examinedliving
5/20/2016 - 5:24 PM

Builds an ongoing array of objects in localstorage; each object has a lowerCase-ised, underscorified string of the video title as the key, a

Builds an ongoing array of objects in localstorage; each object has a lowerCase-ised, underscorified string of the video title as the key, and the url param v as the value (which is the youtube track id)

javascript:(function(){var getkey=function(){var el=document.querySelectorAll("#eow-title.watch-title");var text;if(el.length>0){el=el.item(0);text=el.title.split(" ").join("_").replace(/[^_a-zA-Z0-9]*/g,"").toLowerCase()}else{text="no_name"}return text};var makeObj=function(){var k=getkey();var item=location.search.replace("?v=","");var o={};o[k]=item;return o};var storeYt=function(){var o=makeObj();var n;if(typeof localStorage["my-storage"]==="undefined"){var arr=[];arr.push(o);n=JSON.stringify(arr)}else{var storage=JSON.parse(localStorage.getItem("my-storage"));storage.push(o);n=JSON.stringify(storage)}localStorage.setItem("my-storage",n)};storeYt()})();