diff --git a/index.html b/index.html index e207fbf..f728ee9 100755 --- a/index.html +++ b/index.html @@ -208,43 +208,49 @@ // XXX need better separation between full screen and ribbon modes... function setupEditor(){ - var indicator = $('
') - .appendTo($('.magazine')) + function setupEditorToolbars(){ + var indicator = $('') + .appendTo($('.magazine')) - // the toolbars... - var left_bar = $('') - .appendTo(indicator) - var right_bar = $('') + // the toolbars... + var left_bar = $('') + .appendTo(indicator) + var right_bar = $('') + .appendTo(indicator) + + $('') .appendTo(indicator) + .click(function(){ + setTransitionDuration($('.magazine'), 0) + removePage() + }) - $('') - .appendTo(indicator) - .click(function(){ - setTransitionDuration($('.magazine'), 0) - removePage() - }) + $('') + .appendTo(right_bar) + .click(function(){ + shiftPageRight() + }) + $('') + .appendTo(right_bar) + .click(function(){ + }) - $('') - .appendTo(right_bar) - .click(function(){ - shiftPageRight() - }) - $('') - .appendTo(right_bar) - .click(function(){ - }) - - $('') - .appendTo(left_bar) - .click(function(){ - shiftPageLeft() - }) - $('') - .appendTo(left_bar) - .click(function(){ - }) + $('') + .appendTo(left_bar) + .click(function(){ + shiftPageLeft() + }) + $('') + .appendTo(left_bar) + .click(function(){ + }) + } + function clearEdiorToolbars(){ + var indicator = $('.current-page-indicator').remove() + } + // general editor mode... window.toggleEditor = createCSSClassToggler( '.chrome', 'editor', @@ -262,10 +268,16 @@ function setupEditor(){ } setCurrentPage($('.current.page')) }) - - var toggleInlineEditor = createCSSClassToggler( + // inline editor switcher... + window.toggleInlineEditor = createCSSClassToggler( '.chrome', 'inline-edior', + function(action){ + // prevent switching on while not in editor mode... + if(toggleEditor('?') == 'off' && action == 'on'){ + return false + } + }, function(action){ if(action == 'on'){ MagazineScroller.stop() @@ -278,6 +290,7 @@ function setupEditor(){ } }) + // editable focus... $('[contenteditable]') .on('focus', function(){ if(toggleInlineEditor('?') == 'off'){ @@ -290,9 +303,9 @@ function setupEditor(){ toggleInlineEditorMode('off') }) - // move the page indicator... - // NOTE: this is to be used for page-specific toolbars etc. $('.viewer') + // move the page indicator... + // NOTE: this is to be used for page-specific toolbars etc. .on('pageChanged', function(){ var cur = $('.current.page') var indicator = $('.current-page-indicator') @@ -307,7 +320,7 @@ function setupEditor(){ top: 0, }) }) - + // switch between editor modes... .on('fullScreenMode', function(){ $(':focus').blur() if(toggleEditor('?') == 'on'){ @@ -320,6 +333,8 @@ function setupEditor(){ toggleInlineEditor('off') } }) + + setupEditorToolbars() }