Last active
December 23, 2015 17:09
-
-
Save zakelfassi/6666410 to your computer and use it in GitHub Desktop.
Do you ever feel the need to adjust the font-size of a page ?
Just run this code in your Console (Chrome dev tools/Firebug/...) and select some text !
// note that this code was written under 60seconds just to read this post : http://lifehacker.com/a-scientific-guide-to-saying-no-1293242273 Chrome extension coming soon. Maybe.
This file contains hidden or 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
(function() { | |
function setSelectedSize(s) { | |
var arr = document.getElementsByTagName(window.getSelection().baseNode.parentNode.tagName); | |
for(var i=0; i<arr.length; i++) { | |
arr[i].style.fontSize = "" + s + "px"; | |
} | |
} | |
window.addEventListener("mouseup", function() { | |
if(window.getSelection().type == "Range") { | |
s = prompt("New font size ?", ""); | |
setSelectedSize(s); | |
} | |
}); | |
})(); | |
/** | |
* as a bookmarklet | |
* | |
/ | |
// javascript:(function(){function e(e){var t=document.getElementsByTagName(window.getSelection().baseNode.parentNode.tagName);for(var n=0;n<t.length;n++){t[n].style.fontSize=""+e+"px"}}window.addEventListener("mouseup",function(){if(window.getSelection().type=="Range"){s=prompt("New font size ?","");e(s)}})})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment