Pinterest middle click open image in new tab

Fixes pinterest middle click open image in new tab

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Pinterest middle click open image in new tab
// @namespace    FuckPinterest
// @version      0.6
// @description  Fixes pinterest middle click open image in new tab
// @author       jesusmg
// @include    	 http://*.pinterest.com/*
// @include      https://*.pinterest.com/*
// @include   	 https://*.pinterest.*/*
// @grant        none
// @run-at       document-end
// ==/UserScript==

// dollar sign alias the querySelectorAll function
var $ = function (inpt) {
    return document.querySelectorAll(inpt);
};

(function() {
    'use strict';
    document.addEventListener("click", function(e){ e.button===1 && e.stopPropagation(); }, true);

    window.addEventListener("mousemove", function (e) {
        var element = e.target;

        while (element !== null && element.tagName !== undefined && element.tagName.toString().toLowerCase() !== "a") {
            element = element.parentNode;
        }

        if (element !== null && element.tagName !== undefined && element.tagName.toString().toLowerCase() === "a") {
            element.style.cursor = "pointer";
        }
    });
})();