您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Redirect directly to target page avoiding Yandex Turbo
当前为
// ==UserScript== // @name Remove Yandex Turbo // @description Redirect directly to target page avoiding Yandex Turbo // @author Autapomorph // @version 1.0.0 // @run-at document_start // @include https://yandex.ru/* // @license MIT // @namespace https://greasyfork.org/users/689919 // ==/UserScript== function getUrlVar() { var urlVar = window.location.search; var arrayVar = []; var valueAndKey = []; var resultArray = []; arrayVar = (urlVar.substr(1)).split('&'); if (arrayVar[0] == "") return false; for (i = 0; i < arrayVar.length; i++) { valueAndKey = arrayVar[i].split('='); resultArray[valueAndKey[0]] = valueAndKey[1]; } return resultArray; } var urlLandingPage = getUrlVar(); var urlPathname = window.location.pathname; if (urlPathname == '/turbo') { top.location.replace(decodeURIComponent(urlLandingPage['text'])); } else if (/turbo\/.*\/s\//.test(window.location.pathname)) { var turboStr = '/turbo/'; var sStr = '/s/'; var turboIndex = top.location.pathname.indexOf(turboStr); var sIndex = top.location.pathname.indexOf(sStr); var host = window.location.pathname.substring(turboIndex + turboStr.length, sIndex); var pathName = window.location.pathname.substring(sIndex + sStr.length); top.location.replace('https://' + host + '/' + pathName); } else if (urlPathname.indexOf('/turbo/s/') != -1) { top.location.replace('https://' + urlPathname.substr(urlPathname.indexOf('/turbo/s/') + 9)); } else if (urlPathname == '/search/touch/') { $('a[data-sc-host]').each(function() { var urlYaTurbo = $(this).attr('href'); var dataCounter = JSON.parse($(this).attr('data-counter')); if ((urlYaTurbo.indexOf('https://yandex.ru/turbo/s/') != -1) || (urlYaTurbo.indexOf('https://yandex.ru/turbo?text=') != -1)) { $(this).attr('data-bem', '{"link":{}}'); if (dataCounter[0] == 'b') { $(this).attr('href', dataCounter[1]); } else if (dataCounter[0] == 'w') { $(this).attr('href', dataCounter[3]); } } }); } else if (urlPathname == '/search/') { $('a.link').each(function() { var dataCounter = JSON.parse($(this).attr('data-counter')); if (dataCounter[0] == 'b') { $(this).attr('href', dataCounter[1]); } else if (dataCounter[0] == 'w') { if (typeof(dataCounter[3]) != 'undefined') { $(this).hide(); } } }); } else if (urlPathname.substr(0, 12) == '/news/story/') { var YTsubtitle = document.querySelector('div.news-story__head > a.news-story__subtitle'); if ((YTsubtitle.href.substr(0, 26) == 'https://yandex.ru/turbo/s/') || (YTsubtitle.href.substr(0, 26) == 'https://yandex.ru/turbo/h/')) { YTsubtitle.href = 'https://' + YTsubtitle.href.substring(26, YTsubtitle.href.length).split('?')[0]; } else { YTsubtitle.href = YTsubtitle.href.split('?')[0]; } var YT = document.querySelectorAll('a.news-snippet__url'); for (var i = 0; i < YT.length; i++) { if ((YT[i].href.substr(0, 26) == 'https://yandex.ru/turbo/s/') || (YT[i].href.substr(0, 26) == 'https://yandex.ru/turbo/h/')) { YT[i].href = 'https://' + YT[i].href.substring(26, YT[i].href.length).split('?')[0]; } else { YT[i].href = YT[i].href.split('?')[0]; } } var YTicon = document.querySelectorAll('svg.news-snippet__turbo-icon'); for (var i = 0; i < YTicon.length; i++) { YTicon[i].style.display = "none"; } };