Last active
September 27, 2016 10:08
-
-
Save hfhchan/1f9f88c8c300ccfe2086a2ae43ef9f6b to your computer and use it in GitHub Desktop.
Use SVG for Glyphwiki
This file contains 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 Glyphwiki use svg | |
// @namespace https://github.com/hfhchan | |
// @include http://glyphwiki.org/* | |
// @include http://en.glyphwiki.org/* | |
// @include http://zht.glyphwiki.org/* | |
// @include http://zhs.glyphwiki.org/* | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
console.log('hi') | |
Array.prototype.slice.call(document.querySelectorAll('img.thumb, img.glyph')).forEach(function(el){ | |
var src = el.src; | |
if (src.indexOf('error') !== -1) { | |
return; | |
} | |
src = src.replace('.50px.png','.svg'); | |
src = src.replace('.100px.png','.svg'); | |
src = src.replace('.png','.svg'); | |
el.src = src; | |
el.style.background = '#fff'; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment