Permalink
Browse files

Fix widgets that have double-init problems

  • Loading branch information...
kabel committed Sep 4, 2015
1 parent 120caa7 commit 3d8493523a198d3fa78f04947fd86e124322644e
@@ -1,4 +1,6 @@
define(['jquery', 'wdn', 'require', 'moment'], function($, WDN, require, moment) {
var initd = false;
var getLocalEventSettings = function() {
var $eventLink = $('link[rel=events]'),
eventParams = WDN.getPluginParam('events');
@@ -82,7 +84,6 @@ define(['jquery', 'wdn', 'require', 'moment'], function($, WDN, require, moment)
if (localConfig.url && $(localConfig.container).length) {
$(this.container).addClass('wdn-calendar');
WDN.loadCSS(WDN.getTemplateFilePath('css/layouts/events.css', true, true));
$.getJSON(localConfig.url + 'upcoming/?format=json&limit=' + encodeURIComponent(localConfig.limit), function(data) {
display(data, localConfig);
}
@@ -92,6 +93,11 @@ define(['jquery', 'wdn', 'require', 'moment'], function($, WDN, require, moment)
return {
initialize : function(config) {
if (!initd) {
WDN.loadCSS(WDN.getTemplateFilePath('css/layouts/events.css', true, true));
initd = true;
}
$(function() {
setup(config);
});
@@ -1,10 +1,12 @@
define(['wdn', 'require', 'jquery'], function(WDN, require, $) {
define(['wdn', 'require', 'jquery', 'plugins/validator/jquery.validator'], function(WDN, require, $) {
var initd = false;
return {
initialize: function(callback) {
WDN.loadCSS(WDN.getTemplateFilePath('css/layouts/formvalidator.css', true, true));
require(['plugins/validator/jquery.validator'], function() {
$(callback);
});
if (!initd) {
WDN.loadCSS(WDN.getTemplateFilePath('css/layouts/formvalidator.css', true, true));
initd = true;
}
$(callback);
}
};
});
@@ -6,6 +6,8 @@
define(['jquery', 'modernizr'], function($, Modernizr) {
"use strict";
var initd = false;
var imageCls = 'wdn_image_swap',
currentPoint,
checkPoints = [320,480,600,768,960,1040],
@@ -60,6 +62,11 @@ define(['jquery', 'modernizr'], function($, Modernizr) {
swapSource(currentPoint);
});
}
if (initd) {
return;
}
initd = true;
$(window).resize(function() {
if (resizeTimer) {
@@ -1,12 +1,12 @@
define(['wdn', 'require', 'jquery'], function(WDN, require, $) {
var pluginPath = 'plugins/ui/';
define(['wdn', 'require', 'jquery', 'plugins/ui/jquery-ui'], function(WDN, require, $) {
var initd = false;
return {
initialize: function(callback) {
WDN.loadCSS(WDN.getTemplateFilePath('scripts/' + pluginPath + 'css/jquery-ui-wdn.css', true, true));
require(['./' + pluginPath + 'jquery-ui'], function() {
$(callback);
});
if (!initd) {
WDN.loadCSS(WDN.getTemplateFilePath('scripts/plugins/ui/css/jquery-ui-wdn.css', true, true));
initd = true;
}
$(callback);
}
};
});
@@ -1,4 +1,6 @@
define(['jquery', 'wdn', 'require', 'moment'], function($, WDN, require, moment) {
var initd = true;
var getLocalEventSettings = function() {
var $eventLink = $('link[rel=events]'),
eventParams = WDN.getPluginParam('events');
@@ -105,7 +107,6 @@ define(['jquery', 'wdn', 'require', 'moment'], function($, WDN, require, moment)
localConfig = $.extend({}, config, defaultConfig);
if (localConfig.url && $(localConfig.container).length) {
WDN.loadCSS(WDN.getTemplateFilePath('css/layouts/monthwidget.css', true, true));
$.get(localConfig.url + '?monthwidget&format=hcalendar', function(data) {
display(data, localConfig);
}
@@ -115,6 +116,11 @@ define(['jquery', 'wdn', 'require', 'moment'], function($, WDN, require, moment)
return {
initialize : function(config) {
if (!initd) {
WDN.loadCSS(WDN.getTemplateFilePath('css/layouts/monthwidget.css', true, true));
initd = true;
}
$(function() {
setup(config);
});
@@ -7,13 +7,20 @@ define(['jquery', 'wdn', 'require', 'modernizr', 'navigation'], function($, WDN,
return false;
}
var initd = false;
var isFullNav = function() {
return Modernizr.mq('(min-width: 700px)') || !Modernizr.mq('only all');
};
return {
initialize : function() {
if (initd) {
return;
}
initd = true;
$(function() {
var domQ = $('#wdn_search_query'),
domSearchForm = $('#wdn_search_form'),
@@ -1,4 +1,4 @@
define(['jquery', 'require'], function($, require) {
define(['jquery', 'require', 'plugins/qtip/jquery.qtip'], function($, require) {
var pluginPath = 'plugins/qtip/',
qtipPlugin = 'jquery.qtip',
wdnStyle = 'wdn.qtip',
@@ -72,13 +72,10 @@ define(['jquery', 'require'], function($, require) {
initialize : function() {
if (!initd) {
WDN.loadCSS(WDN.getTemplateFilePath('scripts/' + pluginPath + wdnStyle + '.css', true, true));
require([pluginPath + qtipPlugin], function() {
initd = true;
tooltipSetup();
});
} else {
tooltipSetup();
initd = true;
}
tooltipSetup();
},
addTooltips : function($elements) {
this.addTooltip($elements);
@@ -100,4 +97,4 @@ define(['jquery', 'require'], function($, require) {
};
return Plugin;
});
});

0 comments on commit 3d84935

Please sign in to comment.