From 36804897f8bb24c5e8dbf03547cc0334b0f6ae1e Mon Sep 17 00:00:00 2001 From: jlukic Date: Fri, 28 Mar 2014 16:15:41 -0400 Subject: [PATCH] Updates sticky module, search module is now css variabalized --- src/definitions/modules/popup.js | 13 ++++++++----- src/definitions/modules/search.js | 5 ++--- src/definitions/modules/sticky.js | 27 +++++++++++++++++++-------- 3 files changed, 29 insertions(+), 16 deletions(-) diff --git a/src/definitions/modules/popup.js b/src/definitions/modules/popup.js index f8370bdc3..321a920a8 100755 --- a/src/definitions/modules/popup.js +++ b/src/definitions/modules/popup.js @@ -517,6 +517,9 @@ $.fn.popup = function(parameters) { }; break; } + if(positioning === undefined) { + module.error(error.invalidPosition); + } // tentatively place on stage $popup .css(positioning) @@ -608,7 +611,6 @@ $.fn.popup = function(parameters) { }, setting: function(name, value) { - module.debug('Changing setting', name, value); if( $.isPlainObject(name) ) { $.extend(true, settings, name); } @@ -786,7 +788,7 @@ $.fn.popup = function(parameters) { $.fn.popup.settings = { name : 'Popup', - debug : true, + debug : false, verbose : true, performance : true, namespace : 'popup', @@ -819,9 +821,10 @@ $.fn.popup.settings = { maxSearchDepth : 10, error: { - content : 'Your popup has no content specified', - method : 'The method you called is not defined.', - recursion : 'Popup attempted to reposition element to fit, but could not find an adequate position.' + content : 'Your popup has no content specified', + invalidPosition : 'The position you specified is not a valid position', + method : 'The method you called is not defined.', + recursion : 'Popup attempted to reposition element to fit, but could not find an adequate position.' }, metadata: { diff --git a/src/definitions/modules/search.js b/src/definitions/modules/search.js index cec1e20f9..024fe1dcf 100755 --- a/src/definitions/modules/search.js +++ b/src/definitions/modules/search.js @@ -422,7 +422,6 @@ $.fn.search = function(parameters) { }, setting: function(name, value) { - module.debug('Changing setting', name, value); if( $.isPlainObject(name) ) { $.extend(true, settings, name); } @@ -708,7 +707,7 @@ $.fn.search.settings = { + '' ; } - html += '
'; + html += '
'; if(result.price !== undefined) { html+= '
' + result.price + '
'; } @@ -754,7 +753,7 @@ $.fn.search.settings = { + '
' ; } - html += '
'; + html += '
'; if(result.price !== undefined) { html+= '
' + result.price + '
'; } diff --git a/src/definitions/modules/sticky.js b/src/definitions/modules/sticky.js index 79c42f286..081452af3 100755 --- a/src/definitions/modules/sticky.js +++ b/src/definitions/modules/sticky.js @@ -58,7 +58,6 @@ $.fn.sticky = function(parameters) { module = { initialize: function() { - module.verbose('Initializing sticky', settings); if(settings.context) { $context = $(settings.context); @@ -67,6 +66,13 @@ $.fn.sticky = function(parameters) { $context = $container; } + if($context.size() === 0) { + module.error(error.invalidContext, settings.context, $module); + return; + } + + module.verbose('Initializing sticky', settings, $container); + $window .on('resize' + eventNamespace, module.event.resize) .on('scroll' + eventNamespace, module.event.scroll) @@ -109,10 +115,13 @@ $.fn.sticky = function(parameters) { } }, - refresh: function() { + refresh: function(hardRefresh) { module.reset(); module.save.positions(); $.proxy(settings.onReposition, element)(); + if(hardRefresh) { + $container = $module.offsetParent(); + } }, save: { @@ -204,8 +213,10 @@ $.fn.sticky = function(parameters) { set: { containerSize: function() { - if($module.is(':visible') && $container.get(0).tagName === 'HTML') { - module.error(error.container, $container.get(0), $container.get(0).tagName); + if($container.get(0).tagName === 'HTML') { + if($module.is(':visible')) { + module.error(error.container, $container.get(0).tagName, $module); + } } else { module.debug('Settings container size', module.cache.context.height); @@ -429,7 +440,6 @@ $.fn.sticky = function(parameters) { }, setting: function(name, value) { - module.debug('Changing setting', name, value); if( $.isPlainObject(name) ) { $.extend(true, settings, name); } @@ -610,7 +620,7 @@ $.fn.sticky.settings = { namespace : 'sticky', verbose : true, - debug : true, + debug : false, performance : true, pushing : false, @@ -626,8 +636,9 @@ $.fn.sticky.settings = { onBottom : function(){}, error : { - container: 'Sticky element must be inside a relative container', - method : 'The method you called is not defined.' + container : 'Sticky element must be inside a relative container', + method : 'The method you called is not defined.', + invalidContext : 'Context specified does not exist' }, className : {