diff --git a/dist/components/colorize.js b/dist/components/colorize.js
deleted file mode 100644
index 1073f5593..000000000
--- a/dist/components/colorize.js
+++ /dev/null
@@ -1,274 +0,0 @@
-/*!
- * # Semantic UI 2.0.0 - Colorize
- * http://github.com/semantic-org/semantic-ui/
- *
- *
- * Copyright 2015 Contributors
- * Released under the MIT license
- * http://opensource.org/licenses/MIT
- *
- */
-
-;(function ( $, window, document, undefined ) {
-
- "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) {
-
- var
- $module = $(this),
-
- mainCanvas = $('')[0],
- imageCanvas = $('')[0],
- overlayCanvas = $('')[0],
-
- backgroundImage = new Image(),
-
- // defs
- mainContext,
- imageContext,
- overlayContext,
-
- image,
- imageName,
-
- width,
- height,
-
- // shortcuts
- colors = settings.colors,
- paths = settings.paths,
- namespace = settings.namespace,
- error = settings.error,
-
- // boilerplate
- instance = $module.data('module-' + namespace),
- module
- ;
-
- module = {
-
- checkPreconditions: function() {
- module.debug('Checking pre-conditions');
-
- if( !$.isPlainObject(colors) || $.isEmptyObject(colors) ) {
- module.error(error.undefinedColors);
- return false;
- }
- return true;
- },
-
- async: function(callback) {
- if(settings.async) {
- setTimeout(callback, 0);
- }
- else {
- callback();
- }
- },
-
- 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);
- }
- },
-
- initialize: function() {
- module.debug('Initializing with colors', colors);
- if( module.checkPreconditions() ) {
-
- module.async(function() {
- module.getMetadata();
- module.canvas.create();
-
- module.draw.image(function() {
- module.draw.colors();
- module.canvas.merge();
- });
- $module
- .data('module-' + namespace, module)
- ;
- });
- }
- },
-
- 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');
-
- 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');
-
- $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: {
-
- 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);
- 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);
- }
- }
- },
- 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;
- });
- }
- return ( $.isFunction( method ) )
- ? method.apply(context, methodArguments)
- : false
- ;
- }
-
- };
- 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;
- };
-
- $.fn.colorize.settings = {
- name : 'Image Colorizer',
- debug : true,
- namespace : 'colorize',
-
- onDraw : function(overlayContext, imageName, colorName, color) {},
-
- // whether to block execution while updating canvas
- async : true,
- // object containing names and default values of color regions
- colors : {},
-
- 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 );
diff --git a/dist/components/colorize.min.js b/dist/components/colorize.min.js
deleted file mode 100644
index de6629dae..000000000
--- a/dist/components/colorize.min.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/*!
- * # Semantic UI 2.0.0 - Colorize
- * http://github.com/semantic-org/semantic-ui/
- *
- *
- * Copyright 2015 Contributors
- * Released under the MIT license
- * http://opensource.org/licenses/MIT
- *
- */
-!function(e,n,i,t){"use strict";e.fn.colorize=function(n){var i=e.isPlainObject(n)?e.extend(!0,{},e.fn.colorize.settings,n):e.extend({},e.fn.colorize.settings),o=arguments||!1;return e(this).each(function(n){var a,r,c,s,d,g,u,l,m=e(this),f=e("")[0],h=e("")[0],p=e("")[0],v=new Image,w=i.colors,b=(i.paths,i.namespace),y=i.error,C=m.data("module-"+b);return l={checkPreconditions:function(){return l.debug("Checking pre-conditions"),!e.isPlainObject(w)||e.isEmptyObject(w)?(l.error(y.undefinedColors),!1):!0},async:function(e){i.async?setTimeout(e,0):e()},getMetadata:function(){l.debug("Grabbing metadata"),s=m.data("image")||i.image||t,d=m.data("name")||i.name||n,g=i.width||m.width(),u=i.height||m.height(),(0===g||0===u)&&l.error(y.undefinedSize)},initialize:function(){l.debug("Initializing with colors",w),l.checkPreconditions()&&l.async(function(){l.getMetadata(),l.canvas.create(),l.draw.image(function(){l.draw.colors(),l.canvas.merge()}),m.data("module-"+b,l)})},redraw:function(){l.debug("Redrawing image"),l.async(function(){l.canvas.clear(),l.draw.colors(),l.canvas.merge()})},change:{color:function(e,n){return l.debug("Changing color",e),w[e]===t?(l.error(y.missingColor),!1):(w[e]=n,void l.redraw())}},canvas:{create:function(){l.debug("Creating canvases"),f.width=g,f.height=u,h.width=g,h.height=u,p.width=g,p.height=u,a=f.getContext("2d"),r=h.getContext("2d"),c=p.getContext("2d"),m.append(f),a=m.children("canvas")[0].getContext("2d")},clear:function(e){l.debug("Clearing canvas"),c.fillStyle="#FFFFFF",c.fillRect(0,0,g,u)},merge:function(){return e.isFunction(a.blendOnto)?(a.putImageData(r.getImageData(0,0,g,u),0,0),void c.blendOnto(a,"multiply")):void l.error(y.missingPlugin)}},draw:{image:function(e){l.debug("Drawing image"),e=e||function(){},s?(v.src=s,v.onload=function(){r.drawImage(v,0,0),e()}):(l.error(y.noImage),e())},colors:function(){l.debug("Drawing color overlays",w),e.each(w,function(e,n){i.onDraw(c,d,e,n)})}},debug:function(e,n){i.debug&&(n!==t?console.info(i.name+": "+e,n):console.info(i.name+": "+e))},error:function(e){console.warn(i.name+": "+e)},invoke:function(n,o,a){var r;return a=a||Array.prototype.slice.call(arguments,2),"string"==typeof n&&C!==t&&(n=n.split("."),e.each(n,function(n,t){return e.isPlainObject(C[t])?(C=C[t],!0):e.isFunction(C[t])?(r=C[t],!0):(l.error(i.error.method),!1)})),e.isFunction(r)?r.apply(o,a):!1}},C!==t&&o?("invoke"==o[0]&&(o=Array.prototype.slice.call(o,1)),l.invoke(o[0],this,Array.prototype.slice.call(o,1))):void l.initialize()}),this},e.fn.colorize.settings={name:"Image Colorizer",debug:!0,namespace:"colorize",onDraw:function(e,n,i,t){},async:!0,colors:{},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);
\ No newline at end of file
diff --git a/dist/components/state.js b/dist/components/state.js
deleted file mode 100644
index fd665e2b5..000000000
--- a/dist/components/state.js
+++ /dev/null
@@ -1,708 +0,0 @@
-/*!
- * # Semantic UI 2.3.0 - State
- * http://github.com/semantic-org/semantic-ui/
- *
- *
- * Released under the MIT license
- * http://opensource.org/licenses/MIT
- *
- */
-
-;(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) {
- var
- $allModules = $(this),
-
- moduleSelector = $allModules.selector || '',
-
- hasTouch = ('ontouchstart' in document.documentElement),
- time = new Date().getTime(),
- performance = [],
-
- query = arguments[0],
- methodInvoked = (typeof query == 'string'),
- queryArguments = [].slice.call(arguments, 1),
-
- returnedValue
- ;
- $allModules
- .each(function() {
- var
- settings = ( $.isPlainObject(parameters) )
- ? $.extend(true, {}, $.fn.state.settings, parameters)
- : $.extend({}, $.fn.state.settings),
-
- error = settings.error,
- metadata = settings.metadata,
- className = settings.className,
- namespace = settings.namespace,
- states = settings.states,
- text = settings.text,
-
- eventNamespace = '.' + namespace,
- moduleNamespace = namespace + '-module',
-
- $module = $(this),
-
- element = this,
- instance = $module.data(moduleNamespace),
-
- module
- ;
- module = {
-
- initialize: function() {
- module.verbose('Initializing module');
-
- // allow module to guess desired state based on element
- if(settings.automatic) {
- module.add.defaults();
- }
-
- // bind events with delegated events
- if(settings.context && moduleSelector !== '') {
- $(settings.context)
- .on(moduleSelector, 'mouseenter' + eventNamespace, module.change.text)
- .on(moduleSelector, 'mouseleave' + eventNamespace, module.reset.text)
- .on(moduleSelector, 'click' + eventNamespace, module.toggle.state)
- ;
- }
- else {
- $module
- .on('mouseenter' + eventNamespace, module.change.text)
- .on('mouseleave' + eventNamespace, module.reset.text)
- .on('click' + eventNamespace, module.toggle.state)
- ;
- }
- module.instantiate();
- },
-
- instantiate: function() {
- module.verbose('Storing instance of module', module);
- instance = module;
- $module
- .data(moduleNamespace, module)
- ;
- },
-
- destroy: function() {
- module.verbose('Destroying previous module', instance);
- $module
- .off(eventNamespace)
- .removeData(moduleNamespace)
- ;
- },
-
- refresh: function() {
- module.verbose('Refreshing selector cache');
- $module = $(element);
- },
-
- add: {
- defaults: function() {
- var
- userStates = parameters && $.isPlainObject(parameters.states)
- ? parameters.states
- : {}
- ;
- $.each(settings.defaults, function(type, typeStates) {
- if( module.is[type] !== undefined && module.is[type]() ) {
- module.verbose('Adding default states', type, element);
- $.extend(settings.states, typeStates, userStates);
- }
- });
- }
- },
-
- is: {
-
- active: function() {
- return $module.hasClass(className.active);
- },
- loading: function() {
- return $module.hasClass(className.loading);
- },
- inactive: function() {
- return !( $module.hasClass(className.active) );
- },
- state: function(state) {
- if(className[state] === undefined) {
- return false;
- }
- return $module.hasClass( className[state] );
- },
-
- enabled: function() {
- return !( $module.is(settings.filter.active) );
- },
- disabled: function() {
- return ( $module.is(settings.filter.active) );
- },
- textEnabled: function() {
- return !( $module.is(settings.filter.text) );
- },
-
- // definitions for automatic type detection
- button: function() {
- return $module.is('.button:not(a, .submit)');
- },
- input: function() {
- return $module.is('input');
- },
- progress: function() {
- return $module.is('.ui.progress');
- }
- },
-
- allow: function(state) {
- module.debug('Now allowing state', state);
- states[state] = true;
- },
- disallow: function(state) {
- module.debug('No longer allowing', state);
- states[state] = false;
- },
-
- allows: function(state) {
- return states[state] || false;
- },
-
- enable: function() {
- $module.removeClass(className.disabled);
- },
-
- disable: function() {
- $module.addClass(className.disabled);
- },
-
- setState: function(state) {
- if(module.allows(state)) {
- $module.addClass( className[state] );
- }
- },
-
- removeState: function(state) {
- if(module.allows(state)) {
- $module.removeClass( className[state] );
- }
- },
-
- toggle: {
- state: function() {
- var
- apiRequest,
- requestCancelled
- ;
- if( module.allows('active') && module.is.enabled() ) {
- module.refresh();
- if($.fn.api !== undefined) {
- apiRequest = $module.api('get request');
- requestCancelled = $module.api('was cancelled');
- if( requestCancelled ) {
- module.debug('API Request cancelled by beforesend');
- settings.activateTest = function(){ return false; };
- settings.deactivateTest = function(){ return false; };
- }
- else if(apiRequest) {
- module.listenTo(apiRequest);
- return;
- }
- }
- module.change.state();
- }
- }
- },
-
- listenTo: function(apiRequest) {
- module.debug('API request detected, waiting for state signal', apiRequest);
- if(apiRequest) {
- if(text.loading) {
- module.update.text(text.loading);
- }
- $.when(apiRequest)
- .then(function() {
- if(apiRequest.state() == 'resolved') {
- module.debug('API request succeeded');
- settings.activateTest = function(){ return true; };
- settings.deactivateTest = function(){ return true; };
- }
- else {
- module.debug('API request failed');
- settings.activateTest = function(){ return false; };
- settings.deactivateTest = function(){ return false; };
- }
- module.change.state();
- })
- ;
- }
- },
-
- // checks whether active/inactive state can be given
- change: {
-
- state: function() {
- module.debug('Determining state change direction');
- // inactive to active change
- if( module.is.inactive() ) {
- module.activate();
- }
- else {
- module.deactivate();
- }
- if(settings.sync) {
- module.sync();
- }
- settings.onChange.call(element);
- },
-
- text: function() {
- if( module.is.textEnabled() ) {
- if(module.is.disabled() ) {
- module.verbose('Changing text to disabled text', text.hover);
- module.update.text(text.disabled);
- }
- else if( module.is.active() ) {
- if(text.hover) {
- module.verbose('Changing text to hover text', text.hover);
- module.update.text(text.hover);
- }
- else if(text.deactivate) {
- module.verbose('Changing text to deactivating text', text.deactivate);
- module.update.text(text.deactivate);
- }
- }
- else {
- if(text.hover) {
- module.verbose('Changing text to hover text', text.hover);
- module.update.text(text.hover);
- }
- else if(text.activate){
- module.verbose('Changing text to activating text', text.activate);
- module.update.text(text.activate);
- }
- }
- }
- }
-
- },
-
- activate: function() {
- if( settings.activateTest.call(element) ) {
- module.debug('Setting state to active');
- $module
- .addClass(className.active)
- ;
- module.update.text(text.active);
- settings.onActivate.call(element);
- }
- },
-
- deactivate: function() {
- if( settings.deactivateTest.call(element) ) {
- module.debug('Setting state to inactive');
- $module
- .removeClass(className.active)
- ;
- module.update.text(text.inactive);
- settings.onDeactivate.call(element);
- }
- },
-
- sync: function() {
- module.verbose('Syncing other buttons to current state');
- if( module.is.active() ) {
- $allModules
- .not($module)
- .state('activate');
- }
- else {
- $allModules
- .not($module)
- .state('deactivate')
- ;
- }
- },
-
- get: {
- text: function() {
- return (settings.selector.text)
- ? $module.find(settings.selector.text).text()
- : $module.html()
- ;
- },
- textFor: function(state) {
- return text[state] || false;
- }
- },
-
- flash: {
- text: function(text, duration, callback) {
- var
- previousText = module.get.text()
- ;
- module.debug('Flashing text message', text, duration);
- text = text || settings.text.flash;
- duration = duration || settings.flashDuration;
- callback = callback || function() {};
- module.update.text(text);
- setTimeout(function(){
- module.update.text(previousText);
- callback.call(element);
- }, duration);
- }
- },
-
- reset: {
- // on mouseout sets text to previous value
- text: function() {
- var
- activeText = text.active || $module.data(metadata.storedText),
- inactiveText = text.inactive || $module.data(metadata.storedText)
- ;
- if( module.is.textEnabled() ) {
- if( module.is.active() && activeText) {
- module.verbose('Resetting active text', activeText);
- module.update.text(activeText);
- }
- else if(inactiveText) {
- module.verbose('Resetting inactive text', activeText);
- module.update.text(inactiveText);
- }
- }
- }
- },
-
- update: {
- text: function(text) {
- var
- currentText = module.get.text()
- ;
- if(text && text !== currentText) {
- module.debug('Updating text', text);
- if(settings.selector.text) {
- $module
- .data(metadata.storedText, text)
- .find(settings.selector.text)
- .text(text)
- ;
- }
- else {
- $module
- .data(metadata.storedText, text)
- .html(text)
- ;
- }
- }
- else {
- module.debug('Text is already set, ignoring update', text);
- }
- }
- },
-
- setting: function(name, value) {
- module.debug('Changing setting', name, value);
- if( $.isPlainObject(name) ) {
- $.extend(true, settings, name);
- }
- else if(value !== undefined) {
- if($.isPlainObject(settings[name])) {
- $.extend(true, settings[name], value);
- }
- else {
- settings[name] = value;
- }
- }
- else {
- return settings[name];
- }
- },
- internal: function(name, value) {
- if( $.isPlainObject(name) ) {
- $.extend(true, module, name);
- }
- else if(value !== undefined) {
- module[name] = value;
- }
- else {
- return module[name];
- }
- },
- debug: function() {
- if(!settings.silent && settings.debug) {
- if(settings.performance) {
- module.performance.log(arguments);
- }
- else {
- module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
- module.debug.apply(console, arguments);
- }
- }
- },
- verbose: function() {
- if(!settings.silent && settings.verbose && settings.debug) {
- if(settings.performance) {
- module.performance.log(arguments);
- }
- else {
- module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
- module.verbose.apply(console, arguments);
- }
- }
- },
- error: function() {
- if(!settings.silent) {
- module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
- module.error.apply(console, arguments);
- }
- },
- performance: {
- log: function(message) {
- var
- currentTime,
- executionTime,
- previousTime
- ;
- if(settings.performance) {
- currentTime = new Date().getTime();
- previousTime = time || currentTime;
- executionTime = currentTime - previousTime;
- time = currentTime;
- performance.push({
- 'Name' : message[0],
- 'Arguments' : [].slice.call(message, 1) || '',
- 'Element' : element,
- 'Execution Time' : executionTime
- });
- }
- clearTimeout(module.performance.timer);
- module.performance.timer = setTimeout(module.performance.display, 500);
- },
- display: function() {
- var
- title = settings.name + ':',
- totalTime = 0
- ;
- time = false;
- clearTimeout(module.performance.timer);
- $.each(performance, function(index, data) {
- totalTime += data['Execution Time'];
- });
- title += ' ' + totalTime + 'ms';
- if(moduleSelector) {
- title += ' \'' + moduleSelector + '\'';
- }
- if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
- console.groupCollapsed(title);
- if(console.table) {
- console.table(performance);
- }
- else {
- $.each(performance, function(index, data) {
- console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
- });
- }
- console.groupEnd();
- }
- performance = [];
- }
- },
- invoke: function(query, passedArguments, context) {
- var
- object = instance,
- maxDepth,
- found,
- response
- ;
- passedArguments = passedArguments || queryArguments;
- context = element || context;
- if(typeof query == 'string' && object !== undefined) {
- query = query.split(/[\. ]/);
- maxDepth = query.length - 1;
- $.each(query, function(depth, value) {
- var camelCaseValue = (depth != maxDepth)
- ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
- : query
- ;
- if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
- object = object[camelCaseValue];
- }
- else if( object[camelCaseValue] !== undefined ) {
- found = object[camelCaseValue];
- return false;
- }
- else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
- object = object[value];
- }
- else if( object[value] !== undefined ) {
- found = object[value];
- return false;
- }
- else {
- module.error(error.method, query);
- return false;
- }
- });
- }
- if ( $.isFunction( found ) ) {
- response = found.apply(context, passedArguments);
- }
- else if(found !== undefined) {
- response = found;
- }
- if($.isArray(returnedValue)) {
- returnedValue.push(response);
- }
- else if(returnedValue !== undefined) {
- returnedValue = [returnedValue, response];
- }
- else if(response !== undefined) {
- returnedValue = response;
- }
- return found;
- }
- };
-
- if(methodInvoked) {
- if(instance === undefined) {
- module.initialize();
- }
- module.invoke(query);
- }
- else {
- if(instance !== undefined) {
- instance.invoke('destroy');
- }
- module.initialize();
- }
- })
- ;
-
- return (returnedValue !== undefined)
- ? returnedValue
- : this
- ;
-};
-
-$.fn.state.settings = {
-
- // module info
- name : 'State',
-
- // debug output
- debug : false,
-
- // verbose debug output
- verbose : false,
-
- // namespace for events
- namespace : 'state',
-
- // debug data includes performance
- performance : true,
-
- // callback occurs on state change
- onActivate : function() {},
- onDeactivate : function() {},
- onChange : function() {},
-
- // state test functions
- activateTest : function() { return true; },
- deactivateTest : function() { return true; },
-
- // whether to automatically map default states
- automatic : true,
-
- // activate / deactivate changes all elements instantiated at same time
- sync : false,
-
- // default flash text duration, used for temporarily changing text of an element
- flashDuration : 1000,
-
- // selector filter
- filter : {
- text : '.loading, .disabled',
- active : '.disabled'
- },
-
- context : false,
-
- // error
- error: {
- beforeSend : 'The before send function has cancelled state change',
- method : 'The method you called is not defined.'
- },
-
- // metadata
- metadata: {
- promise : 'promise',
- storedText : 'stored-text'
- },
-
- // change class on state
- className: {
- active : 'active',
- disabled : 'disabled',
- error : 'error',
- loading : 'loading',
- success : 'success',
- warning : 'warning'
- },
-
- selector: {
- // selector for text node
- text: false
- },
-
- defaults : {
- input: {
- disabled : true,
- loading : true,
- active : true
- },
- button: {
- disabled : true,
- loading : true,
- active : true,
- },
- progress: {
- active : true,
- success : true,
- warning : true,
- error : true
- }
- },
-
- states : {
- active : true,
- disabled : true,
- error : true,
- loading : true,
- success : true,
- warning : true
- },
-
- text : {
- disabled : false,
- flash : false,
- hover : false,
- active : false,
- inactive : false,
- activate : false,
- deactivate : false
- }
-
-};
-
-
-
-})( jQuery, window, document );
diff --git a/dist/components/state.min.js b/dist/components/state.min.js
deleted file mode 100644
index d2d4a2904..000000000
--- a/dist/components/state.min.js
+++ /dev/null
@@ -1 +0,0 @@
-!function(e,t,n,a){"use strict";t=void 0!==t&&t.Math==Math?t:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")(),e.fn.state=function(t){var i,o=e(this),s=o.selector||"",c=(n.documentElement,(new Date).getTime()),r=[],l=arguments[0],u="string"==typeof l,d=[].slice.call(arguments,1);return o.each(function(){var n,f=e.isPlainObject(t)?e.extend(!0,{},e.fn.state.settings,t):e.extend({},e.fn.state.settings),v=f.error,g=f.metadata,b=f.className,x=f.namespace,h=f.states,m=f.text,p="."+x,T=x+"-module",y=e(this),w=this,C=y.data(T);n={initialize:function(){n.verbose("Initializing module"),f.automatic&&n.add.defaults(),f.context&&""!==s?e(f.context).on(s,"mouseenter"+p,n.change.text).on(s,"mouseleave"+p,n.reset.text).on(s,"click"+p,n.toggle.state):y.on("mouseenter"+p,n.change.text).on("mouseleave"+p,n.reset.text).on("click"+p,n.toggle.state),n.instantiate()},instantiate:function(){n.verbose("Storing instance of module",n),C=n,y.data(T,n)},destroy:function(){n.verbose("Destroying previous module",C),y.off(p).removeData(T)},refresh:function(){n.verbose("Refreshing selector cache"),y=e(w)},add:{defaults:function(){var i=t&&e.isPlainObject(t.states)?t.states:{};e.each(f.defaults,function(t,o){n.is[t]!==a&&n.is[t]()&&(n.verbose("Adding default states",t,w),e.extend(f.states,o,i))})}},is:{active:function(){return y.hasClass(b.active)},loading:function(){return y.hasClass(b.loading)},inactive:function(){return!y.hasClass(b.active)},state:function(e){return b[e]!==a&&y.hasClass(b[e])},enabled:function(){return!y.is(f.filter.active)},disabled:function(){return y.is(f.filter.active)},textEnabled:function(){return!y.is(f.filter.text)},button:function(){return y.is(".button:not(a, .submit)")},input:function(){return y.is("input")},progress:function(){return y.is(".ui.progress")}},allow:function(e){n.debug("Now allowing state",e),h[e]=!0},disallow:function(e){n.debug("No longer allowing",e),h[e]=!1},allows:function(e){return h[e]||!1},enable:function(){y.removeClass(b.disabled)},disable:function(){y.addClass(b.disabled)},setState:function(e){n.allows(e)&&y.addClass(b[e])},removeState:function(e){n.allows(e)&&y.removeClass(b[e])},toggle:{state:function(){var t;if(n.allows("active")&&n.is.enabled()){if(n.refresh(),e.fn.api!==a)if(t=y.api("get request"),y.api("was cancelled"))n.debug("API Request cancelled by beforesend"),f.activateTest=function(){return!1},f.deactivateTest=function(){return!1};else if(t)return void n.listenTo(t);n.change.state()}}},listenTo:function(t){n.debug("API request detected, waiting for state signal",t),t&&(m.loading&&n.update.text(m.loading),e.when(t).then(function(){"resolved"==t.state()?(n.debug("API request succeeded"),f.activateTest=function(){return!0},f.deactivateTest=function(){return!0}):(n.debug("API request failed"),f.activateTest=function(){return!1},f.deactivateTest=function(){return!1}),n.change.state()}))},change:{state:function(){n.debug("Determining state change direction"),n.is.inactive()?n.activate():n.deactivate(),f.sync&&n.sync(),f.onChange.call(w)},text:function(){n.is.textEnabled()&&(n.is.disabled()?(n.verbose("Changing text to disabled text",m.hover),n.update.text(m.disabled)):n.is.active()?m.hover?(n.verbose("Changing text to hover text",m.hover),n.update.text(m.hover)):m.deactivate&&(n.verbose("Changing text to deactivating text",m.deactivate),n.update.text(m.deactivate)):m.hover?(n.verbose("Changing text to hover text",m.hover),n.update.text(m.hover)):m.activate&&(n.verbose("Changing text to activating text",m.activate),n.update.text(m.activate)))}},activate:function(){f.activateTest.call(w)&&(n.debug("Setting state to active"),y.addClass(b.active),n.update.text(m.active),f.onActivate.call(w))},deactivate:function(){f.deactivateTest.call(w)&&(n.debug("Setting state to inactive"),y.removeClass(b.active),n.update.text(m.inactive),f.onDeactivate.call(w))},sync:function(){n.verbose("Syncing other buttons to current state"),n.is.active()?o.not(y).state("activate"):o.not(y).state("deactivate")},get:{text:function(){return f.selector.text?y.find(f.selector.text).text():y.html()},textFor:function(e){return m[e]||!1}},flash:{text:function(e,t,a){var i=n.get.text();n.debug("Flashing text message",e,t),e=e||f.text.flash,t=t||f.flashDuration,a=a||function(){},n.update.text(e),setTimeout(function(){n.update.text(i),a.call(w)},t)}},reset:{text:function(){var e=m.active||y.data(g.storedText),t=m.inactive||y.data(g.storedText);n.is.textEnabled()&&(n.is.active()&&e?(n.verbose("Resetting active text",e),n.update.text(e)):t&&(n.verbose("Resetting inactive text",e),n.update.text(t)))}},update:{text:function(e){var t=n.get.text();e&&e!==t?(n.debug("Updating text",e),f.selector.text?y.data(g.storedText,e).find(f.selector.text).text(e):y.data(g.storedText,e).html(e)):n.debug("Text is already set, ignoring update",e)}},setting:function(t,i){if(n.debug("Changing setting",t,i),e.isPlainObject(t))e.extend(!0,f,t);else{if(i===a)return f[t];e.isPlainObject(f[t])?e.extend(!0,f[t],i):f[t]=i}},internal:function(t,i){if(e.isPlainObject(t))e.extend(!0,n,t);else{if(i===a)return n[t];n[t]=i}},debug:function(){!f.silent&&f.debug&&(f.performance?n.performance.log(arguments):(n.debug=Function.prototype.bind.call(console.info,console,f.name+":"),n.debug.apply(console,arguments)))},verbose:function(){!f.silent&&f.verbose&&f.debug&&(f.performance?n.performance.log(arguments):(n.verbose=Function.prototype.bind.call(console.info,console,f.name+":"),n.verbose.apply(console,arguments)))},error:function(){f.silent||(n.error=Function.prototype.bind.call(console.error,console,f.name+":"),n.error.apply(console,arguments))},performance:{log:function(e){var t,a;f.performance&&(a=(t=(new Date).getTime())-(c||t),c=t,r.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:w,"Execution Time":a})),clearTimeout(n.performance.timer),n.performance.timer=setTimeout(n.performance.display,500)},display:function(){var t=f.name+":",i=0;c=!1,clearTimeout(n.performance.timer),e.each(r,function(e,t){i+=t["Execution Time"]}),t+=" "+i+"ms",s&&(t+=" '"+s+"'"),(console.group!==a||console.table!==a)&&r.length>0&&(console.groupCollapsed(t),console.table?console.table(r):e.each(r,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),r=[]}},invoke:function(t,o,s){var c,r,l,u=C;return o=o||d,s=w||s,"string"==typeof t&&u!==a&&(t=t.split(/[\. ]/),c=t.length-1,e.each(t,function(i,o){var s=i!=c?o+t[i+1].charAt(0).toUpperCase()+t[i+1].slice(1):t;if(e.isPlainObject(u[s])&&i!=c)u=u[s];else{if(u[s]!==a)return r=u[s],!1;if(!e.isPlainObject(u[o])||i==c)return u[o]!==a?(r=u[o],!1):(n.error(v.method,t),!1);u=u[o]}})),e.isFunction(r)?l=r.apply(s,o):r!==a&&(l=r),e.isArray(i)?i.push(l):i!==a?i=[i,l]:l!==a&&(i=l),r}},u?(C===a&&n.initialize(),n.invoke(l)):(C!==a&&C.invoke("destroy"),n.initialize())}),i!==a?i:this},e.fn.state.settings={name:"State",debug:!1,verbose:!1,namespace:"state",performance:!0,onActivate:function(){},onDeactivate:function(){},onChange:function(){},activateTest:function(){return!0},deactivateTest:function(){return!0},automatic:!0,sync:!1,flashDuration:1e3,filter:{text:".loading, .disabled",active:".disabled"},context:!1,error:{beforeSend:"The before send function has cancelled state change",method:"The method you called is not defined."},metadata:{promise:"promise",storedText:"stored-text"},className:{active:"active",disabled:"disabled",error:"error",loading:"loading",success:"success",warning:"warning"},selector:{text:!1},defaults:{input:{disabled:!0,loading:!0,active:!0},button:{disabled:!0,loading:!0,active:!0},progress:{active:!0,success:!0,warning:!0,error:!0}},states:{active:!0,disabled:!0,error:!0,loading:!0,success:!0,warning:!0},text:{disabled:!1,flash:!1,hover:!1,active:!1,inactive:!1,activate:!1,deactivate:!1}}}(jQuery,window,document);
\ No newline at end of file
diff --git a/dist/components/visit.js b/dist/components/visit.js
deleted file mode 100644
index 13c0ff409..000000000
--- a/dist/components/visit.js
+++ /dev/null
@@ -1,517 +0,0 @@
-/*!
- * # Semantic UI 2.0.0 - Visit
- * http://github.com/semantic-org/semantic-ui/
- *
- *
- * Copyright 2015 Contributors
- * Released under the MIT license
- * http://opensource.org/licenses/MIT
- *
- */
-
-;(function ($, window, document, undefined) {
-
-"use strict";
-
-$.visit = $.fn.visit = function(parameters) {
- var
- $allModules = $.isFunction(this)
- ? $(window)
- : $(this),
- moduleSelector = $allModules.selector || '',
-
- time = new Date().getTime(),
- performance = [],
-
- query = arguments[0],
- methodInvoked = (typeof query == 'string'),
- queryArguments = [].slice.call(arguments, 1),
- returnedValue
- ;
- $allModules
- .each(function() {
- var
- settings = ( $.isPlainObject(parameters) )
- ? $.extend(true, {}, $.fn.visit.settings, parameters)
- : $.extend({}, $.fn.visit.settings),
-
- error = settings.error,
- namespace = settings.namespace,
-
- eventNamespace = '.' + namespace,
- moduleNamespace = namespace + '-module',
-
- $module = $(this),
- $displays = $(),
-
- element = this,
- instance = $module.data(moduleNamespace),
- module
- ;
- module = {
-
- initialize: function() {
- if(settings.count) {
- module.store(settings.key.count, settings.count);
- }
- else if(settings.id) {
- module.add.id(settings.id);
- }
- else if(settings.increment && methodInvoked !== 'increment') {
- module.increment();
- }
- module.add.display($module);
- module.instantiate();
- },
-
- instantiate: function() {
- module.verbose('Storing instance of visit module', module);
- instance = module;
- $module
- .data(moduleNamespace, module)
- ;
- },
-
- destroy: function() {
- module.verbose('Destroying instance');
- $module
- .removeData(moduleNamespace)
- ;
- },
-
- increment: function(id) {
- var
- currentValue = module.get.count(),
- newValue = +(currentValue) + 1
- ;
- if(id) {
- module.add.id(id);
- }
- else {
- if(newValue > settings.limit && !settings.surpass) {
- newValue = settings.limit;
- }
- module.debug('Incrementing visits', newValue);
- module.store(settings.key.count, newValue);
- }
- },
-
- decrement: function(id) {
- var
- currentValue = module.get.count(),
- newValue = +(currentValue) - 1
- ;
- if(id) {
- module.remove.id(id);
- }
- else {
- module.debug('Removing visit');
- module.store(settings.key.count, newValue);
- }
- },
-
- get: {
- count: function() {
- return +(module.retrieve(settings.key.count)) || 0;
- },
- idCount: function(ids) {
- ids = ids || module.get.ids();
- return ids.length;
- },
- ids: function(delimitedIDs) {
- var
- idArray = []
- ;
- delimitedIDs = delimitedIDs || module.retrieve(settings.key.ids);
- if(typeof delimitedIDs === 'string') {
- idArray = delimitedIDs.split(settings.delimiter);
- }
- module.verbose('Found visited ID list', idArray);
- return idArray;
- },
- storageOptions: function(data) {
- var
- options = {}
- ;
- if(settings.expires) {
- options.expires = settings.expires;
- }
- if(settings.domain) {
- options.domain = settings.domain;
- }
- if(settings.path) {
- options.path = settings.path;
- }
- return options;
- }
- },
-
- has: {
- visited: function(id, ids) {
- var
- visited = false
- ;
- ids = ids || module.get.ids();
- if(id !== undefined && ids) {
- $.each(ids, function(index, value){
- if(value == id) {
- visited = true;
- }
- });
- }
- return visited;
- }
- },
-
- set: {
- count: function(value) {
- module.store(settings.key.count, value);
- },
- ids: function(value) {
- module.store(settings.key.ids, value);
- }
- },
-
- reset: function() {
- module.store(settings.key.count, 0);
- module.store(settings.key.ids, null);
- },
-
- add: {
- id: function(id) {
- var
- currentIDs = module.retrieve(settings.key.ids),
- newIDs = (currentIDs === undefined || currentIDs === '')
- ? id
- : currentIDs + settings.delimiter + id
- ;
- if( module.has.visited(id) ) {
- module.debug('Unique content already visited, not adding visit', id, currentIDs);
- }
- else if(id === undefined) {
- module.debug('ID is not defined');
- }
- else {
- module.debug('Adding visit to unique content', id);
- module.store(settings.key.ids, newIDs);
- }
- module.set.count( module.get.idCount() );
- },
- display: function(selector) {
- var
- $element = $(selector)
- ;
- if($element.length > 0 && !$.isWindow($element[0])) {
- module.debug('Updating visit count for element', $element);
- $displays = ($displays.length > 0)
- ? $displays.add($element)
- : $element
- ;
- }
- }
- },
-
- remove: {
- id: function(id) {
- var
- currentIDs = module.get.ids(),
- newIDs = []
- ;
- if(id !== undefined && currentIDs !== undefined) {
- module.debug('Removing visit to unique content', id, currentIDs);
- $.each(currentIDs, function(index, value){
- if(value !== id) {
- newIDs.push(value);
- }
- });
- newIDs = newIDs.join(settings.delimiter);
- module.store(settings.key.ids, newIDs );
- }
- module.set.count( module.get.idCount() );
- }
- },
-
- check: {
- limit: function(value) {
- value = value || module.get.count();
- if(settings.limit) {
- if(value >= settings.limit) {
- module.debug('Pages viewed exceeded limit, firing callback', value, settings.limit);
- settings.onLimit.call(element, value);
- }
- module.debug('Limit not reached', value, settings.limit);
- settings.onChange.call(element, value);
- }
- module.update.display(value);
- }
- },
-
- update: {
- display: function(value) {
- value = value || module.get.count();
- if($displays.length > 0) {
- module.debug('Updating displayed view count', $displays);
- $displays.html(value);
- }
- }
- },
-
- store: function(key, value) {
- var
- options = module.get.storageOptions(value)
- ;
- if(settings.storageMethod == 'localstorage' && window.localStorage !== undefined) {
- window.localStorage.setItem(key, value);
- module.debug('Value stored using local storage', key, value);
- }
- else if($.cookie !== undefined) {
- $.cookie(key, value, options);
- module.debug('Value stored using cookie', key, value, options);
- }
- else {
- module.error(error.noCookieStorage);
- return;
- }
- if(key == settings.key.count) {
- module.check.limit(value);
- }
- },
- retrieve: function(key, value) {
- var
- storedValue
- ;
- if(settings.storageMethod == 'localstorage' && window.localStorage !== undefined) {
- storedValue = window.localStorage.getItem(key);
- }
- // get by cookie
- else if($.cookie !== undefined) {
- storedValue = $.cookie(key);
- }
- else {
- module.error(error.noCookieStorage);
- }
- if(storedValue == 'undefined' || storedValue == 'null' || storedValue === undefined || storedValue === null) {
- storedValue = undefined;
- }
- return storedValue;
- },
-
- setting: function(name, value) {
- if( $.isPlainObject(name) ) {
- $.extend(true, settings, name);
- }
- else if(value !== undefined) {
- settings[name] = value;
- }
- else {
- return settings[name];
- }
- },
- internal: function(name, value) {
- module.debug('Changing internal', name, value);
- if(value !== undefined) {
- if( $.isPlainObject(name) ) {
- $.extend(true, module, name);
- }
- else {
- module[name] = value;
- }
- }
- else {
- return module[name];
- }
- },
- debug: function() {
- if(settings.debug) {
- if(settings.performance) {
- module.performance.log(arguments);
- }
- else {
- module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
- module.debug.apply(console, arguments);
- }
- }
- },
- verbose: function() {
- if(settings.verbose && settings.debug) {
- if(settings.performance) {
- module.performance.log(arguments);
- }
- else {
- module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
- module.verbose.apply(console, arguments);
- }
- }
- },
- error: function() {
- module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
- module.error.apply(console, arguments);
- },
- performance: {
- log: function(message) {
- var
- currentTime,
- executionTime,
- previousTime
- ;
- if(settings.performance) {
- currentTime = new Date().getTime();
- previousTime = time || currentTime;
- executionTime = currentTime - previousTime;
- time = currentTime;
- performance.push({
- 'Name' : message[0],
- 'Arguments' : [].slice.call(message, 1) || '',
- 'Element' : element,
- 'Execution Time' : executionTime
- });
- }
- clearTimeout(module.performance.timer);
- module.performance.timer = setTimeout(module.performance.display, 500);
- },
- display: function() {
- var
- title = settings.name + ':',
- totalTime = 0
- ;
- time = false;
- clearTimeout(module.performance.timer);
- $.each(performance, function(index, data) {
- totalTime += data['Execution Time'];
- });
- title += ' ' + totalTime + 'ms';
- if(moduleSelector) {
- title += ' \'' + moduleSelector + '\'';
- }
- if($allModules.length > 1) {
- title += ' ' + '(' + $allModules.length + ')';
- }
- if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
- console.groupCollapsed(title);
- if(console.table) {
- console.table(performance);
- }
- else {
- $.each(performance, function(index, data) {
- console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
- });
- }
- console.groupEnd();
- }
- performance = [];
- }
- },
- invoke: function(query, passedArguments, context) {
- var
- object = instance,
- maxDepth,
- found,
- response
- ;
- passedArguments = passedArguments || queryArguments;
- context = element || context;
- if(typeof query == 'string' && object !== undefined) {
- query = query.split(/[\. ]/);
- maxDepth = query.length - 1;
- $.each(query, function(depth, value) {
- var camelCaseValue = (depth != maxDepth)
- ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
- : query
- ;
- if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
- object = object[camelCaseValue];
- }
- else if( object[camelCaseValue] !== undefined ) {
- found = object[camelCaseValue];
- return false;
- }
- else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
- object = object[value];
- }
- else if( object[value] !== undefined ) {
- found = object[value];
- return false;
- }
- else {
- return false;
- }
- });
- }
- if ( $.isFunction( found ) ) {
- response = found.apply(context, passedArguments);
- }
- else if(found !== undefined) {
- response = found;
- }
- if($.isArray(returnedValue)) {
- returnedValue.push(response);
- }
- else if(returnedValue !== undefined) {
- returnedValue = [returnedValue, response];
- }
- else if(response !== undefined) {
- returnedValue = response;
- }
- return found;
- }
- };
- if(methodInvoked) {
- if(instance === undefined) {
- module.initialize();
- }
- module.invoke(query);
- }
- else {
- if(instance !== undefined) {
- instance.invoke('destroy');
- }
- module.initialize();
- }
-
- })
- ;
- return (returnedValue !== undefined)
- ? returnedValue
- : this
- ;
-};
-
-$.fn.visit.settings = {
-
- name : 'Visit',
-
- debug : false,
- verbose : false,
- performance : true,
-
- namespace : 'visit',
-
- increment : false,
- surpass : false,
- count : false,
- limit : false,
-
- delimiter : '&',
- storageMethod : 'localstorage',
-
- key : {
- count : 'visit-count',
- ids : 'visit-ids'
- },
-
- expires : 30,
- domain : false,
- path : '/',
-
- onLimit : function() {},
- onChange : function() {},
-
- error : {
- method : 'The method you called is not defined',
- missingPersist : 'Using the persist setting requires the inclusion of PersistJS',
- noCookieStorage : 'The default storage cookie requires $.cookie to be included.'
- }
-
-};
-
-})( jQuery, window , document );
diff --git a/dist/components/visit.min.js b/dist/components/visit.min.js
deleted file mode 100644
index 1b734d749..000000000
--- a/dist/components/visit.min.js
+++ /dev/null
@@ -1,11 +0,0 @@
-/*!
- * # Semantic UI 2.0.0 - Visit
- * http://github.com/semantic-org/semantic-ui/
- *
- *
- * Copyright 2015 Contributors
- * Released under the MIT license
- * http://opensource.org/licenses/MIT
- *
- */
-!function(e,t,i,n){"use strict";e.visit=e.fn.visit=function(i){var o,r=e(e.isFunction(this)?t:this),s=r.selector||"",a=(new Date).getTime(),c=[],u=arguments[0],l="string"==typeof u,d=[].slice.call(arguments,1);return r.each(function(){var g,m=e.isPlainObject(i)?e.extend(!0,{},e.fn.visit.settings,i):e.extend({},e.fn.visit.settings),f=m.error,p=m.namespace,v=p+"-module",h=e(this),b=e(),y=this,k=h.data(v);g={initialize:function(){m.count?g.store(m.key.count,m.count):m.id?g.add.id(m.id):m.increment&&"increment"!==l&&g.increment(),g.add.display(h),g.instantiate()},instantiate:function(){g.verbose("Storing instance of visit module",g),k=g,h.data(v,g)},destroy:function(){g.verbose("Destroying instance"),h.removeData(v)},increment:function(e){var t=g.get.count(),i=+t+1;e?g.add.id(e):(i>m.limit&&!m.surpass&&(i=m.limit),g.debug("Incrementing visits",i),g.store(m.key.count,i))},decrement:function(e){var t=g.get.count(),i=+t-1;e?g.remove.id(e):(g.debug("Removing visit"),g.store(m.key.count,i))},get:{count:function(){return+g.retrieve(m.key.count)||0},idCount:function(e){return e=e||g.get.ids(),e.length},ids:function(e){var t=[];return e=e||g.retrieve(m.key.ids),"string"==typeof e&&(t=e.split(m.delimiter)),g.verbose("Found visited ID list",t),t},storageOptions:function(e){var t={};return m.expires&&(t.expires=m.expires),m.domain&&(t.domain=m.domain),m.path&&(t.path=m.path),t}},has:{visited:function(t,i){var o=!1;return i=i||g.get.ids(),t!==n&&i&&e.each(i,function(e,i){i==t&&(o=!0)}),o}},set:{count:function(e){g.store(m.key.count,e)},ids:function(e){g.store(m.key.ids,e)}},reset:function(){g.store(m.key.count,0),g.store(m.key.ids,null)},add:{id:function(e){var t=g.retrieve(m.key.ids),i=t===n||""===t?e:t+m.delimiter+e;g.has.visited(e)?g.debug("Unique content already visited, not adding visit",e,t):e===n?g.debug("ID is not defined"):(g.debug("Adding visit to unique content",e),g.store(m.key.ids,i)),g.set.count(g.get.idCount())},display:function(t){var i=e(t);i.length>0&&!e.isWindow(i[0])&&(g.debug("Updating visit count for element",i),b=b.length>0?b.add(i):i)}},remove:{id:function(t){var i=g.get.ids(),o=[];t!==n&&i!==n&&(g.debug("Removing visit to unique content",t,i),e.each(i,function(e,i){i!==t&&o.push(i)}),o=o.join(m.delimiter),g.store(m.key.ids,o)),g.set.count(g.get.idCount())}},check:{limit:function(e){e=e||g.get.count(),m.limit&&(e>=m.limit&&(g.debug("Pages viewed exceeded limit, firing callback",e,m.limit),m.onLimit.call(y,e)),g.debug("Limit not reached",e,m.limit),m.onChange.call(y,e)),g.update.display(e)}},update:{display:function(e){e=e||g.get.count(),b.length>0&&(g.debug("Updating displayed view count",b),b.html(e))}},store:function(i,o){var r=g.get.storageOptions(o);if("localstorage"==m.storageMethod&&t.localStorage!==n)t.localStorage.setItem(i,o),g.debug("Value stored using local storage",i,o);else{if(e.cookie===n)return void g.error(f.noCookieStorage);e.cookie(i,o,r),g.debug("Value stored using cookie",i,o,r)}i==m.key.count&&g.check.limit(o)},retrieve:function(i,o){var r;return"localstorage"==m.storageMethod&&t.localStorage!==n?r=t.localStorage.getItem(i):e.cookie!==n?r=e.cookie(i):g.error(f.noCookieStorage),("undefined"==r||"null"==r||r===n||null===r)&&(r=n),r},setting:function(t,i){if(e.isPlainObject(t))e.extend(!0,m,t);else{if(i===n)return m[t];m[t]=i}},internal:function(t,i){return g.debug("Changing internal",t,i),i===n?g[t]:void(e.isPlainObject(t)?e.extend(!0,g,t):g[t]=i)},debug:function(){m.debug&&(m.performance?g.performance.log(arguments):(g.debug=Function.prototype.bind.call(console.info,console,m.name+":"),g.debug.apply(console,arguments)))},verbose:function(){m.verbose&&m.debug&&(m.performance?g.performance.log(arguments):(g.verbose=Function.prototype.bind.call(console.info,console,m.name+":"),g.verbose.apply(console,arguments)))},error:function(){g.error=Function.prototype.bind.call(console.error,console,m.name+":"),g.error.apply(console,arguments)},performance:{log:function(e){var t,i,n;m.performance&&(t=(new Date).getTime(),n=a||t,i=t-n,a=t,c.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:y,"Execution Time":i})),clearTimeout(g.performance.timer),g.performance.timer=setTimeout(g.performance.display,500)},display:function(){var t=m.name+":",i=0;a=!1,clearTimeout(g.performance.timer),e.each(c,function(e,t){i+=t["Execution Time"]}),t+=" "+i+"ms",s&&(t+=" '"+s+"'"),r.length>1&&(t+=" ("+r.length+")"),(console.group!==n||console.table!==n)&&c.length>0&&(console.groupCollapsed(t),console.table?console.table(c):e.each(c,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),c=[]}},invoke:function(t,i,r){var s,a,c,u=k;return i=i||d,r=y||r,"string"==typeof t&&u!==n&&(t=t.split(/[\. ]/),s=t.length-1,e.each(t,function(i,o){var r=i!=s?o+t[i+1].charAt(0).toUpperCase()+t[i+1].slice(1):t;if(e.isPlainObject(u[r])&&i!=s)u=u[r];else{if(u[r]!==n)return a=u[r],!1;if(!e.isPlainObject(u[o])||i==s)return u[o]!==n?(a=u[o],!1):!1;u=u[o]}})),e.isFunction(a)?c=a.apply(r,i):a!==n&&(c=a),e.isArray(o)?o.push(c):o!==n?o=[o,c]:c!==n&&(o=c),a}},l?(k===n&&g.initialize(),g.invoke(u)):(k!==n&&k.invoke("destroy"),g.initialize())}),o!==n?o:this},e.fn.visit.settings={name:"Visit",debug:!1,verbose:!1,performance:!0,namespace:"visit",increment:!1,surpass:!1,count:!1,limit:!1,delimiter:"&",storageMethod:"localstorage",key:{count:"visit-count",ids:"visit-ids"},expires:30,domain:!1,path:"/",onLimit:function(){},onChange:function(){},error:{method:"The method you called is not defined",missingPersist:"Using the persist setting requires the inclusion of PersistJS",noCookieStorage:"The default storage cookie requires $.cookie to be included."}}}(jQuery,window,document);
\ No newline at end of file
diff --git a/src/definitions/behaviors/colorize.js b/src/definitions/behaviors/colorize.js
deleted file mode 100644
index 31efb1c15..000000000
--- a/src/definitions/behaviors/colorize.js
+++ /dev/null
@@ -1,280 +0,0 @@
-/*!
- * # Semantic UI - Colorize
- * http://github.com/semantic-org/semantic-ui/
- *
- *
- * Released under the MIT license
- * http://opensource.org/licenses/MIT
- *
- */
-
-;(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.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) {
-
- var
- $module = $(this),
-
- mainCanvas = $('')[0],
- imageCanvas = $('')[0],
- overlayCanvas = $('')[0],
-
- backgroundImage = new Image(),
-
- // defs
- mainContext,
- imageContext,
- overlayContext,
-
- image,
- imageName,
-
- width,
- height,
-
- // shortcuts
- colors = settings.colors,
- paths = settings.paths,
- namespace = settings.namespace,
- error = settings.error,
-
- // boilerplate
- instance = $module.data('module-' + namespace),
- module
- ;
-
- module = {
-
- checkPreconditions: function() {
- module.debug('Checking pre-conditions');
-
- if( !$.isPlainObject(colors) || $.isEmptyObject(colors) ) {
- module.error(error.undefinedColors);
- return false;
- }
- return true;
- },
-
- async: function(callback) {
- if(settings.async) {
- setTimeout(callback, 0);
- }
- else {
- callback();
- }
- },
-
- 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);
- }
- },
-
- initialize: function() {
- module.debug('Initializing with colors', colors);
- if( module.checkPreconditions() ) {
-
- module.async(function() {
- module.getMetadata();
- module.canvas.create();
-
- module.draw.image(function() {
- module.draw.colors();
- module.canvas.merge();
- });
- $module
- .data('module-' + namespace, module)
- ;
- });
- }
- },
-
- 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');
-
- 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');
-
- $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: {
-
- 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);
- 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);
- }
- }
- },
- 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;
- });
- }
- return ( $.isFunction( method ) )
- ? method.apply(context, methodArguments)
- : false
- ;
- }
-
- };
- 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;
-};
-
-$.fn.colorize.settings = {
- name : 'Image Colorizer',
- debug : true,
- namespace : 'colorize',
-
- onDraw : function(overlayContext, imageName, colorName, color) {},
-
- // whether to block execution while updating canvas
- async : true,
- // object containing names and default values of color regions
- colors : {},
-
- 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 );
diff --git a/src/definitions/behaviors/state.js b/src/definitions/behaviors/state.js
deleted file mode 100644
index 83f9ae713..000000000
--- a/src/definitions/behaviors/state.js
+++ /dev/null
@@ -1,708 +0,0 @@
-/*!
- * # Semantic UI - State
- * http://github.com/semantic-org/semantic-ui/
- *
- *
- * Released under the MIT license
- * http://opensource.org/licenses/MIT
- *
- */
-
-;(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) {
- var
- $allModules = $(this),
-
- moduleSelector = $allModules.selector || '',
-
- hasTouch = ('ontouchstart' in document.documentElement),
- time = new Date().getTime(),
- performance = [],
-
- query = arguments[0],
- methodInvoked = (typeof query == 'string'),
- queryArguments = [].slice.call(arguments, 1),
-
- returnedValue
- ;
- $allModules
- .each(function() {
- var
- settings = ( $.isPlainObject(parameters) )
- ? $.extend(true, {}, $.fn.state.settings, parameters)
- : $.extend({}, $.fn.state.settings),
-
- error = settings.error,
- metadata = settings.metadata,
- className = settings.className,
- namespace = settings.namespace,
- states = settings.states,
- text = settings.text,
-
- eventNamespace = '.' + namespace,
- moduleNamespace = namespace + '-module',
-
- $module = $(this),
-
- element = this,
- instance = $module.data(moduleNamespace),
-
- module
- ;
- module = {
-
- initialize: function() {
- module.verbose('Initializing module');
-
- // allow module to guess desired state based on element
- if(settings.automatic) {
- module.add.defaults();
- }
-
- // bind events with delegated events
- if(settings.context && moduleSelector !== '') {
- $(settings.context)
- .on(moduleSelector, 'mouseenter' + eventNamespace, module.change.text)
- .on(moduleSelector, 'mouseleave' + eventNamespace, module.reset.text)
- .on(moduleSelector, 'click' + eventNamespace, module.toggle.state)
- ;
- }
- else {
- $module
- .on('mouseenter' + eventNamespace, module.change.text)
- .on('mouseleave' + eventNamespace, module.reset.text)
- .on('click' + eventNamespace, module.toggle.state)
- ;
- }
- module.instantiate();
- },
-
- instantiate: function() {
- module.verbose('Storing instance of module', module);
- instance = module;
- $module
- .data(moduleNamespace, module)
- ;
- },
-
- destroy: function() {
- module.verbose('Destroying previous module', instance);
- $module
- .off(eventNamespace)
- .removeData(moduleNamespace)
- ;
- },
-
- refresh: function() {
- module.verbose('Refreshing selector cache');
- $module = $(element);
- },
-
- add: {
- defaults: function() {
- var
- userStates = parameters && $.isPlainObject(parameters.states)
- ? parameters.states
- : {}
- ;
- $.each(settings.defaults, function(type, typeStates) {
- if( module.is[type] !== undefined && module.is[type]() ) {
- module.verbose('Adding default states', type, element);
- $.extend(settings.states, typeStates, userStates);
- }
- });
- }
- },
-
- is: {
-
- active: function() {
- return $module.hasClass(className.active);
- },
- loading: function() {
- return $module.hasClass(className.loading);
- },
- inactive: function() {
- return !( $module.hasClass(className.active) );
- },
- state: function(state) {
- if(className[state] === undefined) {
- return false;
- }
- return $module.hasClass( className[state] );
- },
-
- enabled: function() {
- return !( $module.is(settings.filter.active) );
- },
- disabled: function() {
- return ( $module.is(settings.filter.active) );
- },
- textEnabled: function() {
- return !( $module.is(settings.filter.text) );
- },
-
- // definitions for automatic type detection
- button: function() {
- return $module.is('.button:not(a, .submit)');
- },
- input: function() {
- return $module.is('input');
- },
- progress: function() {
- return $module.is('.ui.progress');
- }
- },
-
- allow: function(state) {
- module.debug('Now allowing state', state);
- states[state] = true;
- },
- disallow: function(state) {
- module.debug('No longer allowing', state);
- states[state] = false;
- },
-
- allows: function(state) {
- return states[state] || false;
- },
-
- enable: function() {
- $module.removeClass(className.disabled);
- },
-
- disable: function() {
- $module.addClass(className.disabled);
- },
-
- setState: function(state) {
- if(module.allows(state)) {
- $module.addClass( className[state] );
- }
- },
-
- removeState: function(state) {
- if(module.allows(state)) {
- $module.removeClass( className[state] );
- }
- },
-
- toggle: {
- state: function() {
- var
- apiRequest,
- requestCancelled
- ;
- if( module.allows('active') && module.is.enabled() ) {
- module.refresh();
- if($.fn.api !== undefined) {
- apiRequest = $module.api('get request');
- requestCancelled = $module.api('was cancelled');
- if( requestCancelled ) {
- module.debug('API Request cancelled by beforesend');
- settings.activateTest = function(){ return false; };
- settings.deactivateTest = function(){ return false; };
- }
- else if(apiRequest) {
- module.listenTo(apiRequest);
- return;
- }
- }
- module.change.state();
- }
- }
- },
-
- listenTo: function(apiRequest) {
- module.debug('API request detected, waiting for state signal', apiRequest);
- if(apiRequest) {
- if(text.loading) {
- module.update.text(text.loading);
- }
- $.when(apiRequest)
- .then(function() {
- if(apiRequest.state() == 'resolved') {
- module.debug('API request succeeded');
- settings.activateTest = function(){ return true; };
- settings.deactivateTest = function(){ return true; };
- }
- else {
- module.debug('API request failed');
- settings.activateTest = function(){ return false; };
- settings.deactivateTest = function(){ return false; };
- }
- module.change.state();
- })
- ;
- }
- },
-
- // checks whether active/inactive state can be given
- change: {
-
- state: function() {
- module.debug('Determining state change direction');
- // inactive to active change
- if( module.is.inactive() ) {
- module.activate();
- }
- else {
- module.deactivate();
- }
- if(settings.sync) {
- module.sync();
- }
- settings.onChange.call(element);
- },
-
- text: function() {
- if( module.is.textEnabled() ) {
- if(module.is.disabled() ) {
- module.verbose('Changing text to disabled text', text.hover);
- module.update.text(text.disabled);
- }
- else if( module.is.active() ) {
- if(text.hover) {
- module.verbose('Changing text to hover text', text.hover);
- module.update.text(text.hover);
- }
- else if(text.deactivate) {
- module.verbose('Changing text to deactivating text', text.deactivate);
- module.update.text(text.deactivate);
- }
- }
- else {
- if(text.hover) {
- module.verbose('Changing text to hover text', text.hover);
- module.update.text(text.hover);
- }
- else if(text.activate){
- module.verbose('Changing text to activating text', text.activate);
- module.update.text(text.activate);
- }
- }
- }
- }
-
- },
-
- activate: function() {
- if( settings.activateTest.call(element) ) {
- module.debug('Setting state to active');
- $module
- .addClass(className.active)
- ;
- module.update.text(text.active);
- settings.onActivate.call(element);
- }
- },
-
- deactivate: function() {
- if( settings.deactivateTest.call(element) ) {
- module.debug('Setting state to inactive');
- $module
- .removeClass(className.active)
- ;
- module.update.text(text.inactive);
- settings.onDeactivate.call(element);
- }
- },
-
- sync: function() {
- module.verbose('Syncing other buttons to current state');
- if( module.is.active() ) {
- $allModules
- .not($module)
- .state('activate');
- }
- else {
- $allModules
- .not($module)
- .state('deactivate')
- ;
- }
- },
-
- get: {
- text: function() {
- return (settings.selector.text)
- ? $module.find(settings.selector.text).text()
- : $module.html()
- ;
- },
- textFor: function(state) {
- return text[state] || false;
- }
- },
-
- flash: {
- text: function(text, duration, callback) {
- var
- previousText = module.get.text()
- ;
- module.debug('Flashing text message', text, duration);
- text = text || settings.text.flash;
- duration = duration || settings.flashDuration;
- callback = callback || function() {};
- module.update.text(text);
- setTimeout(function(){
- module.update.text(previousText);
- callback.call(element);
- }, duration);
- }
- },
-
- reset: {
- // on mouseout sets text to previous value
- text: function() {
- var
- activeText = text.active || $module.data(metadata.storedText),
- inactiveText = text.inactive || $module.data(metadata.storedText)
- ;
- if( module.is.textEnabled() ) {
- if( module.is.active() && activeText) {
- module.verbose('Resetting active text', activeText);
- module.update.text(activeText);
- }
- else if(inactiveText) {
- module.verbose('Resetting inactive text', activeText);
- module.update.text(inactiveText);
- }
- }
- }
- },
-
- update: {
- text: function(text) {
- var
- currentText = module.get.text()
- ;
- if(text && text !== currentText) {
- module.debug('Updating text', text);
- if(settings.selector.text) {
- $module
- .data(metadata.storedText, text)
- .find(settings.selector.text)
- .text(text)
- ;
- }
- else {
- $module
- .data(metadata.storedText, text)
- .html(text)
- ;
- }
- }
- else {
- module.debug('Text is already set, ignoring update', text);
- }
- }
- },
-
- setting: function(name, value) {
- module.debug('Changing setting', name, value);
- if( $.isPlainObject(name) ) {
- $.extend(true, settings, name);
- }
- else if(value !== undefined) {
- if($.isPlainObject(settings[name])) {
- $.extend(true, settings[name], value);
- }
- else {
- settings[name] = value;
- }
- }
- else {
- return settings[name];
- }
- },
- internal: function(name, value) {
- if( $.isPlainObject(name) ) {
- $.extend(true, module, name);
- }
- else if(value !== undefined) {
- module[name] = value;
- }
- else {
- return module[name];
- }
- },
- debug: function() {
- if(!settings.silent && settings.debug) {
- if(settings.performance) {
- module.performance.log(arguments);
- }
- else {
- module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
- module.debug.apply(console, arguments);
- }
- }
- },
- verbose: function() {
- if(!settings.silent && settings.verbose && settings.debug) {
- if(settings.performance) {
- module.performance.log(arguments);
- }
- else {
- module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
- module.verbose.apply(console, arguments);
- }
- }
- },
- error: function() {
- if(!settings.silent) {
- module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
- module.error.apply(console, arguments);
- }
- },
- performance: {
- log: function(message) {
- var
- currentTime,
- executionTime,
- previousTime
- ;
- if(settings.performance) {
- currentTime = new Date().getTime();
- previousTime = time || currentTime;
- executionTime = currentTime - previousTime;
- time = currentTime;
- performance.push({
- 'Name' : message[0],
- 'Arguments' : [].slice.call(message, 1) || '',
- 'Element' : element,
- 'Execution Time' : executionTime
- });
- }
- clearTimeout(module.performance.timer);
- module.performance.timer = setTimeout(module.performance.display, 500);
- },
- display: function() {
- var
- title = settings.name + ':',
- totalTime = 0
- ;
- time = false;
- clearTimeout(module.performance.timer);
- $.each(performance, function(index, data) {
- totalTime += data['Execution Time'];
- });
- title += ' ' + totalTime + 'ms';
- if(moduleSelector) {
- title += ' \'' + moduleSelector + '\'';
- }
- if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
- console.groupCollapsed(title);
- if(console.table) {
- console.table(performance);
- }
- else {
- $.each(performance, function(index, data) {
- console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
- });
- }
- console.groupEnd();
- }
- performance = [];
- }
- },
- invoke: function(query, passedArguments, context) {
- var
- object = instance,
- maxDepth,
- found,
- response
- ;
- passedArguments = passedArguments || queryArguments;
- context = element || context;
- if(typeof query == 'string' && object !== undefined) {
- query = query.split(/[\. ]/);
- maxDepth = query.length - 1;
- $.each(query, function(depth, value) {
- var camelCaseValue = (depth != maxDepth)
- ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
- : query
- ;
- if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
- object = object[camelCaseValue];
- }
- else if( object[camelCaseValue] !== undefined ) {
- found = object[camelCaseValue];
- return false;
- }
- else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
- object = object[value];
- }
- else if( object[value] !== undefined ) {
- found = object[value];
- return false;
- }
- else {
- module.error(error.method, query);
- return false;
- }
- });
- }
- if ( $.isFunction( found ) ) {
- response = found.apply(context, passedArguments);
- }
- else if(found !== undefined) {
- response = found;
- }
- if($.isArray(returnedValue)) {
- returnedValue.push(response);
- }
- else if(returnedValue !== undefined) {
- returnedValue = [returnedValue, response];
- }
- else if(response !== undefined) {
- returnedValue = response;
- }
- return found;
- }
- };
-
- if(methodInvoked) {
- if(instance === undefined) {
- module.initialize();
- }
- module.invoke(query);
- }
- else {
- if(instance !== undefined) {
- instance.invoke('destroy');
- }
- module.initialize();
- }
- })
- ;
-
- return (returnedValue !== undefined)
- ? returnedValue
- : this
- ;
-};
-
-$.fn.state.settings = {
-
- // module info
- name : 'State',
-
- // debug output
- debug : false,
-
- // verbose debug output
- verbose : false,
-
- // namespace for events
- namespace : 'state',
-
- // debug data includes performance
- performance : true,
-
- // callback occurs on state change
- onActivate : function() {},
- onDeactivate : function() {},
- onChange : function() {},
-
- // state test functions
- activateTest : function() { return true; },
- deactivateTest : function() { return true; },
-
- // whether to automatically map default states
- automatic : true,
-
- // activate / deactivate changes all elements instantiated at same time
- sync : false,
-
- // default flash text duration, used for temporarily changing text of an element
- flashDuration : 1000,
-
- // selector filter
- filter : {
- text : '.loading, .disabled',
- active : '.disabled'
- },
-
- context : false,
-
- // error
- error: {
- beforeSend : 'The before send function has cancelled state change',
- method : 'The method you called is not defined.'
- },
-
- // metadata
- metadata: {
- promise : 'promise',
- storedText : 'stored-text'
- },
-
- // change class on state
- className: {
- active : 'active',
- disabled : 'disabled',
- error : 'error',
- loading : 'loading',
- success : 'success',
- warning : 'warning'
- },
-
- selector: {
- // selector for text node
- text: false
- },
-
- defaults : {
- input: {
- disabled : true,
- loading : true,
- active : true
- },
- button: {
- disabled : true,
- loading : true,
- active : true,
- },
- progress: {
- active : true,
- success : true,
- warning : true,
- error : true
- }
- },
-
- states : {
- active : true,
- disabled : true,
- error : true,
- loading : true,
- success : true,
- warning : true
- },
-
- text : {
- disabled : false,
- flash : false,
- hover : false,
- active : false,
- inactive : false,
- activate : false,
- deactivate : false
- }
-
-};
-
-
-
-})( jQuery, window, document );
diff --git a/src/definitions/behaviors/visit.js b/src/definitions/behaviors/visit.js
deleted file mode 100644
index df88d0b9a..000000000
--- a/src/definitions/behaviors/visit.js
+++ /dev/null
@@ -1,525 +0,0 @@
-/*!
- * # Semantic UI - Visit
- * http://github.com/semantic-org/semantic-ui/
- *
- *
- * Released under the MIT license
- * http://opensource.org/licenses/MIT
- *
- */
-
-;(function ($, window, document, undefined) {
-
-"use strict";
-
-window = (typeof window != 'undefined' && window.Math == Math)
- ? window
- : (typeof self != 'undefined' && self.Math == Math)
- ? self
- : Function('return this')()
-;
-
-$.visit = $.fn.visit = function(parameters) {
- var
- $allModules = $.isFunction(this)
- ? $(window)
- : $(this),
- moduleSelector = $allModules.selector || '',
-
- time = new Date().getTime(),
- performance = [],
-
- query = arguments[0],
- methodInvoked = (typeof query == 'string'),
- queryArguments = [].slice.call(arguments, 1),
- returnedValue
- ;
- $allModules
- .each(function() {
- var
- settings = ( $.isPlainObject(parameters) )
- ? $.extend(true, {}, $.fn.visit.settings, parameters)
- : $.extend({}, $.fn.visit.settings),
-
- error = settings.error,
- namespace = settings.namespace,
-
- eventNamespace = '.' + namespace,
- moduleNamespace = namespace + '-module',
-
- $module = $(this),
- $displays = $(),
-
- element = this,
- instance = $module.data(moduleNamespace),
- module
- ;
- module = {
-
- initialize: function() {
- if(settings.count) {
- module.store(settings.key.count, settings.count);
- }
- else if(settings.id) {
- module.add.id(settings.id);
- }
- else if(settings.increment && methodInvoked !== 'increment') {
- module.increment();
- }
- module.add.display($module);
- module.instantiate();
- },
-
- instantiate: function() {
- module.verbose('Storing instance of visit module', module);
- instance = module;
- $module
- .data(moduleNamespace, module)
- ;
- },
-
- destroy: function() {
- module.verbose('Destroying instance');
- $module
- .removeData(moduleNamespace)
- ;
- },
-
- increment: function(id) {
- var
- currentValue = module.get.count(),
- newValue = +(currentValue) + 1
- ;
- if(id) {
- module.add.id(id);
- }
- else {
- if(newValue > settings.limit && !settings.surpass) {
- newValue = settings.limit;
- }
- module.debug('Incrementing visits', newValue);
- module.store(settings.key.count, newValue);
- }
- },
-
- decrement: function(id) {
- var
- currentValue = module.get.count(),
- newValue = +(currentValue) - 1
- ;
- if(id) {
- module.remove.id(id);
- }
- else {
- module.debug('Removing visit');
- module.store(settings.key.count, newValue);
- }
- },
-
- get: {
- count: function() {
- return +(module.retrieve(settings.key.count)) || 0;
- },
- idCount: function(ids) {
- ids = ids || module.get.ids();
- return ids.length;
- },
- ids: function(delimitedIDs) {
- var
- idArray = []
- ;
- delimitedIDs = delimitedIDs || module.retrieve(settings.key.ids);
- if(typeof delimitedIDs === 'string') {
- idArray = delimitedIDs.split(settings.delimiter);
- }
- module.verbose('Found visited ID list', idArray);
- return idArray;
- },
- storageOptions: function(data) {
- var
- options = {}
- ;
- if(settings.expires) {
- options.expires = settings.expires;
- }
- if(settings.domain) {
- options.domain = settings.domain;
- }
- if(settings.path) {
- options.path = settings.path;
- }
- return options;
- }
- },
-
- has: {
- visited: function(id, ids) {
- var
- visited = false
- ;
- ids = ids || module.get.ids();
- if(id !== undefined && ids) {
- $.each(ids, function(index, value){
- if(value == id) {
- visited = true;
- }
- });
- }
- return visited;
- }
- },
-
- set: {
- count: function(value) {
- module.store(settings.key.count, value);
- },
- ids: function(value) {
- module.store(settings.key.ids, value);
- }
- },
-
- reset: function() {
- module.store(settings.key.count, 0);
- module.store(settings.key.ids, null);
- },
-
- add: {
- id: function(id) {
- var
- currentIDs = module.retrieve(settings.key.ids),
- newIDs = (currentIDs === undefined || currentIDs === '')
- ? id
- : currentIDs + settings.delimiter + id
- ;
- if( module.has.visited(id) ) {
- module.debug('Unique content already visited, not adding visit', id, currentIDs);
- }
- else if(id === undefined) {
- module.debug('ID is not defined');
- }
- else {
- module.debug('Adding visit to unique content', id);
- module.store(settings.key.ids, newIDs);
- }
- module.set.count( module.get.idCount() );
- },
- display: function(selector) {
- var
- $element = $(selector)
- ;
- if($element.length > 0 && !$.isWindow($element[0])) {
- module.debug('Updating visit count for element', $element);
- $displays = ($displays.length > 0)
- ? $displays.add($element)
- : $element
- ;
- }
- }
- },
-
- remove: {
- id: function(id) {
- var
- currentIDs = module.get.ids(),
- newIDs = []
- ;
- if(id !== undefined && currentIDs !== undefined) {
- module.debug('Removing visit to unique content', id, currentIDs);
- $.each(currentIDs, function(index, value){
- if(value !== id) {
- newIDs.push(value);
- }
- });
- newIDs = newIDs.join(settings.delimiter);
- module.store(settings.key.ids, newIDs );
- }
- module.set.count( module.get.idCount() );
- }
- },
-
- check: {
- limit: function(value) {
- value = value || module.get.count();
- if(settings.limit) {
- if(value >= settings.limit) {
- module.debug('Pages viewed exceeded limit, firing callback', value, settings.limit);
- settings.onLimit.call(element, value);
- }
- module.debug('Limit not reached', value, settings.limit);
- settings.onChange.call(element, value);
- }
- module.update.display(value);
- }
- },
-
- update: {
- display: function(value) {
- value = value || module.get.count();
- if($displays.length > 0) {
- module.debug('Updating displayed view count', $displays);
- $displays.html(value);
- }
- }
- },
-
- store: function(key, value) {
- var
- options = module.get.storageOptions(value)
- ;
- if(settings.storageMethod == 'localstorage' && window.localStorage !== undefined) {
- window.localStorage.setItem(key, value);
- module.debug('Value stored using local storage', key, value);
- }
- else if($.cookie !== undefined) {
- $.cookie(key, value, options);
- module.debug('Value stored using cookie', key, value, options);
- }
- else {
- module.error(error.noCookieStorage);
- return;
- }
- if(key == settings.key.count) {
- module.check.limit(value);
- }
- },
- retrieve: function(key, value) {
- var
- storedValue
- ;
- if(settings.storageMethod == 'localstorage' && window.localStorage !== undefined) {
- storedValue = window.localStorage.getItem(key);
- }
- // get by cookie
- else if($.cookie !== undefined) {
- storedValue = $.cookie(key);
- }
- else {
- module.error(error.noCookieStorage);
- }
- if(storedValue == 'undefined' || storedValue == 'null' || storedValue === undefined || storedValue === null) {
- storedValue = undefined;
- }
- return storedValue;
- },
-
- setting: function(name, value) {
- if( $.isPlainObject(name) ) {
- $.extend(true, settings, name);
- }
- else if(value !== undefined) {
- settings[name] = value;
- }
- else {
- return settings[name];
- }
- },
- internal: function(name, value) {
- module.debug('Changing internal', name, value);
- if(value !== undefined) {
- if( $.isPlainObject(name) ) {
- $.extend(true, module, name);
- }
- else {
- module[name] = value;
- }
- }
- else {
- return module[name];
- }
- },
- debug: function() {
- if(!settings.silent && settings.debug) {
- if(settings.performance) {
- module.performance.log(arguments);
- }
- else {
- module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
- module.debug.apply(console, arguments);
- }
- }
- },
- verbose: function() {
- if(!settings.silent && settings.verbose && settings.debug) {
- if(settings.performance) {
- module.performance.log(arguments);
- }
- else {
- module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
- module.verbose.apply(console, arguments);
- }
- }
- },
- error: function() {
- if(!settings.silent) {
- module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
- module.error.apply(console, arguments);
- }
- },
- performance: {
- log: function(message) {
- var
- currentTime,
- executionTime,
- previousTime
- ;
- if(settings.performance) {
- currentTime = new Date().getTime();
- previousTime = time || currentTime;
- executionTime = currentTime - previousTime;
- time = currentTime;
- performance.push({
- 'Name' : message[0],
- 'Arguments' : [].slice.call(message, 1) || '',
- 'Element' : element,
- 'Execution Time' : executionTime
- });
- }
- clearTimeout(module.performance.timer);
- module.performance.timer = setTimeout(module.performance.display, 500);
- },
- display: function() {
- var
- title = settings.name + ':',
- totalTime = 0
- ;
- time = false;
- clearTimeout(module.performance.timer);
- $.each(performance, function(index, data) {
- totalTime += data['Execution Time'];
- });
- title += ' ' + totalTime + 'ms';
- if(moduleSelector) {
- title += ' \'' + moduleSelector + '\'';
- }
- if($allModules.length > 1) {
- title += ' ' + '(' + $allModules.length + ')';
- }
- if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
- console.groupCollapsed(title);
- if(console.table) {
- console.table(performance);
- }
- else {
- $.each(performance, function(index, data) {
- console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
- });
- }
- console.groupEnd();
- }
- performance = [];
- }
- },
- invoke: function(query, passedArguments, context) {
- var
- object = instance,
- maxDepth,
- found,
- response
- ;
- passedArguments = passedArguments || queryArguments;
- context = element || context;
- if(typeof query == 'string' && object !== undefined) {
- query = query.split(/[\. ]/);
- maxDepth = query.length - 1;
- $.each(query, function(depth, value) {
- var camelCaseValue = (depth != maxDepth)
- ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
- : query
- ;
- if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
- object = object[camelCaseValue];
- }
- else if( object[camelCaseValue] !== undefined ) {
- found = object[camelCaseValue];
- return false;
- }
- else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
- object = object[value];
- }
- else if( object[value] !== undefined ) {
- found = object[value];
- return false;
- }
- else {
- return false;
- }
- });
- }
- if ( $.isFunction( found ) ) {
- response = found.apply(context, passedArguments);
- }
- else if(found !== undefined) {
- response = found;
- }
- if($.isArray(returnedValue)) {
- returnedValue.push(response);
- }
- else if(returnedValue !== undefined) {
- returnedValue = [returnedValue, response];
- }
- else if(response !== undefined) {
- returnedValue = response;
- }
- return found;
- }
- };
- if(methodInvoked) {
- if(instance === undefined) {
- module.initialize();
- }
- module.invoke(query);
- }
- else {
- if(instance !== undefined) {
- instance.invoke('destroy');
- }
- module.initialize();
- }
-
- })
- ;
- return (returnedValue !== undefined)
- ? returnedValue
- : this
- ;
-};
-
-$.fn.visit.settings = {
-
- name : 'Visit',
-
- debug : false,
- verbose : false,
- performance : true,
-
- namespace : 'visit',
-
- increment : false,
- surpass : false,
- count : false,
- limit : false,
-
- delimiter : '&',
- storageMethod : 'localstorage',
-
- key : {
- count : 'visit-count',
- ids : 'visit-ids'
- },
-
- expires : 30,
- domain : false,
- path : '/',
-
- onLimit : function() {},
- onChange : function() {},
-
- error : {
- method : 'The method you called is not defined',
- missingPersist : 'Using the persist setting requires the inclusion of PersistJS',
- noCookieStorage : 'The default storage cookie requires $.cookie to be included.'
- }
-
-};
-
-})( jQuery, window, document );