Last active
April 16, 2025 04:53
-
-
Save roflsunriz/3cad056749b77eaa5e583b7ef60ba6f1 to your computer and use it in GitHub Desktop.
JumpToPCnico : ニコニコ動画のモバイルページからPCページへ簡単に移動できるユーザースクリプト
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name JumpToPCnico | |
// @namespace jumpToPCnico | |
// @version 1.3 | |
// @description ニコニコ動画のモバイルページからPCページへ簡単に移動できるユーザースクリプト | |
// @author roflsunriz | |
// @match *://sp.nicovideo.jp/* | |
// @match *://sp.seiga.nicovideo.jp/* | |
// @match *://sp.*.nicovideo.jp/* | |
// @match *://sp.nicovideo.jp/ | |
// @match *://sp.seiga.nicovideo.jp/ | |
// @match *://sp.*.nicovideo.jp/ | |
// @grant none | |
// @updateURL https://gist.githubusercontent.com/roflsunriz/3cad056749b77eaa5e583b7ef60ba6f1/raw/JumpToPCnico.user.js | |
// @downloadURL https://gist.githubusercontent.com/roflsunriz/3cad056749b77eaa5e583b7ef60ba6f1/raw/JumpToPCnico.user.js | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=nicovideo.jp | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// ページが読み込まれたときに実行される関数 | |
window.addEventListener("load", function() { | |
// URLを取得する | |
const url = window.location.href; | |
// sp.という文字列が含まれている場合、PC版のURLに飛ぶボタンを挿入する | |
if (url.includes("sp.")) { | |
let mobileUrl = url.replace("sp.", ""); | |
// ニコニコ静画の特別処理 | |
if (url.includes("seiga.nicovideo.jp")) { | |
mobileUrl = mobileUrl.replace("#!/", "/"); | |
} | |
const button = document.createElement("button"); | |
button.innerText = "PC版へ"; | |
button.className = "jump-to-pc-button"; | |
// スタイルを追加 | |
button.style.cssText = ` | |
position: fixed; | |
bottom: 20px; | |
right: 20px; | |
padding: 12px 24px; | |
font-size: 16px; | |
font-weight: bold; | |
color: #ffffff; | |
background-color: rgba(40, 40, 40, 0.8); | |
border: none; | |
border-radius: 25px; | |
backdrop-filter: blur(10px); | |
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); | |
cursor: pointer; | |
transition: all 0.3s ease; | |
z-index: 102; | |
`; | |
// ホバー時のスタイル | |
button.addEventListener("mouseover", function() { | |
this.style.backgroundColor = 'rgba(60, 60, 60, 0.9)'; | |
this.style.transform = 'scale(1.05)'; | |
}); | |
button.addEventListener("mouseout", function() { | |
this.style.backgroundColor = 'rgba(40, 40, 40, 0.8)'; | |
this.style.transform = 'scale(1)'; | |
}); | |
button.addEventListener("click", function() { | |
window.location.href = mobileUrl; | |
}); | |
document.body.appendChild(button); | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Rawボタンを押してTampermonkeyにインストール。