Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Use SVG for Glyphwiki
// ==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
You can’t perform that action at this time.