").attr({id:i,role:"tooltip"}).addClass("ui-tooltip ui-widget ui-corner-all ui-widget-content "+(this.options.tooltipClass||""));return t("
").addClass("ui-tooltip-content").appendTo(n),n.appendTo(this.document[0].body),this.tooltips[i]=e,n},_find:function(e){var i=e.data("ui-tooltip-id");return i?t("#"+i):t()},_removeTooltip:function(t){t.remove(),delete this.tooltips[t.attr("id")]},_destroy:function(){var e=this;t.each(this.tooltips,function(i,s){var n=t.Event("blur");n.target=n.currentTarget=s[0],e.close(n,!0),t("#"+i).remove(),s.data("ui-tooltip-title")&&(s.attr("title",s.data("ui-tooltip-title")),s.removeData("ui-tooltip-title"))})}})})(jQuery);(function(t,e){var i="ui-effects-";t.effects={effect:{}},function(t,e){function i(t,e,i){var s=u[e.type]||{};return null==t?i||!e.def?null:e.def:(t=s.floor?~~t:parseFloat(t),isNaN(t)?e.def:s.mod?(t+s.mod)%s.mod:0>t?0:t>s.max?s.max:t)}function s(i){var s=l(),n=s._rgba=[];return i=i.toLowerCase(),f(h,function(t,a){var o,r=a.re.exec(i),h=r&&a.parse(r),l=a.space||"rgba";return h?(o=s[l](h),s[c[l].cache]=o[c[l].cache],n=s._rgba=o._rgba,!1):e}),n.length?("0,0,0,0"===n.join()&&t.extend(n,a.transparent),s):a[i]}function n(t,e,i){return i=(i+1)%1,1>6*i?t+6*(e-t)*i:1>2*i?e:2>3*i?t+6*(e-t)*(2/3-i):t}var a,o="backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",r=/^([\-+])=\s*(\d+\.?\d*)/,h=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[t[1],t[2],t[3],t[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[2.55*t[1],2.55*t[2],2.55*t[3],t[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,parse:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16)]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])/,parse:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16)]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(t){return[t[1],t[2]/100,t[3]/100,t[4]]}}],l=t.Color=function(e,i,s,n){return new t.Color.fn.parse(e,i,s,n)},c={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},u={"byte":{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},d=l.support={},p=t("
")[0],f=t.each;p.style.cssText="background-color:rgba(1,1,1,.5)",d.rgba=p.style.backgroundColor.indexOf("rgba")>-1,f(c,function(t,e){e.cache="_"+t,e.props.alpha={idx:3,type:"percent",def:1}}),l.fn=t.extend(l.prototype,{parse:function(n,o,r,h){if(n===e)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=t(n).css(o),o=e);var u=this,d=t.type(n),p=this._rgba=[];return o!==e&&(n=[n,o,r,h],d="array"),"string"===d?this.parse(s(n)||a._default):"array"===d?(f(c.rgba.props,function(t,e){p[e.idx]=i(n[e.idx],e)}),this):"object"===d?(n instanceof l?f(c,function(t,e){n[e.cache]&&(u[e.cache]=n[e.cache].slice())}):f(c,function(e,s){var a=s.cache;f(s.props,function(t,e){if(!u[a]&&s.to){if("alpha"===t||null==n[t])return;u[a]=s.to(u._rgba)}u[a][e.idx]=i(n[t],e,!0)}),u[a]&&0>t.inArray(null,u[a].slice(0,3))&&(u[a][3]=1,s.from&&(u._rgba=s.from(u[a])))}),this):e},is:function(t){var i=l(t),s=!0,n=this;return f(c,function(t,a){var o,r=i[a.cache];return r&&(o=n[a.cache]||a.to&&a.to(n._rgba)||[],f(a.props,function(t,i){return null!=r[i.idx]?s=r[i.idx]===o[i.idx]:e})),s}),s},_space:function(){var t=[],e=this;return f(c,function(i,s){e[s.cache]&&t.push(i)}),t.pop()},transition:function(t,e){var s=l(t),n=s._space(),a=c[n],o=0===this.alpha()?l("transparent"):this,r=o[a.cache]||a.to(o._rgba),h=r.slice();return s=s[a.cache],f(a.props,function(t,n){var a=n.idx,o=r[a],l=s[a],c=u[n.type]||{};null!==l&&(null===o?h[a]=l:(c.mod&&(l-o>c.mod/2?o+=c.mod:o-l>c.mod/2&&(o-=c.mod)),h[a]=i((l-o)*e+o,n)))}),this[n](h)},blend:function(e){if(1===this._rgba[3])return this;var i=this._rgba.slice(),s=i.pop(),n=l(e)._rgba;return l(t.map(i,function(t,e){return(1-s)*n[e]+s*t}))},toRgbaString:function(){var e="rgba(",i=t.map(this._rgba,function(t,e){return null==t?e>2?1:0:t});return 1===i[3]&&(i.pop(),e="rgb("),e+i.join()+")"},toHslaString:function(){var e="hsla(",i=t.map(this.hsla(),function(t,e){return null==t&&(t=e>2?1:0),e&&3>e&&(t=Math.round(100*t)+"%"),t});return 1===i[3]&&(i.pop(),e="hsl("),e+i.join()+")"},toHexString:function(e){var i=this._rgba.slice(),s=i.pop();return e&&i.push(~~(255*s)),"#"+t.map(i,function(t){return t=(t||0).toString(16),1===t.length?"0"+t:t}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}}),l.fn.parse.prototype=l.fn,c.hsla.to=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e,i,s=t[0]/255,n=t[1]/255,a=t[2]/255,o=t[3],r=Math.max(s,n,a),h=Math.min(s,n,a),l=r-h,c=r+h,u=.5*c;return e=h===r?0:s===r?60*(n-a)/l+360:n===r?60*(a-s)/l+120:60*(s-n)/l+240,i=0===l?0:.5>=u?l/c:l/(2-c),[Math.round(e)%360,i,u,null==o?1:o]},c.hsla.from=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e=t[0]/360,i=t[1],s=t[2],a=t[3],o=.5>=s?s*(1+i):s+i-s*i,r=2*s-o;return[Math.round(255*n(r,o,e+1/3)),Math.round(255*n(r,o,e)),Math.round(255*n(r,o,e-1/3)),a]},f(c,function(s,n){var a=n.props,o=n.cache,h=n.to,c=n.from;l.fn[s]=function(s){if(h&&!this[o]&&(this[o]=h(this._rgba)),s===e)return this[o].slice();var n,r=t.type(s),u="array"===r||"object"===r?s:arguments,d=this[o].slice();return f(a,function(t,e){var s=u["object"===r?t:e.idx];null==s&&(s=d[e.idx]),d[e.idx]=i(s,e)}),c?(n=l(c(d)),n[o]=d,n):l(d)},f(a,function(e,i){l.fn[e]||(l.fn[e]=function(n){var a,o=t.type(n),h="alpha"===e?this._hsla?"hsla":"rgba":s,l=this[h](),c=l[i.idx];return"undefined"===o?c:("function"===o&&(n=n.call(this,c),o=t.type(n)),null==n&&i.empty?this:("string"===o&&(a=r.exec(n),a&&(n=c+parseFloat(a[2])*("+"===a[1]?1:-1))),l[i.idx]=n,this[h](l)))})})}),l.hook=function(e){var i=e.split(" ");f(i,function(e,i){t.cssHooks[i]={set:function(e,n){var a,o,r="";if("transparent"!==n&&("string"!==t.type(n)||(a=s(n)))){if(n=l(a||n),!d.rgba&&1!==n._rgba[3]){for(o="backgroundColor"===i?e.parentNode:e;(""===r||"transparent"===r)&&o&&o.style;)try{r=t.css(o,"backgroundColor"),o=o.parentNode}catch(h){}n=n.blend(r&&"transparent"!==r?r:"_default")}n=n.toRgbaString()}try{e.style[i]=n}catch(h){}}},t.fx.step[i]=function(e){e.colorInit||(e.start=l(e.elem,i),e.end=l(e.end),e.colorInit=!0),t.cssHooks[i].set(e.elem,e.start.transition(e.end,e.pos))}})},l.hook(o),t.cssHooks.borderColor={expand:function(t){var e={};return f(["Top","Right","Bottom","Left"],function(i,s){e["border"+s+"Color"]=t}),e}},a=t.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"}}(jQuery),function(){function i(e){var i,s,n=e.ownerDocument.defaultView?e.ownerDocument.defaultView.getComputedStyle(e,null):e.currentStyle,a={};if(n&&n.length&&n[0]&&n[n[0]])for(s=n.length;s--;)i=n[s],"string"==typeof n[i]&&(a[t.camelCase(i)]=n[i]);else for(i in n)"string"==typeof n[i]&&(a[i]=n[i]);return a}function s(e,i){var s,n,o={};for(s in i)n=i[s],e[s]!==n&&(a[s]||(t.fx.step[s]||!isNaN(parseFloat(n)))&&(o[s]=n));return o}var n=["add","remove","toggle"],a={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1};t.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(e,i){t.fx.step[i]=function(t){("none"!==t.end&&!t.setAttr||1===t.pos&&!t.setAttr)&&(jQuery.style(t.elem,i,t.end),t.setAttr=!0)}}),t.fn.addBack||(t.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),t.effects.animateClass=function(e,a,o,r){var h=t.speed(a,o,r);return this.queue(function(){var a,o=t(this),r=o.attr("class")||"",l=h.children?o.find("*").addBack():o;l=l.map(function(){var e=t(this);return{el:e,start:i(this)}}),a=function(){t.each(n,function(t,i){e[i]&&o[i+"Class"](e[i])})},a(),l=l.map(function(){return this.end=i(this.el[0]),this.diff=s(this.start,this.end),this}),o.attr("class",r),l=l.map(function(){var e=this,i=t.Deferred(),s=t.extend({},h,{queue:!1,complete:function(){i.resolve(e)}});return this.el.animate(this.diff,s),i.promise()}),t.when.apply(t,l.get()).done(function(){a(),t.each(arguments,function(){var e=this.el;t.each(this.diff,function(t){e.css(t,"")})}),h.complete.call(o[0])})})},t.fn.extend({addClass:function(e){return function(i,s,n,a){return s?t.effects.animateClass.call(this,{add:i},s,n,a):e.apply(this,arguments)}}(t.fn.addClass),removeClass:function(e){return function(i,s,n,a){return arguments.length>1?t.effects.animateClass.call(this,{remove:i},s,n,a):e.apply(this,arguments)}}(t.fn.removeClass),toggleClass:function(i){return function(s,n,a,o,r){return"boolean"==typeof n||n===e?a?t.effects.animateClass.call(this,n?{add:s}:{remove:s},a,o,r):i.apply(this,arguments):t.effects.animateClass.call(this,{toggle:s},n,a,o)}}(t.fn.toggleClass),switchClass:function(e,i,s,n,a){return t.effects.animateClass.call(this,{add:i,remove:e},s,n,a)}})}(),function(){function s(e,i,s,n){return t.isPlainObject(e)&&(i=e,e=e.effect),e={effect:e},null==i&&(i={}),t.isFunction(i)&&(n=i,s=null,i={}),("number"==typeof i||t.fx.speeds[i])&&(n=s,s=i,i={}),t.isFunction(s)&&(n=s,s=null),i&&t.extend(e,i),s=s||i.duration,e.duration=t.fx.off?0:"number"==typeof s?s:s in t.fx.speeds?t.fx.speeds[s]:t.fx.speeds._default,e.complete=n||i.complete,e}function n(e){return!e||"number"==typeof e||t.fx.speeds[e]?!0:"string"!=typeof e||t.effects.effect[e]?t.isFunction(e)?!0:"object"!=typeof e||e.effect?!1:!0:!0}t.extend(t.effects,{version:"1.10.3",save:function(t,e){for(var s=0;e.length>s;s++)null!==e[s]&&t.data(i+e[s],t[0].style[e[s]])},restore:function(t,s){var n,a;for(a=0;s.length>a;a++)null!==s[a]&&(n=t.data(i+s[a]),n===e&&(n=""),t.css(s[a],n))},setMode:function(t,e){return"toggle"===e&&(e=t.is(":hidden")?"show":"hide"),e},getBaseline:function(t,e){var i,s;switch(t[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=t[0]/e.height}switch(t[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=t[1]/e.width}return{x:s,y:i}},createWrapper:function(e){if(e.parent().is(".ui-effects-wrapper"))return e.parent();var i={width:e.outerWidth(!0),height:e.outerHeight(!0),"float":e.css("float")},s=t("
").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),n={width:e.width(),height:e.height()},a=document.activeElement;try{a.id}catch(o){a=document.body}return e.wrap(s),(e[0]===a||t.contains(e[0],a))&&t(a).focus(),s=e.parent(),"static"===e.css("position")?(s.css({position:"relative"}),e.css({position:"relative"})):(t.extend(i,{position:e.css("position"),zIndex:e.css("z-index")}),t.each(["top","left","bottom","right"],function(t,s){i[s]=e.css(s),isNaN(parseInt(i[s],10))&&(i[s]="auto")}),e.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),e.css(n),s.css(i).show()},removeWrapper:function(e){var i=document.activeElement;return e.parent().is(".ui-effects-wrapper")&&(e.parent().replaceWith(e),(e[0]===i||t.contains(e[0],i))&&t(i).focus()),e},setTransition:function(e,i,s,n){return n=n||{},t.each(i,function(t,i){var a=e.cssUnit(i);a[0]>0&&(n[i]=a[0]*s+a[1])}),n}}),t.fn.extend({effect:function(){function e(e){function s(){t.isFunction(a)&&a.call(n[0]),t.isFunction(e)&&e()}var n=t(this),a=i.complete,r=i.mode;(n.is(":hidden")?"hide"===r:"show"===r)?(n[r](),s()):o.call(n[0],i,s)}var i=s.apply(this,arguments),n=i.mode,a=i.queue,o=t.effects.effect[i.effect];return t.fx.off||!o?n?this[n](i.duration,i.complete):this.each(function(){i.complete&&i.complete.call(this)}):a===!1?this.each(e):this.queue(a||"fx",e)},show:function(t){return function(e){if(n(e))return t.apply(this,arguments);var i=s.apply(this,arguments);return i.mode="show",this.effect.call(this,i)}}(t.fn.show),hide:function(t){return function(e){if(n(e))return t.apply(this,arguments);var i=s.apply(this,arguments);return i.mode="hide",this.effect.call(this,i)}}(t.fn.hide),toggle:function(t){return function(e){if(n(e)||"boolean"==typeof e)return t.apply(this,arguments);var i=s.apply(this,arguments);return i.mode="toggle",this.effect.call(this,i)}}(t.fn.toggle),cssUnit:function(e){var i=this.css(e),s=[];return t.each(["em","px","%","pt"],function(t,e){i.indexOf(e)>0&&(s=[parseFloat(i),e])}),s}})}(),function(){var e={};t.each(["Quad","Cubic","Quart","Quint","Expo"],function(t,i){e[i]=function(e){return Math.pow(e,t+2)}}),t.extend(e,{Sine:function(t){return 1-Math.cos(t*Math.PI/2)},Circ:function(t){return 1-Math.sqrt(1-t*t)},Elastic:function(t){return 0===t||1===t?t:-Math.pow(2,8*(t-1))*Math.sin((80*(t-1)-7.5)*Math.PI/15)},Back:function(t){return t*t*(3*t-2)},Bounce:function(t){for(var e,i=4;((e=Math.pow(2,--i))-1)/11>t;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}}),t.each(e,function(e,i){t.easing["easeIn"+e]=i,t.easing["easeOut"+e]=function(t){return 1-i(1-t)},t.easing["easeInOut"+e]=function(t){return.5>t?i(2*t)/2:1-i(-2*t+2)/2}})}()})(jQuery);(function(t){var e=/up|down|vertical/,i=/up|left|vertical|horizontal/;t.effects.effect.blind=function(s,n){var a,o,r,h=t(this),l=["position","top","bottom","left","right","height","width"],c=t.effects.setMode(h,s.mode||"hide"),u=s.direction||"up",d=e.test(u),p=d?"height":"width",f=d?"top":"left",m=i.test(u),g={},v="show"===c;h.parent().is(".ui-effects-wrapper")?t.effects.save(h.parent(),l):t.effects.save(h,l),h.show(),a=t.effects.createWrapper(h).css({overflow:"hidden"}),o=a[p](),r=parseFloat(a.css(f))||0,g[p]=v?o:0,m||(h.css(d?"bottom":"right",0).css(d?"top":"left","auto").css({position:"absolute"}),g[f]=v?r:o+r),v&&(a.css(p,0),m||a.css(f,r+o)),a.animate(g,{duration:s.duration,easing:s.easing,queue:!1,complete:function(){"hide"===c&&h.hide(),t.effects.restore(h,l),t.effects.removeWrapper(h),n()}})}})(jQuery);(function(t){t.effects.effect.bounce=function(e,i){var s,n,a,o=t(this),r=["position","top","bottom","left","right","height","width"],h=t.effects.setMode(o,e.mode||"effect"),l="hide"===h,c="show"===h,u=e.direction||"up",d=e.distance,p=e.times||5,f=2*p+(c||l?1:0),m=e.duration/f,g=e.easing,v="up"===u||"down"===u?"top":"left",_="up"===u||"left"===u,b=o.queue(),y=b.length;for((c||l)&&r.push("opacity"),t.effects.save(o,r),o.show(),t.effects.createWrapper(o),d||(d=o["top"===v?"outerHeight":"outerWidth"]()/3),c&&(a={opacity:1},a[v]=0,o.css("opacity",0).css(v,_?2*-d:2*d).animate(a,m,g)),l&&(d/=Math.pow(2,p-1)),a={},a[v]=0,s=0;p>s;s++)n={},n[v]=(_?"-=":"+=")+d,o.animate(n,m,g).animate(a,m,g),d=l?2*d:d/2;l&&(n={opacity:0},n[v]=(_?"-=":"+=")+d,o.animate(n,m,g)),o.queue(function(){l&&o.hide(),t.effects.restore(o,r),t.effects.removeWrapper(o),i()}),y>1&&b.splice.apply(b,[1,0].concat(b.splice(y,f+1))),o.dequeue()}})(jQuery);(function(t){t.effects.effect.clip=function(e,i){var s,n,a,o=t(this),r=["position","top","bottom","left","right","height","width"],h=t.effects.setMode(o,e.mode||"hide"),l="show"===h,c=e.direction||"vertical",u="vertical"===c,d=u?"height":"width",p=u?"top":"left",f={};t.effects.save(o,r),o.show(),s=t.effects.createWrapper(o).css({overflow:"hidden"}),n="IMG"===o[0].tagName?s:o,a=n[d](),l&&(n.css(d,0),n.css(p,a/2)),f[d]=l?a:0,f[p]=l?0:a/2,n.animate(f,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){l||o.hide(),t.effects.restore(o,r),t.effects.removeWrapper(o),i()}})}})(jQuery);(function(t){t.effects.effect.drop=function(e,i){var s,n=t(this),a=["position","top","bottom","left","right","opacity","height","width"],o=t.effects.setMode(n,e.mode||"hide"),r="show"===o,h=e.direction||"left",l="up"===h||"down"===h?"top":"left",c="up"===h||"left"===h?"pos":"neg",u={opacity:r?1:0};t.effects.save(n,a),n.show(),t.effects.createWrapper(n),s=e.distance||n["top"===l?"outerHeight":"outerWidth"](!0)/2,r&&n.css("opacity",0).css(l,"pos"===c?-s:s),u[l]=(r?"pos"===c?"+=":"-=":"pos"===c?"-=":"+=")+s,n.animate(u,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){"hide"===o&&n.hide(),t.effects.restore(n,a),t.effects.removeWrapper(n),i()}})}})(jQuery);(function(t){t.effects.effect.explode=function(e,i){function s(){b.push(this),b.length===u*d&&n()}function n(){p.css({visibility:"visible"}),t(b).remove(),m||p.hide(),i()}var a,o,r,h,l,c,u=e.pieces?Math.round(Math.sqrt(e.pieces)):3,d=u,p=t(this),f=t.effects.setMode(p,e.mode||"hide"),m="show"===f,g=p.show().css("visibility","hidden").offset(),v=Math.ceil(p.outerWidth()/d),_=Math.ceil(p.outerHeight()/u),b=[];for(a=0;u>a;a++)for(h=g.top+a*_,c=a-(u-1)/2,o=0;d>o;o++)r=g.left+o*v,l=o-(d-1)/2,p.clone().appendTo("body").wrap("
").css({position:"absolute",visibility:"visible",left:-o*v,top:-a*_}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:v,height:_,left:r+(m?l*v:0),top:h+(m?c*_:0),opacity:m?0:1}).animate({left:r+(m?0:l*v),top:h+(m?0:c*_),opacity:m?1:0},e.duration||500,e.easing,s)}})(jQuery);(function(t){t.effects.effect.fade=function(e,i){var s=t(this),n=t.effects.setMode(s,e.mode||"toggle");s.animate({opacity:n},{queue:!1,duration:e.duration,easing:e.easing,complete:i})}})(jQuery);(function(t){t.effects.effect.fold=function(e,i){var s,n,a=t(this),o=["position","top","bottom","left","right","height","width"],r=t.effects.setMode(a,e.mode||"hide"),h="show"===r,l="hide"===r,c=e.size||15,u=/([0-9]+)%/.exec(c),d=!!e.horizFirst,p=h!==d,f=p?["width","height"]:["height","width"],m=e.duration/2,g={},v={};t.effects.save(a,o),a.show(),s=t.effects.createWrapper(a).css({overflow:"hidden"}),n=p?[s.width(),s.height()]:[s.height(),s.width()],u&&(c=parseInt(u[1],10)/100*n[l?0:1]),h&&s.css(d?{height:0,width:c}:{height:c,width:0}),g[f[0]]=h?n[0]:c,v[f[1]]=h?n[1]:0,s.animate(g,m,e.easing).animate(v,m,e.easing,function(){l&&a.hide(),t.effects.restore(a,o),t.effects.removeWrapper(a),i()})}})(jQuery);(function(t){t.effects.effect.highlight=function(e,i){var s=t(this),n=["backgroundImage","backgroundColor","opacity"],a=t.effects.setMode(s,e.mode||"show"),o={backgroundColor:s.css("backgroundColor")};"hide"===a&&(o.opacity=0),t.effects.save(s,n),s.show().css({backgroundImage:"none",backgroundColor:e.color||"#ffff99"}).animate(o,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){"hide"===a&&s.hide(),t.effects.restore(s,n),i()}})}})(jQuery);(function(t){t.effects.effect.pulsate=function(e,i){var s,n=t(this),a=t.effects.setMode(n,e.mode||"show"),o="show"===a,r="hide"===a,h=o||"hide"===a,l=2*(e.times||5)+(h?1:0),c=e.duration/l,u=0,d=n.queue(),p=d.length;for((o||!n.is(":visible"))&&(n.css("opacity",0).show(),u=1),s=1;l>s;s++)n.animate({opacity:u},c,e.easing),u=1-u;n.animate({opacity:u},c,e.easing),n.queue(function(){r&&n.hide(),i()}),p>1&&d.splice.apply(d,[1,0].concat(d.splice(p,l+1))),n.dequeue()}})(jQuery);(function(t){t.effects.effect.puff=function(e,i){var s=t(this),n=t.effects.setMode(s,e.mode||"hide"),a="hide"===n,o=parseInt(e.percent,10)||150,r=o/100,h={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()};t.extend(e,{effect:"scale",queue:!1,fade:!0,mode:n,complete:i,percent:a?o:100,from:a?h:{height:h.height*r,width:h.width*r,outerHeight:h.outerHeight*r,outerWidth:h.outerWidth*r}}),s.effect(e)},t.effects.effect.scale=function(e,i){var s=t(this),n=t.extend(!0,{},e),a=t.effects.setMode(s,e.mode||"effect"),o=parseInt(e.percent,10)||(0===parseInt(e.percent,10)?0:"hide"===a?0:100),r=e.direction||"both",h=e.origin,l={height:s.height(),width:s.width(),outerHeight:s.outerHeight(),outerWidth:s.outerWidth()},c={y:"horizontal"!==r?o/100:1,x:"vertical"!==r?o/100:1};n.effect="size",n.queue=!1,n.complete=i,"effect"!==a&&(n.origin=h||["middle","center"],n.restore=!0),n.from=e.from||("show"===a?{height:0,width:0,outerHeight:0,outerWidth:0}:l),n.to={height:l.height*c.y,width:l.width*c.x,outerHeight:l.outerHeight*c.y,outerWidth:l.outerWidth*c.x},n.fade&&("show"===a&&(n.from.opacity=0,n.to.opacity=1),"hide"===a&&(n.from.opacity=1,n.to.opacity=0)),s.effect(n)},t.effects.effect.size=function(e,i){var s,n,a,o=t(this),r=["position","top","bottom","left","right","width","height","overflow","opacity"],h=["position","top","bottom","left","right","overflow","opacity"],l=["width","height","overflow"],c=["fontSize"],u=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],d=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],p=t.effects.setMode(o,e.mode||"effect"),f=e.restore||"effect"!==p,m=e.scale||"both",g=e.origin||["middle","center"],v=o.css("position"),_=f?r:h,b={height:0,width:0,outerHeight:0,outerWidth:0};"show"===p&&o.show(),s={height:o.height(),width:o.width(),outerHeight:o.outerHeight(),outerWidth:o.outerWidth()},"toggle"===e.mode&&"show"===p?(o.from=e.to||b,o.to=e.from||s):(o.from=e.from||("show"===p?b:s),o.to=e.to||("hide"===p?b:s)),a={from:{y:o.from.height/s.height,x:o.from.width/s.width},to:{y:o.to.height/s.height,x:o.to.width/s.width}},("box"===m||"both"===m)&&(a.from.y!==a.to.y&&(_=_.concat(u),o.from=t.effects.setTransition(o,u,a.from.y,o.from),o.to=t.effects.setTransition(o,u,a.to.y,o.to)),a.from.x!==a.to.x&&(_=_.concat(d),o.from=t.effects.setTransition(o,d,a.from.x,o.from),o.to=t.effects.setTransition(o,d,a.to.x,o.to))),("content"===m||"both"===m)&&a.from.y!==a.to.y&&(_=_.concat(c).concat(l),o.from=t.effects.setTransition(o,c,a.from.y,o.from),o.to=t.effects.setTransition(o,c,a.to.y,o.to)),t.effects.save(o,_),o.show(),t.effects.createWrapper(o),o.css("overflow","hidden").css(o.from),g&&(n=t.effects.getBaseline(g,s),o.from.top=(s.outerHeight-o.outerHeight())*n.y,o.from.left=(s.outerWidth-o.outerWidth())*n.x,o.to.top=(s.outerHeight-o.to.outerHeight)*n.y,o.to.left=(s.outerWidth-o.to.outerWidth)*n.x),o.css(o.from),("content"===m||"both"===m)&&(u=u.concat(["marginTop","marginBottom"]).concat(c),d=d.concat(["marginLeft","marginRight"]),l=r.concat(u).concat(d),o.find("*[width]").each(function(){var i=t(this),s={height:i.height(),width:i.width(),outerHeight:i.outerHeight(),outerWidth:i.outerWidth()};f&&t.effects.save(i,l),i.from={height:s.height*a.from.y,width:s.width*a.from.x,outerHeight:s.outerHeight*a.from.y,outerWidth:s.outerWidth*a.from.x},i.to={height:s.height*a.to.y,width:s.width*a.to.x,outerHeight:s.height*a.to.y,outerWidth:s.width*a.to.x},a.from.y!==a.to.y&&(i.from=t.effects.setTransition(i,u,a.from.y,i.from),i.to=t.effects.setTransition(i,u,a.to.y,i.to)),a.from.x!==a.to.x&&(i.from=t.effects.setTransition(i,d,a.from.x,i.from),i.to=t.effects.setTransition(i,d,a.to.x,i.to)),i.css(i.from),i.animate(i.to,e.duration,e.easing,function(){f&&t.effects.restore(i,l)})})),o.animate(o.to,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){0===o.to.opacity&&o.css("opacity",o.from.opacity),"hide"===p&&o.hide(),t.effects.restore(o,_),f||("static"===v?o.css({position:"relative",top:o.to.top,left:o.to.left}):t.each(["top","left"],function(t,e){o.css(e,function(e,i){var s=parseInt(i,10),n=t?o.to.left:o.to.top;return"auto"===i?n+"px":s+n+"px"})})),t.effects.removeWrapper(o),i()}})}})(jQuery);(function(t){t.effects.effect.shake=function(e,i){var s,n=t(this),a=["position","top","bottom","left","right","height","width"],o=t.effects.setMode(n,e.mode||"effect"),r=e.direction||"left",h=e.distance||20,l=e.times||3,c=2*l+1,u=Math.round(e.duration/c),d="up"===r||"down"===r?"top":"left",p="up"===r||"left"===r,f={},m={},g={},v=n.queue(),_=v.length;for(t.effects.save(n,a),n.show(),t.effects.createWrapper(n),f[d]=(p?"-=":"+=")+h,m[d]=(p?"+=":"-=")+2*h,g[d]=(p?"-=":"+=")+2*h,n.animate(f,u,e.easing),s=1;l>s;s++)n.animate(m,u,e.easing).animate(g,u,e.easing);n.animate(m,u,e.easing).animate(f,u/2,e.easing).queue(function(){"hide"===o&&n.hide(),t.effects.restore(n,a),t.effects.removeWrapper(n),i()}),_>1&&v.splice.apply(v,[1,0].concat(v.splice(_,c+1))),n.dequeue()}})(jQuery);(function(t){t.effects.effect.slide=function(e,i){var s,n=t(this),a=["position","top","bottom","left","right","width","height"],o=t.effects.setMode(n,e.mode||"show"),r="show"===o,h=e.direction||"left",l="up"===h||"down"===h?"top":"left",c="up"===h||"left"===h,u={};t.effects.save(n,a),n.show(),s=e.distance||n["top"===l?"outerHeight":"outerWidth"](!0),t.effects.createWrapper(n).css({overflow:"hidden"}),r&&n.css(l,c?isNaN(s)?"-"+s:-s:s),u[l]=(r?c?"+=":"-=":c?"-=":"+=")+s,n.animate(u,{queue:!1,duration:e.duration,easing:e.easing,complete:function(){"hide"===o&&n.hide(),t.effects.restore(n,a),t.effects.removeWrapper(n),i()}})}})(jQuery);(function(t){t.effects.effect.transfer=function(e,i){var s=t(this),n=t(e.to),a="fixed"===n.css("position"),o=t("body"),r=a?o.scrollTop():0,h=a?o.scrollLeft():0,l=n.offset(),c={top:l.top-r,left:l.left-h,height:n.innerHeight(),width:n.innerWidth()},u=s.offset(),d=t("
").appendTo(document.body).addClass(e.className).css({top:u.top-r,left:u.left-h,height:s.innerHeight(),width:s.innerWidth(),position:a?"fixed":"absolute"}).animate(c,e.duration,e.easing,function(){d.remove(),i()})}})(jQuery);;
function toFixedString(n, digits) {
var unsigned = toUnsignedString(Math.abs(n), digits);
return (n < 0 ? "-" : "") + unsigned;
}
function toUnsignedString(n, digits) {
var t, s = Math.round(n * Math.pow(10, digits)) + "",
start, end;
if (/\D/.test(s)) {
return "" + n;
}
s = padLeft(s, 1 + digits, "0");
start = s.substring(0, t = (s.length - digits));
end = s.substring(t);
if(end) {
end = "." + end;
}
return start + end; // avoid "0."
}
function formatprice_euro(price){
if(Math.floor(price) != price){ // Round to 2 decimals
// Round to second decimal
price = Math.ceil(price * 100);
price = price/100;
// If number is now round, add ,-
var round = false;
if(price == Math.floor(price)) var round = true;
price = price.toString();
price = price.replace(".",",");
// If only one number left after comma, add trailing zero
var priceArr = split(",",price);
var dec = priceArr[1];
if(dec.length<2 && round==false) price = (price.toString() + "0").toString();
}else{
price = price.toString() + ",-";
}
return ("€"+price).toString();
}
/*
Developed by Robert Nyman, http://www.robertnyman.com
Code/licensing: http://code.google.com/p/getelementsbyclassname/
*/
var getElementsByClassName = function (className, tag, elm){
if (document.getElementsByClassName) {
getElementsByClassName = function (className, tag, elm) {
elm = elm || document;
var elements = elm.getElementsByClassName(className),
nodeName = (tag)? new RegExp("\\b" + tag + "\\b", "i") : null,
returnElements = [],
current;
for(var i=0, il=elements.length; i
0;
};
function routeLocationHash(){
if((window.location.hash=='#signup'
|| window.location.hash=='#trial')
&& window.location.toString().indexOf('pricing')==-1){
gotoSignup();
} else {
var url = window.location.hash.split('/');
if(window.location.hash.indexOf('#signup')!= -1){
if(url[1]){
if(url[1]=='invite'){
toggleSignup(url[2],url[3]);
}else{
toggleSignup(url[1]);
}
}else{
toggleSignup();
}
}
}
if((window.location.hash=='#request-invite') && window.location.toString().indexOf('pricing')==-1){
gotoInviteRequest();
}else{
if(window.location.hash.indexOf('#request-invite')!= -1){
gotoInviteRequest();
}
}
if(window.location.hash=='#more') toggleReadMore();
if(window.location.hash=='#faq') toggleFAQ();
}
function goToTop(){
$('body,html').animate({scrollTop:0}, 200);
}
function toggleSignup(Code,Email,Currency){
$('a#signup-button').hide();
if(Code) $('form#signup').attr('action','/auth/register/'+Code)
if(Code && Currency) $('form#signup').attr('action','/auth/register/'+Code+'/'+Currency)
if($('form#signup').css('display')=='none'){
$("#splash_inner").hide();
$('form#signup').insertBefore('#splash_inner').slideDown('fast',function(){
makeAjax($('form#signup'));
$('body,html').animate({
scrollTop: 0,
complete: function(){
if(Email){
$("#signup_container input.text:first").val(Email);
$("#signup_container input.text:last").focus();
}else{
$("#signup_container input.text:first").focus();
}
}
}, 0);
if(Email){
$("#signup_container input.text:first").val(Email);
$("#signup_container input.text:last").focus();
}else{
$("#signup_container input.text:first").focus();
}
});
}else{
$("#splash_inner").show();
$('form#signup').slideUp('fast');
}
}
function gotoSignup(){
$('a#signup-button').hide();
if($('form#signup').css('display')=='none'){
$('form#request-invite').hide();
$('img#splash').fadeOut('fast',function(){
$('form#signup').appendTo('#splash_inner').fadeIn('fast',function(){
$("#signup_container:first input.text:first").focus();
makeAjax($('form#signup'));
});
$('body,html').animate({
scrollTop:0
}, 0);
});
}
}
function gotoInviteRequest(){
$('a#signup-button').hide();
if($('form#request-invite').css('display')=='none'){
$('form#signup').hide();
$('img#splash').fadeOut('fast',function(){
$('form#request-invite').fadeIn('fast',function(){
$("#signup_container:first input.text:first").focus();
makeAjax($('form#request-invite'));
});
$('body,html').animate({
scrollTop:0
}, 0);
});
}
}
function toggleReadMore(){
if($('div#more').css('display')=='none') $('div#more,div#faq').show();
$('body,html').animate({
scrollTop: $("#more").offset().top - 30
}, 100);
}
function toggleFAQ(){
if($('div#faq').css('display')=='none') $('div#more,div#faq').show();
$('body,html').animate({
scrollTop: $("#faq").offset().top
}, 100);
}
function makeAjax(el){
$(el).submit(function(){
if(validateSignup(this)){
data = $(el).serialize();
$.post($(el).attr('action'),data,function(data,textStatus,jqXHR){
$(el).html(''+data+'
');
});
}
return false;
});
}
function validateSignup(el){
$('#starttrial_confirmpassword').val($('#starttrial_password').val());
var errors = 0;
var inputs = el.getElementsByTagName('input');
for(i = 0 ; i < inputs.length ; i++){
if(inputs[i].type=='hidden') continue;
if(!inputs[i].value){
inputs[i].style.borderWidth = '2px';
inputs[i].style.borderColor = '#d66';
errors++;
}else{
inputs[i].style.borderWidth = '1px';
inputs[i].style.borderColor = '#bbb';
}
}
if($(el).find('#agree')[0] && !el.agree.checked){
$(el).find('#agree')[0].parentNode.getElementsByTagName('label')[0].style.fontStyle = 'italic';
$(el).find('#agree')[0].parentNode.getElementsByTagName('label')[0].style.color = '#d66';
$(el).find('#agree')[0].parentNode.getElementsByTagName('label')[0].getElementsByTagName('a')[0].style.color = '#d66';
errors++;
}else if($(el).find('#agree')[0]){
$(el).find('#agree')[0].parentNode.getElementsByTagName('label')[0].style.fontStyle = 'normal';
$(el).find('#agree')[0].parentNode.getElementsByTagName('label')[0].style.color = '#999';
$(el).find('#agree')[0].parentNode.getElementsByTagName('label')[0].getElementsByTagName('a')[0].style.color = '#666';
}
if(errors>0) return false;
return true;
}
function toggleMobileLogin(el){
$('div#login').css('display','block');
$(el).hide();
};
// Detect IE 10
if (Function('/*@cc_on return document.documentMode===10@*/')()){
document.documentElement.className+=' ie10';
}
/*
* jQuery UI Touch Punch 0.2.2
*
* Copyright 2011, Dave Furfero
* Dual licensed under the MIT or GPL Version 2 licenses.
*
* Depends:
* jquery.ui.widget.js
* jquery.ui.mouse.js
*/
(function(b){b.support.touch="ontouchend" in document;if(!b.support.touch){return;}var c=b.ui.mouse.prototype,e=c._mouseInit,a;function d(g,h){if(g.originalEvent.touches.length>1){return;}g.preventDefault();var i=g.originalEvent.changedTouches[0],f=document.createEvent("MouseEvents");f.initMouseEvent(h,true,true,window,1,i.screenX,i.screenY,i.clientX,i.clientY,false,false,false,false,0,null);g.target.dispatchEvent(f);}c._touchStart=function(g){var f=this;if(a||!f._mouseCapture(g.originalEvent.changedTouches[0])){return;}a=true;f._touchMoved=false;d(g,"mouseover");d(g,"mousemove");d(g,"mousedown");};c._touchMove=function(f){if(!a){return;}this._touchMoved=true;d(f,"mousemove");};c._touchEnd=function(f){if(!a){return;}d(f,"mouseup");d(f,"mouseout");if(!this._touchMoved){d(f,"click");}a=false;};c._mouseInit=function(){var f=this;f.element.bind("touchstart",b.proxy(f,"_touchStart")).bind("touchmove",b.proxy(f,"_touchMove")).bind("touchend",b.proxy(f,"_touchEnd"));e.call(f);};})(jQuery);
if(typeof(console)!='object') var console = {"log":function(msg){}};
if(typeof(searchLabel)=='undefined') searchLabel = 'Search';
if(typeof(searchNoResults)=='undefined') searchNoResults = 'No results.';
var statusOrder;
var newinputs = 0;
var currentIssue = 0;
var latestKeyPress;
var sorting;
var isMobile;
var tabSpaceWidth = 320;
var separateProjectTabsPlanned = 0;
var slowIE;
var hints;
/* Cookie setters/getters */
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) === 0) return c.substring(nameEQ.length,c.length);
}
return null;
}
function eraseCookie(name) {
createCookie(name,"",-1);
}
/* Trackie functionality */
$(document).ready(function(){
if(navigator.userAgent.indexOf('Firefox')!= -1 ) $('body').addClass('firefox');
if ($('html').is('.ie6, .ie7, .ie8')) {
slowIE = true;
}
if($('body').width() < 500)isMobile = true;
if($('body').hasClass('auth') && isMobile){ window.location = "/"; return; }
$("body.newproject a.new,body.projectmembers a.new").click(function(){
$(this).parent().children('table.contacts').append(" | |
");
$("table.contacts td.name input[type='text']").focus(function(){
if($(this).val().indexOf(' email')>=0 || $(this).val().indexOf(' e-mail')>=0) $(this).val('');
});
newinputs++;
});
$("body.issue input.title").focus();
if($("body.issue").length && typeof(autogrow)=='function') $('textarea').autogrow();
/* Disable some stuff on mobile */
if(isMobile) tabSpaceWidth = 400;
separateProjectTabs();
applyIFrames();
$(window).resize(function(){
if(!separateProjectTabsPlanned){
separateProjectTabsPlanned=1;
setTimeout(separateProjectTabs,500);
}
});
initLightBoxes();
if($("div#feedback-form").length){
var browserSpecs = detectBrowser();
$("div#feedback-form input#BrowserName").val(browserSpecs.browserName);
$("div#feedback-form input#BrowserVersion").val(browserSpecs.fullVersion);
}
if($('table.issues').length>0) initTableSorter();
if($('table#statuses-table').length > 0){
prepareColorPicker();
$('table#statuses-table').tableDnD({dragHandle: "reorder",onDragClass:"dragging"});
}
if($('table#groups-table').length > 0){
$('table#groups-table').tableDnD({dragHandle: "reorder",onDragClass:"dragging"});
}
$('a.help').click(function(){
alert($(this).attr('title'));
});
initSearch();
if($('.group').length) initQuickAdd();
/* Add group form */
$("#addgroupfield a.close").click(function(){
$('#addgroupfield input.text').val('').blur();
$('.add-group').show();
$('#addgroupfield').hide();
});
/* Unread comments */
$('.newcomments').removeClass('hidden');
/* Make issue rows drag'n'droppable */
if($("body.project #groups").length>0 && !isMobile){
initDragNDrop();
$('.container.empty,.container.just-fixed').each(function(){
$(this).closest('.group').find('.top-add-link').remove();
});
$('a.delete-group').click(function(){
if(confirm(delete_group_confirmation_message)){
$('#delete-group-form input').val($(this).attr('id').replace('delete-group-','')).parent().submit();
}
});
$('.no-touch div.group').hover(function(){
$(this).children('a.delete-group').show();
$(this).children('a.drag-group').show();
},function(){
$(this).children('a.delete-group').hide();
$(this).children('a.drag-group').hide();
});
}
$('a.add-group').click(function(){
$(this).hide();
$('#addgroupfield').show();
$('#addgroupfield input.text').focus();
dismissHint('hint-add-group');
$('#hint-add-group').hide();
});
if($("body.project #groups").length && !isMobile) initDragReorder();
if($("body.newproject").length) $('table td input:first').focus();
applyGroupClasses();
$('.attachment-container').hover(function(){
$(this).children('a.delete-attachment').css('visibility','visible');
},function(){
$(this).children('a.delete-attachment').css('visibility','hidden');
});
if($('#expire').length){
$('#current-user').hide();
$('#expire .close').click(function(){
$('#current-user').show();
$('#expire').hide();
});
}
// PJAX inline form submits for a quicker user experience
$('.project #assigneemenuform,.project #prioritymenuform,.project #statusmenuform').submit(function(event) {
$.pjax.submit(
event,
$('#issues-'+$(this).children("input[name='GroupID']").val()+" tbody[data-pjax-container]"),
{scrollTo:false}
);
});
$('.project tbody[data-pjax-container]').on('pjax:end',function(event){
initDragNDrop(); // See if this can be limited to the table that changed
$(event.target).parent().trigger("update");
evaluateFixed($(event.target).closest('.container'));
applyIFrames();
});
// Handle excess tabs
$('.tab').not('#excesspulldown').click(function(){
$('body').removeClass('ready');
$('.tab').removeClass('active');
$(this).addClass('active');
$('#page').addClass('empty').empty();
});
// Handle horizontal mode
$('.horizontal-switch,#horizontal-hint').click(function(){
dismissHint('horizontal-hint');
if(typeof(_gaq)=='object') _gaq.push(['_trackEvent', 'Horizontal Mode','Flick Horizontal Mode Switch']);
});
if($('body').hasClass('horizontal-mode')){
if(typeof(_gaq)=='object') _gaq.push(['_trackEvent', 'Horizontal Mode','On']);
}else{
if(typeof(_gaq)=='object') _gaq.push(['_trackEvent', 'Horizontal Mode','Off']);
}
visualizeOverflow();
if($('.group').length==1 && $('.group > .empty').length==1){
initiateQuickAdd($('.group'));
}
// Decide which hints to display by default
if(!$('body').hasClass('horizontal-mode') && !isMobile){
if($('.issue').length<2){
offerHint('hint-inline-add');
}else if($('.group').length==1){
offerHint('hint-add-group');
}
// Dismiss members hint as soon as user visits project members page
if($('body').hasClass('projectmembers')) dismissHint('members-hint');
// Dismiss horizontal hint if stored in previous cookie format
if(null != readCookie('saw-horizontal-hint')){
dismissHint('horizontal-hint');
eraseCookie('saw-horizontal-hint');
}
// Only after add issue and add group hints are gone, show members hint or horizontal hint.
if($('#hint-add-group:visible').length == 0
&& $('#hint-inline-add:visible').length == 0){
offerHint('hint-hide-completed');
if($('#hint-hide-completed:visible').length == 0) offerHint('members-hint');
if($('#hint-hide-completed:visible').length == 0
&& $("#members-hint:visible").length == 0) offerHint('horizontal-hint');
}
// Hint dismissal
$('.hint-content > a').click(function(){
dismissHint($(this).parent().parent().attr('id'));
});
}
if(!isMobile) initEditables();
$('body').addClass('ready');
});
/* INLINE EDITING OF FIELDS */
function initEditables(){
if($('body').hasClass('read-only')) return;
makeEditable($('.frame .issue h2.editable'),'Title','input');
makeEditable($('.frame .issue .textfield'),'Description','textarea');
makeEditable($('.frame .issue i.no-description'),'Description','textarea');
}
function makeEditable(el,field,fieldType){
if($('body').hasClass('read-only')) return;
var origEl = el;
// Reset in case this has been executed once already;
$(el).unbind('click');
$(el).click(function(){
var origEl = $(this);
$(this).hide();
$('.inline-edit,.inline-edit-save-button').remove();
if(fieldType=='input'){
inputEl = $('').insertAfter($(this));
}else if(fieldType=='textarea'){
inputEl = $('').insertAfter($(this));
saveLink = $('Save changes').insertAfter(inputEl);
}
if(origEl[0].tagName!='I') inputEl.val($(el).text().trim());
inputEl.focus();
inputEl.blur(function(){
saveInlineEdit($(this),field,fieldType,origEl);
});
if(fieldType=='input'){
$(inputEl).keypress(function(e){
if(e.keyCode==13){
saveInlineEdit($(this),field,fieldType,origEl);
return false;
}
return true;
});
}
});
}
function saveInlineEdit(el,field,fieldType,origEl){
$(el).hide();
if($(el).val().length>0){
if(origEl[0].tagName=='I'){
$('.textfield,.inline-edit-save-button').remove();
$(origEl).after(''+(nl2br($(el).val().trim()))+'
');
$(origEl).remove();
}else{
$('.inline-edit-save-button').remove();
$(origEl).empty();
$(origEl).html(nl2br($(el).val().trim()));
$(origEl).show();
}
}else{
if(fieldType=='textarea'){
$(origEl).after('No description filed.');
$('.textfield,.inline-edit-save-button').remove();
}else{
$(origEl).show();
$('.textfield,.inline-edit-save-button').remove();
return;
}
}
fieldIndex = 'Issue['+field+']';
data = { 'Inline' : 1 };
data[fieldIndex] = $(el).val().trim();
$.ajax({
type: "POST",
url: './edit',
data: data,
success: function(GroupID){
if(parseInt(GroupID)!=NaN) window.top.refreshList(parseInt(GroupID));
$(el).remove();
$(this).parent().children('.inline-edit,.inline-edit-save-button').remove();
initEditables();
}
});
}
/* HINT BUBBLES */
function dismissHint(id){
el = document.getElementById(id);
$(el).hide();
var hintClass = id;
if(null == (dismissedHints = readCookie('dismissedHints'))){
dismissedHints = [];
}else{
dismissedHints = dismissedHints.split(',');
}
if(dismissedHints.indexOf(hintClass)==-1) dismissedHints.push(hintClass);
eraseCookie('dismissedHints');
createCookie('dismissedHints',dismissedHints.join(','),1825);
}
function offerHint(id){
el = document.getElementById(id);
dismissedHints = readCookie('dismissedHints');
if(dismissedHints == null || dismissedHints.indexOf(id)==-1) $(el).show();
}
/* OPEN ISSUES IN LIGHTBOXED IFRAMES */
function initLightBoxes(){
if(isMobile){
$('a.attachment-image').removeAttr('onclick');
}else{
if(typeof($.colorbox) == 'function'){
$('div#home-screenshots a').colorbox({transition:'none',opacity:0.75,rel:'screenshot_15'});
$('div#more div.screenshot a').colorbox({transition:'none',opacity:0.75,rel:'screenshot-right'});
$('.client-screenshot').colorbox({transition:'none',photo:true,opacity:0.75});
$('div#screenshots a.screenshot').colorbox({transition:'none',opacity:0.75,maxHeight:'90%',maxWidth:'90%'});
$('a.attachment-image').colorbox({transition:'none',opacity:0,maxHeight:'90%',maxWidth:'90%',photo:true,title:
function(){
var src = $(this).attr('href');
return 'Download image';
},
onOpen: function(){
$('body').unbind('click');
$('body').click(function(){ $.colorbox.close(); });
},
onClosed: function(){
$('body').unbind('click');
$('body').click(function(){ closeIssueFrame(); });
}});
}
}
}
function applyIFrames(){
if(!isMobile){
$('table.issues td.title a').click(function(e){
e.preventDefault();
$('.simplemenu,#statusmenu,#searchresults').hide();
$('#frame-wrap').remove();
$('body').append('');
setTimeout(setCloseIssueFrame, 1);
});
}
if(!isMobile){
$('.addissuefield a.more').click(function(e){
e.preventDefault();
var Title = $('.addissuefield input.text').val();
var GroupID = $(this).closest('.group').find('table.issues').attr('id').replace('issues-','');
$('body').append('');
setTimeout(setCloseIssueFrame, 1);
});
}
}
function setCloseIssueFrame(){
$('body').click(function(e){ if(e.target.tagName!='A') closeIssueFrame(); });
}
function closeIssueFrame(){
$('#frame-wrap').remove();
}
/* QUICK ADD ISSUE FIELD */
function initQuickAdd(){
/* Quick add */
$(".project-header a.action.add").click(function(){
initiateQuickAdd($('.group:first'));
});
/* Quick add from group */
$(".group a.action.add").click(function(){
initiateQuickAdd($(this).closest('.group'));
});
$(".group a.action.add,.group a.top-add-link").click(function(){
initiateQuickAdd($(this).closest('.group'));
});
$("form.quick-add-form").submit(function(){
if($(this).children('input.text').val().length==0) return false;
});
$(".addissuefield a.close").click(function(){
$(this).closest('.group').find('.addissuefield input.text').val('').blur();
$(this).closest('.group').find('a.add-in-group').show();
$(this).closest('.group').find('.addissuefield').hide();
$(this).closest('.group').find('div.notes').show();
});
}
function initiateQuickAdd(el){
el.find('a.add-in-group').hide();
el.find('.addissuefield').show();
if(!(el.find('.container.empty') && $('.group').length==1)) el.find('.notes').hide(); // Hide note while adding unless only and empty group.
el.find('.addissuefield input.text').focus();
if($('body').width() > 774 && !$('body').hasClass('horizontal-mode')){
el.find('.addissuefield input.text').css('width',(el.find('.addissuefield .input').width() - el.find('.addissuefield a.more').width() - 12 )+'px');
}
}
function addInline(formElement){
var PostData = {
'Title':$(formElement).find('input.text').val(),
'GroupID':$(formElement).find('input.GroupID').val()
};
if(PostData.Title.length==0) return false;
$(formElement).find('input.text').addClass('loading');
$('#addissuefield-'+PostData.GroupID+' input.text').val('').focus();
$.post('./inline-add/',PostData, function(data,textStatus,jqXHR) {
$('table#issues-'+PostData.GroupID).closest('.container').find('.addissuefield input.text').removeClass('loading');
if(data=='FAIL'){
alert('Failed to add your issue. Please check if your internet connection is up.');
}else{
$('table#issues-'+PostData.GroupID).closest('.container').find('p.no-issues').remove();
$('table#issues-'+PostData.GroupID).removeClass('empty');
$('table#issues-'+PostData.GroupID).parent().parent().removeClass('empty');
$('table#issues-'+PostData.GroupID+' tbody').empty();
$('table#issues-'+PostData.GroupID+' tbody').show();
$('table#issues-'+PostData.GroupID+' tbody').html(data);
$('table#issues-'+PostData.GroupID).trigger("update");
evaluateFixed($('table#issues-'+PostData.GroupID).closest('.container'));
initDragNDrop();
applyIFrames();
// If inline add hint is present and second issue was added, switch to Add List hint
if($('#hint-inline-add').length>0 && $('#hint-inline-add').css('display')=='block' && $('table#issues-'+PostData.GroupID+' .issue').length==2){
$('#hint-inline-add').hide();
offerHint('hint-add-group');
}
}
});
return false;
}
/* SEARCH */
function initSearch(){
$('#searchbox').focus(function(){
$(this).addClass('active').val('');
$('ul#searchresults').empty().hide();
$("#searchbox").removeClass('loading');
});
$('#searchbox').blur(function(){
$("#searchbox").removeClass('loading');
if($(this).val()=='')$(this).removeClass('active').val(searchLabel);
});
$('#searchbox').keydown(function(e){
if(e.which==8 || e.which == 9){
if($('#searchbox').val().length==1){
resetSearch();
return true;
}
}
if( e.which == 9){
return true;
}else if(e.which==13){
fireSearch($("#searchbox").val());
}else{
latestKeyPress = Math.round(new Date().getTime() / 1000.0);
setTimeout(handleSearchKeyPress,250);
}
});
}
function resetSearch(completely){
$("#searchbox").removeClass('loading');
if($("#searchbox").val()=='' || completely)$("#searchbox").removeClass('active').val(searchLabel);
$('ul#searchresults').empty().hide();
}
function handleSearchKeyPress(){
if(Math.round(new Date().getTime() / 1000.0) - latestKeyPress < 250) fireSearch($("#searchbox").val());
}
function fireSearch(str){
$("#searchbox").addClass('loading');
$.getJSON('/search/'+str,function(data,status){
$('ul#searchresults').show();
$("#searchbox").removeClass('loading');
if(typeof(data)!=undefined){
$('ul#searchresults').empty().removeClass('no-results');
for(i in data){
$('ul#searchresults').append(""+data[i].Title+"");
for(j in data[i].Issues){
$('ul#searchresults li#project-'+i+' ul.issues').append(""+data[i].Issues[j].StatusLabel+""+data[i].Issues[j].Title+"");
}
}
if($('ul#searchresults ul.issues li').length==0){
$('ul#searchresults').empty().addClass('no-results').html(''+searchNoResults+'');
}else{
$('ul#searchresults > li:first').css('margin-top','0');
$('ul#searchresults ul.issues li:last').css('background','none');
$('ul#searchresults ul.issues a').click(function(e){
e.preventDefault();
$('body').append('');
setTimeout(setCloseIssueFrame, 1);
resetSearch(1);
$('body').unbind('click');
return false;
});
}
}
});
}
function nextClickClosesSearchResults(){
$('body').click(function(e){
if(e.target.tagName!='A'){
resetSearch(1);
$('body').unbind('click');
}
return true;
});
}
/* ISSUE TABLE FUNCTIONALITY */
function initTableSorter(tableID){
if(typeof($.tablesorter) != 'object') return;
if( tableID) tableID="#"+tableID;
if(!tableID) tableID="";
if($('table.issues'+tableID).hasClass('developer')){ /* Is developer */
sorting = [[1,0],[4,0],[6,0],[3,1],[5,0]] ;
$("table.issues"+tableID).each(function(){
if($(this).find('.issue').length && typeof($.tablesorter) == 'object') $(this).tablesorter({
widgets: ["saveSort"],
sortList: sorting
});
});
}else{ /* Is client */
sorting = [[1,0],[4,0],[5,0],[3,1]];
$("table.issues"+tableID).each(function(){
if($(this).find('tr.issue').length>0 && typeof($.tablesorter) == 'object') $(this).tablesorter({
sortList: sorting
});
});
}
}
function initDragReorder(){
if( $('body.client').length>0 || $('.group h3').length<2){
$('.group h3').css('cursor','default');
return;
}
$('#groups').sortable({
'items':'div.group',
'handle':'h3',
'tolerance':'pointer',
'create':function(){
groupHeight = $('div#groups').height();
},
'start':function(){
$('#groups').css('height', (groupHeight) + 'px');
},
'stop':function(event){
$(event.srcElement).closest('div.group').find('h3 img').show();
$('#groups').css('height','auto');
var GroupIDs = new Array();
$('div.group').each(function(){
GroupIDs.push($(this).attr('id').replace('group-',''));
});
var PostData = {
"ReorderGroups":1,
"GroupIDs":GroupIDs
};
$(this).closest('div.group').find('.group-title img').show();
$.post('./',PostData, function(data) {
$('div.group h3 img').hide();
});
}
});
}
function initDragNDrop(){
if($('body').hasClass('read-only')) return;
if($('body.client').length>0 || $('.group h3').length==0){
$('.group h3').css('cursor','default');
if($('body.client').length>0 || $('.group h3').length==0) $('.delete-group').hide();
return;
}
$("body.project.no-touch tr.issue td.title a").each(function(){
$(this).draggable({
helper:'clone',
drag:function(ev,ui){ }
});
});
$("body.project.no-touch .container").droppable({
accept: "td.title a",
activeClass: 'droppable-active',
hoverClass: 'droppable-hover',
drop: function(ev, ui) {
var source = $(ui.draggable[0]).closest('.container');
if($(source).parent().attr('id')==$(this).parent().attr('id')){
$(ui.draggable[0]).show();
return;
}
var GroupID = $(this).find('table.issues').attr('id').replace('issues-','');
var IssueID = $(ui.draggable[0]).parent().parent().attr('id').replace('issue-row-','');
$(ui.draggable[0]).closest('tr').appendTo($(this).find('table.issues')).show();
$(this).find('table.issues').show();
$(this).find('p.no-issues').hide();
/* If this is a new table, apply tableSorter */
if(!$(this).find('th.headerSortDown').length && !$(this).find('th.headerSortUp').length){
initTableSorter($(this).find('table.issues').attr('id'));
}
$(this).find('table.issues').trigger("update");
var PostData = {
"IssueID":IssueID,
"GroupID":GroupID
};
$(this).closest('div.group').find('.group-title img').show();
$.post('./move/',PostData, function(data) {
if($(source).find('tr.issue').length==0) $(source).find('table.issues').closest('.container').addClass('empty');
if($(this).closest('.container').hasClass('hide-fixed')) hideFixed($(this).children('table.issues'));
applyGroupClasses();
$('.group-title img').hide();
});
}
});
}
function applyGroupClasses(){
$('.group .container').each(function(){
$(this).removeClass('contains-fixed');
$(this).removeClass('just-fixed');
$(this).removeClass('empty');
if($(this).find('tr.issue').length > 0 &&
$(this).find('tr.completed').length==$(this).find('tr.issue').length) $(this).addClass('just-fixed');
if($(this).find('tr.issue').length==0) $(this).addClass('empty');
if($(this).find('tr.completed').length>0) $(this).addClass('contains-fixed');
});
}
function refreshList(GroupID){
$.get('./list/'+parseInt(GroupID)+'/?r='+Math.floor(100000*Math.random()), function(data,textStatus,jqXHR) {
$('table#issues-'+GroupID+' tbody').empty();
$('table#issues-'+GroupID+' tbody').show();
$('table#issues-'+GroupID+' tbody').html(data);
$('table#issues-'+GroupID).trigger("update");
evaluateFixed($('table#issues-'+GroupID).closest('.container'));
initDragNDrop();
applyIFrames();
});
}
function evaluateFixed(el){
/* Make the group understand it contains fixed items, if so */
var issueCount = $(el).find('tr.issue').length;
var fixedIssueCount=$(el).find('tr.completed').length;
if(issueCount==0) $(el).closest('.container').addClass('empty');
el.removeClass('just-fixed');
el.removeClass('contains-fixed');
if(fixedIssueCount>0){
el.addClass('contains-fixed');
if(issueCount!=fixedIssueCount){
el.removeClass('just-fixed');
}else{
el.addClass('just-fixed');
}
}else{
el.removeClass('contains-fixed');
el.removeClass('just-fixed');
}
}
function updateGroups(){
applyGroupClasses();
initDragNDrop();
initTableSorter();
}
/* SHOW/HIDE COMPLETED */
function showFixed(el){
$(el).closest('.container').removeClass('hide-fixed').addClass('show-fixed');
/* Move completed issues back down */
var fixedRows = $(el).closest('.container').find('tr.completed');
$(el).closest('.container').find('tr.completed').remove();
$(el).closest('.container').find('tbody').append(fixedRows);
initDragNDrop();
applyIFrames();
}
function hideFixed(el){
$(el).closest('.container').addClass('hide-fixed').removeClass('show-fixed');
}
function prepareColorPicker(){
var f = $.farbtastic('#colorpicker');
var p = $('#colorpicker');
var selected;
$('.status-color-input')
.each(function () { f.linkTo(this); $(this).css('opacity', 0.75); })
.focus(function() {
if (selected) {
$(selected).css('opacity', 0.75).removeClass('colorwell-selected');
}else{
p.hide();
}
f.linkTo(this);
p.show();
$(selected = this).css('opacity', 1).addClass('colorwell-selected');
});
$('.status-color-input').blur(function(e){
el = (undefined!=e.target) ? e.target : e.srcElement;
if(navigator.userAgent.indexOf('MSIE')==-1 && el.id!='colorpicker') p.hide();
});
}
function addFile(el){
$(el).before('
');
$(el).text('Add another file');
if(!$('.save-files').length && $(el).parent().is('#attach-file-form')) $(el).after('or Save file');
if($('input[type="file"]').length>1) $('a.save-files').text("Save files");
}
function expandArrangeProjects(){
$("#arrange-projects-container").show();
$("#expandArrangeProjects").hide();
$('table#arrange-projects').tableDnD({dragHandle: "reorder",onDragClass:"dragging"});
}
function toggleSpecs(){
if($("table.specs").css('display')!='none'){
$("table.specs").hide();
$("#toggleSpecs").removeClass("toggleExpanded");
}else{
$("table.specs").show();
$("#toggleSpecs").addClass("toggleExpanded");
}
}
function toggleHistory(){
if($("div#history").css('display')!='none'){
$("div#history").hide();
$("#toggleHistory").removeClass("toggleExpanded");
}else{
$("div#history").show();
$("#toggleHistory").addClass("toggleExpanded");
}
}
function toggleComments(){
if($("div#comments").css('display')!='none'){
$("div#comments").hide();
$("#toggleComments").removeClass("toggleExpanded");
}else{
$("div#comments").show();
$("#toggleComments").addClass("toggleExpanded");
}
}
function toggleScreenshots(){
if($("div#screenshots").css('display')!='none'){
$("div#screenshots").hide();
$("#toggleScreenshots").removeClass("toggleExpanded");
}else{
$("div#screenshots").show();
$("#toggleScreenshots").addClass("toggleExpanded");
}
}
function toggleCheckbox(identifier){
if(!$(identifier).is("input[type='checkbox']")) return false;
if($(identifier).is(":checked")){
$(identifier).removeAttr('checked');
}else{
$(identifier).attr('checked','checked');
}
}
function markStatusForDeletion(el,message){
var TableRow = $(el).parent().closest('tr');
if(!$(TableRow).hasClass('new-status')){
if(!confirm(message)) return false;
}
$(TableRow).hide();
$(TableRow).find('input.delete').val(1);
}
function markGroupForDeletion(el,message){
var TableRow = $(el).parent().closest('tr');
if(!$(TableRow).hasClass('new-group')){
if(!confirm(message)) return false;
}
$(TableRow).hide();
$(TableRow).find('input.delete').val(1);
}
function toggleStatuses(){
if($('div#statuses').css('display')=='none'){
$('div#statuses').slideDown('fast',function(){
});
}else{
$('div#statuses').slideUp('fast');
}
}
function addStatus(){
var newID = $('table#statuses-table tbody tr').length;
$('table#statuses-table tbody').append(" | | | |
");
prepareColorPicker();
$('table#statuses-table').tableDnD({dragHandle: "reorder",onDragClass:"dragging"});
$('table#statuses-table tr:last input.label').focus();
}
function addGroup(){
var newID = $('table#groups-table tbody tr').length;
$('table#groups-table tbody').append(" | |
");
prepareColorPicker();
$('table#groups-table').tableDnD({dragHandle: "reorder",onDragClass:"dragging"});
$('table#groups-table tr:last input.label').focus();
}
var currentIssue = null;
/* PROJECT TABS */
var hideExcessTabs = false;
var hideExcessTabsTimeout;
function separateProjectTabs(){
/* Reset the tabs area first. */
$('#excesstabs li').removeClass('excess').clone().insertBefore('li#excesspulldown');
$('#excesstabs li').remove();
$('li#excesspulldown').hide();
$('ul#excesstabs').hide();
/* Put excess projects that don't fit in the tab bar, into a pulldown */
if(!isMobile) tabSpaceWidth = $('#page').width() - $('li.new a').width() - 80;
var lastR = 0;
$('ul#tabs li.tab').not('li#excesspulldown').not('li#settings-tab').each(function(){
if($(this).position().left + $(this).width() > tabSpaceWidth || $(this).position().top > 0 ){
if(!$("ul#excesstabs").length) $('#content').prepend("");
$('ul#excesstabs').append($(this));
$(this).addClass('excess');
}else{
lastR = ($(this).position().left + $(this).width());
}
});
// Show/hide
if($('ul#excesstabs li').length>0){
$('li#excesspulldown').show();
if(!isMobile) $('ul#excesstabs').css('left',parseInt($('li#excesspulldown').offset().left) + "px");
$('ul#excesstabs').hide();
$('li#excesspulldown').hover(function(){
$('ul#excesstabs').show();
hideExcessTabs = false;
},function(){
hideExcessTabs = true;
scheduleHideExcessTabsMenu();
});
$('.no-touch ul#excesstabs').hover(function(){
hideExcessTabs = false;
},function(){
hideExcessTabs = true;
scheduleHideExcessTabsMenu();
});
$('ul#excesstabs li').filter(':last').attr('id','lastexcessli');
}
separateProjectTabsPlanned=0;
}
function scheduleHideExcessTabsMenu(){
hideExcessTabsTimeout = setTimeout(hideExcessTabsMenu,200);
}
function hideExcessTabsMenu(){
if(hideExcessTabs) $('ul#excesstabs').hide();
}
/* EMAIL QUOTES */
function showQuotes(el){
$(el).closest('.quotes-container').find('span').show();
$(el).closest('.quotes-container').find('a.show-quotes').hide();
$(el).closest('.quotes-container').find('a.hide-quotes').show();
}
function hideQuotes(el){
$(el).closest('.commentbox').find('.quotes-container span').hide();
$(el).closest('.commentbox').find('a.hide-quotes').hide();
$(el).closest('.commentbox').find('a.show-quotes').show();
$(el).closest('.textfield').find('.quotes-container span').hide();
$(el).closest('.textfield').find('a.hide-quotes').hide();
$(el).closest('.textfield').find('a.show-quotes').show();
}
/* DELETE CONFIRMATIONS */
function deleteProject(el,msg){
if(confirm(msg)){
$(el).closest('form').find('#DeleteProjectID').val($(el).closest('form').find('#ProjectID').val());
$(el).closest('form').submit();
}else{
$(el).closest('form').find('#DeleteProjectID').val('');
}
}
function deleteAttachment(el,msg){
if(confirm(msg)){
$('#DeleteAttachmentID').val($(el).attr('id').replace('delete-attachment-',''));
$('#DeleteAttachmentID').closest('form').submit();
}else{
$('#DeleteAttachmentID').closest('form').find('#DeleteAttachmentID').val('');
}
}
function deleteComment(el,msg){
if(confirm(msg)){
$('#DeleteCommentID').val($(el).attr('id').replace('delete-comment-',''));
$('#DeleteCommentID').closest('form').submit();
}else{
$('#DeleteCommentID').closest('form').find('#DeleteCommentID').val('');
}
}
/* DROP DOWN MENUS */
function showStatusMenu(el,IssueID,GroupID,Status){
$('#prioritymenu').hide();
$('#assigneemenu').hide();
/* Show the on-hover status setting menu */
$('#statusmenu ul li img').hide();
$('#statusmenu').show();
$('#statusmenu').css('visibility','visible');
currentIssue = IssueID;
if(!isMobile){
var left = $(el).position().left + $(el).width() - 65;
var top = $(el).position().top + $(el).closest('.container').position().top;
$('#statusmenu').css('top',top+'px');
$('#statusmenu').css('left',left+'px');
}
$('#statusmenu ul li').unbind('click');
$('#statusmenu ul li').click(function(){
var status = $(this).attr('id').split('_');
status = status[2];
if(status == 'delete'){
if(!confirm(delete_issue_confirmation_message)) return false;
}
$('#statusmenuform input.IssueID').val(currentIssue);
$('#statusmenuform input.GroupID').val(GroupID);
$('#statusmenuform input.Status').val(status);
$('#statusmenuform').submit();
$('#statusmenu').hide();
$('body').unbind('click');
});
var items = $('#statusmenu ul li');
for(i=0;i < items.length;i++){
if($(items[i]).children('a').text() == $(el).text()){
$('#statusmenu ').css('top',( ($('#statusmenu').position().top - 3)- (i * 24))+'px');
$(items[i]).children('img').show();
}
}
$('#statusmenu ul a.close').unbind('click');
$('#statusmenu ul a.close').click(function(){
$('#statusmenu').hide();
$('body').unbind('click');
});
$('.no-touch #statusmenu').hover(function(){},function(){ nextClickClosesDropDown(); });
}
function showPriorityMenu(el,IssueID,GroupID,Priority,View){
$('#statusmenu').hide();
$('#assigneemenu').hide();
/* Show the on-hover priority setting menu */
$('#prioritymenu ul li img').hide();
$('#prioritymenuform').appendTo($('#page'));
$('#prioritymenu').show();
$('#prioritymenu').css('visibility','visible');
var left = $(el).position().left + $(el).width() + 25;
var top = $(el).position().top + $(el).closest('.container').position().top;
currentIssue = IssueID;
$('#prioritymenu').css('top',top+'px');
$('#prioritymenu').css('left',left+'px');
$('#prioritymenu ul li').unbind('click');
$('#prioritymenu ul li').click(function(){
var priority = $(this).attr('id').split('_');
priority = priority[2];
$('#prioritymenuform input.IssueID').val(IssueID);
$('#prioritymenuform input.GroupID').val(GroupID);
$('#prioritymenuform input.Priority').val(priority);
$('#prioritymenuform').submit();
$('#prioritymenu').hide();
$('body').unbind('click');
});
var items = $('#prioritymenu ul li');
for(i=0;i < items.length;i++){
if($(items[i]).children('a').text() == $(el).text()){
$('#prioritymenu').css('top',( ($('#prioritymenu').position().top - 3)- (i * 24))+'px');
$(items[i]).children('img').show();
}
}
$('#prioritymenu ul a.close').unbind('click');
$('#prioritymenu ul a.close').click(function(){
$('#prioritymenu').hide();
$('body').unbind('click');
});
$('.no-touch #prioritymenu').hover(function(){},function(){ nextClickClosesDropDown(); });
}
function showAssigneeMenu(el,IssueID,GroupID,AssigneeIDs,View,doSubmit){
if($('#issueform .AssigneeID').length>0) AssigneeIDs = $('#issueform .AssigneeID').val();
var Assignees = AssigneeIDs.toString().split(',');
$('.simplemenu').hide();
$('#assigneemenu').show();
$('#assigneemenu').css('visibility','visible');
var left = $(el).position().left + $(el).width() + (View ? -30 : -10);
var top = ($(el).position().top + $(el).closest('.container').position().top) - (Math.round($('#assigneemenu')[0].offsetHeight/2)) + 10;
currentIssue = IssueID;
$('#assigneemenu').css('top',top+'px');
$('#assigneemenu').css('left',left+'px');
$('#assigneemenu ul li').removeClass('selected');
$('#assigneemenu ul li').each(function(){
var MyAssigneeID = $(this).attr('id').replace('assignee_li_','');
if(Assignees.indexOf(MyAssigneeID)>-1) $(this).addClass('selected');
});
if($('#assigneemenu ul li.selected').length==0) $('#assignee_li_0').addClass('selected');
$('#assigneemenu ul li a').unbind('click');
$('#assigneemenu ul li a').click(function(){
$(this).parent().toggleClass('selected');
if($(this).parent().attr('id').replace('assignee_li_','') == 0){
$('#assigneemenu ul li').removeClass('selected');
$('#assignee_li_0').addClass('selected');
}
var AssigneesNow = [];
$('#assigneemenu li.selected a').each(function(){
ClickedAssignee = parseInt($(this).parent().attr('id').replace('assignee_li_',''));
if(ClickedAssignee > 0){
$('#assignee_li_0').removeClass('selected');
AssigneesNow.push(ClickedAssignee);
}
});
if(doSubmit){ // Submit and refresh page
$('#assigneemenuform input.IssueID').val(currentIssue);
$('#assigneemenuform input.AssigneeID').val(AssigneesNow.join(',')); // This comes out empty now. Fix.
$('#assigneemenuform input.GroupID').val(GroupID);
$('#assigneemenuform').submit();
}else{// Renew data inline
$('input.AssigneeID').val(AssigneesNow.join(','));
var assignees = [];
$('#assigneemenu li.selected a').each(function(){
assignees.push($(this).text());
});
$(el).html(''+(assignees.length > 0 ? assignees.join(', ') : 'nobody')+'');
if(AssigneesNow.length>1){
$(el).addClass('many');
}else{
$(el).removeClass('many');
}
}
$('body').unbind('click');
});
$('#assigneemenu ul a.close').unbind('click');
$('#assigneemenu ul a.close').click(function(){
$('#assigneemenu').hide();
$('body').unbind('click');
});
$('.no-touch #assigneemenu').hover(function(){},function(){ nextClickClosesDropDown(); });
/* If the list is excessively long, truncate height and make scrollable */
if($('#assigneemenu ul li').length>15){
var altTop = $(el).offset().top - 400;
$('#assigneemenu ul').css({'height':'400px','overflow-y':'auto','width':'120px'});
$('#assigneemenu').css({'top':altTop+'px'});
}
}
function showReporterMenu_edit(el,IssueID,OriginatorID){
$('#statusmenu').hide();
$('#assigneemenu').hide();
$('#prioritymenu').hide();
/* Show the reporter setting menu */
$('div#reportermenu ul li img.pointer').hide();
$('div#reportermenu').show();
$('div#reportermenu').css('visibility','visible');
var left = $(el).position().left + $(el).width() + 25;
var top = $(el).position().top - 25 ;
currentIssue = IssueID;
$('div#reportermenu').css('top',top+'px');
$('div#reportermenu').css('left',left+'px');
$('div#reportermenu ul li a').unbind('click');
$('div#reportermenu ul li a').click(function(){
if($('span.issue-reporter-email').text() == $(this).parent().children('span.email').text()){
$('div#reportermenu').hide();
$('body').unbind('click');
return;
}
var reporter = $(this).parent().attr('id').split('_');
userid = reporter[2];
originatorid = reporter[3];
$('#reportermenuform input.UserID').val(userid);
$('#reportermenuform input.OriginatorID').val(originatorid);
$('#reportermenuform').submit();
$('div#reportermenu').hide();
$('a.originators').html($(this).text());
});
var items = $('div#reportermenu ul li');
for(i=0;i < items.length;i++){
if($(items[i]).children('a').text() == $(el).text()){
$('#reportermenu').css('top',( ($('#reportermenu').position().top -2)- (i * 24))+'px');
$(items[i]).children('img').show();
}
}
$('div#reportermenu ul a.close').unbind('click');
$('div#reportermenu ul a.close').click(function(){
$('div#reportermenu').hide();
});
$('.no-touch #reportermenu').hover(function(){},function(){ nextClickClosesDropDown(); });
}
/* DROP DOWN DISMISSAL */
function nextClickClosesDropDown(){
$('body').click(function(e){
if(e.target.tagName!='A'){
$('#statusmenu').hide();
$('.simplemenu').hide();
$('body').unbind('click');
}
return true;
});
}
/* UTILITY FUNCTIONS */
function detectBrowser(){
var nVer = navigator.appVersion;
var nAgt = navigator.userAgent;
var browserName = navigator.appName;
var fullVersion = ''+parseFloat(navigator.appVersion);
var majorVersion = parseInt(navigator.appVersion,10);
var nameOffset,verOffset,ix;
/* In MSIE, the true version is after "MSIE" in userAgent */
if ((verOffset=nAgt.indexOf("MSIE"))!=-1) {
browserName = "Internet Explorer";
fullVersion = nAgt.substring(verOffset+5);
}
/* In Opera, the true version is after "Opera" */
else if ((verOffset=nAgt.indexOf("Opera"))!=-1) {
browserName = "Opera";
fullVersion = nAgt.substring(verOffset+6);
}
/* In Chrome, the true version is after "Chrome" */
else if ((verOffset=nAgt.indexOf("Chrome"))!=-1) {
browserName = "Chrome";
fullVersion = nAgt.substring(verOffset+7);
}
/* In Safari, the true version is after "Safari" */
else if ((verOffset=nAgt.indexOf("Safari"))!=-1) {
browserName = "Safari";
verOffset = nAgt.indexOf("Version");
fullVersion = nAgt.substring(verOffset+8);
}
/* In Firefox, the true version is after "Firefox" */
else if ((verOffset=nAgt.indexOf("Firefox"))!=-1) {
browserName = "Firefox";
fullVersion = nAgt.substring(verOffset+8);
}
/* In most other browsers, "name/version" is at the end of userAgent */
else if ( (nameOffset=nAgt.lastIndexOf(' ')+1) < (verOffset=nAgt.lastIndexOf('/')) )
{
browserName = nAgt.substring(nameOffset,verOffset);
fullVersion = nAgt.substring(verOffset+1);
if (browserName.toLowerCase()==browserName.toUpperCase()) {
browserName = navigator.appName;
}
}
/* trim the fullVersion string at semicolon/space if present */
if ((ix=fullVersion.indexOf(";"))!=-1) fullVersion=fullVersion.substring(0,ix);
if ((ix=fullVersion.indexOf(" "))!=-1) fullVersion=fullVersion.substring(0,ix);
majorVersion = parseInt(''+fullVersion,10);
if (isNaN(majorVersion)) {
fullVersion = ''+parseFloat(navigator.appVersion);
majorVersion = parseInt(navigator.appVersion,10);
}
return {browserName:browserName,majorVersion:majorVersion,fullVersion:fullVersion};
}
function trim12 (str) {
varstr = str.replace(/^\s\s*/, ''),
ws = /\s/,
i = str.length;
while (ws.test(str.charAt(--i)));
return str.slice(0, i + 1);
}
function toggleFeedback(){
if($('#feedback-form').css('display')=='none'){
$('#feedback-form').css('display','block');
$('#feedback-tab').hide();
$('.no-touch div#feedback-form').hover(function(){},function(){ nextClickClosesFeedback(); });
}else{
$('#feedback-form').css('display','none');
$('#feedback-tab').show();
}
}
function nextClickClosesFeedback(){
$('body').click(function(e){
if(e.target.tagName!='A'){
$('#feedback-form').css('display','none');
$('#feedback-tab').show();
$('body').unbind('click');
}
return true;
});
}
function validateContactForm(){
var foo = (15 - 1);
$('input#captchanum').removeClass('wrong');
if( document.getElementById('captchanum').value != foo &&
document.getElementById('captchanum').value != 'veertien' &&
document.getElementById('captchanum').value != 'fourteen'){
$('input#captchanum').addClass('wrong');
return false;
}
return true;
}
function handleVAT(){
if($('#recurly-form .vat').hasClass('applicable')){
$('.vat-container').empty();
$('.vat *').clone().appendTo('.vat-container');
$('.due_now *').clone().appendTo('.vat-container').show();
$('#recurly-form .vat').hide();
$('#recurly-form .due_now').hide();
$('.vat-container').show();
$('.vat-explain').show();
}else{
$('.vat-container').empty();
$('.vat-explain').hide();
$('.vat').hide();
$('.due_now').hide();
}
}
/* Horizontal mode related functionality */
$.fn.hasOverflow = function() {
//note: clientHeight= height of holder
//scrollHeight= we have content till this height
var _elm = $(this)[0];
var _hasScrollBar = false;
if ((_elm.clientHeight < _elm.scrollHeight) || (_elm.clientWidth < _elm.scrollWidth)) {
_hasScrollBar = true;
}
return _hasScrollBar;
}
function toggleHorizontalMode(el) {
$('body').toggleClass('horizontal-mode');
if($('body').hasClass('horizontal-mode')){
$('#hint-inline-add').hide();
$('#hint-add-group').hide();
}
$(el).toggleClass('active');
dismissHint('horizontal-hint');
visualizeOverflow();
separateProjectTabs();
createCookie('horizontal-'+ProjectID,$('body').hasClass('horizontal-mode'),1825);
}
function toggleMeta(){
$('body').toggleClass('horizontal-mode-meta');
createCookie('horizontal-'+ProjectID,$('body').hasClass('horizontal-mode-meta'),1825);
visualizeOverflow();
}
window.onresize = function(){
if($('body').hasClass('horizontal-mode')) visualizeOverflow();
}
function visualizeOverflow(){
$('#groups').removeAttr('style');
if($('body').hasClass('horizontal-mode')){
$('#groups').css('width',(($('.group').length * ($('body').hasClass('horizontal-mode-meta') ? 240 : 220 ) )+ 230)+'px');
el = $('#board').get(0);
if(el.scrollLeft>0){
$(el).parent().addClass('scroll');
}else{
$(el).parent().removeClass('scroll');
}
if($('#board').hasOverflow()){
if(el.offsetWidth + el.scrollLeft >= el.scrollWidth){
$('#board').removeClass('overflow');
}else{
$('#board').addClass('overflow');
}
}
}
}
function closeIssueFrame(IssueID,RefreshGroupID){
if(IssueID != undefined){
var container = $("#issue-row-"+IssueID).closest('.container');
$("#issue-row-"+IssueID).remove();
evaluateFixed(container);
}
if(RefreshGroupID!=undefined){
refreshList(RefreshGroupID);
}
$("#frame-wrap").remove();
}
function setIFrameHeight(h){
if( frameContainer = window.top.document.getElementById('frame-wrap-container')){
if(h > (.9 * document.body.offsetHeight )){
frameContainer.style.height = "90%";
frameContainer.style.top = '5%';
frameContainer.style.marginTop = "0";
}else{
frameContainer.style.height = h + "px";
frameContainer.style.top = '50%';
frameContainer.style.marginTop = (-1 * (h/2)) + "px";
}
}
return frameContainer.offsetHeight;
}
function nl2br (str, is_xhtml) {
var breakTag = (is_xhtml || typeof is_xhtml === 'undefined') ? '
' : '
';
return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + breakTag + '$2');
};
$(document).ready(function(){
$('form').submit(function(){
if(typeof(_gaq)!="undefined")_gaq.push(['_trackEvent', 'Form Submit', $(this).attr('id'), document.title]);
});
});;
/**
* TableDnD plug-in for JQuery, allows you to drag and drop table rows
* You can set up various options to control how the system will work
* Copyright (c) Denis Howlett
* Licensed like jQuery, see http://docs.jquery.com/License.
*
* Configuration options:
*
* onDragStyle
* This is the style that is assigned to the row during drag. There are limitations to the styles that can be
* associated with a row (such as you can't assign a border--well you can, but it won't be
* displayed). (So instead consider using onDragClass.) The CSS style to apply is specified as
* a map (as used in the jQuery css(...) function).
* onDropStyle
* This is the style that is assigned to the row when it is dropped. As for onDragStyle, there are limitations
* to what you can do. Also this replaces the original style, so again consider using onDragClass which
* is simply added and then removed on drop.
* onDragClass
* This class is added for the duration of the drag and then removed when the row is dropped. It is more
* flexible than using onDragStyle since it can be inherited by the row cells and other content. The default
* is class is tDnD_whileDrag. So to use the default, simply customise this CSS class in your
* stylesheet.
* onDrop
* Pass a function that will be called when the row is dropped. The function takes 2 parameters: the table
* and the row that was dropped. You can work out the new order of the rows by using
* table.rows.
* onDragStart
* Pass a function that will be called when the user starts dragging. The function takes 2 parameters: the
* table and the row which the user has started to drag.
* onAllowDrop
* Pass a function that will be called as a row is over another row. If the function returns true, allow
* dropping on that row, otherwise not. The function takes 2 parameters: the dragged row and the row under
* the cursor. It returns a boolean: true allows the drop, false doesn't allow it.
* scrollAmount
* This is the number of pixels to scroll if the user moves the mouse cursor to the top or bottom of the
* window. The page should automatically scroll up or down as appropriate (tested in IE6, IE7, Safari, FF2,
* FF3 beta
* dragHandle
* This is the name of a class that you assign to one or more cells in each row that is draggable. If you
* specify this class, then you are responsible for setting cursor: move in the CSS and only these cells
* will have the drag behaviour. If you do not specify a dragHandle, then you get the old behaviour where
* the whole row is draggable.
*
* Other ways to control behaviour:
*
* Add class="nodrop" to any rows for which you don't want to allow dropping, and class="nodrag" to any rows
* that you don't want to be draggable.
*
* Inside the onDrop method you can also call $.tableDnD.serialize() this returns a string of the form
* []=&[]= so that you can send this back to the server. The table must have
* an ID as must all the rows.
*
* Other methods:
*
* $("...").tableDnDUpdate()
* Will update all the matching tables, that is it will reapply the mousedown method to the rows (or handle cells).
* This is useful if you have updated the table rows using Ajax and you want to make the table draggable again.
* The table maintains the original configuration (so you don't have to specify it again).
*
* $("...").tableDnDSerialize()
* Will serialize and return the serialized string as above, but for each of the matching tables--so it can be
* called from anywhere and isn't dependent on the currentTable being set up correctly before calling
*
* Known problems:
* - Auto-scoll has some problems with IE7 (it scrolls even when it shouldn't), work-around: set scrollAmount to 0
*
* Version 0.2: 2008-02-20 First public version
* Version 0.3: 2008-02-07 Added onDragStart option
* Made the scroll amount configurable (default is 5 as before)
* Version 0.4: 2008-03-15 Changed the noDrag/noDrop attributes to nodrag/nodrop classes
* Added onAllowDrop to control dropping
* Fixed a bug which meant that you couldn't set the scroll amount in both directions
* Added serialize method
* Version 0.5: 2008-05-16 Changed so that if you specify a dragHandle class it doesn't make the whole row
* draggable
* Improved the serialize method to use a default (and settable) regular expression.
* Added tableDnDupate() and tableDnDSerialize() to be called when you are outside the table
*/
jQuery.tableDnD = {
/** Keep hold of the current table being dragged */
currentTable : null,
/** Keep hold of the current drag object if any */
dragObject: null,
/** The current mouse offset */
mouseOffset: null,
/** Remember the old value of Y so that we don't do too much processing */
oldY: 0,
/** Actually build the structure */
build: function(options) {
// Set up the defaults if any
this.each(function() {
// This is bound to each matching table, set up the defaults and override with user options
this.tableDnDConfig = jQuery.extend({
onDragStyle: null,
onDropStyle: null,
// Add in the default class for whileDragging
onDragClass: "tDnD_whileDrag",
onDrop: null,
onDragStart: null,
scrollAmount: 5,
serializeRegexp: /[^\-]*$/, // The regular expression to use to trim row IDs
serializeParamName: null, // If you want to specify another parameter name instead of the table ID
dragHandle: null // If you give the name of a class here, then only Cells with this class will be draggable
}, options || {});
// Now make the rows draggable
jQuery.tableDnD.makeDraggable(this);
});
// Now we need to capture the mouse up and mouse move event
// We can use bind so that we don't interfere with other event handlers
jQuery(document)
.bind('mousemove', jQuery.tableDnD.mousemove)
.bind('mouseup', jQuery.tableDnD.mouseup);
// Don't break the chain
return this;
},
/** This function makes all the rows on the table draggable apart from those marked as "NoDrag" */
makeDraggable: function(table) {
var config = table.tableDnDConfig;
if (table.tableDnDConfig.dragHandle) {
// We only need to add the event to the specified cells
var cells = jQuery("td."+table.tableDnDConfig.dragHandle, table);
cells.each(function() {
// The cell is bound to "this"
jQuery(this).mousedown(function(ev) {
jQuery.tableDnD.dragObject = this.parentNode;
jQuery.tableDnD.currentTable = table;
jQuery.tableDnD.mouseOffset = jQuery.tableDnD.getMouseOffset(this, ev);
if (config.onDragStart) {
// Call the onDrop method if there is one
config.onDragStart(table, this);
}
return false;
});
})
} else {
// For backwards compatibility, we add the event to the whole row
var rows = jQuery("tr", table); // get all the rows as a wrapped set
rows.each(function() {
// Iterate through each row, the row is bound to "this"
var row = jQuery(this);
if (! row.hasClass("nodrag")) {
row.mousedown(function(ev) {
if (ev.target.tagName == "TD") {
jQuery.tableDnD.dragObject = this;
jQuery.tableDnD.currentTable = table;
jQuery.tableDnD.mouseOffset = jQuery.tableDnD.getMouseOffset(this, ev);
if (config.onDragStart) {
// Call the onDrop method if there is one
config.onDragStart(table, this);
}
return false;
}
}).css("cursor", "move"); // Store the tableDnD object
}
});
}
},
updateTables: function() {
this.each(function() {
// this is now bound to each matching table
if (this.tableDnDConfig) {
jQuery.tableDnD.makeDraggable(this);
}
})
},
/** Get the mouse coordinates from the event (allowing for browser differences) */
mouseCoords: function(ev){
if(ev.pageX || ev.pageY){
return {x:ev.pageX, y:ev.pageY};
}
return {
x:ev.clientX + document.body.scrollLeft - document.body.clientLeft,
y:ev.clientY + document.body.scrollTop - document.body.clientTop
};
},
/** Given a target element and a mouse event, get the mouse offset from that element.
To do this we need the element's position and the mouse position */
getMouseOffset: function(target, ev) {
ev = ev || window.event;
var docPos = this.getPosition(target);
var mousePos = this.mouseCoords(ev);
return {x:mousePos.x - docPos.x, y:mousePos.y - docPos.y};
},
/** Get the position of an element by going up the DOM tree and adding up all the offsets */
getPosition: function(e){
var left = 0;
var top = 0;
/** Safari fix -- thanks to Luis Chato for this! */
if (e.offsetHeight == 0) {
/** Safari 2 doesn't correctly grab the offsetTop of a table row
this is detailed here:
http://jacob.peargrove.com/blog/2006/technical/table-row-offsettop-bug-in-safari/
the solution is likewise noted there, grab the offset of a table cell in the row - the firstChild.
note that firefox will return a text node as a first child, so designing a more thorough
solution may need to take that into account, for now this seems to work in firefox, safari, ie */
e = e.firstChild; // a table cell
}
while (e.offsetParent){
left += e.offsetLeft;
top += e.offsetTop;
e = e.offsetParent;
}
left += e.offsetLeft;
top += e.offsetTop;
return {x:left, y:top};
},
mousemove: function(ev) {
if (jQuery.tableDnD.dragObject == null) {
return;
}
var dragObj = jQuery(jQuery.tableDnD.dragObject);
var config = jQuery.tableDnD.currentTable.tableDnDConfig;
var mousePos = jQuery.tableDnD.mouseCoords(ev);
var y = mousePos.y - jQuery.tableDnD.mouseOffset.y;
//auto scroll the window
var yOffset = window.pageYOffset;
if (document.all) {
// Windows version
//yOffset=document.body.scrollTop;
if (typeof document.compatMode != 'undefined' &&
document.compatMode != 'BackCompat') {
yOffset = document.documentElement.scrollTop;
}
else if (typeof document.body != 'undefined') {
yOffset=document.body.scrollTop;
}
}
if (mousePos.y-yOffset < config.scrollAmount) {
window.scrollBy(0, -config.scrollAmount);
} else {
var windowHeight = window.innerHeight ? window.innerHeight
: document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
if (windowHeight-(mousePos.y-yOffset) < config.scrollAmount) {
window.scrollBy(0, config.scrollAmount);
}
}
if (y != jQuery.tableDnD.oldY) {
// work out if we're going up or down...
var movingDown = y > jQuery.tableDnD.oldY;
// update the old value
jQuery.tableDnD.oldY = y;
// update the style to show we're dragging
if (config.onDragClass) {
dragObj.addClass(config.onDragClass);
} else {
dragObj.css(config.onDragStyle);
}
// If we're over a row then move the dragged row to there so that the user sees the
// effect dynamically
var currentRow = jQuery.tableDnD.findDropTargetRow(dragObj, y);
if (currentRow) {
// TODO worry about what happens when there are multiple TBODIES
if (movingDown && jQuery.tableDnD.dragObject != currentRow) {
jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject, currentRow.nextSibling);
} else if (! movingDown && jQuery.tableDnD.dragObject != currentRow) {
jQuery.tableDnD.dragObject.parentNode.insertBefore(jQuery.tableDnD.dragObject, currentRow);
}
}
}
return false;
},
/** We're only worried about the y position really, because we can only move rows up and down */
findDropTargetRow: function(draggedRow, y) {
var rows = jQuery.tableDnD.currentTable.rows;
for (var i=0; i rowY - rowHeight) && (y < (rowY + rowHeight))) {
// that's the row we're over
// If it's the same as the current row, ignore it
if (row == draggedRow) {return null;}
var config = jQuery.tableDnD.currentTable.tableDnDConfig;
if (config.onAllowDrop) {
if (config.onAllowDrop(draggedRow, row)) {
return row;
} else {
return null;
}
} else {
// If a row has nodrop class, then don't allow dropping (inspired by John Tarr and Famic)
var nodrop = jQuery(row).hasClass("nodrop");
if (! nodrop) {
return row;
} else {
return null;
}
}
return row;
}
}
return null;
},
mouseup: function(e) {
if (jQuery.tableDnD.currentTable && jQuery.tableDnD.dragObject) {
var droppedRow = jQuery.tableDnD.dragObject;
var config = jQuery.tableDnD.currentTable.tableDnDConfig;
// If we have a dragObject, then we need to release it,
// The row will already have been moved to the right place so we just reset stuff
if (config.onDragClass) {
jQuery(droppedRow).removeClass(config.onDragClass);
} else {
jQuery(droppedRow).css(config.onDropStyle);
}
jQuery.tableDnD.dragObject = null;
if (config.onDrop) {
// Call the onDrop method if there is one
config.onDrop(jQuery.tableDnD.currentTable, droppedRow);
}
jQuery.tableDnD.currentTable = null; // let go of the table too
}
},
serialize: function() {
if (jQuery.tableDnD.currentTable) {
return jQuery.tableDnD.serializeTable(jQuery.tableDnD.currentTable);
} else {
return "Error: No Table id set, you need to set an id on your table and every row";
}
},
serializeTable: function(table) {
var result = "";
var tableId = table.id;
var rows = table.rows;
for (var i=0; i 0) result += "&";
var rowId = rows[i].id;
if (rowId && rowId && table.tableDnDConfig && table.tableDnDConfig.serializeRegexp) {
rowId = rowId.match(table.tableDnDConfig.serializeRegexp)[0];
}
result += tableId + '[]=' + rowId;
}
return result;
},
serializeTables: function() {
var result = "";
this.each(function() {
// this is now bound to each matching table
result += jQuery.tableDnD.serializeTable(this);
});
return result;
}
}
jQuery.fn.extend(
{
tableDnD : jQuery.tableDnD.build,
tableDnDUpdate : jQuery.tableDnD.updateTables,
tableDnDSerialize: jQuery.tableDnD.serializeTables
}
);;
// retina.js, a high-resolution image swapper (http://retinajs.com), v0.0.2
(function(){function t(e){this.path=e;var t=this.path.split("."),n=t.slice(0,t.length-1).join("."),r=t[t.length-1];this.at_2x_path=n+"@2x."+r}function n(e){this.el=e,this.path=new t(this.el.getAttribute("src"));var n=this;this.path.check_2x_variant(function(e){e&&n.swap()})}var e=typeof exports=="undefined"?window:exports;e.RetinaImagePath=t,t.confirmed_paths=[],t.prototype.is_external=function(){return!!this.path.match(/^https?\:/i)&&!this.path.match("//"+document.domain)},t.prototype.check_2x_variant=function(e){var n,r=this;if(this.is_external())return e(!1);if(this.at_2x_path in t.confirmed_paths)return e(!0);n=new XMLHttpRequest,n.open("HEAD",this.at_2x_path),n.onreadystatechange=function(){return n.readyState!=4?e(!1):n.status>=200&&n.status<=399?(t.confirmed_paths.push(r.at_2x_path),e(!0)):e(!1)},n.send()},e.RetinaImage=n,n.prototype.swap=function(e){function n(){t.el.complete?(t.el.setAttribute("width",t.el.offsetWidth),t.el.setAttribute("height",t.el.offsetHeight),t.el.setAttribute("src",e)):setTimeout(n,5)}typeof e=="undefined"&&(e=this.path.at_2x_path);var t=this;n()},e.devicePixelRatio>1&&(window.onload=function(){var e=document.getElementsByTagName("img"),t=[],r,i;for(r=0;r