- Fixed a bunch of bugs for existing paginations
[FlickrHacks.git] / _greasemonkey_ / flickrgroupsearch.user.js
blob869c86e926bb9903b64dc8c56a7509fa3f21004f
1 // ==UserScript==
2 // @name        Flickr group search
3 // @namespace   http://6v8.gamboni.org/
4 // @description add a direct group search box when you are reading a group thread.
5 // @version        0.1
6 // @identifier  http://6v8.gamboni.org/IMG/js/flickrgroupsearch.user.js
7 // @date           2006-05-24
8 // @creator        Pierre Andrews (mortimer.pa@free.fr)
9 // @include http://*flickr.com/groups/*/discuss/*
10 // ==/UserScript==
12 // --------------------------------------------------------------------
14 // This is a Greasemonkey user script.
16 // To install, you need Greasemonkey: http://greasemonkey.mozdev.org/
17 // Then restart Firefox and revisit this script.
18 // Under Tools, there will be a new menu item to "Install User Script".
19 // Accept the default configuration and install.
21 // --------------------------------------------------------------------
22 // Copyright (C) 2006 Pierre Andrews
23 // 
24 // This program is free software; you can redistribute it and/or
25 // modify it under the terms of the GNU General Public License
26 // as published by the Free Software Foundation; either version 2
27 // of the License, or (at your option) any later version.
28 // 
29 // This program is distributed in the hope that it will be useful,
30 // but WITHOUT ANY WARRANTY; without even the implied warranty of
31 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
32 // GNU General Public License for more details.
33 // 
34 // The GNU General Public License is available by visiting
35 //   http://www.gnu.org/copyleft/gpl.html
36 // or by writing to
37 //   Free Software Foundation, Inc.
38 //   51 Franklin Street, Fifth Floor
39 //   Boston, MA  02110-1301
40 //   USA
43 (function () {
45         var hint = document.evaluate("//td[@id='Hint']/p/a",
46                                                                  document.body, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null
47                                                                  ).singleNodeValue;
48         if(hint) {
49                 var gp_id = hint.href.split('=');
50                 gp_id = gp_id[1];
51                 var search = hint.parentNode.appendChild(document.createElement('span'));
52                 search.className = "TopicListing";
53                 search.innerHTML = '<h4 style="padding-top: 5px;">Or, Search discussions:</h4>\
54                          <form method="get" action="/search/groups/">\
55                          <input type="hidden" value="'+gp_id+'" name="w"/>\
56                          <input type="text" style="width: 130px;" name="q"/>\
57                          <input type="submit" value="SEARCH" class="SmallButt"/>\
58                          </form>';                       
59         }
60         
61 })();