diff options
| -rw-r--r-- | static/js/pichat.js | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/static/js/pichat.js b/static/js/pichat.js index 82b6ae4..286edb9 100644 --- a/static/js/pichat.js +++ b/static/js/pichat.js @@ -610,14 +610,18 @@ $(function(){ // dragging images into the manual fave palette var palette = document.getElementById("manual-palette"); var paletteButton = document.getElementById("manual-palette-button"); + var paletteTimeout = null; var paletteCallbacks = { 'enter': function() { + if (paletteTimeout) clearTimeout(paletteTimeout); manPaletteShow(); }, 'leave': function() { - manPaletteHide(); + if (paletteTimeout) clearTimeout(paletteTimeout); + paletteTimeout = setTimeout(manPaletteHideUnlessLocked, 500); }, 'drop': function (url) { + if (paletteTimeout) clearTimeout(paletteTimeout); addManualFav(url); } }; @@ -1253,20 +1257,32 @@ $(function(){ }); }); +var manPaletteOpen = false; +var manPaletteLocked = false; function manPaletteToggle() { if ($("#manual-palette").css("display") == "none") { - manPaletteShow(); + manPaletteLocked = true; + manPaletteShow(); } else { + manPaletteLocked = false; manPaletteHide(); } }; +function manPaletteHideUnlessLocked (){ + if (manPaletteLocked) return; + manPaletteHide(); +} + function manPaletteHide() { + manPaletteOpen = false; $("#manual-palette").css("display", "none"); $("#manual-palette-thumbs").html(""); } function manPaletteShow() { + if (manPaletteOpen) return; + manPaletteOpen = true; $("#manual-palette").show(); if (! hasLocalStorage()) { $('#manual-palette-localstorage-error').show() |
