From b9203e8a9c2a4126515b112236779a6e5a5350af Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 18 Jul 2012 02:09:13 -0400 Subject: push --- static/js/pichat.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'static/js/pichat.js') 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() -- cgit v1.2.3-70-g09d2