Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
gremlins.js bookmarklet
(function (e, a, h, f, c, b, d) {
c = a.createElement("script");
c.type = "text/javascript";
c.src = "https://rawgithub.com/marmelab/gremlins.js/master/gremlins.min.js";
c.onload = c.onreadystatechange = function () {
if (!b && (!(d = this.readyState) || d == "loaded" || d == "complete")) {
h();
f(c).remove()
}
};
a.documentElement.childNodes[0].appendChild(c);
})(window, document, function () { gremlins && gremlins.createHorde().unleash(); });
javascript:(function(e,a,h,f,c,b,d){c=a.createElement("script");c.type="text/javascript";c.src="https://rawgithub.com/marmelab/gremlins.js/master/gremlins.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h();f(c).remove()}};a.documentElement.childNodes[0].appendChild(c);})(window,document,function(){gremlins&&gremlins.createHorde().unleash();});
@artoliukkonen

This comment has been minimized.

Copy link

commented Mar 17, 2014

If tested site is using RequireJS this bookmarklet won't work. Here's a working version for this case (optimal would ofc be one script for all cases, however this is enough for me..).

require.config({
    paths: { 
        gremlins:  'https://rawgithub.com/marmelab/gremlins.js/master/gremlins.min'
    }
});
require(['gremlins'], function(gremlins) {
    gremlins.createHorde()
        .unleash();
});

Minified for bookmarklet:

javascript:require.config({paths:{gremlins:"https://rawgithub.com/marmelab/gremlins.js/master/gremlins.min"}}),require(["gremlins"],function(a){a.createHorde().unleash()});
@seutje

This comment has been minimized.

Copy link
Owner Author

commented Mar 28, 2014

Neat, I didn't think of that use-case, thanks!
I'll see if I can roll it up in a conditional.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.