{"version":3,"sources":["embed.js"],"names":["$","window","document","undefined","Math","self","Function","fn","embed","parameters","returnedValue","$allModules","this","moduleSelector","selector","time","Date","getTime","performance","query","arguments","methodInvoked","queryArguments","slice","call","each","module","settings","isPlainObject","extend","className","sources","error","metadata","namespace","templates","eventNamespace","moduleNamespace","$module","$placeholder","find","placeholder","$icon","icon","$embed","element","instance","data","initialize","debug","determine","autoplay","create","bind","events","instantiate","verbose","destroy","reset","removeData","off","refresh","has","on","createAndShow","get","createPlaceholder","url","generate","html","createEmbed","addClass","appendTo","onCreate","changeEmbed","show","change","source","id","remove","active","showPlaceholder","onReset","set","onDisplay","hide","onPlaceholderDisplay","type","should","matchedSource","name","search","domain","replace","removeClass","empty","encode","index","urlString","push","encodeURIComponent","join","iframe","noURL","extraParameters","onEmbed","length","is","video","setting","value","internal","silent","log","prototype","console","info","apply","message","currentTime","executionTime","previousTime","Name","Arguments","Element","Execution Time","clearTimeout","timer","setTimeout","display","title","totalTime","group","table","groupCollapsed","groupEnd","invoke","passedArguments","context","maxDepth","found","response","object","split","depth","camelCaseValue","charAt","toUpperCase","method","isFunction","isArray","color","hd","brandedUI","youtube","autohide","hq","jsapi","api","modestbranding","vimeo","byline","portrait","src","image","onPause","onPlay","onStop","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,MAAQ,SAASC,GAEpB,GAYEC,GAXAC,EAAkBX,EAAEY,MAEpBC,EAAkBF,EAAYG,UAAY,GAE1CC,GAAkB,GAAIC,OAAOC,UAC7BC,KAEAC,EAAkBC,UAAU,GAC5BC,EAAmC,gBAATF,GAC1BG,KAAqBC,MAAMC,KAAKJ,UAAW,EA+gB7C,OA1gBAT,GACGc,KAAK,WACJ,GAwBEC,GAvBAC,EAAo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c,OACdF,YAAc,cACdoC,OAAc,SACdV,IAAc,OAGhBnC,OACEuE,MAAS,mBACT6C,OAAS,wCAGXtH,WACEkD,OAAS,SACTxE,MAAS,SAGXM,UACEN,MAAc,SACdiC,YAAc,eACdE,KAAc,SAGhBZ,SACE2H,SACEhE,KAAS,UACTH,KAAS,QACT5C,KAAS,aACTiD,OAAS,cACTzB,IAAS,+BACT1D,WAAY,SAASkB,GACnB,OACEgI,UAAkBhI,EAAS8H,UAC3BtG,SAAiBxB,EAASwB,SAC1BoG,MAAiB5H,EAAS4H,OAASpJ,EACnCyJ,GAAiBjI,EAAS6H,GAC1BK,MAAiBlI,EAASmI,IAC1BC,gBAAkBpI,EAAS8H,aAIjCO,OACEtE,KAAS,QACTH,KAAS,QACT5C,KAAS,aACTiD,OAAS,YACTzB,IAAS,gCACT1D,WAAY,SAASkB,GACnB,OACEmI,IAAWnI,EAASmI,IACpB3G,SAAWxB,EAASwB,SACpB8G,OAAWtI,EAAS8H,UACpBF,MAAW5H,EAAS4H,OAASpJ,EAC7B+J,SAAWvI,EAAS8H,UACpBvB,MAAWvG,EAAS8H,cAM5BtH,WACEmE,OAAS,SAASnC,EAAK1D,GACrB,GAAI0J,GAAMhG,CAIV,OAHI1D,KACA0J,GAAO,IAAM1J,GAEV,gBACe0J,EAAM,kIAK9B1H,YAAc,SAAS2H,EAAOzH,GAC5B,GACE0B,GAAO,EAQT,OANG1B,KACD0B,GAAQ,aAAe1B,EAAO,eAE7ByH,IACD/F,GAAQ,iCAAmC+F,EAAQ,MAE9C/F,IAKXyF,KAAU,EACVO,QAAU,aACVC,OAAU,aACVC,OAAU,eAMRC,OAAQvK,OAAQC","file":"embed.min.js","sourcesContent":["/*!\n * # Semantic UI 2.2.6 - Embed\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.embed = function(parameters) {\n\n var\n $allModules = $(this),\n\n moduleSelector = $allModules.selector || '',\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.embed.settings, parameters)\n : $.extend({}, $.fn.embed.settings),\n\n selector = settings.selector,\n className = settings.className,\n sources = settings.sources,\n error = settings.error,\n metadata = settings.metadata,\n namespace = settings.namespace,\n templates = settings.templates,\n\n eventNamespace = '.' + namespace,\n moduleNamespace = 'module-' + namespace,\n\n $window = $(window),\n $module = $(this),\n $placeholder = $module.find(selector.placeholder),\n $icon = $module.find(selector.icon),\n $embed = $module.find(selector.embed),\n\n element = this,\n instance = $module.data(moduleNamespace),\n module\n ;\n\n module = {\n\n initialize: function() {\n module.debug('Initializing embed');\n module.determine.autoplay();\n module.create();\n module.bind.events();\n module.instantiate();\n },\n\n instantiate: function() {\n module.verbose('Storing instance of module', module);\n instance = module;\n $module\n .data(moduleNamespace, module)\n ;\n },\n\n destroy: function() {\n module.verbose('Destroying previous instance of embed');\n module.reset();\n $module\n .removeData(moduleNamespace)\n .off(eventNamespace)\n ;\n },\n\n refresh: function() {\n module.verbose('Refreshing selector cache');\n $placeholder = $module.find(selector.placeholder);\n $icon = $module.find(selector.icon);\n $embed = $module.find(selector.embed);\n },\n\n bind: {\n events: function() {\n if( module.has.placeholder() ) {\n module.debug('Adding placeholder events');\n $module\n .on('click' + eventNamespace, selector.placeholder, module.createAndShow)\n .on('click' + eventNamespace, selector.icon, module.createAndShow)\n ;\n }\n }\n },\n\n create: function() {\n var\n placeholder = module.get.placeholder()\n ;\n if(placeholder) {\n module.createPlaceholder();\n }\n else {\n module.createAndShow();\n }\n },\n\n createPlaceholder: function(placeholder) {\n var\n icon = module.get.icon(),\n url = module.get.url(),\n embed = module.generate.embed(url)\n ;\n placeholder = placeholder || module.get.placeholder();\n $module.html( templates.placeholder(placeholder, icon) );\n module.debug('Creating placeholder for embed', placeholder, icon);\n },\n\n createEmbed: function(url) {\n module.refresh();\n url = url || module.get.url();\n $embed = $('
')\n .addClass(className.embed)\n .html( module.generate.embed(url) )\n .appendTo($module)\n ;\n settings.onCreate.call(element, url);\n module.debug('Creating embed object', $embed);\n },\n\n changeEmbed: function(url) {\n $embed\n .html( module.generate.embed(url) )\n ;\n },\n\n createAndShow: function() {\n module.createEmbed();\n module.show();\n },\n\n // sets new embed\n change: function(source, id, url) {\n module.debug('Changing video to ', source, id, url);\n $module\n .data(metadata.source, source)\n .data(metadata.id, id)\n ;\n if(url) {\n $module.data(metadata.url, url);\n }\n else {\n $module.removeData(metadata.url);\n }\n if(module.has.embed()) {\n module.changeEmbed();\n }\n else {\n module.create();\n }\n },\n\n // clears embed\n reset: function() {\n module.debug('Clearing embed and showing placeholder');\n module.remove.active();\n module.remove.embed();\n module.showPlaceholder();\n settings.onReset.call(element);\n },\n\n // shows current embed\n show: function() {\n module.debug('Showing embed');\n module.set.active();\n settings.onDisplay.call(element);\n },\n\n hide: function() {\n module.debug('Hiding embed');\n module.showPlaceholder();\n },\n\n showPlaceholder: function() {\n module.debug('Showing placeholder image');\n module.remove.active();\n settings.onPlaceholderDisplay.call(element);\n },\n\n get: {\n id: function() {\n return settings.id || $module.data(metadata.id);\n },\n placeholder: function() {\n return settings.placeholder || $module.data(metadata.placeholder);\n },\n icon: function() {\n return (settings.icon)\n ? settings.icon\n : ($module.data(metadata.icon) !== undefined)\n ? $module.data(metadata.icon)\n : module.determine.icon()\n ;\n },\n source: function(url) {\n return (settings.source)\n ? settings.source\n : ($module.data(metadata.source) !== undefined)\n ? $module.data(metadata.source)\n : module.determine.source()\n ;\n },\n type: function() {\n var source = module.get.source();\n return (sources[source] !== undefined)\n ? sources[source].type\n : false\n ;\n },\n url: function() {\n return (settings.url)\n ? settings.url\n : ($module.data(metadata.url) !== undefined)\n ? $module.data(metadata.url)\n : module.determine.url()\n ;\n }\n },\n\n determine: {\n autoplay: function() {\n if(module.should.autoplay()) {\n settings.autoplay = true;\n }\n },\n source: function(url) {\n var\n matchedSource = false\n ;\n url = url || module.get.url();\n if(url) {\n $.each(sources, function(name, source) {\n if(url.search(source.domain) !== -1) {\n matchedSource = name;\n return false;\n }\n });\n }\n return matchedSource;\n },\n icon: function() {\n var\n source = module.get.source()\n ;\n return (sources[source] !== undefined)\n ? sources[source].icon\n : false\n ;\n },\n url: function() {\n var\n id = settings.id || $module.data(metadata.id),\n source = settings.source || $module.data(metadata.source),\n url\n ;\n url = (sources[source] !== undefined)\n ? sources[source].url.replace('{id}', id)\n : false\n ;\n if(url) {\n $module.data(metadata.url, url);\n }\n return url;\n }\n },\n\n\n set: {\n active: function() {\n $module.addClass(className.active);\n }\n },\n\n remove: {\n active: function() {\n $module.removeClass(className.active);\n },\n embed: function() {\n $embed.empty();\n }\n },\n\n encode: {\n parameters: function(parameters) {\n var\n urlString = [],\n index\n ;\n for (index in parameters) {\n urlString.push( encodeURIComponent(index) + '=' + encodeURIComponent( parameters[index] ) );\n }\n return urlString.join('&');\n }\n },\n\n generate: {\n embed: function(url) {\n module.debug('Generating embed html');\n var\n source = module.get.source(),\n html,\n parameters\n ;\n url = module.get.url(url);\n if(url) {\n parameters = module.generate.parameters(source);\n html = templates.iframe(url, parameters);\n }\n else {\n module.error(error.noURL, $module);\n }\n return html;\n },\n parameters: function(source, extraParameters) {\n var\n parameters = (sources[source] && sources[source].parameters !== undefined)\n ? sources[source].parameters(settings)\n : {}\n ;\n extraParameters = extraParameters || settings.parameters;\n if(extraParameters) {\n parameters = $.extend({}, parameters, extraParameters);\n }\n parameters = settings.onEmbed(parameters);\n return module.encode.parameters(parameters);\n }\n },\n\n has: {\n embed: function() {\n return ($embed.length > 0);\n },\n placeholder: function() {\n return settings.placeholder || $module.data(metadata.placeholder);\n }\n },\n\n should: {\n autoplay: function() {\n return (settings.autoplay === 'auto')\n ? (settings.placeholder || $module.data(metadata.placeholder) !== undefined)\n : settings.autoplay\n ;\n }\n },\n\n is: {\n video: function() {\n return module.get.type() == 'video';\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 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 return (returnedValue !== undefined)\n ? returnedValue\n : this\n ;\n};\n\n$.fn.embed.settings = {\n\n name : 'Embed',\n namespace : 'embed',\n\n silent : false,\n debug : false,\n verbose : false,\n performance : true,\n\n icon : false,\n source : false,\n url : false,\n id : false,\n\n // standard video settings\n autoplay : 'auto',\n color : '#444444',\n hd : true,\n brandedUI : false,\n\n // additional parameters to include with the embed\n parameters: false,\n\n onDisplay : function() {},\n onPlaceholderDisplay : function() {},\n onReset : function() {},\n onCreate : function(url) {},\n onEmbed : function(parameters) {\n return parameters;\n },\n\n metadata : {\n id : 'id',\n icon : 'icon',\n placeholder : 'placeholder',\n source : 'source',\n url : 'url'\n },\n\n error : {\n noURL : 'No URL specified',\n method : 'The method you called is not defined'\n },\n\n className : {\n active : 'active',\n embed : 'embed'\n },\n\n selector : {\n embed : '.embed',\n placeholder : '.placeholder',\n icon : '.icon'\n },\n\n sources: {\n youtube: {\n name : 'youtube',\n type : 'video',\n icon : 'video play',\n domain : 'youtube.com',\n url : '//www.youtube.com/embed/{id}',\n parameters: function(settings) {\n return {\n autohide : !settings.brandedUI,\n autoplay : settings.autoplay,\n color : settings.color || undefined,\n hq : settings.hd,\n jsapi : settings.api,\n modestbranding : !settings.brandedUI\n };\n }\n },\n vimeo: {\n name : 'vimeo',\n type : 'video',\n icon : 'video play',\n domain : 'vimeo.com',\n url : '//player.vimeo.com/video/{id}',\n parameters: function(settings) {\n return {\n api : settings.api,\n autoplay : settings.autoplay,\n byline : settings.brandedUI,\n color : settings.color || undefined,\n portrait : settings.brandedUI,\n title : settings.brandedUI\n };\n }\n }\n },\n\n templates: {\n iframe : function(url, parameters) {\n var src = url;\n if (parameters) {\n src += '?' + parameters;\n }\n return ''\n + ''\n ;\n },\n placeholder : function(image, icon) {\n var\n html = ''\n ;\n if(icon) {\n html += '';\n }\n if(image) {\n html += '';\n }\n return html;\n }\n },\n\n // NOT YET IMPLEMENTED\n api : false,\n onPause : function() {},\n onPlay : function() {},\n onStop : function() {}\n\n};\n\n\n\n})( jQuery, window, document );\n"]}