Advertisement
Guest User

Untitled

a guest
Jul 16th, 2018
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.39 KB | None | 0 0
  1. // ==UserScript==
  2. // @name Copy this Novel
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description try to take over the world!
  6. // @author You
  7. // @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js
  8. // @match https://fictionlog.co/*
  9. // @match https://www.kawebook.com/story/detail/*
  10. // @match http://www.tunwalai.com/chapter/*
  11. // @match https://novel.th-sharing.com/read/*
  12. // @match https://imakeuread.blogspot.com/*/*/*
  13. // @match https://www.hongsamut.com/fiction/*
  14. // @match https://www.thai-novel.com/*
  15. // @match https://www.tard-niyai.com/*
  16. // @grant GM_setClipboard
  17. // @grant GM_notification
  18. // @grant GM_addStyle
  19. // ==/UserScript==
  20.  
  21. (function() {
  22. 'use strict';
  23.  
  24. var handlerNameArr = ['contextmenu', 'copy', 'cut', 'paste', 'mousedown', 'mouseup', 'beforeunload', 'beforeprint', 'keyup', 'keydown', 'select', 'selectstart'];
  25. var removeProtection = function removeProtectionName(protectedWindow) {
  26. for(var i = 0; i < handlerNameArr.length; i++) {
  27. var handlerName = handlerNameArr[i];
  28. var handlerOnName = 'on' + handlerName;
  29.  
  30. if(protectedWindow[handlerOnName])
  31. protectedWindow[handlerOnName] = null;
  32.  
  33. protectedWindow.addEventListener(handlerName, function(e){ e.stopPropagation(); }, true);
  34. }
  35. };
  36.  
  37. var removeCssProtection = function removeCssProtectionName() {
  38. var css = ['* {',
  39. ' -webkit-user-select:text!important;',
  40. ' -moz-user-select:text!important;',
  41. ' -ms-user-select:text!important;',
  42. ' -o-user-select:text!important;',
  43. ' user-select:text!important;',
  44. '}',
  45. ].join('\n');
  46. GM_addStyle(css);
  47. };
  48.  
  49. removeProtection(window);
  50.  
  51. var frameList = window.frames;
  52. for(var j = 0; j < frameList.length; j++) {
  53. try {
  54. removeProtection(frameList[j]);
  55. } catch(e) {}
  56. }
  57.  
  58. removeCssProtection();
  59.  
  60. if(window.location.href.startsWith('https://fictionlog.co/')) {
  61. var u = "\u0e01\u0e02\u0e03\u0e04\u0e05\u0e06\u0e07\u0e08\u0e09\u0e0a\u0e0b\u0e0c\u0e0d\u0e0e\u0e0f\u0e10\u0e11\u0e12\u0e13\u0e14\u0e15\u0e16\u0e17\u0e18\u0e19\u0e1a\u0e1b\u0e1c\u0e1d\u0e1e\u0e1f\u0e20\u0e21\u0e22\u0e23\u0e24\u0e25\u0e26\u0e27\u0e28\u0e29\u0e2a\u0e2b\u0e2c\u0e2d\u0e2e\u0e2f\u0e30\u0e31\u0e32\u0e33\u0e34\u0e35\u0e36\u0e37\u0e38\u0e39\u0e3a\u0e40\u0e41\u0e42\u0e43\u0e44\u0e45\u0e46\u0e47\u0e48\u0e49\u0e4a\u0e4b\u0e4c".split("");
  62.  
  63. setInterval(function () {
  64. if($('.enigma').length && window.location.pathname.startsWith('/c/')) {
  65. var noFonts = parseInt($('body style')[0].innerHTML.substr($('body style')[0].innerHTML.indexOf("/fonts/") + 7, 1)),
  66. rpETcontent = $('.enigma')[0].innerHTML;
  67.  
  68. for(var k = 0; k < 71; k++) {
  69. var ET2rp = 'e';
  70. ET2rp += 900 + (k < 2 ? k : (k + 1 + noFonts));
  71. ET2rp = parseInt(ET2rp, 16);
  72. rpETcontent = rpETcontent.replace(new RegExp(String.fromCharCode(ET2rp), "g"), u[k]);
  73. }
  74.  
  75. $('.enigma')[0].innerHTML = rpETcontent;
  76. window.history.replaceState({page: "/" + window.location.pathname}, document.title, "https://fictionlog.co" + window.location.pathname.replace('/c/', '/w/c/'));
  77. $('.content-detail')[1].addEventListener('dblclick', function (e) {
  78. var selection = window.getSelection();
  79. var range = document.createRange();
  80.  
  81. range.selectNodeContents($('.content-detail')[1]);
  82. selection.removeAllRanges();
  83. selection.addRange(range);
  84.  
  85. GM_setClipboard();
  86. GM_notification ({
  87. title: 'Notification',
  88. text: 'ก๊อปปี้เนื้อหาไปยังคลิปบอร์ดแล้ว.',
  89. timeout: 3000,
  90. onclick: function () {
  91. window.focus ();
  92. },
  93. });
  94. });
  95. }
  96. }, 1000);
  97. }
  98. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement