voicehub链接asmr.one

向voicehub添加asmr.one链接

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください。
  1. // ==UserScript==
  2. // @name voicehub链接asmr.one
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1.1
  5. // @description 向voicehub添加asmr.one链接
  6. // @author danhuang jiang
  7. // @match *://voicehub.xarchiver.tk/*
  8. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  9. // @grant GM_xmlhttpRequest
  10. // @require https://code.jquery.com/jquery-3.6.0.min.js
  11. // @license MIT
  12. // ==/UserScript==
  13. const asmr_one_api = "api.asmr-100.com"
  14. const asmr_one="www.asmr-100.com"
  15. //const asmr_one = "www.asmr.one"
  16. var count = 0;
  17.  
  18. function processItem(item) {
  19. if ($(item).hasClass('processed')) {
  20. return;
  21. }
  22. var imgContent = $(item).find('div > a > div > div.q-img__content.absolute-full.q-anchor--skip > div.absolute-top-left.transparent.q-pa-none > div > div');
  23. if (imgContent.length > 0) {
  24. var rj = imgContent.text().trim();
  25. var target = $(item).find('div > div > div > div:nth-child(4) > div > div:nth-child(4)');
  26. var newTarget = target.clone();
  27. newTarget.find('a').attr('href', `https://${asmr_one}/work/${rj}`);
  28. GM_xmlhttpRequest({
  29. method: "GET",
  30. url: `https://${asmr_one_api}/api/workInfo/${rj.slice(2)}`,
  31. responseType: "json",
  32. onload: function (resp) {
  33. if (resp.readyState === 4 && resp.status === 200) {
  34. if (resp.response['has_subtitle']) {
  35. $(newTarget).find('a').text('asmr.one 字幕')
  36. } else {
  37. $(newTarget).find('a').text('asmr.one')
  38. }
  39. $(target).after(newTarget);
  40. }
  41. }
  42. }
  43. );
  44. $(item).addClass('processed');
  45. count = 0;
  46. }
  47. }
  48.  
  49. function checkItems() {
  50. const url = window.location.href
  51. var items;
  52. if (url.includes('works')) {
  53. items = $('#q-app > div > div.q-page-container > main > div > div:nth-child(2) > div > div');
  54. } else if (url.includes('work')) {
  55. items = $('#q-app > div > div.q-page-container > main > div > div.col-xs-12.col-sm-8.col-lg-6');
  56. }
  57. var unprocessedItems = items.filter(':not(.processed)');
  58. if (unprocessedItems.length == 0) {
  59. if (++count == 5) {
  60. clearInterval(intervalId);
  61. }
  62. } else {
  63. unprocessedItems.each(function (index, item) {
  64. processItem(item);
  65. });
  66. }
  67. }
  68.  
  69. var intervalId = setInterval(checkItems, 2000);