mirror of
https://github.com/flynx/PortableMag.git
synced 2025-10-29 11:10:08 +00:00
squashed several bugs + added more separation between data and chrome...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
fd9d9c8523
commit
8bbba6506b
@ -507,7 +507,7 @@ $(document).ready(function(){
|
|||||||
$('#DRAG_FULL_PAGE').text(DRAG_FULL_PAGE)
|
$('#DRAG_FULL_PAGE').text(DRAG_FULL_PAGE)
|
||||||
$('#USE_REAL_PAGE_SIZES').text(USE_REAL_PAGE_SIZES)
|
$('#USE_REAL_PAGE_SIZES').text(USE_REAL_PAGE_SIZES)
|
||||||
|
|
||||||
$('#FingersSupported').text($.fn.swipe.fingers.ALL)
|
//$('#FingersSupported').text($.fn.swipe.fingers.ALL)
|
||||||
var b = $('#BrowserInfo')
|
var b = $('#BrowserInfo')
|
||||||
$.each($.browser, function(i, e){$('<div>'+i+': '+e+'</div>').appendTo(b)})
|
$.each($.browser, function(i, e){$('<div>'+i+': '+e+'</div>').appendTo(b)})
|
||||||
}
|
}
|
||||||
|
|||||||
50
magazine.js
50
magazine.js
@ -894,7 +894,7 @@ function buildJSONState(export_bookmarks, export_position){
|
|||||||
}
|
}
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
function loadJSONState(data){
|
function loadJSONState(data, ignore_chrome){
|
||||||
function _build(block, elem){
|
function _build(block, elem){
|
||||||
if(elem.type == 'page'){
|
if(elem.type == 'page'){
|
||||||
createPage(elem.content)
|
createPage(elem.content)
|
||||||
@ -924,7 +924,11 @@ function loadJSONState(data){
|
|||||||
// remove service classes...
|
// remove service classes...
|
||||||
// XXX should we do this here, on build or in both places...
|
// XXX should we do this here, on build or in both places...
|
||||||
mag.children('.current.page').removeClass('current')
|
mag.children('.current.page').removeClass('current')
|
||||||
loadMagazine(mag, data.position, data.bookmarks)
|
loadMagazineData(mag)
|
||||||
|
|
||||||
|
if(!ignore_chrome){
|
||||||
|
loadMagazineChrome(data.position, data.bookmarks)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -983,15 +987,21 @@ function createArticle(template){
|
|||||||
return createEmptyArticle()
|
return createEmptyArticle()
|
||||||
.append(createCoverPage(template))
|
.append(createCoverPage(template))
|
||||||
}
|
}
|
||||||
function createPage(template){
|
function createPage(data){
|
||||||
return $('<div/>')
|
var page = $('<div/>')
|
||||||
.addClass('page')
|
.addClass('page')
|
||||||
.append($('<div/>')
|
|
||||||
|
var jdata = $(data)
|
||||||
|
if(jdata.hasClass('content')){
|
||||||
|
return page.append(jdata)
|
||||||
|
} else {
|
||||||
|
return page.append($('<div/>')
|
||||||
.addClass('content')
|
.addClass('content')
|
||||||
.html(template))
|
.html(data))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function createCoverPage(template){
|
function createCoverPage(data){
|
||||||
return createPage(template).addClass('cover')
|
return createPage(data).addClass('cover')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1000,16 +1010,26 @@ function createCoverPage(template){
|
|||||||
/************************************************ editor: magazine ***/
|
/************************************************ editor: magazine ***/
|
||||||
|
|
||||||
|
|
||||||
|
// NOTE: this will just load the data...
|
||||||
|
function loadMagazineData(mag){
|
||||||
|
removeMagazine()
|
||||||
|
mag.appendTo($('.aligner'))
|
||||||
|
return mag
|
||||||
|
}
|
||||||
|
function loadMagazineChrome(position, bookmarks){
|
||||||
|
setupBookmarkTouchZones()
|
||||||
|
setupNavigator()
|
||||||
|
// XXX is this the right place for this?
|
||||||
|
setCurrentPage(position)
|
||||||
|
loadBookmarks(bookmarks != null ? bookmarks : [])
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// NOTE: we do not need to create any event handlers here specifically
|
// NOTE: we do not need to create any event handlers here specifically
|
||||||
// as all events are ahndled by the viewer...
|
// as all events are ahndled by the viewer...
|
||||||
function loadMagazine(mag, position, bookmarks){
|
function loadMagazine(mag, position, bookmarks){
|
||||||
removeMagazine()
|
mag = loadMagazineData(mag)
|
||||||
mag.appendTo($('.aligner'))
|
loadMagazineChrome(position, bookmarks)
|
||||||
// XXX is this the right place for this?
|
|
||||||
setupBookmarkTouchZones()
|
|
||||||
setCurrentPage(position)
|
|
||||||
loadBookmarks(bookmarks != null ? bookmarks : [])
|
|
||||||
setupNavigator()
|
|
||||||
return mag
|
return mag
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user