Rutor Preview Ajax

Предпросмотр раздач на сайте

目前為 2023-05-22 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Rutor Preview Ajax
  3. // @namespace https://github.com/AlekPet/
  4. // @version 1.4.6.9
  5. // @description Предпросмотр раздач на сайте
  6. // @author AlekPet
  7. // @license MIT; https://opensource.org/licenses/MIT
  8. // @match http*://tor-ru.net/*
  9. // @match http*://zerkalo-rutor.org/*
  10. // @match http*://rutor.info/*
  11. // @match http*://rutor.is/*
  12. // @match http*://free-rutor.org/*
  13. // @match http*://freedom-tor.org/*
  14. // @match http*://top-tor.org/*
  15. // @match http*://rutor.is/*
  16. // @match http*://live-rutor.org/*
  17. // @match http*://xrutor.org/*
  18. // @match http*://rutor.info/*
  19. // @match http*://new-rutor.org/*
  20. // @match http*://6tor.org/*
  21. // @icon https://raw.githubusercontent.com/AlekPet/Rutor-Preview-Ajax/master/assets/images/icon.png
  22. // @connect *
  23. // @run-at document-end
  24. // @noframes
  25. // @grant GM_setValue
  26. // @grant GM_getValue
  27. // @grant GM_addStyle
  28. // @grant GM_addValueChangeListener
  29. // @grant GM.xmlHttpRequest
  30. // @grant GM_getResourceText
  31. // @require https://code.jquery.com/jquery-3.1.0.min.js
  32. // @require https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js
  33. // ==/UserScript==
  34.  
  35. GM_addStyle(`
  36. .mDiv{width: 250px;border: 3px double #FFA302;/*right: 9px;*/text-align: center;color:white;}
  37. .mDiv_title{background-image: url(/s/i/poisk_bg.gif);background-size: 40% 100%;padding: 5px;border-bottom: 2px solid #ffea00; cursor: pointer;}
  38. .mDiv_inner{overflow-y: auto;max-height: 300px;}
  39. .mDiv_FavInner{overflow-y: auto;max-height: 300px; color: silver; width: 80%;margin: 0 auto;padding: 10px;}
  40.  
  41. .mDiv_title.no_vis{filter: grayscale(1) brightness(1.5) !important;}
  42. .mDiv_title.opens{display:none;filter: hue-rotate(-40deg);}
  43. .mDiv_title.fav{filter: hue-rotate(200deg);}
  44. .mDiv_title.stream{filter: hue-rotate(120deg);}
  45.  
  46. .com_Style{background: linear-gradient(#b7b7b7,#545454);color: white;text-align: center;padding: 4px;cursor: pointer;user-select: none; width: 300px;margin: 0 auto;border-radius: 8px;transition: all 0.5s ease;margin-bottom: 10px;}
  47. .com_Style:hover {background: linear-gradient(#676666,#9e9e9e);width: 350px;transition: all 0.5s ease-out;font-size: 1.2em;}
  48.  
  49. #my_content{border: 1px solid silver;}
  50. .my_tr{display:none;}
  51.  
  52. .footSpoiler{text-align: center; padding: 10px;}
  53.  
  54. .box_comments{background: #d0caca;width: 90%;margin: 0 auto;padding: 10px;border-radius:8px;}
  55.  
  56. div#index tr.my_tr:hover { background-color: white;}
  57. div#my_content tr:hover { background-color: white;}
  58.  
  59. .buttonsStyle {border: 1px solid;width: 80%;margin: 3px auto;background: linear-gradient(#72ff72,#1d8e08);padding: 5px;cursor: pointer;}
  60. .buttonsStyle:hover{background: linear-gradient(#2fc12f,#246318);}
  61. .mDiv_FavControl{background: linear-gradient(#5a0067,#815f87);}
  62. .mDiv_FavControl:hover{background: linear-gradient(#be0a2f,#bc8ec5);}
  63. .mDiv_FavControlCheck{background: linear-gradient(#336700,#6e875f);}
  64. .mDiv_FavControlCheck:hover{background: linear-gradient(#07a116,#347036);}
  65. .butSpoiler{cursor:pointer; width: 16px;}
  66. .mDivFavControl_box{
  67. display: flex;
  68. margin: 0 20px;
  69. font-size: 0.8rem;
  70. }
  71.  
  72. div.seeEl {width: 80%;margin: 5px auto;background: linear-gradient(#e2a9d1,#ffc200);cursor: pointer;overflow: hidden;line-height: 1;font-size: 0.8em; box-sizing: content-box;color: black; font-weight: bold;font-family: monospace;}
  73. div.seeEl:hover{background: linear-gradient(#ff9b58,#f5ff0082); color: #8e0000;}
  74. div.seeEl div img:not(.butSpoiler) {box-shadow: 2px 2px 5px black;}
  75. .minipanel{display: table-cell;vertical-align: middle;padding: 5px;border-left: 1px dotted white;background: linear-gradient(#df99e8,#ff6400);}
  76. .minipanel:hover {background: linear-gradient(#d377de,#ff7000);}
  77. .minipanel:hover img{transition:1s all;transform: rotateX(360deg) !important;}
  78. .minipanel img{transition:1s all;}
  79.  
  80. .loading_tor_box{padding: 5px;}
  81. .loading_tor {width: 100%;background: #e0dcdc;border-radius: 8px;}
  82. .loading_tor_text{height: inherit;width: 0%;background: linear-gradient(#1dff60, #00b327);border-radius: 8px;color: #676767;font-size: 1em;padding: 2px;}
  83.  
  84. .checkbox_Load:not(checked) {opacity: 0;}
  85. .checkbox_Load + label {cursor: pointer;position: absolute;left: 35%;}
  86. .checkbox_Load:checked + label:before {background: #53d64c;}
  87. .checkbox_Load:checked + label:after {left: 5px;content: 'ON';color: green;}
  88. .checkbox_Load:not(checked) + label:before {content: '';position: absolute;top: 2px;left: -28px;width: 60px;height: 20px;background: #ff6060;box-shadow: inset 0 2px 3px rgba(0,0,0,.2);}
  89. .checkbox_Load:not(checked) + label:after {content: 'OFF';position: absolute;top: 4px;left: -25px;width: 25px;height: 15px;background: #FFF;box-shadow: 0 2px 5px rgba(0,0,0,.3);transition: all .2s;}
  90. div.imgages_Load {display: table; border-collapse: collapse; color: #b40000;font-family: monospace;font-weight: bold;}
  91. .preLoadImagesCell{display: table-cell;height: 40px;vertical-align: middle;background: #fbf7f7;text-align: center;width: 40%;}
  92. .preLoadImagesRow{display:table-row;}
  93. .preLoadImagesRow #timoutTimeImages {width:50%;text-align: right;color: #00447f;font-family: monospace;font-weight: bold;}
  94. .splitter{border-top: 1px solid silver;}
  95.  
  96. tr.gai td a[href='javascript:void(0);'], tr.tum td a[href='javascript:void(0);']{margin-right: 5px;}
  97. tr.gai td a[href='javascript:void(0);'] img, tr.tum td a[href='javascript:void(0);'] img, .box_buttons_inner a[href='javascript:void(0);'] img{transition:1s transform;}
  98. tr.gai td a[href='javascript:void(0);'] img:hover, tr.tum td a[href='javascript:void(0);'] img:hover, .box_buttons_inner a[href='javascript:void(0);'] img:hover{transform: scale(1.3);filter: hue-rotate(270deg);}
  99. .FavBlockEl{margin: 0 5px 10px 0;background: #fbf7f7;box-shadow: 2px 2px 5px silver;}
  100. .FavBlockEl a {text-decoration: none;font-size: 0.8em;font-weight: bold;}
  101. .FavBlockEl a:hover {color: #73046a !important;}
  102. .FavBlockEl > div:nth-child(2) div {margin: 5px 0 5px 0;}
  103. .FavBlockEl > div:nth-child(3) {display: table-cell;vertical-align: middle;padding: 5px;border-left: 1px dotted;background: linear-gradient(to bottom, #fbf7f7, #ffc7c7);font-weight: bold;color: orange;user-select: none;cursor: pointer;}
  104. .FavBlockEl > div:nth-child(3):hover{background: linear-gradient(#ffd4d4 50%, #f59999);}
  105. .poleLinks{display:block;transition: 1s transform;}
  106. .poleLinks:hover{transform: scale(1.4);}
  107. .mDiv_Popup {background: #fbf7f7;width: 300px;border: 1px solid silver;box-shadow: 4px 4px 8px #00000073;border-radius: 6px;margin: 10% auto;text-align: center; display:none;}
  108. .mDiv_Popup > .mDiv_Popup_title {padding: 5px;font-size: 1.2em;font-family: cursive;border-radius: 6px 6px 0 0;background-image: url(/s/i/poisk_bg.gif);background-size: 40% 100%;color:white;}
  109. .mDiv_Popup > .mDiv_Popup_message_box {font-size: 1em;text-align: center;line-height: 1.5;color: darkslategrey;border-radius: 0 0 6px 6px;border-top: 1px solid #1d1d1d;}
  110. .mDiv_Popup_message_box > .mDiv_Popup_message {padding: 10px;max-height: 500px;min-height: 90px;overflow-y: auto;}
  111. .mDiv_Popup_smoke {position: fixed;background: #000000a6;left: 0;top: 0;width: 100%;height: 100%;display: none;z-index:3;}
  112. .box_buttons_inner {display: inline-block;margin-left: 20px;}
  113. .mDiv_Popup_title_x {float: right; cursor: pointer;}
  114. .mDiv_Popup_title_x:after {content: 'X';}
  115. .mDiv_Popup_title_x:hover {color: yellow;}
  116. tr.backgr td > div {display: inline;}
  117. .blend_class{background-blend-mode: luminosity;background-color: #ffd74540;}
  118. /*---*/
  119. .pop_panel{
  120. margin-right: 5px;
  121. position: relative;
  122. }
  123. .pop_elements {
  124. position: absolute;
  125. background: white;
  126. padding: 6px;
  127. text-align: center;
  128. border: 1px solid silver;
  129. top: -20px;
  130. right: 50%;
  131. width: max-content;
  132. height: -webkit-fill-available;
  133. border-radius: 6px;
  134. box-shadow: 0px 2px 4px 0px silver;
  135. display: none;
  136. }
  137. .pop_panel:hover > .pop_elements{
  138. display: block;
  139. }
  140.  
  141. .pop_elements a {
  142. position: relative;
  143. margin: 0px 10px;
  144. }
  145. .pop_elements a span {
  146. position: absolute;
  147. font-size: 5px;
  148. top: 13px;
  149. left: 50%;
  150. transform: translate(-50%, 0px);
  151. color: silver;
  152. }
  153. /*.pop_elements a[data-servname]:after {
  154. content: attr(data-servname);
  155. font-size: 8px;
  156. text-decoration: none;
  157. }*/
  158.  
  159. .service_splitter{
  160. border-right: 2px dotted silver;
  161. padding-right: 5px;
  162. }
  163.  
  164. #torrentPlayer {
  165. position: fixed;
  166. top: 50%;
  167. left: 50%;
  168. transform: translate(-50%, -50%);
  169. border: 1px solid silver;
  170. user-select: none;
  171. font-family: monospace;
  172. background: #ffffffcf;
  173. color: white;
  174. display: flex;
  175. flex-direction: column;
  176. justify-content: center;
  177. align-content: center;
  178. max-width: 35vw;
  179. }
  180.  
  181. .torrentPlayer_video {
  182. position: relative;
  183. height: 0;
  184. padding-bottom: 56.25%;
  185. background: #000000d1;
  186. }
  187.  
  188. .torrentPlayer_video iframe{
  189. position: absolute;
  190. width: 100%;
  191. height: 100%;
  192. top: 0;
  193. left: 0;
  194. }
  195.  
  196. .torrentPlayer_list {
  197. color: #810c0c;
  198. padding: 2px;
  199. line-height: 2;
  200. font-weight: bold;
  201. }
  202.  
  203. .torrentPlayer_title {
  204. background: black;
  205. font-weight: bold;
  206. text-align: center;
  207. }
  208.  
  209. .torrentPlayer_info {}
  210.  
  211. .torrentPlayer_close {
  212. cursor: pointer;
  213. position: absolute;
  214. right: -12px;
  215. top: -15px;
  216. background: #c0c0c0e0;
  217. border-radius: 100%;
  218. padding: 10px;
  219. z-index: 1;
  220. }
  221. .torrentPlayer_close:hover {
  222. background: #939393de;
  223. }
  224.  
  225. .torrentPlayer_playlist {
  226. max-height: 200px;
  227. overflow-y: scroll;
  228. list-style: none;
  229. display: flex;
  230. flex-direction: column;
  231. margin: 2px;
  232. padding: 4px;
  233. }
  234.  
  235. .torrentPlayer_playlist li {
  236. cursor: pointer;
  237. border: 1px solid #ffa302;
  238. background: linear-gradient(45deg, #fed304, transparent);
  239. border-radius: 4px;
  240. padding: 0 6px;
  241. margin: 2px;
  242. display: flex;
  243. flex-direction: row;
  244. align-items: center;
  245. justify-content: space-between;
  246. word-break: break-all;
  247. }
  248.  
  249. .torrentPlayer_playlist_item_title{
  250. text-align: left;
  251. border-right: 2px dotted orange;
  252. width: 90%;
  253. }
  254.  
  255. .torrentPlayer_playlist_item_title_item_size {
  256. padding: 0 3px;
  257. width: 10%;
  258. text-align: center;
  259. }
  260. .activExists:first-child:before {
  261. content: attr(data-exists);
  262. background: green;
  263. position: absolute;
  264. top: 50%;
  265. transform: translateY(-50%);
  266. left: -10px;
  267. writing-mode: vertical-lr;
  268. text-orientation: upright;
  269. color: wheat;
  270. padding: 2px;
  271. font-size: 0.7rem;
  272. }
  273. .activExistsRed:first-child:before{
  274. background: red;
  275. }
  276. `);
  277.  
  278. /* sorted plugin jquery
  279.  
  280. tr.backgr td:not(:first-child):not(:last-child) {background: url(/agrrr/img/sort-bg.gif) 100% -70px no-repeat;font-size: 12px;text-align: left;cursor: pointer;padding-right: 19px;}
  281. tr.backgr td.headerSortUp{background-position-y: -20px;}
  282. tr.backgr td.headerSortDown{background-position-y: -120px;}
  283.  
  284. tr.backgr td > div.headerSortUp{background-position-y: -135px;}
  285. tr.backgr td > div.headerSortDown{background-position-y: -36px;}
  286. tr.backgr td > div {background: url(/agrrr/img/sort-bg.gif) 100% -86px no-repeat;font-size: 12px;text-align: left;cursor: pointer;padding-right: 20px;display: inline;height: 20px;position: relative;top: 1px;}
  287. */
  288.  
  289. (function() {
  290. 'use strict';
  291. const $ = window.jQuery,
  292. image_arrow = "https://raw.githubusercontent.com/AlekPet/Rutor-Preview-Ajax/master/assets/images/arrow_icon.gif",
  293. no_image = "https://raw.githubusercontent.com/AlekPet/Rutor-Preview-Ajax/master/assets/images/no_image.png",
  294. favIcon = "https://raw.githubusercontent.com/AlekPet/Rutor-Preview-Ajax/master/assets/images/yellow_heart.png",//"https://aminoapps.com/static/bower/emojify.js/images/emoji/yellow_heart.png",
  295. searchIcon = "https://raw.githubusercontent.com/AlekPet/Rutor-Preview-Ajax/master/assets/images/search_icon.png",
  296. torrServIcon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAACplBMVEVVVVVURkdYT1B1WD9KPT1SR0hORUYtISIsJCYrISIzIiIsIyVcOhotICJ8eXdeVlZWTE1QRkdLQUNQRkeZajbTeBlbU1RSSElGPT1DOjppTC93Uy5RSEhaU1VUTExLQkJANjdMQkJPQk5IPD4/NjU/NTVPQ05DOTs9MjM9MDE/NjVAODY3Ky03Kyw2Kis1KSo0KCkxJihDOzlDOjkxJyguJCQ3LC0fDg0wJSZANjY/NTYnHR4yJihANzlBODgiGR89LCNwSB9ZSDtLQ0I5Li8vJCUqHR7gfQBXNxstIiY2Kyw2LC0vIyUsICAfCQ1NRkRYVU9ZWlBMRkVWUEyAgXeXlo2fpJaeqJiolHC8hjliV0hjYVmRkIebnJKem5Shp5y3rIjhmTS7oXGXn5FjX1lZXE+apJGNi4RuaWVoYmKTh23kmS7WnEmrrZ+orJ6Zno9YWE6EjXuosp+rrqKMjoaFdmXmoDf3kw7TolnIp22uspyor5+EjntOSESapZGqsqGusqagm4a/fCf8kwf+kgHwlRnEq3qttaaprqCYn49OSURaVFChq5ers6KvsaeimoOqgEv0lhj4jwbJomGwuaqvuKipraCgppZaWVBaVVCrsqKusKanq5/Hj0L+lATGfiOGdmB8e3Kgp5irsKKgqJZbXFJQSkabp5KrtaKsrqXIrnf5lg3/kgDhhQ21jFCQj4SXnI6rsaFSTkeJlYCotKCtrJvNoFrnkyT4jgTJjD6EfHB1c22SlYmnrJ6Fh3xjZVqcqpOnq56xrZPimDPQlEKAdm2YmZGEgnt2dmybn5FhXFhxcmman5HKoFvUmkaurpmQj4l4c255d2+MlYNxcWiBa028ikGgnYagqpmgopaZmo+KjIBoaGBeW1dramNqZmFfWVb///9Brb7hAAAAT3RSTlMAAAAAAAAAAAAAAAAAAAI0h8PewkMID3bc/f3heA8Pk/mTAnb5+QI03If9/cPD3t7Dh/39hzTcAnb5+Q+T+fkPe+L8/dx2Dww9ht7ehzQC034NnwAAAAFiS0dE4V8Iz6YAAAAHdElNRQfnARcNDQ5t9QcVAAABG0lEQVQY0wEQAe/+AAABAg4PEBESEhMQFBUDAQAABAUWFxgZT1BRUhobHB0FBAAGHh8gU1RVVldYWVogIR4GACIjJFtcXV5fYGFiY2QlIyYAJyhlZmdoaWprbG1ub3AoJwApKnFyc3R1dnd4eXp7fCspACx9fn+AgYKDhIWGh4iJii0ALouMjY6PkJGSk5SVlpeYLgAvmYyam5ydnp+goaKjpKUvADCmp6ipqqusra6vsLFvsjAAMTKztLW2t7i5uru8vb4zNAA1Nr/AwcLDxMXGx8jJyjY1ADc4OcvMzc7P0NHS09Q6ODcABzs8PdXW19jZ2tvcPjw7BwAICT9AQULd3t/gQ0RFRgkIAAoLDEdISTBKSzBMTU4NCwoBwWbifpX7rQAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAyMy0wMS0yM1QxMzoxMjo1MyswMDowMINE+WMAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMjMtMDEtMjNUMTM6MTI6NTMrMDA6MDDyGUHfAAAAKHRFWHRkYXRlOnRpbWVzdGFtcAAyMDIzLTAxLTIzVDEzOjEzOjE0KzAwOjAwCyM7SgAAAABJRU5ErkJggg==",
  297. torrServToAdd = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAABDlBMVEVKr1BKrzBLr09Lrk9Mo0ZLrlF0w19Mrk5Lrk5PqkZMr1BLrlBMr05Mrk9avjNKrk5Lr1BCtGJHpUFLr045vlVNrE1Lrk9Krk9Lrk9Lrk9Lrk9Lrk9Mrk9Mr05Mr09Lrk9Lrk9Lrk9Lrk9Lrk9Mrk9Lrk9Lrk9Lrk9Lr09JrU5Lrk9Lr09Lrk9Lrk9Lrk9Lrk9Lrk9Lrk9Mrk9Lrk9LrlBLsE5Lrk9Mrk9Kr05Lrk9MrlBLrk5Mr09Lrk9IrU1Krk9TsVaJyoxTslZKrU5gt2Pq9utguGRIrUxft2Lt9+7u9+5guGNSsVZet2JdtmFxv3Tv+O/v+PBywHWKyo3q9urt9+39/v1xv3Vft2P///+b6o0DAAAAPXRSTlMAAAAAAAAAAAAAAAAAAAAAAAAAAAAABkei3fncSgcajujrjRcarf6pFwaMB+nqSaH420lIBweoFxaLB0gHlFkjPAAAAAFiS0dEWZqy9BgAAAAJcEhZcwAAAOwAAADsAXkocb0AAAAHdElNRQfnARcNDQ5t9QcVAAAA0UlEQVQY02NgYGQSE5eQlJKSlpCRZWZhZWBjl5NXsAUDRSVlDk4GLhVVEMfODkioqWtwM2jKA1n2Do6OTvZAES1tBnEdoICzi6urmzOQoavHIAHiu3t4enm7g0T0GSRtbX18/fwDAoP8fH1sbaUZpGztgkNCA8LCAkJdg91tDTAFIFrCAwPDwVoMoYZGeHpGQA01UoRa6wK21pjBREsN6DAfR0cfsMNMGXiU1dXgTjcz52Xg47ew1IV4TlfLXECQgVWI2UpPX9rAwFDf2kZYRBQA9Mo2aHeqks0AAAAldEVYdGRhdGU6Y3JlYXRlADIwMjMtMDEtMjNUMTM6MTI6MjgrMDA6MDCLhqSAAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIzLTAxLTIzVDEzOjEyOjI4KzAwOjAw+tscPAAAACh0RVh0ZGF0ZTp0aW1lc3RhbXAAMjAyMy0wMS0yM1QxMzoxMzoxNCswMDowMAsjO0oAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb7jwaAAAAAElFTkSuQmCC",
  298. aceStreamIcon = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAACZFBMVEX//wD/+CL/////dFgAAAD/yf//6AP//wP/fVn/5a3//xFds8v//zOm//9izl8y03NXpbxmxeAA7/9CsZQA/xA+7JGD+v88/44w0XJft9Bu1PEAAAABAQDuVUH4WUT5WUTyVj0KAAAAAAEKBQD4fQD6egfxWzj9W0X+W0X+W0X/W0H6WkncVFsBAQEEAgDhcQD9fwD9gAD+Xz3+W0X+W0X+W0PRVXWdVM+eVNGdUsoSCQD9gAD+gAD6YzP+W0b/W0X/W0ONUNmcVNSdVdSdVdSdVdScVNOYUs36fgD+gAD+gAD7YzP9WkX5WUS6PA2OTMCcVNOdVdScVNOcVNOdVdScVNP4gQL+gAD+gAD9gACKRridUtLoAMCAOaecVNOdVdP1wiP3tBz+fwD+gADjcgADAgA6fohGjJ1Hi50BfU2fS9GcVNP8xiT1wyTYeQbxhwcCBARIip1JjJ9IjJ5WgKX8xiX8xiT7xiT6xiQHBgFBfJBIi55JjJ9Ii55Ih5yUGKf8xiT9xyX9xyX8xiXyvCEhk08hoE9DjJRIi55Ji55JjJ/6xCT9xyT9xyX8xiTTuisipVsnplonp1smplonmlxEfJVJi55JjJ9HiZzqviX/xiP/xiAABjAmplomplpHiZxJjJ9Ji55DgpQ0plUjpVoaolwlpVonp1snp1snp1smpVlIi55Ji59Iip0BAgMdj08mplonp1onp1onp1omplompFkmplkwmG5Ii55Ii55Ii50KLxglolgmpVklolgSVS1GdpxIip5Ii55HiJsBAgIBAwE/e45FhpgAAQFJjJ8np1v///+JAouZAAAAyXRSTlMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAQggIAsBAQEWGw5SmpFnPQsBAQZTTmy/skEUQYEjAWyDHsDXXRWe8fnNghkq1nIiQRcDCHrde6f0oRit9WIGNAEEctobGXKHBwEHaUQDFZZxHQYJAUDwnC/QZGJAAQmq/JUmAsHy9LQMBhMldcv5MM3njRQ/gLKbDAi88TITXCoBi3wq6LoNGUYwQuPo5DSO5kMBBV/E4tqPMlITZsJNAR0wGwIHRGMfAQEFCwGmiBL/AAAAAWJLR0QCZgt8ZAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAAAd0SU1FB+cBFw0NDfT8Vq8AAAEbSURBVBjTARAB7/4AGxsbHBsAAQIDHR4fICEiGwAbGyMEACQlJicoKSorLAQtABsuBC8wMTIzNDU2Nzg5BQIAGxs6Ozw9Pj9AQUJDREVGRwAbBkhJSktMTU5PUFFSU1RVAAdWV1hZBAgJGwRaW1xdXl8AYGFiY2QEZRsbBGZnaGlqawBsbW5vCiMbG3ALcXJyc3RbAHV2d3gMeRsEDXp7yXx9fn8AgIGCg4QOD4WGh4iJinEQGwCLjI2Oj5CRkpOUlZaXmBEbAJmamxKcncrKnhOfoKGiBBsAo6Slpp2nqKmqFKusrRGuGwCvsLGys7S1tre4uboEGxsbAAS7vL2+vxXAwcLDFhvEGxsAxRsXGBcEG8bHGRobyBsbG5hpVpaCHPp+AAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIzLTAxLTIzVDEzOjEyOjI4KzAwOjAwi4akgAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMy0wMS0yM1QxMzoxMjoyOCswMDowMPrbHDwAAAAodEVYdGRhdGU6dGltZXN0YW1wADIwMjMtMDEtMjNUMTM6MTM6MTMrMDA6MDDOhAXEAAAAAElFTkSuQmCC",
  299.  
  300.  
  301. images_ = [image_arrow,no_image,favIcon,searchIcon,torrServIcon],
  302.  
  303. hostname = location.origin,
  304.  
  305. debug = 0,
  306. torr_serv_port = 8090,
  307. acestream_port = 6878
  308.  
  309. var ObjSave = null,
  310. TimeOutImages = 5;
  311.  
  312. GM_addValueChangeListener('ObjSave', function() {
  313. let ls_value = GM_getValue('ObjSave');
  314.  
  315. ObjSave = (ls_value)?JSON.parse(ls_value):{};
  316. updateFav();
  317. updateForm();
  318. });
  319.  
  320. function checkLocaltorage(){
  321. if(ObjSave){
  322. if (!ObjSave.hasOwnProperty('favorites')){
  323. ObjSave.favorites = [];
  324. }
  325.  
  326. if (!ObjSave.hasOwnProperty('options')){
  327. ObjSave.options = {};
  328. }
  329.  
  330. if(debug) console.log("Объект: ",ObjSave);
  331. }
  332. }
  333.  
  334. function loadStorage(){
  335. let ObjSave_tmp = GM_getValue('ObjSave');
  336.  
  337. ObjSave = (ObjSave_tmp) ? JSON.parse(GM_getValue('ObjSave')) : {
  338. options: {}
  339. };
  340.  
  341. checkLocaltorage();
  342. }
  343.  
  344. function saveToStorage(){
  345. try{
  346. var save_data = JSON.stringify(ObjSave);
  347.  
  348. if(save_data.length>0 && save_data !== null && save_data !=="" && save_data !== undefined){
  349. GM_setValue('ObjSave', save_data);
  350. if(debug) console.log("Сохраненно: ",ObjSave);
  351. }
  352. }catch(e){
  353. console.log(e);
  354. }
  355. }
  356.  
  357. function LoadingImages(param){
  358. try{
  359. //Images
  360. let callback = param.func,
  361. content = param.content,
  362. button = param.button,
  363. elem = param.elem,
  364. IMGElements = $(content).find('#details tr:eq(0) img:not([src^="http://rublacklist.net"])'),
  365. lenIMG = IMGElements.length,
  366.  
  367.  
  368. progressBar = $(elem).nextAll(":eq(0)"),
  369. progressBarText = progressBar.find(".loading_tor_text"),
  370. procentuno = 100/lenIMG;
  371.  
  372. if(lenIMG > 0){
  373. if(debug){
  374. console.log(`Изображений найдено: ${lenIMG}\n------------------------------`);
  375. console.log("Тайм-аут равен: ", TimeOutImages, "Если 0 тайм-аут выкл.");
  376. }
  377.  
  378. let imgLoaded = 0,
  379. procentLoaded = 0;
  380.  
  381. progressBar.show();
  382.  
  383. $(IMGElements).each(function(){
  384. let image = this,
  385. timer = null;
  386.  
  387. $(image).one("load", function(){
  388. if (timer) {
  389. clearTimeout(timer);
  390. timer = null;
  391. }
  392.  
  393. imgLoaded++;
  394.  
  395. if(debug) console.log("Изображений загруженно: ",imgLoaded);
  396.  
  397. procentLoaded += procentuno;
  398. progressBarText.css("width", procentLoaded+"%");
  399. progressBarText.text("Загружено "+procentLoaded.toFixed(1)+"%");
  400.  
  401. if(imgLoaded === lenIMG){
  402. progressBarText.text("100.0%");
  403. progressBarText.css("width", "100%");
  404. callback(param);
  405. progressBar.fadeOut('slow');
  406. }
  407. })
  408. .one('error', function() {
  409. let src = $(this).attr("src");
  410.  
  411. $(this).attr({
  412. "title": "Изображение не найдено:\n"+src,
  413. "src": no_image,
  414. "error_image": 1
  415. }).css({"cursor":"pointer"});
  416. $(this).click(function(){window.open(src);});
  417. })
  418. .attr("src",image.src);
  419.  
  420. if(TimeOutImages !== 0){
  421. timer = setTimeout(function(theImg) {
  422. return function() {
  423. if(debug) console.log(`Таймер истек: ${theImg.src}\n------------------------------`);
  424.  
  425. theImg.onload = theImg.onabort = theImg.onerror = function() {};
  426.  
  427. if (timer) {
  428. clearTimeout(timer);
  429. timer = null;
  430. }
  431.  
  432. let src = $(theImg).attr("src");
  433.  
  434. $(theImg).attr({
  435. "title": "Изображение не найдено:\n"+src,
  436. "src": no_image,
  437. "error_image": 1
  438. }).css({"cursor":"pointer"}).click(function(){window.open(src);});
  439.  
  440. if(imgLoaded === lenIMG){
  441. progressBarText.text("100.0%");
  442. progressBarText.css("width", "100%");
  443. callback(param);
  444. progressBar.fadeOut('slow');
  445. }
  446. };
  447. }(image), TimeOutImages*1000);
  448. }
  449. });
  450. }
  451. } catch(e){
  452. console.log(e);
  453. }
  454. }
  455.  
  456. // Правим полученный контент
  457. function modifyData(param){
  458. var data = param.data,
  459. button = param.button,
  460. elem = param.elem,
  461.  
  462. content = $(data).find("#content")[0] || undefined;
  463.  
  464. if (!content){
  465. let nextEl = $(elem).next().next().children(0);
  466.  
  467. $(nextEl).html("<div style='text-align: center;font: italic 12pt monospace;color:red;'>Страница пока не доступна!</div>");
  468. return false;
  469. }
  470.  
  471. content.removeChild(content.children[0]);
  472. content.removeChild(content.children[0]);
  473. content.removeChild(content.lastElementChild);
  474. content.removeChild(content.lastElementChild);
  475.  
  476. $(content).find("tr").not(".c_h").hover(function(){$(this).css("background-color","transparent");},function(){$(this).css("background-color","transparent");});
  477.  
  478. let tableCount = $(content).find("table tr[class^='c_h']").length;
  479.  
  480. // Список файлов измененная загрузка
  481. let descrN = $(content).find(".header span").attr("onclick").toString().match(/descriptions\/(\d+)\.files/i)[1];
  482. $(content).find(".header span").removeAttr("onclick");
  483. $(content).find(".header span").attr("filelist_already_loaded", 0);
  484.  
  485. $(content).find(".header span").click(function(){
  486. if($(this).attr("filelist_already_loaded") == 0){
  487. $(this).attr("filelist_already_loaded",1);
  488. $(content).find('#filelist').load('/descriptions/'+descrN+'.files');
  489. }
  490. $(content).find('#displayfiles').fadeToggle('slow', 'linear');
  491. });
  492. //
  493.  
  494. $(content).find("#cem").before('<div class="box_comments"><div title="Показать комментарии" class="com_Style">Комментарии'+(tableCount>0?' ('+tableCount+')':'')+'</div><div style="display:none;" id="hiden_cc"></div></div>');
  495.  
  496. $(content).find(".com_Style").click(function(){$(this).next().fadeToggle( 'slow', 'linear');});
  497.  
  498. $(content).find("#hiden_cc").append($(content).find("#cem"));
  499.  
  500. let tableCom = $(content).find("table tr[class^='c_h']").parent().parent();
  501.  
  502. $(content).find("#hiden_cc").append(tableCom.prev(),tableCom.prev().prev(),tableCom);
  503.  
  504. let cloneButton = (button.clone(true)).attr("title","Скрыть раздачу"),
  505.  
  506. spoiler = $("<div class='footSpoiler'></div>").html(cloneButton);
  507.  
  508. $(content).append(spoiler);
  509.  
  510. content.id = "my_content";
  511.  
  512.  
  513. let nextEl = $(elem).next().next().children(0);
  514.  
  515. $(nextEl).html(content);
  516.  
  517. if(debug) console.log("Предзагрузка включена...",$(".checkbox_Load")[0].checked);
  518.  
  519. if($(".checkbox_Load")[0].checked){
  520. LoadingImages({content:content, button:button, elem:elem, func: ShowIHide});
  521. } else {
  522. ShowIHide({button:button, elem:elem});
  523. }
  524. }
  525.  
  526. function MiniPanel(param){
  527. let button = param.button,
  528. elem = param.elem;
  529.  
  530. // Add see
  531. $(".mDiv_title.opens").show();
  532. let a_elems = $(elem).children()[2].children[4].href.indexOf('magnet') == -1 ? $(elem).children()[2].children[4]: $(elem).children()[2].children[5],
  533. textPop = a_elems.innerText,//.children(1).children()[5].innerText,
  534.  
  535. imgSmall = $(elem).nextAll(".my_tr:eq(0)").find('table#details tr:eq(0) img:not([error_image])').filter(function(i,val){
  536. if(val.width > 150 && !/banner|kinopoisk|imdb/i.test(this.src)){
  537. return this;
  538. }
  539. });
  540.  
  541. if(imgSmall.length>0){
  542. let elOut = imgSmall[0];
  543. for(let i of imgSmall){
  544. if(i.height > elOut.height) {
  545. elOut = i;
  546. }
  547. }
  548. imgSmall = elOut.src;
  549. } else {
  550. imgSmall = no_image ;
  551. }
  552.  
  553. if(debug) console.log("Мини изображение: ",imgSmall);
  554.  
  555. let imgEl = $('<img>').attr({
  556. src: imgSmall,
  557. width: "50px"
  558. }),
  559.  
  560. imgBox = $('<div style="display: table-cell;vertical-align: middle;padding:5px;border-right: 1px dotted white;"></div>').append(imgEl),
  561. textBox = $('<div style="display: table-cell;vertical-align: middle;font-size: unset;padding:2px;word-break: break-all;"></div>').text(textPop),
  562. hide = button.clone(true),
  563. hideE = $._data(hide[0], "events"),
  564. addonBox = $('<div class="minipanel"></div>').attr('title',hide.attr('title')).each(function () {
  565. for (var type in hideE){
  566. for (var handler in hideE[type]){
  567. if(handler === 'delegateCount') continue;
  568. $.event.add(this, type, hideE[type][handler], hideE[type].data);
  569. }
  570. }
  571. }).append(hide.off()),
  572.  
  573. elSee = $('<div class="seeEl"></div>').attr('title',textPop).append(imgBox, textBox,addonBox);
  574.  
  575. $(imgBox).add(textBox).click(function(){
  576. let offset = $(elem).offset().top;
  577. $('html, body').animate({scrollTop:offset}, 500, 'swing');
  578. });
  579.  
  580. $(elem).data(elSee);
  581.  
  582. $(".mDiv_inner").append(elSee).animate({scrollTop:$("div.mDiv_inner").offset().top}, 500, 'swing');
  583. }
  584.  
  585. // Функция появления и прочее
  586. function ShowIHide(param){
  587. let elem = param.elem,
  588. button = param.button,
  589. event_el = param.event_el || null;
  590.  
  591. $(elem).nextAll(".my_tr:eq(0)").animate(
  592. {
  593. width: [ "toggle", "swing" ],
  594. height: [ "toggle", "swing" ],
  595. opacity: "toggle"
  596. }, 1500, "linear", function(){
  597. if($(this).css("display") === "none"){
  598. button.css("transform", "scaleY(1)").attr("title","Показать раздачу");
  599.  
  600. // Remove see
  601. $(".mDiv_inner")[0].removeChild($(elem).data()[0]);
  602. if($(".my_tr:visible").length<1){
  603. $(".mDiv_title.opens").hide();
  604. }
  605.  
  606. } else {
  607. button.css("transform", "scaleY(-1)").attr("title","Скрыть раздачу");
  608.  
  609. // Mini Panel
  610. MiniPanel(param);
  611. }
  612.  
  613. const lenSee = $(".seeEl").length
  614. if(lenSee>0){
  615. $("#hideAll").fadeIn('fast')
  616. } else {
  617. $("#hideAll").fadeOut('fast')
  618. }
  619.  
  620. $(".mDiv_title.opens").text(`Открытые (${lenSee})`);
  621.  
  622. // Back offset on page
  623. //if(event_el !== "minipanel") $('html, body').animate({scrollTop:$(elem).offset().top}, 500, 'swing');
  624. $('html, body').animate({scrollTop:$(elem).offset().top}, 500, 'swing');
  625. });
  626. }
  627.  
  628. // Ajax запрос
  629. function ajaxJQ(param){
  630. if(debug) console.log("Ajax proceed...");
  631.  
  632. let button = param.button,
  633. link = param.link,
  634. elem = param.elem;
  635.  
  636. return new Promise(function(resolve, reject){
  637. $.ajax({
  638. url: link,
  639. success: function(data){
  640. if(debug) console.log("Ajax запрос завершен!");
  641.  
  642. //let ObjData = {data:data,button:button,elem:elem};
  643. //modifyData(ObjData);
  644. resolve({data:data,button:button,elem:elem})
  645. },
  646. error: function(e)
  647. {
  648. let nextEl = $(elem).next().next().children(0);
  649. $(nextEl).css({"text-align":"center","color":"red"}).text(e.statusText.toUpperCase()+": Нет ответа от сервера")
  650. ShowIHide({button:button, elem:elem});
  651. reject(null)
  652. }
  653. });
  654. })
  655.  
  656. }
  657.  
  658. function MakeFav(param){
  659. let elem = param.el || null,
  660. link = param.link,
  661. linkText = param.linkText,
  662. id = param.id,
  663. Down = param.Down,
  664. Mdown = param.Mdown,
  665. date_time = param.date_time,
  666. category = param.category,
  667. index = param.index,
  668. isExists = param.object?.isExists == undefined ? '' : param.object?.isExists?'OK':'NO',
  669.  
  670. searchText = searchEditReq(linkText),
  671.  
  672. FavElTitleA = $('<a style="color: #005fb4;"></a>').attr({href:hostname+"/torrent/"+id, target:"_blank",title:linkText}).text(linkText),
  673. FavElTitle = $(`<div ${isExists?'class="activExists '+(isExists=='NO'? 'activExistsRed':'')+'" data-exists="'+isExists+'"':''} style="display: table-cell;vertical-align: middle;padding:5px; width: 80%;position:relative;"></div>`).append(FavElTitleA,'<div class="class_category" style="position: absolute;top: -5px;left: 3px;color: #800047;font-size: 8px;font-weight: bold;background: #ffbbbb;padding: 0 5px;">'+category+'</div>'),
  674. FavAddBlock = $('<div style="display: table-cell;vertical-align: middle;padding:5px; width: 10%; border-left: 1px dotted orange;">'+
  675. '<div class="poleLinks"><a href="'+Down+'" target="_blank" title="Download"><img src="/s/i/d.gif" alt="Download"></a></div>'+
  676. '<div class="poleLinks"><a href="'+Mdown+'" target="_blank" title="Magnet Link"><img src="/s/i/m.png" alt="Magnet Link"></a></div>'+
  677. '<div class="poleLinks"><a href="'+hostname+"/search/"+encodeURIComponent(searchText)+'" target="_blank" title="Искать: '+linkText+'"><img src="'+searchIcon+'" alt="Искать:'+linkText+'" width="13"></a></div>'+
  678. '</div>'),
  679. FavElBlockX = $('<div title="Удалить!"></div>').text("X").click(function(e){
  680. let event_el = e.currentTarget,
  681. el_block = event_el.parentElement;
  682.  
  683. if(debug) console.log($(".mDiv_FavInner .FavBlockEl").index(el_block));
  684. removeFav({el:el_block, id:id, linkText:linkText, index:$(".mDiv_FavInner .FavBlockEl").index(el_block)});
  685. }),
  686. FavBlockEl = $('<div class="FavBlockEl"></div>').append(FavElTitle,FavAddBlock,FavElBlockX);
  687. FavBlockEl.on('mouseenter mouseleave', function(ev){
  688. $(this).first().toggleClass("blend_class")
  689. });
  690.  
  691. $(".mDiv_FavInner").append(FavBlockEl);
  692.  
  693. if($(".mDiv_FavInner").children().length === 0) {
  694. $(".mDiv_FavInner").empty();
  695. $(".mDiv_FavControl").fadeOut('slow');
  696. } else {
  697. $(".mDiv_FavControl").fadeIn('slow');
  698. }
  699.  
  700. $(".mDiv_title.fav").text('Избранное '+($(".mDiv_FavInner").children().length == 0 ?'':'('+$(".mDiv_FavInner").children().length+')'));
  701. }
  702.  
  703. async function addFav(param){
  704. let elem = param.el || null,
  705. link = param.link,
  706. linkText = param.linkText,
  707. Down = param.Down,
  708. Mdown = param.Mdown,
  709. date_time = param.date_time,
  710.  
  711. id = link,
  712.  
  713. category = await getCategoryTorrent(param)
  714.  
  715. try{
  716. // Get id
  717. id = id.match(/.*torrent\/(\d+)\//i)[1];
  718. param.id = id;
  719. if(!id) id = link;
  720.  
  721. if(debug) console.log("Ид равен: ", id);
  722.  
  723. // Save local storage
  724. if (!ObjSave.hasOwnProperty('favorites')){
  725. ObjSave.favorites = [];
  726. }
  727.  
  728. if(!checkPovtor({id:id,linkText:linkText})){
  729. if(debug) console.log("Нет в базе избранного, сохраняю!");
  730.  
  731. fly.call(elem, ".mDiv_FavInner", 3, 3000)
  732.  
  733. ObjSave.favorites.push({
  734. el: null,
  735. link: encodeURI(link),
  736. linkText: escape(linkText),
  737. id: id,
  738. Down: encodeURI(Down),
  739. Mdown: encodeURI(Mdown),
  740. date_time: date_time,
  741. category: category
  742. });
  743.  
  744. saveToStorage();
  745. //MakeFav(param); -> GM_addValueChangeListener update auto
  746.  
  747. showMessage('Избранное',`<p>Успешно добавлен в избранное!</p><p><b>${linkText}<b></p>`)
  748. }
  749. } catch (e){
  750. console.log(e);
  751. }
  752. }
  753.  
  754. function revomeFavAll(){
  755. if(confirm(`Вы действительно хотите очистить список избранного?`)){
  756. if (ObjSave.hasOwnProperty('favorites') && Object.keys(ObjSave.favorites).length){
  757. ObjSave.favorites = [];
  758. $(".mDiv_FavInner").empty().text('Пусто...');;
  759. saveToStorage();
  760. if(debug) console.log("Все элементы удалены из избранного!");
  761. $(".mDiv_title.fav").text('Избранное '+($(".mDiv_FavInner").children().length == 0 ?'':'('+$(".mDiv_FavInner").children().length+')'));
  762. $(".mDiv_FavControl").fadeOut('slow')
  763. }
  764. }
  765. }
  766.  
  767. function removeFav(param){
  768. let el = param.el,
  769. id = param.id,
  770. linkText = param.linkText,
  771. index = param.index;
  772.  
  773. if(confirm(`Вы действительно хотите удалить?\n"${linkText}"?`)){
  774. if (ObjSave.hasOwnProperty('favorites') && index !== "" && index !== null && index !== undefined){
  775. $(el).animate({"height":"0px","opacity": "0"},'slow', function(){
  776. ObjSave.favorites.splice(index, 1);
  777. $(this).remove();
  778. saveToStorage();
  779. if(debug) console.log("Элемент удален из избранного!");
  780. $(".mDiv_title.fav").text('Избранное '+($(".mDiv_FavInner").children().length == 0 ?'':'('+$(".mDiv_FavInner").children().length+')'));
  781.  
  782. if(!Object.keys(ObjSave.favorites).length) {
  783. $(".mDiv_FavInner").text('Пусто...');
  784. $(".mDiv_FavControl").fadeOut('slow')
  785. } else {
  786. $(".mDiv_FavControl").fadeIn('slow')
  787. }
  788. });
  789. }
  790. }
  791. }
  792.  
  793. function checkPovtor(params){
  794. let povtor = false,
  795. linkText = params.linkText,
  796. id = params.id
  797.  
  798. if (ObjSave.hasOwnProperty('favorites')){
  799. if(ObjSave.favorites.length > 0){
  800. for(var i=0; i<ObjSave.favorites.length;i++){
  801. let current = ObjSave.favorites[i]
  802. if(current.id === id){
  803. if(debug) console.log("Уже есть в базе избранного!");
  804. showMessage('Внимание',`<p>Уже есть в базе избранного!</p><p><b>${linkText}<b></p>`)
  805. povtor = true;
  806. }
  807. }
  808. }
  809. }
  810.  
  811. return povtor;
  812. }
  813.  
  814. function updateForm(){
  815. if (ObjSave.hasOwnProperty('options')){
  816. let chechVal = null,
  817. timoutTimeImages = 5;
  818. if (ObjSave.options.hasOwnProperty('preload')) chechVal = ObjSave.options.preload;
  819.  
  820. $("#checkbox_imgages_Load")[0].checked = chechVal;
  821.  
  822. timoutTimeImages = (ObjSave.options.hasOwnProperty('TimeOutLoadImages') && typeof(ObjSave.options.TimeOutLoadImages) == "number")?ObjSave.options.TimeOutLoadImages:5;
  823. $("#timoutTimeImages").val(timoutTimeImages);
  824. }
  825. }
  826.  
  827. function updateFav(){
  828. if(!ObjSave.options?.settings_visible?.fav) return
  829.  
  830. if (ObjSave.hasOwnProperty('favorites')){
  831. if(ObjSave.favorites.length > 0){
  832. $(".mDiv_FavInner").empty();
  833. for(let pFav = 0; pFav<ObjSave.favorites.length; pFav++){
  834. let ObjFavCur = ObjSave.favorites[pFav];
  835.  
  836. MakeFav({
  837. el: null,
  838. link: decodeURI(ObjFavCur.link),
  839. linkText: unescape(ObjFavCur.linkText),
  840. Down: decodeURI(ObjFavCur.Down),
  841. id: ObjFavCur.id,
  842. Mdown: decodeURI(ObjFavCur.Mdown),
  843. date_time: ObjFavCur.date_time,
  844. category: ObjFavCur.category,
  845. index: pFav,
  846. object: ObjFavCur
  847. });
  848. }
  849. }
  850. }
  851. }
  852.  
  853. function showMessage(title = "Сообщение", message, anim_time_sec = 1000, time_delay_sec = 3000, autohide=true){
  854. $(".mDiv_Popup_message_box > .mDiv_Popup_message").html(message);
  855. $(".mDiv_Popup > .mDiv_Popup_title span").text(title);
  856.  
  857. $(".mDiv_Popup_smoke").fadeIn(anim_time_sec, function(){
  858. $(".mDiv_Popup").fadeIn(anim_time_sec,function(){
  859. if(autohide){
  860. let anim = function (){$(this).fadeOut(anim_time_sec, function(){$(".mDiv_Popup_smoke").fadeOut(anim_time_sec);});}.bind(this);
  861. setTimeout(anim, time_delay_sec)
  862. }
  863. });
  864. });
  865. }
  866.  
  867. function searchinHost(search){
  868. return location.href.includes(search);
  869. }
  870.  
  871. function makePanel(){
  872. if(!document.getElementById("sidebar")) return;
  873.  
  874. if (!ObjSave.options.hasOwnProperty('settings_visible')){
  875. ObjSave.options.settings_visible = {
  876. sett:true,
  877. fav:true,
  878. opens:true,
  879. stream:true
  880. }
  881. } else if(typeof ObjSave.options.settings_visible == 'boolean'){
  882. ObjSave.options.settings_visible = {
  883. sett:true,
  884. fav:true,
  885. opens:true,
  886. stream:true
  887. }
  888. }
  889. if(debug)console.log('Menu show-hide: ',ObjSave.options.settings_visible)
  890.  
  891. let hostisT = searchinHost("/torrent/"),
  892. settings_visible = ObjSave.options.settings_visible,
  893. div = $('<div class="mDiv">'+
  894. (!hostisT?
  895. '<div class="mDiv_title'+(settings_visible.sett?'':' no_vis')+' sett">Настройки</div>'+
  896. '<div class="mDiv_settings_body" style="'+(settings_visible.sett?'display: block':'display: none')+'">'+
  897. '<div id="preLoadImages" class="imgages_Load">'+
  898. '<div class="preLoadImagesRow">'+
  899. '<div class="preLoadImagesCell">Предзагрузка: </div>'+
  900. '<div class="preLoadImagesCell" style="position:relative;"><input type="checkbox" class="checkbox_Load" id="checkbox_imgages_Load"><label for="checkbox_imgages_Load"></label></div>'+
  901. '</div>'+
  902. '<div class="preLoadImagesRow">'+
  903. '<div class="preLoadImagesCell">Тайм-аут загр.</div>'+
  904. '<div class="preLoadImagesCell"><input type="number" id="timoutTimeImages" title="Тайм-аут загрузки изображений.\nЕсли 0, то тайм-аут устанавл. настройкой браузера!" min="0" step="0.1"> сек.</div>'+
  905. '</div>'+
  906. '</div>'+
  907. '<div class="mDiv_title'+(settings_visible.stream?'':' no_vis')+' stream">Torrent Stream</div>'+
  908. '<div class="mDiv_settings_body imgages_Load" style="'+(settings_visible.stream?'display: block':'display: none')+'">'+
  909. '<div class="preLoadImagesRow">'+
  910. '<div class="preLoadImagesCell">TorrServer Ip:Port</div>'+
  911. '<div class="preLoadImagesCell"><input style="width: 150px;text-align:center;transform: scale(0.9);" id="torr_server_address" data-service="TorrServer" title="TorrServer адресс и порт" value="localhost:8090"></div>'+
  912. '</div>'+
  913. '<div class="preLoadImagesRow">'+
  914. '<div class="preLoadImagesCell">AceStream Ip:Port</div>'+
  915. '<div class="preLoadImagesCell"><input style="width: 150px;text-align:center;transform: scale(0.9);" id="acestream_server_address" data-service="AceStream" title="AceStream адресс и порт" value="localhost:6878"></div>'+
  916. '</div>'+
  917. '<div style="display:block;padding:2px;color:darkslateblue;font-size: 0.8rem;">Альфа версия: Нужен запущенный TorrServer или AceStream(лучше TorrServer😀) и запущенный <a href="https://github.com/AlekPet/Rutor-Preview-Ajax/tree/master/servers/nodejs">сервер</a>.</div>'+
  918. '</div>'+
  919. '<div class="mDiv_title'+(settings_visible.opens?'':' no_vis')+' opens">Открытые</div>'+
  920. '<div class="mDiv_settings_body" style="'+(settings_visible.opens?'display: block':'display: none')+'">'+
  921. '<div id="hideAll" class="buttonsStyle">Свернуть все</div>'+
  922. '<div class="mDiv_inner"></div>'+
  923. '</div>'+
  924. '<div class="mDiv_title'+(settings_visible.fav?'':' no_vis')+' fav">Избранное</div>'+
  925. '<div class="mDiv_settings_body" style="'+(settings_visible.fav?'display: block':'display: none')+'">'+
  926. '<div class="mDivFavControl_box">'+
  927. '<div class="mDiv_FavControl buttonsStyle" title="Очистить список избранного!">Очистить избранное</div>'+
  928. '<div class="mDiv_FavControlCheck buttonsStyle" title="Проверить торренты">Проверить торренты</div>'+
  929. '</div>'+
  930. '<div class="mDiv_FavInner"></div>'+
  931. '</div>'+
  932. '</div>': /* One torrent */
  933. '<div class="mDiv_title'+(settings_visible.sett?'':' no_vis')+' sett">Настройки</div>'+
  934. '<div class="mDiv_settings_body" style="'+(settings_visible.sett?'display: block':'display: none')+'">'+
  935. '<div id="preLoadImages" class="imgages_Load">'+
  936. '</div>'+
  937. '<div class="mDiv_title'+(settings_visible.stream?'':' no_vis')+' stream">Torrent Stream</div>'+
  938. '<div class="mDiv_settings_body imgages_Load" style="'+(settings_visible.stream?'display: block':'display: none')+'">'+
  939. '<div class="preLoadImagesRow" style="color:#b40000;">'+
  940. '<div class="preLoadImagesCell">TorrServer Ip:Port</div>'+
  941. '<div class="preLoadImagesCell"><input style="width: 150px;text-align:center;transform: scale(0.9);" id="torr_server_address" data-service="TorrServer" title="TorrServer адресс и порт" value="localhost:8090"></div>'+
  942. '</div>'+
  943. '<div class="preLoadImagesRow">'+
  944. '<div class="preLoadImagesCell">AceStream Ip:Port</div>'+
  945. '<div class="preLoadImagesCell"><input style="width: 150px;text-align:center;transform: scale(0.9);" id="acestream_server_address" data-service="AceStream" title="AceStream адресс и порт" value="localhost:6878"></div>'+
  946. '</div>'+
  947. '<div style="display:block;padding:2px;color:darkslateblue;font-size: 0.8rem;">Альфа версия: Нужен запущенный TorrServer или AceStream(лучше TorrServer😀) и запущенный <a href="https://github.com/AlekPet/Rutor-Preview-Ajax/tree/master/servers/nodejs">сервер</a>.</div>'+
  948.  
  949. '</div>'+
  950. '<div class="mDiv_title'+(settings_visible.opens?'':' no_vis')+' opens">Открытые</div>'+
  951. '<div class="mDiv_settings_body" style="'+(settings_visible.opens?'display: block':'display: none')+'">'+
  952. '<div id="hideAll" class="buttonsStyle">Свернуть все</div>'+
  953. '<div class="mDiv_inner"></div>'+
  954. '</div>'+
  955. '<div class="mDiv_title'+(settings_visible.fav?'':' no_vis')+' fav">Избранное</div>'+
  956. '<div class="mDiv_settings_body" style="'+(settings_visible.fav?'display: block':'display: none')+'">'+
  957. '<div class="mDiv_FavControl buttonsStyle" title="Очистить список избранного!">Очистить избранное</div>'+
  958. '<div class="mDivFavControl_box">'+
  959. '<div class="mDiv_FavControl buttonsStyle" title="Очистить список избранного!">Очистить избранное</div>'+
  960. '<div class="mDiv_FavControlCheck buttonsStyle" title="Проверить торренты">Проверить торренты</div>'+
  961. '</div>'+
  962. '<div class="mDiv_FavInner"></div>'+
  963. '</div>'+
  964. '</div>'+
  965. '</div>'+
  966. '</div>')+
  967. '</div>'),
  968.  
  969. chechVal = "";
  970. if (ObjSave.hasOwnProperty('options') && ObjSave.options.hasOwnProperty('preload')){
  971. chechVal = ObjSave.options.preload;
  972. }
  973.  
  974. $(div).find("#checkbox_imgages_Load").change(function(){
  975. if(debug) console.log("Предзагрузка: ",$(this)[0].checked);
  976.  
  977. if (ObjSave.hasOwnProperty('options')){
  978. if (!ObjSave.options.hasOwnProperty('preload')) ObjSave.options.preload = "";
  979. ObjSave.options.preload = $(this)[0].checked;
  980. saveToStorage();
  981. }
  982. }).attr("checked",chechVal);
  983.  
  984. $(div).find("#timoutTimeImages").change(function(){
  985. let valueTO = $(this).val();
  986.  
  987. if(debug) console.log("Тайм-аут установлен в: ", valueTO+" сек.");
  988.  
  989. if(valueTO === "" || /^\s?$/.test(valueTO)) $(this).val(5);
  990.  
  991. if (ObjSave.hasOwnProperty('options')){
  992. if (!ObjSave.options.hasOwnProperty('TimeOutLoadImages')) ObjSave.options.TimeOutLoadImages = 5;
  993. TimeOutImages = ObjSave.options.TimeOutLoadImages = parseFloat($(this).val());
  994. saveToStorage();
  995. }
  996. }).val((ObjSave.options.TimeOutLoadImages)?ObjSave.options.TimeOutLoadImages:5);
  997.  
  998. // TorrServ & AceStream
  999.  
  1000. $(div).find("#torr_server_address, #acestream_server_address").on('change',function(){
  1001. let valueInput = $(this).val(),
  1002. service = this.dataset.service,
  1003. options_service_name = service === 'TorrServer' ? ['torr_server_address', torr_serv_port] : ['acestream_server_address', acestream_port],
  1004. checkAddr = valueInput.match(/(localhost|\b\d{1,3}\b\.\b\d{1,3}\b\.\b\d{1,3}\b\.\b\d{1,3}\b)\:\b(\d+)\b/g),
  1005. prevVal = $(this).data('preVal')
  1006.  
  1007. if(!checkAddr) {
  1008. alert(`Адресс ${service}\'а указан неверно!`)
  1009. $(this).val(prevVal ? prevVal : 'localhost:'+options_service_name[1])
  1010. return;
  1011. }
  1012.  
  1013. $(this).data('preVal', valueInput)
  1014.  
  1015. if (ObjSave.hasOwnProperty('options')){
  1016. ObjSave.options[options_service_name[0]] = checkAddr && checkAddr.length==1 ? checkAddr[0] : 'localhost:'+options_service_name[1];
  1017. }
  1018. saveToStorage();
  1019.  
  1020. }).val(function(index, value){
  1021. const options_service_name = this.dataset.service === 'TorrServer' ? ['torr_server_address', torr_serv_port] : ['acestream_server_address', acestream_port]
  1022. return ObjSave.options[options_service_name[0]] ? ObjSave.options[options_service_name[0]] : 'localhost:'+options_service_name[1]
  1023. })
  1024.  
  1025. $("#sidebar").append(div);
  1026.  
  1027. $("#sidebar .mDiv").click(function(event){
  1028. const target = event.target
  1029. if(target.classList.contains('mDiv_title') /*&& !target.classList.contains('sett')*/){
  1030. const nameSp = target.classList[target.classList.length-1],
  1031. settings_body = $(target.nextElementSibling),
  1032. $traget = $(target)
  1033.  
  1034. if (settings_body.css('display') == 'none'){
  1035. if(nameSp === 'fav' && $('.mDiv_FavInner').children().length === 0) updateFav()
  1036. settings_body.slideDown('slow')
  1037. ObjSave.options.settings_visible[nameSp] = true
  1038. $traget.removeClass('no_vis')
  1039.  
  1040. } else {
  1041. settings_body.slideUp('slow')
  1042. ObjSave.options.settings_visible[nameSp] = false
  1043. $traget.removeClass(nameSp)
  1044. $traget.addClass('no_vis')
  1045. $traget.addClass(nameSp)
  1046. }
  1047. saveToStorage();
  1048. }
  1049.  
  1050. })
  1051.  
  1052. if(ObjSave.hasOwnProperty('favorites') && Object.keys(ObjSave.favorites).length > 0) {
  1053. $(".mDiv_FavInner").fadeIn('slow');
  1054. $(".mDiv_FavControl").fadeIn('slow');
  1055. } else{
  1056. $(".mDiv_FavInner").text('Пусто...').fadeIn('slow');
  1057. $(".mDiv_FavControl").fadeOut('slow');
  1058. }
  1059.  
  1060. let maxTop = $(".sideblock:nth-child(1)").offset().top+parseFloat($(".sideblock:nth-child(1)").css("height"))+parseFloat($(".sideblock:nth-child(2)").css("height"));
  1061. $(window).scroll(function() {
  1062. if($(window).scrollTop() >= maxTop){
  1063. $(".sideblock:eq(1)").css({"position":"fixed", "top":"0px","width":"250px"});
  1064. $(".mDiv").css({"position":"fixed", "top":"70px"});
  1065. } else {
  1066. $(".mDiv").add($(".sideblock:eq(1)")).removeAttr("style");
  1067. }
  1068. });
  1069.  
  1070. $("#hideAll").click(function(){
  1071. if($(".my_tr:visible").length){
  1072. $(".my_tr").fadeOut("slow", function(){
  1073. $("img.butSpoiler").css("transform", "scaleY(1)").attr("title","Показать раздачу");
  1074.  
  1075. // Remove see
  1076. $("#hideAll").fadeOut("fast", function(){
  1077. $(".mDiv_title.opens").hide();
  1078. $(".mDiv_inner").empty();
  1079. });
  1080.  
  1081. });
  1082. }
  1083. }).hide();
  1084.  
  1085. $(".mDiv_FavControl").click(revomeFavAll);
  1086. $(".mDiv_FavControlCheck").click(torrentsFavoritesExists);
  1087.  
  1088. appendSmokeAndPopUp()
  1089. }
  1090.  
  1091. function appendSmokeAndPopUp(){
  1092. $("body").append($('<div class="mDiv_Popup_smoke">'+
  1093. '<div class="mDiv_Popup">'+
  1094. '<div class="mDiv_Popup_title"><span></span><div class="mDiv_Popup_title_x"></div></div>'+
  1095. '<div class="mDiv_Popup_message_box">'+
  1096. '<div class="mDiv_Popup_message"></div>'+
  1097. '</div>'+
  1098. '</div>'));
  1099. $('.mDiv_Popup_title_x').click(function(){
  1100. $(".mDiv_Popup").fadeOut(1000, function(){$(".mDiv_Popup_smoke").fadeOut(1000);});
  1101. });
  1102. }
  1103.  
  1104. function searchEditReq(title){
  1105. let seatchText = title.match(/(.*)(?:\(|\[)/i)[1];
  1106.  
  1107. if(seatchText === null || seatchText === undefined || !seatchText.length) seatchText = title;
  1108.  
  1109. if(seatchText.indexOf("/") !=-1 || seatchText.indexOf("\\")!=-1){
  1110. seatchText = seatchText.replace(/\s?\/\s?|\s?\\\s?/g," ")
  1111. }
  1112. return seatchText;
  1113. }
  1114.  
  1115. function fly(target, size, duration){
  1116. target = $(target)
  1117.  
  1118. if($('.mDiv_settings_body').css('display') == 'none') target = $('.mDiv_title')
  1119.  
  1120. let posLeft = target.offset().left-$(this).offset().left,
  1121. posTop = target.offset().top-($(this).offset().top+target.height()/2)
  1122.  
  1123. $(this).
  1124. clone()
  1125. .css({
  1126. "position":"absolute",
  1127. "z-index":"9999999999",
  1128. "filter": "hue-rotate(270deg)",
  1129. "text-indent": "0px"
  1130. })
  1131. .appendTo(this)
  1132. .animate(
  1133. {
  1134. left:"+="+posLeft,
  1135. top:"+="+posTop,
  1136. textIndent: size
  1137. },
  1138. {
  1139. step: function( now, fx ) {
  1140. $(this).css("transform","scale("+now+")")
  1141. },
  1142. duration: duration,
  1143. complete: function(){
  1144. $(this).remove()
  1145. }
  1146. }
  1147. )
  1148. }
  1149.  
  1150. function convertSizes(bytes, poslezap = 2){
  1151. if (bytes === 0) return '0 Bytes';
  1152.  
  1153. const k = 1024,
  1154. dm = poslezap < 0 ? 0 : poslezap,
  1155. sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'],
  1156. i = Math.floor(Math.log(bytes) / Math.log(k));
  1157.  
  1158. return parseFloat((bytes / Math.pow(k, i)).toFixed(poslezap)) + ' ' + sizes[i];
  1159. }
  1160.  
  1161. // -- TorrServer
  1162. function checkRunningService(params){}
  1163.  
  1164. function requestTorrentService(params){
  1165.  
  1166. const method = params.method ? params.method : 'GET',
  1167. data = method == 'POST' && params.data ? params.data : ''
  1168.  
  1169. return new Promise((resolve, reject)=>{
  1170.  
  1171. GM.xmlHttpRequest({
  1172. method: method,
  1173. url: params.url,
  1174. data: data,
  1175. responseType: 'json',
  1176. headers : { 'Content-type' : 'application/json' },
  1177. onload: function(res) {
  1178. if(res.status == 200 && res.statusText == 'OK'){
  1179. resolve({status:'OK', data: res.response})
  1180. } else if(res.status == 403) {
  1181. resolve({status: 'error_403'})
  1182. } else {
  1183. reject(`[Status ${res.status}] Запрос вернул ошибку...`)
  1184. }
  1185. },
  1186. onerror: function(e){
  1187. reject('[Request] Запрос вернул ошибку...')
  1188. }
  1189. })
  1190. })
  1191. }
  1192.  
  1193. async function torrServAction(down, torr_server_address, save=true){
  1194. try{
  1195. const issave = save ? '&save' : '',
  1196. {status, data} = await requestTorrentService({url: `http://${torr_server_address}/stream/fname?link=${down}${issave}&stat`})
  1197.  
  1198. if(status == 'OK'){
  1199. return data
  1200. } else if(status == 'error_403') {
  1201. showMessage('ОШИБКА',`<p style='color:red; font-weight: bold;'>Запрошенный URL не может быть получен, проверьте работает ли TorServer!</p>`)
  1202. return null
  1203. }
  1204. }
  1205. catch(ev) {
  1206. showMessage('ОШИБКА',`<p style='color:red; font-weight: bold;'>TorrServ не работает (адрес <span style='color: blue;'>${torr_server_address}</span>) или ошибка в коде!</p><p>Текст ошибки: '${ev}'</p>`)
  1207. }
  1208. }
  1209.  
  1210. function returnIframe(v,addr,v_name,vhash,vindex=1,){
  1211. v.empty()
  1212. //const isvideo = /\.(?:mp4|mkv|avi|m3u8)$/g.test(v_name) ? {style: 'position: absolute; width: 100%;height: 100%;top: 0;left: 0;border:none;'} : {style: 'width:100%;border:none;overflow:hidden;'},
  1213. const addr_path = encodeURIComponent(`http://${addr}/stream/fname?link=${vhash}`),
  1214. serverHTTP = 'http://localhost:8000/frame' // 'http://alekpet.pythonanywhere.com/getvideo' // http://localhost:8000/frame
  1215. return `<iframe src="${serverHTTP}?path_vid=${addr_path}&name_vid=${encodeURIComponent(v_name)}&index_vid=${vindex}" frameborder="0" scrolling="no" />` //style="${isvideo.style}"
  1216. }
  1217.  
  1218. async function torrServer(params){
  1219.  
  1220. const {down, magn, linkText, action='add'} = params,
  1221. torr_server_address = $("#torr_server_address").val()
  1222.  
  1223. if(!torr_server_address){
  1224. alert(`Адрес TorrServer\'а '${torr_server_address}' указан неверно!`)
  1225. return
  1226. }
  1227.  
  1228. try{
  1229. if(action == 'add'){
  1230. if(confirm(`Добавить "${linkText}" для проигрывания в torrServ?`)){
  1231. const data = await torrServAction(magn, torr_server_address)
  1232. if(data){
  1233. showMessage('УСПЕШНО',`<p style='color:green;'><b>Торрент был сохранен в TorServer!</b></p>
  1234. <p><b>Название:</b> ${data.title || data.name}</p>
  1235. <p><b>Размер:</b> ${convertSizes(data.torrent_size)}</p>`)
  1236. }
  1237. }
  1238. } else if(action == 'play'){
  1239. const data = await torrServAction(magn, torr_server_address, false)
  1240. if(data){
  1241. if(confirm('Запустить проигрыватель?')){
  1242.  
  1243. let videos = data.file_stats.filter((elem, idx)=> /.(avi|mp4|mkv|mp3)/g.test(elem.path)),
  1244. boxPlayer = $('#torrentPlayer'),
  1245. close_vid,inner_vid,inner_list,vid_info,vid_title = null
  1246.  
  1247. if(boxPlayer.length) boxPlayer.remove()
  1248.  
  1249. boxPlayer = $("<div></div>").attr('id','torrentPlayer')
  1250.  
  1251. close_vid = $("<div class='torrentPlayer_close'>").attr('title','Закрыть').text('X').click(function(){
  1252. boxPlayer.hide(()=>{
  1253. boxPlayer.remove()
  1254. })
  1255. })
  1256. vid_title = $("<div class='torrentPlayer_title'>")
  1257. vid_info = $("<div class='torrentPlayer_info'>").text('Загрузка...')
  1258. inner_vid = $("<div class='torrentPlayer_video'>")
  1259. inner_list = $("<div class='torrentPlayer_list'>")
  1260.  
  1261. vid_title.append(vid_info,close_vid)
  1262.  
  1263. boxPlayer.append(vid_title,inner_vid,inner_list)
  1264. $('body').append(boxPlayer)
  1265.  
  1266. if(videos.length){
  1267. let frame = returnIframe(inner_vid, torr_server_address, videos[0].path, data.hash)
  1268. inner_vid.append(frame)
  1269.  
  1270. let ulpl = $("<ul class='torrentPlayer_playlist'></ul>")
  1271. vid_info.text(videos[0].path)
  1272.  
  1273. for(let [k,v] of videos.entries()){
  1274. let li = $("<li></li>").click(function(){
  1275. let frame = returnIframe(inner_vid, torr_server_address, v.path, data.hash, v.id)
  1276. inner_vid.html(frame)
  1277. vid_info.text(v.path)
  1278. }),
  1279. title_item_list = `${k+1}. ${v.path}`,
  1280. name_vid = $("<span class='torrentPlayer_playlist_item_title'>").text(title_item_list),
  1281. size_vid = $("<span class='torrentPlayer_playlist_item_size'>").text(convertSizes(v.length))
  1282.  
  1283. li.append(name_vid,size_vid)
  1284. ulpl.append(li)
  1285. }
  1286.  
  1287. inner_list.append(ulpl)
  1288. }
  1289. }
  1290. }
  1291. }
  1292. } catch(ev) {
  1293. showMessage('ОШИБКА',`<p style='color:red; font-weight: bold;'>Текст ошибки: '${ev}'</p>`)
  1294. }
  1295. }
  1296. // -- TorrServer
  1297.  
  1298. // -- AceStream
  1299. async function AceStreamAction(down, acestream_server_address, save=true){
  1300. try{
  1301. const issave = save ? '&save' : '',
  1302. {status, data} = await requestTorrentService({url: `http://${acestream_server_address}/server/api?method=get_api_access_token`})
  1303.  
  1304. if(status == 'OK'){
  1305. return data.result
  1306. } else if(status == 'error_403') {
  1307. showMessage('ОШИБКА',`<p style='color:red; font-weight: bold;'>Запрошенный URL не может быть получен, проверьте работает ли AceStream!</p>`)
  1308. return null
  1309. }
  1310. }
  1311. catch(ev) {
  1312. showMessage('ОШИБКА',`<p style='color:red; font-weight: bold;'>AceStream не работает (адрес <span style='color: blue;'>${acestream_server_address}</span>) или ошибка в коде!</p><p>Текст ошибки: '${ev}'</p>`)
  1313. }
  1314. }
  1315.  
  1316. async function aceStreamServer(params){
  1317. const {down, magn, linkText, action='play'} = params,
  1318. acestream_server_address = $("#acestream_server_address").val()
  1319.  
  1320. if(!acestream_server_address){
  1321. alert(`Адрес AceStream\'а '${acestream_server_address}' указан неверно!`)
  1322. return
  1323. }
  1324.  
  1325. // http://127.0.0.1:6878/ace/getstream?url=http://d.rutor.info/download/894977
  1326. // http://127.0.0.1:6878/ace/manifest.m3u8?url=http://d.rutor.info/download/894977&format=json
  1327. // http://localhost:6878/server/api?method=get_api_access_token
  1328. const {token} = await AceStreamAction(magn, acestream_server_address, false)
  1329.  
  1330. if(token){
  1331. if(confirm('Запустить проигрыватель?')){
  1332.  
  1333. let videos = encodeURIComponent(`http://${acestream_server_address}/ace/getstream?url=${down}`),
  1334. boxPlayer = $('#torrentPlayer'),
  1335. close_vid,inner_vid,inner_list,vid_info,vid_title = null
  1336.  
  1337. if(boxPlayer.length) boxPlayer.remove()
  1338.  
  1339. boxPlayer = $("<div></div>").attr('id','torrentPlayer')
  1340.  
  1341. close_vid = $("<div class='torrentPlayer_close'>").text('X').click(function(){
  1342. boxPlayer.hide(()=>{
  1343. boxPlayer.remove()
  1344. })
  1345. })
  1346. vid_title = $("<div class='torrentPlayer_title'>")
  1347. vid_info = $("<div class='torrentPlayer_info'>").text('Загрузка...')
  1348. inner_vid = $("<div class='torrentPlayer_video'>")
  1349. inner_list = $("<div class='torrentPlayer_list'>")
  1350.  
  1351. vid_title.append(vid_info,close_vid)
  1352.  
  1353. boxPlayer.append(vid_title,inner_vid,inner_list)
  1354. $('body').append(boxPlayer)
  1355.  
  1356. if(videos.length){
  1357. inner_vid.empty()
  1358. let frame = `<iframe src="http://localhost:8000/frame?path_vid=${videos}&name_vid=${encodeURIComponent(linkText)}&index_vid=${1}" frameborder="0" scrolling="no" style="width: 100%;height: 100%;" />`
  1359. inner_vid.append(frame)
  1360.  
  1361. let ulpl = $("<ul class='torrentPlayer_playlist'></ul>")
  1362. vid_info.text(linkText)
  1363.  
  1364. /*for(let v of videos){
  1365. let li = $("<li></li>").click(function(){
  1366. inner_vid.empty()
  1367. let frame = `<iframe src="http://localhost:8000/frame?path_vid=${v}&name_vid=${encodeURIComponent(v)}&index_vid=${v}" frameborder="0" scrolling="no"/>`
  1368. inner_vid.html(frame)
  1369. vid_info.text(v)
  1370. }),
  1371. name_vid = $("<span class='torrentPlayer_playlist_item_title'>").text(v),
  1372. size_vid = $("<span class='torrentPlayer_playlist_item_size'>").text(convertSizes(v.length))
  1373.  
  1374. li.append(name_vid,size_vid)
  1375. ulpl.append(li)
  1376. }
  1377.  
  1378. inner_list.append(ulpl)*/
  1379. }
  1380. }
  1381. }
  1382.  
  1383. }
  1384. // -- AceStream
  1385.  
  1386. function addPoleInfo(){
  1387. if(!searchinHost("/torrent/")){
  1388.  
  1389. // Ищим классы для получения данных
  1390. $(".backgr, .gai, .tum").each(function(i, val){
  1391. // Если класс заголовка добавляем свой заголовок для кнопки
  1392. if(this.className == "backgr") {
  1393. $('<td width="1px"></td>').prependTo(this);
  1394. } else {
  1395. // Если нет получаем информацию
  1396. let elem = this,
  1397. m_elem = elem.children[1],
  1398. link, linkText, magn, down, count_magnet = 1,
  1399.  
  1400. img = $('<img/>').attr({title:"Показать раздачу",class:"butSpoiler", src:image_arrow, alt:""}),
  1401. newI = $('<td/>').css("text-align","center").append(img);
  1402.  
  1403. if(m_elem.children[count_magnet] && m_elem.children[count_magnet].href.indexOf('magnet') == -1){
  1404. down = m_elem.children[1].href
  1405. link = m_elem.children[count_magnet] ? m_elem.children[count_magnet].href : null
  1406. linkText = m_elem.children[count_magnet] ? m_elem.children[count_magnet].textContent : null
  1407. } else {
  1408. down = m_elem.children[count_magnet-1].href
  1409. magn = m_elem.children[count_magnet] ? m_elem.children[count_magnet].href : null
  1410. link = m_elem.children[count_magnet+1] ? m_elem.children[count_magnet+1].href : null
  1411. linkText = m_elem.children[count_magnet+1] ? m_elem.children[count_magnet+1].textContent : null
  1412. }
  1413.  
  1414. let favorite = $("<a/>")
  1415. .attr({href:'javascript:void(0);', title:`Добавить в избранное:\nИмя: ${linkText}\nСсылка торрента: ${link}\nDownload: ${down}\nMagnet: ${(magn ? magn : 'Нет')}`, class:'downgif'})
  1416. .append($("<img/>").attr({src:favIcon, width:'13',alt:''}))
  1417. .click(function(ev){
  1418. ev.stopPropagation()
  1419. addFav({
  1420. el:this,
  1421. link:link,
  1422. linkText:linkText,
  1423. Down:down,
  1424. Mdown:magn,
  1425. date_time: new Date().getTime()
  1426. });
  1427. }),
  1428. search = $("<a/>")
  1429. .attr({href:'javascript:void(0);', title:`Искать: ${linkText}`, class:'downgif'})
  1430. .append($("<img/>").attr({src: searchIcon, width:'13', alt:''}))
  1431. .click(function(ev){
  1432. ev.stopPropagation()
  1433. let searchText = searchEditReq(linkText);
  1434. window.location.href = hostname+"/search/"+encodeURIComponent(searchText);
  1435. }),
  1436.  
  1437. AceStreamServPlay = $("<a/>")
  1438. .attr({href:'javascript:void(0);', title:`Проиграть в AceStream: ${linkText}`, class:'downgif service_splitter', 'data-servname':'AceStream'})
  1439. .append($('<span/>').text('AceStream'))
  1440. .append($("<img/>").attr({src: aceStreamIcon, width:'13', alt:''}))
  1441. .click(function(ev){
  1442. ev.stopPropagation()
  1443. aceStreamServer({down, linkText, magn, action: 'play'})
  1444. }) ,
  1445.  
  1446. torrServPlay = $("<a/>")
  1447. .attr({href:'javascript:void(0);', title:`Проиграть в torrserv: ${linkText}`, class:'downgif','data-servname':'TorrServ Play'})
  1448. .append($('<span>').text('TorrServ Play'))
  1449. .append($("<img/>").attr({src: torrServIcon, width:'13', alt:''}))
  1450. .click(function(ev){
  1451. ev.stopPropagation()
  1452. torrServer({down, linkText, magn, action: 'play'})
  1453. }),
  1454.  
  1455. torrServ = $("<a/>")
  1456. .attr({href:'javascript:void(0);', title:`Добавить в torrserv: ${linkText}`, class:'downgif','data-servname':'TorrServ Add'})
  1457. .append($('<span/>').text('TorrServ Add'))
  1458. .append($("<img/>").attr({src: torrServToAdd, width:'13', alt:''}))
  1459. .click(function(ev){
  1460. ev.stopPropagation()
  1461. torrServer({down, magn, linkText})
  1462. }),
  1463.  
  1464. pop_items = $("<div class='pop_elements'></div>"),
  1465. bufDiv = $("<a class='pop_panel' onclick='event.stopPropagation();'><img src='https://www.pvsm.ru/images/2019/10/14/v-zakladki-PDF-i-ePUB-versiya-rukovodstva-po-React-3.png' width='15' alt=''/></a>").append(pop_items)
  1466. pop_items.append(AceStreamServPlay,torrServPlay,torrServ)
  1467.  
  1468.  
  1469. // Image event
  1470. $(img).add(elem).click(async function(e) {
  1471. e.stopPropagation()
  1472.  
  1473. //if(e.target.tagName == 'A') return true
  1474.  
  1475. if(!$(elem).next().is(".tr_loading")){
  1476. $(elem).after('<tr class="tr_loading" style="text-align:center; display:none;"><td colspan="6">'+
  1477. '<div class="loading_tor_box">'+
  1478. '<div class="loading_tor"><div class="loading_tor_text"></div></div>'+
  1479. '</div>'+
  1480. '</td></tr>');
  1481. $(elem).next('.tr_loading').after('<tr class="my_tr"><td colspan="6"></td></tr>');
  1482.  
  1483. ajaxJQ({button : img , link: link, elem : elem}).then((data)=> modifyData(data));
  1484. } else {
  1485. ShowIHide({elem:elem, button: img, event_el: e.currentTarget.className});
  1486. }
  1487. });
  1488.  
  1489.  
  1490. $(m_elem).on('click contextmenu',function(ev){
  1491. const cur_ = ev.target
  1492. if(cur_ && /download|magnet|torrent/.test(cur_.parentElement.href) || cur_.tagName == 'A'){
  1493. ev.stopPropagation()
  1494. }
  1495. });
  1496.  
  1497. favorite.insertBefore(m_elem.children[0])
  1498. search.insertBefore(m_elem.children[0])
  1499. bufDiv.insertBefore(m_elem.children[0])
  1500. newI.prependTo(this);
  1501. }
  1502. });
  1503. } else {
  1504. const poleDown = $("#download a"),
  1505. link = location.href,
  1506. linkText = $("#all > h1").text(),
  1507. down = poleDown.eq(1).attr('href'),
  1508. magn = poleDown.eq(0).attr('href'),
  1509.  
  1510. box_buttons = $("<div class='box_buttons_inner'></div>").insertAfter(poleDown.eq(1)),
  1511.  
  1512. favorite = $("<a href='javascript:void(0);' title='Добавить в избранное'><img src='"+favIcon+"' width='15'></a>").click(function(){
  1513. addFav({
  1514. el:this,
  1515. link:link,
  1516. linkText:linkText,
  1517. Down:down,
  1518. Mdown:magn,
  1519. date_time: new Date().getTime()
  1520. });
  1521. }),
  1522. search = $("<a href='javascript:void(0);' style='margin-left:10px;' title='Искать: "+linkText+"'><img src='"+searchIcon+"' width='15'></a>").click(function(){
  1523. let searchText = searchEditReq(linkText);
  1524. window.location.href = hostname + "/search/"+encodeURIComponent(searchText);
  1525. }),
  1526.  
  1527. AceStreamServPlay = $("<a/>")
  1528. .css('margin-left','10px')
  1529. .attr({href:'javascript:void(0);', title:`Проиграть в AceStream: ${linkText}`})
  1530. .append($("<img/>").attr({src: aceStreamIcon, width:'15', alt:''}))
  1531. .click(function(ev){
  1532. ev.stopPropagation()
  1533. aceStreamServer({down, linkText, magn, action: 'play'})
  1534. }) ,
  1535. torrServPlay = $("<a/>")
  1536. .css('margin-left','10px')
  1537. .attr({href:'javascript:void(0);', title:`Проиграть в torrserv: ${linkText}`})
  1538. .append($("<img/>").attr({src: torrServIcon, width:'15', alt:''}))
  1539. .click(function(ev){
  1540. ev.stopPropagation()
  1541. torrServer({down, linkText, magn, action: 'play'})
  1542. }),
  1543.  
  1544. torrServ = $("<a/>")
  1545. .css('margin-left','10px')
  1546. .attr({href:'javascript:void(0);', title:`Добавить в torrserv: ${linkText}`})
  1547. .append($("<img/>").attr({src: torrServToAdd, width:'15', alt:''}))
  1548. .click(function(ev){
  1549. ev.stopPropagation()
  1550. torrServer({down, magn, linkText})
  1551. })
  1552.  
  1553. favorite.appendTo(box_buttons)
  1554. search.appendTo(box_buttons)
  1555. torrServPlay.appendTo(box_buttons)
  1556. torrServ.appendTo(box_buttons)
  1557. AceStreamServPlay.appendTo(box_buttons)
  1558. }
  1559. }
  1560.  
  1561. async function getCategoryTorrent(currentObj){
  1562. let category_ ="Нет категории"
  1563. await new Promise(function(res,rej){
  1564. $.ajax({
  1565. url: currentObj.link,
  1566. success: function(data){
  1567. try{
  1568. category_ = data.match(/Категория.*\>(.*)\<\/a/i)[1]
  1569. }
  1570. catch(e){
  1571. if(debug)console.warn(`Категория не найдена у: ${unescape(currentObj.linkText)}... (Раздача не существует)`)
  1572. }
  1573. res(category_)
  1574. },
  1575. error: function(e){
  1576. rej("Нет категории")
  1577. }
  1578.  
  1579. }).then(function(res){
  1580.  
  1581. })
  1582. })
  1583. if(debug) console.log(`Категория у '${unescape(currentObj.linkText)}' следующая '${category_!="Нет категории"?category_:'%cНет категории'}'`, "color:red")
  1584. return category_
  1585. }
  1586.  
  1587. function torrentsFavoritesExists(){
  1588. if(!confirm('Проверить торренты в избранном?')) return
  1589. // Check torrent exists?
  1590. let promises = []
  1591. for(let obj in ObjSave.favorites){
  1592. let currentObj = ObjSave.favorites[obj],
  1593.  
  1594. p = new Promise((res,rej)=>{
  1595. let v = currentObj.link.split('/')
  1596. $.ajax({
  1597. url: `/torrent/${v[v.length-1]}`,
  1598. success: (data) => {
  1599. let result = data.includes('Раздача не существует!')?false:true
  1600. return res({result, v:unescape(currentObj.linkText).trim()})
  1601. },
  1602. error: (e) => res({result: false, v})
  1603. })
  1604. }).then((result_)=>{
  1605. let {result, v} = result_
  1606. currentObj.isExists = (typeof result === 'string' ? JSON.parse(result): result)
  1607. return !result ? `Ссылка на торрент больше не существует: ${v}`: null
  1608. })
  1609. promises.push(p)
  1610. }
  1611.  
  1612. Promise.all(promises).then(values => {
  1613. let filter_vals = values.filter(v => v)
  1614. if(filter_vals.length){
  1615. alert(filter_vals.join('\n'))
  1616. console.log(`%c${filter_vals.join('\n')}`, 'color: orange;background:darkred;');
  1617. updateFav()
  1618. }
  1619. });
  1620.  
  1621. }
  1622.  
  1623. async function remakeFav(){
  1624. if (ObjSave.hasOwnProperty('favorites')){
  1625. // Favorites object
  1626. let isEdit = !1;
  1627.  
  1628. if(Object.prototype.toString.call(ObjSave.favorites) == "[object Object]"){
  1629. if(Object.keys(ObjSave.favorites).length > 0){
  1630. for(let pFav in ObjSave.favorites){
  1631. // no date
  1632. if(!ObjSave.favorites[pFav].hasOwnProperty("date_time")){
  1633. ObjSave.favorites[pFav].date_time = new Date().getTime()
  1634. if(debug) console.log("Нет Даты!: ", ObjSave.favorites[pFav])
  1635. }
  1636.  
  1637. // http
  1638. if(pFav.includes("http://")){
  1639. if(debug) console.log("Ид содержит http!: ", ObjSave.favorites[pFav])
  1640.  
  1641. let pFavencodeURI = encodeURI(pFav),
  1642. newId = unescape(pFav).match(/.*torrent\/(\d+)\//i)[1];
  1643.  
  1644. ObjSave.favorites[newId] = ObjSave.favorites[pFavencodeURI];
  1645. ObjSave.favorites[newId].id = newId;
  1646. delete ObjSave.favorites[pFavencodeURI]
  1647. }
  1648.  
  1649. }
  1650.  
  1651. }
  1652. // Favorites convert to array
  1653. ObjSave.favorites = Object.keys(ObjSave.favorites).map((k,i) => ({...ObjSave.favorites[k]}))
  1654. isEdit = !0;
  1655.  
  1656. if(debug) console.log("Исправленме Ид и добавление Даты: ",ObjSave,"Были ли правки:",isEdit)
  1657. saveToStorage();
  1658.  
  1659. } else{
  1660. if(!debug) console.log('Объект фаворит это массив...')
  1661. for(let obj=0;obj<ObjSave.favorites.length;obj++){
  1662. let currentObj = ObjSave.favorites[obj]
  1663.  
  1664. // no date
  1665. if(!currentObj.hasOwnProperty("date_time")){
  1666. currentObj.date_time = new Date().getTime()
  1667. if(debug) console.log("Нет Даты!: ", currentObj.date_time)
  1668. }
  1669.  
  1670. // http
  1671. if(currentObj.hasOwnProperty("link") && currentObj.hasOwnProperty("Down")){
  1672. let torrentId = currentObj.link
  1673. if(currentObj.link.includes("http://")){
  1674. if(debug) console.log("Link содержит http!: ", currentObj.link)
  1675. try{
  1676. torrentId = currentObj.link.match(/(\d+)\/?/i)[1];
  1677. } catch(e){
  1678. torrentId = currentObj.link//.match(/(\d+)/i)[1]
  1679. console.log('Remake Favorite no find ID', currentObj.link)
  1680. }
  1681. currentObj.link = `${hostname}/torrent/${torrentId}`
  1682. }
  1683.  
  1684. if(currentObj.Down.includes("http://")){
  1685. if(debug) console.log("Down содержит http!: ", currentObj.Down)
  1686. currentObj.Down = `http://d.${location.hostname}/download/${torrentId}`
  1687. }
  1688.  
  1689. if(debug) console.log('New link and download:', currentObj)
  1690. }
  1691.  
  1692. //---------- Category
  1693. if(!currentObj.hasOwnProperty('category')){
  1694. isEdit = !0;
  1695. let category_ = await getCategoryTorrent(currentObj)
  1696. currentObj.category = category_
  1697. }
  1698. //----------
  1699.  
  1700. }
  1701. }
  1702. if(debug) console.log('После remakeFav:', ObjSave.favorites)
  1703. if(isEdit){
  1704. saveToStorage();
  1705. console.log('Save remake...')
  1706. }
  1707. }
  1708. }
  1709.  
  1710. // Сортировка и корекция развернутых раздач
  1711. function correctSortRazdch(sortWhat, type, field, butIndx){
  1712. let dataClicked = sortWhat.sorti[butIndx].press,
  1713. __this = this,
  1714. press = this
  1715.  
  1716. sortWhat = Object.assign({}, sortWhat);
  1717.  
  1718. if(type == 0){
  1719. sortWhat.razd.sort(function(a,b) {
  1720. var an = a[field],
  1721. bn = b[field]
  1722. return an - bn;
  1723. });
  1724. } else if(type == 1){
  1725. sortWhat.razd.sort(function(a,b) {
  1726. var x = a[field].toLowerCase();
  1727. var y = b[field].toLowerCase();
  1728.  
  1729. if(x < y) return -1;
  1730. if(x > y) return 1;
  1731. return 0
  1732. });
  1733. }
  1734.  
  1735. if(dataClicked) sortWhat.razd.reverse()
  1736.  
  1737. for(var i=0; i<sortWhat.razd.length;i++){
  1738. let elDetach = $(sortWhat.razd[i].es),
  1739. childs = null
  1740.  
  1741. if(elDetach.next().next().is(".my_tr")) childs = [elDetach.next(),elDetach.next().next()]
  1742.  
  1743. elDetach.detach().appendTo(sortWhat.category)
  1744.  
  1745. if(childs != null){
  1746. $(childs[1]).detach().insertAfter(elDetach)
  1747. $(childs[0]).detach().insertAfter(elDetach)
  1748. }
  1749. }
  1750.  
  1751. if(butIndx == 3 || butIndx == 4){
  1752. const _this = $(sortWhat.sorti[butIndx].el_img)
  1753. press = _this
  1754. //_this.hasClass("headerSortDown") ? _this.removeClass("headerSortDown").addClass("headerSortUp"):_this.removeClass("headerSortUp").addClass("headerSortDown")
  1755. } /*else{
  1756. $(__this).hasClass("headerSortDown") ? $(__this).removeClass("headerSortDown").addClass("headerSortUp"):$(__this).removeClass("headerSortUp").addClass("headerSortDown")
  1757. }*/
  1758.  
  1759. sortWhat.sorti.map(function(currarr, indarr){
  1760. if(indarr !== butIndx){
  1761. currarr.press = false
  1762. //$(currarr.el_img).removeClass("headerSortUp headerSortDown")
  1763.  
  1764. if($(currarr.el_img).is("img")) $(currarr.el_img).css("transform", "scaleY(1)");
  1765. else $(currarr.el_img).find("img").css("transform", "scaleY(1)")
  1766. }
  1767. })
  1768.  
  1769. if($(press).is("img")){
  1770. $(press).css("transform", "scaleY("+(dataClicked?"1":"-1")+")")
  1771. } else {
  1772. $(press).find("img[width^=15]").css("transform", "scaleY("+(dataClicked?"1":"-1")+")")
  1773. }
  1774.  
  1775. sortWhat.sorti[butIndx].press = !sortWhat.sorti[butIndx].press
  1776.  
  1777. if(debug) console.log("Button: ",butIndx,"Value buttons: ",sortWhat.sorti[0].press,sortWhat.sorti[1].press,sortWhat.sorti[2].press,sortWhat.sorti[3].press,sortWhat.sorti[4].press)
  1778. }
  1779.  
  1780. // Эвенты для заголовков
  1781. function setEventHeaderTitle(massiv){
  1782. let titleSort = [],
  1783. titles = $(this).find(".backgr > td").each(function(idxel, el){
  1784.  
  1785. if(idxel == 0) return true
  1786. if(idxel == 4 && el.textContent == "Пиры"){
  1787. let img = $("<img>").attr({"src":"https://raw.githubusercontent.com/AlekPet/Rutor-Preview-Ajax/master/assets/images/arrow_icon.gif","width":"15"}).css({"position": "relative","top":"3px","cursor": "pointer"}).attr({"title":"Сортировать по Раздающим","id":"_Up"}),
  1788. img_clone = img.clone(false).attr({"title":"Сортировать по Качающим","id":"_Down"})
  1789. $(el).css({"width": "90px"}).append($("<div>").text(" Р",).css({"cursor": "pointer"}).attr({"title":"Сортировать по Раздающим","id":"_Up"}),
  1790. el,img,
  1791. $("<div>").text("К").css({"cursor": "pointer"}).attr({"title":"Сортировать по Качающим","id":"_Down"}),
  1792. el,img_clone
  1793. )
  1794. titleSort.push({
  1795. el_img: $(el).find("div").eq(0),el_img:img,
  1796. index: idxel,
  1797. press: false},
  1798. {
  1799. el_img: $(el).find("div").eq(1),el_img:img_clone,
  1800. index: idxel+1,press: false
  1801. })
  1802. } else {
  1803. let img = $("<img>").attr({"src":"https://raw.githubusercontent.com/AlekPet/Rutor-Preview-Ajax/master/assets/images/arrow_icon.gif","width":"15"}).css({"position": "relative","top": ($(el).children().first().is("img")?"-10px":"3px")})
  1804. $(el).css({"width": "80px", "cursor": "pointer"}).attr("title","Сортировать по \""+($(el).children().first().is("img")?"Добавлено":$(el).text())+"\"").append(img)
  1805. titleSort.push({
  1806. el_img: el,el_img:el,
  1807. index: idxel,
  1808. press: false})
  1809. }
  1810. })
  1811. massiv.sorti = titleSort
  1812. // By date
  1813. titles.eq(1).click(function(){
  1814. correctSortRazdch.call(this,massiv,0, "date",0)
  1815. })
  1816. // By name
  1817. titles.eq(2).click(function(){
  1818. correctSortRazdch.call(this,massiv,1, "name",1)
  1819. })
  1820. // By size
  1821. titles.eq(3).click(function(){
  1822. correctSortRazdch.call(this,massiv,0, "size",2)
  1823. })
  1824. // By Up/Down
  1825. titles.eq(4).find("div, img").each(function(img_indx, el){ // titles.eq(4).find("img")
  1826. $(this).click(function(){
  1827. if(el.id == "_Up"){
  1828. correctSortRazdch.call(el, massiv, 0, "up",3)
  1829. } else {
  1830. correctSortRazdch.call(el, massiv, 0, "down",4)
  1831. }
  1832. })
  1833. })
  1834. }
  1835.  
  1836. function sorting(){
  1837. if(!searchinHost("/torrent/")){
  1838. // Ищим классы для получения данных
  1839. let massivT = [],
  1840. month = ["Январь","Февраль","Март","Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"],
  1841. razmeronosti = ["kB","MB","GB"]
  1842.  
  1843. $("#index > table").each(function(idx, eltable){
  1844.  
  1845. let objCat = {category:this, name:$(this).prev().text(), razd:[]}
  1846.  
  1847. $(this).find(".gai, .tum").each(function(){
  1848.  
  1849. let colR, colU, size
  1850. if(this.children.length == 5){
  1851. colR = this.children[4].children[0].textContent
  1852. colU = this.children[4].children[2].textContent
  1853. size = this.children[3].textContent
  1854. } else{
  1855. colR = this.children[5].children[0].textContent
  1856. colU = this.children[5].children[2].textContent
  1857. size = this.children[4].textContent
  1858. }
  1859.  
  1860. // Date
  1861. let dateT = this.children[1].textContent
  1862. dateT = dateT.split(/\s+/)
  1863.  
  1864. $.each(month, function(idx,val){
  1865. if(dateT[1] == val.substr(0,3)) dateT[1] = idx
  1866. })
  1867.  
  1868. dateT = new Date(parseInt("20"+dateT[2]), dateT[1], dateT[0], 0,0,0)
  1869.  
  1870. // Sizes
  1871. let complSize
  1872. $.each(razmeronosti, function(idx,val){
  1873. if(size.includes(val)){
  1874. complSize = size.substr(0, size.indexOf(razmeronosti[idx]))*1
  1875. if(idx == 0){
  1876. complSize = complSize *1
  1877. } else if(idx == 1){
  1878. complSize = complSize * 1000
  1879. } else if(idx == 2){
  1880. complSize = complSize *1000000
  1881. }
  1882. } else {
  1883. complSize = parseFloat(size)
  1884. }
  1885. })
  1886.  
  1887. let nameSorti = this.children[2].children[5].textContent
  1888. if(!nameSorti || nameSorti.length == 0) nameSorti = this.children[2].children[0].getAttribute('title');
  1889.  
  1890. objCat.razd.push({es:this, date:dateT, name:nameSorti, size:complSize, up:colR, down:colU})
  1891. })
  1892. massivT.push(objCat)
  1893. setEventHeaderTitle.call(this, massivT[idx])
  1894.  
  1895. })
  1896. if(debug)console.log("Sorting obj:",massivT)
  1897. }
  1898. }
  1899.  
  1900. function AdBlock(){
  1901. if($(".sideblock2").length){
  1902. $(".sideblock2").remove();
  1903. }
  1904.  
  1905. $(['https://code.jquery.com/jquery-3.1.0.min.js','https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js']).each(function(){
  1906. let jquery = document.createElement('script')
  1907. jquery.type = "text/javascript"
  1908. jquery.src = this
  1909. document.head.appendChild(jquery)
  1910. })
  1911.  
  1912. }
  1913.  
  1914. function init(){
  1915. //setTimeout(function(){
  1916. //AdBlock();
  1917. loadStorage();
  1918. makePanel();
  1919. addPoleInfo();
  1920. remakeFav();
  1921. updateFav();
  1922. sorting();
  1923.  
  1924. //if(searchinHost("/top/")) sorting(); // using jquery.tablesorter on site, run only TOP category
  1925. //}, 500);
  1926. }
  1927.  
  1928. // To fix the script on the website:
  1929. // Replace the function 'sotrdgts' (jquery.tablesorter) on the site,
  1930. // because there is an error on the site and the userscript does not work correctly!
  1931. /*document.addEventListener('readystatechange', function(){
  1932. if(document.readyState == 'interactive'){
  1933. $(`<script>function sotrdgts() {
  1934. if($(".sorted tbody td").length) {
  1935. $(".sorted tbody td").each(function() {
  1936. $(this).html("<s>" + appndvl($(this).html()) + "</s>" + $(this).html());
  1937. });
  1938. $(".sorted tbody td[colspan=2]").each(function() {
  1939. $(this).replaceWith('<td>' + $(this).html() + '</td><td></td>');
  1940. });
  1941. $(".sorted").each(function() {
  1942. $(this).tablesorter({
  1943. widgets: ['zebra'],
  1944. headers: {
  1945. 0: { sorter: 'digit' } ,
  1946. 3: { sorter: 'digit' } ,
  1947. 4: { sorter: 'digit' }
  1948. }
  1949. });
  1950. });
  1951. } else {
  1952. setTimeout(function() {sotrdgts();}, 200);
  1953. }
  1954. }</script>`).appendTo(document.body);
  1955.  
  1956. } else if(document.readyState == 'complete'){
  1957. init();
  1958. }
  1959. });*/
  1960.  
  1961. /*window.onload = function(){
  1962.  
  1963. let scripts = [
  1964. 'https://vjs.zencdn.net/7.20.3/video.min.js',
  1965. 'https://cdn.jsdelivr.net/npm/@videojs/http-streaming@2.15.0/dist/videojs-http-streaming.min.js'
  1966. ],
  1967. body = document.querySelector('body')
  1968.  
  1969. for(let s of scripts){
  1970. let script = document.createElement('script')
  1971. script.type = 'text/javascript'
  1972. script.charset = 'utf-8'
  1973. script.src = s
  1974. body.appendChild(script)
  1975. }
  1976. }*/
  1977.  
  1978. init()
  1979.  
  1980. })();

QingJ © 2025

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