diff --git a/download.php b/download.php index e14b265..05ded82 100755 --- a/download.php +++ b/download.php @@ -35,6 +35,12 @@ } elseif($paths[0] == "delete") { + header("Content-type: text/html; charset=utf-8"); + header("Expires: on, 01 Jan 1970 00:00:00 GMT"); + header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); + header("Cache-Control: no-store, no-cache, must-revalidate"); + header("Cache-Control: post-check=0, pre-check=0", false); + header("Pragma: no-cache"); if(json_decode(file_get_contents("features"))->deleting == true) { @$f = basename($paths[1]); diff --git a/functions.js b/functions.js index 95b6ae2..9c736b5 100644 --- a/functions.js +++ b/functions.js @@ -444,7 +444,7 @@ function upload(binary,fname,date) i.style.maxWidth = "19%"; i.style.minWidth = "200px"; grid.appendChild(i); - if(isset(i.y) && typeof window.scrollTo == "function") window.scrollTo(0,i.y); + if(typeof window.scrollTo == "function") window.scrollTo(0,$(i).offset().top); var xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"); xmlhttp.addEventListener("readystatechange",function() { @@ -644,8 +644,8 @@ function kinput(e) if(kk == 105) infooverlay(); if(kk == 102) fs(); if(kk == 27) {e.preventDefault(); container.click();} - if(kk == 39) next(); - if(kk == 37) prev(); + if(kk == 39 || kk == 110) next(); + if(kk == 37 || kk == 112) prev(); if(kk == 8 || kk == 46){ e.preventDefault(); del();} } function addimg(image) @@ -714,11 +714,11 @@ function openpic(srcthumb) var d = $(srcthumb).data(); if("by" in d) { - by = meta['all'] != undefined ? meta['all'] : "Unknown"; + by = d.by; } else { - by = d.by; + by = meta['all'] != undefined ? meta['all'] : "Unknown"; } if("description" in d) { @@ -1287,7 +1287,7 @@ infolay.classList.add("closed"); container.appendChilds(prevb,nextb,img,infobut,infolay); function init() { - document.body.appendChilds(grid,container); + document.body.appendChilds(prog,grid,container); document.querySelector(".fileUpload").style.display = ""; imgs.forEach(addimg); ety(); diff --git a/functions.min.js b/functions.min.js deleted file mode 100644 index 5ae74ca..0000000 --- a/functions.min.js +++ /dev/null @@ -1,3 +0,0 @@ -(function(){if(!Event.prototype.preventDefault){Event.prototype.preventDefault=function(){this.returnValue=false}}if(!Event.prototype.stopPropagation){Event.prototype.stopPropagation=function(){this.cancelBubble=true}}if(!Element.prototype.addEventListener){var c=[];var b=function(f,h){var d=this;var k=function(l){l.target=l.srcElement;l.currentTarget=d;if(h.handleEvent){h.handleEvent(l)}else{h.call(d,l)}};if(f=="DOMContentLoaded"){var g=function(l){if(document.readyState=="complete"){k(l)}};document.attachEvent("onreadystatechange",g);c.push({object:this,type:f,listener:h,wrapper:g});if(document.readyState=="complete"){var j=new Event();j.srcElement=window;g(j)}}else{this.attachEvent("on"+f,k);c.push({object:this,type:f,listener:h,wrapper:k})}};var a=function(f,g){var d=0;while(dc){b.height*=c/b.width;b.width=c}var j=CE("canvas"),h=j.getContext("2d");h.clearRect(0,0,j.width,j.height);j.width=b.width;j.height=b.height;h.drawImage(b,0,0,b.width,b.height);stackBlurCanvasRGBA(j,0,0,b.width,b.height,10);h.font=(b.height/100)*12+"px Ubuntu";h.fillInversedText("Uploading image...",(b.width/100)*20,(b.height/100)*50);var g=j.toDataURL(),l=new Image();j.remove();b.remove();l.src=g;l.classList.add("image");l.style.maxWidth="19%";l.style.minWidth="200px";grid.appendChild(l);if(isset(l.y)&&typeof window.scrollTo=="function"){window.scrollTo(0,l.y)}var k=window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP");k.addEventListener("readystatechange",function(){if(k.readyState==4&&k.status==200){delete uploads[d];l.remove();var m=json_decode(k.responseText);if(m.success){imgs.push(m.file);addimg(m.file);console.log(m.orig_file+" was successfully uploaded")}else{alert("There was an error while uploading: "+m.error+", file: "+m.file)}}});k.upload.addEventListener("progress",function(n){if(n.lengthComputable){var m=n.loaded/n.total;uploads[d]=m}else{console.warn("Unable to compute progress information since the total size is unknown")}});k.addEventListener("abort",error);k.addEventListener("timeout",error);k.addEventListener("error",error);k.open("POST","upload.php?name="+e+"&date="+a,true);k.send(f);uploads[d]=0})}function error(a){console.warn(a);console.log(this)}function startWorker(){if(typeof(Worker)!=="undefined"&&typeof(w)=="undefined"&&preload){w=new Worker("preload.js");w.onmessage=function(c){var d=basename(c.data[1]),a=c.data[0];var b=(window.URL||window.webkitURL).createObjectURL(a);imgs[d]=b;mdata[d]=json_decode(c.data[2]);console.info("WebWorker has successfully downloaded "+d+" to "+b)};w.postMessage(imgs);console.info("Preload WebWorker started")}}function lhash(){requestAnimationFrame(lhash);var g=location.hash;if(g[1]=="!"){if(g.length<=2){console.warn("No arguments provided but #!. Stopping.")}else{argr=substr(g,2);args=explode(",",argr);for(var d=0;d2){console.warn("Multiple values specified, using first one")}if(c=="ts"){if(f!=""){thumbsize=f}}if(c=="rs"){if(f!=""){realsize=f}}if(c=="image"){if(f!=""&&f!=undefined){var e=(container.style.display=="none");if(e||$.data(img,"original")!=f){var b=findthumb(f);if(b!=undefined&&($.data(img,"original")!=$.data(b,"original")||e)){openpic(b)}}}}if(c=="info"){if(f=="true"){infolay.classList.remove("closed")}else{if(f=="false"){infolay.classList.add("closed")}}}if(c=="preload"){if(f=="false"||f==false){preload=false}if(f=="true"||f==true){preload=true}}if(c=="overview"){if(f=="true"||f==true){if(container.style.display!="none"){container.click()}}}}}}}function winwidth(){var b=window,h=document,f=h.documentElement,c=h.getElementsByTagName("body")[0],a=b.innerWidth||f.clientWidth||c.clientWidth;return a}CanvasRenderingContext2D.prototype.fillInversedText=function(e,l,h){var f=this.measureText(e).width;var a=parseInt(this.font,"10");a=(a===0)?16:a;var j=document.createElement("canvas");j.width=f;j.height=a;var n=j.getContext("2d");n.font=this.font;n.textBaseline="top";n.fillText(e,0,0);var k=this.getImageData(l,h,f,a);var d=n.getImageData(0,0,f,a);var m=k.data;var b=d.data;var g=b.length;for(var c=0;c0){m[c]=(255-m[c]);m[c+1]=(255-m[c+1]);m[c+2]=(255-m[c+2])}}this.putImageData(k,l,h)};function kinput(b){var a=b.keyCode||b.which;if(a==105){infooverlay()}if(a==102){fs()}if(a==27){b.preventDefault();container.click()}if(a==39){next()}if(a==37){prev()}if(a==8||a==46){b.preventDefault();del()}}function addimg(a){var b=CE("img");if(thumbsize!=0){b.src="download.php/resize/"+(parseInt(thumbsize)+(parseInt(thumbsize)/10))+"/"+a;b.style.width=thumbsize+"px"}else{b.src="thumbs.dir/"+a+".jpg";b.style.width="19%";if(mobile){b.style.width="92%"}b.style.minWidth="200px"}$.data(b,"original",a);b.classList.add("image");if(meta[a]!=undefined){$.data(b,"by",meta[a].by);$.data(b,"description",meta[a].description)}b.addEventListener("click",openpic);grid.appendChild(b)}function openpic(h){if(this.tagName=="IMG"){h=this}if(h==undefined){console.warn("srcthumb is undefined");return}var e=$.data(h,"original"),a=false,r=imgs[e];if(substr(r,0,4)=="blob"){console.info("Reading image "+e+" from "+r);img.src=r;a=true}else{if(realsize==0){img.src=e}else{if(realsize=="dyn"){img.src="download.php/resize/"+(winwidth()/100)*95+"/"+e}else{img.src="download.php/resize/"+realsize+"/"+e}}}$.data(img,"original",e);location.hash="#!image="+basename(e);container.style.display="";var t=$(h).data();if("by" in t){by=meta.all!=undefined?meta.all:"Unknown"}else{by=t.by}if("description" in t){desc=t.description}else{desc="Unbenannt"}infobut.style.display="";var x=mdata[e]!=undefined?mdata[e]:json_decode(file_get_contents("download.php/exif/"+e)),g=desc+", hochgeladen von "+by,p=a?'
In Originalgröße downloaden':'
In Originalgröße downloaden';if($.data(h,"description")=="undefined"){g="Hochgeladen von "+$.data(h,"by")}if(x!=false&&x!=null){var o=x.width,k=x.height,b=x.make,c=x.model,n=x.GPS,u=x.date,s=x.ISO,j=x.aperture,v=x.exposure,f=x.filesize,m=x.flash,l=x.software;if(u!=false){g+=", fotografiert am "+u}if(u!=false&&b!=false&&c!=false){var q=b+" "+c;if(b==c){q=c}if(c.indexOf(b)!=-1){q=c}g+=", mit einer / einem "+q}else{if(b!=false&&c!=false){var q=b+" "+c;if(b==c){q=c}if(c.indexOf(b)!=-1){q=c}g+=", fotografiert mit einer / einem "+q}}if(s!=false){g+=", ISO: "+s}if(j!=false){g+=", Blende: "+j}if(v!=false){g+=", Belichtungszeit: "+v}if(m!=false){g+=", Blitz aktiviert"}if(f!=false){g+=", Dateigrösse: "+f}if(o!=false&&k!=false){g+=", Abmessungen: "+o+"x"+k}if(l!=false&&l!=null){g+=", software: "+l}g+=p;if(n!=false){g+=' Ort in Karten öffnen'}if(features.deleting){g+="    "}}infolay.innerHTML=g}function infooverlay(){infolay.classList.toggle("closed")}function findthumb(b){var a=document.getElementsByClassName("image");for(i=0;i>d;if(A!=0){A=255/A;h[v]=((f*B)>>d)*A;h[v+1]=((g*B)>>d)*A;h[v+2]=((E*B)>>d)*A}else{h[v]=h[v+1]=h[v+2]=0}f-=r;g-=G;E-=C;T-=b;r-=W.r;G-=W.g;C-=W.b;b-=W.a;U=(n+((U=O+Q+1)>d;if(A>0){A=255/A;h[U]=((f*B)>>d)*A;h[U+1]=((g*B)>>d)*A;h[U+2]=((E*B)>>d)*A}else{h[U]=h[U+1]=h[U+2]=0}f-=r;g-=G;E-=C;T-=b;r-=W.r;G-=W.g;C-=W.b;b-=W.a;U=(O+(((U=N+l)