Skip to content

Instantly share code, notes, and snippets.

View keropodium's full-sized avatar
💥

keropodium

💥
  • ¯\_(ツ)_/¯
  • Alicante, Spain
View GitHub Profile
@jabranr
jabranr / harlem-shake-snippet.js
Last active June 29, 2023 15:01
Harlem Shake JavaScript bookmarklet
/**
* 1. Save the following JavaScript snippet as browser bookmark
* 2. Visit a webpage and click on saved bookmark
* 3. Watch the webpage elements dance
* Original story by Mozilla - https://hacks.mozilla.org/2014/02/html5-css3-and-the-bookmarklet-that-shook-the-web/
*/
javascript:(function(){function c(){var e=document.createElement("link");e.setAttribute("type","text/css");e.setAttribute("rel","stylesheet");e.setAttribute("href",f);e.setAttribute("class",l);document.body.appendChild(e)}function h(){var e=document.getElementsByClassName(l);for(var t=0;t<e.length;t++){document.body.removeChild(e[t])}}function p(){var e=document.createElement("div");e.setAttribute("class",a);document.body.appendChild(e);setTimeout(function(){document.body.removeChild(e)},100)}function d(e){return{height:e.offsetHeight,width:e.offsetWidth}}function v(i){var s=d(i);return s.height>e&&s.height<n&&s.width>t&&s.width<r}function m(e){var t=e;var n=0;while(!!t){n+=t.offsetTop;t=t.offsetParent}return n}function g(){var e=docume