Merge pull request #99 from jonathanmtran/be1fbd11cefe61170084b89aafa0a5311b258abf
Arrow Navigation
This commit is contained in:
commit
8c0ec05c1e
26
3.0/modules/arrow_nav/helpers/arrow_nav_theme.php
Normal file
26
3.0/modules/arrow_nav/helpers/arrow_nav_theme.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php defined("SYSPATH") or die("No direct script access.");
|
||||
/**
|
||||
* Gallery - a web based photo album viewer and editor
|
||||
* Copyright (C) 2000-2011 Bharat Mediratta
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or (at
|
||||
* your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
class arrow_nav_theme {
|
||||
function head($theme) {
|
||||
if($theme->page_subtype == "photo") {
|
||||
return $theme->script("arrow_nav.js");
|
||||
}
|
||||
}
|
||||
}
|
17
3.0/modules/arrow_nav/js/arrow_nav.js
Normal file
17
3.0/modules/arrow_nav/js/arrow_nav.js
Normal file
@ -0,0 +1,17 @@
|
||||
$(document).keydown(function(e) {
|
||||
var url;
|
||||
|
||||
if (e.keyCode == 37) {
|
||||
// Left key pressed
|
||||
url = $('.g-paginator .g-first a').attr("href");
|
||||
// Right key pressed
|
||||
} else if (e.keyCode == 39) {
|
||||
url = $('.g-paginator .g-text-right a').attr("href");
|
||||
}
|
||||
|
||||
if(url != undefined) {
|
||||
window.location = url;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
3
3.0/modules/arrow_nav/module.info
Normal file
3
3.0/modules/arrow_nav/module.info
Normal file
@ -0,0 +1,3 @@
|
||||
name = "Arrow Navigation"
|
||||
description = "Use the left/right arrow keys to go to the previous/next photo"
|
||||
version = 1
|
Reference in New Issue
Block a user