Last active
April 10, 2017 00:10
-
-
Save boboben1/36cdb5aeff8f4dc362e61ada6869d500 to your computer and use it in GitHub Desktop.
UC Search With Google
This file contains 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 UC Searcher | |
// @namespace boboben1 | |
// @description Searches on unknowncheats.me through google | |
// @include http*://www.unknowncheats.me/forum/* | |
// @version 1 | |
// @grant GM_addStyle | |
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js | |
// @require https://gist.githubusercontent.com/boboben1/231f5d3f93a0b8204d3a3c0a0ca7a86d/raw/6510dbdf4426ed559d92d37daa10de4aef8aaf13/waitForKeyElements.js | |
// ==/UserScript== | |
this.$ = this.jQuery = jQuery.noConflict(true); | |
$(document).ready(function() { | |
var cx = '016999169009260102639:k47nqrnf6ta'; | |
var gcse = document.createElement('script'); | |
var checker = 0; | |
gcse.type = 'text/javascript'; | |
gcse.async = true; | |
gcse.src = 'https://cse.google.com/cse.js?cx=' + cx; | |
var s = document.getElementsByTagName('script')[0]; | |
s.parentNode.insertBefore(gcse, s); | |
var checker_2 = 0; | |
function checker_2_fn() | |
{ | |
if ($(".gsc-results-wrapper-visible").length > 0) { | |
checker_2 = 0; | |
$("#___gcse_0").show(); | |
checker = setInterval(function() { | |
var show = $(".gsc-results-wrapper-overlay").hasClass("gsc-results-wrapper-visible"); | |
if (!show) | |
{ | |
$("#___gcse_0").hide(); | |
clearInterval(checker); | |
} | |
}, 200); | |
} else { | |
setTimeout(function(){checker_2_fn();}, 200); | |
} | |
} | |
var Go = $("#Table1 > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(2) > div:nth-child(1) > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(5) > td:nth-child(1) > div:nth-child(5) > input:nth-child(2)"); | |
Go.after("<input type='button' class='button' value='Search Google' id='SearchGoogle'/>"); | |
Go.after("<gcse:search></gcse:search>"); | |
$("#SearchGoogle").click(function() { | |
var query = $("#Table1 > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(2) > div:nth-child(1) > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(5) > td:nth-child(1) > div:nth-child(5) > input:nth-child(1)").val(); | |
$("#gsc-i-id1").val(query); | |
$("input.gsc-search-button").click(); | |
if (checker_2 == 0) | |
{ | |
setTimeout(function(){checker_2_fn();}, 0); | |
checker_2 = 1; | |
} | |
//waitForKeyElements(".gsc-results-wrapper-visible", function(elem){ | |
//}, true); | |
}); | |
waitForKeyElements("#___gcse_0", function(elem) { | |
elem.hide(); | |
}, true); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment