Skip to content

Instantly share code, notes, and snippets.

@ddrscott
Last active October 19, 2018 14:34
Show Gist options
  • Save ddrscott/a367b46dbda5ffb36d4f14c698375d4f to your computer and use it in GitHub Desktop.
Save ddrscott/a367b46dbda5ffb36d4f14c698375d4f to your computer and use it in GitHub Desktop.
(function(){
function handleClick(e) {
const r = Math.random();
if (r > 0.1) {
console.log("not yet: ", r);
return true;
}
e.preventDefault();
e.stopPropagation();
s = document.body.style;
if (s.transform === "rotate(180deg)") {
s.transform = "";
} else {
s.transform = "rotate(180deg)";
console.log("flip! ", r);
}
return false;
}
document.querySelectorAll('a').forEach((a) => a.onclick = handleClick);
document.body.style.transition = 'all .2s ease'
})();
{
"manifest_version": 2,
"name": "Flip",
"description": "(╯°□°)╯︵ ┻━┻",
"version": "0.1",
"content_scripts": [
{
"matches": [
"*://*/*"
],
"js": [
"flip.js"
],
"run_at": "document_end"
}
]
}
@ddrscott
Copy link
Author

flip-demo

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