Ver Fonte

Chore: add assets

wudi há 5 anos atrás
pai
commit
f7346db8ec
2 ficheiros alterados com 135 adições e 0 exclusões
  1. 33 0
      public/favicon.ico
  2. 102 0
      public/plugins/gallery.html

+ 33 - 0
public/favicon.ico

@@ -0,0 +1,33 @@
+<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.
+   -->

+ 102 - 0
public/plugins/gallery.html

@@ -0,0 +1,102 @@
+
+<!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;  }
+			label { color:white;  font-family:sans-serif; }
+			img { margin-right:4px;  cursor:pointer;  }
+			#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 = [];
+		
+			function update() {
+				var ikey = document.getElementById("keyws").value;
+				if(document.getElementById("isolated").checked) ikey += " isolated";
+				ikey = ikey.trim();
+				console.log(JSON.stringify(ikey));
+				//alert(keyws);
+				
+				var request = new XMLHttpRequest();
+				var url = "https://pixabay.com/api/?image_type=photo"+(ikey==""?"":"&q="+encodeURIComponent(ikey))+"&per_page=200&page=1&key=10554583-a5eacb61c2e61105fdfb6eb88&safesearch=true"; 
+				if(ikey=="") {
+					if(Math.random()<0.005) url="gallery.php?url="+encodeURIComponent(url+"&safesearch=true");
+					else url="gallery.json";
+				}
+				//console.log(url);
+				request.open("GET", url, true);
+				request.onload = imgsLoaded.bind(this);
+				request.onerror = function(e) {  console.log(e.target.response);  }
+				request.send();
+			}
+			function imgsLoaded(e) {
+				//console.log(e.target.response);
+				var iw = window.innerWidth-28, th=100;
+				var cont = document.getElementById("cont");
+				cont.setAttribute("style","height:"+(window.innerHeight-42)+"px;");
+				while(cont.firstChild) cont.removeChild(cont.firstChild);
+				cont.scrollTop = 0;
+				hits = JSON.parse(e.target.response)["hits"];  imgs=[];
+				var heis = [];
+				for(var i=0; i<hits.length; ) {
+					var totw = 0, j=i;
+					while(j<hits.length) {
+						var hit = hits[j];
+						var w=hit["previewWidth"], h=hit["previewHeight"];
+						if(j<=i+1 || totw+w*(th/h)+4 < iw) {  totw+=w*(th/h) + 4;  j++;  }
+						else break;
+					}
+					while(i<j) {
+						heis.push(th*(iw/totw));  i++;
+					}
+				}
+				
+				for(var i=0; i<hits.length; i++) {
+					var hit = hits[i];
+					var img = document.createElement("img");
+					img.setAttribute("src",hit["previewURL"]);
+					img.setAttribute("height",heis[i]+"px");
+					img.addEventListener("click", imgClick);
+					cont.appendChild(img);
+					imgs.push(img);
+				}
+				console.log(hits);
+			}
+			function imgClick(e) {
+				var ind = imgs.indexOf(e.currentTarget);
+				var hit = hits[ind];  console.log(hit);
+				var x = "app.open(\""+hit["largeImageURL"]+"\",null,true);";
+				window.parent.postMessage(x, "*");
+			}
+			function msg(e) {  alert("These images come from www.PixaBay.com and are free to use for any purpose.");  }
+		</script>
+	</head>
+	
+	<body onload="update()">	
+		<button onclick="msg()">?</button>
+		<label>Keywords:</label> <input type="text" id="keyws" onchange="update()"></input>
+		<input type="checkbox" id="isolated" style="vertical-align:middle;" onchange="update()" /> <label for="isolated">Isolated</label>
+		
+		
+		<div id="cont"></div>
+	</body>
+</html>