Skip to content

Instantly share code, notes, and snippets.

@zonuexe
Created April 7, 2017 17:51
Show Gist options
  • Save zonuexe/f847cf0d99a45a4db0e7b5077b093f96 to your computer and use it in GitHub Desktop.
Save zonuexe/f847cf0d99a45a4db0e7b5077b093f96 to your computer and use it in GitHub Desktop.
pixelart-pixelated.js
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