NicoNico Search Plus

ニコ動検索カスタム

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         NicoNico Search Plus
// @namespace  https://tanbatu.github.io/
// @version      0.1
// @description  ニコ動検索カスタム
// @author       You
// @match        https://www.nicovideo.jp/tag/*
// @match        https://www.nicovideo.jp/search/*
// @icon         https://www.google.com/s2/favicons?domain=nicovideo.jp
// @license      tanbatu
// @grant        none
// @namespace https://greasyfork.org/users/663478
// ==/UserScript==

let url = location.href
let new_url = url.replace(/\?.*$/,"");

let getbutton = document.getElementsByClassName('hidden')[0]
getbutton.insertAdjacentHTML('afterend',`
<div class="autoPlay" style="background-color:#dcdcdc;border-radius:10px;">
            <p class="switchingBtn">人気順</p>
			<p class="switchingBtn">視聴回数</p>
            <p class="switchingBtn">投稿日</p>
</div>
`)

let btn = document.getElementsByClassName('switchingBtn')
btn[2].addEventListener("click", function() {
  location.href=new_url+"?sort=h&order=d"
});
btn[3].addEventListener("click", function() {
  location.href=new_url+"?sort=v&order=d"
});
btn[4].addEventListener("click", function() {
  location.href=new_url+"?sort=f&order=d"
});