Last active
November 14, 2016 07:21
-
-
Save justdanpo/a08a101e0a0079957f8b5da75295fa7f to your computer and use it in GitHub Desktop.
Center Image
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
// ==UserScript== | |
// @name Center Image | |
// @namespace https://gist.github.com/justdanpo | |
// @version 0.2 | |
// @description Open images centered | |
// @author den_po | |
// @match http://*/* | |
// @match https://*/* | |
// @match file://* | |
// @run-at document-end | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
if ((1 === document.body.childNodes.length) && | |
("IMG" === document.body.childNodes[0].nodeName) && | |
(document.body.childNodes[0].src == document.URL) | |
) { | |
document.body.style.display = "-webkit-box"; | |
document.body.style.textAlign = "-webkit-center"; | |
document.body.style.webkitBoxAlign = "center"; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment