My 115

115

  1. // ==UserScript==
  2. // @name My 115
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.14
  5. // @description 115
  6. // @author You
  7.  
  8.  
  9.  
  10. // @include http*://115.com/*
  11.  
  12. // @icon https://www.google.com/s2/favicons?domain=115.com
  13. // @grant none
  14. // ==/UserScript==
  15. function addJQuery(callback) {
  16. var script = document.createElement("script");
  17. script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js");
  18. script.addEventListener('load', function() {
  19. var script = document.createElement("script");
  20. script.textContent = "window.jQ=jQuery.noConflict(true);(" + callback.toString() + ")();";
  21. document.body.appendChild(script);
  22. }, false);
  23. document.body.appendChild(script);
  24. }
  25.  
  26. function main(){
  27. const regex = /((?:(?!(boy|oy|hjd|jd|com|om|SIS|IS|sis)))[a-zA-Z]{2,5})-?\d{3,4}/g;
  28. const subtitle_r = /((?:(?!(boy|oy|hjd|jd|com|om|SIS|IS)))[a-zA-Z]{2,5})-?\d{3,4}(-|_)?(ch|C|c)/g;
  29. function mainBtnClick() {
  30. var items = $(".name")
  31. items.each((i, video) => {
  32. var texts = $(video).find("span")
  33. var t = texts.text().toUpperCase()
  34. const found = t.match(regex);
  35. const sub = t.match(subtitle_r)
  36. if (found && found.length === 1) {
  37. var code = found[0]
  38. var temp = code.match(/[a-zA-Z]+|\d+/g)
  39. code = temp[0] + temp[1]
  40. $.ajax({url: "https://www.mingren.life/av/" + code, success: (result) => {
  41. if (result.DownloadMovies.length > 0){
  42. // already download
  43. if (result.DownloadMovies[0].subtitle == 0 && sub) {
  44. $(texts).css("color", "purple")
  45. } else {
  46. $(texts).css("color", "blue")
  47. }
  48. } else {
  49. $(texts).css("color", "red")
  50. }
  51. }})
  52. }
  53.  
  54.  
  55. })
  56. }
  57.  
  58.  
  59. $(document).ready(function(){
  60. 'use strict';
  61. let body = $("body");
  62. let btn = $("<button style='z-index:100;position: absolute; left: 100px; top: 200px' id='main-btn-addon'>Start</button>")
  63. body.append(btn)
  64.  
  65. $('#main-btn-addon').click(mainBtnClick)
  66.  
  67. console.log(body)
  68. });
  69. }
  70. // load jQuery and execute the main function
  71. addJQuery(main);