From 717513cc073eeef453e219b79487ff2e45f4d70f Mon Sep 17 00:00:00 2001 From: Zev Benjamin Date: Thu, 10 Jan 2013 14:22:25 -0500 Subject: [PATCH] Only draw a color picker when it is shown (imported from commit 3ad2f3dbc753a1e04429ac365aa1c9d244742cbc) --- zephyr/static/js/subs.js | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/zephyr/static/js/subs.js b/zephyr/static/js/subs.js index 9d3317b70c..c686290be6 100644 --- a/zephyr/static/js/subs.js +++ b/zephyr/static/js/subs.js @@ -81,15 +81,6 @@ function get_button_for_stream(stream_name) { return $('#subscription_' + stream_info[stream_name.toLowerCase()].id).find('.unsubscribe_button'); } -function draw_colorpicker(stream_name) { - var colorpicker = $('#subscription_' + stream_info[stream_name.toLowerCase()].id).find('.colorpicker'); - colorpicker.spectrum(colorpicker_options); -} - -function draw_all_colorpickers() { - $('.colorpicker').spectrum(colorpicker_options); -} - function add_to_stream_list(stream_name) { var stream_sub_row; var sub; @@ -120,7 +111,6 @@ function add_to_stream_list(stream_name) { stream_info[lstream_name] = sub; $('#subscriptions_table').prepend(templates.subscription({subscriptions: [sub]})); - draw_colorpicker(stream_name); } } @@ -184,7 +174,6 @@ exports.fetch = function () { subscriptions.push(sub); }); $('#subscriptions_table').append(templates.subscription({subscriptions: subscriptions})); - draw_all_colorpickers(); } $('#streams').focus().select(); }, @@ -342,6 +331,9 @@ $(function () { var stream = sub_row.find('.subscription_name').text(); var error_elem = sub_row.find('.subscriber_list_container .alert-error'); var list = sub_row.find('.subscriber_list_container ul'); + var colorpicker = sub_row.find('.colorpicker'); + colorpicker.spectrum(colorpicker_options); + error_elem.addClass('hide'); list.empty();