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
125 KiB

11 years ago
11 years ago
11 years ago
  1. /** # Semantic UI
  2. * Version: 0.6.5
  3. * http://github.com/jlukic/semantic-ui
  4. *
  5. *
  6. * Copyright 2013 Contributors
  7. * Released under the MIT license
  8. * http://opensource.org/licenses/MIT
  9. *
  10. * Release Date: 10/22/2013
  11. */
  12. !function(a,b,c,d){a.fn.accordion=function(b){var c,e=a(this),f=(new Date).getTime(),g=[],h=arguments[0],i="string"==typeof h,j=[].slice.call(arguments,1);return e.each(function(){var k,l=a.isPlainObject(b)?a.extend(!0,{},a.fn.accordion.settings,b):a.extend({},a.fn.accordion.settings),m=l.className,n=l.namespace,o=l.selector,p=l.error,q="."+n,r="module-"+n,s=e.selector||"",t=a(this),u=t.find(o.title),v=t.find(o.content),w=this,x=t.data(r);k={initialize:function(){k.debug("Initializing accordion with bound events",t),u.on("click"+q,k.event.click),k.instantiate()},instantiate:function(){x=k,t.data(r,k)},destroy:function(){k.debug("Destroying previous accordion for",t),t.removeData(r),u.off(q)},event:{click:function(){k.verbose("Title clicked",this);var b=a(this),c=u.index(b);k.toggle(c)},resetStyle:function(){k.verbose("Resetting styles on element",this),a(this).attr("style","").removeAttr("style").children().attr("style","").removeAttr("style")}},toggle:function(a){k.debug("Toggling content content at index",a);var b=u.eq(a),c=b.next(v),d=c.is(":visible");d?l.collapsible?k.close(a):k.debug("Cannot close accordion content collapsing is disabled"):k.open(a)},open:function(b){var c=u.eq(b),d=c.next(v),e=u.filter("."+m.active),f=e.next(u),g=e.size()>0;d.is(":animated")||(k.debug("Opening accordion content",c),l.exclusive&&g&&(e.removeClass(m.active),f.stop().children().animate({opacity:0},l.duration,k.event.resetStyle).end().slideUp(l.duration,l.easing,function(){f.removeClass(m.active).attr("style","").removeAttr("style").children().attr("style","").removeAttr("style")})),c.addClass(m.active),d.stop().children().attr("style","").removeAttr("style").end().slideDown(l.duration,l.easing,function(){d.addClass(m.active).attr("style","").removeAttr("style"),a.proxy(l.onOpen,d)(),a.proxy(l.onChange,d)()}))},close:function(b){var c=u.eq(b),d=c.next(v);k.debug("Closing accordion content",c),c.removeClass(m.active),d.removeClass(m.active).show().stop().children().animate({opacity:0},l.duration,k.event.resetStyle).end().slideUp(l.duration,l.easing,function(){d.attr("style","").removeAttr("style"),a.proxy(l.onClose,d)(),a.proxy(l.onChange,d)()})},setting:function(b,c){return k.debug("Changing setting",b,c),c===d?l[b]:(a.isPlainObject(b)?a.extend(!0,l,b):l[b]=c,void 0)},internal:function(b,c){return k.debug("Changing internal",b,c),c===d?k[b]:(a.isPlainObject(b)?a.extend(!0,k,b):k[b]=c,void 0)},debug:function(){l.debug&&(l.performance?k.performance.log(arguments):(k.debug=Function.prototype.bind.call(console.info,console,l.name+":"),k.debug.apply(console,arguments)))},verbose:function(){l.verbose&&l.debug&&(l.performance?k.performance.log(arguments):(k.verbose=Function.prototype.bind.call(console.info,console,l.name+":"),k.verbose.apply(console,arguments)))},error:function(){k.error=Function.prototype.bind.call(console.error,console,l.name+":"),k.error.apply(console,arguments)},performance:{log:function(a){var b,c,d;l.performance&&(b=(new Date).getTime(),d=f||b,c=b-d,f=b,g.push({Element:w,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":c})),clearTimeout(k.performance.timer),k.performance.timer=setTimeout(k.performance.display,100)},display:function(){var b=l.name+":",c=0;f=!1,clearTimeout(k.performance.timer),a.each(g,function(a,b){c+=b["Execution Time"]}),b+=" "+c+"ms",s&&(b+=" '"+s+"'"),(console.group!==d||console.table!==d)&&g.length>0&&(console.groupCollapsed(b),console.table?console.table(g):a.each(g,function(a,b){console.log(b.Name+": "+b["Execution Time"]+"ms")}),console.groupEnd()),g=[]}},invoke:function(b,e,f){var g,h,i;return e=e||j,f=w||f,"string"==typeof b&&x!==d&&(b=b.split(/[\. ]/),g=b.length-1,a.each(b,function(c,e){var f=c!=g?e+b[c+1].charAt(0).toUpperCase()+b[c+1].slice(1):b;if(a.isPlainObject(x[e])&&c!=g)x=x[e];else{if(!a.isPlainObject(x[f])||c==g)return x[e]!==d?(h=x[e],!1):x[f]!==d?(h=x[f],!1):(k.error(p.method),!1);x=x[f]}})),a.isFunction(h)?i=h.apply(f,e):h!==d&&(i=h),a.isArray(c)?c.push(i):c!==d?c=[c,i]:i!==d&&(c=i),h}},i?(x===d&&k.initialize(),k.invoke(h)):(x!==d&&k.destroy(),k.initialize())}),c!==d?c
  13. },refresh:function(){r.removeClass(l.active),j.width={log:u.width(),userList:s.outerWidth()},r.hasClass(l.active)&&j.user.list.hide(),p.data("module",j)},user:{updateCount:function(){k.userCount&&(z=p.data("users"),g=0,a.each(z,function(){g++}),t.html(k.templates.userCount(g)))},joined:function(b){z=p.data("users"),"anonymous"!=b.id&&z[b.id]===d&&(z[b.id]=b.info,k.randomColor&&b.info.color===d&&(b.info.color=k.templates.color(b.id)),y=k.templates.userList(b.info),b.info.isAdmin?a(y).prependTo(s):a(y).appendTo(s),k.partingMessages&&(u.append(k.templates.joined(b.info)),j.message.scroll.test()),j.user.updateCount())},left:function(a){z=p.data("users"),a!==d&&"anonymous"!==a.id&&(delete z[a.id],p.data("users",z),s.find("[data-id="+a.id+"]").remove(),k.partingMessages&&(u.append(k.templates.left(a.info)),j.message.scroll.test()),j.user.updateCount())},list:{create:function(b){z={},b.each(function(a){"anonymous"!==a.id&&"undefined"!==a.id&&(k.randomColor&&a.info.color===d&&(a.info.color=k.templates.color(a.id)),y=a.info.isAdmin?k.templates.userList(a.info)+y:y+k.templates.userList(a.info),z[a.id]=a.info)}),p.data("users",z).data("user",z[b.me.id]).removeClass(l.loading),s.html(y),j.user.updateCount(),a.proxy(k.onJoin,s.children())()},show:function(){u.animate({width:j.width.log-j.width.userList},{duration:k.speed,easing:k.easing,complete:j.message.scroll.move})},hide:function(){u.stop().animate({width:j.width.log},{duration:k.speed,easing:k.easing,complete:j.message.scroll.move})}}},message:{scroll:{test:function(){h=u.prop("scrollHeight")-u.height(),Math.abs(u.scrollTop()-h)<k.scrollArea&&j.message.scroll.move()},move:function(){h=u.prop("scrollHeight")-u.height(),u.scrollTop(h)}},send:function(b){j.utils.emptyString(b)||a.api({url:k.endpoint.message,method:"POST",data:{message:{content:b,timestamp:(new Date).getTime()}}})},receive:function(a){f=a.data,z=p.data("users"),e=p.data("user"),z[f.userID]!==d&&(e===d||e.id!=f.userID)&&(f.user=z[f.userID],j.message.display(f))},display:function(b){u.append(k.templates.message(b)),j.message.scroll.test(),a.proxy(k.onMessage,u.children().last())()}},expand:function(){p.addClass(l.expand),a.proxy(k.onExpand,p)(),j.refresh()},contract:function(){p.removeClass(l.expand),a.proxy(k.onContract,p)(),j.refresh()},event:{input:{keydown:function(a){13==a.which&&w.addClass(l.down)},keyup:function(a){13==a.which&&(w.removeClass(l.down),j.event.submit())}},submit:function(){var a=v.val(),b=p.data("user");b===d||j.utils.emptyString(a)||(j.message.send(a),j.message.display({user:b,text:a}),j.message.scroll.move(),v.val(""))},toggleExpand:function(){p.hasClass(l.expand)?(q.removeClass(l.active),j.contract()):(q.addClass(l.active),j.expand())},toggleUserList:function(){u.is(":animated")||(r.hasClass(l.active)?(r.removeClass("active"),j.user.list.hide()):(r.addClass(l.active),j.user.list.show()))}},utils:{emptyString:function(a){return"string"==typeof a?-1==a.search(/\S/):!1}},setting:function(b,c){return c===d?k[b]:(a.isPlainObject(b)?a.extend(!0,k,b):k[b]=c,void 0)},internal:function(b,c){return c===d?j[b]:(a.isPlainObject(b)?a.extend(!0,j,b):j[b]=c,void 0)},debug:function(){k.debug&&(k.performance?j.performance.log(arguments):(j.debug=Function.prototype.bind.call(console.info,console,k.name+":"),j.debug.apply(console,arguments)))},verbose:function(){k.verbose&&k.debug&&(k.performance?j.performance.log(arguments):(j.verbose=Function.prototype.bind.call(console.info,console,k.name+":"),j.verbose.apply(console,arguments)))},error:function(){j.error=Function.prototype.bind.call(console.error,console,k.name+":"),j.error.apply(console,arguments)},performance:{log:function(a){var b,c,d;k.performance&&(b=(new Date).getTime(),d=time||b,c=b-d,time=b,performance.push({Element:element,Name:a[0],Arguments:[].slice.call(a,1)||"","Execution Time":c})),clearTimeout(j.performance.timer),j.performance.timer=setTimeout(j.performance.display,100)},display:function(){var b=k.name+":",c=0;time=!1,clearTimeout(j.performance.timer),a.each(performance,function(a,b){c+=b["Execution Time"]}),b+=" "+c+"ms",moduleSelector&&(b+
  14. }),console.groupEnd()),k=[]}},invoke:function(b,c,e){var g,h,i;return c=c||n,e=E||e,"string"==typeof b&&F!==d&&(b=b.split(/[\. ]/),g=b.length-1,a.each(b,function(c,e){var f=c!=g?e+b[c+1].charAt(0).toUpperCase()+b[c+1].slice(1):b;if(a.isPlainObject(F[e])&&c!=g)F=F[e];else{if(!a.isPlainObject(F[f])||c==g)return F[e]!==d?(h=F[e],!1):F[f]!==d?(h=F[f],!1):(r.error(w.method),!1);F=F[f]}})),a.isFunction(h)?i=h.apply(e,c):h!==d&&(i=h),a.isArray(f)?f.push(i):f!==d?f=[f,i]:i!==d&&(f=i),h}},m?(F===d&&r.initialize(),r.invoke(l)):(F!==d&&r.destroy(),r.initialize())}),f!==d?f:this},a.fn.modal.settings={name:"Modal",namespace:"modal",verbose:!0,debug:!0,performance:!0,closable:!0,context:"body",duration:500,easing:"easeOutExpo",offset:0,transition:"scale",onShow:function(){},onHide:function(){},onApprove:function(){},onDeny:function(){},selector:{close:".close, .actions .button",approve:".actions .positive, .actions .approve",deny:".actions .negative, .actions .cancel"},error:{dimmer:"UI Dimmer, a required component is not included in this page",method:"The method you called is not defined."},className:{active:"active",scrolling:"scrolling"}}}(jQuery,window,document),function(a,b,c,d){a.fn.nag=function(c){var e,f=a(this),g=f.selector||"",h=(new Date).getTime(),i=[],j=arguments[0],k="string"==typeof j,l=[].slice.call(arguments,1);return a(this).each(function(){var m,n,o,p,q,r,s,t,u,v=a.extend(!0,{},a.fn.nag.settings,c),w=v.className,x=v.selector,y=v.error,z=v.namespace,A="."+z,B=z+"-module",C=a(this),D=C.find(x.close),E=a(v.context),F=this,G=C.data(B),H=b.requestAnimationFrame||b.mozRequestAnimationFrame||b.webkitRequestAnimationFrame||b.msRequestAnimationFrame||function(a){setTimeout(a,0)};u={initialize:function(){u.verbose("Initializing element"),m=C.offset(),n=C.outerHeight(),o=E.outerWidth(),p=E.outerHeight(),q=E.offset(),C.data(B,u),D.on("click"+A,u.dismiss),v.context==b&&"fixed"==v.position&&C.addClass(w.fixed),v.sticky&&(u.verbose("Adding scroll events"),"absolute"==v.position?E.on("scroll"+A,u.event.scroll).on("resize"+A,u.event.scroll):a(b).on("scroll"+A,u.event.scroll).on("resize"+A,u.event.scroll),a.proxy(u.event.scroll,this)()),v.displayTime>0&&setTimeout(u.hide,v.displayTime),u.should.show()?C.is(":visible")||u.show():u.hide()},destroy:function(){u.verbose("Destroying instance"),C.removeData(B).off(A),v.sticky&&E.off(A)},refresh:function(){u.debug("Refreshing cached calculations"),m=C.offset(),n=C.outerHeight(),o=E.outerWidth(),p=E.outerHeight(),q=E.offset()},show:function(){u.debug("Showing nag",v.animation.show),"fade"==v.animation.show?C.fadeIn(v.duration,v.easing):C.slideDown(v.duration,v.easing)},hide:function(){u.debug("Showing nag",v.animation.hide),"fade"==v.animation.show?C.fadeIn(v.duration,v.easing):C.slideUp(v.duration,v.easing)},onHide:function(){u.debug("Removing nag",v.animation.hide),C.remove(),v.onHide&&v.onHide()},stick:function(){if(u.refresh(),"fixed"==v.position){var c=a(b).prop("pageYOffset")||a(b).scrollTop(),d=C.hasClass(w.bottom)?q.top+(p-n)-c:q.top-c;C.css({position:"fixed",top:d,left:q.left,width:o-v.scrollBarWidth})}else C.css({top:s})},unStick:function(){C.css({top:""})},dismiss:function(a){v.storageMethod&&u.storage.set(v.storedKey,v.storedValue),u.hide(),a.stopImmediatePropagation(),a.preventDefault()},should:{show:function(){return v.persist?(u.debug("Persistent nag is set, can show nag"),!0):u.storage.get(v.storedKey)!=v.storedValue?(u.debug("Stored value is not set, can show nag",u.storage.get(v.storedKey)),!0):(u.debug("Stored value is set, cannot show nag",u.storage.get(v.storedKey)),!1)},stick:function(){return r=E.prop("pageYOffset")||E.scrollTop(),s=C.hasClass(w.bottom)?p-C.outerHeight()+r:r,s>m.top?!0:"fixed"==v.position?!0:!1}},storage:{set:function(c,e){u.debug("Setting stored value",c,e,v.storageMethod),"local"==v.storageMethod&&b.store!==d?b.store.set(c,e):a.cookie!==d?a.cookie(c,e):u.error(y.noStorage)},get:function(c){return u.debug("Getting stored value",c,v.storageMethod),"local"==v.storageMethod&&b.store!==d?b.store.get(c):a.cookie!==d?a.cookie(c):(u.error(y.noStorage),void
  15. }},set:{defaultSide:function(){l=w.find("."+p.className.active),m=l.next(r.side).size()>0?l.next(r.side):w.find(r.side).first(),n.verbose("Active side set to",l),n.verbose("Next side set to",m)},stageSize:function(){var a={width:m.outerWidth(),height:m.outerHeight()};n.verbose("Resizing stage to fit new content",a),w.css({width:a.width,height:a.height})},nextSide:function(a){m=w.find(a),0===m.size()&&n.error(s.side),n.verbose("Next side manually set to",m)},active:function(){n.verbose("Setting new side to active",m),y.removeClass(t.active),m.addClass(t.active),a.proxy(p.onChange,m)(),n.set.defaultSide()}},flip:{up:function(){n.debug("Flipping up",m),n.is.animating()?n.queue("flip up"):(n.stage.above(),n.animate(n.get.transform.up()))},down:function(){n.debug("Flipping down",m),n.is.animating()?n.queue("flip down"):(n.stage.below(),n.animate(n.get.transform.down()))},left:function(){n.debug("Flipping left",m),n.is.animating()?n.queue("flip left"):(n.stage.left(),n.animate(n.get.transform.left()))},right:function(){n.debug("Flipping right",m),n.is.animating()?n.queue("flip right"):(n.stage.right(),n.animate(n.get.transform.right()))},over:function(){n.debug("Flipping over",m),n.is.animating()?n.queue("flip over"):(n.stage.behind(),n.animate(n.get.transform.over()))},back:function(){n.debug("Flipping back",m),n.is.animating()?n.queue("flip back"):(n.stage.behind(),n.animate(n.get.transform.back()))}},stage:{above:function(){var a={origin:(l.outerHeight()-m.outerHeight())/2,depth:{active:m.outerHeight()/2,next:l.outerHeight()/2}};n.verbose("Setting the initial animation position as above",m,a),l.css({transform:"rotateY(0deg) translateZ("+a.depth.active+"px)"}),m.addClass(t.animating).css({display:"block",top:a.origin+"px",transform:"rotateX(90deg) translateZ("+a.depth.next+"px)"})},below:function(){var a={origin:(l.outerHeight()-m.outerHeight())/2,depth:{active:m.outerHeight()/2,next:l.outerHeight()/2}};n.verbose("Setting the initial animation position as below",m,a),l.css({transform:"rotateY(0deg) translateZ("+a.depth.active+"px)"}),m.addClass(t.animating).css({display:"block",top:a.origin+"px",transform:"rotateX(-90deg) translateZ("+a.depth.next+"px)"})},left:function(){var a={origin:(l.outerWidth()-m.outerWidth())/2,depth:{active:m.outerWidth()/2,next:l.outerWidth()/2}};n.verbose("Setting the initial animation position as left",m,a),l.css({transform:"rotateY(0deg) translateZ("+a.depth.active+"px)"}),m.addClass(t.animating).css({display:"block",left:a.origin+"px",transform:"rotateY(-90deg) translateZ("+a.depth.next+"px)"})},right:function(){var a={origin:(l.outerWidth()-m.outerWidth())/2,depth:{active:m.outerWidth()/2,next:l.outerWidth()/2}};n.verbose("Setting the initial animation position as left",m,a),l.css({transform:"rotateY(0deg) translateZ("+a.depth.active+"px)"}),m.addClass(t.animating).css({display:"block",left:a.origin+"px",transform:"rotateY(90deg) translateZ("+a.depth.next+"px)"})},behind:function(){var a={origin:(l.outerWidth()-m.outerWidth())/2,depth:{active:m.outerWidth()/2,next:l.outerWidth()/2}};n.verbose("Setting the initial animation position as behind",m,a),l.css({transform:"rotateY(0deg)"}),m.addClass(t.animating).css({display:"block",left:a.origin+"px",transform:"rotateY(-180deg)"})}},setting:function(b,c){return c===d?p[b]:(a.isPlainObject(b)?a.extend(!0,p,b):p[b]=c,void 0)},internal:function(b,c){return c===d?n[b]:(a.isPlainObject(b)?a.extend(!0,n,b):n[b]=c,void 0)},debug:function(){p.debug&&(p.performance?n.performance.log(arguments):(n.debug=Function.prototype.bind.call(console.info,console,p.name+":"),n.debug.apply(console,arguments)))},verbose:function(){p.verbose&&p.debug&&(p.performance?n.performance.log(arguments):(n.verbose=Function.prototype.bind.call(console.info,console,p.name+":"),n.verbose.apply(console,arguments)))},error:function(){n.error=Function.prototype.bind.call(console.error,console,p.name+":"),n.error.apply(console,arguments)},performance:{log:function(a){var b,c,d;p.performance&&(b=(new Date).getTime(),d=g||b,c=b-d,g=b,h.push({Element:z,Name:a[0],Arguments:[].slice.call(a,1)