Amazon Questions New Tab

Open questions page of Amazon products in a new tab.

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Amazon Questions New Tab
// @namespace   iamMG
// @version     1.0
// @description Open questions page of Amazon products in a new tab.
// @author      iamMG
// @grant     	GM.openInTab
// @include		/^https?:\/\/(www.)?amazon.*\/[a-z]p\/.*/
// @run-at		document-end
// @license			MIT
// @icon			https://i.imgur.com/d5YE1Lv.png
// @copyright		2019, iamMG (https://openuserjs.org/users/iamMG)
// ==/UserScript==

(function() {
    'use strict';
	var que = document.getElementById('askATFLink');
	que.addEventListener('click', function(e){
        this.removeAttribute('href');
		var matches = /((?:.*)amazon.(?:\w+))\/(?:.*)?([a-z]p)\/(?:product\/)?([^\/\?&]+)(?:.*|$)/.exec(document.URL);
		var link = "/ask/questions/asin/" + matches[3];
		window.open(window.location.protocol + "//" + window.location.host + link, "", "", false);
    }, false)
})();