UU看書手機版

幫助在使用手機閱讀UU看書時,能使用滑鼠手勢輕鬆地換頁

  1. // ==UserScript==
  2. // @name UU看書手機版
  3. // @version 0.1.10
  4. // @description 幫助在使用手機閱讀UU看書時,能使用滑鼠手勢輕鬆地換頁
  5. // @author John
  6. // @match *://*.uukanshu.com/read.aspx*
  7. // @grant none
  8. // @license MIT License
  9. // @namespace https://gf.qytechs.cn/users/814278
  10. // ==/UserScript==
  11.  
  12. var lastX,lastY,lastSign,afterGestures,gesturesWords,gesturesContent,gestures,signs;
  13. const defaultFun={
  14. prePage:"prePage()",
  15. nextPage:"nextPage()"
  16. };
  17. var bookName = getBookName();
  18.  
  19. var filterList = ['UU看書 www.uukanshu.com'
  20. ,'UU看書www.uukanshu.com'
  21. ,'UU看书 www.uukanshu.com'
  22. ,'UU看书www.uukanshu.com'
  23. ,"\\n\\n"+bookName+'.*https://'
  24. ,'https://'
  25. ,'請記住本書首發域名:。'
  26. ,'手機版閱讀網址:'
  27. ,'\\(未完待續。\\)'
  28. ,'\\(未完待续。\\)'
  29. ,'\\(\\)'
  30. ,'\\[\\]'
  31. ,'天才一秒記住本站地址:最快更新!無廣告!'
  32. ,'章節缺失、錯誤舉報'
  33. ,'章节缺失、錯誤举报'
  34. ,'章节缺失、错误举报'
  35. ,'天才壹秒記住,為您提供精彩小說閱讀。'
  36. ,'手機用戶請瀏覽m閱讀,更優質的閱讀體驗。'
  37. ,'手机用户请浏览m阅读,更优质的阅读体验。'
  38. ,'最新網址:'
  39. ,"UU看書.*!"
  40. ,'手機用戶請到閱讀。'
  41. ,"您可以在百度裏搜索“"+bookName+"搜小說”查找最新章節!\\n"
  42. ,"您可以在百度里搜索“"+bookName+"搜小說”查找最新章節!\\n"
  43. ,"\\n\\n為了方便下次閱讀.*下次打開書架即可看到!"
  44. ,"\\n\\n喜歡《"+bookName+"》請向你的朋友\\(QQ、博客、微信等方式\\)推薦本書,謝謝您的支持!!"
  45. ,"\\n\\n\\n"
  46. ];
  47.  
  48. var replaceList = {
  49. ",":","
  50. , ":":":"
  51. , ";":';'
  52. , "\\?":"?"
  53. , "!":"!"
  54. , "。":"..."
  55. , "夸":"誇"
  56. , "并":"並"
  57. , "閑":"閒"
  58. , "圣":"聖"
  59. , "里":"裡"
  60. , "云":"雲"
  61. , "愿":"願"
  62. , "后":"後"
  63. , "尸":"屍"
  64. , "其于":"其餘"
  65. , "于":"於"
  66. , "賬":"帳"
  67. , "凈":"淨"
  68. , "裏":"裡"
  69. , "淀":"澱"
  70. , "贊":"讚"
  71. , "钻":"鑽" , "鉆":"鑽"
  72. , "仆":"僕"
  73. , "皇後":"皇后" , "王後":"王后" , "太後":"太后" , "天後":"天后"
  74. , "隻能":"只能" , "隻要":"只要" , "隻是":"只是" , "隻可":"只可" , "隻允":"只允" , "隻說":"只說" , "隻求":"只求" , "隻願":"只願", "隻見":"只見"
  75. , "這么":"這麼" , "那么":"那麼" , "怎么":"怎麼" , "什么":"什麼" , "多么":"多麼" , "要么":"要麼" , "是么\\?":"是嗎\\?"
  76. , "答復":"答覆" , "復數":"複數"
  77. , "開采":"開採" , "采收":"採收" , "采集":"採集" , "采納":"採納" , "采取":"採取"
  78. , "舍不":"捨不" , "舍棄":"捨棄" , "舍身":"捨身" , "舍去":"捨去" , "有舍":"有捨"
  79. , "松動":"鬆動" , "松了":"鬆了" , "松開":"鬆開" , "松手":"鬆手" , "松掉":"鬆掉" , "松綁":"鬆綁" , "輕松":"輕鬆"
  80. , "干干":"乾乾" , "干脆":"乾脆" , "干淨":"乾淨" , "干燥":"乾燥" , "干貨":"乾貨" , "干涸":"乾涸" , "干系":"關係"
  81. , "干道":"幹道" , "干過":"幹過" , "干的":"幹的" , "骨干":"骨幹" , "干什":"幹什" , "干嘛":"幹嘛"
  82. , "聯系":"聯繫" , "關系":"關係"
  83. , "合並":"合併" , "吞並":"吞併" , "並吞":"併吞"
  84. , "典范":"典範" , "范例":"範例" , "范疇":"範疇" , "范圍":"範圍"
  85. , "須髮":"鬚髮" , "鬍須":"鬍鬚"
  86. , "余生":"餘生" , "余情":"餘情" , "余溫":"餘溫" , "余力":"餘力"
  87. , "標志":"標誌" , "號志":"號誌"
  88. , "穀底":"谷底" , "山穀":"山谷"
  89. , "能斗":"能鬥" , "戰斗":"戰鬥" , "斗戰":"鬥戰" , "斗志":"鬥志" , "斗不過":"鬥不過"
  90. , "麵對":"面對" , "迎麵":"迎面" , "下麵":"下面"
  91. , "jian貨":"賤貨"
  92. , "撫mo":"撫摸"
  93. //, "關于":"關於" , "大于":"大於" , "小于":"小於" , "等于":"等於" , "高于":"高於" , "低于":"低於" , "至于":"至於"
  94. };
  95.  
  96.  
  97.  
  98.  
  99. function prePage(){
  100. var url = $("#read_pre").attr("href");
  101. if (url == undefined){
  102. url = $("#prev").attr("href");
  103. }
  104. if (url == undefined){
  105. return false;
  106. }
  107. window.location.href = url;
  108. }
  109.  
  110. function nextPage(){
  111. var url = $("#read_next").attr("href");
  112. if (url == undefined){
  113. url = $("#next").attr("href");
  114. }
  115. if (url == undefined){
  116. return false;
  117. }
  118. window.location.href = url;
  119. }
  120.  
  121. function initEventListener(start,move,end,tracer,clientX,clientY,startBool){
  122. var isMouse=start=="mousedown";
  123. function moveFun(e){
  124. tracer(eval(clientX),eval(clientY), isMouse);
  125. gesturesWords.innerHTML=signs;
  126. var gesturesWidth=signs.length*51+40;
  127. gesturesContent.style.width=gesturesWidth+"px";
  128. gesturesContent.style.marginLeft=-gesturesWidth/2+"px";
  129. };
  130.  
  131. document.addEventListener(start, function(e) {
  132. if(!startBool || eval(startBool)){
  133. lastX=eval(clientX);
  134. lastY=eval(clientY);
  135. lastSign=signs="";
  136. document.addEventListener(move, moveFun, false);
  137. }
  138. }, false);
  139.  
  140. function endFun(e) {
  141. document.removeEventListener(move, moveFun, false);
  142. setTimeout(function(){if(gesturesContent.parentNode)gesturesContent.parentNode.removeChild(gesturesContent);},500);
  143. if(signs){
  144. if(afterGestures)afterGestures();
  145. for(var g of gestures){
  146. var gSign=g.gesture;
  147. if(signs==gSign){
  148. if(!isMouse) document.body.appendChild(gesturesContent);
  149. var fun=defaultFun[g.fun];
  150. if(fun===undefined || !fun){
  151. eval(g.fun);
  152. }else{
  153. eval(fun);
  154. }
  155. e.stopPropagation();
  156. e.preventDefault();
  157. break;
  158. }
  159. }
  160. signs="";
  161. }
  162. };
  163.  
  164. document.addEventListener(end, endFun, false);
  165. document.addEventListener("mouseup", endFun, false);
  166. }
  167.  
  168. function fullToHalf(val) {
  169. var result = "";
  170.  
  171. try{
  172. var value = val || "";
  173. if (value) {
  174. for (var i = 0; i <= value.length; i++) {
  175. if (value.charCodeAt(i) == 12288) {
  176. result += " ";
  177. } else {
  178. if (value.charCodeAt(i) > 65280 && value.charCodeAt(i) < 65375) {
  179. result += String.fromCharCode(value.charCodeAt(i) - 65248);
  180. } else {
  181. result += String.fromCharCode(value.charCodeAt(i));
  182. }
  183. }
  184. }
  185. }
  186. }catch(e){
  187. console.error(e);
  188. }
  189.  
  190. return result;
  191. }
  192.  
  193. function alterContent(){
  194. try{
  195. var obj = document.getElementById("bookContent");
  196. obj.style.cssText += 'word-break: break-all;';
  197. var val = fullToHalf(obj.innerText);
  198.  
  199. for(const str of filterList){
  200. val = val.replace(new RegExp(str,"gi"),'');
  201. }
  202.  
  203. setTimeout(function() {
  204. for (var key in replaceList) {
  205. val = val.replace(new RegExp(key, "gi"), replaceList[key]);
  206. }
  207. obj.innerText = val;
  208. },5);
  209. }catch(e){
  210. console.error(e);
  211. }
  212. }
  213.  
  214. function addNexPagetLink(){
  215. try{
  216. var newEle = document.createElement("div");
  217. var oldEle = document.querySelector(".rp-switch");
  218. var nextLinkEle = document.getElementById("read_next")
  219.  
  220. var leftEle = nextLinkEle.cloneNode(true);
  221. var rightEle = nextLinkEle.cloneNode(true);
  222. leftEle.style.cssText = 'left:0px;position:absolute;';
  223. rightEle.style.cssText = 'right:0px;position:absolute;';
  224. newEle.appendChild(leftEle);
  225. newEle.appendChild(rightEle);
  226. oldEle.parentNode.insertBefore(newEle ,oldEle);
  227. }catch(e){
  228. console.error(e);
  229. }
  230. }
  231.  
  232.  
  233. function alterEleLoction(){
  234. var toolbtm1Ele = document.getElementById("tool_btm1");
  235. var toolbtm2Ele = document.getElementById("tool_btm2");
  236. var fontBtbEle = document.getElementById("funfont");
  237. var nextBtnEle = document.getElementById("funnext");
  238. fontBtbEle.style = 'width:50px;position: absolute;right:10px;left:auto;padding-top: 12px;';
  239. nextBtnEle.style = 'width:50px;position: absolute;left:10px;';
  240.  
  241. toolbtm1Ele.insertBefore(nextBtnEle, fontBtbEle);
  242. toolbtm1Ele.removeChild(fontBtbEle);
  243. toolbtm2Ele.appendChild(fontBtbEle);
  244. }
  245.  
  246. function getBookName(){
  247. var result = "";
  248. try{
  249. var headerEle = document.querySelector("header");
  250. var aa = headerEle.innerText.split("\n");
  251. result = aa[1];
  252. }catch(e){
  253. console.error(e);
  254. }
  255. return result;
  256. }
  257.  
  258.  
  259. (function() {
  260. 'use strict';
  261. const minLength=256;
  262. const tg=0.5;
  263. gestures=[
  264. {gesture:"→", fun:"prePage"},
  265. {gesture:"←", fun:"nextPage"},
  266. ];
  267.  
  268. function tracer(curX,curY,showSign) {
  269. let distanceX=curX-lastX,distanceY=curY-lastY;
  270. let distance=(distanceX*distanceX)+(distanceY*distanceY);
  271. if (distance>minLength) {
  272. lastX=curX;
  273. lastY=curY;
  274. let direction="";
  275. let slope=Math.abs(distanceY/distanceX);
  276. if(slope>tg){
  277. if(distanceY>0) {
  278. direction="↓";
  279. }else{
  280. direction="↑";
  281. }
  282. }else if(slope<=1/tg) {
  283. if(distanceX>0) {
  284. direction="→";
  285. }else{
  286. direction="←";
  287. }
  288. }
  289. if(lastSign!=direction) {
  290. signs+=direction;
  291. lastSign=direction;
  292. if(showSign){
  293. document.body.appendChild(gesturesContent);
  294. }
  295. }
  296. }
  297. }
  298.  
  299. gesturesContent=document.createElement("div");
  300. gesturesContent.id="gesturesContent";
  301. gesturesContent.style.cssText="width:300px;height:70px;position:fixed;left:50%;top:50%;margin-top:-25px;margin-left:-150px;z-index:999999999;background-color:#000;border:1px solid;border-radius:10px;opacity:0.65;filter:alpha(opacity=65);box-shadow:5px 5px 20px 0px #000;";
  302. gesturesContent.innerHTML='<div id="gesturesWords" style="position:absolute;left:20px;top:5px;font:bold 50px \'黑体\';color:#ffffff"></div>';
  303. gesturesWords = gesturesContent.querySelector("#gesturesWords");
  304.  
  305. initEventListener("touchstart","touchmove","touchend",tracer,"e.changedTouches[0].clientX","e.changedTouches[0].clientY");
  306. initEventListener("mousedown","mousemove","contextmenu",tracer,"e.clientX","e.clientY","e.which === 3");
  307.  
  308. alterContent();
  309. // alterEleLoction();
  310. addNexPagetLink();
  311.  
  312. try{
  313. document.querySelector('.samebooks1').style.display = 'none';
  314. document.querySelector('.socialBtn').style.display = 'none';
  315. }catch(e){
  316. console.error(e);
  317. }
  318.  
  319. /*
  320. BookReader.ReadSetting.SetFontSize = function(val) {
  321. val = parseInt(val);
  322. var rf = parseInt(Common.GetCookie("ziti") || "18");
  323. if (isNaN(rf)) {
  324. rf = 20
  325. }
  326. val = val + rf;
  327. if (val > 36) {
  328. Common.Toast("已經是最大了...");
  329. val = 36
  330. }
  331. if (val < 16) {
  332. Common.Toast("已經是最小了...");
  333. val = 16
  334. }
  335. Common.SetCookie("ziti", val, (new Date()).AddDays(365), "/");
  336. $(BookReader.Display.Containers.ChapterDivId).css("font-size", val + "px");
  337. $(BookReader.Display.Containers.ChapterDivId).children("p").css("font-size", val + "px");
  338. $(BookReader.Display.Containers.ChapterDivId).css("line-height", val * BookReader.Options.Config.lineHeightRate +"px");
  339. $(BookReader.Display.Containers.ChapterDivId).children("p").css("line-height", val * BookReader.Options.Config.lineHeightRate + "px")
  340. }
  341. */
  342. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址