Skip to content

Commit

Permalink
Overhauld the Color Schemes system
Browse files Browse the repository at this point in the history
  • Loading branch information
GM-Script-Writer-62850 committed Jul 18, 2013
1 parent d18e2e8 commit 754f606
Show file tree
Hide file tree
Showing 24 changed files with 909 additions and 428 deletions.
2 changes: 2 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ Credit where credit is due:
phpmailer 5.2.6
openiconlibrary.sourceforge.net
Powered by Linux image
Stefan Petre
ColorPicker (www.eyecon.ro/colorpicker/)

Installation Notes:
Extract files to /var/www (or where ever your web pages are visible from)
Expand Down
124 changes: 78 additions & 46 deletions inc/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,30 +20,35 @@
</div>

<div class="box">
<h2>Color Sceme</h2>
<p>
Select a Color:
<select onchange="if(this.value!='void')changeColor(this.value);">
<option value="void">Please Select</option>
<option value="3c9642x3c7796" style="background-color:#3c9642;color:#3c7796;">Green</option>
<option value="3c7796x963c8f" style="background-color:#3c7796;color:#963c8f;">Blue</option>
<option value="963c8fx3c7796" style="background-color:#963c8f;color:#3c7796;">Purple</option>
<option value="663366x3c7796" style="background-color:#663366;color:#3c7796;">Dark Purple</option>
<option value="000000x999999" style="background-color:#000000;color:#999999;">Black</option>
<option value="996633xbfbfbf" style="background-color:#996633;color:#bfbfbf;">Light Brown</option>
<option value="848484xbfbfbf" style="background-color:#848484;color:#bfbfbf;">Gray</option>
<option value="383838x838383" style="background-color:#383838;color:#838383;">Dark Gray</option>
<option value="ff007exbb045e" style="background-color:#ff007e;color:#bb045e;">Pink</option>
</select>
<h2>Debug Console</h2>
<p><?php
if(isset($Fortune)){
echo '<a href="javascript:void(\'toggleFortune\')" onclick="this[TC]=toggleFortune(this[TC])?\'Hide\':\'Show\';">'.($_COOKIE["fortune"]?'Hide':'Show').'</a> fortunes. (Refresh to apply)<br/>';
}
?>
<a href="javascript:void('toggleDebug')" id="debug-link" onclick="this[TC]=toggleDebug(false)?'Hide':'Show';"><?php
if(isset($_COOKIE["debug"])){
if($_COOKIE["debug"]=='true'){
echo 'Hide';
}
else{
echo 'Show';
}
}
else{
echo 'Show';
}
?></a> the Debug Console. You can toggle the Debug Console at any time by pressing this:<br/><code>[Ctrl]+[Shift]+[D]</code>
</p>
<!-- Manual color picker (for theme development)-->
<!--<input value="000000xFFFFFF" onkeypress="if(event.which==13){changeColor(this.value);return false;}"/>-->
</div>

<div class="box">
<h2>Email Configuration</h2>
<p><input type="submit" value="Edit" onclick="emailManager(null);"/>
<input type="submit" value="Delete" onclick="deleteEmail();" style="float:right;"/></p>
<h2>Trouble Shooting</h2>
<p>
If you are having issues loading the Scanned Files page due to over population you can <a href="index.php?page=Scans&amp;delete=Remove" onclick="return confirm('Delete all scanned files?')">
Remove All the Scans</a> with that link or you can use <a href="index.php?page=Scans&filter=1&t=0">this link</a> so you can use the scan filter. If you are having another issue you may want to read the <a href="index.php?page=About">Release Notes</a> or
take a look at the <a href="index.php?page=PHP%20Information">PHP Configuration</a>.
</p>
</div>

</div>
Expand Down Expand Up @@ -84,35 +89,62 @@
<div class="column">

<div class="box">
<h2>Trouble Shooting</h2>
<p>
If you are having issues loading the Scanned Files page due to over population you can <a href="index.php?page=Scans&amp;delete=Remove" onclick="return confirm('Delete all scanned files?')">
Remove All the Scans</a> with that link or you can use <a href="index.php?page=Scans&filter=1&t=0">this link</a> so you can use the scan filter. If you are having another issue you may want to read the <a href="index.php?page=About">Release Notes</a> or
take a look at the <a href="index.php?page=PHP%20Information">PHP Configuration</a>.
</p>
<h2>Color Scheme</h2>
<p><span style="margin-right:30px;">Theme Picker:</span><select onchange="if(this.value!='void')changeColor(this.value,true);">
<option value="void">Please Select</option>
<option value="3C9642.3C7796.3C9642.FFFFFF.3C9642.FFFFFF.000000.383838.FFFFFF.FF0000.FFFFFF" style="background-color:#3c9642;color:#3c7796;">Green</option>
<option value="3C7796.963C8F.3C7796.FFFFFF.3C7796.FFFFFF.000000.383838.FFFFFF.FF0000.FFFFFF" style="background-color:#3c7796;color:#963c8f;">Blue</option>
<option value="963C8f.3C7796.963C8f.FFFFFF.963C8f.FFFFFF.000000.383838.FFFFFF.FF0000.FFFFFF" style="background-color:#963c8f;color:#3c7796;">Purple</option>
<option value="663366.3C7796.663366.FFFFFF.663366.FFFFFF.000000.383838.FFFFFF.FF0000.FFFFFF" style="background-color:#663366;color:#3c7796;">Dark Purple</option>
<option value="000000.999999.000000.FFFFFF.000000.FFFFFF.000000.383838.FFFFFF.FF0000.FFFFFF" style="background-color:#000000;color:#999999;">Black</option>
<option value="996633.BFBFBF.996633.FFFFFF.996633.FFFFFF.000000.383838.FFFFFF.FF0000.FFFFFF" style="background-color:#996633;color:#bfbfbf;">Light Brown</option>
<option value="848484.BFBFBF.848484.FFFFFF.848484.FFFFFF.000000.383838.FFFFFF.FF0000.FFFFFF" style="background-color:#848484;color:#bfbfbf;">Gray</option>
<option value="383838.838383.383838.FFFFFF.383838.FFFFFF.000000.000000.FFFFFF.FF0000.FFFFFF" style="background-color:#383838;color:#838383;">Dark Gray</option>
<option value="FF007E.BB045E.FF007E.FFFFFF.FF007E.FFFFFF.000000.383838.FFFFFF.FF0000.FFFFFF" style="background-color:#ff007e;color:#bb045e;">Pink</option>
</select></p>
<?php $Theme=explode('.',$Theme);$attrs='class="colorPicker" readonly="readonly" onchange="changeColor(this,false);"'; ?>
<div class="footer"><form name="theme" onsubmit="return changeColor(null,true);" action="#"><p style="line-height:23px;">
<span>Background Color:</span> <input name="BG_COLOR" style="background-color:#<?php echo $Theme[0]; ?>" value="<?php echo $Theme[0]; ?>" <?php echo $attrs; ?>/>
<span>Page Background:</span> <input name="PB_COLOR" style="background-color:#<?php echo $Theme[3]; ?>" value="<?php echo $Theme[3]; ?>" <?php echo $attrs; ?>/>
<span>Page Text:</span> <input name="PT_COLOR" style="background-color:#<?php echo $Theme[6]; ?>" value="<?php echo $Theme[6]; ?>" <?php echo $attrs; ?>/>
<span>Header Background:</span> <input name="HB_COLOR" style="background-color:#<?php echo $Theme[4]; ?>" value="<?php echo $Theme[4]; ?>" <?php echo $attrs; ?>/>
<span>Header Text:</span> <input name="HT_COLOR" style="background-color:#<?php echo $Theme[5]; ?>" value="<?php echo $Theme[5]; ?>" <?php echo $attrs; ?>/>
<span>Link Color:</span> <input name="LC_COLOR" style="background-color:#<?php echo $Theme[2]; ?>" value="<?php echo $Theme[2]; ?>" <?php echo $attrs; ?>/>
<span>Link Color (Mouse Over):</span> <input name="LK_COLOR" style="background-color:#<?php echo $Theme[1]; ?>" value="<?php echo $Theme[1]; ?>" <?php echo $attrs; ?>/>
<span>Debug Background:</span> <input name="BB_COLOR" style="background-color:#<?php echo $Theme[7]; ?>" value="<?php echo $Theme[7]; ?>" <?php echo $attrs; ?>/>
<span>Debug Text:</span> <input name="BT_COLOR" style="background-color:#<?php echo $Theme[8]; ?>" value="<?php echo $Theme[8]; ?>" <?php echo $attrs; ?>/>
<span>Alert Header Background:</span> <input name="AH_COLOR" style="background-color:#<?php echo $Theme[9]; ?>" value="<?php echo $Theme[9]; ?>" <?php echo $attrs; ?>/>
<span>Alert Header Text:</span> <input name="AT_COLOR" style="background-color:#<?php echo $Theme[10]; ?>" value="<?php echo $Theme[10]; ?>" <?php echo $attrs; ?>/>
<script type="text/javascript">(function(){
var pickers=$('.colorPicker').ColorPicker({
onSubmit:function(hsb,hex,rgb,el){
$(el).val(hex);
$(el).ColorPickerHide();
sendE(el,'change');
},
onShow:function(colpkr){
$(colpkr)['fade'+(colpkr.style.display=='block'?'Out':'In')](500);
return false;
},
onHide: function(colpkr){
$(colpkr).fadeOut(500);
return false;
}
});
document.theme.reset();
for(var i in pickers){
if(isNaN(i))
break;
$(pickers[i]).ColorPickerSetColor(pickers[i].value);
}
})();</script><br/>
<input type="submit" value="Save"/></p></form></div>
</div>

<div class="box">
<h2>Debug Console</h2>
<p><?php
if(isset($Fortune)){
echo '<a href="javascript:void(\'toggleFortune\')" onclick="this[TC]=toggleFortune(this[TC])?\'Hide\':\'Show\';">'.($_COOKIE["fortune"]?'Hide':'Show').'</a> fortunes. (Refresh to apply)<br/>';
}
?>
<a href="javascript:void('toggleDebug')" id="debug-link" onclick="this[TC]=toggleDebug(false)?'Hide':'Show';"><?php
if(isset($_COOKIE["debug"])){
if($_COOKIE["debug"]=='true'){
echo 'Hide';
}
else{
echo 'Show';
}
}
else{
echo 'Show';
}
?></a> the Debug Console. You can toggle the Debug Console at any time by pressing this:<br/><code>[Ctrl]+[Shift]+[D]</code>
</p>
<h2>Email Configuration</h2>
<p><input type="submit" value="Edit" onclick="emailManager(null);"/>
<input type="submit" value="Delete" onclick="deleteEmail();" style="float:right;"/></p>
</div>

<div class="box">
Expand Down
30 changes: 17 additions & 13 deletions inc/header.php
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
<!DOCTYPE html><html><?php $path=is_numeric($GLOBALS['PAGE'])?substr($_SERVER['PHP_SELF'],0,strlen(end(explode('/',$_SERVER['PHP_SELF'])))*-1-4):''; ?>
<?php
$path=is_numeric($GLOBALS['PAGE'])?substr($_SERVER['PHP_SELF'],0,strlen(end(explode('/',$_SERVER['PHP_SELF'])))*-1-4):'';
$Theme=isset($_COOKIE["theme"])?url($_COOKIE["theme"]):$GLOBALS['Theme'];
$GLOBALS['Theme']=$Theme;
?>
<!DOCTYPE html><html>
<head>
<meta charset="UTF-8"/>
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="chrome=1"><![endif]-->
<title><?php echo html($GLOBALS['NAME'].' ~ '.$GLOBALS['PAGE'].' - '.$page); ?></title>
<link id="style" rel="stylesheet" href="<?php echo $path; ?>inc/style.php<?php
if(isset($_COOKIE["colors"])){
echo "?colors=".url($_COOKIE["colors"]);
}
?>" type="text/css"/>
<?php
if($GLOBALS['PAGE']=='Config')
echo '<link id="style_new" rel="stylesheet" href="inc/style.php'.(isset($_COOKIE["colors"])?'?colors='.$_COOKIE["colors"]:'').'" type="text/css"/>';
?>
<link rel="shortcut icon" href="<?php echo $path; ?>inc/images/favicon.png"/>
<script type="text/javascript" src="<?php echo $path; ?>jquery/imgareaselect-0.9.10/scripts/jquery.min.js"></script>
<?php echo in_array($GLOBALS['PAGE'],Array("Scan","Edit"))?'<script type="text/javascript" src="'.$path.'jquery/imgareaselect-0.9.10/scripts/jquery.imgareaselect.pack.js"></script>'.
'<link rel="stylesheet" type="text/css" href="'.$path.'jquery/imgareaselect-0.9.10/css/imgareaselect-animated.css"/>':''; ?>
<link rel="stylesheet" href="<?php echo $path; ?>inc/style.php?theme=<?php echo $Theme; ?>" type="text/css"/>
<script type="text/javascript" src="<?php echo $path; ?>jquery/jquery.min.js"></script>
<?php
if(in_array($GLOBALS['PAGE'],Array("Scan","Edit")))
echo '<link rel="stylesheet" type="text/css" href="'.$path.'jquery/imgareaselect-0.9.10/css/imgareaselect-animated.css"/>'."\n".
'<script type="text/javascript" src="'.$path.'jquery/imgareaselect-0.9.10/scripts/jquery.imgareaselect.pack.js"></script>';
else if($GLOBALS['PAGE']=='Config')
echo '<style id="style_old" type="text/css"/></style><style id="style_new" type="text/css"/></style>'."\n".
'<link rel="stylesheet" media="screen" type="text/css" href="'.$path.'jquery/colorpicker-custom/css/colorpicker.css"/>'."\n".
'<script type="text/javascript" src="'.$path.'jquery/colorpicker-custom/js/colorpicker.js"></script>';
?>
<script type="text/javascript" src="<?php echo $path; ?>inc/model-dialog.js"></script>
<script type="text/javascript" src="<?php echo $path; ?>inc/cookie.js"></script>
<script type="text/javascript" src="<?php echo $path; ?>inc/main.js"></script>
Expand Down
7 changes: 7 additions & 0 deletions inc/ie.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ p .icon{
.dualForm .largeButton span{
font-size:33pt;
}
.colorPicker{
font-size:0;
line-height:9001px;
}
.colorpicker div{
filter:inherit;
}
/* IE 6 & 7 Hacks */
h2 .del{
*position:relative;
Expand Down
1 change: 1 addition & 0 deletions inc/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ function js($X){
$page=($PAGE==200?"Success":"Error");
$Auth=true;
$RequireLogin=false;
$Theme='3C9642.3C7796.3C9642.FFFFFF.3C9642.FFFFFF.000000.383838.FFFFFF';
include("header.php");
?>
<div class="box box-full"><h2>HTTP Status Code: <?php echo $PAGE; ?></h2><p class="center"><?php echo $PAGE==200?'Ok, you found me':'That is a error'; ?></p></div>
Expand Down
70 changes: 49 additions & 21 deletions inc/main.js
Original file line number Diff line number Diff line change
@@ -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, checkTimeout, paper, filesLst={}, TC='textContent';// TC can be changed to 'innerText' see header.php
ias, previewIMG, scanners, checkTimeout, rotateTimer, paper, filesLst={}, TC='textContent';// TC can be changed to 'innerText' see header.php
$(document).ready(function (){
e=$('img[title="Preview"]');
previewIMG=e[0];
Expand All @@ -26,6 +26,51 @@ $(document).ready(function (){
function getID(id){
return document.getElementById(id);
}
function encodeHTML(string){// http://stackoverflow.com/questions/24816/escaping-html-strings-with-jquery#answer-12034334
var entityMap={
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': '&quot;',
"'": '&#39;',
"/": '&#x2F;'
};
return String(string).replace(/[&<>"'\/]/g,function(s){return entityMap[s];});
}
function changeColor(x,save){
if(typeof(XMLHttpRequest)=='undefined')
return printMsg('Sorry',supportErrorA+"XMLHttpRequest "+(TC=='textContent'?'function':'object')+" so can't change themes."+supportErrorB,'center',0);
var fields=Array('BG','LK','LC','PB','HB','HT','PT','BB','BT','AH','AT'),str='';
if(typeof(x)=='string'){
x=x.split('.');
for(var i in fields){
document.theme[fields[i]+'_COLOR'].value=x[i];
document.theme[fields[i]+'_COLOR'].style.backgroundColor='#'+x[i];
$(document.theme[fields[i]+'_COLOR']).ColorPickerSetColor(x[i]);
}
}
else if(!save)
x.style.backgroundColor='#'+x.value;
for(var i in fields)
str+=document.theme[fields[i]+'_COLOR'].value+'.';
var O=getID('style_old');
var N=getID('style_new');
O[TC]=N[TC];
var httpRequest = new XMLHttpRequest();
httpRequest.onreadystatechange = function(){
if(httpRequest.readyState==4){
if(httpRequest.status==200)
N[TC]=httpRequest.responseText.replace(/url\("images/g,'url("inc/images');
else
printMsg('Error '+httpRequest.status,' Failed to connect to '+document.domain,'center',-1);
}
};
httpRequest.open('GET', 'inc/style.php?theme='+str.slice(0,-1)+(save?'&save='+new Date().getTime():''));
httpRequest.send(null);
document.body.setAttribute('onbeforeunload',save?"if(!document.cookie)return confirm('The color theme was not saved because you have cookies disabled\\nPress OK to leave or Cancel to stay')":"return confirm('You did not save your color scheme\\nPress OK to leave or Cancel to stay')");
return false;
}

function pre_scan(form,ias){
previewIMG.style.zIndex=-1;
previewIMG.nextSibling.removeAttribute('style');
Expand Down Expand Up @@ -151,13 +196,6 @@ function validateKey(ele,e,ias){
// anything else (mostly letters)
return false;
}
function changeColor(colors){
var O=getID('style');
var N=getID('style_new');
O.href=N.href;
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(data,ele){
generic=data.raw.slice(5);
scan=data.scan;
Expand All @@ -177,17 +215,6 @@ function lastScan(data,ele){
'<a href="#" onclick="return emailManager(\''+scan+'\');" class="tool icon email"><span class=\"tip\">Email</span></a> '+
'<span class="tool icon recent-off"><span class="tip">Last Scan (Disabled)</span></span></p>';
}
function encodeHTML(string){// http://stackoverflow.com/questions/24816/escaping-html-strings-with-jquery#answer-12034334
var entityMap={
"&": "&amp;",
"<": "&lt;",
">": "&gt;",
'"': '&quot;',
"'": '&#39;',
"/": '&#x2F;'
};
return String(string).replace(/[&<>"'\/]/g,function(s){return entityMap[s];});
}
function buildScannerOptions(json){
var str='',id,name,loc,sel=0;
for(var i=0,m=json.length;i<m;i++){
Expand Down Expand Up @@ -420,6 +447,7 @@ function rotateChange(ele){
return;
ias.setOptions({ "hide": true, "disable": true, "fadeSpeed": false, "rotating": true });
// If you hava a fear of numbers do not even try to read this function
clearTimeout(rotateTimer);
ele.style[prefix]='rotate('+val+'deg) scale('+
(function(deg,h,w){ // Credit: http://userscripts.org/topics/127570?page=1#posts-502266 (http://jsfiddle.net/swU6Z/)
// scale = sin(phi) / sin(phi + theta)
Expand All @@ -433,7 +461,7 @@ function rotateChange(ele){
return Math.abs(Math.sin(phi)/Math.sin(psi));
})(val,ele.offsetHeight,ele.offsetWidth)+')';
//printMsg('debug',encodeHTML(ele.style[prefix]),'center');
setTimeout(function(){// We can not leave it rotated, it brutally screws up cropping
rotateTimer=setTimeout(function(){// We can not leave it rotated, it brutally screws up cropping
ele.style[prefix]='';
setTimeout(function(){
ias.setOptions({ "hide": false, "disable": false, "fadeSpeed": 850, "rotating": false });
Expand Down Expand Up @@ -596,7 +624,7 @@ function PDF_popup(files){
populateSelect();
}
};
httpRequest.open('GET', 'config/paper.json');
httpRequest.open('GET', 'config/paper.json?nocache='+new Date().getTime());
httpRequest.send(null);
}
else
Expand Down
Loading

0 comments on commit 754f606

Please sign in to comment.