some refacoting...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-01-29 15:50:52 +04:00
parent d697e9a8f2
commit 1ccae2ba1e
2 changed files with 10 additions and 10 deletions

View File

@ -420,7 +420,7 @@ $(document).ready(function(){
Drag in full page view: <button id="DRAG_FULL_PAGE" onclick="toggleSetting(this)"></button> Drag in full page view: <button id="DRAG_FULL_PAGE" onclick="toggleSetting(this)"></button>
</div> </div>
<div> <div>
Enable different size pages (still flaky): <button id="_USE_REAL_SIZES" onclick="toggleSetting(this)"></button> Enable different size pages (still flaky): <button id="USE_REAL_PAGE_SIZES" onclick="toggleSetting(this)"></button>
</div> </div>
<p> <p>
NOTE: this is not an actual configuration page, just a live demo NOTE: this is not an actual configuration page, just a live demo
@ -439,14 +439,14 @@ $(document).ready(function(){
FIT_PAGE_TO_VIEW = $('#FIT_PAGE_TO_VIEW').text() == 'true' ? true : false FIT_PAGE_TO_VIEW = $('#FIT_PAGE_TO_VIEW').text() == 'true' ? true : false
ANIMATE_WINDOW_RESIZE = $('#ANIMATE_WINDOW_RESIZE').text() == 'true' ? true : false ANIMATE_WINDOW_RESIZE = $('#ANIMATE_WINDOW_RESIZE').text() == 'true' ? true : false
DRAG_FULL_PAGE = $('#DRAG_FULL_PAGE').text() == 'true' ? true : false DRAG_FULL_PAGE = $('#DRAG_FULL_PAGE').text() == 'true' ? true : false
_USE_REAL_SIZES = $('#_USE_REAL_SIZES').text() == 'true' ? true : false USE_REAL_PAGE_SIZES = $('#USE_REAL_PAGE_SIZES').text() == 'true' ? true : false
} }
function loadSettings(){ function loadSettings(){
$('#PAGES_IN_RIBBON').attr('value', PAGES_IN_RIBBON) $('#PAGES_IN_RIBBON').attr('value', PAGES_IN_RIBBON)
$('#FIT_PAGE_TO_VIEW').text(FIT_PAGE_TO_VIEW) $('#FIT_PAGE_TO_VIEW').text(FIT_PAGE_TO_VIEW)
$('#ANIMATE_WINDOW_RESIZE').text(ANIMATE_WINDOW_RESIZE) $('#ANIMATE_WINDOW_RESIZE').text(ANIMATE_WINDOW_RESIZE)
$('#DRAG_FULL_PAGE').text(DRAG_FULL_PAGE) $('#DRAG_FULL_PAGE').text(DRAG_FULL_PAGE)
$('#_USE_REAL_SIZES').text(_USE_REAL_SIZES) $('#USE_REAL_PAGE_SIZES').text(USE_REAL_PAGE_SIZES)
} }
function toggleSetting(obj){ function toggleSetting(obj){
obj = $(obj) obj = $(obj)

View File

@ -23,8 +23,8 @@ var DRAG_FULL_PAGE = true
// we get to the right from the no-resize element... // we get to the right from the no-resize element...
// ...think the reason is .no-resize page centering... // ...think the reason is .no-resize page centering...
// XXX still buggy on togglePageView to TN after funny sized pages... // XXX still buggy on togglePageView to TN after funny sized pages...
//var _USE_REAL_SIZES = true //var USE_REAL_PAGE_SIZES = true
var _USE_REAL_SIZES = false var USE_REAL_PAGE_SIZES = false
/*********************************************************************/ /*********************************************************************/
@ -203,7 +203,7 @@ function fitNPages(n, fit_to_content){
fit_to_content = true fit_to_content = true
} }
var view = $('.viewer') var view = $('.viewer')
if(_USE_REAL_SIZES){ if(USE_REAL_PAGE_SIZES){
var page = $('.page:not(.no-resize)') var page = $('.page:not(.no-resize)')
} else { } else {
var page = $('.page') var page = $('.page')
@ -223,7 +223,7 @@ function fitNPages(n, fit_to_content){
// this point, as we will start changing things next... // this point, as we will start changing things next...
if(fit_to_content){ if(fit_to_content){
if(_USE_REAL_SIZES){ if(USE_REAL_PAGE_SIZES){
page.width('auto') page.width('auto')
page.height('auto') page.height('auto')
} else { } else {
@ -266,7 +266,7 @@ function fitNPages(n, fit_to_content){
var offset = rW * getPageNumber()-1 var offset = rW * getPageNumber()-1
} else { } else {
// calculate the target offset... // calculate the target offset...
if(_USE_REAL_SIZES){ if(USE_REAL_PAGE_SIZES){
var rpages = $('.page:not(.no-resize), .current.page') var rpages = $('.page:not(.no-resize), .current.page')
} else { } else {
var rpages = page var rpages = page
@ -274,7 +274,7 @@ function fitNPages(n, fit_to_content){
var i = rpages.index(cur) var i = rpages.index(cur)
var offset = rW * i-1 var offset = rW * i-1
// now do the unresized elements... // now do the unresized elements...
if(_USE_REAL_SIZES){ if(USE_REAL_PAGE_SIZES){
$('.page.no-resize').width('auto') $('.page.no-resize').width('auto')
var nrpages = $('.page.no-resize, .current.page') var nrpages = $('.page.no-resize, .current.page')
i = nrpages.index(cur) i = nrpages.index(cur)
@ -285,7 +285,7 @@ function fitNPages(n, fit_to_content){
} }
} }
if(_USE_REAL_SIZES){ if(USE_REAL_PAGE_SIZES){
if(cur.hasClass('no-resize')){ if(cur.hasClass('no-resize')){
rW = cur.width() rW = cur.width()
} }