diff --git a/TODO.otl b/TODO.otl index 903840b..b77c775 100755 --- a/TODO.otl +++ b/TODO.otl @@ -1,12 +1,14 @@ -[_] 37% Priority work +[_] 38% Priority work [_] 0% TouchSwipe issues... [_] BUG: swipe-back does not cancel a swipe... (TouchSwipe) | ...unless the finger is return to within the threshold of the | touchdown point. [_] BUG: no drag threshold on excludedElements (TouchSwipe) | stalled... - [_] 69% general todo - [_] JSON: store format version in the JSON file... + [_] 75% general todo + [_] 0% add two main page themes: + [_] light + [_] dark [_] JSON: add page URLs as an alternative to direct content... | use AJAX to get remote pages and their nested content [_] JSON: add metadata section that can be downloaded separately... @@ -40,12 +42,9 @@ [_] add default empty state to viewer, magazine and article... | use it to trigger a "New Magazine", "New Cover"/"New Article" and | "New Cover"/"New Page" actions... - [_] Editor: decide weather to make the editor toolbar oriented or floating bars around context... [_] Editor: make the editor switchable... | if it is imported it should be able to switch on and off on demand... [_] Editor: make empty magazine and article visible in the editor... - [_] add in-page live templates... - | elements that will get generated content, like page numbers etc. [_] 0% populate an example issue [_] template photo page [_] template 3x3 grid @@ -57,6 +56,10 @@ [_] BUG: href to existing anchors will mess up layout... | need to find out how can we disable anchor links from actually | going to the anchor... + [X] Editor: decide weather to make the editor toolbar oriented or floating bars around context... + [X] add in-page live templates... + | elements that will get generated content, like page numbers etc. + [X] JSON: store format version in the JSON file... [X] MINOR BUG: on loading a mag from JSON page widths get messed up... | ...in cases where content elements have explicit widths pages do | not get stretched, this can be fixed by simply updating the view diff --git a/editor.html b/editor.html index da3e774..2c16445 100755 --- a/editor.html +++ b/editor.html @@ -121,8 +121,7 @@ $(document).ready(function(){ // load state and setup everything that depends on it... loadState() - setupNavigator() - setupBookmarkTouchZones() + loadMagazineChrome() // set default view... togglePageView('on') diff --git a/index.html b/index.html index c33ab6e..e96e7f0 100755 --- a/index.html +++ b/index.html @@ -105,9 +105,9 @@ $(document).ready(function(){ // load state and setup everything that depends on it... + // XXX load the data with loadJSON() loadState() - setupNavigator() - setupBookmarkTouchZones() + loadMagazineChrome() // set default view... togglePageView('on') @@ -153,7 +153,7 @@ $(document).ready(function(){
- +
@@ -224,7 +224,7 @@ $(document).ready(function(){
-
+
+
@@ -277,9 +279,11 @@ $(document).ready(function(){ -
+ + +
[PAGE NUMBER]
@@ -329,7 +333,7 @@ $(document).ready(function(){ Go back
Go forward
-
+ @@ -338,6 +342,8 @@ $(document).ready(function(){

This is an example layer

click or tap to hide
+ +
[PAGE NUMBER]
@@ -402,11 +408,15 @@ $(document).ready(function(){ + +
[PAGE NUMBER]

The Page content has a fixed size...

+ +
[PAGE NUMBER]
@@ -427,6 +437,8 @@ $(document).ready(function(){

NOTE: by default the overflow is visible (see next page), so be carefull.

+ +
[PAGE NUMBER]
@@ -442,6 +454,8 @@ $(document).ready(function(){ You can see this by resizing the page in browser or rotating the device.

+ +
[PAGE NUMBER]
@@ -450,6 +464,8 @@ $(document).ready(function(){

Page Templates

home
+ +
[PAGE NUMBER]
@@ -462,26 +478,36 @@ $(document).ready(function(){
Column 2
+ +
[PAGE NUMBER]
Page + +
[PAGE NUMBER]
Page + +
[PAGE NUMBER]
Page + +
[PAGE NUMBER]
Page + +
[PAGE NUMBER]
@@ -490,18 +516,24 @@ $(document).ready(function(){

Article Cover

home
+ +
[PAGE NUMBER]
Page + +
[PAGE NUMBER]
Page
home
+ +
[PAGE NUMBER]
diff --git a/magazine.css b/magazine.css index e969134..f72f895 100755 --- a/magazine.css +++ b/magazine.css @@ -449,6 +449,17 @@ body { /******************************************************* templates ***/ + +.page-number-text { + position: absolute; + bottom: 10px; + right: 10px; + text-align: right; + + color: gray; +} + + /* XXX split these into seporate files... */ .caption { display: block; diff --git a/magazine.js b/magazine.js index 9a7380b..472c7a0 100755 --- a/magazine.js +++ b/magazine.js @@ -947,6 +947,9 @@ function resetState(){ * **********************************************************************/ +var JSON_FORMAT_VERSION = 0.1 + + // there are two type of metadata handlers: // - 'as-is', this is a trivial read and write value // - explicit reader/writer, this will convert the data from html to JSON @@ -1000,8 +1003,6 @@ function writeMetadata(elem, res, metadata){ return elem } -var JSON_VERSION = 0.1 - function buildJSON(export_bookmarks, export_position){ function _getContent(_, elem){ elem = $(elem) @@ -1042,7 +1043,7 @@ function buildJSON(export_bookmarks, export_position){ res.pages = $('.magazine > .page, .magazine > .article').map(_getContent).toArray(), res.bookmarks = export_bookmarks ? buildBookmarkList() : [] - res['format-version'] = JSON_VERSION + res['format-version'] = JSON_FORMAT_VERSION if(export_position){ res.position = getPageNumber() @@ -1090,7 +1091,7 @@ function loadJSON(data, ignore_chrome){ } // XXX check version... - var version = data['json-version'] + var version = data['format-version'] if(version != JSON_VERSION){ console.warn('WARNING: JSON Format Version Mismatch.') } @@ -1169,6 +1170,34 @@ function createCoverPage(data){ +/*********************************************** editor: templates ***/ + +var MagazineTemplates = { + + // setup titles... + '.magazine-title-text': function(elem){ + elem.text($('.magazine').attr('title') + || $('.magazine').attr('name') + || 'PortableMag') + }, + + // setup page numbers... + '.page-number-text': function(elem){ + elem.each(function(_, e){ + var e = $(e) + e.text(getPageNumber(e.parents('.page'))) + }) + } +} + +// XXX call this on page edits... +function runMagazineTemplates(){ + for(var tpl in MagazineTemplates){ + MagazineTemplates[tpl]($(tpl)) + } +} + + /************************************************ editor: magazine ***/ // load the data... @@ -1181,13 +1210,17 @@ function loadMagazineData(mag){ function loadMagazineChrome(position, bookmarks){ setupBookmarkTouchZones() setupNavigator() - setCurrentPage(position) - loadBookmarks(bookmarks != null ? bookmarks : []) + if(position){ + setCurrentPage(position) + } + if(bookmarks){ + loadBookmarks(bookmarks != null ? bookmarks : []) + } + runMagazineTemplates() // XXX do we need to cover this with a splash??? updateView() } - // NOTE: we do not need to create any event handlers here specifically // as all events are ahndled by the viewer... function loadMagazine(mag, position, bookmarks){