快资讯跳转至手机版

将电脑版页面跳转到手机版,让新闻内容居中并隐藏推荐新闻!

目前為 2020-04-15 提交的版本,檢視 最新版本

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

You will need to install an extension such as Tampermonkey to install this script.

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         快资讯跳转至手机版
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  将电脑版页面跳转到手机版,让新闻内容居中并隐藏推荐新闻!
// @author       You
// @match        *://www.360kuai.com/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict'
    var u0 = window.location.href;
    var u1,u2,u3,u4;
    if(u0.indexOf("mob") == -1) //非手机版
    {
        if(u0.indexOf("pc/detail") > -1) //电脑版
        {
            u1 = u0.substr(0,24)
            u2 = u0.substr(34,u0.length-34)
            console.log("u1="+u1)
            console.log("u2="+u2)
            u3 = u1+"mob/transcoding?"+u2;
            console.log("u3="+u3)
            window.location.href = u3
        }
        else 
        {
            u1 = u0.substr(0,24)
            u2 = u0.substr(24,17)
            console.log("u1="+u1)
            console.log("u2="+u2)
            if(u2=="")
                return;
            else if(u2.indexOf("pc/home") == -1)
            {
                u3 = u0.substr(42,u0.length-42)
                console.log("u3="+u3)
                u4 = u1+"mob/transcoding?url="+u2+"&"+u3;
                console.log("u4="+u4)
                window.location.href = u4
            }
        }
    }
    var rel_news = document.getElementById("rel_news")
    if(rel_news != null)
        rel_news.setAttribute("style","display:none")

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