new keyboard shortcuts added
This commit is contained in:
parent
3b89cea776
commit
467f2dbdad
102
picturelicious/media/shortcuts.js.php
Normal file → Executable file
102
picturelicious/media/shortcuts.js.php
Normal file → Executable file
|
@ -3,15 +3,99 @@ header( 'Content-type: text/javascript; charset=utf-8' );
|
||||||
?>
|
?>
|
||||||
|
|
||||||
document.onkeydown=function(e){
|
document.onkeydown=function(e){
|
||||||
var keyCode = e.keyCode || e.which;
|
var pressedKey = e.keyCode || e.which;
|
||||||
var arrow = {left: 37, up: 38, right: 39, down: 40 };
|
var keyCodes = { left: 37, // navigate forward
|
||||||
|
up: 38, //
|
||||||
|
right: 39, // navigate back
|
||||||
|
down: 40, //
|
||||||
|
one: 49, // vote 1* // TODO
|
||||||
|
two: 50, // vote 2* // TODO
|
||||||
|
three: 51, // vote 3* // TODO
|
||||||
|
four: 52, // vote 4* // TODO
|
||||||
|
five: 53, // vote 5* // TODO
|
||||||
|
num1: 97, // vote 1* // TODO
|
||||||
|
num2: 98, // vote 2* // TODO
|
||||||
|
num3: 99, // vote 3* // TODO
|
||||||
|
num4: 100, // vote 4* // TODO
|
||||||
|
num5: 101, // vote 5* // TODO
|
||||||
|
plus: 107, // toggle image display size
|
||||||
|
minus: 109, // toggle image display size
|
||||||
|
c: 67, // focus cursor into comments field
|
||||||
|
f: 70, // toggle image display size
|
||||||
|
h: 72, // navigate to main page
|
||||||
|
l: 76, // login
|
||||||
|
r: 82, // load random image // TODO
|
||||||
|
s: 83, // focus cursor into search field
|
||||||
|
u: 85 // navigate to upload form
|
||||||
|
};
|
||||||
|
|
||||||
switch(keyCode){
|
var focusedElement = document.activeElement;
|
||||||
case arrow.left:
|
console.log("focused: " + focusedElement.id);
|
||||||
document.getElementById('prevBar').click();
|
|
||||||
break;
|
if( focusedElement.id != "commentContent" && focusedElement.id != "q" )
|
||||||
case arrow.right:
|
{
|
||||||
document.getElementById('nextBar').click();
|
switch(pressedKey){
|
||||||
break;
|
case keyCodes.left:
|
||||||
|
document.getElementById('prevBar').click();
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case keyCodes.right:
|
||||||
|
document.getElementById('nextBar').click();
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case keyCodes.one:
|
||||||
|
case keyCodes.num1:
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case keyCodes.two:
|
||||||
|
case keyCodes.num2:
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case keyCodes.three:
|
||||||
|
case keyCodes.num3:
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case keyCodes.four:
|
||||||
|
case keyCodes.num4:
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case keyCodes.five:
|
||||||
|
case keyCodes.num5:
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case keyCodes.plus:
|
||||||
|
case keyCodes.minus:
|
||||||
|
case keyCodes.f:
|
||||||
|
swap(document.getElementById('image'), 'scaled', 'full')
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case keyCodes.c:
|
||||||
|
document.getElementById('commentContent').focus();
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case keyCodes.h:
|
||||||
|
document.getElementById('logo').click();
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case keyCodes.l:
|
||||||
|
document.getElementById('login').click();
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case keyCodes.r:
|
||||||
|
// TODO
|
||||||
|
break;
|
||||||
|
case keyCodes.s:
|
||||||
|
document.getElementById('q').focus();
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
case keyCodes.u:
|
||||||
|
document.getElementById('upload').click();
|
||||||
|
return false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
4
picturelicious/templates/header.tpl.php
Normal file → Executable file
4
picturelicious/templates/header.tpl.php
Normal file → Executable file
|
@ -31,7 +31,7 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="menuItems">
|
<div class="menuItems">
|
||||||
<a href="<?php echo Config::$absolutePath; ?>upload">Upload</a>
|
<a href="<?php echo Config::$absolutePath; ?>upload" id="upload">Upload</a>
|
||||||
<a href="<?php echo Config::$absolutePath; ?>users">Users</a>
|
<a href="<?php echo Config::$absolutePath; ?>users">Users</a>
|
||||||
<a href="<?php echo Config::$absolutePath; ?>quicktags">Quick-Tagging</a>
|
<a href="<?php echo Config::$absolutePath; ?>quicktags">Quick-Tagging</a>
|
||||||
<a href="<?php echo Config::$absolutePath; ?>static/bookmarklet">Bookmarklet</a>
|
<a href="<?php echo Config::$absolutePath; ?>static/bookmarklet">Bookmarklet</a>
|
||||||
|
@ -48,7 +48,7 @@
|
||||||
<a href="<?php echo Config::$absolutePath; ?>logout">logout</a>)
|
<a href="<?php echo Config::$absolutePath; ?>logout">logout</a>)
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
Hello Anonymous
|
Hello Anonymous
|
||||||
(<a href="<?php echo Config::$absolutePath; ?>login">login</a> /
|
(<a href="<?php echo Config::$absolutePath; ?>login" id="login">login</a> /
|
||||||
<a href="<?php echo Config::$absolutePath; ?>register">register</a>)
|
<a href="<?php echo Config::$absolutePath; ?>register">register</a>)
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php if( $user->admin ) { ?>
|
<?php if( $user->admin ) { ?>
|
||||||
|
|
2
picturelicious/templates/view.tpl.php
Normal file → Executable file
2
picturelicious/templates/view.tpl.php
Normal file → Executable file
|
@ -124,7 +124,7 @@
|
||||||
<?php if( $user->id ) { ?>
|
<?php if( $user->id ) { ?>
|
||||||
<form method="post" class="addComment" action="<?php echo Config::$absolutePath.$iv->basePath.'view/'.$iv->image['keyword']; ?>">
|
<form method="post" class="addComment" action="<?php echo Config::$absolutePath.$iv->basePath.'view/'.$iv->image['keyword']; ?>">
|
||||||
<div>
|
<div>
|
||||||
<textarea name="content" rows="3" cols="60"></textarea>
|
<textarea name="content" rows="3" cols="60" id="commentContent"></textarea>
|
||||||
<input class="submit" type="submit" name="addComment" value="Submit Comment"/>
|
<input class="submit" type="submit" name="addComment" value="Submit Comment"/>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user