Skip to content

Commit

Permalink
Fix preview links for the 3ed time and fix recent scan
Browse files Browse the repository at this point in the history
  • Loading branch information
GM-Script-Writer-62850 committed Jul 14, 2013
1 parent 1578602 commit 5fe82f0
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
17 changes: 8 additions & 9 deletions inc/main.js
@@ -1,5 +1,5 @@
var supportErrorA="Your browser does not support the ", supportErrorB="<br/>You have 3 choices: Ignore This, update your browser, and switch browsers.",
ias, previewIMG, scanners, paper, filesLst={}, TC='textContent';// TC can be changed to 'innerText' see header.php
ias, previewIMG, scanners, checkTimeout, paper, filesLst={}, TC='textContent';// TC can be changed to 'innerText' see header.php
$(document).ready(function (){
e=$('img[title="Preview"]');
previewIMG=e[0];
Expand Down Expand Up @@ -41,6 +41,7 @@ function pre_scan(form,ias){
document.scanning.scanner.removeAttribute('disabled');
setTimout(function(){document.scanning.scanner.setAttribute('disabled','disabled');},250);
}
clearTimeout(checkTimeout);
return true;
}
function sendE(ele,e){
Expand Down Expand Up @@ -157,15 +158,17 @@ function changeColor(colors){
N.href='inc/style.php?colors='+colors+'&nocache='+new Date().getTime();
document.body.setAttribute('onunload',"if(!document.cookie)alert('The color theme was not saved because you have cookies disabled')");
}
function lastScan(scan,preview,scanner,ele){
function lastScan(scan,preview,scanner,source,size,ele){
generic=scan.slice(5);
previewIMG.src='scans/'+preview;
ias.setOptions({'enable': true });
ias.update();
getID('sel').removeAttribute('style');
document.scanning.scanner.value=scanner;
sendE(document.scanning.scanner,'change');
scannerChange(document.scanning.scanner);
document.scanning.scanner.disabled='disabled';
document.scanning.source.value=source;
document.scanning.size.value=size;
sendE(document.scanning.size,'change');
ele.parentNode.parentNode.innerHTML='<h2>'+generic+'</h2><p><a class="tool icon download" href="download.php?file='+scan+'"><span class="tip">Download</span></a> '+
'<a class="tool icon zip" href="download.php?file='+scan+'&amp;compress"><span class="tip">Download Zip</span></a> '+
Expand Down Expand Up @@ -257,7 +260,7 @@ function checkScanners(){
printMsg('Information',"The scanner currently selected is being used by someone right now",'center',-1);
}
}
setTimeout(checkScanners,5000);
checkTimeout=setTimeout(checkScanners,5000);
}
};
httpRequest.open('GET', 'config/scanners.json?cacheBust='+new Date().getTime(), true);
Expand Down Expand Up @@ -730,12 +733,8 @@ function bulkUpload(){
if(httpRequest.readyState==4){
if(httpRequest.status==200){//printMsg('Debug',encodeHTML(httpRequest.responseText),'center',0);
var json=parseJSON(httpRequest.responseText),ids=false,c=0;
if(json['success']){

This comment has been minimized.

Copy link
@GM-Script-Writer-62850

GM-Script-Writer-62850 Jul 14, 2013

Author Owner

why were these lines not in the last commit?

printMsg('Success','All '+json['images'].length+' image(s) were uploaded to your new <a href="http://imgur.com/a/'+
json['album']['data']['id']+'" target="_blank">album</a><br/>You delete hash is <i>'+json['album']['data']['deletehash']+
'</i>. Sorry, I do not know the URL to delete albums. XP','center',0);
if(json['success'])
ids=Array();
}
else{
if(json['images'].length==0){
if(!json['album'])
Expand Down
2 changes: 1 addition & 1 deletion inc/previewlinks.php
Expand Up @@ -17,7 +17,7 @@
if($_GET['page']=="Edit")
echo '<span class=\\"tool icon edit-off\\"><span class=\\"tip\\">Edit (Disabled)</span></span>';
else
echo '<a href=\\"index.php?page=Edit&amp;file="+file+"\\" class=\\"tool icon edit\\"><span class=\\"tip\\">Edit</span></a>';
echo '<a href=\\"index.php?page=Edit&amp;file="+fileURL+"\\" class=\\"tool icon edit\\"><span class=\\"tip\\">Edit</span></a>';
?> \
<a href=\"index.php?page=View&amp;file=Scan_"+fileURL+"\" class=\"tool icon view\"><span class=\"tip\">View</span></a> \
<a href=\"#\" class=\"tool icon upload\" onclick=\"return upload('Scan_"+fileJS+"')\"><span class=\"tip\">Upload to Imgur</span></a> \
Expand Down
5 changes: 3 additions & 2 deletions inc/scan.php
Expand Up @@ -215,9 +215,10 @@
<span class="tool icon email-off"><span class="tip">Email (Disabled)</span></span>
<?php
$ls='<span class="tool icon recent-off"><span class="tip">Last Scan (Disabled)</span></span>';
if(isset($_COOKIE["scan"])&&isset($_COOKIE["preview"])){
if(isset($_COOKIE["scan"])&&isset($_COOKIE["preview"])&&isset($_COOKIE["size"])&&isset($_COOKIE["source"])){
if(file_exists("scans/".$_COOKIE["scan"])&&file_exists("scans/".$_COOKIE["preview"]))
echo "<a class=\"tool icon recent\" onclick=\"lastScan('".html(js($_COOKIE["scan"]))."','".html(js($_COOKIE["preview"]))."','".html(js($_COOKIE["scanner"]))."',this');\" href=\"javascript:void(null)\"><span class=\"tip\">Last Scan</span></a>";
echo "<a class=\"tool icon recent\" onclick=\"lastScan('".html(js($_COOKIE["scan"]))."','".html(js($_COOKIE["preview"]))."','".html(js($_COOKIE["scanner"]))."','".
html(js($_COOKIE["source"]))."','".html(js($_COOKIE["size"]))."',this);\" href=\"javascript:void(null)\"><span class=\"tip\">Last Scan</span></a>";
else
echo $ls;
}
Expand Down
4 changes: 1 addition & 3 deletions inc/style.php
Expand Up @@ -666,7 +666,7 @@
cursor: pointer;
}

#imgur-uploads .box .album{
#imgur-uploads .box .album {
width: 160px;
height: 160px;
margin-top: 3px;
Expand All @@ -682,8 +682,6 @@
/*display: -moz-box; does not work in firefox as of writing this
-moz-box-pack: center;
-moz-box-align: center;*/
text-decoration: none;

}

#imgur-uploads .box .album img {
Expand Down
2 changes: 2 additions & 0 deletions index.php
Expand Up @@ -1093,6 +1093,8 @@ function quit(){
else{
echo "Set_Cookie( 'scan', '$S_FILENAME', 1, '/', '', '' );".
"Set_Cookie( 'preview', '$P_FILENAME', 1, '/', '', '' );".
"Set_Cookie( 'source', '$SOURCE', 1, '/', '', '' );".
"Set_Cookie( 'size', '$SIZE', 1, '/', '', '' );".
"Set_Cookie( 'scanner', '$SCANNER', 1, '/', '', '' );";
}
$ORNT=($ORNT==''?'vert':$ORNT);
Expand Down

0 comments on commit 5fe82f0

Please sign in to comment.