PlatinSport direct AceStream links

Obtain direct, clickable AceStream links on PlatinSport, bypassing url shorteners.

目前為 2023-04-02 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name PlatinSport direct AceStream links
  3. // @description Obtain direct, clickable AceStream links on PlatinSport, bypassing url shorteners.
  4. // @namespace StephenP
  5. // @author StephenP
  6. // @grant GM.registerMenuCommand
  7. // @grant GM.setValue
  8. // @grant GM.getValue
  9. // @version 1.1
  10. // @match https://www.platinsport.com/*
  11. // @contributionURL https://nowpayments.io/donation/stephenpgreasyfork
  12. // @license AGPL-3.0-or-later
  13. // ==/UserScript==
  14. getAdultContentVisible();
  15. async function getAdultContentVisible(){
  16. var x=await GM.getValue("adultContentEnabled");
  17. if(x=="yes"){
  18. GM.registerMenuCommand("Hide the lists of adult contents on Platinsport", hideAdultContent, "H");
  19. }
  20. else{
  21. GM.registerMenuCommand("Show the lists of adult contents on Platinsport", showAdultContent, "S");
  22. removeAdultLinks();
  23. }
  24. createLinks();
  25. }
  26. function hideAdultContent(){
  27. GM.setValue("adultContentEnabled","no");
  28. location.reload();
  29. }
  30. function showAdultContent(){
  31. GM.setValue("adultContentEnabled","yes");
  32. location.reload();
  33. }
  34. function removeAdultLinks(){
  35. var b=document.getElementsByClassName("fa-mars-double");
  36. if(b.length==1){
  37. b[0].parentNode.parentNode.remove();
  38. }
  39. }
  40. function createLinks(){
  41. if(!document.location.href.includes("/link/")){
  42. var links=document.getElementsByTagName("A");
  43.  
  44. for(let link of links){
  45. if(link.href.includes("bc.vc")){
  46. let pos=link.href.indexOf("https://www.p");
  47. link.href=link.href.slice(pos);
  48. }
  49. }
  50. }
  51. else{
  52. var texts=document.getElementsByTagName("STRONG");
  53. for(let t of texts){
  54. var link=null;
  55. var regexpLinks=/acestream:\/\/[a-f0-9]{40}/g
  56. t.innerHTML=t.innerHTML.replace(regexpLinks,replacerLinks);
  57. if(location.href.includes("/link")){
  58. var regexpLangs=/[\[]([A-Z][A-Z])[\]]/g
  59. t.innerHTML=t.innerHTML.replace(regexpLangs,replacerLangs);
  60. }
  61. }
  62. }
  63. }
  64. function replacerLinks(match, offset, string) {
  65. return "<a style=\"color: yellow; line-height: normal\" href=\""+match+"\">"+match.replace("acestream://","")+"</a>";
  66. }
  67. function replacerLangs(match, p1, offset, string) {
  68. return getFlagEmoji(p1);
  69. }
  70. //Following function taken mostly from https://dev.to/jorik/country-code-to-flag-emoji-a21
  71. function getFlagEmoji(countryCode) {
  72. if(countryCode==="UK"){
  73. countryCode="GB"
  74. }
  75. const codePoints = countryCode
  76. .toUpperCase()
  77. .split('')
  78. .map(char => 127397 + char.charCodeAt());
  79. return String.fromCodePoint(...codePoints);
  80. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址