Advertisement
mspotilas

blogger navbar search fix

Oct 13th, 2011
399
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <b:if cond="data:blog.pageType == &quot;index&quot;">
  2. <script type="text/javascript">
  3. //<![CDATA[
  4. // Broken Navbar Search fix hack
  5. // MS-potilas 2011. See http://yabtb.blogspot.com
  6.  
  7.   var qPos = window.location.href.indexOf('/search?q='); // length 10
  8.   if(window.location.href.indexOf('&') == -1 && qPos != -1)
  9.   {
  10.     searchPhrase = decodeURIComponent(window.location.href.substring(qPos+10));
  11.     if(customSearchControl != null) customSearchControl.execute(searchPhrase); // IE works this way
  12.  
  13.     var d = document.getElementById('blog-pager-newer-link');
  14.     if(d) d.parentNode.removeChild(d);
  15.     if(numPosts < 20) { // always 20 (url has no &)
  16.       d = document.getElementById('blog-pager-older-link');
  17.       if(d) d.parentNode.removeChild(d);
  18.     }
  19.     d = document.getElementsByClassName('status-msg-wrap');
  20.     if(d && d.length == 1) {
  21.       d = d[0];
  22.       if(d && !numPosts) d.parentNode.removeChild(d);
  23.  
  24. //    if(numPosts) {
  25. //      d = document.getElementsByClassName('status-msg-body');
  26. //      if(d && d.length == 1) {
  27. //        d = d[0].firstChild;
  28. //        while(d && (d.nodeType != 1 || d.nodeName.toLowerCase() != 'a' || d.href.indexOf('/search?q=') < 0))
  29. //          d = d.nextSibling;
  30. //        if(d) d.parentNode.removeChild(d);
  31. //      }
  32. //    }
  33.     }
  34.   }
  35. //]]>
  36. </script>
  37. </b:if>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement