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
98 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: 07/20/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.namespace,"module-"+f.namespace,e.selector||""),h=(new Date).getTime(),i=[],j=arguments[0],k="string"==typeof j,l=[].slice.call(arguments,1);return e.each(function(){var b,e=a(this),m=e.find(f.selector.title),n=(e.find(f.selector.icon),e.find(f.selector.content)),o=(e.selector||"",this),p=e.data("module-"+f.namespace),q=f.className,r=(f.metadata,f.namespace),s=(f.animation,f.errors);b={initialize:function(){b.debug("Initializing accordion with bound events",e),m.on("click",b.event.click),e.data("module",b)},destroy:function(){b.debug("Destroying previous accordion for",e),e.off(r)},event:{click:function(){var c=a(this),d=m.index(c),e=c.hasClass(q.active);b.verbose("Accordion title clicked",c),e?f.collapsible?b.close(d):b.debug("Cannot close accordion content collapsing is disabled"):b.open(d)},resetStyle:function(){a(this).removeAttr("style").children().removeAttr("style")}},open:function(c){var d=m.eq(c),e=d.next(n),g=m.filter("."+q.active),h=g.next(m),i=g.size()>0;e.is(":animated")||(b.debug("Opening accordion content",d),f.exclusive&&i&&(g.removeClass(q.active),h.stop().children().animate({opacity:0},f.speed,b.event.resetStyle).end().slideUp(f.speed,f.easing,function(){h.removeClass(q.active).removeAttr("style").children().removeAttr("style")})),d.addClass(q.active),e.stop().children().removeAttr("style").end().slideDown(f.speed,f.easing,function(){e.addClass(q.active).removeAttr("style"),a.proxy(f.onOpen,e)(),a.proxy(f.onChange,e)()}))},close:function(c){var d=m.eq(c),e=d.next(n);b.debug("Closing accordion content",d),d.removeClass(q.active),e.removeClass(q.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+":"))},verbose:function(){f.verbose&&f.debug&&(f.performance?b.performance.log(arguments):b.verbose=Function.prototype.bind.call(console.info,console,f.moduleName+":"))},error:function(){b.error=Function.prototype.bind.call(console.log,console,f.moduleName+":")},performance:{log:function(a){var c,d,e;f.performance&&(c=(new Date).getTime(),e=h||c,d=c-e,h=c,i.push({Element:o,Name:a[0],Arguments:a[1]||"","Execution Time":d})),clearTimeout(b.performance.timer),b.performance.timer=setTimeout(b.performance.display,100)},display:function(){var b=f.moduleName+":",c=0;h=!1,a.each(i,function(a,b){c+=b["Execution Time"]}),b+=" "+c+"ms",g&&(b+=" '"+g+"'"),(console.group!==d||console.table!==d)&&i.length>0&&(console.groupCollapsed(b),console.table?console.table(i):a.each(i,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),i=[]}},invoke:function(c,e,f){var g,h;return e=e||l,f=o||f,"string"==typeof c&&p!==d&&(c=c.split("."),g=c.length-1,a.each(c,function(c,e){return a.isPlainObject(p[e])&&c!=g?(p=p[e],!0):p[e]!==d?(h=p[e],!0):(b.error(s.method),!1)})),a.isFunction(h)?(p.verbose("Executing invoked function",h),h.apply(f,e)):h||!1}},k?(p===d&&b.initialize(),c=b.invoke(j)):(p!==d&&b.destroy(),b.initialize())}),c?c:this},a.fn.accordion.settings={moduleName:"Accordion",debug:!0,verbose:!0,performance:!1,exclusive:!0,collapsible:!0,onOpen:function(){},onClose:function(){},onChange:function(){},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(a,b,c,d){a.animationSettings=function(b,c,e,f){return b=c===d?b:"object"==typeof c?a.extend({},b,c):"func
  13. g&&(b+=" Performance ("+g+")"),(console.group!==d||console.table!==d)&&i.length>0&&(console.groupCollapsed(b),console.table?(a.each(i,function(a,b){c+=b["Execution Time"]}),console.table(i)):a.each(i,function(a,b){c+=b["Execution Time"],console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.log("Total Execution Time:",c+"ms"),console.groupEnd(),i=[],h=!1)}},invoke:function(c,e,f){var g,h;return e=e||l,f=r||f,"string"==typeof c&&s!==d&&(c=c.split("."),g=c.length-1,a.each(c,function(c,e){return a.isPlainObject(s[e])&&c!=g?(s=s[e],!0):s[e]!==d?(h=s[e],!0):(b.error(v.method),!1)})),a.isFunction(h)?(s.verbose("Executing invoked function",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 Module",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=a(this),n=m.find(f.selector.expandButton),o=m.find(f.selector.userListButton),p=m.find(f.selector.userList),q=(m.find(f.selector.room),m.find(f.selector.userCount)),r=m.find(f.selector.log),s=(m.find(f.selector.message),m.find(f.selector.messageInput)),t=m.find(f.selector.messageButton),u=m.data("module"),v=f.className,w=f.namespace,x="",y={};return l={channel:!1,width:{log:r.width(),userList:p.outerWidth()},initialize:function(){return Pusher===d&&l.error(f.errors.pusher),b===d||c===d?(l.error(f.errors.key),!1):f.endpoint.message||f.endpoint.authentication?(k=new Pusher(b),Pusher.channel_auth_endpoint=f.endpoint.authentication,l.channel=k.subscribe(c),l.channel.bind("pusher:subscription_succeeded",l.user.list.create),l.channel.bind("pusher:subscription_error",l.error),l.channel.bind("pusher:member_added",l.user.joined),l.channel.bind("pusher:member_removed",l.user.left),l.channel.bind("update_messages",l.message.receive),a.each(f.customEvents,function(a,b){l.channel.bind(a,b)}),a.fn.hoverClass!==d&&a.fn.downClass!==d&&(n.hoverClass().downClass(),o.hoverClass().downClass(),t.hoverClass().downClass()),o.on("click."+w,l.event.toggleUserList),n.on("click."+w,l.event.toggleExpand),s.on("keydown."+w,l.event.input.keydown).on("keyup."+w,l.event.input.keyup),t.on("mouseenter."+w,l.event.hover).on("mouseleave."+w,l.event.hover).on("click."+w,l.event.submit),r.animate({scrollTop:r.prop("scrollHeight")},400),m.data("module",l).addClass(v.loading),void 0):(l.error(f.errors.endpoint),!1)},refresh:function(){o.removeClass(v.active),l.width={log:r.width(),userList:p.outerWidth()},o.hasClass(v.active)&&l.user.list.hide(),m.data("module",l)},user:{updateCount:function(){f.userCount&&(y=m.data("users"),i=0,a.each(y,function(){i++}),q.html(f.templates.userCount(i)))},joined:function(b){y=m.data("users"),"anonymous"!=b.id&&y[b.id]===d&&(y[b.id]=b.info,f.randomColor&&b.info.color===d&&(b.info.color=f.templates.color(b.id)),x=f.templates.userList(b.info),b.info.isAdmin?a(x).prependTo(p):a(x).appendTo(p),f.partingMessages&&(r.append(f.templates.joined(b.info)),l.message.scroll.test()),l.user.updateCount())},left:function(a){y=m.data("users"),a!==d&&"anonymous"!==a.id&&(delete y[a.id],m.data("users",y),p.find("[data-id="+a.id+"]").remove(),f.partingMessages&&(r.append(f.templates.left(a.info)),l.message.scroll.test()),l.user.updateCount())},list:{create:function(b){y={},b.each(function(a){"anonymous"!==a.id&&"undefined"!==a.id&&(f.randomColor&&a.info.color===d&&(a.info.color=f.templates.color(a.id)),x=a.info.isAdmin?f.templates.userList(a.info)+x:x+f.templates.userList(a.info),y[a.id]=a.info)}),m.data("users",y).data("user",y[b.me.id]).removeClass(v.loading),p.html(x),l.user.updateCount(),a.proxy(f.onJoin,p.children())()},show:function(){r.animate({width:l.width.log-l.width.u
  14. },instantiate:function(){e.verbose("Storing instance of module"),y=e,g.data("module-"+p,y)},refresh:function(){v=h.inline?g.next(l.popup):t.children(l.popup).last(),u=g.offsetParent()},destroy:function(){e.debug("Destroying existing popups"),g.off("."+p)},event:{mouseenter:function(b){var c=this;e.timer=setTimeout(function(){a.proxy(e.toggle,c)(),a(c).hasClass(m.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(m.visible)&&b.stopPropagation()},resize:function(){v.is(":visible")&&e.position()}},create:function(){e.debug("Creating pop-up html");var b=g.data(o.html)||h.html,c=g.data(o.variation)||h.variation,d=g.data(o.title)||h.title,f=g.data(o.content)||g.attr("title")||h.content;b||f||d?(b||(b=h.template({title:d,content:f})),v=a("<div/>").addClass(m.popup).addClass(c).html(b),h.inline?v.insertAfter(g):v.appendTo(a("body")),a.proxy(h.onInit,v)()):e.error(n.content)},remove:function(){v.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:v.width(),height:v.outerHeight(),position:v.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(m.visible)?e.hide():(e.hideAll(),e.show())},position:function(c,d){var f,i,j=(a(b).width(),a(b).height(),g.outerWidth()),k=g.outerHeight(),l=v.width(),p=v.outerHeight(),q=h.inline?g.position():g.offset(),r=h.inline?u.outerWidth():t.outerWidth(),s=h.inline?u.outerHeight():t.outerHeight();switch(c=c||g.data(o.position)||h.position,d=d||g.data(o.arrowOffset)||h.arrowOffset,e.debug("Calculating offset for position",c),c){case"top left":f={top:"auto",bottom:s-q.top+h.distanceAway,left:q.left+d};break;case"top center":f={bottom:s-q.top+h.distanceAway,left:q.left+j/2-l/2+d,top:"auto",right:"auto"};break;case"top right":f={bottom:s-q.top+h.distanceAway,right:r-q.left-j-d,top:"auto",left:"auto"};break;case"left center":f={top:q.top+k/2-p/2,right:r-q.left+h.distanceAway-d,left:"auto",bottom:"auto"};break;case"right center":f={top:q.top+k/2-p/2,left:q.left+j+h.distanceAway+d,bottom:"auto",right:"auto"};break;case"bottom left":f={top:q.top+k+h.distanceAway,left:q.left+d,bottom:"auto",right:"auto"};break;case"bottom center":f={top:q.top+k+h.distanceAway,left:q.left+j/2-l/2+d,bottom:"auto",right:"auto"};break;case"bottom right":f={top:q.top+k+h.distanceAway,right:r-q.left-j-d,left:"auto",bottom:"auto"}}return a.extend(f,{width:v.width()+1}),v.removeAttr("style").removeClass("top right bottom left center").css(f).addClass(c).addClass(m.loading),i=e.get.offstagePosition(),i?(e.debug("Element is outside boundaries ",i),w<h.maxSearchDepth?(c=e.get.nextPosition(c),w++,e.debug("Trying new position: ",c),e.position(c)):(e.error(n.recursion),w=0,!1)):(e.debug("Position is on stage",c),w=0,!0)},show:function(){e.debug("Showing pop-up"),0===v.size()&&e.create(),e.position(),g.addClass(m.visible),v.removeClass(m.loading),"pop"==h.animation&&a.fn.popIn!==d?(console.log(v),v.stop().popIn(h.duration,h.easing)):(console.log(v),v.stop().fadeIn(h.duration,h.easing)),"click"==h.on&&h.clicktoClose&&(e.debug("Binding popup close event"),a(c).on("click."+p,e.gracefully.hide)),a.proxy(h.onShow,v)()},hideAll:function(){a(l.popup).filter(":visible").stop().fadeOut(200).prev(g).removeClass(m.visible)},hide:function(){g.removeClass(m.visible),v.is(":visible")&&(e.debug("Hiding pop-up"),"pop"==h.animation&&a.
  15. }(jQuery,window,document),function(a,b,c,d){a.fn.video=function(b){var c,e=a.extend(!0,{},a.fn.video.settings,b),f=arguments||!1;return a(this).each(function(){var g,h=a(this),i=h.find(e.selector.placeholder),j=h.find(e.selector.playButton),k=h.find(e.selector.embed),l=h.data("module-"+e.namespace),m="string"==typeof b,n=e.namespace,o=e.metadata,p=e.className;g={initialize:function(){g.debug("Initializing video"),i.off(".video").on("click."+n,g.play),j.off(".video").on("click."+n,g.play),h.data("module-"+n,g)},change:function(a,b){g.debug("Changing video to ",b),h.data(o.source,a).data(o.flv,b),e.onChange()},reset:function(){g.debug("Clearing video embed and showing placeholder"),h.removeClass(p.active),k.html(" "),i.show(),e.onReset()},play:function(){g.debug("Playing video");var a=h.data(o.source),b=h.data(o.flv);k.html(g.generate.html(a,b)),h.addClass(p.active),e.onPlay()},generate:{html:function(a,b){g.debug("Generating embed html");var c,d="auto"==e.width?h.width():e.width,f="auto"==e.height?h.height():e.height;return"vimeo"==a?c='<iframe src="http://player.vimeo.com/video/'+b+"?="+g.generate.url(a)+'"'+' width="'+d+'" height="'+f+'"'+' frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>':"youtube"==a&&(c='<iframe src="http://www.youtube.com/embed/'+b+"?="+g.generate.url(a)+'"'+' width="'+d+'" height="'+f+'"'+' frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>'),c},url:function(a){var b=e.api?1:0,c=e.autoplay?1:0,d=e.hd?1:0,f=e.showUI?1:0,g=e.showUI?0:1,h="";return"vimeo"==a?(h="api="+b+"&amp;title="+f+"&amp;byline="+f+"&amp;portrait="+f+"&amp;autoplay="+c,e.color&&(h+="&amp;color="+e.color)):"youtube"==a&&(h="enablejsapi="+b+"&amp;autoplay="+c+"&amp;autohide="+g+"&amp;hq="+d+"&amp;modestbranding=1",e.color&&(h+="&amp;color="+e.color)),h}},debug:function(a,b){e.debug&&(b!==d?console.info(e.moduleName+": "+a,b):console.info(e.moduleName+": "+a))},error:function(a){console.warn(e.moduleName+": "+a)},invoke:function(b,c,f){var h;return f=f||Array.prototype.slice.call(arguments,2),"string"==typeof b&&l!==d&&(b=b.split("."),a.each(b,function(b,c){return a.isPlainObject(l[c])?(l=l[c],!0):a.isFunction(l[c])?(h=l[c],!0):(g.error(e.errors.method),!1)})),a.isFunction(h)?h.apply(c,f):h}},m?c=g.invoke(f[0],this,Array.prototype.slice.call(f,1)):(l&&g.destroy(),g.initialize())}),c!==d?c:this},a.fn.videoPlaylist=function(b,c){var d=a(this),e=a(b),f=e.find(".embed iframe"),g=a.extend({},a.fn.videoPlaylist.settings,c,!0);d.each(function(){var b=a(this),c=g.metadata,f=g.namespace,h=g.className,i={initialize:function(){b.on("click."+f,i.changeVideo)},changeVideo:function(){var f=b.data(c.flv)||!1,i=b.data(c.source)||!1,j=b.data(c.placeholder)||!1;if(f&&i){if(e.data(c.source,i).data(c.flv,f),g.showPlaceholder)e.removeClass(h.active).find(a.fn.video.selector.placeholder).attr("src",j);else try{e.video("play")}catch(k){console.warn("Video Playlist Module: "+g.error.init)}d.removeClass(h.active),b.addClass(h.active)}}};i.initialize()}),g.playFirst&&(d.eq(0).trigger("click"),f.size()>0&&f.attr("src",f.attr("src").replace("autoplay=1","autoplay=0")))},a.fn.video.settings={moduleName:"Video",namespace:"video",debug:!1,metadata:{source:"source",flv:"flv"},onPlay:function(){},onReset:function(){},onChange:function(){},play:function(){},pause:function(){},stop:function(){},width:"auto",height:"auto",autoplay:!1,color:"#442359",hd:!0,showUI:!1,api:!0,errors:{method:"The method you called is not defined"},className:{active:"active"},selector:{embed:".embed",placeholder:".placeholder",playButton:".play"}},a.fn.videoPlaylist.settings={moduleName:"Video Playlist",namespace:"videoPlaylist",source:"vimeo",showPlaceholder:!1,playFirst:!0,metadata:{flv:"flv",source:"source",placeholder:"placeholder"},errors:{init:"The video player you specified was not yet initialized"},className:{active:"active"}}}(jQuery,window,document);