Created
April 7, 2017 17:51
-
-
Save zonuexe/f847cf0d99a45a4db0e7b5077b093f96 to your computer and use it in GitHub Desktop.
pixelart-pixelated.js
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
var newStyle = document.createElement('style'); newStyle.type = "text/css"; | |
document.getElementsByTagName('head').item(0).appendChild(newStyle); | |
var css = document.styleSheets.item(0); | |
css.insertRule(".__pixelart{ image-rendering: pixelated }", 0); | |
var x = Array.prototype.map.call(document.querySelectorAll('.Item'), function(i){ | |
var t = i.querySelectorAll('.ItemText a'); | |
var isPixelArt = !!Array.prototype.filter.call(t, function(v){ return /ドット|dot|pixel/.test(v.innerText); }).length; | |
var isIronbeads = !Array.prototype.filter.call(t, function(v){ return /アイロンビーズ/.test(v.innerText); }).length; | |
if (isPixelArt && !isIronbeads) { | |
var img = i.querySelector('img.MediaBody'); | |
img.classList.add("__pixelart"); | |
console.log(img); | |
} | |
return i; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment