地址精简

去掉 抖音、bilibili、西瓜、腾讯新闻 网址的多余部分,减小长度。

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         地址精简
// @namespace    http://domain.com/directory
// @version      0.3.7
// @author       幸福的赢得
// @match        *://*.douyin.com/*
// @exclude      *://so.douyin.com/*
// @match        *://*.iesdouyin.com/*
// @match        *://*.bilibili.com/*
// @exclude      *://m.bilibili.com/search*
// @exclude      *://search.bilibili.com/*
// @match        *://*.ixigua.com/*
// @match        *://*.inews.qq.com/*
// @include      /^https?:\/\/(greasy|sleazy)fork\.org\/[^/]+\/scripts\/\d+-/
// @match        *://*.zhihu.com/*
// @exclude      *://www.zhihu.com/search?*
// @grant        none
// @description 去掉 抖音、bilibili、西瓜、腾讯新闻 网址的多余部分,减小长度。
// ==/UserScript==
 
if (/:\/\/greasyfork/.test (location.href) ) {
    const m =
    /(\/[^/]+\/scripts\/\d+)-[^/]+(\/.*)?/.exec(location.pathname)
    history.replaceState({}, null, `${location.origin}${m[1]}${m[2] ?? ''}${location.search}${location.hash}`)
    return
}
 
 
if (/\?/.test (location.href) ) {
    var plainPath =
    location.href.replace (/\?.*/, "")
    history.pushState({}, '', plainPath);
}