Created
April 13, 2012 17:14
-
-
Save johnkpaul/2378436 to your computer and use it in GitHub Desktop.
Change the default Javascript library on jsFiddle to jQuery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @match http://jsfiddle.net/* | |
// ==/UserScript== | |
// @author: John K. Paul @johnkpaul | |
// @license: http://www.opensource.org/licenses/MIT | |
// http://johnkpaul.tumblr.com/post/21030300518/changing-jsfiddles-default-library-to-jquery | |
(function(){ | |
var script = document.createElement('script'); | |
script.appendChild(document.createTextNode('('+ main +')();')); | |
document.body.appendChild(script); | |
//written in mootools out of respect to Piotr Zalewa :) | |
function main(){ | |
var js_lib = document.id('js_lib'), | |
is_root = new URI(window.location).get('directory') === '/', | |
jq_opt_group = js_lib.getElement("[label=jQuery]"), | |
latest_jq_val = jq_opt_group.getElement(">").value; | |
if(is_root){ | |
js_lib.value = latest_jq_val; | |
} | |
} | |
}()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment