Browse Source
First rough non-working pass at rapid writing carousel module
First rough non-working pass at rapid writing carousel module
Former-commit-id:pull/258/heade3f5f77c1c
Former-commit-id:d7852ee34a
18 changed files with 1820 additions and 10 deletions
Split View
Diff Options
-
325build/minified/modules/carousel.js
-
1build/minified/modules/carousel.min.js
-
2build/minified/modules/chat.min.js
-
2build/minified/modules/checkbox.min.js
-
2build/minified/modules/dropdown.min.js
-
2build/minified/modules/form.min.js
-
2build/minified/modules/nag.min.js
-
2build/minified/modules/popup.min.js
-
2build/minified/modules/search.min.js
-
2build/minified/modules/shape.min.js
-
2build/minified/modules/tab.min.js
-
325build/packaged/modules/carousel.js
-
2build/packaged/semantic.min.js.REMOVED.git-id
-
325build/uncompressed/modules/carousel.js
-
161node/src/documents/modules/carousel.html
-
325node/src/files/components/semantic/modules/carousel.js
-
23src/modules/carousel.css
-
325src/modules/carousel.js
@ -0,0 +1,325 @@ |
|||
/* ****************************** |
|||
Semantic Module: Carousel |
|||
Author: Jack Lukic |
|||
Notes: First Commit May 28, 2013 |
|||
|
|||
A carousel alternates between |
|||
several pieces of content in sequence. |
|||
|
|||
****************************** */ |
|||
|
|||
;(function ( $, window, document, undefined ) { |
|||
|
|||
$.fn.carousel = function(parameters) { |
|||
var |
|||
$allModules = $(this), |
|||
|
|||
settings = $.extend(true, {}, $.fn.carousel.settings, parameters), |
|||
|
|||
eventNamespace = '.' + settings.namespace, |
|||
moduleNamespace = 'module-' + settings.namespace, |
|||
moduleSelector = $allModules.selector || '', |
|||
|
|||
time = new Date().getTime(), |
|||
performance = [], |
|||
|
|||
query = arguments[0], |
|||
methodInvoked = (typeof query == 'string'), |
|||
queryArguments = [].slice.call(arguments, 1), |
|||
invokedResponse |
|||
; |
|||
|
|||
$allModules |
|||
.each(function() { |
|||
var |
|||
$module = $(this), |
|||
$arrows = $(settings.selector.arrows), |
|||
$leftArrow = $(settings.selector.leftArrow), |
|||
$rightArrow = $(settings.selector.rightArrow), |
|||
$content = $(settings.selector.content), |
|||
$navigation = $(settings.selector.navigation), |
|||
$navItem = $(settings.selector.navItem), |
|||
|
|||
selector = $module.selector || '', |
|||
element = this, |
|||
instance = $module.data('module-' + settings.namespace), |
|||
|
|||
className = settings.className, |
|||
namespace = settings.namespace, |
|||
errors = settings.errors, |
|||
module |
|||
; |
|||
|
|||
module = { |
|||
|
|||
initialize: function() { |
|||
module.openingAnimation(); |
|||
module.marquee.autoAdvance(); |
|||
$leftArrow |
|||
.on('click', module.marquee.left) |
|||
; |
|||
$rightArrow |
|||
.on('click', module.marquee.right) |
|||
; |
|||
$navItem |
|||
.on('click', module.marquee.change) |
|||
; |
|||
}, |
|||
|
|||
destroy: function() { |
|||
module.verbose('Destroying previous module for', $module); |
|||
$module |
|||
.off(namespace) |
|||
; |
|||
}, |
|||
|
|||
left: function() { |
|||
var |
|||
$activeContent = $content.filter('.' + className.active), |
|||
currentIndex = $content.index($activeContent), |
|||
imageCount = $content.size(), |
|||
newIndex = (currentIndex - 1 != -1) |
|||
? (currentIndex - 1) |
|||
: (imageCount - 1) |
|||
; |
|||
$navItem |
|||
.eq(newIndex) |
|||
.trigger('click') |
|||
; |
|||
}, |
|||
|
|||
right: function() { |
|||
var |
|||
$activeContent = $content.filter('.' + className.active), |
|||
currentIndex = $content.index($activeContent), |
|||
imageCount = $content.size(), |
|||
newIndex = (currentIndex + 1 != imageCount) |
|||
? (currentIndex + 1) |
|||
: 0 |
|||
; |
|||
$navItem |
|||
.eq(newIndex) |
|||
.trigger('click') |
|||
; |
|||
}, |
|||
|
|||
change: function() { |
|||
var |
|||
$selected = $(this), |
|||
selectedIndex = $navItem.index($selected), |
|||
$selectedImage = $content.eq(selectedIndex) |
|||
; |
|||
module.marquee.autoAdvance(); |
|||
$selected |
|||
.addClass('active') |
|||
.siblings() |
|||
.removeClass('active') |
|||
; |
|||
$selectedImage |
|||
.addClass('active animated fadeIn') |
|||
.siblings('.' + className.active) |
|||
.removeClass('animated fadeIn scaleIn') |
|||
.animate({ |
|||
opacity: 0 |
|||
}, 500, function(){ |
|||
$(this) |
|||
.removeClass('active') |
|||
.removeAttr('style') |
|||
; |
|||
}) |
|||
; |
|||
}, |
|||
|
|||
autoAdvance: function() { |
|||
clearInterval(module.timer); |
|||
module.timer = setInterval(module.marquee.right, settings.duration); |
|||
}, |
|||
|
|||
setting: function(name, value) { |
|||
if(value !== undefined) { |
|||
if( $.isPlainObject(name) ) { |
|||
module.verbose('Modifying settings object', name, value); |
|||
$.extend(true, settings, name); |
|||
} |
|||
else { |
|||
module.verbose('Modifying setting', name, value); |
|||
settings[name] = value; |
|||
} |
|||
} |
|||
else { |
|||
return settings[name]; |
|||
} |
|||
}, |
|||
internal: function(name, value) { |
|||
if(value !== undefined) { |
|||
if( $.isPlainObject(name) ) { |
|||
module.verbose('Modifying internal property', name, value); |
|||
$.extend(true, module, name); |
|||
} |
|||
else { |
|||
module.verbose('Changing internal method to', value); |
|||
module[name] = value; |
|||
} |
|||
} |
|||
else { |
|||
return module[name]; |
|||
} |
|||
}, |
|||
debug: function() { |
|||
if(settings.debug) { |
|||
if(settings.performance) { |
|||
module.performance.log(arguments); |
|||
} |
|||
else { |
|||
module.debug = Function.prototype.bind.call(console.info, console, settings.moduleName + ':'); |
|||
} |
|||
} |
|||
}, |
|||
verbose: function() { |
|||
if(settings.verbose && settings.debug) { |
|||
if(settings.performance) { |
|||
module.performance.log(arguments); |
|||
} |
|||
else { |
|||
module.verbose = Function.prototype.bind.call(console.info, console, settings.moduleName + ':'); |
|||
} |
|||
} |
|||
}, |
|||
error: function() { |
|||
module.error = Function.prototype.bind.call(console.log, console, settings.moduleName + ':'); |
|||
}, |
|||
performance: { |
|||
log: function(message) { |
|||
var |
|||
currentTime, |
|||
executionTime, |
|||
previousTime |
|||
; |
|||
if(settings.performance) { |
|||
currentTime = new Date().getTime(); |
|||
previousTime = time || currentTime, |
|||
executionTime = currentTime - previousTime; |
|||
time = currentTime; |
|||
performance.push({ |
|||
'Element' : element, |
|||
'Name' : message[0], |
|||
'Arguments' : message[1] || 'None', |
|||
'Execution Time' : executionTime |
|||
}); |
|||
clearTimeout(module.performance.timer); |
|||
module.performance.timer = setTimeout(module.performance.display, 100); |
|||
} |
|||
}, |
|||
display: function() { |
|||
var |
|||
title = settings.moduleName, |
|||
caption = settings.moduleName + ': ' + moduleSelector + '(' + $allModules.size() + ' elements)', |
|||
totalExecutionTime = 0 |
|||
; |
|||
if(moduleSelector) { |
|||
title += ' Performance (' + moduleSelector + ')'; |
|||
} |
|||
if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) { |
|||
console.groupCollapsed(title); |
|||
if(console.table) { |
|||
$.each(performance, function(index, data) { |
|||
totalExecutionTime += data['Execution Time']; |
|||
}); |
|||
console.table(performance); |
|||
} |
|||
else { |
|||
$.each(performance, function(index, data) { |
|||
totalExecutionTime += data['Execution Time']; |
|||
console.log(data['Name'] + ': ' + data['Execution Time']+'ms'); |
|||
}); |
|||
} |
|||
console.log('Total Execution Time:', totalExecutionTime +'ms'); |
|||
console.groupEnd(); |
|||
performance = []; |
|||
time = false; |
|||
} |
|||
} |
|||
}, |
|||
invoke: function(query, passedArguments, context) { |
|||
var |
|||
maxDepth, |
|||
found |
|||
; |
|||
passedArguments = passedArguments || queryArguments; |
|||
context = element || context; |
|||
if(typeof query == 'string' && instance !== undefined) { |
|||
query = query.split('.'); |
|||
maxDepth = query.length - 1; |
|||
$.each(query, function(depth, value) { |
|||
if( $.isPlainObject( instance[value] ) && (depth != maxDepth) ) { |
|||
instance = instance[value]; |
|||
return true; |
|||
} |
|||
else if( instance[value] !== undefined ) { |
|||
found = instance[value]; |
|||
return true; |
|||
} |
|||
module.error(errors.method); |
|||
return false; |
|||
}); |
|||
} |
|||
if ( $.isFunction( found ) ) { |
|||
module.verbose('Executing invoked function', found); |
|||
return found.apply(context, passedArguments); |
|||
} |
|||
return found || false; |
|||
} |
|||
}; |
|||
|
|||
if(methodInvoked) { |
|||
if(instance === undefined) { |
|||
module.initialize(); |
|||
} |
|||
invokedResponse = module.invoke(query); |
|||
} |
|||
else { |
|||
if(instance !== undefined) { |
|||
module.destroy(); |
|||
} |
|||
module.initialize(); |
|||
} |
|||
}) |
|||
; |
|||
return (invokedResponse) |
|||
? invokedResponse |
|||
: this |
|||
; |
|||
}; |
|||
|
|||
$.fn.carousel.settings = { |
|||
|
|||
moduleName : 'Carousel Module', |
|||
namespace : 'carousel', |
|||
|
|||
verbose : true, |
|||
debug : true, |
|||
performance : true, |
|||
|
|||
// delegated event context
|
|||
duration: 5000, |
|||
|
|||
errors : { |
|||
method : 'The method you called is not defined.' |
|||
}, |
|||
|
|||
selector : { |
|||
arrows : '.arrow', |
|||
leftArrow : '.left.arrow', |
|||
rightArrow : '.right.arrow', |
|||
content : '.content', |
|||
navigation : '.navigation', |
|||
navItem : '.navigation .icon' |
|||
}, |
|||
|
|||
className : { |
|||
active : 'active' |
|||
} |
|||
|
|||
}; |
|||
|
|||
})( jQuery, window , document ); |
@ -0,0 +1 @@ |
|||
(function(e,t,n,o){e.fn.carousel=function(t){var n,i=e(this),a=e.extend(!0,{},e.fn.carousel.settings,t),r=("."+a.namespace,"module-"+a.namespace,i.selector||""),s=(new Date).getTime(),c=[],l=arguments[0],u="string"==typeof l,d=[].slice.call(arguments,1);return i.each(function(){var t,f=e(this),m=(e(a.selector.arrows),e(a.selector.leftArrow)),g=e(a.selector.rightArrow),p=e(a.selector.content),v=(e(a.selector.navigation),e(a.selector.navItem)),h=(f.selector||"",this),b=f.data("module-"+a.namespace),x=a.className,y=a.namespace,w=a.errors;t={initialize:function(){t.openingAnimation(),t.marquee.autoAdvance(),m.on("click",t.marquee.left),g.on("click",t.marquee.right),v.on("click",t.marquee.change)},destroy:function(){t.verbose("Destroying previous module for",f),f.off(y)},left:function(){var e=p.filter("."+x.active),t=p.index(e),n=p.size(),o=-1!=t-1?t-1:n-1;v.eq(o).trigger("click")},right:function(){var e=p.filter("."+x.active),t=p.index(e),n=p.size(),o=t+1!=n?t+1:0;v.eq(o).trigger("click")},change:function(){var n=e(this),o=v.index(n),i=p.eq(o);t.marquee.autoAdvance(),n.addClass("active").siblings().removeClass("active"),i.addClass("active animated fadeIn").siblings("."+x.active).removeClass("animated fadeIn scaleIn").animate({opacity:0},500,function(){e(this).removeClass("active").removeAttr("style")})},autoAdvance:function(){clearInterval(t.timer),t.timer=setInterval(t.marquee.right,a.duration)},setting:function(n,i){return i===o?a[n]:(e.isPlainObject(n)?(t.verbose("Modifying settings object",n,i),e.extend(!0,a,n)):(t.verbose("Modifying setting",n,i),a[n]=i),o)},internal:function(n,i){return i===o?t[n]:(e.isPlainObject(n)?(t.verbose("Modifying internal property",n,i),e.extend(!0,t,n)):(t.verbose("Changing internal method to",i),t[n]=i),o)},debug:function(){a.debug&&(a.performance?t.performance.log(arguments):t.debug=Function.prototype.bind.call(console.info,console,a.moduleName+":"))},verbose:function(){a.verbose&&a.debug&&(a.performance?t.performance.log(arguments):t.verbose=Function.prototype.bind.call(console.info,console,a.moduleName+":"))},error:function(){t.error=Function.prototype.bind.call(console.log,console,a.moduleName+":")},performance:{log:function(e){var n,o,i;a.performance&&(n=(new Date).getTime(),i=s||n,o=n-i,s=n,c.push({Element:h,Name:e[0],Arguments:e[1]||"None","Execution Time":o}),clearTimeout(t.performance.timer),t.performance.timer=setTimeout(t.performance.display,100))},display:function(){var t=a.moduleName,n=(a.moduleName+": "+r+"("+i.size()+" elements)",0);r&&(t+=" Performance ("+r+")"),(console.group!==o||console.table!==o)&&c.length>0&&(console.groupCollapsed(t),console.table?(e.each(c,function(e,t){n+=t["Execution Time"]}),console.table(c)):e.each(c,function(e,t){n+=t["Execution Time"],console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.log("Total Execution Time:",n+"ms"),console.groupEnd(),c=[],s=!1)}},invoke:function(n,i,a){var r,s;return i=i||d,a=h||a,"string"==typeof n&&b!==o&&(n=n.split("."),r=n.length-1,e.each(n,function(n,i){return e.isPlainObject(b[i])&&n!=r?(b=b[i],!0):b[i]!==o?(s=b[i],!0):(t.error(w.method),!1)})),e.isFunction(s)?(t.verbose("Executing invoked function",s),s.apply(a,i)):s||!1}},u?(b===o&&t.initialize(),n=t.invoke(l)):(b!==o&&t.destroy(),t.initialize())}),n?n:this},e.fn.carousel.settings={moduleName:"Carousel Module",namespace:"carousel",verbose:!0,debug:!0,performance:!0,duration:5e3,errors:{method:"The method you called is not defined."},selector:{arrows:".arrow",leftArrow:".left.arrow",rightArrow:".right.arrow",content:".content",navigation:".navigation",navItem:".navigation .icon"},className:{active:"active"}}})(jQuery,window,document); |
2
build/minified/modules/chat.min.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1 +1 @@ |
|||
(function(e,t,n,o){e.fn.checkbox=function(t){var n,a=e(this),i=e.extend(!0,{},e.fn.checkbox.settings,t),s="."+i.namespace,r="module-"+i.namespace,l=a.selector||"",c=(new Date).getTime(),u=[],d=arguments[0],f="string"==typeof d,m=[].slice.call(arguments,1);return a.each(function(){var t,p=e(this),g=e(this).find(i.selector.input),h=p.selector||"",v=this,b=p.data("module-"+i.namespace),y=i.className,x=i.namespace,C=i.errors;t={initialize:function(){i.context&&""!==h?(t.verbose("Initializing checkbox with delegated events",p),e(v,i.context).on(h,"click"+s,t.toggle).data(r,t)):(t.verbose("Initializing checkbox with bound events",p),p.on("click"+s,t.toggle).data(r,t))},destroy:function(){t.verbose("Destroying previous module for",p),p.off(x)},is:{radio:function(){return p.hasClass(y.radio)}},can:{disable:function(){return"boolean"==typeof i.required?i.required:!t.is.radio()}},enable:function(){t.debug("Enabling checkbox"),p.addClass(y.active),g.prop("checked",!0),e.proxy(i.onChange,g.get())(),e.proxy(i.onEnable,g.get())()},disable:function(){t.debug("Disabling checkbox"),p.removeClass(y.active),g.prop("checked",!1),e.proxy(i.onChange,g.get())(),e.proxy(i.onDisable,g.get())()},toggle:function(){t.verbose("Toggling checkbox state"),g.prop("checked")!==o&&g.prop("checked")?t.can.disable()&&t.disable():t.enable()},setting:function(n,a){return a===o?i[n]:(e.isPlainObject(n)?(t.verbose("Modifying settings object",n,a),e.extend(!0,i,n)):(t.verbose("Modifying setting",n,a),i[n]=a),o)},internal:function(n,a){return a===o?t[n]:(e.isPlainObject(n)?(t.verbose("Modifying internal property",n,a),e.extend(!0,t,n)):(t.verbose("Changing internal method to",a),t[n]=a),o)},debug:function(){i.debug&&(i.performance?t.performance.log(arguments):t.debug=Function.prototype.bind.call(console.info,console,i.moduleName+":"))},verbose:function(){i.verbose&&i.debug&&(i.performance?t.performance.log(arguments):t.verbose=Function.prototype.bind.call(console.info,console,i.moduleName+":"))},error:function(){t.error=Function.prototype.bind.call(console.log,console,i.moduleName+":")},performance:{log:function(e){var n,o,a;i.performance&&(n=(new Date).getTime(),a=c||n,o=n-a,c=n,u.push({Element:v,Name:e[0],Arguments:e[1]||"None","Execution Time":o}),clearTimeout(t.performance.timer),t.performance.timer=setTimeout(t.performance.display,100))},display:function(){var t=i.moduleName,n=(i.moduleName+": "+l+"("+a.size()+" elements)",0);l&&(t+=" Performance ("+l+")"),(console.group!==o||console.table!==o)&&u.length>0&&(console.groupCollapsed(t),console.table?(e.each(u,function(e,t){n+=t["Execution Time"]}),console.table(u)):e.each(u,function(e,t){n+=t["Execution Time"],console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.log("Total Execution Time:",n+"ms"),console.groupEnd(),u=[],c=!1)}},invoke:function(n,a,i){var s,r;return a=a||m,i=v||i,"string"==typeof n&&b!==o&&(n=n.split("."),s=n.length-1,e.each(n,function(n,a){return e.isPlainObject(b[a])&&n!=s?(b=b[a],!0):b[a]!==o?(r=b[a],!0):(t.error(C.method),!1)})),e.isFunction(r)?(t.verbose("Executing invoked function",r),r.apply(i,a)):r||!1}},f?(b===o&&t.initialize(),n=t.invoke(d)):(b!==o&&t.destroy(),t.initialize())}),n?n:this},e.fn.checkbox.settings={moduleName:"Checkbox Module",namespace:"checkbox",verbose:!0,debug:!0,performance:!0,context:!1,required:"auto",onChange:function(){},onEnable:function(){},onDisable:function(){},errors:{method:"The method you called is not defined."},selector:{input:"input"},className:{active:"active",radio:"radio"}}})(jQuery,window,document); |
|||
(function(e,t,n,o){e.fn.checkbox=function(t){var n,a=e(this),i=e.extend(!0,{},e.fn.checkbox.settings,t),s="."+i.namespace,r="module-"+i.namespace,c=a.selector||"",l=(new Date).getTime(),u=[],d=arguments[0],f="string"==typeof d,m=[].slice.call(arguments,1);return a.each(function(){var t,p=e(this),g=e(this).find(i.selector.input),h=p.selector||"",v=this,b=p.data("module-"+i.namespace),y=i.className,x=i.namespace,C=i.errors;t={initialize:function(){i.context&&""!==h?(t.verbose("Initializing checkbox with delegated events",p),e(v,i.context).on(h,"click"+s,t.toggle).data(r,t)):(t.verbose("Initializing checkbox with bound events",p),p.on("click"+s,t.toggle).data(r,t))},destroy:function(){t.verbose("Destroying previous module for",p),p.off(x)},is:{radio:function(){return p.hasClass(y.radio)}},can:{disable:function(){return"boolean"==typeof i.required?i.required:!t.is.radio()}},enable:function(){t.debug("Enabling checkbox"),p.addClass(y.active),g.prop("checked",!0),e.proxy(i.onChange,g.get())(),e.proxy(i.onEnable,g.get())()},disable:function(){t.debug("Disabling checkbox"),p.removeClass(y.active),g.prop("checked",!1),e.proxy(i.onChange,g.get())(),e.proxy(i.onDisable,g.get())()},toggle:function(){t.verbose("Toggling checkbox state"),g.prop("checked")!==o&&g.prop("checked")?t.can.disable()&&t.disable():t.enable()},setting:function(n,a){return a===o?i[n]:(e.isPlainObject(n)?(t.verbose("Modifying settings object",n,a),e.extend(!0,i,n)):(t.verbose("Modifying setting",n,a),i[n]=a),o)},internal:function(n,a){return a===o?t[n]:(e.isPlainObject(n)?(t.verbose("Modifying internal property",n,a),e.extend(!0,t,n)):(t.verbose("Changing internal method to",a),t[n]=a),o)},debug:function(){i.debug&&(i.performance?t.performance.log(arguments):t.debug=Function.prototype.bind.call(console.info,console,i.moduleName+":"))},verbose:function(){i.verbose&&i.debug&&(i.performance?t.performance.log(arguments):t.verbose=Function.prototype.bind.call(console.info,console,i.moduleName+":"))},error:function(){t.error=Function.prototype.bind.call(console.log,console,i.moduleName+":")},performance:{log:function(e){var n,o,a;i.performance&&(n=(new Date).getTime(),a=l||n,o=n-a,l=n,u.push({Element:v,Name:e[0],Arguments:e[1]||"None","Execution Time":o}),clearTimeout(t.performance.timer),t.performance.timer=setTimeout(t.performance.display,100))},display:function(){var t=i.moduleName,n=(i.moduleName+": "+c+"("+a.size()+" elements)",0);c&&(t+=" Performance ("+c+")"),(console.group!==o||console.table!==o)&&u.length>0&&(console.groupCollapsed(t),console.table?(e.each(u,function(e,t){n+=t["Execution Time"]}),console.table(u)):e.each(u,function(e,t){n+=t["Execution Time"],console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.log("Total Execution Time:",n+"ms"),console.groupEnd(),u=[],l=!1)}},invoke:function(n,a,i){var s,r;return a=a||m,i=v||i,"string"==typeof n&&b!==o&&(n=n.split("."),s=n.length-1,e.each(n,function(n,a){return e.isPlainObject(b[a])&&n!=s?(b=b[a],!0):b[a]!==o?(r=b[a],!0):(t.error(C.method),!1)})),e.isFunction(r)?(t.verbose("Executing invoked function",r),r.apply(i,a)):r||!1}},f?(b===o&&t.initialize(),n=t.invoke(d)):(b!==o&&t.destroy(),t.initialize())}),n?n:this},e.fn.checkbox.settings={moduleName:"Checkbox Module",namespace:"checkbox",verbose:!0,debug:!0,performance:!0,context:!1,required:"auto",onChange:function(){},onEnable:function(){},onDisable:function(){},errors:{method:"The method you called is not defined."},selector:{input:"input"},className:{active:"active",radio:"radio"}}})(jQuery,window,document); |
2
build/minified/modules/dropdown.min.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
2
build/minified/modules/form.min.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -1 +1 @@ |
|||
(function(e,t,n,o){e.fn.nag=function(n){var i=e.extend(!0,{},e.fn.nag.settings,n),a=arguments||!1;return e(this).each(function(){var n,s,r,c,l,u,d,f,m,p=e(this),g=p.find(i.selector.close),h=e(i.context),v=p.data("module"),b=i.className,y=t.requestAnimationFrame||t.mozRequestAnimationFrame||t.webkitRequestAnimationFrame||t.msRequestAnimationFrame||function(e){setTimeout(e,0)};return m={initialize:function(){n=p.offset(),s=p.outerHeight(),r=h.outerWidth(),c=h.outerHeight(),l=h.offset(),p.data("module",m),g.on("mouseenter mouseleave",m.event.hover).on("click",m.dismiss),i.context==t&&"fixed"==i.position&&p.addClass(b.fixed),i.sticky&&("absolute"==i.position?h.on("scroll resize",m.event.scroll):e(t).on("scroll resize",m.event.scroll),e.proxy(m.event.scroll,this)()),i.followLink&&p.on("mouseenter mouseleave",m.event.hover).on("click",m.followLink),i.displayTime>0&&setTimeout(m.hide,i.displayTime),m.should.show()?p.is(":visible")||m.show():m.hide()},refresh:function(){n=p.offset(),s=p.outerHeight(),r=h.outerWidth(),c=h.outerHeight(),l=h.offset()},show:function(){e.fn.popIn!==o?p.popIn(i.duration):p.fadeIn(i.duration,i.easing)},hide:function(){p.fadeOut(i.duration,i.easing)},stick:function(){if(m.refresh(),"fixed"==i.position){var n=e(t).prop("pageYOffset")||e(t).scrollTop(),o=p.hasClass(b.bottom)?l.top+(c-s)-n:l.top-n;p.css({position:"fixed",top:o,left:l.left,width:r-i.scrollBarWidth})}else p.css({top:d})},unStick:function(){p.css({top:""})},dismiss:function(){i.storageMethod&&m.storage.set(i.storedKey,i.storedValue),m.hide()},should:{show:function(){return m.storage.get(i.storedKey)==i.storedValue?!1:!0},stick:function(){return u=h.prop("pageYOffset")||h.scrollTop(),d=p.hasClass(b.bottom)?c-p.outerHeight()+u:u,d>n.top?!0:"fixed"==i.position?!0:!1}},followLink:function(){e.fn.followLink!==o&&p.followLink()},storage:{set:function(t,n){"local"==i.storageMethod&&store!==o?store.set(t,n):e.cookie!==o?e.cookie(t,n):m.error(i.errors.noStorage)},get:function(t){return"local"==i.storageMethod&&store!==o?store.get(t):e.cookie!==o?e.cookie(t):(m.error(i.errors.noStorage),o)}},event:{hover:function(){e(this).toggleClass(b.hover)},scroll:function(){f!==o&&clearTimeout(f),f=setTimeout(function(){m.should.stick()?y(m.stick):m.unStick()},i.lag)}},error:function(e){console.log("Nag Module:"+e)},invoke:function(t,n,a){var s;return a=a||Array.prototype.slice.call(arguments,2),"string"==typeof t&&v!==o&&(t=t.split("."),e.each(t,function(t,n){return e.isPlainObject(v[n])?(v=v[n],!0):e.isFunction(v[n])?(s=v[n],!0):(m.error(i.errors.method),!1)})),e.isFunction(s)?s.apply(n,a):s}},v!==o&&a?("invoke"==a[0]&&(a=Array.prototype.slice.call(a,1)),m.invoke(a[0],this,Array.prototype.slice.call(a,1))):(m.initialize(),o)}),this},e.fn.nag.settings={displayTime:0,followLink:!0,position:"fixed",scrollBarWidth:18,storageMethod:"cookie",storedKey:"nag",storedValue:"dismiss",sticky:!0,lag:0,context:t,errors:{noStorage:"Neither $.cookie or store is defined. A storage solution is required for storing state",followLink:"Follow link is set but the plugin is not included"},className:{bottom:"bottom",hover:"hover",fixed:"fixed"},selector:{close:".icon.close"},speed:500,easing:"easeOutQuad"}})(jQuery,window,document); |
|||
(function(e,t,n,o){e.fn.nag=function(n){var i=e.extend(!0,{},e.fn.nag.settings,n),a=arguments||!1;return e(this).each(function(){var n,r,s,c,l,u,d,m,f,p=e(this),g=p.find(i.selector.close),h=e(i.context),v=p.data("module"),b=i.className,y=t.requestAnimationFrame||t.mozRequestAnimationFrame||t.webkitRequestAnimationFrame||t.msRequestAnimationFrame||function(e){setTimeout(e,0)};return f={initialize:function(){n=p.offset(),r=p.outerHeight(),s=h.outerWidth(),c=h.outerHeight(),l=h.offset(),p.data("module",f),g.on("mouseenter mouseleave",f.event.hover).on("click",f.dismiss),i.context==t&&"fixed"==i.position&&p.addClass(b.fixed),i.sticky&&("absolute"==i.position?h.on("scroll resize",f.event.scroll):e(t).on("scroll resize",f.event.scroll),e.proxy(f.event.scroll,this)()),i.followLink&&p.on("mouseenter mouseleave",f.event.hover).on("click",f.followLink),i.displayTime>0&&setTimeout(f.hide,i.displayTime),f.should.show()?p.is(":visible")||f.show():f.hide()},refresh:function(){n=p.offset(),r=p.outerHeight(),s=h.outerWidth(),c=h.outerHeight(),l=h.offset()},show:function(){e.fn.popIn!==o?p.popIn(i.duration):p.fadeIn(i.duration,i.easing)},hide:function(){p.fadeOut(i.duration,i.easing)},stick:function(){if(f.refresh(),"fixed"==i.position){var n=e(t).prop("pageYOffset")||e(t).scrollTop(),o=p.hasClass(b.bottom)?l.top+(c-r)-n:l.top-n;p.css({position:"fixed",top:o,left:l.left,width:s-i.scrollBarWidth})}else p.css({top:d})},unStick:function(){p.css({top:""})},dismiss:function(){i.storageMethod&&f.storage.set(i.storedKey,i.storedValue),f.hide()},should:{show:function(){return f.storage.get(i.storedKey)==i.storedValue?!1:!0},stick:function(){return u=h.prop("pageYOffset")||h.scrollTop(),d=p.hasClass(b.bottom)?c-p.outerHeight()+u:u,d>n.top?!0:"fixed"==i.position?!0:!1}},followLink:function(){e.fn.followLink!==o&&p.followLink()},storage:{set:function(t,n){"local"==i.storageMethod&&store!==o?store.set(t,n):e.cookie!==o?e.cookie(t,n):f.error(i.errors.noStorage)},get:function(t){return"local"==i.storageMethod&&store!==o?store.get(t):e.cookie!==o?e.cookie(t):(f.error(i.errors.noStorage),o)}},event:{hover:function(){e(this).toggleClass(b.hover)},scroll:function(){m!==o&&clearTimeout(m),m=setTimeout(function(){f.should.stick()?y(f.stick):f.unStick()},i.lag)}},error:function(e){console.log("Nag Module:"+e)},invoke:function(t,n,a){var r;return a=a||Array.prototype.slice.call(arguments,2),"string"==typeof t&&v!==o&&(t=t.split("."),e.each(t,function(t,n){return e.isPlainObject(v[n])?(v=v[n],!0):e.isFunction(v[n])?(r=v[n],!0):(f.error(i.errors.method),!1)})),e.isFunction(r)?r.apply(n,a):r}},v!==o&&a?("invoke"==a[0]&&(a=Array.prototype.slice.call(a,1)),f.invoke(a[0],this,Array.prototype.slice.call(a,1))):(f.initialize(),o)}),this},e.fn.nag.settings={displayTime:0,followLink:!0,position:"fixed",scrollBarWidth:18,storageMethod:"cookie",storedKey:"nag",storedValue:"dismiss",sticky:!0,lag:0,context:t,errors:{noStorage:"Neither $.cookie or store is defined. A storage solution is required for storing state",followLink:"Follow link is set but the plugin is not included"},className:{bottom:"bottom",hover:"hover",fixed:"fixed"},selector:{close:".icon.close"},speed:500,easing:"easeOutQuad"}})(jQuery,window,document); |
2
build/minified/modules/popup.min.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
2
build/minified/modules/search.min.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
2
build/minified/modules/shape.min.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
2
build/minified/modules/tab.min.js
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,325 @@ |
|||
/* ****************************** |
|||
Semantic Module: Carousel |
|||
Author: Jack Lukic |
|||
Notes: First Commit May 28, 2013 |
|||
|
|||
A carousel alternates between |
|||
several pieces of content in sequence. |
|||
|
|||
****************************** */ |
|||
|
|||
;(function ( $, window, document, undefined ) { |
|||
|
|||
$.fn.carousel = function(parameters) { |
|||
var |
|||
$allModules = $(this), |
|||
|
|||
settings = $.extend(true, {}, $.fn.carousel.settings, parameters), |
|||
|
|||
eventNamespace = '.' + settings.namespace, |
|||
moduleNamespace = 'module-' + settings.namespace, |
|||
moduleSelector = $allModules.selector || '', |
|||
|
|||
time = new Date().getTime(), |
|||
performance = [], |
|||
|
|||
query = arguments[0], |
|||
methodInvoked = (typeof query == 'string'), |
|||
queryArguments = [].slice.call(arguments, 1), |
|||
invokedResponse |
|||
; |
|||
|
|||
$allModules |
|||
.each(function() { |
|||
var |
|||
$module = $(this), |
|||
$arrows = $(settings.selector.arrows), |
|||
$leftArrow = $(settings.selector.leftArrow), |
|||
$rightArrow = $(settings.selector.rightArrow), |
|||
$content = $(settings.selector.content), |
|||
$navigation = $(settings.selector.navigation), |
|||
$navItem = $(settings.selector.navItem), |
|||
|
|||
selector = $module.selector || '', |
|||
element = this, |
|||
instance = $module.data('module-' + settings.namespace), |
|||
|
|||
className = settings.className, |
|||
namespace = settings.namespace, |
|||
errors = settings.errors, |
|||
module |
|||
; |
|||
|
|||
module = { |
|||
|
|||
initialize: function() { |
|||
module.openingAnimation(); |
|||
module.marquee.autoAdvance(); |
|||
$leftArrow |
|||
.on('click', module.marquee.left) |
|||
; |
|||
$rightArrow |
|||
.on('click', module.marquee.right) |
|||
; |
|||
$navItem |
|||
.on('click', module.marquee.change) |
|||
; |
|||
}, |
|||
|
|||
destroy: function() { |
|||
module.verbose('Destroying previous module for', $module); |
|||
$module |
|||
.off(namespace) |
|||
; |
|||
}, |
|||
|
|||
left: function() { |
|||
var |
|||
$activeContent = $content.filter('.' + className.active), |
|||
currentIndex = $content.index($activeContent), |
|||
imageCount = $content.size(), |
|||
newIndex = (currentIndex - 1 != -1) |
|||
? (currentIndex - 1) |
|||
: (imageCount - 1) |
|||
; |
|||
$navItem |
|||
.eq(newIndex) |
|||
.trigger('click') |
|||
; |
|||
}, |
|||
|
|||
right: function() { |
|||
var |
|||
$activeContent = $content.filter('.' + className.active), |
|||
currentIndex = $content.index($activeContent), |
|||
imageCount = $content.size(), |
|||
newIndex = (currentIndex + 1 != imageCount) |
|||
? (currentIndex + 1) |
|||
: 0 |
|||
; |
|||
$navItem |
|||
.eq(newIndex) |
|||
.trigger('click') |
|||
; |
|||
}, |
|||
|
|||
change: function() { |
|||
var |
|||
$selected = $(this), |
|||
selectedIndex = $navItem.index($selected), |
|||
$selectedImage = $content.eq(selectedIndex) |
|||
; |
|||
module.marquee.autoAdvance(); |
|||
$selected |
|||
.addClass('active') |
|||
.siblings() |
|||
.removeClass('active') |
|||
; |
|||
$selectedImage |
|||
.addClass('active animated fadeIn') |
|||
.siblings('.' + className.active) |
|||
.removeClass('animated fadeIn scaleIn') |
|||
.animate({ |
|||
opacity: 0 |
|||
}, 500, function(){ |
|||
$(this) |
|||
.removeClass('active') |
|||
.removeAttr('style') |
|||
; |
|||
}) |
|||
; |
|||
}, |
|||
|
|||
autoAdvance: function() { |
|||
clearInterval(module.timer); |
|||
module.timer = setInterval(module.marquee.right, settings.duration); |
|||
}, |
|||
|
|||
setting: function(name, value) { |
|||
if(value !== undefined) { |
|||
if( $.isPlainObject(name) ) { |
|||
module.verbose('Modifying settings object', name, value); |
|||
$.extend(true, settings, name); |
|||
} |
|||
else { |
|||
module.verbose('Modifying setting', name, value); |
|||
settings[name] = value; |
|||
} |
|||
} |
|||
else { |
|||
return settings[name]; |
|||
} |
|||
}, |
|||
internal: function(name, value) { |
|||
if(value !== undefined) { |
|||
if( $.isPlainObject(name) ) { |
|||
module.verbose('Modifying internal property', name, value); |
|||
$.extend(true, module, name); |
|||
} |
|||
else { |
|||
module.verbose('Changing internal method to', value); |
|||
module[name] = value; |
|||
} |
|||
} |
|||
else { |
|||
return module[name]; |
|||
} |
|||
}, |
|||
debug: function() { |
|||
if(settings.debug) { |
|||
if(settings.performance) { |
|||
module.performance.log(arguments); |
|||
} |
|||
else { |
|||
module.debug = Function.prototype.bind.call(console.info, console, settings.moduleName + ':'); |
|||
} |
|||
} |
|||
}, |
|||
verbose: function() { |
|||
if(settings.verbose && settings.debug) { |
|||
if(settings.performance) { |
|||
module.performance.log(arguments); |
|||
} |
|||
else { |
|||
module.verbose = Function.prototype.bind.call(console.info, console, settings.moduleName + ':'); |
|||
} |
|||
} |
|||
}, |
|||
error: function() { |
|||
module.error = Function.prototype.bind.call(console.log, console, settings.moduleName + ':'); |
|||
}, |
|||
performance: { |
|||
log: function(message) { |
|||
var |
|||
currentTime, |
|||
executionTime, |
|||
previousTime |
|||
; |
|||
if(settings.performance) { |
|||
currentTime = new Date().getTime(); |
|||
previousTime = time || currentTime, |
|||
executionTime = currentTime - previousTime; |
|||
time = currentTime; |
|||
performance.push({ |
|||
'Element' : element, |
|||
'Name' : message[0], |
|||
'Arguments' : message[1] || 'None', |
|||
'Execution Time' : executionTime |
|||
}); |
|||
clearTimeout(module.performance.timer); |
|||
module.performance.timer = setTimeout(module.performance.display, 100); |
|||
} |
|||
}, |
|||
display: function() { |
|||
var |
|||
title = settings.moduleName, |
|||
caption = settings.moduleName + ': ' + moduleSelector + '(' + $allModules.size() + ' elements)', |
|||
totalExecutionTime = 0 |
|||
; |
|||
if(moduleSelector) { |
|||
title += ' Performance (' + moduleSelector + ')'; |
|||
} |
|||
if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) { |
|||
console.groupCollapsed(title); |
|||
if(console.table) { |
|||
$.each(performance, function(index, data) { |
|||
totalExecutionTime += data['Execution Time']; |
|||
}); |
|||
console.table(performance); |
|||
} |
|||
else { |
|||
$.each(performance, function(index, data) { |
|||
totalExecutionTime += data['Execution Time']; |
|||
console.log(data['Name'] + ': ' + data['Execution Time']+'ms'); |
|||
}); |
|||
} |
|||
console.log('Total Execution Time:', totalExecutionTime +'ms'); |
|||
console.groupEnd(); |
|||
performance = []; |
|||
time = false; |
|||
} |
|||
} |
|||
}, |
|||
invoke: function(query, passedArguments, context) { |
|||
var |
|||
maxDepth, |
|||
found |
|||
; |
|||
passedArguments = passedArguments || queryArguments; |
|||
context = element || context; |
|||
if(typeof query == 'string' && instance !== undefined) { |
|||
query = query.split('.'); |
|||
maxDepth = query.length - 1; |
|||
$.each(query, function(depth, value) { |
|||
if( $.isPlainObject( instance[value] ) && (depth != maxDepth) ) { |
|||
instance = instance[value]; |
|||
return true; |
|||
} |
|||
else if( instance[value] !== undefined ) { |
|||
found = instance[value]; |
|||
return true; |
|||
} |
|||
module.error(errors.method); |
|||
return false; |
|||
}); |
|||
} |
|||
if ( $.isFunction( found ) ) { |
|||
module.verbose('Executing invoked function', found); |
|||
return found.apply(context, passedArguments); |
|||
} |
|||
return found || false; |
|||
} |
|||
}; |
|||
|
|||
if(methodInvoked) { |
|||
if(instance === undefined) { |
|||
module.initialize(); |
|||
} |
|||
invokedResponse = module.invoke(query); |
|||
} |
|||
else { |
|||
if(instance !== undefined) { |
|||
module.destroy(); |
|||
} |
|||
module.initialize(); |
|||
} |
|||
}) |
|||
; |
|||
return (invokedResponse) |
|||
? invokedResponse |
|||
: this |
|||
; |
|||
}; |
|||
|
|||
$.fn.carousel.settings = { |
|||
|
|||
moduleName : 'Carousel Module', |
|||
namespace : 'carousel', |
|||
|
|||
verbose : true, |
|||
debug : true, |
|||
performance : true, |
|||
|
|||
// delegated event context
|
|||
duration: 5000, |
|||
|
|||
errors : { |
|||
method : 'The method you called is not defined.' |
|||
}, |
|||
|
|||
selector : { |
|||
arrows : '.arrow', |
|||
leftArrow : '.left.arrow', |
|||
rightArrow : '.right.arrow', |
|||
content : '.content', |
|||
navigation : '.navigation', |
|||
navItem : '.navigation .icon' |
|||
}, |
|||
|
|||
className : { |
|||
active : 'active' |
|||
} |
|||
|
|||
}; |
|||
|
|||
})( jQuery, window , document ); |
@ -1 +1 @@ |
|||
ae0c02f4bdcd565bf4bb21fc98ab167e9fffc02e |
|||
1a4ff22da9c3b4e30339c89eeb83925c00dcf89a |
@ -0,0 +1,325 @@ |
|||
/* ****************************** |
|||
Semantic Module: Carousel |
|||
Author: Jack Lukic |
|||
Notes: First Commit May 28, 2013 |
|||
|
|||
A carousel alternates between |
|||
several pieces of content in sequence. |
|||
|
|||
****************************** */ |
|||
|
|||
;(function ( $, window, document, undefined ) { |
|||
|
|||
$.fn.carousel = function(parameters) { |
|||
var |
|||
$allModules = $(this), |
|||
|
|||
settings = $.extend(true, {}, $.fn.carousel.settings, parameters), |
|||
|
|||
eventNamespace = '.' + settings.namespace, |
|||
moduleNamespace = 'module-' + settings.namespace, |
|||
moduleSelector = $allModules.selector || '', |
|||
|
|||
time = new Date().getTime(), |
|||
performance = [], |
|||
|
|||
query = arguments[0], |
|||
methodInvoked = (typeof query == 'string'), |
|||
queryArguments = [].slice.call(arguments, 1), |
|||
invokedResponse |
|||
; |
|||
|
|||
$allModules |
|||
.each(function() { |
|||
var |
|||
$module = $(this), |
|||
$arrows = $(settings.selector.arrows), |
|||
$leftArrow = $(settings.selector.leftArrow), |
|||
$rightArrow = $(settings.selector.rightArrow), |
|||
$content = $(settings.selector.content), |
|||
$navigation = $(settings.selector.navigation), |
|||
$navItem = $(settings.selector.navItem), |
|||
|
|||
selector = $module.selector || '', |
|||
element = this, |
|||
instance = $module.data('module-' + settings.namespace), |
|||
|
|||
className = settings.className, |
|||
namespace = settings.namespace, |
|||
errors = settings.errors, |
|||
module |
|||
; |
|||
|
|||
module = { |
|||
|
|||
initialize: function() { |
|||
module.openingAnimation(); |
|||
module.marquee.autoAdvance(); |
|||
$leftArrow |
|||
.on('click', module.marquee.left) |
|||
; |
|||
$rightArrow |
|||
.on('click', module.marquee.right) |
|||
; |
|||
$navItem |
|||
.on('click', module.marquee.change) |
|||
; |
|||
}, |
|||
|
|||
destroy: function() { |
|||
module.verbose('Destroying previous module for', $module); |
|||
$module |
|||
.off(namespace) |
|||
; |
|||
}, |
|||
|
|||
left: function() { |
|||
var |
|||
$activeContent = $content.filter('.' + className.active), |
|||
currentIndex = $content.index($activeContent), |
|||
imageCount = $content.size(), |
|||
newIndex = (currentIndex - 1 != -1) |
|||
? (currentIndex - 1) |
|||
: (imageCount - 1) |
|||
; |
|||
$navItem |
|||
.eq(newIndex) |
|||
.trigger('click') |
|||
; |
|||
}, |
|||
|
|||
right: function() { |
|||
var |
|||
$activeContent = $content.filter('.' + className.active), |
|||
currentIndex = $content.index($activeContent), |
|||
imageCount = $content.size(), |
|||
newIndex = (currentIndex + 1 != imageCount) |
|||
? (currentIndex + 1) |
|||
: 0 |
|||
; |
|||
$navItem |
|||
.eq(newIndex) |
|||
.trigger('click') |
|||
; |
|||
}, |
|||
|
|||
change: function() { |
|||
var |
|||
$selected = $(this), |
|||
selectedIndex = $navItem.index($selected), |
|||
$selectedImage = $content.eq(selectedIndex) |
|||
; |
|||
module.marquee.autoAdvance(); |
|||
$selected |
|||
.addClass('active') |
|||
.siblings() |
|||
.removeClass('active') |
|||
; |
|||
$selectedImage |
|||
.addClass('active animated fadeIn') |
|||
.siblings('.' + className.active) |
|||
.removeClass('animated fadeIn scaleIn') |
|||
.animate({ |
|||
opacity: 0 |
|||
}, 500, function(){ |
|||
$(this) |
|||
.removeClass('active') |
|||
.removeAttr('style') |
|||
; |
|||
}) |
|||
; |
|||
}, |
|||
|
|||
autoAdvance: function() { |
|||
clearInterval(module.timer); |
|||
module.timer = setInterval(module.marquee.right, settings.duration); |
|||
}, |
|||
|
|||
setting: function(name, value) { |
|||
if(value !== undefined) { |
|||
if( $.isPlainObject(name) ) { |
|||
module.verbose('Modifying settings object', name, value); |
|||
$.extend(true, settings, name); |
|||
} |
|||
else { |
|||
module.verbose('Modifying setting', name, value); |
|||
settings[name] = value; |
|||
} |
|||
} |
|||
else { |
|||
return settings[name]; |
|||
} |
|||
}, |
|||
internal: function(name, value) { |
|||
if(value !== undefined) { |
|||
if( $.isPlainObject(name) ) { |
|||
module.verbose('Modifying internal property', name, value); |
|||
$.extend(true, module, name); |
|||
} |
|||
else { |
|||
module.verbose('Changing internal method to', value); |
|||
module[name] = value; |
|||
} |
|||
} |
|||
else { |
|||
return module[name]; |
|||
} |
|||
}, |
|||
debug: function() { |
|||
if(settings.debug) { |
|||
if(settings.performance) { |
|||
module.performance.log(arguments); |
|||
} |
|||
else { |
|||
module.debug = Function.prototype.bind.call(console.info, console, settings.moduleName + ':'); |
|||
} |
|||
} |
|||
}, |
|||
verbose: function() { |
|||
if(settings.verbose && settings.debug) { |
|||
if(settings.performance) { |
|||
module.performance.log(arguments); |
|||
} |
|||
else { |
|||
module.verbose = Function.prototype.bind.call(console.info, console, settings.moduleName + ':'); |
|||
} |
|||
} |
|||
}, |
|||
error: function() { |
|||
module.error = Function.prototype.bind.call(console.log, console, settings.moduleName + ':'); |
|||
}, |
|||
performance: { |
|||
log: function(message) { |
|||
var |
|||
currentTime, |
|||
executionTime, |
|||
previousTime |
|||
; |
|||
if(settings.performance) { |
|||
currentTime = new Date().getTime(); |
|||
previousTime = time || currentTime, |
|||
executionTime = currentTime - previousTime; |
|||
time = currentTime; |
|||
performance.push({ |
|||
'Element' : element, |
|||
'Name' : message[0], |
|||
'Arguments' : message[1] || 'None', |
|||
'Execution Time' : executionTime |
|||
}); |
|||
clearTimeout(module.performance.timer); |
|||
module.performance.timer = setTimeout(module.performance.display, 100); |
|||
} |
|||
}, |
|||
display: function() { |
|||
var |
|||
title = settings.moduleName, |
|||
caption = settings.moduleName + ': ' + moduleSelector + '(' + $allModules.size() + ' elements)', |
|||
totalExecutionTime = 0 |
|||
; |
|||
if(moduleSelector) { |
|||
title += ' Performance (' + moduleSelector + ')'; |
|||
} |
|||
if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) { |
|||
console.groupCollapsed(title); |
|||
if(console.table) { |
|||
$.each(performance, function(index, data) { |
|||
totalExecutionTime += data['Execution Time']; |
|||
}); |
|||
console.table(performance); |
|||
} |
|||
else { |
|||
$.each(performance, function(index, data) { |
|||
totalExecutionTime += data['Execution Time']; |
|||
console.log(data['Name'] + ': ' + data['Execution Time']+'ms'); |
|||
}); |
|||
} |
|||
console.log('Total Execution Time:', totalExecutionTime +'ms'); |
|||
console.groupEnd(); |
|||
performance = []; |
|||
time = false; |
|||
} |
|||
} |
|||
}, |
|||
invoke: function(query, passedArguments, context) { |
|||
var |
|||
maxDepth, |
|||
found |
|||
; |
|||
passedArguments = passedArguments || queryArguments; |
|||
context = element || context; |
|||
if(typeof query == 'string' && instance !== undefined) { |
|||
query = query.split('.'); |
|||
maxDepth = query.length - 1; |
|||
$.each(query, function(depth, value) { |
|||
if( $.isPlainObject( instance[value] ) && (depth != maxDepth) ) { |
|||
instance = instance[value]; |
|||
return true; |
|||
} |
|||
else if( instance[value] !== undefined ) { |
|||
found = instance[value]; |
|||
return true; |
|||
} |
|||
module.error(errors.method); |
|||
return false; |
|||
}); |
|||
} |
|||
if ( $.isFunction( found ) ) { |
|||
module.verbose('Executing invoked function', found); |
|||
return found.apply(context, passedArguments); |
|||
} |
|||
return found || false; |
|||
} |
|||
}; |
|||
|
|||
if(methodInvoked) { |
|||
if(instance === undefined) { |
|||
module.initialize(); |
|||
} |
|||
invokedResponse = module.invoke(query); |
|||
} |
|||
else { |
|||
if(instance !== undefined) { |
|||
module.destroy(); |
|||
} |
|||
module.initialize(); |
|||
} |
|||
}) |
|||
; |
|||
return (invokedResponse) |
|||
? invokedResponse |
|||
: this |
|||
; |
|||
}; |
|||
|
|||
$.fn.carousel.settings = { |
|||
|
|||
moduleName : 'Carousel Module', |
|||
namespace : 'carousel', |
|||
|
|||
verbose : true, |
|||
debug : true, |
|||
performance : true, |
|||
|
|||
// delegated event context
|
|||
duration: 5000, |
|||
|
|||
errors : { |
|||
method : 'The method you called is not defined.' |
|||
}, |
|||
|
|||
selector : { |
|||
arrows : '.arrow', |
|||
leftArrow : '.left.arrow', |
|||
rightArrow : '.right.arrow', |
|||
content : '.content', |
|||
navigation : '.navigation', |
|||
navItem : '.navigation .icon' |
|||
}, |
|||
|
|||
className : { |
|||
active : 'active' |
|||
} |
|||
|
|||
}; |
|||
|
|||
})( jQuery, window , document ); |
@ -0,0 +1,161 @@ |
|||
--- |
|||
layout : 'default' |
|||
css : 'carousel' |
|||
|
|||
title : 'Carousel' |
|||
type : 'UI Module' |
|||
--- |
|||
<script src="/javascript/carousel.js"></script> |
|||
|
|||
<div class="segment"> |
|||
<div class="container"> |
|||
<h1 class="ui dividing header">Carousel</h1> |
|||
<p>A carousel is a <a href="/module.html">ui module</a> which indicates a user's selection of a choice.</p> |
|||
</div> |
|||
</div> |
|||
<div class="main container"> |
|||
|
|||
<div class="peek"> |
|||
<div class="ui vertical pointing secondary menu"> |
|||
<a class="active item">Standard</a> |
|||
<a class="item">Variations</a> |
|||
<a class="item">Behavior</a> |
|||
<a class="item">Examples</a> |
|||
<a class="item">Usage</a> |
|||
</div> |
|||
</div> |
|||
|
|||
<h2 class="ui dividing header">Standard</h2> |
|||
|
|||
<div class="example"> |
|||
<h4 class="ui header">Carousel</h4> |
|||
<p>A standard carousel</p> |
|||
<div class="ui carousel"> |
|||
<div class="throbber"></div> |
|||
<div class="left arrow"> |
|||
<i class="left arrow icon"></i> |
|||
</div> |
|||
<div class="right arrow"> |
|||
<i class="right arrow icon"></i> |
|||
</div> |
|||
<div class="content"> |
|||
aaa |
|||
</div> |
|||
<div class="content"> |
|||
bbb |
|||
</div> |
|||
<div class="content"> |
|||
ccc |
|||
</div> |
|||
<div class="content"> |
|||
ddd |
|||
</div> |
|||
<ul class="select"> |
|||
<i class="active circle icon"></i> |
|||
<i class="circle icon"></i> |
|||
<i class="circle icon"></i> |
|||
<i class="circle icon"></i> |
|||
</ul> |
|||
</div> |
|||
|
|||
</div> |
|||
|
|||
<h2 class="ui dividing header">Usage</h2> |
|||
|
|||
<h3>Initializing</h3> |
|||
<h3 class="ui header">Initializing a check box</h3> |
|||
<div class="code"> |
|||
$('.ui.carousel') |
|||
.carousel() |
|||
; |
|||
</div> |
|||
|
|||
<h3 class="ui header">Settings</h3> |
|||
<table class="ui settings celled table"> |
|||
<thead> |
|||
<th colspan="3">Carousel Settings</th> |
|||
</thead> |
|||
<tbody> |
|||
<tr> |
|||
<td>required</td> |
|||
<td>auto</td> |
|||
<td>Setting to true/false will determine whether an input will allow no selection. Auto will set disallow this behavior only for radio boxes</td> |
|||
</tr> |
|||
<tr> |
|||
<td>context</td> |
|||
<td>false</td> |
|||
<td>A selector or jQuery object to use as a delegated event context</td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
|
|||
<table class="ui settings celled table"> |
|||
<thead> |
|||
<th colspan="3">Callbacks</th> |
|||
</thead> |
|||
<tbody> |
|||
<tr> |
|||
<td>onChange</td> |
|||
<td>None</td> |
|||
<td>Callback after a carousel is either disabled or enabled.</td> |
|||
</tr> |
|||
<tr> |
|||
<td>onEnable</td> |
|||
<td>None</td> |
|||
<td>Callback after a carousel is enabled.</td> |
|||
</tr> |
|||
<tr> |
|||
<td>onDisable</td> |
|||
<td>None</td> |
|||
<td>Callback after a carousel is disabled.</td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
|
|||
<table class="ui settings celled table"> |
|||
<thead> |
|||
<th colspan="3">UI Module Settings</th> |
|||
</thead> |
|||
<tbody> |
|||
<tr> |
|||
<td>moduleName</td> |
|||
<td>Carousel</td> |
|||
<td>Name used in debug logs</td> |
|||
</tr> |
|||
<tr> |
|||
<td>debug</td> |
|||
<td>True</td> |
|||
<td>Provides standard debug output to console</td> |
|||
</tr> |
|||
<tr> |
|||
<td>performance</td> |
|||
<td>False</td> |
|||
<td>Provides standard debug output to console</td> |
|||
</tr> |
|||
<tr> |
|||
<td>verbose</td> |
|||
<td>False</td> |
|||
<td>Provides ancillary debug output to console</td> |
|||
</tr> |
|||
<tr> |
|||
<td>namespace</td> |
|||
<td>carousel</td> |
|||
<td>Event namespace. Makes sure module teardown does not effect other events attached to an element.</td> |
|||
</tr> |
|||
<tr> |
|||
<td>errors</td> |
|||
<td colspan="2"> |
|||
<div class="code"> |
|||
errors : { |
|||
method : 'The method you called is not defined.' |
|||
} |
|||
</div> |
|||
</td> |
|||
</tr> |
|||
</tbody> |
|||
</table> |
|||
|
|||
</div> |
|||
</body> |
|||
|
|||
</html> |
@ -0,0 +1,325 @@ |
|||
/* ****************************** |
|||
Semantic Module: Carousel |
|||
Author: Jack Lukic |
|||
Notes: First Commit May 28, 2013 |
|||
|
|||
A carousel alternates between |
|||
several pieces of content in sequence. |
|||
|
|||
****************************** */ |
|||
|
|||
;(function ( $, window, document, undefined ) { |
|||
|
|||
$.fn.carousel = function(parameters) { |
|||
var |
|||
$allModules = $(this), |
|||
|
|||
settings = $.extend(true, {}, $.fn.carousel.settings, parameters), |
|||
|
|||
eventNamespace = '.' + settings.namespace, |
|||
moduleNamespace = 'module-' + settings.namespace, |
|||
moduleSelector = $allModules.selector || '', |
|||
|
|||
time = new Date().getTime(), |
|||
performance = [], |
|||
|
|||
query = arguments[0], |
|||
methodInvoked = (typeof query == 'string'), |
|||
queryArguments = [].slice.call(arguments, 1), |
|||
invokedResponse |
|||
; |
|||
|
|||
$allModules |
|||
.each(function() { |
|||
var |
|||
$module = $(this), |
|||
$arrows = $(settings.selector.arrows), |
|||
$leftArrow = $(settings.selector.leftArrow), |
|||
$rightArrow = $(settings.selector.rightArrow), |
|||
$content = $(settings.selector.content), |
|||
$navigation = $(settings.selector.navigation), |
|||
$navItem = $(settings.selector.navItem), |
|||
|
|||
selector = $module.selector || '', |
|||
element = this, |
|||
instance = $module.data('module-' + settings.namespace), |
|||
|
|||
className = settings.className, |
|||
namespace = settings.namespace, |
|||
errors = settings.errors, |
|||
module |
|||
; |
|||
|
|||
module = { |
|||
|
|||
initialize: function() { |
|||
module.openingAnimation(); |
|||
module.marquee.autoAdvance(); |
|||
$leftArrow |
|||
.on('click', module.marquee.left) |
|||
; |
|||
$rightArrow |
|||
.on('click', module.marquee.right) |
|||
; |
|||
$navItem |
|||
.on('click', module.marquee.change) |
|||
; |
|||
}, |
|||
|
|||
destroy: function() { |
|||
module.verbose('Destroying previous module for', $module); |
|||
$module |
|||
.off(namespace) |
|||
; |
|||
}, |
|||
|
|||
left: function() { |
|||
var |
|||
$activeContent = $content.filter('.' + className.active), |
|||
currentIndex = $content.index($activeContent), |
|||
imageCount = $content.size(), |
|||
newIndex = (currentIndex - 1 != -1) |
|||
? (currentIndex - 1) |
|||
: (imageCount - 1) |
|||
; |
|||
$navItem |
|||
.eq(newIndex) |
|||
.trigger('click') |
|||
; |
|||
}, |
|||
|
|||
right: function() { |
|||
var |
|||
$activeContent = $content.filter('.' + className.active), |
|||
currentIndex = $content.index($activeContent), |
|||
imageCount = $content.size(), |
|||
newIndex = (currentIndex + 1 != imageCount) |
|||
? (currentIndex + 1) |
|||
: 0 |
|||
; |
|||
$navItem |
|||
.eq(newIndex) |
|||
.trigger('click') |
|||
; |
|||
}, |
|||
|
|||
change: function() { |
|||
var |
|||
$selected = $(this), |
|||
selectedIndex = $navItem.index($selected), |
|||
$selectedImage = $content.eq(selectedIndex) |
|||
; |
|||
module.marquee.autoAdvance(); |
|||
$selected |
|||
.addClass('active') |
|||
.siblings() |
|||
.removeClass('active') |
|||
; |
|||
$selectedImage |
|||
.addClass('active animated fadeIn') |
|||
.siblings('.' + className.active) |
|||
.removeClass('animated fadeIn scaleIn') |
|||
.animate({ |
|||
opacity: 0 |
|||
}, 500, function(){ |
|||
$(this) |
|||
.removeClass('active') |
|||
.removeAttr('style') |
|||
; |
|||
}) |
|||
; |
|||
}, |
|||
|
|||
autoAdvance: function() { |
|||
clearInterval(module.timer); |
|||
module.timer = setInterval(module.marquee.right, settings.duration); |
|||
}, |
|||
|
|||
setting: function(name, value) { |
|||
if(value !== undefined) { |
|||
if( $.isPlainObject(name) ) { |
|||
module.verbose('Modifying settings object', name, value); |
|||
$.extend(true, settings, name); |
|||
} |
|||
else { |
|||
module.verbose('Modifying setting', name, value); |
|||
settings[name] = value; |
|||
} |
|||
} |
|||
else { |
|||
return settings[name]; |
|||
} |
|||
}, |
|||
internal: function(name, value) { |
|||
if(value !== undefined) { |
|||
if( $.isPlainObject(name) ) { |
|||
module.verbose('Modifying internal property', name, value); |
|||
$.extend(true, module, name); |
|||
} |
|||
else { |
|||
module.verbose('Changing internal method to', value); |
|||
module[name] = value; |
|||
} |
|||
} |
|||
else { |
|||
return module[name]; |
|||
} |
|||
}, |
|||
debug: function() { |
|||
if(settings.debug) { |
|||
if(settings.performance) { |
|||
module.performance.log(arguments); |
|||
} |
|||
else { |
|||
module.debug = Function.prototype.bind.call(console.info, console, settings.moduleName + ':'); |
|||
} |
|||
} |
|||
}, |
|||
verbose: function() { |
|||
if(settings.verbose && settings.debug) { |
|||
if(settings.performance) { |
|||
module.performance.log(arguments); |
|||
} |
|||
else { |
|||
module.verbose = Function.prototype.bind.call(console.info, console, settings.moduleName + ':'); |
|||
} |
|||
} |
|||
}, |
|||
error: function() { |
|||
module.error = Function.prototype.bind.call(console.log, console, settings.moduleName + ':'); |
|||
}, |
|||
performance: { |
|||
log: function(message) { |
|||
var |
|||
currentTime, |
|||
executionTime, |
|||
previousTime |
|||
; |
|||
if(settings.performance) { |
|||
currentTime = new Date().getTime(); |
|||
previousTime = time || currentTime, |
|||
executionTime = currentTime - previousTime; |
|||
time = currentTime; |
|||
performance.push({ |
|||
'Element' : element, |
|||
'Name' : message[0], |
|||
'Arguments' : message[1] || 'None', |
|||
'Execution Time' : executionTime |
|||
}); |
|||
clearTimeout(module.performance.timer); |
|||
module.performance.timer = setTimeout(module.performance.display, 100); |
|||
} |
|||
}, |
|||
display: function() { |
|||
var |
|||
title = settings.moduleName, |
|||
caption = settings.moduleName + ': ' + moduleSelector + '(' + $allModules.size() + ' elements)', |
|||
totalExecutionTime = 0 |
|||
; |
|||
if(moduleSelector) { |
|||
title += ' Performance (' + moduleSelector + ')'; |
|||
} |
|||
if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) { |
|||
console.groupCollapsed(title); |
|||
if(console.table) { |
|||
$.each(performance, function(index, data) { |
|||
totalExecutionTime += data['Execution Time']; |
|||
}); |
|||
console.table(performance); |
|||
} |
|||
else { |
|||
$.each(performance, function(index, data) { |
|||
totalExecutionTime += data['Execution Time']; |
|||
console.log(data['Name'] + ': ' + data['Execution Time']+'ms'); |
|||
}); |
|||
} |
|||
console.log('Total Execution Time:', totalExecutionTime +'ms'); |
|||
console.groupEnd(); |
|||
performance = []; |
|||
time = false; |
|||
} |
|||
} |
|||
}, |
|||
invoke: function(query, passedArguments, context) { |
|||
var |
|||
maxDepth, |
|||
found |
|||
; |
|||
passedArguments = passedArguments || queryArguments; |
|||
context = element || context; |
|||
if(typeof query == 'string' && instance !== undefined) { |
|||
query = query.split('.'); |
|||
maxDepth = query.length - 1; |
|||
$.each(query, function(depth, value) { |
|||
if( $.isPlainObject( instance[value] ) && (depth != maxDepth) ) { |
|||
instance = instance[value]; |
|||
return true; |
|||
} |
|||
else if( instance[value] !== undefined ) { |
|||
found = instance[value]; |
|||
return true; |
|||
} |
|||
module.error(errors.method); |
|||
return false; |
|||
}); |
|||
} |
|||
if ( $.isFunction( found ) ) { |
|||
module.verbose('Executing invoked function', found); |
|||
return found.apply(context, passedArguments); |
|||
} |
|||
return found || false; |
|||
} |
|||
}; |
|||
|
|||
if(methodInvoked) { |
|||
if(instance === undefined) { |
|||
module.initialize(); |
|||
} |
|||
invokedResponse = module.invoke(query); |
|||
} |
|||
else { |
|||
if(instance !== undefined) { |
|||
module.destroy(); |
|||
} |
|||
module.initialize(); |
|||
} |
|||
}) |
|||
; |
|||
return (invokedResponse) |
|||
? invokedResponse |
|||
: this |
|||
; |
|||
}; |
|||
|
|||
$.fn.carousel.settings = { |
|||
|
|||
moduleName : 'Carousel Module', |
|||
namespace : 'carousel', |
|||
|
|||
verbose : true, |
|||
debug : true, |
|||
performance : true, |
|||
|
|||
// delegated event context
|
|||
duration: 5000, |
|||
|
|||
errors : { |
|||
method : 'The method you called is not defined.' |
|||
}, |
|||
|
|||
selector : { |
|||
arrows : '.arrow', |
|||
leftArrow : '.left.arrow', |
|||
rightArrow : '.right.arrow', |
|||
content : '.content', |
|||
navigation : '.navigation', |
|||
navItem : '.navigation .icon' |
|||
}, |
|||
|
|||
className : { |
|||
active : 'active' |
|||
} |
|||
|
|||
}; |
|||
|
|||
})( jQuery, window , document ); |
@ -0,0 +1,23 @@ |
|||
|
|||
.ui.carousel .throbber { |
|||
position: absolute; |
|||
top: 219px; |
|||
left: 446px; |
|||
display: none; |
|||
background: url(../images/welcome/throbber.gif) no-repeat 0px 0px; |
|||
width: 32px; |
|||
height: 32px; |
|||
z-index: 9999; |
|||
} |
|||
|
|||
|
|||
|
|||
/* loading state */ |
|||
.ui.loading.carousel .select, |
|||
.ui.loading.carousel .arrow, |
|||
.ui.loading.carousel .slide { |
|||
visibility: hidden; |
|||
} |
|||
.ui.loading.carousel .throbber { |
|||
display: block; |
|||
} |
@ -0,0 +1,325 @@ |
|||
/* ****************************** |
|||
Semantic Module: Carousel |
|||
Author: Jack Lukic |
|||
Notes: First Commit May 28, 2013 |
|||
|
|||
A carousel alternates between |
|||
several pieces of content in sequence. |
|||
|
|||
****************************** */ |
|||
|
|||
;(function ( $, window, document, undefined ) { |
|||
|
|||
$.fn.carousel = function(parameters) { |
|||
var |
|||
$allModules = $(this), |
|||
|
|||
settings = $.extend(true, {}, $.fn.carousel.settings, parameters), |
|||
|
|||
eventNamespace = '.' + settings.namespace, |
|||
moduleNamespace = 'module-' + settings.namespace, |
|||
moduleSelector = $allModules.selector || '', |
|||
|
|||
time = new Date().getTime(), |
|||
performance = [], |
|||
|
|||
query = arguments[0], |
|||
methodInvoked = (typeof query == 'string'), |
|||
queryArguments = [].slice.call(arguments, 1), |
|||
invokedResponse |
|||
; |
|||
|
|||
$allModules |
|||
.each(function() { |
|||
var |
|||
$module = $(this), |
|||
$arrows = $(settings.selector.arrows), |
|||
$leftArrow = $(settings.selector.leftArrow), |
|||
$rightArrow = $(settings.selector.rightArrow), |
|||
$content = $(settings.selector.content), |
|||
$navigation = $(settings.selector.navigation), |
|||
$navItem = $(settings.selector.navItem), |
|||
|
|||
selector = $module.selector || '', |
|||
element = this, |
|||
instance = $module.data('module-' + settings.namespace), |
|||
|
|||
className = settings.className, |
|||
namespace = settings.namespace, |
|||
errors = settings.errors, |
|||
module |
|||
; |
|||
|
|||
module = { |
|||
|
|||
initialize: function() { |
|||
module.openingAnimation(); |
|||
module.marquee.autoAdvance(); |
|||
$leftArrow |
|||
.on('click', module.marquee.left) |
|||
; |
|||
$rightArrow |
|||
.on('click', module.marquee.right) |
|||
; |
|||
$navItem |
|||
.on('click', module.marquee.change) |
|||
; |
|||
}, |
|||
|
|||
destroy: function() { |
|||
module.verbose('Destroying previous module for', $module); |
|||
$module |
|||
.off(namespace) |
|||
; |
|||
}, |
|||
|
|||
left: function() { |
|||
var |
|||
$activeContent = $content.filter('.' + className.active), |
|||
currentIndex = $content.index($activeContent), |
|||
imageCount = $content.size(), |
|||
newIndex = (currentIndex - 1 != -1) |
|||
? (currentIndex - 1) |
|||
: (imageCount - 1) |
|||
; |
|||
$navItem |
|||
.eq(newIndex) |
|||
.trigger('click') |
|||
; |
|||
}, |
|||
|
|||
right: function() { |
|||
var |
|||
$activeContent = $content.filter('.' + className.active), |
|||
currentIndex = $content.index($activeContent), |
|||
imageCount = $content.size(), |
|||
newIndex = (currentIndex + 1 != imageCount) |
|||
? (currentIndex + 1) |
|||
: 0 |
|||
; |
|||
$navItem |
|||
.eq(newIndex) |
|||
.trigger('click') |
|||
; |
|||
}, |
|||
|
|||
change: function() { |
|||
var |
|||
$selected = $(this), |
|||
selectedIndex = $navItem.index($selected), |
|||
$selectedImage = $content.eq(selectedIndex) |
|||
; |
|||
module.marquee.autoAdvance(); |
|||
$selected |
|||
.addClass('active') |
|||
.siblings() |
|||
.removeClass('active') |
|||
; |
|||
$selectedImage |
|||
.addClass('active animated fadeIn') |
|||
.siblings('.' + className.active) |
|||
.removeClass('animated fadeIn scaleIn') |
|||
.animate({ |
|||
opacity: 0 |
|||
}, 500, function(){ |
|||
$(this) |
|||
.removeClass('active') |
|||
.removeAttr('style') |
|||
; |
|||
}) |
|||
; |
|||
}, |
|||
|
|||
autoAdvance: function() { |
|||
clearInterval(module.timer); |
|||
module.timer = setInterval(module.marquee.right, settings.duration); |
|||
}, |
|||
|
|||
setting: function(name, value) { |
|||
if(value !== undefined) { |
|||
if( $.isPlainObject(name) ) { |
|||
module.verbose('Modifying settings object', name, value); |
|||
$.extend(true, settings, name); |
|||
} |
|||
else { |
|||
module.verbose('Modifying setting', name, value); |
|||
settings[name] = value; |
|||
} |
|||
} |
|||
else { |
|||
return settings[name]; |
|||
} |
|||
}, |
|||
internal: function(name, value) { |
|||
if(value !== undefined) { |
|||
if( $.isPlainObject(name) ) { |
|||
module.verbose('Modifying internal property', name, value); |
|||
$.extend(true, module, name); |
|||
} |
|||
else { |
|||
module.verbose('Changing internal method to', value); |
|||
module[name] = value; |
|||
} |
|||
} |
|||
else { |
|||
return module[name]; |
|||
} |
|||
}, |
|||
debug: function() { |
|||
if(settings.debug) { |
|||
if(settings.performance) { |
|||
module.performance.log(arguments); |
|||
} |
|||
else { |
|||
module.debug = Function.prototype.bind.call(console.info, console, settings.moduleName + ':'); |
|||
} |
|||
} |
|||
}, |
|||
verbose: function() { |
|||
if(settings.verbose && settings.debug) { |
|||
if(settings.performance) { |
|||
module.performance.log(arguments); |
|||
} |
|||
else { |
|||
module.verbose = Function.prototype.bind.call(console.info, console, settings.moduleName + ':'); |
|||
} |
|||
} |
|||
}, |
|||
error: function() { |
|||
module.error = Function.prototype.bind.call(console.log, console, settings.moduleName + ':'); |
|||
}, |
|||
performance: { |
|||
log: function(message) { |
|||
var |
|||
currentTime, |
|||
executionTime, |
|||
previousTime |
|||
; |
|||
if(settings.performance) { |
|||
currentTime = new Date().getTime(); |
|||
previousTime = time || currentTime, |
|||
executionTime = currentTime - previousTime; |
|||
time = currentTime; |
|||
performance.push({ |
|||
'Element' : element, |
|||
'Name' : message[0], |
|||
'Arguments' : message[1] || 'None', |
|||
'Execution Time' : executionTime |
|||
}); |
|||
clearTimeout(module.performance.timer); |
|||
module.performance.timer = setTimeout(module.performance.display, 100); |
|||
} |
|||
}, |
|||
display: function() { |
|||
var |
|||
title = settings.moduleName, |
|||
caption = settings.moduleName + ': ' + moduleSelector + '(' + $allModules.size() + ' elements)', |
|||
totalExecutionTime = 0 |
|||
; |
|||
if(moduleSelector) { |
|||
title += ' Performance (' + moduleSelector + ')'; |
|||
} |
|||
if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) { |
|||
console.groupCollapsed(title); |
|||
if(console.table) { |
|||
$.each(performance, function(index, data) { |
|||
totalExecutionTime += data['Execution Time']; |
|||
}); |
|||
console.table(performance); |
|||
} |
|||
else { |
|||
$.each(performance, function(index, data) { |
|||
totalExecutionTime += data['Execution Time']; |
|||
console.log(data['Name'] + ': ' + data['Execution Time']+'ms'); |
|||
}); |
|||
} |
|||
console.log('Total Execution Time:', totalExecutionTime +'ms'); |
|||
console.groupEnd(); |
|||
performance = []; |
|||
time = false; |
|||
} |
|||
} |
|||
}, |
|||
invoke: function(query, passedArguments, context) { |
|||
var |
|||
maxDepth, |
|||
found |
|||
; |
|||
passedArguments = passedArguments || queryArguments; |
|||
context = element || context; |
|||
if(typeof query == 'string' && instance !== undefined) { |
|||
query = query.split('.'); |
|||
maxDepth = query.length - 1; |
|||
$.each(query, function(depth, value) { |
|||
if( $.isPlainObject( instance[value] ) && (depth != maxDepth) ) { |
|||
instance = instance[value]; |
|||
return true; |
|||
} |
|||
else if( instance[value] !== undefined ) { |
|||
found = instance[value]; |
|||
return true; |
|||
} |
|||
module.error(errors.method); |
|||
return false; |
|||
}); |
|||
} |
|||
if ( $.isFunction( found ) ) { |
|||
module.verbose('Executing invoked function', found); |
|||
return found.apply(context, passedArguments); |
|||
} |
|||
return found || false; |
|||
} |
|||
}; |
|||
|
|||
if(methodInvoked) { |
|||
if(instance === undefined) { |
|||
module.initialize(); |
|||
} |
|||
invokedResponse = module.invoke(query); |
|||
} |
|||
else { |
|||
if(instance !== undefined) { |
|||
module.destroy(); |
|||
} |
|||
module.initialize(); |
|||
} |
|||
}) |
|||
; |
|||
return (invokedResponse) |
|||
? invokedResponse |
|||
: this |
|||
; |
|||
}; |
|||
|
|||
$.fn.carousel.settings = { |
|||
|
|||
moduleName : 'Carousel Module', |
|||
namespace : 'carousel', |
|||
|
|||
verbose : true, |
|||
debug : true, |
|||
performance : true, |
|||
|
|||
// delegated event context
|
|||
duration: 5000, |
|||
|
|||
errors : { |
|||
method : 'The method you called is not defined.' |
|||
}, |
|||
|
|||
selector : { |
|||
arrows : '.arrow', |
|||
leftArrow : '.left.arrow', |
|||
rightArrow : '.right.arrow', |
|||
content : '.content', |
|||
navigation : '.navigation', |
|||
navItem : '.navigation .icon' |
|||
}, |
|||
|
|||
className : { |
|||
active : 'active' |
|||
} |
|||
|
|||
}; |
|||
|
|||
})( jQuery, window , document ); |
Write
Preview
Loading…
Cancel
Save