User:Aravindp1510/common.js

function drawTree { //FromWIKI $.getScript("http://cachedcommons.org/cache/protovis/3.2.0/javascripts/protovis-min.js"); var text = $(' '); text.attr('id','readerContent'); var close=$(" &times; "); var wrapper=$(" ").append(text); $("body").append($(" ").append(close)); $("body").append(wrapper); $("#closeButton").click(function{		$("#readerWrapper,#opacity").remove;	}); $(window).keyup(function(e){		if(e.which==27){			$("#readerWrapper,#opacity").remove;		}	}); for(key in localStorage) { console.log(key); if ($("#htree-" + key)) localStorage.getItem(key).every(function (item) {	}); }}

$(document).ready(function {	var d = $("HistoryTree");	d.click(drawTree);	$("#p-personal ul").prepend($('').append(d));	$("#content").find("a[href^='/wiki/']").each(function(i, anchor) { $(this).click(function{			recordClick(window.location.pathname, $(anchor).attr('href'));		}); });	function recordClick(fromPage, toPage){	fromPage = fromPage.split("#")[0].split("?")[0];	toPage = toPage.split("#")[0].split("?")[0];	if (localStorage.getItem(fromPage) != null) {		tos = JSON.parse(localStorage.getItem(fromPage));		if (tos.indexOf(toPage) == -1) {			tos.push(toPage);			localStorage.setItem(fromPage, JSON.stringify(tos));			}	}	else {		localStorage.setItem(fromPage, JSON.stringify([toPage]));	} // Retrieve the object from storage	var retrievedObject = localStorage.getItem(fromPage);	console.log('retrievedObject: ', JSON.parse(retrievedObject)); } });