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.

14 lines
111 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: 08/06/2013
  11. */
  12. !function(a,b,c,d){a.fn.accordion=function(b){var c,e=a(this),f=a.isPlainObject(b)?a.extend(!0,{},a.fn.accordion.settings,b):a.fn.accordion.settings,g=f.className,h=f.namespace,i=f.selector,j=f.errors,k="."+h,l="module-"+h,m=e.selector||"",n=(new Date).getTime(),o=[],p=arguments[0],q="string"==typeof p,r=[].slice.call(arguments,1);return e.each(function(){var b,e=a(this),h=e.find(i.title),s=(e.find(i.icon),e.find(i.content)),t=this,u=e.data(l);b={initialize:function(){b.debug("Initializing accordion with bound events",e),h.on("click"+k,b.event.click),b.instantiate()},instantiate:function(){e.data(l,b)},destroy:function(){b.debug("Destroying previous accordion for",e),e.off(k).removeData(l)},event:{click:function(){b.verbose("Title clicked",this);var c=a(this),d=h.index(c);b.toggle(d)},resetStyle:function(){b.verbose("Resetting styles on element",this),a(this).removeAttr("style").children().removeAttr("style")}},toggle:function(a){b.debug("Toggling content content at index",a);var c=h.eq(a),d=c.hasClass(g.active);d?f.collapsible?b.close(a):b.debug("Cannot close accordion content collapsing is disabled"):b.open(a)},open:function(c){var d=h.eq(c),e=d.next(s),i=h.filter("."+g.active),j=i.next(h),k=i.size()>0;e.is(":animated")||(b.debug("Opening accordion content",d),f.exclusive&&k&&(i.removeClass(g.active),j.stop().children().animate({opacity:0},f.speed,b.event.resetStyle).end().slideUp(f.speed,f.easing,function(){j.removeClass(g.active).removeAttr("style").children().removeAttr("style")})),d.addClass(g.active),e.stop().children().removeAttr("style").end().slideDown(f.speed,f.easing,function(){e.addClass(g.active).removeAttr("style"),a.proxy(f.onOpen,e)(),a.proxy(f.onChange,e)()}))},close:function(c){var d=h.eq(c),e=d.next(s);b.debug("Closing accordion content",d),d.removeClass(g.active),e.removeClass(g.active).show().stop().children().animate({opacity:0},f.speed,b.event.resetStyle).end().slideUp(f.speed,f.easing,function(){e.removeAttr("style"),a.proxy(f.onClose,e)(),a.proxy(f.onChange,e)()})},setting:function(c,e){return b.debug("Changing setting",c,e),e===d?f[c]:(a.isPlainObject(c)?a.extend(!0,f,c):f[c]=e,void 0)},internal:function(c,e){return b.debug("Changing internal",c,e),e===d?b[c]:(a.isPlainObject(c)?a.extend(!0,b,c):b[c]=e,void 0)},debug:function(){f.debug&&(f.performance?b.performance.log(arguments):(b.debug=Function.prototype.bind.call(console.info,console,f.moduleName+":"),b.debug.apply(console,arguments)))},verbose:function(){f.verbose&&f.debug&&(f.performance?b.performance.log(arguments):(b.verbose=Function.prototype.bind.call(console.info,console,f.moduleName+":"),b.verbose.apply(console,arguments)))},error:function(){b.error=Function.prototype.bind.call(console.error,console,f.moduleName+":"),b.error.apply(console,arguments)},performance:{log:function(a){var c,d,e;f.performance&&(c=(new Date).getTime(),e=n||c,d=c-e,n=c,o.push({Element:t,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":d})),clearTimeout(b.performance.timer),b.performance.timer=setTimeout(b.performance.display,100)},display:function(){var c=f.moduleName+":",e=0;n=!1,clearTimeout(b.performance.timer),a.each(o,function(a,b){e+=b["Execution Time"]}),c+=" "+e+"ms",m&&(c+=" '"+m+"'"),(console.group!==d||console.table!==d)&&o.length>0&&(console.groupCollapsed(c),console.table?console.table(o):a.each(o,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),o=[]}},invoke:function(c,e,f){var g,h;return e=e||r,f=t||f,"string"==typeof c&&u!==d&&(c=c.split(/[\. ]/),g=c.length-1,a.each(c,function(c,e){return a.isPlainObject(u[e])&&c!=g?(u=u[e],!0):u[e]!==d?(h=u[e],!0):(b.error(j.method),!1)})),a.isFunction(h)?h.apply(f,e):h||!1}},q?(u===d&&b.initialize(),c=b.invoke(p)):(u!==d&&b.destroy(),b.initialize())}),c?c:this},a.fn.accordion.settings={moduleName:"Accordion",debug:!0,verbose:!0,performance:!0,exclusive:!0,collapsible:!0,onOpen:function(){},onClose:function(){},onChange:function(){},error:{method:"The method you called is not defined"},className:{active:"active",hover:"hover"},selector:{title:".title",icon:".i
  13. })),a.isFunction(h)?h.apply(f,e):h||!1}},k?(s===d&&b.initialize(),c=b.invoke(j)):(s!==d&&b.destroy(),b.initialize())}),c?c:this},a.fn.carousel.settings={moduleName:"Carousel",namespace:"carousel",verbose:!0,debug:!0,performance:!0,duration:5e3,errors:{method:"The method you called is not defined."},selector:{arrows:".arrow",leftArrow:".left.arrow",rightArrow:".right.arrow",content:".content",navigation:".navigation",navItem:".navigation .icon"},className:{active:"active"}}}(jQuery,window,document),function(a,b,c,d){a.fn.chat=function(b,c,e){var f=a.extend(!0,{},a.fn.chat.settings,e),g=arguments||!1;return a(this).each(function(){var e,h,i,j,k,l,m,n=a(this),o=n.find(f.selector.expandButton),p=n.find(f.selector.userListButton),q=n.find(f.selector.userList),r=(n.find(f.selector.room),n.find(f.selector.userCount)),s=n.find(f.selector.log),t=(n.find(f.selector.message),n.find(f.selector.messageInput)),u=n.find(f.selector.messageButton),v=n.data("module"),w=f.className,x=f.namespace,y="",z={};return m={width:{log:s.width(),userList:q.outerWidth()},initialize:function(){return Pusher===d&&m.error(f.errors.pusher),b===d||c===d?(m.error(f.errors.key),!1):f.endpoint.message||f.endpoint.authentication?(l=new Pusher(b),Pusher.channel_auth_endpoint=f.endpoint.authentication,e=l.subscribe(c),e.bind("pusher:subscription_succeeded",m.user.list.create),e.bind("pusher:subscription_error",m.error),e.bind("pusher:member_added",m.user.joined),e.bind("pusher:member_removed",m.user.left),e.bind("update_messages",m.message.receive),a.each(f.customEvents,function(a,b){e.bind(a,b)}),p.on("click."+x,m.event.toggleUserList),o.on("click."+x,m.event.toggleExpand),t.on("keydown."+x,m.event.input.keydown).on("keyup."+x,m.event.input.keyup),u.on("mouseenter."+x,m.event.hover).on("mouseleave."+x,m.event.hover).on("click."+x,m.event.submit),s.animate({scrollTop:s.prop("scrollHeight")},400),n.data("module",m).addClass(w.loading),void 0):(m.error(f.errors.endpoint),!1)},refresh:function(){p.removeClass(w.active),m.width={log:s.width(),userList:q.outerWidth()},p.hasClass(w.active)&&m.user.list.hide(),n.data("module",m)},user:{updateCount:function(){f.userCount&&(z=n.data("users"),j=0,a.each(z,function(){j++}),r.html(f.templates.userCount(j)))},joined:function(b){z=n.data("users"),"anonymous"!=b.id&&z[b.id]===d&&(z[b.id]=b.info,f.randomColor&&b.info.color===d&&(b.info.color=f.templates.color(b.id)),y=f.templates.userList(b.info),b.info.isAdmin?a(y).prependTo(q):a(y).appendTo(q),f.partingMessages&&(s.append(f.templates.joined(b.info)),m.message.scroll.test()),m.user.updateCount())},left:function(a){z=n.data("users"),a!==d&&"anonymous"!==a.id&&(delete z[a.id],n.data("users",z),q.find("[data-id="+a.id+"]").remove(),f.partingMessages&&(s.append(f.templates.left(a.info)),m.message.scroll.test()),m.user.updateCount())},list:{create:function(b){z={},b.each(function(a){"anonymous"!==a.id&&"undefined"!==a.id&&(f.randomColor&&a.info.color===d&&(a.info.color=f.templates.color(a.id)),y=a.info.isAdmin?f.templates.userList(a.info)+y:y+f.templates.userList(a.info),z[a.id]=a.info)}),n.data("users",z).data("user",z[b.me.id]).removeClass(w.loading),q.html(y),m.user.updateCount(),a.proxy(f.onJoin,q.children())()},show:function(){s.animate({width:m.width.log-m.width.userList},{duration:f.speed,easing:f.easing,complete:m.message.scroll.move})},hide:function(){s.stop().animate({width:m.width.log},{duration:f.speed,easing:f.easing,complete:m.message.scroll.move})}}},message:{scroll:{test:function(){k=s.prop("scrollHeight")-s.height(),Math.abs(s.scrollTop()-k)<f.scrollArea&&m.message.scroll.move()},move:function(){k=s.prop("scrollHeight")-s.height(),s.scrollTop(k)}},send:function(b){m.utils.emptyString(b)||a.api({url:f.endpoint.message,method:"POST",data:{chat_message:{content:b,timestamp:(new Date).getTime()}}})},receive:function(a){i=a.data,z=n.data("users"),h=n.data("user"),z[i.userID]!==d&&(h===d||h.id!=i.userID)&&(i.user=z[i.userID],m.message.display(i))},display:function(b){s.append(f.templates.message(b)),m.message.scroll.test(),a.proxy(f.onMessage,s.children().last())()}},e
  14. },display:function(){var b=g.moduleName+":",c=0;o=!1,clearTimeout(y.performance.timer),a.each(p,function(a,b){c+=b["Execution Time"]}),b+=" "+c+"ms",n&&(b+=" '"+n+"'"),(console.group!==d||console.table!==d)&&p.length>0&&(console.groupCollapsed(b),console.table?console.table(p):a.each(p,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),p=[]}},invoke:function(b,c,e){var f,g;return c=c||s,e=C||e,"string"==typeof b&&D!==d&&(b=b.split(/[\. ]/),f=b.length-1,a.each(b,function(b,c){return a.isPlainObject(D[c])&&b!=f?(D=D[c],!0):D[c]!==d?(g=D[c],!0):(y.error(j.method),!1)})),a.isFunction(g)?g.apply(e,c):g||!1}},r?(D===d&&y.initialize(),e=y.invoke(q)):(D!==d&&y.destroy(),y.initialize())}),e?e:this},a.fn.nag.settings={moduleName:"Nag",verbose:!0,debug:!0,performance:!0,namespace:"Nag",persist:!1,displayTime:0,animation:{show:"slide",hide:"slide"},position:"fixed",scrollBarWidth:18,storageMethod:"cookie",storedKey:"nag",storedValue:"dismiss",sticky:!1,lag:0,context:b,error:{noStorage:"Neither $.cookie or store is defined. A storage solution is required for storing state",method:"The method you called is not defined."},className:{bottom:"bottom",fixed:"fixed"},selector:{close:".icon.close"},speed:500,easing:"easeOutQuad",onHide:function(){}}}(jQuery,window,document),function(a,b,c,d){a.fn.popup=function(e){var f,g=a(this),h=a.isPlainObject(e)?a.extend(!0,{},a.fn.popup.settings,e):a.fn.popup.settings,i=g.selector||"",j=(new Date).getTime(),k=[],l=arguments[0],m="string"==typeof l,n=[].slice.call(arguments,1);return g.each(function(){var e,g=a(this),o=a(b),p=g.offsetParent(),q=h.inline?g.next(h.selector.popup):o.children(h.selector.popup).last(),r=0,s="."+h.namespace,t=h.namespace+"-module",u=h.selector,v=h.className,w=h.error,x=h.metadata,y=h.namespace,z=this,A=g.data(t);e={initialize:function(){e.debug("Initializing module",g),"hover"==h.on?g.on("mouseenter"+s,e.event.mouseenter).on("mouseleave"+s,e.event.mouseleave):g.on(h.on+""+s,e.event[h.on]),o.on("resize"+s,e.event.resize),e.instantiate()},instantiate:function(){e.verbose("Storing instance of module",e),A=e,g.data(t,A)},refresh:function(){q=h.inline?g.next(u.popup):o.children(u.popup).last(),p=g.offsetParent()},destroy:function(){e.debug("Destroying previous module"),g.off(s).removeData(t)},event:{mouseenter:function(b){var c=this;e.timer=setTimeout(function(){a.proxy(e.toggle,c)(),a(c).hasClass(v.visible)&&b.stopPropagation()},h.delay)},mouseleave:function(){clearTimeout(e.timer),g.is(":visible")&&e.hide()},click:function(b){a.proxy(e.toggle,this)(),a(this).hasClass(v.visible)&&b.stopPropagation()},resize:function(){q.is(":visible")&&e.position()}},create:function(){e.debug("Creating pop-up html");var b=g.data(x.html)||h.html,c=g.data(x.variation)||h.variation,d=g.data(x.title)||h.title,f=g.data(x.content)||g.attr("title")||h.content;b||f||d?(b||(b=h.template({title:d,content:f})),q=a("<div/>").addClass(v.popup).addClass(c).html(b),h.inline?(e.verbose("Inserting popup element inline"),q.insertAfter(g)):(e.verbose("Appending popup element to body"),q.appendTo(a("body"))),a.proxy(h.onInit,q)()):e.error(w.content)},remove:function(){e.debug("Removing popup"),q.remove()},get:{offstagePosition:function(){var c={top:a(b).scrollTop(),bottom:a(b).scrollTop()+a(b).height(),left:0,right:a(b).width()},d={width:q.width(),height:q.outerHeight(),position:q.offset()},e={},f=[];return d.position&&(e={top:d.position.top<c.top,bottom:d.position.top+d.height>c.bottom,right:d.position.left+d.width>c.right,left:d.position.left<c.left}),a.each(e,function(a,b){b&&f.push(a)}),f.length>0?f.join(" "):!1},nextPosition:function(a){switch(a){case"top left":a="bottom left";break;case"bottom left":a="top right";break;case"top right":a="bottom right";break;case"bottom right":a="top center";break;case"top center":a="bottom center";break;case"bottom center":a="right center";break;case"right center":a="left center";break;case"left center":a="top center"}return a}},toggle:function(){g=a(this),e.debug("Toggling pop-up"),e.refresh(),g.hasClass(v.visible)?e.hide():(e.hideAll(),e.
  15. })},content:{fetch:function(b,c){var i=h.get.tabElement(b),c=c||b,k=h.cache.read(c),l={dataType:"html",stateContext:i,success:function(d){h.cache.add(c,d),h.content.update(b,d),b==e?(h.debug("Content loaded",b),h.activate.tab(b)):h.debug("Content loaded in background",b),a.proxy(j.onTabInit,i)(b,f,g),a.proxy(j.onTabLoad,i)(b,f,g)},urlData:{tab:c}},m=i.data(u.promise)||!1,n=m&&"pending"===m.state();j.cache&&k?(h.debug("Showing existing content",c),h.content.update(b,k),h.activate.tab(b),a.proxy(j.onTabLoad,i)(b,f,g)):n?(h.debug("Content is already loading",c),i.addClass(t.loading)):a.api!==d?(h.debug("Retrieving remote content",c),a.api(a.extend(!0,{headers:{"X-Remote":!0}},j.apiSettings,l))):h.error(v.api)},update:function(a,b){h.debug("Updating html for",a);var c=h.get.tabElement(a);c.html(b)}},activate:{all:function(a){h.activate.tab(a),h.activate.navigation(a)},tab:function(a){var b=h.get.tabElement(a);h.verbose("Showing tab content for",b),b.addClass(t.active)},navigation:function(a){var b=h.get.navElement(a);h.verbose("Activating tab navigation for",b,a),b.addClass(t.active)}},deactivate:{all:function(){h.deactivate.navigation(),h.deactivate.tabs()},navigation:function(){k.removeClass(t.active)},tabs:function(){l.removeClass(t.active+" "+t.loading)}},is:{tab:function(a){return a!==d?h.get.tabElement(a).size()>0:!1}},get:{initialPath:function(){return k.eq(0).data(u.tab)||l.eq(0).data(u.tab)},path:function(){return a.address.value()},defaultPathArray:function(a){return h.utils.pathToArray(h.get.defaultPath(a))},defaultPath:function(a){var b=k.filter("[data-"+u.tab+'^="'+a+'/"]').eq(0),c=b.data(u.tab)||!1;if(c){if(h.debug("Found default tab",c),p<j.maxDepth)return p++,h.get.defaultPath(c);h.error(v.recursion)}else h.debug("No default tabs found for",a);return p=0,a},navElement:function(a){return a=a||e,k.filter("[data-"+u.tab+'="'+a+'"]')},tabElement:function(a){var b,c,d,f;return a=a||e,d=h.utils.pathToArray(a),f=h.utils.last(d),b=l.filter("[data-"+u.tab+'="'+f+'"]'),c=l.filter("[data-"+u.tab+'="'+a+'"]'),b.size()>0?b:c},tab:function(){return e}},utils:{filterArray:function(b,c){return a.grep(b,function(b){return-1==a.inArray(b,c)})},last:function(b){return a.isArray(b)?b[b.length-1]:!1},pathToArray:function(a){return a===d&&(a=e),"string"==typeof a?a.split("/"):[a]},arrayToPath:function(b){return a.isArray(b)?b.join("/"):!1}},setting:function(b,c){return c===d?j[b]:(a.isPlainObject(b)?a.extend(!0,j,b):j[b]=c,void 0)},internal:function(b,c){return c===d?h[b]:(a.isPlainObject(b)?a.extend(!0,h,b):h[b]=c,void 0)},debug:function(){j.debug&&(j.performance?h.performance.log(arguments):(h.debug=Function.prototype.bind.call(console.info,console,j.moduleName+":"),h.debug.apply(console,arguments)))},verbose:function(){j.verbose&&j.debug&&(j.performance?h.performance.log(arguments):(h.verbose=Function.prototype.bind.call(console.info,console,j.moduleName+":"),h.verbose.apply(console,arguments)))},error:function(){h.error=Function.prototype.bind.call(console.error,console,j.moduleName+":"),h.error.apply(console,arguments)},performance:{log:function(a){var b,c,d;j.performance&&(b=(new Date).getTime(),d=r||b,c=b-d,r=b,s.push({Element:q,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":c})),clearTimeout(h.performance.timer),h.performance.timer=setTimeout(h.performance.display,100)},display:function(){var b=j.moduleName+":",c=0;r=!1,clearTimeout(h.performance.timer),a.each(s,function(a,b){c+=b["Execution Time"]}),b+=" "+c+"ms",m&&(b+=" '"+m+"'"),(console.group!==d||console.table!==d)&&s.length>0&&(console.groupCollapsed(b),console.table?console.table(s):a.each(s,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),s=[]}},invoke:function(b,c,e){var f,g;return c=c||B,e=q||e,"string"==typeof b&&y!==d&&(b=b.split(/[\. ]/),f=b.length-1,a.each(b,function(b,c){a.isPlainObject(y[c])&&b!=f?y=y[c]:y[c]!==d?g=y[c]:h.error(v.method)})),a.isFunction(g)?(h.verbose("Executing invoked function",g),g.apply(e,c)):g||!1}},A?(y===d&&h.initialize(),i=h.invoke(z)):(y!==d&&h.destroy(),h.initialize()),i?i:this},a