2 // @name Flickr Move Additional Info
3 // @namespace http://6v8.gamboni.org/
4 // @description Move photos additional informations on top of the group/set list
6 // @identifier http://6v8.gamboni.org/IMG/js/flickrmoveadditionalinfo.user.user.js
8 // @creator Pierre Andrews (mortimer.pa@free.fr)
9 // @include http://*flickr.com/photos/*/*
10 // @exclude *flickr.com/photos/*/alltags*
11 // @exclude http://*flickr.com/photos/organize*
14 // --------------------------------------------------------------------
16 // This is a Greasemonkey user script.
18 // To install, you need Greasemonkey: http://greasemonkey.mozdev.org/
19 // Then restart Firefox and revisit this script.
20 // Under Tools, there will be a new menu item to "Install User Script".
21 // Accept the default configuration and install.
23 // --------------------------------------------------------------------
24 // Copyright (C) 2006 Pierre Andrews
26 // This program is free software; you can redistribute it and/or
27 // modify it under the terms of the GNU General Public License
28 // as published by the Free Software Foundation; either version 2
29 // of the License, or (at your option) any later version.
31 // This program is distributed in the hope that it will be useful,
32 // but WITHOUT ANY WARRANTY; without even the implied warranty of
33 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34 // GNU General Public License for more details.
36 // The GNU General Public License is available by visiting
37 // http://www.gnu.org/copyleft/gpl.html
39 // Free Software Foundation, Inc.
40 // 51 Franklin Street, Fifth Floor
41 // Boston, MA 02110-1301
49 name: "Move Additional Info",
50 namespace: "http://6v8.gamboni.org/",
51 description: "Move photos additional informations on top of the group/set list",
52 identifier: "http://6v8.gamboni.org/IMG/js/flickrmoveadditionalinfo.user.js",
53 version: "0.3", // version
54 date: (new Date("2006-01-29")) // update date
60 if(unsafeWindow.console)
61 unsafeWindow.console.log(arguments);
66 function getObjectMethodClosure(object, method) {
67 return function(arg) {
68 return object[method](arg);
74 http://ecmanaut.blogspot.com/2006/07/expressive-user-scripts-with-xpath-and.html
76 function $x( xpath, root )
78 var doc = root ? root.evaluate?root:root.ownerDocument : document;
79 var got = doc.evaluate( xpath, root||doc, null, 0, null ), next;
81 while( next = got.iterateNext() )
86 function $x1(xpath,root) {
87 var doc = root ? root.evaluate?root:root.ownerDocument : document;
88 return document.evaluate( xpath,
89 root||doc, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null
93 function foreach( xpath, cb, root )
95 var nodes = $x( xpath, root ), e = 0;
96 for( var i=0; i<nodes.length; i++ )
97 e += cb( nodes[i], i ) || 0;
104 http://ecmanaut.blogspot.com/2006/03/e4x-and-dom.html#import_node
106 function importNode( e4x, doc )
108 var me = importNode, xhtml, domTree, importMe;
109 me.Const = me.Const || { mimeType: 'text/xml' };
110 me.Static = me.Static || {};
111 me.Static.parser = me.Static.parser || new DOMParser;
112 xhtml = <testing xmlns="http://www.w3.org/1999/xhtml" />;
114 domTree = me.Static.parser.parseFromString( xhtml.toXMLString(),
116 importMe = domTree.documentElement.firstChild;
117 while( importMe && importMe.nodeType != 1 )
118 importMe = importMe.nextSibling;
119 if( !doc ) doc = document;
120 return importMe ? doc.importNode( importMe, true ) : null;
123 function appendTo( e4x, node, doc )
125 return node.appendChild( importNode( e4x, doc || node.ownerDocument ) );
129 var flickrmoveadditionalinfo = function() {this.init();}
131 flickrmoveadditionalinfo.prototype = {
134 var before = document.getElementById("otherContexts_div");
136 this.move("/html/body/div[@id='Main']/table[@id='Photo']/tbody/tr/td[2]/h4",before);
137 this.move("/html/body/div[@id='Main']/table[@id='Photo']/tbody/tr/td[2]/p[1]",before);
138 this.move("/html/body/div[@id='Main']/table[@id='Photo']/tbody/tr/td[2]/p[2]",before);
139 this.move("/html/body/div[@id='Main']/table[@id='Photo']/tbody/tr/td[2]/ul",before);
140 this.move("//div[@id='upload_form_container']",before);
141 this.move("//textarea[@id='texty']",before);
144 move: function(xpath,to) {
145 var node = $x1(xpath);
147 to.parentNode.insertBefore(node,to);
150 //======================================================================
153 window.addEventListener("load", function () {
156 // update automatically (http://userscripts.org/scripts/show/2296)
157 win.UserScriptUpdates.requestAutomaticUpdates(SCRIPT);
160 var flickrgp = new flickrmoveadditionalinfo();