rem
stringlengths
0
126k
add
stringlengths
0
441k
context
stringlengths
15
136k
"Content";Xmla.PROP_CONTENT_DATA="Data";Xmla.PROP_CONTENT_NONE="None";Xmla.PROP_CONTENT_SCHEMA="Schema";Xmla.PROP_CONTENT_SCHEMADATA="SchemaData";Xmla.prototype={listeners:null,soapMessage:null,response:null,responseText:null,responseXml:null,setOptions:function(a){h(this.options,a,true)},addListener:function(a){var b=a.events;j(b)&&Xmla.Exception._newError("NO_EVENTS_SPECIFIED","Xmla.addListener",a)._throw();if(N(b))b=b==="all"?Xmla.EVENT_ALL:b.split(",");b instanceof Array||Xmla.Exception._newError("WRONG_EVENTS_FORMAT",
"CustomFormat";Xmla.PROP_CONTENT="Content";Xmla.PROP_CONTENT_DATA="Data";Xmla.PROP_CONTENT_NONE="None";Xmla.PROP_CONTENT_SCHEMA="Schema";Xmla.PROP_CONTENT_SCHEMADATA="SchemaData";Xmla.prototype={listeners:null,soapMessage:null,response:null,responseText:null,responseXml:null,setOptions:function(a){g(this.options,a,true)},addListener:function(a){var b=a.events;j(b)&&Xmla.Exception._newError("NO_EVENTS_SPECIFIED","Xmla.addListener",a)._throw();if(N(b))b=b==="all"?Xmla.EVENT_ALL:b.split(",");b instanceof
"Content";Xmla.PROP_CONTENT_DATA="Data";Xmla.PROP_CONTENT_NONE="None";Xmla.PROP_CONTENT_SCHEMA="Schema";Xmla.PROP_CONTENT_SCHEMADATA="SchemaData";Xmla.prototype={listeners:null,soapMessage:null,response:null,responseText:null,responseXml:null,setOptions:function(a){h(this.options,a,true)},addListener:function(a){var b=a.events;j(b)&&Xmla.Exception._newError("NO_EVENTS_SPECIFIED","Xmla.addListener",a)._throw();if(N(b))b=b==="all"?Xmla.EVENT_ALL:b.split(",");b instanceof Array||Xmla.Exception._newError("WRONG_EVENTS_FORMAT",
setSelection : function(start, end)
this.setSelection = function(start, end)
setSelection : function(start, end) { //editAreaLoader.setSelectionRange('abc', pos, parseInt(pos)+1); $(this._id).setSelectionRange(start,end); $(this._id).focus(); },
},
};
setSelection : function(start, end) { //editAreaLoader.setSelectionRange('abc', pos, parseInt(pos)+1); $(this._id).setSelectionRange(start,end); $(this._id).focus(); },
"");return{start:a,end:b.length+a}}else{f=$(a).val();a=document.selection.createRange().duplicate();a.moveEnd("character",f.length);b=a.text==""?f.length:f.lastIndexOf(a.text);a=document.selection.createRange().duplicate();a.moveStart("character",-f.length);return{start:b,end:a.text.length}}else return a.selectionStart||a.selectionStart==0?{start:a.selectionStart,end:a.selectionEnd}:{start:-1,end:-1}};this.setSelectionRange=function(a,b,f){var l=$(a).val();if(typeof b!="number")b=-1;if(typeof f!= "number")f=-1;if(b<0)b=0;if(f>l.length)f=l.length;if(f<b)f=b;if(b>f)b=f;a.focus();if(typeof a.selectionStart!=="undefined"){a.selectionStart=b;a.selectionEnd=f}else if(document.selection){a=a.createTextRange();a.collapse(true);a.moveStart("character",b);a.moveEnd("character",f-b);a.select()}};this.isKeyPress=function(a){if(!a)a=window.event;if(a.altKey||a.ctrlKey||a.metaKey)return false;return(typeof a.charCode!=="undefined"?a.charCode:0)>0||g.isIE?true:g.isOpera?a.keyCode==13||a.keyCode==27||a.keyCode>=
0?{start:a.selectionStart,end:a.selectionEnd}:{start:-1,end:-1}};this.setSelectionRange=function(a,b,f){var l=$(a).val();if(typeof b!="number")b=-1;if(typeof f!="number")f=-1;if(b<0)b=0;if(f>l.length)f=l.length;if(f<b)f=b;if(b>f)b=f;a.focus();if(typeof a.selectionStart!=="undefined"){a.selectionStart=b;a.selectionEnd=f}else if(document.selection){a=a.createTextRange();a.collapse(true);a.moveStart("character",b);a.moveEnd("character",f-b);a.select()}};this.isKeyPress=function(a){if(!a)a=window.event;
"");return{start:a,end:b.length+a}}else{f=$(a).val();a=document.selection.createRange().duplicate();a.moveEnd("character",f.length);b=a.text==""?f.length:f.lastIndexOf(a.text);a=document.selection.createRange().duplicate();a.moveStart("character",-f.length);return{start:b,end:a.text.length}}else return a.selectionStart||a.selectionStart==0?{start:a.selectionStart,end:a.selectionEnd}:{start:-1,end:-1}};this.setSelectionRange=function(a,b,f){var l=$(a).val();if(typeof b!="number")b=-1;if(typeof f!="number")f=-1;if(b<0)b=0;if(f>l.length)f=l.length;if(f<b)f=b;if(b>f)b=f;a.focus();if(typeof a.selectionStart!=="undefined"){a.selectionStart=b;a.selectionEnd=f}else if(document.selection){a=a.createTextRange();a.collapse(true);a.moveStart("character",b);a.moveEnd("character",f-b);a.select()}};this.isKeyPress=function(a){if(!a)a=window.event;if(a.altKey||a.ctrlKey||a.metaKey)return false;return(typeof a.charCode!=="undefined"?a.charCode:0)>0||g.isIE?true:g.isOpera?a.keyCode==13||a.keyCode==27||a.keyCode>=
if (elem.selectionStart != undefined) {
if (typeof elem.selectionStart !== 'undefined') {
this.setSelectionRange = function(elem, start, end) { /** * @preserve Includes jQuery Caret Range plugin * Copyright (c) 2009 Matt Zabriskie * Released under the MIT and GPL licenses. */ var val = $(elem).val(); if (typeof start != "number") start = -1; if (typeof end != "number") end = -1; if (start < 0) start = 0; if (end > val.length) end = val.length; if (end < start) end = start; if (start > end) start = end; elem.focus(); if (elem.selectionStart != undefined) { elem.selectionStart = start; elem.selectionEnd = end; } else if (document.selection) { var range = elem.createTextRange(); range.collapse(true); range.moveStart("character", start); range.moveEnd("character", end - start); range.select(); }};
end:b.length+a}}else{f=$(a).val();a=document.selection.createRange().duplicate();a.moveEnd("character",f.length);b=a.text==""?f.length:f.lastIndexOf(a.text);a=document.selection.createRange().duplicate();a.moveStart("character",-f.length);return{start:b,end:a.text.length}}else return a.selectionStart||a.selectionStart==0?{start:a.selectionStart,end:a.selectionEnd}:{start:-1,end:-1}};this.setSelectionRange=function(a,b,f){var l=$(a).val();if(typeof b!="number")b=-1;if(typeof f!="number")f=-1;if(b< 0)b=0;if(f>l.length)f=l.length;if(f<b)f=b;if(b>f)b=f;a.focus();if(a.selectionStart!=undefined){a.selectionStart=b;a.selectionEnd=f}else if(document.selection){a=a.createTextRange();a.collapse(true);a.moveStart("character",b);a.moveEnd("character",f-b);a.select()}};this.isKeyPress=function(a){if(!a)a=window.event;if(a.altKey||a.ctrlKey||a.metaKey)return false;return(typeof a.charCode!=="undefined"?a.charCode:0)>0||g.isIE?true:g.isOpera?a.keyCode==13||a.keyCode==27||a.keyCode>=32&&a.keyCode<125:a.keyCode==
"");return{start:a,end:b.length+a}}else{f=$(a).val();a=document.selection.createRange().duplicate();a.moveEnd("character",f.length);b=a.text==""?f.length:f.lastIndexOf(a.text);a=document.selection.createRange().duplicate();a.moveStart("character",-f.length);return{start:b,end:a.text.length}}else return a.selectionStart||a.selectionStart==0?{start:a.selectionStart,end:a.selectionEnd}:{start:-1,end:-1}};this.setSelectionRange=function(a,b,f){var l=$(a).val();if(typeof b!="number")b=-1;if(typeof f!= "number")f=-1;if(b<0)b=0;if(f>l.length)f=l.length;if(f<b)f=b;if(b>f)b=f;a.focus();if(typeof a.selectionStart!=="undefined"){a.selectionStart=b;a.selectionEnd=f}else if(document.selection){a=a.createTextRange();a.collapse(true);a.moveStart("character",b);a.moveEnd("character",f-b);a.select()}};this.isKeyPress=function(a){if(!a)a=window.event;if(a.altKey||a.ctrlKey||a.metaKey)return false;return(typeof a.charCode!=="undefined"?a.charCode:0)>0||g.isIE?true:g.isOpera?a.keyCode==13||a.keyCode==27||a.keyCode>=
end:b.length+a}}else{f=$(a).val();a=document.selection.createRange().duplicate();a.moveEnd("character",f.length);b=a.text==""?f.length:f.lastIndexOf(a.text);a=document.selection.createRange().duplicate();a.moveStart("character",-f.length);return{start:b,end:a.text.length}}else return a.selectionStart||a.selectionStart==0?{start:a.selectionStart,end:a.selectionEnd}:{start:-1,end:-1}};this.setSelectionRange=function(a,b,f){var l=$(a).val();if(typeof b!="number")b=-1;if(typeof f!="number")f=-1;if(b<0)b=0;if(f>l.length)f=l.length;if(f<b)f=b;if(b>f)b=f;a.focus();if(a.selectionStart!=undefined){a.selectionStart=b;a.selectionEnd=f}else if(document.selection){a=a.createTextRange();a.collapse(true);a.moveStart("character",b);a.moveEnd("character",f-b);a.select()}};this.isKeyPress=function(a){if(!a)a=window.event;if(a.altKey||a.ctrlKey||a.metaKey)return false;return(typeof a.charCode!=="undefined"?a.charCode:0)>0||g.isIE?true:g.isOpera?a.keyCode==13||a.keyCode==27||a.keyCode>=32&&a.keyCode<125:a.keyCode==
this.setSelectionRange=function(a,b,e){var k=$(a).val();if(typeof b!="number")b=-1;if(typeof e!="number")e=-1;if(b<0)b=0;if(e>k.length)e=k.length;if(e<b)e=b;if(b>e)b=e;a.focus();if(a.selectionStart!=undefined){a.selectionStart=b;a.selectionEnd=e}else if(document.selection){a=a.createTextRange();a.collapse(true);a.moveStart("character",b);a.moveEnd("character",e-b);a.select()}};this.isKeyPress=function(a){if(!a)a=window.event;if(a.altKey||a.ctrlKey||a.metaKey)return false;return(typeof a.charCode!==
this.setSelectionRange=function(a,b,e){var j=$(a).val();if(typeof b!="number")b=-1;if(typeof e!="number")e=-1;if(b<0)b=0;if(e>j.length)e=j.length;if(e<b)e=b;if(b>e)b=e;a.focus();if(a.selectionStart!=undefined){a.selectionStart=b;a.selectionEnd=e}else if(document.selection){a=a.createTextRange();a.collapse(true);a.moveStart("character",b);a.moveEnd("character",e-b);a.select()}};this.isKeyPress=function(a){if(!a)a=window.event;if(a.altKey||a.ctrlKey||a.metaKey)return false;return(typeof a.charCode!==
this.setSelectionRange=function(a,b,e){var k=$(a).val();if(typeof b!="number")b=-1;if(typeof e!="number")e=-1;if(b<0)b=0;if(e>k.length)e=k.length;if(e<b)e=b;if(b>e)b=e;a.focus();if(a.selectionStart!=undefined){a.selectionStart=b;a.selectionEnd=e}else if(document.selection){a=a.createTextRange();a.collapse(true);a.moveStart("character",b);a.moveEnd("character",e-b);a.select()}};this.isKeyPress=function(a){if(!a)a=window.event;if(a.altKey||a.ctrlKey||a.metaKey)return false;return(typeof a.charCode!==
k.length;if(e<b)e=b;if(b>e)b=e;a.focus();if(a.selectionStart!=undefined){a.selectionStart=b;a.selectionEnd=e}else if(document.selection){a=a.createTextRange();a.collapse(true);a.moveStart("character",b);a.moveEnd("character",e-b);a.select()}};this.isKeyPress=function(a){if(!a)a=window.event;if(a.altKey||a.ctrlKey||a.metaKey)return false;return(typeof a.charCode!=="undefined"?a.charCode:0)>0||g.isIE?true:a.keyCode==13||a.keyCode==27||a.keyCode==32||a.keyCode>46&&a.keyCode<112};var X=/^-?\d+(?:px)?$/i;
k.length;if(e<b)e=b;if(b>e)b=e;a.focus();if(a.selectionStart!=undefined){a.selectionStart=b;a.selectionEnd=e}else if(document.selection){a=a.createTextRange();a.collapse(true);a.moveStart("character",b);a.moveEnd("character",e-b);a.select()}};this.isKeyPress=function(a){if(!a)a=window.event;if(a.altKey||a.ctrlKey||a.metaKey)return false;return(typeof a.charCode!=="undefined"?a.charCode:0)>0||h.isIE?true:a.keyCode==13||a.keyCode==27||a.keyCode==32||a.keyCode>46&&a.keyCode<112};var X=/^-?\d+(?:px)?$/i;
function(a){var b,e;if(a.selectionStart!=undefined){b=a.selectionStart;e=a.selectionEnd}else if(document.selection){a=$(a).val();e=document.selection.createRange().duplicate();e.moveEnd("character",a.length);b=e.text==""?a.length:a.lastIndexOf(e.text);e=document.selection.createRange().duplicate();e.moveStart("character",-a.length);e=e.text.length}return{start:b,end:e}};this.setSelectionRange=function(a,b,e){var k=$(a).val();if(typeof b!="number")b=-1;if(typeof e!="number")e=-1;if(b<0)b=0;if(e>k.length)e=k.length;if(e<b)e=b;if(b>e)b=e;a.focus();if(a.selectionStart!=undefined){a.selectionStart=b;a.selectionEnd=e}else if(document.selection){a=a.createTextRange();a.collapse(true);a.moveStart("character",b);a.moveEnd("character",e-b);a.select()}};this.isKeyPress=function(a){if(!a)a=window.event;if(a.altKey||a.ctrlKey||a.metaKey)return false;return(typeof a.charCode!=="undefined"?a.charCode:0)>0||g.isIE?true:a.keyCode==13||a.keyCode==27||a.keyCode==32||a.keyCode>46&&a.keyCode<112};var X=/^-?\d+(?:px)?$/i;
a.selectionStart==0?{start:a.selectionStart,end:a.selectionEnd}:{start:-1,end:-1}};this.setSelectionRange=function(a,b,f){var h=$(a).val();if(typeof b!="number")b=-1;if(typeof f!="number")f=-1;if(b<0)b=0;if(f>h.length)f=h.length;if(f<b)f=b;if(b>f)b=f;a.focus();if(a.selectionStart!=undefined){a.selectionStart=b;a.selectionEnd=f}else if(document.selection){a=a.createTextRange();a.collapse(true);a.moveStart("character",b);a.moveEnd("character",f-b);a.select()}};this.isKeyPress=function(a){if(!a)a=window.event;
f.length);b=a.text==""?f.length:f.lastIndexOf(a.text);a=document.selection.createRange().duplicate();a.moveStart("character",-f.length);return{start:b,end:a.text.length}}else return a.selectionStart||a.selectionStart==0?{start:a.selectionStart,end:a.selectionEnd}:{start:-1,end:-1}};this.setSelectionRange=function(a,b,f){var h=$(a).val();if(typeof b!="number")b=-1;if(typeof f!="number")f=-1;if(b<0)b=0;if(f>h.length)f=h.length;if(f<b)f=b;if(b>f)b=f;a.focus();if(a.selectionStart!=undefined){a.selectionStart= b;a.selectionEnd=f}else if(document.selection){a=a.createTextRange();a.collapse(true);a.moveStart("character",b);a.moveEnd("character",f-b);a.select()}};this.isKeyPress=function(a){if(!a)a=window.event;if(a.altKey||a.ctrlKey||a.metaKey)return false;return(typeof a.charCode!=="undefined"?a.charCode:0)>0||g.isIE?true:a.keyCode==13||a.keyCode==27||a.keyCode>=32&&a.keyCode<125};var Z=/^-?\d+(?:px)?$/i;this.px=function(a,b){a=w(a,b);if(a=="auto"||a==null)return 0;return Z.test(a)?parseFloat(a):0};this.isHidden=
a.selectionStart==0?{start:a.selectionStart,end:a.selectionEnd}:{start:-1,end:-1}};this.setSelectionRange=function(a,b,f){var h=$(a).val();if(typeof b!="number")b=-1;if(typeof f!="number")f=-1;if(b<0)b=0;if(f>h.length)f=h.length;if(f<b)f=b;if(b>f)b=f;a.focus();if(a.selectionStart!=undefined){a.selectionStart=b;a.selectionEnd=f}else if(document.selection){a=a.createTextRange();a.collapse(true);a.moveStart("character",b);a.moveEnd("character",f-b);a.select()}};this.isKeyPress=function(a){if(!a)a=window.event;
function(a){if(document.selection){var b=document.selection.createRange(),f=b.duplicate();f.moveToElementText(a);f.setEndPoint("EndToEnd",b);a=f.text.length-b.text.length;return{start:a,end:a+b.text.length}}else return{start:a.selectionStart,end:a.selectionEnd}};this.setSelectionRange=function(a,b,f){if(a.createTextRange){a=a.createTextRange();a.collapse(true);a.moveEnd("character",f);a.moveStart("character",b);a.select()}else if(a.setSelectionRange){a.focus();a.setSelectionRange(b,f)}};this.isKeyPress=
y:f}};this.scrollIntoView=function(a){(a=document.getElementById(a))&&a.scrollIntoView&&a.scrollIntoView(true)};this.getSelectionRange=function(a){if(document.selection){var b=document.selection.createRange(),f=b.duplicate();f.moveToElementText(a);f.setEndPoint("EndToEnd",b);a=f.text.length-b.text.length;return{start:a,end:a+b.text.length}}else return{start:a.selectionStart,end:a.selectionEnd}};this.setSelectionRange=function(a,b,f){if(a.createTextRange){a=a.createTextRange();a.collapse(true);a.moveEnd("character", f);a.moveStart("character",b);a.select()}else if(a.setSelectionRange){a.focus();a.setSelectionRange(b,f)}};this.isKeyPress=function(a){if(!a)a=window.event;if(a.altKey||a.ctrlKey||a.metaKey)return false;return(typeof a.charCode!=="undefined"?a.charCode:0)>0||k.isIE?true:a.keyCode==13||a.keyCode==27||a.keyCode==32||a.keyCode>46&&a.keyCode<112};var U=/^-?\d+(?:px)?$/i;this.px=function(a,b){a=x(a,b);if(a=="auto"||a==null)return 0;return U.test(a)?parseFloat(a):0};this.isHidden=function(a){if(a.style.display==
function(a){if(document.selection){var b=document.selection.createRange(),f=b.duplicate();f.moveToElementText(a);f.setEndPoint("EndToEnd",b);a=f.text.length-b.text.length;return{start:a,end:a+b.text.length}}else return{start:a.selectionStart,end:a.selectionEnd}};this.setSelectionRange=function(a,b,f){if(a.createTextRange){a=a.createTextRange();a.collapse(true);a.moveEnd("character",f);a.moveStart("character",b);a.select()}else if(a.setSelectionRange){a.focus();a.setSelectionRange(b,f)}};this.isKeyPress=
if(!c&&l!=m)return false;for(var n=0;n<l;n++){var o=j[n];if((!c||o.specified&&o.nodeName!='_cke_expando')&&o.nodeValue!=i.getAttribute(o.nodeName))return false;}if(c)for(n=0;n<m;n++){o=k[n];if(o.specified&&o.nodeName!='_cke_expando'&&o.nodeValue!=this.getAttribute(o.nodeName))return false;}return true;},isVisible:function(){var i=!!this.$.offsetHeight&&this.getComputedStyle('visibility')!='hidden',j,k;if(i&&(b.webkit||b.opera)){j=this.getWindow();if(!j.equals(a.document.getWindow())&&(k=j.$.frameElement))i=new h(k).isVisible();}return i;},hasAttributes:c&&(b.ie7Compat||b.ie6Compat)?function(){var i=this.$.attributes;for(var j=0;j<i.length;j++){var k=i[j];switch(k.nodeName){case 'class':if(this.getAttribute('class'))return true;case '_cke_expando':continue;default:if(k.specified)return true;}}return false;}:function(){var i=this.$.attributes;return i.length>1||i.length==1&&i[0].nodeName!='_cke_expando';},hasAttribute:function(i){var j=this.$.attributes.getNamedItem(i);return!!(j&&j.specified);},hide:function(){this.setStyle('display','none');},moveChildren:function(i,j){var k=this.$;i=i.$;if(k==i)return;var l;if(j)while(l=k.lastChild)i.insertBefore(k.removeChild(l),i.firstChild);else while(l=k.firstChild)i.appendChild(k.removeChild(l));},show:function(){this.setStyles({display:'',visibility:''});},setAttribute:(function(){var i=function(j,k){this.$.setAttribute(j,k);return this;};if(c&&(b.ie7Compat||b.ie6Compat))return function(j,k){var l=this;if(j=='class')l.$.className=k;else if(j=='style')l.$.style.cssText=k;else if(j=='tabindex')l.$.tabIndex=k;else if(j=='checked')l.$.checked=k;else i.apply(l,arguments);return l;};else return i;})(),setAttributes:function(i){for(var j in i)this.setAttribute(j,i[j]);return this;},setValue:function(i){this.$.value=i;return this;},removeAttribute:(function(){var i=function(j){this.$.removeAttribute(j);};if(c&&(b.ie7Compat||b.ie6Compat))return function(j){if(j=='class')j='className';else if(j=='tabindex')j='tabIndex';i.call(this,j);};else return i;})(),removeAttributes:function(i){if(e.isArray(i))for(var j=0;j<i.length;j++)this.removeAttribute(i[j]);else for(var k in i)i.hasOwnProperty(k)&&this.removeAttribute(k);},removeStyle:function(i){var j=this;j.setStyle(i,'');if(j.$.style.removeAttribute)j.$.style.removeAttribute(e.cssStyleToDomStyle(i));if(!j.$.style.cssText)j.removeAttribute('style');},setStyle:function(i,j){this.$.style[e.cssStyleToDomStyle(i)]=j;return this;},setStyles:function(i){for(var j in i)this.setStyle(j,i[j]); return this;},setOpacity:function(i){if(c){i=Math.round(i*100);this.setStyle('filter',i>=100?'':'progid:DXImageTransform.Microsoft.Alpha(opacity='+i+')');}else this.setStyle('opacity',i);},unselectable:b.gecko?function(){this.$.style.MozUserSelect='none';}:b.webkit?function(){this.$.style.KhtmlUserSelect='none';}:function(){if(c||b.opera){var i=this.$,j,k=0;i.unselectable='on';while(j=i.all[k++])switch(j.tagName.toLowerCase()){case 'iframe':case 'textarea':case 'input':case 'select':break;default:j.unselectable='on';}}},getPositionedAncestor:function(){var i=this;while(i.getName()!='html'){if(i.getComputedStyle('position')!='static')return i;i=i.getParent();}return null;},getDocumentPosition:function(i){var D=this;var j=0,k=0,l=D.getDocument().getBody(),m=D.getDocument().$.compatMode=='BackCompat',n=D.getDocument();if(document.documentElement.getBoundingClientRect){var o=D.$.getBoundingClientRect(),p=n.$,q=p.documentElement,r=q.clientTop||l.$.clientTop||0,s=q.clientLeft||l.$.clientLeft||0,t=true;if(c){var u=n.getDocumentElement().contains(D),v=n.getBody().contains(D);t=m&&v||!m&&u;}if(t){j=o.left+(!m&&q.scrollLeft||l.$.scrollLeft);j-=s;k=o.top+(!m&&q.scrollTop||l.$.scrollTop);k-=r;}}else{var w=D,x=null,y;while(w&&!(w.getName()=='body'||w.getName()=='html')){j+=w.$.offsetLeft-w.$.scrollLeft;k+=w.$.offsetTop-w.$.scrollTop;if(!w.equals(D)){j+=w.$.clientLeft||0;k+=w.$.clientTop||0;}var z=x;while(z&&!z.equals(w)){j-=z.$.scrollLeft;k-=z.$.scrollTop;z=z.getParent();}x=w;w=(y=w.$.offsetParent)?new h(y):null;}}if(i){var A=D.getWindow(),B=i.getWindow();if(!A.equals(B)&&A.$.frameElement){var C=new h(A.$.frameElement).getDocumentPosition(i);j+=C.x;k+=C.y;}}if(!document.documentElement.getBoundingClientRect)if(b.gecko&&!m){j+=D.$.clientLeft?1:0;k+=D.$.clientTop?1:0;}return{x:j,y:k};},scrollIntoView:function(i){var o=this;var j=o.getWindow(),k=j.getViewPaneSize().height,l=k*-1;if(i)l+=k;else{l+=o.$.offsetHeight||0;l+=parseInt(o.getComputedStyle('marginBottom')||0,10)||0;}var m=o.getDocumentPosition();l+=m.y;l=l<0?0:l;var n=j.getScrollPosition().y;if(l>n||l<n-k)j.$.scrollTo(0,l);},setState:function(i){var j=this;switch(i){case 1:j.addClass('cke_on');j.removeClass('cke_off');j.removeClass('cke_disabled');break;case 0:j.addClass('cke_disabled');j.removeClass('cke_off');j.removeClass('cke_on');break;default:j.addClass('cke_off');j.removeClass('cke_on');j.removeClass('cke_disabled');break;}},getFrameDocument:function(){var i=this.$;try{i.contentWindow.document;}catch(j){i.src=i.src;
},setAttribute:(function(){var i=function(j,k){this.$.setAttribute(j,k);return this;};if(c&&(b.ie7Compat||b.ie6Compat))return function(j,k){var l=this;if(j=='class')l.$.className=k;else if(j=='style')l.$.style.cssText=k;else if(j=='tabindex')l.$.tabIndex=k;else if(j=='checked')l.$.checked=k;else i.apply(l,arguments);return l;};else return i;})(),setAttributes:function(i){for(var j in i)this.setAttribute(j,i[j]);return this;},setValue:function(i){this.$.value=i;return this;},removeAttribute:(function(){var i=function(j){this.$.removeAttribute(j);};if(c&&(b.ie7Compat||b.ie6Compat))return function(j){if(j=='class')j='className';else if(j=='tabindex')j='tabIndex';i.call(this,j);};else return i;})(),removeAttributes:function(i){if(e.isArray(i))for(var j=0;j<i.length;j++)this.removeAttribute(i[j]);else for(var k in i)i.hasOwnProperty(k)&&this.removeAttribute(k);},removeStyle:function(i){var j=this;j.setStyle(i,'');if(j.$.style.removeAttribute)j.$.style.removeAttribute(e.cssStyleToDomStyle(i));if(!j.$.style.cssText)j.removeAttribute('style');},setStyle:function(i,j){this.$.style[e.cssStyleToDomStyle(i)]=j;return this;},setStyles:function(i){for(var j in i)this.setStyle(j,i[j]);return this;},setOpacity:function(i){if(c){i=Math.round(i*100);this.setStyle('filter',i>=100?'':'progid:DXImageTransform.Microsoft.Alpha(opacity='+i+')');}else this.setStyle('opacity',i);},unselectable:b.gecko?function(){this.$.style.MozUserSelect='none';this.on('dragstart',function(i){i.data.preventDefault();});}:b.webkit?function(){this.$.style.KhtmlUserSelect='none';this.on('dragstart',function(i){i.data.preventDefault();});}:function(){if(c||b.opera){var i=this.$,j,k=0;i.unselectable='on';while(j=i.all[k++])switch(j.tagName.toLowerCase()){case 'iframe':case 'textarea':case 'input':case 'select':break;default:j.unselectable='on';}}},getPositionedAncestor:function(){var i=this;while(i.getName()!='html'){if(i.getComputedStyle('position')!='static')return i;i=i.getParent();}return null;},getDocumentPosition:function(i){var D=this;var j=0,k=0,l=D.getDocument().getBody(),m=D.getDocument().$.compatMode=='BackCompat',n=D.getDocument();if(document.documentElement.getBoundingClientRect){var o=D.$.getBoundingClientRect(),p=n.$,q=p.documentElement,r=q.clientTop||l.$.clientTop||0,s=q.clientLeft||l.$.clientLeft||0,t=true;if(c){var u=n.getDocumentElement().contains(D),v=n.getBody().contains(D);t=m&&v||!m&&u;}if(t){j=o.left+(!m&&q.scrollLeft||l.$.scrollLeft);j-=s;k=o.top+(!m&&q.scrollTop||l.$.scrollTop);
if(!c&&l!=m)return false;for(var n=0;n<l;n++){var o=j[n];if((!c||o.specified&&o.nodeName!='_cke_expando')&&o.nodeValue!=i.getAttribute(o.nodeName))return false;}if(c)for(n=0;n<m;n++){o=k[n];if(o.specified&&o.nodeName!='_cke_expando'&&o.nodeValue!=this.getAttribute(o.nodeName))return false;}return true;},isVisible:function(){var i=!!this.$.offsetHeight&&this.getComputedStyle('visibility')!='hidden',j,k;if(i&&(b.webkit||b.opera)){j=this.getWindow();if(!j.equals(a.document.getWindow())&&(k=j.$.frameElement))i=new h(k).isVisible();}return i;},hasAttributes:c&&(b.ie7Compat||b.ie6Compat)?function(){var i=this.$.attributes;for(var j=0;j<i.length;j++){var k=i[j];switch(k.nodeName){case 'class':if(this.getAttribute('class'))return true;case '_cke_expando':continue;default:if(k.specified)return true;}}return false;}:function(){var i=this.$.attributes;return i.length>1||i.length==1&&i[0].nodeName!='_cke_expando';},hasAttribute:function(i){var j=this.$.attributes.getNamedItem(i);return!!(j&&j.specified);},hide:function(){this.setStyle('display','none');},moveChildren:function(i,j){var k=this.$;i=i.$;if(k==i)return;var l;if(j)while(l=k.lastChild)i.insertBefore(k.removeChild(l),i.firstChild);else while(l=k.firstChild)i.appendChild(k.removeChild(l));},show:function(){this.setStyles({display:'',visibility:''});},setAttribute:(function(){var i=function(j,k){this.$.setAttribute(j,k);return this;};if(c&&(b.ie7Compat||b.ie6Compat))return function(j,k){var l=this;if(j=='class')l.$.className=k;else if(j=='style')l.$.style.cssText=k;else if(j=='tabindex')l.$.tabIndex=k;else if(j=='checked')l.$.checked=k;else i.apply(l,arguments);return l;};else return i;})(),setAttributes:function(i){for(var j in i)this.setAttribute(j,i[j]);return this;},setValue:function(i){this.$.value=i;return this;},removeAttribute:(function(){var i=function(j){this.$.removeAttribute(j);};if(c&&(b.ie7Compat||b.ie6Compat))return function(j){if(j=='class')j='className';else if(j=='tabindex')j='tabIndex';i.call(this,j);};else return i;})(),removeAttributes:function(i){if(e.isArray(i))for(var j=0;j<i.length;j++)this.removeAttribute(i[j]);else for(var k in i)i.hasOwnProperty(k)&&this.removeAttribute(k);},removeStyle:function(i){var j=this;j.setStyle(i,'');if(j.$.style.removeAttribute)j.$.style.removeAttribute(e.cssStyleToDomStyle(i));if(!j.$.style.cssText)j.removeAttribute('style');},setStyle:function(i,j){this.$.style[e.cssStyleToDomStyle(i)]=j;return this;},setStyles:function(i){for(var j in i)this.setStyle(j,i[j]);return this;},setOpacity:function(i){if(c){i=Math.round(i*100);this.setStyle('filter',i>=100?'':'progid:DXImageTransform.Microsoft.Alpha(opacity='+i+')');}else this.setStyle('opacity',i);},unselectable:b.gecko?function(){this.$.style.MozUserSelect='none';}:b.webkit?function(){this.$.style.KhtmlUserSelect='none';}:function(){if(c||b.opera){var i=this.$,j,k=0;i.unselectable='on';while(j=i.all[k++])switch(j.tagName.toLowerCase()){case 'iframe':case 'textarea':case 'input':case 'select':break;default:j.unselectable='on';}}},getPositionedAncestor:function(){var i=this;while(i.getName()!='html'){if(i.getComputedStyle('position')!='static')return i;i=i.getParent();}return null;},getDocumentPosition:function(i){var D=this;var j=0,k=0,l=D.getDocument().getBody(),m=D.getDocument().$.compatMode=='BackCompat',n=D.getDocument();if(document.documentElement.getBoundingClientRect){var o=D.$.getBoundingClientRect(),p=n.$,q=p.documentElement,r=q.clientTop||l.$.clientTop||0,s=q.clientLeft||l.$.clientLeft||0,t=true;if(c){var u=n.getDocumentElement().contains(D),v=n.getBody().contains(D);t=m&&v||!m&&u;}if(t){j=o.left+(!m&&q.scrollLeft||l.$.scrollLeft);j-=s;k=o.top+(!m&&q.scrollTop||l.$.scrollTop);k-=r;}}else{var w=D,x=null,y;while(w&&!(w.getName()=='body'||w.getName()=='html')){j+=w.$.offsetLeft-w.$.scrollLeft;k+=w.$.offsetTop-w.$.scrollTop;if(!w.equals(D)){j+=w.$.clientLeft||0;k+=w.$.clientTop||0;}var z=x;while(z&&!z.equals(w)){j-=z.$.scrollLeft;k-=z.$.scrollTop;z=z.getParent();}x=w;w=(y=w.$.offsetParent)?new h(y):null;}}if(i){var A=D.getWindow(),B=i.getWindow();if(!A.equals(B)&&A.$.frameElement){var C=new h(A.$.frameElement).getDocumentPosition(i);j+=C.x;k+=C.y;}}if(!document.documentElement.getBoundingClientRect)if(b.gecko&&!m){j+=D.$.clientLeft?1:0;k+=D.$.clientTop?1:0;}return{x:j,y:k};},scrollIntoView:function(i){var o=this;var j=o.getWindow(),k=j.getViewPaneSize().height,l=k*-1;if(i)l+=k;else{l+=o.$.offsetHeight||0;l+=parseInt(o.getComputedStyle('marginBottom')||0,10)||0;}var m=o.getDocumentPosition();l+=m.y;l=l<0?0:l;var n=j.getScrollPosition().y;if(l>n||l<n-k)j.$.scrollTo(0,l);},setState:function(i){var j=this;switch(i){case 1:j.addClass('cke_on');j.removeClass('cke_off');j.removeClass('cke_disabled');break;case 0:j.addClass('cke_disabled');j.removeClass('cke_off');j.removeClass('cke_on');break;default:j.addClass('cke_off');j.removeClass('cke_on');j.removeClass('cke_disabled');break;}},getFrameDocument:function(){var i=this.$;try{i.contentWindow.document;}catch(j){i.src=i.src;
var tempo = {}; var delaySet = true; var token = tokens.shift(); if (token.type === 'quote') { tempo.preString = token.token;
var tempo = {}; var delaySet = true; var token = tokens.shift(); if (token.type === 'quote') { tempo.preString = token.token; token = tokens.shift(); if (tokens.length === 0) { return { type: 'immediate', tempo: tempo }; } } if (token.type === 'alpha' && token.token === 'C') { if (tokens.length === 0) throw "Missing tempo after C in Q: field"; token = tokens.shift(); if (token.type === 'punct' && token.token === '=') { if (tokens.length === 0) throw "Missing tempo after = in Q: field";
this.setTempo = function(line, start, end) { //Q - tempo; can be used to specify the notes per minute, e.g. if //the default note length is an eighth note then Q:120 or Q:C=120 //is 120 eighth notes per minute. Similarly Q:C3=40 would be 40 //dotted quarter notes per minute. An absolute tempo may also be //set, e.g. Q:1/8=120 is also 120 eighth notes per minute, //irrespective of the default note length. // // This is either a number, "C=number", "Cnumber=number", or fraction [fraction...]=number // It depends on the L: field, which may either not be present, or may appear after this. // If L: is not present, an eighth note is used. // That means that this field can't be calculated until the end, if it is the first three types, since we don't know if we'll see an L: field. // So, if it is the fourth type, set it here, otherwise, save the info in the multilineVars. // The temporary variables we keep are the duration and the bpm. In the first two forms, the duration is 1. // In addition, a quoted string may both precede and follow. If a quoted string is present, then the duration part is optional. try { var tokens = tokenizer.tokenize(line, start, end); if (tokens.length === 0) throw "Missing parameter in Q: field"; var tempo = {}; var delaySet = true; var token = tokens.shift(); if (token.type === 'quote') { tempo.preString = token.token; token = tokens.shift(); if (tokens.length === 0) { // It's ok to just get a string for the tempo return { type: 'immediate', tempo: tempo }; } } if (token.type === 'alpha' && token.token === 'C') { // either type 2 or type 3 if (tokens.length === 0) throw "Missing tempo after C in Q: field"; token = tokens.shift(); if (token.type === 'punct' && token.token === '=') { // This is a type 2 format. The duration is an implied 1 if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; tempo.duration = [1]; tempo.bpm = parseInt(token.token); } else if (token.type === 'number') { // This is a type 3 format. tempo.duration = [parseInt(token.token)]; if (tokens.length === 0) throw "Missing = after duration in Q: field"; token = tokens.shift(); if (token.type !== 'punct' || token.token !== '=') throw "Expected = after duration in Q: field"; if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; tempo.bpm = parseInt(token.token); } else throw "Expected number or equal after C in Q: field"; } else if (token.type === 'number') { // either type 1 or type 4 var num = parseInt(token.token); if (tokens.length === 0 || tokens[0].type === 'quote') { // This is type 1 tempo.duration = [1]; tempo.bpm = num; } else { // This is type 4 delaySet = false; token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; var den = parseInt(token.token); tempo.duration = [num/den]; // We got the first fraction, keep getting more as long as we find them. while (tokens.length > 0 && tokens[0].token !== '=' && tokens[0].type !== 'quote') { token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; num = parseInt(token.token); token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; den = parseInt(token.token); tempo.duration.push(num/den); } token = tokens.shift(); if (token.type !== 'punct' && token.token !== '=') throw "Expected = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected tempo in Q: field"; tempo.bpm = parseInt(token.token); } } else throw "Unknown value in Q: field"; if (tokens.length !== 0) { token = tokens.shift(); if (token.type === 'quote') { tempo.postString = token.token; token = tokens.shift(); } if (tokens.length !== 0) throw "Unexpected string at end of Q: field"; } return { type: delaySet?'delaySet':'immediate', tempo: tempo }; } catch (msg) { warn(msg, line, start); return { type: 'none' }; } };
if (tokens.length === 0) { return { type: 'immediate', tempo: tempo }; } } if (token.type === 'alpha' && token.token === 'C') { if (tokens.length === 0) throw "Missing tempo after C in Q: field";
if (token.type !== 'number') throw "Expected number after = in Q: field"; tempo.duration = [1]; tempo.bpm = parseInt(token.token); } else if (token.type === 'number') { tempo.duration = [parseInt(token.token)]; if (tokens.length === 0) throw "Missing = after duration in Q: field";
this.setTempo = function(line, start, end) { //Q - tempo; can be used to specify the notes per minute, e.g. if //the default note length is an eighth note then Q:120 or Q:C=120 //is 120 eighth notes per minute. Similarly Q:C3=40 would be 40 //dotted quarter notes per minute. An absolute tempo may also be //set, e.g. Q:1/8=120 is also 120 eighth notes per minute, //irrespective of the default note length. // // This is either a number, "C=number", "Cnumber=number", or fraction [fraction...]=number // It depends on the L: field, which may either not be present, or may appear after this. // If L: is not present, an eighth note is used. // That means that this field can't be calculated until the end, if it is the first three types, since we don't know if we'll see an L: field. // So, if it is the fourth type, set it here, otherwise, save the info in the multilineVars. // The temporary variables we keep are the duration and the bpm. In the first two forms, the duration is 1. // In addition, a quoted string may both precede and follow. If a quoted string is present, then the duration part is optional. try { var tokens = tokenizer.tokenize(line, start, end); if (tokens.length === 0) throw "Missing parameter in Q: field"; var tempo = {}; var delaySet = true; var token = tokens.shift(); if (token.type === 'quote') { tempo.preString = token.token; token = tokens.shift(); if (tokens.length === 0) { // It's ok to just get a string for the tempo return { type: 'immediate', tempo: tempo }; } } if (token.type === 'alpha' && token.token === 'C') { // either type 2 or type 3 if (tokens.length === 0) throw "Missing tempo after C in Q: field"; token = tokens.shift(); if (token.type === 'punct' && token.token === '=') { // This is a type 2 format. The duration is an implied 1 if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; tempo.duration = [1]; tempo.bpm = parseInt(token.token); } else if (token.type === 'number') { // This is a type 3 format. tempo.duration = [parseInt(token.token)]; if (tokens.length === 0) throw "Missing = after duration in Q: field"; token = tokens.shift(); if (token.type !== 'punct' || token.token !== '=') throw "Expected = after duration in Q: field"; if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; tempo.bpm = parseInt(token.token); } else throw "Expected number or equal after C in Q: field"; } else if (token.type === 'number') { // either type 1 or type 4 var num = parseInt(token.token); if (tokens.length === 0 || tokens[0].type === 'quote') { // This is type 1 tempo.duration = [1]; tempo.bpm = num; } else { // This is type 4 delaySet = false; token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; var den = parseInt(token.token); tempo.duration = [num/den]; // We got the first fraction, keep getting more as long as we find them. while (tokens.length > 0 && tokens[0].token !== '=' && tokens[0].type !== 'quote') { token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; num = parseInt(token.token); token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; den = parseInt(token.token); tempo.duration.push(num/den); } token = tokens.shift(); if (token.type !== 'punct' && token.token !== '=') throw "Expected = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected tempo in Q: field"; tempo.bpm = parseInt(token.token); } } else throw "Unknown value in Q: field"; if (tokens.length !== 0) { token = tokens.shift(); if (token.type === 'quote') { tempo.postString = token.token; token = tokens.shift(); } if (tokens.length !== 0) throw "Unexpected string at end of Q: field"; } return { type: delaySet?'delaySet':'immediate', tempo: tempo }; } catch (msg) { warn(msg, line, start); return { type: 'none' }; } };
if (token.type === 'punct' && token.token === '=') { if (tokens.length === 0) throw "Missing tempo after = in Q: field";
if (token.type !== 'punct' || token.token !== '=') throw "Expected = after duration in Q: field"; if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; tempo.bpm = parseInt(token.token); } else throw "Expected number or equal after C in Q: field"; } else if (token.type === 'number') { var num = parseInt(token.token); if (tokens.length === 0 || tokens[0].type === 'quote') { tempo.duration = [1]; tempo.bpm = num; } else { delaySet = false; token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; var den = parseInt(token.token); tempo.duration = [num/den]; while (tokens.length > 0 && tokens[0].token !== '=' && tokens[0].type !== 'quote') {
this.setTempo = function(line, start, end) { //Q - tempo; can be used to specify the notes per minute, e.g. if //the default note length is an eighth note then Q:120 or Q:C=120 //is 120 eighth notes per minute. Similarly Q:C3=40 would be 40 //dotted quarter notes per minute. An absolute tempo may also be //set, e.g. Q:1/8=120 is also 120 eighth notes per minute, //irrespective of the default note length. // // This is either a number, "C=number", "Cnumber=number", or fraction [fraction...]=number // It depends on the L: field, which may either not be present, or may appear after this. // If L: is not present, an eighth note is used. // That means that this field can't be calculated until the end, if it is the first three types, since we don't know if we'll see an L: field. // So, if it is the fourth type, set it here, otherwise, save the info in the multilineVars. // The temporary variables we keep are the duration and the bpm. In the first two forms, the duration is 1. // In addition, a quoted string may both precede and follow. If a quoted string is present, then the duration part is optional. try { var tokens = tokenizer.tokenize(line, start, end); if (tokens.length === 0) throw "Missing parameter in Q: field"; var tempo = {}; var delaySet = true; var token = tokens.shift(); if (token.type === 'quote') { tempo.preString = token.token; token = tokens.shift(); if (tokens.length === 0) { // It's ok to just get a string for the tempo return { type: 'immediate', tempo: tempo }; } } if (token.type === 'alpha' && token.token === 'C') { // either type 2 or type 3 if (tokens.length === 0) throw "Missing tempo after C in Q: field"; token = tokens.shift(); if (token.type === 'punct' && token.token === '=') { // This is a type 2 format. The duration is an implied 1 if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; tempo.duration = [1]; tempo.bpm = parseInt(token.token); } else if (token.type === 'number') { // This is a type 3 format. tempo.duration = [parseInt(token.token)]; if (tokens.length === 0) throw "Missing = after duration in Q: field"; token = tokens.shift(); if (token.type !== 'punct' || token.token !== '=') throw "Expected = after duration in Q: field"; if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; tempo.bpm = parseInt(token.token); } else throw "Expected number or equal after C in Q: field"; } else if (token.type === 'number') { // either type 1 or type 4 var num = parseInt(token.token); if (tokens.length === 0 || tokens[0].type === 'quote') { // This is type 1 tempo.duration = [1]; tempo.bpm = num; } else { // This is type 4 delaySet = false; token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; var den = parseInt(token.token); tempo.duration = [num/den]; // We got the first fraction, keep getting more as long as we find them. while (tokens.length > 0 && tokens[0].token !== '=' && tokens[0].type !== 'quote') { token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; num = parseInt(token.token); token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; den = parseInt(token.token); tempo.duration.push(num/den); } token = tokens.shift(); if (token.type !== 'punct' && token.token !== '=') throw "Expected = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected tempo in Q: field"; tempo.bpm = parseInt(token.token); } } else throw "Unknown value in Q: field"; if (tokens.length !== 0) { token = tokens.shift(); if (token.type === 'quote') { tempo.postString = token.token; token = tokens.shift(); } if (tokens.length !== 0) throw "Unexpected string at end of Q: field"; } return { type: delaySet?'delaySet':'immediate', tempo: tempo }; } catch (msg) { warn(msg, line, start); return { type: 'none' }; } };
if (token.type !== 'number') throw "Expected number after = in Q: field"; tempo.duration = [1]; tempo.bpm = parseInt(token.token); } else if (token.type === 'number') { tempo.duration = [parseInt(token.token)]; if (tokens.length === 0) throw "Missing = after duration in Q: field"; token = tokens.shift(); if (token.type !== 'punct' || token.token !== '=') throw "Expected = after duration in Q: field"; if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; tempo.bpm = parseInt(token.token); } else throw "Expected number or equal after C in Q: field"; } else if (token.type === 'number') { var num = parseInt(token.token); if (tokens.length === 0 || tokens[0].type === 'quote') { tempo.duration = [1]; tempo.bpm = num; } else { delaySet = false;
if (token.type !== 'number') throw "Expected fraction in Q: field"; num = parseInt(token.token);
this.setTempo = function(line, start, end) { //Q - tempo; can be used to specify the notes per minute, e.g. if //the default note length is an eighth note then Q:120 or Q:C=120 //is 120 eighth notes per minute. Similarly Q:C3=40 would be 40 //dotted quarter notes per minute. An absolute tempo may also be //set, e.g. Q:1/8=120 is also 120 eighth notes per minute, //irrespective of the default note length. // // This is either a number, "C=number", "Cnumber=number", or fraction [fraction...]=number // It depends on the L: field, which may either not be present, or may appear after this. // If L: is not present, an eighth note is used. // That means that this field can't be calculated until the end, if it is the first three types, since we don't know if we'll see an L: field. // So, if it is the fourth type, set it here, otherwise, save the info in the multilineVars. // The temporary variables we keep are the duration and the bpm. In the first two forms, the duration is 1. // In addition, a quoted string may both precede and follow. If a quoted string is present, then the duration part is optional. try { var tokens = tokenizer.tokenize(line, start, end); if (tokens.length === 0) throw "Missing parameter in Q: field"; var tempo = {}; var delaySet = true; var token = tokens.shift(); if (token.type === 'quote') { tempo.preString = token.token; token = tokens.shift(); if (tokens.length === 0) { // It's ok to just get a string for the tempo return { type: 'immediate', tempo: tempo }; } } if (token.type === 'alpha' && token.token === 'C') { // either type 2 or type 3 if (tokens.length === 0) throw "Missing tempo after C in Q: field"; token = tokens.shift(); if (token.type === 'punct' && token.token === '=') { // This is a type 2 format. The duration is an implied 1 if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; tempo.duration = [1]; tempo.bpm = parseInt(token.token); } else if (token.type === 'number') { // This is a type 3 format. tempo.duration = [parseInt(token.token)]; if (tokens.length === 0) throw "Missing = after duration in Q: field"; token = tokens.shift(); if (token.type !== 'punct' || token.token !== '=') throw "Expected = after duration in Q: field"; if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; tempo.bpm = parseInt(token.token); } else throw "Expected number or equal after C in Q: field"; } else if (token.type === 'number') { // either type 1 or type 4 var num = parseInt(token.token); if (tokens.length === 0 || tokens[0].type === 'quote') { // This is type 1 tempo.duration = [1]; tempo.bpm = num; } else { // This is type 4 delaySet = false; token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; var den = parseInt(token.token); tempo.duration = [num/den]; // We got the first fraction, keep getting more as long as we find them. while (tokens.length > 0 && tokens[0].token !== '=' && tokens[0].type !== 'quote') { token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; num = parseInt(token.token); token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; den = parseInt(token.token); tempo.duration.push(num/den); } token = tokens.shift(); if (token.type !== 'punct' && token.token !== '=') throw "Expected = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected tempo in Q: field"; tempo.bpm = parseInt(token.token); } } else throw "Unknown value in Q: field"; if (tokens.length !== 0) { token = tokens.shift(); if (token.type === 'quote') { tempo.postString = token.token; token = tokens.shift(); } if (tokens.length !== 0) throw "Unexpected string at end of Q: field"; } return { type: delaySet?'delaySet':'immediate', tempo: tempo }; } catch (msg) { warn(msg, line, start); return { type: 'none' }; } };
var den = parseInt(token.token); tempo.duration = [num/den]; while (tokens.length > 0 && tokens[0].token !== '=' && tokens[0].type !== 'quote') { token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; num = parseInt(token.token); token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; den = parseInt(token.token); tempo.duration.push(num/den); } token = tokens.shift(); if (token.type !== 'punct' && token.token !== '=') throw "Expected = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected tempo in Q: field"; tempo.bpm = parseInt(token.token);
den = parseInt(token.token); tempo.duration.push(num/den);
this.setTempo = function(line, start, end) { //Q - tempo; can be used to specify the notes per minute, e.g. if //the default note length is an eighth note then Q:120 or Q:C=120 //is 120 eighth notes per minute. Similarly Q:C3=40 would be 40 //dotted quarter notes per minute. An absolute tempo may also be //set, e.g. Q:1/8=120 is also 120 eighth notes per minute, //irrespective of the default note length. // // This is either a number, "C=number", "Cnumber=number", or fraction [fraction...]=number // It depends on the L: field, which may either not be present, or may appear after this. // If L: is not present, an eighth note is used. // That means that this field can't be calculated until the end, if it is the first three types, since we don't know if we'll see an L: field. // So, if it is the fourth type, set it here, otherwise, save the info in the multilineVars. // The temporary variables we keep are the duration and the bpm. In the first two forms, the duration is 1. // In addition, a quoted string may both precede and follow. If a quoted string is present, then the duration part is optional. try { var tokens = tokenizer.tokenize(line, start, end); if (tokens.length === 0) throw "Missing parameter in Q: field"; var tempo = {}; var delaySet = true; var token = tokens.shift(); if (token.type === 'quote') { tempo.preString = token.token; token = tokens.shift(); if (tokens.length === 0) { // It's ok to just get a string for the tempo return { type: 'immediate', tempo: tempo }; } } if (token.type === 'alpha' && token.token === 'C') { // either type 2 or type 3 if (tokens.length === 0) throw "Missing tempo after C in Q: field"; token = tokens.shift(); if (token.type === 'punct' && token.token === '=') { // This is a type 2 format. The duration is an implied 1 if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; tempo.duration = [1]; tempo.bpm = parseInt(token.token); } else if (token.type === 'number') { // This is a type 3 format. tempo.duration = [parseInt(token.token)]; if (tokens.length === 0) throw "Missing = after duration in Q: field"; token = tokens.shift(); if (token.type !== 'punct' || token.token !== '=') throw "Expected = after duration in Q: field"; if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; tempo.bpm = parseInt(token.token); } else throw "Expected number or equal after C in Q: field"; } else if (token.type === 'number') { // either type 1 or type 4 var num = parseInt(token.token); if (tokens.length === 0 || tokens[0].type === 'quote') { // This is type 1 tempo.duration = [1]; tempo.bpm = num; } else { // This is type 4 delaySet = false; token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; var den = parseInt(token.token); tempo.duration = [num/den]; // We got the first fraction, keep getting more as long as we find them. while (tokens.length > 0 && tokens[0].token !== '=' && tokens[0].type !== 'quote') { token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; num = parseInt(token.token); token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; den = parseInt(token.token); tempo.duration.push(num/den); } token = tokens.shift(); if (token.type !== 'punct' && token.token !== '=') throw "Expected = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected tempo in Q: field"; tempo.bpm = parseInt(token.token); } } else throw "Unknown value in Q: field"; if (tokens.length !== 0) { token = tokens.shift(); if (token.type === 'quote') { tempo.postString = token.token; token = tokens.shift(); } if (tokens.length !== 0) throw "Unexpected string at end of Q: field"; } return { type: delaySet?'delaySet':'immediate', tempo: tempo }; } catch (msg) { warn(msg, line, start); return { type: 'none' }; } };
} else throw "Unknown value in Q: field"; if (tokens.length !== 0) {
this.setTempo = function(line, start, end) { //Q - tempo; can be used to specify the notes per minute, e.g. if //the default note length is an eighth note then Q:120 or Q:C=120 //is 120 eighth notes per minute. Similarly Q:C3=40 would be 40 //dotted quarter notes per minute. An absolute tempo may also be //set, e.g. Q:1/8=120 is also 120 eighth notes per minute, //irrespective of the default note length. // // This is either a number, "C=number", "Cnumber=number", or fraction [fraction...]=number // It depends on the L: field, which may either not be present, or may appear after this. // If L: is not present, an eighth note is used. // That means that this field can't be calculated until the end, if it is the first three types, since we don't know if we'll see an L: field. // So, if it is the fourth type, set it here, otherwise, save the info in the multilineVars. // The temporary variables we keep are the duration and the bpm. In the first two forms, the duration is 1. // In addition, a quoted string may both precede and follow. If a quoted string is present, then the duration part is optional. try { var tokens = tokenizer.tokenize(line, start, end); if (tokens.length === 0) throw "Missing parameter in Q: field"; var tempo = {}; var delaySet = true; var token = tokens.shift(); if (token.type === 'quote') { tempo.preString = token.token; token = tokens.shift(); if (tokens.length === 0) { // It's ok to just get a string for the tempo return { type: 'immediate', tempo: tempo }; } } if (token.type === 'alpha' && token.token === 'C') { // either type 2 or type 3 if (tokens.length === 0) throw "Missing tempo after C in Q: field"; token = tokens.shift(); if (token.type === 'punct' && token.token === '=') { // This is a type 2 format. The duration is an implied 1 if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; tempo.duration = [1]; tempo.bpm = parseInt(token.token); } else if (token.type === 'number') { // This is a type 3 format. tempo.duration = [parseInt(token.token)]; if (tokens.length === 0) throw "Missing = after duration in Q: field"; token = tokens.shift(); if (token.type !== 'punct' || token.token !== '=') throw "Expected = after duration in Q: field"; if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; tempo.bpm = parseInt(token.token); } else throw "Expected number or equal after C in Q: field"; } else if (token.type === 'number') { // either type 1 or type 4 var num = parseInt(token.token); if (tokens.length === 0 || tokens[0].type === 'quote') { // This is type 1 tempo.duration = [1]; tempo.bpm = num; } else { // This is type 4 delaySet = false; token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; var den = parseInt(token.token); tempo.duration = [num/den]; // We got the first fraction, keep getting more as long as we find them. while (tokens.length > 0 && tokens[0].token !== '=' && tokens[0].type !== 'quote') { token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; num = parseInt(token.token); token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; den = parseInt(token.token); tempo.duration.push(num/den); } token = tokens.shift(); if (token.type !== 'punct' && token.token !== '=') throw "Expected = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected tempo in Q: field"; tempo.bpm = parseInt(token.token); } } else throw "Unknown value in Q: field"; if (tokens.length !== 0) { token = tokens.shift(); if (token.type === 'quote') { tempo.postString = token.token; token = tokens.shift(); } if (tokens.length !== 0) throw "Unexpected string at end of Q: field"; } return { type: delaySet?'delaySet':'immediate', tempo: tempo }; } catch (msg) { warn(msg, line, start); return { type: 'none' }; } };
if (token.type === 'quote') { tempo.postString = token.token; token = tokens.shift(); } if (tokens.length !== 0) throw "Unexpected string at end of Q: field";
if (token.type !== 'punct' && token.token !== '=') throw "Expected = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected tempo in Q: field"; tempo.bpm = parseInt(token.token);
this.setTempo = function(line, start, end) { //Q - tempo; can be used to specify the notes per minute, e.g. if //the default note length is an eighth note then Q:120 or Q:C=120 //is 120 eighth notes per minute. Similarly Q:C3=40 would be 40 //dotted quarter notes per minute. An absolute tempo may also be //set, e.g. Q:1/8=120 is also 120 eighth notes per minute, //irrespective of the default note length. // // This is either a number, "C=number", "Cnumber=number", or fraction [fraction...]=number // It depends on the L: field, which may either not be present, or may appear after this. // If L: is not present, an eighth note is used. // That means that this field can't be calculated until the end, if it is the first three types, since we don't know if we'll see an L: field. // So, if it is the fourth type, set it here, otherwise, save the info in the multilineVars. // The temporary variables we keep are the duration and the bpm. In the first two forms, the duration is 1. // In addition, a quoted string may both precede and follow. If a quoted string is present, then the duration part is optional. try { var tokens = tokenizer.tokenize(line, start, end); if (tokens.length === 0) throw "Missing parameter in Q: field"; var tempo = {}; var delaySet = true; var token = tokens.shift(); if (token.type === 'quote') { tempo.preString = token.token; token = tokens.shift(); if (tokens.length === 0) { // It's ok to just get a string for the tempo return { type: 'immediate', tempo: tempo }; } } if (token.type === 'alpha' && token.token === 'C') { // either type 2 or type 3 if (tokens.length === 0) throw "Missing tempo after C in Q: field"; token = tokens.shift(); if (token.type === 'punct' && token.token === '=') { // This is a type 2 format. The duration is an implied 1 if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; tempo.duration = [1]; tempo.bpm = parseInt(token.token); } else if (token.type === 'number') { // This is a type 3 format. tempo.duration = [parseInt(token.token)]; if (tokens.length === 0) throw "Missing = after duration in Q: field"; token = tokens.shift(); if (token.type !== 'punct' || token.token !== '=') throw "Expected = after duration in Q: field"; if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; tempo.bpm = parseInt(token.token); } else throw "Expected number or equal after C in Q: field"; } else if (token.type === 'number') { // either type 1 or type 4 var num = parseInt(token.token); if (tokens.length === 0 || tokens[0].type === 'quote') { // This is type 1 tempo.duration = [1]; tempo.bpm = num; } else { // This is type 4 delaySet = false; token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; var den = parseInt(token.token); tempo.duration = [num/den]; // We got the first fraction, keep getting more as long as we find them. while (tokens.length > 0 && tokens[0].token !== '=' && tokens[0].type !== 'quote') { token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; num = parseInt(token.token); token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; den = parseInt(token.token); tempo.duration.push(num/den); } token = tokens.shift(); if (token.type !== 'punct' && token.token !== '=') throw "Expected = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected tempo in Q: field"; tempo.bpm = parseInt(token.token); } } else throw "Unknown value in Q: field"; if (tokens.length !== 0) { token = tokens.shift(); if (token.type === 'quote') { tempo.postString = token.token; token = tokens.shift(); } if (tokens.length !== 0) throw "Unexpected string at end of Q: field"; } return { type: delaySet?'delaySet':'immediate', tempo: tempo }; } catch (msg) { warn(msg, line, start); return { type: 'none' }; } };
return { type: delaySet?'delaySet':'immediate', tempo: tempo }; } catch (msg) { warn(msg, line, start); return { type: 'none' };
} else throw "Unknown value in Q: field"; if (tokens.length !== 0) { token = tokens.shift(); if (token.type === 'quote') { tempo.postString = token.token; token = tokens.shift(); } if (tokens.length !== 0) throw "Unexpected string at end of Q: field";
this.setTempo = function(line, start, end) { //Q - tempo; can be used to specify the notes per minute, e.g. if //the default note length is an eighth note then Q:120 or Q:C=120 //is 120 eighth notes per minute. Similarly Q:C3=40 would be 40 //dotted quarter notes per minute. An absolute tempo may also be //set, e.g. Q:1/8=120 is also 120 eighth notes per minute, //irrespective of the default note length. // // This is either a number, "C=number", "Cnumber=number", or fraction [fraction...]=number // It depends on the L: field, which may either not be present, or may appear after this. // If L: is not present, an eighth note is used. // That means that this field can't be calculated until the end, if it is the first three types, since we don't know if we'll see an L: field. // So, if it is the fourth type, set it here, otherwise, save the info in the multilineVars. // The temporary variables we keep are the duration and the bpm. In the first two forms, the duration is 1. // In addition, a quoted string may both precede and follow. If a quoted string is present, then the duration part is optional. try { var tokens = tokenizer.tokenize(line, start, end); if (tokens.length === 0) throw "Missing parameter in Q: field"; var tempo = {}; var delaySet = true; var token = tokens.shift(); if (token.type === 'quote') { tempo.preString = token.token; token = tokens.shift(); if (tokens.length === 0) { // It's ok to just get a string for the tempo return { type: 'immediate', tempo: tempo }; } } if (token.type === 'alpha' && token.token === 'C') { // either type 2 or type 3 if (tokens.length === 0) throw "Missing tempo after C in Q: field"; token = tokens.shift(); if (token.type === 'punct' && token.token === '=') { // This is a type 2 format. The duration is an implied 1 if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; tempo.duration = [1]; tempo.bpm = parseInt(token.token); } else if (token.type === 'number') { // This is a type 3 format. tempo.duration = [parseInt(token.token)]; if (tokens.length === 0) throw "Missing = after duration in Q: field"; token = tokens.shift(); if (token.type !== 'punct' || token.token !== '=') throw "Expected = after duration in Q: field"; if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; tempo.bpm = parseInt(token.token); } else throw "Expected number or equal after C in Q: field"; } else if (token.type === 'number') { // either type 1 or type 4 var num = parseInt(token.token); if (tokens.length === 0 || tokens[0].type === 'quote') { // This is type 1 tempo.duration = [1]; tempo.bpm = num; } else { // This is type 4 delaySet = false; token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; var den = parseInt(token.token); tempo.duration = [num/den]; // We got the first fraction, keep getting more as long as we find them. while (tokens.length > 0 && tokens[0].token !== '=' && tokens[0].type !== 'quote') { token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; num = parseInt(token.token); token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; den = parseInt(token.token); tempo.duration.push(num/den); } token = tokens.shift(); if (token.type !== 'punct' && token.token !== '=') throw "Expected = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected tempo in Q: field"; tempo.bpm = parseInt(token.token); } } else throw "Unknown value in Q: field"; if (tokens.length !== 0) { token = tokens.shift(); if (token.type === 'quote') { tempo.postString = token.token; token = tokens.shift(); } if (tokens.length !== 0) throw "Unexpected string at end of Q: field"; } return { type: delaySet?'delaySet':'immediate', tempo: tempo }; } catch (msg) { warn(msg, line, start); return { type: 'none' }; } };
};
return { type: delaySet?'delaySet':'immediate', tempo: tempo }; } catch (msg) { warn(msg, line, start); return { type: 'none' }; } };
this.setTempo = function(line, start, end) { //Q - tempo; can be used to specify the notes per minute, e.g. if //the default note length is an eighth note then Q:120 or Q:C=120 //is 120 eighth notes per minute. Similarly Q:C3=40 would be 40 //dotted quarter notes per minute. An absolute tempo may also be //set, e.g. Q:1/8=120 is also 120 eighth notes per minute, //irrespective of the default note length. // // This is either a number, "C=number", "Cnumber=number", or fraction [fraction...]=number // It depends on the L: field, which may either not be present, or may appear after this. // If L: is not present, an eighth note is used. // That means that this field can't be calculated until the end, if it is the first three types, since we don't know if we'll see an L: field. // So, if it is the fourth type, set it here, otherwise, save the info in the multilineVars. // The temporary variables we keep are the duration and the bpm. In the first two forms, the duration is 1. // In addition, a quoted string may both precede and follow. If a quoted string is present, then the duration part is optional. try { var tokens = tokenizer.tokenize(line, start, end); if (tokens.length === 0) throw "Missing parameter in Q: field"; var tempo = {}; var delaySet = true; var token = tokens.shift(); if (token.type === 'quote') { tempo.preString = token.token; token = tokens.shift(); if (tokens.length === 0) { // It's ok to just get a string for the tempo return { type: 'immediate', tempo: tempo }; } } if (token.type === 'alpha' && token.token === 'C') { // either type 2 or type 3 if (tokens.length === 0) throw "Missing tempo after C in Q: field"; token = tokens.shift(); if (token.type === 'punct' && token.token === '=') { // This is a type 2 format. The duration is an implied 1 if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; tempo.duration = [1]; tempo.bpm = parseInt(token.token); } else if (token.type === 'number') { // This is a type 3 format. tempo.duration = [parseInt(token.token)]; if (tokens.length === 0) throw "Missing = after duration in Q: field"; token = tokens.shift(); if (token.type !== 'punct' || token.token !== '=') throw "Expected = after duration in Q: field"; if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; tempo.bpm = parseInt(token.token); } else throw "Expected number or equal after C in Q: field"; } else if (token.type === 'number') { // either type 1 or type 4 var num = parseInt(token.token); if (tokens.length === 0 || tokens[0].type === 'quote') { // This is type 1 tempo.duration = [1]; tempo.bpm = num; } else { // This is type 4 delaySet = false; token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; var den = parseInt(token.token); tempo.duration = [num/den]; // We got the first fraction, keep getting more as long as we find them. while (tokens.length > 0 && tokens[0].token !== '=' && tokens[0].type !== 'quote') { token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; num = parseInt(token.token); token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; den = parseInt(token.token); tempo.duration.push(num/den); } token = tokens.shift(); if (token.type !== 'punct' && token.token !== '=') throw "Expected = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected tempo in Q: field"; tempo.bpm = parseInt(token.token); } } else throw "Unknown value in Q: field"; if (tokens.length !== 0) { token = tokens.shift(); if (token.type === 'quote') { tempo.postString = token.token; token = tokens.shift(); } if (tokens.length !== 0) throw "Unexpected string at end of Q: field"; } return { type: delaySet?'delaySet':'immediate', tempo: tempo }; } catch (msg) { warn(msg, line, start); return { type: 'none' }; } };
multilineVars.tempo = {};
var tempo = {};
function setTempo(line, start, end) { //Q - tempo; can be used to specify the notes per minute, e.g. if //the default note length is an eighth note then Q:120 or Q:C=120 //is 120 eighth notes per minute. Similarly Q:C3=40 would be 40 //dotted quarter notes per minute. An absolute tempo may also be //set, e.g. Q:1/8=120 is also 120 eighth notes per minute, //irrespective of the default note length. // // This is either a number, "C=number", "Cnumber=number", or fraction [fraction...]=number // It depends on the L: field, which may either not be present, or may appear after this. // If L: is not present, an eighth note is used. // That means that this field can't be calculated until the end, if it is the first three types, since we don't know if we'll see an L: field. // So, if it is the fourth type, set it here, otherwise, save the info in the multilineVars. // The temporary variables we keep are the duration and the bpm. In the first two forms, the duration is 1. // In addition, a quoted string may both precede and follow. If a quoted string is present, then the duration part is optional. try { var tokens = tokenizer.tokenize(line, start, end); if (tokens.length === 0) throw "Missing parameter in Q: field"; multilineVars.tempo = {}; var delaySet = true; var token = tokens.shift(); if (token.type === 'quote') { multilineVars.tempo.preString = token.token; token = tokens.shift(); if (tokens.length === 0) { // It's ok to just get a string for the tempo tune.metaText.tempo = multilineVars.tempo; delete multilineVars.tempo; return; } } if (token.type === 'alpha' && token.token === 'C') { // either type 2 or type 3 if (tokens.length === 0) throw "Missing tempo after C in Q: field"; token = tokens.shift(); if (token.type === 'punct' && token.token === '=') { // This is a type 2 format. The duration is an implied 1 if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; multilineVars.tempo.duration = [1]; multilineVars.tempo.bpm = parseInt(token.token); } else if (token.type === 'number') { // This is a type 3 format. multilineVars.tempo.duration = [parseInt(token.token)]; if (tokens.length === 0) throw "Missing = after duration in Q: field"; token = tokens.shift(); if (token.type !== 'punct' || token.token !== '=') throw "Expected = after duration in Q: field"; if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; multilineVars.tempo.bpm = parseInt(token.token); } else throw "Expected number or equal after C in Q: field"; } else if (token.type === 'number') { // either type 1 or type 4 var num = parseInt(token.token); if (tokens.length === 0 || tokens[0].type === 'quote') { // This is type 1 multilineVars.tempo.duration = [1]; multilineVars.tempo.bpm = num; } else { // This is type 4 delaySet = false; token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; var den = parseInt(token.token); multilineVars.tempo.duration = [num/den]; // We got the first fraction, keep getting more as long as we find them. while (tokens.length > 0 && tokens[0].token !== '=' && tokens[0].type !== 'quote') { token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; num = parseInt(token.token); token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; den = parseInt(token.token); multilineVars.tempo.duration.push(num/den); } token = tokens.shift(); if (token.type !== 'punct' && token.token !== '=') throw "Expected = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected tempo in Q: field"; multilineVars.tempo.bpm = parseInt(token.token); } } else throw "Unknown value in Q: field"; if (tokens.length !== 0) { token = tokens.shift(); if (token.type === 'quote') { multilineVars.tempo.postString = token.token; token = tokens.shift(); } if (tokens.length !== 0) throw "Unexpected string at end of Q: field"; } if (!delaySet) { tune.metaText.tempo = multilineVars.tempo; delete multilineVars.tempo; } } catch (msg) { warn(msg, line, start); } }
multilineVars.tempo.preString = token.token;
tempo.preString = token.token;
function setTempo(line, start, end) { //Q - tempo; can be used to specify the notes per minute, e.g. if //the default note length is an eighth note then Q:120 or Q:C=120 //is 120 eighth notes per minute. Similarly Q:C3=40 would be 40 //dotted quarter notes per minute. An absolute tempo may also be //set, e.g. Q:1/8=120 is also 120 eighth notes per minute, //irrespective of the default note length. // // This is either a number, "C=number", "Cnumber=number", or fraction [fraction...]=number // It depends on the L: field, which may either not be present, or may appear after this. // If L: is not present, an eighth note is used. // That means that this field can't be calculated until the end, if it is the first three types, since we don't know if we'll see an L: field. // So, if it is the fourth type, set it here, otherwise, save the info in the multilineVars. // The temporary variables we keep are the duration and the bpm. In the first two forms, the duration is 1. // In addition, a quoted string may both precede and follow. If a quoted string is present, then the duration part is optional. try { var tokens = tokenizer.tokenize(line, start, end); if (tokens.length === 0) throw "Missing parameter in Q: field"; multilineVars.tempo = {}; var delaySet = true; var token = tokens.shift(); if (token.type === 'quote') { multilineVars.tempo.preString = token.token; token = tokens.shift(); if (tokens.length === 0) { // It's ok to just get a string for the tempo tune.metaText.tempo = multilineVars.tempo; delete multilineVars.tempo; return; } } if (token.type === 'alpha' && token.token === 'C') { // either type 2 or type 3 if (tokens.length === 0) throw "Missing tempo after C in Q: field"; token = tokens.shift(); if (token.type === 'punct' && token.token === '=') { // This is a type 2 format. The duration is an implied 1 if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; multilineVars.tempo.duration = [1]; multilineVars.tempo.bpm = parseInt(token.token); } else if (token.type === 'number') { // This is a type 3 format. multilineVars.tempo.duration = [parseInt(token.token)]; if (tokens.length === 0) throw "Missing = after duration in Q: field"; token = tokens.shift(); if (token.type !== 'punct' || token.token !== '=') throw "Expected = after duration in Q: field"; if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; multilineVars.tempo.bpm = parseInt(token.token); } else throw "Expected number or equal after C in Q: field"; } else if (token.type === 'number') { // either type 1 or type 4 var num = parseInt(token.token); if (tokens.length === 0 || tokens[0].type === 'quote') { // This is type 1 multilineVars.tempo.duration = [1]; multilineVars.tempo.bpm = num; } else { // This is type 4 delaySet = false; token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; var den = parseInt(token.token); multilineVars.tempo.duration = [num/den]; // We got the first fraction, keep getting more as long as we find them. while (tokens.length > 0 && tokens[0].token !== '=' && tokens[0].type !== 'quote') { token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; num = parseInt(token.token); token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; den = parseInt(token.token); multilineVars.tempo.duration.push(num/den); } token = tokens.shift(); if (token.type !== 'punct' && token.token !== '=') throw "Expected = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected tempo in Q: field"; multilineVars.tempo.bpm = parseInt(token.token); } } else throw "Unknown value in Q: field"; if (tokens.length !== 0) { token = tokens.shift(); if (token.type === 'quote') { multilineVars.tempo.postString = token.token; token = tokens.shift(); } if (tokens.length !== 0) throw "Unexpected string at end of Q: field"; } if (!delaySet) { tune.metaText.tempo = multilineVars.tempo; delete multilineVars.tempo; } } catch (msg) { warn(msg, line, start); } }
tune.metaText.tempo = multilineVars.tempo; delete multilineVars.tempo; return;
return { type: 'immediate', tempo: tempo };
function setTempo(line, start, end) { //Q - tempo; can be used to specify the notes per minute, e.g. if //the default note length is an eighth note then Q:120 or Q:C=120 //is 120 eighth notes per minute. Similarly Q:C3=40 would be 40 //dotted quarter notes per minute. An absolute tempo may also be //set, e.g. Q:1/8=120 is also 120 eighth notes per minute, //irrespective of the default note length. // // This is either a number, "C=number", "Cnumber=number", or fraction [fraction...]=number // It depends on the L: field, which may either not be present, or may appear after this. // If L: is not present, an eighth note is used. // That means that this field can't be calculated until the end, if it is the first three types, since we don't know if we'll see an L: field. // So, if it is the fourth type, set it here, otherwise, save the info in the multilineVars. // The temporary variables we keep are the duration and the bpm. In the first two forms, the duration is 1. // In addition, a quoted string may both precede and follow. If a quoted string is present, then the duration part is optional. try { var tokens = tokenizer.tokenize(line, start, end); if (tokens.length === 0) throw "Missing parameter in Q: field"; multilineVars.tempo = {}; var delaySet = true; var token = tokens.shift(); if (token.type === 'quote') { multilineVars.tempo.preString = token.token; token = tokens.shift(); if (tokens.length === 0) { // It's ok to just get a string for the tempo tune.metaText.tempo = multilineVars.tempo; delete multilineVars.tempo; return; } } if (token.type === 'alpha' && token.token === 'C') { // either type 2 or type 3 if (tokens.length === 0) throw "Missing tempo after C in Q: field"; token = tokens.shift(); if (token.type === 'punct' && token.token === '=') { // This is a type 2 format. The duration is an implied 1 if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; multilineVars.tempo.duration = [1]; multilineVars.tempo.bpm = parseInt(token.token); } else if (token.type === 'number') { // This is a type 3 format. multilineVars.tempo.duration = [parseInt(token.token)]; if (tokens.length === 0) throw "Missing = after duration in Q: field"; token = tokens.shift(); if (token.type !== 'punct' || token.token !== '=') throw "Expected = after duration in Q: field"; if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; multilineVars.tempo.bpm = parseInt(token.token); } else throw "Expected number or equal after C in Q: field"; } else if (token.type === 'number') { // either type 1 or type 4 var num = parseInt(token.token); if (tokens.length === 0 || tokens[0].type === 'quote') { // This is type 1 multilineVars.tempo.duration = [1]; multilineVars.tempo.bpm = num; } else { // This is type 4 delaySet = false; token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; var den = parseInt(token.token); multilineVars.tempo.duration = [num/den]; // We got the first fraction, keep getting more as long as we find them. while (tokens.length > 0 && tokens[0].token !== '=' && tokens[0].type !== 'quote') { token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; num = parseInt(token.token); token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; den = parseInt(token.token); multilineVars.tempo.duration.push(num/den); } token = tokens.shift(); if (token.type !== 'punct' && token.token !== '=') throw "Expected = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected tempo in Q: field"; multilineVars.tempo.bpm = parseInt(token.token); } } else throw "Unknown value in Q: field"; if (tokens.length !== 0) { token = tokens.shift(); if (token.type === 'quote') { multilineVars.tempo.postString = token.token; token = tokens.shift(); } if (tokens.length !== 0) throw "Unexpected string at end of Q: field"; } if (!delaySet) { tune.metaText.tempo = multilineVars.tempo; delete multilineVars.tempo; } } catch (msg) { warn(msg, line, start); } }
multilineVars.tempo.duration = [1]; multilineVars.tempo.bpm = parseInt(token.token);
tempo.duration = [1]; tempo.bpm = parseInt(token.token);
function setTempo(line, start, end) { //Q - tempo; can be used to specify the notes per minute, e.g. if //the default note length is an eighth note then Q:120 or Q:C=120 //is 120 eighth notes per minute. Similarly Q:C3=40 would be 40 //dotted quarter notes per minute. An absolute tempo may also be //set, e.g. Q:1/8=120 is also 120 eighth notes per minute, //irrespective of the default note length. // // This is either a number, "C=number", "Cnumber=number", or fraction [fraction...]=number // It depends on the L: field, which may either not be present, or may appear after this. // If L: is not present, an eighth note is used. // That means that this field can't be calculated until the end, if it is the first three types, since we don't know if we'll see an L: field. // So, if it is the fourth type, set it here, otherwise, save the info in the multilineVars. // The temporary variables we keep are the duration and the bpm. In the first two forms, the duration is 1. // In addition, a quoted string may both precede and follow. If a quoted string is present, then the duration part is optional. try { var tokens = tokenizer.tokenize(line, start, end); if (tokens.length === 0) throw "Missing parameter in Q: field"; multilineVars.tempo = {}; var delaySet = true; var token = tokens.shift(); if (token.type === 'quote') { multilineVars.tempo.preString = token.token; token = tokens.shift(); if (tokens.length === 0) { // It's ok to just get a string for the tempo tune.metaText.tempo = multilineVars.tempo; delete multilineVars.tempo; return; } } if (token.type === 'alpha' && token.token === 'C') { // either type 2 or type 3 if (tokens.length === 0) throw "Missing tempo after C in Q: field"; token = tokens.shift(); if (token.type === 'punct' && token.token === '=') { // This is a type 2 format. The duration is an implied 1 if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; multilineVars.tempo.duration = [1]; multilineVars.tempo.bpm = parseInt(token.token); } else if (token.type === 'number') { // This is a type 3 format. multilineVars.tempo.duration = [parseInt(token.token)]; if (tokens.length === 0) throw "Missing = after duration in Q: field"; token = tokens.shift(); if (token.type !== 'punct' || token.token !== '=') throw "Expected = after duration in Q: field"; if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; multilineVars.tempo.bpm = parseInt(token.token); } else throw "Expected number or equal after C in Q: field"; } else if (token.type === 'number') { // either type 1 or type 4 var num = parseInt(token.token); if (tokens.length === 0 || tokens[0].type === 'quote') { // This is type 1 multilineVars.tempo.duration = [1]; multilineVars.tempo.bpm = num; } else { // This is type 4 delaySet = false; token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; var den = parseInt(token.token); multilineVars.tempo.duration = [num/den]; // We got the first fraction, keep getting more as long as we find them. while (tokens.length > 0 && tokens[0].token !== '=' && tokens[0].type !== 'quote') { token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; num = parseInt(token.token); token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; den = parseInt(token.token); multilineVars.tempo.duration.push(num/den); } token = tokens.shift(); if (token.type !== 'punct' && token.token !== '=') throw "Expected = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected tempo in Q: field"; multilineVars.tempo.bpm = parseInt(token.token); } } else throw "Unknown value in Q: field"; if (tokens.length !== 0) { token = tokens.shift(); if (token.type === 'quote') { multilineVars.tempo.postString = token.token; token = tokens.shift(); } if (tokens.length !== 0) throw "Unexpected string at end of Q: field"; } if (!delaySet) { tune.metaText.tempo = multilineVars.tempo; delete multilineVars.tempo; } } catch (msg) { warn(msg, line, start); } }
multilineVars.tempo.duration = [parseInt(token.token)];
tempo.duration = [parseInt(token.token)];
function setTempo(line, start, end) { //Q - tempo; can be used to specify the notes per minute, e.g. if //the default note length is an eighth note then Q:120 or Q:C=120 //is 120 eighth notes per minute. Similarly Q:C3=40 would be 40 //dotted quarter notes per minute. An absolute tempo may also be //set, e.g. Q:1/8=120 is also 120 eighth notes per minute, //irrespective of the default note length. // // This is either a number, "C=number", "Cnumber=number", or fraction [fraction...]=number // It depends on the L: field, which may either not be present, or may appear after this. // If L: is not present, an eighth note is used. // That means that this field can't be calculated until the end, if it is the first three types, since we don't know if we'll see an L: field. // So, if it is the fourth type, set it here, otherwise, save the info in the multilineVars. // The temporary variables we keep are the duration and the bpm. In the first two forms, the duration is 1. // In addition, a quoted string may both precede and follow. If a quoted string is present, then the duration part is optional. try { var tokens = tokenizer.tokenize(line, start, end); if (tokens.length === 0) throw "Missing parameter in Q: field"; multilineVars.tempo = {}; var delaySet = true; var token = tokens.shift(); if (token.type === 'quote') { multilineVars.tempo.preString = token.token; token = tokens.shift(); if (tokens.length === 0) { // It's ok to just get a string for the tempo tune.metaText.tempo = multilineVars.tempo; delete multilineVars.tempo; return; } } if (token.type === 'alpha' && token.token === 'C') { // either type 2 or type 3 if (tokens.length === 0) throw "Missing tempo after C in Q: field"; token = tokens.shift(); if (token.type === 'punct' && token.token === '=') { // This is a type 2 format. The duration is an implied 1 if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; multilineVars.tempo.duration = [1]; multilineVars.tempo.bpm = parseInt(token.token); } else if (token.type === 'number') { // This is a type 3 format. multilineVars.tempo.duration = [parseInt(token.token)]; if (tokens.length === 0) throw "Missing = after duration in Q: field"; token = tokens.shift(); if (token.type !== 'punct' || token.token !== '=') throw "Expected = after duration in Q: field"; if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; multilineVars.tempo.bpm = parseInt(token.token); } else throw "Expected number or equal after C in Q: field"; } else if (token.type === 'number') { // either type 1 or type 4 var num = parseInt(token.token); if (tokens.length === 0 || tokens[0].type === 'quote') { // This is type 1 multilineVars.tempo.duration = [1]; multilineVars.tempo.bpm = num; } else { // This is type 4 delaySet = false; token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; var den = parseInt(token.token); multilineVars.tempo.duration = [num/den]; // We got the first fraction, keep getting more as long as we find them. while (tokens.length > 0 && tokens[0].token !== '=' && tokens[0].type !== 'quote') { token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; num = parseInt(token.token); token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; den = parseInt(token.token); multilineVars.tempo.duration.push(num/den); } token = tokens.shift(); if (token.type !== 'punct' && token.token !== '=') throw "Expected = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected tempo in Q: field"; multilineVars.tempo.bpm = parseInt(token.token); } } else throw "Unknown value in Q: field"; if (tokens.length !== 0) { token = tokens.shift(); if (token.type === 'quote') { multilineVars.tempo.postString = token.token; token = tokens.shift(); } if (tokens.length !== 0) throw "Unexpected string at end of Q: field"; } if (!delaySet) { tune.metaText.tempo = multilineVars.tempo; delete multilineVars.tempo; } } catch (msg) { warn(msg, line, start); } }
multilineVars.tempo.bpm = parseInt(token.token);
tempo.bpm = parseInt(token.token);
function setTempo(line, start, end) { //Q - tempo; can be used to specify the notes per minute, e.g. if //the default note length is an eighth note then Q:120 or Q:C=120 //is 120 eighth notes per minute. Similarly Q:C3=40 would be 40 //dotted quarter notes per minute. An absolute tempo may also be //set, e.g. Q:1/8=120 is also 120 eighth notes per minute, //irrespective of the default note length. // // This is either a number, "C=number", "Cnumber=number", or fraction [fraction...]=number // It depends on the L: field, which may either not be present, or may appear after this. // If L: is not present, an eighth note is used. // That means that this field can't be calculated until the end, if it is the first three types, since we don't know if we'll see an L: field. // So, if it is the fourth type, set it here, otherwise, save the info in the multilineVars. // The temporary variables we keep are the duration and the bpm. In the first two forms, the duration is 1. // In addition, a quoted string may both precede and follow. If a quoted string is present, then the duration part is optional. try { var tokens = tokenizer.tokenize(line, start, end); if (tokens.length === 0) throw "Missing parameter in Q: field"; multilineVars.tempo = {}; var delaySet = true; var token = tokens.shift(); if (token.type === 'quote') { multilineVars.tempo.preString = token.token; token = tokens.shift(); if (tokens.length === 0) { // It's ok to just get a string for the tempo tune.metaText.tempo = multilineVars.tempo; delete multilineVars.tempo; return; } } if (token.type === 'alpha' && token.token === 'C') { // either type 2 or type 3 if (tokens.length === 0) throw "Missing tempo after C in Q: field"; token = tokens.shift(); if (token.type === 'punct' && token.token === '=') { // This is a type 2 format. The duration is an implied 1 if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; multilineVars.tempo.duration = [1]; multilineVars.tempo.bpm = parseInt(token.token); } else if (token.type === 'number') { // This is a type 3 format. multilineVars.tempo.duration = [parseInt(token.token)]; if (tokens.length === 0) throw "Missing = after duration in Q: field"; token = tokens.shift(); if (token.type !== 'punct' || token.token !== '=') throw "Expected = after duration in Q: field"; if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; multilineVars.tempo.bpm = parseInt(token.token); } else throw "Expected number or equal after C in Q: field"; } else if (token.type === 'number') { // either type 1 or type 4 var num = parseInt(token.token); if (tokens.length === 0 || tokens[0].type === 'quote') { // This is type 1 multilineVars.tempo.duration = [1]; multilineVars.tempo.bpm = num; } else { // This is type 4 delaySet = false; token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; var den = parseInt(token.token); multilineVars.tempo.duration = [num/den]; // We got the first fraction, keep getting more as long as we find them. while (tokens.length > 0 && tokens[0].token !== '=' && tokens[0].type !== 'quote') { token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; num = parseInt(token.token); token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; den = parseInt(token.token); multilineVars.tempo.duration.push(num/den); } token = tokens.shift(); if (token.type !== 'punct' && token.token !== '=') throw "Expected = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected tempo in Q: field"; multilineVars.tempo.bpm = parseInt(token.token); } } else throw "Unknown value in Q: field"; if (tokens.length !== 0) { token = tokens.shift(); if (token.type === 'quote') { multilineVars.tempo.postString = token.token; token = tokens.shift(); } if (tokens.length !== 0) throw "Unexpected string at end of Q: field"; } if (!delaySet) { tune.metaText.tempo = multilineVars.tempo; delete multilineVars.tempo; } } catch (msg) { warn(msg, line, start); } }
multilineVars.tempo.duration = [1]; multilineVars.tempo.bpm = num;
tempo.duration = [1]; tempo.bpm = num;
function setTempo(line, start, end) { //Q - tempo; can be used to specify the notes per minute, e.g. if //the default note length is an eighth note then Q:120 or Q:C=120 //is 120 eighth notes per minute. Similarly Q:C3=40 would be 40 //dotted quarter notes per minute. An absolute tempo may also be //set, e.g. Q:1/8=120 is also 120 eighth notes per minute, //irrespective of the default note length. // // This is either a number, "C=number", "Cnumber=number", or fraction [fraction...]=number // It depends on the L: field, which may either not be present, or may appear after this. // If L: is not present, an eighth note is used. // That means that this field can't be calculated until the end, if it is the first three types, since we don't know if we'll see an L: field. // So, if it is the fourth type, set it here, otherwise, save the info in the multilineVars. // The temporary variables we keep are the duration and the bpm. In the first two forms, the duration is 1. // In addition, a quoted string may both precede and follow. If a quoted string is present, then the duration part is optional. try { var tokens = tokenizer.tokenize(line, start, end); if (tokens.length === 0) throw "Missing parameter in Q: field"; multilineVars.tempo = {}; var delaySet = true; var token = tokens.shift(); if (token.type === 'quote') { multilineVars.tempo.preString = token.token; token = tokens.shift(); if (tokens.length === 0) { // It's ok to just get a string for the tempo tune.metaText.tempo = multilineVars.tempo; delete multilineVars.tempo; return; } } if (token.type === 'alpha' && token.token === 'C') { // either type 2 or type 3 if (tokens.length === 0) throw "Missing tempo after C in Q: field"; token = tokens.shift(); if (token.type === 'punct' && token.token === '=') { // This is a type 2 format. The duration is an implied 1 if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; multilineVars.tempo.duration = [1]; multilineVars.tempo.bpm = parseInt(token.token); } else if (token.type === 'number') { // This is a type 3 format. multilineVars.tempo.duration = [parseInt(token.token)]; if (tokens.length === 0) throw "Missing = after duration in Q: field"; token = tokens.shift(); if (token.type !== 'punct' || token.token !== '=') throw "Expected = after duration in Q: field"; if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; multilineVars.tempo.bpm = parseInt(token.token); } else throw "Expected number or equal after C in Q: field"; } else if (token.type === 'number') { // either type 1 or type 4 var num = parseInt(token.token); if (tokens.length === 0 || tokens[0].type === 'quote') { // This is type 1 multilineVars.tempo.duration = [1]; multilineVars.tempo.bpm = num; } else { // This is type 4 delaySet = false; token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; var den = parseInt(token.token); multilineVars.tempo.duration = [num/den]; // We got the first fraction, keep getting more as long as we find them. while (tokens.length > 0 && tokens[0].token !== '=' && tokens[0].type !== 'quote') { token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; num = parseInt(token.token); token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; den = parseInt(token.token); multilineVars.tempo.duration.push(num/den); } token = tokens.shift(); if (token.type !== 'punct' && token.token !== '=') throw "Expected = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected tempo in Q: field"; multilineVars.tempo.bpm = parseInt(token.token); } } else throw "Unknown value in Q: field"; if (tokens.length !== 0) { token = tokens.shift(); if (token.type === 'quote') { multilineVars.tempo.postString = token.token; token = tokens.shift(); } if (tokens.length !== 0) throw "Unexpected string at end of Q: field"; } if (!delaySet) { tune.metaText.tempo = multilineVars.tempo; delete multilineVars.tempo; } } catch (msg) { warn(msg, line, start); } }
multilineVars.tempo.duration = [num/den];
tempo.duration = [num/den];
function setTempo(line, start, end) { //Q - tempo; can be used to specify the notes per minute, e.g. if //the default note length is an eighth note then Q:120 or Q:C=120 //is 120 eighth notes per minute. Similarly Q:C3=40 would be 40 //dotted quarter notes per minute. An absolute tempo may also be //set, e.g. Q:1/8=120 is also 120 eighth notes per minute, //irrespective of the default note length. // // This is either a number, "C=number", "Cnumber=number", or fraction [fraction...]=number // It depends on the L: field, which may either not be present, or may appear after this. // If L: is not present, an eighth note is used. // That means that this field can't be calculated until the end, if it is the first three types, since we don't know if we'll see an L: field. // So, if it is the fourth type, set it here, otherwise, save the info in the multilineVars. // The temporary variables we keep are the duration and the bpm. In the first two forms, the duration is 1. // In addition, a quoted string may both precede and follow. If a quoted string is present, then the duration part is optional. try { var tokens = tokenizer.tokenize(line, start, end); if (tokens.length === 0) throw "Missing parameter in Q: field"; multilineVars.tempo = {}; var delaySet = true; var token = tokens.shift(); if (token.type === 'quote') { multilineVars.tempo.preString = token.token; token = tokens.shift(); if (tokens.length === 0) { // It's ok to just get a string for the tempo tune.metaText.tempo = multilineVars.tempo; delete multilineVars.tempo; return; } } if (token.type === 'alpha' && token.token === 'C') { // either type 2 or type 3 if (tokens.length === 0) throw "Missing tempo after C in Q: field"; token = tokens.shift(); if (token.type === 'punct' && token.token === '=') { // This is a type 2 format. The duration is an implied 1 if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; multilineVars.tempo.duration = [1]; multilineVars.tempo.bpm = parseInt(token.token); } else if (token.type === 'number') { // This is a type 3 format. multilineVars.tempo.duration = [parseInt(token.token)]; if (tokens.length === 0) throw "Missing = after duration in Q: field"; token = tokens.shift(); if (token.type !== 'punct' || token.token !== '=') throw "Expected = after duration in Q: field"; if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; multilineVars.tempo.bpm = parseInt(token.token); } else throw "Expected number or equal after C in Q: field"; } else if (token.type === 'number') { // either type 1 or type 4 var num = parseInt(token.token); if (tokens.length === 0 || tokens[0].type === 'quote') { // This is type 1 multilineVars.tempo.duration = [1]; multilineVars.tempo.bpm = num; } else { // This is type 4 delaySet = false; token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; var den = parseInt(token.token); multilineVars.tempo.duration = [num/den]; // We got the first fraction, keep getting more as long as we find them. while (tokens.length > 0 && tokens[0].token !== '=' && tokens[0].type !== 'quote') { token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; num = parseInt(token.token); token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; den = parseInt(token.token); multilineVars.tempo.duration.push(num/den); } token = tokens.shift(); if (token.type !== 'punct' && token.token !== '=') throw "Expected = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected tempo in Q: field"; multilineVars.tempo.bpm = parseInt(token.token); } } else throw "Unknown value in Q: field"; if (tokens.length !== 0) { token = tokens.shift(); if (token.type === 'quote') { multilineVars.tempo.postString = token.token; token = tokens.shift(); } if (tokens.length !== 0) throw "Unexpected string at end of Q: field"; } if (!delaySet) { tune.metaText.tempo = multilineVars.tempo; delete multilineVars.tempo; } } catch (msg) { warn(msg, line, start); } }
multilineVars.tempo.duration.push(num/den);
tempo.duration.push(num/den);
function setTempo(line, start, end) { //Q - tempo; can be used to specify the notes per minute, e.g. if //the default note length is an eighth note then Q:120 or Q:C=120 //is 120 eighth notes per minute. Similarly Q:C3=40 would be 40 //dotted quarter notes per minute. An absolute tempo may also be //set, e.g. Q:1/8=120 is also 120 eighth notes per minute, //irrespective of the default note length. // // This is either a number, "C=number", "Cnumber=number", or fraction [fraction...]=number // It depends on the L: field, which may either not be present, or may appear after this. // If L: is not present, an eighth note is used. // That means that this field can't be calculated until the end, if it is the first three types, since we don't know if we'll see an L: field. // So, if it is the fourth type, set it here, otherwise, save the info in the multilineVars. // The temporary variables we keep are the duration and the bpm. In the first two forms, the duration is 1. // In addition, a quoted string may both precede and follow. If a quoted string is present, then the duration part is optional. try { var tokens = tokenizer.tokenize(line, start, end); if (tokens.length === 0) throw "Missing parameter in Q: field"; multilineVars.tempo = {}; var delaySet = true; var token = tokens.shift(); if (token.type === 'quote') { multilineVars.tempo.preString = token.token; token = tokens.shift(); if (tokens.length === 0) { // It's ok to just get a string for the tempo tune.metaText.tempo = multilineVars.tempo; delete multilineVars.tempo; return; } } if (token.type === 'alpha' && token.token === 'C') { // either type 2 or type 3 if (tokens.length === 0) throw "Missing tempo after C in Q: field"; token = tokens.shift(); if (token.type === 'punct' && token.token === '=') { // This is a type 2 format. The duration is an implied 1 if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; multilineVars.tempo.duration = [1]; multilineVars.tempo.bpm = parseInt(token.token); } else if (token.type === 'number') { // This is a type 3 format. multilineVars.tempo.duration = [parseInt(token.token)]; if (tokens.length === 0) throw "Missing = after duration in Q: field"; token = tokens.shift(); if (token.type !== 'punct' || token.token !== '=') throw "Expected = after duration in Q: field"; if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; multilineVars.tempo.bpm = parseInt(token.token); } else throw "Expected number or equal after C in Q: field"; } else if (token.type === 'number') { // either type 1 or type 4 var num = parseInt(token.token); if (tokens.length === 0 || tokens[0].type === 'quote') { // This is type 1 multilineVars.tempo.duration = [1]; multilineVars.tempo.bpm = num; } else { // This is type 4 delaySet = false; token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; var den = parseInt(token.token); multilineVars.tempo.duration = [num/den]; // We got the first fraction, keep getting more as long as we find them. while (tokens.length > 0 && tokens[0].token !== '=' && tokens[0].type !== 'quote') { token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; num = parseInt(token.token); token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; den = parseInt(token.token); multilineVars.tempo.duration.push(num/den); } token = tokens.shift(); if (token.type !== 'punct' && token.token !== '=') throw "Expected = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected tempo in Q: field"; multilineVars.tempo.bpm = parseInt(token.token); } } else throw "Unknown value in Q: field"; if (tokens.length !== 0) { token = tokens.shift(); if (token.type === 'quote') { multilineVars.tempo.postString = token.token; token = tokens.shift(); } if (tokens.length !== 0) throw "Unexpected string at end of Q: field"; } if (!delaySet) { tune.metaText.tempo = multilineVars.tempo; delete multilineVars.tempo; } } catch (msg) { warn(msg, line, start); } }
multilineVars.tempo.postString = token.token;
tempo.postString = token.token;
function setTempo(line, start, end) { //Q - tempo; can be used to specify the notes per minute, e.g. if //the default note length is an eighth note then Q:120 or Q:C=120 //is 120 eighth notes per minute. Similarly Q:C3=40 would be 40 //dotted quarter notes per minute. An absolute tempo may also be //set, e.g. Q:1/8=120 is also 120 eighth notes per minute, //irrespective of the default note length. // // This is either a number, "C=number", "Cnumber=number", or fraction [fraction...]=number // It depends on the L: field, which may either not be present, or may appear after this. // If L: is not present, an eighth note is used. // That means that this field can't be calculated until the end, if it is the first three types, since we don't know if we'll see an L: field. // So, if it is the fourth type, set it here, otherwise, save the info in the multilineVars. // The temporary variables we keep are the duration and the bpm. In the first two forms, the duration is 1. // In addition, a quoted string may both precede and follow. If a quoted string is present, then the duration part is optional. try { var tokens = tokenizer.tokenize(line, start, end); if (tokens.length === 0) throw "Missing parameter in Q: field"; multilineVars.tempo = {}; var delaySet = true; var token = tokens.shift(); if (token.type === 'quote') { multilineVars.tempo.preString = token.token; token = tokens.shift(); if (tokens.length === 0) { // It's ok to just get a string for the tempo tune.metaText.tempo = multilineVars.tempo; delete multilineVars.tempo; return; } } if (token.type === 'alpha' && token.token === 'C') { // either type 2 or type 3 if (tokens.length === 0) throw "Missing tempo after C in Q: field"; token = tokens.shift(); if (token.type === 'punct' && token.token === '=') { // This is a type 2 format. The duration is an implied 1 if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; multilineVars.tempo.duration = [1]; multilineVars.tempo.bpm = parseInt(token.token); } else if (token.type === 'number') { // This is a type 3 format. multilineVars.tempo.duration = [parseInt(token.token)]; if (tokens.length === 0) throw "Missing = after duration in Q: field"; token = tokens.shift(); if (token.type !== 'punct' || token.token !== '=') throw "Expected = after duration in Q: field"; if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; multilineVars.tempo.bpm = parseInt(token.token); } else throw "Expected number or equal after C in Q: field"; } else if (token.type === 'number') { // either type 1 or type 4 var num = parseInt(token.token); if (tokens.length === 0 || tokens[0].type === 'quote') { // This is type 1 multilineVars.tempo.duration = [1]; multilineVars.tempo.bpm = num; } else { // This is type 4 delaySet = false; token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; var den = parseInt(token.token); multilineVars.tempo.duration = [num/den]; // We got the first fraction, keep getting more as long as we find them. while (tokens.length > 0 && tokens[0].token !== '=' && tokens[0].type !== 'quote') { token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; num = parseInt(token.token); token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; den = parseInt(token.token); multilineVars.tempo.duration.push(num/den); } token = tokens.shift(); if (token.type !== 'punct' && token.token !== '=') throw "Expected = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected tempo in Q: field"; multilineVars.tempo.bpm = parseInt(token.token); } } else throw "Unknown value in Q: field"; if (tokens.length !== 0) { token = tokens.shift(); if (token.type === 'quote') { multilineVars.tempo.postString = token.token; token = tokens.shift(); } if (tokens.length !== 0) throw "Unexpected string at end of Q: field"; } if (!delaySet) { tune.metaText.tempo = multilineVars.tempo; delete multilineVars.tempo; } } catch (msg) { warn(msg, line, start); } }
if (!delaySet) { tune.metaText.tempo = multilineVars.tempo; delete multilineVars.tempo; }
return { type: delaySet?'delaySet':'immediate', tempo: tempo };
function setTempo(line, start, end) { //Q - tempo; can be used to specify the notes per minute, e.g. if //the default note length is an eighth note then Q:120 or Q:C=120 //is 120 eighth notes per minute. Similarly Q:C3=40 would be 40 //dotted quarter notes per minute. An absolute tempo may also be //set, e.g. Q:1/8=120 is also 120 eighth notes per minute, //irrespective of the default note length. // // This is either a number, "C=number", "Cnumber=number", or fraction [fraction...]=number // It depends on the L: field, which may either not be present, or may appear after this. // If L: is not present, an eighth note is used. // That means that this field can't be calculated until the end, if it is the first three types, since we don't know if we'll see an L: field. // So, if it is the fourth type, set it here, otherwise, save the info in the multilineVars. // The temporary variables we keep are the duration and the bpm. In the first two forms, the duration is 1. // In addition, a quoted string may both precede and follow. If a quoted string is present, then the duration part is optional. try { var tokens = tokenizer.tokenize(line, start, end); if (tokens.length === 0) throw "Missing parameter in Q: field"; multilineVars.tempo = {}; var delaySet = true; var token = tokens.shift(); if (token.type === 'quote') { multilineVars.tempo.preString = token.token; token = tokens.shift(); if (tokens.length === 0) { // It's ok to just get a string for the tempo tune.metaText.tempo = multilineVars.tempo; delete multilineVars.tempo; return; } } if (token.type === 'alpha' && token.token === 'C') { // either type 2 or type 3 if (tokens.length === 0) throw "Missing tempo after C in Q: field"; token = tokens.shift(); if (token.type === 'punct' && token.token === '=') { // This is a type 2 format. The duration is an implied 1 if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; multilineVars.tempo.duration = [1]; multilineVars.tempo.bpm = parseInt(token.token); } else if (token.type === 'number') { // This is a type 3 format. multilineVars.tempo.duration = [parseInt(token.token)]; if (tokens.length === 0) throw "Missing = after duration in Q: field"; token = tokens.shift(); if (token.type !== 'punct' || token.token !== '=') throw "Expected = after duration in Q: field"; if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; multilineVars.tempo.bpm = parseInt(token.token); } else throw "Expected number or equal after C in Q: field"; } else if (token.type === 'number') { // either type 1 or type 4 var num = parseInt(token.token); if (tokens.length === 0 || tokens[0].type === 'quote') { // This is type 1 multilineVars.tempo.duration = [1]; multilineVars.tempo.bpm = num; } else { // This is type 4 delaySet = false; token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; var den = parseInt(token.token); multilineVars.tempo.duration = [num/den]; // We got the first fraction, keep getting more as long as we find them. while (tokens.length > 0 && tokens[0].token !== '=' && tokens[0].type !== 'quote') { token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; num = parseInt(token.token); token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; den = parseInt(token.token); multilineVars.tempo.duration.push(num/den); } token = tokens.shift(); if (token.type !== 'punct' && token.token !== '=') throw "Expected = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected tempo in Q: field"; multilineVars.tempo.bpm = parseInt(token.token); } } else throw "Unknown value in Q: field"; if (tokens.length !== 0) { token = tokens.shift(); if (token.type === 'quote') { multilineVars.tempo.postString = token.token; token = tokens.shift(); } if (tokens.length !== 0) throw "Unexpected string at end of Q: field"; } if (!delaySet) { tune.metaText.tempo = multilineVars.tempo; delete multilineVars.tempo; } } catch (msg) { warn(msg, line, start); } }
return { type: 'none' };
function setTempo(line, start, end) { //Q - tempo; can be used to specify the notes per minute, e.g. if //the default note length is an eighth note then Q:120 or Q:C=120 //is 120 eighth notes per minute. Similarly Q:C3=40 would be 40 //dotted quarter notes per minute. An absolute tempo may also be //set, e.g. Q:1/8=120 is also 120 eighth notes per minute, //irrespective of the default note length. // // This is either a number, "C=number", "Cnumber=number", or fraction [fraction...]=number // It depends on the L: field, which may either not be present, or may appear after this. // If L: is not present, an eighth note is used. // That means that this field can't be calculated until the end, if it is the first three types, since we don't know if we'll see an L: field. // So, if it is the fourth type, set it here, otherwise, save the info in the multilineVars. // The temporary variables we keep are the duration and the bpm. In the first two forms, the duration is 1. // In addition, a quoted string may both precede and follow. If a quoted string is present, then the duration part is optional. try { var tokens = tokenizer.tokenize(line, start, end); if (tokens.length === 0) throw "Missing parameter in Q: field"; multilineVars.tempo = {}; var delaySet = true; var token = tokens.shift(); if (token.type === 'quote') { multilineVars.tempo.preString = token.token; token = tokens.shift(); if (tokens.length === 0) { // It's ok to just get a string for the tempo tune.metaText.tempo = multilineVars.tempo; delete multilineVars.tempo; return; } } if (token.type === 'alpha' && token.token === 'C') { // either type 2 or type 3 if (tokens.length === 0) throw "Missing tempo after C in Q: field"; token = tokens.shift(); if (token.type === 'punct' && token.token === '=') { // This is a type 2 format. The duration is an implied 1 if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; multilineVars.tempo.duration = [1]; multilineVars.tempo.bpm = parseInt(token.token); } else if (token.type === 'number') { // This is a type 3 format. multilineVars.tempo.duration = [parseInt(token.token)]; if (tokens.length === 0) throw "Missing = after duration in Q: field"; token = tokens.shift(); if (token.type !== 'punct' || token.token !== '=') throw "Expected = after duration in Q: field"; if (tokens.length === 0) throw "Missing tempo after = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected number after = in Q: field"; multilineVars.tempo.bpm = parseInt(token.token); } else throw "Expected number or equal after C in Q: field"; } else if (token.type === 'number') { // either type 1 or type 4 var num = parseInt(token.token); if (tokens.length === 0 || tokens[0].type === 'quote') { // This is type 1 multilineVars.tempo.duration = [1]; multilineVars.tempo.bpm = num; } else { // This is type 4 delaySet = false; token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; var den = parseInt(token.token); multilineVars.tempo.duration = [num/den]; // We got the first fraction, keep getting more as long as we find them. while (tokens.length > 0 && tokens[0].token !== '=' && tokens[0].type !== 'quote') { token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; num = parseInt(token.token); token = tokens.shift(); if (token.type !== 'punct' && token.token !== '/') throw "Expected fraction in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected fraction in Q: field"; den = parseInt(token.token); multilineVars.tempo.duration.push(num/den); } token = tokens.shift(); if (token.type !== 'punct' && token.token !== '=') throw "Expected = in Q: field"; token = tokens.shift(); if (token.type !== 'number') throw "Expected tempo in Q: field"; multilineVars.tempo.bpm = parseInt(token.token); } } else throw "Unknown value in Q: field"; if (tokens.length !== 0) { token = tokens.shift(); if (token.type === 'quote') { multilineVars.tempo.postString = token.token; token = tokens.shift(); } if (tokens.length !== 0) throw "Unexpected string at end of Q: field"; } if (!delaySet) { tune.metaText.tempo = multilineVars.tempo; delete multilineVars.tempo; } } catch (msg) { warn(msg, line, start); } }
this.raw_istream = this.transport.openInputStream(0, 0, 0); this.raw_ostream = this.transport.openOutputStream(0, 0, 0);
this.raw_istream = this.transport.openInputStream(0, 512, 0); this.raw_ostream = this.transport.openOutputStream(0, 512, 0);
setTransport: function(transport) { try { this.transport = transport; this.raw_istream = this.transport.openInputStream(0, 0, 0); this.raw_ostream = this.transport.openOutputStream(0, 0, 0); const replacementChar = Components.interfaces .nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER; var charset = "UTF-8"; this.ostream = Components.classes["@mozilla.org/intl/converter-output-stream;1"] .createInstance(Components.interfaces.nsIConverterOutputStream); this.ostream.init(this.raw_ostream, charset, 0, replacementChar); this.istream = Components.classes["@mozilla.org/intl/converter-input-stream;1"] .createInstance(Components.interfaces.nsIConverterInputStream); this.istream.init(this.raw_istream, charset, 0, replacementChar); if (!this.transport.isAlive()) { log.debug("transport stream is not alive yet"); var mainThread = Components.classes["@mozilla.org/thread-manager;1"] .getService(Components.interfaces.nsIThreadManager).mainThread; var asyncOutputStream = this.raw_ostream.QueryInterface(Components.interfaces.nsIAsyncOutputStream); // We need to be able to write at least one byte. asyncOutputStream.asyncWait(this, 0, 1, mainThread); log.debug("async input wait begun."); } else { log.debug("transport stream is already alive"); this.onConnect(); } } catch (ex) { log.error("setTransport failed: " + ex); this.onNotify("connect-failed", "setTransport failed, Unable to connect; Exception " + ex); this.disconnect(); } },
log.debug("async input wait begun");
log.debug("async input wait begun.");
setTransport: function(transport) { try { this.transport = transport; this.raw_istream = this.transport.openInputStream(0, 0, 0); this.raw_ostream = this.transport.openOutputStream(0, 0, 0); const replacementChar = Components.interfaces .nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER; var charset = "UTF-8"; this.ostream = Components.classes["@mozilla.org/intl/converter-output-stream;1"] .createInstance(Components.interfaces.nsIConverterOutputStream); this.ostream.init(this.raw_ostream, charset, 0, replacementChar); this.istream = Components.classes["@mozilla.org/intl/converter-input-stream;1"] .createInstance(Components.interfaces.nsIConverterInputStream); this.istream.init(this.raw_istream, charset, 0, replacementChar); if (!this.transport.isAlive()) { log.debug("transport stream is not alive yet"); var mainThread = Components.classes["@mozilla.org/thread-manager;1"] .getService(Components.interfaces.nsIThreadManager).mainThread; var asyncOutputStream = this.raw_ostream.QueryInterface(Components.interfaces.nsIAsyncOutputStream); // We need to be able to write at least one byte. asyncOutputStream.asyncWait(this, 0, 1, mainThread); log.debug("async input wait begun"); } else { log.debug("onconnect"); this.onConnect(); } } catch(ex) { log.error(ex, "setTransport failed: "); this.onNotify("connect-failed", "setTransport failed, Unable to connect; Exception "+ex); this.disconnect(); //this.reconnectSoon(); } },
log.debug("onconnect");
log.debug("transport stream is already alive");
setTransport: function(transport) { try { this.transport = transport; this.raw_istream = this.transport.openInputStream(0, 0, 0); this.raw_ostream = this.transport.openOutputStream(0, 0, 0); const replacementChar = Components.interfaces .nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER; var charset = "UTF-8"; this.ostream = Components.classes["@mozilla.org/intl/converter-output-stream;1"] .createInstance(Components.interfaces.nsIConverterOutputStream); this.ostream.init(this.raw_ostream, charset, 0, replacementChar); this.istream = Components.classes["@mozilla.org/intl/converter-input-stream;1"] .createInstance(Components.interfaces.nsIConverterInputStream); this.istream.init(this.raw_istream, charset, 0, replacementChar); if (!this.transport.isAlive()) { log.debug("transport stream is not alive yet"); var mainThread = Components.classes["@mozilla.org/thread-manager;1"] .getService(Components.interfaces.nsIThreadManager).mainThread; var asyncOutputStream = this.raw_ostream.QueryInterface(Components.interfaces.nsIAsyncOutputStream); // We need to be able to write at least one byte. asyncOutputStream.asyncWait(this, 0, 1, mainThread); log.debug("async input wait begun"); } else { log.debug("onconnect"); this.onConnect(); } } catch(ex) { log.error(ex, "setTransport failed: "); this.onNotify("connect-failed", "setTransport failed, Unable to connect; Exception "+ex); this.disconnect(); //this.reconnectSoon(); } },
} catch(ex) { log.error(ex, "setTransport failed: "); this.onNotify("connect-failed", "setTransport failed, Unable to connect; Exception "+ex); this.disconnect();
} catch (ex) { log.error("setTransport failed: " + ex); this.onNotify("connect-failed", "setTransport failed, Unable to connect; Exception " + ex); this.disconnect();
setTransport: function(transport) { try { this.transport = transport; this.raw_istream = this.transport.openInputStream(0, 0, 0); this.raw_ostream = this.transport.openOutputStream(0, 0, 0); const replacementChar = Components.interfaces .nsIConverterInputStream.DEFAULT_REPLACEMENT_CHARACTER; var charset = "UTF-8"; this.ostream = Components.classes["@mozilla.org/intl/converter-output-stream;1"] .createInstance(Components.interfaces.nsIConverterOutputStream); this.ostream.init(this.raw_ostream, charset, 0, replacementChar); this.istream = Components.classes["@mozilla.org/intl/converter-input-stream;1"] .createInstance(Components.interfaces.nsIConverterInputStream); this.istream.init(this.raw_istream, charset, 0, replacementChar); if (!this.transport.isAlive()) { log.debug("transport stream is not alive yet"); var mainThread = Components.classes["@mozilla.org/thread-manager;1"] .getService(Components.interfaces.nsIThreadManager).mainThread; var asyncOutputStream = this.raw_ostream.QueryInterface(Components.interfaces.nsIAsyncOutputStream); // We need to be able to write at least one byte. asyncOutputStream.asyncWait(this, 0, 1, mainThread); log.debug("async input wait begun"); } else { log.debug("onconnect"); this.onConnect(); } } catch(ex) { log.error(ex, "setTransport failed: "); this.onNotify("connect-failed", "setTransport failed, Unable to connect; Exception "+ex); this.disconnect(); //this.reconnectSoon(); } },
}
},
setTreeViewGroupChooser : function() { // TODO: Check to see if we are logged in and trigger an attempt to if not (fail or create dummy chooser if can't log in?) // Get array of group names (and guids somehow) which are ordered by depth-first queries to the group folder structure from KeePassRPC. keefoxInst.treeViewGroupChooser = { rowCount : 10000, getCellText : function(row,column) { if (column.id == "namecol") return "Row "+row; else return "February 18"; }, setTree: function(treebox){ this.treebox = treebox; }, isContainer: function(row){ return false; }, isSeparator: function(row){ return false; }, isSorted: function(){ return false; }, getLevel: function(row){ return 0; }, getImageSrc: function(row,col){ return null; }, getRowProperties: function(index, properties) { var atomService = Components.classes["@mozilla.org/atom-service;1"].getService(Components.interfaces.nsIAtomService); var atom = atomService.getAtom("dummy"); //TODO: maybe set this to be the GUID of the appropriate group? properties.AppendElement(atom); }, getCellProperties: function(row,col,props){}, getColumnProperties: function(colid,col,props){} }; document.getElementById('keefox-group-chooser-tree').view = keefoxInst.treeViewGroupChooser; }
var containerWidth = this.container.offsetWidth; var tabPosition = tabIndex * containerWidth;
var containerHeight = this.container.offsetHeight; var tabPosition = tabIndex * containerHeight;
setup: function(tab) { var tabIndex = this.tabs.index(tab); var containerWidth = this.container.offsetWidth; var tabPosition = tabIndex * containerWidth; if (isNaN(tabPosition) || tabPosition < 0) { tabPosition = 0; } tab.content.setStyle({ position: "absolute", top: "0px", left: tabPosition + "px" }); // Store starting position for use later tab.tStartingPosition = tabPosition; },
top: "0px", left: tabPosition + "px"
top: tabPosition + "px", left: "0px"
setup: function(tab) { var tabIndex = this.tabs.index(tab); var containerWidth = this.container.offsetWidth; var tabPosition = tabIndex * containerWidth; if (isNaN(tabPosition) || tabPosition < 0) { tabPosition = 0; } tab.content.setStyle({ position: "absolute", top: "0px", left: tabPosition + "px" }); // Store starting position for use later tab.tStartingPosition = tabPosition; },
alert('MA JONG');
setup: function(editor) { // add the correct class when the editor becomes active editor.onActivate.add(function(editor) { alert('MA JONG'); $(editor.getContainer()).addClass('expanded'); }); // remove the class when the editor isn't active editor.onDeactivate.add(function(editor) { $(editor.getContainer()).removeClass('expanded'); }); }
$(editor.getContainer()).removeClass('tinyActive');
setup: function(editor) { // catch some events editor.onSaveContent.add(jsBackend.tinyMCE.afterSave); editor.onBeforeSetContent.add(jsBackend.tinyMCE.beforeLoad); // set content editor.onLoadContent.add(jsBackend.tinyMCE.checkContent); // add event editor.onKeyUp.add(function(editor, event) { // show if($('#' + editor.id + '_external').is(':hidden')) { $('#' + editor.id + '_external').show(); } }); /** * It seems like onActivate isn't called when their is just a single * instance. Our workaround is really ugly, we watch each event and * add the class on the container, see: * http://tinymce.moxiecode.com/punbb/viewtopic.php?id=12249 */ // only one instance? if($('.inputEditor').length == 1) { // init var var added = false; // hook all events editor.onEvent.add(function(editor, evt) { // class added before? if(!added) { // hide click to edit $(editor.getContainer()).siblings('.clickToEdit').hide(); // reset var added = true; } }); } // multiple instances, we can rely on onActivate else { // add the correct class when the editor becomes active editor.onActivate.add(function(editor, otherEditor) { // hide click to edit $(editor.getContainer()).siblings('.clickToEdit').hide(); }); // remove the class when the editor isn't active editor.onDeactivate.add(function(editor, otherEditor) { // show click to edit $(editor.getContainer()).siblings('.clickToEdit').show(); // hide if($('#' + editor.id + '_external').is(':visible')) $('#' + editor.id + '_external').hide(); // check the content jsBackend.tinyMCE.checkContent(editor); }); } }
* Our workaround is real ugly, we watch each event and add the class on the container,
* Our workaround is really ugly, we watch each event and add the class on the container,
setup: function(editor) { editor.onLoadContent.add(jsBackend.tinyMCE.checkContent); /** * It seems like onActivate isn't called when their is just a single instance. * Our workaround is real ugly, we watch each event and add the class on the container, * see: http://tinymce.moxiecode.com/punbb/viewtopic.php?id=12249 */ // only one instance? if($('.inputEditor').length == 1) { // init var var added = false; // hook all events editor.onEvent.add(function(editor, evt) { // class added before? if(!added) { // add class $(editor.getContainer()).addClass('expanded'); // reset var added = true; } }); } // multiple instance, we can rely on onActivate else { // add the correct class when the editor becomes active editor.onActivate.add(function(editor, otherEditor) { $(editor.getContainer()).addClass('expanded'); }); // remove the class when the editor isn't active editor.onDeactivate.add(function(editor, otherEditor) { $(editor.getContainer()).removeClass('expanded'); jsBackend.tinyMCE.checkContent(editor); }); } }
$(editor.getContainer()).addClass('expanded');
setup: function(editor) { editor.onLoadContent.add(jsBackend.tinyMCE.checkContent); /** * It seems like onActivate isn't called when their is just a single instance. * Our workaround is really ugly, we watch each event and add the class on the container, * see: http://tinymce.moxiecode.com/punbb/viewtopic.php?id=12249 */ // only one instance? if($('.inputEditor').length == 1) { // init var var added = false; // hook all events editor.onEvent.add(function(editor, evt) { // class added before? if(!added) { // add class $(editor.getContainer()).addClass('expanded'); // hide click to edit $(editor.getContainer()).siblings('.clickToEdit').hide(); // reset var added = true; } }); } // multiple instances, we can rely on onActivate else { // add the correct class when the editor becomes active editor.onActivate.add(function(editor, otherEditor) { // add class $(editor.getContainer()).addClass('expanded'); // hide click to edit $(editor.getContainer()).siblings('.clickToEdit').hide(); }); // remove the class when the editor isn't active editor.onDeactivate.add(function(editor, otherEditor) { // remove the class $(editor.getContainer()).removeClass('expanded'); // show click to edit $(editor.getContainer()).siblings('.clickToEdit').show(); // check the content jsBackend.tinyMCE.checkContent(editor); }); } }
$(editor.getContainer()).removeClass('expanded');
setup: function(editor) { editor.onLoadContent.add(jsBackend.tinyMCE.checkContent); /** * It seems like onActivate isn't called when their is just a single instance. * Our workaround is really ugly, we watch each event and add the class on the container, * see: http://tinymce.moxiecode.com/punbb/viewtopic.php?id=12249 */ // only one instance? if($('.inputEditor').length == 1) { // init var var added = false; // hook all events editor.onEvent.add(function(editor, evt) { // class added before? if(!added) { // add class $(editor.getContainer()).addClass('expanded'); // hide click to edit $(editor.getContainer()).siblings('.clickToEdit').hide(); // reset var added = true; } }); } // multiple instances, we can rely on onActivate else { // add the correct class when the editor becomes active editor.onActivate.add(function(editor, otherEditor) { // add class $(editor.getContainer()).addClass('expanded'); // hide click to edit $(editor.getContainer()).siblings('.clickToEdit').hide(); }); // remove the class when the editor isn't active editor.onDeactivate.add(function(editor, otherEditor) { // remove the class $(editor.getContainer()).removeClass('expanded'); // show click to edit $(editor.getContainer()).siblings('.clickToEdit').show(); // check the content jsBackend.tinyMCE.checkContent(editor); }); } }
number: { percentage: { format: { delimiter: "", separator: ",", precision: 2 } } },
setup: function() { I18n.defaultLocale = "en"; I18n.locale = null; I18n.translations = { en: { hello: "Hello World!", greetings: { stranger: "Hello stranger!", name: "Hello {{name}}!" }, profile: { details: "{{name}} is {{age}}-years old" }, inbox: { one: "You have {{count}} message", other: "You have {{count}} messages", zero: "You have no messages" }, unread: { one: "You have 1 new message ({{unread}} unread)", other: "You have {{count}} new messages ({{unread}} unread)", zero: "You have no new messages ({{unread}} unread)" }, number: null }, pt: { hello: "Olá Mundo!", date: { formats: { "default": "%d/%m/%Y", "short": "%d de %B", "long": "%d de %B de %Y" }, day_names: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"], abbr_day_names: ["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb"], month_names: [null, "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"], abbr_month_names: [null, "Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez"] }, time: { formats: { "default": "%A, %d de %B de %Y, %H:%M h", "short": "%d/%m, %H:%M h", "long": "%A, %d de %B de %Y, %H:%M h" }, am: "AM", pm: "PM" } } } },
editor.onActivate.add(function(editor) { $(editor.getContainer()).addClass('expanded'); }); editor.onDeactivate.add(function(editor) { $(editor.getContainer()).removeClass('expanded'); });
if($('.inputEditor').length == 1) { var added = false; editor.onEvent.add(function(editor, evt) { if(!added) { $(editor.getContainer()).addClass('expanded'); added = true; } }); } else { editor.onActivate.add(function(editor, otherEditor) { $(editor.getContainer()).addClass('expanded'); }); editor.onDeactivate.add(function(editor, otherEditor) { $(editor.getContainer()).removeClass('expanded'); }); }
setup: function(editor) { // add the correct class when the editor becomes active editor.onActivate.add(function(editor) { $(editor.getContainer()).addClass('expanded'); }); // remove the class when the editor isn't active editor.onDeactivate.add(function(editor) { $(editor.getContainer()).removeClass('expanded'); }); }
if (mainButton === undefined || mainButton == null) return;
setupButton_install: function(targetWindow) { KFLog.debug("setupButton_install start"); var mainWindow = targetWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsIWebNavigation) .QueryInterface(Components.interfaces.nsIDocShellTreeItem) .rootTreeItem .QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsIDOMWindow); mainButton = mainWindow.document.getElementById("KeeFox_Main-Button"); // Remove all of the existing buttons for (i = mainButton.childNodes.length; i > 0; i--) { mainButton.removeChild(mainButton.childNodes[0]); } mainButton.setAttribute("class", ""); //mainButton.setAttribute("type", ""); mainButton.removeAttribute("type"); mainButton.setAttribute("label", this.strbundle.getString("installKeeFox.label")); mainButton.setAttribute("disabled", "false"); mainButton.setAttribute("tooltiptext", this.strbundle.getString("installKeeFox.tip")); mainButton.setAttribute("oncommand", "keeFoxInst.KeeFox_MainButtonClick_install()"); },
if (mainButton === undefined || mainButton == null) return;
setupButton_loadKeePass: function(targetWindow) { KFLog.debug("setupButton_loadKeePass start"); var mainWindow = targetWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsIWebNavigation) .QueryInterface(Components.interfaces.nsIDocShellTreeItem) .rootTreeItem .QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsIDOMWindow); mainButton = mainWindow.document.getElementById("KeeFox_Main-Button"); mainButton.setAttribute("label", this.strbundle.getString("launchKeePass.label")); mainButton.setAttribute("disabled", "false"); // Remove all of the existing buttons for (i = mainButton.childNodes.length; i > 0; i--) { mainButton.removeChild(mainButton.childNodes[0]); } mainButton.setAttribute("class", ""); // mainButton.setAttribute("type", ""); mainButton.removeAttribute("type"); mainButton.setAttribute("tooltiptext", this.strbundle.getString("launchKeePass.tip")); mainButton.setAttribute("oncommand", "keeFoxInst.launchKeePass('')"); },
if (DBname == null || DBname == "")
if (DBname === null)
setupButton_ready: function(targetWindow, mainWindowIN) { KFLog.debug("setupButton_ready start"); var mainButton; var mainWindow; if (mainWindowIN != null) mainWindow = mainWindowIN; else { mainWindow = targetWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsIWebNavigation) .QueryInterface(Components.interfaces.nsIDocShellTreeItem) .rootTreeItem .QueryInterface(Components.interfaces.nsIInterfaceRequestor) .getInterface(Components.interfaces.nsIDOMWindow); } mainButton = mainWindow.document.getElementById("KeeFox_Main-Button"); if (mainButton === undefined || mainButton == null) return; mainButton.setAttribute("disabled", "false"); // Remove all of the existing buttons for (var i = mainButton.childNodes.length; i > 0; i--) { mainButton.removeChild(mainButton.childNodes[0]); } mainButton.setAttribute("class", ""); //mainButton.setAttribute("type", ""); mainButton.removeAttribute("type"); var changeDBButton = mainWindow.document.getElementById("KeeFox_ChangeDB-Button"); if (keeFoxInst._keeFoxStorage.get("KeePassDatabaseOpen", false)) { var DBname = mainWindow.keeFoxInst.getDatabaseName(); if (DBname == null || DBname == "") return; // KeePassRPC suddenly dissapeared - toolbar will have been updated from deeper in the stack? maybe not since removal of ICE? mainButton.setAttribute("label", this.strbundle.getString("loggedIn.label")); mainButton.setAttribute("tooltiptext", this.strbundle.getFormattedString("loggedIn.tip",[DBname]) ); // mainButton.setAttribute("oncommand", "alert('blah')"); mainButton.setAttribute("disabled", "true"); mainButton.removeAttribute("oncommand"); } else if (!keeFoxInst._keeFoxStorage.get("KeePassRPCInstalled", false)) { mainButton.setAttribute("label", this.strbundle.getString("installKeeFox.label")); mainButton.setAttribute("tooltiptext", this.strbundle.getString("installKeeFox.tip")); mainButton.setAttribute("oncommand", "keeFoxInst.KeeFox_MainButtonClick_install()"); } else if (!keeFoxInst._keeFoxStorage.get("KeePassRPCActive", false)) { mainButton.setAttribute("label", this.strbundle.getString("launchKeePass.label")); mainButton.setAttribute("tooltiptext", this.strbundle.getString("launchKeePass.tip")); mainButton.setAttribute("oncommand", "keeFoxInst.launchKeePass('')"); } else { mainButton.setAttribute("label", this.strbundle.getString("loggedOut.label")); mainButton.setAttribute("tooltiptext", this.strbundle.getString("loggedOut.tip") ); mainButton.setAttribute("oncommand", "keeFoxInst.loginToKeePass()"); } if (keeFoxInst._keeFoxStorage.get("KeePassDatabaseOpen", false) || keeFoxInst._keeFoxStorage.get("KeePassRPCActive", false)) { changeDBButton.setAttribute("label", this.strbundle.getString("changeDBButton.label")); changeDBButton.setAttribute("tooltiptext", this.strbundle.getString("changeDBButton.tip") ); changeDBButton.setAttribute("onpopupshowing", "keefox_org.toolbar.setMRUdatabases(); event.stopPropagation();"); changeDBButton.setAttribute("disabled", "false"); //changeDBButton.setAttribute("onpopuphiding", "keefox_org.toolbar.detachMRUpopup(); event.stopPropagation();"); } else { changeDBButton.setAttribute("label", this.strbundle.getString("changeDBButtonDisabled.label")); changeDBButton.setAttribute("tooltiptext", this.strbundle.getString("changeDBButtonDisabled.tip") ); changeDBButton.setAttribute("onpopupshowing", ""); //changeDBButton.setAttribute("onpopuphiding", ""); changeDBButton.setAttribute("disabled", "true"); } KFLog.debug("setupButton_ready end"); },
mainWindow.KFdownloadFile("IC1SecDownload", KF_NET35_DOWNLOAD_PATH + KF_NET35_FILE_NAME, KF_NET35_FILE_NAME, mainWindow, window);
persist = mainWindow.KFdownloadFile("IC1SecDownload", KF_NET35_DOWNLOAD_PATH + KF_NET35_FILE_NAME, KF_NET35_FILE_NAME, mainWindow, window, persist);
function setupNET35ExeInstall() {//TODO: cancel net2 downloadinstallState = KF_INSTALL_STATE_NET35_DOWNLOADING | KF_INSTALL_STATE_KI_DOWNLOADED; mainWindow.KFdownloadFile("IC1SecDownload", KF_NET35_DOWNLOAD_PATH + KF_NET35_FILE_NAME, KF_NET35_FILE_NAME, mainWindow, window); hideInstallView(); showProgressView(); showSection('IC1setupNET35downloading'); // call this now and let it decide if it is the right time to run the installer or wait until it's called again by progress listener installState |= KF_INSTALL_STATE_SELECTED_SEC; // we just call IC1 straight away since we currently treat IC1 and IC4 as the same situation IC1setupNET35(mainWindow);}
if (parseInt(month, 10) >= 0) {
if (parseInt(month, 10) >= -1) {
setValue: function(year, month, day) { var date; if (parseInt(month, 10) >= 0) { // strings to numbers year = integer(year); month = integer(month); day = integer(day); date = new Date(year, month, day); } else { date = year || value; year = date.getYear() + 1900; month = date.getMonth(); day = date.getDate(); } // roll year & month if (month == -1) { month = 11; year--; } else if (month == 12) { month = 0; year++; } if (!opened) { select(date, conf); return self; } currMonth = month; currYear = year; // variables var tmp = new Date(year, month, 1 - conf.firstDay), begin = tmp.getDay(), days = dayAm(year, month), prevDays = dayAm(year, month - 1), week; // selectors if (conf.selectors) { // month selector monthSelector.empty(); $.each(labels.months, function(i, m) { if (min < new Date(year, i + 1, -1) && max > new Date(year, i, 0)) { monthSelector.append($("<option/>").html(m).attr("value", i)); } }); // year selector yearSelector.empty(); for (var i = year + conf.yearRange[0]; i < year + conf.yearRange[1]; i++) { if (min < new Date(i + 1, -1, 0) && max > new Date(i, 0, 0)) { yearSelector.append($("<option/>").text(i)); } } monthSelector.val(month); yearSelector.val(year); // title } else { title.html(labels.months[month] + " " + year); } // populate weeks weeks.empty(); pm.add(nm).removeClass(css.disabled); for (var j = 0, a, num; j < 42; j++) { a = $("<a/>"); if (j % 7 === 0) { week = $("<div/>").addClass(css.week); weeks.append(week); } if (j < begin) { a.addClass(css.off); num = prevDays - begin + j + 1; date = new Date(year, month-1, num); } else if (j >= begin + days) { a.addClass(css.off); num = j - days - begin + 1; date = new Date(year, month+1, num); } else { num = j - begin + 1; date = new Date(year, month, num); // current date if (isSameDay(value, date)) { a.attr("id", css.current).addClass(css.focus); // today } else if (isSameDay(now, date)) { a.attr("id", css.today); } } // disabled if (min && date < min) { a.add(pm).addClass(css.disabled); } if (max && date > max) { a.add(nm).addClass(css.disabled); } a.attr("href", "#" + num).text(num).data("date", date); week.append(a); // date picking a.click(function(e) { var el = $(this); if (!el.hasClass(css.disabled)) { $("#" + css.current).removeAttr("id"); el.attr("id", css.current); select(el.data("date"), conf, e); } return false; }); } // sunday if (css.sunday) { weeks.find(css.week).each(function() { var beg = conf.firstDay ? 7 - conf.firstDay : 0; $(this).children().slice(beg, beg + 1).addClass(css.sunday); }); } return self; },
if (!val || val == value) { return self; }
if (val === NaN || val == value) { return self; }
setValue: function(val, e) { val = parseFloat(val); if (!val || val == value) { return self; } var x = (val - conf.min) * (len / range); return seek(x, e); },
if (!$(this).hasClass(css.disabled)) { select($(this).data("date"), conf, e);
var el = $(this); if (!el.hasClass(css.disabled)) { $("#" + css.current).removeAttr("id"); el.attr("id", css.current); select(el.data("date"), conf, e);
setValue: function(year, month, day) { var date; if (parseInt(month, 10) >= 0) { // strings to numbers year = integer(year); month = integer(month); day = integer(day); date = new Date(year, month, day); } else { date = year || value; year = date.getYear() % 100 + 2000; month = date.getMonth(); day = date.getDate(); } // roll year & month if (month == -1) { month = 11; year--; } else if (month == 12) { month = 0; year++; } if (!opened) { select(date, conf); return self; } currMonth = month; currYear = year; // variables var tmp = new Date(year, month, 1 - conf.firstDay), begin = tmp.getDay(), days = dayAm(year, month), prevDays = dayAm(year, month - 1), week; // selectors if (conf.selectors) { // month selector monthSelector.empty(); $.each(labels.months, function(i, m) { if (min < new Date(year, i + 1, -1) && max > new Date(year, i, 0)) { monthSelector.append($("<option/>").html(m).attr("value", i)); } }); // year selector yearSelector.empty(); for (var i = year + conf.yearRange[0]; i < year + conf.yearRange[1]; i++) { if (min < new Date(i + 1, -1, 0) && max > new Date(i, 0, 0)) { yearSelector.append($("<option/>").text(i)); } } monthSelector.val(month); yearSelector.val(year); // title } else { title.html(labels.months[month] + " " + year); } // populate weeks weeks.empty(); pm.add(nm).removeClass(css.disabled); for (var j = 0, a, num; j < 42; j++) { a = $("<a/>"); if (j % 7 === 0) { week = $("<div/>").addClass(css.week); weeks.append(week); } if (j < begin) { a.addClass(css.off); num = prevDays - begin + j + 1; date = new Date(year, month-1, num); } else if (j >= begin + days) { a.addClass(css.off); num = j - days - begin + 1; date = new Date(year, month+1, num); } else { num = j - begin + 1; date = new Date(year, month, num); // current date if (isSameDay(value, date)) { a.attr("id", css.current).addClass(css.focus); // today } else if (isSameDay(now, date)) { a.attr("id", css.today); } } // disabled if (min && date < min) { a.add(pm).addClass(css.disabled); } if (max && date > max) { a.add(nm).addClass(css.disabled); } a.attr("href", "#" + num).text(num).data("date", date); week.append(a); // date picking a.click(function(e) { if (!$(this).hasClass(css.disabled)) { select($(this).data("date"), conf, e); } return false; }); } // sunday if (css.sunday) { weeks.find(css.week).each(function() { var beg = conf.firstDay ? 7 - conf.firstDay : 0; $(this).children().slice(beg, beg + 1).addClass(css.sunday); }); } return self; },
if (typeof month == 'number') {
if (parseInt(month, 10) >= 0) {
setValue: function(year, month, day) { var date; if (typeof month == 'number') { // strings to numbers year = integer(year); month = integer(month); day = integer(day); date = new Date(year, month, day); } else { date = year || value; year = date.getYear() % 100 + 2000; month = date.getMonth(); day = date.getDate(); } // roll year & month if (month == -1) { month = 11; year--; } else if (month == 12) { month = 0; year++; } if (!opened) { select(date, conf); return self; } currMonth = month; currYear = year; // variables var tmp = new Date(year, month, 1 - conf.firstDay), begin = tmp.getDay(), days = dayAm(year, month), prevDays = dayAm(year, month - 1), week; // selectors if (conf.selectors) { // month selector monthSelector.empty(); $.each(labels.months, function(i, m) { if (min < new Date(year, i + 1, -1) && max > new Date(year, i, 0)) { monthSelector.append($("<option/>").html(m).attr("value", i)); } }); // year selector yearSelector.empty(); for (var i = year + conf.yearRange[0]; i < year + conf.yearRange[1]; i++) { if (min < new Date(i + 1, -1, 0) && max > new Date(i, 0, 0)) { yearSelector.append($("<option/>").text(i)); } } monthSelector.val(month); yearSelector.val(year); // title } else { title.html(labels.months[month] + " " + year); } // populate weeks weeks.empty(); pm.add(nm).removeClass(css.disabled); for (var j = 0, a, num; j < 35; j++) { a = $("<a/>"); if (j % 7 === 0) { week = $("<div/>").addClass(css.week); weeks.append(week); } if (j < begin) { a.addClass(css.off); num = prevDays - begin + j + 1; date = new Date(year, month-1, num); } else if (j >= begin + days) { a.addClass(css.off); num = j - days - begin + 1; date = new Date(year, month+1, num); } else { num = j - begin + 1; date = new Date(year, month, num); // current date if (isSameDay(value, date)) { a.attr("id", css.current).addClass(css.focus); // today } else if (isSameDay(now, date)) { a.attr("id", css.today); } } // disabled if (min && date < min) { a.add(pm).addClass(css.disabled); } if (max && date > max) { a.add(nm).addClass(css.disabled); } a.attr("href", "#" + num).text(num).data("date", date); week.append(a); // date picking a.click(function(e) { if (!$(this).hasClass(css.disabled)) { select($(this).data("date"), conf, e); } return false; }); } // sunday if (css.sunday) { weeks.find(css.week).each(function() { var beg = conf.firstDay ? 7 - conf.firstDay : 0; $(this).children().slice(beg, beg + 1).addClass(css.sunday); }); } return self; },
for (var j = 0, a, num; j < 35; j++) {
for (var j = 0, a, num; j < 42; j++) {
setValue: function(year, month, day) { var date; if (typeof month == 'number') { // strings to numbers year = integer(year); month = integer(month); day = integer(day); date = new Date(year, month, day); } else { date = year || value; year = date.getYear() % 100 + 2000; month = date.getMonth(); day = date.getDate(); } // roll year & month if (month == -1) { month = 11; year--; } else if (month == 12) { month = 0; year++; } if (!opened) { select(date, conf); return self; } currMonth = month; currYear = year; // variables var tmp = new Date(year, month, 1 - conf.firstDay), begin = tmp.getDay(), days = dayAm(year, month), prevDays = dayAm(year, month - 1), week; // selectors if (conf.selectors) { // month selector monthSelector.empty(); $.each(labels.months, function(i, m) { if (min < new Date(year, i + 1, -1) && max > new Date(year, i, 0)) { monthSelector.append($("<option/>").html(m).attr("value", i)); } }); // year selector yearSelector.empty(); for (var i = year + conf.yearRange[0]; i < year + conf.yearRange[1]; i++) { if (min < new Date(i + 1, -1, 0) && max > new Date(i, 0, 0)) { yearSelector.append($("<option/>").text(i)); } } monthSelector.val(month); yearSelector.val(year); // title } else { title.html(labels.months[month] + " " + year); } // populate weeks weeks.empty(); pm.add(nm).removeClass(css.disabled); for (var j = 0, a, num; j < 35; j++) { a = $("<a/>"); if (j % 7 === 0) { week = $("<div/>").addClass(css.week); weeks.append(week); } if (j < begin) { a.addClass(css.off); num = prevDays - begin + j + 1; date = new Date(year, month-1, num); } else if (j >= begin + days) { a.addClass(css.off); num = j - days - begin + 1; date = new Date(year, month+1, num); } else { num = j - begin + 1; date = new Date(year, month, num); // current date if (isSameDay(value, date)) { a.attr("id", css.current).addClass(css.focus); // today } else if (isSameDay(now, date)) { a.attr("id", css.today); } } // disabled if (min && date < min) { a.add(pm).addClass(css.disabled); } if (max && date > max) { a.add(nm).addClass(css.disabled); } a.attr("href", "#" + num).text(num).data("date", date); week.append(a); // date picking a.click(function(e) { if (!$(this).hasClass(css.disabled)) { select($(this).data("date"), conf, e); } return false; }); } // sunday if (css.sunday) { weeks.find(css.week).each(function() { var beg = conf.firstDay ? 7 - conf.firstDay : 0; $(this).children().slice(beg, beg + 1).addClass(css.sunday); }); } return self; },
year = date.getYear() + 1900;
year = date.getFullYear();
setValue: function(year, month, day) { var date; if (parseInt(month, 10) >= -1) { // strings to numbers year = integer(year); month = integer(month); day = integer(day); date = new Date(year, month, day); } else { date = year || value; year = date.getYear() + 1900; month = date.getMonth(); day = date.getDate(); } // roll year & month if (month == -1) { month = 11; year--; } else if (month == 12) { month = 0; year++; } if (!opened) { select(date, conf); return self; } currMonth = month; currYear = year; // variables var tmp = new Date(year, month, 1 - conf.firstDay), begin = tmp.getDay(), days = dayAm(year, month), prevDays = dayAm(year, month - 1), week; // selectors if (conf.selectors) { // month selector monthSelector.empty(); $.each(labels.months, function(i, m) { if (min < new Date(year, i + 1, -1) && max > new Date(year, i, 0)) { monthSelector.append($("<option/>").html(m).attr("value", i)); } }); // year selector yearSelector.empty(); for (var i = year + conf.yearRange[0]; i < year + conf.yearRange[1]; i++) { if (min < new Date(i + 1, -1, 0) && max > new Date(i, 0, 0)) { yearSelector.append($("<option/>").text(i)); } } monthSelector.val(month); yearSelector.val(year); // title } else { title.html(labels.months[month] + " " + year); } // populate weeks weeks.empty(); pm.add(nm).removeClass(css.disabled); for (var j = 0, a, num; j < 42; j++) { a = $("<a/>"); if (j % 7 === 0) { week = $("<div/>").addClass(css.week); weeks.append(week); } if (j < begin) { a.addClass(css.off); num = prevDays - begin + j + 1; date = new Date(year, month-1, num); } else if (j >= begin + days) { a.addClass(css.off); num = j - days - begin + 1; date = new Date(year, month+1, num); } else { num = j - begin + 1; date = new Date(year, month, num); // current date if (isSameDay(value, date)) { a.attr("id", css.current).addClass(css.focus); // today } else if (isSameDay(now, date)) { a.attr("id", css.today); } } // disabled if (min && date < min) { a.add(pm).addClass(css.disabled); } if (max && date > max) { a.add(nm).addClass(css.disabled); } a.attr("href", "#" + num).text(num).data("date", date); week.append(a); // date picking a.click(function(e) { var el = $(this); if (!el.hasClass(css.disabled)) { $("#" + css.current).removeAttr("id"); el.attr("id", css.current); select(el.data("date"), conf, e); } return false; }); } // sunday if (css.sunday) { weeks.find(css.week).each(function() { var beg = conf.firstDay ? 7 - conf.firstDay : 0; $(this).children().slice(beg, beg + 1).addClass(css.sunday); }); } return self; },
if (min < new Date(i + 1, -1, 0) && max > new Date(i, 0, 0)) {
if (min <= new Date(i + 1, -1, 1) && max > new Date(i, 0, 0)) {
setValue: function(year, month, day) { var date; if (parseInt(month, 10) >= -1) { // strings to numbers year = integer(year); month = integer(month); day = integer(day); date = new Date(year, month, day); } else { date = year || value; year = date.getFullYear(); month = date.getMonth(); day = date.getDate(); } // roll year & month if (month == -1) { month = 11; year--; } else if (month == 12) { month = 0; year++; } if (!opened) { select(date, conf); return self; } currMonth = month; currYear = year; // variables var tmp = new Date(year, month, 1 - conf.firstDay), begin = tmp.getDay(), days = dayAm(year, month), prevDays = dayAm(year, month - 1), week; // selectors if (conf.selectors) { // month selector monthSelector.empty(); $.each(labels.months, function(i, m) { if (min < new Date(year, i + 1, -1) && max > new Date(year, i, 0)) { monthSelector.append($("<option/>").html(m).attr("value", i)); } }); // year selector yearSelector.empty(); var yearNow = now.getFullYear(); for (var i = yearNow + conf.yearRange[0]; i < yearNow + conf.yearRange[1]; i++) { if (min < new Date(i + 1, -1, 0) && max > new Date(i, 0, 0)) { yearSelector.append($("<option/>").text(i)); } } monthSelector.val(month); yearSelector.val(year); // title } else { title.html(labels.months[month] + " " + year); } // populate weeks weeks.empty(); pm.add(nm).removeClass(css.disabled); // !begin === "sunday" for (var j = !begin ? -7 : 0, a, num; j < (!begin ? 35 : 42); j++) { a = $("<a/>"); if (j % 7 === 0) { week = $("<div/>").addClass(css.week); weeks.append(week); } if (j < begin) { a.addClass(css.off); num = prevDays - begin + j + 1; date = new Date(year, month-1, num); } else if (j >= begin + days) { a.addClass(css.off); num = j - days - begin + 1; date = new Date(year, month+1, num); } else { num = j - begin + 1; date = new Date(year, month, num); // current date if (isSameDay(value, date)) { a.attr("id", css.current).addClass(css.focus); // today } else if (isSameDay(now, date)) { a.attr("id", css.today); } } // disabled if (min && date < min) { a.add(pm).addClass(css.disabled); } if (max && date > max) { a.add(nm).addClass(css.disabled); } a.attr("href", "#" + num).text(num).data("date", date); week.append(a); } // date picking weeks.find("a").click(function(e) { var el = $(this); if (!el.hasClass(css.disabled)) { $("#" + css.current).removeAttr("id"); el.attr("id", css.current); select(el.data("date"), conf, e); } return false; }); // sunday if (css.sunday) { weeks.find(css.week).each(function() { var beg = conf.firstDay ? 7 - conf.firstDay : 0; $(this).children().slice(beg, beg + 1).addClass(css.sunday); }); } return self; },
if (month) {
if (typeof month == 'number') {
setValue: function(year, month, day) { var date; if (month) { // strings to numbers year = integer(year); month = integer(month); day = integer(day); date = new Date(year, month, day); } else { date = year || value; year = date.getYear() % 100 + 2000; month = date.getMonth(); day = date.getDate(); } // roll year & month if (month == -1) { month = 11; year--; } else if (month == 12) { month = 0; year++; } if (!opened) { select(date, conf); return self; } currMonth = month; currYear = year; // variables var tmp = new Date(year, month, 1 - conf.firstDay), begin = tmp.getDay(), days = dayAm(year, month), prevDays = dayAm(year, month - 1), week; // selectors if (conf.selectors) { // month selector monthSelector.empty(); $.each(labels.months, function(i, m) { if (min < new Date(year, i + 1, -1) && max > new Date(year, i, 0)) { monthSelector.append($("<option/>").html(m).attr("value", i)); } }); // year selector yearSelector.empty(); for (var i = year + conf.yearRange[0]; i < year + conf.yearRange[1]; i++) { if (min < new Date(i + 1, -1, 0) && max > new Date(i, 0, 0)) { yearSelector.append($("<option/>").text(i)); } } monthSelector.val(month); yearSelector.val(year); // title } else { title.html(labels.months[month] + " " + year); } // populate weeks weeks.empty(); pm.add(nm).removeClass(css.disabled); for (var j = 0, a, num; j < 35; j++) { a = $("<a/>"); if (j % 7 === 0) { week = $("<div/>").addClass(css.week); weeks.append(week); } if (j < begin) { a.addClass(css.off); num = prevDays - begin + j + 1; date = new Date(year, month-1, num); } else if (j >= begin + days) { a.addClass(css.off); num = j - days - begin + 1; date = new Date(year, month+1, num); } else { num = j - begin + 1; date = new Date(year, month, num); // current date if (isSameDay(value, date)) { a.attr("id", css.current).addClass(css.focus); // today } else if (isSameDay(now, date)) { a.attr("id", css.today); } } // disabled if (min && date < min) { a.add(pm).addClass(css.disabled); } if (max && date > max) { a.add(nm).addClass(css.disabled); } a.attr("href", "#" + num).text(num).data("date", date); week.append(a); // date picking a.click(function(e) { if (!$(this).hasClass(css.disabled)) { select($(this).data("date"), conf, e); } return false; }); } // sunday if (css.sunday) { weeks.find(css.week).each(function() { var beg = conf.firstDay ? 7 - conf.firstDay : 0; $(this).children().slice(beg, beg + 1).addClass(css.sunday); }); } return self; },
return slide(e || $.Event(), undefined, val - conf.min);
return slide(e || $.Event("api"), undefined, val, true);
setValue: function(val, e) { return slide(e || $.Event(), undefined, val - conf.min); },
f.pageCoordinates(c);a=d.x-h.x;d=d.y-h.y;var g=k.create();g[0]=e[0];g[1]=e[4];g[2]=e[8];var j=b.create();b.identity(j);b.translate(j,i);b.rotate(j,d*n,g);b.rotate(j,a*o,m);k.negate(i);b.translate(j,i);k.negate(i);b.multiply(e,j,e);this.paintGl();h=f.pageCoordinates(c)};this.mouseWheelLookAt=function(a,c){f.cancelEvent(c);a=f.wheelDelta(c);a=Math.pow(1.2,a);b.translate(e,i);b.scale(e,[a,a,a]);k.negate(i);b.translate(e,i);k.negate(i);this.paintGl()};this.setWalkParams=function(a,c,d){e=a;p=c;q=d};this.mouseDragWalk=
[a,a,a]);l.negate(i);b.translate(e,i);l.negate(i);this.paintGL()}};this.setWalkParams=function(a,c,d){e=a;p=c;q=d};this.mouseDragWalk=function(a,c){if(this.ctx!=null){var d=f.pageCoordinates(c);a=d.x-h.x;d=d.y-h.y;var g=b.create();b.identity(g);b.rotateY(g,a*q);a=l.create();a[0]=0;a[1]=0;a[2]=-p*d;b.translate(g,a);b.multiply(g,e,e);this.paintGL();h=f.pageCoordinates(c)}};this.mouseDown=function(a,c){f.capture(null);f.capture(j);h=f.pageCoordinates(c)};this.mouseUp=function(){if(h!=null)h=null}});
f.pageCoordinates(c);a=d.x-h.x;d=d.y-h.y;var g=k.create();g[0]=e[0];g[1]=e[4];g[2]=e[8];var j=b.create();b.identity(j);b.translate(j,i);b.rotate(j,d*n,g);b.rotate(j,a*o,m);k.negate(i);b.translate(j,i);k.negate(i);b.multiply(e,j,e);this.paintGl();h=f.pageCoordinates(c)};this.mouseWheelLookAt=function(a,c){f.cancelEvent(c);a=f.wheelDelta(c);a=Math.pow(1.2,a);b.translate(e,i);b.scale(e,[a,a,a]);k.negate(i);b.translate(e,i);k.negate(i);this.paintGl()};this.setWalkParams=function(a,c,d){e=a;p=c;q=d};this.mouseDragWalk=
this.paintGl()};this.setWalkParams=function(a,c,d){e=a;p=c;q=d};this.mouseDragWalk=function(a,c){var d=f.pageCoordinates(c);a=d.x-h.x;d=d.y-h.y;var g=b.create();b.identity(g);b.rotateY(g,a*q);a=k.create();a[0]=0;a[1]=0;a[2]=-p*d;b.translate(g,a);b.multiply(g,e,e);this.paintGl();h=f.pageCoordinates(c)};this.mouseDown=function(a,c){f.capture(null);f.capture(l);h=f.pageCoordinates(c)};this.mouseUp=function(){if(h!=null)h=null}});
f.pageCoordinates(c);a=d.x-h.x;d=d.y-h.y;var g=k.create();g[0]=e[0];g[1]=e[4];g[2]=e[8];var j=b.create();b.identity(j);b.translate(j,i);b.rotate(j,d*n,g);b.rotate(j,a*o,m);k.negate(i);b.translate(j,i);k.negate(i);b.multiply(e,j,e);this.paintGl();h=f.pageCoordinates(c)};this.mouseWheelLookAt=function(a,c){f.cancelEvent(c);a=f.wheelDelta(c);a=Math.pow(1.2,a);b.translate(e,i);b.scale(e,[a,a,a]);k.negate(i);b.translate(e,i);k.negate(i);this.paintGl()};this.setWalkParams=function(a,c,d){e=a;p=c;q=d};this.mouseDragWalk=
this.paintGl()};this.setWalkParams=function(a,c,d){e=a;p=c;q=d};this.mouseDragWalk=function(a,c){var d=f.pageCoordinates(c);a=d.x-h.x;d=d.y-h.y;var g=b.create();b.identity(g);b.rotateY(g,a*q);a=k.create();a[0]=0;a[1]=0;a[2]=-p*d;b.translate(g,a);b.multiply(g,e,e);this.paintGl();h=f.pageCoordinates(c)};this.mouseDown=function(a,c){f.capture(null);f.capture(l);h=f.pageCoordinates(c)};this.mouseUp=function(){if(h!=null)h=null}});
(function(c){var d=[];c.tools=c.tools||{};c.tools.tooltip={version:"1.1.3",conf:{effect:"toggle",fadeOutSpeed:"fast",tip:null,predelay:0,delay:30,opacity:1,lazy:undefined,position:["top","center"],offset:[0,0],cancelDefault:true,relative:false,oneInstance:true,events:{def:"mouseover,mouseout",input:"focus,blur",widget:"focus mouseover,blur mouseout",tooltip:"mouseover,mouseout"},api:false},addEffect:function(e,g,f){b[e]=[g,f]}};var b={toggle:[function(e){var f=this.getConf(),g=this.getTip(),h=f.opacity;if(h<1){g.css({opacity:h})}g.show();e.call()},function(e){this.getTip().hide();e.call()}],fade:[function(e){this.getTip().fadeIn(this.getConf().fadeInSpeed,e)},function(e){this.getTip().fadeOut(this.getConf().fadeOutSpeed,e)}]};function a(f,g){var p=this,k=c(this);f.data("tooltip",p);var l=f.next();if(g.tip){l=c(g.tip);if(l.length>1){l=f.nextAll(g.tip).eq(0);if(!l.length){l=f.parent().nextAll(g.tip).eq(0)}}}function o(u){var t=g.relative?f.position().top:f.offset().top,s=g.relative?f.position().left:f.offset().left,v=g.position[0];t-=l.outerHeight()-g.offset[0];s+=f.outerWidth()+g.offset[1];var q=l.outerHeight()+f.outerHeight();if(v=="center"){t+=q/2}if(v=="bottom"){t+=q}v=g.position[1];var r=l.outerWidth()+f.outerWidth();if(v=="center"){s-=r/2}if(v=="left"){s-=r}return{top:t,left:s}}var i=f.is(":input"),e=i&&f.is(":checkbox, :radio, select, :button"),h=f.attr("type"),n=g.events[h]||g.events[i?(e?"widget":"input"):"def"];n=n.split(/,\s*/);if(n.length!=2){throw"Tooltip: bad events configuration for "+h}f.bind(n[0],function(r){if(g.oneInstance){c.each(d,function(){this.hide()})}var q=l.data("trigger");if(q&&q[0]!=this){l.hide().stop(true,true)}r.target=this;p.show(r);n=g.events.tooltip.split(/,\s*/);l.bind(n[0],function(){p.show(r)});if(n[1]){l.bind(n[1],function(){p.hide(r)})}});f.bind(n[1],function(q){p.hide(q)});if(!c.browser.msie&&!i&&!g.predelay){f.mousemove(function(){if(!p.isShown()){f.triggerHandler("mouseover")}})}if(g.opacity<1){l.css("opacity",g.opacity)}var m=0,j=f.attr("title");if(j&&g.cancelDefault){f.removeAttr("title");f.data("title",j)}c.extend(p,{show:function(r){if(r){f=c(r.target)}clearTimeout(l.data("timer"));if(l.is(":animated")||l.is(":visible")){return p}function q(){l.data("trigger",f);var t=o(r);if(g.tip&&j){l.html(f.data("title"))}r=r||c.Event();r.type="onBeforeShow";k.trigger(r,[t]);if(r.isDefaultPrevented()){return p}t=o(r);l.css({position:"absolute",top:t.top,left:t.left});var s=b[g.effect];if(!s){throw'Nonexistent effect "'+g.effect+'"'}s[0].call(p,function(){r.type="onShow";k.trigger(r)})}if(g.predelay){clearTimeout(m);m=setTimeout(q,g.predelay)}else{q()}return p},hide:function(r){clearTimeout(l.data("timer"));clearTimeout(m);if(!l.is(":visible")){return}function q(){r=r||c.Event();r.type="onBeforeHide";k.trigger(r);if(r.isDefaultPrevented()){return}b[g.effect][1].call(p,function(){r.type="onHide";k.trigger(r)})}if(g.delay&&r){l.data("timer",setTimeout(q,g.delay))}else{q()}return p},isShown:function(){return l.is(":visible, :animated")},getConf:function(){return g},getTip:function(){return l},getTrigger:function(){return f},bind:function(q,r){k.bind(q,r);return p},onHide:function(q){return this.bind("onHide",q)},onBeforeShow:function(q){return this.bind("onBeforeShow",q)},onShow:function(q){return this.bind("onShow",q)},onBeforeHide:function(q){return this.bind("onBeforeHide",q)},unbind:function(q){k.unbind(q);return p}});c.each(g,function(q,r){if(c.isFunction(r)){p.bind(q,r)}})}c.prototype.tooltip=function(e){var f=this.eq(typeof e=="number"?e:0).data("tooltip");if(f){return f}var g=c.extend(true,{},c.tools.tooltip.conf);if(c.isFunction(e)){e={onBeforeShow:e}}else{if(typeof e=="string"){e={tip:e}}}e=c.extend(true,g,e);if(typeof e.position=="string"){e.position=e.position.split(/,?\s/)}if(e.lazy!==false&&(e.lazy===true||this.length>20)){this.one("mouseover",function(h){f=new a(c(this),e);f.show(h);d.push(f)})}else{this.each(function(){f=new a(c(this),e);d.push(f)})}return e.api?f:this}})(jQuery);
setTimeout(function(){c.hide(e)},b.delay);else c.hide(e)});if(m&&b.cancelDefault){a.removeAttr("title");a.data("title",m)}f.extend(c,{show:function(e){if(!d){if(q)d=f(q);else if(b.tip)d=f(b.tip).eq(0);else if(m)d=f(b.layout).addClass(b.tipClass).appendTo(document.body).hide().append(m);else{d=a.next();d.length||(d=a.parent().next())}if(!d.length)throw"Cannot find tooltip for "+a;}if(c.isShown())return c;d.stop(true,true);var g=p(a,d,b);b.tip&&d.html(a.data("title"));e=e||f.Event();e.type="onBeforeShow"; h.trigger(e,[g]);if(e.isDefaultPrevented())return c;g=p(a,d,b);d.css({position:"absolute",top:g.top,left:g.left});l=true;r[0].call(c,function(){e.type="onShow";l="full";h.trigger(e)});g=b.events.tooltip.split(/,\s*/);if(!d.data("__set")){d.bind(g[0],function(){clearTimeout(i);clearTimeout(j)});g[1]&&!a.is("input:not(:checkbox, :radio), textarea")&&d.bind(g[1],function(n){n.relatedTarget!=a[0]&&a.trigger(k[1].split(" ")[0])});d.data("__set",true)}return c},hide:function(e){if(!d||!c.isShown())return c;
(function(c){var d=[];c.tools=c.tools||{};c.tools.tooltip={version:"1.1.3",conf:{effect:"toggle",fadeOutSpeed:"fast",tip:null,predelay:0,delay:30,opacity:1,lazy:undefined,position:["top","center"],offset:[0,0],cancelDefault:true,relative:false,oneInstance:true,events:{def:"mouseover,mouseout",input:"focus,blur",widget:"focus mouseover,blur mouseout",tooltip:"mouseover,mouseout"},api:false},addEffect:function(e,g,f){b[e]=[g,f]}};var b={toggle:[function(e){var f=this.getConf(),g=this.getTip(),h=f.opacity;if(h<1){g.css({opacity:h})}g.show();e.call()},function(e){this.getTip().hide();e.call()}],fade:[function(e){this.getTip().fadeIn(this.getConf().fadeInSpeed,e)},function(e){this.getTip().fadeOut(this.getConf().fadeOutSpeed,e)}]};function a(f,g){var p=this,k=c(this);f.data("tooltip",p);var l=f.next();if(g.tip){l=c(g.tip);if(l.length>1){l=f.nextAll(g.tip).eq(0);if(!l.length){l=f.parent().nextAll(g.tip).eq(0)}}}function o(u){var t=g.relative?f.position().top:f.offset().top,s=g.relative?f.position().left:f.offset().left,v=g.position[0];t-=l.outerHeight()-g.offset[0];s+=f.outerWidth()+g.offset[1];var q=l.outerHeight()+f.outerHeight();if(v=="center"){t+=q/2}if(v=="bottom"){t+=q}v=g.position[1];var r=l.outerWidth()+f.outerWidth();if(v=="center"){s-=r/2}if(v=="left"){s-=r}return{top:t,left:s}}var i=f.is(":input"),e=i&&f.is(":checkbox, :radio, select, :button"),h=f.attr("type"),n=g.events[h]||g.events[i?(e?"widget":"input"):"def"];n=n.split(/,\s*/);if(n.length!=2){throw"Tooltip: bad events configuration for "+h}f.bind(n[0],function(r){if(g.oneInstance){c.each(d,function(){this.hide()})}var q=l.data("trigger");if(q&&q[0]!=this){l.hide().stop(true,true)}r.target=this;p.show(r);n=g.events.tooltip.split(/,\s*/);l.bind(n[0],function(){p.show(r)});if(n[1]){l.bind(n[1],function(){p.hide(r)})}});f.bind(n[1],function(q){p.hide(q)});if(!c.browser.msie&&!i&&!g.predelay){f.mousemove(function(){if(!p.isShown()){f.triggerHandler("mouseover")}})}if(g.opacity<1){l.css("opacity",g.opacity)}var m=0,j=f.attr("title");if(j&&g.cancelDefault){f.removeAttr("title");f.data("title",j)}c.extend(p,{show:function(r){if(r){f=c(r.target)}clearTimeout(l.data("timer"));if(l.is(":animated")||l.is(":visible")){return p}function q(){l.data("trigger",f);var t=o(r);if(g.tip&&j){l.html(f.data("title"))}r=r||c.Event();r.type="onBeforeShow";k.trigger(r,[t]);if(r.isDefaultPrevented()){return p}t=o(r);l.css({position:"absolute",top:t.top,left:t.left});var s=b[g.effect];if(!s){throw'Nonexistent effect "'+g.effect+'"'}s[0].call(p,function(){r.type="onShow";k.trigger(r)})}if(g.predelay){clearTimeout(m);m=setTimeout(q,g.predelay)}else{q()}return p},hide:function(r){clearTimeout(l.data("timer"));clearTimeout(m);if(!l.is(":visible")){return}function q(){r=r||c.Event();r.type="onBeforeHide";k.trigger(r);if(r.isDefaultPrevented()){return}b[g.effect][1].call(p,function(){r.type="onHide";k.trigger(r)})}if(g.delay&&r){l.data("timer",setTimeout(q,g.delay))}else{q()}return p},isShown:function(){return l.is(":visible, :animated")},getConf:function(){return g},getTip:function(){return l},getTrigger:function(){return f},bind:function(q,r){k.bind(q,r);return p},onHide:function(q){return this.bind("onHide",q)},onBeforeShow:function(q){return this.bind("onBeforeShow",q)},onShow:function(q){return this.bind("onShow",q)},onBeforeHide:function(q){return this.bind("onBeforeHide",q)},unbind:function(q){k.unbind(q);return p}});c.each(g,function(q,r){if(c.isFunction(r)){p.bind(q,r)}})}c.prototype.tooltip=function(e){var f=this.eq(typeof e=="number"?e:0).data("tooltip");if(f){return f}var g=c.extend(true,{},c.tools.tooltip.conf);if(c.isFunction(e)){e={onBeforeShow:e}}else{if(typeof e=="string"){e={tip:e}}}e=c.extend(true,g,e);if(typeof e.position=="string"){e.position=e.position.split(/,?\s/)}if(e.lazy!==false&&(e.lazy===true||this.length>20)){this.one("mouseover",function(h){f=new a(c(this),e);f.show(h);d.push(f)})}else{this.each(function(){f=new a(c(this),e);d.push(f)})}return e.api?f:this}})(jQuery);
g.px(a,"borderLeftWidth")-g.px(a,"borderRightWidth")-g.px(a.parentNode,"paddingLeft")-g.px(a.parentNode,"paddingRight");b=U(b,0);f=U(f,1E5);return l<b?b-1:l>f?f+1:a.style.styleFloat!=""?b-1:"auto"}else return"auto"};this.hide=function(a){g.getElement(a).style.display="none"};this.inline=function(a){g.getElement(a).style.display="inline"};this.block=function(a){g.getElement(a).style.display="block"};this.show=function(a){g.getElement(a).style.display=""};var z=null;this.firedTarget=null;this.target=
"block"};this.show=function(a){g.getElement(a).style.display=""};var z=null;this.firedTarget=null;this.target=function(a){return g.firedTarget||a.target||a.srcElement};var da=false;this.capture=function(a){W();if(!(z&&a)){z=a;var b=document.body;if(b.setCapture)a!=null?b.setCapture():b.releaseCapture();if(a!=null){$(b).addClass("unselectable");b.setAttribute("unselectable","on");b.onselectstart="return false;"}else{$(b).removeClass("unselectable");b.setAttribute("unselectable","off");b.onselectstart=
g.px(a,"borderLeftWidth")-g.px(a,"borderRightWidth")-g.px(a.parentNode,"paddingLeft")-g.px(a.parentNode,"paddingRight");b=U(b,0);f=U(f,1E5);return l<b?b-1:l>f?f+1:a.style.styleFloat!=""?b-1:"auto"}else return"auto"};this.hide=function(a){g.getElement(a).style.display="none"};this.inline=function(a){g.getElement(a).style.display="inline"};this.block=function(a){g.getElement(a).style.display="block"};this.show=function(a){g.getElement(a).style.display=""};var z=null;this.firedTarget=null;this.target=
if (event[1]) {
if (event[1] && !trigger.is("input:not(:checkbox, :radio), textarea")) {
show: function(e) { // tip not initialized yet if (!tip) { // find a "manual" tooltip if (title) { tip = $(conf.layout).addClass(conf.tipClass).appendTo(document.body).hide(); } else if (conf.tip) { tip = $(conf.tip).eq(0); } else { tip = trigger.next(); if (!tip.length) { tip = trigger.parent().next(); } } if (!tip.length) { throw "Cannot find tooltip for " + trigger; } } if (self.isShown()) { return self; } // stop previous animation tip.stop(true, true); // get position var pos = getPosition(trigger, tip, conf); // title attribute if (title) { tip.html(title); } // onBeforeShow e = e || $.Event(); e.type = "onBeforeShow"; fire.trigger(e, [pos]); if (e.isDefaultPrevented()) { return self; } // onBeforeShow may have altered the configuration pos = getPosition(trigger, tip, conf); // set position tip.css({position:'absolute', top: pos.top, left: pos.left}); shown = true; // invoke effect effect[0].call(self, function() { e.type = "onShow"; shown = 'full'; fire.trigger(e); }); // tooltip events var event = conf.events.tooltip.split(/,\s*/); tip.bind(event[0], function() { clearTimeout(timer); clearTimeout(pretimer); }); if (event[1]) { tip.bind(event[1], function(e) { // being moved to the trigger element if (e.relatedTarget != trigger[0]) { trigger.trigger(evt[1].split(" ")[0]); } }); } return self; },
var pos = input.offset();
var pos = input.position();
show: function(e) { if (input.is("[readonly]") || opened) { return; } // onBeforeShow e = e || $.Event(); e.type = "onBeforeShow"; fire.trigger(e); if (e.isDefaultPrevented()) { return; } $.each(instances, function() { this.hide(); }); opened = true; // month selector monthSelector.unbind("change").change(function() { self.setValue(yearSelector.val(), $(this).val()); }); // year selector yearSelector.unbind("change").change(function() { self.setValue($(this).val(), monthSelector.val()); }); // prev / next month pm = root.find("#" + css.prev).unbind("click").click(function(e) { if (!pm.hasClass(css.disabled)) { self.addMonth(-1); } return false; }); nm = root.find("#" + css.next).unbind("click").click(function(e) { if (!nm.hasClass(css.disabled)) { self.addMonth(); } return false; }); // set date self.setValue(value); // show calendar var pos = input.offset(); root.css({ top: pos.top + input.outerHeight({margins: true}) + conf.offset[0], left: pos.left + conf.offset[1] }); if (conf.speed) { root.show(conf.speed, function() { onShow(e); }); } else { root.show(); onShow(e); } return self; },
""};var B=null;this.firedTarget=null;this.target=function(a){return g.firedTarget||a.target||a.srcElement};var S=false,Y=false;this.capture=function(a){ca();if(!(B&&a)){B=a;var b=document.body;if(b.setCapture)a!=null?b.setCapture():b.releaseCapture();if(a!=null){$(b).addClass("unselectable");b.setAttribute("unselectable","on");b.onselectstart="return false;"}else{$(b).removeClass("unselectable");b.setAttribute("unselectable","off");b.onselectstart=""}}};this.checkReleaseCapture=function(a,b){B&&a==
""};var B=null;this.firedTarget=null;this.target=function(a){return g.firedTarget||a.target||a.srcElement};var S=false,U=false;this.capture=function(a){ca();if(!(B&&a)){B=a;var b=document.body;if(b.setCapture)a!=null?b.setCapture():b.releaseCapture();if(a!=null){$(b).addClass("unselectable");b.setAttribute("unselectable","on");b.onselectstart="return false;"}else{$(b).removeClass("unselectable");b.setAttribute("unselectable","off");b.onselectstart=""}}};this.checkReleaseCapture=function(a,b){B&&a==
"paddingRight"),h=/^\s*(-?\d+(?:\.\d+)?)\s*\%\s*$/.exec(b);b=(h=h&&h.length==2?h[1]:"0")?parseFloat(h):0;f=(h=(h=/^\s*(-?\d+(?:\.\d+)?)\s*\%\s*$/.exec(f))&&h.length==2?h[1]:"100000")?parseFloat(h):1E5;return k<b?b-1:k>f?f+1:a.style.styleFloat!=""?b-1:"auto"}else return"auto"};this.hide=function(a){g.getElement(a).style.display="none"};this.inline=function(a){g.getElement(a).style.display="inline"};this.block=function(a){g.getElement(a).style.display="block"};this.show=function(a){g.getElement(a).style.display=""};var B=null;this.firedTarget=null;this.target=function(a){return g.firedTarget||a.target||a.srcElement};var S=false,Y=false;this.capture=function(a){ca();if(!(B&&a)){B=a;var b=document.body;if(b.setCapture)a!=null?b.setCapture():b.releaseCapture();if(a!=null){$(b).addClass("unselectable");b.setAttribute("unselectable","on");b.onselectstart="return false;"}else{$(b).removeClass("unselectable");b.setAttribute("unselectable","off");b.onselectstart=""}}};this.checkReleaseCapture=function(a,b){B&&a==
var pos = input.position();
var pos = input.offset();
show: function(e) { if (input.is("[readonly]") || opened) { return; } // onBeforeShow e = e || $.Event(); e.type = "onBeforeShow"; fire.trigger(e); if (e.isDefaultPrevented()) { return; } $.each(instances, function() { this.hide(); }); opened = true; // month selector monthSelector.unbind("change").change(function() { self.setValue(yearSelector.val(), $(this).val()); }); // year selector yearSelector.unbind("change").change(function() { self.setValue($(this).val(), monthSelector.val()); }); // prev / next month pm = root.find("#" + css.prev).unbind("click").click(function(e) { if (!pm.hasClass(css.disabled)) { self.addMonth(-1); } return false; }); nm = root.find("#" + css.next).unbind("click").click(function(e) { if (!nm.hasClass(css.disabled)) { self.addMonth(); } return false; }); // set date self.setValue(value); // show calendar var pos = input.position(); root.css({ top: pos.top + input.outerHeight({margins: true}) + conf.offset[0], left: pos.left + conf.offset[1] }); if (conf.speed) { root.show(conf.speed, function() { onShow(e); }); } else { root.show(); onShow(e); } return self; },
if (input.is("[readonly]")) { return; }
if (input.is("[readonly]") || opened) { return; }
show: function(e) { if (input.is("[readonly]")) { return; } // onBeforeShow e = e || $.Event(); e.type = "onBeforeShow"; fire.trigger(e); if (e.isDefaultPrevented()) { return; } $.each(instances, function() { this.hide(); }); opened = true; // month selector monthSelector.unbind("change").change(function() { self.setValue(yearSelector.val(), $(this).val()); }); // year selector yearSelector.unbind("change").change(function() { self.setValue($(this).val(), monthSelector.val()); }); // prev / next month pm = root.find("#" + css.prev).unbind("click").click(function(e) { if (!pm.hasClass(css.disabled)) { self.addMonth(-1); } return false; }); nm = root.find("#" + css.next).unbind("click").click(function(e) { if (!nm.hasClass(css.disabled)) { self.addMonth(); } return false; }); // set date self.setValue(value); // show calendar var pos = input.offset(); root.css({ top: pos.top + input.outerHeight({margins: true}) + conf.offset[0], left: pos.left + conf.offset[1] }); if (conf.speed) { root.show(conf.speed, function() { onShow(e); }); } else { root.show(); onShow(e); } return self; },
tip = $(conf.layout).addClass(conf.tipClass).appendTo(document.body).hide();
tip = $(conf.layout).addClass(conf.tipClass).appendTo(document.body) .hide().append(title);
show: function(e) { // tip not initialized yet if (!tip) { // find a "manual" tooltip if (title) { tip = $(conf.layout).addClass(conf.tipClass).appendTo(document.body).hide(); } else if (conf.tip) { tip = $(conf.tip).eq(0); } else { tip = trigger.next(); if (!tip.length) { tip = trigger.parent().next(); } } if (!tip.length) { throw "Cannot find tooltip for " + trigger; } } if (self.isShown()) { return self; } // stop previous animation tip.stop(true, true); // get position var pos = getPosition(trigger, tip, conf); // title attribute if (title) { tip.html(title); } // onBeforeShow e = e || $.Event(); e.type = "onBeforeShow"; fire.trigger(e, [pos]); if (e.isDefaultPrevented()) { return self; } // onBeforeShow may have altered the configuration pos = getPosition(trigger, tip, conf); // set position tip.css({position:'absolute', top: pos.top, left: pos.left}); shown = true; // invoke effect effect[0].call(self, function() { e.type = "onShow"; shown = 'full'; fire.trigger(e); }); // tooltip events var event = conf.events.tooltip.split(/,\s*/); tip.bind(event[0], function() { clearTimeout(timer); clearTimeout(pretimer); }); if (event[1] && !trigger.is("input:not(:checkbox, :radio), textarea")) { tip.bind(event[1], function(e) { // being moved to the trigger element if (e.relatedTarget != trigger[0]) { trigger.trigger(evt[1].split(" ")[0]); } }); } return self; },
if (title) { tip.html(title); }
show: function(e) { // tip not initialized yet if (!tip) { // find a "manual" tooltip if (title) { tip = $(conf.layout).addClass(conf.tipClass).appendTo(document.body).hide(); } else if (conf.tip) { tip = $(conf.tip).eq(0); } else { tip = trigger.next(); if (!tip.length) { tip = trigger.parent().next(); } } if (!tip.length) { throw "Cannot find tooltip for " + trigger; } } if (self.isShown()) { return self; } // stop previous animation tip.stop(true, true); // get position var pos = getPosition(trigger, tip, conf); // title attribute if (title) { tip.html(title); } // onBeforeShow e = e || $.Event(); e.type = "onBeforeShow"; fire.trigger(e, [pos]); if (e.isDefaultPrevented()) { return self; } // onBeforeShow may have altered the configuration pos = getPosition(trigger, tip, conf); // set position tip.css({position:'absolute', top: pos.top, left: pos.left}); shown = true; // invoke effect effect[0].call(self, function() { e.type = "onShow"; shown = 'full'; fire.trigger(e); }); // tooltip events var event = conf.events.tooltip.split(/,\s*/); tip.bind(event[0], function() { clearTimeout(timer); clearTimeout(pretimer); }); if (event[1] && !trigger.is("input:not(:checkbox, :radio), textarea")) { tip.bind(event[1], function(e) { // being moved to the trigger element if (e.relatedTarget != trigger[0]) { trigger.trigger(evt[1].split(" ")[0]); } }); } return self; },
if (conf.tip) { tip = $(conf.tip); if (tip.length > 1) { tip = trigger.next(conf.tip); }
if (title) { tip = $(conf.layout).addClass(conf.tipClass).appendTo(document.body); } else { tip = trigger.next(); if (!tip.length) { tip = trigger.parent().next(); } if (!tip.length) { tip = $(conf.tip).eq(0); }
show: function(e) { // tip not initialized yet if (!tip) { // find a "manual" tooltip if (conf.tip) { tip = $(conf.tip); if (tip.length > 1) { tip = trigger.next(conf.tip); } } // create it if (!tip || !tip.length) { tip = $(conf.layout).addClass(conf.tipClass).appendTo(document.body); } } if (self.isShown()) { return self; } // stop previous animation tip.stop(true, true); // get position var pos = getPosition(trigger, tip, conf); // title attribute if (title) { tip.html(title); } // onBeforeShow e = e || $.Event(); e.type = "onBeforeShow"; fire.trigger(e, [pos]); if (e.isDefaultPrevented()) { return self; } // onBeforeShow may have altered the configuration pos = getPosition(trigger, tip, conf); // set position tip.css({position:'absolute', top: pos.top, left: pos.left}); shown = true; // invoke effect effect[0].call(self, function() { e.type = "onShow"; shown = 'full'; fire.trigger(e); }); // tooltip events var event = conf.events.tooltip.split(/,\s*/); tip.bind(event[0], function() { clearTimeout(timer); clearTimeout(pretimer); }); if (event[1]) { tip.bind(event[1], function(e) { // being moved to the trigger element if (e.relatedTarget != trigger[0]) { trigger.trigger(evt[1]); } }); } return self; },
if (!tip || !tip.length) { tip = $(conf.layout).addClass(conf.tipClass).appendTo(document.body); }
} if (tip.length) { tip.hide() } else { throw "Cannot find tooltip for " + trigger;
show: function(e) { // tip not initialized yet if (!tip) { // find a "manual" tooltip if (conf.tip) { tip = $(conf.tip); if (tip.length > 1) { tip = trigger.next(conf.tip); } } // create it if (!tip || !tip.length) { tip = $(conf.layout).addClass(conf.tipClass).appendTo(document.body); } } if (self.isShown()) { return self; } // stop previous animation tip.stop(true, true); // get position var pos = getPosition(trigger, tip, conf); // title attribute if (title) { tip.html(title); } // onBeforeShow e = e || $.Event(); e.type = "onBeforeShow"; fire.trigger(e, [pos]); if (e.isDefaultPrevented()) { return self; } // onBeforeShow may have altered the configuration pos = getPosition(trigger, tip, conf); // set position tip.css({position:'absolute', top: pos.top, left: pos.left}); shown = true; // invoke effect effect[0].call(self, function() { e.type = "onShow"; shown = 'full'; fire.trigger(e); }); // tooltip events var event = conf.events.tooltip.split(/,\s*/); tip.bind(event[0], function() { clearTimeout(timer); clearTimeout(pretimer); }); if (event[1]) { tip.bind(event[1], function(e) { // being moved to the trigger element if (e.relatedTarget != trigger[0]) { trigger.trigger(evt[1]); } }); } return self; },
"paddingRight"),k=/^\s*(-?\d+(?:\.\d+)?)\s*\%\s*$/.exec(b);b=(k=k&&k.length==2?k[1]:"0")?parseFloat(k):0;f=(k=(k=/^\s*(-?\d+(?:\.\d+)?)\s*\%\s*$/.exec(f))&&k.length==2?k[1]:"100000")?parseFloat(k):1E5;return h<b?b-1:h>f?f+1:a.style.styleFloat!=""?b-1:"auto"}else return"auto"};this.hide=function(a){g.getElement(a).style.display="none"};this.inline=function(a){g.getElement(a).style.display="inline"};this.block=function(a){g.getElement(a).style.display="block"};this.show=function(a){g.getElement(a).style.display= ""};var B=null,S=false,Y=false;this.capture=function(a){ca();if(!(B&&a)){B=a;var b=document.body;if(b.setCapture)a!=null?b.setCapture():b.releaseCapture();if(a!=null){$(b).addClass("unselectable");b.setAttribute("unselectable","on");b.onselectstart="return false;"}else{$(b).removeClass("unselectable");b.setAttribute("unselectable","off");b.onselectstart=""}}};this.checkReleaseCapture=function(a,b){B&&a==B&&b.type=="mouseup"&&this.capture(null)};this.getElementsByClassName=function(a,b){if(document.getElementsByClassName)return b.getElementsByClassName(a);
"none"};this.inline=function(a){g.getElement(a).style.display="inline"};this.block=function(a){g.getElement(a).style.display="block"};this.show=function(a){g.getElement(a).style.display=""};var B=null,S=false,Y=false;this.capture=function(a){ca();if(!(B&&a)){B=a;var b=document.body;if(b.setCapture)a!=null?b.setCapture():b.releaseCapture();if(a!=null){$(b).addClass("unselectable");b.setAttribute("unselectable","on");b.onselectstart="return false;"}else{$(b).removeClass("unselectable");b.setAttribute("unselectable",
"paddingRight"),k=/^\s*(-?\d+(?:\.\d+)?)\s*\%\s*$/.exec(b);b=(k=k&&k.length==2?k[1]:"0")?parseFloat(k):0;f=(k=(k=/^\s*(-?\d+(?:\.\d+)?)\s*\%\s*$/.exec(f))&&k.length==2?k[1]:"100000")?parseFloat(k):1E5;return h<b?b-1:h>f?f+1:a.style.styleFloat!=""?b-1:"auto"}else return"auto"};this.hide=function(a){g.getElement(a).style.display="none"};this.inline=function(a){g.getElement(a).style.display="inline"};this.block=function(a){g.getElement(a).style.display="block"};this.show=function(a){g.getElement(a).style.display=""};var B=null,S=false,Y=false;this.capture=function(a){ca();if(!(B&&a)){B=a;var b=document.body;if(b.setCapture)a!=null?b.setCapture():b.releaseCapture();if(a!=null){$(b).addClass("unselectable");b.setAttribute("unselectable","on");b.onselectstart="return false;"}else{$(b).removeClass("unselectable");b.setAttribute("unselectable","off");b.onselectstart=""}}};this.checkReleaseCapture=function(a,b){B&&a==B&&b.type=="mouseup"&&this.capture(null)};this.getElementsByClassName=function(a,b){if(document.getElementsByClassName)return b.getElementsByClassName(a);
if(!c&&l!=m)return false;for(var n=0;n<l;n++){var o=j[n];if((!c||o.specified&&o.nodeName!='_cke_expando')&&o.nodeValue!=i.getAttribute(o.nodeName))return false;}if(c)for(n=0;n<m;n++){o=k[n];if(o.specified&&o.nodeName!='_cke_expando'&&o.nodeValue!=this.getAttribute(o.nodeName))return false;}return true;},isVisible:function(){var i=!!this.$.offsetHeight&&this.getComputedStyle('visibility')!='hidden',j,k;if(i&&(b.webkit||b.opera)){j=this.getWindow();if(!j.equals(a.document.getWindow())&&(k=j.$.frameElement))i=new h(k).isVisible();}return i;},hasAttributes:c&&(b.ie7Compat||b.ie6Compat)?function(){var i=this.$.attributes;for(var j=0;j<i.length;j++){var k=i[j];switch(k.nodeName){case 'class':if(this.getAttribute('class'))return true;case '_cke_expando':continue;default:if(k.specified)return true;}}return false;}:function(){var i=this.$.attributes;return i.length>1||i.length==1&&i[0].nodeName!='_cke_expando';},hasAttribute:function(i){var j=this.$.attributes.getNamedItem(i);return!!(j&&j.specified);},hide:function(){this.setStyle('display','none');},moveChildren:function(i,j){var k=this.$;i=i.$;if(k==i)return;var l;if(j)while(l=k.lastChild)i.insertBefore(k.removeChild(l),i.firstChild);else while(l=k.firstChild)i.appendChild(k.removeChild(l));},show:function(){this.setStyles({display:'',visibility:''});},setAttribute:(function(){var i=function(j,k){this.$.setAttribute(j,k);return this;};if(c&&(b.ie7Compat||b.ie6Compat))return function(j,k){var l=this;if(j=='class')l.$.className=k;else if(j=='style')l.$.style.cssText=k;else if(j=='tabindex')l.$.tabIndex=k;else if(j=='checked')l.$.checked=k;else i.apply(l,arguments);return l;};else return i;})(),setAttributes:function(i){for(var j in i)this.setAttribute(j,i[j]);return this;},setValue:function(i){this.$.value=i;return this;},removeAttribute:(function(){var i=function(j){this.$.removeAttribute(j);};if(c&&(b.ie7Compat||b.ie6Compat))return function(j){if(j=='class')j='className';else if(j=='tabindex')j='tabIndex';i.call(this,j);};else return i;})(),removeAttributes:function(i){if(e.isArray(i))for(var j=0;j<i.length;j++)this.removeAttribute(i[j]);else for(var k in i)i.hasOwnProperty(k)&&this.removeAttribute(k);},removeStyle:function(i){var j=this;j.setStyle(i,'');if(j.$.style.removeAttribute)j.$.style.removeAttribute(e.cssStyleToDomStyle(i));if(!j.$.style.cssText)j.removeAttribute('style');},setStyle:function(i,j){this.$.style[e.cssStyleToDomStyle(i)]=j;return this;},setStyles:function(i){for(var j in i)this.setStyle(j,i[j]);
},show:function(l,m,n,o){this.editor.focus();this._.onMenu(l||a.document.getDocumentElement(),m,n||0,o||0);}}});(function(){j.add('div',{requires:['editingblock','domiterator','styles'],init:function(l){var m=l.lang.div;l.addCommand('creatediv',new a.dialogCommand('creatediv'));l.addCommand('editdiv',new a.dialogCommand('editdiv'));l.addCommand('removediv',{exec:function(n){var o=n.getSelection(),p=o&&o.getRanges(),q,r=o.createBookmarks(),s,t=[];function u(w){var x=new d.elementPath(w),y=x.blockLimit,z=y.is('div')&&y;if(z&&!z.getAttribute('_cke_div_added')){t.push(z);z.setAttribute('_cke_div_added');}};for(var v=0;v<p.length;v++){q=p[v];if(q.collapsed)u(o.getStartElement());else{s=new d.walker(q);s.evaluator=u;s.lastForward();}}for(v=0;v<t.length;v++)t[v].remove(true);o.selectBookmarks(r);}});l.ui.addButton('CreateDiv',{label:m.toolbar,command:'creatediv'});if(l.addMenuItems){l.addMenuItems({editdiv:{label:m.edit,command:'editdiv',group:'div',order:1},removediv:{label:m.remove,command:'removediv',group:'div',order:5}});if(l.contextMenu)l.contextMenu.addListener(function(n,o){if(!n)return null;var p=new d.elementPath(n),q=p.blockLimit;if(q&&q.getAscendant('div',true))return{editdiv:2,removediv:2};return null;});}a.dialog.add('creatediv',this.path+'dialogs/div.js');a.dialog.add('editdiv',this.path+'dialogs/div.js');}});})();(function(){var l={toolbarFocus:{exec:function(n){var o=n._.elementsPath.idBase,p=a.document.getById(o+'0');if(p)p.focus();}}},m='<span class="cke_empty">&nbsp;</span>';j.add('elementspath',{requires:['selection'],init:function(n){var o='cke_path_'+n.name,p,q=function(){if(!p)p=a.document.getById(o);return p;},r='cke_elementspath_'+e.getNextNumber()+'_';n._.elementsPath={idBase:r,filters:[]};n.on('themeSpace',function(s){if(s.data.space=='bottom')s.data.html+='<span id="'+o+'_label" class="cke_voice_label">'+n.lang.elementsPath.eleLabel+'</span>'+'<div id="'+o+'" class="cke_path" role="group" aria-labelledby="'+o+'_label">'+m+'</div>';});n.on('selectionChange',function(s){var t=b,u=s.data.selection,v=u.getStartElement(),w=[],x=s.editor,y=x._.elementsPath.list=[],z=x._.elementsPath.filters;while(v){var A=0;for(var B=0;B<z.length;B++){if(z[B](v)===false){A=1;break;}}if(!A){var C=y.push(v)-1,D;if(v.getAttribute('_cke_real_element_type'))D=v.getAttribute('_cke_real_element_type');else D=v.getName();var E='';if(t.opera||t.gecko&&t.mac)E+=' onkeypress="return false;"';if(t.gecko)E+=' onblur="this.style.cssText = this.style.cssText;"';var F=x.lang.elementsPath.eleTitle.replace(/%1/,D);
if(!c&&l!=m)return false;for(var n=0;n<l;n++){var o=j[n];if((!c||o.specified&&o.nodeName!='_cke_expando')&&o.nodeValue!=i.getAttribute(o.nodeName))return false;}if(c)for(n=0;n<m;n++){o=k[n];if(o.specified&&o.nodeName!='_cke_expando'&&o.nodeValue!=this.getAttribute(o.nodeName))return false;}return true;},isVisible:function(){var i=!!this.$.offsetHeight&&this.getComputedStyle('visibility')!='hidden',j,k;if(i&&(b.webkit||b.opera)){j=this.getWindow();if(!j.equals(a.document.getWindow())&&(k=j.$.frameElement))i=new h(k).isVisible();}return i;},hasAttributes:c&&(b.ie7Compat||b.ie6Compat)?function(){var i=this.$.attributes;for(var j=0;j<i.length;j++){var k=i[j];switch(k.nodeName){case 'class':if(this.getAttribute('class'))return true;case '_cke_expando':continue;default:if(k.specified)return true;}}return false;}:function(){var i=this.$.attributes;return i.length>1||i.length==1&&i[0].nodeName!='_cke_expando';},hasAttribute:function(i){var j=this.$.attributes.getNamedItem(i);return!!(j&&j.specified);},hide:function(){this.setStyle('display','none');},moveChildren:function(i,j){var k=this.$;i=i.$;if(k==i)return;var l;if(j)while(l=k.lastChild)i.insertBefore(k.removeChild(l),i.firstChild);else while(l=k.firstChild)i.appendChild(k.removeChild(l));},show:function(){this.setStyles({display:'',visibility:''});},setAttribute:(function(){var i=function(j,k){this.$.setAttribute(j,k);return this;};if(c&&(b.ie7Compat||b.ie6Compat))return function(j,k){var l=this;if(j=='class')l.$.className=k;else if(j=='style')l.$.style.cssText=k;else if(j=='tabindex')l.$.tabIndex=k;else if(j=='checked')l.$.checked=k;else i.apply(l,arguments);return l;};else return i;})(),setAttributes:function(i){for(var j in i)this.setAttribute(j,i[j]);return this;},setValue:function(i){this.$.value=i;return this;},removeAttribute:(function(){var i=function(j){this.$.removeAttribute(j);};if(c&&(b.ie7Compat||b.ie6Compat))return function(j){if(j=='class')j='className';else if(j=='tabindex')j='tabIndex';i.call(this,j);};else return i;})(),removeAttributes:function(i){if(e.isArray(i))for(var j=0;j<i.length;j++)this.removeAttribute(i[j]);else for(var k in i)i.hasOwnProperty(k)&&this.removeAttribute(k);},removeStyle:function(i){var j=this;j.setStyle(i,'');if(j.$.style.removeAttribute)j.$.style.removeAttribute(e.cssStyleToDomStyle(i));if(!j.$.style.cssText)j.removeAttribute('style');},setStyle:function(i,j){this.$.style[e.cssStyleToDomStyle(i)]=j;return this;},setStyles:function(i){for(var j in i)this.setStyle(j,i[j]);
});
}); self.setDate();
show: function() { // month selector monthSelector.unbind("change").change(function() { self.setDate(yearSelector.val(), $(this).val()); }); // year selector yearSelector.unbind("change").change(function() { self.setDate($(this).val(), monthSelector.val()); }); // prev / next month pm = root.find("#" + css.previousMonth).unbind("click").click(function(e) { if (!pm.hasClass(css.disabled)) { self.prev(); } return false; }); nm = root.find("#" + css.nextMonth).unbind("click").click(function(e) { if (!nm.hasClass(css.disabled)) { self.next(); } return false; }); // set date self.setDate(); // show datepickerer var pos = input.offset(), h = root.height(), w = root.width(); root.css({ top: pos.top + input.outerHeight({margins: true}) + conf.offset[0], left: pos.left + conf.offset[1], width: 0, height: 0, opacity: 0 }).animate({height: h, width: w, opacity: 1}, conf.speed, conf.easing, function() { // keyboard actions $(document).bind("keydown.dp", function(e) { var key = e.keyCode; // esc key if (key == 27) { return self.hide(); } // h=72, j=74, k=75, l=76, down=40, left=37, up=38, right=39 if ($([75, 76, 38, 39, 74, 72, 40, 37]).index(key) != -1) { var days = $("#" + css.weeks + " a"), el = $("." + css.focus), index = days.index(el); el.removeClass(css.focus); if (key == 74 || key == 40) { index += 7; } else if (key == 75 || key == 38) { index -= 7; } else if (key == 76 || key == 39) { index += 1; } else if (key == 72 || key == 37) { index -= 1; } if (index == -1) { self.prev(); el = $("#" + css.weeks + " a:last"); } else if (index == 35) { self.next(); el = $("#" + css.weeks + " a:first"); } else { el = days.eq(index); } el.addClass(css.focus); return false; } // pageUp / pageDown if (key == 34) { return self.next(); } if (key == 33) { return self.prev(); } // home if (key == 36) { return self.setDate(); } // enter if (key == 13) { if (!$(e.target).is("select")) { pick($("." + css.focus).data("date"), conf, e); } } }); // click outside datepicker $(window).bind("click.dp", function(e) { var el = $(e.target); if (!el.parents("#" + css.root).length && el.index(input) !== 0) { self.hide(); } }); }); return self; },
self.setDate();
var pos = input.offset(); root.css({ top: pos.top + input.outerHeight({margins: true}) + conf.offset[0], left: pos.left + conf.offset[1] });
show: function() { // month selector monthSelector.unbind("change").change(function() { self.setDate(yearSelector.val(), $(this).val()); }); // year selector yearSelector.unbind("change").change(function() { self.setDate($(this).val(), monthSelector.val()); }); // prev / next month pm = root.find("#" + css.previousMonth).unbind("click").click(function(e) { if (!pm.hasClass(css.disabled)) { self.prev(); } return false; }); nm = root.find("#" + css.nextMonth).unbind("click").click(function(e) { if (!nm.hasClass(css.disabled)) { self.next(); } return false; }); // set date self.setDate(); // show datepickerer var pos = input.offset(), h = root.height(), w = root.width(); root.css({ top: pos.top + input.outerHeight({margins: true}) + conf.offset[0], left: pos.left + conf.offset[1], width: 0, height: 0, opacity: 0 }).animate({height: h, width: w, opacity: 1}, conf.speed, conf.easing, function() { // keyboard actions $(document).bind("keydown.dp", function(e) { var key = e.keyCode; // esc key if (key == 27) { return self.hide(); } // h=72, j=74, k=75, l=76, down=40, left=37, up=38, right=39 if ($([75, 76, 38, 39, 74, 72, 40, 37]).index(key) != -1) { var days = $("#" + css.weeks + " a"), el = $("." + css.focus), index = days.index(el); el.removeClass(css.focus); if (key == 74 || key == 40) { index += 7; } else if (key == 75 || key == 38) { index -= 7; } else if (key == 76 || key == 39) { index += 1; } else if (key == 72 || key == 37) { index -= 1; } if (index == -1) { self.prev(); el = $("#" + css.weeks + " a:last"); } else if (index == 35) { self.next(); el = $("#" + css.weeks + " a:first"); } else { el = days.eq(index); } el.addClass(css.focus); return false; } // pageUp / pageDown if (key == 34) { return self.next(); } if (key == 33) { return self.prev(); } // home if (key == 36) { return self.setDate(); } // enter if (key == 13) { if (!$(e.target).is("select")) { pick($("." + css.focus).data("date"), conf, e); } } }); // click outside datepicker $(window).bind("click.dp", function(e) { var el = $(e.target); if (!el.parents("#" + css.root).length && el.index(input) !== 0) { self.hide(); } }); }); return self; },
var pos = input.offset(), h = root.height(), w = root.width(); root.css({ top: pos.top + input.outerHeight({margins: true}) + conf.offset[0], left: pos.left + conf.offset[1], width: 0, height: 0, opacity: 0 }).animate({height: h, width: w, opacity: 1}, conf.speed, conf.easing, function() { $(document).bind("keydown.dp", function(e) { var key = e.keyCode; if (key == 27) { return self.hide(); } if ($([75, 76, 38, 39, 74, 72, 40, 37]).index(key) != -1) { var days = $("#" + css.weeks + " a"), el = $("." + css.focus), index = days.index(el); el.removeClass(css.focus); if (key == 74 || key == 40) { index += 7; } else if (key == 75 || key == 38) { index -= 7; } else if (key == 76 || key == 39) { index += 1; } else if (key == 72 || key == 37) { index -= 1; } if (index == -1) { self.prev(); el = $("#" + css.weeks + " a:last"); } else if (index == 35) { self.next(); el = $("#" + css.weeks + " a:first"); } else { el = days.eq(index); } el.addClass(css.focus); return false; } if (key == 34) { return self.next(); } if (key == 33) { return self.prev(); } if (key == 36) { return self.setDate(); } if (key == 13) { if (!$(e.target).is("select")) { pick($("." + css.focus).data("date"), conf, e); } } }); $(window).bind("click.dp", function(e) { var el = $(e.target); if (!el.parents("#" + css.root).length && el.index(input) !== 0) { self.hide(); } }); });
if (conf.speed) { root.show(conf.speed, setupKeyboard); } else { root.show(); setupKeyboard(); }
show: function() { // month selector monthSelector.unbind("change").change(function() { self.setDate(yearSelector.val(), $(this).val()); }); // year selector yearSelector.unbind("change").change(function() { self.setDate($(this).val(), monthSelector.val()); }); // prev / next month pm = root.find("#" + css.previousMonth).unbind("click").click(function(e) { if (!pm.hasClass(css.disabled)) { self.prev(); } return false; }); nm = root.find("#" + css.nextMonth).unbind("click").click(function(e) { if (!nm.hasClass(css.disabled)) { self.next(); } return false; }); // set date self.setDate(); // show datepickerer var pos = input.offset(), h = root.height(), w = root.width(); root.css({ top: pos.top + input.outerHeight({margins: true}) + conf.offset[0], left: pos.left + conf.offset[1], width: 0, height: 0, opacity: 0 }).animate({height: h, width: w, opacity: 1}, conf.speed, conf.easing, function() { // keyboard actions $(document).bind("keydown.dp", function(e) { var key = e.keyCode; // esc key if (key == 27) { return self.hide(); } // h=72, j=74, k=75, l=76, down=40, left=37, up=38, right=39 if ($([75, 76, 38, 39, 74, 72, 40, 37]).index(key) != -1) { var days = $("#" + css.weeks + " a"), el = $("." + css.focus), index = days.index(el); el.removeClass(css.focus); if (key == 74 || key == 40) { index += 7; } else if (key == 75 || key == 38) { index -= 7; } else if (key == 76 || key == 39) { index += 1; } else if (key == 72 || key == 37) { index -= 1; } if (index == -1) { self.prev(); el = $("#" + css.weeks + " a:last"); } else if (index == 35) { self.next(); el = $("#" + css.weeks + " a:first"); } else { el = days.eq(index); } el.addClass(css.focus); return false; } // pageUp / pageDown if (key == 34) { return self.next(); } if (key == 33) { return self.prev(); } // home if (key == 36) { return self.setDate(); } // enter if (key == 13) { if (!$(e.target).is("select")) { pick($("." + css.focus).data("date"), conf, e); } } }); // click outside datepicker $(window).bind("click.dp", function(e) { var el = $(e.target); if (!el.parents("#" + css.root).length && el.index(input) !== 0) { self.hide(); } }); }); return self; },
BF.changeCSS(".verse a, .search_verse a, .first_verse a, .psalm_title a", "cursor: pointer;");
BF.changeCSS(".verse a, .search_verse a, .first_verse a, .psalm_title a, .subscription a", "cursor: pointer;");
function show_cursor() { /// Prevent the cursor from being hidden. clearTimeout(hide_cursor_timeout); if (!is_cursor_visible) { page.style.cursor = "auto"; BF.changeCSS(".verse a, .search_verse a, .first_verse a, .psalm_title a", "cursor: pointer;"); is_cursor_visible = true; } }
lanelist.style.maxHeight = "620px" ;
var lch = parseInt ( document.getElementById('img_container').offsetHeight ) ; lch -= parseInt ( document.getElementById('chr_lanes_container').offsetHeight ) ; lch -= 74 ; lanelist.style.height = lch + "px" ; lanelist.style.maxHeight = lch + "px" ;
function show_lanes () { var form = document.createElement ( 'form' ) ; var h = document.createElement ( 'p' ) ; form.name = 'lanes' ; form.id = 'lanes_form' ; h.id = 'lanes_title' ; h.style.fontWeight = 'bold' ; h.style.borderBottom = '1px solid black' ; h.appendChild ( document.createTextNode ( i18n['lanes_title'] ) ) ; form.appendChild ( h ) ; var lanelist = document.createElement ( 'div' ) ; lanelist.id = "lanelist" ; lanelist.style.fontSize = "8pt" ; lanelist.style.maxHeight = "620px" ; lanelist.style.overflowY = 'scroll' ; lanelist.style.width = '100%' ; create_lane_items ( lanelist , 'radio' ) ; form.appendChild ( lanelist ) ; create_toggle_button ( form ) ;}
showArtifact : function(data) {
showArtifact : function(data, artifactContainer) {
showArtifact : function(data) { this.data = data; if (data == null) { this.find('name', 'repositoryPath')[0].setRawValue(null); this.find('name', 'uploader')[0].setRawValue(null); this.find('name', 'size')[0].setRawValue(null); this.find('name', 'uploaded')[0].setRawValue(null); this.find('name', 'lastChanged')[0].setRawValue(null); this.find('name', 'sha1Hash')[0].setRawValue(null); this.find('name', 'md5Hash')[0].setRawValue(null); this.find('name', 'repositories')[0].setRawValue(null); } else { Ext.Ajax.request({ url : this.data.resourceURI + '?describe=info&isLocal=true', callback : function(options, isSuccess, response) { if (isSuccess) { var infoResp = Ext.decode(response.responseText); if (!infoResp.data.presentLocally) { this.setupNonLocalView(infoResp.data.repositoryPath); } else { this.clearNonLocalView(infoResp.data.canDelete); this.form.setValues(infoResp.data); } } else { if (response.status = 404) { artifactContainer.hideTab(this); } else { Sonatype.utils.connectionError(response, 'Unable to retrieve artifact information.'); } } }, scope : this, method : 'GET', suppressStatus : '404' }); } }
showArtifactContainer : function() { return false;
showArtifactContainer : function( record ) { if ( 'COLLAPSED' == record.get('version') || 'COLLAPSED' == record.get('packaging') || 'COLLAPSED' == record.get('classifier') ) { return false; } return true;
showArtifactContainer : function() { return false; },
var selectedExtraId = $('#block_extra_id_'+ blockId).val();
var selectedExtraId = $('#blockExtraId'+ blockId).val();
showExtraDialog: function(evt) { // prevent the default action evt.preventDefault(); // get the block wherefor we will change the extra var blockId = $(this).attr('rel'); // get selected extra id var selectedExtraId = $('#block_extra_id_'+ blockId).val(); // populate the hidden field, so we know for which block we are changing $('#extraForBlock').val(blockId); // init var var hasModules = false; // check if there already blocks linked $('.linkedExtra input:hidden').each(function() { var id = $(this).val(); if(id != '' && typeof extrasById[id] != 'undefined' && extrasById[id].type == 'block') hasModules = true; }); // blocks linked? if(hasModules) { // show warning $('#extraWarningAlreadyBlock').show(); // disable blocks $('#extraType option[value="block"]').attr('disabled', 'disabled'); } // hide warning else $('#extraWarningAlreadyBlock').hide(); // any extra selected before? And if so, does the extra still exists? if(typeof extrasById[selectedExtraId] != 'undefined') { // set type $('#extraType').val(extrasById[selectedExtraId].type); // populate the modules jsBackend.pages.extras.populateExtraModules(); // set module $('#extraModule').val(extrasById[selectedExtraId].module); // populate the ids jsBackend.pages.extras.populateExtraIds(); // set the extra id $('#extraExtraId').val(extrasById[selectedExtraId].id); } else { // set type $('#extraType').val('html'); $('#extraExtraId').val(''); // populate the modules jsBackend.pages.extras.populateExtraModules(); } // open the modal $('#chooseExtra').dialog('open'); },
else $('#extraWarningAlreadyBlock').hide();
showExtraDialog: function(evt) { // prevent the default action evt.preventDefault(); // get the block wherefor we will change the extra var blockId = $(this).attr('rel'); // get selected extra id var selectedExtraId = $('#blockExtraId'+ blockId).val(); // populate the hidden field, so we know for which block we are changing $('#extraForBlock').val(blockId); // init var var hasModules = false; // check if there already blocks linked $('.linkedExtra input:hidden').each(function() { var id = $(this).val(); if(id != '' && typeof extrasById[id] != 'undefined' && extrasById[id].type == 'block') hasModules = true; }); // blocks linked? if(hasModules) { // show warning $('#extraWarningAlreadyBlock').show(); // disable blocks $('#extraType option[value="block"]').attr('disabled', 'disabled'); } // hide warning else $('#extraWarningAlreadyBlock').hide(); // any extra selected before? And if so, does the extra still exists? if(typeof extrasById[selectedExtraId] != 'undefined') { // set type $('#extraType').val(extrasById[selectedExtraId].type); // populate the modules jsBackend.pages.extras.populateExtraModules(); // set module $('#extraModule').val(extrasById[selectedExtraId].module); // populate the ids jsBackend.pages.extras.populateExtraIds(); // set the extra id $('#extraExtraId').val(extrasById[selectedExtraId].id); } else { // set type $('#extraType').val('html'); $('#extraExtraId').val(''); // populate the modules jsBackend.pages.extras.populateExtraModules(); } // open the modal $('#chooseExtra').dialog('open'); },
this.updateDownloadRemoteIndexCombo( formatField.getValue() );
showHandler: function ( panel ) { var formatField = this.form.findField('format'); if ( formatField ){ this.updateDownloadRemoteIndexCombo( formatField.getValue() ); this.updateIndexableCombo( formatField.getValue() ); } },
this.updateWritePolicy();
showHandler: function ( panel ) { var formatField = this.form.findField('format'); if ( formatField ){ this.updateDownloadRemoteIndexCombo( formatField.getValue() ); this.updateIndexableCombo( formatField.getValue() ); } },
lastFilterValue = null;
this.showPopup = function() { el.style.display = ''; selId = null; };
d.extend({filter:function(a,b,e){if(e)a=":not("+a+")";return d.find.matches(a,b)},dir:function(a,b,e){var g=[];for(a=a[b];a&&a.nodeType!==9&&(e===v||!d(a).is(e));){a.nodeType===1&&g.push(a);a=a[b]}return g},nth:function(a,b,e){b=b||1;for(var g=0;a;a=a[e])if(a.nodeType===1&&++g===b)break;return a},sibling:function(a,b){for(var e=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&e.push(a);return e}});var ia=/[\n\t]/g,W=/\s+/,Ea=/\r/g,Fa=/href|src|style/,Ga=/(button|input)/i,Ha=/(button|input|object|select|textarea)/i,
(f=e);if(f&&typeof f==="string")h=c.filter(f,h);h=this.length>1?c.unique(h):h;if((this.length>1||Da.test(f))&&Ca.test(a))h=h.reverse();return this.pushStack(h,a,I.call(arguments).join(","))}});c.extend({filter:function(a,b,e){if(e)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,e){var f=[];for(a=a[b];a&&a.nodeType!==9&&(e===v||!c(a).is(e));){a.nodeType===1&&f.push(a);a=a[b]}return f},nth:function(a,b,e){b=b||1;for(var f=0;a;a=a[e])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a, b){for(var e=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&e.push(a);return e}});var ia=/[\n\t]/g,W=/\s+/,Ea=/\r/g,Fa=/href|src|style/,Ga=/(button|input)/i,Ha=/(button|input|object|select|textarea)/i,Ia=/^(a|area)$/i,ja=/radio|checkbox/;c.fn.extend({attr:function(a,b){return S(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(p){var o=c(this);o.addClass(a.call(this,
d.extend({filter:function(a,b,e){if(e)a=":not("+a+")";return d.find.matches(a,b)},dir:function(a,b,e){var g=[];for(a=a[b];a&&a.nodeType!==9&&(e===v||!d(a).is(e));){a.nodeType===1&&g.push(a);a=a[b]}return g},nth:function(a,b,e){b=b||1;for(var g=0;a;a=a[e])if(a.nodeType===1&&++g===b)break;return a},sibling:function(a,b){for(var e=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&e.push(a);return e}});var ia=/[\n\t]/g,W=/\s+/,Ea=/\r/g,Fa=/href|src|style/,Ga=/(button|input)/i,Ha=/(button|input|object|select|textarea)/i,
if (val == undefined) {
if (val === undefined) {
function slide(evt, x, val, isSetValue) { // calculate value based on slide position if (val == undefined) { val = x / len * range; // x is calculated based on val. we need to strip off min during calculation } else if (isSetValue) { val -= conf.min; } // increment in steps if (step) { val = Math.round(val / step) * step; } // count x based on value or tweak x if stepping is done if (x == undefined || step) { x = val * len / range; } // nothing changes or out of range --> return if (isNaN(val) || val == value) { return self; } // stay within range x = Math.max(0, Math.min(x, len)); val = x / len * range; if (isSetValue || !vertical) { val += conf.min; } // in vertical ranges value rises upwards if (vertical) { if (isSetValue) { x = len -x; } else { val = conf.max - val; } } // precision val = round(val, precision); // onSlide var isClick = evt.type == "click"; if (fireOnSlide && value !== undefined && !isClick) { evt.type = "onSlide"; fire.trigger(evt, [val, x]); if (evt.isDefaultPrevented()) { return self; } } // speed & callback var speed = isClick ? conf.speed : 0, callback = isClick ? function() { evt.type = "change"; fire.trigger(evt, [val]); } : null; if (vertical) { handle.animate({top: x}, speed, callback); if (conf.progress) { progress.animate({height: len - x + handle.width() / 2}, speed); } } else { handle.animate({left: x}, speed, callback); if (conf.progress) { progress.animate({width: x + handle.width() / 2}, speed); } } // store current value value = val; pos = x; // se input field's value input.val(val); // HTML5 attribute input[0].valueAsNumber = val; return self; }
if (isNaN(val) || val == value) { return self; }
if (isNaN(val)) { return self; }
function slide(evt, x, val, isSetValue) { // calculate value based on slide position if (val == undefined) { val = x / len * range; // x is calculated based on val. we need to strip off min during calculation } else if (isSetValue) { val -= conf.min; } // increment in steps if (step) { val = Math.round(val / step) * step; } // count x based on value or tweak x if stepping is done if (x == undefined || step) { x = val * len / range; } // nothing changes or out of range --> return if (isNaN(val) || val == value) { return self; } // stay within range x = Math.max(0, Math.min(x, len)); val = x / len * range; if (isSetValue || !vertical) { val += conf.min; } // in vertical ranges value rises upwards if (vertical) { if (isSetValue) { x = len -x; } else { val = conf.max - val; } } // precision val = round(val, precision); // onSlide var isClick = evt.type == "click"; if (fireOnSlide && value !== undefined && !isClick) { evt.type = "onSlide"; fire.trigger(evt, [val, x]); if (evt.isDefaultPrevented()) { return self; } } // speed & callback var speed = isClick ? conf.speed : 0, callback = isClick ? function() { evt.type = "change"; fire.trigger(evt, [val]); } : null; if (vertical) { handle.animate({top: x}, speed, callback); if (conf.progress) { progress.animate({height: len - x + handle.width() / 2}, speed); } } else { handle.animate({left: x}, speed, callback); if (conf.progress) { progress.animate({width: x + handle.width() / 2}, speed); } } // store current value value = val; pos = x; // se input field's value input.val(val); // HTML5 attribute input[0].valueAsNumber = val; return self; }
input[0].valueAsNumber = val;
function slide(evt, x, val, isSetValue) { // calculate value based on slide position if (val === undefined) { val = x / len * range; // x is calculated based on val. we need to strip off min during calculation } else if (isSetValue) { val -= conf.min; } // increment in steps if (step) { val = Math.round(val / step) * step; } // count x based on value or tweak x if stepping is done if (x === undefined || step) { x = val * len / range; } // crazy value? if (isNaN(val)) { return self; } // stay within range x = Math.max(0, Math.min(x, len)); val = x / len * range; if (isSetValue || !vertical) { val += conf.min; } // in vertical ranges value rises upwards if (vertical) { if (isSetValue) { x = len -x; } else { val = conf.max - val; } } // precision val = round(val, precision); // onSlide var isClick = evt.type == "click"; if (fireOnSlide && value !== undefined && !isClick) { evt.type = "onSlide"; fire.trigger(evt, [val, x]); if (evt.isDefaultPrevented()) { return self; } } // speed & callback var speed = isClick ? conf.speed : 0, callback = isClick ? function() { evt.type = "change"; fire.trigger(evt, [val]); } : null; if (vertical) { handle.animate({top: x}, speed, callback); if (conf.progress) { progress.animate({height: len - x + handle.width() / 2}, speed); } } else { handle.animate({left: x}, speed, callback); if (conf.progress) { progress.animate({width: x + handle.width() / 2}, speed); } } // store current value value = val; pos = x; // se input field's value input.val(val); // HTML5 attribute input[0].valueAsNumber = val; return self; }
function slide(evt, x, val, isClick) {
function slide(evt, x, val, isSetValue) {
function slide(evt, x, val, isClick) { // calculate value based on slide position if (val == undefined) { val = x / len * range; } // increment in steps if (step) { val = Math.round(val / step) * step; } // count x based on value or tweak x if stepping is done if (x == undefined || step) { x = val * len / range; } // nothing changes or out of range --> return if (isNaN(val) || val == value) { return self; } // stay within range x = Math.max(0, Math.min(x, len)); val += conf.min; val = x / len * range; // precision val = round(val, precision); // onSlide if (fireOnSlide && value !== undefined && !isClick) { evt.type = "onSlide"; fire.trigger(evt, [val, x]); if (evt.isDefaultPrevented()) { return self; } } // speed & callback var speed = isClick ? conf.speed : 0, callback = isClick ? function() { evt.type = "change"; fire.trigger(evt, [val]); } : null; if (conf.vertical) { handle.animate({top: x}, speed, callback); if (conf.progress) { progress.animate({height: x}, speed); } } else { handle.animate({left: x}, speed, callback); if (conf.progress) { progress.animate({width: x}, speed); } } // store current value value = val; pos = x; // se input field's value input.val(val); // HTML5 attribute input[0].valueAsNumber = val; return self; }
x = Math.max(0, Math.min(x, len));
x = Math.max(0, Math.min(x, len)); val = x / len * range; if (isSetValue || !vertical) { val += conf.min; }
function slide(evt, x, val, isClick) { // calculate value based on slide position if (val == undefined) { val = x / len * range; } // increment in steps if (step) { val = Math.round(val / step) * step; } // count x based on value or tweak x if stepping is done if (x == undefined || step) { x = val * len / range; } // nothing changes or out of range --> return if (isNaN(val) || val == value) { return self; } // stay within range x = Math.max(0, Math.min(x, len)); val += conf.min; val = x / len * range; // precision val = round(val, precision); // onSlide if (fireOnSlide && value !== undefined && !isClick) { evt.type = "onSlide"; fire.trigger(evt, [val, x]); if (evt.isDefaultPrevented()) { return self; } } // speed & callback var speed = isClick ? conf.speed : 0, callback = isClick ? function() { evt.type = "change"; fire.trigger(evt, [val]); } : null; if (conf.vertical) { handle.animate({top: x}, speed, callback); if (conf.progress) { progress.animate({height: x}, speed); } } else { handle.animate({left: x}, speed, callback); if (conf.progress) { progress.animate({width: x}, speed); } } // store current value value = val; pos = x; // se input field's value input.val(val); // HTML5 attribute input[0].valueAsNumber = val; return self; }
val += conf.min; val = x / len * range;
if (vertical) { if (isSetValue) { x = len -x; } else { val = conf.max - val; } }
function slide(evt, x, val, isClick) { // calculate value based on slide position if (val == undefined) { val = x / len * range; } // increment in steps if (step) { val = Math.round(val / step) * step; } // count x based on value or tweak x if stepping is done if (x == undefined || step) { x = val * len / range; } // nothing changes or out of range --> return if (isNaN(val) || val == value) { return self; } // stay within range x = Math.max(0, Math.min(x, len)); val += conf.min; val = x / len * range; // precision val = round(val, precision); // onSlide if (fireOnSlide && value !== undefined && !isClick) { evt.type = "onSlide"; fire.trigger(evt, [val, x]); if (evt.isDefaultPrevented()) { return self; } } // speed & callback var speed = isClick ? conf.speed : 0, callback = isClick ? function() { evt.type = "change"; fire.trigger(evt, [val]); } : null; if (conf.vertical) { handle.animate({top: x}, speed, callback); if (conf.progress) { progress.animate({height: x}, speed); } } else { handle.animate({left: x}, speed, callback); if (conf.progress) { progress.animate({width: x}, speed); } } // store current value value = val; pos = x; // se input field's value input.val(val); // HTML5 attribute input[0].valueAsNumber = val; return self; }
if (conf.vertical) {
if (vertical) {
function slide(evt, x, val, isClick) { // calculate value based on slide position if (val == undefined) { val = x / len * range; } // increment in steps if (step) { val = Math.round(val / step) * step; } // count x based on value or tweak x if stepping is done if (x == undefined || step) { x = val * len / range; } // nothing changes or out of range --> return if (isNaN(val) || val == value) { return self; } // stay within range x = Math.max(0, Math.min(x, len)); val += conf.min; val = x / len * range; // precision val = round(val, precision); // onSlide if (fireOnSlide && value !== undefined && !isClick) { evt.type = "onSlide"; fire.trigger(evt, [val, x]); if (evt.isDefaultPrevented()) { return self; } } // speed & callback var speed = isClick ? conf.speed : 0, callback = isClick ? function() { evt.type = "change"; fire.trigger(evt, [val]); } : null; if (conf.vertical) { handle.animate({top: x}, speed, callback); if (conf.progress) { progress.animate({height: x}, speed); } } else { handle.animate({left: x}, speed, callback); if (conf.progress) { progress.animate({width: x}, speed); } } // store current value value = val; pos = x; // se input field's value input.val(val); // HTML5 attribute input[0].valueAsNumber = val; return self; }
if (conf.progress) { progress.animate({height: x}, speed); }
if (conf.progress) { progress.animate({height: len - x + handle.width() / 2}, speed); }
function slide(evt, x, val, isClick) { // calculate value based on slide position if (val == undefined) { val = x / len * range; } // increment in steps if (step) { val = Math.round(val / step) * step; } // count x based on value or tweak x if stepping is done if (x == undefined || step) { x = val * len / range; } // nothing changes or out of range --> return if (isNaN(val) || val == value) { return self; } // stay within range x = Math.max(0, Math.min(x, len)); val += conf.min; val = x / len * range; // precision val = round(val, precision); // onSlide if (fireOnSlide && value !== undefined && !isClick) { evt.type = "onSlide"; fire.trigger(evt, [val, x]); if (evt.isDefaultPrevented()) { return self; } } // speed & callback var speed = isClick ? conf.speed : 0, callback = isClick ? function() { evt.type = "change"; fire.trigger(evt, [val]); } : null; if (conf.vertical) { handle.animate({top: x}, speed, callback); if (conf.progress) { progress.animate({height: x}, speed); } } else { handle.animate({left: x}, speed, callback); if (conf.progress) { progress.animate({width: x}, speed); } } // store current value value = val; pos = x; // se input field's value input.val(val); // HTML5 attribute input[0].valueAsNumber = val; return self; }
if (conf.progress) { progress.animate({width: x}, speed); }
if (conf.progress) { progress.animate({width: x + handle.width() / 2}, speed); }
function slide(evt, x, val, isClick) { // calculate value based on slide position if (val == undefined) { val = x / len * range; } // increment in steps if (step) { val = Math.round(val / step) * step; } // count x based on value or tweak x if stepping is done if (x == undefined || step) { x = val * len / range; } // nothing changes or out of range --> return if (isNaN(val) || val == value) { return self; } // stay within range x = Math.max(0, Math.min(x, len)); val += conf.min; val = x / len * range; // precision val = round(val, precision); // onSlide if (fireOnSlide && value !== undefined && !isClick) { evt.type = "onSlide"; fire.trigger(evt, [val, x]); if (evt.isDefaultPrevented()) { return self; } } // speed & callback var speed = isClick ? conf.speed : 0, callback = isClick ? function() { evt.type = "change"; fire.trigger(evt, [val]); } : null; if (conf.vertical) { handle.animate({top: x}, speed, callback); if (conf.progress) { progress.animate({height: x}, speed); } } else { handle.animate({left: x}, speed, callback); if (conf.progress) { progress.animate({width: x}, speed); } } // store current value value = val; pos = x; // se input field's value input.val(val); // HTML5 attribute input[0].valueAsNumber = val; return self; }
e.type = "onBeforeSlide"; fire.trigger(e); if (e.isDefaultPrevented()) { return false; } init(); var fix = handle.width() / 2;
var fireEvent = e.target != handle[0]; if (fireEvent) { e.type = "onBeforeSlide"; fire.trigger(e); if (e.isDefaultPrevented()) { return false; } } init(); var fix = handle.width() / 2;
function Slider(input, conf) { // private variables var self = this, root = $("<div><div/><a/></div>"), range = conf.max - conf.min, value, callbacks, origo, len, pos, progress, handle; input.before(root); handle = root.addClass(conf.sliderClass).find("a").addClass(conf.handleClass); progress = root.find("div").addClass(conf.progressClass); // get (HTML5) attributes $.each("min,max,size,step,value".split(","), function(i, key) { var val = input.attr(key); conf[key] = parseFloat(val, 10); }); /* with JavaScript we don't want the HTML5 range element NOTE: input.attr("type", "text") throws exception by the browser */ var tmp = $('<input/>') .attr("type", "text") .addClass(input.attr("className")) .attr("name", input.attr("name")) .attr("disabled", input.attr("disabled")); input.replaceWith(tmp); input = tmp; if (conf.hideInput) { input.hide(); } var fire = input.add(this); function init() { var o = handle.offset(); // recalculate when value = 0 (a recovery mechanism) if (!len || !value) { if (conf.vertical) { len = root.height() - handle.outerWidth(true); origo = o.top + len; } else { len = root.width() - handle.outerWidth(true); origo = o.left; } } } // flesh and bone of this tool function seek(x, e) { init(); // fit inside the slider x = Math.min(Math.max(0, x), len); // increment in steps if (conf.size) { x = toSteps(x, conf.size, len); } // calculate value var v = x / len * range + conf.min; if (conf.step) { v = toSteps(v, conf.step, conf.max); } // rounding v = round(v, conf.decimals); if (v != value) { value = v; e = e || $.Event(); e.type = "onSlide"; fire.trigger(e, [v]); } // move handle & resize progress var orig = e && e.originalEvent, speed = orig && orig.type == "click" ? conf.speed : 0; if (conf.vertical) { handle.animate({top: -(x - len)}, speed); progress.animate({height: x}, speed); } else { handle.animate({left: x}, speed); progress.animate({width: x}, speed); } pos = x; return self; } $.extend(self, { setValue: function(v, e) { if (v == value) { return self; } init(); // widget is hidden. cannot determine wrapper dimension if (!len) { value = v; return self; } var x = (v - conf.min) * (len / range); return seek(x, e); }, // if widget is hidden draw: function(e) { var v = value; value = 0; self.setValue(v, e); }, getName: function() { return input.attr("name"); }, getValue: function() { return value; }, getConf: function() { return conf; }, getProgress: function() { return progress; }, getHandle: function() { return handle; }, getInput: function() { return input; }, step: function(am, e) { init(); var x = Math.max(len / conf.step || conf.size || 10, 2); return seek(pos + x * am, e) }, next: function() { return this.step(1); }, prev: function() { return this.step(-1); }, // callback functions bind: function(name, fn) { $(self).bind(name, fn); return self; }, unbind: function(name) { $(self).unbind(name); return self; } }); // callbacks $.each("onBeforeSlide,onSlide,onSlideEnd".split(","), function(i, name) { // from configuration if ($.isFunction(conf[name])) { self.bind(name, conf[name]); } // API methods self[name] = function(fn) { return self.bind(name, fn); }; }); // dragging handle.bind("dragstart", function(e) { if (input.is(":disabled")) { return false; } e.type = "onBeforeSlide"; fire.trigger(e); if (e.isDefaultPrevented()) { return false; } init(); }).bind("drag", function(e) { if (input.is(":disabled")) { return false; } seek(conf.vertical ? origo - e.offsetY : e.offsetX - origo, e); }).bind("dragend", function(e) { e.type = "onSlideEnd"; fire.trigger(e); }).click(function(e) { return e.preventDefault(); }); // clicking root.click(function(e) { if (input.is(":disabled")) { return false; } e.type = "onBeforeSlide"; fire.trigger(e); if (e.isDefaultPrevented()) { return false; } init(); var fix = handle.width() / 2; seek(conf.vertical ? origo - e.pageY + fix : e.pageX - origo - fix, e); e.type = "onSlideEnd"; fire.trigger(e); }); self.onSlide(function(e, val) { input.val(val); }); self.setValue(conf.value || conf.min); }
e.type = "onSlideEnd"; fire.trigger(e);
if (fireEvent) { e.type = "onSlideEnd"; fire.trigger(e); }
function Slider(input, conf) { // private variables var self = this, root = $("<div><div/><a/></div>"), range = conf.max - conf.min, value, callbacks, origo, len, pos, progress, handle; input.before(root); handle = root.addClass(conf.sliderClass).find("a").addClass(conf.handleClass); progress = root.find("div").addClass(conf.progressClass); // get (HTML5) attributes $.each("min,max,size,step,value".split(","), function(i, key) { var val = input.attr(key); conf[key] = parseFloat(val, 10); }); /* with JavaScript we don't want the HTML5 range element NOTE: input.attr("type", "text") throws exception by the browser */ var tmp = $('<input/>') .attr("type", "text") .addClass(input.attr("className")) .attr("name", input.attr("name")) .attr("disabled", input.attr("disabled")); input.replaceWith(tmp); input = tmp; if (conf.hideInput) { input.hide(); } var fire = input.add(this); function init() { var o = handle.offset(); // recalculate when value = 0 (a recovery mechanism) if (!len || !value) { if (conf.vertical) { len = root.height() - handle.outerWidth(true); origo = o.top + len; } else { len = root.width() - handle.outerWidth(true); origo = o.left; } } } // flesh and bone of this tool function seek(x, e) { init(); // fit inside the slider x = Math.min(Math.max(0, x), len); // increment in steps if (conf.size) { x = toSteps(x, conf.size, len); } // calculate value var v = x / len * range + conf.min; if (conf.step) { v = toSteps(v, conf.step, conf.max); } // rounding v = round(v, conf.decimals); if (v != value) { value = v; e = e || $.Event(); e.type = "onSlide"; fire.trigger(e, [v]); } // move handle & resize progress var orig = e && e.originalEvent, speed = orig && orig.type == "click" ? conf.speed : 0; if (conf.vertical) { handle.animate({top: -(x - len)}, speed); progress.animate({height: x}, speed); } else { handle.animate({left: x}, speed); progress.animate({width: x}, speed); } pos = x; return self; } $.extend(self, { setValue: function(v, e) { if (v == value) { return self; } init(); // widget is hidden. cannot determine wrapper dimension if (!len) { value = v; return self; } var x = (v - conf.min) * (len / range); return seek(x, e); }, // if widget is hidden draw: function(e) { var v = value; value = 0; self.setValue(v, e); }, getName: function() { return input.attr("name"); }, getValue: function() { return value; }, getConf: function() { return conf; }, getProgress: function() { return progress; }, getHandle: function() { return handle; }, getInput: function() { return input; }, step: function(am, e) { init(); var x = Math.max(len / conf.step || conf.size || 10, 2); return seek(pos + x * am, e) }, next: function() { return this.step(1); }, prev: function() { return this.step(-1); }, // callback functions bind: function(name, fn) { $(self).bind(name, fn); return self; }, unbind: function(name) { $(self).unbind(name); return self; } }); // callbacks $.each("onBeforeSlide,onSlide,onSlideEnd".split(","), function(i, name) { // from configuration if ($.isFunction(conf[name])) { self.bind(name, conf[name]); } // API methods self[name] = function(fn) { return self.bind(name, fn); }; }); // dragging handle.bind("dragstart", function(e) { if (input.is(":disabled")) { return false; } e.type = "onBeforeSlide"; fire.trigger(e); if (e.isDefaultPrevented()) { return false; } init(); }).bind("drag", function(e) { if (input.is(":disabled")) { return false; } seek(conf.vertical ? origo - e.offsetY : e.offsetX - origo, e); }).bind("dragend", function(e) { e.type = "onSlideEnd"; fire.trigger(e); }).click(function(e) { return e.preventDefault(); }); // clicking root.click(function(e) { if (input.is(":disabled")) { return false; } e.type = "onBeforeSlide"; fire.trigger(e); if (e.isDefaultPrevented()) { return false; } init(); var fix = handle.width() / 2; seek(conf.vertical ? origo - e.pageY + fix : e.pageX - origo - fix, e); e.type = "onSlideEnd"; fire.trigger(e); }); self.onSlide(function(e, val) { input.val(val); }); self.setValue(conf.value || conf.min); }
conf[key] = parseFloat(val, 10);
if (val || val === 0) {; conf[key] = parseFloat(val, 10); }
function Slider(input, conf) { // private variables var self = this, root = $("<div><div/><a/></div>").data("slider", self), value, // current value origo, // handle's start point len, // length of the slider pos, // current position of the handle progress, // progress "bar" handle; // drag handle // create slider input.before(root); handle = root.addClass(conf.sliderClass).find("a").addClass(conf.handleClass); progress = root.find("div").addClass(conf.progressClass); // get (HTML5) attributes into configuration $.each("min,max,step,value".split(","), function(i, key) { var val = input.attr(key); conf[key] = parseFloat(val, 10); }); var range = conf.max - conf.min; /* replace build-in range element for cross browser consistency NOTE: input.attr("type", "text") throws exception by the browser */ if (input[0].getAttribute("type") == 'range') { var tmp = $('<input/>') .attr("type", "text") .addClass(input.attr("className")) .attr("name", input.attr("name")) .attr("disabled", input.attr("disabled")).val(input.val()); input.replaceWith(tmp); input = tmp; } if (conf.hideInput) { input.hide(); } var fire = input.add(this); // flesh and bone of this tool function seek(x, e) { // fit inside the slider x = Math.min(Math.max(0, x), len); // increment in steps if (conf.step) { x = toSteps(x, conf.step, len); } // calculate value var v = round(x / len * range + conf.min, conf.decimals); // onSlide e = e || $.Event(); e.type = "onSlide"; fire.trigger(e, [v]); if (e.isDefaultPrevented()) { return self; } if (v != value) { // move handle & resize progress var isClick = e && e.originalEvent && e.originalEvent.type == "click", speed = isClick ? conf.speed : 0, callback = isClick ? function() { e.type = "change"; fire.trigger(e, [v]); } : null; if (conf.vertical) { handle.animate({top: -(x - len)}, speed, callback); progress.animate({height: x}, speed); } else { handle.animate({left: x}, speed, callback); progress.animate({width: x}, speed); } value = v; pos = x; input.val(v); } return self; } $.extend(self, { setValue: function(val, e) { val = parseFloat(val); if (!val || val == value) { return self; } var x = (val - conf.min) * (len / range); return seek(x, e); }, getValue: function() { return value; }, getConf: function() { return conf; }, getProgress: function() { return progress; }, getHandle: function() { return handle; }, getInput: function() { return input; }, step: function(am, e) { var x = Math.max(len / conf.step || conf.size || 10, 2); return seek(pos + x * am, e); }, next: function() { return this.step(1); }, prev: function() { return this.step(-1); } }); // callbacks $.each("onSlide,change".split(","), function(i, name) { // from configuration if ($.isFunction(conf[name])) { $(self).bind(name, conf[name]); } // API methods self[name] = function(fn) { $(self).bind(name, fn); return self; }; }); // dragging handle.bind("drag", function(e) { if (input.is(":disabled")) { return false; } if (!origo) { init(); } seek(conf.vertical ? origo - e.offsetY : e.offsetX - origo, e); }).bind("dragend", function(e) { if (!e.isDefaultPrevented()) { e.type = "change"; fire.trigger(e, [value]); } }).click(function(e) { return e.preventDefault(); }); // clicking root.click(function(e) { if (input.is(":disabled")) { return false; } var fix = handle.width() / 2; if (!origo) { init(); } seek(conf.vertical ? origo - e.pageY + fix : e.pageX - origo - fix, e); }); input.blur(function(e) { self.setValue($(this).val(), e); }); function init() { if (conf.vertical) { len = dim(root, "height") - dim(handle, "height"); origo = root.offset().top + len; } else { len = dim(root, "width") - dim(handle, "width"); origo = root.offset().left; } } init(); self.setValue(input.val() || conf.min); }
var v = round(x / len * range + conf.min, conf.decimals);
var isClick = e && e.originalEvent && e.originalEvent.type == "click", v = round(x / len * range + conf.min, conf.decimals);
function Slider(input, conf) { // private variables var self = this, root = $("<div><div/><a/></div>").data("slider", self), value, // current value origo, // handle's start point len, // length of the slider pos, // current position of the handle progress, // progress "bar" handle; // drag handle // create slider input.before(root); handle = root.addClass(conf.sliderClass).find("a").addClass(conf.handleClass); progress = root.find("div").addClass(conf.progressClass); // get (HTML5) attributes into configuration $.each("min,max,step,value".split(","), function(i, key) { var val = input.attr(key); conf[key] = parseFloat(val, 10); }); var range = conf.max - conf.min; /* replace build-in range element for cross browser consistency NOTE: input.attr("type", "text") throws exception by the browser */ if (input[0].getAttribute("type") == 'range') { var tmp = $('<input/>') .attr("type", "text") .addClass(input.attr("className")) .attr("name", input.attr("name")) .attr("disabled", input.attr("disabled")).val(input.val()); input.replaceWith(tmp); input = tmp; } if (conf.hideInput) { input.hide(); } var fire = input.add(this); // flesh and bone of this tool function seek(x, e) { // fit inside the slider x = Math.min(Math.max(0, x), len); // increment in steps if (conf.step) { x = toSteps(x, conf.step, len); } // calculate value var v = round(x / len * range + conf.min, conf.decimals); // onSlide e = e || $.Event(); e.type = "onSlide"; fire.trigger(e, [v]); if (e.isDefaultPrevented()) { return self; } if (v != value) { // move handle & resize progress var isClick = e && e.originalEvent && e.originalEvent.type == "click", speed = isClick ? conf.speed : 0, callback = isClick ? function() { e.type = "change"; fire.trigger(e, [v]); } : null; if (conf.vertical) { handle.animate({top: -(x - len)}, speed, callback); progress.animate({height: x}, speed); } else { handle.animate({left: x}, speed, callback); progress.animate({width: x}, speed); } value = v; pos = x; input.val(v); } return self; } $.extend(self, { setValue: function(val, e) { val = parseFloat(val); if (!val || val == value) { return self; } var x = (val - conf.min) * (len / range); return seek(x, e); }, getValue: function() { return value; }, getConf: function() { return conf; }, getProgress: function() { return progress; }, getHandle: function() { return handle; }, getInput: function() { return input; }, step: function(am, e) { var x = Math.max(len / conf.step || conf.size || 10, 2); return seek(pos + x * am, e); }, next: function() { return this.step(1); }, prev: function() { return this.step(-1); } }); // callbacks $.each("onSlide,change".split(","), function(i, name) { // from configuration if ($.isFunction(conf[name])) { $(self).bind(name, conf[name]); } // API methods self[name] = function(fn) { $(self).bind(name, fn); return self; }; }); // dragging handle.bind("drag", function(e) { if (input.is(":disabled")) { return false; } if (!origo) { init(); } seek(conf.vertical ? origo - e.offsetY : e.offsetX - origo, e); }).bind("dragend", function(e) { if (!e.isDefaultPrevented()) { e.type = "change"; fire.trigger(e, [value]); } }).click(function(e) { return e.preventDefault(); }); // clicking root.click(function(e) { if (input.is(":disabled")) { return false; } var fix = handle.width() / 2; if (!origo) { init(); } seek(conf.vertical ? origo - e.pageY + fix : e.pageX - origo - fix, e); }); input.blur(function(e) { self.setValue($(this).val(), e); }); function init() { if (conf.vertical) { len = dim(root, "height") - dim(handle, "height"); origo = root.offset().top + len; } else { len = dim(root, "width") - dim(handle, "width"); origo = root.offset().left; } } init(); self.setValue(input.val() || conf.min); }