Advertisement
QonQon

FanficQompleteBookmarklet

May 31st, 2015
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. javascript: function urlGetChap(a){return/(^.*?fanfiction\.net\/s\/\d+\/)(\d+)(?:\/?.*$)/.exec(a)[2]}function urlSetChap(a,b){return/(^.*?fanfiction\.net\/s\/\d+\/)(\d+)(?:\/?.*$)/.exec(a)[1]+b}function inc(a){a=/(^.*?fanfiction\.net\/s\/\d+\/)(\d+)(?:\/?.*$)/.exec(a);return a[1]+(parseInt(a[2])+1)}
  2. function createChapFromFfpage(a,b){var c=b.createElement("div"),e=b.getElementById("storytext");if(e){c.setAttribute("class","chapter");var f=b.createElement("span");f.innerHTML=urlGetChap(a)+". ";var g=b.getElementsByTagName("title")[0],d=b.createElement("a");d.setAttribute("href",a);d.innerHTML=g.innerHTML;c.appendChild(f);c.appendChild(d);c.appendChild(document.createElement("hr"));c.appendChild(e);return c}return null}
  3. var body=document.getElementsByTagName("body")[0],head=document.getElementsByTagName("head")[0],title=document.getElementsByTagName("title")[0],profile_top=document.getElementById("profile_top"),chap=createChapFromFfpage(document.location.href,document),ptbuttons=profile_top.getElementsByTagName("button");
  4. if(ptbuttons.length)try{for(ptbuttons[0].remove();head.firstElementChild;)head.firstElementChild.remove();for(;body.firstElementChild;)body.firstElementChild.remove()}catch(e$$7){try{ptbuttons[0].removeNode(!0);for(var elementChildren=head.children;elementChildren.length;)elementChildren[0].removeNode(!0);for(elementChildren=body.children;elementChildren.length;)elementChildren[0].removeNode(!0)}catch(e$$8){}}body.removeAttribute("style");var style=document.createElement("style");
  5. style.setAttribute("type","text/css");style.innerHTML='body{background-color:#3f5;color:#ccc;margin:0;padding:0;font-family:"Verdana";}div.wrap{max-width:1200px;margin-left:auto;margin-right:auto;}.chapter,#profile_top{background-color:#222;margin-top:1em;margin-bottom:1em;}img{float:left;}canvas{float:left;}a:link{color:#a05;}a:visited{color:#555;}a:hover{color:#fff;}a:active{color:#a05;}';head.appendChild(style);head.appendChild(title);wrap=document.createElement("div");
  6. wrap.setAttribute("class","wrap");var div=document.createElement("div");div.appendChild(profile_top);wrap.appendChild(div);wrap.appendChild(chap);body.appendChild(wrap);GLOBAL_URL_FOR_IE="";function loadQomplete(){var a=document.createElement("style");a.setAttribute("type","text/css");a.innerHTML="body{background-color:#604;}";head.appendChild(a);console.log("QOMPLETE")}
  7. function reqListener(){var a=(new DOMParser).parseFromString(this.responseText,"text/html"),b=this.responseURL;void 0==b&&(b=GLOBAL_URL_FOR_IE);(a=createChapFromFfpage(b,a))?(wrap.appendChild(a),loadNext(b)):loadQomplete()}function loadNext(a){var b=new XMLHttpRequest;b.onload=reqListener;GLOBAL_URL_FOR_IE=inc(a);b.open("get",inc(a),!0);b.send()}loadNext(document.location.href);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement