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.

13 lines
74 KiB

  1. /** # Semantic UI
  2. * Version: 0.1
  3. * http://github.com/quirkyinc/semantic
  4. *
  5. *
  6. * Copyright 2013 Contributors
  7. * Released under the MIT license
  8. * http://opensource.org/licenses/MIT
  9. *
  10. * Released: 05/19/2013
  11. */
  12. (function(e,t,n,o){e.fn.accordion=function(t){var n=e.extend(!0,{},e.fn.accordion.settings,t),i=arguments||!1;return e(this).each(function(){var t,a=e(this),s=a.find(n.selector.title),r=(a.find(n.selector.icon),a.find(n.selector.content)),l=a.data("module"),c=n.className;return t={initialize:function(){s.on("click",t.change),a.data("module",t)},change:function(){var o=e(this),i=(o.next(r),o.hasClass(c.active));i?n.collapsible&&e.proxy(t.close,o)():e.proxy(t.open,o)()},open:function(){var t=e(this),o=t.next(r),i=s.filter("."+c.active),a=i.next(s);n.exclusive&&i.size()>0&&(i.removeClass("active"),a.stop().slideUp(n.speed,n.easing,function(){e(this).removeClass("active").removeAttr("style")})),t.addClass(c.active),o.hide().addClass(c.active).stop().slideDown(n.speed,n.easing,function(){e(this).removeAttr("style")})},close:function(){var t=e(this),o=t.next(r);t.removeClass(c.active),o.removeClass(c.active).show().stop().slideUp(n.speed,n.easing,function(){e(this).removeAttr("style")})},debug:function(e){n.debug&&console.info(n.moduleName+": "+e)},error:function(e){console.warn(n.moduleName+": "+e)},invoke:function(i,a,s){var r;return s=s||Array.prototype.slice.call(arguments,2),"string"==typeof i&&l!==o&&(i=i.split("."),e.each(i,function(o,i){return e.isPlainObject(l[i])?(l=l[i],!0):e.isFunction(l[i])?(r=l[i],!0):(t.error(n.errors.method),!1)})),e.isFunction(r)?r.apply(a,s):r}},l!==o&&i?("invoke"==i[0]&&(i=Array.prototype.slice.call(i,1)),t.invoke(i[0],this,Array.prototype.slice.call(i,1))):(t.initialize(),o)}),this},e.fn.accordion.settings={moduleName:"Accordion",debug:!1,exclusive:!0,collapsible:!0,errors:{method:"The method you called is not defined"},className:{active:"active",hover:"hover"},selector:{title:".title",icon:".icon",content:".content"},speed:500,easing:"easeInOutQuint"}})(jQuery,window,document),function(e,t,n,o){e.animationSettings=function(t,n,i,a){return t=n===o?t:"object"==typeof n?e.extend({},t,n):"function"==typeof i?e.extend({},t,{duration:n,complete:i}):"object"==typeof i?e.extend(!0,{},t,{duration:n},i):e.extend({},t,{duration:n,easing:i,complete:a})},e.fn.popIn=function(t,n,o){var i=e.animationSettings(e.fn.popIn.settings,t,n,o),a=e(this),s=a.size(),r=0,l=function(){0==a.filter(":animated").size(),r++,e(this).css("transform","").removeClass(i.className.init),e.proxy(i.eachComplete,this)(),r==s&&e.proxy(i.complete,a)()},c=function(t){e(this).delay(i.delay*t).animate({opacity:i.endOpacity,transform:"scale("+i.endScale+")"},i.duration,i.easing,l)};return i.isLegacyBrowser?a.show():a.addClass(i.className.init).show().css({opacity:i.startOpacity,transform:"scale("+i.startScale+")"}).each(c),e(this)},e.fn.popOut=function(t,n,o){var i=e.animationSettings(e.fn.popIn.settings,t,n,o),a={complete:function(){e(this).hide(),e.proxy(i.complete,this)()},startOpacity:i.endOpacity,endOpacity:0,startScale:i.endScale,endScale:i.startScale},s=e.extend(!0,{},i,a);e(this).popIn(s)},e.fn.popIn.settings={isLegacyBrowser:!1,className:{init:"init"},duration:450,easing:"easeOutExpo",delay:100,startOpacity:0,endOpacity:1,startScale:.7,endScale:1,eachComplete:function(){},complete:function(){}},e.fn.kenBurns=function(t,n,i){var a=e.animationSettings(e.fn.kenBurns.settings,t,n,i),s={randomPosition:function(e,t,n){var n=n!==o?n:t,i=Math.random()*(e+n-(e-t))+(e-t);return parseInt(i,10)},animate:function(){var t={},n={};t=a.useStartPosition?{x:parseInt(e(this).css("background-position-x"),10),y:parseInt(e(this).css("background-position-y"),10)}:{x:s.randomPosition(50,a.xRange),y:s.randomPosition(50,a.yRange)},n.x=t.x>50?s.randomPosition(t.x,a.xMaxTravelDistance,-a.xMinTravelDistance):s.randomPosition(t.x,-a.xMinTravelDistance,a.xMaxTravelDistance),n.y=t.y>50?s.randomPosition(t.y,a.yMaxTravelDistance,-a.yMinTravelDistance):s.randomPosition(t.y,-a.yMinTravelDistance,a.yMaxTravelDistance),e(this).css({backgroundPosition:t.x+"%",backgroundPositionY:t.y+"%"}).stop().animate({backgroundPosition:n.x+"%",backgroundPositionY:n.y+"%"},a.duration,a.easing,a.complete)}};return a.isLegacyBrowser||e(this).each(s.animate),e(this)},e.fn.kenBurns
  13. },message:function(e){var t="";return e.user.isAdmin?(e.user.color="#55356A",t+='<div class="admin message">',t+='<span class="quirky ui flag team"></span>'):t+='<div class="message">',t+="<p>",t+=e.user.color!==o?'<span class="author" style="color: '+e.user.color+';">'+e.user.name+"</span>: ":'<span class="author">'+e.user.name+"</span>: ",t+=""+e.text+" </p>"+"</div>"},joined:function(e){return typeof e.name!==o?'<div class="status">'+e.name+" has joined the chat.</div>":!1},left:function(e){return typeof e.name!==o?'<div class="status">'+e.name+" has left the chat.</div>":!1},userList:function(e){var t="";return e.isAdmin&&(e.color="#55356A"),t+='<div class="user" data-id="'+e.id+'">'+' <div class="image">'+' <img src="'+e.avatarURL+'">'+" </div>",t+=e.color!==o?' <p><a href="/users/'+e.id+'" target="_blank" style="color: '+e.color+';">'+e.name+"</a></p>":' <p><a href="/users/'+e.id+'" target="_blank">'+e.name+"</a></p>",t+="</div>"}}}}(jQuery,window,document),function(e,t,n,o){e.fn.checkbox=function(t){var n,i=e(this),a=e.extend(!0,{},e.fn.checkbox.settings,t),s="."+a.namespace,r="module-"+a.namespace,l=(i.selector||"",(new Date).getTime()),c=[],u=arguments[0],d="string"==typeof u,f=[].slice.call(arguments,1);return i.each(function(){var t,p=e(this),m=e(this).find(a.selector.input),g=p.selector||"",h=this,v=p.data("module-"+a.namespace),b=a.className,y=a.namespace,x=a.errors;t={initialize:function(){a.context&&""!==g?(t.verbose("Initializing checkbox with delegated events",p),e(h,a.context).on(g,"click"+s,t.toggle).data(r,t)):(t.verbose("Initializing checkbox with bound events",p),p.on("click"+s,t.toggle).data(r,t))},destroy:function(){t.verbose("Destroying previous module for",p),p.off(y)},enable:function(){t.debug("Enabling checkbox"),p.addClass(b.active),m.prop("checked",!0),e.proxy(a.onChange,m.get())(),e.proxy(a.onEnable,m.get())()},disable:function(){t.debug("Disabling checkbox"),p.removeClass(b.active),m.prop("checked",!1),e.proxy(a.onChange,m.get())(),e.proxy(a.onDisable,m.get())()},toggle:function(){m.prop("checked")!==o&&m.prop("checked")?t.disable():t.enable()},setting:function(t,n){return n===o?a[t]:(e.isPlainObject(t)?e.extend(!0,a,t):a[t]=n,o)},internal:function(n,i){return i===o?t[n]:(e.isPlainObject(n)?e.extend(!0,t,n):t[n]=i,o)},debug:function(){a.debug&&(t.performance.log(arguments[0]),t.verbose=Function.prototype.bind.call(console.info,console,a.moduleName+":"))},verbose:function(){a.verbose&&a.debug&&(t.performance.log(arguments[0]),t.verbose=Function.prototype.bind.call(console.info,console,a.moduleName+":"))},error:function(){console.log!==o&&(t.error=Function.prototype.bind.call(console.log,console,a.moduleName+":"))},performance:{log:function(e){var n,o,i;a.performance&&(n=(new Date).getTime(),i=l||n,o=n-i,l=n,c.push({Element:h,Name:e,"Execution Time":o}),clearTimeout(t.performance.timer),t.performance.timer=setTimeout(t.performance.display,100))},display:function(){var t=a.moduleName,n=(a.moduleName+": "+g+"("+i.size()+" elements)",0);g&&(t+="Performance ("+g+")"),(console.group!==o||console.table!==o)&&c.length>0&&(console.groupCollapsed(t),console.table?(e.each(c,function(e,t){n+=t["Execution Time"]}),console.table(c)):e.each(c,function(e,t){n+=t["Execution Time"]}),console.log("Total Execution Time:",n+"ms"),console.groupEnd(),c=[],l=!1)}},invoke:function(n,i,a){var s,r;return i=i||f,a=h||a,"string"==typeof n&&v!==o&&(n=n.split("."),s=n.length-1,e.each(n,function(n,i){return e.isPlainObject(v[i])&&n!=s?(v=v[i],!0):v[i]!==o?(r=v[i],!0):(t.error(x.method),!1)})),e.isFunction(r)?(t.verbose("Executing invoked function",r),r.apply(a,i)):r||!1}},d?(v===o&&t.initialize(),n=t.invoke(u)):(v!==o&&t.destroy(),t.initialize())}),n?n:this},e.fn.checkbox.settings={moduleName:"Checkbox Module",namespace:"checkbox",verbose:!0,debug:!0,performance:!0,context:!1,onChange:function(){},onEnable:function(){},onDisable:function(){},errors:{method:"The method you called is not defined."},selector:{input:"input"},className:{active:"active"}}}(jQuery,window,document),function(e,t,n,o){e.dimScreen=function(t){var
  14. }(jQuery,window,document),function(e,t,n,o){e.fn.starReview=function(t){var n=e.extend(!0,{},e.fn.starReview.settings,t),i=arguments||!1;return e(this).each(function(){var t,a=e(this),s=a.find(n.selector.star),r=n.className,l=n.namespace,c=a.data("module");return t={settings:n,initialize:function(){n.rateable&&(e.fn.state!==o&&(a.state(),s.state()),s.bind("mouseenter."+l,t.event.mouseenter).bind("mouseleave."+l,t.event.mouseleave).bind("click."+l,t.event.click)),a.addClass(r.initialize).data("module",t)},setRating:function(t){var o=s.eq(t-1);a.removeClass(r.hover),s.removeClass(r.hover),o.nextAll().removeClass(r.active),o.addClass(r.active).prevAll().addClass(r.active),e.proxy(n.onRate,a)()},event:{mouseenter:function(){var t=e(this);t.nextAll().removeClass(r.hover),a.addClass(r.hover),t.addClass(r.hover).prevAll().addClass(r.hover)},mouseleave:function(){s.removeClass(r.hover)},click:function(){var n=e(this);t.setRating(s.index(n)+1)}},error:function(e){console.warn(n.moduleName+": "+e)},invoke:function(i,a,s){var r;return s=s||Array.prototype.slice.call(arguments,2),"string"==typeof i&&c!==o&&(i=i.split("."),e.each(i,function(o,i){return e.isPlainObject(c[i])?(c=c[i],!0):e.isFunction(c[i])?(r=c[i],!0):(t.error(n.errors.method),!1)})),e.isFunction(r)?r.apply(a,s):!1}},c!==o&&i?("invoke"==i[0]&&(i=Array.prototype.slice.call(i,1)),t.invoke(i[0],this,Array.prototype.slice.call(i,1))):(t.initialize(),o)}),this},e.fn.starReview.settings={moduleName:"Star Module",namespace:"star",rateable:!0,onRate:function(){},className:{initialize:"initialize",loading:"loading",active:"active",hover:"hover",down:"down"},selector:{star:"i"}}}(jQuery,window,document),function(e,t,n,o){e.fn.tabNavigation=function(n){var i,a,s,r,l,c=e.extend(!0,{},e.fn.tabNavigation.settings,n),u=e(this),d=e(c.context).find(c.selector.tabs),f=!0,p={},m=0,g=c.className,h=c.metadata,v=c.namespace,b=c.errors,y=u.data("module"),x=arguments[0],w=y!==o&&"string"==typeof x,C=[].slice.call(arguments,1);return r={initialize:function(){r.debug("Initializing Tabs",u),c.history&&c.path!==!1&&(e.address!==o?(r.verbose("Address library found adding state change event"),e.address.state(c.path).change(r.event.history.change)):r.error(b.state)),e.isWindow(u.get(0))||u.on("click."+v,r.event.click),u.data("module",r)},destroy:function(){r.debug("Destroying tabs",u),u.off("."+v)},event:{click:function(){r.debug("Navigation clicked");var t=e(this).data(h.tab);t!==o?t!==i&&(c.history?e.address.value(t):r.change(t)):r.debug("No tab specified")},history:{change:function(t){var n=t.pathNames.join("/")||r.get.initialPath(),i=c.templates.determineTitle(n)||!1;r.debug("History change event",n,t),s=t,n!==o&&r.change(n),i&&e.address.title(i)}}},refresh:function(){i&&(r.debug("Refreshing tab",i),r.change(i))},cache:{read:function(e){return e!==o?p[e]:p},add:function(e,t){e=e||i,r.debug("Adding cached content for",e),p[e]=t},remove:function(e){e=e||i,r.debug("Removing cached content for",e),delete p[e]}},change:function(n){var l=r.get.defaultPathArray(n);r.deactivate.all(),e.each(l,function(u,d){var m=l.slice(0,u+1),g=r.utils.arrayToPath(m),h=r.utils.last(l)==g,v=r.is.tab(g),b=!v,y=t.history&&t.history.pushState,x=y&&c.ignoreFirstLoad&&f,w=e.isPlainObject(c.apiSettings),C=r.get.tabElement(g);return r.verbose("Looking for tab",d),b?(r.verbose("Tab is not found, assuming it is a parameter",d),!0):(v&&(r.verbose("Tab was found",d),i=g,a=r.utils.filterArray(l,m),h&&w?x?(r.debug("Ignoring remote content on first tab load",g),f=!1,p[n]=C.html(),r.activate.all(g),e.proxy(c.onTabInit,C)(g,a,s)):(r.activate.navigation(g),r.content.fetch(g,c.onTabLoad)):(r.debug("Opened tab",g),r.activate.all(g),e.proxy(c.onTabLoad,C)(g,a,s))),o)})},content:{fetch:function(t){var n=r.get.tabElement(t),l=p[t]||!1,u={dataType:"html",stateContext:n,success:function(o){p[t]=o,r.content.update(t,o),t==i?(r.debug("Content loaded",t),r.activate.tab(t)):r.debug("Content loaded in background",t),e.proxy(c.onTabInit,n)(t,a,s)},urlData:{tab:t}},d=n.data(h.promise)||!1,f=d&&"pending"===d.state();c.cache&&l?(r.debug("Showing exist