Skip to content

Instantly share code, notes, and snippets.

@winguse
Created February 26, 2018 13:13
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 winguse/077bdb923dd91580aeda548a26513cb4 to your computer and use it in GitHub Desktop.
Save winguse/077bdb923dd91580aeda548a26513cb4 to your computer and use it in GitHub Desktop.
function b64DecodeUnicode(str) {
return decodeURIComponent(Array.prototype.map.call(atob(str), function(c) {
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2)
}).join(''))
}
var reg = /([A-Za-z0-9+\/=]{10,})/g;
document.querySelectorAll('p,span').forEach(e => {
var txt = e.innerHTML;
if (txt.indexOf('<') >= 0) return;
try { e.innerHTML = txt.replace(reg, b64DecodeUnicode); } catch (err) { }
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment