Greasy Fork is available in English.

[KissAnime] Beta Default Server

Sets KissAnime/Kimcartoon player to beta server.

安装此脚本?
作者推荐脚本

您可能也喜欢[KissAnime] Captcha Solver

安装此脚本
  1. // ==UserScript==
  2. // @name [KissAnime] Beta Default Server
  3. // @namespace https://greasyfork.org/en/users/193865-westleym
  4. // @author WestleyM
  5. // @version 2019.01.19
  6. // @icon http://kissanime.ru/Content/images/favicon.ico
  7. // @description Sets KissAnime/Kimcartoon player to beta server.
  8. // @grant none
  9. // @include *://kissanime.ru/anime/*
  10. // @include *://kimcartoon.me/*
  11. // @require http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
  12. // ==/UserScript==
  13.  
  14. function main() {
  15. var updateLink = "&s=beta&pfail=3";
  16. var $ = window.jQuery;
  17. var webLink = window.location.href;
  18. console.log(webLink);
  19. //kimcartoon
  20. if (webLink.indexOf("kimcartoon") > -1) {
  21. if (webLink.indexOf("&s=") > -1 && webLink.indexOf("&s=beta") === -1) {
  22. window.stop();
  23. var currentServer = webLink.substring(webLink.indexOf("&s="), webLink.length); //Grabs string starting with &s= until the end of the link
  24. webLink = webLink.replace(currentServer, "&s=beta");
  25. location.replace(webLink);
  26. } else if (webLink.indexOf("&s=") === -1 && webLink.indexOf("id=") > -1) {
  27. window.stop();
  28. webLink += "&s=beta";
  29. location.replace(webLink);
  30. }
  31. }
  32.  
  33. //kissanime
  34. //Redirect to the beta server if the script detects you are on the default one
  35. if (webLink.indexOf("kissanime") > -1) {
  36. if(webLink.indexOf("&s=default") > -1) {
  37. window.stop();
  38. webLink = webLink.replace("&s=default", updateLink);
  39. location.replace(webLink);
  40. }
  41. //Works when on the page for watching the anime
  42. try {
  43. //Updates the links in the episode box
  44. var selectEpisode = $("#selectEpisode").find("option").toArray();
  45. if (selectEpisode != null) {
  46. selectEpisode.forEach(function(episodeLink) {
  47. episodeLink.value += updateLink;
  48. });
  49. }
  50.  
  51. //Updates the link on the "previous" button
  52. var btnPrevious = $("#btnPrevious").parent()[0];
  53. if (btnPrevious != null) {
  54. btnPrevious.href += updateLink;
  55. }
  56.  
  57. //Updates the link on the "next" button
  58. var btnNext = $("#btnNext").parent()[0];
  59. if (btnNext != null) {
  60. btnNext.href += updateLink;
  61. }
  62. }
  63. catch(err) {
  64. console.log("There was an error: " + err);
  65. }
  66. }
  67. }
  68.  
  69. main();