您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
Removes the cruft from the new zerohedge
当前为
// ==UserScript== // @name ZeroCruft // @version 1.2 // @namespace 1bae28cfed0eddb302b3ac9b578412a3 // @author Dan Garthwaite <[email protected]> // @description Removes the cruft from the new zerohedge // @include http://*zerohedge.com/* // @run-at document-end // ==/UserScript== (function() { 'use strict'; document.getElementById('header-container').remove(); document.getElementById('sidebar-left').remove(); document.getElementById('sidebar-right').remove(); var page = document.getElementById('page'); page.style.maxWidth = "80em"; page.style.marginLeft = page.style.marginRight = "auto"; var slider = document.getElementsByClassName("slick-slider"); if (slider.length > 0) { slider[0].remove(); } /* Do jk navigation */ $('head').append('<style>.jk-current {outline: 1px solid navy;}</style>'); var jk = function(a, inc) { if (!a.length) { return; } for (var i = 0; i <= a.length; i++) { if (a[i].classList.contains('jk-current')) { var next = (i + inc) % a.length; next = (next > 0) ? next : 0; console.warn("next = " + next); a[i].classList.toggle('jk-current'); a[next].classList.toggle('jk-current'); break; } } }; var arts = document.getElementsByTagName("article"); if (arts.length > 3) { arts[2].classList.add('jk-current'); jk(arts, 1); } $(document.body).keypress(function (event) { // ignore keypresses in input fields if (document.activeElement.tagName == 'INPUT') { return; } if (arts.length === 0) { return; } var key = String.fromCharCode(event.which).toUpperCase(); if (key === 'J' || key === ' ') { // J or space for next jk(arts, 1); } else if (key == 'K') { // K for back jk(arts, -1); } else if (key == 'O' || event.which == 13) { var toClick = $(".jk-current").find('a')[0]; console.log("toClick = " + toClick); toClick.click(); } else { return; } //scroll .jk-current to top of window $('html, body').animate({ scrollTop: $(".jk-current").offset().top - 100 }, 200); }); })();