From e7165c9ff78c64cae9d0206b3563fe583cb91561 Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 1 May 2015 10:25:48 -0600 Subject: [PATCH] Safari: smoother popup pane toggling; cleanup popup js --- platform/safari/vapi-popup.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/platform/safari/vapi-popup.js b/platform/safari/vapi-popup.js index e492e9562..eb54b2e4c 100644 --- a/platform/safari/vapi-popup.js +++ b/platform/safari/vapi-popup.js @@ -27,13 +27,23 @@ if(typeof safari.self === "undefined" || window.top !== window) { var onLoaded = function() { var _toggle = DOMTokenList.prototype.toggle; + var unchainPane2Timeout = false; + var unchainPane2 = function() { + pane2.style.removeProperty("display"); + }; DOMTokenList.prototype.toggle = function(className, enabled) { if(className === "dfEnabled") { + if(unchainPane2Timeout !== false) { + clearTimeout(unchainPane2Timeout); + unchainPane2Timeout = false; + } + _toggle.apply(this, arguments); + pane2.style.setProperty("display", "inline-block", "important"); + unchainPane2Timeout = setTimeout(unchainPane2, 700); updateSize(enabled); } - _toggle.apply(this, arguments); - if(className === "dfEnabled") { - setTimeout(updateSize, 0); + else { + _toggle.apply(this, arguments); } }; var body = document.body,