Sha256: c398acb3fb3bbdaa453461ca8c41787ba249cb08389da751a449b9e78e8fc9ef
Contents?: true
Size: 1 KB
Versions: 26
Compression:
Stored size: 1 KB
Contents
pageflow.widgets = (function() { return { isPresent: function(name) { return !!$('div.' + className(name)).length; }, areLoaded: function() { return !!$('div.widgets_present').length; }, use: function(options, callback) { var original = options.insteadOf; var originalClassName = className(original); var replacementClassNames = className(options.name) + ' ' + className(original, 'replaced'); if (this.isPresent(original)) { replace(originalClassName, replacementClassNames); callback(function() { replace(replacementClassNames, originalClassName); }); } else { callback(function() {}); } } }; function replace(original, replacement) { $('div.widgets_present') .removeClass(original) .addClass(replacement); pageflow.events.trigger('widgets:update'); } function className(name, state) { return 'widget_' + name + '_' + (state || 'present'); } }());
Version data entries
26 entries across 26 versions & 1 rubygems