function makeView(tps,out,twds,wds,curc,cit) { var list = tps.list, cts=tps.categories; if(cit==-1) { for(var i=0; i< Back"); var tpl = list[cit]; makeItem(tps,cit,cts,out, true); out.push(""); /* out.push(""); */ /* out.push("
"); out.push("
"); */ } } function shorten(str, lim) { return (str.length300) num++; var cc = Math.floor(rst/num); //console.log(cc); var isz = cc-26; //console.log(isz); var tit = escapeHtml(tpl[7]); var lim = ~~(isz/9); //console.log(tpl); if(big) lst.push("
"); else lst.push("
"); var iurl = tpl[3]; //(Math.random()<0.5?"wide.png":"tall.png"); // tpl[3] var aurl = "//www.Photopea.com#t"+tempID(tpl); //* if(big) isz=rst/2; var wi = (isz+"px"); var hi = ((isz*0.67)+"px"); lst.push("
"); // ict lst.push(""); lst.push("
"); // ict lst.push("
"); // cmt lst.push("" + (big?tit:shorten(tit,lim)) + ""); var au = tps.authors[tpl[0]]; lst.push(""+"By "+(big?au:shorten(au,~~(lim*0.7))) + " in " + cts["c"+tpl[4]]+""); if(big) { lst.push("

"+findLinks(escapeHtml(tpl[8]))+"

"); lst.push("

"); var dstr = printDate(tpl[1]); //lst.push("Open"); //lst.push("  Open Separately"); lst.push(printNum(tpl[5])+" views • "+printNum(tpl[6])+" uses • "+dstr);// lst.push("
"); //lst.push("
"); lst.push(tpl[6]+" uses"); lst.push("

"); lst.push("

"); lst.push("photopea.com#t"+tempID(tpl)+""); lst.push("
"); lst.push("

"); } else { //var p = makeNode("span"); p.textContent = tpl[5]+"/"+tpl[6]; //ict.appendChild(p); //p.setAttribute("style","display:inline-block; right:4px; bottom:8px; padding:0px 4px; position:absolute; background:white;"); } lst.push("
"); // cmt lst.push("
"); } function printDate(d) { var dt = new Date(d*1000); var mon = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sept","Oct","Nov","Dec"][dt.getMonth()]; return mon+" "+(dt.getDate())+", "+dt.getFullYear(); } function printNum(f) { return f.toLocaleString('en-US', {maximumFractionDigits:2}); } function tempID(tpl) { return tpl[2].split("").reverse().join(""); } function isWhite(c) { return c==" " || c=="\n" || c=="\t"; } function findLinks(str) { //return str; var iod = -1; for(var i=0; i0 && !isWhite(str[i0])) i0--; while(i1"+mid+""+str.slice(i1+1); } return str//.replaceAll("\n","
"); } function escapeHtml(unsafe) { return unsafe .replace(/&/g, "&") .replace(//g, ">") .replace(/"/g, """) .replace(/'/g, "'"); } function getCatCounts(tps) { var list = tps.list, cts=tps.categories; var ccnt = JSON.parse(JSON.stringify(cts)); for(var cat in ccnt) ccnt[cat]=0; for(var i=0; iCATEGORIES"); for(var cat in cts) { if(ccnt[cat]==0) continue; var cw = parseInt(cat.slice(1)), isTop = (cw%10)==0; //console.log(cw); out.push("
"); out.push(cts[cat]); out.push(""+ccnt[cat]+""); out.push("
"); } } function cost0(v) { var age = (Date.now()*0.001 - v[1]) / (60*60*24); // age in days var cst = v[6] / age; // usages per day var ext = 20*Math.pow(Math.PI,-age*0.5); //console.log(age,cst,ext) return cst+ext; /* var ts = Math.max(0, v[1]-1134028003); var x = v[6]; var y = 1; var z = Math.max(1,Math.abs(x)); return getBaseLog(10, z) + (y*ts/45000); // 45000 */ } function cost1(v) { return v[1]; } function cost2(v) { return v[6]; } //function getBaseLog(x, y) { return Math.log(y) / Math.log(x); }