From d394cca06f64670f794158dfb8da157fb2c85f44 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 25 Mar 2013 19:39:02 +0000 Subject: [PATCH] Avoid some init / destroy errors in color picker popup --- etemplate/js/et2_widget_color.js | 21 ++++++++++++++++----- phpgwapi/js/jquery/jpicker/jpicker-1.1.6.js | 4 ++-- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/etemplate/js/et2_widget_color.js b/etemplate/js/et2_widget_color.js index 42ee83be31..224b18f294 100644 --- a/etemplate/js/et2_widget_color.js +++ b/etemplate/js/et2_widget_color.js @@ -57,12 +57,21 @@ var et2_color = et2_inputWidget.extend({ // Translations for(var key in jQuery.fn.jPicker.defaults.localization.text) { - jQuery.fn.jPicker.defaults.localization.text[key] = this.egw().lang(jQuery.fn.jPicker.defaults.localization.text[key]); + if(jQuery.fn.jPicker.defaults.localization.text[key]) + { + jQuery.fn.jPicker.defaults.localization.text[key] = this.egw().lang(jQuery.fn.jPicker.defaults.localization.text[key]); + } } for(var key in jQuery.fn.jPicker.defaults.localization.tooltips) { - jQuery.fn.jPicker.defaults.localization.tooltips[key].ok = this.egw().lang(jQuery.fn.jPicker.defaults.localization.tooltips[key].ok); - jQuery.fn.jPicker.defaults.localization.tooltips[key].cancel = this.egw().lang(jQuery.fn.jPicker.defaults.localization.tooltips[key].cancel); + if(jQuery.fn.jPicker.defaults.localization.tooltips[key].ok) + { + jQuery.fn.jPicker.defaults.localization.tooltips[key].ok = this.egw().lang(jQuery.fn.jPicker.defaults.localization.tooltips[key].ok); + } + if(jQuery.fn.jPicker.defaults.localization.tooltips[key].cancel) + { + jQuery.fn.jPicker.defaults.localization.tooltips[key].cancel = this.egw().lang(jQuery.fn.jPicker.defaults.localization.tooltips[key].cancel); + } } this.options = jQuery.extend({}, this.defaults, this.options); @@ -120,14 +129,16 @@ var et2_color = et2_inputWidget.extend({ title: self.options.statustext ? self.options.statustext : self.egw().lang('Select color'), autoOpen: false, resizable: false, - width: self.get_jPicker() ? self.get_jPicker().width : "auto" + width: "auto" }); // Hide original move bar jQuery('table.jPicker .Move').hide(); // Trigger dialog opening - jQuery('.Image',self.$node.next()).click(function() {jQuery("table.jPicker").dialog("open")}); + jQuery('.Image',self.$node.next()).click(function() { + jQuery("table.jPicker").dialog("open"); + }); },500); return true; }, diff --git a/phpgwapi/js/jquery/jpicker/jpicker-1.1.6.js b/phpgwapi/js/jquery/jpicker/jpicker-1.1.6.js index 3392159ffc..dd6d47f517 100644 --- a/phpgwapi/js/jquery/jpicker/jpicker-1.1.6.js +++ b/phpgwapi/js/jquery/jpicker/jpicker-1.1.6.js @@ -1852,7 +1852,7 @@ commitCallback = null; cancelCallback = null; liveCallback = null; - container.html(''); + container.remove(); for (i = 0; i < List.length; i++) if (List[i] == $this) List.splice(i, 1); }, images = settings.images, // local copies for YUI compressor @@ -2083,4 +2083,4 @@ } } }; -})(jQuery, '1.1.6'); \ No newline at end of file +})(jQuery, '1.1.6');