// // Copyright 2010 Yu Jianrong, All Rights Reserved // // Licensed under BSD License. // special case, remove iframe of dm5 page (not include the comic page) if (window.location.host==="www.dm5.com" && !(/^\/m/.test(window.location.pathname))) { var ifs=document.getElementsByTagName("iframe"); for(var i=ifs.length-1; i>=0; --i) ifs[i].parentNode.removeChild(ifs[i]); } else ($___=function() { var _window = window; var _document = document; var $_=function(id) { return _document.getElementById(id); }; var m=_document.createElement("meta"); m.name="viewport"; var c_page=0; var div_imgs=[]; var VerticalWritting = true; var Landscape= false; var MAXPRELOADPAGENUM = 10; var getPageURL=function(thePage) { return _window.location.href; }; var div_postprocess = function(){}; var configuration = localStorage.getItem("config")? JSON.parse(localStorage.getItem("config")):{}; if (configuration.SmoothAnimation === undefined) configuration.SmoothAnimation = true; if (configuration.PreloadPages === undefined) configuration.PreloadPages = 4; var getCurrentPage, getPageCount, getImgURL, setCurrentPage, getPrevChapter, getNextChapter; var parseEngine={ "dm5.com":function() { var url = window.location.href; DM5_PAGE = 1; if (url.indexOf('-p') > 0) { DM5_PAGE = parseInt(url.substring(url.indexOf("-p") + 2), 10); } croot = DM5_CURL.substring(0, DM5_CURL.length - 1) + "-p"; var mkey = ''; if ($("#dm5_key").length > 0) { mkey = $("#dm5_key").val(); } getCurrentPage=function() { return DM5_PAGE-1; }; getPageCount=function() { return DM5_IMAGE_COUNT; }; getImgURL=function(thePage) { var ret=""; $.ajax({ url: 'showimagefun.ashx?d=' + new Date(), data: { cid: DM5_CID, page: thePage+1, language:1, key:mkey }, type: 'GET', async: false, error: function (msg) { }, success: function (msg) { if (msg !== '') { if (mkey != '') { eval(msg); ret = d[0]; } else { var arr = msg.split(','); ret = arr[0]; } } } }); return ret; }; setCurrentPage=function(thePage) { DM5_PAGE = thePage+1; }; getPageURL = function(thePage) { return croot + (thePage + 1) + "/"; }; getPrevChapter = function() { return false; }; // var nurl=new String(window.location); // var cid=nurl.substring(nurl.indexOf("-")+1,nurl.indexOf("_")); // var nextUrl="../../tiaozhuan.aspx"+"?cid="+cid; getNextChapter = function() { return {text:"", href:DM5_CURL_END}; }; } ,"u17.com":function() { VerticalWritting = false; getCurrentPage=function() { return u_page; }; getPageCount=function() { return __htmlURL.length; }; getImgURL=function(thePage) { var url=__htmlURL[thePage]; //get the html var request = new XMLHttpRequest(); request.open("GET", url, false); request.send(); // request.responseText; return (/src="([^"]*)"/).exec(eee((/document.write\(eee\('([^']*)'/).exec(request.responseText)[1]))[1]; }; setCurrentPage=function(thePage) { u_page=thePage; }; getPageURL = function(thePage) { return __htmlURL[thePage]; }; // build the htmlURLs if (!_window.__htmlURL) { u_page = 0; __htmlURL=[]; var UrlBase = document.body.innerHTML.substr(document.body.innerHTML.indexOf("$('#comicShow')")).match(/location.href=(.*?)\+\$\("#comicShow"\).*?;/)[1]; for (var i=0;i<$_('comicShow').options.length;++i) { __htmlURL.push(eval(UrlBase)+$_('comicShow').options[i].value+'.html'); if ($_('comicShow').options[i].selected) u_page=i; } }; try{ var btns = document.querySelectorAll(".comic_read_top dd.read_btn input"); var ChapterInfo={next:false, prev:false}; var nextUrl = String(btns[0].onclick).match(/href='(.*?)'/); if (nextUrl) ChapterInfo.next ={text:"", href:nextUrl[1]}; var prevUrl = String(btns[1].onclick).match(/href='(.*?)'/); if (prevUrl) ChapterInfo.prev ={text:"", href:prevUrl[1]}; getPrevChapter = function() { return ChapterInfo.prev; }; getNextChapter = function() { return ChapterInfo.next; }; } catch(E) { getPrevChapter = function() { return false; }; getNextChapter = function() { return false; }; } } ,"www.boston.com/bigpicture":function() { VerticalWritting = false; Landscape = true; if (!_window.__imgs) { u_page = 0; __imgs=[]; var bpDivs = _document.getElementsByClassName("bpBoth"); for (var i=0; i690) { this.height=this.height - (_this.scrollHeight-690); this.width=Math.floor(_w*this.height/_h); } this.onload=null; }; setTimeout(function() { if (!_this.tImg.flink) _this.tImg.flink=getImgURL(_this.page); _this.tImg.src=_this.tImg.flink; } ,0); // this.className="bpCaption"; // this.tImg.style.position="relative"; // this.tImg.style.top="0px"; // this.tImg.style.left="0px"; }; }; getPrevChapter = function() { return false; }; getNextChapter = function() { return false; }; } ,"www.imanhua.com/comic":function() { getCurrentPage=function() { return iNo-1; }; getPageCount=function() { return len; }; getImgURL=function(thePage) { return imanhua_host + encodeURI(pic[thePage]); }; setCurrentPage=function(thePage) { iNo=thePage+1; }; getPageURL = function(thePage) { return base + 'p=' + String(thePage); }; getPrevChapter = function() { return false; }; getNextChapter = function() { return false; }; } ,"www.cococomic.com/manhua|www.99comic.com/manhua|mh.99770.cc/manhua":function() { getCurrentPage=function() { return parseInt(page, 10)-1; }; getPageCount=function() { return datas; }; getImgURL=function(thePage) { return ServerList[server-1]+arrPicListUrl[thePage]; }; setCurrentPage=function(thePage) { page = thePage+1; }; getPageURL = function(thePage) { return '?v='+(thePage+1)+"*s="+server; }; getPrevChapter = function() { return false; }; getNextChapter = function() { return false; }; } ,"*.178.com/mh/*.shtml":function() { getCurrentPage=function() { return g_current_page-1; }; getPageCount=function() { return arr_pages.length; }; getImgURL=function(thePage) { return img_prefix+arr_pages[thePage]; }; setCurrentPage=function(thePage) { g_current_page = thePage+1; }; getPageURL = function(thePage) { return generatePageUrl(g_page_base,thePage+1); }; if (!_window._chapterInfo) { _window._chapterInfo={ prev:$_("prev_chapter")?{text:$_("prev_chapter").innerText, href:$_("prev_chapter").href}:false, next:$_("next_chapter")?{text:$_("next_chapter").innerText, href:$_("next_chapter").href}:false}; } getPrevChapter = function() { return _window._chapterInfo.prev; }; getNextChapter = function() { return _window._chapterInfo.next; }; } ,"comic.131.com/content/":function() { getCurrentPage=function() { return pageNum -1; }; getPageCount=function() { return total; }; getImgURL=function(thePage) { var url=getPageURL(thePage); var request = new XMLHttpRequest(); request.open("GET", url, false); request.send(); // request.responseText; return (/onclick="NextPage\(\);" src="(.*?)" id="cur_pic"/).exec(request.responseText)[1]; }; setCurrentPage=function(thePage) { pageNum = thePage+1; }; getPageURL = function(thePage) { return "http://comic.131.com/content/"+sid+"/"+bid+"/"+(thePage+1)+".html"; }; if (!_window._chapterInfo) { var chapters = document.querySelectorAll(".list-directory li a"); for (var i=0;i/i); regx1 = (/\.\.\.(\d+)/); prevChapterRegx = //; nextChapterRegx = /下一篇  /; htmlSource = _document.documentElement.outerHTML; var nextChapterUrl = null; var prevChapterUrl = null; if((tmp=htmlSource.match(prevChapterRegx)) !== null) { tmpUrl = tmp[1]; if ((/http:|https:/).test(tmpUrl)) prevChapterUrl = tmpUrl; else if ((/^\//).test(tmpUrl)) prevChapterUrl = 'http://www.flyluo.com'+tmpUrl; else prevChapterUrl = location.href.match(/.*\//)[0]+tmpUrl; } if((tmp=htmlSource.match(nextChapterRegx)) !== null) { tmpUrl = tmp[1]; if ((/http:|https:/).test(tmpUrl)) nextChapterUrl = tmpUrl; else if ((/^\//).test(tmpUrl)) nextChapterUrl = 'http://www.flyluo.com'+tmpUrl; else nextChapterUrl = location.href.match(/.*\//)[0]+tmpUrl; } totalPage = parseInt(document.getElementsByTagName('html')[0].innerText.match(regx1)[1], 10); if(url.indexOf("-page-") > 0) { FLYLUO_PAGE = parseInt(url.substring(url.indexOf("-page-") + 6), 10)-1; croot = url.substring(0, url.indexOf("-page-")+6); } else croot = url.substring(0, url.indexOf(".html"))+'-page-'; getCurrentPage = function() { return FLYLUO_PAGE; }; getPageCount = function() { return totalPage; }; getImgURL = function(thePage) { proUrl = croot + (thePage+1) + ".html"; var request = new XMLHttpRequest(); request.open("GET", proUrl, false); request.send(); return request.responseText.match(regx)[1]; }; setCurrentPage = function(thePage) { FLYLUO_PAGE = thePage + 1; }; getPageURL = function(thePage) { return croot + (thePage + 1) + ".html"; }; getPrevChapter = function() { return prevChapterUrl ? {text:"", href:prevChapterUrl} : false; }; getNextChapter = function() { return nextChapterUrl ? {text:"", href:nextChapterUrl} : false; }; _document.onmousedown=null; } ,"www.dmeden.com/comichtml":function() { var PageCount = parseInt(document.getElementById("hdPageCount").value,10); var CurrentPage = parseInt(document.getElementById("hdPageIndex").value,10) -1; var __sID = document.getElementById("hdVolID").value; var __s = document.getElementById("hdS").value; getCurrentPage = function() { return CurrentPage; }; getPageCount = function() { return PageCount; }; getImgURL = function(thePage) { var request = new XMLHttpRequest(); request.open("GET", getPageURL(thePage), false); request.send(); return request.responseText.match(/id="imgCurr" src="(.*?)"/)[1]; }; setCurrentPage = function(thePage) { CurrentPage = thePage; }; getPageURL = function(thePage) { return "../"+ __sID +"/"+ (thePage+1) + ".html?s=" + __s; }; getPrevChapter = function() { return false; }; getNextChapter = function() { return false; }; } ,"27bb.com/source/plugin/comic/html/":function(){ var PageCount = document.querySelector("select[onchange='JumpTo(this)']").length *2-1; var CurrentPage = parseInt(/.*\/(.*?)\.php$/.exec(location.pathname)[1], 10)*2 -2 ; getCurrentPage = function() { return CurrentPage; }; getPageCount = function() { return PageCount; }; getImgURL = function(thePage) { var index = thePage % 2; var request = new XMLHttpRequest(); request.open("GET", getPageURL(thePage), false); request.send(); var req=/ links.length? links.length:index; return links[index]; }; setCurrentPage = function(thePage) { CurrentPage = thePage; }; getPageURL = function(thePage) { return (thePage>>1) +1 +".php"; }; getPrevChapter = function() { return false; }; getNextChapter = function() { return false; }; } }; // if (!_window.__iPadReaderInitialized) // { // // _window.__iPadReaderInitialized = true; // // push the pages to the // for (var i=0;i"; } // alert(allImgs); document.body.innerHTML = allImgs; return; } var AllLinks=_document.querySelectorAll("head>link"); for(var i=0;ithis.page + configuration.PreloadPages) div_imgs[i].eraseImg(); else div_imgs[i].loadImg(false); }; for (var i=this.page-1; i>=0;--i) { div_imgs[i].style.visibility="hidden"; if(i=div_imgs.length) { c_page=div_imgs.length-1; alert("Last page already"); }else // history.forward(); div_imgs[c_page].focusMe(); }; var preImg=function() { --c_page; if(c_page<0) { c_page=0; alert("First page already"); }else { // history.back(); div_imgs[c_page].focusMe(); } }; _document.onmouseup=function(e) { // for Firefox if (e.target === _document.documentElement) return; if(!e.offsetX) { e.offsetX = e.layerX; e.offsetY = e.layerY; } if (e.offsetX-scrollX < innerWidth/3) { if (VerticalWritting) nextImg(); else preImg(); } else if (e.offsetX-scrollX > innerWidth*2/3) { if (VerticalWritting) preImg(); else nextImg(); } else { var p=parseInt(prompt("jump to 1-"+div_imgs.length+" page",c_page+1), 10); if(p) { if(p>div_imgs.length) alert("maximum "+div_imgs.length+" pages!"); else { c_page=p-1; div_imgs[p-1].focusMe(); } } } }; }else { m.content="user-scalable=no,width=device-width,initial-scale=1.0,maximum-scale=1.0"; _document.getElementsByTagName("head")[0].appendChild(m); _document.body.innerHTML="
"; setTimeout(function(){$_("ReaderMain").style.opacity=1;}, 0); var div_Images=_document.createElement("div"); div_Images.style.cssText="display:table;text-align:center;background-color:#D6D6D6;font-size:25px;position:absolute;left:0px;top:0px;width:100%;height:100%;overflow-x:hidden;overflow-y:hidden;z-index:0;"; div_Images.innerHTML = "
"+loc_LOADING+"
"; $_("ReaderMain").appendChild(div_Images); for(i=0; i=0; --NodeIdx) { if (_document.body.childNodes[NodeIdx].className !== "iReader") _document.body.removeChild(_document.body.childNodes[NodeIdx]); } // _this.style.backgroundColor="white"; // this.style.opacity= 1; // _this.loadingText.innerHTML = ""; _this.style.opacity= 1; }; this.tImg.setTransform = function() { if (this.unloaded) return; this.pageHeight = _window.innerHeight; this.pageWidth=Math.floor(this.width * this.pageHeight / this.height); if (this.height<10){ this.top=0; this.left=0; } else{ if (_this.setToRight ^ !VerticalWritting) this.left=this.pageWidth<=_window.innerWidth?(_window.innerWidth-this.pageWidth)>>1:0; else this.left=this.pageWidth<=_window.innerWidth?(_window.innerWidth-this.pageWidth)>>1:_window.innerWidth-this.pageWidth; this.top =0; } this.style.webkitTransform="translate("+ Math.ceil(this.left)+"px, "+Math.ceil(this.top)+"px)"; }; setTimeout(function() { if (!_this.tImg.flink) _this.tImg.flink=getImgURL(_this.page); _this.tImg.src=_this.tImg.flink; } ,0); this.tImg.style.position="absolute"; this.tImg.style.left="0px"; this.tImg.style.top="0px"; this.tImg.style.width="auto"; this.tImg.style.height="100%"; this.tImg.left = this.tImg.top = 0; this.tImg.setTransform(); this.style.opacity = 0.01; // this.style.backgroundColor="#D6D6D6"; // this.tImg.style.opacity= 0; // this.loadingText.innerHTML = loc_LOADING; }; div_img.focusMe=function(setToRight) { setCurrentPage(this.page); $_("currentPage").innerHTML=(this.page+1)+"/"+getPageCount(); $_("PageJump").value=this.page; // _document.title = (this.page+1)+"/"+getPageCount() + " " + oldTitle; try{ history.pushState({},(this.page+1)+"/"+getPageCount() + " " + oldTitle, getPageURL(this.page)); } catch(e){ } _document.title = (this.page+1)+"/"+getPageCount() + " " + oldTitle; div_imgs[this.page].style.visibility="visible"; div_imgs[this.page].setToRight = setToRight; div_imgs[this.page].loadImg(true); for (var i=this.page+1; ithis.page + configuration.PreloadPages) div_imgs[i].eraseImg(); else div_imgs[i].loadImg(false); } for (var i=this.page-1; i>=0;--i) { div_imgs[i].style.visibility="hidden"; div_imgs[i].setToRight = true; if(i0) div_imgs[this.page-1].style.webkitTransform="translate(" + (VerticalWritting?100:-100) +"%,0px)"; if (this.page < div_imgs.length -1) div_imgs[this.page+1].style.webkitTransform="translate(" + (VerticalWritting?-100:100) +"%,0px)"; }; div_img.tImg.addEventListener("webkitTransitionEnd", function(){ // console.info("transitionEnd" + String(this.style.webkitTransitionProperty) ); this.style.webkitTransitionProperty = "none"; }, false ); div_img.tImg.style.webkitTransitionDuration="300ms"; div_img.tImg.style.webkitTransitionProperty = "none"; div_img.tImg.style.webkitTransform="translate(0px,0px)"; div_img.style.webkitTransitionDuration="300ms"; div_img.style.webkitTransitionProperty = "none"; div_img.style.webkitTransform="translate(0px,0px)"; div_img.addEventListener("webkitTransitionEnd", function(){ this.style.webkitTransitionProperty = "none"; }, false ); div_postprocess(div_img); // $_("ReaderMain").appendChild(div_img); div_Images.appendChild(div_img); div_imgs.push(div_img); }; var div_options=_document.createElement("div"); // div_options.style.cssText="font-size:25px;visibility:hidden;position:absolute;left:0px;top:0px;width:"+__ScreenWidth+"px;height:"+__ScreenHeight+"px;overflow-x:hidden;overflow-y:hidden;z-index:10;background-color:rgba(0,0,0,0.6);"; div_options.style.cssText="-webkit-transition-duration:300ms;font-size:25px;display:none;position:absolute;left:0px;top:0px;width:100%;height:100%;overflow-x:hidden;overflow-y:hidden;z-index:10;background-color:rgba(0,0,0,0.6);"; div_options.enable = false; $_("ReaderMain").appendChild(div_options); div_options.innerHTML="
"+ "
"; div_options.innerHTML+="
"+ formatStr("" + "" + "
" + "%s
" + "
" + "%s
" + "" + "
" + "%s
" , loc_RELOAD, loc_VERTICALWRITTING, loc_CURRENTPAGE, loc_JUMPTOPAGE, loc_ANIMATIONENABLE, loc_PRELOADPAGENUM ) + "
"; div_options.innerHTML+="
"+ "
"; div_options.innerHTML+="
Version 0.11.10.31.18
"; div_options.addEventListener("webkitTransitionEnd", function(){this.style.display=this.enable?"inline":"none";}, false); var updateLeftRightPanel=function() { var nextChapter, nextChapterText, prevChapter, prevChapterText; if (VerticalWritting) { nextChapter = $_("_left_chapter_"); nextChapterText = $_("_left_chapter_text_"); prevChapter= $_("_right_chapter_"); prevChapterText= $_("_right_chapter_text_"); } else { nextChapter = $_("_right_chapter_"); nextChapterText = $_("_right_chapter_text_"); prevChapter= $_("_left_chapter_"); prevChapterText= $_("_left_chapter_text_"); } var next=getNextChapter(); if (next) { nextChapterText.innerHTML = formatStr(loc_NEXTCHAPTER, next.text); nextChapter.onclick=function() { location.href = next.href; }; nextChapter.style.visibility = "visible"; } else { nextChapterText.innerHTML = "";//loc_NONEXTCHAPTER; nextChapter.onclick=null; nextChapter.style.visibility = "hidden"; } var prev=getPrevChapter(); if (prev) { prevChapterText.innerHTML = formatStr(loc_PREVCHAPTER, prev.text); prevChapter.onclick=function() { location.href = prev.href; }; prevChapter.style.visibility = "visible"; } else { prevChapterText.innerHTML = "";//loc_NOPREVCHAPTER; prevChapter.onclick=null; prevChapter.style.visibility = "hidden"; } }; $_("VerticalWritting").checked = VerticalWritting; $_("VerticalWritting").onclick=function() { VerticalWritting = !VerticalWritting; updateLeftRightPanel(); }; $_("Reload").onclick=function() { $___(); }; for(var i=0; i
%s
", Landscape?loc_LANDSCAPEWARNING:loc_PORTRAITWARNING); div_rotationWarning.className="iReader"; _document.body.appendChild(div_rotationWarning); var checkRotation=function() { // if (!(/iPad/.test(navigator.userAgent))) // return; var rightOrientation = true; if (_window.hasOwnProperty("orientation")) { switch(_window.orientation) { case 0: case 180: rightOrientation = !Landscape; break; case 90: case -90: rightOrientation = Landscape; break; } } if (!rightOrientation) { if (div_rotationWarning.style.visibility !== "visible") div_rotationWarning.style.visibility = "visible"; div_rotationWarning.enable = true; } else { if (div_rotationWarning.style.visibility !== "hidden") div_rotationWarning.style.visibility = "hidden"; div_rotationWarning.enable = false; } window.scrollTo(0,0); }; _window.onorientationchange=checkRotation; checkRotation(); setInterval(checkRotation, 2500); _window.onresize=function() { for ( var i = 0; i=div_imgs.length) { c_page=div_imgs.length-1; // alert(loc_LASTPAGE); showOptionPanel(true); }else { // history.forward(); div_imgs[c_page].focusMe(); if (configuration.SmoothAnimation) { div_imgs[c_page-1].style.webkitTransitionProperty = "-webkit-transform"; div_imgs[c_page-1].style.visibility="visible"; } } }; var ImageclickAt=function(x, target) { if (div_rotationWarning.enable) return; if(x<_window.innerWidth/4) { if (VerticalWritting) nextImg(); else preImg(); } else if (x>_window.innerWidth*3/4) { if (VerticalWritting) preImg(); else nextImg(); } else { showOptionPanel(true); } return false; }; var OptionclickAt=function(x, target) { if (div_rotationWarning.enable) return; if (target.tagName === "DIV") { showOptionPanel(false); return false; } }; if(navigator.userAgent.indexOf("iPad")!=-1 || navigator.userAgent.indexOf("Android")!=-1) { div_Images.ontouchstart =function(e) { return ImageclickAt(e.touches[0].pageX, e.target); }; div_options.ontouchstart =function(e) { return OptionclickAt(e.touches[0].pageX, e.target); }; } else { div_Images.onmousedown=function(e) { ImageclickAt(e.pageX, e.target); }; div_options.onmousedown=function(e) { OptionclickAt(e.pageX, e.target); }; }; }; c_page=getCurrentPage(); div_imgs[c_page].focusMe(); // c_page=getCurrentPage(); // if (!_window.__iPadReaderInitialized) // { // _window.__iPadReaderInitialized = true; // var pageDelta = c_page - (getPageCount() -1); // if (pageDelta != 0) // history.go(pageDelta) // else // div_imgs[c_page].focusMe(); // }else // div_imgs[c_page].focusMe(); },0); })();