tkrkt
6/30/2015 - 9:06 AM

SlideShareのテキスト文字参照化を直すグリモン

SlideShareのテキスト文字参照化を直すグリモン

// ==UserScript==
// @name        SlideShare-FixCharacterReference
// @namespace   jp.tkrkt
// @include     http://www.slideshare.net/*
// @version     1
// @grant       none
// ==/UserScript==

//https://gist.github.com/myaumyau/4975024
function hexNumRefToString(hexNumRef) {
    return hexNumRef.replace(/&#x([0-9a-f]+);/ig, function(match, $1, idx, all) {
	    return String.fromCharCode('0x' + $1);
	});
}

var elems = document.querySelectorAll('.transcripts li[itemprop=text]');
Array.prototype.forEach.call(elems, function(elem){
  elem.textContent = hexNumRefToString(elem.textContent);
});