mirror of
https://gitflic.ru/project/photopea-v2/photopea-v-2.git
synced 2026-05-19 16:20:37 +00:00
Starting to work on this again, started by updating any new files
This commit is contained in:
@@ -1,126 +1,33 @@
|
||||
|
||||
function makeView(tps,out,twds,wds,curc,cit) {
|
||||
var list = tps.list, cts=tps.categories;
|
||||
if(cit==-1) {
|
||||
for(var i=0; i<list.length; i++) {
|
||||
var tpl = list[i], cat=tpl[4], pcat=cat-(cat%10);
|
||||
if(curc!=-1) {
|
||||
if((curc%10)==0) { if(pcat!=curc) continue; }
|
||||
else if(curc!=cat) continue;
|
||||
}
|
||||
if(twds!="") {
|
||||
var occ=0, tot=(tpl[7] + " " + tpl[8] + " " + tps.authors[tpl[0]] + " " + cts["c"+tpl[4]]).toLowerCase();
|
||||
for(var j=0; j<wds.length; j++) {
|
||||
if(tot.indexOf(wds[j])!=-1) occ++;
|
||||
}
|
||||
if(occ==0) continue;
|
||||
}
|
||||
makeItem(tps,i, cts,out, false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
out.push("<div id=\"back\"><span class=\"back\" onclick=\"backClicked()\">< Back</span></div>");
|
||||
var tpl = list[cit];
|
||||
makeItem(tps,cit,cts,out, true);
|
||||
}
|
||||
}
|
||||
|
||||
function toID(str) { return str.toLowerCase().replace(/\s+/g, "-")+".html"; }
|
||||
function makeItem(tps, ind,cts,lst, big) {
|
||||
var tpl = tps.list[ind];
|
||||
var rst = window.innerWidth-(245+30); //console.log(iw);
|
||||
var num = 1; while(rst/num>300) num++;
|
||||
var cc = Math.floor(rst/num); //console.log(cc);
|
||||
var isz = cc-26; //console.log(isz);
|
||||
|
||||
var tit = tpl[7];
|
||||
var lim = ~~(isz/9); //console.log(tpl);
|
||||
|
||||
lst.push("<div class=\"item"+(big?" flexrow":"")+"\" "+ ((!big) ? "onclick=\"itemClicked("+ind+")\"" : "")+">");
|
||||
|
||||
var iurl = tpl[3]//(Math.random()<0.5?"wide.png":"tall.png");
|
||||
//*
|
||||
if(big) isz=rst/2;
|
||||
var wi = (isz+"px");
|
||||
var hi = ((isz*0.67)+"px");
|
||||
lst.push("<div style=\"min-width:"+wi+"; height:"+hi+"; background-image: url('"+iurl+"'); background-size:contain; background-repeat: no-repeat; background-position: center;\">"); // ict */
|
||||
|
||||
//var wi = big?"50%":(isz+"px");
|
||||
//lst.push("<div style=\"min-width:"+wi+"; max-width:"+wi+";\">"); // ict
|
||||
var aurl = "https://www.Photopea.com#t"+tpl[2].split("").reverse().join("");
|
||||
//lst.push("<img src=\""+iurl+"\" "+((big&&!stc) ? "onclick=\"itemClicked("+ind+")\"" : "")+" />");
|
||||
lst.push("</div>"); // ict
|
||||
lst.push("<div class=\""+"post"+(big?"_big":"")+"\">"); // cmt
|
||||
|
||||
lst.push("<span class=\"title "+(big?"t1":"t2")+"\">" + escapeHtml((tit.length<lim || big) ?tit:tit.slice(0,lim-3)+"...") + "</span>");
|
||||
|
||||
lst.push("<span>"+"By "+tps.authors[tpl[0]] + " in " + cts["c"+tpl[4]]+"</span>");
|
||||
|
||||
if(big) {
|
||||
lst.push("<p>"+escapeHtml(tpl[8])+"</p>");
|
||||
lst.push("<p>");
|
||||
lst.push("<b class=\"clickable\" onclick=\"itemClicked("+ind+")\">Open</b>");
|
||||
lst.push(" <a href=\""+aurl+"\" target=\"_blank\" class=\"clickable\" ><b>Open Separately</b></a>");
|
||||
lst.push("</p>");
|
||||
lst.push("<b>"+"👁 "+tpl[5]+"× ⭳ "+tpl[6]+"×"+"</b>");
|
||||
}
|
||||
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("</div>"); // cmt
|
||||
lst.push("</div>");
|
||||
}
|
||||
|
||||
function escapeHtml(unsafe) {
|
||||
return unsafe
|
||||
.replace(/&/g, "&")
|
||||
.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; i<list.length; i++) {
|
||||
var tpl = list[i], cat=tpl[4], pcat=cat-(cat%10);
|
||||
ccnt["c"+cat]++; if(cat!=pcat) ccnt["c"+pcat]++;
|
||||
}
|
||||
return ccnt;
|
||||
}
|
||||
|
||||
function getCats(tps, curr,out) {
|
||||
var cts=tps.categories, ccnt = getCatCounts(tps);
|
||||
out.push("<span class=\"cat_title\">CATEGORIES</span>");
|
||||
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("<div class=\"cat"+(isTop?" top":"") + (cw==curr?" blue":"")+" clickable\" onclick=\"catClicked("+cw+")\">");
|
||||
out.push(cts[cat]);
|
||||
out.push("<span class=\"count\">"+ccnt[cat]+"</span>");
|
||||
out.push("</div>");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function cost(v) {
|
||||
var age = (Date.now()*0.001 - v[1]) / (60*60*24);
|
||||
var cst = v[6] / age;
|
||||
var ext = 20*Math.pow(2,-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 getBaseLog(x, y) { return Math.log(y) / Math.log(x); }
|
||||
|
||||
|
||||
<HTML>
|
||||
<HEAD>
|
||||
<TITLE>404 Not Found</TITLE>
|
||||
<BASE href="/error_docs/"><!--[if lte IE 6]></BASE><![endif]-->
|
||||
</HEAD>
|
||||
<BODY>
|
||||
<H1>Not Found</H1>
|
||||
The requested document was not found on this server.
|
||||
<P>
|
||||
<HR>
|
||||
<ADDRESS>
|
||||
Web Server at photopea.com
|
||||
</ADDRESS>
|
||||
</BODY>
|
||||
</HTML>
|
||||
|
||||
<!--
|
||||
- Unfortunately, Microsoft has added a clever new
|
||||
- "feature" to Internet Explorer. If the text of
|
||||
- an error's message is "too small", specifically
|
||||
- less than 512 bytes, Internet Explorer returns
|
||||
- its own error message. You can turn that off,
|
||||
- but it's pretty tricky to find switch called
|
||||
- "smart error messages". That means, of course,
|
||||
- that short error messages are censored by default.
|
||||
- IIS always returns error messages that are long
|
||||
- enough to make Internet Explorer happy. The
|
||||
- workaround is pretty simple: pad the error
|
||||
- message with a big comment like this to push it
|
||||
- over the five hundred and twelve bytes minimum.
|
||||
- Of course, that's exactly what you're reading
|
||||
- right now.
|
||||
-->
|
||||
|
||||
Reference in New Issue
Block a user