Skip to content

Instantly share code, notes, and snippets.

@shellexy
Created January 6, 2018 11:44
Show Gist options
  • Save shellexy/5df71f97cba36543e9a6f089fe1ee6cd to your computer and use it in GitHub Desktop.
Save shellexy/5df71f97cba36543e9a6f089fe1ee6cd to your computer and use it in GitHub Desktop.
去除网页样式的 bookmarklet 书签工具
javascript:
(function(){
if (f=document.querySelector('frame[name="Main"]')) {
window.location.href = f.src;
}
document.body.style.margin = "10%";
document.body.style.lineHeight = "2em";
document.body.bgColor = "#F5F5B5";
document.body.text = "#000000";
document.onmousedown = 0;
document.onselectstart = 0;
document.oncontextmenu = 0;
document.onclick = null;
document.body.onmousedown = 0;
document.body.onselectstart = 0;
document.body.oncontextmenu = 0;
document.body.onclick = null;
for (i = 0; i < document.styleSheets.length; i++) {
void(document.styleSheets.item(i).disabled = true);
}
NodeList.prototype.forEach = Array.prototype.forEach;
NodeList.prototype.filter = Array.prototype.filter;
document.body.querySelectorAll(':not(a)').forEach(function(e){ e.style.cssText = 'color: black; background-color: #F5F5B5' });
document.querySelectorAll('iframe').forEach(function(e){ e.style.cssText = 'width: 90%; height: 90%' });
document.querySelectorAll('object, embed, applet, script').forEach(function(e){ e.parentNode.removeChild(e) });
document.querySelectorAll('img').forEach(function(e){ e.style.maxWidth='100%'; e.removeAttribute('width'); e.removeAttribute('height'); });
document.querySelectorAll('a[style*="position: absolute"]').forEach(function(e){ e.style.cssText = "" });
document.querySelectorAll('img[src$="\.jpg\.thumb\.jpg"]').forEach(function(e){e.src = e.src.replace('.jpg.thumb.jpg', '.jpg') });
void 0;
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment