mirror of
https://github.com/flynx/PortableMag.git
synced 2025-10-29 11:10:08 +00:00
I do not know why but I added a page index template...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
d1a8745c1c
commit
ad1dcf7616
11
index.html
11
index.html
@ -463,7 +463,16 @@ $(document).ready(function(){
|
|||||||
<div class="cover page">
|
<div class="cover page">
|
||||||
<div class="content" name="ArticleAnchorExample">
|
<div class="content" name="ArticleAnchorExample">
|
||||||
<h1>Page Templates</h1>
|
<h1>Page Templates</h1>
|
||||||
<a href="#home">home</a><br>
|
|
||||||
|
<p>
|
||||||
|
This page contains several examples of template fields,
|
||||||
|
the first one is the simplest, the magazine name
|
||||||
|
(<span class="magazine-title-text">[MAGAZINE NAME]</span>),
|
||||||
|
then we'll have the index (see next) and in the bottom-right
|
||||||
|
corner is the page number...
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<div class="article-index">[ARTICLE INDEX]</div>
|
||||||
|
|
||||||
<div class="page-number-text">[PAGE NUMBER]</div>
|
<div class="page-number-text">[PAGE NUMBER]</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
31
magazine.js
31
magazine.js
@ -1181,6 +1181,37 @@ var MagazineTemplates = {
|
|||||||
|| 'PortableMag')
|
|| 'PortableMag')
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// index...
|
||||||
|
'.article-index': function(elem){
|
||||||
|
var list = $('<ul/>')
|
||||||
|
var mag = $('.magazine')
|
||||||
|
// get the articles...
|
||||||
|
$('.magazine .article .cover h1').each(function(i, e){
|
||||||
|
e = $(e)
|
||||||
|
var lnk = $('<a/>')
|
||||||
|
.attr('href', '#' + getPageNumber(e.parents('.page').first()))
|
||||||
|
// XXX is this the right way to go?
|
||||||
|
.text(e.text() || 'No title')
|
||||||
|
|
||||||
|
list.append(
|
||||||
|
$('<li/>')
|
||||||
|
.append(lnk))
|
||||||
|
})
|
||||||
|
var root = $('<ul/>')
|
||||||
|
.append($('<li/>')
|
||||||
|
.append($('<a/>')
|
||||||
|
.attr('href', '#' + getPageNumber($('.magazine > .cover').first()))
|
||||||
|
// XXX is this the right way to go?
|
||||||
|
.text(mag.attr('title')
|
||||||
|
|| mag.attr('name')
|
||||||
|
|| 'Magazine')))
|
||||||
|
root.append(list)
|
||||||
|
elem
|
||||||
|
.html('')
|
||||||
|
// cover...
|
||||||
|
.append(root)
|
||||||
|
},
|
||||||
|
|
||||||
// setup page numbers...
|
// setup page numbers...
|
||||||
'.page-number-text': function(elem){
|
'.page-number-text': function(elem){
|
||||||
elem.each(function(_, e){
|
elem.each(function(_, e){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user