您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Force to open Yandex search result linx in same tab. Default behaviour is to open in the new tab.
当前为
// ==UserScript== // @name Open in current tab in Yandex (don't open in new tab) // @name:ru Открывать ссылки в текущей вклакде для Яндекс (не открывать в новых вкладках) // @namespace FIX // @version 0.1 // @description Force to open Yandex search result linx in same tab. Default behaviour is to open in the new tab. // @description:ru Заставляет открывать ссылки в поиске Янедкса в текущей вкладке при нажатии на них. По умолчанию Яндекс открывает их в новой вкладке. // @author toverna // @include *://yandex.*/* // @include *://*.yandex.*/* // @grant unsafeWindow // ==/UserScript== (function() { 'use strict'; var win = unsafeWindow || window; if (win.top !== win.self) return; console.time('Remove Yandex load'); function removeAttrs (scope) { var links = scope.querySelectorAll('a[target="_blank"]'); var i; for (i = links.length - 1; i >= 0; --i) { links[i].removeAttribute('target'); } } removeAttrs (document.body); var obs = new MutationObserver(function(ms){ ms.forEach(function(m){ m.addedNodes.forEach(function(n){ if (n.nodeType !== Node.ELEMENT_NODE) { return; } removeAttrs(n); }); }); }); obs.observe(document.body, {childList: true, subtree: true}); console.timeEnd('Remove Yandex load'); })();