PGR21 새 불판 감지기

PGR21에서 불판에 상주시 새 불판으로 자동 이동

  1. // ==UserScript==
  2. // @name PGR21 새 불판 감지기
  3. // @namespace https://github.com/nyqui/pgr21-fresh-grill-detector
  4. // @match https://pgr21.com/pb/bulpan.php*
  5. // @match https://pgr21.co.kr/pb/bulpan.php*
  6. // @match https://pgr21.net/pb/bulpan.php*
  7. // @match https://pgrer.net/pb/bulpan.php*
  8. // @match https://ppt21.com/pb/bulpan.php*
  9. // @match https://pgr21.com/bulpan/*
  10. // @exclude https://pgr21.com/bulpan/0*
  11. // @version 0.3.0
  12. // @author nyqui
  13. // @require https://cdn.jsdelivr.net/npm/sweetalert2@11
  14. // @grant GM_addStyle
  15.  
  16. // @description PGR21에서 불판에 상주시 새 불판으로 자동 이동
  17. // @license MIT
  18. // ==/UserScript==
  19.  
  20. const footerString = "v" + GM_info.script.version;
  21. //redirect timer in ms
  22. const redirectTimer = 3000;
  23. //admin comment class name
  24. const admCmtName = ".admCmt";
  25. const cmtWrapName = ".cmtWrap";
  26. const toastMix = Swal.mixin({
  27. toast: true,
  28. icon: "success",
  29. position: "top-end",
  30. showConfirmButton: false,
  31. timer: `${redirectTimer}`,
  32. timerProgressBar: true,
  33. title: `새 불판 확인`,
  34. text: `잠시 이동합니다...`
  35. });
  36.  
  37.  
  38. /*
  39. if ((window.location.hostname).includes("pgr21.com") === false) {
  40. window.location.hostname = "pgr21.com";
  41. }
  42. */
  43.  
  44. if ((window.location.pathname).includes(".php") === false) {
  45. var youtube = null;
  46.  
  47. $(document).ready(function() {
  48. youtube = document.querySelector('iframe.youtu-embed')?.getAttribute("src");
  49.  
  50. if (youtube) {
  51. GM_addStyle(`
  52. .btn_bulpan {
  53. margin-top: -50px !important;
  54. margin-right: 10px !important;
  55. }
  56. `);
  57.  
  58. const docnumber = (window.location.pathname.substring(window.location.pathname.lastIndexOf('/') + 1));
  59. youtube = (youtube.substring(youtube.lastIndexOf('/') + 1));
  60.  
  61. //<a class="btn_bulpan" id="btn_bulpan" href="/pb/bulpan.php?no=31868" data-no="31868">불판창</a>
  62. $("a#btn_bulpan.btn_bulpan").after('<a class="btn_bulpan" id="btn_bulpan_youtube" href="/pb/bulpan_twitch.php?no=' + docnumber + '&player=youtube&ch=' + youtube + '" target="_blank" rel="noopener noreferrer">유튜브 불판창</a>');
  63. }
  64.  
  65. });
  66. } else {
  67.  
  68. const bulpanTitle = (document.title).replace(/(-|\(|#)(.*)/, "");
  69.  
  70. toastMix.fire({
  71. icon: "info",
  72. title: "새 불판 감지기 작동중",
  73. text: bulpanTitle,
  74. timer: 2000,
  75. footer: footerString
  76. });
  77.  
  78. const observer = new MutationObserver(function(mutations, observer) {
  79. var admCmts = document.querySelectorAll(admCmtName);
  80. var lastadmCmt = admCmts[admCmts.length - 1];
  81. if ((lastadmCmt.innerText).includes(bulpanTitle)) {
  82. observer.disconnect();
  83. toastMix.fire({
  84. didDestroy: () => {
  85. window.location.href = (lastadmCmt.querySelector("a").getAttribute("href"));
  86. },
  87. });
  88. }
  89. });
  90.  
  91. observer.observe(document.querySelector(cmtWrapName), {
  92. childList: true
  93. });
  94. }

QingJ © 2025

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