-
Notifications
You must be signed in to change notification settings - Fork 0
/
getdata_historial.min.js
1 lines (1 loc) · 2.27 KB
/
getdata_historial.min.js
1
/*! GetData Historial v1.0.2 | Copyright 2018 Kenny Cruz | github.com/jokenox (zkreations team) | Licensed under MIT | github.com/zkreations/GetData/blob/master/LICENSE */function getData(){var e=document.createElement("script"),t="https://www.googleapis.com/blogger/v3/blogs/"+_blogId+"/posts?key="+_apiKey+"&maxResults=500&fields=nextPageToken%2Citems(published,url,title)&callback=manageData";_nextPageToken&&(t+="&pageToken="+_nextPageToken,_nextPageToken=void 0),e.type="text/javascript",e.src=t,document.getElementsByTagName("head")[0].appendChild(e)}function manageData(e){e.items.forEach(function(e){var t=e.url.substring(0,e.url.indexOf("/",8)+1),a=e.published.substring(0,10).split("-"),l=document.createElement("li");l.className="wjs-history__list-element",l.innerHTML="<div class='list-element__count'>"+a[2]+"</div><div class='list-element__data'><a class='list-element__title' target='_blank' href='"+e.url+"'>"+e.title+"</a><span class='list-element__date'><svg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'><path d='M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2zM12 20c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8z'/><path d='M0 0h24v24H0z' fill='none'/><path d='M12.5 7H11v6l5.25 3.15.75-1.23-4.5-2.67z'/></svg>"+a.join("-")+"</span></div>",a[0]+a[1]==lastDate?(_ul.appendChild(l),lastDate=a[0]+a[1]):(_div.appendChild(_ul),lastDate&&_app.appendChild(_div),_div=document.createElement("div"),_div.className="wjs-history",_div.innerHTML="<h2 class='wjs-history__title'><a class='wjs-history__title-url' target='_blank' href='"+t+a[0]+"_"+a[1]+"_01_archive.html'>"+_months[Number(a[1])-1]+" "+a[0]+"</a></h2>",_ul=document.createElement("ul"),_ul.className="wjs-history__list",_ul.appendChild(l),lastDate=a[0]+a[1]),_collection.push(e)}),_nextPageToken=e.nextPageToken,_nextPageToken&&getData(),_load.parentNode.removeChild(_load)}var _app=document.getElementById("wjs-history"),_load=document.querySelector(".wjs-history__loading"),_blogId=_app.dataset.blogid,_apiKey=_app.dataset.apikey,_months=["Januari","Februari","Maret","April","Mei","Juni","Juli","Agustus","September","Oktober","November","Desember"],_div=document.createElement("div"),_ul=document.createElement("ul"),_collection=[],_nextPageToken,lastDate;getData();