jquery-scroll testing bookmarklet

This bookmarklet enables you to test the unobtrusive jquery-scroll plugin on your webpage before implementing it. The scrollbar of all elements with an overflow of auto or scroll will be replaced with a custom scrollbar.

Drag this link to your Bookmarks Bar : jquery-scroll testing

view formatted bookmarklet source
(function(){
  if(typeof jQuery == 'undefined' || jQuery.fn.jquery.split(".")[1] < 4 || jQuery.fn.jquery.split(".")[2] < 2){
    var otherlib = typeof $ == 'function';
    loadJQuery(function(){
      if(otherlib) jQuery.noConflict();
      loadScrollbar();
    });
  } else {
    loadScrollbar();
  }

  function loadScrollbar(){
    jQuery('head').append('');
    jQuery('head').children(':last').attr({
      type : 'text/css',
      rel  : 'stylesheet',
      href : 'http://thomd.github.com/jquery-scroll/bookmarklet.css'
    });
    jQuery.getScript('https://raw.github.com/thomd/jquery-scroll/master/jquery.scroll.js', function(){
      jQuery('*').filter(function(){return jQuery(this).css('overflow').match(/auto|scroll/) || jQuery(this).css('overflow-y').match(/auto|scroll/)}).scrollbar();
    });
  }

  function loadJQuery(fn){
    var script = document.createElement('script');
    script.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js';
    var done = false;
    script.onload = script.onreadystatechange = function(){
      if (!done && (!this.readyState || this.readyState == 'loaded' || this.readyState == 'complete')) {
        done = true;
        fn();
      }
    };
    document.getElementsByTagName('head')[0].appendChild(script);
  }
})();