Skip to content

Instantly share code, notes, and snippets.

@hfhchan
Last active September 27, 2016 10:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hfhchan/1f9f88c8c300ccfe2086a2ae43ef9f6b to your computer and use it in GitHub Desktop.
Save hfhchan/1f9f88c8c300ccfe2086a2ae43ef9f6b to your computer and use it in GitHub Desktop.
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