From fc3ede4f5a3b26b0645e8979eb36be0ad0c6f049 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Thu, 7 Mar 2013 04:12:19 +0400 Subject: [PATCH] added page cloning to the editor... Signed-off-by: Alex A. Naanou --- TODO.otl | 2 +- editor.js | 39 +++++++++++++++++++++++++++++++++------ 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/TODO.otl b/TODO.otl index 5f4791f..daff99f 100755 --- a/TODO.otl +++ b/TODO.otl @@ -4,7 +4,7 @@ [_] change image [_] add page via template [_] load/save from JSON - [_] basic instructions + [_] basic instructions/docs... [_] 37% Version 1.0 checklist (migration to layout.html) [X] page scaling for full page view [X] top/bottom toolbars diff --git a/editor.js b/editor.js index 7db4e2e..a1d5ea4 100755 --- a/editor.js +++ b/editor.js @@ -232,6 +232,7 @@ function setupEditorToolbars(){ .appendTo(indicator) $('') + .attr('title', 'Remove') .appendTo(indicator) .click(function(){ setTransitionDuration($('.magazine'), 0) @@ -242,14 +243,27 @@ function setupEditorToolbars(){ }) $('') + .attr('title', 'Move (w. Shift - Clone)') .appendTo(right_bar) .click(function(){ - shiftPageRight() - runMagazineTemplates() - + // if shift is pressed duplicate current page... + if(event.shiftKey){ + var n = getPageNumber() + setTransitionDuration($('.magazine'), 0) + $('.current.page') + .clone(true, true) + .removeClass('current') + .insertAfter($('.current.page')) + setCurrentPage(n) + // simply move... + } else { + shiftPageRight() + runMagazineTemplates() + } return false }) $('') + .attr('title', 'New page') .appendTo(right_bar) .click(function(){ @@ -257,14 +271,27 @@ function setupEditorToolbars(){ }) $('') + .attr('title', 'Move (w. Shift - Clone)') .appendTo(left_bar) .click(function(){ - shiftPageLeft() - runMagazineTemplates() - + // if shift is pressed duplicate current page... + if(event.shiftKey){ + var n = getPageNumber() + setTransitionDuration($('.magazine'), 0) + $('.current.page') + .clone(true, true) + .removeClass('current') + .insertBefore($('.current.page')) + setCurrentPage(n+1) + // simply move... + } else { + shiftPageLeft() + runMagazineTemplates() + } return false }) $('') + .attr('title', 'New page') .appendTo(left_bar) .click(function(){