LinHES Forums
http://forum.linhes.org/

Search KnoppMyth forum with Firefox keywords & Greasemon
http://forum.linhes.org/viewtopic.php?f=3&t=14610
Page 1 of 1

Author:  crushinator [ Sat Mar 17, 2007 10:11 pm ]
Post subject:  Search KnoppMyth forum with Firefox keywords & Greasemon

Just like everyone else, I depend on the KnoppMyth forums to shepherd me through the wondrous, endless joy that is MythTV. But the PHP search page feels cumbersome to go to and use. One tip for quick access is to use Firefox keyword searching (http://www.mozilla.org/products/firefox ... words.html).

For example, I set "km" to search KnoppMyth forums:
Code:
km r5e50 and mount and usb and key

But notice that I have to use "and" between keywords, otherwise it performs an "or" search. I think this is because the KnoppMyth PHP search page defaults to "ANY" keywords versus "ALL" keywords.

Well, I got kind of tired of typing "and" all the time. So instead I used a combination of Greasemonkey, Platypus (a firefox extension for generating Greasemonkey scripts), and an IMDB script from userscript.org to adjust the KnoppMyth search page to my liking:

1. Set "kms" as firefox keyword to point to http://mysettopbox.tv/phpBB2/search.php

2. Install the following Greasemonkey script (based on the IMDB focus script http://userscripts.org/scripts/show/1528)

Code:
// ==UserScript==
// @name          Focus KnoppMyth search
// @namespace     http://felixfamily.net/gm
// @description     Focus the search box when KnoppMyth search loads.
// @include       http://mysettopbox.tv/phpBB2/search.php
// @author        Michael Felix, gm@mfelix.allmail.net
// ==/UserScript==

function do_platypus_script() {
do_modify_html_it(window.document,document.evaluate('/HTML[1]/BODY[1]/TABLE[1]/TBODY[1]/TR[1]/TD[1]/FORM[1]/TABLE[2]/TBODY[1]/TR[2]/TD[2]/SPAN[1]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue,/"search_terms" value="any" checked="checked"/,'"search_terms" value="any" ',null);
do_modify_html_it(window.document,document.evaluate('/HTML[1]/BODY[1]/TABLE[1]/TBODY[1]/TR[1]/TD[1]/FORM[1]/TABLE[2]/TBODY[1]/TR[2]/TD[2]/SPAN[1]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue,/name="search_terms" value="all"/,'name="search_terms" value="all" checked="checked"',null);
do_modify_html_it(window.document,document.evaluate('/HTML[1]/BODY[1]/TABLE[1]/TBODY[1]/TR[1]/TD[1]/TABLE[1]/TBODY[1]/TR[1]/TD[2]/SPAN[1]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue,/mysettopbox.tv/,'mysettopbox.tv with pickles',null);

var inputs = document.getElementsByTagName('input');
    for (var i = 0; i < inputs.length; i++){
       if (inputs[i].name == 'search_keywords'){
          inputs[i].focus();
          return;
       }   
 };

}; // Ends do_platypus_script

window.addEventListener("load", function() { do_platypus_script() }, false);

//
//  Mon Dec 19 15:59:37 2005 -- Scott R. Turner
//  Short, uncommented file containing all the code to implement Platypus
//  actions.  Can be "included" into the Platypus script.
//
//
//

function do_modify_html_it(doc, element, match_re, replace_string) {
    match_re = new RegExp(match_re);
    if (element.innerHTML) {
element.innerHTML = element.innerHTML.replace(match_re, replace_string);
    };
};


3. So to quickly search the KnoppMyth forums, I hit "Alt-D" to focus on Firefox address bar, I type "kms" to go to the KnoppMyth search page, then the script will automatically hit the "Search ALL keywords" button, then will put the insertion point focus on the "Search Keywords" field. Now I can quickly type my search terms, e.g. "r5e50 mount usb key" and get search results!

It would be even nicer if the web-host could adjust the PHP search page to default to "ALL" search terms, because then a simple Firefox keyword search would be enough.

p.s.
I've also made similar keywords to search the KnoppMyth Wiki "kw", MythTV mailing list "m".

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/