User:Solarra/Reftool

javascript:if(typeof%20wgEnableAPI=='undefined'){alert('This%20bookmarklet%20only%20works%20on%20Wikimedia%20pages')}else{xhr=new%20XMLHttpRequest();xhr.onreadystatechange=function(){if(xhr.readyState==4){eval('pages=('+xhr.responseText+').query.pages');for(var%20page%20in%20pages)edittoken=pages[page].edittoken;if(edittoken=='+\\')if(!confirm('You%20are%20not%20logged%20in,%20continue?'))return;location.href='//toolserver.org/~dispenser/cgi-bin/reflinks.py?client=autobm&family=wikipedia&lang='+wgContentLanguage+'&page='+encodeURIComponent(window.wgPageName)+'&autoclick=wpSave&wpEditToken='+edittoken;}};xhr.open('GET',wgScriptPath+'/api.php?action=query&prop=info&intoken=edit&titles=M&format=json',true);xhr.send(null);}
javascript:location.href='http://tools.wmflabs.org/legobot/cgi-bin/reflinks.py?url='+document.location.href;