youtube: shorts view => regular view

3/15/2022, 10:19:34 PM

当前为 2022-03-15 提交的版本,查看 最新版本

// ==UserScript==
// @name        youtube: shorts view => regular view
// @namespace   Violentmonkey Scripts
// @include     https://*.youtube.*
// @version     1.1
// @author      KraXen72
// @grant       GM_registerMenuCommand
// @description 3/15/2022, 10:19:34 PM
// ==/UserScript==

function shortsRegularView() {
  url = window.location.href
  parts = url.split("/")
    .filter(part => part !== "")
  shortsIndex = parts.indexOf("shorts")
  idIndex = shortsIndex + 1
  
  newurl = `https://youtube.com/watch?v=${parts[idIndex]}`
  window.location.href = newurl
  
  console.log("href:", parts)
  
}

// actionsDiv = document.querySelector("#actions")
// button = document.createElement("button")
// button.onclick = shortsRegularView

// button.innerHTML = `<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 0 24 24" width="24px" fill="#FFFFFF"><path d="M0 0h24v24H0V0z" fill="none"/><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 14.5v-9l6 4.5-6 4.5z"/></svg>`
// actionsDiv.appendChild(button)

GM_registerMenuCommand("Go to regular view", shortsRegularView)

QingJ © 2025

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