Gist to JSFiddle Bookmarklet
by webxl
HTML
All fields are optional. New fiddle setting will be used if no data provided.
html,js,css
code for specific panels
resources
a comma separated list of external resources
title
title of the fiddle
description
description of the fiddle
normalize_css
yes or no - should normalize.css be loaded before any CSS declarations?
dtd
substring of the chosen DTD (i.e. “html 4”)
http://jsfiddle.net/api/post/{framework}/{version}/
// http://jsfiddle.net/gh/gist/{framework}/{version}/dependencies/{dependency_list}/{gist_id}/
//window.location = "http://jsfiddle.net/gh/gist/mootools/1.2/" + gist;
//
JavaScript
testing = true;
if (!testing) {
root = window.location.protocol + '//' + window.location.host;
if (root == "https://gist.github.com") {
gist = window.location.pathname
} else {
alert("Please use on a valid gist URL");
return;
}
}
if (confirm("Would you like to specify a framework or any dependencies?")) {
}
if (testing) {
gistJSUrl = "https://gist.github.com/raw/1221980/objExtend.js";
} else {
window.gistJSUrl = '';
links = document.getElementsByTagName('a');
for (i = 0; i < links.length; i++) {
l = links[i].getAttribute('href');
if (l.substr(0, 4) == '/raw' && l.substr(-3) == '.js') {
gistJSUrl = l;
}
}
}
if (gistJSUrl == '') {
console.log("raw file could not be extracted");
} else {
s = document.createElement('script');
body = document.getElementsByTagName('body')[0];
body.appendChild(s);
s.src = 'https://raw.github.com/gist/1235941/2fiddle.js';
}