hanime.tv - avatar & banner helper

This scripts lets you open avatar and banner in a new tab when you click on them.

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        hanime.tv - avatar & banner helper
// @namespace   https://myanimelist.net/profile/kyoyatempest
// @include     https://hanime.tv/channel
// @match       https://hanime.tv/channels/*
// @version     1.6
// @author      kyoyacchi
// @description This scripts lets you open avatar and banner in a new tab when you click on them.
// @icon        https://hanime.tv/favicon.ico
// @license gpl-3.0
// @run-at      document-end
// ==/UserScript==


function App(){

let v = document.querySelector(".avatar__image")
? document.querySelector(".avatar__image") : null;

let url = document.querySelector(".avatar__image") ? document.querySelector(".avatar__image").style.backgroundImage.split('"')[1] : null;

if (v){
v.onclick = function () {
  if (url) {
window.open(url, "_blank")

  }
}
}


let banner =document.querySelector(".channel__banner")? document.querySelector(".channel__banner") : null;
let bannerurl = banner ? document.getElementsByClassName("channel__banner__bg_overlay")[0].style.backgroundImage.split('"')[1] : null;



  if (banner){

banner.onclick = function () {
  if (bannerurl == "https://static-assets-44d.pages.dev/images/temp_bg_top.png") {//default
    return
  } else {

   window.open(bannerurl,"_blank")
  }

}
  }


}
window.addEventListener("load",()=>{
  App();
});
let curl = window.location.href
function checkUrl (){
  let newUrl = window.location.href
  if(newUrl != curl){
    App();
  }
}

setInterval(checkUrl,1000);