You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
31 KiB
1 lines
31 KiB
{"version":3,"sources":["dimmer.js"],"names":["$","window","document","undefined","Math","self","Function","fn","dimmer","parameters","returnedValue","$allModules","this","time","Date","getTime","performance","query","arguments","methodInvoked","queryArguments","slice","call","each","$dimmer","$dimmable","module","settings","isPlainObject","extend","selector","namespace","className","error","eventNamespace","moduleNamespace","moduleSelector","clickEvent","documentElement","$module","element","instance","data","preinitialize","is","parent","has","dimmerName","find","filter","create","set","variation","initialize","debug","bind","events","dimmable","instantiate","verbose","destroy","unbind","remove","off","on","show","hide","toggle","page","pageDimmer","closable","event","click","removeData","target","length","content","stopImmediatePropagation","addContent","$content","detach","appendTo","$element","template","addClass","callback","isFunction","dimmed","animating","enabled","animate","onShow","onChange","onHide","useCSS","transition","opacity","animation","queue","duration","get","useFailSafe","onStart","onComplete","active","stop","css","width","height","fadeTo","removeAttr","fadeOut","hasClass","disabled","can","color","colorArray","split","isRGB","isRGBA","join","removeClass","setting","name","value","internal","silent","log","prototype","console","info","apply","message","currentTime","executionTime","previousTime","push","Name","Arguments","Element","Execution Time","clearTimeout","timer","setTimeout","display","title","totalTime","index","group","table","groupCollapsed","groupEnd","invoke","passedArguments","context","maxDepth","found","response","object","depth","camelCaseValue","charAt","toUpperCase","method","isArray","attr","jQuery"],"mappings":";;;;;;;;;CAUC,SAAWA,EAAGC,EAAQC,EAAUC,GAEjC,YAEAF,GAA2B,mBAAVA,IAAyBA,EAAOG,MAAQA,KACrDH,EACgB,mBAARI,OAAuBA,KAAKD,MAAQA,KAC1CC,KACAC,SAAS,iBAGfN,EAAEO,GAAGC,OAAS,SAASC,GACrB,GAUEC,GATAC,EAAkBX,EAAEY,MAEpBC,GAAkB,GAAIC,OAAOC,UAC7BC,KAEAC,EAAkBC,UAAU,GAC5BC,EAAmC,gBAATF,GAC1BG,KAAqBC,MAAMC,KAAKJ,UAAW,EAylB7C,OAplBAP,GACGY,KA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AMuB,EAASD,GAE1BG,IAAUzJ,IAChB0J,EAAWD,GAEV5J,EAAEoK,QAAQ1J,GACXA,EAAc8H,KAAKqB,GAEbnJ,IAAkBP,EACxBO,GAAiBA,EAAemJ,GAE1BA,IAAa1J,IACnBO,EAAgBmJ,GAEXD,IAIXlI,EAAOiB,gBAEJxB,GACEsB,IAAatC,GACduB,EAAO2B,aAET3B,EAAO8H,OAAOvI,KAGXwB,IAAatC,GACdsC,EAAS+G,OAAO,WAElB9H,EAAO2B,gBAKL3C,IAAkBP,EACtBO,EACAE,MAINZ,EAAEO,GAAGC,OAAOmB,UAEVgG,KAAc,SACd5F,UAAc,SAEd+F,QAAc,EACdxE,OAAc,EACdK,SAAc,EACd3C,aAAc,EAGd+B,YAAc,EAGdK,WAAc,EAGdkB,SAAc,OAGdwB,QAAc,EAGdC,WAAc,OAGd/B,IAAc,EAGdgC,QAAc,OAGdG,UACElC,KAAO,IACPC,KAAO,KAGT0B,SAAc,aACdD,OAAc,aACdE,OAAc,aAEd5D,OACEkI,OAAW,yCAGbnI,WACEwE,OAAa,SACbhB,UAAa,YACb/B,SAAa,WACb8B,OAAa,SACb/E,OAAa,SACbyG,SAAa,WACb/C,KAAa,OACbG,WAAa,OACbJ,KAAa,QAGfnC,UACEtB,OAAW,eACXoE,QAAW,0DAGbO,UACE3E,OAAQ,WACP,MAAOR,GAAE,WAAWqK,KAAK,QAAS,iBAMnCC,OAAQrK,OAAQC","file":"dimmer.min.js","sourcesContent":["/*!\n * # Semantic UI 2.2.6 - Dimmer\n * http://github.com/semantic-org/semantic-ui/\n *\n *\n * Released under the MIT license\n * http://opensource.org/licenses/MIT\n *\n */\n\n;(function ($, window, document, undefined) {\n\n\"use strict\";\n\nwindow = (typeof window != 'undefined' && window.Math == Math)\n ? window\n : (typeof self != 'undefined' && self.Math == Math)\n ? self\n : Function('return this')()\n;\n\n$.fn.dimmer = function(parameters) {\n var\n $allModules = $(this),\n\n time = new Date().getTime(),\n performance = [],\n\n query = arguments[0],\n methodInvoked = (typeof query == 'string'),\n queryArguments = [].slice.call(arguments, 1),\n\n returnedValue\n ;\n\n $allModules\n .each(function() {\n var\n settings = ( $.isPlainObject(parameters) )\n ? $.extend(true, {}, $.fn.dimmer.settings, parameters)\n : $.extend({}, $.fn.dimmer.settings),\n\n selector = settings.selector,\n namespace = settings.namespace,\n className = settings.className,\n error = settings.error,\n\n eventNamespace = '.' + namespace,\n moduleNamespace = 'module-' + namespace,\n moduleSelector = $allModules.selector || '',\n\n clickEvent = ('ontouchstart' in document.documentElement)\n ? 'touchstart'\n : 'click',\n\n $module = $(this),\n $dimmer,\n $dimmable,\n\n element = this,\n instance = $module.data(moduleNamespace),\n module\n ;\n\n module = {\n\n preinitialize: function() {\n if( module.is.dimmer() ) {\n\n $dimmable = $module.parent();\n $dimmer = $module;\n }\n else {\n $dimmable = $module;\n if( module.has.dimmer() ) {\n if(settings.dimmerName) {\n $dimmer = $dimmable.find(selector.dimmer).filter('.' + settings.dimmerName);\n }\n else {\n $dimmer = $dimmable.find(selector.dimmer);\n }\n }\n else {\n $dimmer = module.create();\n }\n module.set.variation();\n }\n },\n\n initialize: function() {\n module.debug('Initializing dimmer', settings);\n\n module.bind.events();\n module.set.dimmable();\n module.instantiate();\n },\n\n instantiate: function() {\n module.verbose('Storing instance of module', module);\n instance = module;\n $module\n .data(moduleNamespace, instance)\n ;\n },\n\n destroy: function() {\n module.verbose('Destroying previous module', $dimmer);\n module.unbind.events();\n module.remove.variation();\n $dimmable\n .off(eventNamespace)\n ;\n },\n\n bind: {\n events: function() {\n if(settings.on == 'hover') {\n $dimmable\n .on('mouseenter' + eventNamespace, module.show)\n .on('mouseleave' + eventNamespace, module.hide)\n ;\n }\n else if(settings.on == 'click') {\n $dimmable\n .on(clickEvent + eventNamespace, module.toggle)\n ;\n }\n if( module.is.page() ) {\n module.debug('Setting as a page dimmer', $dimmable);\n module.set.pageDimmer();\n }\n\n if( module.is.closable() ) {\n module.verbose('Adding dimmer close event', $dimmer);\n $dimmable\n .on(clickEvent + eventNamespace, selector.dimmer, module.event.click)\n ;\n }\n }\n },\n\n unbind: {\n events: function() {\n $module\n .removeData(moduleNamespace)\n ;\n $dimmable\n .off(eventNamespace)\n ;\n }\n },\n\n event: {\n click: function(event) {\n module.verbose('Determining if event occured on dimmer', event);\n if( $dimmer.find(event.target).length === 0 || $(event.target).is(selector.content) ) {\n module.hide();\n event.stopImmediatePropagation();\n }\n }\n },\n\n addContent: function(element) {\n var\n $content = $(element)\n ;\n module.debug('Add content to dimmer', $content);\n if($content.parent()[0] !== $dimmer[0]) {\n $content.detach().appendTo($dimmer);\n }\n },\n\n create: function() {\n var\n $element = $( settings.template.dimmer() )\n ;\n if(settings.dimmerName) {\n module.debug('Creating named dimmer', settings.dimmerName);\n $element.addClass(settings.dimmerName);\n }\n $element\n .appendTo($dimmable)\n ;\n return $element;\n },\n\n show: function(callback) {\n callback = $.isFunction(callback)\n ? callback\n : function(){}\n ;\n module.debug('Showing dimmer', $dimmer, settings);\n if( (!module.is.dimmed() || module.is.animating()) && module.is.enabled() ) {\n module.animate.show(callback);\n settings.onShow.call(element);\n settings.onChange.call(element);\n }\n else {\n module.debug('Dimmer is already shown or disabled');\n }\n },\n\n hide: function(callback) {\n callback = $.isFunction(callback)\n ? callback\n : function(){}\n ;\n if( module.is.dimmed() || module.is.animating() ) {\n module.debug('Hiding dimmer', $dimmer);\n module.animate.hide(callback);\n settings.onHide.call(element);\n settings.onChange.call(element);\n }\n else {\n module.debug('Dimmer is not visible');\n }\n },\n\n toggle: function() {\n module.verbose('Toggling dimmer visibility', $dimmer);\n if( !module.is.dimmed() ) {\n module.show();\n }\n else {\n module.hide();\n }\n },\n\n animate: {\n show: function(callback) {\n callback = $.isFunction(callback)\n ? callback\n : function(){}\n ;\n if(settings.useCSS && $.fn.transition !== undefined && $dimmer.transition('is supported')) {\n if(settings.opacity !== 'auto') {\n module.set.opacity();\n }\n $dimmer\n .transition({\n animation : settings.transition + ' in',\n queue : false,\n duration : module.get.duration(),\n useFailSafe : true,\n onStart : function() {\n module.set.dimmed();\n },\n onComplete : function() {\n module.set.active();\n callback();\n }\n })\n ;\n }\n else {\n module.verbose('Showing dimmer animation with javascript');\n module.set.dimmed();\n if(settings.opacity == 'auto') {\n settings.opacity = 0.8;\n }\n $dimmer\n .stop()\n .css({\n opacity : 0,\n width : '100%',\n height : '100%'\n })\n .fadeTo(module.get.duration(), settings.opacity, function() {\n $dimmer.removeAttr('style');\n module.set.active();\n callback();\n })\n ;\n }\n },\n hide: function(callback) {\n callback = $.isFunction(callback)\n ? callback\n : function(){}\n ;\n if(settings.useCSS && $.fn.transition !== undefined && $dimmer.transition('is supported')) {\n module.verbose('Hiding dimmer with css');\n $dimmer\n .transition({\n animation : settings.transition + ' out',\n queue : false,\n duration : module.get.duration(),\n useFailSafe : true,\n onStart : function() {\n module.remove.dimmed();\n },\n onComplete : function() {\n module.remove.active();\n callback();\n }\n })\n ;\n }\n else {\n module.verbose('Hiding dimmer with javascript');\n module.remove.dimmed();\n $dimmer\n .stop()\n .fadeOut(module.get.duration(), function() {\n module.remove.active();\n $dimmer.removeAttr('style');\n callback();\n })\n ;\n }\n }\n },\n\n get: {\n dimmer: function() {\n return $dimmer;\n },\n duration: function() {\n if(typeof settings.duration == 'object') {\n if( module.is.active() ) {\n return settings.duration.hide;\n }\n else {\n return settings.duration.show;\n }\n }\n return settings.duration;\n }\n },\n\n has: {\n dimmer: function() {\n if(settings.dimmerName) {\n return ($module.find(selector.dimmer).filter('.' + settings.dimmerName).length > 0);\n }\n else {\n return ( $module.find(selector.dimmer).length > 0 );\n }\n }\n },\n\n is: {\n active: function() {\n return $dimmer.hasClass(className.active);\n },\n animating: function() {\n return ( $dimmer.is(':animated') || $dimmer.hasClass(className.animating) );\n },\n closable: function() {\n if(settings.closable == 'auto') {\n if(settings.on == 'hover') {\n return false;\n }\n return true;\n }\n return settings.closable;\n },\n dimmer: function() {\n return $module.hasClass(className.dimmer);\n },\n dimmable: function() {\n return $module.hasClass(className.dimmable);\n },\n dimmed: function() {\n return $dimmable.hasClass(className.dimmed);\n },\n disabled: function() {\n return $dimmable.hasClass(className.disabled);\n },\n enabled: function() {\n return !module.is.disabled();\n },\n page: function () {\n return $dimmable.is('body');\n },\n pageDimmer: function() {\n return $dimmer.hasClass(className.pageDimmer);\n }\n },\n\n can: {\n show: function() {\n return !$dimmer.hasClass(className.disabled);\n }\n },\n\n set: {\n opacity: function(opacity) {\n var\n color = $dimmer.css('background-color'),\n colorArray = color.split(','),\n isRGB = (colorArray && colorArray.length == 3),\n isRGBA = (colorArray && colorArray.length == 4)\n ;\n opacity = settings.opacity === 0 ? 0 : settings.opacity || opacity;\n if(isRGB || isRGBA) {\n colorArray[3] = opacity + ')';\n color = colorArray.join(',');\n }\n else {\n color = 'rgba(0, 0, 0, ' + opacity + ')';\n }\n module.debug('Setting opacity to', opacity);\n $dimmer.css('background-color', color);\n },\n active: function() {\n $dimmer.addClass(className.active);\n },\n dimmable: function() {\n $dimmable.addClass(className.dimmable);\n },\n dimmed: function() {\n $dimmable.addClass(className.dimmed);\n },\n pageDimmer: function() {\n $dimmer.addClass(className.pageDimmer);\n },\n disabled: function() {\n $dimmer.addClass(className.disabled);\n },\n variation: function(variation) {\n variation = variation || settings.variation;\n if(variation) {\n $dimmer.addClass(variation);\n }\n }\n },\n\n remove: {\n active: function() {\n $dimmer\n .removeClass(className.active)\n ;\n },\n dimmed: function() {\n $dimmable.removeClass(className.dimmed);\n },\n disabled: function() {\n $dimmer.removeClass(className.disabled);\n },\n variation: function(variation) {\n variation = variation || settings.variation;\n if(variation) {\n $dimmer.removeClass(variation);\n }\n }\n },\n\n setting: function(name, value) {\n module.debug('Changing setting', name, value);\n if( $.isPlainObject(name) ) {\n $.extend(true, settings, name);\n }\n else if(value !== undefined) {\n if($.isPlainObject(settings[name])) {\n $.extend(true, settings[name], value);\n }\n else {\n settings[name] = value;\n }\n }\n else {\n return settings[name];\n }\n },\n internal: function(name, value) {\n if( $.isPlainObject(name) ) {\n $.extend(true, module, name);\n }\n else if(value !== undefined) {\n module[name] = value;\n }\n else {\n return module[name];\n }\n },\n debug: function() {\n if(!settings.silent && settings.debug) {\n if(settings.performance) {\n module.performance.log(arguments);\n }\n else {\n module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');\n module.debug.apply(console, arguments);\n }\n }\n },\n verbose: function() {\n if(!settings.silent && settings.verbose && settings.debug) {\n if(settings.performance) {\n module.performance.log(arguments);\n }\n else {\n module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');\n module.verbose.apply(console, arguments);\n }\n }\n },\n error: function() {\n if(!settings.silent) {\n module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');\n module.error.apply(console, arguments);\n }\n },\n performance: {\n log: function(message) {\n var\n currentTime,\n executionTime,\n previousTime\n ;\n if(settings.performance) {\n currentTime = new Date().getTime();\n previousTime = time || currentTime;\n executionTime = currentTime - previousTime;\n time = currentTime;\n performance.push({\n 'Name' : message[0],\n 'Arguments' : [].slice.call(message, 1) || '',\n 'Element' : element,\n 'Execution Time' : executionTime\n });\n }\n clearTimeout(module.performance.timer);\n module.performance.timer = setTimeout(module.performance.display, 500);\n },\n display: function() {\n var\n title = settings.name + ':',\n totalTime = 0\n ;\n time = false;\n clearTimeout(module.performance.timer);\n $.each(performance, function(index, data) {\n totalTime += data['Execution Time'];\n });\n title += ' ' + totalTime + 'ms';\n if(moduleSelector) {\n title += ' \\'' + moduleSelector + '\\'';\n }\n if($allModules.length > 1) {\n title += ' ' + '(' + $allModules.length + ')';\n }\n if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {\n console.groupCollapsed(title);\n if(console.table) {\n console.table(performance);\n }\n else {\n $.each(performance, function(index, data) {\n console.log(data['Name'] + ': ' + data['Execution Time']+'ms');\n });\n }\n console.groupEnd();\n }\n performance = [];\n }\n },\n invoke: function(query, passedArguments, context) {\n var\n object = instance,\n maxDepth,\n found,\n response\n ;\n passedArguments = passedArguments || queryArguments;\n context = element || context;\n if(typeof query == 'string' && object !== undefined) {\n query = query.split(/[\\. ]/);\n maxDepth = query.length - 1;\n $.each(query, function(depth, value) {\n var camelCaseValue = (depth != maxDepth)\n ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)\n : query\n ;\n if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {\n object = object[camelCaseValue];\n }\n else if( object[camelCaseValue] !== undefined ) {\n found = object[camelCaseValue];\n return false;\n }\n else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {\n object = object[value];\n }\n else if( object[value] !== undefined ) {\n found = object[value];\n return false;\n }\n else {\n module.error(error.method, query);\n return false;\n }\n });\n }\n if ( $.isFunction( found ) ) {\n response = found.apply(context, passedArguments);\n }\n else if(found !== undefined) {\n response = found;\n }\n if($.isArray(returnedValue)) {\n returnedValue.push(response);\n }\n else if(returnedValue !== undefined) {\n returnedValue = [returnedValue, response];\n }\n else if(response !== undefined) {\n returnedValue = response;\n }\n return found;\n }\n };\n\n module.preinitialize();\n\n if(methodInvoked) {\n if(instance === undefined) {\n module.initialize();\n }\n module.invoke(query);\n }\n else {\n if(instance !== undefined) {\n instance.invoke('destroy');\n }\n module.initialize();\n }\n })\n ;\n\n return (returnedValue !== undefined)\n ? returnedValue\n : this\n ;\n};\n\n$.fn.dimmer.settings = {\n\n name : 'Dimmer',\n namespace : 'dimmer',\n\n silent : false,\n debug : false,\n verbose : false,\n performance : true,\n\n // name to distinguish between multiple dimmers in context\n dimmerName : false,\n\n // whether to add a variation type\n variation : false,\n\n // whether to bind close events\n closable : 'auto',\n\n // whether to use css animations\n useCSS : true,\n\n // css animation to use\n transition : 'fade',\n\n // event to bind to\n on : false,\n\n // overriding opacity value\n opacity : 'auto',\n\n // transition durations\n duration : {\n show : 500,\n hide : 500\n },\n\n onChange : function(){},\n onShow : function(){},\n onHide : function(){},\n\n error : {\n method : 'The method you called is not defined.'\n },\n\n className : {\n active : 'active',\n animating : 'animating',\n dimmable : 'dimmable',\n dimmed : 'dimmed',\n dimmer : 'dimmer',\n disabled : 'disabled',\n hide : 'hide',\n pageDimmer : 'page',\n show : 'show'\n },\n\n selector: {\n dimmer : '> .ui.dimmer',\n content : '.ui.dimmer > .content, .ui.dimmer > .content > .center'\n },\n\n template: {\n dimmer: function() {\n return $('<div />').attr('class', 'ui dimmer');\n }\n }\n\n};\n\n})( jQuery, window, document );\n"]}
|