Bookmarklets, Miscellaneous
To use these, just drag them to your bookmarks file. I can't take credit for these, but I can never find where I found them, so I put copies here. Send me a note if you know from whence they came.
Toggle Table Borders v.1:
Source
<a href="javascript:for(i=0;i<document.all.length;i++)if(document.all[i].tagName=='TABLE')void(document.all[i].border=(document.all[i].border=='0')?'1':'0');">TogTable</a>
ToggleCSS v.1
Source
<a href="javascript:var%20i=0;if(document.styleSheets.length%3E0){cs=!document.styleSheets[0].disabled;for(i=0;i%3Cdocument.styleSheets.length;i++)%20document.styleSheets[i].disabled=cs;}void(cs=true);">TogCSS</a>
Toggle Table Borders v.2 (new and improved, submitted by Reid)
Source
<a href="javascript:for(i=0;i<document.getElementsByTagName('TABLE').length;i++)void(document.getElementsByTagName('TABLE')[i].border=(document.getElementsByTagName('TABLE')[i].border=='0')?'1':'0');">TogTable</a>
goToRSSFeed v.1
Source
<a href="javascript:els=document.getElementsByTagName('link');feeds='';for(i=0;i<els.length;i++){ty=(els[i].getAttribute('type')||'').toLowerCase();url=els[i].getAttribute('href');if(url&&(ty=='application/rss+xml'||ty=='text/xml'||ty=='text/x-opml')){if(window.confirm('Go to the RSS Feed: '+url+'?')){feeds+=url+',';}}}if(!feeds){window.alert('No subscriptions made');}else{feeds=feeds.substr(0,feeds.length-1);window.location=feeds;}">goToRSSFeed</a>
goToRSSFeed v.2
Source
var els = document.getElementsByTagName('link');
feeds = '';
for (i = 0; i < els.length; i++) {
ty = (els[i].getAttribute('type') || '').toLowerCase();
url = els[i].getAttribute('href');
if (url && (ty == 'application/rss+xml' || ty == 'text/xml' || ty == 'text/x-opml')) {
if (window.confirm('Go to the RSS Feed: ' + url + '?')) {
feeds += url + ',';
}
}
}
if (!feeds) {
window.alert('No subscriptions made');
} else {
feeds = feeds.substr(0, feeds.length - 1);
window.location = feeds;
}
Re-enable Right Click
Many websites disable right click, let's try to re-enable it by checking for oncontextmenu events and nuking them.
Source Code
// This is a draft. Might not pan out.
// naive attempt based on oncontextmenu attributes
document.querySelectorAll('[oncontextmenu]').forEach(function (element) {
console.log('removing oncontextmenu from element', element);
element.removeAttribute('oncontextmenu');
});
// naive attempt based on onmousedown attributes
document.querySelectorAll('[onmousedown]').forEach(function (element) {
console.log('removing onmousedown from element', element);
element.removeAttribute('onmousedown');
});
// naive attempt based on onmouseup attributes
document.querySelectorAll('[onmouseup]').forEach(function (element) {
console.log('removing onmouseup from element', element);
element.removeAttribute('onmouseup');
});
// naive attempt based on onselectstart attributes
document.querySelectorAll('[onselectstart]').forEach(function (element) {
console.log('removing onselectstart from element', element);
element.removeAttribute('onselectstart');
});
// naive attempt based on ondragstart attributes
document.querySelectorAll('[ondragstart]').forEach(function (element) {
console.log('removing ondragstart from element', element);
element.removeAttribute('ondragstart');
});
// naive attempt based on ondrag attributes
document.querySelectorAll('[ondrag]').forEach(function (element) {
console.log('removing ondrag from element', element);
element.removeAttribute('ondrag');
});
// naive attempt based on ondragend attributes
document.querySelectorAll('[ondragend]').forEach(function (element) {
console.log('removing ondragend from element', element);
element.removeAttribute('ondragend');
});