Greasy Fork

oo.pe redirection remover

remove oo.pe redirection in Arca.live

当前为 2024-01-29 提交的版本,查看 最新版本

// ==UserScript==
// @name            oo.pe redirection remover
// @name:ko         oo.pe 리디렉션 제거기
// @namespace       OOPE_REMOVER_V1
// @match           https://arca.live/b/*
// @run-at          document-end
// @version         1.1
// @author          Laria
// @description     remove oo.pe redirection in Arca.live
// @description:ko  아카라이브 oo.pe 리디렉션을 제거합니다.
// @supportURL      https://greasyfork.org/scripts/485591
// @icon            https://www.google.com/s2/favicons?sz=64&domain=oo.pe
// @license         MIT
// @encoding        utf-8
// ==/UserScript==

/*
 * Note: Please install with greasyfork, it will update automatically..
 *
 * More info. https://greasyfork.org/scripts/485591
 *
*/

/*
 * == Change log ==
 * 1.0 - release
 * 1.1 - add retry
 */

//root
(function() {
    'use strict';
    function resolveLink() {
      //search link include 'oo.pe'
      document.querySelectorAll('a[href*="oo.pe"]').forEach(function(src) {
        try {
          //tokenizing
          const token = src.href.split('/');
          //search oo.pe prefix
          const pref = token.indexOf('oo.pe');
          //join link after prefix
          const out = token.slice(pref + 1).join('/');
          //apply
          src.href = out;
        } catch (_) {}
      });
    }
    resolveLink();
    //repeat once
    setTimeout(() => {
      resolveLink();
    }, 100);
})();