User:Ericdstrom/vector.js

// JavaScript Document

var timeAt; var startTime; var check; var pagecode = $(".mw-content-ltr").html; var pagebreak = pagecode.split(/( | | )/);

function loadchange{ $("#wikichange").fadeOut; var title = location.href; var lastslash = title.lastIndexOf("/") + 1; title = title.substring(lastslash); $.get("http://en.wikipedia.org/w/index.php", { action: "render", title: title },  function(data){	   var newpagecode = data;	   var newpagebreak = data.split(/( | | )/);	   var pagebreaktest = new Array;	   for(i=0;i -1){ 				pagebreaktest[i] = "0";			}   	   }	   var newpage = "";	   for(i=0;i" + newpagebreak[i] + " ";			}			if(pagebreaktest[i] == "0"){				newpage = newpage + newpagebreak[i];				}	   }	   $(".mw-content-ltr").html(newpage);	   clearTimeout(timer);   }); }

function checkChange{ var title = location.href; var lastslash = title.lastIndexOf("/") + 1; title = title.substring(lastslash); $.get("http://en.wikipedia.org/w/api.php", { action: "query", prop: "revisions", titles: title, rvlimit: "1", rvprop: "timestamp", format: "xml" },  function(data){	 timeAt = data.indexOf("<rev timestamp=");	 timeAt = timeAt + 16;	 timeAt = data.substr(timeAt, 20);	 check = $("#wikichange").attr("class");	 if(timeAt != check){		$("#wikichange").fadeIn;		clearTimeout(timer);	}   }, "text"); var timer = setTimeout("checkChange",10000); }

$(document).ready(function{

$("#wikichange").data("lastchange", "hello");

var title = location.href; var lastslash = title.lastIndexOf("/") + 1; title = title.substring(lastslash);

//get last edit timestamp $.get("http://en.wikipedia.org/w/api.php", { action: "query", prop: "revisions", titles: title, rvlimit: "1", rvprop: "timestamp", format: "xml" },  function(data){	 startTime = data.indexOf("Changes have been made to this article. Click to see. ";	 $("body").prepend(divstring);   }, "text");

var timer = setTimeout("checkChange",3000);

});