Created
December 6, 2013 02:18
-
-
Save amitrogye/7817543 to your computer and use it in GitHub Desktop.
sncsublimehelper
This file contains 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
window.bookmarklet = function(opts) { | |
fullFunc(opts) | |
}; | |
// These are the styles, scripts and callbacks we include in our bookmarklet: | |
window.bookmarklet({ | |
css: ['https://gist.github.com/amitrogye/7817587/raw/82e387657a00eec730c9e61fd6200a40de774479/vanillabox.css'], | |
js: ['https://gist.github.com/amitrogye/7817595/raw/d2a969b0dd2c7fd6dbf848acdb99a9515cb9ca1a/jquery.vanillabox-0.1.3.min.js'], | |
// jqpath : 'myCustomjQueryPath.js', <-- option to include your own path to jQuery | |
ready: function() { | |
// The meat of your jQuery code goes here | |
//jQuery("body").html("Hello World"); | |
//alert('Hello world'); | |
jQuery('.foobar a').vanillabox(); | |
} | |
}) | |
function fullFunc(a) { | |
function d(b) { | |
if (b.length === 0) { | |
a.ready(); | |
return false | |
} | |
jQuery.getScript(b[0], function() { | |
d(b.slice(1)) | |
}) | |
} | |
function e(b) { | |
jQuery.each(b, function(c, f) { | |
jQuery("<link>").attr({ | |
href: f, | |
rel: "stylesheet" | |
}).appendTo("head") | |
}) | |
} | |
a.jqpath = a.jqpath || "https://gist.github.com/amitrogye/7818396/raw/2a40d4c01711011eb4a0e9ae5536a78a512b401c/jquery-2.0.3.min.js"; | |
(function(b) { | |
var c = document.createElement("script"); | |
c.type = "text/javascript"; | |
c.src = b; | |
c.onload = function() { | |
e(a.css); | |
d(a.js) | |
}; | |
document.body.appendChild(c) | |
})(a.jqpath) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment