Skip to content

Instantly share code, notes, and snippets.

@fpiesche
Last active August 29, 2018 21:24
Show Gist options
  • Save fpiesche/5d86231c269bf9fb0e1e7ba217836293 to your computer and use it in GitHub Desktop.
Save fpiesche/5d86231c269bf9fb0e1e7ba217836293 to your computer and use it in GitHub Desktop.
Power Mode for mastodon.social

POWER BOOPS

Here's a fun little bookmarklet for use with Mastodon! Create a link with this "URL" in your bookmarks toolbar and click it when looking at mastodon.social (or whatever other instance you use) to ACTIVATE POWER MODE:

javascript:void%20function(){(function(t,e){%22object%22==typeof%20exports%26%26%22object%22==typeof%20module%3Fmodule.exports=e():%22function%22==typeof%20define%26%26define.amd%3Fdefine([],e):%22object%22==typeof%20exports%3Fexports.POWERMODE=e():t.POWERMODE=e()})(this,function(){return%20function(t){function%20e(n){if(o[n])return%20o[n].exports;var%20i=o[n]={exports:{},id:n,loaded:!1};return%20t[n].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var%20o={};return%20e.m=t,e.c=o,e.p=%22%22,e(0)}([function(t,e,o){%22use%20strict%22;function%20n(t,e){return%20Math.random()(e-t)+t}function%20i(t){if(a.colorful){var%20e=n(0,360);return%22hsla(%22+n(e-10,e+10)+%22,%20100%25,%20%22+n(50,80)+%22%25,%201)%22}return%20window.getComputedStyle(t).color}function%20r(t,e,o){return{x:t,y:e,alpha:1,color:o,velocity:{x:-1+2Math.random(),y:-3.5+2Math.random()}}}function%20a(t){if(%22Favourite%22==t.target.getAttribute(%22title%22)){for(var%20e={x:t.pageX,y:t.pageY,color:i()},o=5+Math.round(10Math.random());o--;)u[f]=r(e.x,e.y,e.color),f=(f+1)%25500;if(a.shake){var%20n=1+2Math.random(),d=n(Math.random()%3E.5%3F-1:1),c=n*(Math.random()%3E.5%3F-1:1);document.body.style.marginLeft=d+%22px%22,document.body.style.marginTop=c+%22px%22,setTimeout(function(){document.body.style.marginLeft=%22%22,document.body.style.marginTop=%22%22},75)}}}function%20d(){requestAnimationFrame(d),l.clearRect(0,0,c.width,c.height);for(var%20t=0;t%3Cu.length;++t){var%20e=u[t];e.alpha%3C=.1||(e.velocity.y+=.075,e.x+=e.velocity.x,e.y+=e.velocity.y,e.alpha*=.96,l.globalAlpha=e.alpha,l.fillStyle=e.color,l.fillRect(Math.round(e.x-1.5),Math.round(e.y-1.5),3,3))}}var%20c=document.createElement(%22canvas%22);c.width=window.innerWidth,c.height=window.innerHeight,c.style.cssText=%22position:fixed;top:0;left:0;pointer-events:none;z-index:999999%22,window.addEventListener(%22resize%22,function(){c.width=window.innerWidth,c.height=window.innerHeight}),document.body.appendChild(c);var%20l=c.getContext(%222d%22),u=[],f=0;a.shake=!0,a.colorful=!0,requestAnimationFrame(d),t.exports=a},function(t,e){(function(){null!=window.mozInnerScreenX})()}])}),document.body.addEventListener(%22click%22,POWERMODE),new%20Notification(%22POWER%20MODE%20ACTIVATED%22)}();

This runs mostly on this Javascript port of POWER MODE, with minor modifications to go for clicks rather than text cursors and only run on Mastodon's Favourite button.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment