Mobile 1668 to Desktop

Auto Redirect from mobile 1668 to desktop

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Mobile 1668 to Desktop
// @namespace    https://www.reddit.com/user/RobotOilInc
// @version      0.1.1
// @description  Auto Redirect from mobile 1668 to desktop
// @author       RobotOilInc
// @match        https://m.1688.com/offer/*.html*offerId=*
// @match        https://m.1688.com/offer/*.html*
// @license      MIT
// @homepageURL  https://greasyfork.org/en/scripts/430178-mobile-1668-to-desktop
// @supportURL   https://greasyfork.org/en/scripts/430178-mobile-1668-to-desktop
// @run-at       document-start
// @icon         https://img.alicdn.com/tfs/TB1uh..zbj1gK0jSZFuXXcrHpXa-16-16.ico?x-icon
// ==/UserScript==

/* jshint esversion: 6 */

// Regex to grab offerId if not in URL
const regex = /https?:\/\/m\.1688\.com\/offer\/(.*)\.html/i;

// Get the offerId
let offerId = (new URLSearchParams(window.location.search)).get('offerId');
if (offerId == null) {
    offerId = regex.exec(window.location.href)[1]
}

window.location.href = `https://detail.1688.com/offer/${offerId}.html`;