rem
stringlengths
0
126k
add
stringlengths
0
441k
context
stringlengths
15
136k
if(schema['Enum']){ var enumer = schema['Enum'];
if(schema.Enum){ var enumer = schema.Enum;
_validate : function(/*Any*/instance,/*Object*/schema,/*Boolean*/ _changing) { var recursion = -1; var errors = []; var prettyPrint = []; function addPrint(indent, message){ var str = ""; for (var i = 0; i < indent; i++) str += "\t"; prettyPrint.push(str + message); } function appendPrint(message){ if (prettyPrint.length > 0) prettyPrint[prettyPrint.length-1] += " " + message; } // validate a value against a property definition function checkProp(value, schema, path,i, recursion){ var l; path += path ? typeof i == 'number' ? '[' + i + ']' : typeof i == 'undefined' ? '' : '.' + i : i; function addError(message){ errors.push({property:path,message:message}); } if((typeof schema != 'object' || schema instanceof Array) && (path || typeof schema != 'function')){ if(typeof schema == 'function'){ if(!(value instanceof schema)){ addError("is not an instance of the class/constructor " + schema.name); } }else if(schema){ addError("Invalid schema/property definition " + schema); } return null; } if(_changing && schema.readonly){ addError("is a readonly field, it can not be changed"); } if(schema['extends']){ // if it extends another schema, it must pass that schema as well checkProp(value,schema['extends'],path,i, recursion); } // validate a value against a type definition function checkType(type,value){ if(type){ if(typeof type == 'string' && type != 'any' && (type == 'null' ? value !== null : typeof value != type) && !(value instanceof Array && type == 'array') && !(type == 'integer' && value%1===0)){ return [{property:path,message:(typeof value) + " value found, but a " + type + " is required"}]; } if(type instanceof Array){ var unionErrors=[]; for(var j = 0; j < type.length; j++){ // a union type if(!(unionErrors=checkType(type[j],value)).length){ break; } } if(unionErrors.length){ return unionErrors; } }else if(typeof type == 'object'){ var priorErrors = errors; errors = []; checkProp(value,type,path, recursion); var theseErrors = errors; errors = priorErrors; return theseErrors; } } return []; } if(value === undefined){ if(!schema.optional){ addError("is missing and it is not optional"); } }else{ if (schema.type === 'union') { var enumField = value[schema.field]; if (enumField === undefined) addError("Expected " + schema.field + " field in " + path); else { addPrint(recursion, enumField+':'); var ttFound = false; for (var tt = 0; tt < schema.types.length; tt++) { if (enumField === schema.types[tt].value) { if (schema.types[tt].properties[schema.field] === undefined) // Don't throw an error when we encounter the original enum field schema.types[tt].properties[schema.field] = { type: "string", output: "hidden" }; errors.concat(checkObj(value,schema.types[tt].properties,path+"."+schema.field+'='+enumField,schema.additionalProperties, recursion+1)); ttFound = true; break; } } if (ttFound === false) { addError("Unknown type " + enumField + " in " + path); } } } else errors = errors.concat(checkType(schema.type,value)); if(schema.disallow && !checkType(schema.disallow,value).length){ addError(" disallowed value was matched"); } if(value !== null){ if(value instanceof Array){ if(schema.items){ if(schema.items instanceof Array){ for(i=0,l=value.length; i<l; i++){ errors.concat(checkProp(value[i],schema.items[i],path,i, recursion)); } }else{ var thisRecursion = (recursion===0)?1:recursion; // TODO-PER-HACK: Not sure why the first case is different. Figure it out someday. for(i=0,l=value.length; i<l; i++){ var nextRecursion = recursion; if (schema.output !== 'noindex') { nextRecursion++; if (typeof value[i] !== 'object') { if (schema.output === 'join') appendPrint(value[i]===null?'null':value[i]); else addPrint(thisRecursion, (value[i]===null?'null':value[i])); } else addPrint(thisRecursion, path.substring(path.lastIndexOf('.')+1) + " " + (i+1)); } errors.concat(checkProp(value[i],schema.items,path,i, nextRecursion)); } } } if(schema.minItems && value.length < schema.minItems){ addError("There must be a minimum of " + schema.minItems + " in the array"); } if(schema.maxItems && value.length > schema.maxItems){ addError("There must be a maximum of " + schema.maxItems + " in the array"); } if (schema.additionalProperties !== true) { for(i in value){ if(value.hasOwnProperty(i)) { var num = parseInt(i); var index = "" + num; var isNum = i === index; if(!isNum ){ addError((typeof i) + " The property " + i + " is not defined in the schema and the schema does not allow additional properties"); } } } } }else if(schema.properties){ errors.concat(checkObj(value,schema.properties,path,schema.additionalProperties, recursion+1)); } if(schema.pattern && typeof value == 'string' && !value.match(schema.pattern)){ addError("does not match the regex pattern " + schema.pattern); } if(schema.maxLength && typeof value == 'string' && value.length > schema.maxLength){ addError("may only be " + schema.maxLength + " characters long"); } if(schema.minLength && typeof value == 'string' && value.length < schema.minLength){ addError("must be at least " + schema.minLength + " characters long"); } if(typeof schema.minimum !== undefined && typeof value == typeof schema.minimum && schema.minimum > value){ addError("must have a minimum value of " + schema.minimum); } if(typeof schema.maximum !== undefined && typeof value == typeof schema.maximum && schema.maximum < value){ addError("must have a maximum value of " + schema.maximum); } if(schema['Enum']){ var enumer = schema['Enum']; l = enumer.length; var found; for(var j = 0; j < l; j++){ if(enumer[j]===value){ found=1; break; } } if(!found){ addError(value + " does not have a value in the enumeration " + enumer.join(", ")); } } if(typeof schema.maxDecimal == 'number' && (value.toString().match(new RegExp("\\.[0-9]{" + (schema.maxDecimal + 1) + ",}")))){ addError("may only have " + schema.maxDecimal + " digits of decimal places"); } } } return null; } function checkAllProps(instance,objTypeDef,path,recursion) { for(var i in objTypeDef){ if(objTypeDef.hasOwnProperty(i)){ var value = instance[i]; var propDef = objTypeDef[i]; if (propDef.output !== 'hidden' && value !== undefined) { if (value === null) addPrint(recursion, i+": null"); else if (typeof value === 'object') addPrint(recursion, i+":"); else addPrint(recursion, i+": "+value); } checkProp(value,propDef,path,i, recursion); } } } // validate an object against a schema function checkObj(instance,objTypeDef,path,additionalProp, recursion){ checkAllProps(instance,objTypeDef,path,recursion); for(i in instance){ if(instance.hasOwnProperty(i)) { if (objTypeDef[i]) { var requires = objTypeDef[i].requires; if(requires && !(requires in instance)){ errors.push({property:path,message:"the presence of the property " + i + " requires that " + requires + " also be present"}); } var prohibits = objTypeDef[i].prohibits; if(prohibits && (prohibits in instance)){ errors.push({property:path,message:"the presence of the property " + i + " prohibits " + requires + " from being present"}); } var value = instance[i]; if(!(i in objTypeDef)){ checkProp(value,additionalProp,path,i, recursion); } if(!_changing && value && value.$schema){ errors = errors.concat(checkProp(value,value.$schema,path,i, recursion)); } } else if (additionalProp!==true){ errors.push({property:path+' '+i,message:(typeof i) + " The property " + i + " is not defined in the schema and the schema does not allow additional properties"}); } } } return errors; } if(schema){ checkProp(instance,schema,'',_changing || '', recursion); } if(!_changing && instance && instance.$schema){ checkProp(instance,instance.$schema,'','', recursion); } return {valid:!errors.length,errors:errors, output: prettyPrint}; }
if(typeof schema.maxDecimal == 'number' &&
if(typeof schema.maxDecimal === 'number' &&
_validate : function(/*Any*/instance,/*Object*/schema,/*Boolean*/ _changing) { var recursion = -1; var errors = []; var prettyPrint = []; function addPrint(indent, message){ var str = ""; for (var i = 0; i < indent; i++) str += "\t"; prettyPrint.push(str + message); } function appendPrint(message){ if (prettyPrint.length > 0) prettyPrint[prettyPrint.length-1] += " " + message; } // validate a value against a property definition function checkProp(value, schema, path,i, recursion){ var l; path += path ? typeof i == 'number' ? '[' + i + ']' : typeof i == 'undefined' ? '' : '.' + i : i; function addError(message){ errors.push({property:path,message:message}); } if((typeof schema != 'object' || schema instanceof Array) && (path || typeof schema != 'function')){ if(typeof schema == 'function'){ if(!(value instanceof schema)){ addError("is not an instance of the class/constructor " + schema.name); } }else if(schema){ addError("Invalid schema/property definition " + schema); } return null; } if(_changing && schema.readonly){ addError("is a readonly field, it can not be changed"); } if(schema['extends']){ // if it extends another schema, it must pass that schema as well checkProp(value,schema['extends'],path,i, recursion); } // validate a value against a type definition function checkType(type,value){ if(type){ if(typeof type == 'string' && type != 'any' && (type == 'null' ? value !== null : typeof value != type) && !(value instanceof Array && type == 'array') && !(type == 'integer' && value%1===0)){ return [{property:path,message:(typeof value) + " value found, but a " + type + " is required"}]; } if(type instanceof Array){ var unionErrors=[]; for(var j = 0; j < type.length; j++){ // a union type if(!(unionErrors=checkType(type[j],value)).length){ break; } } if(unionErrors.length){ return unionErrors; } }else if(typeof type == 'object'){ var priorErrors = errors; errors = []; checkProp(value,type,path, recursion); var theseErrors = errors; errors = priorErrors; return theseErrors; } } return []; } if(value === undefined){ if(!schema.optional){ addError("is missing and it is not optional"); } }else{ if (schema.type === 'union') { var enumField = value[schema.field]; if (enumField === undefined) addError("Expected " + schema.field + " field in " + path); else { addPrint(recursion, enumField+':'); var ttFound = false; for (var tt = 0; tt < schema.types.length; tt++) { if (enumField === schema.types[tt].value) { if (schema.types[tt].properties[schema.field] === undefined) // Don't throw an error when we encounter the original enum field schema.types[tt].properties[schema.field] = { type: "string", output: "hidden" }; errors.concat(checkObj(value,schema.types[tt].properties,path+"."+schema.field+'='+enumField,schema.additionalProperties, recursion+1)); ttFound = true; break; } } if (ttFound === false) { addError("Unknown type " + enumField + " in " + path); } } } else errors = errors.concat(checkType(schema.type,value)); if(schema.disallow && !checkType(schema.disallow,value).length){ addError(" disallowed value was matched"); } if(value !== null){ if(value instanceof Array){ if(schema.items){ if(schema.items instanceof Array){ for(i=0,l=value.length; i<l; i++){ errors.concat(checkProp(value[i],schema.items[i],path,i, recursion)); } }else{ var thisRecursion = (recursion===0)?1:recursion; // TODO-PER-HACK: Not sure why the first case is different. Figure it out someday. for(i=0,l=value.length; i<l; i++){ var nextRecursion = recursion; if (schema.output !== 'noindex') { nextRecursion++; if (typeof value[i] !== 'object') { if (schema.output === 'join') appendPrint(value[i]===null?'null':value[i]); else addPrint(thisRecursion, (value[i]===null?'null':value[i])); } else addPrint(thisRecursion, path.substring(path.lastIndexOf('.')+1) + " " + (i+1)); } errors.concat(checkProp(value[i],schema.items,path,i, nextRecursion)); } } } if(schema.minItems && value.length < schema.minItems){ addError("There must be a minimum of " + schema.minItems + " in the array"); } if(schema.maxItems && value.length > schema.maxItems){ addError("There must be a maximum of " + schema.maxItems + " in the array"); } if (schema.additionalProperties !== true) { for(i in value){ if(value.hasOwnProperty(i)) { var num = parseInt(i); var index = "" + num; var isNum = i === index; if(!isNum ){ addError((typeof i) + " The property " + i + " is not defined in the schema and the schema does not allow additional properties"); } } } } }else if(schema.properties){ errors.concat(checkObj(value,schema.properties,path,schema.additionalProperties, recursion+1)); } if(schema.pattern && typeof value == 'string' && !value.match(schema.pattern)){ addError("does not match the regex pattern " + schema.pattern); } if(schema.maxLength && typeof value == 'string' && value.length > schema.maxLength){ addError("may only be " + schema.maxLength + " characters long"); } if(schema.minLength && typeof value == 'string' && value.length < schema.minLength){ addError("must be at least " + schema.minLength + " characters long"); } if(typeof schema.minimum !== undefined && typeof value == typeof schema.minimum && schema.minimum > value){ addError("must have a minimum value of " + schema.minimum); } if(typeof schema.maximum !== undefined && typeof value == typeof schema.maximum && schema.maximum < value){ addError("must have a maximum value of " + schema.maximum); } if(schema['Enum']){ var enumer = schema['Enum']; l = enumer.length; var found; for(var j = 0; j < l; j++){ if(enumer[j]===value){ found=1; break; } } if(!found){ addError(value + " does not have a value in the enumeration " + enumer.join(", ")); } } if(typeof schema.maxDecimal == 'number' && (value.toString().match(new RegExp("\\.[0-9]{" + (schema.maxDecimal + 1) + ",}")))){ addError("may only have " + schema.maxDecimal + " digits of decimal places"); } } } return null; } function checkAllProps(instance,objTypeDef,path,recursion) { for(var i in objTypeDef){ if(objTypeDef.hasOwnProperty(i)){ var value = instance[i]; var propDef = objTypeDef[i]; if (propDef.output !== 'hidden' && value !== undefined) { if (value === null) addPrint(recursion, i+": null"); else if (typeof value === 'object') addPrint(recursion, i+":"); else addPrint(recursion, i+": "+value); } checkProp(value,propDef,path,i, recursion); } } } // validate an object against a schema function checkObj(instance,objTypeDef,path,additionalProp, recursion){ checkAllProps(instance,objTypeDef,path,recursion); for(i in instance){ if(instance.hasOwnProperty(i)) { if (objTypeDef[i]) { var requires = objTypeDef[i].requires; if(requires && !(requires in instance)){ errors.push({property:path,message:"the presence of the property " + i + " requires that " + requires + " also be present"}); } var prohibits = objTypeDef[i].prohibits; if(prohibits && (prohibits in instance)){ errors.push({property:path,message:"the presence of the property " + i + " prohibits " + requires + " from being present"}); } var value = instance[i]; if(!(i in objTypeDef)){ checkProp(value,additionalProp,path,i, recursion); } if(!_changing && value && value.$schema){ errors = errors.concat(checkProp(value,value.$schema,path,i, recursion)); } } else if (additionalProp!==true){ errors.push({property:path+' '+i,message:(typeof i) + " The property " + i + " is not defined in the schema and the schema does not allow additional properties"}); } } } return errors; } if(schema){ checkProp(instance,schema,'',_changing || '', recursion); } if(!_changing && instance && instance.$schema){ checkProp(instance,instance.$schema,'','', recursion); } return {valid:!errors.length,errors:errors, output: prettyPrint}; }
if(instance.hasOwnProperty(i)) {
if(instance.hasOwnProperty(i) && typeof instance[i] !== 'function') {
_validate : function(/*Any*/instance,/*Object*/schema,/*Boolean*/ _changing) { var recursion = -1; var errors = []; var prettyPrint = []; function addPrint(indent, message){ var str = ""; for (var i = 0; i < indent; i++) str += "\t"; prettyPrint.push(str + message); } function appendPrint(message){ if (prettyPrint.length > 0) prettyPrint[prettyPrint.length-1] += " " + message; } // validate a value against a property definition function checkProp(value, schema, path,i, recursion){ var l; path += path ? typeof i == 'number' ? '[' + i + ']' : typeof i == 'undefined' ? '' : '.' + i : i; function addError(message){ errors.push({property:path,message:message}); } if((typeof schema != 'object' || schema instanceof Array) && (path || typeof schema != 'function')){ if(typeof schema == 'function'){ if(!(value instanceof schema)){ addError("is not an instance of the class/constructor " + schema.name); } }else if(schema){ addError("Invalid schema/property definition " + schema); } return null; } if(_changing && schema.readonly){ addError("is a readonly field, it can not be changed"); } if(schema['extends']){ // if it extends another schema, it must pass that schema as well checkProp(value,schema['extends'],path,i, recursion); } // validate a value against a type definition function checkType(type,value){ if(type){ if(typeof type == 'string' && type != 'any' && (type == 'null' ? value !== null : typeof value != type) && !(value instanceof Array && type == 'array') && !(type == 'integer' && value%1===0)){ return [{property:path,message:(typeof value) + " value found, but a " + type + " is required"}]; } if(type instanceof Array){ var unionErrors=[]; for(var j = 0; j < type.length; j++){ // a union type if(!(unionErrors=checkType(type[j],value)).length){ break; } } if(unionErrors.length){ return unionErrors; } }else if(typeof type == 'object'){ var priorErrors = errors; errors = []; checkProp(value,type,path, recursion); var theseErrors = errors; errors = priorErrors; return theseErrors; } } return []; } if(value === undefined){ if(!schema.optional){ addError("is missing and it is not optional"); } }else{ if (schema.type === 'union') { var enumField = value[schema.field]; if (enumField === undefined) addError("Expected " + schema.field + " field in " + path); else { addPrint(recursion, enumField+':'); var ttFound = false; for (var tt = 0; tt < schema.types.length; tt++) { if (enumField === schema.types[tt].value) { if (schema.types[tt].properties[schema.field] === undefined) // Don't throw an error when we encounter the original enum field schema.types[tt].properties[schema.field] = { type: "string", output: "hidden" }; errors.concat(checkObj(value,schema.types[tt].properties,path+"."+schema.field+'='+enumField,schema.additionalProperties, recursion+1)); ttFound = true; break; } } if (ttFound === false) { addError("Unknown type " + enumField + " in " + path); } } } else errors = errors.concat(checkType(schema.type,value)); if(schema.disallow && !checkType(schema.disallow,value).length){ addError(" disallowed value was matched"); } if(value !== null){ if(value instanceof Array){ if(schema.items){ if(schema.items instanceof Array){ for(i=0,l=value.length; i<l; i++){ errors.concat(checkProp(value[i],schema.items[i],path,i, recursion)); } }else{ var thisRecursion = (recursion===0)?1:recursion; // TODO-PER-HACK: Not sure why the first case is different. Figure it out someday. for(i=0,l=value.length; i<l; i++){ var nextRecursion = recursion; if (schema.output !== 'noindex') { nextRecursion++; if (typeof value[i] !== 'object') { if (schema.output === 'join') appendPrint(value[i]===null?'null':value[i]); else addPrint(thisRecursion, (value[i]===null?'null':value[i])); } else addPrint(thisRecursion, path.substring(path.lastIndexOf('.')+1) + " " + (i+1)); } errors.concat(checkProp(value[i],schema.items,path,i, nextRecursion)); } } } if(schema.minItems && value.length < schema.minItems){ addError("There must be a minimum of " + schema.minItems + " in the array"); } if(schema.maxItems && value.length > schema.maxItems){ addError("There must be a maximum of " + schema.maxItems + " in the array"); } if (schema.additionalProperties !== true) { for(i in value){ if(value.hasOwnProperty(i)) { var num = parseInt(i); var index = "" + num; var isNum = i === index; if(!isNum ){ addError((typeof i) + " The property " + i + " is not defined in the schema and the schema does not allow additional properties"); } } } } }else if(schema.properties){ errors.concat(checkObj(value,schema.properties,path,schema.additionalProperties, recursion+1)); } if(schema.pattern && typeof value == 'string' && !value.match(schema.pattern)){ addError("does not match the regex pattern " + schema.pattern); } if(schema.maxLength && typeof value == 'string' && value.length > schema.maxLength){ addError("may only be " + schema.maxLength + " characters long"); } if(schema.minLength && typeof value == 'string' && value.length < schema.minLength){ addError("must be at least " + schema.minLength + " characters long"); } if(typeof schema.minimum !== undefined && typeof value == typeof schema.minimum && schema.minimum > value){ addError("must have a minimum value of " + schema.minimum); } if(typeof schema.maximum !== undefined && typeof value == typeof schema.maximum && schema.maximum < value){ addError("must have a maximum value of " + schema.maximum); } if(schema['Enum']){ var enumer = schema['Enum']; l = enumer.length; var found; for(var j = 0; j < l; j++){ if(enumer[j]===value){ found=1; break; } } if(!found){ addError(value + " does not have a value in the enumeration " + enumer.join(", ")); } } if(typeof schema.maxDecimal == 'number' && (value.toString().match(new RegExp("\\.[0-9]{" + (schema.maxDecimal + 1) + ",}")))){ addError("may only have " + schema.maxDecimal + " digits of decimal places"); } } } return null; } function checkAllProps(instance,objTypeDef,path,recursion) { for(var i in objTypeDef){ if(objTypeDef.hasOwnProperty(i)){ var value = instance[i]; var propDef = objTypeDef[i]; if (propDef.output !== 'hidden' && value !== undefined) { if (value === null) addPrint(recursion, i+": null"); else if (typeof value === 'object') addPrint(recursion, i+":"); else addPrint(recursion, i+": "+value); } checkProp(value,propDef,path,i, recursion); } } } // validate an object against a schema function checkObj(instance,objTypeDef,path,additionalProp, recursion){ checkAllProps(instance,objTypeDef,path,recursion); for(i in instance){ if(instance.hasOwnProperty(i)) { if (objTypeDef[i]) { var requires = objTypeDef[i].requires; if(requires && !(requires in instance)){ errors.push({property:path,message:"the presence of the property " + i + " requires that " + requires + " also be present"}); } var prohibits = objTypeDef[i].prohibits; if(prohibits && (prohibits in instance)){ errors.push({property:path,message:"the presence of the property " + i + " prohibits " + requires + " from being present"}); } var value = instance[i]; if(!(i in objTypeDef)){ checkProp(value,additionalProp,path,i, recursion); } if(!_changing && value && value.$schema){ errors = errors.concat(checkProp(value,value.$schema,path,i, recursion)); } } else if (additionalProp!==true){ errors.push({property:path+' '+i,message:(typeof i) + " The property " + i + " is not defined in the schema and the schema does not allow additional properties"}); } } } return errors; } if(schema){ checkProp(instance,schema,'',_changing || '', recursion); } if(!_changing && instance && instance.$schema){ checkProp(instance,instance.$schema,'','', recursion); } return {valid:!errors.length,errors:errors, output: prettyPrint}; }
errors.push({property:path+' '+i,message:(typeof i) + " The property " + i +
errors.push({property:path+' '+i,message:(typeof instance[i]) + " The property " + i +
_validate : function(/*Any*/instance,/*Object*/schema,/*Boolean*/ _changing) { var recursion = -1; var errors = []; var prettyPrint = []; function addPrint(indent, message){ var str = ""; for (var i = 0; i < indent; i++) str += "\t"; prettyPrint.push(str + message); } function appendPrint(message){ if (prettyPrint.length > 0) prettyPrint[prettyPrint.length-1] += " " + message; } // validate a value against a property definition function checkProp(value, schema, path,i, recursion){ var l; path += path ? typeof i == 'number' ? '[' + i + ']' : typeof i == 'undefined' ? '' : '.' + i : i; function addError(message){ errors.push({property:path,message:message}); } if((typeof schema != 'object' || schema instanceof Array) && (path || typeof schema != 'function')){ if(typeof schema == 'function'){ if(!(value instanceof schema)){ addError("is not an instance of the class/constructor " + schema.name); } }else if(schema){ addError("Invalid schema/property definition " + schema); } return null; } if(_changing && schema.readonly){ addError("is a readonly field, it can not be changed"); } if(schema['extends']){ // if it extends another schema, it must pass that schema as well checkProp(value,schema['extends'],path,i, recursion); } // validate a value against a type definition function checkType(type,value){ if(type){ if(typeof type == 'string' && type != 'any' && (type == 'null' ? value !== null : typeof value != type) && !(value instanceof Array && type == 'array') && !(type == 'integer' && value%1===0)){ return [{property:path,message:(typeof value) + " value found, but a " + type + " is required"}]; } if(type instanceof Array){ var unionErrors=[]; for(var j = 0; j < type.length; j++){ // a union type if(!(unionErrors=checkType(type[j],value)).length){ break; } } if(unionErrors.length){ return unionErrors; } }else if(typeof type == 'object'){ var priorErrors = errors; errors = []; checkProp(value,type,path, recursion); var theseErrors = errors; errors = priorErrors; return theseErrors; } } return []; } if(value === undefined){ if(!schema.optional){ addError("is missing and it is not optional"); } }else{ if (schema.type === 'union') { var enumField = value[schema.field]; if (enumField === undefined) addError("Expected " + schema.field + " field in " + path); else { addPrint(recursion, enumField+':'); var ttFound = false; for (var tt = 0; tt < schema.types.length; tt++) { if (enumField === schema.types[tt].value) { if (schema.types[tt].properties[schema.field] === undefined) // Don't throw an error when we encounter the original enum field schema.types[tt].properties[schema.field] = { type: "string", output: "hidden" }; errors.concat(checkObj(value,schema.types[tt].properties,path+"."+schema.field+'='+enumField,schema.additionalProperties, recursion+1)); ttFound = true; break; } } if (ttFound === false) { addError("Unknown type " + enumField + " in " + path); } } } else errors = errors.concat(checkType(schema.type,value)); if(schema.disallow && !checkType(schema.disallow,value).length){ addError(" disallowed value was matched"); } if(value !== null){ if(value instanceof Array){ if(schema.items){ if(schema.items instanceof Array){ for(i=0,l=value.length; i<l; i++){ errors.concat(checkProp(value[i],schema.items[i],path,i, recursion)); } }else{ var thisRecursion = (recursion===0)?1:recursion; // TODO-PER-HACK: Not sure why the first case is different. Figure it out someday. for(i=0,l=value.length; i<l; i++){ var nextRecursion = recursion; if (schema.output !== 'noindex') { nextRecursion++; if (typeof value[i] !== 'object') { if (schema.output === 'join') appendPrint(value[i]===null?'null':value[i]); else addPrint(thisRecursion, (value[i]===null?'null':value[i])); } else addPrint(thisRecursion, path.substring(path.lastIndexOf('.')+1) + " " + (i+1)); } errors.concat(checkProp(value[i],schema.items,path,i, nextRecursion)); } } } if(schema.minItems && value.length < schema.minItems){ addError("There must be a minimum of " + schema.minItems + " in the array"); } if(schema.maxItems && value.length > schema.maxItems){ addError("There must be a maximum of " + schema.maxItems + " in the array"); } if (schema.additionalProperties !== true) { for(i in value){ if(value.hasOwnProperty(i)) { var num = parseInt(i); var index = "" + num; var isNum = i === index; if(!isNum ){ addError((typeof i) + " The property " + i + " is not defined in the schema and the schema does not allow additional properties"); } } } } }else if(schema.properties){ errors.concat(checkObj(value,schema.properties,path,schema.additionalProperties, recursion+1)); } if(schema.pattern && typeof value == 'string' && !value.match(schema.pattern)){ addError("does not match the regex pattern " + schema.pattern); } if(schema.maxLength && typeof value == 'string' && value.length > schema.maxLength){ addError("may only be " + schema.maxLength + " characters long"); } if(schema.minLength && typeof value == 'string' && value.length < schema.minLength){ addError("must be at least " + schema.minLength + " characters long"); } if(typeof schema.minimum !== undefined && typeof value == typeof schema.minimum && schema.minimum > value){ addError("must have a minimum value of " + schema.minimum); } if(typeof schema.maximum !== undefined && typeof value == typeof schema.maximum && schema.maximum < value){ addError("must have a maximum value of " + schema.maximum); } if(schema['Enum']){ var enumer = schema['Enum']; l = enumer.length; var found; for(var j = 0; j < l; j++){ if(enumer[j]===value){ found=1; break; } } if(!found){ addError(value + " does not have a value in the enumeration " + enumer.join(", ")); } } if(typeof schema.maxDecimal == 'number' && (value.toString().match(new RegExp("\\.[0-9]{" + (schema.maxDecimal + 1) + ",}")))){ addError("may only have " + schema.maxDecimal + " digits of decimal places"); } } } return null; } function checkAllProps(instance,objTypeDef,path,recursion) { for(var i in objTypeDef){ if(objTypeDef.hasOwnProperty(i)){ var value = instance[i]; var propDef = objTypeDef[i]; if (propDef.output !== 'hidden' && value !== undefined) { if (value === null) addPrint(recursion, i+": null"); else if (typeof value === 'object') addPrint(recursion, i+":"); else addPrint(recursion, i+": "+value); } checkProp(value,propDef,path,i, recursion); } } } // validate an object against a schema function checkObj(instance,objTypeDef,path,additionalProp, recursion){ checkAllProps(instance,objTypeDef,path,recursion); for(i in instance){ if(instance.hasOwnProperty(i)) { if (objTypeDef[i]) { var requires = objTypeDef[i].requires; if(requires && !(requires in instance)){ errors.push({property:path,message:"the presence of the property " + i + " requires that " + requires + " also be present"}); } var prohibits = objTypeDef[i].prohibits; if(prohibits && (prohibits in instance)){ errors.push({property:path,message:"the presence of the property " + i + " prohibits " + requires + " from being present"}); } var value = instance[i]; if(!(i in objTypeDef)){ checkProp(value,additionalProp,path,i, recursion); } if(!_changing && value && value.$schema){ errors = errors.concat(checkProp(value,value.$schema,path,i, recursion)); } } else if (additionalProp!==true){ errors.push({property:path+' '+i,message:(typeof i) + " The property " + i + " is not defined in the schema and the schema does not allow additional properties"}); } } } return errors; } if(schema){ checkProp(instance,schema,'',_changing || '', recursion); } if(!_changing && instance && instance.$schema){ checkProp(instance,instance.$schema,'','', recursion); } return {valid:!errors.length,errors:errors, output: prettyPrint}; }
R in P&&delete P[Q[S]];}}return O;},embed:function(O){var P=O.parent;if(P&&P.name=='object'){var Q=P.attributes.width,R=P.attributes.height;Q&&(O.attributes.width=Q);R&&(O.attributes.height=R);}},param:function(O){O.children=[];O.isEmpty=true;return O;},a:function(O){if(!(O.children.length||O.attributes.name||O.attributes._cke_saved_name))return false;},body:function(O){delete O.attributes.spellcheck;delete O.attributes.contenteditable;},style:function(O){var P=O.children[0];P&&P.value&&(P.value=e.trim(P.value));if(!O.attributes.type)O.attributes.type='text/css';},title:function(O){O.children[0].value=O.attributes._cke_title;}},attributes:{'class':function(O,P){return e.ltrim(O.replace(/(?:^|\s+)cke_[^\s]*/g,''))||false;}},comment:function(O){if(O.substr(0,m.length)==m){if(O.substr(m.length,3)=='{C}')O=O.substr(m.length+3);else O=O.substr(m.length);return new a.htmlParser.cdata(decodeURIComponent(O));}return O;}},y={elements:{}};for(u in t)y.elements[u]=r;if(c)x.attributes.style=function(O,P){return O.toLowerCase();};var z=/<(?:a|area|img|input)[\s\S]*?\s((?:href|src|name)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+)))/gi,A=/(?:<style(?=[ >])[^>]*>[\s\S]*<\/style>)|(?:<(:?link|meta|base)[^>]*>)/gi,B=/<cke:encoded>([^<]*)<\/cke:encoded>/gi,C=/(<\/?)((?:object|embed|param|html|body|head|title)[^>]*>)/gi,D=/(<\/?)cke:((?:html|body|head|title)[^>]*>)/gi,E=/<cke:(param|embed)([^>]*?)\/?>(?!\s*<\/cke:\1)/gi;function F(O){return O.replace(z,'$& _cke_saved_$1');};function G(O){return O.replace(A,function(P){return '<cke:encoded>'+encodeURIComponent(P)+'</cke:encoded>';});};function H(O){return O.replace(B,function(P,Q){return decodeURIComponent(Q);});};function I(O){return O.replace(C,'$1cke:$2');};function J(O){return O.replace(D,'$1$2');};function K(O){return O.replace(E,'<cke:$1$2></cke:$1>');};function L(O){return O.replace(/<!--(?!{cke_protected})[\s\S]+?-->/g,function(P){return '<!--'+m+'{C}'+encodeURIComponent(P).replace(/--/g,'%2D%2D')+'-->';});};function M(O){return O.replace(/<!--\{cke_protected\}\{C\}([\s\S]+?)-->/g,function(P,Q){return decodeURIComponent(Q);});};function N(O,P){var Q=[],R=/<\!--\{cke_temp(comment)?\}(\d*?)-->/g,S=[/<script[\s\S]*?<\/script>/gi,/<noscript[\s\S]*?<\/noscript>/gi].concat(P);O=O.replace(/<!--[\s\S]*?-->/g,function(U){return '<!--{cke_tempcomment}'+(Q.push(U)-1)+'-->';});for(var T=0;T<S.length;T++)O=O.replace(S[T],function(U){U=U.replace(R,function(V,W,X){return Q[X];});return '<!--{cke_temp}'+(Q.push(U)-1)+'-->';});O=O.replace(R,function(U,V,W){return '<!--'+m+(V?'{C}':'')+encodeURIComponent(Q[W]).replace(/--/g,'%2D%2D')+'-->';
if(w(C))return;if(k.enterMode==CKEDITOR.ENTER_BR){delete C.name;C.add(new CKEDITOR.htmlParser.element('br'));}else o(k['format_'+(k.enterMode==CKEDITOR.ENTER_P?'p':'div')])(C);},div:function(C){var D=C.onlyChild();if(D&&D.name=='table'){var E=C.attributes;D.attributes=CKEDITOR.tools.extend(D.attributes,E);E.style&&D.addStyle(E.style);var F=new CKEDITOR.htmlParser.element('div');F.addStyle('clear','both');C.add(F);delete C.name;}},td:function(C){if(C.getAncestor('thead'))C.name='th';},ol:s,ul:s,dl:s,font:function(C){if(!CKEDITOR.env.gecko&&u(C.parent)){delete C.name;return;}C.filterChildren();var D=C.attributes,E=D.style,F=C.parent;if('font'==F.name){CKEDITOR.tools.extend(F.attributes,C.attributes);E&&F.addStyle(E);delete C.name;return;}else{E=E||'';if(D.color){D.color!='#000000'&&(E+='color:'+D.color+';');delete D.color;}if(D.face){E+='font-family:'+D.face+';';delete D.face;}if(D.size){E+='font-size:'+(D.size>3?'large':D.size<3?'small':'medium')+';';delete D.size;}C.name='span';C.addStyle(E);}},span:function(C){if(!CKEDITOR.env.gecko&&u(C.parent))return false;C.filterChildren();if(v(C)){delete C.name;return null;}if(!CKEDITOR.env.gecko&&u(C)){var D=C.firstChild(function(K){return K.value||K.name=='img';}),E=D&&(D.value||'l.'),F=E.match(/^([^\s]+?)([.)]?)$/);return r(F,E);}var G=C.children,H=C.attributes,I=H&&H.style,J=G&&G[0];if(I)H.style=n([['line-height'],[/^font-family$/,null,!A?p(k.font_style,'family'):null],[/^font-size$/,null,!A?p(k.fontSize_style,'size'):null],[/^color$/,null,!A?p(k.colorButton_foreStyle,'color'):null],[/^background-color$/,null,!A?p(k.colorButton_backStyle,'color'):null]])(I,C)||'';return null;},b:o(k.coreStyles_bold),i:o(k.coreStyles_italic),u:o(k.coreStyles_underline),s:o(k.coreStyles_strike),sup:o(k.coreStyles_superscript),sub:o(k.coreStyles_subscript),a:function(C){var D=C.attributes;if(D&&!D.href&&D.name)delete C.name;},'cke:listbullet':function(C){if(C.getAncestor(/h\d/)&&!k.pasteFromWordNumberedHeadingToList)delete C.name;}},attributeNames:[[/^onmouse(:?out|over)/,''],[/^onload$/,''],[/(?:v|o):\w+/,''],[/^lang/,'']],attributes:{style:n(B?[[/^margin$|^margin-(?!bottom|top)/,null,function(C,D,E){if(D.name in {p:1,div:1}){var F=k.contentsLangDirection=='ltr'?'margin-left':'margin-right';if(E=='margin')C=y(E,C,[F])[F];else if(E!=F)return null;if(C&&!d.test(C))return[F,C];}return null;}],[/^clear$/],[/^border.*|margin.*|vertical-align|float$/,null,function(C,D){if(D.name=='img')return C;}],[/^width|height$/,null,function(C,D){if(D.name in {table:1,td:1,th:1,img:1})return C;
R in P&&delete P[Q[S]];}}return O;},embed:function(O){var P=O.parent;if(P&&P.name=='object'){var Q=P.attributes.width,R=P.attributes.height;Q&&(O.attributes.width=Q);R&&(O.attributes.height=R);}},param:function(O){O.children=[];O.isEmpty=true;return O;},a:function(O){if(!(O.children.length||O.attributes.name||O.attributes._cke_saved_name))return false;},body:function(O){delete O.attributes.spellcheck;delete O.attributes.contenteditable;},style:function(O){var P=O.children[0];P&&P.value&&(P.value=e.trim(P.value));if(!O.attributes.type)O.attributes.type='text/css';},title:function(O){O.children[0].value=O.attributes._cke_title;}},attributes:{'class':function(O,P){return e.ltrim(O.replace(/(?:^|\s+)cke_[^\s]*/g,''))||false;}},comment:function(O){if(O.substr(0,m.length)==m){if(O.substr(m.length,3)=='{C}')O=O.substr(m.length+3);else O=O.substr(m.length);return new a.htmlParser.cdata(decodeURIComponent(O));}return O;}},y={elements:{}};for(u in t)y.elements[u]=r;if(c)x.attributes.style=function(O,P){return O.toLowerCase();};var z=/<(?:a|area|img|input)[\s\S]*?\s((?:href|src|name)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+)))/gi,A=/(?:<style(?=[ >])[^>]*>[\s\S]*<\/style>)|(?:<(:?link|meta|base)[^>]*>)/gi,B=/<cke:encoded>([^<]*)<\/cke:encoded>/gi,C=/(<\/?)((?:object|embed|param|html|body|head|title)[^>]*>)/gi,D=/(<\/?)cke:((?:html|body|head|title)[^>]*>)/gi,E=/<cke:(param|embed)([^>]*?)\/?>(?!\s*<\/cke:\1)/gi;function F(O){return O.replace(z,'$& _cke_saved_$1');};function G(O){return O.replace(A,function(P){return '<cke:encoded>'+encodeURIComponent(P)+'</cke:encoded>';});};function H(O){return O.replace(B,function(P,Q){return decodeURIComponent(Q);});};function I(O){return O.replace(C,'$1cke:$2');};function J(O){return O.replace(D,'$1$2');};function K(O){return O.replace(E,'<cke:$1$2></cke:$1>');};function L(O){return O.replace(/<!--(?!{cke_protected})[\s\S]+?-->/g,function(P){return '<!--'+m+'{C}'+encodeURIComponent(P).replace(/--/g,'%2D%2D')+'-->';});};function M(O){return O.replace(/<!--\{cke_protected\}\{C\}([\s\S]+?)-->/g,function(P,Q){return decodeURIComponent(Q);});};function N(O,P){var Q=[],R=/<\!--\{cke_temp(comment)?\}(\d*?)-->/g,S=[/<script[\s\S]*?<\/script>/gi,/<noscript[\s\S]*?<\/noscript>/gi].concat(P);O=O.replace(/<!--[\s\S]*?-->/g,function(U){return '<!--{cke_tempcomment}'+(Q.push(U)-1)+'-->';});for(var T=0;T<S.length;T++)O=O.replace(S[T],function(U){U=U.replace(R,function(V,W,X){return Q[X];});return '<!--{cke_temp}'+(Q.push(U)-1)+'-->';});O=O.replace(R,function(U,V,W){return '<!--'+m+(V?'{C}':'')+encodeURIComponent(Q[W]).replace(/--/g,'%2D%2D')+'-->';
typeof u=="string"}function C(j){if(j.substr(0,1)=="/")return r+j;if(j.substr(0,1)=="."||!j.match(/^\s*\w+:\/\
n.addEventListener("click",function(){n.play()},false)})})}function B(j,n,u){return u||k[j][n.split(".").slice(-1)[0]]||F[j]}function y(j,n){var u=j.getAttribute(n);return u==true||typeof u=="string"}function C(j){if(j.substr(0,1)=="/")return r+j;if(j.substr(0,1)=="."||!j.match(/^\s*\w+:\/\ else return u;if(j=="auto")return u;return j}function E(j){return j.match(/\s*([\w-]+\/[\w-]+)(;|\s|$)/)[1]}var p="video",d="audio";o.createElement(p).canPlayType||v(["abbr","article","aside","audio","canvas","details","figcaption","figure","footer","header","hgroup","mark","menu","meter","nav","output","progress","section","summary","time","video","source"],function(j){o.createElement(j)});var e="";v(o.getElementsByTagName("script"),function(j){j=j.src;if(j.match(/html5media(\.min|)\.js/))e=j.split("/").slice(0,
typeof u=="string"}function C(j){if(j.substr(0,1)=="/")return r+j;if(j.substr(0,1)=="."||!j.match(/^\s*\w+:\/\//))return w+j;return j}function A(j,n,u){var x=j.getAttribute(n);if(x)return x+"px";if(j.currentStyle)j=j.currentStyle[n];else if(z.getComputedStyle)j=o.defaultView.getComputedStyle(j,null).getPropertyValue(n);else return u;if(j=="auto")return u;return j}function E(j){return j.match(/\s*([\w-]+\/[\w-]+)(;|\s|$)/)[1]}var p="video",d="audio";o.createElement(p).canPlayType||v(["abbr","article",
WT_DECLARE_WT_MEMBER(1,"WSuggestionPopup",function(q,d,x,y,p){function r(){return d.style.display!="none"}function k(){d.style.display="none"}function z(a){c.positionAtWidget(d.id,a.id,c.Vertical)}function A(a){a=a||window.event;a=a.target||a.srcElement;if(a.className!="content"){if(!c.hasTag(a,"DIV"))a=a.parentNode;s(a)}}function s(a){var b=a.firstChild;a=c.getElement(e);var i=b.innerHTML;b=b.getAttribute("sug");a.focus();x(a,i,b);k();e=null}function B(a,b){for(a=b?a.nextSibling:a.previousSibling;a;a=
WT_DECLARE_WT_MEMBER(1,"WSuggestionPopup",function(q,d,y,z,r){function m(a){return $(a).hasClass("Wt-suggest-onedit")||$(a).hasClass("Wt-suggest-dropdown")}function s(){return d.style.display!="none"}function k(){d.style.display="none"}function A(a){c.positionAtWidget(d.id,a.id,c.Vertical)}function B(a){a=a||window.event;a=a.target||a.srcElement;if(a.className!="content"){if(!c.hasTag(a,"DIV"))a=a.parentNode;t(a)}}function t(a){var b=a.firstChild,h=c.getElement(f),e=b.innerHTML;b=b.getAttribute("sug");
WT_DECLARE_WT_MEMBER(1,"WSuggestionPopup",function(q,d,x,y,p){function r(){return d.style.display!="none"}function k(){d.style.display="none"}function z(a){c.positionAtWidget(d.id,a.id,c.Vertical)}function A(a){a=a||window.event;a=a.target||a.srcElement;if(a.className!="content"){if(!c.hasTag(a,"DIV"))a=a.parentNode;s(a)}}function s(a){var b=a.firstChild;a=c.getElement(e);var i=b.innerHTML;b=b.getAttribute("sug");a.focus();x(a,i,b);k();e=null}function B(a,b){for(a=b?a.nextSibling:a.previousSibling;a;a=
document.activeElement};this.history=function(){function a(){var l,p;p=location.href;l=p.indexOf("#");return l>=0?p.substr(l+1):null}function b(){v.value=G+"|"+C;if(u)v.value+="|"+M.join(",")}function f(l){if(l){if(!l||C!==l){C=l||G;H(unescape(C))}}else{C=G;H(unescape(C))}}function k(l){var p;l='<html><body><div id="state">'+l+"</div></body></html>";try{p=F.contentWindow.document;p.open();p.write(l);p.close();return true}catch(q){return false}}function h(){var l,p,q,m;if(!F.contentWindow||!F.contentWindow.document)setTimeout(h,
a.style.visibility=""};this.hasFocus=function(a){return a==document.activeElement};this.history=function(){function a(){var l,q;q=location.href;l=q.indexOf("#");return l>=0?q.substr(l+1):null}function b(){w.value=G+"|"+C;if(v)w.value+="|"+M.join(",")}function f(l){if(l){if(!l||C!==l){C=l||G;H(unescape(C))}}else{C=G;H(unescape(C))}}function k(l){var q;l='<html><body><div id="state">'+l+"</div></body></html>";try{q=F.contentWindow.document;q.open();q.write(l);q.close();return true}catch(r){return false}}
document.activeElement};this.history=function(){function a(){var l,p;p=location.href;l=p.indexOf("#");return l>=0?p.substr(l+1):null}function b(){v.value=G+"|"+C;if(u)v.value+="|"+M.join(",")}function f(l){if(l){if(!l||C!==l){C=l||G;H(unescape(C))}}else{C=G;H(unescape(C))}}function k(l){var p;l='<html><body><div id="state">'+l+"</div></body></html>";try{p=F.contentWindow.document;p.open();p.write(l);p.close();return true}catch(q){return false}}function h(){var l,p,q,m;if(!F.contentWindow||!F.contentWindow.document)setTimeout(h,
""};this.hasFocus=function(a){return a==document.activeElement};this.history=function(){function a(){var g,p;p=location.href;g=p.indexOf("#");return g>=0?p.substr(g+1):null}function b(){J.value=L+"|"+C;if(u)J.value+="|"+D.join(",")}function e(g){if(g){if(!g||C!==g){C=g||L;E(unescape(C))}}else{C=L;E(unescape(C))}}function j(g){var p;g='<html><body><div id="state">'+g+"</div></body></html>";try{p=I.contentWindow.document;p.open();p.write(g);p.close();return true}catch(r){return false}}function l(){var g,
""};this.hasFocus=function(a){return a==document.activeElement};this.history=function(){function a(){var g,p;p=location.href;g=p.indexOf("#");return g>=0?p.substr(g+1):null}function b(){K.value=L+"|"+C;if(u)K.value+="|"+D.join(",")}function e(g){if(g){if(!g||C!==g){C=g||L;E(unescape(C))}}else{C=L;E(unescape(C))}}function j(g){var p;g='<html><body><div id="state">'+g+"</div></body></html>";try{p=I.contentWindow.document;p.open();p.write(g);p.close();return true}catch(r){return false}}function l(){var g,
""};this.hasFocus=function(a){return a==document.activeElement};this.history=function(){function a(){var g,p;p=location.href;g=p.indexOf("#");return g>=0?p.substr(g+1):null}function b(){J.value=L+"|"+C;if(u)J.value+="|"+D.join(",")}function e(g){if(g){if(!g||C!==g){C=g||L;E(unescape(C))}}else{C=L;E(unescape(C))}}function j(g){var p;g='<html><body><div id="state">'+g+"</div></body></html>";try{p=I.contentWindow.document;p.open();p.write(g);p.close();return true}catch(r){return false}}function l(){var g,
e+"ctrlKey=1";if(h.metaKey)g+=e+"metaKey=1";if(h.shiftKey)g+=e+"shiftKey=1";c.data=g;return c}function t(){var c="";feedback=false;for(var d=0;d<v.length;++d){feedback=feedback||v[d].feedback;c+=v[d].data}V=v;v=[];return{feedback:feedback,result:c}}function A(){q.history._initTimeout();R==0&&J(null,"none",null,false);W=setTimeout(A,_$_KEEP_ALIVE_$_000)}function z(c){if(!q.isIEMobile)document.title=c}function F(){q.history._initialize();n();if(!ba){ba=true;_$_ONLOAD_$_();W=setTimeout(A,_$_KEEP_ALIVE_$_000)}}
e+"ctrlKey=1";if(h.metaKey)g+=e+"metaKey=1";if(h.shiftKey)g+=e+"shiftKey=1";c.data=g;return c}function t(){var c="";feedback=false;for(var d=0;d<v.length;++d){feedback=feedback||v[d].feedback;c+=v[d].data}V=v;v=[];return{feedback:feedback,result:c}}function A(){q.history._initTimeout();S==0&&J(null,"none",null,false);W=setTimeout(A,_$_KEEP_ALIVE_$_000)}function z(c){if(!q.isIEMobile)document.title=c}function F(){q.history._initialize();n();if(!ba){ba=true;_$_ONLOAD_$_();W=setTimeout(A,_$_KEEP_ALIVE_$_000)}}
e+"ctrlKey=1";if(h.metaKey)g+=e+"metaKey=1";if(h.shiftKey)g+=e+"shiftKey=1";c.data=g;return c}function t(){var c="";feedback=false;for(var d=0;d<v.length;++d){feedback=feedback||v[d].feedback;c+=v[d].data}V=v;v=[];return{feedback:feedback,result:c}}function A(){q.history._initTimeout();R==0&&J(null,"none",null,false);W=setTimeout(A,_$_KEEP_ALIVE_$_000)}function z(c){if(!q.isIEMobile)document.title=c}function F(){q.history._initialize();n();if(!ba){ba=true;_$_ONLOAD_$_();W=setTimeout(A,_$_KEEP_ALIVE_$_000)}}
"",d=false,e=0;e<y.length;++e){d=d||y[e].feedback;c+=y[e].data}ga=y;y=[];return{feedback:d,result:c}}function z(){R=true;if(aa){clearTimeout(aa);aa=null}var c=$("#Wt-timers");c.size()>0&&h.setHtml(c.get(0),"",false)}function P(){h.history._initTimeout();ba==0&&u(null,"none",null,false);aa=setTimeout(P,_$_KEEP_ALIVE_$_000)}function da(c){if(!h.isIEMobile)document.title=c}function a(){if(!document.activeElement){function c(e){if(e&&e.target)document.activeElement=e.target==document?null:e.target}function d(){document.activeElement= null}document.addEventListener("focus",c,true);document.addEventListener("blur",d,true)}h.history._initialize();U();if(!ja){ja=true;_$_ONLOAD_$_();R||(aa=setTimeout(P,_$_KEEP_ALIVE_$_000))}}function b(c){clearTimeout(c);document.body.style.cursor="auto";if(ea!=null){try{ea()}catch(d){}ea=null}}function f(){document.body.style.cursor="wait";ea=hideLoadingIndicator;showLoadingIndicator()}function l(c){ka=c}function n(c){if(c){c="(function() {"+c+"})();";window.execScript?window.execScript(c):window.eval(c)}k._p_.autoJavaScript()}
d+"rotation="+j.rotation;c.data=e;return c}function X(){for(var c="",d=false,e=0;e<y.length;++e){d=d||y[e].feedback;c+=y[e].data}ga=y;y=[];return{feedback:d,result:c}}function N(){R=true;if(aa){clearTimeout(aa);aa=null}var c=$("#Wt-timers");c.size()>0&&h.setHtml(c.get(0),"",false)}function z(){h.history._initTimeout();ba==0&&u(null,"none",null,false);aa=setTimeout(z,_$_KEEP_ALIVE_$_000)}function da(c){if(!h.isIEMobile)document.title=c}function a(){if(!document.activeElement){function c(e){if(e&&e.target)document.activeElement= e.target==document?null:e.target}function d(){document.activeElement=null}document.addEventListener("focus",c,true);document.addEventListener("blur",d,true)}h.history._initialize();U();if(!ja){ja=true;_$_ONLOAD_$_();R||(aa=setTimeout(z,_$_KEEP_ALIVE_$_000))}}function b(c){clearTimeout(c);document.body.style.cursor="auto";if(ea!=null){try{ea()}catch(d){}ea=null}}function f(){document.body.style.cursor="wait";ea=hideLoadingIndicator;showLoadingIndicator()}function l(c){ka=c}function n(c){if(c){c="(function() {"+
"",d=false,e=0;e<y.length;++e){d=d||y[e].feedback;c+=y[e].data}ga=y;y=[];return{feedback:d,result:c}}function z(){R=true;if(aa){clearTimeout(aa);aa=null}var c=$("#Wt-timers");c.size()>0&&h.setHtml(c.get(0),"",false)}function P(){h.history._initTimeout();ba==0&&u(null,"none",null,false);aa=setTimeout(P,_$_KEEP_ALIVE_$_000)}function da(c){if(!h.isIEMobile)document.title=c}function a(){if(!document.activeElement){function c(e){if(e&&e.target)document.activeElement=e.target==document?null:e.target}function d(){document.activeElement=null}document.addEventListener("focus",c,true);document.addEventListener("blur",d,true)}h.history._initialize();U();if(!ja){ja=true;_$_ONLOAD_$_();R||(aa=setTimeout(P,_$_KEEP_ALIVE_$_000))}}function b(c){clearTimeout(c);document.body.style.cursor="auto";if(ea!=null){try{ea()}catch(d){}ea=null}}function f(){document.body.style.cursor="wait";ea=hideLoadingIndicator;showLoadingIndicator()}function l(c){ka=c}function n(c){if(c){c="(function() {"+c+"})();";window.execScript?window.execScript(c):window.eval(c)}k._p_.autoJavaScript()}
k.x+b.offsetWidth;i=k.y;n=k.x;b=k.y+b.offsetHeight}else{e=k.x;i=k.y+b.offsetHeight;n=k.x+b.offsetWidth;b=k.y}h.fitToWindow(a,e,i,n,b)};this.hasFocus=function(a){return a==document.activeElement};this.history=function(){function a(){var l,p;p=location.href;l=p.indexOf("#");return l>=0?p.substr(l+1):null}function b(){F.value=L+"|"+E;if(u)F.value+="|"+M.join(",")}function e(l){if(l){if(!l||E!==l){E=l||L;N(unescape(E))}}else{E=L;N(unescape(E))}}function k(l){var p;l='<html><body><div id="state">'+l+"</div></body></html>";
a.style.display="block";if(e==g.Horizontal){e=j.x+b.offsetWidth;i=j.y;n=j.x;b=j.y+b.offsetHeight}else{e=j.x;i=j.y+b.offsetHeight;n=j.x+b.offsetWidth;b=j.y}g.fitToWindow(a,e,i,n,b)};this.hasFocus=function(a){return a==document.activeElement};this.history=function(){function a(){var l,p;p=location.href;l=p.indexOf("#");return l>=0?p.substr(l+1):null}function b(){E.value=K+"|"+D;if(u)E.value+="|"+L.join(",")}function e(l){if(l){if(!l||D!==l){D=l||K;M(unescape(D))}}else{D=K;M(unescape(D))}}function j(l){var p;
k.x+b.offsetWidth;i=k.y;n=k.x;b=k.y+b.offsetHeight}else{e=k.x;i=k.y+b.offsetHeight;n=k.x+b.offsetWidth;b=k.y}h.fitToWindow(a,e,i,n,b)};this.hasFocus=function(a){return a==document.activeElement};this.history=function(){function a(){var l,p;p=location.href;l=p.indexOf("#");return l>=0?p.substr(l+1):null}function b(){F.value=L+"|"+E;if(u)F.value+="|"+M.join(",")}function e(l){if(l){if(!l||E!==l){E=l||L;N(unescape(E))}}else{E=L;N(unescape(E))}}function k(l){var p;l='<html><body><div id="state">'+l+"</div></body></html>";
O=null}J=null;if(d>0)++W;else W=0;if(!Q)if(ga||z.length>0)if(d==1){d=Math.min(12E4,Math.exp(W)*500);R=setTimeout(function(){G()},d)}else G()}}function x(){J.abort();O=J=null;Q||G()}function A(d,c,f,j){o.checkReleaseCapture(d,f);_$_$if_STRICTLY_SERIALIZED_EVENTS_$_();if(!J){_$_$endif_$_();var m={},g=z.length;m.object=d;m.signal=c;m.event=f;m.feedback=j;z[g]=T(m,g);F();q();_$_$if_STRICTLY_SERIALIZED_EVENTS_$_()}_$_$endif_$_()}function F(){if(J!=null&&O!=null){clearTimeout(O);J.abort();J=null}if(J==
var _$_WT_CLASS_$_=new (function(){function v(a,b){return a.style[b]?a.style[b]:document.defaultView&&document.defaultView.getComputedStyle?document.defaultView.getComputedStyle(a,null)[b]:a.currentStyle?a.currentStyle[b]:null}function t(a){if(B!=null){if(!a)a=window.event;g.condCall(B,"onmousemove",a);return false}else return true}function A(a){if(B!=null){var b=B;g.capture(null);if(!a)a=window.event;g.condCall(b,"onmouseup",a);g.cancelEvent(a,g.CancelPropagate);return false}else return true}function aa(){if(!S){S=
O=null}J=null;if(d>0)++W;else W=0;if(!Q)if(ga||z.length>0)if(d==1){d=Math.min(12E4,Math.exp(W)*500);R=setTimeout(function(){G()},d)}else G()}}function x(){J.abort();O=J=null;Q||G()}function A(d,c,f,j){o.checkReleaseCapture(d,f);_$_$if_STRICTLY_SERIALIZED_EVENTS_$_();if(!J){_$_$endif_$_();var m={},g=z.length;m.object=d;m.signal=c;m.event=f;m.feedback=j;z[g]=T(m,g);F();q();_$_$if_STRICTLY_SERIALIZED_EVENTS_$_()}_$_$endif_$_()}function F(){if(J!=null&&O!=null){clearTimeout(O);J.abort();J=null}if(J==
b.offsetHeight;n=k.x+b.offsetWidth;b=k.y}g.fitToWindow(a,e,i,n,b)};this.hasFocus=function(a){return a==document.activeElement};this.history=function(){function a(){var l,p;p=location.href;l=p.indexOf("#");return l>=0?p.substr(l+1):null}function b(){F.value=L+"|"+E;if(u)F.value+="|"+M.join(",")}function e(l){if(l){if(!l||E!==l){E=l||L;N(unescape(E))}}else{E=L;N(unescape(E))}}function k(l){var p;l='<html><body><div id="state">'+l+"</div></body></html>";try{p=A.contentWindow.document;p.open();p.write(l);
b.offsetHeight;n=k.x+b.offsetWidth;b=k.y}h.fitToWindow(a,e,i,n,b)};this.hasFocus=function(a){return a==document.activeElement};this.history=function(){function a(){var l,p;p=location.href;l=p.indexOf("#");return l>=0?p.substr(l+1):null}function b(){F.value=L+"|"+E;if(u)F.value+="|"+M.join(",")}function e(l){if(l){if(!l||E!==l){E=l||L;N(unescape(E))}}else{E=L;N(unescape(E))}}function k(l){var p;l='<html><body><div id="state">'+l+"</div></body></html>";try{p=A.contentWindow.document;p.open();p.write(l);
b.offsetHeight;n=k.x+b.offsetWidth;b=k.y}g.fitToWindow(a,e,i,n,b)};this.hasFocus=function(a){return a==document.activeElement};this.history=function(){function a(){var l,p;p=location.href;l=p.indexOf("#");return l>=0?p.substr(l+1):null}function b(){F.value=L+"|"+E;if(u)F.value+="|"+M.join(",")}function e(l){if(l){if(!l||E!==l){E=l||L;N(unescape(E))}}else{E=L;N(unescape(E))}}function k(l){var p;l='<html><body><div id="state">'+l+"</div></body></html>";try{p=A.contentWindow.document;p.open();p.write(l);
function(a,b,f){a=g.getElement(a);b=g.getElement(b);var h=g.widgetPageCoordinates(b),k,o;a.style.display="block";if(f==g.Horizontal){f=h.x+b.offsetWidth;k=h.y;o=h.x;b=h.y+b.offsetHeight}else{f=h.x;k=h.y+b.offsetHeight;o=h.x+b.offsetWidth;b=h.y}g.fitToWindow(a,f,k,o,b)};this.hasFocus=function(a){return a==document.activeElement};this.history=function(){function a(){var l,p;p=location.href;l=p.indexOf("#");return l>=0?p.substr(l+1):null}function b(){v.value=G+"|"+C;if(u)v.value+="|"+M.join(",")}function f(l){if(l){if(!l||
document.activeElement};this.history=function(){function a(){var l,p;p=location.href;l=p.indexOf("#");return l>=0?p.substr(l+1):null}function b(){v.value=G+"|"+C;if(u)v.value+="|"+M.join(",")}function f(l){if(l){if(!l||C!==l){C=l||G;H(unescape(C))}}else{C=G;H(unescape(C))}}function h(l){var p;l='<html><body><div id="state">'+l+"</div></body></html>";try{p=F.contentWindow.document;p.open();p.write(l);p.close();return true}catch(q){return false}}function k(){var l,p,q,n;if(!F.contentWindow||!F.contentWindow.document)setTimeout(k,
function(a,b,f){a=g.getElement(a);b=g.getElement(b);var h=g.widgetPageCoordinates(b),k,o;a.style.display="block";if(f==g.Horizontal){f=h.x+b.offsetWidth;k=h.y;o=h.x;b=h.y+b.offsetHeight}else{f=h.x;k=h.y+b.offsetHeight;o=h.x+b.offsetWidth;b=h.y}g.fitToWindow(a,f,k,o,b)};this.hasFocus=function(a){return a==document.activeElement};this.history=function(){function a(){var l,p;p=location.href;l=p.indexOf("#");return l>=0?p.substr(l+1):null}function b(){v.value=G+"|"+C;if(u)v.value+="|"+M.join(",")}function f(l){if(l){if(!l||
function(a,b,f){a=k.getElement(a);b=k.getElement(b);var m=k.widgetPageCoordinates(b),l,o;a.style.display="block";if(f==k.Horizontal){f=m.x+b.offsetWidth;l=m.y;o=m.x;b=m.y+b.offsetHeight}else{f=m.x;l=m.y+b.offsetHeight;o=m.x+b.offsetWidth;b=m.y}k.fitToWindow(a,f,l,o,b)};this.hasFocus=function(a){return a==document.activeElement};this.history=function(){function a(){var g,p;p=location.href;g=p.indexOf("#");return g>=0?p.substr(g+1):null}function b(){H.value=I+"|"+z;if(r)H.value+="|"+A.join(",")}function f(g){if(g){if(!g||
k.Horizontal){f=m.x+b.offsetWidth;l=m.y;n=m.x;b=m.y+b.offsetHeight}else{f=m.x;l=m.y+b.offsetHeight;n=m.x+b.offsetWidth;b=m.y}k.fitToWindow(a,f,l,n,b)};this.hasFocus=function(a){return a==document.activeElement};this.history=function(){function a(){var g,o;o=location.href;g=o.indexOf("#");return g>=0?o.substr(g+1):null}function b(){L.value=I+"|"+y;if(q)L.value+="|"+N.join(",")}function f(g){if(g){if(!g||y!==g){y=g||I;S(unescape(y))}}else{y=I;S(unescape(y))}}function m(g){var o;g='<html><body><div id="state">'+
function(a,b,f){a=k.getElement(a);b=k.getElement(b);var m=k.widgetPageCoordinates(b),l,o;a.style.display="block";if(f==k.Horizontal){f=m.x+b.offsetWidth;l=m.y;o=m.x;b=m.y+b.offsetHeight}else{f=m.x;l=m.y+b.offsetHeight;o=m.x+b.offsetWidth;b=m.y}k.fitToWindow(a,f,l,o,b)};this.hasFocus=function(a){return a==document.activeElement};this.history=function(){function a(){var g,p;p=location.href;g=p.indexOf("#");return g>=0?p.substr(g+1):null}function b(){H.value=I+"|"+z;if(r)H.value+="|"+A.join(",")}function f(g){if(g){if(!g||
null){N=setTimeout(function(){A()},n.updateDelay);fa=(new Date).getTime()}else if(U){clearTimeout(N);A()}else if((new Date).getTime()-fa>n.updateDelay){clearTimeout(N);A()}}function R(d){ca=d;p._p_.comm.responseReceived(d)}function A(){N=null;if(ba){if(!ga){if(confirm("The application was quited, do you want to restart?"))document.location=document.location;ga=true}}else{var d,c,e,h="&rand="+Math.round(Math.random(ha)*1E5);if(x.length>0){d=f();c=d.feedback?setTimeout(r,_$_INDICATOR_TIMEOUT_$_):null; e=false}else{d={result:"signal=poll"};c=null;e=true}J=p._p_.comm.sendUpdate(ia+h,"request=jsupdate&"+d.result+"&ackId="+ca,c,ca,-1);L=e?setTimeout(K,_$_SERVER_PUSH_TIMEOUT_$_):null}}function I(d,c){var e={},h=x.length;e.signal="user";e.id=typeof d==="string"?d:d==_$_APP_CLASS_$_?"app":d.id;if(typeof c==="object"){e.name=c.name;e.object=c.eventObject;e.event=c.event}else{e.name=c;e.object=e.event=null}e.args=[];for(var i=2;i<arguments.length;++i){var j=arguments[i];j=j===false?0:j===true?1:j.toDateString?
d)}else w()}}function H(){G.abort();M=G=null;w()}function A(d,c,e,h){g.checkReleaseCapture(d,e);_$_$if_STRICTLY_SERIALIZED_EVENTS_$_();if(!G){_$_$endif_$_();var i={},j=z.length;i.object=d;i.signal=c;i.event=e;i.feedback=h;z[j]=R(i,j);F();q();_$_$if_STRICTLY_SERIALIZED_EVENTS_$_()}_$_$endif_$_()}function F(){if(G!=null&&M!=null){clearTimeout(M);G.abort();G=null}if(G==null)if(P==null){P=setTimeout(function(){w()},g.updateDelay);fa=(new Date).getTime()}else if(T){clearTimeout(P);w()}else if((new Date).getTime()-
null){N=setTimeout(function(){A()},n.updateDelay);fa=(new Date).getTime()}else if(U){clearTimeout(N);A()}else if((new Date).getTime()-fa>n.updateDelay){clearTimeout(N);A()}}function R(d){ca=d;p._p_.comm.responseReceived(d)}function A(){N=null;if(ba){if(!ga){if(confirm("The application was quited, do you want to restart?"))document.location=document.location;ga=true}}else{var d,c,e,h="&rand="+Math.round(Math.random(ha)*1E5);if(x.length>0){d=f();c=d.feedback?setTimeout(r,_$_INDICATOR_TIMEOUT_$_):null;e=false}else{d={result:"signal=poll"};c=null;e=true}J=p._p_.comm.sendUpdate(ia+h,"request=jsupdate&"+d.result+"&ackId="+ca,c,ca,-1);L=e?setTimeout(K,_$_SERVER_PUSH_TIMEOUT_$_):null}}function I(d,c){var e={},h=x.length;e.signal="user";e.id=typeof d==="string"?d:d==_$_APP_CLASS_$_?"app":d.id;if(typeof c==="object"){e.name=c.name;e.object=c.eventObject;e.event=c.event}else{e.name=c;e.object=e.event=null}e.args=[];for(var i=2;i<arguments.length;++i){var j=arguments[i];j=j===false?0:j===true?1:j.toDateString?
if(r)r.push(t);else A.onText(t);}q=A._.htmlPartsRegex.lastIndex;if(p=o[1]){p=p.toLowerCase();if(r&&f.$cdata[p]){A.onCDATA(r.join(''));r=null;}if(!r){A.onTagClose(p);continue;}}if(r){r.push(o[0]);continue;}if(p=o[3]){p=p.toLowerCase();var u={},v,w=o[4],x=!!(w&&w.charAt(w.length-1)=='/');if(w)while(v=l.exec(w)){var y=v[1].toLowerCase(),z=v[2]||v[3]||v[4]||'';if(!z&&m[y])u[y]=y;else u[y]=z;}A.onTagOpen(p,u,x);if(!r&&f.$cdata[p])r=[];continue;}if(p=o[2])A.onComment(p);}if(n.length>q)A.onText(n.substring(q,n.length));}};})();a.htmlParser.comment=function(l){this.value=l;this._={isBlockLike:false};};a.htmlParser.comment.prototype={type:8,writeHtml:function(l,m){var n=this.value;if(m){if(!(n=m.onComment(n,this)))return;if(typeof n!='string'){n.parent=this.parent;n.writeHtml(l,m);return;}}l.comment(n);}};(function(){var l=/[\t\r\n ]{2,}|[\t\r\n]/g;a.htmlParser.text=function(m){this.value=m;this._={isBlockLike:false};};a.htmlParser.text.prototype={type:3,writeHtml:function(m,n){var o=this.value;if(n&&!(o=n.onText(o,this)))return;m.text(o);}};})();(function(){a.htmlParser.cdata=function(l){this.value=l;};a.htmlParser.cdata.prototype={type:3,writeHtml:function(l){l.write(this.value);}};})();a.htmlParser.fragment=function(){this.children=[];this.parent=null;this._={isBlockLike:true,hasInlineStarted:false};};(function(){var l={colgroup:1,dd:1,dt:1,li:1,option:1,p:1,td:1,tfoot:1,th:1,thead:1,tr:1},m=e.extend({table:1,ul:1,ol:1,dl:1},f.table,f.ul,f.ol,f.dl),n=f.$list,o=f.$listItem;a.htmlParser.fragment.fromHtml=function(p,q){var r=new a.htmlParser(),s=[],t=new a.htmlParser.fragment(),u=[],v=[],w=t,x=false,y;function z(E){var F;if(u.length>0)for(var G=0;G<u.length;G++){var H=u[G],I=H.name,J=f[I],K=w.name&&f[w.name];if((!K||K[I])&&(!E||!J||J[E]||!f[E])){if(!F){A();F=1;}H=H.clone();H.parent=w;w=H;u.splice(G,1);G--;}}};function A(){while(v.length)w.add(v.shift());};function B(E,F,G){F=F||w||t;if(q&&!F.type){var H,I;if(E.attributes&&(I=E.attributes._cke_real_element_type))H=I;else H=E.name;if(H&&!(H in f.$body)&&!(H in f.$nonBodyContent)){var J=w;w=F;r.onTagOpen(q,{});F=w;if(G)w=J;}}if(E._.isBlockLike&&E.name!='pre'){var K=E.children.length,L=E.children[K-1],M;if(L&&L.type==3)if(!(M=e.rtrim(L.value)))E.children.length=K-1;else L.value=M;}F.add(E);if(E.returnPoint){w=E.returnPoint;delete E.returnPoint;}};r.onTagOpen=function(E,F,G){var H=new a.htmlParser.element(E,F);if(H.isUnknown&&G)H.isEmpty=true;if(f.$removeEmpty[E]){u.push(H);return;}else if(E=='pre')x=true;else if(E=='br'&&x){w.add(new a.htmlParser.text('\n'));
if(!z&&m[y])u[y]=y;else u[y]=z;}A.onTagOpen(p,u,x);if(!r&&f.$cdata[p])r=[];continue;}if(p=o[2])A.onComment(p);}if(n.length>q)A.onText(n.substring(q,n.length));}};})();a.htmlParser.comment=function(l){this.value=l;this._={isBlockLike:false};};a.htmlParser.comment.prototype={type:8,writeHtml:function(l,m){var n=this.value;if(m){if(!(n=m.onComment(n,this)))return;if(typeof n!='string'){n.parent=this.parent;n.writeHtml(l,m);return;}}l.comment(n);}};(function(){var l=/[\t\r\n ]{2,}|[\t\r\n]/g;a.htmlParser.text=function(m){this.value=m;this._={isBlockLike:false};};a.htmlParser.text.prototype={type:3,writeHtml:function(m,n){var o=this.value;if(n&&!(o=n.onText(o,this)))return;m.text(o);}};})();(function(){a.htmlParser.cdata=function(l){this.value=l;};a.htmlParser.cdata.prototype={type:3,writeHtml:function(l){l.write(this.value);}};})();a.htmlParser.fragment=function(){this.children=[];this.parent=null;this._={isBlockLike:true,hasInlineStarted:false};};(function(){var l={colgroup:1,dd:1,dt:1,li:1,option:1,p:1,td:1,tfoot:1,th:1,thead:1,tr:1},m=e.extend({table:1,ul:1,ol:1,dl:1},f.table,f.ul,f.ol,f.dl),n=f.$list,o=f.$listItem;a.htmlParser.fragment.fromHtml=function(p,q){var r=new a.htmlParser(),s=[],t=new a.htmlParser.fragment(),u=[],v=[],w=t,x=false,y;function z(E){var F;if(u.length>0)for(var G=0;G<u.length;G++){var H=u[G],I=H.name,J=f[I],K=w.name&&f[w.name];if((!K||K[I])&&(!E||!J||J[E]||!f[E])){if(!F){A();F=1;}H=H.clone();H.parent=w;w=H;u.splice(G,1);G--;}}};function A(E){while(v.length-(E||0)>0)w.add(v.shift());};function B(E,F,G){F=F||w||t;if(q&&!F.type){var H,I;if(E.attributes&&(I=E.attributes._cke_real_element_type))H=I;else H=E.name;if(H&&!(H in f.$body)&&!(H in f.$nonBodyContent)){var J=w;w=F;r.onTagOpen(q,{});F=w;if(G)w=J;}}if(E._.isBlockLike&&E.name!='pre'){var K=E.children.length,L=E.children[K-1],M;if(L&&L.type==3)if(!(M=e.rtrim(L.value)))E.children.length=K-1;else L.value=M;}F.add(E);if(E.returnPoint){w=E.returnPoint;delete E.returnPoint;}};r.onTagOpen=function(E,F,G){var H=new a.htmlParser.element(E,F);if(H.isUnknown&&G)H.isEmpty=true;if(f.$removeEmpty[E]){u.push(H);return;}else if(E=='pre')x=true;else if(E=='br'&&x){w.add(new a.htmlParser.text('\n'));return;}if(E=='br'){v.push(H);return;}var I=w.name,J=I&&(f[I]||(w._.isBlockLike?f.div:f.span));if(J&&!H.isUnknown&&!w.isUnknown&&!J[E]){var K=false,L;if(E in n&&I in n){var M=w.children,N=M[M.length-1];if(!(N&&N.name in o))B(N=new a.htmlParser.element('li'),w);y=w,L=N;}else if(E==I)B(w,w.parent);else{if(m[I]){if(!y)y=w;
if(r)r.push(t);else A.onText(t);}q=A._.htmlPartsRegex.lastIndex;if(p=o[1]){p=p.toLowerCase();if(r&&f.$cdata[p]){A.onCDATA(r.join(''));r=null;}if(!r){A.onTagClose(p);continue;}}if(r){r.push(o[0]);continue;}if(p=o[3]){p=p.toLowerCase();var u={},v,w=o[4],x=!!(w&&w.charAt(w.length-1)=='/');if(w)while(v=l.exec(w)){var y=v[1].toLowerCase(),z=v[2]||v[3]||v[4]||'';if(!z&&m[y])u[y]=y;else u[y]=z;}A.onTagOpen(p,u,x);if(!r&&f.$cdata[p])r=[];continue;}if(p=o[2])A.onComment(p);}if(n.length>q)A.onText(n.substring(q,n.length));}};})();a.htmlParser.comment=function(l){this.value=l;this._={isBlockLike:false};};a.htmlParser.comment.prototype={type:8,writeHtml:function(l,m){var n=this.value;if(m){if(!(n=m.onComment(n,this)))return;if(typeof n!='string'){n.parent=this.parent;n.writeHtml(l,m);return;}}l.comment(n);}};(function(){var l=/[\t\r\n ]{2,}|[\t\r\n]/g;a.htmlParser.text=function(m){this.value=m;this._={isBlockLike:false};};a.htmlParser.text.prototype={type:3,writeHtml:function(m,n){var o=this.value;if(n&&!(o=n.onText(o,this)))return;m.text(o);}};})();(function(){a.htmlParser.cdata=function(l){this.value=l;};a.htmlParser.cdata.prototype={type:3,writeHtml:function(l){l.write(this.value);}};})();a.htmlParser.fragment=function(){this.children=[];this.parent=null;this._={isBlockLike:true,hasInlineStarted:false};};(function(){var l={colgroup:1,dd:1,dt:1,li:1,option:1,p:1,td:1,tfoot:1,th:1,thead:1,tr:1},m=e.extend({table:1,ul:1,ol:1,dl:1},f.table,f.ul,f.ol,f.dl),n=f.$list,o=f.$listItem;a.htmlParser.fragment.fromHtml=function(p,q){var r=new a.htmlParser(),s=[],t=new a.htmlParser.fragment(),u=[],v=[],w=t,x=false,y;function z(E){var F;if(u.length>0)for(var G=0;G<u.length;G++){var H=u[G],I=H.name,J=f[I],K=w.name&&f[w.name];if((!K||K[I])&&(!E||!J||J[E]||!f[E])){if(!F){A();F=1;}H=H.clone();H.parent=w;w=H;u.splice(G,1);G--;}}};function A(){while(v.length)w.add(v.shift());};function B(E,F,G){F=F||w||t;if(q&&!F.type){var H,I;if(E.attributes&&(I=E.attributes._cke_real_element_type))H=I;else H=E.name;if(H&&!(H in f.$body)&&!(H in f.$nonBodyContent)){var J=w;w=F;r.onTagOpen(q,{});F=w;if(G)w=J;}}if(E._.isBlockLike&&E.name!='pre'){var K=E.children.length,L=E.children[K-1],M;if(L&&L.type==3)if(!(M=e.rtrim(L.value)))E.children.length=K-1;else L.value=M;}F.add(E);if(E.returnPoint){w=E.returnPoint;delete E.returnPoint;}};r.onTagOpen=function(E,F,G){var H=new a.htmlParser.element(E,F);if(H.isUnknown&&G)H.isEmpty=true;if(f.$removeEmpty[E]){u.push(H);return;}else if(E=='pre')x=true;else if(E=='br'&&x){w.add(new a.htmlParser.text('\n'));
"undefined"&&this.length)return d.data(this[0]);else if(typeof a==="object")return this.each(function(){d.data(this,a)});var e=a.split(".");e[1]=e[1]?"."+e[1]:"";if(b===v){var g=this.triggerHandler("getData"+e[1]+"!",[e[0]]);if(g===v&&this.length)g=d.data(this[0],a);return g===v&&e[1]?this.data(e[0]):g}else return this.trigger("setData"+e[1]+"!",[e[0],b]).each(function(){d.data(this,a,b)})},removeData:function(a){return this.each(function(){d.removeData(this,a)})}});(function(){function a(c){for(var f= "",i,j=0;c[j];j++){i=c[j];if(i.nodeType===3||i.nodeType===4)f+=i.nodeValue;else if(i.nodeType!==8)f+=a(i.childNodes)}return f}function b(c,f,i,j,n,m){n=0;for(var t=j.length;n<t;n++){var s=j[n];if(s){s=s[c];for(var u=false;s;){if(s.sizcache===i){u=j[s.sizset];break}if(s.nodeType===1&&!m){s.sizcache=i;s.sizset=n}if(s.nodeName.toLowerCase()===f){u=s;break}s=s[c]}j[n]=u}}}function e(c,f,i,j,n,m){n=0;for(var t=j.length;n<t;n++){var s=j[n];if(s){s=s[c];for(var u=false;s;){if(s.sizcache===i){u=j[s.sizset];
"undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var e=a.split(".");e[1]=e[1]?"."+e[1]:"";if(b===v){var f=this.triggerHandler("getData"+e[1]+"!",[e[0]]);if(f===v&&this.length)f=c.data(this[0],a);return f===v&&e[1]?this.data(e[0]):f}else return this.trigger("setData"+e[1]+"!",[e[0],b]).each(function(){c.data(this,a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});(function(){function a(d){for(var g= "",i,j=0;d[j];j++){i=d[j];if(i.nodeType===3||i.nodeType===4)g+=i.nodeValue;else if(i.nodeType!==8)g+=a(i.childNodes)}return g}function b(d,g,i,j,n,m){n=0;for(var t=j.length;n<t;n++){var s=j[n];if(s){s=s[d];for(var u=false;s;){if(s.sizcache===i){u=j[s.sizset];break}if(s.nodeType===1&&!m){s.sizcache=i;s.sizset=n}if(s.nodeName.toLowerCase()===g){u=s;break}s=s[d]}j[n]=u}}}function e(d,g,i,j,n,m){n=0;for(var t=j.length;n<t;n++){var s=j[n];if(s){s=s[d];for(var u=false;s;){if(s.sizcache===i){u=j[s.sizset];
"undefined"&&this.length)return d.data(this[0]);else if(typeof a==="object")return this.each(function(){d.data(this,a)});var e=a.split(".");e[1]=e[1]?"."+e[1]:"";if(b===v){var g=this.triggerHandler("getData"+e[1]+"!",[e[0]]);if(g===v&&this.length)g=d.data(this[0],a);return g===v&&e[1]?this.data(e[0]):g}else return this.trigger("setData"+e[1]+"!",[e[0],b]).each(function(){d.data(this,a,b)})},removeData:function(a){return this.each(function(){d.removeData(this,a)})}});(function(){function a(c){for(var f="",i,j=0;c[j];j++){i=c[j];if(i.nodeType===3||i.nodeType===4)f+=i.nodeValue;else if(i.nodeType!==8)f+=a(i.childNodes)}return f}function b(c,f,i,j,n,m){n=0;for(var t=j.length;n<t;n++){var s=j[n];if(s){s=s[c];for(var u=false;s;){if(s.sizcache===i){u=j[s.sizset];break}if(s.nodeType===1&&!m){s.sizcache=i;s.sizset=n}if(s.nodeName.toLowerCase()===f){u=s;break}s=s[c]}j[n]=u}}}function e(c,f,i,j,n,m){n=0;for(var t=j.length;n<t;n++){var s=j[n];if(s){s=s[c];for(var u=false;s;){if(s.sizcache===i){u=j[s.sizset];
h(a[0],b):null}function Z(){return(new Date).getTime()}function $(a,b){var e=0;b.each(function(){if(this.nodeName===(a[e]&&a[e].nodeName)){var g=d.data(a[e++]),h=d.data(this,g);if(g=g&&g.events){delete h.handle;h.events={};for(var k in g)for(var l in g[k])d.event.add(this,k,g[k][l],g[k][l].data)}}})}function aa(a,b,e){var g,h,k;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&a[0].indexOf("<option")<0){h=true;if(k=d.fragments[a[0]])if(k!==1)g=k}if(!g){b=b&&b[0]?b[0].ownerDocument||b[0]:r; g=b.createDocumentFragment();d.clean(a,b,g,e)}if(h)d.fragments[a[0]]=k?g:1;return{fragment:g,cacheable:h}}function M(a){for(var b=0,e,g;(e=a[b])!=null;b++)if(!d.noData[e.nodeName.toLowerCase()]&&(g=e[B]))delete d.cache[g]}function ba(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var d=function(a,b){return new d.fn.init(a,b)},sa=x.jQuery,ta=x.$,r=x.document,N,ua=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,va=/^.[^:#\[\.,]*$/,wa=/\S/,xa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,
h(a[0],b):null}function Z(){return(new Date).getTime()}function $(a,b){var e=0;b.each(function(){if(this.nodeName===(a[e]&&a[e].nodeName)){var f=c.data(a[e++]),h=c.data(this,f);if(f=f&&f.events){delete h.handle;h.events={};for(var k in f)for(var l in f[k])c.event.add(this,k,f[k][l],f[k][l].data)}}})}function aa(a,b,e){var f,h,k;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&a[0].indexOf("<option")<0){h=true;if(k=c.fragments[a[0]])if(k!==1)f=k}if(!f){b=b&&b[0]?b[0].ownerDocument||b[0]:r; f=b.createDocumentFragment();c.clean(a,b,f,e)}if(h)c.fragments[a[0]]=k?f:1;return{fragment:f,cacheable:h}}function M(a){for(var b=0,e,f;(e=a[b])!=null;b++)if(!c.noData[e.nodeName.toLowerCase()]&&(f=e[B]))delete c.cache[f]}function ba(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var c=function(a,b){return new c.fn.init(a,b)},sa=x.jQuery,ta=x.$,r=x.document,N,ua=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,va=/^.[^:#\[\.,]*$/,wa=/\S/,xa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,
h(a[0],b):null}function Z(){return(new Date).getTime()}function $(a,b){var e=0;b.each(function(){if(this.nodeName===(a[e]&&a[e].nodeName)){var g=d.data(a[e++]),h=d.data(this,g);if(g=g&&g.events){delete h.handle;h.events={};for(var k in g)for(var l in g[k])d.event.add(this,k,g[k][l],g[k][l].data)}}})}function aa(a,b,e){var g,h,k;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&a[0].indexOf("<option")<0){h=true;if(k=d.fragments[a[0]])if(k!==1)g=k}if(!g){b=b&&b[0]?b[0].ownerDocument||b[0]:r;g=b.createDocumentFragment();d.clean(a,b,g,e)}if(h)d.fragments[a[0]]=k?g:1;return{fragment:g,cacheable:h}}function M(a){for(var b=0,e,g;(e=a[b])!=null;b++)if(!d.noData[e.nodeName.toLowerCase()]&&(g=e[B]))delete d.cache[g]}function ba(a){return"scrollTo"in a&&a.document?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var d=function(a,b){return new d.fn.init(a,b)},sa=x.jQuery,ta=x.$,r=x.document,N,ua=/^[^<]*(<[\w\W]+>)[^>]*$|^#([\w-]+)$/,va=/^.[^:#\[\.,]*$/,wa=/\S/,xa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,
if (t==oldt) {
if (t===oldt) {
function abc_keystroke(){ if (bReentry) return; bReentry = true; var t = editArea.get(); if (t==oldt) { abc_mousemove(); bReentry = false; return; } else { oldt = t; } // clear out any old tune var done = false; var i = 0; while (!done) { var el = $("canvas"+i); if (el) el.innerHTML = ""; else done = true; i++; } processAbc({ tunebook: t, fnCallback: writeOneTune }); // Put the click handlers on all the music we just printed.// var paths = $$('path');// var click = function() {// var x = this.getAttribute('abc-pos');// //$(this).setStyle({ backgroundColor: '#ff0000' });// if (x && !x.startsWith('-1')) {// var arr = x.split(',');// editArea.setSelection(parseInt(arr[0])-1, parseInt(arr[1]));// }// };// paths.each(function(path) {// path.onclick = click;// }); bReentry = false;}
this.bottom = 7; this.top = 7;
function ABCAbsoluteElement(abcelem, duration, minspacing) { // spacing which must be taken on top of the width this.abcelem = abcelem; this.duration = duration; this.minspacing = minspacing || 0; this.x = 0; this.children = []; this.heads = []; this.extra = []; this.extraw = 0; this.decs = []; this.w = 0; this.right = []; this.invisible = false;}
this.dy = (this.asc)?AbcSpacing.STEP:-AbcSpacing.STEP;
this.dy = (this.asc)?AbcSpacing.STEP*1.2:-AbcSpacing.STEP*1.2;
function ABCBeamElem (type, flat) { this.isflat = (flat); this.isgrace = (type && type==="grace"); this.forceup = (type && type==="up"); this.forcedown = (type && type==="down"); this.elems = []; // all the ABCAbsoluteElements this.total = 0; this.dy = (this.asc)?AbcSpacing.STEP:-AbcSpacing.STEP; if (this.isgrace) this.dy = this.dy*0.4; this.allrests = true;}
var text = getABCText(node); if (inabc) { if (node.nodeType==3 && !text.match(/^\s*$/)) {
if (node.nodeType==3 && !node.nodeValue.match(/^\s*$/)) { brcount=0; var text = node.nodeValue; if (text.match(/^\s*X:/m)) { inabc=true; abctext=""; } if (inabc) {
function ABCConversion(elem) { var contents = $(elem).contents(); var abctext = ""; var inabc = false; var brcount = 0; contents.each(function(i,node){ var text = getABCText(node); if (inabc) { if (node.nodeType==3 && !text.match(/^\s*$/)) { abctext += text.replace(/\n$/,"").replace(/^\n/,""); brcount=0; } else if($(node).is("br") && brcount==0) { abctext += "\n"; brcount++; } else { inabc = false; brcount=0; insertScoreBefore(node,abctext); } } else { if (text.match(/^X:/m)) { inabc=true; abctext=text.replace(/\n$/,"").replace(/^\n/,""); } } }); if (inabc) { appendScoreTo(elem,abctext); }}
brcount=0; } else if($(node).is("br") && brcount==0) { abctext += "\n"; brcount++; } else { inabc = false; brcount=0; insertScoreBefore(node,abctext); } } else { if (text.match(/^X:/m)) { inabc=true; abctext=text.replace(/\n$/,"").replace(/^\n/,""); }
} } else if (inabc && $(node).is("br") && brcount==0) { abctext += "\n"; brcount++; } else if (inabc) { inabc = false; brcount=0; insertScoreBefore(node,abctext);
function ABCConversion(elem) { var contents = $(elem).contents(); var abctext = ""; var inabc = false; var brcount = 0; contents.each(function(i,node){ var text = getABCText(node); if (inabc) { if (node.nodeType==3 && !text.match(/^\s*$/)) { abctext += text.replace(/\n$/,"").replace(/^\n/,""); brcount=0; } else if($(node).is("br") && brcount==0) { abctext += "\n"; brcount++; } else { inabc = false; brcount=0; insertScoreBefore(node,abctext); } } else { if (text.match(/^X:/m)) { inabc=true; abctext=text.replace(/\n$/,"").replace(/^\n/,""); } } }); if (inabc) { appendScoreTo(elem,abctext); }}
} else if($(node).is("br")) {
brcount=0; } else if($(node).is("br") && brcount==0) {
function ABCConversion(elem) { var contents = $(elem).contents(); var abctext = ""; var inabc = false; contents.each(function(i,node){ var text = getABCText(node); if (inabc) { if (node.nodeType==3 && !text.match(/^\s*$/)) { abctext += text.replace(/\n$/,"").replace(/^\n/,""); } else if($(node).is("br")) { abctext += "\n"; } else { inabc = false; insertScoreBefore(node,abctext); } } else { if (text.match(/^X:/m)) { inabc=true; abctext=text.replace(/\n$/,"").replace(/^\n/,""); } } }); if (inabc) { insertScoreBefore(contents.last(),abctext); }}
insertScoreBefore(contents.last(),abctext);
appendScoreTo(elem,abctext);
function ABCConversion(elem) { var contents = $(elem).contents(); var abctext = ""; var inabc = false; contents.each(function(i,node){ var text = getABCText(node); if (inabc) { if (node.nodeType==3 && !text.match(/^\s*$/)) { abctext += text.replace(/\n$/,"").replace(/^\n/,""); } else if($(node).is("br")) { abctext += "\n"; } else { inabc = false; insertScoreBefore(node,abctext); } } else { if (text.match(/^X:/m)) { inabc=true; abctext=text.replace(/\n$/,"").replace(/^\n/,""); } } }); if (inabc) { insertScoreBefore(contents.last(),abctext); }}
abcspan.append($(node));
function ABCConversion(elem) { var contents = $(elem).contents(); var abctext = ""; var inabc = false; var brcount = 0; contents.each(function(i,node){ if (node.nodeType==3 && !node.nodeValue.match(/^\s*$/)) { brcount=0; var text = node.nodeValue; if (text.match(/^\s*X:/m)) { inabc=true; abctext=""; } if (inabc) { abctext += text.replace(/\n$/,"").replace(/^\n/,""); } } else if (inabc && $(node).is("br") && brcount==0) { abctext += "\n"; brcount++; } else if (inabc) { // second br or whitespace textnode inabc = false; brcount=0; insertScoreBefore(node,abctext); } }); if (inabc) { appendScoreTo(elem,abctext); }}
var text = $(node).text();
var text = getABCText(node);
function ABCConversion(elem) { var contents = $(elem).contents(); var abctext = ""; var inabc = false; contents.each(function(i,node){ var text = $(node).text(); if (inabc) { if (node.nodeType==3 && !text.match(/^\s*$/)) { abctext += text.replace(/\n$/,"").replace(/^\n/,""); } else if($(node).is("br")) { abctext += "\n"; } else { inabc = false; insertScoreBefore(node,abctext); } } else { if (text.match(/^X:/m)) { inabc=true; abctext=text.replace(/\n$/,"").replace(/^\n/,""); } } }); if (inabc) { insertScoreBefore(contents.last(),abctext); }}
this.stafflines = 5;
function ABCLayout(glyphs, bagpipes) { this.glyphs = glyphs; this.isBagpipes = bagpipes; this.chartable = {rest:{0:"rests.whole", 1:"rests.half", 2:"rests.quarter", 3:"rests.8th", 4: "rests.16th",5: "rests.32nd", 6: "rests.64th", 7: "rests.128th"}, note:{"-1": "noteheads.dbl", 0:"noteheads.whole", 1:"noteheads.half", 2:"noteheads.quarter", 3:"noteheads.quarter", 4:"noteheads.quarter", 5:"noteheads.quarter", 6:"noteheads.quarter"}, uflags:{3:"flags.u8th", 4:"flags.u16th", 5:"flags.u32nd", 6:"flags.u64th"}, dflags:{3:"flags.d8th", 4:"flags.d16th", 5:"flags.d32nd", 6:"flags.d64th"}}; this.slurs = {}; this.ties = []; this.slursbyvoice = {}; this.tiesbyvoice = {}; this.endingsbyvoice = {}; this.s = 0; // current staff number this.v = 0; // current voice number on current staff}
this.slursbyvoice = {}; this.tiesbyvoice = {}; this.endingsbyvoice = {}; this.s = 0; this.v = 0;
function ABCLayout(glyphs, bagpipes) { this.glyphs = glyphs; this.isBagpipes = bagpipes; this.chartable = {rest:{0:"rests.whole", 1:"rests.half", 2:"rests.quarter", 3:"rests.8th", 4: "rests.16th",5: "rests.32nd", 6: "rests.64th", 7: "rests.128th"}, note:{"-1": "noteheads.dbl", 0:"noteheads.whole", 1:"noteheads.half", 2:"noteheads.quarter", 3:"noteheads.quarter", 4:"noteheads.quarter", 5:"noteheads.quarter", 6:"noteheads.quarter"}, uflags:{3:"flags.u8th", 4:"flags.u16th", 5:"flags.u32nd", 6:"flags.u64th"}, dflags:{3:"flags.d8th", 4:"flags.d16th", 5:"flags.d32nd", 6:"flags.d64th"}}; this.slurs = {}; this.ties = [];}
this.next = null;
function ABCMidiWriter(parent) { this.parent = parent; this.scale = [0,2,4,5,7,9,11]; this.restart = {line:0, staff:0, voice:0, pos:0}; this.visited = {}; this.multiplier =1;};
this.pitch2 = opt["pitch2"]; this.linewidth = opt["linewidth"];
function ABCRelativeElement(c, dx, w, pitch, opt) { opt = opt || {}; this.x = 0; this.c = c; // character or path or string this.dx = dx; // relative x position this.w = w; // minimum width taken up by this element (can include gratuitous space) this.pitch = pitch; // relative y position by pitch this.scalex = opt["scalex"] || 1; // should the character/path be scaled? this.type = opt["type"] || "symbol"; // cheap types.}
this.top = pitch + ((opt["extreme"]=="above")? 7 : 0); this.bottom = pitch - ((opt["extreme"]=="below")? 7 : 0);
function ABCRelativeElement(c, dx, w, pitch, opt) { opt = opt || {}; this.x = 0; this.c = c; // character or path or string this.dx = dx; // relative x position this.w = w; // minimum width taken up by this element (can include gratuitous space) this.pitch = pitch; // relative y position by pitch this.scalex = opt["scalex"] || 1; // should the character/path be scaled? this.scaley = opt["scaley"] || 1; // should the character/path be scaled? this.type = opt["type"] || "symbol"; // cheap types. this.pitch2 = opt["pitch2"]; this.linewidth = opt["linewidth"]; this.attributes = opt["attributes"]; // only present on textual elements}
this.stafflines = [];
function ABCStaffGroupElement() { this.voices = []; this.staffs = [];}
function ABCTieElem (anchor1, anchor2, above, force) {
function ABCTieElem (anchor1, anchor2, above, forceandshift) {
function ABCTieElem (anchor1, anchor2, above, force) { this.anchor1 = anchor1; // must have a .x and a .pitch, and a .parent property or be null (means starts at the "beginning" of the line - after keysig) this.anchor2 = anchor2; // must have a .x and a .pitch property or be null (means ends at the end of the line) this.above = above; // true if the arc curves above this.force = force;}
this.force = force;
this.force = forceandshift;
function ABCTieElem (anchor1, anchor2, above, force) { this.anchor1 = anchor1; // must have a .x and a .pitch, and a .parent property or be null (means starts at the "beginning" of the line - after keysig) this.anchor2 = anchor2; // must have a .x and a .pitch property or be null (means ends at the end of the line) this.above = above; // true if the arc curves above this.force = force;}
}
};
function ABCTripletElem (number, anchor1, anchor2, above) { this.anchor1 = anchor1; // must have a .x and a .pitch property or be null (means starts at the "beginning" of the line - after keysig) this.anchor2 = anchor2; // must have a .x and a .pitch property or be null (means ends at the end of the line) this.above = above; // true if the arc curves above this.number = number;}
function ABCVoiceElement(y, voicenumber, voicetotal) {
function ABCVoiceElement(voicenumber, voicetotal) {
function ABCVoiceElement(y, voicenumber, voicetotal) { this.children = []; this.beams = []; this.otherchildren = []; // ties, slurs, triplets this.w = 0; this.y = y; this.duplicate = false; this.voicenumber = voicenumber; //number of the voice on a given stave (not staffgroup) this.voicetotal = voicetotal;}
this.y = y;
function ABCVoiceElement(y, voicenumber, voicetotal) { this.children = []; this.beams = []; this.otherchildren = []; // ties, slurs, triplets this.w = 0; this.y = y; this.duplicate = false; this.voicenumber = voicenumber; //number of the voice on a given stave (not staffgroup) this.voicetotal = voicetotal;}
return this;
abort: function () { /// Is a query in progress? If readyState > 0 and < 4, it needs to be aborted. if (ajax.readyState % 4) { /// Stop it from retrying first. clearTimeout(ajax_timeout); ajax.abort(); } return this; },
if ( action.output.data.ldapGroupsAsRoles =='true' && action.result.data != null ) {
if ( action.output.data.ldapGroupsAsRoles == true && action.result.data != null ) {
actionCompleteHandler : function( form, action ) { if ( action.type == 'sonatypeSubmit' ) { if ( action.options.url == this.servicePath.testUserAndGroupConfig ) { var title = 'User Mapping Test Results'; if ( action.output.data.ldapGroupsAsRoles =='true' && action.result.data != null ) { var r = action.result.data; var n = 0; for ( var i = 0; i < r.length; i++ ) { n += r[i].roles.length; } if ( n == 0 ) { title += ' <span class="x-toolbar-warning"><b>WARNING:</b> the test returned no roles, group mapping may not be valid.</span>'; } } this.usersGridPanel.setTitle( title ); this.usersDataStore.loadData( action.result.data ? action.result : { data: [] } ); this.usersGridPanel.expand(); } else if ( action.options.url == this.servicePath.testConnectionInfo ) { Sonatype.MessageBox.alert( 'Authentication Test', 'LDAP connection and authentication test completed successfully.' ) .setIcon( Sonatype.MessageBox.INFO ); } } else if ( action.type == 'sonatypeLoad' && action.options.url == this.servicePath.userAndGroupConfig ) { var userComponent = this.find( 'name', 'userMemberOfAttribute' )[0]; if ( !Ext.isEmpty( userComponent.getValue() ) ) { this.find( 'name', 'groupType' )[0].setValue( 'dynamic' ); this.showComponent( userComponent ); this.hideComponent( this.find( 'name', 'groupBaseDn' )[0] ); this.hideComponent( this.find( 'name', 'groupSubtree' )[0] ); this.hideComponent( this.find( 'name', 'groupObjectClass' )[0] ); this.hideComponent( this.find( 'name', 'groupIdAttribute' )[0] ); this.hideComponent( this.find( 'name', 'groupMemberAttribute' )[0] ); this.hideComponent( this.find( 'name', 'groupMemberFormat' )[0] ); } else { this.find( 'name', 'groupType' )[0].setValue( 'static' ); this.hideComponent( userComponent ); this.showComponent( this.find( 'name', 'groupBaseDn' )[0] ); this.showComponent( this.find( 'name', 'groupSubtree' )[0] ); this.showComponent( this.find( 'name', 'groupObjectClass' )[0] ); this.showComponent( this.find( 'name', 'groupIdAttribute' )[0] ); this.showComponent( this.find( 'name', 'groupMemberAttribute' )[0] ); this.showComponent( this.find( 'name', 'groupMemberFormat' )[0] ); } var ldapGroupsAsRoles = this.find( 'name', 'ldapGroupsAsRoles' )[0]; if ( ldapGroupsAsRoles.getRawValue() != "true" ) { ldapGroupsAsRoles.ownerCt.collapse(); } } },
if ( ldapGroupsAsRoles.getRawValue() != "true" ) {
if ( ldapGroupsAsRoles.getValue() != true ) {
actionCompleteHandler : function( form, action ) { if ( action.type == 'sonatypeSubmit' ) { if ( action.options.url == this.servicePath.testUserAndGroupConfig ) { var title = 'User Mapping Test Results'; if ( action.output.data.ldapGroupsAsRoles =='true' && action.result.data != null ) { var r = action.result.data; var n = 0; for ( var i = 0; i < r.length; i++ ) { n += r[i].roles.length; } if ( n == 0 ) { title += ' <span class="x-toolbar-warning"><b>WARNING:</b> the test returned no roles, group mapping may not be valid.</span>'; } } this.usersGridPanel.setTitle( title ); this.usersDataStore.loadData( action.result.data ? action.result : { data: [] } ); this.usersGridPanel.expand(); } else if ( action.options.url == this.servicePath.testConnectionInfo ) { Sonatype.MessageBox.alert( 'Authentication Test', 'LDAP connection and authentication test completed successfully.' ) .setIcon( Sonatype.MessageBox.INFO ); } } else if ( action.type == 'sonatypeLoad' && action.options.url == this.servicePath.userAndGroupConfig ) { var userComponent = this.find( 'name', 'userMemberOfAttribute' )[0]; if ( !Ext.isEmpty( userComponent.getValue() ) ) { this.find( 'name', 'groupType' )[0].setValue( 'dynamic' ); this.showComponent( userComponent ); this.hideComponent( this.find( 'name', 'groupBaseDn' )[0] ); this.hideComponent( this.find( 'name', 'groupSubtree' )[0] ); this.hideComponent( this.find( 'name', 'groupObjectClass' )[0] ); this.hideComponent( this.find( 'name', 'groupIdAttribute' )[0] ); this.hideComponent( this.find( 'name', 'groupMemberAttribute' )[0] ); this.hideComponent( this.find( 'name', 'groupMemberFormat' )[0] ); } else { this.find( 'name', 'groupType' )[0].setValue( 'static' ); this.hideComponent( userComponent ); this.showComponent( this.find( 'name', 'groupBaseDn' )[0] ); this.showComponent( this.find( 'name', 'groupSubtree' )[0] ); this.showComponent( this.find( 'name', 'groupObjectClass' )[0] ); this.showComponent( this.find( 'name', 'groupIdAttribute' )[0] ); this.showComponent( this.find( 'name', 'groupMemberAttribute' )[0] ); this.showComponent( this.find( 'name', 'groupMemberFormat' )[0] ); } var ldapGroupsAsRoles = this.find( 'name', 'ldapGroupsAsRoles' )[0]; if ( ldapGroupsAsRoles.getRawValue() != "true" ) { ldapGroupsAsRoles.ownerCt.collapse(); } } },
effects.push(new Effect.Move(tab.content, { x: position, y: 0, mode: 'absolute', sync: true } ));
effects.push(new Effect.Move(tab.content, { x: 0, y: position, mode: 'absolute', sync: true } ));
activate: function() { var effects = []; for (var i = 0; i < this.menu.tabs.length; i++) { var tab = this.menu.tabs[i]; var position = tab.tStartingPosition - this.tStartingPosition; effects.push(new Effect.Move(tab.content, { x: position, y: 0, mode: 'absolute', sync: true } )); } if (this.menu.latestEffect != null) { this.menu.latestEffect.cancel(); } this.menu.latestEffect = new Effect.Parallel(effects, this.parent.options.animationOptions); },
activeLayersPanel.setLayerVisible(!isChecked);
activeLayerRecord.setLayerVisible(!isChecked);
var activeLayerCheckHandler = function(activeLayerRecord, isChecked, forceApplyFilter) { //set the record to be selected if checked activeLayersPanel.getSelectionModel().selectRecords([activeLayerRecord.internalRecord], false); if (activeLayerRecord.getIsLoading()) { activeLayersPanel.setLayerVisible(!isChecked); //reverse selection Ext.MessageBox.show({ title: 'Please wait', msg: "There is an operation in process for this layer. Please wait until it is finished.", buttons: Ext.MessageBox.OK, animEl: 'mb9', icon: Ext.MessageBox.INFO }); return; } activeLayerRecord.setLayerVisible(isChecked); if (isChecked) { var filterPanelObj = activeLayerRecord.getFilterPanel(); //Create our filter panel if we haven't already if (!filterPanelObj) { filterPanelObj = formFactory.getFilterForm(activeLayerRecord, map); activeLayerRecord.setFilterPanel(filterPanelObj); } //If the filter panel already exists, this may be a case where we are retriggering visiblity //in which case just rerun the previous filter if (filterPanelObj.form && forceApplyFilter && !filterButton.disabled) { filterButton.handler(); } //If there is a filter panel, show it if (filterPanelObj.form) { filterPanel.add(filterPanelObj.form); filterPanel.getLayout().setActiveItem(activeLayerRecord.getId()); } //if we enable the filter button we don't download the layer immediately (as the user will have to enter in filter params) if (filterPanelObj.supportsFiltering) { filterButton.enable(); filterButton.toggle(true); } else { //Otherwise the layer doesn't need filtering, just display it immediately loadLayer(activeLayerRecord); } filterPanel.doLayout(); } else { //Otherwise we are making the layer invisible, so clear any overlays var overlayManager = activeLayerRecord.getOverlayManager(); if (overlayManager) { overlayManager.clearOverlays(); } filterPanel.getLayout().setActiveItem(0); filterButton.disable(); } };
filterPanel.getLayout().setActiveItem(activeLayerRecord.getId());
if (filterPanelObj && filterPanelObj.form) { filterPanel.getLayout().setActiveItem(activeLayerRecord.getId()); } else { filterPanel.getLayout().setActiveItem(0); }
var activeLayerSelectionHandler = function(activeLayerRecord) { //if its not checked then don't do any actions if (!activeLayerRecord.getLayerVisible()) { filterPanel.getLayout().setActiveItem(0); filterButton.disable(); } else if (activeLayerRecord.getFilterPanel() != null) { var filterPanelObj = activeLayerRecord.getFilterPanel(); //if filter panel already exists then show it filterPanel.getLayout().setActiveItem(activeLayerRecord.getId()); if (filterPanelObj.supportsFiltering) { filterButton.enable(); filterButton.toggle(true); } else { filterButton.disable(); } } else { //if this type doesnt need a filter panel then just show the default filter panel filterPanel.getLayout().setActiveItem(0); filterButton.disable(); } };
var activeLayerSelectionHandler = function(sm, index, record) { var activeLayerRecord = new ActiveLayersRecord(record);
var activeLayerSelectionHandler = function(activeLayerRecord) {
var activeLayerSelectionHandler = function(sm, index, record) { var activeLayerRecord = new ActiveLayersRecord(record); //if its not checked then don't do any actions if (!activeLayerRecord.getLayerVisible()) { filterPanel.getLayout().setActiveItem(0); filterButton.disable(); } else if (activeLayerRecord.getFilterPanel() != null) { var filterPanelObj = activeLayerRecord.getFilterPanel(); //if filter panel already exists then show it filterPanel.getLayout().setActiveItem(activeLayerRecord.getId()); if (filterPanelObj.supportsFiltering) { filterButton.enable(); filterButton.toggle(true); } else { filterButton.disable(); } } else { //if this type doesnt need a filter panel then just show the default filter panel filterPanel.getLayout().setActiveItem(0); filterButton.disable(); } };
} else if (activeLayerRecord.getFilterPanel() != null) {
} else if (activeLayerRecord.getFilterPanel() !== null) {
var activeLayerSelectionHandler = function(activeLayerRecord) { //if its not checked then don't do any actions if (!activeLayerRecord.getLayerVisible()) { filterPanel.getLayout().setActiveItem(0); filterButton.disable(); } else if (activeLayerRecord.getFilterPanel() != null) { var filterPanelObj = activeLayerRecord.getFilterPanel(); //if filter panel already exists then show it if (filterPanelObj && filterPanelObj.form) { filterPanel.getLayout().setActiveItem(activeLayerRecord.getId()); } else { filterPanel.getLayout().setActiveItem(0); } if (filterPanelObj.supportsFiltering) { filterButton.enable(); filterButton.toggle(true); } else { filterButton.disable(); } } else { //if this type doesnt need a filter panel then just show the default filter panel filterPanel.getLayout().setActiveItem(0); filterButton.disable(); } };
if (filterPanelObj.supportsFiltering) {
if (filterPanelObj && filterPanelObj.supportsFiltering) {
var activeLayerSelectionHandler = function(activeLayerRecord) { //if its not checked then don't do any actions if (!activeLayerRecord.getLayerVisible()) { filterPanel.getLayout().setActiveItem(0); filterButton.disable(); } else if (activeLayerRecord.getFilterPanel() != null) { var filterPanelObj = activeLayerRecord.getFilterPanel(); //if filter panel already exists then show it if (filterPanelObj && filterPanelObj.form) { filterPanel.getLayout().setActiveItem(activeLayerRecord.getId()); } else { filterPanel.getLayout().setActiveItem(0); } if (filterPanelObj.supportsFiltering) { filterButton.enable(); filterButton.toggle(true); } else { filterButton.disable(); } } else { //if this type doesnt need a filter panel then just show the default filter panel filterPanel.getLayout().setActiveItem(0); filterButton.disable(); } };
var filterPanelObj = activeLayerRecord.getFilterPanel(); if (filterPanelObj && filterPanelObj.form) { filterPanelObj.form.destroy(); }
var activeLayersRemoveHandler = function(activeLayerRecord) { if (activeLayerRecord.getIsLoading()) { Ext.MessageBox.show({ title: 'Please wait', msg: "There is an operation in process for this layer. Please wait until it is finished.", buttons: Ext.MessageBox.OK, animEl: 'mb9', icon: Ext.MessageBox.INFO }); return; } var overlayManager = activeLayerRecord.getOverlayManager(); if (overlayManager) { overlayManager.clearOverlays(); } //remove it from active layers activeLayersStore.removeActiveLayersRecord(activeLayerRecord); //set the filter panels active item to 0 filterPanel.getLayout().setActiveItem(0); };
console.log(XMLHttpRequest); console.log(textStatus); console.log(errorThrown);
add: function(evt) { // prevent default evt.preventDefault(); // validate if($('#newCategoryValue').val().length == 0) return false; // split url to buil the ajax-url var chunks = document.location.pathname.split('/'); // buil ajax-url var url = '/backend/ajax.php?module=' + chunks[3] + '&action=add_category&language=' + chunks[2]; // init var var name = $('#newCategoryValue').val(); // make the call $.ajax({cache: false, type: 'POST', dataType: 'json', url: url, data: 'category_name=' + name, success: function(data, textStatus) { if(data.code == 200) { // existing categoyr if(typeof data.data.id != 'undefined') var id = data.data.id; // doesn't exist else { var id = data.data.new_id; $('#categoryId').append('<option selected="selected" value="'+ id +'">'+ name +'</option>'); } // unselect all $('#categoryId option').attr('selected', ''); // set selected $('#categoryId').val(id); // clear $('#newCategoryValue').val(''); $('#newCategoryButton').addClass('disabledButton'); $('#newCategory').slideUp(); // show message jsBackend.messages.add('success', "{$msgCategoryAdded}"); } else { // show message jsBackend.messages.add('error', textStatus); } // alert the user if(data.code != 200 && jsBackend.debug) { alert(data.message); } }, error: function(XMLHttpRequest, textStatus, errorThrown) { // show box again $('#newCategoryError').show(); // show message jsBackend.messages.add('error', textStatus); // alert the user if(jsBackend.debug) alert(textStatus); } }); },
jsBackend.messages.add('success', "{$msgCategoryAdded}");
jsBackend.messages.add('success', "{$msgAddedCategory|addslashes}".replace('%1$s', name));
add: function(evt) { // prevent default evt.preventDefault(); // validate if($('#newCategoryValue').val().length == 0) return false; // split url to buil the ajax-url var chunks = document.location.pathname.split('/'); // buil ajax-url var url = '/backend/ajax.php?module=' + chunks[3] + '&action=add_category&language=' + chunks[2]; // init var var name = $('#newCategoryValue').val(); // make the call $.ajax({ url: url, data: 'category_name=' + name, success: function(data, textStatus) { if(data.code == 200) { // existing categoyr if(typeof data.data.id != 'undefined') var id = data.data.id; // doesn't exist else { var id = data.data.new_id; $('#categoryId').append('<option selected="selected" value="'+ id +'">'+ name +'</option>'); } // unselect all $('#categoryId option').attr('selected', ''); // set selected $('#categoryId').val(id); // clear $('#newCategoryValue').val(''); $('#newCategoryButton').addClass('disabledButton'); $('#newCategory').slideUp(); // show message jsBackend.messages.add('success', "{$msgCategoryAdded}"); } else { // show message jsBackend.messages.add('error', textStatus); } // alert the user if(data.code != 200 && jsBackend.debug) { alert(data.message); } } }); },
} else if (layout.contains(l)) { layouts.splice(i, 0, layout); return;
this.add = function(layout) { var i, il; for (i=0, il = layouts.length ;i < il; ++i) { var l = layouts[i]; if (l.getId() == layout.getId()) { layouts[i] = layout; return; } } layouts.push(layout); };
e;var b=d(this).unbind(".tabs");d.each(["href","load","cache"],function(c,h){b.removeData(h+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){d.data(this,"destroy.tabs")?d(this).remove():d(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-state-hover ui-state-focus ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")});a.cookie&&this._cookie(null,a.cookie);return this},add:function(a,e,b){if(b===p)b=this.anchors.length; var c=this,h=this.options;e=d(h.tabTemplate.replace(/#\{href\}/g,a).replace(/#\{label\}/g,e));a=!a.indexOf("#")?a.replace("#",""):this._tabId(d("a",e)[0]);e.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var i=d("#"+a);i.length||(i=d(h.panelTemplate).attr("id",a).data("destroy.tabs",true));i.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(b>=this.lis.length){e.appendTo(this.list);i.appendTo(this.list[0].parentNode)}else{e.insertBefore(this.lis[b]); i.insertBefore(this.panels[b])}h.disabled=d.map(h.disabled,function(k){return k>=b?++k:k});this._tabify();if(this.anchors.length==1){h.selected=0;e.addClass("ui-tabs-selected ui-state-active");i.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){c._trigger("show",null,c._ui(c.anchors[0],c.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[b],this.panels[b]));return this},remove:function(a){a=this._getIndex(a);var e=this.options,b=this.lis.eq(a).remove(),c=this.panels.eq(a).remove();
d.data(this,"href.tabs");if(e)this.href=e;var a=d(this).unbind(".tabs");d.each(["href","load","cache"],function(c,h){a.removeData(h+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){d.data(this,"destroy.tabs")?d(this).remove():d(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-state-hover ui-state-focus ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")});b.cookie&&this._cookie(null,b.cookie);return this},add:function(b, e,a){if(a===p)a=this.anchors.length;var c=this,h=this.options;e=d(h.tabTemplate.replace(/#\{href\}/g,b).replace(/#\{label\}/g,e));b=!b.indexOf("#")?b.replace("#",""):this._tabId(d("a",e)[0]);e.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var j=d("#"+b);j.length||(j=d(h.panelTemplate).attr("id",b).data("destroy.tabs",true));j.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(a>=this.lis.length){e.appendTo(this.list);j.appendTo(this.list[0].parentNode)}else{e.insertBefore(this.lis[a]); j.insertBefore(this.panels[a])}h.disabled=d.map(h.disabled,function(k){return k>=a?++k:k});this._tabify();if(this.anchors.length==1){h.selected=0;e.addClass("ui-tabs-selected ui-state-active");j.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){c._trigger("show",null,c._ui(c.anchors[0],c.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[a],this.panels[a]));return this},remove:function(b){b=this._getIndex(b);var e=this.options,a=this.lis.eq(b).remove(),c=this.panels.eq(b).remove();
e;var b=d(this).unbind(".tabs");d.each(["href","load","cache"],function(c,h){b.removeData(h+".tabs")})});this.lis.unbind(".tabs").add(this.panels).each(function(){d.data(this,"destroy.tabs")?d(this).remove():d(this).removeClass("ui-state-default ui-corner-top ui-tabs-selected ui-state-active ui-state-hover ui-state-focus ui-state-disabled ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide")});a.cookie&&this._cookie(null,a.cookie);return this},add:function(a,e,b){if(b===p)b=this.anchors.length;var c=this,h=this.options;e=d(h.tabTemplate.replace(/#\{href\}/g,a).replace(/#\{label\}/g,e));a=!a.indexOf("#")?a.replace("#",""):this._tabId(d("a",e)[0]);e.addClass("ui-state-default ui-corner-top").data("destroy.tabs",true);var i=d("#"+a);i.length||(i=d(h.panelTemplate).attr("id",a).data("destroy.tabs",true));i.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide");if(b>=this.lis.length){e.appendTo(this.list);i.appendTo(this.list[0].parentNode)}else{e.insertBefore(this.lis[b]);i.insertBefore(this.panels[b])}h.disabled=d.map(h.disabled,function(k){return k>=b?++k:k});this._tabify();if(this.anchors.length==1){h.selected=0;e.addClass("ui-tabs-selected ui-state-active");i.removeClass("ui-tabs-hide");this.element.queue("tabs",function(){c._trigger("show",null,c._ui(c.anchors[0],c.panels[0]))});this.load(0)}this._trigger("add",null,this._ui(this.anchors[b],this.panels[b]));return this},remove:function(a){a=this._getIndex(a);var e=this.options,b=this.lis.eq(a).remove(),c=this.panels.eq(a).remove();
if(type == 'notice') { setTimeout('jsBackend.messages.hide($("#'+ uniqueId +'"));', 20000); }
if(type == 'notice') { setTimeout('jsBackend.messages.hide($("#'+ uniqueId +'"));', 5000); }
add: function(type, content) { var uniqueId = 'e'+ new Date().getTime().toString(); var html = '<div id="'+ uniqueId +'" class="formMessage '+ type +'Message" style="display: none;">'+ ' <p>'+ content +'</p>'+ ' <div class="buttonHolderRight">'+ ' <a class="button icon linkButton iconClose iconOnly" href="#"><span><span><span>X</span></span></span></a>'+ ' </div>'+ '</div>'; // prepend $('#messaging').prepend(html); // show $('#'+ uniqueId).fadeIn(); // timeout if(type == 'notice') { setTimeout('jsBackend.messages.hide($("#'+ uniqueId +'"));', 20000); } if(type == 'success') { setTimeout('jsBackend.messages.hide($("#'+ uniqueId +'"));', 5000); } },
else return 'url('+E+G+H+I+')';});};if(!l[p]){var v=s.preload;if(v&&v.length>0){t(v);a.imageCacher.load(v,function(){l[p]=1;n(o,p,q,r);});return;}l[p]=1;}q=s[q];var w=!q||!!q._isLoaded;if(w)r&&r();else{var x=q._pending||(q._pending=[]);x.push(r);if(x.length>1)return;var y=!q.css||!q.css.length,z=!q.js||!q.js.length,A=function(){if(y&&z){q._isLoaded=1;for(var D=0;D<x.length;D++){if(x[D])x[D]();}}};if(!y){var B=q.css;if(e.isArray(B)){t(B);for(var C=0;C<B.length;C++)a.document.appendStyleSheet(B[C]);}else{B=u(B,a.getUrl(m[p]));a.document.appendStyleText(B);}q.css=B;y=1;}if(!z){t(q.js);a.scriptLoader.load(q.js,function(){z=1;A();});}A();}};return{add:function(o,p){k[o]=p;p.skinPath=m[o]||(m[o]=a.getUrl('skins/'+o+'/'));},load:function(o,p,q){var r=o.skinName,s=o.skinPath;if(k[r])n(o,r,p,q);else{m[r]=s;a.scriptLoader.load(a.getUrl(s+'skin.js'),function(){n(o,r,p,q);});}}};})();a.themes=new a.resourceManager('themes/','theme');a.ui=function(k){if(k.ui)return k.ui;this._={handlers:{},items:{},editor:k};return this;};var k=a.ui;k.prototype={add:function(l,m,n){this._.items[l]={type:m,command:n.command||null,args:Array.prototype.slice.call(arguments,2)};},create:function(l){var q=this;var m=q._.items[l],n=m&&q._.handlers[m.type],o=m&&m.command&&q._.editor.getCommand(m.command),p=n&&n.create.apply(q,m.args);if(o)o.uiItems.push(p);return p;},addHandler:function(l,m){this._.handlers[l]=m;}};(function(){var l=0,m=function(){var x='editor'+ ++l;return a.instances&&a.instances[x]?m():x;},n={},o=function(x){var y=x.config.customConfig;if(!y)return false;y=a.getUrl(y);var z=n[y]||(n[y]={});if(z.fn){z.fn.call(x,x.config);if(a.getUrl(x.config.customConfig)==y||!o(x))x.fireOnce('customConfigLoaded');}else a.scriptLoader.load(y,function(){if(a.editorConfig)z.fn=a.editorConfig;else z.fn=function(){};o(x);});return true;},p=function(x,y){x.on('customConfigLoaded',function(){if(y){if(y.on)for(var z in y.on)x.on(z,y.on[z]);e.extend(x.config,y,true);delete x.config.on;}q(x);});if(y&&y.customConfig!=undefined)x.config.customConfig=y.customConfig;if(!o(x))x.fireOnce('customConfigLoaded');},q=function(x){var y=x.config.skin.split(','),z=y[0],A=a.getUrl(y[1]||'skins/'+z+'/');x.skinName=z;x.skinPath=A;x.skinClass='cke_skin_'+z;x.tabIndex=x.config.tabIndex||x.element.getAttribute('tabindex')||0;x.fireOnce('configLoaded');t(x);},r=function(x){a.lang.load(x.config.language,x.config.defaultLanguage,function(y,z){x.langCode=y;x.lang=e.prototypedCopy(z);if(b.gecko&&b.version<10900&&x.lang.dir=='rtl')x.lang.dir='ltr';
for(var C=0;C<B.length;C++)a.document.appendStyleSheet(B[C]);}else{B=u(B,a.getUrl(m[p]));a.document.appendStyleText(B);}q.css=B;y=1;}if(!z){t(q.js);a.scriptLoader.load(q.js,function(){z=1;A();});}A();}};return{add:function(o,p){k[o]=p;p.skinPath=m[o]||(m[o]=a.getUrl('skins/'+o+'/'));},load:function(o,p,q){var r=o.skinName,s=o.skinPath;if(k[r])n(o,r,p,q);else{m[r]=s;a.scriptLoader.load(a.getUrl(s+'skin.js'),function(){n(o,r,p,q);});}}};})();a.themes=new a.resourceManager('themes/','theme');a.ui=function(k){if(k.ui)return k.ui;this._={handlers:{},items:{},editor:k};return this;};var k=a.ui;k.prototype={add:function(l,m,n){this._.items[l]={type:m,command:n.command||null,args:Array.prototype.slice.call(arguments,2)};},create:function(l){var q=this;var m=q._.items[l],n=m&&q._.handlers[m.type],o=m&&m.command&&q._.editor.getCommand(m.command),p=n&&n.create.apply(q,m.args);if(o)o.uiItems.push(p);return p;},addHandler:function(l,m){this._.handlers[l]=m;}};(function(){var l=0,m=function(){var x='editor'+ ++l;return a.instances&&a.instances[x]?m():x;},n={},o=function(x){var y=x.config.customConfig;if(!y)return false;y=a.getUrl(y);var z=n[y]||(n[y]={});if(z.fn){z.fn.call(x,x.config);if(a.getUrl(x.config.customConfig)==y||!o(x))x.fireOnce('customConfigLoaded');}else a.scriptLoader.load(y,function(){if(a.editorConfig)z.fn=a.editorConfig;else z.fn=function(){};o(x);});return true;},p=function(x,y){x.on('customConfigLoaded',function(){if(y){if(y.on)for(var z in y.on)x.on(z,y.on[z]);e.extend(x.config,y,true);delete x.config.on;}q(x);});if(y&&y.customConfig!=undefined)x.config.customConfig=y.customConfig;if(!o(x))x.fireOnce('customConfigLoaded');},q=function(x){var y=x.config.skin.split(','),z=y[0],A=a.getUrl(y[1]||'skins/'+z+'/');x.skinName=z;x.skinPath=A;x.skinClass='cke_skin_'+z;x.tabIndex=x.config.tabIndex||x.element.getAttribute('tabindex')||0;x.fireOnce('configLoaded');t(x);},r=function(x){a.lang.load(x.config.language,x.config.defaultLanguage,function(y,z){x.langCode=y;x.lang=e.prototypedCopy(z);if(b.gecko&&b.version<10900&&x.lang.dir=='rtl')x.lang.dir='ltr';var A=x.config;A.contentsLangDirection=='ui'&&(A.contentsLangDirection=x.lang.dir);s(x);});},s=function(x){var y=x.config,z=y.plugins,A=y.extraPlugins,B=y.removePlugins;if(A){var C=new RegExp('(?:^|,)(?:'+A.replace(/\s*,\s*/g,'|')+')(?=,|$)','g');z=z.replace(C,'');z+=','+A;}if(B){C=new RegExp('(?:^|,)(?:'+B.replace(/\s*,\s*/g,'|')+')(?=,|$)','g');z=z.replace(C,'');}j.load(z.split(','),function(D){var E=[],F=[],G=[];
else return 'url('+E+G+H+I+')';});};if(!l[p]){var v=s.preload;if(v&&v.length>0){t(v);a.imageCacher.load(v,function(){l[p]=1;n(o,p,q,r);});return;}l[p]=1;}q=s[q];var w=!q||!!q._isLoaded;if(w)r&&r();else{var x=q._pending||(q._pending=[]);x.push(r);if(x.length>1)return;var y=!q.css||!q.css.length,z=!q.js||!q.js.length,A=function(){if(y&&z){q._isLoaded=1;for(var D=0;D<x.length;D++){if(x[D])x[D]();}}};if(!y){var B=q.css;if(e.isArray(B)){t(B);for(var C=0;C<B.length;C++)a.document.appendStyleSheet(B[C]);}else{B=u(B,a.getUrl(m[p]));a.document.appendStyleText(B);}q.css=B;y=1;}if(!z){t(q.js);a.scriptLoader.load(q.js,function(){z=1;A();});}A();}};return{add:function(o,p){k[o]=p;p.skinPath=m[o]||(m[o]=a.getUrl('skins/'+o+'/'));},load:function(o,p,q){var r=o.skinName,s=o.skinPath;if(k[r])n(o,r,p,q);else{m[r]=s;a.scriptLoader.load(a.getUrl(s+'skin.js'),function(){n(o,r,p,q);});}}};})();a.themes=new a.resourceManager('themes/','theme');a.ui=function(k){if(k.ui)return k.ui;this._={handlers:{},items:{},editor:k};return this;};var k=a.ui;k.prototype={add:function(l,m,n){this._.items[l]={type:m,command:n.command||null,args:Array.prototype.slice.call(arguments,2)};},create:function(l){var q=this;var m=q._.items[l],n=m&&q._.handlers[m.type],o=m&&m.command&&q._.editor.getCommand(m.command),p=n&&n.create.apply(q,m.args);if(o)o.uiItems.push(p);return p;},addHandler:function(l,m){this._.handlers[l]=m;}};(function(){var l=0,m=function(){var x='editor'+ ++l;return a.instances&&a.instances[x]?m():x;},n={},o=function(x){var y=x.config.customConfig;if(!y)return false;y=a.getUrl(y);var z=n[y]||(n[y]={});if(z.fn){z.fn.call(x,x.config);if(a.getUrl(x.config.customConfig)==y||!o(x))x.fireOnce('customConfigLoaded');}else a.scriptLoader.load(y,function(){if(a.editorConfig)z.fn=a.editorConfig;else z.fn=function(){};o(x);});return true;},p=function(x,y){x.on('customConfigLoaded',function(){if(y){if(y.on)for(var z in y.on)x.on(z,y.on[z]);e.extend(x.config,y,true);delete x.config.on;}q(x);});if(y&&y.customConfig!=undefined)x.config.customConfig=y.customConfig;if(!o(x))x.fireOnce('customConfigLoaded');},q=function(x){var y=x.config.skin.split(','),z=y[0],A=a.getUrl(y[1]||'skins/'+z+'/');x.skinName=z;x.skinPath=A;x.skinClass='cke_skin_'+z;x.tabIndex=x.config.tabIndex||x.element.getAttribute('tabindex')||0;x.fireOnce('configLoaded');t(x);},r=function(x){a.lang.load(x.config.language,x.config.defaultLanguage,function(y,z){x.langCode=y;x.lang=e.prototypedCopy(z);if(b.gecko&&b.version<10900&&x.lang.dir=='rtl')x.lang.dir='ltr';
w.ownerDocument&&w!==b;){if(p?p.index(w)>-1:d(w).is(a))return w;w=w.parentNode}return null})},index:function(a){if(!a||typeof a==="string")return d.inArray(this[0],a?d(a):this.parent().children());return d.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?d(a,b||this.context):d.makeArray(a);b=d.merge(this.get(),a);return this.pushStack(a[0]&&(a[0].setInterval||a[0].nodeType===9||a[0].parentNode&&a[0].parentNode.nodeType!==11)?d.unique(b):b)},andSelf:function(){return this.add(this.prevObject)}});
-1:c(f).is(h)){e.push({selector:l,elem:f});delete k[l]}}f=f.parentNode}}return e}var p=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(o,w){for(;w&&w.ownerDocument&&w!==b;){if(p?p.index(w)>-1:c(w).is(a))return w;w=w.parentNode}return null})},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(), a);return this.pushStack(a[0]&&(a[0].setInterval||a[0].nodeType===9||a[0].parentNode&&a[0].parentNode.nodeType!==11)?c.unique(b):b)},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,e){return c.dir(a,"parentNode",e)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,
w.ownerDocument&&w!==b;){if(p?p.index(w)>-1:d(w).is(a))return w;w=w.parentNode}return null})},index:function(a){if(!a||typeof a==="string")return d.inArray(this[0],a?d(a):this.parent().children());return d.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?d(a,b||this.context):d.makeArray(a);b=d.merge(this.get(),a);return this.pushStack(a[0]&&(a[0].setInterval||a[0].nodeType===9||a[0].parentNode&&a[0].parentNode.nodeType!==11)?d.unique(b):b)},andSelf:function(){return this.add(this.prevObject)}});
var value = $('#addValue-' + id).val().replace(/^\s+|\s+$/g, '');
var value = $('#addValue-' + id).val().replace(/^\s+|\s+$/g, '').replace(options.splitChar, '');
function add() { blockSubmit = false; // init some vars var value = $('#addValue-' + id).val().replace(/^\s+|\s+$/g, ''); var inElements = false; // reset box $('#addValue-' + id).val('').focus(); $('#addButton-' + id).addClass('disabledButton'); // only add new element if it isn't empty if(value != '') { // already in elements? for( var i in elements) { if(value == elements[i]) inElements = true; } // only add if not already in elements if(!inElements) { // add elements elements.push(value); // set new value $('#' + id).val(elements.join(options.splitChar)); // rebuild element list build(); } } }
if (child == null) return null;
if (child === null) return null;
function add_content_bottom() { var child = page.lastChild, child_position, newEl, page_height; if (child == null) return null; child_position = child_position = child.offsetTop + child.clientHeight; page_height = page_height = doc_docEl.clientHeight; /// Is the user scrolling close to the bottom of the page? if (child_position < scroll_pos + page_height + buffer_add) { /// Can the content be grabbed from cache? if (cached_count_bottom > 0) { newEl = doc.createElement("div"); /// First subtract 1 from the global counter variable to point to the last cached passage, and then retrieve the cached content. newEl.innerHTML = cached_verses_bottom[--cached_count_bottom]; ///NOTE: This is actually works like insertAfter() (if such a function existed). /// By using "null" as the second parameter, it tells it to add the element to the end. page.insertBefore(newEl, null); /// This fixes an IE7+ bug that causes the page to scroll needlessly when an element is added. /*@cc_on win.scrollTo(0, scroll_pos); @*/ /// Better check to see if we need to add more content. setTimeout(add_content_bottom, lookup_speed_scrolling); } else { /// Did the user scroll all the way to the very bottom? (If so, then there is no more content to be gotten.) if (scroll_maxed_bottom) { bottomLoader.style.visibility = "hidden"; return null; } /// Get more content. run_search(ADDITIONAL); } } }
if (child.offsetTop + child.clientHeight < scroll_pos + doc_docEl.clientHeight + buffer_add) {
if (child.offsetTop + child.clientHeight < window.pageYOffset + doc_docEl.clientHeight + buffer_add) {
function add_content_bottom_if_needed() { var child = page.lastChild, newEl; if (child === null) { return null; } /// Is the user scrolling close to the bottom of the page? if (child.offsetTop + child.clientHeight < scroll_pos + doc_docEl.clientHeight + buffer_add) { /// Can the content be grabbed from cache? if (cached_count_bottom > 0) { newEl = document.createElement("div"); /// First subtract 1 from the outer counter variable to point to the last cached passage, and then retrieve the cached content. newEl.innerHTML = cached_verses_bottom[--cached_count_bottom]; ///NOTE: This is actually works like insertAfter() (if such a function existed). /// By using "null" as the second parameter, it tells it to add the element to the end. page.insertBefore(newEl, null); /// This fixes an IE7+ bug that causes the page to scroll needlessly when an element is added. /*@cc_on window.scrollTo(0, scroll_pos); @*/ /// Check to see if we need to add more content. add_content_if_needed(additional); } else { /// Did the user scroll all the way to the very bottom? (If so, then there is no more content to be gotten.) if (scroll_maxed_bottom) { bottomLoader.style.visibility = "hidden"; return null; } /// Get more content. run_search(additional); } } }
window.scrollTo(0, scroll_pos);
scrollViewTo(0, window.pageYOffset);
function add_content_bottom_if_needed() { var child = page.lastChild, newEl; if (child === null) { return null; } /// Is the user scrolling close to the bottom of the page? if (child.offsetTop + child.clientHeight < scroll_pos + doc_docEl.clientHeight + buffer_add) { /// Can the content be grabbed from cache? if (cached_count_bottom > 0) { newEl = document.createElement("div"); /// First subtract 1 from the outer counter variable to point to the last cached passage, and then retrieve the cached content. newEl.innerHTML = cached_verses_bottom[--cached_count_bottom]; ///NOTE: This is actually works like insertAfter() (if such a function existed). /// By using "null" as the second parameter, it tells it to add the element to the end. page.insertBefore(newEl, null); /// This fixes an IE7+ bug that causes the page to scroll needlessly when an element is added. /*@cc_on window.scrollTo(0, scroll_pos); @*/ /// Check to see if we need to add more content. add_content_if_needed(additional); } else { /// Did the user scroll all the way to the very bottom? (If so, then there is no more content to be gotten.) if (scroll_maxed_bottom) { bottomLoader.style.visibility = "hidden"; return null; } /// Get more content. run_search(additional); } } }
if (scroll_maxed_bottom) {
if (has_reached_bottom) {
function add_content_bottom_if_needed() { var child = page.lastChild, newEl; if (child === null) { return null; } /// Is the user scrolling close to the bottom of the page? if (child.offsetTop + child.clientHeight < window.pageYOffset + doc_docEl.clientHeight + buffer_add) { /// Can the content be grabbed from cache? if (cached_count_bottom > 0) { newEl = document.createElement("div"); /// First subtract 1 from the outer counter variable to point to the last cached passage, and then retrieve the cached content. newEl.innerHTML = cached_verses_bottom[--cached_count_bottom]; ///NOTE: This is actually works like insertAfter() (if such a function existed). /// By using "null" as the second parameter, it tells it to add the element to the end. page.insertBefore(newEl, null); /// This fixes an IE7+ bug that causes the page to scroll needlessly when an element is added. /*@cc_on scrollViewTo(0, window.pageYOffset); @*/ /// Check to see if we need to add more content. add_content_if_needed(additional); } else { /// Did the user scroll all the way to the very bottom? (If so, then there is no more content to be gotten.) if (scroll_maxed_bottom) { bottomLoader.style.visibility = "hidden"; return null; } /// Get more content. run_search(additional); } } }
setTimeout(add_content_bottom_if_needed, lookup_speed_sitting);
window.setTimeout(add_content_bottom_if_needed, lookup_speed_sitting);
function add_content_if_needed(direction) { if (direction === additional) { setTimeout(add_content_bottom_if_needed, lookup_speed_sitting); } else { setTimeout(add_content_top_if_needed, lookup_speed_scrolling); } }
setTimeout(add_content_top_if_needed, lookup_speed_scrolling);
window.setTimeout(add_content_top_if_needed, lookup_speed_scrolling);
function add_content_if_needed(direction) { if (direction === additional) { setTimeout(add_content_bottom_if_needed, lookup_speed_sitting); } else { setTimeout(add_content_top_if_needed, lookup_speed_scrolling); } }
if (child == null) return null;
if (child === null) return null;
function add_content_top() { var child = page.firstChild, child_height, child_position, newEl; if (child == null) return null; child_height = child.clientHeight; child_position = child_height; /// Is the user scrolling close to the top of the page? if (child_position + buffer_add > scroll_pos) { /// Can the content be grabbed from cache? if (cached_count_top > 0) { newEl = doc.createElement("div"); /// First subtract 1 from the global counter variable to point to the last cached passage, and then retrieve the cached content. newEl.innerHTML = cached_verses_top[--cached_count_top]; page.insertBefore(newEl, child); /// The new content that was just added to the top of the page will push the other contents downward. /// Therefore, the page must be instantly scrolled down the same amount as the height of the content that was added. win.scrollTo(0, scroll_pos = (win.pageYOffset + newEl.clientHeight)); /// Check to see if we need to add more content. setTimeout(add_content_top, lookup_speed_scrolling); } else { /// Did the user scroll all the way to the very top? (If so, then there is no more content to be gotten.) if (scroll_maxed_top) { topLoader.style.visibility = "hidden"; return null; } /// Get more content. run_search(PREVIOUS); } } }
if (child.clientHeight + buffer_add > scroll_pos) {
if (child.clientHeight + buffer_add > window.pageYOffset) {
function add_content_top_if_needed() { var child = page.firstChild, newEl; if (child === null) { return null; } /// Is the user scrolling close to the top of the page? if (child.clientHeight + buffer_add > scroll_pos) { /// Can the content be grabbed from cache? if (cached_count_top > 0) { newEl = document.createElement("div"); /// First subtract 1 from the outer counter variable to point to the last cached passage, and then retrieve the cached content. newEl.innerHTML = cached_verses_top[--cached_count_top]; page.insertBefore(newEl, child); /// The new content that was just added to the top of the page will push the other contents downward. /// Therefore, the page must be instantly scrolled down the same amount as the height of the content that was added. scroll_pos = window.pageYOffset + newEl.clientHeight; window.scrollTo(0, scroll_pos); /// Check to see if we need to add more content. add_content_if_needed(previous); } else { /// Did the user scroll all the way to the very top? (If so, then there is no more content to be gotten.) if (scroll_maxed_top) { topLoader.style.visibility = "hidden"; return null; } /// Get more content. run_search(previous); } } }
scroll_pos = window.pageYOffset + newEl.clientHeight; window.scrollTo(0, scroll_pos);
scrollViewTo(0, window.pageYOffset + newEl.clientHeight);
function add_content_top_if_needed() { var child = page.firstChild, newEl; if (child === null) { return null; } /// Is the user scrolling close to the top of the page? if (child.clientHeight + buffer_add > scroll_pos) { /// Can the content be grabbed from cache? if (cached_count_top > 0) { newEl = document.createElement("div"); /// First subtract 1 from the outer counter variable to point to the last cached passage, and then retrieve the cached content. newEl.innerHTML = cached_verses_top[--cached_count_top]; page.insertBefore(newEl, child); /// The new content that was just added to the top of the page will push the other contents downward. /// Therefore, the page must be instantly scrolled down the same amount as the height of the content that was added. scroll_pos = window.pageYOffset + newEl.clientHeight; window.scrollTo(0, scroll_pos); /// Check to see if we need to add more content. add_content_if_needed(previous); } else { /// Did the user scroll all the way to the very top? (If so, then there is no more content to be gotten.) if (scroll_maxed_top) { topLoader.style.visibility = "hidden"; return null; } /// Get more content. run_search(previous); } } }
if (scroll_maxed_top) {
if (has_reached_top) {
function add_content_top_if_needed() { var child = page.firstChild, newEl; if (child === null) { return null; } /// Is the user scrolling close to the top of the page? if (child.clientHeight + buffer_add > window.pageYOffset) { /// Can the content be grabbed from cache? if (cached_count_top > 0) { newEl = document.createElement("div"); /// First subtract 1 from the outer counter variable to point to the last cached passage, and then retrieve the cached content. newEl.innerHTML = cached_verses_top[--cached_count_top]; page.insertBefore(newEl, child); /// The new content that was just added to the top of the page will push the other contents downward. /// Therefore, the page must be instantly scrolled down the same amount as the height of the content that was added. scrollViewTo(0, window.pageYOffset + newEl.clientHeight); /// Check to see if we need to add more content. add_content_if_needed(previous); } else { /// Did the user scroll all the way to the very top? (If so, then there is no more content to be gotten.) if (scroll_maxed_top) { topLoader.style.visibility = "hidden"; return null; } /// Get more content. run_search(previous); } } }
if(this.icon){var u=(this.iconOffset||0)*-16;m.push(' style="background-image:url(',a.getUrl(this.icon),');background-position:0 '+u+'px;"');}m.push('></span><span id="',o,'_label" class="cke_label">',this.label,'</span>');if(this.hasArrow)m.push('<span class="cke_buttonarrow">'+(b.hc?'&#9660;':'')+'</span>');m.push('</a>','</span>');if(this.onRender)this.onRender();return t;},setState:function(l){if(this._.state==l)return false;this._.state=l;var m=a.document.getById(this._.id);if(m){m.setState(l);l==0?m.setAttribute('aria-disabled',true):m.removeAttribute('aria-disabled');l==1?m.setAttribute('aria-pressed',true):m.removeAttribute('aria-pressed');return true;}else return false;}};k.button._={instances:[],keydown:function(l,m){var n=k.button._.instances[l];if(n.onkey){m=new d.event(m);return n.onkey(n,m.getKeystroke())!==false;}},focus:function(l,m){var n=k.button._.instances[l],o;if(n.onfocus)o=n.onfocus(n,new d.event(m))!==false;if(b.gecko&&b.version<10900)m.preventBubble();return o;}};k.prototype.addButton=function(l,m){this.add(l,1,m);};(function(){var l=function(r,s){var t=r.document,u=t.getBody(),v=false,w=function(){v=true;};u.on(s,w);(b.version>7?t.$:t.$.selection.createRange()).execCommand(s);u.removeListener(s,w);return v;},m=c?function(r,s){return l(r,s);}:function(r,s){try{return r.document.$.execCommand(s);}catch(t){return false;}},n=function(r){this.type=r;this.canUndo=this.type=='cut';};n.prototype={exec:function(r,s){var t=m(r,this.type);if(!t)alert(r.lang.clipboard[this.type+'Error']);return t;}};var o={canUndo:false,exec:c?function(r){r.focus();if(!r.document.getBody().fire('beforepaste')&&!l(r,'paste')){r.fire('pasteDialog');return false;}}:function(r){try{if(!r.document.getBody().fire('beforepaste')&&!r.document.$.execCommand('Paste',false,null))throw 0;}catch(s){setTimeout(function(){r.fire('pasteDialog');},0);return false;}}},p=function(r){if(this.mode!='wysiwyg')return;switch(r.data.keyCode){case 1000+86:case 2000+45:var s=this.document.getBody();if(!c&&s.fire('beforepaste'))r.cancel();else if(b.opera||b.gecko&&b.version<10900)s.fire('paste');return;case 1000+88:case 2000+46:var t=this;this.fire('saveSnapshot');setTimeout(function(){t.fire('saveSnapshot');},0);}};function q(r,s,t){var u=this.document;if(c&&u.getById('cke_pastebin'))return;if(s=='text'&&r.data&&r.data.$.clipboardData){var v=r.data.$.clipboardData.getData('text/plain');if(v){r.data.preventDefault();t(v);return;}}var w=this.getSelection(),x=new d.range(u),y=new h(s=='text'?'textarea':'div',u);
},this);else if(q){q=l.getCommand(q);if(q){q.on('state',function(){this.setState(q.state);},this);p+='cke_'+(q.state==1?'on':q.state==0?'disabled':'off');}}if(!q)p+='cke_off';if(this.className)p+=' '+this.className;m.push('<span class="cke_button">','<a id="',o,'" class="',p,'"',n.gecko&&n.version>=10900&&!n.hc?'':'" href="javascript:void(\''+(this.title||'').replace("'",'')+"')\"",' title="',this.title,'" tabindex="-1" hidefocus="true" role="button" aria-labelledby="'+o+'_label"'+(this.hasArrow?' aria-haspopup="true"':''));if(n.opera||n.gecko&&n.mac)m.push(' onkeypress="return false;"');if(n.gecko)m.push(' onblur="this.style.cssText = this.style.cssText;"');m.push(' onkeydown="return CKEDITOR.ui.button._.keydown(',s,', event);" onfocus="return CKEDITOR.ui.button._.focus(',s,', event);" onclick="CKEDITOR.tools.callFunction(',r,', this); return false;"><span class="cke_icon"');if(this.icon){var u=(this.iconOffset||0)*-16;m.push(' style="background-image:url(',a.getUrl(this.icon),');background-position:0 '+u+'px;"');}m.push('>&nbsp;</span><span id="',o,'_label" class="cke_label">',this.label,'</span>');if(this.hasArrow)m.push('<span class="cke_buttonarrow">'+(b.hc?'&#9660;':'&nbsp;')+'</span>');m.push('</a>','</span>');if(this.onRender)this.onRender();return t;},setState:function(l){if(this._.state==l)return false;this._.state=l;var m=a.document.getById(this._.id);if(m){m.setState(l);l==0?m.setAttribute('aria-disabled',true):m.removeAttribute('aria-disabled');l==1?m.setAttribute('aria-pressed',true):m.removeAttribute('aria-pressed');return true;}else return false;}};k.button._={instances:[],keydown:function(l,m){var n=k.button._.instances[l];if(n.onkey){m=new d.event(m);return n.onkey(n,m.getKeystroke())!==false;}},focus:function(l,m){var n=k.button._.instances[l],o;if(n.onfocus)o=n.onfocus(n,new d.event(m))!==false;if(b.gecko&&b.version<10900)m.preventBubble();return o;}};k.prototype.addButton=function(l,m){this.add(l,1,m);};a.on('reset',function(){k.button._.instances=[];});(function(){var l=function(s,t){var u=s.document,v=u.getBody(),w=false,x=function(){w=true;};v.on(t,x);(b.version>7?u.$:u.$.selection.createRange()).execCommand(t);v.removeListener(t,x);return w;},m=c?function(s,t){return l(s,t);}:function(s,t){try{return s.document.$.execCommand(t);}catch(u){return false;}},n=function(s){this.type=s;this.canUndo=this.type=='cut';};n.prototype={exec:function(s,t){this.type=='cut'&&r(s);var u=m(s,this.type);if(!u)alert(s.lang.clipboard[this.type+'Error']);
if(this.icon){var u=(this.iconOffset||0)*-16;m.push(' style="background-image:url(',a.getUrl(this.icon),');background-position:0 '+u+'px;"');}m.push('></span><span id="',o,'_label" class="cke_label">',this.label,'</span>');if(this.hasArrow)m.push('<span class="cke_buttonarrow">'+(b.hc?'&#9660;':'')+'</span>');m.push('</a>','</span>');if(this.onRender)this.onRender();return t;},setState:function(l){if(this._.state==l)return false;this._.state=l;var m=a.document.getById(this._.id);if(m){m.setState(l);l==0?m.setAttribute('aria-disabled',true):m.removeAttribute('aria-disabled');l==1?m.setAttribute('aria-pressed',true):m.removeAttribute('aria-pressed');return true;}else return false;}};k.button._={instances:[],keydown:function(l,m){var n=k.button._.instances[l];if(n.onkey){m=new d.event(m);return n.onkey(n,m.getKeystroke())!==false;}},focus:function(l,m){var n=k.button._.instances[l],o;if(n.onfocus)o=n.onfocus(n,new d.event(m))!==false;if(b.gecko&&b.version<10900)m.preventBubble();return o;}};k.prototype.addButton=function(l,m){this.add(l,1,m);};(function(){var l=function(r,s){var t=r.document,u=t.getBody(),v=false,w=function(){v=true;};u.on(s,w);(b.version>7?t.$:t.$.selection.createRange()).execCommand(s);u.removeListener(s,w);return v;},m=c?function(r,s){return l(r,s);}:function(r,s){try{return r.document.$.execCommand(s);}catch(t){return false;}},n=function(r){this.type=r;this.canUndo=this.type=='cut';};n.prototype={exec:function(r,s){var t=m(r,this.type);if(!t)alert(r.lang.clipboard[this.type+'Error']);return t;}};var o={canUndo:false,exec:c?function(r){r.focus();if(!r.document.getBody().fire('beforepaste')&&!l(r,'paste')){r.fire('pasteDialog');return false;}}:function(r){try{if(!r.document.getBody().fire('beforepaste')&&!r.document.$.execCommand('Paste',false,null))throw 0;}catch(s){setTimeout(function(){r.fire('pasteDialog');},0);return false;}}},p=function(r){if(this.mode!='wysiwyg')return;switch(r.data.keyCode){case 1000+86:case 2000+45:var s=this.document.getBody();if(!c&&s.fire('beforepaste'))r.cancel();else if(b.opera||b.gecko&&b.version<10900)s.fire('paste');return;case 1000+88:case 2000+46:var t=this;this.fire('saveSnapshot');setTimeout(function(){t.fire('saveSnapshot');},0);}};function q(r,s,t){var u=this.document;if(c&&u.getById('cke_pastebin'))return;if(s=='text'&&r.data&&r.data.$.clipboardData){var v=r.data.$.clipboardData.getData('text/plain');if(v){r.data.preventDefault();t(v);return;}}var w=this.getSelection(),x=new d.range(u),y=new h(s=='text'?'textarea':'div',u);
k.setHtml(i);return k.getFirst().remove();};h.setMarker=function(i,j,k,l){var m=j.getCustomData('list_marker_id')||j.setCustomData('list_marker_id',e.getNextNumber()).getCustomData('list_marker_id'),n=j.getCustomData('list_marker_names')||j.setCustomData('list_marker_names',{}).getCustomData('list_marker_names');i[m]=j;n[k]=1;return j.setCustomData(k,l);};h.clearAllMarkers=function(i){for(var j in i)h.clearMarkers(i,i[j],true);};h.clearMarkers=function(i,j,k){var l=j.getCustomData('list_marker_names'),m=j.getCustomData('list_marker_id');for(var n in l)j.removeCustomData(n);j.removeCustomData('list_marker_names');if(k){j.removeCustomData('list_marker_id');delete i[m];}};e.extend(h.prototype,{type:1,addClass:function(i){var j=this.$.className;if(j){var k=new RegExp('(?:^|\\s)'+i+'(?:\\s|$)','');if(!k.test(j))j+=' '+i;}this.$.className=j||i;},removeClass:function(i){var j=this.getAttribute('class');if(j){var k=new RegExp('(?:^|\\s+)'+i+'(?=\\s|$)','i');if(k.test(j)){j=j.replace(k,'').replace(/^\s+/,'');if(j)this.setAttribute('class',j);else this.removeAttribute('class');}}},hasClass:function(i){var j=new RegExp('(?:^|\\s+)'+i+'(?=\\s|$)','');return j.test(this.getAttribute('class'));},append:function(i,j){var k=this;if(typeof i=='string')i=k.getDocument().createElement(i);if(j)k.$.insertBefore(i.$,k.$.firstChild);else k.$.appendChild(i.$);return i;},appendHtml:function(i){var k=this;if(!k.$.childNodes.length)k.setHtml(i);else{var j=new h('div',k.getDocument());j.setHtml(i);j.moveChildren(k);}},appendText:function(i){if(this.$.text!=undefined)this.$.text+=i;else this.append(new d.text(i));},appendBogus:function(){var k=this;var i=k.getLast();while(i&&i.type==3&&!e.rtrim(i.getText()))i=i.getPrevious();if(!i||!i.is||!i.is('br')){var j=b.opera?k.getDocument().createText(''):k.getDocument().createElement('br');b.gecko&&j.setAttribute('type','_moz');k.append(j);}},breakParent:function(i){var l=this;var j=new d.range(l.getDocument());j.setStartAfter(l);j.setEndAfter(i);var k=j.extractContents();j.insertNode(l.remove());k.insertAfterNode(l);},contains:c||b.webkit?function(i){var j=this.$;return i.type!=1?j.contains(i.getParent().$):j!=i.$&&j.contains(i.$);}:function(i){return!!(this.$.compareDocumentPosition(i.$)&16);},focus:function(){try{this.$.focus();}catch(i){}},getHtml:function(){var i=this.$.innerHTML;return c?i.replace(/<\?[^>]*>/g,''):i;},getOuterHtml:function(){var j=this;if(j.$.outerHTML)return j.$.outerHTML.replace(/<\?[^>]*>/,'');var i=j.$.ownerDocument.createElement('div');
};d.nodeList.prototype={count:function(){return this.$.length;},getItem:function(h){var i=this.$[h];return i?new d.node(i):null;}};d.element=function(h,i){if(typeof h=='string')h=(i?i.$:document).createElement(h);d.domObject.call(this,h);};var h=d.element;h.get=function(i){return i&&(i.$?i:new h(i));};h.prototype=new d.node();h.createFromHtml=function(i,j){var k=new h('div',j);k.setHtml(i);return k.getFirst().remove();};h.setMarker=function(i,j,k,l){var m=j.getCustomData('list_marker_id')||j.setCustomData('list_marker_id',e.getNextNumber()).getCustomData('list_marker_id'),n=j.getCustomData('list_marker_names')||j.setCustomData('list_marker_names',{}).getCustomData('list_marker_names');i[m]=j;n[k]=1;return j.setCustomData(k,l);};h.clearAllMarkers=function(i){for(var j in i)h.clearMarkers(i,i[j],true);};h.clearMarkers=function(i,j,k){var l=j.getCustomData('list_marker_names'),m=j.getCustomData('list_marker_id');for(var n in l)j.removeCustomData(n);j.removeCustomData('list_marker_names');if(k){j.removeCustomData('list_marker_id');delete i[m];}};e.extend(h.prototype,{type:1,addClass:function(i){var j=this.$.className;if(j){var k=new RegExp('(?:^|\\s)'+i+'(?:\\s|$)','');if(!k.test(j))j+=' '+i;}this.$.className=j||i;},removeClass:function(i){var j=this.getAttribute('class');if(j){var k=new RegExp('(?:^|\\s+)'+i+'(?=\\s|$)','i');if(k.test(j)){j=j.replace(k,'').replace(/^\s+/,'');if(j)this.setAttribute('class',j);else this.removeAttribute('class');}}},hasClass:function(i){var j=new RegExp('(?:^|\\s+)'+i+'(?=\\s|$)','');return j.test(this.getAttribute('class'));},append:function(i,j){var k=this;if(typeof i=='string')i=k.getDocument().createElement(i);if(j)k.$.insertBefore(i.$,k.$.firstChild);else k.$.appendChild(i.$);return i;},appendHtml:function(i){var k=this;if(!k.$.childNodes.length)k.setHtml(i);else{var j=new h('div',k.getDocument());j.setHtml(i);j.moveChildren(k);}},appendText:function(i){if(this.$.text!=undefined)this.$.text+=i;else this.append(new d.text(i));},appendBogus:function(){var k=this;var i=k.getLast();while(i&&i.type==3&&!e.rtrim(i.getText()))i=i.getPrevious();if(!i||!i.is||!i.is('br')){var j=b.opera?k.getDocument().createText(''):k.getDocument().createElement('br');b.gecko&&j.setAttribute('type','_moz');k.append(j);}},breakParent:function(i){var l=this;var j=new d.range(l.getDocument());j.setStartAfter(l);j.setEndAfter(i);var k=j.extractContents();j.insertNode(l.remove());k.insertAfterNode(l);},contains:c||b.webkit?function(i){var j=this.$;return i.type!=1?j.contains(i.getParent().$):j!=i.$&&j.contains(i.$);
k.setHtml(i);return k.getFirst().remove();};h.setMarker=function(i,j,k,l){var m=j.getCustomData('list_marker_id')||j.setCustomData('list_marker_id',e.getNextNumber()).getCustomData('list_marker_id'),n=j.getCustomData('list_marker_names')||j.setCustomData('list_marker_names',{}).getCustomData('list_marker_names');i[m]=j;n[k]=1;return j.setCustomData(k,l);};h.clearAllMarkers=function(i){for(var j in i)h.clearMarkers(i,i[j],true);};h.clearMarkers=function(i,j,k){var l=j.getCustomData('list_marker_names'),m=j.getCustomData('list_marker_id');for(var n in l)j.removeCustomData(n);j.removeCustomData('list_marker_names');if(k){j.removeCustomData('list_marker_id');delete i[m];}};e.extend(h.prototype,{type:1,addClass:function(i){var j=this.$.className;if(j){var k=new RegExp('(?:^|\\s)'+i+'(?:\\s|$)','');if(!k.test(j))j+=' '+i;}this.$.className=j||i;},removeClass:function(i){var j=this.getAttribute('class');if(j){var k=new RegExp('(?:^|\\s+)'+i+'(?=\\s|$)','i');if(k.test(j)){j=j.replace(k,'').replace(/^\s+/,'');if(j)this.setAttribute('class',j);else this.removeAttribute('class');}}},hasClass:function(i){var j=new RegExp('(?:^|\\s+)'+i+'(?=\\s|$)','');return j.test(this.getAttribute('class'));},append:function(i,j){var k=this;if(typeof i=='string')i=k.getDocument().createElement(i);if(j)k.$.insertBefore(i.$,k.$.firstChild);else k.$.appendChild(i.$);return i;},appendHtml:function(i){var k=this;if(!k.$.childNodes.length)k.setHtml(i);else{var j=new h('div',k.getDocument());j.setHtml(i);j.moveChildren(k);}},appendText:function(i){if(this.$.text!=undefined)this.$.text+=i;else this.append(new d.text(i));},appendBogus:function(){var k=this;var i=k.getLast();while(i&&i.type==3&&!e.rtrim(i.getText()))i=i.getPrevious();if(!i||!i.is||!i.is('br')){var j=b.opera?k.getDocument().createText(''):k.getDocument().createElement('br');b.gecko&&j.setAttribute('type','_moz');k.append(j);}},breakParent:function(i){var l=this;var j=new d.range(l.getDocument());j.setStartAfter(l);j.setEndAfter(i);var k=j.extractContents();j.insertNode(l.remove());k.insertAfterNode(l);},contains:c||b.webkit?function(i){var j=this.$;return i.type!=1?j.contains(i.getParent().$):j!=i.$&&j.contains(i.$);}:function(i){return!!(this.$.compareDocumentPosition(i.$)&16);},focus:function(){try{this.$.focus();}catch(i){}},getHtml:function(){var i=this.$.innerHTML;return c?i.replace(/<\?[^>]*>/g,''):i;},getOuterHtml:function(){var j=this;if(j.$.outerHTML)return j.$.outerHTML.replace(/<\?[^>]*>/,'');var i=j.$.ownerDocument.createElement('div');
Ia=/^(a|area)$/i,ja=/radio|checkbox/;d.fn.extend({attr:function(a,b){return S(this,a,b,true,d.attr)},removeAttr:function(a){return this.each(function(){d.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(d.isFunction(a))return this.each(function(p){var o=d(this);o.addClass(a.call(this,p,o.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(W),e=0,g=this.length;e<g;e++){var h=this[e];if(h.nodeType===1)if(h.className)for(var k=" "+h.className+" ", l=0,q=b.length;l<q;l++){if(k.indexOf(" "+b[l]+" ")<0)h.className+=" "+b[l]}else h.className=a}return this},removeClass:function(a){if(d.isFunction(a))return this.each(function(p){var o=d(this);o.removeClass(a.call(this,p,o.attr("class")))});if(a&&typeof a==="string"||a===v)for(var b=(a||"").split(W),e=0,g=this.length;e<g;e++){var h=this[e];if(h.nodeType===1&&h.className)if(a){for(var k=(" "+h.className+" ").replace(ia," "),l=0,q=b.length;l<q;l++)k=k.replace(" "+b[l]+" "," ");h.className=k.substring(1,
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, p,o.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(W),e=0,f=this.length;e<f;e++){var h=this[e];if(h.nodeType===1)if(h.className)for(var k=" "+h.className+" ",l=0,q=b.length;l<q;l++){if(k.indexOf(" "+b[l]+" ")<0)h.className+=" "+b[l]}else h.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(p){var o=c(this);o.removeClass(a.call(this,p,o.attr("class")))});if(a&&typeof a==="string"||a===v)for(var b=(a||"").split(W),e=0,f=this.length;e<f;e++){var h=
Ia=/^(a|area)$/i,ja=/radio|checkbox/;d.fn.extend({attr:function(a,b){return S(this,a,b,true,d.attr)},removeAttr:function(a){return this.each(function(){d.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(d.isFunction(a))return this.each(function(p){var o=d(this);o.addClass(a.call(this,p,o.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(W),e=0,g=this.length;e<g;e++){var h=this[e];if(h.nodeType===1)if(h.className)for(var k=" "+h.className+" ",l=0,q=b.length;l<q;l++){if(k.indexOf(" "+b[l]+" ")<0)h.className+=" "+b[l]}else h.className=a}return this},removeClass:function(a){if(d.isFunction(a))return this.each(function(p){var o=d(this);o.removeClass(a.call(this,p,o.attr("class")))});if(a&&typeof a==="string"||a===v)for(var b=(a||"").split(W),e=0,g=this.length;e<g;e++){var h=this[e];if(h.nodeType===1&&h.className)if(a){for(var k=(" "+h.className+" ").replace(ia," "),l=0,q=b.length;l<q;l++)k=k.replace(" "+b[l]+" "," ");h.className=k.substring(1,
s(x);});},s=function(x){var y=x.config,z=y.plugins,A=y.extraPlugins,B=y.removePlugins;if(A){var C=new RegExp('(?:^|,)(?:'+A.replace(/\s*,\s*/g,'|')+')(?=,|$)','g');z=z.replace(C,'');z+=','+A;}if(B){C=new RegExp('(?:^|,)(?:'+B.replace(/\s*,\s*/g,'|')+')(?=,|$)','g');z=z.replace(C,'');}j.load(z.split(','),function(D){var E=[],F=[],G=[];x.plugins=D;for(var H in D){var I=D[H],J=I.lang,K=j.getPath(H),L=null;I.path=K;if(J){L=e.indexOf(J,x.langCode)>=0?x.langCode:J[0];if(!I.lang[L])G.push(a.getUrl(K+'lang/'+L+'.js'));else{e.extend(x.lang,I.lang[L]);L=null;}}F.push(L);E.push(I);}a.scriptLoader.load(G,function(){var M=['beforeInit','init','afterInit'];for(var N=0;N<M.length;N++)for(var O=0;O<E.length;O++){var P=E[O];if(N===0&&F[O]&&P.lang)e.extend(x.lang,P.lang[F[O]]);if(P[M[N]])P[M[N]](x);}x.fire('pluginsLoaded');u(x);});});},t=function(x){a.skins.load(x,'editor',function(){r(x);});},u=function(x){var y=x.config.theme;a.themes.load(y,function(){var z=x.theme=a.themes.get(y);z.path=a.themes.getPath(y);z.build(x);if(x.config.autoUpdateElement)v(x);});},v=function(x){var y=x.element;if(x.elementMode==1&&y.is('textarea')){var z=y.$.form&&new h(y.$.form);if(z){function A(){x.updateElement();};z.on('submit',A);if(!z.$.submit.nodeName)z.$.submit=e.override(z.$.submit,function(B){return function(){x.updateElement();if(B.apply)B.apply(this,arguments);else B();};});x.on('destroy',function(){z.removeListener('submit',A);});}}};function w(){var x,y=this._.commands,z=this.mode;for(var A in y){x=y[A];x[x.startDisabled?'disable':x.modes[z]?'enable':'disable']();}};a.editor.prototype._init=function(){var z=this;var x=h.get(z._.element),y=z._.instanceConfig;delete z._.element;delete z._.instanceConfig;z._.commands={};z._.styles=[];z.element=x;z.name=x&&z.elementMode==1&&(x.getId()||x.getNameAtt())||m();if(z.name in a.instances)throw '[CKEDITOR.editor] The instance "'+z.name+'" already exists.';z.config=e.prototypedCopy(i);z.ui=new k(z);z.focusManager=new a.focusManager(z);a.fire('instanceCreated',null,z);z.on('mode',w,null,null,1);p(z,y);};})();e.extend(a.editor.prototype,{addCommand:function(l,m){return this._.commands[l]=new a.command(this,m);},addCss:function(l){this._.styles.push(l);},destroy:function(l){var r=this;if(!l)r.updateElement();if(r.mode)r._.modes[r.mode].unload(r.getThemeSpace('contents'));r.theme.destroy(r);var m,n=0,o,p,q;if(r.toolbox){m=r.toolbox.toolbars;for(;n<m.length;n++){p=m[n].items;for(o=0;o<p.length;o++){q=p[o];if(q.clickFn)e.removeFunction(q.clickFn);if(q.keyDownFn)e.removeFunction(q.keyDownFn);
x.plugins=D;for(var H in D){var I=D[H],J=I.lang,K=j.getPath(H),L=null;I.path=K;if(J){L=e.indexOf(J,x.langCode)>=0?x.langCode:J[0];if(!I.lang[L])G.push(a.getUrl(K+'lang/'+L+'.js'));else{e.extend(x.lang,I.lang[L]);L=null;}}F.push(L);E.push(I);}a.scriptLoader.load(G,function(){var M=['beforeInit','init','afterInit'];for(var N=0;N<M.length;N++)for(var O=0;O<E.length;O++){var P=E[O];if(N===0&&F[O]&&P.lang)e.extend(x.lang,P.lang[F[O]]);if(P[M[N]])P[M[N]](x);}x.fire('pluginsLoaded');u(x);});});},t=function(x){a.skins.load(x,'editor',function(){r(x);});},u=function(x){var y=x.config.theme;a.themes.load(y,function(){var z=x.theme=a.themes.get(y);z.path=a.themes.getPath(y);z.build(x);if(x.config.autoUpdateElement)v(x);});},v=function(x){var y=x.element;if(x.elementMode==1&&y.is('textarea')){var z=y.$.form&&new h(y.$.form);if(z){function A(){x.updateElement();};z.on('submit',A);if(!z.$.submit.nodeName)z.$.submit=e.override(z.$.submit,function(B){return function(){x.updateElement();if(B.apply)B.apply(this,arguments);else B();};});x.on('destroy',function(){z.removeListener('submit',A);});}}};function w(){var x,y=this._.commands,z=this.mode;for(var A in y){x=y[A];x[x.startDisabled?'disable':x.modes[z]?'enable':'disable']();}};a.editor.prototype._init=function(){var z=this;var x=h.get(z._.element),y=z._.instanceConfig;delete z._.element;delete z._.instanceConfig;z._.commands={};z._.styles=[];z.element=x;z.name=x&&z.elementMode==1&&(x.getId()||x.getNameAtt())||m();if(z.name in a.instances)throw '[CKEDITOR.editor] The instance "'+z.name+'" already exists.';z.config=e.prototypedCopy(i);z.ui=new k(z);z.focusManager=new a.focusManager(z);a.fire('instanceCreated',null,z);z.on('mode',w,null,null,1);p(z,y);};})();e.extend(a.editor.prototype,{addCommand:function(l,m){return this._.commands[l]=new a.command(this,m);},addCss:function(l){this._.styles.push(l);},destroy:function(l){var r=this;if(!l)r.updateElement();if(r.mode)r._.modes[r.mode].unload(r.getThemeSpace('contents'));r.theme.destroy(r);var m,n=0,o,p,q;if(r.toolbox){m=r.toolbox.toolbars;for(;n<m.length;n++){p=m[n].items;for(o=0;o<p.length;o++){q=p[o];if(q.clickFn)e.removeFunction(q.clickFn);if(q.keyDownFn)e.removeFunction(q.keyDownFn);if(q.index)k.button._.instances[q.index]=null;}}}if(r.contextMenu)e.removeFunction(r.contextMenu._.functionId);if(r._.filebrowserFn)e.removeFunction(r._.filebrowserFn);r.fire('destroy');a.remove(r);a.fire('instanceDestroyed',null,r);},execCommand:function(l,m){var n=this.getCommand(l),o={name:l,commandData:m,command:n};
s(x);});},s=function(x){var y=x.config,z=y.plugins,A=y.extraPlugins,B=y.removePlugins;if(A){var C=new RegExp('(?:^|,)(?:'+A.replace(/\s*,\s*/g,'|')+')(?=,|$)','g');z=z.replace(C,'');z+=','+A;}if(B){C=new RegExp('(?:^|,)(?:'+B.replace(/\s*,\s*/g,'|')+')(?=,|$)','g');z=z.replace(C,'');}j.load(z.split(','),function(D){var E=[],F=[],G=[];x.plugins=D;for(var H in D){var I=D[H],J=I.lang,K=j.getPath(H),L=null;I.path=K;if(J){L=e.indexOf(J,x.langCode)>=0?x.langCode:J[0];if(!I.lang[L])G.push(a.getUrl(K+'lang/'+L+'.js'));else{e.extend(x.lang,I.lang[L]);L=null;}}F.push(L);E.push(I);}a.scriptLoader.load(G,function(){var M=['beforeInit','init','afterInit'];for(var N=0;N<M.length;N++)for(var O=0;O<E.length;O++){var P=E[O];if(N===0&&F[O]&&P.lang)e.extend(x.lang,P.lang[F[O]]);if(P[M[N]])P[M[N]](x);}x.fire('pluginsLoaded');u(x);});});},t=function(x){a.skins.load(x,'editor',function(){r(x);});},u=function(x){var y=x.config.theme;a.themes.load(y,function(){var z=x.theme=a.themes.get(y);z.path=a.themes.getPath(y);z.build(x);if(x.config.autoUpdateElement)v(x);});},v=function(x){var y=x.element;if(x.elementMode==1&&y.is('textarea')){var z=y.$.form&&new h(y.$.form);if(z){function A(){x.updateElement();};z.on('submit',A);if(!z.$.submit.nodeName)z.$.submit=e.override(z.$.submit,function(B){return function(){x.updateElement();if(B.apply)B.apply(this,arguments);else B();};});x.on('destroy',function(){z.removeListener('submit',A);});}}};function w(){var x,y=this._.commands,z=this.mode;for(var A in y){x=y[A];x[x.startDisabled?'disable':x.modes[z]?'enable':'disable']();}};a.editor.prototype._init=function(){var z=this;var x=h.get(z._.element),y=z._.instanceConfig;delete z._.element;delete z._.instanceConfig;z._.commands={};z._.styles=[];z.element=x;z.name=x&&z.elementMode==1&&(x.getId()||x.getNameAtt())||m();if(z.name in a.instances)throw '[CKEDITOR.editor] The instance "'+z.name+'" already exists.';z.config=e.prototypedCopy(i);z.ui=new k(z);z.focusManager=new a.focusManager(z);a.fire('instanceCreated',null,z);z.on('mode',w,null,null,1);p(z,y);};})();e.extend(a.editor.prototype,{addCommand:function(l,m){return this._.commands[l]=new a.command(this,m);},addCss:function(l){this._.styles.push(l);},destroy:function(l){var r=this;if(!l)r.updateElement();if(r.mode)r._.modes[r.mode].unload(r.getThemeSpace('contents'));r.theme.destroy(r);var m,n=0,o,p,q;if(r.toolbox){m=r.toolbox.toolbars;for(;n<m.length;n++){p=m[n].items;for(o=0;o<p.length;o++){q=p[o];if(q.clickFn)e.removeFunction(q.clickFn);if(q.keyDownFn)e.removeFunction(q.keyDownFn);
function(a,b){if(document.getElementsByClassName)return b.getElementsByClassName(a);else{b=b.getElementsByTagName("*");for(var f=[],l,n=0,o=b.length;n<o;n++){l=b[n];l.className.indexOf(a)!=-1&&f.push(l)}return f}};this.addCss=function(a,b){var f=document.styleSheets[0];f.insertRule(a+" { "+b+" }",f.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css");if(!b){b=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(b)}if(b.styleSheet){var f=
""}}};this.checkReleaseCapture=function(a,b){z&&a==z&&b.type=="mouseup"&&this.capture(null)};this.getElementsByClassName=function(a,b){if(document.getElementsByClassName)return b.getElementsByClassName(a);else{b=b.getElementsByTagName("*");for(var f=[],l,n=0,o=b.length;n<o;n++){l=b[n];l.className.indexOf(a)!=-1&&f.push(l)}return f}};this.addCss=function(a,b){var f=document.styleSheets[0];f.insertRule(a+" { "+b+" }",f.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css");
function(a,b){if(document.getElementsByClassName)return b.getElementsByClassName(a);else{b=b.getElementsByTagName("*");for(var f=[],l,n=0,o=b.length;n<o;n++){l=b[n];l.className.indexOf(a)!=-1&&f.push(l)}return f}};this.addCss=function(a,b){var f=document.styleSheets[0];f.insertRule(a+" { "+b+" }",f.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css");if(!b){b=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(b)}if(b.styleSheet){var f=
b){if(document.getElementsByClassName)return b.getElementsByClassName(a);else{b=b.getElementsByTagName("*");for(var f=[],l,n=0,o=b.length;n<o;n++){l=b[n];l.className.indexOf(a)!=-1&&f.push(l)}return f}};this.addCss=function(a,b){var f=document.styleSheets[0];f.insertRule(a+" { "+b+" }",f.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css");if(!b){b=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(b)}if(b.styleSheet){var f=
function(a,b){if(document.getElementsByClassName)return b.getElementsByClassName(a);else{b=b.getElementsByTagName("*");for(var f=[],l,n=0,o=b.length;n<o;n++){l=b[n];l.className.indexOf(a)!=-1&&f.push(l)}return f}};this.addCss=function(a,b){var f=document.styleSheets[0];f.insertRule(a+" { "+b+" }",f.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css");if(!b){b=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(b)}if(b.styleSheet){var f=
b){if(document.getElementsByClassName)return b.getElementsByClassName(a);else{b=b.getElementsByTagName("*");for(var f=[],l,n=0,o=b.length;n<o;n++){l=b[n];l.className.indexOf(a)!=-1&&f.push(l)}return f}};this.addCss=function(a,b){var f=document.styleSheets[0];f.insertRule(a+" { "+b+" }",f.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css");if(!b){b=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(b)}if(b.styleSheet){var f=
for(var e=[],k,i=0,n=b.length;i<n;i++){k=b[i];k.className.indexOf(a)!=-1&&e.push(k)}return e}};this.addCss=function(a,b){var e=document.styleSheets[0];e.insertRule(a+" { "+b+" }",e.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css");if(!b){b=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(b)}if(b.styleSheet){var e=document.createElement("style");if(b)b.parentNode.insertBefore(e,b);else{e.id="Wt-inline-css";document.getElementsByTagName("head")[0].appendChild(e)}e.styleSheet.cssText=
for(var e=[],j,i=0,n=b.length;i<n;i++){j=b[i];j.className.indexOf(a)!=-1&&e.push(j)}return e}};this.addCss=function(a,b){var e=document.styleSheets[0];e.insertRule(a+" { "+b+" }",e.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css");if(!b){b=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(b)}if(b.styleSheet){var e=document.createElement("style");if(b)b.parentNode.insertBefore(e,b);else{e.id="Wt-inline-css";document.getElementsByTagName("head")[0].appendChild(e)}e.styleSheet.cssText=
for(var e=[],k,i=0,n=b.length;i<n;i++){k=b[i];k.className.indexOf(a)!=-1&&e.push(k)}return e}};this.addCss=function(a,b){var e=document.styleSheets[0];e.insertRule(a+" { "+b+" }",e.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css");if(!b){b=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(b)}if(b.styleSheet){var e=document.createElement("style");if(b)b.parentNode.insertBefore(e,b);else{e.id="Wt-inline-css";document.getElementsByTagName("head")[0].appendChild(e)}e.styleSheet.cssText=
else{b=b.getElementsByTagName("*");for(var f=[],h,k=0,o=b.length;k<o;k++){h=b[k];h.className.indexOf(a)!=-1&&f.push(h)}return f}};this.addCss=function(a,b){var f=document.styleSheets[0];f.insertRule(a+" { "+b+" }",f.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css");if(!b){b=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(b)}if(b.styleSheet){var f=document.createElement("style");if(b)b.parentNode.insertBefore(f,b);else{f.id=
"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);else{b=b.getElementsByTagName("*");for(var f=[],h,k=0,o=b.length;k<o;k++){h=b[k];h.className.indexOf(a)!=-1&&f.push(h)}return f}};this.addCss=function(a,b){var f=document.styleSheets[0];f.insertRule(a+" { "+b+" }",f.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css");
else{b=b.getElementsByTagName("*");for(var f=[],h,k=0,o=b.length;k<o;k++){h=b[k];h.className.indexOf(a)!=-1&&f.push(h)}return f}};this.addCss=function(a,b){var f=document.styleSheets[0];f.insertRule(a+" { "+b+" }",f.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css");if(!b){b=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(b)}if(b.styleSheet){var f=document.createElement("style");if(b)b.parentNode.insertBefore(f,b);else{f.id=
"off");b.onselectstart=""}};this.checkReleaseCapture=function(a,b){G&&a==G&&b.type=="mouseup"&&this.capture(null)};this.getElementsByClassName=function(a,b){if(document.getElementsByClassName)return b.getElementsByClassName(a);else{b=b.getElementsByTagName("*");for(var f=[],m,l=0,o=b.length;l<o;l++){m=b[l];m.className.indexOf(a)!=-1&&f.push(m)}return f}};this.addCss=function(a,b){var f=document.styleSheets[0];f.insertRule(a+" { "+b+" }",f.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css");
this.capture(null)};this.getElementsByClassName=function(a,b){if(document.getElementsByClassName)return b.getElementsByClassName(a);else{b=b.getElementsByTagName("*");for(var f=[],m,l=0,n=b.length;l<n;l++){m=b[l];m.className.indexOf(a)!=-1&&f.push(m)}return f}};this.addCss=function(a,b){var f=document.styleSheets[0];f.insertRule(a+" { "+b+" }",f.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css");if(!b){b=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(b)}if(b.styleSheet){var f=
"off");b.onselectstart=""}};this.checkReleaseCapture=function(a,b){G&&a==G&&b.type=="mouseup"&&this.capture(null)};this.getElementsByClassName=function(a,b){if(document.getElementsByClassName)return b.getElementsByClassName(a);else{b=b.getElementsByTagName("*");for(var f=[],m,l=0,o=b.length;l<o;l++){m=b[l];m.className.indexOf(a)!=-1&&f.push(m)}return f}};this.addCss=function(a,b){var f=document.styleSheets[0];f.insertRule(a+" { "+b+" }",f.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css");
function(a,b){if(document.getElementsByClassName)return b.getElementsByClassName(a);else{b=b.getElementsByTagName("*");for(var f=[],l,n=0,o=b.length;n<o;n++){l=b[n];l.className.indexOf(a)!=-1&&f.push(l)}return f}};this.addCss=function(a,b){var f=document.styleSheets[0];f.insertRule(a+" { "+b+" }",f.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css");if(!b){b=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(b)}if(b.styleSheet){var f= document.createElement("style");if(b)b.parentNode.insertBefore(f,b);else{f.id="Wt-inline-css";document.getElementsByTagName("head")[0].appendChild(f)}f.styleSheet.cssText=a}else{a=document.createTextNode(a);b.appendChild(a)}};this.getCssRule=function(a,b){a=a.toLowerCase();if(document.styleSheets)for(var f=0;f<document.styleSheets.length;f++){var l=document.styleSheets[f],n=0,o;do{o=null;if(l.cssRules)o=l.cssRules[n];else if(l.rules)o=l.rules[n];if(o&&o.selectorText)if(o.selectorText.toLowerCase()==
""}}};this.checkReleaseCapture=function(a,b){z&&a==z&&b.type=="mouseup"&&this.capture(null)};this.getElementsByClassName=function(a,b){if(document.getElementsByClassName)return b.getElementsByClassName(a);else{b=b.getElementsByTagName("*");for(var f=[],l,n=0,o=b.length;n<o;n++){l=b[n];l.className.indexOf(a)!=-1&&f.push(l)}return f}};this.addCss=function(a,b){var f=document.styleSheets[0];f.insertRule(a+" { "+b+" }",f.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css"); if(!b){b=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(b)}if(b.styleSheet){var f=document.createElement("style");if(b)b.parentNode.insertBefore(f,b);else{f.id="Wt-inline-css";document.getElementsByTagName("head")[0].appendChild(f)}f.styleSheet.cssText=a}else{a=document.createTextNode(a);b.appendChild(a)}};this.getCssRule=function(a,b){a=a.toLowerCase();if(document.styleSheets)for(var f=0;f<document.styleSheets.length;f++){var l=document.styleSheets[f],n=0,o;
function(a,b){if(document.getElementsByClassName)return b.getElementsByClassName(a);else{b=b.getElementsByTagName("*");for(var f=[],l,n=0,o=b.length;n<o;n++){l=b[n];l.className.indexOf(a)!=-1&&f.push(l)}return f}};this.addCss=function(a,b){var f=document.styleSheets[0];f.insertRule(a+" { "+b+" }",f.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css");if(!b){b=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(b)}if(b.styleSheet){var f=document.createElement("style");if(b)b.parentNode.insertBefore(f,b);else{f.id="Wt-inline-css";document.getElementsByTagName("head")[0].appendChild(f)}f.styleSheet.cssText=a}else{a=document.createTextNode(a);b.appendChild(a)}};this.getCssRule=function(a,b){a=a.toLowerCase();if(document.styleSheets)for(var f=0;f<document.styleSheets.length;f++){var l=document.styleSheets[f],n=0,o;do{o=null;if(l.cssRules)o=l.cssRules[n];else if(l.rules)o=l.rules[n];if(o&&o.selectorText)if(o.selectorText.toLowerCase()==
b){if(document.getElementsByClassName)return b.getElementsByClassName(a);else{b=b.getElementsByTagName("*");for(var f=[],l,n=0,o=b.length;n<o;n++){l=b[n];l.className.indexOf(a)!=-1&&f.push(l)}return f}};this.addCss=function(a,b){var f=document.styleSheets[0];f.insertRule(a+" { "+b+" }",f.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css");if(!b){b=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(b)}if(b.styleSheet){var f=
function(a,b){if(document.getElementsByClassName)return b.getElementsByClassName(a);else{b=b.getElementsByTagName("*");for(var f=[],l,n=0,o=b.length;n<o;n++){l=b[n];l.className.indexOf(a)!=-1&&f.push(l)}return f}};this.addCss=function(a,b){var f=document.styleSheets[0];f.insertRule(a+" { "+b+" }",f.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css");if(!b){b=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(b)}if(b.styleSheet){var f=
b){if(document.getElementsByClassName)return b.getElementsByClassName(a);else{b=b.getElementsByTagName("*");for(var f=[],l,n=0,o=b.length;n<o;n++){l=b[n];l.className.indexOf(a)!=-1&&f.push(l)}return f}};this.addCss=function(a,b){var f=document.styleSheets[0];f.insertRule(a+" { "+b+" }",f.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css");if(!b){b=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(b)}if(b.styleSheet){var f=document.createElement("style");if(b)b.parentNode.insertBefore(f,b);else{f.id="Wt-inline-css";document.getElementsByTagName("head")[0].appendChild(f)}f.styleSheet.cssText=a}else{a=document.createTextNode(a);b.appendChild(a)}};this.getCssRule=function(a,b){a=a.toLowerCase();if(document.styleSheets)for(var f=0;f<document.styleSheets.length;f++){var l=document.styleSheets[f],n=0,o;do{o=null;if(l.cssRules)o=l.cssRules[n];else if(l.rules)o=l.rules[n];if(o&&o.selectorText)if(o.selectorText.toLowerCase()==
for(var e=[],k,i=0,n=b.length;i<n;i++){k=b[i];k.className.indexOf(a)!=-1&&e.push(k)}return e}};this.addCss=function(a,b){var e=document.styleSheets[0];e.insertRule(a+" { "+b+" }",e.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css");if(!b){b=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(b)}if(b.styleSheet){var e=document.createElement("style");if(b)b.parentNode.insertBefore(e,b);else{e.id="Wt-inline-css";document.getElementsByTagName("head")[0].appendChild(e)}e.styleSheet.cssText= a}else{a=document.createTextNode(a);b.appendChild(a)}};this.getCssRule=function(a,b){a=a.toLowerCase();if(document.styleSheets)for(var e=0;e<document.styleSheets.length;e++){var k=document.styleSheets[e],i=0,n=false;do{if((n=k.cssRules?k.cssRules[i]:k.rules[i])&&n.selectorText)if(n.selectorText.toLowerCase()==a)if(b=="delete"){k.cssRules?k.deleteRule(i):k.removeRule(i);return true}else return n;++i}while(n)}return false};this.removeCssRule=function(a){return h.getCssRule(a,"delete")};this.addStyleSheet=
for(var e=[],j,i=0,n=b.length;i<n;i++){j=b[i];j.className.indexOf(a)!=-1&&e.push(j)}return e}};this.addCss=function(a,b){var e=document.styleSheets[0];e.insertRule(a+" { "+b+" }",e.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css");if(!b){b=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(b)}if(b.styleSheet){var e=document.createElement("style");if(b)b.parentNode.insertBefore(e,b);else{e.id="Wt-inline-css";document.getElementsByTagName("head")[0].appendChild(e)}e.styleSheet.cssText= a}else{a=document.createTextNode(a);b.appendChild(a)}};this.getCssRule=function(a,b){a=a.toLowerCase();if(document.styleSheets)for(var e=0;e<document.styleSheets.length;e++){var j=document.styleSheets[e],i=0,n;do{n=null;if(j.cssRules)n=j.cssRules[i];else if(j.rules)n=j.rules[i];if(n&&n.selectorText)if(n.selectorText.toLowerCase()==a)if(b=="delete"){j.cssRules?j.deleteRule(i):j.removeRule(i);return true}else return n;++i}while(n)}return false};this.removeCssRule=function(a){return g.getCssRule(a,"delete")};
for(var e=[],k,i=0,n=b.length;i<n;i++){k=b[i];k.className.indexOf(a)!=-1&&e.push(k)}return e}};this.addCss=function(a,b){var e=document.styleSheets[0];e.insertRule(a+" { "+b+" }",e.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css");if(!b){b=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(b)}if(b.styleSheet){var e=document.createElement("style");if(b)b.parentNode.insertBefore(e,b);else{e.id="Wt-inline-css";document.getElementsByTagName("head")[0].appendChild(e)}e.styleSheet.cssText=a}else{a=document.createTextNode(a);b.appendChild(a)}};this.getCssRule=function(a,b){a=a.toLowerCase();if(document.styleSheets)for(var e=0;e<document.styleSheets.length;e++){var k=document.styleSheets[e],i=0,n=false;do{if((n=k.cssRules?k.cssRules[i]:k.rules[i])&&n.selectorText)if(n.selectorText.toLowerCase()==a)if(b=="delete"){k.cssRules?k.deleteRule(i):k.removeRule(i);return true}else return n;++i}while(n)}return false};this.removeCssRule=function(a){return h.getCssRule(a,"delete")};this.addStyleSheet=
else{b=b.getElementsByTagName("*");for(var f=[],h,k=0,o=b.length;k<o;k++){h=b[k];h.className.indexOf(a)!=-1&&f.push(h)}return f}};this.addCss=function(a,b){var f=document.styleSheets[0];f.insertRule(a+" { "+b+" }",f.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css");if(!b){b=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(b)}if(b.styleSheet){var f=document.createElement("style");if(b)b.parentNode.insertBefore(f,b);else{f.id= "Wt-inline-css";document.getElementsByTagName("head")[0].appendChild(f)}f.styleSheet.cssText=a}else{a=document.createTextNode(a);b.appendChild(a)}};this.getCssRule=function(a,b){a=a.toLowerCase();if(document.styleSheets)for(var f=0;f<document.styleSheets.length;f++){var h=document.styleSheets[f],k=0,o;do{o=null;if(h.cssRules)o=h.cssRules[k];else if(h.rules)o=h.rules[k];if(o&&o.selectorText)if(o.selectorText.toLowerCase()==a)if(b=="delete"){h.cssRules?h.deleteRule(k):h.removeRule(k);return true}else return o;
"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);else{b=b.getElementsByTagName("*");for(var f=[],h,k=0,o=b.length;k<o;k++){h=b[k];h.className.indexOf(a)!=-1&&f.push(h)}return f}};this.addCss=function(a,b){var f=document.styleSheets[0];f.insertRule(a+" { "+b+" }",f.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css"); if(!b){b=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(b)}if(b.styleSheet){var f=document.createElement("style");if(b)b.parentNode.insertBefore(f,b);else{f.id="Wt-inline-css";document.getElementsByTagName("head")[0].appendChild(f)}f.styleSheet.cssText=a}else{a=document.createTextNode(a);b.appendChild(a)}};this.getCssRule=function(a,b){a=a.toLowerCase();if(document.styleSheets)for(var f=0;f<document.styleSheets.length;f++){var h=document.styleSheets[f],k=0,o;
else{b=b.getElementsByTagName("*");for(var f=[],h,k=0,o=b.length;k<o;k++){h=b[k];h.className.indexOf(a)!=-1&&f.push(h)}return f}};this.addCss=function(a,b){var f=document.styleSheets[0];f.insertRule(a+" { "+b+" }",f.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css");if(!b){b=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(b)}if(b.styleSheet){var f=document.createElement("style");if(b)b.parentNode.insertBefore(f,b);else{f.id="Wt-inline-css";document.getElementsByTagName("head")[0].appendChild(f)}f.styleSheet.cssText=a}else{a=document.createTextNode(a);b.appendChild(a)}};this.getCssRule=function(a,b){a=a.toLowerCase();if(document.styleSheets)for(var f=0;f<document.styleSheets.length;f++){var h=document.styleSheets[f],k=0,o;do{o=null;if(h.cssRules)o=h.cssRules[k];else if(h.rules)o=h.rules[k];if(o&&o.selectorText)if(o.selectorText.toLowerCase()==a)if(b=="delete"){h.cssRules?h.deleteRule(k):h.removeRule(k);return true}else return o;
"off");b.onselectstart=""}};this.checkReleaseCapture=function(a,b){G&&a==G&&b.type=="mouseup"&&this.capture(null)};this.getElementsByClassName=function(a,b){if(document.getElementsByClassName)return b.getElementsByClassName(a);else{b=b.getElementsByTagName("*");for(var f=[],m,l=0,o=b.length;l<o;l++){m=b[l];m.className.indexOf(a)!=-1&&f.push(m)}return f}};this.addCss=function(a,b){var f=document.styleSheets[0];f.insertRule(a+" { "+b+" }",f.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css"); if(!b){b=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(b)}if(b.styleSheet){var f=document.createElement("style");if(b)b.parentNode.insertBefore(f,b);else{f.id="Wt-inline-css";document.getElementsByTagName("head")[0].appendChild(f)}f.styleSheet.cssText=a}else{a=document.createTextNode(a);b.appendChild(a)}};this.getCssRule=function(a,b){a=a.toLowerCase();if(document.styleSheets)for(var f=0;f<document.styleSheets.length;f++){var m=document.styleSheets[f],l=0,o=
this.capture(null)};this.getElementsByClassName=function(a,b){if(document.getElementsByClassName)return b.getElementsByClassName(a);else{b=b.getElementsByTagName("*");for(var f=[],m,l=0,n=b.length;l<n;l++){m=b[l];m.className.indexOf(a)!=-1&&f.push(m)}return f}};this.addCss=function(a,b){var f=document.styleSheets[0];f.insertRule(a+" { "+b+" }",f.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css");if(!b){b=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(b)}if(b.styleSheet){var f= document.createElement("style");if(b)b.parentNode.insertBefore(f,b);else{f.id="Wt-inline-css";document.getElementsByTagName("head")[0].appendChild(f)}f.styleSheet.cssText=a}else{a=document.createTextNode(a);b.appendChild(a)}};this.getCssRule=function(a,b){a=a.toLowerCase();if(document.styleSheets)for(var f=0;f<document.styleSheets.length;f++){var m=document.styleSheets[f],l=0,n=false;do{if((n=m.cssRules?m.cssRules[l]:m.rules[l])&&n.selectorText)if(n.selectorText.toLowerCase()==a)if(b=="delete"){m.cssRules?
"off");b.onselectstart=""}};this.checkReleaseCapture=function(a,b){G&&a==G&&b.type=="mouseup"&&this.capture(null)};this.getElementsByClassName=function(a,b){if(document.getElementsByClassName)return b.getElementsByClassName(a);else{b=b.getElementsByTagName("*");for(var f=[],m,l=0,o=b.length;l<o;l++){m=b[l];m.className.indexOf(a)!=-1&&f.push(m)}return f}};this.addCss=function(a,b){var f=document.styleSheets[0];f.insertRule(a+" { "+b+" }",f.cssRules.length)};this.addCssText=function(a){var b=document.getElementById("Wt-inline-css");if(!b){b=document.createElement("style");document.getElementsByTagName("head")[0].appendChild(b)}if(b.styleSheet){var f=document.createElement("style");if(b)b.parentNode.insertBefore(f,b);else{f.id="Wt-inline-css";document.getElementsByTagName("head")[0].appendChild(f)}f.styleSheet.cssText=a}else{a=document.createTextNode(a);b.appendChild(a)}};this.getCssRule=function(a,b){a=a.toLowerCase();if(document.styleSheets)for(var f=0;f<document.styleSheets.length;f++){var m=document.styleSheets[f],l=0,o=
if (continueBar) staff.bar = 'end';
if (continueBar) staff.connectBarLines = 'end';
this.addDirective = function(str) { var oneParameterMeasurement = function(cmd, tokens) { var points = tokenizer.getMeasurement(tokens); if (points.used === 0 || tokens.length !== 0) return "Directive \"" + cmd + "\" requires a measurement as a parameter."; tune.formatting[cmd] = points.value; return null; }; var getFontParameter = function(tokens) { var font = {}; var token = tokens.last(); if (token.type === 'number') { font.size = parseInt(token.token); tokens.pop(); } if (tokens.length > 0) { var scratch = ""; tokens.each(function(tok) { if (tok.token !== '-') { if (scratch.length > 0) scratch += ' '; scratch += tok.token; } }); font.font = scratch; } return font; }; var getChangingFont = function(cmd, tokens) { if (tokens.length === 0) return "Directive \"" + cmd + "\" requires a font as a parameter."; multilineVars[cmd] = getFontParameter(tokens); return null; }; var getGlobalFont = function(cmd, tokens) { if (tokens.length === 0) return "Directive \"" + cmd + "\" requires a font as a parameter."; tune.formatting[cmd] = getFontParameter(tokens); return null; }; var tokens = tokenizer.tokenize(str, 0, str.length); // 3 or more % in a row, or just spaces after %% is just a comment if (tokens.length === 0 || tokens[0].type !== 'alpha') return null; var restOfString = str.substring(str.indexOf(tokens[0].token)+tokens[0].token.length); restOfString = tokenizer.stripComment(restOfString); var cmd = tokens.shift().token.toLowerCase(); var num; var scratch = ""; switch (cmd) { case "bagpipes":tune.formatting.bagpipes = true;break; case "landscape":tune.formatting.landscape = true;break; case "slurgraces":tune.formatting.slurgraces = true;break; case "stretchlast":tune.formatting.stretchlast = true;break; case "titlecaps": multilineVars.titlecaps = true;break; case "titleleft":tune.formatting.titleleft = true;break; case "botmargin": case "botspace": case "composerspace": case "indent": case "leftmargin": case "linesep": case "musicspace": case "partsspace": case "staffsep": case "staffwidth": case "subtitlespace": case "sysstaffsep": case "systemsep": case "textspace": case "titlespace": case "topmargin": case "topspace": case "vocalspace": case "wordsspace": return oneParameterMeasurement(cmd, tokens); break; case "scale": scratch = ""; tokens.each(function(tok) { scratch += tok.token; }); num = parseFloat(scratch); if (isNaN(num) || num === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.scale = num; break; case "sep": if (tokens.length === 0) tune.addSeparator(); else { if (tokens.length !== 3 || tokens[0].type !== 'number' || tokens[1].type !== 'number' || tokens[2].type !== 'number') return "Directive \"" + cmd + "\" requires 3 numbers: space above, space below, length of line"; tune.addSeparator(parseInt(tokens[0].token), parseInt(tokens[1].token), parseInt(tokens[2].token)); } break; case "barnumbers": if (tokens.length !== 1 || tokens[0].type !== 'number') return "Directive \"" + cmd + "\" requires a number as a parameter."; multilineVars.barNumbers = parseInt(tokens[0].token); break; case "begintext": multilineVars.inTextBlock = true; break; case "text": tune.addText(tokenizer.translateString(restOfString)); // display secondary title break; case "gchordfont": case "partsfont": case "vocalfont": return getChangingFont(cmd, tokens); break; case "barlabelfont": case "barnumberfont": case "composerfont": case "subtitlefont": case "tempofont": case "titlefont": case "voicefont": return getGlobalFont(cmd, tokens); break; case "barnumfont": return getGlobalFont("barnumberfont", tokens); break; case "score": multilineVars.score_is_present = true; var addVoice = function(id, newStaff, bracket, brace, continueBar) { if (newStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length, numVoices: 0 }); } var staff = multilineVars.staves.last(); if (bracket !== undefined) staff.bracket = bracket; if (brace !== undefined) staff.brace = brace; if (continueBar) staff.bar = 'end'; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = { staffNum: staff.index, index: staff.numVoices}; staff.numVoices++; } }; var openParen = false; var openBracket = false; var openBrace = false; var justOpenParen = false; var justOpenBracket = false; var justOpenBrace = false; var continueBar = false; var lastVoice = undefined; while (tokens.length) { var t = tokens.shift(); switch (t.token) { case '(': if (openParen) warn("Can't nest parenthesis in %%score", str, t.start); else { openParen = true; justOpenParen = true; } break; case ')': if (!openParen || justOpenParen) warn("Unexpected close parenthesis in %%score", str, t.start); else openParen = false; break; case '[': if (openBracket) warn("Can't nest brackets in %%score", str, t.start); else { openBracket = true; justOpenBracket = true; } break; case ']': if (!openBracket || justOpenBracket) warn("Unexpected close bracket in %%score", str, t.start); else { openBracket = false; multilineVars.staves[lastVoice.staffNum].bracket = 'end'; } break; case '{': if (openBrace ) warn("Can't nest braces in %%score", str, t.start); else { openBrace = true; justOpenBrace = true; } break; case '}': if (!openBrace || justOpenBrace) warn("Unexpected close brace in %%score", str, t.start); else { openBrace = false; multilineVars.staves[lastVoice.staffNum].brace = 'end'; } break; case '|': continueBar = true; if (lastVoice) multilineVars.staves[lastVoice.staffNum].bar = 'start'; break; default: var vc = ""; while (t.type === 'alpha' || t.type === 'number') { vc += t.token; if (t.continueId) t = tokens.shift(); else break; } var newStaff = !openParen || justOpenParen; var bracket = justOpenBracket ? 'start' : openBracket ? 'continue' : undefined; var brace = justOpenBrace ? 'start' : openBrace ? 'continue' : undefined; addVoice(vc, newStaff, bracket, brace, continueBar); justOpenParen = false; justOpenBracket = false; justOpenBrace = false; continueBar = false; lastVoice = multilineVars.voices[vc]; break; } } break; case "midi": case "indent": case "playtempo": case "auquality": case "continuous": case "nobarcheck": case "staves": // TODO-PER: Actually handle the parameters of these tune.formatting[cmd] = restOfString; break; default: return "Unknown directive: " + cmd; } return null; };
if (lastVoice) multilineVars.staves[lastVoice.staffNum].bar = 'start';
if (lastVoice) { var ty = 'start'; if (lastVoice.staffNum > 0) { if (multilineVars.staves[lastVoice.staffNum-1].connectBarLines === 'start' || multilineVars.staves[lastVoice.staffNum-1].connectBarLines === 'continue') ty = 'continue'; } multilineVars.staves[lastVoice.staffNum].connectBarLines = ty; }
this.addDirective = function(str) { var oneParameterMeasurement = function(cmd, tokens) { var points = tokenizer.getMeasurement(tokens); if (points.used === 0 || tokens.length !== 0) return "Directive \"" + cmd + "\" requires a measurement as a parameter."; tune.formatting[cmd] = points.value; return null; }; var getFontParameter = function(tokens) { var font = {}; var token = tokens.last(); if (token.type === 'number') { font.size = parseInt(token.token); tokens.pop(); } if (tokens.length > 0) { var scratch = ""; tokens.each(function(tok) { if (tok.token !== '-') { if (scratch.length > 0) scratch += ' '; scratch += tok.token; } }); font.font = scratch; } return font; }; var getChangingFont = function(cmd, tokens) { if (tokens.length === 0) return "Directive \"" + cmd + "\" requires a font as a parameter."; multilineVars[cmd] = getFontParameter(tokens); return null; }; var getGlobalFont = function(cmd, tokens) { if (tokens.length === 0) return "Directive \"" + cmd + "\" requires a font as a parameter."; tune.formatting[cmd] = getFontParameter(tokens); return null; }; var tokens = tokenizer.tokenize(str, 0, str.length); // 3 or more % in a row, or just spaces after %% is just a comment if (tokens.length === 0 || tokens[0].type !== 'alpha') return null; var restOfString = str.substring(str.indexOf(tokens[0].token)+tokens[0].token.length); restOfString = tokenizer.stripComment(restOfString); var cmd = tokens.shift().token.toLowerCase(); var num; var scratch = ""; switch (cmd) { case "bagpipes":tune.formatting.bagpipes = true;break; case "landscape":tune.formatting.landscape = true;break; case "slurgraces":tune.formatting.slurgraces = true;break; case "stretchlast":tune.formatting.stretchlast = true;break; case "titlecaps": multilineVars.titlecaps = true;break; case "titleleft":tune.formatting.titleleft = true;break; case "botmargin": case "botspace": case "composerspace": case "indent": case "leftmargin": case "linesep": case "musicspace": case "partsspace": case "staffsep": case "staffwidth": case "subtitlespace": case "sysstaffsep": case "systemsep": case "textspace": case "titlespace": case "topmargin": case "topspace": case "vocalspace": case "wordsspace": return oneParameterMeasurement(cmd, tokens); break; case "scale": scratch = ""; tokens.each(function(tok) { scratch += tok.token; }); num = parseFloat(scratch); if (isNaN(num) || num === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.scale = num; break; case "sep": if (tokens.length === 0) tune.addSeparator(); else { if (tokens.length !== 3 || tokens[0].type !== 'number' || tokens[1].type !== 'number' || tokens[2].type !== 'number') return "Directive \"" + cmd + "\" requires 3 numbers: space above, space below, length of line"; tune.addSeparator(parseInt(tokens[0].token), parseInt(tokens[1].token), parseInt(tokens[2].token)); } break; case "barnumbers": if (tokens.length !== 1 || tokens[0].type !== 'number') return "Directive \"" + cmd + "\" requires a number as a parameter."; multilineVars.barNumbers = parseInt(tokens[0].token); break; case "begintext": multilineVars.inTextBlock = true; break; case "text": tune.addText(tokenizer.translateString(restOfString)); // display secondary title break; case "gchordfont": case "partsfont": case "vocalfont": return getChangingFont(cmd, tokens); break; case "barlabelfont": case "barnumberfont": case "composerfont": case "subtitlefont": case "tempofont": case "titlefont": case "voicefont": return getGlobalFont(cmd, tokens); break; case "barnumfont": return getGlobalFont("barnumberfont", tokens); break; case "score": multilineVars.score_is_present = true; var addVoice = function(id, newStaff, bracket, brace, continueBar) { if (newStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length, numVoices: 0 }); } var staff = multilineVars.staves.last(); if (bracket !== undefined) staff.bracket = bracket; if (brace !== undefined) staff.brace = brace; if (continueBar) staff.bar = 'end'; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = { staffNum: staff.index, index: staff.numVoices}; staff.numVoices++; } }; var openParen = false; var openBracket = false; var openBrace = false; var justOpenParen = false; var justOpenBracket = false; var justOpenBrace = false; var continueBar = false; var lastVoice = undefined; while (tokens.length) { var t = tokens.shift(); switch (t.token) { case '(': if (openParen) warn("Can't nest parenthesis in %%score", str, t.start); else { openParen = true; justOpenParen = true; } break; case ')': if (!openParen || justOpenParen) warn("Unexpected close parenthesis in %%score", str, t.start); else openParen = false; break; case '[': if (openBracket) warn("Can't nest brackets in %%score", str, t.start); else { openBracket = true; justOpenBracket = true; } break; case ']': if (!openBracket || justOpenBracket) warn("Unexpected close bracket in %%score", str, t.start); else { openBracket = false; multilineVars.staves[lastVoice.staffNum].bracket = 'end'; } break; case '{': if (openBrace ) warn("Can't nest braces in %%score", str, t.start); else { openBrace = true; justOpenBrace = true; } break; case '}': if (!openBrace || justOpenBrace) warn("Unexpected close brace in %%score", str, t.start); else { openBrace = false; multilineVars.staves[lastVoice.staffNum].brace = 'end'; } break; case '|': continueBar = true; if (lastVoice) multilineVars.staves[lastVoice.staffNum].bar = 'start'; break; default: var vc = ""; while (t.type === 'alpha' || t.type === 'number') { vc += t.token; if (t.continueId) t = tokens.shift(); else break; } var newStaff = !openParen || justOpenParen; var bracket = justOpenBracket ? 'start' : openBracket ? 'continue' : undefined; var brace = justOpenBrace ? 'start' : openBrace ? 'continue' : undefined; addVoice(vc, newStaff, bracket, brace, continueBar); justOpenParen = false; justOpenBracket = false; justOpenBrace = false; continueBar = false; lastVoice = multilineVars.voices[vc]; break; } } break; case "midi": case "indent": case "playtempo": case "auquality": case "continuous": case "nobarcheck": case "staves": // TODO-PER: Actually handle the parameters of these tune.formatting[cmd] = restOfString; break; default: return "Unknown directive: " + cmd; } return null; };
var oneParameterMeasurement = function(cmd, tokens) { var points = tokenizer.getMeasurement(tokens); if (points.used === 0 || tokens.length !== 0) return "Directive \"" + cmd + "\" requires a measurement as a parameter."; tune.formatting[cmd] = points.value; return null; }; var getFontParameter = function(tokens) { var font = {}; var token = tokens.last(); if (token.type === 'number') { font.size = parseInt(token.token); tokens.pop();
var oneParameterMeasurement = function(cmd, tokens) { var points = tokenizer.getMeasurement(tokens); if (points.used === 0 || tokens.length !== 0) return "Directive \"" + cmd + "\" requires a measurement as a parameter."; tune.formatting[cmd] = points.value; return null; }; var getFontParameter = function(tokens) { var font = {}; var token = tokens.last(); if (token.type === 'number') { font.size = parseInt(token.token); tokens.pop(); } if (tokens.length > 0) { var scratch = ""; tokens.each(function(tok) { if (tok.token !== '-') { if (scratch.length > 0) scratch += ' '; scratch += tok.token; } }); font.font = scratch; } return font; }; var getChangingFont = function(cmd, tokens) { if (tokens.length === 0) return "Directive \"" + cmd + "\" requires a font as a parameter."; multilineVars[cmd] = getFontParameter(tokens); return null; }; var getGlobalFont = function(cmd, tokens) { if (tokens.length === 0) return "Directive \"" + cmd + "\" requires a font as a parameter."; tune.formatting[cmd] = getFontParameter(tokens); return null; }; var tokens = tokenizer.tokenize(str, 0, str.length); if (tokens.length === 0 || tokens[0].type !== 'alpha') return null; var restOfString = str.substring(str.indexOf(tokens[0].token)+tokens[0].token.length); restOfString = tokenizer.stripComment(restOfString); var cmd = tokens.shift().token.toLowerCase(); var num; var scratch = ""; switch (cmd) { case "bagpipes":tune.formatting.bagpipes = true;break; case "landscape":tune.formatting.landscape = true;break; case "slurgraces":tune.formatting.slurgraces = true;break; case "stretchlast":tune.formatting.stretchlast = true;break; case "titlecaps": multilineVars.titlecaps = true;break; case "titleleft":tune.formatting.titleleft = true;break; case "botmargin": case "botspace": case "composerspace": case "indent": case "leftmargin": case "linesep": case "musicspace": case "partsspace": case "staffsep": case "staffwidth": case "subtitlespace": case "sysstaffsep": case "systemsep": case "textspace": case "titlespace": case "topmargin": case "topspace": case "vocalspace": case "wordsspace": return oneParameterMeasurement(cmd, tokens); case "scale": scratch = ""; tokens.each(function(tok) { scratch += tok.token; }); num = parseFloat(scratch); if (isNaN(num) || num === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.scale = num; break; case "sep": if (tokens.length === 0) tune.addSeparator(); else { if (tokens.length !== 3 || tokens[0].type !== 'number' || tokens[1].type !== 'number' || tokens[2].type !== 'number') return "Directive \"" + cmd + "\" requires 3 numbers: space above, space below, length of line"; tune.addSeparator(parseInt(tokens[0].token), parseInt(tokens[1].token), parseInt(tokens[2].token));
this.addDirective = function(str) { var oneParameterMeasurement = function(cmd, tokens) { var points = tokenizer.getMeasurement(tokens); if (points.used === 0 || tokens.length !== 0) return "Directive \"" + cmd + "\" requires a measurement as a parameter."; tune.formatting[cmd] = points.value; return null; }; var getFontParameter = function(tokens) { var font = {}; var token = tokens.last(); if (token.type === 'number') { font.size = parseInt(token.token); tokens.pop(); } if (tokens.length > 0) { var scratch = ""; tokens.each(function(tok) { if (tok.token !== '-') { if (scratch.length > 0) scratch += ' '; scratch += tok.token; } }); font.font = scratch; } return font; }; var getChangingFont = function(cmd, tokens) { if (tokens.length === 0) return "Directive \"" + cmd + "\" requires a font as a parameter."; multilineVars[cmd] = getFontParameter(tokens); return null; }; var getGlobalFont = function(cmd, tokens) { if (tokens.length === 0) return "Directive \"" + cmd + "\" requires a font as a parameter."; tune.formatting[cmd] = getFontParameter(tokens); return null; }; var tokens = tokenizer.tokenize(str, 0, str.length); // 3 or more % in a row, or just spaces after %% is just a comment if (tokens.length === 0 || tokens[0].type !== 'alpha') return null; var restOfString = str.substring(str.indexOf(tokens[0].token)+tokens[0].token.length); restOfString = tokenizer.stripComment(restOfString); var cmd = tokens.shift().token.toLowerCase(); var num; var scratch = ""; switch (cmd) { case "bagpipes":tune.formatting.bagpipes = true;break; case "landscape":tune.formatting.landscape = true;break; case "slurgraces":tune.formatting.slurgraces = true;break; case "stretchlast":tune.formatting.stretchlast = true;break; case "titlecaps": multilineVars.titlecaps = true;break; case "titleleft":tune.formatting.titleleft = true;break; case "botmargin": case "botspace": case "composerspace": case "indent": case "leftmargin": case "linesep": case "musicspace": case "partsspace": case "staffsep": case "staffwidth": case "subtitlespace": case "sysstaffsep": case "systemsep": case "textspace": case "titlespace": case "topmargin": case "topspace": case "vocalspace": case "wordsspace": return oneParameterMeasurement(cmd, tokens); break; case "scale": scratch = ""; tokens.each(function(tok) { scratch += tok.token; }); num = parseFloat(scratch); if (isNaN(num) || num === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.scale = num; break; case "sep": if (tokens.length === 0) tune.addSeparator(); else { if (tokens.length !== 3 || tokens[0].type !== 'number' || tokens[1].type !== 'number' || tokens[2].type !== 'number') return "Directive \"" + cmd + "\" requires 3 numbers: space above, space below, length of line"; tune.addSeparator(parseInt(tokens[0].token), parseInt(tokens[1].token), parseInt(tokens[2].token)); } break; case "barnumbers": if (tokens.length !== 1 || tokens[0].type !== 'number') return "Directive \"" + cmd + "\" requires a number as a parameter."; multilineVars.barNumbers = parseInt(tokens[0].token); break; case "begintext": multilineVars.inTextBlock = true; break; case "text": tune.addText(tokenizer.translateString(restOfString)); // display secondary title break; case "gchordfont": case "partsfont": case "vocalfont": return getChangingFont(cmd, tokens); break; case "barlabelfont": case "barnumberfont": case "composerfont": case "subtitlefont": case "tempofont": case "titlefont": case "voicefont": return getGlobalFont(cmd, tokens); break; case "barnumfont": return getGlobalFont("barnumberfont", tokens); break; case "score": multilineVars.score_is_present = true; var addVoice = function(id, newStaff, bracket, brace, continueBar) { if (newStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length, numVoices: 0 }); } var staff = multilineVars.staves.last(); if (bracket !== undefined) staff.bracket = bracket; if (brace !== undefined) staff.brace = brace; if (continueBar) staff.connectBarLines = 'end'; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = { staffNum: staff.index, index: staff.numVoices}; staff.numVoices++; } }; var openParen = false; var openBracket = false; var openBrace = false; var justOpenParen = false; var justOpenBracket = false; var justOpenBrace = false; var continueBar = false; var lastVoice = undefined; while (tokens.length) { var t = tokens.shift(); switch (t.token) { case '(': if (openParen) warn("Can't nest parenthesis in %%score", str, t.start); else { openParen = true; justOpenParen = true; } break; case ')': if (!openParen || justOpenParen) warn("Unexpected close parenthesis in %%score", str, t.start); else openParen = false; break; case '[': if (openBracket) warn("Can't nest brackets in %%score", str, t.start); else { openBracket = true; justOpenBracket = true; } break; case ']': if (!openBracket || justOpenBracket) warn("Unexpected close bracket in %%score", str, t.start); else { openBracket = false; multilineVars.staves[lastVoice.staffNum].bracket = 'end'; } break; case '{': if (openBrace ) warn("Can't nest braces in %%score", str, t.start); else { openBrace = true; justOpenBrace = true; } break; case '}': if (!openBrace || justOpenBrace) warn("Unexpected close brace in %%score", str, t.start); else { openBrace = false; multilineVars.staves[lastVoice.staffNum].brace = 'end'; } break; case '|': continueBar = true; if (lastVoice) { var ty = 'start'; if (lastVoice.staffNum > 0) { if (multilineVars.staves[lastVoice.staffNum-1].connectBarLines === 'start' || multilineVars.staves[lastVoice.staffNum-1].connectBarLines === 'continue') ty = 'continue'; } multilineVars.staves[lastVoice.staffNum].connectBarLines = ty; } break; default: var vc = ""; while (t.type === 'alpha' || t.type === 'number') { vc += t.token; if (t.continueId) t = tokens.shift(); else break; } var newStaff = !openParen || justOpenParen; var bracket = justOpenBracket ? 'start' : openBracket ? 'continue' : undefined; var brace = justOpenBrace ? 'start' : openBrace ? 'continue' : undefined; addVoice(vc, newStaff, bracket, brace, continueBar); justOpenParen = false; justOpenBracket = false; justOpenBrace = false; continueBar = false; lastVoice = multilineVars.voices[vc]; break; } } break; case "midi": case "indent": case "playtempo": case "auquality": case "continuous": case "nobarcheck": case "staves": // TODO-PER: Actually handle the parameters of these tune.formatting[cmd] = restOfString; break; default: return "Unknown directive: " + cmd; } return null; };
if (tokens.length > 0) { var scratch = ""; tokens.each(function(tok) { if (tok.token !== '-') { if (scratch.length > 0) scratch += ' '; scratch += tok.token; } }); font.font = scratch;
break; case "barnumbers": if (tokens.length !== 1 || tokens[0].type !== 'number') return "Directive \"" + cmd + "\" requires a number as a parameter."; multilineVars.barNumbers = parseInt(tokens[0].token); break; case "begintext": multilineVars.inTextBlock = true; break; case "text": tune.addText(tokenizer.translateString(restOfString)); break; case "gchordfont": case "partsfont": case "vocalfont": return getChangingFont(cmd, tokens); case "barlabelfont": case "barnumberfont": case "composerfont": case "subtitlefont": case "tempofont": case "titlefont": case "voicefont": return getGlobalFont(cmd, tokens); case "barnumfont": return getGlobalFont("barnumberfont", tokens); case "score": multilineVars.score_is_present = true; var addVoice = function(id, newStaff, bracket, brace, continueBar) { if (newStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length, numVoices: 0 }); } var staff = multilineVars.staves.last(); if (bracket !== undefined) staff.bracket = bracket; if (brace !== undefined) staff.brace = brace; if (continueBar) staff.connectBarLines = 'end'; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = { staffNum: staff.index, index: staff.numVoices}; staff.numVoices++; } }; var openParen = false; var openBracket = false; var openBrace = false; var justOpenParen = false; var justOpenBracket = false; var justOpenBrace = false; var continueBar = false; var lastVoice = undefined; while (tokens.length) { var t = tokens.shift(); switch (t.token) { case '(': if (openParen) warn("Can't nest parenthesis in %%score", str, t.start); else { openParen = true; justOpenParen = true; } break; case ')': if (!openParen || justOpenParen) warn("Unexpected close parenthesis in %%score", str, t.start); else openParen = false; break; case '[': if (openBracket) warn("Can't nest brackets in %%score", str, t.start); else { openBracket = true; justOpenBracket = true; } break; case ']': if (!openBracket || justOpenBracket) warn("Unexpected close bracket in %%score", str, t.start); else { openBracket = false; multilineVars.staves[lastVoice.staffNum].bracket = 'end'; } break; case '{': if (openBrace ) warn("Can't nest braces in %%score", str, t.start); else { openBrace = true; justOpenBrace = true; } break; case '}': if (!openBrace || justOpenBrace) warn("Unexpected close brace in %%score", str, t.start); else { openBrace = false; multilineVars.staves[lastVoice.staffNum].brace = 'end'; } break; case '|': continueBar = true; if (lastVoice) { var ty = 'start'; if (lastVoice.staffNum > 0) { if (multilineVars.staves[lastVoice.staffNum-1].connectBarLines === 'start' || multilineVars.staves[lastVoice.staffNum-1].connectBarLines === 'continue') ty = 'continue'; } multilineVars.staves[lastVoice.staffNum].connectBarLines = ty; } break; default: var vc = ""; while (t.type === 'alpha' || t.type === 'number') { vc += t.token; if (t.continueId) t = tokens.shift(); else break; } var newStaff = !openParen || justOpenParen; var bracket = justOpenBracket ? 'start' : openBracket ? 'continue' : undefined; var brace = justOpenBrace ? 'start' : openBrace ? 'continue' : undefined; addVoice(vc, newStaff, bracket, brace, continueBar); justOpenParen = false; justOpenBracket = false; justOpenBrace = false; continueBar = false; lastVoice = multilineVars.voices[vc]; break; }
this.addDirective = function(str) { var oneParameterMeasurement = function(cmd, tokens) { var points = tokenizer.getMeasurement(tokens); if (points.used === 0 || tokens.length !== 0) return "Directive \"" + cmd + "\" requires a measurement as a parameter."; tune.formatting[cmd] = points.value; return null; }; var getFontParameter = function(tokens) { var font = {}; var token = tokens.last(); if (token.type === 'number') { font.size = parseInt(token.token); tokens.pop(); } if (tokens.length > 0) { var scratch = ""; tokens.each(function(tok) { if (tok.token !== '-') { if (scratch.length > 0) scratch += ' '; scratch += tok.token; } }); font.font = scratch; } return font; }; var getChangingFont = function(cmd, tokens) { if (tokens.length === 0) return "Directive \"" + cmd + "\" requires a font as a parameter."; multilineVars[cmd] = getFontParameter(tokens); return null; }; var getGlobalFont = function(cmd, tokens) { if (tokens.length === 0) return "Directive \"" + cmd + "\" requires a font as a parameter."; tune.formatting[cmd] = getFontParameter(tokens); return null; }; var tokens = tokenizer.tokenize(str, 0, str.length); // 3 or more % in a row, or just spaces after %% is just a comment if (tokens.length === 0 || tokens[0].type !== 'alpha') return null; var restOfString = str.substring(str.indexOf(tokens[0].token)+tokens[0].token.length); restOfString = tokenizer.stripComment(restOfString); var cmd = tokens.shift().token.toLowerCase(); var num; var scratch = ""; switch (cmd) { case "bagpipes":tune.formatting.bagpipes = true;break; case "landscape":tune.formatting.landscape = true;break; case "slurgraces":tune.formatting.slurgraces = true;break; case "stretchlast":tune.formatting.stretchlast = true;break; case "titlecaps": multilineVars.titlecaps = true;break; case "titleleft":tune.formatting.titleleft = true;break; case "botmargin": case "botspace": case "composerspace": case "indent": case "leftmargin": case "linesep": case "musicspace": case "partsspace": case "staffsep": case "staffwidth": case "subtitlespace": case "sysstaffsep": case "systemsep": case "textspace": case "titlespace": case "topmargin": case "topspace": case "vocalspace": case "wordsspace": return oneParameterMeasurement(cmd, tokens); break; case "scale": scratch = ""; tokens.each(function(tok) { scratch += tok.token; }); num = parseFloat(scratch); if (isNaN(num) || num === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.scale = num; break; case "sep": if (tokens.length === 0) tune.addSeparator(); else { if (tokens.length !== 3 || tokens[0].type !== 'number' || tokens[1].type !== 'number' || tokens[2].type !== 'number') return "Directive \"" + cmd + "\" requires 3 numbers: space above, space below, length of line"; tune.addSeparator(parseInt(tokens[0].token), parseInt(tokens[1].token), parseInt(tokens[2].token)); } break; case "barnumbers": if (tokens.length !== 1 || tokens[0].type !== 'number') return "Directive \"" + cmd + "\" requires a number as a parameter."; multilineVars.barNumbers = parseInt(tokens[0].token); break; case "begintext": multilineVars.inTextBlock = true; break; case "text": tune.addText(tokenizer.translateString(restOfString)); // display secondary title break; case "gchordfont": case "partsfont": case "vocalfont": return getChangingFont(cmd, tokens); break; case "barlabelfont": case "barnumberfont": case "composerfont": case "subtitlefont": case "tempofont": case "titlefont": case "voicefont": return getGlobalFont(cmd, tokens); break; case "barnumfont": return getGlobalFont("barnumberfont", tokens); break; case "score": multilineVars.score_is_present = true; var addVoice = function(id, newStaff, bracket, brace, continueBar) { if (newStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length, numVoices: 0 }); } var staff = multilineVars.staves.last(); if (bracket !== undefined) staff.bracket = bracket; if (brace !== undefined) staff.brace = brace; if (continueBar) staff.connectBarLines = 'end'; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = { staffNum: staff.index, index: staff.numVoices}; staff.numVoices++; } }; var openParen = false; var openBracket = false; var openBrace = false; var justOpenParen = false; var justOpenBracket = false; var justOpenBrace = false; var continueBar = false; var lastVoice = undefined; while (tokens.length) { var t = tokens.shift(); switch (t.token) { case '(': if (openParen) warn("Can't nest parenthesis in %%score", str, t.start); else { openParen = true; justOpenParen = true; } break; case ')': if (!openParen || justOpenParen) warn("Unexpected close parenthesis in %%score", str, t.start); else openParen = false; break; case '[': if (openBracket) warn("Can't nest brackets in %%score", str, t.start); else { openBracket = true; justOpenBracket = true; } break; case ']': if (!openBracket || justOpenBracket) warn("Unexpected close bracket in %%score", str, t.start); else { openBracket = false; multilineVars.staves[lastVoice.staffNum].bracket = 'end'; } break; case '{': if (openBrace ) warn("Can't nest braces in %%score", str, t.start); else { openBrace = true; justOpenBrace = true; } break; case '}': if (!openBrace || justOpenBrace) warn("Unexpected close brace in %%score", str, t.start); else { openBrace = false; multilineVars.staves[lastVoice.staffNum].brace = 'end'; } break; case '|': continueBar = true; if (lastVoice) { var ty = 'start'; if (lastVoice.staffNum > 0) { if (multilineVars.staves[lastVoice.staffNum-1].connectBarLines === 'start' || multilineVars.staves[lastVoice.staffNum-1].connectBarLines === 'continue') ty = 'continue'; } multilineVars.staves[lastVoice.staffNum].connectBarLines = ty; } break; default: var vc = ""; while (t.type === 'alpha' || t.type === 'number') { vc += t.token; if (t.continueId) t = tokens.shift(); else break; } var newStaff = !openParen || justOpenParen; var bracket = justOpenBracket ? 'start' : openBracket ? 'continue' : undefined; var brace = justOpenBrace ? 'start' : openBrace ? 'continue' : undefined; addVoice(vc, newStaff, bracket, brace, continueBar); justOpenParen = false; justOpenBracket = false; justOpenBrace = false; continueBar = false; lastVoice = multilineVars.voices[vc]; break; } } break; case "midi": case "indent": case "playtempo": case "auquality": case "continuous": case "nobarcheck": case "staves": // TODO-PER: Actually handle the parameters of these tune.formatting[cmd] = restOfString; break; default: return "Unknown directive: " + cmd; } return null; };
return font; }; var getChangingFont = function(cmd, tokens) { if (tokens.length === 0) return "Directive \"" + cmd + "\" requires a font as a parameter."; multilineVars[cmd] = getFontParameter(tokens); return null; }; var getGlobalFont = function(cmd, tokens) { if (tokens.length === 0) return "Directive \"" + cmd + "\" requires a font as a parameter."; tune.formatting[cmd] = getFontParameter(tokens); return null; }; var tokens = tokenizer.tokenize(str, 0, str.length); if (tokens.length === 0 || tokens[0].type !== 'alpha') return null; var restOfString = str.substring(str.indexOf(tokens[0].token)+tokens[0].token.length); restOfString = tokenizer.stripComment(restOfString); var cmd = tokens.shift().token.toLowerCase(); var num; var scratch = ""; switch (cmd) { case "bagpipes":tune.formatting.bagpipes = true;break; case "landscape":tune.formatting.landscape = true;break; case "slurgraces":tune.formatting.slurgraces = true;break; case "stretchlast":tune.formatting.stretchlast = true;break; case "titlecaps": multilineVars.titlecaps = true;break; case "titleleft":tune.formatting.titleleft = true;break; case "botmargin": case "botspace": case "composerspace": case "indent": case "leftmargin": case "linesep": case "musicspace": case "partsspace": case "staffsep": case "staffwidth": case "subtitlespace": case "sysstaffsep": case "systemsep": case "textspace": case "titlespace": case "topmargin": case "topspace": case "vocalspace": case "wordsspace": return oneParameterMeasurement(cmd, tokens); break; case "scale": scratch = ""; tokens.each(function(tok) { scratch += tok.token; }); num = parseFloat(scratch); if (isNaN(num) || num === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.scale = num; break; case "sep": if (tokens.length === 0) tune.addSeparator(); else { if (tokens.length !== 3 || tokens[0].type !== 'number' || tokens[1].type !== 'number' || tokens[2].type !== 'number') return "Directive \"" + cmd + "\" requires 3 numbers: space above, space below, length of line"; tune.addSeparator(parseInt(tokens[0].token), parseInt(tokens[1].token), parseInt(tokens[2].token)); } break; case "barnumbers": if (tokens.length !== 1 || tokens[0].type !== 'number') return "Directive \"" + cmd + "\" requires a number as a parameter."; multilineVars.barNumbers = parseInt(tokens[0].token); break; case "begintext": multilineVars.inTextBlock = true; break; case "text": tune.addText(tokenizer.translateString(restOfString)); break; case "gchordfont": case "partsfont": case "vocalfont": return getChangingFont(cmd, tokens); break; case "barlabelfont": case "barnumberfont": case "composerfont": case "subtitlefont": case "tempofont": case "titlefont": case "voicefont": return getGlobalFont(cmd, tokens); break; case "barnumfont": return getGlobalFont("barnumberfont", tokens); break; case "score": multilineVars.score_is_present = true; var addVoice = function(id, newStaff, bracket, brace, continueBar) { if (newStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length, numVoices: 0 }); } var staff = multilineVars.staves.last(); if (bracket !== undefined) staff.bracket = bracket; if (brace !== undefined) staff.brace = brace; if (continueBar) staff.connectBarLines = 'end'; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = { staffNum: staff.index, index: staff.numVoices}; staff.numVoices++; } }; var openParen = false; var openBracket = false; var openBrace = false; var justOpenParen = false; var justOpenBracket = false; var justOpenBrace = false; var continueBar = false; var lastVoice = undefined; while (tokens.length) { var t = tokens.shift(); switch (t.token) { case '(': if (openParen) warn("Can't nest parenthesis in %%score", str, t.start); else { openParen = true; justOpenParen = true; } break; case ')': if (!openParen || justOpenParen) warn("Unexpected close parenthesis in %%score", str, t.start); else openParen = false; break; case '[': if (openBracket) warn("Can't nest brackets in %%score", str, t.start); else { openBracket = true; justOpenBracket = true; } break; case ']': if (!openBracket || justOpenBracket) warn("Unexpected close bracket in %%score", str, t.start); else { openBracket = false; multilineVars.staves[lastVoice.staffNum].bracket = 'end'; } break; case '{': if (openBrace ) warn("Can't nest braces in %%score", str, t.start); else { openBrace = true; justOpenBrace = true; } break; case '}': if (!openBrace || justOpenBrace) warn("Unexpected close brace in %%score", str, t.start); else { openBrace = false; multilineVars.staves[lastVoice.staffNum].brace = 'end'; } break; case '|': continueBar = true; if (lastVoice) { var ty = 'start'; if (lastVoice.staffNum > 0) { if (multilineVars.staves[lastVoice.staffNum-1].connectBarLines === 'start' || multilineVars.staves[lastVoice.staffNum-1].connectBarLines === 'continue') ty = 'continue'; } multilineVars.staves[lastVoice.staffNum].connectBarLines = ty; } break; default: var vc = ""; while (t.type === 'alpha' || t.type === 'number') { vc += t.token; if (t.continueId) t = tokens.shift(); else break; } var newStaff = !openParen || justOpenParen; var bracket = justOpenBracket ? 'start' : openBracket ? 'continue' : undefined; var brace = justOpenBrace ? 'start' : openBrace ? 'continue' : undefined; addVoice(vc, newStaff, bracket, brace, continueBar); justOpenParen = false; justOpenBracket = false; justOpenBrace = false; continueBar = false; lastVoice = multilineVars.voices[vc]; break; } } break; case "midi": case "indent": case "playtempo": case "auquality": case "continuous": case "nobarcheck": case "staves": tune.formatting[cmd] = restOfString; break; default: return "Unknown directive: " + cmd; } return null; };
break; case "midi": case "indent": case "playtempo": case "auquality": case "continuous": case "nobarcheck": case "staves": tune.formatting[cmd] = restOfString; break; default: return "Unknown directive: " + cmd; } return null; };
this.addDirective = function(str) { var oneParameterMeasurement = function(cmd, tokens) { var points = tokenizer.getMeasurement(tokens); if (points.used === 0 || tokens.length !== 0) return "Directive \"" + cmd + "\" requires a measurement as a parameter."; tune.formatting[cmd] = points.value; return null; }; var getFontParameter = function(tokens) { var font = {}; var token = tokens.last(); if (token.type === 'number') { font.size = parseInt(token.token); tokens.pop(); } if (tokens.length > 0) { var scratch = ""; tokens.each(function(tok) { if (tok.token !== '-') { if (scratch.length > 0) scratch += ' '; scratch += tok.token; } }); font.font = scratch; } return font; }; var getChangingFont = function(cmd, tokens) { if (tokens.length === 0) return "Directive \"" + cmd + "\" requires a font as a parameter."; multilineVars[cmd] = getFontParameter(tokens); return null; }; var getGlobalFont = function(cmd, tokens) { if (tokens.length === 0) return "Directive \"" + cmd + "\" requires a font as a parameter."; tune.formatting[cmd] = getFontParameter(tokens); return null; }; var tokens = tokenizer.tokenize(str, 0, str.length); // 3 or more % in a row, or just spaces after %% is just a comment if (tokens.length === 0 || tokens[0].type !== 'alpha') return null; var restOfString = str.substring(str.indexOf(tokens[0].token)+tokens[0].token.length); restOfString = tokenizer.stripComment(restOfString); var cmd = tokens.shift().token.toLowerCase(); var num; var scratch = ""; switch (cmd) { case "bagpipes":tune.formatting.bagpipes = true;break; case "landscape":tune.formatting.landscape = true;break; case "slurgraces":tune.formatting.slurgraces = true;break; case "stretchlast":tune.formatting.stretchlast = true;break; case "titlecaps": multilineVars.titlecaps = true;break; case "titleleft":tune.formatting.titleleft = true;break; case "botmargin": case "botspace": case "composerspace": case "indent": case "leftmargin": case "linesep": case "musicspace": case "partsspace": case "staffsep": case "staffwidth": case "subtitlespace": case "sysstaffsep": case "systemsep": case "textspace": case "titlespace": case "topmargin": case "topspace": case "vocalspace": case "wordsspace": return oneParameterMeasurement(cmd, tokens); break; case "scale": scratch = ""; tokens.each(function(tok) { scratch += tok.token; }); num = parseFloat(scratch); if (isNaN(num) || num === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.scale = num; break; case "sep": if (tokens.length === 0) tune.addSeparator(); else { if (tokens.length !== 3 || tokens[0].type !== 'number' || tokens[1].type !== 'number' || tokens[2].type !== 'number') return "Directive \"" + cmd + "\" requires 3 numbers: space above, space below, length of line"; tune.addSeparator(parseInt(tokens[0].token), parseInt(tokens[1].token), parseInt(tokens[2].token)); } break; case "barnumbers": if (tokens.length !== 1 || tokens[0].type !== 'number') return "Directive \"" + cmd + "\" requires a number as a parameter."; multilineVars.barNumbers = parseInt(tokens[0].token); break; case "begintext": multilineVars.inTextBlock = true; break; case "text": tune.addText(tokenizer.translateString(restOfString)); // display secondary title break; case "gchordfont": case "partsfont": case "vocalfont": return getChangingFont(cmd, tokens); break; case "barlabelfont": case "barnumberfont": case "composerfont": case "subtitlefont": case "tempofont": case "titlefont": case "voicefont": return getGlobalFont(cmd, tokens); break; case "barnumfont": return getGlobalFont("barnumberfont", tokens); break; case "score": multilineVars.score_is_present = true; var addVoice = function(id, newStaff, bracket, brace, continueBar) { if (newStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length, numVoices: 0 }); } var staff = multilineVars.staves.last(); if (bracket !== undefined) staff.bracket = bracket; if (brace !== undefined) staff.brace = brace; if (continueBar) staff.connectBarLines = 'end'; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = { staffNum: staff.index, index: staff.numVoices}; staff.numVoices++; } }; var openParen = false; var openBracket = false; var openBrace = false; var justOpenParen = false; var justOpenBracket = false; var justOpenBrace = false; var continueBar = false; var lastVoice = undefined; while (tokens.length) { var t = tokens.shift(); switch (t.token) { case '(': if (openParen) warn("Can't nest parenthesis in %%score", str, t.start); else { openParen = true; justOpenParen = true; } break; case ')': if (!openParen || justOpenParen) warn("Unexpected close parenthesis in %%score", str, t.start); else openParen = false; break; case '[': if (openBracket) warn("Can't nest brackets in %%score", str, t.start); else { openBracket = true; justOpenBracket = true; } break; case ']': if (!openBracket || justOpenBracket) warn("Unexpected close bracket in %%score", str, t.start); else { openBracket = false; multilineVars.staves[lastVoice.staffNum].bracket = 'end'; } break; case '{': if (openBrace ) warn("Can't nest braces in %%score", str, t.start); else { openBrace = true; justOpenBrace = true; } break; case '}': if (!openBrace || justOpenBrace) warn("Unexpected close brace in %%score", str, t.start); else { openBrace = false; multilineVars.staves[lastVoice.staffNum].brace = 'end'; } break; case '|': continueBar = true; if (lastVoice) { var ty = 'start'; if (lastVoice.staffNum > 0) { if (multilineVars.staves[lastVoice.staffNum-1].connectBarLines === 'start' || multilineVars.staves[lastVoice.staffNum-1].connectBarLines === 'continue') ty = 'continue'; } multilineVars.staves[lastVoice.staffNum].connectBarLines = ty; } break; default: var vc = ""; while (t.type === 'alpha' || t.type === 'number') { vc += t.token; if (t.continueId) t = tokens.shift(); else break; } var newStaff = !openParen || justOpenParen; var bracket = justOpenBracket ? 'start' : openBracket ? 'continue' : undefined; var brace = justOpenBrace ? 'start' : openBrace ? 'continue' : undefined; addVoice(vc, newStaff, bracket, brace, continueBar); justOpenParen = false; justOpenBracket = false; justOpenBrace = false; continueBar = false; lastVoice = multilineVars.voices[vc]; break; } } break; case "midi": case "indent": case "playtempo": case "auquality": case "continuous": case "nobarcheck": case "staves": // TODO-PER: Actually handle the parameters of these tune.formatting[cmd] = restOfString; break; default: return "Unknown directive: " + cmd; } return null; };
var s = tokenizer.stripComment(str).strip(); if (s.length === 0) return null; var i = s.indexOf(' '); var cmd = (i > 0) ? s.substring(0, i) : s;
var tokens = tokenizer.tokenize(str, 0, str.length); if (tokens.length === 0 || tokens[0].type !== 'alpha') return null; var restOfString = str.substring(str.indexOf(tokens[0])); var cmd = tokens.shift().token.toLowerCase();
var addDirective = function(str) { var s = tokenizer.stripComment(str).strip(); if (s.length === 0) // 3 or more % in a row, or just spaces after %% is just a comment return null; var i = s.indexOf(' '); var cmd = (i > 0) ? s.substring(0, i) : s; var num; cmd = cmd.toLowerCase(); switch (cmd) { case "bagpipes":tune.formatting.bagpipes = true;break; case "stretchlast":tune.formatting.stretchlast = true;break; case "staffwidth": num = tokenizer.getInt(s.substring(i)); if (num.digits === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.staffwidth = num.value; break; case "scale": num = tokenizer.getFloat(s.substring(i)); if (num.digits === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.scale = num.value; break; case "sep": // TODO-PER: This actually goes into the stream, it is not global tune.formatting.sep = s.substring(i); break; case "score": case "indent": case "voicefont": case "titlefont": case "barlabelfont": case "barnumfont": case "barnumberfont": case "barnumbers": case "topmargin": case "botmargin": case "topspace": case "titlespace": case "subtitlespace": case "composerspace": case "musicspace": case "partsspace": case "wordsspace": case "textspace": case "vocalspace": case "staffsep": case "linesep": case "midi": case "titlecaps": case "titlefont": case "composerfont": case "indent": case "playtempo": case "auquality": case "text": case "begintext": case "endtext": case "vocalfont": case "systemsep": case "sysstaffsep": case "landscape": case "gchordfont": case "leftmargin": case "partsfont": case "staves": case "slurgraces": case "titleleft": case "subtitlefont": case "tempofont": case "continuous": case "botspace": case "nobarcheck": // TODO-PER: Actually handle the parameters of these tune.formatting[cmd] = s.substring(i); break; default: return "Unknown directive: " + cmd; break; } return null; };
cmd = cmd.toLowerCase();
var scratch = "";
var addDirective = function(str) { var s = tokenizer.stripComment(str).strip(); if (s.length === 0) // 3 or more % in a row, or just spaces after %% is just a comment return null; var i = s.indexOf(' '); var cmd = (i > 0) ? s.substring(0, i) : s; var num; cmd = cmd.toLowerCase(); switch (cmd) { case "bagpipes":tune.formatting.bagpipes = true;break; case "stretchlast":tune.formatting.stretchlast = true;break; case "staffwidth": num = tokenizer.getInt(s.substring(i)); if (num.digits === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.staffwidth = num.value; break; case "scale": num = tokenizer.getFloat(s.substring(i)); if (num.digits === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.scale = num.value; break; case "sep": // TODO-PER: This actually goes into the stream, it is not global tune.formatting.sep = s.substring(i); break; case "score": case "indent": case "voicefont": case "titlefont": case "barlabelfont": case "barnumfont": case "barnumberfont": case "barnumbers": case "topmargin": case "botmargin": case "topspace": case "titlespace": case "subtitlespace": case "composerspace": case "musicspace": case "partsspace": case "wordsspace": case "textspace": case "vocalspace": case "staffsep": case "linesep": case "midi": case "titlecaps": case "titlefont": case "composerfont": case "indent": case "playtempo": case "auquality": case "text": case "begintext": case "endtext": case "vocalfont": case "systemsep": case "sysstaffsep": case "landscape": case "gchordfont": case "leftmargin": case "partsfont": case "staves": case "slurgraces": case "titleleft": case "subtitlefont": case "tempofont": case "continuous": case "botspace": case "nobarcheck": // TODO-PER: Actually handle the parameters of these tune.formatting[cmd] = s.substring(i); break; default: return "Unknown directive: " + cmd; break; } return null; };
num = tokenizer.getInt(s.substring(i)); if (num.digits === 0)
if (tokens.length !== 1 || tokens[0].type != 'number')
var addDirective = function(str) { var s = tokenizer.stripComment(str).strip(); if (s.length === 0) // 3 or more % in a row, or just spaces after %% is just a comment return null; var i = s.indexOf(' '); var cmd = (i > 0) ? s.substring(0, i) : s; var num; cmd = cmd.toLowerCase(); switch (cmd) { case "bagpipes":tune.formatting.bagpipes = true;break; case "stretchlast":tune.formatting.stretchlast = true;break; case "staffwidth": num = tokenizer.getInt(s.substring(i)); if (num.digits === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.staffwidth = num.value; break; case "scale": num = tokenizer.getFloat(s.substring(i)); if (num.digits === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.scale = num.value; break; case "sep": // TODO-PER: This actually goes into the stream, it is not global tune.formatting.sep = s.substring(i); break; case "score": case "indent": case "voicefont": case "titlefont": case "barlabelfont": case "barnumfont": case "barnumberfont": case "barnumbers": case "topmargin": case "botmargin": case "topspace": case "titlespace": case "subtitlespace": case "composerspace": case "musicspace": case "partsspace": case "wordsspace": case "textspace": case "vocalspace": case "staffsep": case "linesep": case "midi": case "titlecaps": case "titlefont": case "composerfont": case "indent": case "playtempo": case "auquality": case "text": case "begintext": case "endtext": case "vocalfont": case "systemsep": case "sysstaffsep": case "landscape": case "gchordfont": case "leftmargin": case "partsfont": case "staves": case "slurgraces": case "titleleft": case "subtitlefont": case "tempofont": case "continuous": case "botspace": case "nobarcheck": // TODO-PER: Actually handle the parameters of these tune.formatting[cmd] = s.substring(i); break; default: return "Unknown directive: " + cmd; break; } return null; };
tune.formatting.staffwidth = num.value;
tune.formatting.staffwidth = parseInt(tokens[0].token);
var addDirective = function(str) { var s = tokenizer.stripComment(str).strip(); if (s.length === 0) // 3 or more % in a row, or just spaces after %% is just a comment return null; var i = s.indexOf(' '); var cmd = (i > 0) ? s.substring(0, i) : s; var num; cmd = cmd.toLowerCase(); switch (cmd) { case "bagpipes":tune.formatting.bagpipes = true;break; case "stretchlast":tune.formatting.stretchlast = true;break; case "staffwidth": num = tokenizer.getInt(s.substring(i)); if (num.digits === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.staffwidth = num.value; break; case "scale": num = tokenizer.getFloat(s.substring(i)); if (num.digits === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.scale = num.value; break; case "sep": // TODO-PER: This actually goes into the stream, it is not global tune.formatting.sep = s.substring(i); break; case "score": case "indent": case "voicefont": case "titlefont": case "barlabelfont": case "barnumfont": case "barnumberfont": case "barnumbers": case "topmargin": case "botmargin": case "topspace": case "titlespace": case "subtitlespace": case "composerspace": case "musicspace": case "partsspace": case "wordsspace": case "textspace": case "vocalspace": case "staffsep": case "linesep": case "midi": case "titlecaps": case "titlefont": case "composerfont": case "indent": case "playtempo": case "auquality": case "text": case "begintext": case "endtext": case "vocalfont": case "systemsep": case "sysstaffsep": case "landscape": case "gchordfont": case "leftmargin": case "partsfont": case "staves": case "slurgraces": case "titleleft": case "subtitlefont": case "tempofont": case "continuous": case "botspace": case "nobarcheck": // TODO-PER: Actually handle the parameters of these tune.formatting[cmd] = s.substring(i); break; default: return "Unknown directive: " + cmd; break; } return null; };
num = tokenizer.getFloat(s.substring(i)); if (num.digits === 0)
scratch = ""; tokens.each(function(tok) { scratch += tok.token; }); num = parseFloat(scratch); if (isNaN(num) || num === 0)
var addDirective = function(str) { var s = tokenizer.stripComment(str).strip(); if (s.length === 0) // 3 or more % in a row, or just spaces after %% is just a comment return null; var i = s.indexOf(' '); var cmd = (i > 0) ? s.substring(0, i) : s; var num; cmd = cmd.toLowerCase(); switch (cmd) { case "bagpipes":tune.formatting.bagpipes = true;break; case "stretchlast":tune.formatting.stretchlast = true;break; case "staffwidth": num = tokenizer.getInt(s.substring(i)); if (num.digits === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.staffwidth = num.value; break; case "scale": num = tokenizer.getFloat(s.substring(i)); if (num.digits === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.scale = num.value; break; case "sep": // TODO-PER: This actually goes into the stream, it is not global tune.formatting.sep = s.substring(i); break; case "score": case "indent": case "voicefont": case "titlefont": case "barlabelfont": case "barnumfont": case "barnumberfont": case "barnumbers": case "topmargin": case "botmargin": case "topspace": case "titlespace": case "subtitlespace": case "composerspace": case "musicspace": case "partsspace": case "wordsspace": case "textspace": case "vocalspace": case "staffsep": case "linesep": case "midi": case "titlecaps": case "titlefont": case "composerfont": case "indent": case "playtempo": case "auquality": case "text": case "begintext": case "endtext": case "vocalfont": case "systemsep": case "sysstaffsep": case "landscape": case "gchordfont": case "leftmargin": case "partsfont": case "staves": case "slurgraces": case "titleleft": case "subtitlefont": case "tempofont": case "continuous": case "botspace": case "nobarcheck": // TODO-PER: Actually handle the parameters of these tune.formatting[cmd] = s.substring(i); break; default: return "Unknown directive: " + cmd; break; } return null; };
tune.formatting.scale = num.value;
tune.formatting.scale = num;
var addDirective = function(str) { var s = tokenizer.stripComment(str).strip(); if (s.length === 0) // 3 or more % in a row, or just spaces after %% is just a comment return null; var i = s.indexOf(' '); var cmd = (i > 0) ? s.substring(0, i) : s; var num; cmd = cmd.toLowerCase(); switch (cmd) { case "bagpipes":tune.formatting.bagpipes = true;break; case "stretchlast":tune.formatting.stretchlast = true;break; case "staffwidth": num = tokenizer.getInt(s.substring(i)); if (num.digits === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.staffwidth = num.value; break; case "scale": num = tokenizer.getFloat(s.substring(i)); if (num.digits === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.scale = num.value; break; case "sep": // TODO-PER: This actually goes into the stream, it is not global tune.formatting.sep = s.substring(i); break; case "score": case "indent": case "voicefont": case "titlefont": case "barlabelfont": case "barnumfont": case "barnumberfont": case "barnumbers": case "topmargin": case "botmargin": case "topspace": case "titlespace": case "subtitlespace": case "composerspace": case "musicspace": case "partsspace": case "wordsspace": case "textspace": case "vocalspace": case "staffsep": case "linesep": case "midi": case "titlecaps": case "titlefont": case "composerfont": case "indent": case "playtempo": case "auquality": case "text": case "begintext": case "endtext": case "vocalfont": case "systemsep": case "sysstaffsep": case "landscape": case "gchordfont": case "leftmargin": case "partsfont": case "staves": case "slurgraces": case "titleleft": case "subtitlefont": case "tempofont": case "continuous": case "botspace": case "nobarcheck": // TODO-PER: Actually handle the parameters of these tune.formatting[cmd] = s.substring(i); break; default: return "Unknown directive: " + cmd; break; } return null; };
tune.formatting.sep = s.substring(i);
if (tokens.length === 0) return "Directive \"" + cmd + "\" requires a string as a parameter."; tune.formatting.sep = tokens[0].token; break; case "barnumbers": if (tokens.length !== 1 || tokens[0].type != 'number') return "Directive \"" + cmd + "\" requires a number as a parameter."; multilineVars.barNumbers = tokens[0].token; break; case "begintext": multilineVars.inTextBlock = true; break; case "text": tune.addText(tokenizer.translateString(restOfString)); break; case "vocalfont": multilineVars.fontVocal = {}; var token = tokens.last(); if (token.type === 'number') { multilineVars.fontVocal.size = parseInt(token.token); tokens.pop(); } if (tokens.length > 0) { scratch = ""; tokens.each(function(tok) { if (tok.token === '-') scratch += ' '; else scratch += tok.token; }); multilineVars.fontVocal.font = scratch; }
var addDirective = function(str) { var s = tokenizer.stripComment(str).strip(); if (s.length === 0) // 3 or more % in a row, or just spaces after %% is just a comment return null; var i = s.indexOf(' '); var cmd = (i > 0) ? s.substring(0, i) : s; var num; cmd = cmd.toLowerCase(); switch (cmd) { case "bagpipes":tune.formatting.bagpipes = true;break; case "stretchlast":tune.formatting.stretchlast = true;break; case "staffwidth": num = tokenizer.getInt(s.substring(i)); if (num.digits === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.staffwidth = num.value; break; case "scale": num = tokenizer.getFloat(s.substring(i)); if (num.digits === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.scale = num.value; break; case "sep": // TODO-PER: This actually goes into the stream, it is not global tune.formatting.sep = s.substring(i); break; case "score": case "indent": case "voicefont": case "titlefont": case "barlabelfont": case "barnumfont": case "barnumberfont": case "barnumbers": case "topmargin": case "botmargin": case "topspace": case "titlespace": case "subtitlespace": case "composerspace": case "musicspace": case "partsspace": case "wordsspace": case "textspace": case "vocalspace": case "staffsep": case "linesep": case "midi": case "titlecaps": case "titlefont": case "composerfont": case "indent": case "playtempo": case "auquality": case "text": case "begintext": case "endtext": case "vocalfont": case "systemsep": case "sysstaffsep": case "landscape": case "gchordfont": case "leftmargin": case "partsfont": case "staves": case "slurgraces": case "titleleft": case "subtitlefont": case "tempofont": case "continuous": case "botspace": case "nobarcheck": // TODO-PER: Actually handle the parameters of these tune.formatting[cmd] = s.substring(i); break; default: return "Unknown directive: " + cmd; break; } return null; };
case "barnumbers":
var addDirective = function(str) { var s = tokenizer.stripComment(str).strip(); if (s.length === 0) // 3 or more % in a row, or just spaces after %% is just a comment return null; var i = s.indexOf(' '); var cmd = (i > 0) ? s.substring(0, i) : s; var num; cmd = cmd.toLowerCase(); switch (cmd) { case "bagpipes":tune.formatting.bagpipes = true;break; case "stretchlast":tune.formatting.stretchlast = true;break; case "staffwidth": num = tokenizer.getInt(s.substring(i)); if (num.digits === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.staffwidth = num.value; break; case "scale": num = tokenizer.getFloat(s.substring(i)); if (num.digits === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.scale = num.value; break; case "sep": // TODO-PER: This actually goes into the stream, it is not global tune.formatting.sep = s.substring(i); break; case "score": case "indent": case "voicefont": case "titlefont": case "barlabelfont": case "barnumfont": case "barnumberfont": case "barnumbers": case "topmargin": case "botmargin": case "topspace": case "titlespace": case "subtitlespace": case "composerspace": case "musicspace": case "partsspace": case "wordsspace": case "textspace": case "vocalspace": case "staffsep": case "linesep": case "midi": case "titlecaps": case "titlefont": case "composerfont": case "indent": case "playtempo": case "auquality": case "text": case "begintext": case "endtext": case "vocalfont": case "systemsep": case "sysstaffsep": case "landscape": case "gchordfont": case "leftmargin": case "partsfont": case "staves": case "slurgraces": case "titleleft": case "subtitlefont": case "tempofont": case "continuous": case "botspace": case "nobarcheck": // TODO-PER: Actually handle the parameters of these tune.formatting[cmd] = s.substring(i); break; default: return "Unknown directive: " + cmd; break; } return null; };
case "text": case "begintext": case "endtext": case "vocalfont":
var addDirective = function(str) { var s = tokenizer.stripComment(str).strip(); if (s.length === 0) // 3 or more % in a row, or just spaces after %% is just a comment return null; var i = s.indexOf(' '); var cmd = (i > 0) ? s.substring(0, i) : s; var num; cmd = cmd.toLowerCase(); switch (cmd) { case "bagpipes":tune.formatting.bagpipes = true;break; case "stretchlast":tune.formatting.stretchlast = true;break; case "staffwidth": num = tokenizer.getInt(s.substring(i)); if (num.digits === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.staffwidth = num.value; break; case "scale": num = tokenizer.getFloat(s.substring(i)); if (num.digits === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.scale = num.value; break; case "sep": // TODO-PER: This actually goes into the stream, it is not global tune.formatting.sep = s.substring(i); break; case "score": case "indent": case "voicefont": case "titlefont": case "barlabelfont": case "barnumfont": case "barnumberfont": case "barnumbers": case "topmargin": case "botmargin": case "topspace": case "titlespace": case "subtitlespace": case "composerspace": case "musicspace": case "partsspace": case "wordsspace": case "textspace": case "vocalspace": case "staffsep": case "linesep": case "midi": case "titlecaps": case "titlefont": case "composerfont": case "indent": case "playtempo": case "auquality": case "text": case "begintext": case "endtext": case "vocalfont": case "systemsep": case "sysstaffsep": case "landscape": case "gchordfont": case "leftmargin": case "partsfont": case "staves": case "slurgraces": case "titleleft": case "subtitlefont": case "tempofont": case "continuous": case "botspace": case "nobarcheck": // TODO-PER: Actually handle the parameters of these tune.formatting[cmd] = s.substring(i); break; default: return "Unknown directive: " + cmd; break; } return null; };
tune.formatting[cmd] = s.substring(i);
tune.formatting[cmd] = restOfString;
var addDirective = function(str) { var s = tokenizer.stripComment(str).strip(); if (s.length === 0) // 3 or more % in a row, or just spaces after %% is just a comment return null; var i = s.indexOf(' '); var cmd = (i > 0) ? s.substring(0, i) : s; var num; cmd = cmd.toLowerCase(); switch (cmd) { case "bagpipes":tune.formatting.bagpipes = true;break; case "stretchlast":tune.formatting.stretchlast = true;break; case "staffwidth": num = tokenizer.getInt(s.substring(i)); if (num.digits === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.staffwidth = num.value; break; case "scale": num = tokenizer.getFloat(s.substring(i)); if (num.digits === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.scale = num.value; break; case "sep": // TODO-PER: This actually goes into the stream, it is not global tune.formatting.sep = s.substring(i); break; case "score": case "indent": case "voicefont": case "titlefont": case "barlabelfont": case "barnumfont": case "barnumberfont": case "barnumbers": case "topmargin": case "botmargin": case "topspace": case "titlespace": case "subtitlespace": case "composerspace": case "musicspace": case "partsspace": case "wordsspace": case "textspace": case "vocalspace": case "staffsep": case "linesep": case "midi": case "titlecaps": case "titlefont": case "composerfont": case "indent": case "playtempo": case "auquality": case "text": case "begintext": case "endtext": case "vocalfont": case "systemsep": case "sysstaffsep": case "landscape": case "gchordfont": case "leftmargin": case "partsfont": case "staves": case "slurgraces": case "titleleft": case "subtitlefont": case "tempofont": case "continuous": case "botspace": case "nobarcheck": // TODO-PER: Actually handle the parameters of these tune.formatting[cmd] = s.substring(i); break; default: return "Unknown directive: " + cmd; break; } return null; };
var restOfString = str.substring(str.indexOf(tokens[0]));
var restOfString = str.substring(str.indexOf(tokens[0].token)+tokens[0].token.length); restOfString = tokenizer.stripComment(restOfString);
var addDirective = function(str) { var tokens = tokenizer.tokenize(str, 0, str.length); // 3 or more % in a row, or just spaces after %% is just a comment if (tokens.length === 0 || tokens[0].type !== 'alpha') return null; var restOfString = str.substring(str.indexOf(tokens[0])); var cmd = tokens.shift().token.toLowerCase();// var s = tokenizer.stripComment(str).strip();// if (s.length === 0) // 3 or more % in a row, or just spaces after %% is just a comment// return null;// var i = s.indexOf(' ');// var cmd = (i > 0) ? s.substring(0, i) : s; var num; var scratch = "";// cmd = cmd.toLowerCase(); switch (cmd) { case "bagpipes":tune.formatting.bagpipes = true;break; case "stretchlast":tune.formatting.stretchlast = true;break; case "staffwidth": if (tokens.length !== 1 || tokens[0].type != 'number') return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.staffwidth = parseInt(tokens[0].token); break; case "scale": scratch = ""; tokens.each(function(tok) { scratch += tok.token; }); num = parseFloat(scratch); if (isNaN(num) || num === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.scale = num; break; case "sep": // TODO-PER: This actually goes into the stream, it is not global if (tokens.length === 0) return "Directive \"" + cmd + "\" requires a string as a parameter."; tune.formatting.sep = tokens[0].token; break; case "barnumbers": if (tokens.length !== 1 || tokens[0].type != 'number') return "Directive \"" + cmd + "\" requires a number as a parameter."; multilineVars.barNumbers = tokens[0].token; break; case "begintext": multilineVars.inTextBlock = true; break; case "text": tune.addText(tokenizer.translateString(restOfString)); // display secondary title break; case "vocalfont": multilineVars.fontVocal = {}; var token = tokens.last(); if (token.type === 'number') { multilineVars.fontVocal.size = parseInt(token.token); tokens.pop(); } if (tokens.length > 0) { scratch = ""; tokens.each(function(tok) { if (tok.token === '-') scratch += ' '; else scratch += tok.token; }); multilineVars.fontVocal.font = scratch; } break; case "score": case "indent": case "voicefont": case "titlefont": case "barlabelfont": case "barnumfont": case "barnumberfont": case "topmargin": case "botmargin": case "topspace": case "titlespace": case "subtitlespace": case "composerspace": case "musicspace": case "partsspace": case "wordsspace": case "textspace": case "vocalspace": case "staffsep": case "linesep": case "midi": case "titlecaps": case "titlefont": case "composerfont": case "indent": case "playtempo": case "auquality": case "systemsep": case "sysstaffsep": case "landscape": case "gchordfont": case "leftmargin": case "partsfont": case "staves": case "slurgraces": case "titleleft": case "subtitlefont": case "tempofont": case "continuous": case "botspace": case "nobarcheck": // TODO-PER: Actually handle the parameters of these tune.formatting[cmd] = restOfString; break; default: return "Unknown directive: " + cmd; break; } return null; };
if (tokens.length !== 1 || tokens[0].type != 'number') return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.staffwidth = parseInt(tokens[0].token);
scratch = tokenizer.getMeasurement(tokens); if (scratch.used === 0 || tokens.length !== 0) return "Directive \"" + cmd + "\" requires a measurement as a parameter."; tune.formatting.staffwidth = scratch.value;
var addDirective = function(str) { var tokens = tokenizer.tokenize(str, 0, str.length); // 3 or more % in a row, or just spaces after %% is just a comment if (tokens.length === 0 || tokens[0].type !== 'alpha') return null; var restOfString = str.substring(str.indexOf(tokens[0])); var cmd = tokens.shift().token.toLowerCase();// var s = tokenizer.stripComment(str).strip();// if (s.length === 0) // 3 or more % in a row, or just spaces after %% is just a comment// return null;// var i = s.indexOf(' ');// var cmd = (i > 0) ? s.substring(0, i) : s; var num; var scratch = "";// cmd = cmd.toLowerCase(); switch (cmd) { case "bagpipes":tune.formatting.bagpipes = true;break; case "stretchlast":tune.formatting.stretchlast = true;break; case "staffwidth": if (tokens.length !== 1 || tokens[0].type != 'number') return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.staffwidth = parseInt(tokens[0].token); break; case "scale": scratch = ""; tokens.each(function(tok) { scratch += tok.token; }); num = parseFloat(scratch); if (isNaN(num) || num === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.scale = num; break; case "sep": // TODO-PER: This actually goes into the stream, it is not global if (tokens.length === 0) return "Directive \"" + cmd + "\" requires a string as a parameter."; tune.formatting.sep = tokens[0].token; break; case "barnumbers": if (tokens.length !== 1 || tokens[0].type != 'number') return "Directive \"" + cmd + "\" requires a number as a parameter."; multilineVars.barNumbers = tokens[0].token; break; case "begintext": multilineVars.inTextBlock = true; break; case "text": tune.addText(tokenizer.translateString(restOfString)); // display secondary title break; case "vocalfont": multilineVars.fontVocal = {}; var token = tokens.last(); if (token.type === 'number') { multilineVars.fontVocal.size = parseInt(token.token); tokens.pop(); } if (tokens.length > 0) { scratch = ""; tokens.each(function(tok) { if (tok.token === '-') scratch += ' '; else scratch += tok.token; }); multilineVars.fontVocal.font = scratch; } break; case "score": case "indent": case "voicefont": case "titlefont": case "barlabelfont": case "barnumfont": case "barnumberfont": case "topmargin": case "botmargin": case "topspace": case "titlespace": case "subtitlespace": case "composerspace": case "musicspace": case "partsspace": case "wordsspace": case "textspace": case "vocalspace": case "staffsep": case "linesep": case "midi": case "titlecaps": case "titlefont": case "composerfont": case "indent": case "playtempo": case "auquality": case "systemsep": case "sysstaffsep": case "landscape": case "gchordfont": case "leftmargin": case "partsfont": case "staves": case "slurgraces": case "titleleft": case "subtitlefont": case "tempofont": case "continuous": case "botspace": case "nobarcheck": // TODO-PER: Actually handle the parameters of these tune.formatting[cmd] = restOfString; break; default: return "Unknown directive: " + cmd; break; } return null; };
return "Directive \"" + cmd + "\" requires a string as a parameter."; tune.formatting.sep = tokens[0].token;
tune.addSeparator(); else { if (tokens.length !== 3 || tokens[0].type !== 'number' || tokens[1].type !== 'number' || tokens[2].type !== 'number') return "Directive \"" + cmd + "\" requires 3 numbers: space above, space below, length of line"; tune.addSeparator(parseInt(tokens[0].token), parseInt(tokens[1].token), parseInt(tokens[2].token)); }
var addDirective = function(str) { var tokens = tokenizer.tokenize(str, 0, str.length); // 3 or more % in a row, or just spaces after %% is just a comment if (tokens.length === 0 || tokens[0].type !== 'alpha') return null; var restOfString = str.substring(str.indexOf(tokens[0])); var cmd = tokens.shift().token.toLowerCase();// var s = tokenizer.stripComment(str).strip();// if (s.length === 0) // 3 or more % in a row, or just spaces after %% is just a comment// return null;// var i = s.indexOf(' ');// var cmd = (i > 0) ? s.substring(0, i) : s; var num; var scratch = "";// cmd = cmd.toLowerCase(); switch (cmd) { case "bagpipes":tune.formatting.bagpipes = true;break; case "stretchlast":tune.formatting.stretchlast = true;break; case "staffwidth": if (tokens.length !== 1 || tokens[0].type != 'number') return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.staffwidth = parseInt(tokens[0].token); break; case "scale": scratch = ""; tokens.each(function(tok) { scratch += tok.token; }); num = parseFloat(scratch); if (isNaN(num) || num === 0) return "Directive \"" + cmd + "\" requires a number as a parameter."; tune.formatting.scale = num; break; case "sep": // TODO-PER: This actually goes into the stream, it is not global if (tokens.length === 0) return "Directive \"" + cmd + "\" requires a string as a parameter."; tune.formatting.sep = tokens[0].token; break; case "barnumbers": if (tokens.length !== 1 || tokens[0].type != 'number') return "Directive \"" + cmd + "\" requires a number as a parameter."; multilineVars.barNumbers = tokens[0].token; break; case "begintext": multilineVars.inTextBlock = true; break; case "text": tune.addText(tokenizer.translateString(restOfString)); // display secondary title break; case "vocalfont": multilineVars.fontVocal = {}; var token = tokens.last(); if (token.type === 'number') { multilineVars.fontVocal.size = parseInt(token.token); tokens.pop(); } if (tokens.length > 0) { scratch = ""; tokens.each(function(tok) { if (tok.token === '-') scratch += ' '; else scratch += tok.token; }); multilineVars.fontVocal.font = scratch; } break; case "score": case "indent": case "voicefont": case "titlefont": case "barlabelfont": case "barnumfont": case "barnumberfont": case "topmargin": case "botmargin": case "topspace": case "titlespace": case "subtitlespace": case "composerspace": case "musicspace": case "partsspace": case "wordsspace": case "textspace": case "vocalspace": case "staffsep": case "linesep": case "midi": case "titlecaps": case "titlefont": case "composerfont": case "indent": case "playtempo": case "auquality": case "systemsep": case "sysstaffsep": case "landscape": case "gchordfont": case "leftmargin": case "partsfont": case "staves": case "slurgraces": case "titleleft": case "subtitlefont": case "tempofont": case "continuous": case "botspace": case "nobarcheck": // TODO-PER: Actually handle the parameters of these tune.formatting[cmd] = restOfString; break; default: return "Unknown directive: " + cmd; break; } return null; };