fc2ppvdb-improved

fc2ppvdb.com Improved for better browsing

目前為 2025-01-21 提交的版本,檢視 最新版本

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