Top Menu

Using Wowhead tooltips with tumblr

ilusur:

Wowhead provide a handy piece of javascript that allows you to link to items and spells on their site and have them show up with tooltips automatically. Sadly, tumblr have started redirecting all links through their own URL, which breaks this code’s functionality.

If you’d still like to use the Wowhead tooltips on your tumblr, go and edit your tumblr theme, add the Wowhead script tag in the <head> tag, then add the following code to the bottom of your template, before the </body> tag:

<script type="text/javascript">
  $(document).ready(function() {
    $("a").each(function(index) {
      link_url = decodeURIComponent(this.href).substring(30);
      if (link_url.substring(0,22) == "http://www.wowhead.com") {   
        end_pos = link_url.indexOf("&t");
        if(end_pos != -1){
          link_url = link_url.substring(0, end_pos);
        }            
        this.href = link_url;	
      }
    });
  });
</script>

This bit of jQuery simply searches through the links on your page, and if they’re going to Wowhead, removes tumblr’s redirection which restores the tooltip functionality. Other links are unaffected; and as this is based on your tumblr template, this only works when looking at your blog, not when your posts appear on the dashboard. Here’s an example link: G’Hanir, the Mother Tree.

This is an awesome tip! Thank you!

Powered by WordPress. Designed by WooThemes