TealDeer

Search and Tagged for Tumblr themes

Jan 18th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.56 KB | None | 0 0
  1. //THIS PART GOES ABOVE THE </head> TAG IN YOUR THEME. REMEMBER TO REPLACE 'YOURNAME' WITH YOUR TUMBLR NAME
  2. <script type="text/javascript">
  3.     <!--
  4.    function handleThis(formElm)
  5.    {
  6.        window.location="http://YOURNAME.tumblr.com/search/"+formElm.number.value+"";
  7.     return false;
  8.    }
  9.    // -->
  10.   </script>
  11.   <script type="text/javascript">
  12.     <!--
  13.    function handleThat(formElm)
  14.    {
  15.        window.location="http://YOURNAME.tumblr.com/tagged/"+formElm.number.value+"";
  16.     return false;
  17.    }
  18.    // -->
  19.   </script>
  20.  
  21. //LOCATE THE SEARCH BLOCK IN YOUR THEME. IN MY THEME IT'S: {block:IfSearchBoxInSidebar}
  22.  
  23. //REPLACE THE CONTENTS OF THE SEARCH BLOCK (between {block:whatever} and {/block:whatever}) WITH THE FOLLOWING:
  24. <div id="search">
  25.           <form id="search-form" method="get" onsubmit="return handleThis(this)" style="margin-bottom:4px;">
  26.             <input type="text" name="number" value="Text Search" onblur="this.value = this.value || this.defaultValue;"  onfocus="this.value == this.defaultValue && (this.value = '');" />
  27.             <span class="right"></span>
  28.           </form>
  29.           <form id="search-form" method="get" onsubmit="return handleThat(this)">
  30.             <input type="text" name="number" value="Tag Search" onblur="this.value = this.value || this.defaultValue;"  onfocus="this.value == this.defaultValue && (this.value = '');" />
  31.             <span class="right"></span>
  32.           </form>
  33. </div>
  34.  
  35. //THIS SHOULD RESULT IN TWO SEARCH BARS IN THE SIDEBAR. ONE WILL SAY 'Text Search' AND ONE WILL SAY 'Tag Search'
Advertisement
Add Comment
Please, Sign In to add comment