In this article, we delve into the world of
User:Davipo/wikipast.js to explore its many facets and discover the importance it has in our society. From
User:Davipo/wikipast.js as a relevant figure in history, to its relevance today, through its impact on different aspects of daily life. We will analyze how
User:Davipo/wikipast.js has influenced and continues to influence our lives, revealing data and curiosities that you may not have known. Get ready to immerse yourself in an exciting journey through
User:Davipo/wikipast.js and discover everything that this figure, theme, date, etc. has to offer us.
// wikipast.js
// User:Davipo
// 2009-03-16, revised 2009-09-25
/* WikiPast: Browse Wikipedia as it appeared on a given date in the past.
Works with TimeTraveller.
*/
var pastdate = "1999-01-01";
function seeback() {
var entry = prompt("Enter date:", pastdate);
if (entry != null) {
pastdate = entry;
query_rev(wgArticleId, pastdate);
}
}
function query_rev(pageid, date) {
var qbase = "/w/api.php?action=query";
var query = qbase + "&prop=revisions&rvlimit=1&rvprop=timestamp|ids&rvdir=older&format=json";
query = query + "&pageids=" + pageid + "&rvstart=" + date + "T00:00:00Z";
api.open('GET', wgServer + query, true);
api.onreadystatechange = show_revision;
api.send(null);
}
function show_revision() {
if (api.readyState == 4) {
if (api.status == 200) {
var response = eval('(' + api.responseText + ')');
var pageinfo = response;
if (pageinfo) {
var revinfo = pageinfo;
var revid = revinfo;
var timestamp = revinfo;
var target_time = pastdate + 'T00:00:00Z';
window.location = wgServer + '/w/index.php?oldid=' + revid + '&timetravel=' + target_time;
}
}
}
}
function wpast_setup() {
var tooltip = "Browse Wikipedia as it appeared on a past date";
mw.util.addPortletLink("p-tb", "javascript:seeback()", "Browse in past", "t-past", tooltip, "`");
}
if(typeof sajax_init_object !== 'undefined') {
var api = sajax_init_object();
addOnloadHook(wpast_setup);
}