From 7d5a1c20e8bf245635880f7e0d6c3186cd92d007 Mon Sep 17 00:00:00 2001 From: Thomas Bruederli <thomas@roundcube.net> Date: Thu, 18 Sep 2014 12:25:57 -0400 Subject: [PATCH] Fix splitter code to properly work with 1px size borders --- skins/larry/ui.js | 32 +++++++++++++++----------------- 1 files changed, 15 insertions(+), 17 deletions(-) diff --git a/skins/larry/ui.js b/skins/larry/ui.js index 47a6897..3cb75b0 100644 --- a/skins/larry/ui.js +++ b/skins/larry/ui.js @@ -76,7 +76,7 @@ function get_pref(key) { if (!prefs) { - prefs = window.localStorage ? rcmail.local_storage_get_item('prefs.larry', {}) : {}; + prefs = rcmail.local_storage_get_item('prefs.larry', {}); } // fall-back to cookies @@ -85,9 +85,8 @@ if (cookie != null) { prefs[key] = cookie; - // copy value to local storage and remove cookie - if (window.localStorage) { - rcmail.local_storage_set_item('prefs.larry', prefs); + // copy value to local storage and remove cookie (if localStorage is supported) + if (rcmail.local_storage_set_item('prefs.larry', prefs)) { rcmail.set_cookie(key, cookie, new Date()); // expire cookie } } @@ -103,11 +102,8 @@ { prefs[key] = val; - // write prefs to local storage - if (window.localStorage) { - rcmail.local_storage_set_item('prefs.larry', prefs); - } - else { + // write prefs to local storage (if supported) + if (!rcmail.local_storage_set_item('prefs.larry', prefs)) { // store value in cookie var exp = new Date(); exp.setYear(exp.getFullYear() + 1); @@ -472,7 +468,8 @@ minHeight: 90 }).show(); - me.message_timer = window.setTimeout(dialog_close, p.timeout); + if (p.timeout > 0) + me.message_timer = window.setTimeout(dialog_close, p.timeout); } } @@ -539,7 +536,8 @@ // $('#composeformbuttons')[(btns ? 'show' : 'hide')](); var abooks = $('#directorylist'); - $('#compose-contacts .scroller').css('top', abooks.position().top + abooks.outerHeight()); + if (abooks.length) + $('#compose-contacts .scroller').css('top', abooks.position().top + abooks.outerHeight()); } @@ -1262,8 +1260,8 @@ this.resize = function() { if (this.horizontal) { - this.p1.css('height', Math.floor(this.pos - this.p1pos.top - this.halfsize) + 'px'); - this.p2.css('top', Math.ceil(this.pos + this.halfsize + 2) + 'px'); + this.p1.css('height', Math.floor(this.pos - this.p1pos.top - Math.floor(this.halfsize)) + 'px'); + this.p2.css('top', Math.ceil(this.pos + Math.ceil(this.halfsize) + 2) + 'px'); this.handle.css('top', Math.round(this.pos - this.halfsize + this.offset)+'px'); if (bw.ie) { var new_height = parseInt(this.p2.parent().outerHeight(), 10) - parseInt(this.p2.css('top'), 10) - (bw.ie8 ? 2 : 0); @@ -1271,8 +1269,8 @@ } } else { - this.p1.css('width', Math.floor(this.pos - this.p1pos.left - this.halfsize) + 'px'); - this.p2.css('left', Math.ceil(this.pos + this.halfsize) + 'px'); + this.p1.css('width', Math.floor(this.pos - this.p1pos.left - Math.floor(this.halfsize)) + 'px'); + this.p2.css('left', Math.ceil(this.pos + Math.ceil(this.halfsize)) + 'px'); this.handle.css('left', Math.round(this.pos - this.halfsize + this.offset + 3)+'px'); if (bw.ie) { var new_width = parseInt(this.p2.parent().outerWidth(), 10) - parseInt(this.p2.css('left'), 10) ; @@ -1355,13 +1353,13 @@ if (me.horizontal) { if (((pos.y - me.halfsize) > me.p1pos.top) && ((pos.y + me.halfsize) < (me.p2pos.top + me.p2.outerHeight()))) { - me.pos = Math.max(me.min, pos.y - me.offset); + me.pos = Math.max(me.min, pos.y - Math.max(0, me.offset)); me.resize(); } } else { if (((pos.x - me.halfsize) > me.p1pos.left) && ((pos.x + me.halfsize) < (me.p2pos.left + me.p2.outerWidth()))) { - me.pos = Math.max(me.min, pos.x - me.offset); + me.pos = Math.max(me.min, pos.x - Math.max(0, me.offset)); me.resize(); } } -- Gitblit v1.9.1