mirror of
https://gitflic.ru/project/photopea-v2/photopea-v-2.git
synced 2026-10-28 15:00:04 +00:00
Add some files that I missed. Credit to @minimeee
This commit is contained in:
1 parent
acda078189
commit
e1d427c0f6
79 files changed
+17291
-17106
No files matched your search
@@ -0,0 +1,142 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, initial-scale=1.0" />
|
||||
|
||||
<style>
|
||||
body { background-color:#474747; overflow:hidden; }
|
||||
label { color:white; font-family:sans-serif; font-size:0.8em; }
|
||||
img { margin-right:4px; cursor:pointer; }
|
||||
button { padding:0 4px; }
|
||||
#cont {
|
||||
margin-top:4px;
|
||||
overflow-y: scroll;
|
||||
/* for Firefox: */
|
||||
scrollbar-color: #222222 rgba(0,0,0, 0.2 );
|
||||
scrollbar-width: thin;
|
||||
}
|
||||
#cont::-webkit-scrollbar {
|
||||
width: 10px;
|
||||
background: rgba(0,0,0,0.2);
|
||||
}
|
||||
#cont::-webkit-scrollbar-thumb {
|
||||
background: #222222;
|
||||
margin:2px;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
var imgs = [], hits = [], done=0;
|
||||
|
||||
var UNS = location.href.indexOf("uns")!=-1, PAGE=1, sTop=-1, cont, keyws;
|
||||
|
||||
function update(page) {
|
||||
cont = document.getElementById("cont");
|
||||
keyws = document.getElementById("keyws");
|
||||
if(page==null) { PAGE=1; hits=[]; sTop=-1; }
|
||||
else { PAGE = page; sTop=cont.scrollTop; }
|
||||
|
||||
var ikey = keyws.value;
|
||||
if(document.getElementById("isolated").checked) ikey += " isolated";
|
||||
ikey = ikey.trim();
|
||||
console.log(JSON.stringify(ikey));
|
||||
|
||||
var url;
|
||||
if(!UNS) {
|
||||
url = "https://pixabay.com/api/?image_type=photo"+(ikey==""?"":"&q="+encodeURIComponent(ikey))+"&per_page="+100+"&page="+PAGE+"&key=10554583-a5eacb61c2e61105fdfb6eb88&safesearch=true";
|
||||
}
|
||||
else {
|
||||
//var keys = ["lake", "mountains", "tree"]; if(ikey=="") ikey=keys[Math.floor(Math.random()*keys.length)];
|
||||
url = "https://api.unsplash.com/search/photos?per_page="+30+"&query="+encodeURIComponent(ikey)+"&page="+PAGE;
|
||||
}
|
||||
var fnam = "gallery"+(UNS?"1":"");
|
||||
if(ikey=="") {
|
||||
if(!UNS && Math.random()<0.005) url="gallery.php?url="+encodeURIComponent(url)+"&fnam="+fnam;//+"&r="+Math.random();
|
||||
else url=fnam+".json";
|
||||
}
|
||||
console.log(url);
|
||||
|
||||
|
||||
var req = new XMLHttpRequest();
|
||||
req.open("GET", url, true);
|
||||
if(UNS) req.setRequestHeader("Authorization", "Client-ID 3twt3nS_LYzp4nViMBB3tmWU0F-wyHUpgfrG1nIuiYs");
|
||||
req.onload = imgsLoaded.bind(this);
|
||||
req.onerror = function(e) { console.log(e.target.response); }
|
||||
req.send();
|
||||
}
|
||||
function imgsLoaded(e) {
|
||||
//console.log(e.target.response);
|
||||
var obj = JSON.parse(e.target.response); //console.log(obj);
|
||||
var list = obj["hits"]?obj["hits"]:obj["results"];
|
||||
|
||||
hits = hits.concat(list);
|
||||
|
||||
var iw = window.innerWidth-29, th=100;
|
||||
cont.setAttribute("style","height:"+(window.innerHeight-42)+"px;");
|
||||
while(cont.firstChild) cont.removeChild(cont.firstChild);
|
||||
cont.scrollTop = 0;
|
||||
|
||||
//for(var i=0; i<hits.length; i++) if(hits[i]["user_id"]==6314823) hits.splice(i,1);
|
||||
var heis = [];
|
||||
for(var i=0; i<hits.length; ) {
|
||||
var totw = 0, j=i;
|
||||
while(j<hits.length) {
|
||||
var hit = hits[j], w=hit["previewWidth"], h=hit["previewHeight"];
|
||||
if(w==null) { w=hit["width"]; h=hit["height"]; }
|
||||
|
||||
var nw=w*(th/h);
|
||||
if(j<=i+1 || totw+nw < iw) { totw+=nw; j++; }
|
||||
else break;
|
||||
}
|
||||
var num = j-i;
|
||||
while(i<j) {
|
||||
heis.push(Math.min(th*2,th*((iw-num*4)/totw))); i++;
|
||||
}
|
||||
}
|
||||
|
||||
imgs=[];
|
||||
|
||||
for(var i=0; i<hits.length; i++) {
|
||||
var hit = hits[i];
|
||||
var img = document.createElement("img");
|
||||
img.setAttribute("src",hit["previewURL"]?hit["previewURL"]:hit["urls"]["thumb"]);
|
||||
img.setAttribute("height",heis[i]+"px");
|
||||
img.addEventListener("click", imgClick);
|
||||
cont.appendChild(img);
|
||||
imgs.push(img);
|
||||
}
|
||||
if(sTop!=-1) cont.scrollTop=sTop;
|
||||
|
||||
cont.appendChild(document.createElement("br"));
|
||||
var more = document.createElement("button");
|
||||
more.onclick = function(e) { update(PAGE+1); }
|
||||
more.textContent="Load More";
|
||||
if(keyws.value!="") cont.appendChild(more);
|
||||
|
||||
console.log(hits);
|
||||
}
|
||||
function imgClick(e) {
|
||||
var ind = imgs.indexOf(e.currentTarget);
|
||||
var hit = hits[ind]; console.log(hit);
|
||||
var url = hit["largeImageURL"]; if(url==null) url = hit["urls"]["full"];
|
||||
var x = "app.open(\""+url+"\",null,true);";
|
||||
window.parent.postMessage(x, "*");
|
||||
}
|
||||
function msg(e) { alert("These images come from www."+(UNS?"Unsplash":"PixaBay")+".com and are free to use for any purpose."); }
|
||||
|
||||
window.onresize = update;
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body onload="update()">
|
||||
<div style="height:22px; overflow:hidden;">
|
||||
<button onclick="msg()">?</button>
|
||||
<label>Keywords:</label> <input type="text" id="keyws" onchange="update()" value=""></input>
|
||||
<input type="checkbox" id="isolated" style="vertical-align:middle;" onchange="update()" /> <label for="isolated">Isolated</label>
|
||||
</div>
|
||||
|
||||
<div id="cont"></div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1 @@
|
||||
{"total":1403241,"totalHits":500,"hits":[{"id":8128264,"pageURL":"https://pixabay.com/photos/vulture-king-vulture-bird-avian-8128264/","type":"photo","tags":"vulture, king vulture, bird","previewURL":"https://cdn.pixabay.com/photo/2023/07/15/07/15/vulture-8128264_150.png","previewWidth":105,"previewHeight":150,"webformatURL":"https://pixabay.com/get/g9631caa2e874df3303c7f7980deead00ba9eb8e9f4d945c24fd6526477ef2797dc4245360093e7853a13726ce87176832b0085530dc684dc572e57906e03508e_640.png","webformatWidth":448,"webformatHeight":640,"largeImageURL":"https://pixabay.com/get/gd58698a31af022679330160d184092f4bab2672753a97b09a30986cc2ce5d6a554267f3f3ee37690e1eabe31347e6b36af106d3573313fc69ff414c6d3125b5e_1280.png","imageWidth":4208,"imageHeight":6016,"imageSize":35052662,"views":32311,"downloads":27463,"collections":24,"likes":119,"comments":40,"user_id":4464111,"user":"ambquinn","userImageURL":"https://cdn.pixabay.com/user/2023/06/27/11-02-33-758_250x250.jpeg"},{"id":8137008,"pageURL":"https://pixabay.com/photos/bird-secretary-bird-bird-of-prey-8137008/","type":"photo","tags":"bird, secretary bird, bird of prey","previewURL":"https://cdn.pixabay.com/photo/2023/07/19/13/56/bird-8137008_150.png","previewWidth":150,"previewHeight":100,"webformatURL":"https://pixabay.com/get/gd7c56d4f4cd41d409ae9ac242f976891c01d93bdba0433fe23b54f4f1fedabcda56a115132fa52b5b63da4f5365e1952976181742f9ca5aacbbc7779cd7ca8d5_640.png","webformatWidth":640,"webformatHeight":427,"largeImageURL":"https://pixabay.com/get/g360ac11fec31e90d040a6de4fa832d4033acc9f99891d948efd96f3cea4e0c0264a18fe567d800f1949cdaf679c669386a3d339b92a8e89e009d588deb97c164_1280.png","imageWidth":6016,"imageHeight":4016,"imageSize":24988433,"views":9017,"downloads":8842,"collections":0,"likes":42,"comments":22,"user_id":4464111,"user":"ambquinn","userImageURL":"https://cdn.pixabay.com/user/2023/06/27/11-02-33-758_250x250.jpeg"},{"id":8140376,"pageURL":"https://pixabay.com/photos/flowers-carnation-petals-nature-8140376/","type":"photo","tags":"flowers, free wallpaper, nature background","previewURL":"https://cdn.pixabay.com/photo/2023/07/20/21/26/flowers-8140376_150.jpg","previewWidth":150,"previewHeight":100,"webformatURL":"https://pixabay.com/get/g5686c1cf5881c6c9acf58ed550ccc857f57facd75623510694db43a12b638cdb0f9dec5dbc4e4e6a02ed5c90a4f415ce5c5a2d4712e23413817be82f9454eb6d_640.jpg","webformatWidth":640,"webformatHeight":427,"largeImageURL":"https://pixabay.com/get/g425277c0fa86f0e67e695cab61a7995fd79be5e886e1c4d553514683aee8aeb6f4ba2721a288afc16a966f659bb9fae04027d5bb31fc17fb10f9ac1dbb45f2d0_1280.jpg","imageWidth":6000,"imageHeight":4000,"imageSize":2146627,"views":5785,"downloads":5696,"collections":0,"likes":55,"comments":0,"user_id":7673058,"user":"Ray_Shrewsberry","userImageURL":"https://cdn.pixabay.com/user/2023/06/28/01-02-02-872_250x250.jpg"},{"id":8137534,"pageURL":"https://pixabay.com/photos/bird-emu-flightless-bird-8137534/","type":"photo","tags":"bird, emu, flightless bird","previewURL":"https://cdn.pixabay.com/photo/2023/07/19/18/05/bird-8137534_150.jpg","previewWidth":150,"previewHeight":100,"webformatURL":"https://pixabay.com/get/g56fac30b0c6506e9cbe7ccaffc1409aecb2d9cec277c6097d63a9550789f46e628b622a59eff8d18cce1889c8993b9bc5d78ae93281c7d5ee10dc3b4dda83e2c_640.jpg","webformatWidth":640,"webformatHeight":427,"largeImageURL":"https://pixabay.com/get/g366040f704459626a640efc790bcdc6335ccfb1888b4eb2fb641bcd6cea7200879e2c9ea9c1b53875dce8e35a5f003700c348e25708bcfb7f646e889956cfb17_1280.jpg","imageWidth":6000,"imageHeight":4000,"imageSize":4938985,"views":2737,"downloads":2683,"collections":2,"likes":38,"comments":21,"user_id":3698690,"user":"Marjonhorn","userImageURL":"https://cdn.pixabay.com/user/2020/10/31/14-11-24-484_250x250.png"},{"id":8132690,"pageURL":"https://pixabay.com/photos/baby-snow-leopard-snow-leopard-young-8132690/","type":"photo","tags":"baby snow leopard, snow leopard, young","previewURL":"https://cdn.pixabay.com/photo/2023/07/17/13/50/baby-snow-leopard-8132690_150.jpg","previewWidth":150,"previewHeight":100,"webformatURL":"https://pixabay.com/get/ge6fa4688d07bdfbe970e3a9a0bc6a7855f2440ab2605044568ed696b1d00f15c290bf9d900f35c8fb7b186e947f922d7657dbc01f2ff466c3cf0f00d52e0510b_640.jpg","webformatWidth":640,"webformatHeight":427,"largeImageURL":"https://pixabay.com/get/ga00a7d94c1fb9fedd956342159ef8935948fcefbf855216eb4417a3e89c4f8c9c03b02420af9fb919fd1d1f21ee8e15e5c24f0bb07b75aa51b240c6eff4fc663_1280.jpg","imageWidth":6000,"imageHeight":4000,"imageSize":9752032,"views":15882,"downloads":14954,"collections":12,"likes":73,"comments":38,"user_id":1425977,"user":"ChiemSeherin","userImageURL":"https://cdn.pixabay.com/user/2023/05/25/14-19-09-610_250x250.jpg"},{"id":8137544,"pageURL":"https://pixabay.com/photos/bird-peacock-blue-peacock-8137544/","type":"photo","tags":"bird, peacock, blue peacock","previewURL":"https://cdn.pixabay.com/photo/2023/07/19/18/11/bird-8137544_150.jpg","previewWidth":150,"previewHeight":100,"webformatURL":"https://pixabay.cLine truncated
|
||||
Reference in new issue
Block a user