Advertisement
mspotilas

clear button for CSE search results

Jan 20th, 2012
690
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   // clear button for CSE search results / MS-potilas 2012
  2.   $(window).load(function() { window.setTimeout(function() {
  3.     var xele=$("<a href='javascript:void()' onclick='customSearchControl.clearAllResults();$(&quot;#cseclr&quot;).hide();' id='cseclr' style='display:none;position:absolute;right:9px;top:1px;'><img title='Clear search results' src='http://www.google.com/uds/css/clear.gif' style='border:1px solid #eee;'/></a>");
  4.     $("#cse").before(xele);
  5.     $("#cse-search-form .gsc-clear-button").click(function() { $("#cseclr").hide(); });
  6.     $("#cse-search-form input.gsc-search-button").click(function() { if($("#cse-search-form input.gsc-input")[0].value != "") window.setTimeout(function(){ $("#cseclr").show();}, 250); else $("#cseclr").hide(); });
  7.     if(searchPhrase != "") $("#cseclr").show();
  8.   }, 500); });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement