From 025822ce35fef6970a382abe8a411e9179191647 Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Fri, 4 May 2012 18:13:01 +0200 Subject: [PATCH 1/2] CC-3763 : Don't call window.resize callbacks multiple time during continuous events --- airtime_mvc/public/js/airtime/library/spl.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/airtime_mvc/public/js/airtime/library/spl.js b/airtime_mvc/public/js/airtime/library/spl.js index 114e731ae..4b9f743fd 100644 --- a/airtime_mvc/public/js/airtime/library/spl.js +++ b/airtime_mvc/public/js/airtime/library/spl.js @@ -13,6 +13,7 @@ var AIRTIME = (function(AIRTIME){ $lib, $pl, widgetHeight, + resizeTimeout, width; function isTimeValid(time) { @@ -779,7 +780,9 @@ var AIRTIME = (function(AIRTIME){ }; mod.onResize = function() { - setWidgetSize(); + + clearTimeout(resizeTimeout); + resizeTimeout = setTimeout(setWidgetSize, 100); }; return AIRTIME; From f78e6eaeca0bab7aecca56d3469f446e732dc366 Mon Sep 17 00:00:00 2001 From: Naomi Aro Date: Fri, 4 May 2012 18:16:10 +0200 Subject: [PATCH 2/2] CC-3763 : Don't call window.resize callbacks multiple time during continuous events --- airtime_mvc/public/js/airtime/schedule/add-show.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/airtime_mvc/public/js/airtime/schedule/add-show.js b/airtime_mvc/public/js/airtime/schedule/add-show.js index f784e6ce1..f14297e7b 100644 --- a/airtime_mvc/public/js/airtime/schedule/add-show.js +++ b/airtime_mvc/public/js/airtime/schedule/add-show.js @@ -508,8 +508,7 @@ function alertShowErrorAndReload(){ window.location.reload(); } - -$(window).resize(function(){ +function windowResize() { var windowWidth = $(this).width(); // margin on showform are 16 px on each side if(!$("#schedule-add-show").is(':hidden')){ @@ -524,4 +523,10 @@ $(window).resize(function(){ $('#schedule_calendar').fullCalendar('option', 'contentHeight', mainHeight) $("#schedule_calendar").fullCalendar('render'); +} + +var scheduleResizeTimeout; +$(window).resize(function(){ + clearTimeout(scheduleResizeTimeout); + scheduleResizeTimeout = setTimeout(windowResize, 100); });