semantic-ui-less
Advanced tools
Comparing version 2.1.8 to 2.2.1
@@ -6,3 +6,2 @@ /*! | ||
* | ||
* Copyright 2015 Contributors | ||
* Released under the MIT license | ||
@@ -13,6 +12,14 @@ * http://opensource.org/licenses/MIT | ||
;(function ( $, window, document, undefined ) { | ||
;(function ($, window, document, undefined) { | ||
"use strict"; | ||
var | ||
window = (typeof window != 'undefined' && window.Math == Math) | ||
? window | ||
: (typeof self != 'undefined' && self.Math == Math) | ||
? self | ||
: Function('return this')() | ||
; | ||
$.api = $.fn.api = function(parameters) { | ||
@@ -146,3 +153,3 @@ | ||
response = module.decode.json(response); | ||
return false; | ||
return response; | ||
} | ||
@@ -239,3 +246,2 @@ }, | ||
module.verbose('Using AJAX settings', ajaxSettings); | ||
if(settings.cache === 'local' && module.read.cachedResponse(url)) { | ||
@@ -283,2 +289,5 @@ module.debug('Response returned from local cache'); | ||
}, | ||
expectingJSON: function() { | ||
return settings.dataType === 'json' || settings.dataType === 'jsonp'; | ||
}, | ||
form: function() { | ||
@@ -294,3 +303,6 @@ return $module.is('form') || $context.is('form'); | ||
loading: function() { | ||
return (module.request && module.request.state() == 'pending'); | ||
return (module.request) | ||
? (module.request.state() == 'pending') | ||
: false | ||
; | ||
}, | ||
@@ -308,3 +320,3 @@ abortedRequest: function(xhr) { | ||
validResponse: function(response) { | ||
if( (settings.dataType !== 'json' && settings.dataType !== 'jsonp') || !$.isFunction(settings.successTest) ) { | ||
if( (!module.is.expectingJSON()) || !$.isFunction(settings.successTest) ) { | ||
module.verbose('Response is not JSON, skipping validation', settings.successTest, response); | ||
@@ -479,3 +491,5 @@ return true; | ||
translatedResponse = ( $.isFunction(settings.onResponse) ) | ||
? settings.onResponse.call(context, $.extend(true, {}, response)) | ||
? module.is.expectingJSON() | ||
? settings.onResponse.call(context, $.extend(true, {}, response)) | ||
: settings.onResponse.call(context, response) | ||
: false | ||
@@ -561,2 +575,3 @@ ; | ||
settings.onAbort.call(context, status, $module, xhr); | ||
return true; | ||
} | ||
@@ -566,3 +581,3 @@ else if(status == 'invalid') { | ||
} | ||
else if(status == 'error') { | ||
else if(status == 'error') { | ||
if(xhr !== undefined) { | ||
@@ -660,3 +675,3 @@ module.debug('XHR produced a server error', status, httpMessage); | ||
; | ||
module.verbose('Created server request', xhr); | ||
module.verbose('Created server request', xhr, ajaxSettings); | ||
return xhr; | ||
@@ -692,3 +707,3 @@ } | ||
return $.isPlainObject(xhr) | ||
? (settings.dataType == 'json' || settings.dataType == 'jsonp') | ||
? (module.is.expectingJSON()) | ||
? module.decode.json(xhr.responseText) | ||
@@ -738,2 +753,5 @@ : xhr.responseText | ||
} | ||
if(runSettings === false) { | ||
return runSettings; | ||
} | ||
return (runSettings !== undefined) | ||
@@ -765,3 +783,3 @@ ? $.extend(true, {}, runSettings) | ||
} | ||
else if( !module.is.form() ) { | ||
else if( module.is.form() ) { | ||
@@ -845,3 +863,8 @@ } | ||
else if(value !== undefined) { | ||
settings[name] = value; | ||
if($.isPlainObject(settings[name])) { | ||
$.extend(true, settings[name], value); | ||
} | ||
else { | ||
settings[name] = value; | ||
} | ||
} | ||
@@ -864,3 +887,3 @@ else { | ||
debug: function() { | ||
if(settings.debug) { | ||
if(!settings.silent && settings.debug) { | ||
if(settings.performance) { | ||
@@ -876,3 +899,3 @@ module.performance.log(arguments); | ||
verbose: function() { | ||
if(settings.verbose && settings.debug) { | ||
if(!settings.silent && settings.verbose && settings.debug) { | ||
if(settings.performance) { | ||
@@ -888,4 +911,6 @@ module.performance.log(arguments); | ||
error: function() { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
if(!settings.silent) { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
} | ||
}, | ||
@@ -892,0 +917,0 @@ performance: { |
@@ -6,3 +6,2 @@ /*! | ||
* | ||
* Copyright 2015 Contributors | ||
* Released under the MIT license | ||
@@ -13,264 +12,271 @@ * http://opensource.org/licenses/MIT | ||
;(function ( $, window, document, undefined ) { | ||
;(function ($, window, document, undefined) { | ||
"use strict"; | ||
"use strict"; | ||
$.fn.colorize = function(parameters) { | ||
var | ||
settings = ( $.isPlainObject(parameters) ) | ||
? $.extend(true, {}, $.fn.colorize.settings, parameters) | ||
: $.extend({}, $.fn.colorize.settings), | ||
// hoist arguments | ||
moduleArguments = arguments || false | ||
; | ||
$(this) | ||
.each(function(instanceIndex) { | ||
window = (typeof window != 'undefined' && window.Math == Math) | ||
? window | ||
: (typeof self != 'undefined' && self.Math == Math) | ||
? self | ||
: Function('return this')() | ||
; | ||
var | ||
$module = $(this), | ||
$.fn.colorize = function(parameters) { | ||
var | ||
settings = ( $.isPlainObject(parameters) ) | ||
? $.extend(true, {}, $.fn.colorize.settings, parameters) | ||
: $.extend({}, $.fn.colorize.settings), | ||
// hoist arguments | ||
moduleArguments = arguments || false | ||
; | ||
$(this) | ||
.each(function(instanceIndex) { | ||
mainCanvas = $('<canvas />')[0], | ||
imageCanvas = $('<canvas />')[0], | ||
overlayCanvas = $('<canvas />')[0], | ||
var | ||
$module = $(this), | ||
backgroundImage = new Image(), | ||
mainCanvas = $('<canvas />')[0], | ||
imageCanvas = $('<canvas />')[0], | ||
overlayCanvas = $('<canvas />')[0], | ||
// defs | ||
mainContext, | ||
imageContext, | ||
overlayContext, | ||
backgroundImage = new Image(), | ||
image, | ||
imageName, | ||
// defs | ||
mainContext, | ||
imageContext, | ||
overlayContext, | ||
width, | ||
height, | ||
image, | ||
imageName, | ||
// shortucts | ||
colors = settings.colors, | ||
paths = settings.paths, | ||
namespace = settings.namespace, | ||
error = settings.error, | ||
width, | ||
height, | ||
// boilerplate | ||
instance = $module.data('module-' + namespace), | ||
module | ||
; | ||
// shortcuts | ||
colors = settings.colors, | ||
paths = settings.paths, | ||
namespace = settings.namespace, | ||
error = settings.error, | ||
module = { | ||
// boilerplate | ||
instance = $module.data('module-' + namespace), | ||
module | ||
; | ||
checkPreconditions: function() { | ||
module.debug('Checking pre-conditions'); | ||
module = { | ||
if( !$.isPlainObject(colors) || $.isEmptyObject(colors) ) { | ||
module.error(error.undefinedColors); | ||
return false; | ||
} | ||
return true; | ||
}, | ||
checkPreconditions: function() { | ||
module.debug('Checking pre-conditions'); | ||
async: function(callback) { | ||
if(settings.async) { | ||
setTimeout(callback, 0); | ||
} | ||
else { | ||
callback(); | ||
} | ||
}, | ||
if( !$.isPlainObject(colors) || $.isEmptyObject(colors) ) { | ||
module.error(error.undefinedColors); | ||
return false; | ||
} | ||
return true; | ||
}, | ||
getMetadata: function() { | ||
module.debug('Grabbing metadata'); | ||
image = $module.data('image') || settings.image || undefined; | ||
imageName = $module.data('name') || settings.name || instanceIndex; | ||
width = settings.width || $module.width(); | ||
height = settings.height || $module.height(); | ||
if(width === 0 || height === 0) { | ||
module.error(error.undefinedSize); | ||
} | ||
}, | ||
async: function(callback) { | ||
if(settings.async) { | ||
setTimeout(callback, 0); | ||
} | ||
else { | ||
callback(); | ||
} | ||
}, | ||
initialize: function() { | ||
module.debug('Initializing with colors', colors); | ||
if( module.checkPreconditions() ) { | ||
getMetadata: function() { | ||
module.debug('Grabbing metadata'); | ||
image = $module.data('image') || settings.image || undefined; | ||
imageName = $module.data('name') || settings.name || instanceIndex; | ||
width = settings.width || $module.width(); | ||
height = settings.height || $module.height(); | ||
if(width === 0 || height === 0) { | ||
module.error(error.undefinedSize); | ||
} | ||
}, | ||
module.async(function() { | ||
module.getMetadata(); | ||
module.canvas.create(); | ||
initialize: function() { | ||
module.debug('Initializing with colors', colors); | ||
if( module.checkPreconditions() ) { | ||
module.draw.image(function() { | ||
module.draw.colors(); | ||
module.canvas.merge(); | ||
}); | ||
$module | ||
.data('module-' + namespace, module) | ||
; | ||
module.async(function() { | ||
module.getMetadata(); | ||
module.canvas.create(); | ||
module.draw.image(function() { | ||
module.draw.colors(); | ||
module.canvas.merge(); | ||
}); | ||
} | ||
}, | ||
redraw: function() { | ||
module.debug('Redrawing image'); | ||
module.async(function() { | ||
module.canvas.clear(); | ||
module.draw.colors(); | ||
module.canvas.merge(); | ||
$module | ||
.data('module-' + namespace, module) | ||
; | ||
}); | ||
}, | ||
} | ||
}, | ||
change: { | ||
color: function(colorName, color) { | ||
module.debug('Changing color', colorName); | ||
if(colors[colorName] === undefined) { | ||
module.error(error.missingColor); | ||
return false; | ||
} | ||
colors[colorName] = color; | ||
module.redraw(); | ||
redraw: function() { | ||
module.debug('Redrawing image'); | ||
module.async(function() { | ||
module.canvas.clear(); | ||
module.draw.colors(); | ||
module.canvas.merge(); | ||
}); | ||
}, | ||
change: { | ||
color: function(colorName, color) { | ||
module.debug('Changing color', colorName); | ||
if(colors[colorName] === undefined) { | ||
module.error(error.missingColor); | ||
return false; | ||
} | ||
}, | ||
colors[colorName] = color; | ||
module.redraw(); | ||
} | ||
}, | ||
canvas: { | ||
create: function() { | ||
module.debug('Creating canvases'); | ||
canvas: { | ||
create: function() { | ||
module.debug('Creating canvases'); | ||
mainCanvas.width = width; | ||
mainCanvas.height = height; | ||
imageCanvas.width = width; | ||
imageCanvas.height = height; | ||
overlayCanvas.width = width; | ||
overlayCanvas.height = height; | ||
mainCanvas.width = width; | ||
mainCanvas.height = height; | ||
imageCanvas.width = width; | ||
imageCanvas.height = height; | ||
overlayCanvas.width = width; | ||
overlayCanvas.height = height; | ||
mainContext = mainCanvas.getContext('2d'); | ||
imageContext = imageCanvas.getContext('2d'); | ||
overlayContext = overlayCanvas.getContext('2d'); | ||
mainContext = mainCanvas.getContext('2d'); | ||
imageContext = imageCanvas.getContext('2d'); | ||
overlayContext = overlayCanvas.getContext('2d'); | ||
$module | ||
.append( mainCanvas ) | ||
; | ||
mainContext = $module.children('canvas')[0].getContext('2d'); | ||
}, | ||
clear: function(context) { | ||
module.debug('Clearing canvas'); | ||
overlayContext.fillStyle = '#FFFFFF'; | ||
overlayContext.fillRect(0, 0, width, height); | ||
}, | ||
merge: function() { | ||
if( !$.isFunction(mainContext.blendOnto) ) { | ||
module.error(error.missingPlugin); | ||
return; | ||
} | ||
mainContext.putImageData( imageContext.getImageData(0, 0, width, height), 0, 0); | ||
overlayContext.blendOnto(mainContext, 'multiply'); | ||
$module | ||
.append( mainCanvas ) | ||
; | ||
mainContext = $module.children('canvas')[0].getContext('2d'); | ||
}, | ||
clear: function(context) { | ||
module.debug('Clearing canvas'); | ||
overlayContext.fillStyle = '#FFFFFF'; | ||
overlayContext.fillRect(0, 0, width, height); | ||
}, | ||
merge: function() { | ||
if( !$.isFunction(mainContext.blendOnto) ) { | ||
module.error(error.missingPlugin); | ||
return; | ||
} | ||
}, | ||
mainContext.putImageData( imageContext.getImageData(0, 0, width, height), 0, 0); | ||
overlayContext.blendOnto(mainContext, 'multiply'); | ||
} | ||
}, | ||
draw: { | ||
draw: { | ||
image: function(callback) { | ||
module.debug('Drawing image'); | ||
callback = callback || function(){}; | ||
if(image) { | ||
backgroundImage.src = image; | ||
backgroundImage.onload = function() { | ||
imageContext.drawImage(backgroundImage, 0, 0); | ||
callback(); | ||
}; | ||
} | ||
else { | ||
module.error(error.noImage); | ||
image: function(callback) { | ||
module.debug('Drawing image'); | ||
callback = callback || function(){}; | ||
if(image) { | ||
backgroundImage.src = image; | ||
backgroundImage.onload = function() { | ||
imageContext.drawImage(backgroundImage, 0, 0); | ||
callback(); | ||
} | ||
}, | ||
colors: function() { | ||
module.debug('Drawing color overlays', colors); | ||
$.each(colors, function(colorName, color) { | ||
settings.onDraw(overlayContext, imageName, colorName, color); | ||
}); | ||
}; | ||
} | ||
}, | ||
debug: function(message, variableName) { | ||
if(settings.debug) { | ||
if(variableName !== undefined) { | ||
console.info(settings.name + ': ' + message, variableName); | ||
} | ||
else { | ||
console.info(settings.name + ': ' + message); | ||
} | ||
else { | ||
module.error(error.noImage); | ||
callback(); | ||
} | ||
}, | ||
error: function(errorMessage) { | ||
console.warn(settings.name + ': ' + errorMessage); | ||
}, | ||
invoke: function(methodName, context, methodArguments) { | ||
var | ||
method | ||
; | ||
methodArguments = methodArguments || Array.prototype.slice.call( arguments, 2 ); | ||
if(typeof methodName == 'string' && instance !== undefined) { | ||
methodName = methodName.split('.'); | ||
$.each(methodName, function(index, name) { | ||
if( $.isPlainObject( instance[name] ) ) { | ||
instance = instance[name]; | ||
return true; | ||
} | ||
else if( $.isFunction( instance[name] ) ) { | ||
method = instance[name]; | ||
return true; | ||
} | ||
module.error(settings.error.method); | ||
return false; | ||
}); | ||
colors: function() { | ||
module.debug('Drawing color overlays', colors); | ||
$.each(colors, function(colorName, color) { | ||
settings.onDraw(overlayContext, imageName, colorName, color); | ||
}); | ||
} | ||
}, | ||
debug: function(message, variableName) { | ||
if(settings.debug) { | ||
if(variableName !== undefined) { | ||
console.info(settings.name + ': ' + message, variableName); | ||
} | ||
return ( $.isFunction( method ) ) | ||
? method.apply(context, methodArguments) | ||
: false | ||
; | ||
else { | ||
console.info(settings.name + ': ' + message); | ||
} | ||
} | ||
}, | ||
error: function(errorMessage) { | ||
console.warn(settings.name + ': ' + errorMessage); | ||
}, | ||
invoke: function(methodName, context, methodArguments) { | ||
var | ||
method | ||
; | ||
methodArguments = methodArguments || Array.prototype.slice.call( arguments, 2 ); | ||
}; | ||
if(instance !== undefined && moduleArguments) { | ||
// simpler than invoke realizing to invoke itself (and losing scope due prototype.call() | ||
if(moduleArguments[0] == 'invoke') { | ||
moduleArguments = Array.prototype.slice.call( moduleArguments, 1 ); | ||
if(typeof methodName == 'string' && instance !== undefined) { | ||
methodName = methodName.split('.'); | ||
$.each(methodName, function(index, name) { | ||
if( $.isPlainObject( instance[name] ) ) { | ||
instance = instance[name]; | ||
return true; | ||
} | ||
else if( $.isFunction( instance[name] ) ) { | ||
method = instance[name]; | ||
return true; | ||
} | ||
module.error(settings.error.method); | ||
return false; | ||
}); | ||
} | ||
return module.invoke(moduleArguments[0], this, Array.prototype.slice.call( moduleArguments, 1 ) ); | ||
return ( $.isFunction( method ) ) | ||
? method.apply(context, methodArguments) | ||
: false | ||
; | ||
} | ||
// initializing | ||
module.initialize(); | ||
}) | ||
; | ||
return this; | ||
}; | ||
$.fn.colorize.settings = { | ||
name : 'Image Colorizer', | ||
debug : true, | ||
namespace : 'colorize', | ||
}; | ||
if(instance !== undefined && moduleArguments) { | ||
// simpler than invoke realizing to invoke itself (and losing scope due prototype.call() | ||
if(moduleArguments[0] == 'invoke') { | ||
moduleArguments = Array.prototype.slice.call( moduleArguments, 1 ); | ||
} | ||
return module.invoke(moduleArguments[0], this, Array.prototype.slice.call( moduleArguments, 1 ) ); | ||
} | ||
// initializing | ||
module.initialize(); | ||
}) | ||
; | ||
return this; | ||
}; | ||
onDraw : function(overlayContext, imageName, colorName, color) {}, | ||
$.fn.colorize.settings = { | ||
name : 'Image Colorizer', | ||
debug : true, | ||
namespace : 'colorize', | ||
// whether to block execution while updating canvas | ||
async : true, | ||
// object containing names and default values of color regions | ||
colors : {}, | ||
onDraw : function(overlayContext, imageName, colorName, color) {}, | ||
metadata: { | ||
image : 'image', | ||
name : 'name' | ||
}, | ||
// whether to block execution while updating canvas | ||
async : true, | ||
// object containing names and default values of color regions | ||
colors : {}, | ||
error: { | ||
noImage : 'No tracing image specified', | ||
undefinedColors : 'No default colors specified.', | ||
missingColor : 'Attempted to change color that does not exist', | ||
missingPlugin : 'Blend onto plug-in must be included', | ||
undefinedHeight : 'The width or height of image canvas could not be automatically determined. Please specify a height.' | ||
} | ||
metadata: { | ||
image : 'image', | ||
name : 'name' | ||
}, | ||
}; | ||
error: { | ||
noImage : 'No tracing image specified', | ||
undefinedColors : 'No default colors specified.', | ||
missingColor : 'Attempted to change color that does not exist', | ||
missingPlugin : 'Blend onto plug-in must be included', | ||
undefinedHeight : 'The width or height of image canvas could not be automatically determined. Please specify a height.' | ||
} | ||
}; | ||
})( jQuery, window, document ); |
@@ -6,3 +6,2 @@ /*! | ||
* | ||
* Copyright 2015 Contributors | ||
* Released under the MIT license | ||
@@ -13,6 +12,13 @@ * http://opensource.org/licenses/MIT | ||
;(function ( $, window, document, undefined ) { | ||
;(function ($, window, document, undefined) { | ||
"use strict"; | ||
window = (typeof window != 'undefined' && window.Math == Math) | ||
? window | ||
: (typeof self != 'undefined' && self.Math == Math) | ||
? self | ||
: Function('return this')() | ||
; | ||
$.fn.form = function(parameters) { | ||
@@ -79,2 +85,5 @@ var | ||
else { | ||
if(instance !== undefined) { | ||
instance.invoke('destroy'); | ||
} | ||
module.verbose('Initializing form validation', $module, settings); | ||
@@ -234,2 +243,16 @@ module.bindEvents(); | ||
}, | ||
empty: function($field) { | ||
if(!$field || $field.length === 0) { | ||
return true; | ||
} | ||
else if($field.is('input[type="checkbox"]')) { | ||
return !$field.is(':checked'); | ||
} | ||
else { | ||
return module.is.blank($field); | ||
} | ||
}, | ||
blank: function($field) { | ||
return $.trim($field.val()) === ''; | ||
}, | ||
valid: function() { | ||
@@ -268,5 +291,8 @@ var | ||
var | ||
$field = $(this), | ||
key = event.which, | ||
keyCode = { | ||
$field = $(this), | ||
key = event.which, | ||
isInput = $field.is(selector.input), | ||
isCheckbox = $field.is(selector.checkbox), | ||
isInDropdown = ($field.closest(selector.uiDropdown).length > 0), | ||
keyCode = { | ||
enter : 13, | ||
@@ -282,3 +308,3 @@ escape : 27 | ||
} | ||
if(!event.ctrlKey && key == keyCode.enter && $field.is(selector.input) && $field.not(selector.checkbox).length > 0 ) { | ||
if(!event.ctrlKey && key == keyCode.enter && isInput && !isInDropdown && !isCheckbox) { | ||
if(!keyHeldDown) { | ||
@@ -305,3 +331,5 @@ $field | ||
module.debug('Revalidating field', $field, validationRules); | ||
module.validate.form.call(module, event, true); | ||
if(validationRules) { | ||
module.validate.field( validationRules ); | ||
} | ||
} | ||
@@ -317,3 +345,4 @@ else if(settings.on == 'blur' || settings.on == 'change') { | ||
$field = $(this), | ||
$fieldGroup = $field.closest($group) | ||
$fieldGroup = $field.closest($group), | ||
validationRules = module.get.validation($field) | ||
; | ||
@@ -324,3 +353,3 @@ if(settings.on == 'change' || ( $fieldGroup.hasClass(className.error) && settings.revalidate) ) { | ||
module.debug('Revalidating field', $field, module.get.validation($field)); | ||
module.validate.form.call(module, event, true); | ||
module.validate.field( validationRules ); | ||
}, settings.delay); | ||
@@ -381,3 +410,3 @@ } | ||
$label = $field.closest(selector.group).find('label').eq(0); | ||
name = ($label.size() == 1) | ||
name = ($label.length == 1) | ||
? $label.text() | ||
@@ -801,4 +830,7 @@ : $field.prop('placeholder') || settings.text.unspecifiedField | ||
var | ||
identifier = field.identifier || fieldName, | ||
$field = module.get.field(identifier), | ||
identifier = field.identifier || fieldName, | ||
$field = module.get.field(identifier), | ||
$dependsField = (field.depends) | ||
? module.get.field(field.depends) | ||
: false, | ||
fieldValid = true, | ||
@@ -815,6 +847,10 @@ fieldErrors = [] | ||
} | ||
else if(field.optional && $.trim($field.val()) === ''){ | ||
module.debug('Field is optional and empty. Skipping', identifier); | ||
else if(field.optional && module.is.blank($field)){ | ||
module.debug('Field is optional and blank. Skipping', identifier); | ||
fieldValid = true; | ||
} | ||
else if(field.depends && module.is.empty($dependsField)) { | ||
module.debug('Field depends on another value that is not present or empty. Skipping', $dependsField); | ||
fieldValid = true; | ||
} | ||
else if(field.rules !== undefined) { | ||
@@ -889,3 +925,3 @@ $.each(field.rules, function(index, rule) { | ||
debug: function() { | ||
if(settings.debug) { | ||
if(!settings.silent && settings.debug) { | ||
if(settings.performance) { | ||
@@ -901,3 +937,3 @@ module.performance.log(arguments); | ||
verbose: function() { | ||
if(settings.verbose && settings.debug) { | ||
if(!settings.silent && settings.verbose && settings.debug) { | ||
if(settings.performance) { | ||
@@ -913,4 +949,6 @@ module.performance.log(arguments); | ||
error: function() { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
if(!settings.silent) { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
} | ||
}, | ||
@@ -1069,3 +1107,3 @@ performance: { | ||
decimal : /^\d*(\.)\d+/, | ||
email : "[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?", | ||
email : /^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i, | ||
escape : /[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, | ||
@@ -1178,6 +1216,3 @@ flags : /^\/(.*)\/(.*)?/, | ||
email: function(value){ | ||
var | ||
emailRegExp = new RegExp($.fn.form.settings.regExp.email, 'i') | ||
; | ||
return emailRegExp.test(value); | ||
return $.fn.form.settings.regExp.email.test(value); | ||
}, | ||
@@ -1184,0 +1219,0 @@ |
@@ -6,3 +6,2 @@ /*! | ||
* | ||
* Copyright 2015 Contributors | ||
* Released under the MIT license | ||
@@ -13,6 +12,13 @@ * http://opensource.org/licenses/MIT | ||
;(function ( $, window, document, undefined ) { | ||
;(function ($, window, document, undefined) { | ||
"use strict"; | ||
window = (typeof window != 'undefined' && window.Math == Math) | ||
? window | ||
: (typeof self != 'undefined' && self.Math == Math) | ||
? self | ||
: Function('return this')() | ||
; | ||
$.fn.state = function(parameters) { | ||
@@ -414,3 +420,8 @@ var | ||
else if(value !== undefined) { | ||
settings[name] = value; | ||
if($.isPlainObject(settings[name])) { | ||
$.extend(true, settings[name], value); | ||
} | ||
else { | ||
settings[name] = value; | ||
} | ||
} | ||
@@ -433,3 +444,3 @@ else { | ||
debug: function() { | ||
if(settings.debug) { | ||
if(!settings.silent && settings.debug) { | ||
if(settings.performance) { | ||
@@ -445,3 +456,3 @@ module.performance.log(arguments); | ||
verbose: function() { | ||
if(settings.verbose && settings.debug) { | ||
if(!settings.silent && settings.verbose && settings.debug) { | ||
if(settings.performance) { | ||
@@ -457,4 +468,6 @@ module.performance.log(arguments); | ||
error: function() { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
if(!settings.silent) { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
} | ||
}, | ||
@@ -461,0 +474,0 @@ performance: { |
@@ -6,3 +6,2 @@ /*! | ||
* | ||
* Copyright 2015 Contributors | ||
* Released under the MIT license | ||
@@ -13,6 +12,13 @@ * http://opensource.org/licenses/MIT | ||
;(function ( $, window, document, undefined ) { | ||
;(function ($, window, document, undefined) { | ||
"use strict"; | ||
window = (typeof window != 'undefined' && window.Math == Math) | ||
? window | ||
: (typeof self != 'undefined' && self.Math == Math) | ||
? self | ||
: Function('return this')() | ||
; | ||
$.fn.visibility = function(parameters) { | ||
@@ -29,3 +35,6 @@ var | ||
queryArguments = [].slice.call(arguments, 1), | ||
returnedValue | ||
returnedValue, | ||
moduleCount = $allModules.length, | ||
loadedCount = 0 | ||
; | ||
@@ -67,2 +76,3 @@ | ||
contextObserver, | ||
observer, | ||
@@ -118,2 +128,5 @@ module | ||
} | ||
if(contextObserver) { | ||
contextObserver.disconnect(); | ||
} | ||
$window | ||
@@ -124,4 +137,9 @@ .off('load' + eventNamespace, module.event.load) | ||
$context | ||
.off('scroll' + eventNamespace, module.event.scroll) | ||
.off('scrollchange' + eventNamespace, module.event.scrollchange) | ||
; | ||
if(settings.type == 'fixed') { | ||
module.resetFixed(); | ||
module.remove.placeholder(); | ||
} | ||
$module | ||
@@ -135,8 +153,7 @@ .off(eventNamespace) | ||
if('MutationObserver' in window) { | ||
observer = new MutationObserver(function(mutations) { | ||
module.verbose('DOM tree modified, updating visibility calculations'); | ||
module.timer = setTimeout(function() { | ||
module.verbose('DOM tree modified, updating sticky menu'); | ||
module.refresh(); | ||
}, 100); | ||
contextObserver = new MutationObserver(module.event.contextChanged); | ||
observer = new MutationObserver(module.event.changed); | ||
contextObserver.observe(document, { | ||
childList : true, | ||
subtree : true | ||
}); | ||
@@ -172,2 +189,21 @@ observer.observe(element, { | ||
event: { | ||
changed: function(mutations) { | ||
module.verbose('DOM tree modified, updating visibility calculations'); | ||
module.timer = setTimeout(function() { | ||
module.verbose('DOM tree modified, updating sticky menu'); | ||
module.refresh(); | ||
}, 100); | ||
}, | ||
contextChanged: function(mutations) { | ||
[].forEach.call(mutations, function(mutation) { | ||
if(mutation.removedNodes) { | ||
[].forEach.call(mutation.removedNodes, function(node) { | ||
if(node == element || $(node).find(element).length > 0) { | ||
module.debug('Element removed from DOM, tearing down events'); | ||
module.destroy(); | ||
} | ||
}); | ||
} | ||
}); | ||
}, | ||
resize: function() { | ||
@@ -272,3 +308,9 @@ module.debug('Window resized'); | ||
module.precache(src, function() { | ||
module.set.image(src); | ||
module.set.image(src, function() { | ||
loadedCount++; | ||
if(loadedCount == moduleCount) { | ||
settings.onAllLoaded.call(this); | ||
} | ||
settings.onLoad.call(this); | ||
}); | ||
}); | ||
@@ -347,7 +389,8 @@ }; | ||
left : 'auto', | ||
zIndex : '1' | ||
zIndex : settings.zIndex | ||
}) | ||
; | ||
settings.onFixed.call(element); | ||
}, | ||
image: function(src) { | ||
image: function(src, callback) { | ||
$module | ||
@@ -358,6 +401,6 @@ .attr('src', src) | ||
if( $.fn.transition !== undefined ) { | ||
$module.transition(settings.transition, settings.duration); | ||
$module.transition(settings.transition, settings.duration, callback); | ||
} | ||
else { | ||
$module.fadeIn(settings.duration); | ||
$module.fadeIn(settings.duration, callback); | ||
} | ||
@@ -395,4 +438,3 @@ } | ||
if(settings.type == 'fixed') { | ||
module.remove.fixed(); | ||
module.remove.occurred(); | ||
module.resetFixed(); | ||
} | ||
@@ -407,4 +449,9 @@ module.reset(); | ||
resetFixed: function () { | ||
module.remove.fixed(); | ||
module.remove.occurred(); | ||
}, | ||
reset: function() { | ||
module.verbose('Reseting all cached values'); | ||
module.verbose('Resetting all cached values'); | ||
if( $.isPlainObject(module.cache) ) { | ||
@@ -772,3 +819,10 @@ module.cache.screen = {}; | ||
; | ||
settings.onUnfixed.call(element); | ||
}, | ||
placeholder: function() { | ||
module.debug('Removing placeholder content'); | ||
if($placeholder) { | ||
$placeholder.remove(); | ||
} | ||
}, | ||
occurred: function(callback) { | ||
@@ -987,3 +1041,3 @@ if(callback) { | ||
debug: function() { | ||
if(settings.debug) { | ||
if(!settings.silent && settings.debug) { | ||
if(settings.performance) { | ||
@@ -999,3 +1053,3 @@ module.performance.log(arguments); | ||
verbose: function() { | ||
if(settings.verbose && settings.debug) { | ||
if(!settings.silent && settings.verbose && settings.debug) { | ||
if(settings.performance) { | ||
@@ -1011,4 +1065,6 @@ module.performance.log(arguments); | ||
error: function() { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
if(!settings.silent) { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
} | ||
}, | ||
@@ -1190,2 +1246,5 @@ performance: { | ||
// z-index to use with visibility 'fixed' | ||
zIndex : '10', | ||
// image only animation settings | ||
@@ -1214,2 +1273,10 @@ transition : 'fade in', | ||
// special callbacks for image | ||
onLoad : function() {}, | ||
onAllLoaded : function() {}, | ||
// special callbacks for fixed position | ||
onFixed : function() {}, | ||
onUnfixed : function() {}, | ||
// utility callbacks | ||
@@ -1235,2 +1302,2 @@ onUpdate : false, // disabled by default for performance | ||
})( jQuery, window, document ); | ||
})( jQuery, window, document ); |
@@ -6,3 +6,2 @@ /*! | ||
* | ||
* Copyright 2015 Contributors | ||
* Released under the MIT license | ||
@@ -17,2 +16,9 @@ * http://opensource.org/licenses/MIT | ||
window = (typeof window != 'undefined' && window.Math == Math) | ||
? window | ||
: (typeof self != 'undefined' && self.Math == Math) | ||
? self | ||
: Function('return this')() | ||
; | ||
$.visit = $.fn.visit = function(parameters) { | ||
@@ -327,3 +333,3 @@ var | ||
debug: function() { | ||
if(settings.debug) { | ||
if(!settings.silent && settings.debug) { | ||
if(settings.performance) { | ||
@@ -339,3 +345,3 @@ module.performance.log(arguments); | ||
verbose: function() { | ||
if(settings.verbose && settings.debug) { | ||
if(!settings.silent && settings.verbose && settings.debug) { | ||
if(settings.performance) { | ||
@@ -351,4 +357,6 @@ module.performance.log(arguments); | ||
error: function() { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
if(!settings.silent) { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
} | ||
}, | ||
@@ -355,0 +363,0 @@ performance: { |
@@ -6,3 +6,2 @@ /*! | ||
* | ||
* Copyright 2015 Contributors | ||
* Released under the MIT license | ||
@@ -12,4 +11,5 @@ * http://opensource.org/licenses/MIT | ||
*/ | ||
;(function ( $, window, document, undefined ) { | ||
;(function ($, window, document, undefined) { | ||
$.site = $.fn.site = function(parameters) { | ||
@@ -16,0 +16,0 @@ var |
@@ -6,3 +6,2 @@ /*! | ||
* | ||
* Copyright 2015 Contributors | ||
* Released under the MIT license | ||
@@ -17,2 +16,9 @@ * http://opensource.org/licenses/MIT | ||
window = (typeof window != 'undefined' && window.Math == Math) | ||
? window | ||
: (typeof self != 'undefined' && self.Math == Math) | ||
? self | ||
: Function('return this')() | ||
; | ||
$.fn.accordion = function(parameters) { | ||
@@ -372,3 +378,8 @@ var | ||
else if(value !== undefined) { | ||
settings[name] = value; | ||
if($.isPlainObject(settings[name])) { | ||
$.extend(true, settings[name], value); | ||
} | ||
else { | ||
settings[name] = value; | ||
} | ||
} | ||
@@ -394,3 +405,3 @@ else { | ||
debug: function() { | ||
if(settings.debug) { | ||
if(!settings.silent && settings.debug) { | ||
if(settings.performance) { | ||
@@ -406,3 +417,3 @@ module.performance.log(arguments); | ||
verbose: function() { | ||
if(settings.verbose && settings.debug) { | ||
if(!settings.silent && settings.verbose && settings.debug) { | ||
if(settings.performance) { | ||
@@ -418,4 +429,6 @@ module.performance.log(arguments); | ||
error: function() { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
if(!settings.silent) { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
} | ||
}, | ||
@@ -553,2 +566,3 @@ performance: { | ||
silent : false, | ||
debug : false, | ||
@@ -555,0 +569,0 @@ verbose : false, |
@@ -6,3 +6,2 @@ /*! | ||
* | ||
* Copyright 2015 Contributors | ||
* Released under the MIT license | ||
@@ -13,6 +12,13 @@ * http://opensource.org/licenses/MIT | ||
;(function ( $, window, document, undefined ) { | ||
;(function ($, window, document, undefined) { | ||
"use strict"; | ||
window = (typeof window != 'undefined' && window.Math == Math) | ||
? window | ||
: (typeof self != 'undefined' && self.Math == Math) | ||
? self | ||
: Function('return this')() | ||
; | ||
$.fn.checkbox = function(parameters) { | ||
@@ -125,3 +131,3 @@ var | ||
input: function() { | ||
module.verbose('Modfying <input> z-index to be unselectable'); | ||
module.verbose('Modifying <input> z-index to be unselectable'); | ||
$input.addClass(className.hidden); | ||
@@ -132,3 +138,3 @@ } | ||
input: function() { | ||
module.verbose('Modfying <input> z-index to be selectable'); | ||
module.verbose('Modifying <input> z-index to be selectable'); | ||
$input.removeClass(className.hidden); | ||
@@ -275,2 +281,4 @@ } | ||
module.set.enabled(); | ||
settings.onEnable.call(input); | ||
// preserve legacy callbacks | ||
settings.onEnabled.call(input); | ||
@@ -286,2 +294,4 @@ }, | ||
module.set.disabled(); | ||
settings.onDisable.call(input); | ||
// preserve legacy callbacks | ||
settings.onDisabled.call(input); | ||
@@ -593,3 +603,8 @@ }, | ||
else if(value !== undefined) { | ||
settings[name] = value; | ||
if($.isPlainObject(settings[name])) { | ||
$.extend(true, settings[name], value); | ||
} | ||
else { | ||
settings[name] = value; | ||
} | ||
} | ||
@@ -612,3 +627,3 @@ else { | ||
debug: function() { | ||
if(settings.debug) { | ||
if(!settings.silent && settings.debug) { | ||
if(settings.performance) { | ||
@@ -624,3 +639,3 @@ module.performance.log(arguments); | ||
verbose: function() { | ||
if(settings.verbose && settings.debug) { | ||
if(!settings.silent && settings.verbose && settings.debug) { | ||
if(settings.performance) { | ||
@@ -636,4 +651,6 @@ module.performance.log(arguments); | ||
error: function() { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
if(!settings.silent) { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
} | ||
}, | ||
@@ -773,2 +790,3 @@ performance: { | ||
silent : false, | ||
debug : false, | ||
@@ -798,2 +816,6 @@ verbose : true, | ||
// preserve misspelled callbacks (will be removed in 3.0) | ||
onEnabled : function(){}, | ||
onDisabled : function(){}, | ||
className : { | ||
@@ -800,0 +822,0 @@ checked : 'checked', |
@@ -6,3 +6,2 @@ /*! | ||
* | ||
* Copyright 2015 Contributors | ||
* Released under the MIT license | ||
@@ -13,6 +12,13 @@ * http://opensource.org/licenses/MIT | ||
;(function ( $, window, document, undefined ) { | ||
;(function ($, window, document, undefined) { | ||
"use strict"; | ||
window = (typeof window != 'undefined' && window.Math == Math) | ||
? window | ||
: (typeof self != 'undefined' && self.Math == Math) | ||
? self | ||
: Function('return this')() | ||
; | ||
$.fn.dimmer = function(parameters) { | ||
@@ -142,2 +148,5 @@ var | ||
; | ||
$dimmable | ||
.off(eventNamespace) | ||
; | ||
} | ||
@@ -389,6 +398,7 @@ }, | ||
colorArray = color.split(','), | ||
isRGB = (colorArray && colorArray.length == 3), | ||
isRGBA = (colorArray && colorArray.length == 4) | ||
; | ||
opacity = settings.opacity === 0 ? 0 : settings.opacity || opacity; | ||
if(isRGBA) { | ||
if(isRGB || isRGBA) { | ||
colorArray[3] = opacity + ')'; | ||
@@ -452,3 +462,8 @@ color = colorArray.join(','); | ||
else if(value !== undefined) { | ||
settings[name] = value; | ||
if($.isPlainObject(settings[name])) { | ||
$.extend(true, settings[name], value); | ||
} | ||
else { | ||
settings[name] = value; | ||
} | ||
} | ||
@@ -471,3 +486,3 @@ else { | ||
debug: function() { | ||
if(settings.debug) { | ||
if(!settings.silent && settings.debug) { | ||
if(settings.performance) { | ||
@@ -483,3 +498,3 @@ module.performance.log(arguments); | ||
verbose: function() { | ||
if(settings.verbose && settings.debug) { | ||
if(!settings.silent && settings.verbose && settings.debug) { | ||
if(settings.performance) { | ||
@@ -495,4 +510,6 @@ module.performance.log(arguments); | ||
error: function() { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
if(!settings.silent) { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
} | ||
}, | ||
@@ -637,2 +654,3 @@ performance: { | ||
silent : false, | ||
debug : false, | ||
@@ -702,2 +720,2 @@ verbose : false, | ||
})( jQuery, window, document ); | ||
})( jQuery, window, document ); |
/*! | ||
* # Semantic UI - Video | ||
* # Semantic UI - Embed | ||
* http://github.com/semantic-org/semantic-ui/ | ||
* | ||
* | ||
* Copyright 2015 Contributors | ||
* Released under the MIT license | ||
@@ -16,2 +15,9 @@ * http://opensource.org/licenses/MIT | ||
window = (typeof window != 'undefined' && window.Math == Math) | ||
? window | ||
: (typeof self != 'undefined' && self.Math == Math) | ||
? self | ||
: Function('return this')() | ||
; | ||
$.fn.embed = function(parameters) { | ||
@@ -144,2 +150,8 @@ | ||
changeEmbed: function(url) { | ||
$embed | ||
.html( module.generate.embed(url) ) | ||
; | ||
}, | ||
createAndShow: function() { | ||
@@ -156,5 +168,15 @@ module.createEmbed(); | ||
.data(metadata.id, id) | ||
.data(metadata.url, url) | ||
; | ||
module.create(); | ||
if(url) { | ||
$module.data(metadata.url, url); | ||
} | ||
else { | ||
$module.removeData(metadata.url); | ||
} | ||
if(module.has.embed()) { | ||
module.changeEmbed(); | ||
} | ||
else { | ||
module.create(); | ||
} | ||
}, | ||
@@ -339,2 +361,5 @@ | ||
has: { | ||
embed: function() { | ||
return ($embed.length > 0); | ||
}, | ||
placeholder: function() { | ||
@@ -366,3 +391,8 @@ return settings.placeholder || $module.data(metadata.placeholder); | ||
else if(value !== undefined) { | ||
settings[name] = value; | ||
if($.isPlainObject(settings[name])) { | ||
$.extend(true, settings[name], value); | ||
} | ||
else { | ||
settings[name] = value; | ||
} | ||
} | ||
@@ -385,3 +415,3 @@ else { | ||
debug: function() { | ||
if(settings.debug) { | ||
if(!settings.silent && settings.debug) { | ||
if(settings.performance) { | ||
@@ -397,3 +427,3 @@ module.performance.log(arguments); | ||
verbose: function() { | ||
if(settings.verbose && settings.debug) { | ||
if(!settings.silent && settings.verbose && settings.debug) { | ||
if(settings.performance) { | ||
@@ -409,4 +439,6 @@ module.performance.log(arguments); | ||
error: function() { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
if(!settings.silent) { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
} | ||
}, | ||
@@ -548,2 +580,3 @@ performance: { | ||
silent : false, | ||
debug : false, | ||
@@ -610,3 +643,3 @@ verbose : false, | ||
autoplay : settings.autoplay, | ||
color : settings.colors || undefined, | ||
color : settings.color || undefined, | ||
hq : settings.hd, | ||
@@ -629,3 +662,3 @@ jsapi : settings.api, | ||
byline : settings.brandedUI, | ||
color : settings.colors || undefined, | ||
color : settings.color || undefined, | ||
portrait : settings.brandedUI, | ||
@@ -640,4 +673,8 @@ title : settings.brandedUI | ||
iframe : function(url, parameters) { | ||
var src = url; | ||
if (parameters) { | ||
src += '?' + parameters; | ||
} | ||
return '' | ||
+ '<iframe src="' + url + '?' + parameters + '"' | ||
+ '<iframe src="' + src + '"' | ||
+ ' width="100%" height="100%"' | ||
@@ -662,3 +699,3 @@ + ' frameborder="0" scrolling="no" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>' | ||
// NOT YET IMPLEMENTED | ||
api : true, | ||
api : false, | ||
onPause : function() {}, | ||
@@ -665,0 +702,0 @@ onPlay : function() {}, |
@@ -6,3 +6,2 @@ /*! | ||
* | ||
* Copyright 2015 Contributors | ||
* Released under the MIT license | ||
@@ -13,6 +12,13 @@ * http://opensource.org/licenses/MIT | ||
;(function ( $, window, document, undefined ) { | ||
;(function ($, window, document, undefined) { | ||
"use strict"; | ||
window = (typeof window != 'undefined' && window.Math == Math) | ||
? window | ||
: (typeof self != 'undefined' && self.Math == Math) | ||
? self | ||
: Function('return this')() | ||
; | ||
$.fn.modal = function(parameters) { | ||
@@ -71,3 +77,3 @@ var | ||
elementNamespace, | ||
elementEventNamespace, | ||
id, | ||
@@ -140,3 +146,3 @@ observer, | ||
id = (Math.random().toString(16) + '000000000').substr(2,8); | ||
elementNamespace = '.' + id; | ||
elementEventNamespace = '.' + id; | ||
module.verbose('Creating unique id for element', id); | ||
@@ -152,3 +158,4 @@ } | ||
; | ||
$window.off(elementNamespace); | ||
$window.off(elementEventNamespace); | ||
$dimmer.off(elementEventNamespace); | ||
$close.off(eventNamespace); | ||
@@ -214,3 +221,3 @@ $context.dimmer('destroy'); | ||
$window | ||
.on('resize' + elementNamespace, module.event.resize) | ||
.on('resize' + elementEventNamespace, module.event.resize) | ||
; | ||
@@ -505,3 +512,3 @@ } | ||
$dimmer | ||
.off('click' + elementNamespace) | ||
.off('click' + elementEventNamespace) | ||
; | ||
@@ -591,3 +598,3 @@ } | ||
$dimmer | ||
.on('click' + elementNamespace, module.event.click) | ||
.on('click' + elementEventNamespace, module.event.click) | ||
; | ||
@@ -656,3 +663,8 @@ } | ||
else if(value !== undefined) { | ||
settings[name] = value; | ||
if($.isPlainObject(settings[name])) { | ||
$.extend(true, settings[name], value); | ||
} | ||
else { | ||
settings[name] = value; | ||
} | ||
} | ||
@@ -675,3 +687,3 @@ else { | ||
debug: function() { | ||
if(settings.debug) { | ||
if(!settings.silent && settings.debug) { | ||
if(settings.performance) { | ||
@@ -687,3 +699,3 @@ module.performance.log(arguments); | ||
verbose: function() { | ||
if(settings.verbose && settings.debug) { | ||
if(!settings.silent && settings.verbose && settings.debug) { | ||
if(settings.performance) { | ||
@@ -699,4 +711,6 @@ module.performance.log(arguments); | ||
error: function() { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
if(!settings.silent) { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
} | ||
}, | ||
@@ -835,2 +849,3 @@ performance: { | ||
silent : false, | ||
debug : false, | ||
@@ -837,0 +852,0 @@ verbose : false, |
@@ -6,3 +6,2 @@ /*! | ||
* | ||
* Copyright 2015 Contributors | ||
* Released under the MIT license | ||
@@ -17,2 +16,9 @@ * http://opensource.org/licenses/MIT | ||
window = (typeof window != 'undefined' && window.Math == Math) | ||
? window | ||
: (typeof self != 'undefined' && self.Math == Math) | ||
? self | ||
: Function('return this')() | ||
; | ||
$.fn.nag = function(parameters) { | ||
@@ -260,3 +266,8 @@ var | ||
else if(value !== undefined) { | ||
settings[name] = value; | ||
if($.isPlainObject(settings[name])) { | ||
$.extend(true, settings[name], value); | ||
} | ||
else { | ||
settings[name] = value; | ||
} | ||
} | ||
@@ -279,3 +290,3 @@ else { | ||
debug: function() { | ||
if(settings.debug) { | ||
if(!settings.silent && settings.debug) { | ||
if(settings.performance) { | ||
@@ -291,3 +302,3 @@ module.performance.log(arguments); | ||
verbose: function() { | ||
if(settings.verbose && settings.debug) { | ||
if(!settings.silent && settings.verbose && settings.debug) { | ||
if(settings.performance) { | ||
@@ -303,4 +314,6 @@ module.performance.log(arguments); | ||
error: function() { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
if(!settings.silent) { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
} | ||
}, | ||
@@ -439,2 +452,3 @@ performance: { | ||
silent : false, | ||
debug : false, | ||
@@ -446,3 +460,3 @@ verbose : false, | ||
// allows cookie to be overriden | ||
// allows cookie to be overridden | ||
persist : false, | ||
@@ -494,2 +508,9 @@ | ||
// Adds easing | ||
$.extend( $.easing, { | ||
easeOutQuad: function (x, t, b, c, d) { | ||
return -c *(t/=d)*(t-2) + b; | ||
} | ||
}); | ||
})( jQuery, window, document ); |
@@ -6,3 +6,2 @@ /*! | ||
* | ||
* Copyright 2015 Contributors | ||
* Released under the MIT license | ||
@@ -17,2 +16,9 @@ * http://opensource.org/licenses/MIT | ||
window = (typeof window != 'undefined' && window.Math == Math) | ||
? window | ||
: (typeof self != 'undefined' && self.Math == Math) | ||
? self | ||
: Function('return this')() | ||
; | ||
$.fn.popup = function(parameters) { | ||
@@ -55,2 +61,4 @@ var | ||
$context = $(settings.context), | ||
$scrollContext = $(settings.scrollContext), | ||
$boundary = $(settings.boundary), | ||
$target = (settings.target) | ||
@@ -70,2 +78,3 @@ ? $(settings.target) | ||
documentObserver, | ||
elementNamespace, | ||
@@ -83,5 +92,6 @@ id, | ||
module.bind.events(); | ||
if( !module.exists() && settings.preserve) { | ||
if(!module.exists() && settings.preserve) { | ||
module.create(); | ||
} | ||
module.observeChanges(); | ||
module.instantiate(); | ||
@@ -98,2 +108,13 @@ }, | ||
observeChanges: function() { | ||
if('MutationObserver' in window) { | ||
documentObserver = new MutationObserver(module.event.documentChanged); | ||
documentObserver.observe(document, { | ||
childList : true, | ||
subtree : true | ||
}); | ||
module.debug('Setting up mutation observer', documentObserver); | ||
} | ||
}, | ||
refresh: function() { | ||
@@ -145,2 +166,5 @@ if(settings.popup) { | ||
module.debug('Destroying previous module'); | ||
if(documentObserver) { | ||
documentObserver.disconnect(); | ||
} | ||
// remove element only if was created dynamically | ||
@@ -154,5 +178,5 @@ if($popup && !settings.preserve) { | ||
// remove events | ||
$window.off(elementNamespace); | ||
module.unbind.close(); | ||
module.unbind.events(); | ||
$module | ||
.off(eventNamespace) | ||
.removeData(moduleNamespace) | ||
@@ -192,5 +216,22 @@ ; | ||
}, | ||
documentChanged: function(mutations) { | ||
[].forEach.call(mutations, function(mutation) { | ||
if(mutation.removedNodes) { | ||
[].forEach.call(mutation.removedNodes, function(node) { | ||
if(node == element || $(node).find(element).length > 0) { | ||
module.debug('Element removed from DOM, tearing down events'); | ||
module.destroy(); | ||
} | ||
}); | ||
} | ||
}); | ||
}, | ||
hideGracefully: function(event) { | ||
var | ||
$target = $(event.target), | ||
isInDOM = $.contains(document.documentElement, event.target), | ||
inPopup = ($target.closest(selector.popup).length > 0) | ||
; | ||
// don't close on clicks inside popup | ||
if(event && $(event.target).closest(selector.popup).length === 0) { | ||
if(event && !inPopup && isInDOM) { | ||
module.debug('Click occurred outside popup hiding popup'); | ||
@@ -249,3 +290,3 @@ module.hide(); | ||
settings.inline = true; | ||
settings.popups = $target.next(selector.popup).data(metadata.activator, $module); | ||
settings.popup = $target.next(selector.popup).data(metadata.activator, $module); | ||
module.refresh(); | ||
@@ -270,3 +311,3 @@ if(settings.hoverable) { | ||
createID: function() { | ||
id = (Math.random().toString(16) + '000000000').substr(2,8); | ||
id = (Math.random().toString(16) + '000000000').substr(2, 8); | ||
elementNamespace = '.' + id; | ||
@@ -335,3 +376,3 @@ module.verbose('Creating unique id for element', id); | ||
.data(metadata.activator) | ||
.popup('hide') | ||
.popup('hide') | ||
; | ||
@@ -385,2 +426,7 @@ }) | ||
}, | ||
supports: { | ||
svg: function() { | ||
return (typeof SVGGraphicsElement === undefined); | ||
} | ||
}, | ||
animate: { | ||
@@ -470,7 +516,14 @@ show: function(callback) { | ||
var | ||
targetElement = $target[0], | ||
targetPosition = (settings.inline || (settings.popup && settings.movePopup)) | ||
targetElement = $target[0], | ||
isWindow = ($boundary[0] == window), | ||
targetPosition = (settings.inline || (settings.popup && settings.movePopup)) | ||
? $target.position() | ||
: $target.offset(), | ||
calculations = {}, | ||
screenPosition = (isWindow) | ||
? { top: 0, left: 0 } | ||
: $boundary.offset(), | ||
calculations = {}, | ||
scroll = (isWindow) | ||
? { top: $window.scrollTop(), left: $window.scrollLeft() } | ||
: { top: 0, left: 0}, | ||
screen | ||
@@ -500,8 +553,10 @@ ; | ||
screen : { | ||
top : screenPosition.top, | ||
left : screenPosition.left, | ||
scroll: { | ||
top : $window.scrollTop(), | ||
left : $window.scrollLeft() | ||
top : scroll.top, | ||
left : scroll.left | ||
}, | ||
width : $window.width(), | ||
height : $window.height() | ||
width : $boundary.width(), | ||
height : $boundary.height() | ||
} | ||
@@ -526,3 +581,3 @@ }; | ||
? parseInt( window.getComputedStyle(targetElement).getPropertyValue('margin-right'), 10) | ||
: parseInt( window.getComputedStyle(targetElement).getPropertyValue('margin-left') , 10) | ||
: parseInt( window.getComputedStyle(targetElement).getPropertyValue('margin-left'), 10) | ||
: 0 | ||
@@ -533,6 +588,6 @@ ; | ||
calculations.boundary = { | ||
top : screen.scroll.top, | ||
bottom : screen.scroll.top + screen.height, | ||
left : screen.scroll.left, | ||
right : screen.scroll.left + screen.width | ||
top : screen.top + screen.scroll.top, | ||
bottom : screen.top + screen.scroll.top + screen.height, | ||
left : screen.left + screen.scroll.left, | ||
right : screen.left + screen.scroll.left + screen.width | ||
}; | ||
@@ -571,3 +626,2 @@ return calculations; | ||
; | ||
offset = offset || module.get.offset(); | ||
calculations = calculations || module.get.calculations(); | ||
@@ -718,3 +772,3 @@ | ||
if(target.width === 0 && target.height === 0 && !(target.element instanceof SVGGraphicsElement)) { | ||
if(target.width === 0 && target.height === 0 && !module.is.svg(target.element)) { | ||
module.debug('Popup target is hidden, no action taken'); | ||
@@ -951,9 +1005,6 @@ return false; | ||
close: function() { | ||
if(settings.hideOnScroll === true || (settings.hideOnScroll == 'auto' && settings.on != 'click')) { | ||
$document | ||
if(settings.hideOnScroll === true || (settings.hideOnScroll == 'auto' && settings.on != 'click')) { | ||
$scrollContext | ||
.one(module.get.scrollEvent() + elementNamespace, module.event.hideGracefully) | ||
; | ||
$context | ||
.one(module.get.scrollEvent() + elementNamespace, module.event.hideGracefully) | ||
; | ||
} | ||
@@ -982,24 +1033,18 @@ if(settings.on == 'hover' && openedWithTouch) { | ||
unbind: { | ||
events: function() { | ||
$window | ||
.off(elementNamespace) | ||
; | ||
$module | ||
.off(eventNamespace) | ||
; | ||
}, | ||
close: function() { | ||
if(settings.hideOnScroll === true || (settings.hideOnScroll == 'auto' && settings.on != 'click')) { | ||
$document | ||
.off('scroll' + elementNamespace, module.hide) | ||
; | ||
$context | ||
.off('scroll' + elementNamespace, module.hide) | ||
; | ||
} | ||
if(settings.on == 'hover' && openedWithTouch) { | ||
$document | ||
.off('touchstart' + elementNamespace) | ||
; | ||
openedWithTouch = false; | ||
} | ||
if(settings.on == 'click' && settings.closable) { | ||
module.verbose('Removing close event from document'); | ||
$document | ||
.off('click' + elementNamespace) | ||
; | ||
} | ||
} | ||
$document | ||
.off(elementNamespace) | ||
; | ||
$scrollContext | ||
.off(elementNamespace) | ||
; | ||
}, | ||
}, | ||
@@ -1032,2 +1077,5 @@ | ||
}, | ||
svg: function(element) { | ||
return module.supports.svg() && (element instanceof SVGGraphicsElement); | ||
}, | ||
active: function() { | ||
@@ -1093,3 +1141,3 @@ return $module.hasClass(className.active); | ||
debug: function() { | ||
if(settings.debug) { | ||
if(!settings.silent && settings.debug) { | ||
if(settings.performance) { | ||
@@ -1105,3 +1153,3 @@ module.performance.log(arguments); | ||
verbose: function() { | ||
if(settings.verbose && settings.debug) { | ||
if(!settings.silent && settings.verbose && settings.debug) { | ||
if(settings.performance) { | ||
@@ -1117,4 +1165,6 @@ module.performance.log(arguments); | ||
error: function() { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
if(!settings.silent) { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
} | ||
}, | ||
@@ -1250,34 +1300,41 @@ performance: { | ||
name : 'Popup', | ||
name : 'Popup', | ||
// module settings | ||
debug : false, | ||
verbose : false, | ||
performance : true, | ||
namespace : 'popup', | ||
silent : false, | ||
debug : false, | ||
verbose : false, | ||
performance : true, | ||
namespace : 'popup', | ||
// whether it should use dom mutation observers | ||
observeChanges : true, | ||
// callback only when element added to dom | ||
onCreate : function(){}, | ||
onCreate : function(){}, | ||
// callback before element removed from dom | ||
onRemove : function(){}, | ||
onRemove : function(){}, | ||
// callback before show animation | ||
onShow : function(){}, | ||
onShow : function(){}, | ||
// callback after show animation | ||
onVisible : function(){}, | ||
onVisible : function(){}, | ||
// callback before hide animation | ||
onHide : function(){}, | ||
onHide : function(){}, | ||
// callback when popup cannot be positioned in visible screen | ||
onUnplaceable: function(){}, | ||
onUnplaceable : function(){}, | ||
// callback after hide animation | ||
onHidden : function(){}, | ||
onHidden : function(){}, | ||
// when to show popup | ||
on : 'hover', | ||
on : 'hover', | ||
// element to use to determine if popup is out of boundary | ||
boundary : window, | ||
// whether to add touchstart events when using hover | ||
@@ -1287,6 +1344,6 @@ addTouchEvents : true, | ||
// default position relative to element | ||
position : 'top left', | ||
position : 'top left', | ||
// name of variation to use | ||
variation : '', | ||
variation : '', | ||
@@ -1312,27 +1369,30 @@ // whether popup should be moved to context | ||
// explicitly set content | ||
content : false, | ||
content : false, | ||
// explicitly set html | ||
html : false, | ||
html : false, | ||
// explicitly set title | ||
title : false, | ||
title : false, | ||
// whether automatically close on clickaway when on click | ||
closable : true, | ||
closable : true, | ||
// automatically hide on scroll | ||
hideOnScroll : 'auto', | ||
hideOnScroll : 'auto', | ||
// hide other popups on show | ||
exclusive : false, | ||
exclusive : false, | ||
// context to attach popups | ||
context : 'body', | ||
context : 'body', | ||
// context for binding scroll events | ||
scrollContext : window, | ||
// position to prefer when calculating new position | ||
prefer : 'opposite', | ||
prefer : 'opposite', | ||
// specify position to appear even if it doesn't fit | ||
lastResort : false, | ||
lastResort : false, | ||
@@ -1339,0 +1399,0 @@ // delay used to prevent accidental refiring of animations due to user error |
@@ -6,3 +6,2 @@ /*! | ||
* | ||
* Copyright 2015 Contributors | ||
* Released under the MIT license | ||
@@ -13,6 +12,21 @@ * http://opensource.org/licenses/MIT | ||
;(function ( $, window, document, undefined ) { | ||
;(function ($, window, document, undefined) { | ||
"use strict"; | ||
window = (typeof window != 'undefined' && window.Math == Math) | ||
? window | ||
: (typeof self != 'undefined' && self.Math == Math) | ||
? self | ||
: Function('return this')() | ||
; | ||
var | ||
global = (typeof window != 'undefined' && window.Math == Math) | ||
? window | ||
: (typeof self != 'undefined' && self.Math == Math) | ||
? self | ||
: Function('return this')() | ||
; | ||
$.fn.progress = function(parameters) { | ||
@@ -93,4 +107,4 @@ var | ||
reset: function() { | ||
module.set.percent(0); | ||
module.set.value(0); | ||
module.remove.nextValue(); | ||
module.update.progress(0); | ||
}, | ||
@@ -100,2 +114,3 @@ | ||
if(module.percent === undefined || module.percent < 100) { | ||
module.remove.progressPoll(); | ||
module.set.percent(100); | ||
@@ -154,11 +169,3 @@ } | ||
incrementValue = incrementValue || 1; | ||
newValue = startValue + incrementValue; | ||
maxValue = module.get.total(); | ||
module.debug('Incrementing value', startValue, newValue, maxValue); | ||
if(newValue > maxValue ) { | ||
module.debug('Value cannot increment above total', maxValue); | ||
newValue = maxValue; | ||
} | ||
} | ||
@@ -171,9 +178,5 @@ else { | ||
maxValue = 100; | ||
module.debug('Incrementing percentage by', startValue, newValue); | ||
if(newValue > maxValue ) { | ||
module.debug('Value cannot increment above 100 percent'); | ||
newValue = maxValue; | ||
} | ||
} | ||
newValue = module.get.normalizedValue(newValue); | ||
module.set.progress(newValue); | ||
@@ -199,7 +202,3 @@ }, | ||
} | ||
if(newValue < 0) { | ||
module.debug('Value cannot decrement below 0'); | ||
newValue = 0; | ||
} | ||
newValue = module.get.normalizedValue(newValue); | ||
module.set.progress(newValue); | ||
@@ -209,2 +208,5 @@ }, | ||
has: { | ||
progressPoll: function() { | ||
return module.progressPoll; | ||
}, | ||
total: function() { | ||
@@ -234,7 +236,31 @@ return (module.get.total() !== false); | ||
; | ||
module.debug('Adding variables to progress bar text', templateText); | ||
module.verbose('Adding variables to progress bar text', templateText); | ||
return templateText; | ||
}, | ||
normalizedValue: function(value) { | ||
if(value < 0) { | ||
module.debug('Value cannot decrement below 0'); | ||
return 0; | ||
} | ||
if(module.has.total()) { | ||
if(value > module.total) { | ||
module.debug('Value cannot increment above total', module.total); | ||
return module.total; | ||
} | ||
} | ||
else if(value > 100 ) { | ||
module.debug('Value cannot increment above 100 percent'); | ||
return 100; | ||
} | ||
return value; | ||
}, | ||
updateInterval: function() { | ||
if(settings.updateInterval == 'auto') { | ||
return settings.duration; | ||
} | ||
return settings.updateInterval; | ||
}, | ||
randomValue: function() { | ||
@@ -292,3 +318,3 @@ module.debug('Generating random increment percentage'); | ||
value: function() { | ||
return module.value || 0; | ||
return module.nextValue || module.value || 0; | ||
}, | ||
@@ -300,3 +326,15 @@ total: function() { | ||
create: { | ||
progressPoll: function() { | ||
module.progressPoll = setTimeout(function() { | ||
module.update.toNextValue(); | ||
module.remove.progressPoll(); | ||
}, module.get.updateInterval()); | ||
}, | ||
}, | ||
is: { | ||
complete: function() { | ||
return module.is.success() || module.is.warning() || module.is.error(); | ||
}, | ||
success: function() { | ||
@@ -320,2 +358,13 @@ return $module.hasClass(className.success); | ||
remove: { | ||
progressPoll: function() { | ||
module.verbose('Removing progress poll timer'); | ||
if(module.progressPoll) { | ||
clearTimeout(module.progressPoll); | ||
delete module.progressPoll; | ||
} | ||
}, | ||
nextValue: function() { | ||
module.verbose('Removing progress value stored for next update'); | ||
delete module.nextValue; | ||
}, | ||
state: function() { | ||
@@ -416,5 +465,13 @@ module.verbose('Removing stored state'); | ||
$bar.one(transitionEnd + eventNamespace, animationCallback); | ||
module.timer = setTimeout(animationCallback, settings.duration + 100); | ||
animating = true; | ||
module.interval = setInterval(module.set.labels, settings.framerate); | ||
module.interval = setInterval(function() { | ||
var | ||
isInDOM = $.contains(document.documentElement, element) | ||
; | ||
if(!isInDOM) { | ||
clearInterval(module.interval); | ||
animating = false; | ||
} | ||
module.set.labels(); | ||
}, settings.framerate); | ||
}, | ||
@@ -430,3 +487,3 @@ labels: function() { | ||
text = module.get.text(text); | ||
module.debug('Setting label to text', text); | ||
module.verbose('Setting label to text', text); | ||
$label.text(text); | ||
@@ -441,3 +498,3 @@ } | ||
if(percent === 100) { | ||
if(settings.autoSuccess && !(module.is.warning() || module.is.error())) { | ||
if(settings.autoSuccess && !(module.is.warning() || module.is.error() || module.is.success())) { | ||
module.set.success(); | ||
@@ -449,2 +506,3 @@ module.debug('Automatically triggering success at 100%'); | ||
module.remove.active(); | ||
module.remove.progressPoll(); | ||
} | ||
@@ -466,7 +524,7 @@ } | ||
else if(settings.label == 'ratio' && module.total) { | ||
module.debug('Adding ratio to bar label'); | ||
module.verbose('Adding ratio to bar label'); | ||
$progress.text( module.get.text(settings.text.ratio) ); | ||
} | ||
else if(settings.label == 'percent') { | ||
module.debug('Adding percentage to bar label'); | ||
module.verbose('Adding percentage to bar label'); | ||
$progress.text( module.get.text(settings.text.percent) ); | ||
@@ -484,9 +542,12 @@ } | ||
module.remove.success(); | ||
text = settings.onLabelUpdate('active', text, module.value, module.total); | ||
if(text) { | ||
module.set.label(text); | ||
} | ||
settings.onActive.call(element, module.value, module.total); | ||
$bar.one(transitionEnd + eventNamespace, function() { | ||
settings.onActive.call(element, module.value, module.total); | ||
}); | ||
}, | ||
success : function(text) { | ||
text = text || settings.text.success; | ||
text = text || settings.text.success || settings.text.active; | ||
module.debug('Setting success state'); | ||
@@ -498,6 +559,13 @@ $module.addClass(className.success); | ||
module.complete(); | ||
if(text) { | ||
if(settings.text.success) { | ||
text = settings.onLabelUpdate('success', text, module.value, module.total); | ||
module.set.label(text); | ||
} | ||
settings.onSuccess.call(element, module.total); | ||
else { | ||
text = settings.onLabelUpdate('active', text, module.value, module.total); | ||
module.set.label(text); | ||
} | ||
$bar.one(transitionEnd + eventNamespace, function() { | ||
settings.onSuccess.call(element, module.total); | ||
}); | ||
}, | ||
@@ -512,6 +580,9 @@ warning : function(text) { | ||
module.complete(); | ||
text = settings.onLabelUpdate('warning', text, module.value, module.total); | ||
if(text) { | ||
module.set.label(text); | ||
} | ||
settings.onWarning.call(element, module.value, module.total); | ||
$bar.one(transitionEnd + eventNamespace, function() { | ||
settings.onWarning.call(element, module.value, module.total); | ||
}); | ||
}, | ||
@@ -526,6 +597,9 @@ error : function(text) { | ||
module.complete(); | ||
text = settings.onLabelUpdate('error', text, module.value, module.total); | ||
if(text) { | ||
module.set.label(text); | ||
} | ||
settings.onError.call(element, module.value, module.total); | ||
$bar.one(transitionEnd + eventNamespace, function() { | ||
settings.onError.call(element, module.value, module.total); | ||
}); | ||
}, | ||
@@ -542,12 +616,40 @@ transitionEvent: function() { | ||
progress: function(value) { | ||
if(!module.has.progressPoll()) { | ||
module.debug('First update in progress update interval, immediately updating', value); | ||
module.update.progress(value); | ||
module.create.progressPoll(); | ||
} | ||
else { | ||
module.debug('Updated within interval, setting next update to use new value', value); | ||
module.set.nextValue(value); | ||
} | ||
}, | ||
nextValue: function(value) { | ||
module.nextValue = value; | ||
} | ||
}, | ||
update: { | ||
toNextValue: function() { | ||
var | ||
numericValue = module.get.numericValue(value), | ||
nextValue = module.nextValue | ||
; | ||
if(nextValue) { | ||
module.debug('Update interval complete using last updated value', nextValue); | ||
module.update.progress(nextValue); | ||
module.remove.nextValue(); | ||
} | ||
}, | ||
progress: function(value) { | ||
var | ||
percentComplete | ||
; | ||
if(numericValue === false) { | ||
value = module.get.numericValue(value); | ||
if(value === false) { | ||
module.error(error.nonNumeric, value); | ||
} | ||
value = module.get.normalizedValue(value); | ||
if( module.has.total() ) { | ||
module.set.value(numericValue); | ||
percentComplete = (numericValue / module.total) * 100; | ||
module.set.value(value); | ||
percentComplete = (value / module.total) * 100; | ||
module.debug('Calculating percent complete from total', percentComplete); | ||
@@ -557,3 +659,3 @@ module.set.percent( percentComplete ); | ||
else { | ||
percentComplete = numericValue; | ||
percentComplete = value; | ||
module.debug('Setting value to exact percentage value', percentComplete); | ||
@@ -571,3 +673,8 @@ module.set.percent( percentComplete ); | ||
else if(value !== undefined) { | ||
settings[name] = value; | ||
if($.isPlainObject(settings[name])) { | ||
$.extend(true, settings[name], value); | ||
} | ||
else { | ||
settings[name] = value; | ||
} | ||
} | ||
@@ -590,3 +697,3 @@ else { | ||
debug: function() { | ||
if(settings.debug) { | ||
if(!settings.silent && settings.debug) { | ||
if(settings.performance) { | ||
@@ -602,3 +709,3 @@ module.performance.log(arguments); | ||
verbose: function() { | ||
if(settings.verbose && settings.debug) { | ||
if(!settings.silent && settings.verbose && settings.debug) { | ||
if(settings.performance) { | ||
@@ -614,4 +721,6 @@ module.performance.log(arguments); | ||
error: function() { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
if(!settings.silent) { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
} | ||
}, | ||
@@ -751,2 +860,3 @@ performance: { | ||
silent : false, | ||
debug : false, | ||
@@ -761,22 +871,27 @@ verbose : false, | ||
duration : 300, | ||
duration : 300, | ||
autoSuccess : true, | ||
showActivity : true, | ||
limitValues : true, | ||
updateInterval : 'auto', | ||
label : 'percent', | ||
precision : 0, | ||
framerate : (1000 / 30), /// 30 fps | ||
autoSuccess : true, | ||
showActivity : true, | ||
limitValues : true, | ||
percent : false, | ||
total : false, | ||
value : false, | ||
label : 'percent', | ||
precision : 0, | ||
framerate : (1000 / 30), /// 30 fps | ||
onChange : function(percent, value, total){}, | ||
onSuccess : function(total){}, | ||
onActive : function(value, total){}, | ||
onError : function(value, total){}, | ||
onWarning : function(value, total){}, | ||
percent : false, | ||
total : false, | ||
value : false, | ||
onLabelUpdate : function(state, text, value, total){ | ||
return text; | ||
}, | ||
onChange : function(percent, value, total){}, | ||
onSuccess : function(total){}, | ||
onActive : function(value, total){}, | ||
onError : function(value, total){}, | ||
onWarning : function(value, total){}, | ||
error : { | ||
@@ -824,2 +939,2 @@ method : 'The method you called is not defined.', | ||
})( jQuery, window, document ); | ||
})( jQuery, window, document ); |
@@ -6,3 +6,2 @@ /*! | ||
* | ||
* Copyright 2015 Contributors | ||
* Released under the MIT license | ||
@@ -17,2 +16,9 @@ * http://opensource.org/licenses/MIT | ||
window = (typeof window != 'undefined' && window.Math == Math) | ||
? window | ||
: (typeof self != 'undefined' && self.Math == Math) | ||
? self | ||
: Function('return this')() | ||
; | ||
$.fn.rating = function(parameters) { | ||
@@ -53,2 +59,3 @@ var | ||
initialLoad, | ||
module | ||
@@ -72,3 +79,5 @@ ; | ||
} | ||
module.set.initialLoad(); | ||
module.set.rating( module.get.initialRating() ); | ||
module.remove.initialLoad(); | ||
module.instantiate(); | ||
@@ -177,2 +186,5 @@ }, | ||
; | ||
}, | ||
initialLoad: function() { | ||
initialLoad = false; | ||
} | ||
@@ -197,2 +209,8 @@ }, | ||
is: { | ||
initialLoad: function() { | ||
return initialLoad; | ||
} | ||
}, | ||
get: { | ||
@@ -241,7 +259,12 @@ initialRating: function() { | ||
.prevAll() | ||
.andSelf() | ||
.addBack() | ||
.addClass(className.active) | ||
; | ||
} | ||
settings.onRate.call(element, rating); | ||
if(!module.is.initialLoad()) { | ||
settings.onRate.call(element, rating); | ||
} | ||
}, | ||
initialLoad: function() { | ||
initialLoad = true; | ||
} | ||
@@ -256,3 +279,8 @@ }, | ||
else if(value !== undefined) { | ||
settings[name] = value; | ||
if($.isPlainObject(settings[name])) { | ||
$.extend(true, settings[name], value); | ||
} | ||
else { | ||
settings[name] = value; | ||
} | ||
} | ||
@@ -275,3 +303,3 @@ else { | ||
debug: function() { | ||
if(settings.debug) { | ||
if(!settings.silent && settings.debug) { | ||
if(settings.performance) { | ||
@@ -287,3 +315,3 @@ module.performance.log(arguments); | ||
verbose: function() { | ||
if(settings.verbose && settings.debug) { | ||
if(!settings.silent && settings.verbose && settings.debug) { | ||
if(settings.performance) { | ||
@@ -299,4 +327,6 @@ module.performance.log(arguments); | ||
error: function() { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
if(!settings.silent) { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
} | ||
}, | ||
@@ -437,2 +467,3 @@ performance: { | ||
slent : false, | ||
debug : false, | ||
@@ -447,2 +478,4 @@ verbose : false, | ||
fireOnInit : false, | ||
onRate : function(rating){}, | ||
@@ -449,0 +482,0 @@ |
@@ -6,3 +6,2 @@ /*! | ||
* | ||
* Copyright 2015 Contributors | ||
* Released under the MIT license | ||
@@ -17,2 +16,9 @@ * http://opensource.org/licenses/MIT | ||
window = (typeof window != 'undefined' && window.Math == Math) | ||
? window | ||
: (typeof self != 'undefined' && self.Math == Math) | ||
? self | ||
: Function('return this')() | ||
; | ||
$.fn.search = function(parameters) { | ||
@@ -59,2 +65,4 @@ var | ||
disabledBubbled = false, | ||
module | ||
@@ -88,2 +96,16 @@ ; | ||
refresh: function() { | ||
module.debug('Refreshing selector cache'); | ||
$prompt = $module.find(selector.prompt); | ||
$searchButton = $module.find(selector.searchButton); | ||
$category = $module.find(selector.category); | ||
$results = $module.find(selector.results); | ||
$result = $module.find(selector.result); | ||
}, | ||
refreshResults: function() { | ||
$results = $module.find(selector.results); | ||
$result = $module.find(selector.result); | ||
}, | ||
bind: { | ||
@@ -154,4 +176,9 @@ events: function() { | ||
$module | ||
.one('click', selector.results, function(event) { | ||
if( !module.is.animating() && !module.is.hidden() ) { | ||
.one('click.close' + eventNamespace, selector.results, function(event) { | ||
if(module.is.inMessage(event) || disabledBubbled) { | ||
$prompt.focus(); | ||
return; | ||
} | ||
disabledBubbled = false; | ||
if( !module.is.animating() && !module.is.hidden()) { | ||
callback(); | ||
@@ -179,3 +206,5 @@ } | ||
$title = $result.find(selector.title).eq(0), | ||
$link = $result.find('a[href]').eq(0), | ||
$link = $result.is('a[href]') | ||
? $result | ||
: $result.find('a[href]').eq(0), | ||
href = $link.attr('href') || false, | ||
@@ -195,2 +224,3 @@ target = $link.attr('target') || false, | ||
module.debug('Custom onSelect callback cancelled default select action'); | ||
disabledBubbled = true; | ||
return; | ||
@@ -296,14 +326,26 @@ } | ||
setup: { | ||
api: function() { | ||
api: function(searchTerm) { | ||
var | ||
apiSettings = { | ||
debug : settings.debug, | ||
on : false, | ||
cache : 'local', | ||
action : 'search', | ||
onError : module.error | ||
debug : settings.debug, | ||
on : false, | ||
cache : true, | ||
action : 'search', | ||
urlData : { | ||
query : searchTerm | ||
}, | ||
onSuccess : function(response) { | ||
module.parse.response.call(element, response, searchTerm); | ||
}, | ||
onAbort : function(response) { | ||
}, | ||
onFailure : function() { | ||
module.displayMessage(error.serverError); | ||
}, | ||
onError : module.error | ||
}, | ||
searchHTML | ||
; | ||
module.verbose('First request, initializing API'); | ||
$.extend(true, apiSettings, settings.apiSettings); | ||
module.verbose('Setting up API request', apiSettings); | ||
$module.api(apiSettings); | ||
@@ -332,2 +374,5 @@ } | ||
}, | ||
inMessage: function(event) { | ||
return (event.target && $(event.target).closest(selector.message).length > 0); | ||
}, | ||
empty: function() { | ||
@@ -412,2 +457,9 @@ return ($results.html() === ''); | ||
select: { | ||
firstResult: function() { | ||
module.verbose('Selecting first result'); | ||
$result.first().addClass(className.active); | ||
} | ||
}, | ||
set: { | ||
@@ -502,23 +554,7 @@ focus: function() { | ||
remote: function(searchTerm) { | ||
var | ||
apiSettings = { | ||
onSuccess : function(response) { | ||
module.parse.response.call(element, response, searchTerm); | ||
}, | ||
onFailure: function() { | ||
module.displayMessage(error.serverError); | ||
}, | ||
urlData: { | ||
query: searchTerm | ||
} | ||
} | ||
; | ||
if( !$module.api('get request') ) { | ||
module.setup.api(); | ||
if($module.api('is loading')) { | ||
$module.api('abort'); | ||
} | ||
$.extend(true, apiSettings, settings.apiSettings); | ||
module.debug('Executing search', apiSettings); | ||
module.cancel.query(); | ||
module.setup.api(searchTerm); | ||
$module | ||
.api('setting', apiSettings) | ||
.api('query') | ||
@@ -804,8 +840,15 @@ ; | ||
} | ||
$results | ||
.html(html) | ||
; | ||
if( module.can.show() ) { | ||
if(html) { | ||
$results | ||
.html(html) | ||
; | ||
module.refreshResults(); | ||
if(settings.selectFirstResult) { | ||
module.select.firstResult(); | ||
} | ||
module.showResults(); | ||
} | ||
else { | ||
module.hideResults(); | ||
} | ||
}, | ||
@@ -888,3 +931,3 @@ | ||
} | ||
else { | ||
else if(settings.showNoResults) { | ||
html = module.displayMessage(error.noResults, 'empty'); | ||
@@ -926,3 +969,3 @@ } | ||
debug: function() { | ||
if(settings.debug) { | ||
if(!settings.silent && settings.debug) { | ||
if(settings.performance) { | ||
@@ -938,3 +981,3 @@ module.performance.log(arguments); | ||
verbose: function() { | ||
if(settings.verbose && settings.debug) { | ||
if(!settings.silent && settings.verbose && settings.debug) { | ||
if(settings.performance) { | ||
@@ -950,4 +993,6 @@ module.performance.log(arguments); | ||
error: function() { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
if(!settings.silent) { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
} | ||
}, | ||
@@ -1086,21 +1131,26 @@ performance: { | ||
name : 'Search', | ||
namespace : 'search', | ||
name : 'Search', | ||
namespace : 'search', | ||
debug : false, | ||
verbose : false, | ||
performance : true, | ||
silent : false, | ||
debug : false, | ||
verbose : false, | ||
performance : true, | ||
type : 'standard', | ||
// template to use (specified in settings.templates) | ||
type : 'standard', | ||
minCharacters : 1, | ||
// minimum characters required to search | ||
minCharacters : 1, | ||
apiSettings : false, | ||
// whether to select first result after searching automatically | ||
selectFirstResult : false, | ||
// API config | ||
apiSettings : false, | ||
source : false, | ||
// object to search | ||
source : false, | ||
// fields to search | ||
searchFields : [ | ||
@@ -1110,25 +1160,27 @@ 'title', | ||
], | ||
// fields to search | ||
// field to display in standard results template | ||
displayField : '', | ||
// field to display in standard results template | ||
// whether to include fuzzy results in local search | ||
searchFullText : true, | ||
// whether to include fuzzy results in local search | ||
// whether to add events to prompt automatically | ||
automatic : true, | ||
// whether to add events to prompt automatically | ||
// delay before hiding menu after blur | ||
hideDelay : 0, | ||
// delay before hiding menu after blur | ||
// delay before searching | ||
searchDelay : 200, | ||
// delay before searching | ||
// maximum results returned from local | ||
maxResults : 7, | ||
// maximum results returned from local | ||
// whether to store lookups in local cache | ||
cache : true, | ||
// whether to store lookups in local cache | ||
// whether no results errors should be shown | ||
showNoResults : true, | ||
// transition settings | ||
@@ -1202,2 +1254,3 @@ transition : 'scale', | ||
results : '.results', | ||
message : '.results > .message', | ||
category : '.category', | ||
@@ -1204,0 +1257,0 @@ result : '.result', |
@@ -6,3 +6,2 @@ /*! | ||
* | ||
* Copyright 2015 Contributors | ||
* Released under the MIT license | ||
@@ -13,6 +12,13 @@ * http://opensource.org/licenses/MIT | ||
;(function ( $, window, document, undefined ) { | ||
;(function ($, window, document, undefined) { | ||
"use strict"; | ||
window = (typeof window != 'undefined' && window.Math == Math) | ||
? window | ||
: (typeof self != 'undefined' && self.Math == Math) | ||
? self | ||
: Function('return this')() | ||
; | ||
$.fn.shape = function(parameters) { | ||
@@ -243,2 +249,12 @@ var | ||
$activeSide = $clone.find('.' + settings.className.active), | ||
newWidth = (settings.width == 'next') | ||
? $nextSide.outerWidth(true) | ||
: (settings.width == 'initial') | ||
? $module.width() | ||
: settings.width, | ||
newHeight = (settings.height == 'next') | ||
? $nextSide.outerHeight(true) | ||
: (settings.height == 'initial') | ||
? $module.height() | ||
: settings.height, | ||
$nextSide = (nextIndex) | ||
@@ -248,18 +264,16 @@ ? $clone.find(selector.side).eq(nextIndex) | ||
? $activeSide.next(selector.side) | ||
: $clone.find(selector.side).first(), | ||
newSize = {} | ||
: $clone.find(selector.side).first() | ||
; | ||
module.set.currentStageSize(); | ||
$activeSide.removeClass(className.active); | ||
$nextSide.addClass(className.active); | ||
$clone.insertAfter($module); | ||
newSize = { | ||
width : $nextSide.outerWidth(true), | ||
height : $nextSide.outerHeight(true) | ||
}; | ||
$clone.remove(); | ||
$module | ||
.css(newSize) | ||
; | ||
module.verbose('Resizing stage to fit new content', newSize); | ||
if(settings.width != 'auto') { | ||
$module.css('width', newWidth + settings.jitter); | ||
module.verbose('Specifying width during animation', newWidth); | ||
} | ||
if(settings.height != 'auto') { | ||
$module.css('height', newHeight + settings.jitter); | ||
module.verbose('Specifying height during animation', newHeight); | ||
} | ||
}, | ||
@@ -657,3 +671,8 @@ | ||
else if(value !== undefined) { | ||
settings[name] = value; | ||
if($.isPlainObject(settings[name])) { | ||
$.extend(true, settings[name], value); | ||
} | ||
else { | ||
settings[name] = value; | ||
} | ||
} | ||
@@ -676,3 +695,3 @@ else { | ||
debug: function() { | ||
if(settings.debug) { | ||
if(!settings.silent && settings.debug) { | ||
if(settings.performance) { | ||
@@ -688,3 +707,3 @@ module.performance.log(arguments); | ||
verbose: function() { | ||
if(settings.verbose && settings.debug) { | ||
if(!settings.silent && settings.verbose && settings.debug) { | ||
if(settings.performance) { | ||
@@ -700,4 +719,6 @@ module.performance.log(arguments); | ||
error: function() { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
if(!settings.silent) { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
} | ||
}, | ||
@@ -839,2 +860,5 @@ performance: { | ||
// hide all debug content | ||
silent : false, | ||
// debug content outputted to console | ||
@@ -846,2 +870,5 @@ debug : false, | ||
// fudge factor in pixels when swapping from 2d to 3d (can be useful to correct rounding errors) | ||
jitter : 0, | ||
// performance data output | ||
@@ -853,2 +880,8 @@ performance: true, | ||
// width during animation, can be set to 'auto', initial', 'next' or pixel amount | ||
width: 'initial', | ||
// height during animation, can be set to 'auto', 'initial', 'next' or pixel amount | ||
height: 'initial', | ||
// callback occurs on side change | ||
@@ -887,2 +920,2 @@ beforeChange : function() {}, | ||
})( jQuery, window, document ); | ||
})( jQuery, window, document ); |
@@ -6,3 +6,2 @@ /*! | ||
* | ||
* Copyright 2015 Contributors | ||
* Released under the MIT license | ||
@@ -13,6 +12,13 @@ * http://opensource.org/licenses/MIT | ||
;(function ( $, window, document, undefined ) { | ||
;(function ($, window, document, undefined) { | ||
"use strict"; | ||
window = (typeof window != 'undefined' && window.Math == Math) | ||
? window | ||
: (typeof self != 'undefined' && self.Math == Math) | ||
? self | ||
: Function('return this')() | ||
; | ||
$.fn.sidebar = function(parameters) { | ||
@@ -771,3 +777,8 @@ var | ||
else if(value !== undefined) { | ||
settings[name] = value; | ||
if($.isPlainObject(settings[name])) { | ||
$.extend(true, settings[name], value); | ||
} | ||
else { | ||
settings[name] = value; | ||
} | ||
} | ||
@@ -790,3 +801,3 @@ else { | ||
debug: function() { | ||
if(settings.debug) { | ||
if(!settings.silent && settings.debug) { | ||
if(settings.performance) { | ||
@@ -802,3 +813,3 @@ module.performance.log(arguments); | ||
verbose: function() { | ||
if(settings.verbose && settings.debug) { | ||
if(!settings.silent && settings.verbose && settings.debug) { | ||
if(settings.performance) { | ||
@@ -814,4 +825,6 @@ module.performance.log(arguments); | ||
error: function() { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
if(!settings.silent) { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
} | ||
}, | ||
@@ -951,2 +964,3 @@ performance: { | ||
silent : false, | ||
debug : false, | ||
@@ -953,0 +967,0 @@ verbose : false, |
@@ -6,3 +6,2 @@ /*! | ||
* | ||
* Copyright 2015 Contributors | ||
* Released under the MIT license | ||
@@ -13,6 +12,13 @@ * http://opensource.org/licenses/MIT | ||
;(function ( $, window, document, undefined ) { | ||
;(function ($, window, document, undefined) { | ||
"use strict"; | ||
window = (typeof window != 'undefined' && window.Math == Math) | ||
? window | ||
: (typeof self != 'undefined' && self.Math == Math) | ||
? self | ||
: Function('return this')() | ||
; | ||
$.fn.sticky = function(parameters) { | ||
@@ -62,2 +68,4 @@ var | ||
element = this, | ||
documentObserver, | ||
observer, | ||
@@ -96,2 +104,5 @@ module | ||
module.reset(); | ||
if(documentObserver) { | ||
documentObserver.disconnect(); | ||
} | ||
if(observer) { | ||
@@ -111,12 +122,8 @@ observer.disconnect(); | ||
observeChanges: function() { | ||
var | ||
context = $context[0] | ||
; | ||
if('MutationObserver' in window) { | ||
observer = new MutationObserver(function(mutations) { | ||
clearTimeout(module.timer); | ||
module.timer = setTimeout(function() { | ||
module.verbose('DOM tree modified, updating sticky menu', mutations); | ||
module.refresh(); | ||
}, 100); | ||
documentObserver = new MutationObserver(module.event.documentChanged); | ||
observer = new MutationObserver(module.event.changed); | ||
documentObserver.observe(document, { | ||
childList : true, | ||
subtree : true | ||
}); | ||
@@ -127,3 +134,3 @@ observer.observe(element, { | ||
}); | ||
observer.observe(context, { | ||
observer.observe($context[0], { | ||
childList : true, | ||
@@ -180,2 +187,21 @@ subtree : true | ||
event: { | ||
changed: function(mutations) { | ||
clearTimeout(module.timer); | ||
module.timer = setTimeout(function() { | ||
module.verbose('DOM tree modified, updating sticky menu', mutations); | ||
module.refresh(); | ||
}, 100); | ||
}, | ||
documentChanged: function(mutations) { | ||
[].forEach.call(mutations, function(mutation) { | ||
if(mutation.removedNodes) { | ||
[].forEach.call(mutation.removedNodes, function(node) { | ||
if(node == element || $(node).find(element).length > 0) { | ||
module.debug('Element removed from DOM, tearing down events'); | ||
module.destroy(); | ||
} | ||
}); | ||
} | ||
}); | ||
}, | ||
load: function() { | ||
@@ -653,3 +679,3 @@ module.verbose('Page contents finished loading'); | ||
reset: function() { | ||
module.debug('Reseting elements position'); | ||
module.debug('Resetting elements position'); | ||
module.unbind(); | ||
@@ -699,3 +725,3 @@ module.unfix(); | ||
debug: function() { | ||
if(settings.debug) { | ||
if(!settings.silent && settings.debug) { | ||
if(settings.performance) { | ||
@@ -711,3 +737,3 @@ module.performance.log(arguments); | ||
verbose: function() { | ||
if(settings.verbose && settings.debug) { | ||
if(!settings.silent && settings.verbose && settings.debug) { | ||
if(settings.performance) { | ||
@@ -723,4 +749,6 @@ module.performance.log(arguments); | ||
error: function() { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
if(!settings.silent) { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
} | ||
}, | ||
@@ -859,2 +887,3 @@ performance: { | ||
silent : false, | ||
debug : false, | ||
@@ -903,3 +932,3 @@ verbose : true, | ||
container : 'Sticky element must be inside a relative container', | ||
visible : 'Element is hidden, you must call refresh after element becomes visible', | ||
visible : 'Element is hidden, you must call refresh after element becomes visible. Use silent setting to surpress this warning in production.', | ||
method : 'The method you called is not defined.', | ||
@@ -920,2 +949,2 @@ invalidContext : 'Context specified does not exist', | ||
})( jQuery, window, document ); | ||
})( jQuery, window, document ); |
@@ -6,3 +6,2 @@ /*! | ||
* | ||
* Copyright 2015 Contributors | ||
* Released under the MIT license | ||
@@ -17,2 +16,9 @@ * http://opensource.org/licenses/MIT | ||
window = (typeof window != 'undefined' && window.Math == Math) | ||
? window | ||
: (typeof self != 'undefined' && self.Math == Math) | ||
? self | ||
: Function('return this')() | ||
; | ||
$.fn.tab = function(parameters) { | ||
@@ -453,3 +459,5 @@ | ||
onSuccess : function(response) { | ||
module.cache.add(fullTabPath, response); | ||
if(settings.cacheType == 'response') { | ||
module.cache.add(fullTabPath, response); | ||
} | ||
module.update.content(tabPath, response); | ||
@@ -465,2 +473,5 @@ if(tabPath == activeTabPath) { | ||
settings.onLoad.call($tab[0], tabPath, parameterArray, historyEvent); | ||
if(settings.cacheType != 'response') { | ||
module.cache.add(fullTabPath, $tab.html()); | ||
} | ||
}, | ||
@@ -515,4 +526,7 @@ urlData: { | ||
var | ||
$tab = module.get.tabElement(tabPath), | ||
isActive = $tab.hasClass(className.active) | ||
$tab = module.get.tabElement(tabPath), | ||
$deactiveTabs = (settings.deactivate == 'siblings') | ||
? $tab.siblings($tabs) | ||
: $tabs.not($tab), | ||
isActive = $tab.hasClass(className.active) | ||
; | ||
@@ -523,5 +537,6 @@ module.verbose('Showing tab content for', $tab); | ||
.addClass(className.active) | ||
.siblings($tabs) | ||
.removeClass(className.active + ' ' + className.loading) | ||
; | ||
$deactiveTabs | ||
.removeClass(className.active + ' ' + className.loading) | ||
; | ||
if($tab.length > 0) { | ||
@@ -534,3 +549,6 @@ settings.onVisible.call($tab[0], tabPath); | ||
var | ||
$navigation = module.get.navElement(tabPath), | ||
$navigation = module.get.navElement(tabPath), | ||
$deactiveNavigation = (settings.deactivate == 'siblings') | ||
? $navigation.siblings($allModules) | ||
: $allModules.not($navigation), | ||
isActive = $navigation.hasClass(className.active) | ||
@@ -542,5 +560,6 @@ ; | ||
.addClass(className.active) | ||
.siblings($allModules) | ||
.removeClass(className.active + ' ' + className.loading) | ||
; | ||
$deactiveNavigation | ||
.removeClass(className.active + ' ' + className.loading) | ||
; | ||
} | ||
@@ -667,3 +686,8 @@ } | ||
else if(value !== undefined) { | ||
settings[name] = value; | ||
if($.isPlainObject(settings[name])) { | ||
$.extend(true, settings[name], value); | ||
} | ||
else { | ||
settings[name] = value; | ||
} | ||
} | ||
@@ -686,3 +710,3 @@ else { | ||
debug: function() { | ||
if(settings.debug) { | ||
if(!settings.silent && settings.debug) { | ||
if(settings.performance) { | ||
@@ -698,3 +722,3 @@ module.performance.log(arguments); | ||
verbose: function() { | ||
if(settings.verbose && settings.debug) { | ||
if(!settings.silent && settings.verbose && settings.debug) { | ||
if(settings.performance) { | ||
@@ -710,4 +734,6 @@ module.performance.log(arguments); | ||
error: function() { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
if(!settings.silent) { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
} | ||
}, | ||
@@ -851,2 +877,3 @@ performance: { | ||
silent : false, | ||
debug : false, | ||
@@ -856,18 +883,21 @@ verbose : false, | ||
auto : false, // uses pjax style endpoints fetching content from same url with remote-content headers | ||
history : false, // use browser history | ||
historyType : 'hash', // #/ or html5 state | ||
path : false, // base path of url | ||
auto : false, // uses pjax style endpoints fetching content from same url with remote-content headers | ||
history : false, // use browser history | ||
historyType : 'hash', // #/ or html5 state | ||
path : false, // base path of url | ||
context : false, // specify a context that tabs must appear inside | ||
childrenOnly : false, // use only tabs that are children of context | ||
maxDepth : 25, // max depth a tab can be nested | ||
context : false, // specify a context that tabs must appear inside | ||
childrenOnly : false, // use only tabs that are children of context | ||
maxDepth : 25, // max depth a tab can be nested | ||
alwaysRefresh : false, // load tab content new every tab click | ||
cache : true, // cache the content requests to pull locally | ||
ignoreFirstLoad : false, // don't load remote content on first load | ||
deactivate : 'siblings', // whether tabs should deactivate sibling menu elements or all elements initialized together | ||
apiSettings : false, // settings for api call | ||
evaluateScripts : 'once', // whether inline scripts should be parsed (true/false/once). Once will not re-evaluate on cached content | ||
alwaysRefresh : false, // load tab content new every tab click | ||
cache : true, // cache the content requests to pull locally | ||
cacheType : 'response', // Whether to cache exact response, or to html cache contents after scripts execute | ||
ignoreFirstLoad : false, // don't load remote content on first load | ||
apiSettings : false, // settings for api call | ||
evaluateScripts : 'once', // whether inline scripts should be parsed (true/false/once). Once will not re-evaluate on cached content | ||
onFirstLoad : function(tabPath, parameterArray, historyEvent) {}, // called first time loaded | ||
@@ -878,3 +908,3 @@ onLoad : function(tabPath, parameterArray, historyEvent) {}, // called on every load | ||
templates : { | ||
templates : { | ||
determineTitle: function(tabArray) {} // returns page title for path | ||
@@ -881,0 +911,0 @@ }, |
@@ -6,3 +6,2 @@ /*! | ||
* | ||
* Copyright 2015 Contributors | ||
* Released under the MIT license | ||
@@ -13,6 +12,13 @@ * http://opensource.org/licenses/MIT | ||
;(function ( $, window, document, undefined ) { | ||
;(function ($, window, document, undefined) { | ||
"use strict"; | ||
window = (typeof window != 'undefined' && window.Math == Math) | ||
? window | ||
: (typeof self != 'undefined' && self.Math == Math) | ||
? self | ||
: Function('return this')() | ||
; | ||
$.fn.transition = function() { | ||
@@ -833,3 +839,8 @@ var | ||
else if(value !== undefined) { | ||
settings[name] = value; | ||
if($.isPlainObject(settings[name])) { | ||
$.extend(true, settings[name], value); | ||
} | ||
else { | ||
settings[name] = value; | ||
} | ||
} | ||
@@ -852,3 +863,3 @@ else { | ||
debug: function() { | ||
if(settings.debug) { | ||
if(!settings.silent && settings.debug) { | ||
if(settings.performance) { | ||
@@ -864,3 +875,3 @@ module.performance.log(arguments); | ||
verbose: function() { | ||
if(settings.verbose && settings.debug) { | ||
if(!settings.silent && settings.verbose && settings.debug) { | ||
if(settings.performance) { | ||
@@ -876,4 +887,6 @@ module.performance.log(arguments); | ||
error: function() { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
if(!settings.silent) { | ||
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); | ||
module.error.apply(console, arguments); | ||
} | ||
}, | ||
@@ -1010,2 +1023,5 @@ performance: { | ||
// hide all output from this component regardless of other settings | ||
silent : false, | ||
// debug content outputted to console | ||
@@ -1072,3 +1088,3 @@ debug : false, | ||
error: { | ||
noAnimation : 'Element is no longer attached to DOM. Unable to animate.', | ||
noAnimation : 'Element is no longer attached to DOM. Unable to animate. Use silent setting to surpress this warning in production.', | ||
repeated : 'That animation is already occurring, cancelling repeated animation', | ||
@@ -1075,0 +1091,0 @@ method : 'The method you called is not defined', |
@@ -8,3 +8,3 @@ var | ||
summary : 'Semantic UI - LESS Release of Semantic UI', | ||
version : '2.1.8', | ||
version : '2.2.1', | ||
git : 'git://github.com/Semantic-Org/Semantic-UI-LESS.git', | ||
@@ -99,4 +99,2 @@ }); | ||
'_site/modules/transition.variables', | ||
'_site/modules/video.overrides', | ||
'_site/modules/video.variables', | ||
'_site/views/ad.overrides', | ||
@@ -176,4 +174,2 @@ '_site/views/ad.variables', | ||
'definitions/modules/transition.less', | ||
'definitions/modules/video.js', | ||
'definitions/modules/video.less', | ||
'definitions/views/ad.less', | ||
@@ -238,3 +234,2 @@ 'definitions/views/card.less', | ||
'themes/default/assets/fonts/icons.eot', | ||
'themes/default/assets/fonts/icons.otf', | ||
'themes/default/assets/fonts/icons.svg', | ||
@@ -241,0 +236,0 @@ 'themes/default/assets/fonts/icons.ttf', |
{ | ||
"name": "semantic-ui-less", | ||
"version": "2.1.8", | ||
"version": "2.2.1", | ||
"title": "Semantic UI", | ||
@@ -19,2 +19,2 @@ "description": "LESS Only distribution of Semantic UI", | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
2923087
21894
8
388
2
0