Last active
May 7, 2016 16:15
-
-
Save heptal/e2be8faf542bd2b01ebfd2699a0d1c82 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name SAThreadSearch | |
// @namespace forums.somethingawful.com | |
// @version 0.2 | |
// @description Inline thread search | |
// @author Me | |
// @match http://forums.somethingawful.com/showthread.php* | |
// @match https://forums.somethingawful.com/showthread.php* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
$('<form action="query.php" method="post" class="threadsearch">') | |
.append(' <input id="searchbox" type="text" placeholder="Search thread" name="q" value="" size="25"> ') | |
.append('<input type="submit" class="bginput" name="Submit" value="GO">') | |
.append('<input type="hidden" name="action" value="query">') | |
.submit(function(event) { | |
$('#searchbox').attr('value', function(i, val) { | |
val = val.replace(/threadid:\d+\s+/g, ''); | |
if (val === "") { event.preventDefault(); return; } | |
return 'threadid:' + $('#something_awful').data('thread') + ' ' + val; | |
}); | |
}).insertAfter($('.top .thread_bookmark')); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment