summaryrefslogtreecommitdiffstats
path: root/template
diff options
context:
space:
mode:
Diffstat (limited to 'template')
-rw-r--r--template/standard/html/main.php2
-rw-r--r--template/standard/html/page/main.php18
-rw-r--r--template/standard/html/pagination.php18
-rw-r--r--template/standard/html/post/main.php18
-rw-r--r--template/standard/html/user/main.php18
-rw-r--r--template/standard/rsrc/main.js16
6 files changed, 30 insertions, 60 deletions
diff --git a/template/standard/html/main.php b/template/standard/html/main.php
index e6c0e10..c6cfa7d 100644
--- a/template/standard/html/main.php
+++ b/template/standard/html/main.php
@@ -47,6 +47,8 @@ $BLOGMETA_DESC = escapeHTML($BLOGMETA['DESC']);
<link rel="alternate" type="application/rss+xml" title="<?=$Language->text('feed_name_posts', $BLOGMETA_NAME)?>" href="<?=Application::getURL('feed/post/')?>" />
<link rel="alternate" type="application/rss+xml" title="<?=$Language->text('feed_name_pages', $BLOGMETA_NAME)?>" href="<?=Application::getURL('feed/page/')?>" />
+ <script defer src="<?=Application::getTemplateURL('rsrc/main.js')?>"></script>
+
<title><?="{$HEAD_NAME} | {$BLOGMETA_NAME} {$BLOGMETA_DESC}"?></title>
</head>
<body>
diff --git a/template/standard/html/page/main.php b/template/standard/html/page/main.php
index 8ac7977..621b939 100644
--- a/template/standard/html/page/main.php
+++ b/template/standard/html/page/main.php
@@ -20,27 +20,15 @@ $time = "<time datetime=\"{$PAGE['ATTR']['TIME_INSERT']}\" title=\"".parseDateti
<section id="site-navi">
<?php if($PAGE['PREV']): ?>
- <div><a href="<?=$PAGE['PREV']['URL']?>" title="<?=$Language->text('prev_page')?> »<?=escapeHTML($PAGE['PREV']['ATTR']['NAME'])?>«"><i class="fa fa-arrow-left"></i></a></div>
+ <div><a id="prev-site" href="<?=$PAGE['PREV']['URL']?>" title="<?=$Language->text('prev_page')?> »<?=escapeHTML($PAGE['PREV']['ATTR']['NAME'])?>«"><i class="fa fa-arrow-left"></i></a></div>
<?php else: ?>
<div><a class="disabled"><i class="fa fa-arrow-left"></i></a></div>
<?php endif; ?>
<?php if($PAGE['NEXT']): ?>
- <div><a href="<?=$PAGE['NEXT']['URL']?>" title="<?=$Language->text('next_page')?> »<?=escapeHTML($PAGE['NEXT']['ATTR']['NAME'])?>«"><i class="fa fa-arrow-right"></i></a></div>
+ <div><a id="next-site" href="<?=$PAGE['NEXT']['URL']?>" title="<?=$Language->text('next_page')?> »<?=escapeHTML($PAGE['NEXT']['ATTR']['NAME'])?>«"><i class="fa fa-arrow-right"></i></a></div>
<?php else: ?>
<div><a class="disabled"><i class="fa fa-arrow-right"></i></a></div>
<?php endif; ?>
-</section>
-
-<script>
- var prevPageURL = <?php echo json_encode($PAGE['PREV'] ? $PAGE['PREV']['URL'] : FALSE); ?>;
- var nextPageURL = <?php echo json_encode($PAGE['NEXT'] ? $PAGE['NEXT']['URL'] : FALSE); ?>;
-
- document.addEventListener('keyup', function(event) {
- if(!event.ctrlKey && !event.shiftKey) {
- (event.keyCode === 37 && prevPageURL) && (window.location.href = prevPageURL);
- (event.keyCode === 39 && nextPageURL) && (window.location.href = nextPageURL);
- }
- }, false)
-</script> \ No newline at end of file
+</section> \ No newline at end of file
diff --git a/template/standard/html/pagination.php b/template/standard/html/pagination.php
index 221530e..7a9279a 100644
--- a/template/standard/html/pagination.php
+++ b/template/standard/html/pagination.php
@@ -9,7 +9,7 @@
?>
<section id="site-navi">
<?php if($THIS > 1): ?>
- <div><a href="<?=sprintf($HREF, $THIS-1)?>"><i class="fa fa-arrow-left"></i></a></div>
+ <div><a id="prev-site" href="<?=sprintf($HREF, $THIS-1)?>"><i class="fa fa-arrow-left"></i></a></div>
<?php else: ?>
<div><a class="disabled"><i class="fa fa-arrow-left"></i></a></div>
<?php endif; ?>
@@ -35,20 +35,8 @@
</section>
<?php if($THIS < $LAST): ?>
- <div><a href="<?=sprintf($HREF, $THIS+1)?>"><i class="fa fa-arrow-right"></i></a></div>
+ <div><a id="next-site" href="<?=sprintf($HREF, $THIS+1)?>"><i class="fa fa-arrow-right"></i></a></div>
<?php else: ?>
<div><a class="disabled"><i class="fa fa-arrow-right"></i></a></div>
<?php endif; ?>
-</section>
-
-<script>
- var prevPageURL = <?php echo json_encode($THIS > 1 ? sprintf($HREF, $THIS-1) : FALSE); ?>;
- var nextPageURL = <?php echo json_encode($THIS < $LAST ? sprintf($HREF, $THIS+1) : FALSE); ?>;
-
- document.addEventListener('keyup', function(event) {
- if(!event.ctrlKey && !event.shiftKey) {
- (event.keyCode === 37 && prevPageURL) && (window.location.href = prevPageURL);
- (event.keyCode === 39 && nextPageURL) && (window.location.href = nextPageURL);
- }
- }, false)
-</script> \ No newline at end of file
+</section> \ No newline at end of file
diff --git a/template/standard/html/post/main.php b/template/standard/html/post/main.php
index 3f50c76..5104ba9 100644
--- a/template/standard/html/post/main.php
+++ b/template/standard/html/post/main.php
@@ -20,27 +20,15 @@ $time = "<time datetime=\"{$POST['ATTR']['TIME_INSERT']}\" title=\"".parseDateti
<section id="site-navi">
<?php if($POST['PREV']): ?>
- <div><a href="<?=$POST['PREV']['URL']?>" title="<?=$Language->text('prev_post')?> »<?=escapeHTML($POST['PREV']['ATTR']['NAME'])?>«"><i class="fa fa-arrow-left"></i></a></div>
+ <div><a id="prev-site" href="<?=$POST['PREV']['URL']?>" title="<?=$Language->text('prev_post')?> »<?=escapeHTML($POST['PREV']['ATTR']['NAME'])?>«"><i class="fa fa-arrow-left"></i></a></div>
<?php else: ?>
<div><a class="disabled"><i class="fa fa-arrow-left"></i></a></div>
<?php endif; ?>
<?php if($POST['NEXT']): ?>
- <div><a href="<?=$POST['NEXT']['URL']?>" title="<?=$Language->text('next_post')?> »<?=escapeHTML($POST['NEXT']['ATTR']['NAME'])?>«"><i class="fa fa-arrow-right"></i></a></div>
+ <div><a id="next-site" href="<?=$POST['NEXT']['URL']?>" title="<?=$Language->text('next_post')?> »<?=escapeHTML($POST['NEXT']['ATTR']['NAME'])?>«"><i class="fa fa-arrow-right"></i></a></div>
<?php else: ?>
<div><a class="disabled"><i class="fa fa-arrow-right"></i></a></div>
<?php endif; ?>
-</section>
-
-<script>
- var prevPageURL = <?php echo json_encode($POST['PREV'] ? $POST['PREV']['URL'] : FALSE); ?>;
- var nextPageURL = <?php echo json_encode($POST['NEXT'] ? $POST['NEXT']['URL'] : FALSE); ?>;
-
- document.addEventListener('keyup', function(event) {
- if(!event.ctrlKey && !event.shiftKey) {
- (event.keyCode === 37 && prevPageURL) && (window.location.href = prevPageURL);
- (event.keyCode === 39 && nextPageURL) && (window.location.href = nextPageURL);
- }
- }, false)
-</script> \ No newline at end of file
+</section> \ No newline at end of file
diff --git a/template/standard/html/user/main.php b/template/standard/html/user/main.php
index d3766dc..c2a5346 100644
--- a/template/standard/html/user/main.php
+++ b/template/standard/html/user/main.php
@@ -17,27 +17,15 @@
<section id="site-navi">
<?php if($USER['PREV']): ?>
- <div><a href="<?=$USER['PREV']['URL']?>" title="<?=$Language->text('prev_user')?> »<?=escapeHTML($USER['PREV']['ATTR']['NAME'])?>«"><i class="fa fa-arrow-left"></i></a></div>
+ <div><a id="prev-site" href="<?=$USER['PREV']['URL']?>" title="<?=$Language->text('prev_user')?> »<?=escapeHTML($USER['PREV']['ATTR']['NAME'])?>«"><i class="fa fa-arrow-left"></i></a></div>
<?php else: ?>
<div><a class="disabled"><i class="fa fa-arrow-left"></i></a></div>
<?php endif; ?>
<?php if($USER['NEXT']): ?>
- <div><a href="<?=$USER['NEXT']['URL']?>" title="<?=$Language->text('next_user')?> »<?=escapeHTML($USER['NEXT']['ATTR']['NAME'])?>«"><i class="fa fa-arrow-right"></i></a></div>
+ <div><a id="next-site" href="<?=$USER['NEXT']['URL']?>" title="<?=$Language->text('next_user')?> »<?=escapeHTML($USER['NEXT']['ATTR']['NAME'])?>«"><i class="fa fa-arrow-right"></i></a></div>
<?php else: ?>
<div><a class="disabled"><i class="fa fa-arrow-right"></i></a></div>
<?php endif; ?>
-</section>
-
-<script>
- var prevPageURL = <?php echo json_encode($USER['PREV'] ? $USER['PREV']['URL'] : FALSE); ?>;
- var nextPageURL = <?php echo json_encode($USER['NEXT'] ? $USER['NEXT']['URL'] : FALSE); ?>;
-
- document.addEventListener('keyup', function(event) {
- if(!event.ctrlKey && !event.shiftKey) {
- (event.keyCode === 37 && prevPageURL) && (window.location.href = prevPageURL);
- (event.keyCode === 39 && nextPageURL) && (window.location.href = nextPageURL);
- }
- }, false)
-</script> \ No newline at end of file
+</section> \ No newline at end of file
diff --git a/template/standard/rsrc/main.js b/template/standard/rsrc/main.js
new file mode 100644
index 0000000..4a336e2
--- /dev/null
+++ b/template/standard/rsrc/main.js
@@ -0,0 +1,16 @@
+
+//==============================================================================
+// Elements which contains the location of the previous and next site
+//==============================================================================
+var prev = document.getElementById("prev-site");
+var next = document.getElementById("next-site");
+
+//==============================================================================
+// Handle arrow keys and change the location to the desired direction
+//==============================================================================
+document.addEventListener("keyup", function(event) {
+ if(!event.ctrlKey && !event.shiftKey) {
+ (event.keyCode === 37 && prev) && (window.location.href = prev.getAttribute("href"));
+ (event.keyCode === 39 && next) && (window.location.href = next.getAttribute("href"));
+ }
+}, false); \ No newline at end of file