您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Trims the capture graph timeline to only the earliest and latest years
当前为
// ==UserScript== // @name Wayback Machine Timeline Compressor // @namespace DoomTay // @description Trims the capture graph timeline to only the earliest and latest years // @version 0.9.0 // @include /http(?:s?):\/\/web\.archive\.org\/web\// // @grant none // ==/UserScript== var smallTimeline = document.querySelector("#sparklineImgId[width = \"525\"]"); var bigTimeline = document.querySelector("#sparklineImgId[width = \"1029\"]"); if(smallTimeline) { smallTimeline.src = smallTimeline.src.replace(/(http:\/\/web\.archive\.org\/web\/jsp\/graph\.jsp\?graphdata=525_27)(?:_\d\d\d\d:-1:000000000000)+|(?:_\d\d\d\d:-1:000000000000)+$/g, "$1"); var startYear = parseInt(smallTimeline.src.substr(smallTimeline.src.search(/\d\d\d\d:/),4)); var lastYear = parseInt(smallTimeline.src.substr(smallTimeline.src.search(/\d\d\d\d(?!.*\d\d\d\d:)/),4)); var yearRange = (lastYear - startYear) + 1; var scripts = document.scripts; for(var s = 0; s < scripts.length; s++) { if(scripts[s].innerHTML.indexOf("525, 27") > -1) { var newScript = document.createElement('script'); newScript.type = "text/javascript"; newScript.innerHTML = scripts[s].innerHTML.replace("(525, 27, 25, 2)","(525, 27, " + (525 / yearRange) + ", " + (525 - yearRange)/(12 * yearRange) + ")").replace(/firstYear = \d\d\d\d/,"firstYear = " + startYear); document.body.appendChild(newScript); __wm.bt(); break; } } } else if(bigTimeline) { bigTimeline.src = bigTimeline.src.replace(/(http:\/\/web\.archive\.org\/web\/jsp\/graph.jsp\?nomonth=1&graphdata=1029_75)(?:_\d\d\d\d:-1:000000000000)+|(?:_\d\d\d\d:-1:000000000000)+$/g, "$1"); var lastYear = parseInt(bigTimeline.src.substr(bigTimeline.src.search(/\d\d\d\d(?!.*\d\d\d\d:)/),4)); window.firstYear = parseInt(bigTimeline.src.substr(bigTimeline.src.search(/\d\d\d\d:/),4)); window.startYear = parseInt(window.location.href.substr(window.location.href.indexOf("http://web.archive.org/web/") + 27,4)) - firstYear; var yearRange = (lastYear - firstYear) + 1; window.yearImgWidth = (1029 / yearRange); window.monthImgWidth = (1029 - yearRange)/(12 * yearRange); document.getElementById("wbMouseTrackYearImg").style.width = (Math.round(10*yearImgWidth)/10) + "px"; var yearLabels = document.getElementsByClassName("year-label"); for(var y = 0; y < yearLabels.length; y++) { while(y < yearLabels.length && (yearLabels[y].dataset.year > lastYear || yearLabels[y].dataset.year < firstYear)) yearLabels[y].parentNode.removeChild(yearLabels[y]); if(y >= yearLabels.length) continue; yearLabels[y].style.width = Math.floor(1029 /yearRange) + "px"; } }