fc2ppvdb-improved

fc2ppvdb.com Improved for better browsing

Mint 2024.11.02.. Lásd a legutóbbi verzió

  1. // ==UserScript==
  2. // @name fc2ppvdb-improved
  3. // @namespace fc2ppvdb.com-improved
  4. // @version 1.0.1
  5. // @author KememChan
  6. // @icon https://www.google.com/s2/favicons?sz=32&domain_url=https%3A%2F%2Ffc2ppvdb.com%2Farticles%2F4558488
  7. // @match https://fc2ppvdb.com/*
  8. // @require https://cdn.jsdelivr.net/npm/jquery@3.7.1/dist/jquery.min.js
  9. // @grant GM_addStyle
  10. // @grant GM_xmlhttpRequest
  11. // @description fc2ppvdb.com Improved for better browsing
  12. // ==/UserScript==
  13.  
  14. (e=>{if(typeof GM_addStyle=="function"){GM_addStyle(e);return}const t=document.createElement("style");t.textContent=e,document.head.append(t)})(' @import"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css";.resources.svelte-1osydsn.svelte-1osydsn{display:flex;justify-content:end;gap:5px}li.svelte-1osydsn.svelte-1osydsn{list-style-type:none}.seed.svelte-1osydsn.svelte-1osydsn{color:#adff2f;transition:all .3s ease-in-out}.seed.svelte-1osydsn.svelte-1osydsn:hover{color:#9acd32;transform:scale(1.1)}li.svelte-1osydsn>.svelte-1osydsn{transition:transform .3s ease-in-out;color:#fff}.sukebei.svelte-1osydsn.svelte-1osydsn:hover,.torrent.svelte-1osydsn.svelte-1osydsn:hover,.magnet.svelte-1osydsn.svelte-1osydsn:hover,.seed.svelte-1osydsn.svelte-1osydsn:hover{transform:scale(1.1);color:#0f0}@keyframes svelte-1osydsn-scale{0%{transform:scale(1)}50%{transform:scale(1.01)}to{transform:scale(1.05)}}.flex.svelte-knutg5.svelte-knutg5{justify-content:space-between;align-items:center;transition:transform .3s ease-in-out}.no-video.svelte-knutg5.svelte-knutg5{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);font-size:1.2rem;padding:10px;background-color:#000;border-radius:5%;color:#fff;opacity:0;animation:svelte-knutg5-popup .3s ease-in-out forwards;will-change:transform,opacity}video.svelte-knutg5.svelte-knutg5{position:absolute;top:0;left:0;width:100%;height:100%;object-fit:contain}.code.svelte-knutg5.svelte-knutg5{color:#fff;position:absolute;top:0;background-color:#1f2937;padding-inline:5px;transition:transform .3s ease-in-out}.grid-item-wrapper.svelte-knutg5:hover .code.svelte-knutg5{animation:svelte-knutg5-flash .3s ease-in-out forwards}.grid-item.svelte-knutg5.svelte-knutg5{position:relative;width:100%;padding-top:56.25%;background:#eee;transition:transform .3s ease-in-out;will-change:transform}.grid-item-wrapper.svelte-knutg5:hover .grid-item.svelte-knutg5{animation:svelte-knutg5-flash .3s ease-in-out forwards}.grid-item.svelte-knutg5 img.svelte-knutg5{position:absolute;top:0;left:0;width:100%;height:100%;object-fit:contain;background-color:#1f2937;transition:filter .3s ease-in-out;will-change:filter}.grid-item-wrapper.svelte-knutg5:hover .grid-item img.svelte-knutg5{animation:svelte-knutg5-blur .3s ease-in-out forwards}.grid-item-title.svelte-knutg5.svelte-knutg5{color:#fff;font-size:14px;margin-top:5px;width:100%;transition:transform .3s ease-in-out}.title.svelte-knutg5.svelte-knutg5{overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical}.maker.svelte-knutg5.svelte-knutg5{color:#6495ed;transition:transform .3s ease-in-out}.maker.svelte-knutg5.svelte-knutg5:hover{color:#1e90ff;transform:scale(1.1)}.grid-item-wrapper.svelte-knutg5.svelte-knutg5{transition:transform .3s ease-in-out;will-change:transform}.grid-item-wrapper.svelte-knutg5.svelte-knutg5:hover{animation:svelte-knutg5-scale .3s ease-in-out forwards}@keyframes svelte-knutg5-popup{0%{opacity:0;transform:translate(-50%,-50%) scale(.8)}to{opacity:1;transform:translate(-50%,-50%) scale(1)}}@keyframes svelte-knutg5-flash{0%{background-color:#1f2937}50%{background-color:#333}to{background-color:#1f2937}}@keyframes svelte-knutg5-blur{0%{filter:blur(0) brightness(1)}50%{filter:blur(1px) brightness(.7)}to{filter:blur(2px) brightness(.5)}}@keyframes svelte-knutg5-scale{0%{transform:scale(1)}50%{transform:scale(1.01)}to{transform:scale(1.05)}}.loading.svelte-yp0c0n{font-size:2rem;text-align:center;display:flex;justify-content:center;align-items:center;animation:svelte-yp0c0n-loadingAnimation 2s infinite}@keyframes svelte-yp0c0n-loadingAnimation{0%{opacity:1;transform:scale(1)}50%{opacity:.5;transform:scale(1.1)}to{opacity:1;transform:scale(1)}}.grid-container.svelte-yp0c0n{display:grid;grid-template-columns:repeat(4,1fr);gap:1rem;padding:1rem;opacity:0;animation:svelte-yp0c0n-fadeIn 2s forwards}@media (max-width: 1025px){.grid-container.svelte-yp0c0n{grid-template-columns:repeat(2,1fr)}}@media (max-width: 500px){.grid-container.svelte-yp0c0n{grid-template-columns:repeat(1,1fr)}}@keyframes svelte-yp0c0n-fadeIn{to{opacity:1}}div.svelte-1jfd2dh{display:inline-block;position:relative;width:100%;height:0;padding-top:56.25%;overflow:hidden}img.svelte-1jfd2dh,video.svelte-1jfd2dh{position:absolute;top:0;left:0;width:100%;height:100%;object-fit:contain;transition:filter .3s ease-in-out;background-color:#000}img.svelte-1jfd2dh:hover{filter:brightness(.5)}.no-video.svelte-1jfd2dh{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);color:#fff;font-size:1.5rem} ');
  15.  
  16. (function ($) {
  17. 'use strict';
  18.  
  19. var __defProp = Object.defineProperty;
  20. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  21. var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
  22. async function getMovieList() {
  23. const movies = $("div.flex.flex-wrap.-m-4 > *");
  24. return await Promise.all(
  25. Array.from(movies).map(
  26. async (movie) => ({
  27. code: $(movie).find("span").first().text(),
  28. thumbnail: $(movie).find("img").attr("data-src"),
  29. title: $(movie).find("div.mt-1 a:eq(0)").text(),
  30. titleUrl: $(movie).find("div.mt-1 a:eq(0)").attr("href"),
  31. maker: $(movie).find("div.mt-1 a:eq(1)").text(),
  32. makerUrl: $(movie).find("div.mt-1 a:eq(1)").attr("href")
  33. })
  34. )
  35. );
  36. }
  37. function noop() {
  38. }
  39. function is_promise(value) {
  40. return !!value && (typeof value === "object" || typeof value === "function") && typeof /** @type {any} */
  41. value.then === "function";
  42. }
  43. function run(fn) {
  44. return fn();
  45. }
  46. function blank_object() {
  47. return /* @__PURE__ */ Object.create(null);
  48. }
  49. function run_all(fns) {
  50. fns.forEach(run);
  51. }
  52. function is_function(thing) {
  53. return typeof thing === "function";
  54. }
  55. function safe_not_equal(a, b) {
  56. return a != a ? b == b : a !== b || a && typeof a === "object" || typeof a === "function";
  57. }
  58. let src_url_equal_anchor;
  59. function src_url_equal(element_src, url) {
  60. if (element_src === url) return true;
  61. if (!src_url_equal_anchor) {
  62. src_url_equal_anchor = document.createElement("a");
  63. }
  64. src_url_equal_anchor.href = url;
  65. return element_src === src_url_equal_anchor.href;
  66. }
  67. function is_empty(obj) {
  68. return Object.keys(obj).length === 0;
  69. }
  70. function append(target2, node) {
  71. target2.appendChild(node);
  72. }
  73. function insert(target2, node, anchor) {
  74. target2.insertBefore(node, anchor || null);
  75. }
  76. function detach(node) {
  77. if (node.parentNode) {
  78. node.parentNode.removeChild(node);
  79. }
  80. }
  81. function destroy_each(iterations, detaching) {
  82. for (let i = 0; i < iterations.length; i += 1) {
  83. if (iterations[i]) iterations[i].d(detaching);
  84. }
  85. }
  86. function element(name) {
  87. return document.createElement(name);
  88. }
  89. function text(data) {
  90. return document.createTextNode(data);
  91. }
  92. function space() {
  93. return text(" ");
  94. }
  95. function empty() {
  96. return text("");
  97. }
  98. function listen(node, event, handler, options) {
  99. node.addEventListener(event, handler, options);
  100. return () => node.removeEventListener(event, handler, options);
  101. }
  102. function attr(node, attribute, value) {
  103. if (value == null) node.removeAttribute(attribute);
  104. else if (node.getAttribute(attribute) !== value) node.setAttribute(attribute, value);
  105. }
  106. function children(element2) {
  107. return Array.from(element2.childNodes);
  108. }
  109. function set_data(text2, data) {
  110. data = "" + data;
  111. if (text2.data === data) return;
  112. text2.data = /** @type {string} */
  113. data;
  114. }
  115. let current_component;
  116. function set_current_component(component) {
  117. current_component = component;
  118. }
  119. function get_current_component() {
  120. if (!current_component) throw new Error("Function called outside component initialization");
  121. return current_component;
  122. }
  123. function onMount(fn) {
  124. get_current_component().$$.on_mount.push(fn);
  125. }
  126. const dirty_components = [];
  127. const binding_callbacks = [];
  128. let render_callbacks = [];
  129. const flush_callbacks = [];
  130. const resolved_promise = /* @__PURE__ */ Promise.resolve();
  131. let update_scheduled = false;
  132. function schedule_update() {
  133. if (!update_scheduled) {
  134. update_scheduled = true;
  135. resolved_promise.then(flush);
  136. }
  137. }
  138. function add_render_callback(fn) {
  139. render_callbacks.push(fn);
  140. }
  141. const seen_callbacks = /* @__PURE__ */ new Set();
  142. let flushidx = 0;
  143. function flush() {
  144. if (flushidx !== 0) {
  145. return;
  146. }
  147. const saved_component = current_component;
  148. do {
  149. try {
  150. while (flushidx < dirty_components.length) {
  151. const component = dirty_components[flushidx];
  152. flushidx++;
  153. set_current_component(component);
  154. update(component.$$);
  155. }
  156. } catch (e) {
  157. dirty_components.length = 0;
  158. flushidx = 0;
  159. throw e;
  160. }
  161. set_current_component(null);
  162. dirty_components.length = 0;
  163. flushidx = 0;
  164. while (binding_callbacks.length) binding_callbacks.pop()();
  165. for (let i = 0; i < render_callbacks.length; i += 1) {
  166. const callback = render_callbacks[i];
  167. if (!seen_callbacks.has(callback)) {
  168. seen_callbacks.add(callback);
  169. callback();
  170. }
  171. }
  172. render_callbacks.length = 0;
  173. } while (dirty_components.length);
  174. while (flush_callbacks.length) {
  175. flush_callbacks.pop()();
  176. }
  177. update_scheduled = false;
  178. seen_callbacks.clear();
  179. set_current_component(saved_component);
  180. }
  181. function update($$) {
  182. if ($$.fragment !== null) {
  183. $$.update();
  184. run_all($$.before_update);
  185. const dirty = $$.dirty;
  186. $$.dirty = [-1];
  187. $$.fragment && $$.fragment.p($$.ctx, dirty);
  188. $$.after_update.forEach(add_render_callback);
  189. }
  190. }
  191. function flush_render_callbacks(fns) {
  192. const filtered = [];
  193. const targets = [];
  194. render_callbacks.forEach((c) => fns.indexOf(c) === -1 ? filtered.push(c) : targets.push(c));
  195. targets.forEach((c) => c());
  196. render_callbacks = filtered;
  197. }
  198. const outroing = /* @__PURE__ */ new Set();
  199. let outros;
  200. function group_outros() {
  201. outros = {
  202. r: 0,
  203. c: [],
  204. p: outros
  205. // parent group
  206. };
  207. }
  208. function check_outros() {
  209. if (!outros.r) {
  210. run_all(outros.c);
  211. }
  212. outros = outros.p;
  213. }
  214. function transition_in(block, local) {
  215. if (block && block.i) {
  216. outroing.delete(block);
  217. block.i(local);
  218. }
  219. }
  220. function transition_out(block, local, detach2, callback) {
  221. if (block && block.o) {
  222. if (outroing.has(block)) return;
  223. outroing.add(block);
  224. outros.c.push(() => {
  225. outroing.delete(block);
  226. if (callback) {
  227. if (detach2) block.d(1);
  228. callback();
  229. }
  230. });
  231. block.o(local);
  232. } else if (callback) {
  233. callback();
  234. }
  235. }
  236. function handle_promise(promise, info) {
  237. const token = info.token = {};
  238. function update2(type, index, key, value) {
  239. if (info.token !== token) return;
  240. info.resolved = value;
  241. let child_ctx = info.ctx;
  242. if (key !== void 0) {
  243. child_ctx = child_ctx.slice();
  244. child_ctx[key] = value;
  245. }
  246. const block = type && (info.current = type)(child_ctx);
  247. let needs_flush = false;
  248. if (info.block) {
  249. if (info.blocks) {
  250. info.blocks.forEach((block2, i) => {
  251. if (i !== index && block2) {
  252. group_outros();
  253. transition_out(block2, 1, 1, () => {
  254. if (info.blocks[i] === block2) {
  255. info.blocks[i] = null;
  256. }
  257. });
  258. check_outros();
  259. }
  260. });
  261. } else {
  262. info.block.d(1);
  263. }
  264. block.c();
  265. transition_in(block, 1);
  266. block.m(info.mount(), info.anchor);
  267. needs_flush = true;
  268. }
  269. info.block = block;
  270. if (info.blocks) info.blocks[index] = block;
  271. if (needs_flush) {
  272. flush();
  273. }
  274. }
  275. if (is_promise(promise)) {
  276. const current_component2 = get_current_component();
  277. promise.then(
  278. (value) => {
  279. set_current_component(current_component2);
  280. update2(info.then, 1, info.value, value);
  281. set_current_component(null);
  282. },
  283. (error) => {
  284. set_current_component(current_component2);
  285. update2(info.catch, 2, info.error, error);
  286. set_current_component(null);
  287. if (!info.hasCatch) {
  288. throw error;
  289. }
  290. }
  291. );
  292. if (info.current !== info.pending) {
  293. update2(info.pending, 0);
  294. return true;
  295. }
  296. } else {
  297. if (info.current !== info.then) {
  298. update2(info.then, 1, info.value, promise);
  299. return true;
  300. }
  301. info.resolved = /** @type {T} */
  302. promise;
  303. }
  304. }
  305. function update_await_block_branch(info, ctx, dirty) {
  306. const child_ctx = ctx.slice();
  307. const { resolved } = info;
  308. if (info.current === info.then) {
  309. child_ctx[info.value] = resolved;
  310. }
  311. if (info.current === info.catch) {
  312. child_ctx[info.error] = resolved;
  313. }
  314. info.block.p(child_ctx, dirty);
  315. }
  316. function ensure_array_like(array_like_or_iterator) {
  317. return (array_like_or_iterator == null ? void 0 : array_like_or_iterator.length) !== void 0 ? array_like_or_iterator : Array.from(array_like_or_iterator);
  318. }
  319. function create_component(block) {
  320. block && block.c();
  321. }
  322. function mount_component(component, target2, anchor) {
  323. const { fragment, after_update } = component.$$;
  324. fragment && fragment.m(target2, anchor);
  325. add_render_callback(() => {
  326. const new_on_destroy = component.$$.on_mount.map(run).filter(is_function);
  327. if (component.$$.on_destroy) {
  328. component.$$.on_destroy.push(...new_on_destroy);
  329. } else {
  330. run_all(new_on_destroy);
  331. }
  332. component.$$.on_mount = [];
  333. });
  334. after_update.forEach(add_render_callback);
  335. }
  336. function destroy_component(component, detaching) {
  337. const $$ = component.$$;
  338. if ($$.fragment !== null) {
  339. flush_render_callbacks($$.after_update);
  340. run_all($$.on_destroy);
  341. $$.fragment && $$.fragment.d(detaching);
  342. $$.on_destroy = $$.fragment = null;
  343. $$.ctx = [];
  344. }
  345. }
  346. function make_dirty(component, i) {
  347. if (component.$$.dirty[0] === -1) {
  348. dirty_components.push(component);
  349. schedule_update();
  350. component.$$.dirty.fill(0);
  351. }
  352. component.$$.dirty[i / 31 | 0] |= 1 << i % 31;
  353. }
  354. function init(component, options, instance2, create_fragment2, not_equal, props, append_styles = null, dirty = [-1]) {
  355. const parent_component = current_component;
  356. set_current_component(component);
  357. const $$ = component.$$ = {
  358. fragment: null,
  359. ctx: [],
  360. // state
  361. props,
  362. update: noop,
  363. not_equal,
  364. bound: blank_object(),
  365. // lifecycle
  366. on_mount: [],
  367. on_destroy: [],
  368. on_disconnect: [],
  369. before_update: [],
  370. after_update: [],
  371. context: new Map(options.context || (parent_component ? parent_component.$$.context : [])),
  372. // everything else
  373. callbacks: blank_object(),
  374. dirty,
  375. skip_bound: false,
  376. root: options.target || parent_component.$$.root
  377. };
  378. append_styles && append_styles($$.root);
  379. let ready = false;
  380. $$.ctx = instance2 ? instance2(component, options.props || {}, (i, ret, ...rest) => {
  381. const value = rest.length ? rest[0] : ret;
  382. if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {
  383. if (!$$.skip_bound && $$.bound[i]) $$.bound[i](value);
  384. if (ready) make_dirty(component, i);
  385. }
  386. return ret;
  387. }) : [];
  388. $$.update();
  389. ready = true;
  390. run_all($$.before_update);
  391. $$.fragment = create_fragment2 ? create_fragment2($$.ctx) : false;
  392. if (options.target) {
  393. if (options.hydrate) {
  394. const nodes = children(options.target);
  395. $$.fragment && $$.fragment.l(nodes);
  396. nodes.forEach(detach);
  397. } else {
  398. $$.fragment && $$.fragment.c();
  399. }
  400. if (options.intro) transition_in(component.$$.fragment);
  401. mount_component(component, options.target, options.anchor);
  402. flush();
  403. }
  404. set_current_component(parent_component);
  405. }
  406. class SvelteComponent {
  407. constructor() {
  408. /**
  409. * ### PRIVATE API
  410. *
  411. * Do not use, may change at any time
  412. *
  413. * @type {any}
  414. */
  415. __publicField(this, "$$");
  416. /**
  417. * ### PRIVATE API
  418. *
  419. * Do not use, may change at any time
  420. *
  421. * @type {any}
  422. */
  423. __publicField(this, "$$set");
  424. }
  425. /** @returns {void} */
  426. $destroy() {
  427. destroy_component(this, 1);
  428. this.$destroy = noop;
  429. }
  430. /**
  431. * @template {Extract<keyof Events, string>} K
  432. * @param {K} type
  433. * @param {((e: Events[K]) => void) | null | undefined} callback
  434. * @returns {() => void}
  435. */
  436. $on(type, callback) {
  437. if (!is_function(callback)) {
  438. return noop;
  439. }
  440. const callbacks = this.$$.callbacks[type] || (this.$$.callbacks[type] = []);
  441. callbacks.push(callback);
  442. return () => {
  443. const index = callbacks.indexOf(callback);
  444. if (index !== -1) callbacks.splice(index, 1);
  445. };
  446. }
  447. /**
  448. * @param {Partial<Props>} props
  449. * @returns {void}
  450. */
  451. $set(props) {
  452. if (this.$$set && !is_empty(props)) {
  453. this.$$.skip_bound = true;
  454. this.$$set(props);
  455. this.$$.skip_bound = false;
  456. }
  457. }
  458. }
  459. const PUBLIC_VERSION = "4";
  460. if (typeof window !== "undefined")
  461. (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(PUBLIC_VERSION);
  462. var _GM_xmlhttpRequest = /* @__PURE__ */ (() => typeof GM_xmlhttpRequest != "undefined" ? GM_xmlhttpRequest : void 0)();
  463. const videoPreviewCache = {};
  464. function getVideoPreviewFromNjav(url) {
  465. if (videoPreviewCache[url] !== void 0) {
  466. return Promise.resolve(videoPreviewCache[url]);
  467. }
  468. return new Promise((resolve, reject) => {
  469. _GM_xmlhttpRequest({
  470. url,
  471. onload(response) {
  472. const njavPage = $(response.responseText);
  473. const movie = njavPage.find("div.col-6.col-sm-4.col-lg-3").first();
  474. const videoPreview = movie.find("div.thumb").attr("data-preview");
  475. if (videoPreview) {
  476. _GM_xmlhttpRequest({
  477. url: videoPreview,
  478. responseType: "blob",
  479. onload(r) {
  480. const blobUrl = URL.createObjectURL(r.response);
  481. videoPreviewCache[url] = blobUrl;
  482. resolve(blobUrl);
  483. }
  484. });
  485. } else {
  486. videoPreviewCache[url] = null;
  487. resolve(null);
  488. }
  489. },
  490. onerror() {
  491. videoPreviewCache[url] = null;
  492. resolve(null);
  493. }
  494. });
  495. });
  496. }
  497. function create_if_block$3(ctx) {
  498. let a0;
  499. let i0;
  500. let t0;
  501. let a1;
  502. let i1;
  503. let t1;
  504. let button;
  505. let t2;
  506. return {
  507. c() {
  508. a0 = element("a");
  509. i0 = element("i");
  510. t0 = space();
  511. a1 = element("a");
  512. i1 = element("i");
  513. t1 = space();
  514. button = element("button");
  515. t2 = text(
  516. /*seed*/
  517. ctx[3]
  518. );
  519. attr(i0, "class", "fa-solid fa-arrow-down");
  520. attr(i0, "aria-hidden", "true");
  521. attr(a0, "class", "torrent svelte-1osydsn");
  522. attr(
  523. a0,
  524. "href",
  525. /*torrent*/
  526. ctx[1]
  527. );
  528. attr(a0, "rel", "noopener");
  529. attr(a0, "title", "Download Torrent");
  530. attr(i1, "class", "fa-solid fa-magnet");
  531. attr(i1, "aria-hidden", "true");
  532. attr(a1, "class", "magnet svelte-1osydsn");
  533. attr(
  534. a1,
  535. "href",
  536. /*magnet*/
  537. ctx[2]
  538. );
  539. attr(a1, "rel", "noopener");
  540. attr(a1, "title", "Download with Magnet");
  541. attr(button, "class", "seed svelte-1osydsn");
  542. attr(button, "type", "button");
  543. },
  544. m(target2, anchor) {
  545. insert(target2, a0, anchor);
  546. append(a0, i0);
  547. insert(target2, t0, anchor);
  548. insert(target2, a1, anchor);
  549. append(a1, i1);
  550. insert(target2, t1, anchor);
  551. insert(target2, button, anchor);
  552. append(button, t2);
  553. },
  554. p(ctx2, dirty) {
  555. if (dirty & /*torrent*/
  556. 2) {
  557. attr(
  558. a0,
  559. "href",
  560. /*torrent*/
  561. ctx2[1]
  562. );
  563. }
  564. if (dirty & /*magnet*/
  565. 4) {
  566. attr(
  567. a1,
  568. "href",
  569. /*magnet*/
  570. ctx2[2]
  571. );
  572. }
  573. if (dirty & /*seed*/
  574. 8) set_data(
  575. t2,
  576. /*seed*/
  577. ctx2[3]
  578. );
  579. },
  580. d(detaching) {
  581. if (detaching) {
  582. detach(a0);
  583. detach(t0);
  584. detach(a1);
  585. detach(t1);
  586. detach(button);
  587. }
  588. }
  589. };
  590. }
  591. function create_fragment$3(ctx) {
  592. let li;
  593. let a0;
  594. let i0;
  595. let a0_href_value;
  596. let t0;
  597. let a1;
  598. let i1;
  599. let a1_href_value;
  600. let t1;
  601. let a2;
  602. let i2;
  603. let a2_href_value;
  604. let t2;
  605. let a3;
  606. let i3;
  607. let a3_href_value;
  608. let t3;
  609. let if_block = (
  610. /*torrent*/
  611. ctx[1] && create_if_block$3(ctx)
  612. );
  613. return {
  614. c() {
  615. li = element("li");
  616. a0 = element("a");
  617. i0 = element("i");
  618. t0 = space();
  619. a1 = element("a");
  620. i1 = element("i");
  621. t1 = space();
  622. a2 = element("a");
  623. i2 = element("i");
  624. i2.innerHTML = ``;
  625. t2 = space();
  626. a3 = element("a");
  627. i3 = element("i");
  628. t3 = space();
  629. if (if_block) if_block.c();
  630. attr(i0, "class", "fa-solid fa-globe");
  631. attr(i0, "aria-hidden", "true");
  632. attr(a0, "class", "missav svelte-1osydsn");
  633. attr(a0, "href", a0_href_value = "https://missav.com/en/search/" + /*code*/
  634. ctx[0]);
  635. attr(a0, "target", "_blank");
  636. attr(a0, "rel", "noopener");
  637. attr(a0, "title", "Search on MissAV");
  638. attr(i1, "class", "fa-solid fa-globe");
  639. attr(i1, "aria-hidden", "true");
  640. attr(a1, "class", "njav svelte-1osydsn");
  641. attr(a1, "href", a1_href_value = "https://njav.tv/en/search?keyword=" + /*code*/
  642. ctx[0]);
  643. attr(a1, "target", "_blank");
  644. attr(a1, "rel", "noopener");
  645. attr(a1, "title", "Search on Njav");
  646. attr(i2, "class", "fa-solid fa-image");
  647. attr(i2, "aria-hidden", "true");
  648. attr(a2, "href", a2_href_value = "https://img.javstore.net/search/images/?q=" + /*code*/
  649. ctx[0]);
  650. attr(a2, "target", "_blank");
  651. attr(a2, "rel", "noopener");
  652. attr(a2, "title", "Search Images");
  653. attr(a2, "class", "svelte-1osydsn");
  654. attr(i3, "class", "fa-solid fa-magnifying-glass");
  655. attr(i3, "aria-hidden", "true");
  656. attr(a3, "class", "sukebei svelte-1osydsn");
  657. attr(a3, "href", a3_href_value = `https://sukebei.nyaa.si/?f=0&c=0_0&q=${/*code*/
  658. ctx[0]}&s=seeders&o=desc`);
  659. attr(a3, "target", "_blank");
  660. attr(a3, "rel", "noopener");
  661. attr(a3, "title", "Search on Sukebei");
  662. attr(li, "class", "resources svelte-1osydsn");
  663. },
  664. m(target2, anchor) {
  665. insert(target2, li, anchor);
  666. append(li, a0);
  667. append(a0, i0);
  668. append(li, t0);
  669. append(li, a1);
  670. append(a1, i1);
  671. append(li, t1);
  672. append(li, a2);
  673. append(a2, i2);
  674. append(li, t2);
  675. append(li, a3);
  676. append(a3, i3);
  677. append(li, t3);
  678. if (if_block) if_block.m(li, null);
  679. },
  680. p(ctx2, [dirty]) {
  681. if (dirty & /*code*/
  682. 1 && a0_href_value !== (a0_href_value = "https://missav.com/en/search/" + /*code*/
  683. ctx2[0])) {
  684. attr(a0, "href", a0_href_value);
  685. }
  686. if (dirty & /*code*/
  687. 1 && a1_href_value !== (a1_href_value = "https://njav.tv/en/search?keyword=" + /*code*/
  688. ctx2[0])) {
  689. attr(a1, "href", a1_href_value);
  690. }
  691. if (dirty & /*code*/
  692. 1 && a2_href_value !== (a2_href_value = "https://img.javstore.net/search/images/?q=" + /*code*/
  693. ctx2[0])) {
  694. attr(a2, "href", a2_href_value);
  695. }
  696. if (dirty & /*code*/
  697. 1 && a3_href_value !== (a3_href_value = `https://sukebei.nyaa.si/?f=0&c=0_0&q=${/*code*/
  698. ctx2[0]}&s=seeders&o=desc`)) {
  699. attr(a3, "href", a3_href_value);
  700. }
  701. if (
  702. /*torrent*/
  703. ctx2[1]
  704. ) {
  705. if (if_block) {
  706. if_block.p(ctx2, dirty);
  707. } else {
  708. if_block = create_if_block$3(ctx2);
  709. if_block.c();
  710. if_block.m(li, null);
  711. }
  712. } else if (if_block) {
  713. if_block.d(1);
  714. if_block = null;
  715. }
  716. },
  717. i: noop,
  718. o: noop,
  719. d(detaching) {
  720. if (detaching) {
  721. detach(li);
  722. }
  723. if (if_block) if_block.d();
  724. }
  725. };
  726. }
  727. function instance$3($$self, $$props, $$invalidate) {
  728. let { code } = $$props;
  729. let { torrent } = $$props;
  730. let { magnet } = $$props;
  731. let { seed } = $$props;
  732. $$self.$$set = ($$props2) => {
  733. if ("code" in $$props2) $$invalidate(0, code = $$props2.code);
  734. if ("torrent" in $$props2) $$invalidate(1, torrent = $$props2.torrent);
  735. if ("magnet" in $$props2) $$invalidate(2, magnet = $$props2.magnet);
  736. if ("seed" in $$props2) $$invalidate(3, seed = $$props2.seed);
  737. };
  738. return [code, torrent, magnet, seed];
  739. }
  740. class Resources extends SvelteComponent {
  741. constructor(options) {
  742. super();
  743. init(this, options, instance$3, create_fragment$3, safe_not_equal, { code: 0, torrent: 1, magnet: 2, seed: 3 });
  744. }
  745. }
  746. function create_if_block_1$1(ctx) {
  747. let await_block_anchor;
  748. let promise;
  749. let info = {
  750. ctx,
  751. current: null,
  752. token: null,
  753. hasCatch: false,
  754. pending: create_pending_block$1,
  755. then: create_then_block$1,
  756. catch: create_catch_block$1,
  757. value: 6
  758. };
  759. handle_promise(promise = getVideoPreviewFromNjav(`https://njav.tv/en/search?keyword=${/*movie*/
  760. ctx[0].code}`), info);
  761. return {
  762. c() {
  763. await_block_anchor = empty();
  764. info.block.c();
  765. },
  766. m(target2, anchor) {
  767. insert(target2, await_block_anchor, anchor);
  768. info.block.m(target2, info.anchor = anchor);
  769. info.mount = () => await_block_anchor.parentNode;
  770. info.anchor = await_block_anchor;
  771. },
  772. p(new_ctx, dirty) {
  773. ctx = new_ctx;
  774. info.ctx = ctx;
  775. if (dirty & /*movie*/
  776. 1 && promise !== (promise = getVideoPreviewFromNjav(`https://njav.tv/en/search?keyword=${/*movie*/
  777. ctx[0].code}`)) && handle_promise(promise, info)) ;
  778. else {
  779. update_await_block_branch(info, ctx, dirty);
  780. }
  781. },
  782. d(detaching) {
  783. if (detaching) {
  784. detach(await_block_anchor);
  785. }
  786. info.block.d(detaching);
  787. info.token = null;
  788. info = null;
  789. }
  790. };
  791. }
  792. function create_catch_block$1(ctx) {
  793. return { c: noop, m: noop, p: noop, d: noop };
  794. }
  795. function create_then_block$1(ctx) {
  796. let if_block_anchor;
  797. function select_block_type(ctx2, dirty) {
  798. if (
  799. /*videoPreview*/
  800. ctx2[6]
  801. ) return create_if_block_2$1;
  802. return create_else_block$2;
  803. }
  804. let current_block_type = select_block_type(ctx);
  805. let if_block = current_block_type(ctx);
  806. return {
  807. c() {
  808. if_block.c();
  809. if_block_anchor = empty();
  810. },
  811. m(target2, anchor) {
  812. if_block.m(target2, anchor);
  813. insert(target2, if_block_anchor, anchor);
  814. },
  815. p(ctx2, dirty) {
  816. if (current_block_type === (current_block_type = select_block_type(ctx2)) && if_block) {
  817. if_block.p(ctx2, dirty);
  818. } else {
  819. if_block.d(1);
  820. if_block = current_block_type(ctx2);
  821. if (if_block) {
  822. if_block.c();
  823. if_block.m(if_block_anchor.parentNode, if_block_anchor);
  824. }
  825. }
  826. },
  827. d(detaching) {
  828. if (detaching) {
  829. detach(if_block_anchor);
  830. }
  831. if_block.d(detaching);
  832. }
  833. };
  834. }
  835. function create_else_block$2(ctx) {
  836. let p;
  837. return {
  838. c() {
  839. p = element("p");
  840. p.textContent = "No Preview 😭";
  841. attr(p, "class", "no-video svelte-knutg5");
  842. },
  843. m(target2, anchor) {
  844. insert(target2, p, anchor);
  845. },
  846. p: noop,
  847. d(detaching) {
  848. if (detaching) {
  849. detach(p);
  850. }
  851. }
  852. };
  853. }
  854. function create_if_block_2$1(ctx) {
  855. let video;
  856. let video_src_value;
  857. return {
  858. c() {
  859. video = element("video");
  860. if (!src_url_equal(video.src, video_src_value = /*videoPreview*/
  861. ctx[6])) attr(video, "src", video_src_value);
  862. video.autoplay = true;
  863. video.playsInline = true;
  864. video.loop = true;
  865. video.muted = true;
  866. attr(video, "preload", "none");
  867. attr(video, "class", "svelte-knutg5");
  868. },
  869. m(target2, anchor) {
  870. insert(target2, video, anchor);
  871. },
  872. p(ctx2, dirty) {
  873. if (dirty & /*movie*/
  874. 1 && !src_url_equal(video.src, video_src_value = /*videoPreview*/
  875. ctx2[6])) {
  876. attr(video, "src", video_src_value);
  877. }
  878. },
  879. d(detaching) {
  880. if (detaching) {
  881. detach(video);
  882. }
  883. }
  884. };
  885. }
  886. function create_pending_block$1(ctx) {
  887. return { c: noop, m: noop, p: noop, d: noop };
  888. }
  889. function create_if_block$2(ctx) {
  890. let a;
  891. let t_value = (
  892. /*movie*/
  893. ctx[0].maker + ""
  894. );
  895. let t;
  896. let a_href_value;
  897. return {
  898. c() {
  899. a = element("a");
  900. t = text(t_value);
  901. attr(a, "class", "maker svelte-knutg5");
  902. attr(a, "href", a_href_value = /*movie*/
  903. ctx[0].makerUrl);
  904. attr(a, "rel", "noopener");
  905. },
  906. m(target2, anchor) {
  907. insert(target2, a, anchor);
  908. append(a, t);
  909. },
  910. p(ctx2, dirty) {
  911. if (dirty & /*movie*/
  912. 1 && t_value !== (t_value = /*movie*/
  913. ctx2[0].maker + "")) set_data(t, t_value);
  914. if (dirty & /*movie*/
  915. 1 && a_href_value !== (a_href_value = /*movie*/
  916. ctx2[0].makerUrl)) {
  917. attr(a, "href", a_href_value);
  918. }
  919. },
  920. d(detaching) {
  921. if (detaching) {
  922. detach(a);
  923. }
  924. }
  925. };
  926. }
  927. function create_fragment$2(ctx) {
  928. var _a, _b, _c;
  929. let div4;
  930. let div1;
  931. let div0;
  932. let img;
  933. let img_src_value;
  934. let img_alt_value;
  935. let t0;
  936. let t1;
  937. let span;
  938. let t2_value = (
  939. /*movie*/
  940. ctx[0].code + ""
  941. );
  942. let t2;
  943. let t3;
  944. let div3;
  945. let a;
  946. let t4_value = (
  947. /*movie*/
  948. ctx[0].title + ""
  949. );
  950. let t4;
  951. let a_href_value;
  952. let a_title_value;
  953. let t5;
  954. let div2;
  955. let t6;
  956. let resources;
  957. let current;
  958. let mounted;
  959. let dispose;
  960. let if_block0 = (
  961. /*mouseHover*/
  962. ctx[2] && create_if_block_1$1(ctx)
  963. );
  964. let if_block1 = (
  965. /*movie*/
  966. ctx[0].maker && create_if_block$2(ctx)
  967. );
  968. resources = new Resources({
  969. props: {
  970. code: (
  971. /*movie*/
  972. ctx[0].code
  973. ),
  974. torrent: (
  975. /*torrentDataArray*/
  976. ((_a = ctx[1][0]) == null ? void 0 : _a.torrent) ?? null
  977. ),
  978. magnet: (
  979. /*torrentDataArray*/
  980. ((_b = ctx[1][0]) == null ? void 0 : _b.magnet) ?? null
  981. ),
  982. seed: (
  983. /*torrentDataArray*/
  984. ((_c = ctx[1][0]) == null ? void 0 : _c.seed) ?? null
  985. )
  986. }
  987. });
  988. return {
  989. c() {
  990. div4 = element("div");
  991. div1 = element("div");
  992. div0 = element("div");
  993. img = element("img");
  994. t0 = space();
  995. if (if_block0) if_block0.c();
  996. t1 = space();
  997. span = element("span");
  998. t2 = text(t2_value);
  999. t3 = space();
  1000. div3 = element("div");
  1001. a = element("a");
  1002. t4 = text(t4_value);
  1003. t5 = space();
  1004. div2 = element("div");
  1005. if (if_block1) if_block1.c();
  1006. t6 = space();
  1007. create_component(resources.$$.fragment);
  1008. if (!src_url_equal(img.src, img_src_value = /*movie*/
  1009. ctx[0].thumbnail)) attr(img, "src", img_src_value);
  1010. attr(img, "alt", img_alt_value = /*movie*/
  1011. ctx[0].title);
  1012. attr(img, "loading", "lazy");
  1013. attr(img, "class", "svelte-knutg5");
  1014. attr(span, "class", "code svelte-knutg5");
  1015. attr(div1, "class", "grid-item svelte-knutg5");
  1016. attr(a, "class", "title svelte-knutg5");
  1017. attr(a, "href", a_href_value = /*movie*/
  1018. ctx[0].titleUrl);
  1019. attr(a, "title", a_title_value = /*movie*/
  1020. ctx[0].title);
  1021. attr(a, "rel", "noopener");
  1022. attr(div2, "class", "flex svelte-knutg5");
  1023. attr(div3, "class", "grid-item-title svelte-knutg5");
  1024. attr(div4, "class", "grid-item-wrapper svelte-knutg5");
  1025. },
  1026. m(target2, anchor) {
  1027. insert(target2, div4, anchor);
  1028. append(div4, div1);
  1029. append(div1, div0);
  1030. append(div0, img);
  1031. append(div0, t0);
  1032. if (if_block0) if_block0.m(div0, null);
  1033. append(div1, t1);
  1034. append(div1, span);
  1035. append(span, t2);
  1036. append(div4, t3);
  1037. append(div4, div3);
  1038. append(div3, a);
  1039. append(a, t4);
  1040. append(div3, t5);
  1041. append(div3, div2);
  1042. if (if_block1) if_block1.m(div2, null);
  1043. append(div2, t6);
  1044. mount_component(resources, div2, null);
  1045. current = true;
  1046. if (!mounted) {
  1047. dispose = [
  1048. listen(
  1049. div0,
  1050. "mouseover",
  1051. /*mouseover_handler*/
  1052. ctx[3]
  1053. ),
  1054. listen(
  1055. div0,
  1056. "mouseleave",
  1057. /*mouseleave_handler*/
  1058. ctx[4]
  1059. ),
  1060. listen(
  1061. div0,
  1062. "touchstart",
  1063. /*touchstart_handler*/
  1064. ctx[5],
  1065. { passive: true }
  1066. )
  1067. ];
  1068. mounted = true;
  1069. }
  1070. },
  1071. p(ctx2, [dirty]) {
  1072. var _a2, _b2, _c2;
  1073. if (!current || dirty & /*movie*/
  1074. 1 && !src_url_equal(img.src, img_src_value = /*movie*/
  1075. ctx2[0].thumbnail)) {
  1076. attr(img, "src", img_src_value);
  1077. }
  1078. if (!current || dirty & /*movie*/
  1079. 1 && img_alt_value !== (img_alt_value = /*movie*/
  1080. ctx2[0].title)) {
  1081. attr(img, "alt", img_alt_value);
  1082. }
  1083. if (
  1084. /*mouseHover*/
  1085. ctx2[2]
  1086. ) {
  1087. if (if_block0) {
  1088. if_block0.p(ctx2, dirty);
  1089. } else {
  1090. if_block0 = create_if_block_1$1(ctx2);
  1091. if_block0.c();
  1092. if_block0.m(div0, null);
  1093. }
  1094. } else if (if_block0) {
  1095. if_block0.d(1);
  1096. if_block0 = null;
  1097. }
  1098. if ((!current || dirty & /*movie*/
  1099. 1) && t2_value !== (t2_value = /*movie*/
  1100. ctx2[0].code + "")) set_data(t2, t2_value);
  1101. if ((!current || dirty & /*movie*/
  1102. 1) && t4_value !== (t4_value = /*movie*/
  1103. ctx2[0].title + "")) set_data(t4, t4_value);
  1104. if (!current || dirty & /*movie*/
  1105. 1 && a_href_value !== (a_href_value = /*movie*/
  1106. ctx2[0].titleUrl)) {
  1107. attr(a, "href", a_href_value);
  1108. }
  1109. if (!current || dirty & /*movie*/
  1110. 1 && a_title_value !== (a_title_value = /*movie*/
  1111. ctx2[0].title)) {
  1112. attr(a, "title", a_title_value);
  1113. }
  1114. if (
  1115. /*movie*/
  1116. ctx2[0].maker
  1117. ) {
  1118. if (if_block1) {
  1119. if_block1.p(ctx2, dirty);
  1120. } else {
  1121. if_block1 = create_if_block$2(ctx2);
  1122. if_block1.c();
  1123. if_block1.m(div2, t6);
  1124. }
  1125. } else if (if_block1) {
  1126. if_block1.d(1);
  1127. if_block1 = null;
  1128. }
  1129. const resources_changes = {};
  1130. if (dirty & /*movie*/
  1131. 1) resources_changes.code = /*movie*/
  1132. ctx2[0].code;
  1133. if (dirty & /*torrentDataArray*/
  1134. 2) resources_changes.torrent = /*torrentDataArray*/
  1135. ((_a2 = ctx2[1][0]) == null ? void 0 : _a2.torrent) ?? null;
  1136. if (dirty & /*torrentDataArray*/
  1137. 2) resources_changes.magnet = /*torrentDataArray*/
  1138. ((_b2 = ctx2[1][0]) == null ? void 0 : _b2.magnet) ?? null;
  1139. if (dirty & /*torrentDataArray*/
  1140. 2) resources_changes.seed = /*torrentDataArray*/
  1141. ((_c2 = ctx2[1][0]) == null ? void 0 : _c2.seed) ?? null;
  1142. resources.$set(resources_changes);
  1143. },
  1144. i(local) {
  1145. if (current) return;
  1146. transition_in(resources.$$.fragment, local);
  1147. current = true;
  1148. },
  1149. o(local) {
  1150. transition_out(resources.$$.fragment, local);
  1151. current = false;
  1152. },
  1153. d(detaching) {
  1154. if (detaching) {
  1155. detach(div4);
  1156. }
  1157. if (if_block0) if_block0.d();
  1158. if (if_block1) if_block1.d();
  1159. destroy_component(resources);
  1160. mounted = false;
  1161. run_all(dispose);
  1162. }
  1163. };
  1164. }
  1165. function instance$2($$self, $$props, $$invalidate) {
  1166. let mouseHover = false;
  1167. let { movie } = $$props;
  1168. let { torrentDataArray = [] } = $$props;
  1169. const mouseover_handler = () => $$invalidate(2, mouseHover = true);
  1170. const mouseleave_handler = () => $$invalidate(2, mouseHover = false);
  1171. const touchstart_handler = () => $$invalidate(2, mouseHover = true);
  1172. $$self.$$set = ($$props2) => {
  1173. if ("movie" in $$props2) $$invalidate(0, movie = $$props2.movie);
  1174. if ("torrentDataArray" in $$props2) $$invalidate(1, torrentDataArray = $$props2.torrentDataArray);
  1175. };
  1176. return [
  1177. movie,
  1178. torrentDataArray,
  1179. mouseHover,
  1180. mouseover_handler,
  1181. mouseleave_handler,
  1182. touchstart_handler
  1183. ];
  1184. }
  1185. class MovieList extends SvelteComponent {
  1186. constructor(options) {
  1187. super();
  1188. init(this, options, instance$2, create_fragment$2, safe_not_equal, { movie: 0, torrentDataArray: 1 });
  1189. }
  1190. }
  1191. const sukebeiCache = {};
  1192. async function getTorrentDataFromSukebei(url) {
  1193. if (sukebeiCache[url] !== void 0) {
  1194. return Promise.resolve(sukebeiCache[url]);
  1195. }
  1196. const newUrl = `https://sukebei.nyaa.si/?f=0&c=0_0&q=${url}&s=seeders&o=desc`;
  1197. console.log(`Requesting ${newUrl}`);
  1198. return new Promise((resolve, reject) => {
  1199. _GM_xmlhttpRequest({
  1200. url: newUrl,
  1201. onload(response) {
  1202. const $torrentRows = $(response.responseText).find("tbody > *");
  1203. const torrentDataArray = $torrentRows.map((_, row) => {
  1204. const $row = $(row);
  1205. return {
  1206. title: $row.find("td a:eq(1)").text(),
  1207. torrent: "https://sukebei.nyaa.si" + ($row.find("td a i.fa-download").parent().attr("href") ?? ""),
  1208. magnet: $row.find("td a i.fa-magnet").parent().attr("href") ?? "",
  1209. seed: $row.find("td:eq(-3)").text()
  1210. };
  1211. }).get();
  1212. sukebeiCache[url] = torrentDataArray;
  1213. resolve(torrentDataArray);
  1214. },
  1215. onerror(response) {
  1216. reject(response);
  1217. }
  1218. });
  1219. });
  1220. }
  1221. function get_each_context(ctx, list, i) {
  1222. const child_ctx = ctx.slice();
  1223. child_ctx[4] = list[i];
  1224. return child_ctx;
  1225. }
  1226. function create_else_block$1(ctx) {
  1227. let div;
  1228. let current;
  1229. let each_value = ensure_array_like(
  1230. /*movieList*/
  1231. ctx[0]
  1232. );
  1233. let each_blocks = [];
  1234. for (let i = 0; i < each_value.length; i += 1) {
  1235. each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i));
  1236. }
  1237. const out = (i) => transition_out(each_blocks[i], 1, 1, () => {
  1238. each_blocks[i] = null;
  1239. });
  1240. return {
  1241. c() {
  1242. div = element("div");
  1243. for (let i = 0; i < each_blocks.length; i += 1) {
  1244. each_blocks[i].c();
  1245. }
  1246. attr(div, "class", "grid-container svelte-yp0c0n");
  1247. },
  1248. m(target2, anchor) {
  1249. insert(target2, div, anchor);
  1250. for (let i = 0; i < each_blocks.length; i += 1) {
  1251. if (each_blocks[i]) {
  1252. each_blocks[i].m(div, null);
  1253. }
  1254. }
  1255. current = true;
  1256. },
  1257. p(ctx2, dirty) {
  1258. if (dirty & /*movieList, torrentDataArray, parseInt*/
  1259. 3) {
  1260. each_value = ensure_array_like(
  1261. /*movieList*/
  1262. ctx2[0]
  1263. );
  1264. let i;
  1265. for (i = 0; i < each_value.length; i += 1) {
  1266. const child_ctx = get_each_context(ctx2, each_value, i);
  1267. if (each_blocks[i]) {
  1268. each_blocks[i].p(child_ctx, dirty);
  1269. transition_in(each_blocks[i], 1);
  1270. } else {
  1271. each_blocks[i] = create_each_block(child_ctx);
  1272. each_blocks[i].c();
  1273. transition_in(each_blocks[i], 1);
  1274. each_blocks[i].m(div, null);
  1275. }
  1276. }
  1277. group_outros();
  1278. for (i = each_value.length; i < each_blocks.length; i += 1) {
  1279. out(i);
  1280. }
  1281. check_outros();
  1282. }
  1283. },
  1284. i(local) {
  1285. if (current) return;
  1286. for (let i = 0; i < each_value.length; i += 1) {
  1287. transition_in(each_blocks[i]);
  1288. }
  1289. current = true;
  1290. },
  1291. o(local) {
  1292. each_blocks = each_blocks.filter(Boolean);
  1293. for (let i = 0; i < each_blocks.length; i += 1) {
  1294. transition_out(each_blocks[i]);
  1295. }
  1296. current = false;
  1297. },
  1298. d(detaching) {
  1299. if (detaching) {
  1300. detach(div);
  1301. }
  1302. destroy_each(each_blocks, detaching);
  1303. }
  1304. };
  1305. }
  1306. function create_if_block$1(ctx) {
  1307. let div;
  1308. return {
  1309. c() {
  1310. div = element("div");
  1311. div.textContent = "Loading...";
  1312. attr(div, "class", "loading svelte-yp0c0n");
  1313. },
  1314. m(target2, anchor) {
  1315. insert(target2, div, anchor);
  1316. },
  1317. p: noop,
  1318. i: noop,
  1319. o: noop,
  1320. d(detaching) {
  1321. if (detaching) {
  1322. detach(div);
  1323. }
  1324. }
  1325. };
  1326. }
  1327. function create_each_block(ctx) {
  1328. let movielistpage;
  1329. let current;
  1330. function func(...args) {
  1331. return (
  1332. /*func*/
  1333. ctx[2](
  1334. /*movie*/
  1335. ctx[4],
  1336. ...args
  1337. )
  1338. );
  1339. }
  1340. movielistpage = new MovieList({
  1341. props: {
  1342. movie: (
  1343. /*movie*/
  1344. ctx[4]
  1345. ),
  1346. torrentDataArray: (
  1347. /*torrentDataArray*/
  1348. ctx[1].filter(func).map(
  1349. /*func_1*/
  1350. ctx[3]
  1351. )
  1352. )
  1353. }
  1354. });
  1355. return {
  1356. c() {
  1357. create_component(movielistpage.$$.fragment);
  1358. },
  1359. m(target2, anchor) {
  1360. mount_component(movielistpage, target2, anchor);
  1361. current = true;
  1362. },
  1363. p(new_ctx, dirty) {
  1364. ctx = new_ctx;
  1365. const movielistpage_changes = {};
  1366. if (dirty & /*movieList*/
  1367. 1) movielistpage_changes.movie = /*movie*/
  1368. ctx[4];
  1369. if (dirty & /*torrentDataArray, movieList*/
  1370. 3) movielistpage_changes.torrentDataArray = /*torrentDataArray*/
  1371. ctx[1].filter(func).map(
  1372. /*func_1*/
  1373. ctx[3]
  1374. );
  1375. movielistpage.$set(movielistpage_changes);
  1376. },
  1377. i(local) {
  1378. if (current) return;
  1379. transition_in(movielistpage.$$.fragment, local);
  1380. current = true;
  1381. },
  1382. o(local) {
  1383. transition_out(movielistpage.$$.fragment, local);
  1384. current = false;
  1385. },
  1386. d(detaching) {
  1387. destroy_component(movielistpage, detaching);
  1388. }
  1389. };
  1390. }
  1391. function create_fragment$1(ctx) {
  1392. let current_block_type_index;
  1393. let if_block;
  1394. let if_block_anchor;
  1395. let current;
  1396. const if_block_creators = [create_if_block$1, create_else_block$1];
  1397. const if_blocks = [];
  1398. function select_block_type(ctx2, dirty) {
  1399. if (
  1400. /*movieList*/
  1401. ctx2[0].length === 0
  1402. ) return 0;
  1403. return 1;
  1404. }
  1405. current_block_type_index = select_block_type(ctx);
  1406. if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx);
  1407. return {
  1408. c() {
  1409. if_block.c();
  1410. if_block_anchor = empty();
  1411. },
  1412. m(target2, anchor) {
  1413. if_blocks[current_block_type_index].m(target2, anchor);
  1414. insert(target2, if_block_anchor, anchor);
  1415. current = true;
  1416. },
  1417. p(ctx2, [dirty]) {
  1418. let previous_block_index = current_block_type_index;
  1419. current_block_type_index = select_block_type(ctx2);
  1420. if (current_block_type_index === previous_block_index) {
  1421. if_blocks[current_block_type_index].p(ctx2, dirty);
  1422. } else {
  1423. group_outros();
  1424. transition_out(if_blocks[previous_block_index], 1, 1, () => {
  1425. if_blocks[previous_block_index] = null;
  1426. });
  1427. check_outros();
  1428. if_block = if_blocks[current_block_type_index];
  1429. if (!if_block) {
  1430. if_block = if_blocks[current_block_type_index] = if_block_creators[current_block_type_index](ctx2);
  1431. if_block.c();
  1432. } else {
  1433. if_block.p(ctx2, dirty);
  1434. }
  1435. transition_in(if_block, 1);
  1436. if_block.m(if_block_anchor.parentNode, if_block_anchor);
  1437. }
  1438. },
  1439. i(local) {
  1440. if (current) return;
  1441. transition_in(if_block);
  1442. current = true;
  1443. },
  1444. o(local) {
  1445. transition_out(if_block);
  1446. current = false;
  1447. },
  1448. d(detaching) {
  1449. if (detaching) {
  1450. detach(if_block_anchor);
  1451. }
  1452. if_blocks[current_block_type_index].d(detaching);
  1453. }
  1454. };
  1455. }
  1456. const CHUNK_SIZE = 20;
  1457. function instance$1($$self, $$props, $$invalidate) {
  1458. let movieList = [];
  1459. let torrentDataArray = [];
  1460. onMount(async () => {
  1461. $$invalidate(0, movieList = await getMovieList());
  1462. const codes = Array.from(new Set(movieList.map((movie) => movie.code)));
  1463. const chunks = [];
  1464. for (let i = 0; i < codes.length; i += CHUNK_SIZE) {
  1465. chunks.push(codes.slice(i, i + CHUNK_SIZE).join("|"));
  1466. }
  1467. const results = await Promise.all(chunks.map(getTorrentDataFromSukebei));
  1468. $$invalidate(1, torrentDataArray = results.flat());
  1469. });
  1470. const func = (movie, data) => data.title.includes(movie.code);
  1471. const func_1 = (data) => ({
  1472. ...data,
  1473. seed: parseInt(data.seed, 10) || 0
  1474. });
  1475. return [movieList, torrentDataArray, func, func_1];
  1476. }
  1477. class Movies extends SvelteComponent {
  1478. constructor(options) {
  1479. super();
  1480. init(this, options, instance$1, create_fragment$1, safe_not_equal, {});
  1481. }
  1482. }
  1483. function getMovieDetail() {
  1484. const $El2 = $("div.flex.flex-col.items-start.rounded-lg");
  1485. const movieDetail = {
  1486. code: $El2.find("span.text-white.ml-2").first().text(),
  1487. thumbnail: $El2.find("img").first().attr("src")
  1488. };
  1489. return movieDetail;
  1490. }
  1491. function create_if_block_1(ctx) {
  1492. let await_block_anchor;
  1493. let info = {
  1494. ctx,
  1495. current: null,
  1496. token: null,
  1497. hasCatch: false,
  1498. pending: create_pending_block,
  1499. then: create_then_block,
  1500. catch: create_catch_block,
  1501. value: 5
  1502. };
  1503. handle_promise(getVideoPreviewFromNjav(`https://njav.tv/en/search?keyword=${/*movieDetail*/
  1504. ctx[2].code}`), info);
  1505. return {
  1506. c() {
  1507. await_block_anchor = empty();
  1508. info.block.c();
  1509. },
  1510. m(target2, anchor) {
  1511. insert(target2, await_block_anchor, anchor);
  1512. info.block.m(target2, info.anchor = anchor);
  1513. info.mount = () => await_block_anchor.parentNode;
  1514. info.anchor = await_block_anchor;
  1515. },
  1516. p(new_ctx, dirty) {
  1517. ctx = new_ctx;
  1518. update_await_block_branch(info, ctx, dirty);
  1519. },
  1520. d(detaching) {
  1521. if (detaching) {
  1522. detach(await_block_anchor);
  1523. }
  1524. info.block.d(detaching);
  1525. info.token = null;
  1526. info = null;
  1527. }
  1528. };
  1529. }
  1530. function create_catch_block(ctx) {
  1531. return { c: noop, m: noop, p: noop, d: noop };
  1532. }
  1533. function create_then_block(ctx) {
  1534. let if_block_anchor;
  1535. function select_block_type(ctx2, dirty) {
  1536. if (
  1537. /*videoPreview*/
  1538. ctx2[5]
  1539. ) return create_if_block_2;
  1540. return create_else_block;
  1541. }
  1542. let current_block_type = select_block_type(ctx);
  1543. let if_block = current_block_type(ctx);
  1544. return {
  1545. c() {
  1546. if_block.c();
  1547. if_block_anchor = empty();
  1548. },
  1549. m(target2, anchor) {
  1550. if_block.m(target2, anchor);
  1551. insert(target2, if_block_anchor, anchor);
  1552. },
  1553. p(ctx2, dirty) {
  1554. if_block.p(ctx2, dirty);
  1555. },
  1556. d(detaching) {
  1557. if (detaching) {
  1558. detach(if_block_anchor);
  1559. }
  1560. if_block.d(detaching);
  1561. }
  1562. };
  1563. }
  1564. function create_else_block(ctx) {
  1565. let p;
  1566. return {
  1567. c() {
  1568. p = element("p");
  1569. p.textContent = "No Preview 😭";
  1570. attr(p, "class", "no-video svelte-1jfd2dh");
  1571. },
  1572. m(target2, anchor) {
  1573. insert(target2, p, anchor);
  1574. },
  1575. p: noop,
  1576. d(detaching) {
  1577. if (detaching) {
  1578. detach(p);
  1579. }
  1580. }
  1581. };
  1582. }
  1583. function create_if_block_2(ctx) {
  1584. let video;
  1585. let video_src_value;
  1586. return {
  1587. c() {
  1588. video = element("video");
  1589. if (!src_url_equal(video.src, video_src_value = /*videoPreview*/
  1590. ctx[5])) attr(video, "src", video_src_value);
  1591. video.autoplay = true;
  1592. video.loop = true;
  1593. attr(video, "class", "svelte-1jfd2dh");
  1594. },
  1595. m(target2, anchor) {
  1596. insert(target2, video, anchor);
  1597. },
  1598. p: noop,
  1599. d(detaching) {
  1600. if (detaching) {
  1601. detach(video);
  1602. }
  1603. }
  1604. };
  1605. }
  1606. function create_pending_block(ctx) {
  1607. return { c: noop, m: noop, p: noop, d: noop };
  1608. }
  1609. function create_if_block(ctx) {
  1610. let resources;
  1611. let current;
  1612. resources = new Resources({
  1613. props: {
  1614. code: (
  1615. /*movieDetail*/
  1616. ctx[2].code
  1617. ),
  1618. torrent: (
  1619. /*torrentData*/
  1620. ctx[1][0].torrent
  1621. ),
  1622. magnet: (
  1623. /*torrentData*/
  1624. ctx[1][0].magnet
  1625. ),
  1626. seed: (
  1627. /*torrentData*/
  1628. ctx[1][0].seed
  1629. )
  1630. }
  1631. });
  1632. return {
  1633. c() {
  1634. create_component(resources.$$.fragment);
  1635. },
  1636. m(target2, anchor) {
  1637. mount_component(resources, target2, anchor);
  1638. current = true;
  1639. },
  1640. p(ctx2, dirty) {
  1641. const resources_changes = {};
  1642. if (dirty & /*torrentData*/
  1643. 2) resources_changes.torrent = /*torrentData*/
  1644. ctx2[1][0].torrent;
  1645. if (dirty & /*torrentData*/
  1646. 2) resources_changes.magnet = /*torrentData*/
  1647. ctx2[1][0].magnet;
  1648. if (dirty & /*torrentData*/
  1649. 2) resources_changes.seed = /*torrentData*/
  1650. ctx2[1][0].seed;
  1651. resources.$set(resources_changes);
  1652. },
  1653. i(local) {
  1654. if (current) return;
  1655. transition_in(resources.$$.fragment, local);
  1656. current = true;
  1657. },
  1658. o(local) {
  1659. transition_out(resources.$$.fragment, local);
  1660. current = false;
  1661. },
  1662. d(detaching) {
  1663. destroy_component(resources, detaching);
  1664. }
  1665. };
  1666. }
  1667. function create_fragment(ctx) {
  1668. let div;
  1669. let img;
  1670. let img_src_value;
  1671. let t0;
  1672. let t1;
  1673. let if_block1_anchor;
  1674. let current;
  1675. let mounted;
  1676. let dispose;
  1677. let if_block0 = (
  1678. /*mouseHover*/
  1679. ctx[0] && create_if_block_1(ctx)
  1680. );
  1681. let if_block1 = (
  1682. /*torrentData*/
  1683. ctx[1].length > 0 && create_if_block(ctx)
  1684. );
  1685. return {
  1686. c() {
  1687. div = element("div");
  1688. img = element("img");
  1689. t0 = space();
  1690. if (if_block0) if_block0.c();
  1691. t1 = space();
  1692. if (if_block1) if_block1.c();
  1693. if_block1_anchor = empty();
  1694. if (!src_url_equal(img.src, img_src_value = /*movieDetail*/
  1695. ctx[2].thumbnail)) attr(img, "src", img_src_value);
  1696. attr(
  1697. img,
  1698. "alt",
  1699. /*movieDetail*/
  1700. ctx[2].code
  1701. );
  1702. attr(img, "class", "svelte-1jfd2dh");
  1703. attr(div, "class", "svelte-1jfd2dh");
  1704. },
  1705. m(target2, anchor) {
  1706. insert(target2, div, anchor);
  1707. append(div, img);
  1708. append(div, t0);
  1709. if (if_block0) if_block0.m(div, null);
  1710. insert(target2, t1, anchor);
  1711. if (if_block1) if_block1.m(target2, anchor);
  1712. insert(target2, if_block1_anchor, anchor);
  1713. current = true;
  1714. if (!mounted) {
  1715. dispose = [
  1716. listen(
  1717. div,
  1718. "touchstart",
  1719. /*handleMouseEnter*/
  1720. ctx[3],
  1721. { passive: true }
  1722. ),
  1723. listen(
  1724. div,
  1725. "focus",
  1726. /*handleMouseEnter*/
  1727. ctx[3]
  1728. ),
  1729. listen(
  1730. div,
  1731. "mouseover",
  1732. /*handleMouseEnter*/
  1733. ctx[3]
  1734. ),
  1735. listen(
  1736. div,
  1737. "mouseleave",
  1738. /*handleMouseLeave*/
  1739. ctx[4]
  1740. )
  1741. ];
  1742. mounted = true;
  1743. }
  1744. },
  1745. p(ctx2, [dirty]) {
  1746. if (
  1747. /*mouseHover*/
  1748. ctx2[0]
  1749. ) {
  1750. if (if_block0) {
  1751. if_block0.p(ctx2, dirty);
  1752. } else {
  1753. if_block0 = create_if_block_1(ctx2);
  1754. if_block0.c();
  1755. if_block0.m(div, null);
  1756. }
  1757. } else if (if_block0) {
  1758. if_block0.d(1);
  1759. if_block0 = null;
  1760. }
  1761. if (
  1762. /*torrentData*/
  1763. ctx2[1].length > 0
  1764. ) {
  1765. if (if_block1) {
  1766. if_block1.p(ctx2, dirty);
  1767. if (dirty & /*torrentData*/
  1768. 2) {
  1769. transition_in(if_block1, 1);
  1770. }
  1771. } else {
  1772. if_block1 = create_if_block(ctx2);
  1773. if_block1.c();
  1774. transition_in(if_block1, 1);
  1775. if_block1.m(if_block1_anchor.parentNode, if_block1_anchor);
  1776. }
  1777. } else if (if_block1) {
  1778. group_outros();
  1779. transition_out(if_block1, 1, 1, () => {
  1780. if_block1 = null;
  1781. });
  1782. check_outros();
  1783. }
  1784. },
  1785. i(local) {
  1786. if (current) return;
  1787. transition_in(if_block1);
  1788. current = true;
  1789. },
  1790. o(local) {
  1791. transition_out(if_block1);
  1792. current = false;
  1793. },
  1794. d(detaching) {
  1795. if (detaching) {
  1796. detach(div);
  1797. detach(t1);
  1798. detach(if_block1_anchor);
  1799. }
  1800. if (if_block0) if_block0.d();
  1801. if (if_block1) if_block1.d(detaching);
  1802. mounted = false;
  1803. run_all(dispose);
  1804. }
  1805. };
  1806. }
  1807. function instance($$self, $$props, $$invalidate) {
  1808. let movieDetail = getMovieDetail();
  1809. let mouseHover = false;
  1810. let torrentData = [];
  1811. onMount(async () => {
  1812. var _a;
  1813. $$invalidate(1, torrentData = await getTorrentDataFromSukebei(movieDetail.code));
  1814. console.log((_a = torrentData[0]) == null ? void 0 : _a.torrent);
  1815. });
  1816. const handleMouseEnter = () => $$invalidate(0, mouseHover = true);
  1817. const handleMouseLeave = () => $$invalidate(0, mouseHover = false);
  1818. return [mouseHover, torrentData, movieDetail, handleMouseEnter, handleMouseLeave];
  1819. }
  1820. class MovieDetail extends SvelteComponent {
  1821. constructor(options) {
  1822. super();
  1823. init(this, options, instance, create_fragment, safe_not_equal, {});
  1824. }
  1825. }
  1826. const target = document.querySelector("div.flex.flex-wrap.-m-4");
  1827. if (target) {
  1828. new Movies({
  1829. target: target.parentNode.insertBefore(document.createElement("div"), target)
  1830. });
  1831. target.remove();
  1832. } else {
  1833. console.error("Target element for Movies not found.");
  1834. }
  1835. const $El = document.querySelector("div.flex.flex-col.items-start.rounded-lg > div > a > img").parentElement;
  1836. if ($El) {
  1837. new MovieDetail({
  1838. target: $El.parentNode.insertBefore(document.createElement("div"), $El)
  1839. });
  1840. $El.remove();
  1841. } else {
  1842. console.error("Target element for MovieDetail not found.");
  1843. }
  1844.  
  1845. })(jQuery);