Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
// ==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('&nbsp;<input id="searchbox" type="text" placeholder="Search thread" name="q" value="" size="25">&nbsp;')
.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
You can’t perform that action at this time.