知乎移动页变网页

try to take over the world!

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         知乎移动页变网页
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       cmmdwl
// @match        *://*.zhihu.com/tardis/*
// @grant        none
// ==/UserScript==

(function() {



    var url = location.href; //声明变量url
    if (url.indexOf("/tardis/sogou/qus/") > 0) {//如果url里面搜索到了/tardis就继续执行
        var url1 = url.replace("/tardis/sogou/qus/", "/question/"); //替换掉tardis
        var url2 = url1.slice(url.indexOf("/tardis/sogou/qus/") + 1).split('/')
        // console.log(location.protocol+"//www.v2ex.com/t/"+url2[1])
        console.log("url 1 ok "+url1);
        console.log("url 2 ok "+url2);
        location.replace(url1); //直接输出 url1 结束了
        console.log(location.protocol+"/www.zhihu.com/"+url2[2]);
    }

    // Your code here...
})();