Last active
December 12, 2017 03:30
-
-
Save nfreear/2987ba2e4c15068c8805 to your computer and use it in GitHub Desktop.
Nick's bookmarklet Javascripts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> <title>*Bookmarklets / bookmark Javascripts (applet, favelet)</title> | |
<style> | |
body { font: 1.05em sans-serif; } | |
#bookmarks li { margin-top: 8px; } | |
#bookmarks a { | |
cursor: auto; | |
cursor: /*alias,*/ url(https://developer.mozilla.org/@api/deki/files/810/=Popicon_1.gif), auto; | |
cursor: move; | |
} | |
#logo { | |
x-background: url(iet-ou-logo-js.svg?fill=%230000ff&size=50px) no-repeat; | |
} | |
#logo svg { | |
width: 50px; | |
height: 50px; | |
} | |
#logo svg g { | |
fill: #aaa; | |
} | |
</style> | |
<!-- | |
https://developer.mozilla.org/en/docs/DOM/window.open | |
https://developer.mozilla.org/en-US/docs/CSS/cursor/url | |
--> | |
<p id=logo > | |
<img data-src="iet-ou-logo-js.svg?fill=#32b4e5;" /> | |
</p> | |
<script> | |
// http://stackoverflow.com/questions/14068031/embedding-external-svg-in-html-for-javascript-manipulation | |
(function svg_load(url, id) { | |
var xhr = new XMLHttpRequest(); | |
xhr.open("GET", url, false); | |
// Following line is just to be on the safe side; | |
// not needed if your server delivers SVG with correct MIME type | |
xhr.overrideMimeType("image/svg+xml"); | |
xhr.send(""); | |
document.getElementById(id) | |
.appendChild(xhr.responseXML.documentElement); | |
})("iet-ou-logo-400px.svg", "logo"); | |
</script> | |
<ul id=bookmarks > | |
<li><a href= | |
"javascript:(function(){f='http://www.delicious.com/save?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'¬es='+encodeURIComponent(''+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text))+'&v=6&';a=function(){if(!window.open(f+'noui=1&jump=doclose','deliciousuiv6','location=1,links=0,scrollbars=0,toolbar=0,width=710,height=660'))location.href=f+'jump=yes'};if(/Firefox/.test(navigator.userAgent)){setTimeout(a,0)}else{a()}})()" | |
>save on delicious</a> | |
<li><a href= | |
"javascript:(function(){scscript=document.createElement('SCRIPT');scscript.type='text/javascript';scscript.src='http://www.scoop.it/resources/bklet/scoop.js?x='+(Math.random());document.getElementsByTagName('head')[0].appendChild(scscript);document.sc_srvurl='http://www.scoop.it'})();" | |
>Scoop.it!</a> | |
<li><a href= | |
"javascript:(function(){s=document.getElementsByTagName('SCRIPT');tx='';sr=[];for(i=0;i<s.length;i++){with(s.item(i)){t=text;if(t){tx+=t;}else{sr.push(src)};}};with(window.open()){document.write('<textarea id="t">'+(sr.join("\n"))+"\n\n-----\n\n"+tx+'</textarea><script src="http://jsbeautifier.org/beautify.js"></script><script>with(document.getElementById("t")){value=js_beautify(value);with(style){width="99%";height="99%";borderStyle="none";}};</script>');document.close();}})();" | |
>See all scripts, by Ichiro Hiroshi</a> | |
<li><a href= | |
"javascript:Qr=window.getSelection?window.getSelection().toString():document.selection.createRange().text;if(!Qr){void(Qr=prompt('Enter%20DOI%20to%20resolve,%20e.g.%2010.1000/202:',''))}if(Qr){if(Qr.indexOf('doi://')==0)Qr=Qr.substr(6);if(Qr.indexOf('doi:')==0)Qr=Qr.substr(4)}if(Qr)location.href='http://dx.doi.org/'+escape(Qr)" | |
>DOI name</a> | |
<li><a href= | |
"javascript:function se(d) {return d.selection ? d.selection.createRange().text : d.getSelection()} s = se(document); for (i=0; i<frames.length && !s; i++) s = se(frames[i].document); if (!s || s=='') s = prompt('Enter%20search%20terms%20for%20Wikipedia',''); open('http://en.wikipedia.org' + (s ? '/w/index.php?title=Special:Search&search=' + encodeURIComponent(s) : '')).focus();" | |
>Wikipedia search</a> | |
<li><a href= | |
"javascript:(function(){var k,x,t,i,j,p; for(k=0;x=document.links[k];k++){t=x.href.replace(/[%]3A/ig,':').replace(/[%]2f/ig,'/');i=t.lastIndexOf('http');if(i>0){ t=t.substring(i); j=t.indexOf('&'); if(j>0)t=t.substring(0,j); p=/https?\:\/\/[^\s]*[^.,;'">\s\)\]]/.exec(unescape(t)); if(p) x.href=p[0]; } else if (x.onmouseover&&x.onmouseout){x.onmouseover(); if (window.status && window.status.indexOf('://')!=-1)x.href=window.status; x.onmouseout(); } x.onmouseover=null; x.onmouseout=null; }})();" | |
>remove redirects, zap</a> | |
<li><a href= | |
"javascript:(function%20(document,bootstrap)%20{%20var%20invalidHTMLString%20=%20'The%20annotation%20toolbar%20cannot%20be%20loaded.%20Please%20visit%20the%20OU%20Annotate%20website%20and%20make%20your%20annotation%20there.';%20if%20(window.document%20===%20undefined)%20{%20alert(invalidHTMLString);%20location.reload(true);%20}%20var%20s%20=%20document.createElement('script');%20s.id%20=%20'ou_a_b';%20s.src%20=%20bootstrap;%20document.body.appendChild(s);%20}(document,'http://students.open.ac.uk/annotate/bookmarklet/bootstrap.js'));" | |
>OU Annotate toolbar</a> | |
<li><a title="'Do Not Track'" href= | |
"javascript:window.external.msAddTrackingProtectionList('list.txt', 'Turn on Do Not Track preference');" | |
>MSIE9: add an empty Tracking Protection List/ DNT</a> | |
<li><a title="RED is a robot that checks HTTP resources to see how they'll behave, pointing out common problems and suggesting improvements" href= | |
"javascript:location%20=%20'http://redbot.org/?uri='+encodeURIComponent(location);%20void%200" x-old-href="../webui.py?" | |
>RED</a> | |
<li><a href= | |
"javascript:location='http://validator.w3.org/check?uri='+encodeURIComponent(location);void 0" | |
>W3C validator</a> | |
<li><a title="CSS3 + vendor prefixes" href= | |
"javascript:location='http://jigsaw.w3.org/css-validator/validator?profile=css3&usermedium=all&warning=1&vextwarning=true&lang=en&uri='+encodeURIComponent(location);void 0" | |
>W3C CSS validator</a> | |
<li><a title="HTML validation, CSS 2.1 validation, Internationalization check, Feed validation" href= | |
"javascript:location='http://validator.w3.org/unicorn/check?ucn_task=conformance&ucn_uri='+encodeURIComponent(location);void 0" | |
>W3C Unicorn</a> | |
<li><a title="W3C" href= | |
"javascript:location='http://services.w3.org/xslt?xmlfile=http%3A%2F%2Fservices.w3.org%2Ftidy%2Ftidy%3FdocAddr%3D'+encodeURIComponent(location)+'%26passThroughXHTML%3D1&xslfile=http%3A%2F%2Fwww.w3.org%2F2002%2F08%2Fextract-semantic.xsl';void 0" | |
>Semantic extractor</a> | |
<li><a href= | |
"javascript:(function() {var _p='http://squizlabs.github.com/HTML_CodeSniffer/build/';var _i=function(s,cb) {var sc=document.createElement('script');sc.onload = function() {sc.onload = null;sc.onreadystatechange = null;cb.call(this);};sc.onreadystatechange = function(){if(/^(complete|loaded)$/.test(this.readyState) === true){sc.onreadystatechange = null;sc.onload();}};sc.src=s;if (document.head) {document.head.appendChild(sc);} else {document.getElementsByTagName('head')[0].appendChild(sc);}}; var options={path:_p};_i(_p+'HTMLCS.js',function(){HTMLCSAuditor.run('WCAG2AA',null,options);});})();" | |
data-url="http://squizlabs.github.com/HTML_CodeSniffer/" | |
>HTML_CodeSniffer / accessibility</a> * a11yLDN 2012-09-24. | |
<li><a href= | |
"javascript:var i,d,t,el=document.getElementsByTagName('time');for(i=0;i<el.length;i++){d=el[i].getAttribute('datetime');t=new Date(Date.parse(d));el[i].title=t.toUTCString()}void 0" | |
>Github time-fix</a> * | |
<li><a href= | |
"javascript:void(location.href='http://www.isitdownrightnow.com/downorjustme.php?url='+encodeURI(window.location.host));" | |
>Down right now?</a> | |
<li><a href= | |
"javascript:(function(){ | |
var q=document.querySelectorAll('#table_results td.grid_edit.not_null span'), | |
j,tx,d; | |
for(j=0; j < q.length;j++){ | |
tx=q[j].innerText; | |
if(tx.match(/^\d{10,}/)){ | |
d=new Date(tx*1000); | |
q[j].innerHTML='<span class=bd title=\''+ d +'\'>'+ tx +'</span>'; /*console.log(tx, d)*/ | |
} | |
} | |
})();" | |
data-url="http://phpmyadmin.net/" | |
>phpMyAd time</a> - phpMyAdmin Unix timestamps | |
<li><a href= | |
"javascript:if(window.location.hostname!='www.alexa.com')window.location='http://www.alexa.com/siteinfo/'+window.location.hostname;" | |
>Alexa site info</a> | |
<li><a href= | |
"javascript:(function(){ | |
var el=document.querySelector('.contractBalancesValue'), | |
h=el.innerText.replace('Hours',''), | |
d=parseInt(h / 7.40); | |
el.title=d+' FT Days'; | |
})()" | |
data-url="https://hr-myvw-live.open.ac.uk/dashboard/core/pages/employee/managetime/time-management-default-view.xhtml" | |
data-date="2013-09-09" | |
>MyView-days absence</a> | |
<li><a href= | |
"javascript:(function(){ | |
var D=document, | |
sc=D.querySelector('script:nth-of-type(6)').innerText, | |
cid=sc.match(/\.uk\/feeds\/([\w-_]+)/)[1], | |
mid=D.location.href.match(/player\.open\.edu\/embed\/(\w+)$/)[1]; | |
alert(cid + '/' + mid); | |
})();" | |
data-url="http://player.open.edu/embed/ece52f98de" | |
>OU Player bookmarklet</a> | |
<li><a href= | |
'javascript:void(function(){ | |
var form = document.createElement("form"); | |
form.method = "POST"; | |
form.enctype = "multipart/form-data"; | |
form.action = "http://validator.w3.org/check"; | |
form.target = "_blank"; | |
/* Get local HTML*/ | |
var html = "<html>" + document.documentElement.innerHTML + "</html>"; | |
var post_data = { | |
fragment: html,/*Settings for validator*/ | |
prefill: "0", | |
doctype: "HTML5", | |
prefill_doctype: "html401", | |
group: "0", | |
ss: "1", | |
outline: "1" | |
}; | |
for(var name in post_data){ | |
(function(){ | |
var t = document.createElement("textarea"); | |
t.name = name; | |
t.value = post_data[name]; | |
form.appendChild(t) | |
})() | |
} | |
document.body.appendChild(form); | |
form.submit(); /* Open validator, in new tab*/ | |
document.body.removeChild(form); | |
})()' | |
data-url="http://validator.w3.org/" | |
data-url="http://stackoverflow.com/questions/7752058/validate-dynamic-html-generated-by-javas..#answer-7752345" | |
>Valid gen source</a> - Validate JS-generated HTML | |
<li><a href=' | |
javascript:( | |
function() { | |
var s=document.createElement("script"); | |
s.charset="UTF-8"; | |
s.src="https://views.scraperwiki.com/run/nodeselectorjs/?x="+(Math.random()); | |
document.body.appendChild(s) | |
})(); | |
' | |
data-url="https://classic.scraperwiki.com/views/nodeselectorjs/" data-url="https://github.com/ptarjan/nodeselector" | |
>nodeSelector bookmarklet</a> | |
<li><a href= | |
'javascript:var D=document,c=D.querySelectorAll("body > *"),p=D.querySelectorAll("body pre[style]"); | |
if(c.length==1 && p.length==1)console.log("Is chrome text/plain, ignore");else console.log("Not chrome text");' | |
>Chrome is-text test</a> - Chrome plain-text test ** | |
<!-- | |
javascript:var D=document,c=D.querySelectorAll("body > *"),p=D.querySelectorAll("body pre[style = 'word-wrap: break-word; white-space: pre-wrap;']");if(c.length==1 && p.length==1)console.log("Is chrome text, ignore");else console.log("Not chrome text"); | |
--> | |
<li><a href= | |
'javascript:(function(){var L=window.location;window.location="http://greatfirewallofchina.org/?siteurl="+encodeURIComponent(L.protocol)+"//"+L.host})();' | |
>Great firewall</a> | |
<li><a href= | |
"javascript:document.location.href='http://www.a11ybuzz.com/submit/?url='+encodeURIComponent(document.URL)+'&title='+document.title.replace(/ /g,'+');'" | |
data-url="http://www.a11ybuzz.com/" | |
>A11yBuzz Submit</a> | |
<li><a href= | |
'javascript:function Q(e,s){document.querySelector(e).setAttribute("style",s)}Q("#masthead-positioner","display:none");Q("#masthead-positioner-height-offset","height:0");' | |
>YT hide ban</a> - YouTube hide banner | |
<li><a href= | |
'javascript:(function(){ jQuery(".X-WP-Shortcode").show().css({ position: "absolute", top: "1em", border: "1px solid gray" }); });' | |
>WP shortcodes</a> | |
<li><a href='javascript:(function(D){ | |
var hd=D.querySelector("#ID-newKennedyHeader").style, | |
nv=D.querySelector("#ID-navPanelContainer").style, | |
sg=D.querySelector(".ID-segmentContext").style; | |
if(1==sessionStorage.NGA_hider){ | |
hd.display="none"; nv.display="none"; sg.display="none"; sessionStorage.NGA_hider=0; | |
}else{ | |
hd.display="block"; nv.display="block"; sg.display="block"; sessionStorage.NGA_hider=1; | |
} })(document);' | |
>GA hider</a> - Google Analytics | |
<li><a href='javascript:window.location = "https://web.archive.org/web/*/" + window.location;' | |
>Archive Check</a> - Wayback machine. | |
<li><a href='javascript:window.location = "https://web.archive.org/save/" + window.location;' | |
>Archive Me!</a> - Wayback machine. | |
</ul> | |
<hr ><pre> | |
©Nick Freear, 15 August 2012 | https://gist.github.com/nfreear/2987ba2e4c15068c8805 | |
* http://jsbeautifier.org/ | |
* http://students.open.ac.uk/annotate/install-bookmarklet | |
* http://subsimple.com/bookmarklets/ | |
* http://en.wikipedia.org/wiki/Bookmarklet#Example | |
* http://marklets.com/ | |
* https://www.squarefree.com/bookmarklets/zap.html | |
* http://redbot.org/webui.py?uri=http%3A%2F%2Ftrack.olnet.org%2F | |
* http://w3.org/QA/Tools/ | |
* http://ie.microsoft.com/testdrive/Browser/DoNotTrack/Default.html | |
* http://squizlabs.github.com/HTML_CodeSniffer/ | |
* http://amazon.co.uk/wishlist/get-button/ | |
* http://paulisageek.com/nodeSelector/ | |
* http://accessify.com/tools-and-wizards/accessibility-tools/favelets/ | |
* https://views.scraperwiki.com/run/accessify-bookmarklet/ | |
* http://debug.yaml.de/ | |
</pre> | |
<script> | |
var ts=document.getElementsByTagName('time');for(var i=0;i<ts.length;i++){var d=ts[i].getAttribute('datetime');var t=new Date(Date.parse(d));ts[i].title=t.toUTCString();} | |
/*@cc_on | |
alert('MSIE only?'); | |
@*/ | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment