rem
stringlengths
0
126k
add
stringlengths
0
441k
context
stringlengths
13
136k
meta
stringlengths
132
347
Calendar=function(d,c,f,a){this.activeDiv=null;this.currentDateEl=null;this.getDateStatus=null;this.getDateToolTip=null;this.getDateText=null;this.timeout=null;this.onSelected=f||null;this.onClose=a||null;this.dragging=false;this.hidden=false;this.minYear=1970;this.maxYear=2050;this.dateFormat=Calendar._TT.DEF_DATE_FORMAT;this.ttDateFormat=Calendar._TT.TT_DATE_FORMAT;this.isPopup=true;this.weekNumbers=true;this.firstDayOfWeek=typeof d=="number"?d:Calendar._FD;this.showsOtherMonths=false;this.dateStr=c;this.ar_days=null;this.showsTime=false;this.time24=true;this.yearStep=2;this.hiliteToday=true;this.multiple=null;this.table=null;this.element=null;this.tbody=null;this.firstdayname=null;this.monthsCombo=null;this.yearsCombo=null;this.hilitedMonth=null;this.activeMonth=null;this.hilitedYear=null;this.activeYear=null;this.dateClicked=false;if(typeof Calendar._SDN=="undefined"){if(typeof Calendar._SDN_len=="undefined"){Calendar._SDN_len=3}var b=new Array();for(var e=8;e>0;){b[--e]=Calendar._DN[e].substr(0,Calendar._SDN_len)}Calendar._SDN=b;if(typeof Calendar._SMN_len=="undefined"){Calendar._SMN_len=3}b=new Array();for(var e=12;e>0;){b[--e]=Calendar._MN[e].substr(0,Calendar._SMN_len)}Calendar._SMN=b}};Calendar._C=null;Calendar.is_ie=(/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent));Calendar.is_ie5=(Calendar.is_ie&&/msie 5\.0/i.test(navigator.userAgent));Calendar.is_opera=/opera/i.test(navigator.userAgent);Calendar.is_khtml=/Konqueror|Safari|KHTML/i.test(navigator.userAgent);Calendar.getAbsolutePos=function(e){var a=0,d=0;var c=/^div$/i.test(e.tagName);if(c&&e.scrollLeft){a=e.scrollLeft}if(c&&e.scrollTop){d=e.scrollTop}var f={x:e.offsetLeft-a,y:e.offsetTop-d};if(e.offsetParent){var b=this.getAbsolutePos(e.offsetParent);f.x+=b.x;f.y+=b.y}return f};Calendar.isRelated=function(c,a){var d=a.relatedTarget;if(!d){var b=a.type;if(b=="mouseover"){d=a.fromElement}else{if(b=="mouseout"){d=a.toElement}}}while(d){if(d==c){return true}d=d.parentNode}return false};Calendar.removeClass=function(e,d){if(!(e&&e.className)){return}var a=e.className.split(" ");var b=new Array();for(var c=a.length;c>0;){if(a[--c]!=d){b[b.length]=a[c]}}e.className=b.join(" ")};Calendar.addClass=function(b,a){Calendar.removeClass(b,a);b.className+=" "+a};Calendar.getElement=function(a){var b=Calendar.is_ie?window.event.srcElement:a.currentTarget;while(b.nodeType!=1||/^div$/i.test(b.tagName)){b=b.parentNode}return b};Calendar.getTargetElement=function(a){var b=Calendar.is_ie?window.event.srcElement:a.target;while(b.nodeType!=1){b=b.parentNode}return b};Calendar.stopEvent=function(a){a||(a=window.event);if(Calendar.is_ie){a.cancelBubble=true;a.returnValue=false}else{a.preventDefault();a.stopPropagation()}return false};Calendar.addEvent=function(a,c,b){if(a.attachEvent){a.attachEvent("on"+c,b)}else{if(a.addEventListener){a.addEventListener(c,b,true)}else{a["on"+c]=b}}};Calendar.removeEvent=function(a,c,b){if(a.detachEvent){a.detachEvent("on"+c,b)}else{if(a.removeEventListener){a.removeEventListener(c,b,true)}else{a["on"+c]=null}}};Calendar.createElement=function(c,b){var a=null;if(document.createElementNS){a=document.createElementNS("http:
Calendar=function(d,c,f,a){this.activeDiv=null;this.currentDateEl=null;this.getDateStatus=null;this.getDateToolTip=null;this.getDateText=null;this.timeout=null;this.onSelected=f||null;this.onClose=a||null;this.dragging=false;this.hidden=false;this.minYear=1970;this.maxYear=2050;this.dateFormat=Calendar._TT.DEF_DATE_FORMAT;this.ttDateFormat=Calendar._TT.TT_DATE_FORMAT;this.isPopup=true;this.weekNumbers=true;this.firstDayOfWeek=typeof d=="number"?d:Calendar._FD;this.showsOtherMonths=false;this.dateStr=c;this.ar_days=null;this.showsTime=false;this.time24=true;this.yearStep=2;this.hiliteToday=true;this.multiple=null;this.table=null;this.element=null;this.tbody=null;this.firstdayname=null;this.monthsCombo=null;this.yearsCombo=null;this.hilitedMonth=null;this.activeMonth=null;this.hilitedYear=null;this.activeYear=null;this.dateClicked=false;if(typeof Calendar._SDN=="undefined"){if(typeof Calendar._SDN_len=="undefined"){Calendar._SDN_len=3}var b=new Array();for(var e=8;e>0;){b[--e]=Calendar._DN[e].substr(0,Calendar._SDN_len)}Calendar._SDN=b;if(typeof Calendar._SMN_len=="undefined"){Calendar._SMN_len=3}b=new Array();for(var e=12;e>0;){b[--e]=Calendar._MN[e].substr(0,Calendar._SMN_len)}Calendar._SMN=b}};Calendar._C=null;Calendar.is_ie=(/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent));Calendar.is_ie5=(Calendar.is_ie&&/msie 5\.0/i.test(navigator.userAgent));Calendar.is_opera=/opera/i.test(navigator.userAgent);Calendar.is_khtml=/Konqueror|Safari|KHTML/i.test(navigator.userAgent);Calendar.getAbsolutePos=function(e){var a=0,d=0;var c=/^div$/i.test(e.tagName);if(c&&e.scrollLeft){a=e.scrollLeft}if(c&&e.scrollTop){d=e.scrollTop}var f={x:e.offsetLeft-a,y:e.offsetTop-d};if(e.offsetParent){var b=this.getAbsolutePos(e.offsetParent);f.x+=b.x;f.y+=b.y}return f};Calendar.isRelated=function(c,a){var d=a.relatedTarget;if(!d){var b=a.type;if(b=="mouseover"){d=a.fromElement}else{if(b=="mouseout"){d=a.toElement}}}while(d){if(d==c){return true}d=d.parentNode}return false};Calendar.removeClass=function(e,d){if(!(e&&e.className)){return}var a=e.className.split(" ");var b=new Array();for(var c=a.length;c>0;){if(a[--c]!=d){b[b.length]=a[c]}}e.className=b.join(" ")};Calendar.addClass=function(b,a){Calendar.removeClass(b,a);b.className+=" "+a};Calendar.getElement=function(a){var b=Calendar.is_ie?window.event.srcElement:a.currentTarget;while(b.nodeType!=1||/^div$/i.test(b.tagName)){b=b.parentNode}return b};Calendar.getTargetElement=function(a){var b=Calendar.is_ie?window.event.srcElement:a.target;while(b.nodeType!=1){b=b.parentNode}return b};Calendar.stopEvent=function(a){a||(a=window.event);if(Calendar.is_ie){a.cancelBubble=true;a.returnValue=false}else{a.preventDefault();a.stopPropagation()}return false};Calendar.addEvent=function(a,c,b){if(a.attachEvent){a.attachEvent("on"+c,b)}else{if(a.addEventListener){a.addEventListener(c,b,true)}else{a["on"+c]=b}}};Calendar.removeEvent=function(a,c,b){if(a.detachEvent){a.detachEvent("on"+c,b)}else{if(a.removeEventListener){a.removeEventListener(c,b,true)}else{a["on"+c]=null}}};Calendar.createElement=function(c,b){var a=null;if(document.createElementNS){a=document.createElementNS("http:
Calendar=function(d,c,f,a){this.activeDiv=null;this.currentDateEl=null;this.getDateStatus=null;this.getDateToolTip=null;this.getDateText=null;this.timeout=null;this.onSelected=f||null;this.onClose=a||null;this.dragging=false;this.hidden=false;this.minYear=1970;this.maxYear=2050;this.dateFormat=Calendar._TT.DEF_DATE_FORMAT;this.ttDateFormat=Calendar._TT.TT_DATE_FORMAT;this.isPopup=true;this.weekNumbers=true;this.firstDayOfWeek=typeof d=="number"?d:Calendar._FD;this.showsOtherMonths=false;this.dateStr=c;this.ar_days=null;this.showsTime=false;this.time24=true;this.yearStep=2;this.hiliteToday=true;this.multiple=null;this.table=null;this.element=null;this.tbody=null;this.firstdayname=null;this.monthsCombo=null;this.yearsCombo=null;this.hilitedMonth=null;this.activeMonth=null;this.hilitedYear=null;this.activeYear=null;this.dateClicked=false;if(typeof Calendar._SDN=="undefined"){if(typeof Calendar._SDN_len=="undefined"){Calendar._SDN_len=3}var b=new Array();for(var e=8;e>0;){b[--e]=Calendar._DN[e].substr(0,Calendar._SDN_len)}Calendar._SDN=b;if(typeof Calendar._SMN_len=="undefined"){Calendar._SMN_len=3}b=new Array();for(var e=12;e>0;){b[--e]=Calendar._MN[e].substr(0,Calendar._SMN_len)}Calendar._SMN=b}};Calendar._C=null;Calendar.is_ie=(/msie/i.test(navigator.userAgent)&&!/opera/i.test(navigator.userAgent));Calendar.is_ie5=(Calendar.is_ie&&/msie 5\.0/i.test(navigator.userAgent));Calendar.is_opera=/opera/i.test(navigator.userAgent);Calendar.is_khtml=/Konqueror|Safari|KHTML/i.test(navigator.userAgent);Calendar.getAbsolutePos=function(e){var a=0,d=0;var c=/^div$/i.test(e.tagName);if(c&&e.scrollLeft){a=e.scrollLeft}if(c&&e.scrollTop){d=e.scrollTop}var f={x:e.offsetLeft-a,y:e.offsetTop-d};if(e.offsetParent){var b=this.getAbsolutePos(e.offsetParent);f.x+=b.x;f.y+=b.y}return f};Calendar.isRelated=function(c,a){var d=a.relatedTarget;if(!d){var b=a.type;if(b=="mouseover"){d=a.fromElement}else{if(b=="mouseout"){d=a.toElement}}}while(d){if(d==c){return true}d=d.parentNode}return false};Calendar.removeClass=function(e,d){if(!(e&&e.className)){return}var a=e.className.split(" ");var b=new Array();for(var c=a.length;c>0;){if(a[--c]!=d){b[b.length]=a[c]}}e.className=b.join(" ")};Calendar.addClass=function(b,a){Calendar.removeClass(b,a);b.className+=" "+a};Calendar.getElement=function(a){var b=Calendar.is_ie?window.event.srcElement:a.currentTarget;while(b.nodeType!=1||/^div$/i.test(b.tagName)){b=b.parentNode}return b};Calendar.getTargetElement=function(a){var b=Calendar.is_ie?window.event.srcElement:a.target;while(b.nodeType!=1){b=b.parentNode}return b};Calendar.stopEvent=function(a){a||(a=window.event);if(Calendar.is_ie){a.cancelBubble=true;a.returnValue=false}else{a.preventDefault();a.stopPropagation()}return false};Calendar.addEvent=function(a,c,b){if(a.attachEvent){a.attachEvent("on"+c,b)}else{if(a.addEventListener){a.addEventListener(c,b,true)}else{a["on"+c]=b}}};Calendar.removeEvent=function(a,c,b){if(a.detachEvent){a.detachEvent("on"+c,b)}else{if(a.removeEventListener){a.removeEventListener(c,b,true)}else{a["on"+c]=null}}};Calendar.createElement=function(c,b){var a=null;if(document.createElementNS){a=document.createElementNS("http://www.w3.org/1999/xhtml",c)}else{a=document.createElement(c)}if(typeof b!="undefined"){b.appendChild(a)}return a};Calendar._add_evs=function(el){with(Calendar){addEvent(el,"mouseover",dayMouseOver);addEvent(el,"mousedown",dayMouseDown);addEvent(el,"mouseout",dayMouseOut);if(is_ie){addEvent(el,"dblclick",dayMouseDblClick);el.setAttribute("unselectable",true)}}};Calendar.findMonth=function(a){if(typeof a.month!="undefined"){return a}else{if(typeof a.parentNode.month!="undefined"){return a.parentNode}}return null};Calendar.findYear=function(a){if(typeof a.year!="undefined"){return a}else{if(typeof a.parentNode.year!="undefined"){return a.parentNode}}return null};Calendar.showMonthsCombo=function(){var e=Calendar._C;if(!e){return false}var e=e;var f=e.activeDiv;var d=e.monthsCombo;if(e.hilitedMonth){Calendar.removeClass(e.hilitedMonth,"hilite")}if(e.activeMonth){Calendar.removeClass(e.activeMonth,"active")}var c=e.monthsCombo.getElementsByTagName("div")[e.date.getMonth()];Calendar.addClass(c,"active");e.activeMonth=c;var b=d.style;b.display="block";if(f.navtype<0){b.left=f.offsetLeft+"px"}else{var a=d.offsetWidth;if(typeof a=="undefined"){a=50}b.left=(f.offsetLeft+f.offsetWidth-a)+"px"}b.top=(f.offsetTop+f.offsetHeight)+"px"};Calendar.showYearsCombo=function(d){var a=Calendar._C;if(!a){return false}var a=a;var c=a.activeDiv;var f=a.yearsCombo;if(a.hilitedYear){Calendar.removeClass(a.hilitedYear,"hilite")}if(a.activeYear){Calendar.removeClass(a.activeYear,"active")}a.activeYear=null;var b=a.date.getFullYear()+(d?1:-1);var j=f.firstChild;var h=false;for(var e=12;e>0;--e){if(b>=a.minYear&&b<=a.maxYear){j.innerHTML=b;j.year=b;j.style.display="block";h=true}else{j.style.display="none"}j=j.nextSibling;b+=d?a.yearStep:-a.yearStep}if(h){var k=f.style;k.display="block";if(c.navtype<0){k.left=c.offsetLeft+"px"}else{var g=f.offsetWidth;if(typeof g=="undefined"){g=50}k.left=(c.offsetLeft+c.offsetWidth-g)+"px"}k.top=(c.offsetTop+c.offsetHeight)+"px"}};Calendar.tableMouseUp=function(ev){var cal=Calendar._C;if(!cal){return false}if(cal.timeout){clearTimeout(cal.timeout)}var el=cal.activeDiv;if(!el){return false}var target=Calendar.getTargetElement(ev);ev||(ev=window.event);Calendar.removeClass(el,"active");if(target==el||target.parentNode==el){Calendar.cellClick(el,ev)}var mon=Calendar.findMonth(target);var date=null;if(mon){date=new Date(cal.date);if(mon.month!=date.getMonth()){date.setMonth(mon.month);cal.setDate(date);cal.dateClicked=false;cal.callHandler()}}else{var year=Calendar.findYear(target);if(year){date=new Date(cal.date);if(year.year!=date.getFullYear()){date.setFullYear(year.year);cal.setDate(date);cal.dateClicked=false;cal.callHandler()}}}with(Calendar){removeEvent(document,"mouseup",tableMouseUp);removeEvent(document,"mouseover",tableMouseOver);removeEvent(document,"mousemove",tableMouseOver);cal._hideCombos();_C=null;return stopEvent(ev)}};Calendar.tableMouseOver=function(n){var a=Calendar._C;if(!a){return}var c=a.activeDiv;var j=Calendar.getTargetElement(n);if(j==c||j.parentNode==c){Calendar.addClass(c,"hilite active");Calendar.addClass(c.parentNode,"rowhilite")}else{if(typeof c.navtype=="undefined"||(c.navtype!=50&&(c.navtype==0||Math.abs(c.navtype)>2))){Calendar.removeClass(c,"active")}Calendar.removeClass(c,"hilite");Calendar.removeClass(c.parentNode,"rowhilite")}n||(n=window.event);if(c.navtype==50&&j!=c){var m=Calendar.getAbsolutePos(c);var p=c.offsetWidth;var o=n.clientX;var q;var l=true;if(o>m.x+p){q=o-m.x-p;l=false}else{q=m.x-o}if(q<0){q=0}var f=c._range;var h=c._current;var g=Math.floor(q/10)%f.length;for(var e=f.length;--e>=0;){if(f[e]==h){break}}while(g-->0){if(l){if(--e<0){e=f.length-1}}else{if(++e>=f.length){e=0}}}var b=f[e];c.innerHTML=b;a.onUpdateTime()}var d=Calendar.findMonth(j);if(d){if(d.month!=a.date.getMonth()){if(a.hilitedMonth){Calendar.removeClass(a.hilitedMonth,"hilite")}Calendar.addClass(d,"hilite");a.hilitedMonth=d}else{if(a.hilitedMonth){Calendar.removeClass(a.hilitedMonth,"hilite")}}}else{if(a.hilitedMonth){Calendar.removeClass(a.hilitedMonth,"hilite")}var k=Calendar.findYear(j);if(k){if(k.year!=a.date.getFullYear()){if(a.hilitedYear){Calendar.removeClass(a.hilitedYear,"hilite")}Calendar.addClass(k,"hilite");a.hilitedYear=k}else{if(a.hilitedYear){Calendar.removeClass(a.hilitedYear,"hilite")}}}else{if(a.hilitedYear){Calendar.removeClass(a.hilitedYear,"hilite")}}}return Calendar.stopEvent(n)};Calendar.tableMouseDown=function(a){if(Calendar.getTargetElement(a)==Calendar.getElement(a)){return Calendar.stopEvent(a)}};Calendar.calDragIt=function(b){var c=Calendar._C;if(!(c&&c.dragging)){return false}var e;var d;if(Calendar.is_ie){d=window.event.clientY+document.body.scrollTop;e=window.event.clientX+document.body.scrollLeft}else{e=b.pageX;d=b.pageY}c.hideShowCovered();var a=c.element.style;a.left=(e-c.xOffs)+"px";a.top=(d-c.yOffs)+"px";return Calendar.stopEvent(b)};Calendar.calDragEnd=function(ev){var cal=Calendar._C;if(!cal){return false}cal.dragging=false;with(Calendar){removeEvent(document,"mousemove",calDragIt);removeEvent(document,"mouseup",calDragEnd);tableMouseUp(ev)}cal.hideShowCovered()};Calendar.dayMouseDown=function(ev){var el=Calendar.getElement(ev);if(el.disabled){return false}var cal=el.calendar;cal.activeDiv=el;Calendar._C=cal;if(el.navtype!=300){with(Calendar){if(el.navtype==50){el._current=el.innerHTML;addEvent(document,"mousemove",tableMouseOver)}else{addEvent(document,Calendar.is_ie5?"mousemove":"mouseover",tableMouseOver)}addClass(el,"hilite active");addEvent(document,"mouseup",tableMouseUp)}}else{if(cal.isPopup){cal._dragStart(ev)}}if(el.navtype==-1||el.navtype==1){if(cal.timeout){clearTimeout(cal.timeout)}cal.timeout=setTimeout("Calendar.showMonthsCombo()",250)}else{if(el.navtype==-2||el.navtype==2){if(cal.timeout){clearTimeout(cal.timeout)}cal.timeout=setTimeout((el.navtype>0)?"Calendar.showYearsCombo(true)":"Calendar.showYearsCombo(false)",250)}else{cal.timeout=null}}return Calendar.stopEvent(ev)};Calendar.dayMouseDblClick=function(a){Calendar.cellClick(Calendar.getElement(a),a||window.event);if(Calendar.is_ie){document.selection.empty()}};Calendar.dayMouseOver=function(b){var a=Calendar.getElement(b);if(Calendar.isRelated(a,b)||Calendar._C||a.disabled){return false}if(a.ttip){if(a.ttip.substr(0,1)=="_"){a.ttip=a.caldate.print(a.calendar.ttDateFormat)+a.ttip.substr(1)}a.calendar.tooltips.innerHTML=a.ttip}if(a.navtype!=300){Calendar.addClass(a,"hilite");if(a.caldate){Calendar.addClass(a.parentNode,"rowhilite")}}return Calendar.stopEvent(b)};Calendar.dayMouseOut=function(ev){with(Calendar){var el=getElement(ev);if(isRelated(el,ev)||_C||el.disabled){return false}removeClass(el,"hilite");if(el.caldate){removeClass(el.parentNode,"rowhilite")}if(el.calendar){el.calendar.tooltips.innerHTML=_TT.SEL_DATE}return stopEvent(ev)}};Calendar.cellClick=function(e,o){var c=e.calendar;var h=false;var l=false;var f=null;if(typeof e.navtype=="undefined"){if(c.currentDateEl){Calendar.removeClass(c.currentDateEl,"selected");Calendar.addClass(e,"selected");h=(c.currentDateEl==e);if(!h){c.currentDateEl=e}}c.date.setDateOnly(e.caldate);f=c.date;var b=!(c.dateClicked=!e.otherMonth);if(!b&&!c.currentDateEl){c._toggleMultipleDate(new Date(f))}else{l=!e.disabled}if(b){c._init(c.firstDayOfWeek,f)}}else{if(e.navtype==200){Calendar.removeClass(e,"hilite");c.callCloseHandler();return}f=new Date(c.date);if(e.navtype==0){f.setDateOnly(new Date())}c.dateClicked=false;var n=f.getFullYear();var g=f.getMonth();function a(q){var r=f.getDate();var i=f.getMonthDays(q);if(r>i){f.setDate(i)}f.setMonth(q)}switch(e.navtype){case 400:Calendar.removeClass(e,"hilite");var p=Calendar._TT.ABOUT;if(typeof p!="undefined"){p+=c.showsTime?Calendar._TT.ABOUT_TIME:""}else{p='Help and about box text is not translated into this language.\nIf you know this language and you feel generous please update\nthe corresponding file in "lang" subdir to match calendar-en.js\nand send it back to <[email protected]> to get it into the distribution ;-)\n\nThank you!\nhttp://dynarch.com/mishoo/calendar.epl\n'}alert(p);return;case -2:if(n>c.minYear){f.setFullYear(n-1)}break;case -1:if(g>0){a(g-1)}else{if(n-->c.minYear){f.setFullYear(n);a(11)}}break;case 1:if(g<11){a(g+1)}else{if(n<c.maxYear){f.setFullYear(n+1);a(0)}}break;case 2:if(n<c.maxYear){f.setFullYear(n+1)}break;case 100:c.setFirstDayOfWeek(e.fdow);return;case 50:var k=e._range;var m=e.innerHTML;for(var j=k.length;--j>=0;){if(k[j]==m){break}}if(o&&o.shiftKey){if(--j<0){j=k.length-1}}else{if(++j>=k.length){j=0}}var d=k[j];e.innerHTML=d;c.onUpdateTime();return;case 0:if((typeof c.getDateStatus=="function")&&c.getDateStatus(f,f.getFullYear(),f.getMonth(),f.getDate())){return false}break}if(!f.equalsTo(c.date)){c.setDate(f);l=true}else{if(e.navtype==0){l=h=true}}}if(l){o&&c.callHandler()}if(h){Calendar.removeClass(e,"hilite");o&&c.callCloseHandler()}};Calendar.prototype.create=function(n){var m=null;if(!n){m=document.getElementsByTagName("body")[0];this.isPopup=true}else{m=n;this.isPopup=false}this.date=this.dateStr?new Date(this.dateStr):new Date();var q=Calendar.createElement("table");this.table=q;q.cellSpacing=0;q.cellPadding=0;q.calendar=this;Calendar.addEvent(q,"mousedown",Calendar.tableMouseDown);var a=Calendar.createElement("div");this.element=a;a.className="calendar";if(this.isPopup){a.style.position="absolute";a.style.display="none"}a.appendChild(q);var k=Calendar.createElement("thead",q);var o=null;var r=null;var b=this;var e=function(s,j,i){o=Calendar.createElement("td",r);o.colSpan=j;o.className="button";if(i!=0&&Math.abs(i)<=2){o.className+=" nav"}Calendar._add_evs(o);o.calendar=b;o.navtype=i;o.innerHTML="<div unselectable='on'>"+s+"</div>";return o};r=Calendar.createElement("tr",k);var c=6;(this.isPopup)&&--c;(this.weekNumbers)&&++c;e("?",1,400).ttip=Calendar._TT.INFO;this.title=e("",c,300);this.title.className="title";if(this.isPopup){this.title.ttip=Calendar._TT.DRAG_TO_MOVE;this.title.style.cursor="move";e("&#x00d7;",1,200).ttip=Calendar._TT.CLOSE}r=Calendar.createElement("tr",k);r.className="headrow";this._nav_py=e("&#x00ab;",1,-2);this._nav_py.ttip=Calendar._TT.PREV_YEAR;this._nav_pm=e("&#x2039;",1,-1);this._nav_pm.ttip=Calendar._TT.PREV_MONTH;this._nav_now=e(Calendar._TT.TODAY,this.weekNumbers?4:3,0);this._nav_now.ttip=Calendar._TT.GO_TODAY;this._nav_nm=e("&#x203a;",1,1);this._nav_nm.ttip=Calendar._TT.NEXT_MONTH;this._nav_ny=e("&#x00bb;",1,2);this._nav_ny.ttip=Calendar._TT.NEXT_YEAR;r=Calendar.createElement("tr",k);r.className="daynames";if(this.weekNumbers){o=Calendar.createElement("td",r);o.className="name wn";o.innerHTML=Calendar._TT.WK}for(var h=7;h>0;--h){o=Calendar.createElement("td",r);if(!h){o.navtype=100;o.calendar=this;Calendar._add_evs(o)}}this.firstdayname=(this.weekNumbers)?r.firstChild.nextSibling:r.firstChild;this._displayWeekdays();var g=Calendar.createElement("tbody",q);this.tbody=g;for(h=6;h>0;--h){r=Calendar.createElement("tr",g);if(this.weekNumbers){o=Calendar.createElement("td",r)}for(var f=7;f>0;--f){o=Calendar.createElement("td",r);o.calendar=this;Calendar._add_evs(o)}}if(this.showsTime){r=Calendar.createElement("tr",g);r.className="time";o=Calendar.createElement("td",r);o.className="time";o.colSpan=2;o.innerHTML=Calendar._TT.TIME||"&nbsp;";o=Calendar.createElement("td",r);o.className="time";o.colSpan=this.weekNumbers?4:3;(function(){function t(C,E,D,F){var A=Calendar.createElement("span",o);A.className=C;A.innerHTML=E;A.calendar=b;A.ttip=Calendar._TT.TIME_PART;A.navtype=50;A._range=[];if(typeof D!="number"){A._range=D}else{for(var B=D;B<=F;++B){var z;if(B<10&&F>=10){z="0"+B}else{z=""+B}A._range[A._range.length]=z}}Calendar._add_evs(A);return A}var x=b.date.getHours();var i=b.date.getMinutes();var y=!b.time24;var j=(x>12);if(y&&j){x-=12}var v=t("hour",x,y?1:0,y?12:23);var u=Calendar.createElement("span",o);u.innerHTML=":";u.className="colon";var s=t("minute",i,0,59);var w=null;o=Calendar.createElement("td",r);o.className="time";o.colSpan=2;if(y){w=t("ampm",j?"pm":"am",["am","pm"])}else{o.innerHTML="&nbsp;"}b.onSetTime=function(){var A,z=this.date.getHours(),B=this.date.getMinutes();if(y){A=(z>=12);if(A){z-=12}if(z==0){z=12}w.innerHTML=A?"pm":"am"}v.innerHTML=(z<10)?("0"+z):z;s.innerHTML=(B<10)?("0"+B):B};b.onUpdateTime=function(){var A=this.date;var B=parseInt(v.innerHTML,10);if(y){if(/pm/i.test(w.innerHTML)&&B<12){B+=12}else{if(/am/i.test(w.innerHTML)&&B==12){B=0}}}var C=A.getDate();var z=A.getMonth();var D=A.getFullYear();A.setHours(B);A.setMinutes(parseInt(s.innerHTML,10));A.setFullYear(D);A.setMonth(z);A.setDate(C);this.dateClicked=false;this.callHandler()}})()}else{this.onSetTime=this.onUpdateTime=function(){}}var l=Calendar.createElement("tfoot",q);r=Calendar.createElement("tr",l);r.className="footrow";o=e(Calendar._TT.SEL_DATE,this.weekNumbers?8:7,300);o.className="ttip";if(this.isPopup){o.ttip=Calendar._TT.DRAG_TO_MOVE;o.style.cursor="move"}this.tooltips=o;a=Calendar.createElement("div",this.element);this.monthsCombo=a;a.className="combo";for(h=0;h<Calendar._MN.length;++h){var d=Calendar.createElement("div");d.className=Calendar.is_ie?"label-IEfix":"label";d.month=h;d.innerHTML=Calendar._SMN[h];a.appendChild(d)}a=Calendar.createElement("div",this.element);this.yearsCombo=a;a.className="combo";for(h=12;h>0;--h){var p=Calendar.createElement("div");p.className=Calendar.is_ie?"label-IEfix":"label";a.appendChild(p)}this._init(this.firstDayOfWeek,this.date);m.appendChild(this.element)};Calendar._keyEvent=function(k){var a=window._dynarch_popupCalendar;if(!a||a.multiple){return false}(Calendar.is_ie)&&(k=window.event);var i=(Calendar.is_ie||k.type=="keypress"),l=k.keyCode;if(k.ctrlKey){switch(l){case 37:i&&Calendar.cellClick(a._nav_pm);break;case 38:i&&Calendar.cellClick(a._nav_py);break;case 39:i&&Calendar.cellClick(a._nav_nm);break;case 40:i&&Calendar.cellClick(a._nav_ny);break;default:return false}}else{switch(l){case 32:Calendar.cellClick(a._nav_now);break;case 27:i&&a.callCloseHandler();break;case 37:case 38:case 39:case 40:if(i){var e,m,j,g,c,d;e=l==37||l==38;d=(l==37||l==39)?1:7;function b(){c=a.currentDateEl;var n=c.pos;m=n&15;j=n>>4;g=a.ar_days[j][m]}b();function f(){var n=new Date(a.date);n.setDate(n.getDate()-d);a.setDate(n)}function h(){var n=new Date(a.date);n.setDate(n.getDate()+d);a.setDate(n)}while(1){switch(l){case 37:if(--m>=0){g=a.ar_days[j][m]}else{m=6;l=38;continue}break;case 38:if(--j>=0){g=a.ar_days[j][m]}else{f();b()}break;case 39:if(++m<7){g=a.ar_days[j][m]}else{m=0;l=40;continue}break;case 40:if(++j<a.ar_days.length){g=a.ar_days[j][m]}else{h();b()}break}break}if(g){if(!g.disabled){Calendar.cellClick(g)}else{if(e){f()}else{h()}}}}break;case 13:if(i){Calendar.cellClick(a.currentDateEl,k)}break;default:return false}}return Calendar.stopEvent(k)};Calendar.prototype._init=function(n,x){var w=new Date(),r=w.getFullYear(),z=w.getMonth(),b=w.getDate();this.table.style.visibility="hidden";var h=x.getFullYear();if(h<this.minYear){h=this.minYear;x.setFullYear(h)}else{if(h>this.maxYear){h=this.maxYear;x.setFullYear(h)}}this.firstDayOfWeek=n;this.date=new Date(x);var y=x.getMonth();var B=x.getDate();var A=x.getMonthDays();x.setDate(1);var s=(x.getDay()-this.firstDayOfWeek)%7;if(s<0){s+=7}x.setDate(-s);x.setDate(x.getDate()+1);var e=this.tbody.firstChild;var l=Calendar._SMN[y];var p=this.ar_days=new Array();var o=Calendar._TT.WEEKEND;var d=this.multiple?(this.datesCells={}):null;for(var u=0;u<6;++u,e=e.nextSibling){var a=e.firstChild;if(this.weekNumbers){a.className="day wn";a.innerHTML=x.getWeekNumber();a=a.nextSibling}e.className="daysrow";var v=false,f,c=p[u]=[];for(var t=0;t<7;++t,a=a.nextSibling,x.setDate(f+1)){f=x.getDate();var g=x.getDay();a.className="day";a.pos=u<<4|t;c[t]=a;var m=(x.getMonth()==y);if(!m){if(this.showsOtherMonths){a.className+=" othermonth";a.otherMonth=true}else{a.className="emptycell";a.innerHTML="&nbsp;";a.disabled=true;continue}}else{a.otherMonth=false;v=true}a.disabled=false;a.innerHTML=this.getDateText?this.getDateText(x,f):f;if(d){d[x.print("%Y%m%d")]=a}if(this.getDateStatus){var q=this.getDateStatus(x,h,y,f);if(this.getDateToolTip){var k=this.getDateToolTip(x,h,y,f);if(k){a.title=k}}if(q===true){a.className+=" disabled";a.disabled=true}else{if(/disabled/i.test(q)){a.disabled=true}a.className+=" "+q}}if(!a.disabled){a.caldate=new Date(x);a.ttip="_";if(!this.multiple&&m&&f==B&&this.hiliteToday){a.className+=" selected";this.currentDateEl=a}if(x.getFullYear()==r&&x.getMonth()==z&&f==b){a.className+=" today";a.ttip+=Calendar._TT.PART_TODAY}if(o.indexOf(g.toString())!=-1){a.className+=a.otherMonth?" oweekend":" weekend"}}}if(!(v||this.showsOtherMonths)){e.className="emptyrow"}}this.title.innerHTML=Calendar._MN[y]+", "+h;this.onSetTime();this.table.style.visibility="visible";this._initMultipleDates()};Calendar.prototype._initMultipleDates=function(){if(this.multiple){for(var b in this.multiple){var a=this.datesCells[b];var c=this.multiple[b];if(!c){continue}if(a){a.className+=" selected"}}}};Calendar.prototype._toggleMultipleDate=function(b){if(this.multiple){var c=b.print("%Y%m%d");var a=this.datesCells[c];if(a){var e=this.multiple[c];if(!e){Calendar.addClass(a,"selected");this.multiple[c]=b}else{Calendar.removeClass(a,"selected");delete this.multiple[c]}}}};Calendar.prototype.setDateToolTipHandler=function(a){this.getDateToolTip=a};Calendar.prototype.setDate=function(a){if(!a.equalsTo(this.date)){this._init(this.firstDayOfWeek,a)}};Calendar.prototype.refresh=function(){this._init(this.firstDayOfWeek,this.date)};Calendar.prototype.setFirstDayOfWeek=function(a){this._init(a,this.date);this._displayWeekdays()};Calendar.prototype.setDateStatusHandler=Calendar.prototype.setDisabledHandler=function(a){this.getDateStatus=a};Calendar.prototype.setRange=function(b,c){this.minYear=b;this.maxYear=c};Calendar.prototype.callHandler=function(){if(this.onSelected){this.onSelected(this,this.date.print(this.dateFormat))}};Calendar.prototype.callCloseHandler=function(){if(this.onClose){this.onClose(this)}this.hideShowCovered()};Calendar.prototype.destroy=function(){var a=this.element.parentNode;a.removeChild(this.element);Calendar._C=null;window._dynarch_popupCalendar=null};Calendar.prototype.reparent=function(b){var a=this.element;a.parentNode.removeChild(a);b.appendChild(a)};Calendar._checkCalendar=function(b){var c=window._dynarch_popupCalendar;if(!c){return false}var a=Calendar.is_ie?Calendar.getElement(b):Calendar.getTargetElement(b);for(;a!=null&&a!=c.element;a=a.parentNode){}if(a==null){window._dynarch_popupCalendar.callCloseHandler();return Calendar.stopEvent(b)}};Calendar.prototype.show=function(){var e=this.table.getElementsByTagName("tr");for(var d=e.length;d>0;){var f=e[--d];Calendar.removeClass(f,"rowhilite");var c=f.getElementsByTagName("td");for(var b=c.length;b>0;){var a=c[--b];Calendar.removeClass(a,"hilite");Calendar.removeClass(a,"active")}}this.element.style.display="block";this.hidden=false;if(this.isPopup){window._dynarch_popupCalendar=this;Calendar.addEvent(document,"keydown",Calendar._keyEvent);Calendar.addEvent(document,"keypress",Calendar._keyEvent);Calendar.addEvent(document,"mousedown",Calendar._checkCalendar)}this.hideShowCovered()};Calendar.prototype.hide=function(){if(this.isPopup){Calendar.removeEvent(document,"keydown",Calendar._keyEvent);Calendar.removeEvent(document,"keypress",Calendar._keyEvent);Calendar.removeEvent(document,"mousedown",Calendar._checkCalendar)}this.element.style.display="none";this.hidden=true;this.hideShowCovered()};Calendar.prototype.showAt=function(a,c){var b=this.element.style;b.left=a+"px";b.top=c+"px";this.show()};Calendar.prototype.showAtElement=function(c,d){var a=this;var e=Calendar.getAbsolutePos(c);if(!d||typeof d!="string"){this.showAt(e.x,e.y+c.offsetHeight);return true}function b(i){if(i.x<0){i.x=0}if(i.y<0){i.y=0}var j=document.createElement("div");var h=j.style;h.position="absolute";h.right=h.bottom=h.width=h.height="0px";document.body.appendChild(j);var g=Calendar.getAbsolutePos(j);document.body.removeChild(j);if(Calendar.is_ie){g.y+=document.body.scrollTop;g.x+=document.body.scrollLeft}else{g.y+=window.scrollY;g.x+=window.scrollX}var f=i.x+i.width-g.x;if(f>0){i.x-=f}f=i.y+i.height-g.y;if(f>0){i.y-=f}}this.element.style.display="block";Calendar.continuation_for_the_fucking_khtml_browser=function(){var f=a.element.offsetWidth;var i=a.element.offsetHeight;a.element.style.display="none";var g=d.substr(0,1);var j="l";if(d.length>1){j=d.substr(1,1)}switch(g){case"T":e.y-=i;break;case"B":e.y+=c.offsetHeight;break;case"C":e.y+=(c.offsetHeight-i)/2;break;case"t":e.y+=c.offsetHeight-i;break;case"b":break}switch(j){case"L":e.x-=f;break;case"R":e.x+=c.offsetWidth;break;case"C":e.x+=(c.offsetWidth-f)/2;break;case"l":e.x+=c.offsetWidth-f;break;case"r":break}e.width=f;e.height=i+40;a.monthsCombo.style.display="none";b(e);a.showAt(e.x,e.y)};if(Calendar.is_khtml){setTimeout("Calendar.continuation_for_the_fucking_khtml_browser()",10)}else{Calendar.continuation_for_the_fucking_khtml_browser()}};Calendar.prototype.setDateFormat=function(a){this.dateFormat=a};Calendar.prototype.setTtDateFormat=function(a){this.ttDateFormat=a};Calendar.prototype.parseDate=function(b,a){if(!a){a=this.dateFormat}this.setDate(Date.parseDate(b,a))};Calendar.prototype.hideShowCovered=function(){if(!Calendar.is_ie&&!Calendar.is_opera){return}function b(k){var i=k.style.visibility;if(!i){if(document.defaultView&&typeof(document.defaultView.getComputedStyle)=="function"){if(!Calendar.is_khtml){i=document.defaultView.getComputedStyle(k,"").getPropertyValue("visibility")}else{i=""}}else{if(k.currentStyle){i=k.currentStyle.visibility}else{i=""}}}return i}var s=new Array("applet","iframe","select");var c=this.element;var a=Calendar.getAbsolutePos(c);var f=a.x;var d=c.offsetWidth+f;var r=a.y;var q=c.offsetHeight+r;for(var h=s.length;h>0;){var g=document.getElementsByTagName(s[--h]);var e=null;for(var l=g.length;l>0;){e=g[--l];a=Calendar.getAbsolutePos(e);var o=a.x;var n=e.offsetWidth+o;var m=a.y;var j=e.offsetHeight+m;if(this.hidden||(o>d)||(n<f)||(m>q)||(j<r)){if(!e.__msh_save_visibility){e.__msh_save_visibility=b(e)}e.style.visibility=e.__msh_save_visibility}else{if(!e.__msh_save_visibility){e.__msh_save_visibility=b(e)}e.style.visibility="hidden"}}}};Calendar.prototype._displayWeekdays=function(){var b=this.firstDayOfWeek;var a=this.firstdayname;var d=Calendar._TT.WEEKEND;for(var c=0;c<7;++c){a.className="day name";var e=(c+b)%7;if(c){a.ttip=Calendar._TT.DAY_FIRST.replace("%s",Calendar._DN[e]);a.navtype=100;a.calendar=this;a.fdow=e;Calendar._add_evs(a)}if(d.indexOf(e.toString())!=-1){Calendar.addClass(a,"weekend")}a.innerHTML=Calendar._SDN[(c+b)%7];a=a.nextSibling}};Calendar.prototype._hideCombos=function(){this.monthsCombo.style.display="none";this.yearsCombo.style.display="none"};Calendar.prototype._dragStart=function(ev){if(this.dragging){return}this.dragging=true;var posX;var posY;if(Calendar.is_ie){posY=window.event.clientY+document.body.scrollTop;posX=window.event.clientX+document.body.scrollLeft}else{posY=ev.clientY+window.scrollY;posX=ev.clientX+window.scrollX}var st=this.element.style;this.xOffs=posX-parseInt(st.left);this.yOffs=posY-parseInt(st.top);with(Calendar){addEvent(document,"mousemove",calDragIt);addEvent(document,"mouseup",calDragEnd)}};Date._MD=new Array(31,28,31,30,31,30,31,31,30,31,30,31);Date.SECOND=1000;Date.MINUTE=60*Date.SECOND;Date.HOUR=60*Date.MINUTE;Date.DAY=24*Date.HOUR;Date.WEEK=7*Date.DAY;Date.parseDate=function(l,c){var n=new Date();var o=0;var e=-1;var k=0;var q=l.split(/\W+/);var p=c.match(/%./g);var h=0,g=0;var r=0;var f=0;for(h=0;h<q.length;++h){if(!q[h]){continue}switch(p[h]){case"%d":case"%e":k=parseInt(q[h],10);break;case"%m":e=parseInt(q[h],10)-1;break;case"%Y":case"%y":o=parseInt(q[h],10);(o<100)&&(o+=(o>29)?1900:2000);break;case"%b":case"%B":for(g=0;g<12;++g){if(Calendar._MN[g].substr(0,q[h].length).toLowerCase()==q[h].toLowerCase()){e=g;break}}break;case"%H":case"%I":case"%k":case"%l":r=parseInt(q[h],10);break;case"%P":case"%p":if(/pm/i.test(q[h])&&r<12){r+=12}else{if(/am/i.test(q[h])&&r>=12){r-=12}}break;case"%M":f=parseInt(q[h],10);break}}if(isNaN(o)){o=n.getFullYear()}if(isNaN(e)){e=n.getMonth()}if(isNaN(k)){k=n.getDate()}if(isNaN(r)){r=n.getHours()}if(isNaN(f)){f=n.getMinutes()}if(o!=0&&e!=-1&&k!=0){return new Date(o,e,k,r,f,0)}o=0;e=-1;k=0;for(h=0;h<q.length;++h){if(q[h].search(/[a-zA-Z]+/)!=-1){var s=-1;for(g=0;g<12;++g){if(Calendar._MN[g].substr(0,q[h].length).toLowerCase()==q[h].toLowerCase()){s=g;break}}if(s!=-1){if(e!=-1){k=e+1}e=s}}else{if(parseInt(q[h],10)<=12&&e==-1){e=q[h]-1}else{if(parseInt(q[h],10)>31&&o==0){o=parseInt(q[h],10);(o<100)&&(o+=(o>29)?1900:2000)}else{if(k==0){k=q[h]}}}}}if(o==0){o=n.getFullYear()}if(e!=-1&&k!=0){return new Date(o,e,k,r,f,0)}return n};Date.prototype.getMonthDays=function(b){var a=this.getFullYear();if(typeof b=="undefined"){b=this.getMonth()}if(((0==(a%4))&&((0!=(a%100))||(0==(a%400))))&&b==1){return 29}else{return Date._MD[b]}};Date.prototype.getDayOfYear=function(){var a=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var c=new Date(this.getFullYear(),0,0,0,0,0);var b=a-c;return Math.floor(b/Date.DAY)};Date.prototype.getWeekNumber=function(){var c=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0);var b=c.getDay();c.setDate(c.getDate()-(b+6)%7+3);var a=c.valueOf();c.setMonth(0);c.setDate(4);return Math.round((a-c.valueOf())/(7*86400000))+1};Date.prototype.equalsTo=function(a){return((this.getFullYear()==a.getFullYear())&&(this.getMonth()==a.getMonth())&&(this.getDate()==a.getDate())&&(this.getHours()==a.getHours())&&(this.getMinutes()==a.getMinutes()))};Date.prototype.setDateOnly=function(a){var b=new Date(a);this.setDate(1);this.setFullYear(b.getFullYear());this.setMonth(b.getMonth());this.setDate(b.getDate())};Date.prototype.print=function(l){var b=this.getMonth();var k=this.getDate();var n=this.getFullYear();var p=this.getWeekNumber();var q=this.getDay();var v={};var r=this.getHours();var c=(r>=12);var h=(c)?(r-12):r;var u=this.getDayOfYear();if(h==0){h=12}var e=this.getMinutes();var j=this.getSeconds();v["%a"]=Calendar._SDN[q];v["%A"]=Calendar._DN[q];v["%b"]=Calendar._SMN[b];v["%B"]=Calendar._MN[b];v["%C"]=1+Math.floor(n/100);v["%d"]=(k<10)?("0"+k):k;v["%e"]=k;v["%H"]=(r<10)?("0"+r):r;v["%I"]=(h<10)?("0"+h):h;v["%j"]=(u<100)?((u<10)?("00"+u):("0"+u)):u;v["%k"]=r;v["%l"]=h;v["%m"]=(b<9)?("0"+(1+b)):(1+b);v["%M"]=(e<10)?("0"+e):e;v["%n"]="\n";v["%p"]=c?"PM":"AM";v["%P"]=c?"pm":"am";v["%s"]=Math.floor(this.getTime()/1000);v["%S"]=(j<10)?("0"+j):j;v["%t"]="\t";v["%U"]=v["%W"]=v["%V"]=(p<10)?("0"+p):p;v["%u"]=q+1;v["%w"]=q;v["%y"]=(""+n).substr(2,2);v["%Y"]=n;v["%%"]="%";var t=/%./g;if(!Calendar.is_ie5&&!Calendar.is_khtml){return l.replace(t,function(a){return v[a]||a})}var o=l.match(t);for(var g=0;g<o.length;g++){var f=v[o[g]];if(f){t=new RegExp(o[g],"g");l=l.replace(t,f)}}return l};Date.prototype.__msh_oldSetFullYear=Date.prototype.setFullYear;Date.prototype.setFullYear=function(b){var a=new Date(this);a.__msh_oldSetFullYear(b);if(a.getMonth()!=this.getMonth()){this.setDate(28)}this.__msh_oldSetFullYear(b)};window._dynarch_popupCalendar=null;
3959 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/3959/471900e25447546fd1890cc9d0bf55fbc3f08e0e/calendar.js/buggy/javascript/jscalendar/calendar.js
if (!val) {return; } if (val.constructor == Date) {return val; }
if (!val) { return; } if (val.constructor == Date) { return val; }
function parseDate(val) { if (!val) {return; } if (val.constructor == Date) {return val; } if (typeof val == 'string') { // rfc3339? var els = val.split("-"); if (els.length == 3) { return new Date(integer(els[0]), integer(els[1]) -1, integer(els[2])); } // invalid offset if (!/^\d+$/.test(val)) { return; } // convert to integer val = integer(val); } var date = new Date(); date.setDate(date.getDate() + val); return date; }
7610 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/7610/006b689e5f8c3b22a231cc4bde61db41ebf4bc81/dateinput.js/buggy/src/dateinput/dateinput.js
if (!/^\d+$/.test(val)) { return; }
if (!/^-?\d+$/.test(val)) { return; }
function parseDate(val) { if (!val) { return; } if (val.constructor == Date) { return val; } if (typeof val == 'string') { // rfc3339? var els = val.split("-"); if (els.length == 3) { return new Date(integer(els[0]), integer(els[1]) -1, integer(els[2])); } // invalid offset if (!/^\d+$/.test(val)) { return; } // convert to integer val = integer(val); } var date = new Date(); date.setDate(date.getDate() + val); return date; }
7610 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/7610/5ea29c44443cb67f780f4aa4faf170e8ca89cc87/dateinput.js/buggy/src/dateinput/dateinput.js
var ret = parseNum(); if (tokens.length === 0) throw "Expected slash in meter"; var tok = tokens.shift(); if (tok.token !== '/') throw "Expected slash in meter"; tok = tokens.shift(); if (tok.type !== 'number') throw "Expected bottom number of meter"; ret.den = tok.token; ret.value = ret.value / parseInt(ret.den); return ret; };
var ret = parseNum(); if (tokens.length === 0) throw "Expected slash in meter"; var tok = tokens.shift(); if (tok.token !== '/') throw "Expected slash in meter"; tok = tokens.shift(); if (tok.type !== 'number') throw "Expected bottom number of meter"; ret.den = tok.token; ret.value = ret.value / parseInt(ret.den); return ret; };
var parseFraction = function() { // handles this much: parseNum slash decimal var ret = parseNum(); if (tokens.length === 0) throw "Expected slash in meter"; var tok = tokens.shift(); if (tok.token !== '/') throw "Expected slash in meter"; tok = tokens.shift(); if (tok.type !== 'number') throw "Expected bottom number of meter"; ret.den = tok.token; ret.value = ret.value / parseInt(ret.den); return ret; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f5a9f7ef8d556b3359fab3994dac1ddd87440bb3/abc_parse_header.js/buggy/abc_parse_header.js
return { newline: true };
return {newline: true};
this.parseHeader = function(line) { if (line.startsWith('%%')) { var err = this.addDirective(line.substring(2)); if (err) warn(err, line, 2); return {}; } line = tokenizer.stripComment(line); if (line.length === 0) return {}; if (line.length >= 2) { if (line[1] === ':') { var nextLine = ""; if (line.indexOf('\x12') >= 0 && line[0] !== 'w') { // w: is the only header field that can have a continuation. nextLine = line.substring(line.indexOf('\x12')+1); line = line.substring(0, line.indexOf('\x12')); //This handles a continuation mark on a header field } var field = metaTextHeaders[line[0]]; if (field !== undefined) { tune.addMetaText(field, tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); return {}; } else { switch(line[0]) { case 'H': tune.addMetaText("history", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); multilineVars.is_in_history = true; break; case 'K': // since the key is the last thing that can happen in the header, we can resolve the tempo now this.resolveTempo(); var result = this.parseKey(line.substring(2)); if (!multilineVars.is_in_header && tune.hasBeginMusic()) { if (result.foundClef) tune.appendStartingElement('clef', -1, -1, multilineVars.clef); if (result.foundKey) tune.appendStartingElement('key', -1, -1, this.fixKey(multilineVars.clef, multilineVars.key)); } multilineVars.is_in_header = false; // The first key signifies the end of the header. break; case 'L': this.setDefaultLength(line, 2, line.length); break; case 'M': multilineVars.origMeter = multilineVars.meter = this.setMeter(line.substring(2)); break; case 'P': // TODO-PER: There is more to do with parts, but the writer doesn't care. if (multilineVars.is_in_header) tune.addMetaText("partOrder", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); else multilineVars.partForNextLine = tokenizer.translateString(tokenizer.stripComment(line.substring(2))); break; case 'Q': var tempo = this.setTempo(line, 2, line.length); if (tempo.type === 'delaySet') multilineVars.tempo = tempo.tempo; else if (tempo.type === 'immediate') tune.metaText.tempo = tempo.tempo; break; case 'T': this.setTitle(line.substring(2)); break; case 'U': this.addUserDefinition(line, 2, line.length); break; case 'V': this.parseVoice(line, 2, line.length); if (!multilineVars.is_in_header) return { newline: true }; break; case 'w': return { words: true }; case 'X': break; case 'E': case 'm': warn("Ignored header", line, 0); break; default: // It wasn't a recognized header value, so parse it as music. if (nextLine.length) nextLine = "\x12" + nextLine; //parseRegularMusicLine(line+nextLine); //nextLine = ""; return { regular: true, str: line+nextLine }; } } if (nextLine.length > 0) return { recurse: true, str: nextLine }; return {}; } } // If we got this far, we have a regular line of mulsic return { regular: true, str: line }; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/b469218ea3fed3fd3b63e64dfa8a3d3cd05c473d/abc_parse_header.js/clean/abc_parse_header.js
return { words: true };
return {words: true};
this.parseHeader = function(line) { if (line.startsWith('%%')) { var err = this.addDirective(line.substring(2)); if (err) warn(err, line, 2); return {}; } line = tokenizer.stripComment(line); if (line.length === 0) return {}; if (line.length >= 2) { if (line[1] === ':') { var nextLine = ""; if (line.indexOf('\x12') >= 0 && line[0] !== 'w') { // w: is the only header field that can have a continuation. nextLine = line.substring(line.indexOf('\x12')+1); line = line.substring(0, line.indexOf('\x12')); //This handles a continuation mark on a header field } var field = metaTextHeaders[line[0]]; if (field !== undefined) { tune.addMetaText(field, tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); return {}; } else { switch(line[0]) { case 'H': tune.addMetaText("history", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); multilineVars.is_in_history = true; break; case 'K': // since the key is the last thing that can happen in the header, we can resolve the tempo now this.resolveTempo(); var result = this.parseKey(line.substring(2)); if (!multilineVars.is_in_header && tune.hasBeginMusic()) { if (result.foundClef) tune.appendStartingElement('clef', -1, -1, multilineVars.clef); if (result.foundKey) tune.appendStartingElement('key', -1, -1, this.fixKey(multilineVars.clef, multilineVars.key)); } multilineVars.is_in_header = false; // The first key signifies the end of the header. break; case 'L': this.setDefaultLength(line, 2, line.length); break; case 'M': multilineVars.origMeter = multilineVars.meter = this.setMeter(line.substring(2)); break; case 'P': // TODO-PER: There is more to do with parts, but the writer doesn't care. if (multilineVars.is_in_header) tune.addMetaText("partOrder", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); else multilineVars.partForNextLine = tokenizer.translateString(tokenizer.stripComment(line.substring(2))); break; case 'Q': var tempo = this.setTempo(line, 2, line.length); if (tempo.type === 'delaySet') multilineVars.tempo = tempo.tempo; else if (tempo.type === 'immediate') tune.metaText.tempo = tempo.tempo; break; case 'T': this.setTitle(line.substring(2)); break; case 'U': this.addUserDefinition(line, 2, line.length); break; case 'V': this.parseVoice(line, 2, line.length); if (!multilineVars.is_in_header) return { newline: true }; break; case 'w': return { words: true }; case 'X': break; case 'E': case 'm': warn("Ignored header", line, 0); break; default: // It wasn't a recognized header value, so parse it as music. if (nextLine.length) nextLine = "\x12" + nextLine; //parseRegularMusicLine(line+nextLine); //nextLine = ""; return { regular: true, str: line+nextLine }; } } if (nextLine.length > 0) return { recurse: true, str: nextLine }; return {}; } } // If we got this far, we have a regular line of mulsic return { regular: true, str: line }; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/b469218ea3fed3fd3b63e64dfa8a3d3cd05c473d/abc_parse_header.js/clean/abc_parse_header.js
return { regular: true, str: line+nextLine };
return {regular: true, str: line+nextLine};
this.parseHeader = function(line) { if (line.startsWith('%%')) { var err = this.addDirective(line.substring(2)); if (err) warn(err, line, 2); return {}; } line = tokenizer.stripComment(line); if (line.length === 0) return {}; if (line.length >= 2) { if (line[1] === ':') { var nextLine = ""; if (line.indexOf('\x12') >= 0 && line[0] !== 'w') { // w: is the only header field that can have a continuation. nextLine = line.substring(line.indexOf('\x12')+1); line = line.substring(0, line.indexOf('\x12')); //This handles a continuation mark on a header field } var field = metaTextHeaders[line[0]]; if (field !== undefined) { tune.addMetaText(field, tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); return {}; } else { switch(line[0]) { case 'H': tune.addMetaText("history", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); multilineVars.is_in_history = true; break; case 'K': // since the key is the last thing that can happen in the header, we can resolve the tempo now this.resolveTempo(); var result = this.parseKey(line.substring(2)); if (!multilineVars.is_in_header && tune.hasBeginMusic()) { if (result.foundClef) tune.appendStartingElement('clef', -1, -1, multilineVars.clef); if (result.foundKey) tune.appendStartingElement('key', -1, -1, this.fixKey(multilineVars.clef, multilineVars.key)); } multilineVars.is_in_header = false; // The first key signifies the end of the header. break; case 'L': this.setDefaultLength(line, 2, line.length); break; case 'M': multilineVars.origMeter = multilineVars.meter = this.setMeter(line.substring(2)); break; case 'P': // TODO-PER: There is more to do with parts, but the writer doesn't care. if (multilineVars.is_in_header) tune.addMetaText("partOrder", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); else multilineVars.partForNextLine = tokenizer.translateString(tokenizer.stripComment(line.substring(2))); break; case 'Q': var tempo = this.setTempo(line, 2, line.length); if (tempo.type === 'delaySet') multilineVars.tempo = tempo.tempo; else if (tempo.type === 'immediate') tune.metaText.tempo = tempo.tempo; break; case 'T': this.setTitle(line.substring(2)); break; case 'U': this.addUserDefinition(line, 2, line.length); break; case 'V': this.parseVoice(line, 2, line.length); if (!multilineVars.is_in_header) return { newline: true }; break; case 'w': return { words: true }; case 'X': break; case 'E': case 'm': warn("Ignored header", line, 0); break; default: // It wasn't a recognized header value, so parse it as music. if (nextLine.length) nextLine = "\x12" + nextLine; //parseRegularMusicLine(line+nextLine); //nextLine = ""; return { regular: true, str: line+nextLine }; } } if (nextLine.length > 0) return { recurse: true, str: nextLine }; return {}; } } // If we got this far, we have a regular line of mulsic return { regular: true, str: line }; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/b469218ea3fed3fd3b63e64dfa8a3d3cd05c473d/abc_parse_header.js/clean/abc_parse_header.js
return { recurse: true, str: nextLine };
return {recurse: true, str: nextLine};
this.parseHeader = function(line) { if (line.startsWith('%%')) { var err = this.addDirective(line.substring(2)); if (err) warn(err, line, 2); return {}; } line = tokenizer.stripComment(line); if (line.length === 0) return {}; if (line.length >= 2) { if (line[1] === ':') { var nextLine = ""; if (line.indexOf('\x12') >= 0 && line[0] !== 'w') { // w: is the only header field that can have a continuation. nextLine = line.substring(line.indexOf('\x12')+1); line = line.substring(0, line.indexOf('\x12')); //This handles a continuation mark on a header field } var field = metaTextHeaders[line[0]]; if (field !== undefined) { tune.addMetaText(field, tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); return {}; } else { switch(line[0]) { case 'H': tune.addMetaText("history", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); multilineVars.is_in_history = true; break; case 'K': // since the key is the last thing that can happen in the header, we can resolve the tempo now this.resolveTempo(); var result = this.parseKey(line.substring(2)); if (!multilineVars.is_in_header && tune.hasBeginMusic()) { if (result.foundClef) tune.appendStartingElement('clef', -1, -1, multilineVars.clef); if (result.foundKey) tune.appendStartingElement('key', -1, -1, this.fixKey(multilineVars.clef, multilineVars.key)); } multilineVars.is_in_header = false; // The first key signifies the end of the header. break; case 'L': this.setDefaultLength(line, 2, line.length); break; case 'M': multilineVars.origMeter = multilineVars.meter = this.setMeter(line.substring(2)); break; case 'P': // TODO-PER: There is more to do with parts, but the writer doesn't care. if (multilineVars.is_in_header) tune.addMetaText("partOrder", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); else multilineVars.partForNextLine = tokenizer.translateString(tokenizer.stripComment(line.substring(2))); break; case 'Q': var tempo = this.setTempo(line, 2, line.length); if (tempo.type === 'delaySet') multilineVars.tempo = tempo.tempo; else if (tempo.type === 'immediate') tune.metaText.tempo = tempo.tempo; break; case 'T': this.setTitle(line.substring(2)); break; case 'U': this.addUserDefinition(line, 2, line.length); break; case 'V': this.parseVoice(line, 2, line.length); if (!multilineVars.is_in_header) return { newline: true }; break; case 'w': return { words: true }; case 'X': break; case 'E': case 'm': warn("Ignored header", line, 0); break; default: // It wasn't a recognized header value, so parse it as music. if (nextLine.length) nextLine = "\x12" + nextLine; //parseRegularMusicLine(line+nextLine); //nextLine = ""; return { regular: true, str: line+nextLine }; } } if (nextLine.length > 0) return { recurse: true, str: nextLine }; return {}; } } // If we got this far, we have a regular line of mulsic return { regular: true, str: line }; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/b469218ea3fed3fd3b63e64dfa8a3d3cd05c473d/abc_parse_header.js/clean/abc_parse_header.js
return { regular: true, str: line };
return {regular: true, str: line};
this.parseHeader = function(line) { if (line.startsWith('%%')) { var err = this.addDirective(line.substring(2)); if (err) warn(err, line, 2); return {}; } line = tokenizer.stripComment(line); if (line.length === 0) return {}; if (line.length >= 2) { if (line[1] === ':') { var nextLine = ""; if (line.indexOf('\x12') >= 0 && line[0] !== 'w') { // w: is the only header field that can have a continuation. nextLine = line.substring(line.indexOf('\x12')+1); line = line.substring(0, line.indexOf('\x12')); //This handles a continuation mark on a header field } var field = metaTextHeaders[line[0]]; if (field !== undefined) { tune.addMetaText(field, tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); return {}; } else { switch(line[0]) { case 'H': tune.addMetaText("history", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); multilineVars.is_in_history = true; break; case 'K': // since the key is the last thing that can happen in the header, we can resolve the tempo now this.resolveTempo(); var result = this.parseKey(line.substring(2)); if (!multilineVars.is_in_header && tune.hasBeginMusic()) { if (result.foundClef) tune.appendStartingElement('clef', -1, -1, multilineVars.clef); if (result.foundKey) tune.appendStartingElement('key', -1, -1, this.fixKey(multilineVars.clef, multilineVars.key)); } multilineVars.is_in_header = false; // The first key signifies the end of the header. break; case 'L': this.setDefaultLength(line, 2, line.length); break; case 'M': multilineVars.origMeter = multilineVars.meter = this.setMeter(line.substring(2)); break; case 'P': // TODO-PER: There is more to do with parts, but the writer doesn't care. if (multilineVars.is_in_header) tune.addMetaText("partOrder", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); else multilineVars.partForNextLine = tokenizer.translateString(tokenizer.stripComment(line.substring(2))); break; case 'Q': var tempo = this.setTempo(line, 2, line.length); if (tempo.type === 'delaySet') multilineVars.tempo = tempo.tempo; else if (tempo.type === 'immediate') tune.metaText.tempo = tempo.tempo; break; case 'T': this.setTitle(line.substring(2)); break; case 'U': this.addUserDefinition(line, 2, line.length); break; case 'V': this.parseVoice(line, 2, line.length); if (!multilineVars.is_in_header) return { newline: true }; break; case 'w': return { words: true }; case 'X': break; case 'E': case 'm': warn("Ignored header", line, 0); break; default: // It wasn't a recognized header value, so parse it as music. if (nextLine.length) nextLine = "\x12" + nextLine; //parseRegularMusicLine(line+nextLine); //nextLine = ""; return { regular: true, str: line+nextLine }; } } if (nextLine.length > 0) return { recurse: true, str: nextLine }; return {}; } } // If we got this far, we have a regular line of mulsic return { regular: true, str: line }; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/b469218ea3fed3fd3b63e64dfa8a3d3cd05c473d/abc_parse_header.js/clean/abc_parse_header.js
if (line.startsWith('%%')) { var err = this.addDirective(line.substring(2)); if (err) warn(err, line, 2);
if (line.startsWith('%%')) { var err = this.addDirective(line.substring(2)); if (err) warn(err, line, 2); return {}; } line = tokenizer.stripComment(line); if (line.length === 0) return {}; if (line.length >= 2) { if (line[1] === ':') { var nextLine = ""; if (line.indexOf('\x12') >= 0 && line[0] !== 'w') { nextLine = line.substring(line.indexOf('\x12')+1); line = line.substring(0, line.indexOf('\x12')); } var field = metaTextHeaders[line[0]]; if (field !== undefined) { tune.addMetaText(field, tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); return {}; } else { switch(line[0]) { case 'H': tune.addMetaText("history", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); multilineVars.is_in_history = true; break; case 'K': this.resolveTempo(); var result = this.parseKey(line.substring(2)); if (!multilineVars.is_in_header && tune.hasBeginMusic()) { if (result.foundClef) tune.appendStartingElement('clef', -1, -1, multilineVars.clef); if (result.foundKey) tune.appendStartingElement('key', -1, -1, this.fixKey(multilineVars.clef, multilineVars.key)); } multilineVars.is_in_header = false; break; case 'L': this.setDefaultLength(line, 2, line.length); break; case 'M': multilineVars.origMeter = multilineVars.meter = this.setMeter(line.substring(2)); break; case 'P': if (multilineVars.is_in_header) tune.addMetaText("partOrder", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); else multilineVars.partForNextLine = tokenizer.translateString(tokenizer.stripComment(line.substring(2))); break; case 'Q': var tempo = this.setTempo(line, 2, line.length); if (tempo.type === 'delaySet') multilineVars.tempo = tempo.tempo; else if (tempo.type === 'immediate') tune.metaText.tempo = tempo.tempo; break; case 'T': this.setTitle(line.substring(2)); break; case 'U': this.addUserDefinition(line, 2, line.length); break; case 'V': this.parseVoice(line, 2, line.length); if (!multilineVars.is_in_header) return { newline: true }; break; case 'w': return { words: true }; case 'X': break; case 'E': case 'm': warn("Ignored header", line, 0); break; default: if (nextLine.length) nextLine = "\x12" + nextLine; return { regular: true, str: line+nextLine }; } } if (nextLine.length > 0) return { recurse: true, str: nextLine };
this.parseHeader = function(line) { if (line.startsWith('%%')) { var err = this.addDirective(line.substring(2)); if (err) warn(err, line, 2); return {}; } line = tokenizer.stripComment(line); if (line.length === 0) return {}; if (line.length >= 2) { if (line[1] === ':') { var nextLine = ""; if (line.indexOf('\x12') >= 0 && line[0] !== 'w') { // w: is the only header field that can have a continuation. nextLine = line.substring(line.indexOf('\x12')+1); line = line.substring(0, line.indexOf('\x12')); //This handles a continuation mark on a header field } var field = metaTextHeaders[line[0]]; if (field !== undefined) { tune.addMetaText(field, tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); return {}; } else { switch(line[0]) { case 'H': tune.addMetaText("history", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); multilineVars.is_in_history = true; break; case 'K': // since the key is the last thing that can happen in the header, we can resolve the tempo now this.resolveTempo(); var result = this.parseKey(line.substring(2)); if (!multilineVars.is_in_header && tune.hasBeginMusic()) { if (result.foundClef) tune.appendStartingElement('clef', -1, -1, multilineVars.clef); if (result.foundKey) tune.appendStartingElement('key', -1, -1, this.fixKey(multilineVars.clef, multilineVars.key)); } multilineVars.is_in_header = false; // The first key signifies the end of the header. break; case 'L': this.setDefaultLength(line, 2, line.length); break; case 'M': multilineVars.origMeter = multilineVars.meter = this.setMeter(line.substring(2)); break; case 'P': // TODO-PER: There is more to do with parts, but the writer doesn't care. if (multilineVars.is_in_header) tune.addMetaText("partOrder", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); else multilineVars.partForNextLine = tokenizer.translateString(tokenizer.stripComment(line.substring(2))); break; case 'Q': var tempo = this.setTempo(line, 2, line.length); if (tempo.type === 'delaySet') multilineVars.tempo = tempo.tempo; else if (tempo.type === 'immediate') tune.metaText.tempo = tempo.tempo; break; case 'T': this.setTitle(line.substring(2)); break; case 'U': this.addUserDefinition(line, 2, line.length); break; case 'V': this.parseVoice(line, 2, line.length); if (!multilineVars.is_in_header) return { newline: true }; break; case 'w': return { words: true }; break; case 'X': break; case 'E': case 'm': warn("Ignored header", line, 0); break; default: // It wasn't a recognized header value, so parse it as music. if (nextLine.length) nextLine = "\x12" + nextLine; //parseRegularMusicLine(line+nextLine); //nextLine = ""; return { regular: true, str: line+nextLine }; } } if (nextLine.length > 0) return { recurse: true, str: nextLine }; return {}; } } // If we got this far, we have a regular line of mulsic return { regular: true, str: line }; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f5a9f7ef8d556b3359fab3994dac1ddd87440bb3/abc_parse_header.js/buggy/abc_parse_header.js
line = tokenizer.stripComment(line); if (line.length === 0) return {};
}
this.parseHeader = function(line) { if (line.startsWith('%%')) { var err = this.addDirective(line.substring(2)); if (err) warn(err, line, 2); return {}; } line = tokenizer.stripComment(line); if (line.length === 0) return {}; if (line.length >= 2) { if (line[1] === ':') { var nextLine = ""; if (line.indexOf('\x12') >= 0 && line[0] !== 'w') { // w: is the only header field that can have a continuation. nextLine = line.substring(line.indexOf('\x12')+1); line = line.substring(0, line.indexOf('\x12')); //This handles a continuation mark on a header field } var field = metaTextHeaders[line[0]]; if (field !== undefined) { tune.addMetaText(field, tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); return {}; } else { switch(line[0]) { case 'H': tune.addMetaText("history", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); multilineVars.is_in_history = true; break; case 'K': // since the key is the last thing that can happen in the header, we can resolve the tempo now this.resolveTempo(); var result = this.parseKey(line.substring(2)); if (!multilineVars.is_in_header && tune.hasBeginMusic()) { if (result.foundClef) tune.appendStartingElement('clef', -1, -1, multilineVars.clef); if (result.foundKey) tune.appendStartingElement('key', -1, -1, this.fixKey(multilineVars.clef, multilineVars.key)); } multilineVars.is_in_header = false; // The first key signifies the end of the header. break; case 'L': this.setDefaultLength(line, 2, line.length); break; case 'M': multilineVars.origMeter = multilineVars.meter = this.setMeter(line.substring(2)); break; case 'P': // TODO-PER: There is more to do with parts, but the writer doesn't care. if (multilineVars.is_in_header) tune.addMetaText("partOrder", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); else multilineVars.partForNextLine = tokenizer.translateString(tokenizer.stripComment(line.substring(2))); break; case 'Q': var tempo = this.setTempo(line, 2, line.length); if (tempo.type === 'delaySet') multilineVars.tempo = tempo.tempo; else if (tempo.type === 'immediate') tune.metaText.tempo = tempo.tempo; break; case 'T': this.setTitle(line.substring(2)); break; case 'U': this.addUserDefinition(line, 2, line.length); break; case 'V': this.parseVoice(line, 2, line.length); if (!multilineVars.is_in_header) return { newline: true }; break; case 'w': return { words: true }; break; case 'X': break; case 'E': case 'm': warn("Ignored header", line, 0); break; default: // It wasn't a recognized header value, so parse it as music. if (nextLine.length) nextLine = "\x12" + nextLine; //parseRegularMusicLine(line+nextLine); //nextLine = ""; return { regular: true, str: line+nextLine }; } } if (nextLine.length > 0) return { recurse: true, str: nextLine }; return {}; } } // If we got this far, we have a regular line of mulsic return { regular: true, str: line }; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f5a9f7ef8d556b3359fab3994dac1ddd87440bb3/abc_parse_header.js/buggy/abc_parse_header.js
if (line.length >= 2) { if (line[1] === ':') { var nextLine = ""; if (line.indexOf('\x12') >= 0 && line[0] !== 'w') { nextLine = line.substring(line.indexOf('\x12')+1); line = line.substring(0, line.indexOf('\x12')); } var field = metaTextHeaders[line[0]]; if (field !== undefined) { tune.addMetaText(field, tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); return {}; } else { switch(line[0]) { case 'H': tune.addMetaText("history", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); multilineVars.is_in_history = true; break; case 'K': this.resolveTempo(); var result = this.parseKey(line.substring(2)); if (!multilineVars.is_in_header && tune.hasBeginMusic()) { if (result.foundClef) tune.appendStartingElement('clef', -1, -1, multilineVars.clef); if (result.foundKey) tune.appendStartingElement('key', -1, -1, this.fixKey(multilineVars.clef, multilineVars.key)); } multilineVars.is_in_header = false; break; case 'L': this.setDefaultLength(line, 2, line.length); break; case 'M': multilineVars.origMeter = multilineVars.meter = this.setMeter(line.substring(2)); break; case 'P': if (multilineVars.is_in_header) tune.addMetaText("partOrder", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); else multilineVars.partForNextLine = tokenizer.translateString(tokenizer.stripComment(line.substring(2))); break; case 'Q': var tempo = this.setTempo(line, 2, line.length); if (tempo.type === 'delaySet') multilineVars.tempo = tempo.tempo; else if (tempo.type === 'immediate') tune.metaText.tempo = tempo.tempo; break; case 'T': this.setTitle(line.substring(2)); break; case 'U': this.addUserDefinition(line, 2, line.length); break; case 'V': this.parseVoice(line, 2, line.length); if (!multilineVars.is_in_header) return { newline: true }; break; case 'w': return { words: true }; break; case 'X': break; case 'E': case 'm': warn("Ignored header", line, 0); break; default: if (nextLine.length) nextLine = "\x12" + nextLine; return { regular: true, str: line+nextLine }; } } if (nextLine.length > 0) return { recurse: true, str: nextLine }; return {}; } } return { regular: true, str: line }; };
return { regular: true, str: line }; };
this.parseHeader = function(line) { if (line.startsWith('%%')) { var err = this.addDirective(line.substring(2)); if (err) warn(err, line, 2); return {}; } line = tokenizer.stripComment(line); if (line.length === 0) return {}; if (line.length >= 2) { if (line[1] === ':') { var nextLine = ""; if (line.indexOf('\x12') >= 0 && line[0] !== 'w') { // w: is the only header field that can have a continuation. nextLine = line.substring(line.indexOf('\x12')+1); line = line.substring(0, line.indexOf('\x12')); //This handles a continuation mark on a header field } var field = metaTextHeaders[line[0]]; if (field !== undefined) { tune.addMetaText(field, tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); return {}; } else { switch(line[0]) { case 'H': tune.addMetaText("history", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); multilineVars.is_in_history = true; break; case 'K': // since the key is the last thing that can happen in the header, we can resolve the tempo now this.resolveTempo(); var result = this.parseKey(line.substring(2)); if (!multilineVars.is_in_header && tune.hasBeginMusic()) { if (result.foundClef) tune.appendStartingElement('clef', -1, -1, multilineVars.clef); if (result.foundKey) tune.appendStartingElement('key', -1, -1, this.fixKey(multilineVars.clef, multilineVars.key)); } multilineVars.is_in_header = false; // The first key signifies the end of the header. break; case 'L': this.setDefaultLength(line, 2, line.length); break; case 'M': multilineVars.origMeter = multilineVars.meter = this.setMeter(line.substring(2)); break; case 'P': // TODO-PER: There is more to do with parts, but the writer doesn't care. if (multilineVars.is_in_header) tune.addMetaText("partOrder", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); else multilineVars.partForNextLine = tokenizer.translateString(tokenizer.stripComment(line.substring(2))); break; case 'Q': var tempo = this.setTempo(line, 2, line.length); if (tempo.type === 'delaySet') multilineVars.tempo = tempo.tempo; else if (tempo.type === 'immediate') tune.metaText.tempo = tempo.tempo; break; case 'T': this.setTitle(line.substring(2)); break; case 'U': this.addUserDefinition(line, 2, line.length); break; case 'V': this.parseVoice(line, 2, line.length); if (!multilineVars.is_in_header) return { newline: true }; break; case 'w': return { words: true }; break; case 'X': break; case 'E': case 'm': warn("Ignored header", line, 0); break; default: // It wasn't a recognized header value, so parse it as music. if (nextLine.length) nextLine = "\x12" + nextLine; //parseRegularMusicLine(line+nextLine); //nextLine = ""; return { regular: true, str: line+nextLine }; } } if (nextLine.length > 0) return { recurse: true, str: nextLine }; return {}; } } // If we got this far, we have a regular line of mulsic return { regular: true, str: line }; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f5a9f7ef8d556b3359fab3994dac1ddd87440bb3/abc_parse_header.js/buggy/abc_parse_header.js
"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+ a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f],
!F.call(j,"constructor")&&!F.call(j.constructor.prototype,"isPrototypeOf"))return false;for(var s in j);return s===B||F.call(j,s)},isEmptyObject:function(j){for(var s in j)return false;return true},error:function(j){throw j;},parseJSON:function(j){if(typeof j!=="string"||!j)return null;j=b.trim(j);if(C.test(j.replace(J,"@").replace(w,"]").replace(I,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(j):(new Function("return "+j))();else b.error("Invalid JSON: "+j)},noop:function(){},globalEval:function(j){if(j&&
"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f],
3959 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/3959/6ffc2de1d5816f49b1cdf002161144b28f2dc6e5/jquery.js/clean/javascript/jquery.js
return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return z.JSON&&z.JSON.parse?z.JSON.parse(a):(new Function("return "+a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Ra.test(a)){var b=r.getElementsByTagName("head")[0]||
"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+ a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f],
return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return z.JSON&&z.JSON.parse?z.JSON.parse(a):(new Function("return "+a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Ra.test(a)){var b=r.getElementsByTagName("head")[0]||
10574 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/10574/e67dc72e11289d294cc6b462fc98149983bd62f4/jquery.js/clean/wp-includes/js/jquery/jquery.js
null||!v.test(i)||isNaN(i)},type:function(i){return i==null?String(i):L[x.call(i)]||"object"},isPlainObject:function(i){if(!i||b.type(i)!=="object"||i.nodeType||b.isWindow(i))return false;if(i.constructor&&!C.call(i,"constructor")&&!C.call(i.constructor.prototype,"isPrototypeOf"))return false;for(var r in i);return r===A||C.call(i,r)},isEmptyObject:function(i){for(var r in i)return false;return true},error:function(i){throw i;},parseJSON:function(i){if(typeof i!=="string"||!i)return null;i=b.trim(i); if(D.test(i.replace(H,"@").replace(w,"]").replace(G,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(i):(new Function("return "+i))();else b.error("Invalid JSON: "+i)},noop:function(){},globalEval:function(i){if(i&&k.test(i)){var r=u.getElementsByTagName("head")[0]||u.documentElement,y=u.createElement("script");y.type="text/javascript";if(b.support.scriptEval)y.appendChild(u.createTextNode(i));else y.text=i;r.insertBefore(y,r.firstChild);r.removeChild(y)}},nodeName:function(i,r){return i.nodeName&&i.nodeName.toUpperCase()===
!F.call(j,"constructor")&&!F.call(j.constructor.prototype,"isPrototypeOf"))return false;for(var s in j);return s===B||F.call(j,s)},isEmptyObject:function(j){for(var s in j)return false;return true},error:function(j){throw j;},parseJSON:function(j){if(typeof j!=="string"||!j)return null;j=b.trim(j);if(C.test(j.replace(J,"@").replace(w,"]").replace(I,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(j):(new Function("return "+j))();else b.error("Invalid JSON: "+j)},noop:function(){},globalEval:function(j){if(j&&
null||!v.test(i)||isNaN(i)},type:function(i){return i==null?String(i):L[x.call(i)]||"object"},isPlainObject:function(i){if(!i||b.type(i)!=="object"||i.nodeType||b.isWindow(i))return false;if(i.constructor&&!C.call(i,"constructor")&&!C.call(i.constructor.prototype,"isPrototypeOf"))return false;for(var r in i);return r===A||C.call(i,r)},isEmptyObject:function(i){for(var r in i)return false;return true},error:function(i){throw i;},parseJSON:function(i){if(typeof i!=="string"||!i)return null;i=b.trim(i);if(D.test(i.replace(H,"@").replace(w,"]").replace(G,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(i):(new Function("return "+i))();else b.error("Invalid JSON: "+i)},noop:function(){},globalEval:function(i){if(i&&k.test(i)){var r=u.getElementsByTagName("head")[0]||u.documentElement,y=u.createElement("script");y.type="text/javascript";if(b.support.scriptEval)y.appendChild(u.createTextNode(i));else y.text=i;r.insertBefore(y,r.firstChild);r.removeChild(y)}},nodeName:function(i,r){return i.nodeName&&i.nodeName.toUpperCase()===
2459 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2459/224f99709ae7b631dc0e80310148eb2c54d2198a/jquery.js/buggy/default_www/frontend/core/js/jquery/jquery.js
parseJSON: function( data ) { if ( typeof data !== "string" || !data ) { return null; } data = jQuery.trim( data ); if ( rvalidchars.test(data.replace(rvalidescape, "@") .replace(rvalidtokens, "]") .replace(rvalidbraces, "")) ) { return window.JSON && window.JSON.parse ? window.JSON.parse( data ) : (new Function("return " + data))(); } else { jQuery.error( "Invalid JSON: " + data ); } },
!F.call(j,"constructor")&&!F.call(j.constructor.prototype,"isPrototypeOf"))return false;for(var s in j);return s===B||F.call(j,s)},isEmptyObject:function(j){for(var s in j)return false;return true},error:function(j){throw j;},parseJSON:function(j){if(typeof j!=="string"||!j)return null;j=b.trim(j);if(C.test(j.replace(J,"@").replace(w,"]").replace(I,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(j):(new Function("return "+j))();else b.error("Invalid JSON: "+j)},noop:function(){},globalEval:function(j){if(j&&
parseJSON: function( data ) { if ( typeof data !== "string" || !data ) { return null; } // Make sure leading/trailing whitespace is removed (IE can't handle it) data = jQuery.trim( data ); // Make sure the incoming data is actual JSON // Logic borrowed from http://json.org/json2.js if ( rvalidchars.test(data.replace(rvalidescape, "@") .replace(rvalidtokens, "]") .replace(rvalidbraces, "")) ) { // Try to use the native JSON parser first return window.JSON && window.JSON.parse ? window.JSON.parse( data ) : (new Function("return " + data))(); } else { jQuery.error( "Invalid JSON: " + data ); } },
10574 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/10574/337f8a7f8f1bd9e61727ac292aa76724b4cf7a46/jquery.js/clean/wp-includes/js/jquery/jquery.js
"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+ a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f],
null||!v.test(i)||isNaN(i)},type:function(i){return i==null?String(i):L[x.call(i)]||"object"},isPlainObject:function(i){if(!i||b.type(i)!=="object"||i.nodeType||b.isWindow(i))return false;if(i.constructor&&!C.call(i,"constructor")&&!C.call(i.constructor.prototype,"isPrototypeOf"))return false;for(var r in i);return r===A||C.call(i,r)},isEmptyObject:function(i){for(var r in i)return false;return true},error:function(i){throw i;},parseJSON:function(i){if(typeof i!=="string"||!i)return null;i=b.trim(i); if(D.test(i.replace(H,"@").replace(w,"]").replace(G,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(i):(new Function("return "+i))();else b.error("Invalid JSON: "+i)},noop:function(){},globalEval:function(i){if(i&&k.test(i)){var r=u.getElementsByTagName("head")[0]||u.documentElement,y=u.createElement("script");y.type="text/javascript";if(b.support.scriptEval)y.appendChild(u.createTextNode(i));else y.text=i;r.insertBefore(y,r.firstChild);r.removeChild(y)}},nodeName:function(i,r){return i.nodeName&&i.nodeName.toUpperCase()===
"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f],
8656 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/8656/debb161f7671ff5bddc8def2221db94ff111ff1b/jquery.js/clean/js/jquery.js
null||!v.test(i)||isNaN(i)},type:function(i){return i==null?String(i):L[x.call(i)]||"object"},isPlainObject:function(i){if(!i||b.type(i)!=="object"||i.nodeType||b.isWindow(i))return false;if(i.constructor&&!C.call(i,"constructor")&&!C.call(i.constructor.prototype,"isPrototypeOf"))return false;for(var r in i);return r===A||C.call(i,r)},isEmptyObject:function(i){for(var r in i)return false;return true},error:function(i){throw i;},parseJSON:function(i){if(typeof i!=="string"||!i)return null;i=b.trim(i); if(D.test(i.replace(H,"@").replace(w,"]").replace(G,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(i):(new Function("return "+i))();else b.error("Invalid JSON: "+i)},noop:function(){},globalEval:function(i){if(i&&k.test(i)){var r=u.getElementsByTagName("head")[0]||u.documentElement,y=u.createElement("script");y.type="text/javascript";if(b.support.scriptEval)y.appendChild(u.createTextNode(i));else y.text=i;r.insertBefore(y,r.firstChild);r.removeChild(y)}},nodeName:function(i,r){return i.nodeName&&i.nodeName.toUpperCase()===
!F.call(j,"constructor")&&!F.call(j.constructor.prototype,"isPrototypeOf"))return false;for(var s in j);return s===B||F.call(j,s)},isEmptyObject:function(j){for(var s in j)return false;return true},error:function(j){throw j;},parseJSON:function(j){if(typeof j!=="string"||!j)return null;j=b.trim(j);if(C.test(j.replace(J,"@").replace(w,"]").replace(I,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(j):(new Function("return "+j))();else b.error("Invalid JSON: "+j)},noop:function(){},globalEval:function(j){if(j&&
null||!v.test(i)||isNaN(i)},type:function(i){return i==null?String(i):L[x.call(i)]||"object"},isPlainObject:function(i){if(!i||b.type(i)!=="object"||i.nodeType||b.isWindow(i))return false;if(i.constructor&&!C.call(i,"constructor")&&!C.call(i.constructor.prototype,"isPrototypeOf"))return false;for(var r in i);return r===A||C.call(i,r)},isEmptyObject:function(i){for(var r in i)return false;return true},error:function(i){throw i;},parseJSON:function(i){if(typeof i!=="string"||!i)return null;i=b.trim(i);if(D.test(i.replace(H,"@").replace(w,"]").replace(G,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(i):(new Function("return "+i))();else b.error("Invalid JSON: "+i)},noop:function(){},globalEval:function(i){if(i&&k.test(i)){var r=u.getElementsByTagName("head")[0]||u.documentElement,y=u.createElement("script");y.type="text/javascript";if(b.support.scriptEval)y.appendChild(u.createTextNode(i));else y.text=i;r.insertBefore(y,r.firstChild);r.removeChild(y)}},nodeName:function(i,r){return i.nodeName&&i.nodeName.toUpperCase()===
2459 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2459/224f99709ae7b631dc0e80310148eb2c54d2198a/jquery.js/buggy/default_www/backend/core/js/jquery/jquery.js
return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return z.JSON&&z.JSON.parse?z.JSON.parse(a):(new Function("return "+a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Ra.test(a)){var b=r.getElementsByTagName("head")[0]||
"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+ a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f],
return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return z.JSON&&z.JSON.parse?z.JSON.parse(a):(new Function("return "+a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Ra.test(a)){var b=r.getElementsByTagName("head")[0]||
8560 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/8560/4d748e5cbfcbd91691b089e42cffdf43918e6201/jquery.min.js/clean/web/javascript/jquery/jquery.min.js
"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+ a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f],
null||!v.test(i)||isNaN(i)},type:function(i){return i==null?String(i):L[x.call(i)]||"object"},isPlainObject:function(i){if(!i||b.type(i)!=="object"||i.nodeType||b.isWindow(i))return false;if(i.constructor&&!C.call(i,"constructor")&&!C.call(i.constructor.prototype,"isPrototypeOf"))return false;for(var r in i);return r===A||C.call(i,r)},isEmptyObject:function(i){for(var r in i)return false;return true},error:function(i){throw i;},parseJSON:function(i){if(typeof i!=="string"||!i)return null;i=b.trim(i); if(D.test(i.replace(H,"@").replace(w,"]").replace(G,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(i):(new Function("return "+i))();else b.error("Invalid JSON: "+i)},noop:function(){},globalEval:function(i){if(i&&k.test(i)){var r=u.getElementsByTagName("head")[0]||u.documentElement,y=u.createElement("script");y.type="text/javascript";if(b.support.scriptEval)y.appendChild(u.createTextNode(i));else y.text=i;r.insertBefore(y,r.firstChild);r.removeChild(y)}},nodeName:function(i,r){return i.nodeName&&i.nodeName.toUpperCase()===
"isPrototypeOf"))return false;var b;for(b in a);return b===w||aa.call(a,b)},isEmptyObject:function(a){for(var b in a)return false;return true},error:function(a){throw a;},parseJSON:function(a){if(typeof a!=="string"||!a)return null;a=c.trim(a);if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return A.JSON&&A.JSON.parse?A.JSON.parse(a):(new Function("return "+a))();else c.error("Invalid JSON: "+a)},noop:function(){},globalEval:function(a){if(a&&Va.test(a)){var b=s.getElementsByTagName("head")[0]||s.documentElement,d=s.createElement("script");d.type="text/javascript";if(c.support.scriptEval)d.appendChild(s.createTextNode(a));else d.text=a;b.insertBefore(d,b.firstChild);b.removeChild(d)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,b,d){var f,e=0,j=a.length,i=j===w||c.isFunction(a);if(d)if(i)for(f in a){if(b.apply(a[f],
10574 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/10574/8e2f21f44411204c60060f830cb1a800533462d2/jquery.js/buggy/wp-includes/js/jquery/jquery.js
var f = %CompileString(text, true);
var f = %CompileString(s, true);
function ParseJSONUnfiltered(text) { var s = $String(text); var f = %CompileString(text, true); return f();}
262 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/262/0f4a33050805b39908d8f9c786d28aff58b0ba09/json.js/buggy/src/json.js
multilineVars.clef = { type: retClef.token, verticalPos: calcMiddle(retClef.token, 0) };
multilineVars.clef = {type: retClef.token, verticalPos: calcMiddle(retClef.token, 0)};
this.parseKey = function(str) // (and clef) { var origStr = str; // The format is: // [space][tonic[#|b][ ][3-letter-mode][ignored-chars][space]][ accidentals...][ clef=treble|bass|bass3|tenor|alto|alto2|alto1|none [+8|-8]] // -- or -- the key can be "none" // First get the key letter: turn that into a index into the key array (0-11) // Then see if there is a sharp or flat. Increment or decrement. // Then see if there is a mode modifier. Add or subtract to the index. // Then do a mod 12 on the index and return the key. // TODO: This may leave unparsed characters at the end after something reasonable was found. var setMiddle = function(str) { var i = tokenizer.skipWhiteSpace(str); str = str.substring(i); if (str.startsWith('m=') || str.startsWith('middle=')) { str = str.substring(str.indexOf('=')+1); multilineVars.clef.verticalPos = parseMiddle(str); } }; // check first to see if there is only a clef. If so, just take that, but ignore an error after that. var retClef = tokenizer.getClef(str); if (retClef.token !== undefined && (retClef.explicit === true || retClef.token !== 'none')) { // none is the only ambiguous marking. We need to assume that's a key multilineVars.clef = { type: retClef.token, verticalPos: calcMiddle(retClef.token, 0) }; str = str.substring(retClef.len); setMiddle(str); return {foundClef: true}; } var ret = {}; var retPitch = tokenizer.getKeyPitch(str); if (retPitch.len > 0) { var key = retPitch.token; str = str.substring(retPitch.len); // We got a pitch to start with, so we might also have an accidental and a mode var retAcc = tokenizer.getSharpFlat(str); if (retAcc.len > 0) { key += retAcc.token; str = str.substring(retAcc.len); } var retMode = tokenizer.getMode(str); if (retMode.len > 0) { key += retMode.token; str = str.substring(retMode.len); } // We need to do a deep copy because we are going to modify it ret.accidentals = []; keys[key].each(function(k) { ret.accidentals.push(Object.clone(k)); }); } else if (str.startsWith('HP')) { this.addDirective("bagpipes"); ret.accidentals = []; multilineVars.key = ret; return {foundKey: true}; } else if (str.startsWith('Hp')) { ret.accidentals = [ {acc: 'natural', note: 'g'}, {acc: 'sharp', note: 'f'}, {acc: 'sharp', note: 'c'} ]; this.addDirective("bagpipes"); multilineVars.key = ret; return {foundKey: true}; } else { var retNone = tokenizer.isMatch(str, 'none'); if (retNone > 0) { // we got the none key - that's the same as C to us ret.accidentals = []; str = str.substring(retNone); } } // There are two special cases of deprecated syntax. Ignore them if they occur var j = tokenizer.skipWhiteSpace(str); str = str.substring(j); if (str.startsWith('exp') || str.startsWith('oct')) str = str.substring(3); // now see if there are extra accidentals var done = false; while (!done) { var retExtra = tokenizer.getKeyAccidental(str); if (retExtra.len === 0) done = true; else { str = str.substring(retExtra.len); if (retExtra.warn) warn("error parsing extra accidentals:", origStr, 0); else { if (!ret.accidentals) ret.accidentals = []; ret.accidentals.push(retExtra.token); } } } // now see if there is a clef retClef = tokenizer.getClef(str); if (retClef.len > 0) { if (retClef.warn) warn("error parsing clef:" + retClef.warn, origStr, 0); else { //ret.clef = retClef.token; multilineVars.clef = { type: retClef.token, verticalPos: calcMiddle(retClef.token, 0) }; str = str.substring(retClef.len); setMiddle(str); } } if (ret.accidentals === undefined && retClef.token === undefined) { warn("error parsing key: ", origStr, 0); return {}; } var result = {}; if (retClef.token !== undefined) result.foundClef = true; if (ret.accidentals !== undefined) { multilineVars.key = ret; result.foundKey = true; } return result; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/b469218ea3fed3fd3b63e64dfa8a3d3cd05c473d/abc_parse_header.js/clean/abc_parse_header.js
ret.accidentals = []; keys[key].each(function(k) { ret.accidentals.push(Object.clone(k)); });
ret = this.deepCopyKey(keys[key]);
this.parseKey = function(str) // (and clef) { var origStr = str; // The format is: // [space][tonic[#|b][ ][3-letter-mode][ignored-chars][space]][ accidentals...][ clef=treble|bass|bass3|tenor|alto|alto2|alto1|none [+8|-8]] // -- or -- the key can be "none" // First get the key letter: turn that into a index into the key array (0-11) // Then see if there is a sharp or flat. Increment or decrement. // Then see if there is a mode modifier. Add or subtract to the index. // Then do a mod 12 on the index and return the key. // TODO: This may leave unparsed characters at the end after something reasonable was found. var setMiddle = function(str) { var i = tokenizer.skipWhiteSpace(str); str = str.substring(i); if (str.startsWith('m=') || str.startsWith('middle=')) { str = str.substring(str.indexOf('=')+1); multilineVars.clef.verticalPos = parseMiddle(str); } }; // check first to see if there is only a clef. If so, just take that, but ignore an error after that. var retClef = tokenizer.getClef(str); if (retClef.token !== undefined && (retClef.explicit === true || retClef.token !== 'none')) { // none is the only ambiguous marking. We need to assume that's a key multilineVars.clef = { type: retClef.token, verticalPos: calcMiddle(retClef.token, 0) }; str = str.substring(retClef.len); setMiddle(str); return {foundClef: true}; } var ret = {}; var retPitch = tokenizer.getKeyPitch(str); if (retPitch.len > 0) { var key = retPitch.token; str = str.substring(retPitch.len); // We got a pitch to start with, so we might also have an accidental and a mode var retAcc = tokenizer.getSharpFlat(str); if (retAcc.len > 0) { key += retAcc.token; str = str.substring(retAcc.len); } var retMode = tokenizer.getMode(str); if (retMode.len > 0) { key += retMode.token; str = str.substring(retMode.len); } // We need to do a deep copy because we are going to modify it ret.accidentals = []; keys[key].each(function(k) { ret.accidentals.push(Object.clone(k)); }); } else if (str.startsWith('HP')) { this.addDirective("bagpipes"); ret.accidentals = []; multilineVars.key = ret; return {foundKey: true}; } else if (str.startsWith('Hp')) { ret.accidentals = [ {acc: 'natural', note: 'g'}, {acc: 'sharp', note: 'f'}, {acc: 'sharp', note: 'c'} ]; this.addDirective("bagpipes"); multilineVars.key = ret; return {foundKey: true}; } else { var retNone = tokenizer.isMatch(str, 'none'); if (retNone > 0) { // we got the none key - that's the same as C to us ret.accidentals = []; str = str.substring(retNone); } } // There are two special cases of deprecated syntax. Ignore them if they occur var j = tokenizer.skipWhiteSpace(str); str = str.substring(j); if (str.startsWith('exp') || str.startsWith('oct')) str = str.substring(3); // now see if there are extra accidentals var done = false; while (!done) { var retExtra = tokenizer.getKeyAccidental(str); if (retExtra.len === 0) done = true; else { str = str.substring(retExtra.len); if (retExtra.warn) warn("error parsing extra accidentals:", origStr, 0); else { if (!ret.accidentals) ret.accidentals = []; ret.accidentals.push(retExtra.token); } } } // now see if there is a clef retClef = tokenizer.getClef(str); if (retClef.len > 0) { if (retClef.warn) warn("error parsing clef:" + retClef.warn, origStr, 0); else { //ret.clef = retClef.token; multilineVars.clef = { type: retClef.token, verticalPos: calcMiddle(retClef.token, 0) }; str = str.substring(retClef.len); setMiddle(str); } } if (ret.accidentals === undefined && retClef.token === undefined) { warn("error parsing key: ", origStr, 0); return {}; } var result = {}; if (retClef.token !== undefined) result.foundClef = true; if (ret.accidentals !== undefined) { multilineVars.key = ret; result.foundKey = true; } return result; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/b469218ea3fed3fd3b63e64dfa8a3d3cd05c473d/abc_parse_header.js/clean/abc_parse_header.js
multilineVars.clef = { type: retClef.token, verticalPos: calcMiddle(retClef.token, 0) };
multilineVars.clef = {type: retClef.token, verticalPos: calcMiddle(retClef.token, 0)};
this.parseKey = function(str) // (and clef) { var origStr = str; // The format is: // [space][tonic[#|b][ ][3-letter-mode][ignored-chars][space]][ accidentals...][ clef=treble|bass|bass3|tenor|alto|alto2|alto1|none [+8|-8]] // -- or -- the key can be "none" // First get the key letter: turn that into a index into the key array (0-11) // Then see if there is a sharp or flat. Increment or decrement. // Then see if there is a mode modifier. Add or subtract to the index. // Then do a mod 12 on the index and return the key. // TODO: This may leave unparsed characters at the end after something reasonable was found. var setMiddle = function(str) { var i = tokenizer.skipWhiteSpace(str); str = str.substring(i); if (str.startsWith('m=') || str.startsWith('middle=')) { str = str.substring(str.indexOf('=')+1); multilineVars.clef.verticalPos = parseMiddle(str); } }; // check first to see if there is only a clef. If so, just take that, but ignore an error after that. var retClef = tokenizer.getClef(str); if (retClef.token !== undefined && (retClef.explicit === true || retClef.token !== 'none')) { // none is the only ambiguous marking. We need to assume that's a key multilineVars.clef = { type: retClef.token, verticalPos: calcMiddle(retClef.token, 0) }; str = str.substring(retClef.len); setMiddle(str); return {foundClef: true}; } var ret = {}; var retPitch = tokenizer.getKeyPitch(str); if (retPitch.len > 0) { var key = retPitch.token; str = str.substring(retPitch.len); // We got a pitch to start with, so we might also have an accidental and a mode var retAcc = tokenizer.getSharpFlat(str); if (retAcc.len > 0) { key += retAcc.token; str = str.substring(retAcc.len); } var retMode = tokenizer.getMode(str); if (retMode.len > 0) { key += retMode.token; str = str.substring(retMode.len); } // We need to do a deep copy because we are going to modify it ret.accidentals = []; keys[key].each(function(k) { ret.accidentals.push(Object.clone(k)); }); } else if (str.startsWith('HP')) { this.addDirective("bagpipes"); ret.accidentals = []; multilineVars.key = ret; return {foundKey: true}; } else if (str.startsWith('Hp')) { ret.accidentals = [ {acc: 'natural', note: 'g'}, {acc: 'sharp', note: 'f'}, {acc: 'sharp', note: 'c'} ]; this.addDirective("bagpipes"); multilineVars.key = ret; return {foundKey: true}; } else { var retNone = tokenizer.isMatch(str, 'none'); if (retNone > 0) { // we got the none key - that's the same as C to us ret.accidentals = []; str = str.substring(retNone); } } // There are two special cases of deprecated syntax. Ignore them if they occur var j = tokenizer.skipWhiteSpace(str); str = str.substring(j); if (str.startsWith('exp') || str.startsWith('oct')) str = str.substring(3); // now see if there are extra accidentals var done = false; while (!done) { var retExtra = tokenizer.getKeyAccidental(str); if (retExtra.len === 0) done = true; else { str = str.substring(retExtra.len); if (retExtra.warn) warn("error parsing extra accidentals:", origStr, 0); else { if (!ret.accidentals) ret.accidentals = []; ret.accidentals.push(retExtra.token); } } } // now see if there is a clef retClef = tokenizer.getClef(str); if (retClef.len > 0) { if (retClef.warn) warn("error parsing clef:" + retClef.warn, origStr, 0); else { //ret.clef = retClef.token; multilineVars.clef = { type: retClef.token, verticalPos: calcMiddle(retClef.token, 0) }; str = str.substring(retClef.len); setMiddle(str); } } if (ret.accidentals === undefined && retClef.token === undefined) { warn("error parsing key: ", origStr, 0); return {}; } var result = {}; if (retClef.token !== undefined) result.foundClef = true; if (ret.accidentals !== undefined) { multilineVars.key = ret; result.foundKey = true; } return result; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/b469218ea3fed3fd3b63e64dfa8a3d3cd05c473d/abc_parse_header.js/clean/abc_parse_header.js
var setMiddle = function(str) {
var setClefMiddle = function(str) {
this.parseKey = function(str) // (and clef) { str = tokenizer.stripComment(str); var origStr = str; if (str.length === 0) { // an empty K: field is the same as K:none str = 'none'; } // The format is: // [space][tonic[#|b][ ][3-letter-mode][ignored-chars][space]][ accidentals...][ clef=treble|bass|bass3|tenor|alto|alto2|alto1|none [+8|-8]] // -- or -- the key can be "none" // First get the key letter: turn that into a index into the key array (0-11) // Then see if there is a sharp or flat. Increment or decrement. // Then see if there is a mode modifier. Add or subtract to the index. // Then do a mod 12 on the index and return the key. // TODO: This may leave unparsed characters at the end after something reasonable was found. // TODO: The above description does not seem to be valid as key names rather than indexes are used -- GD var setMiddle = function(str) { var i = tokenizer.skipWhiteSpace(str); str = str.substring(i); if (str.startsWith('m=') || str.startsWith('middle=')) { str = str.substring(str.indexOf('=')+1); multilineVars.clef.verticalPos = parseMiddle(str); } }; // check first to see if there is only a clef. If so, just take that, but ignore an error after that. var retClef = tokenizer.getClef(str); if (retClef.token !== undefined && (retClef.explicit === true || retClef.token !== 'none')) { // none is the only ambiguous marking. We need to assume that's a key multilineVars.clef = {type: retClef.token, verticalPos: calcMiddle(retClef.token, 0)}; str = str.substring(retClef.len); setMiddle(str); return {foundClef: true}; //TODO multilinevars.key is not set - is this normal? -- GD } var ret = {}; var retPitch = tokenizer.getKeyPitch(str); if (retPitch.len > 0) { var key = retPitch.token; str = str.substring(retPitch.len); // We got a pitch to start with, so we might also have an accidental and a mode var retAcc = tokenizer.getSharpFlat(str); if (retAcc.len > 0) { key += retAcc.token; str = str.substring(retAcc.len); } var retMode = tokenizer.getMode(str); if (retMode.len > 0) { key += retMode.token; str = str.substring(retMode.len); } // We need to do a deep copy because we are going to modify it ret = this.deepCopyKey({accidentals: keys[key]}); ret.root = retPitch.token; ret.acc = retAcc.token || ""; ret.mode = retMode.token || ""; } else if (str.startsWith('HP')) { this.addDirective("bagpipes"); ret.accidentals = []; ret.root = "HP"; ret.acc = ""; ret.mode = ""; multilineVars.key = ret; return {foundKey: true}; } else if (str.startsWith('Hp')) { ret.accidentals = [ {acc: 'natural', note: 'g'}, {acc: 'sharp', note: 'f'}, {acc: 'sharp', note: 'c'} ]; this.addDirective("bagpipes"); ret.root = "Hp"; ret.acc = ""; ret.mode = ""; multilineVars.key = ret; return {foundKey: true}; } else { var retNone = tokenizer.isMatch(str, 'none'); if (retNone > 0) { // we got the none key - that's the same as C to us ret.accidentals = []; ret.root = "none"; ret.acc = ""; ret.mode = ""; str = str.substring(retNone); } } // There are two special cases of deprecated syntax. Ignore them if they occur var j = tokenizer.skipWhiteSpace(str); str = str.substring(j); if (str.startsWith('exp') || str.startsWith('oct')) str = str.substring(3); // now see if there are extra accidentals var done = false; while (!done) { var retExtra = tokenizer.getKeyAccidental(str); if (retExtra.len === 0) done = true; else { str = str.substring(retExtra.len); if (retExtra.warn) warn("error parsing extra accidentals:", origStr, 0); else { if (!ret.accidentals) ret.accidentals = []; ret.accidentals.push(retExtra.token); } } } // now see if there is a clef retClef = tokenizer.getClef(str); if (retClef.len > 0) { if (retClef.warn) warn("error parsing clef:" + retClef.warn, origStr, 0); else { //ret.clef = retClef.token; multilineVars.clef = {type: retClef.token, verticalPos: calcMiddle(retClef.token, 0)}; str = str.substring(retClef.len); setMiddle(str); } } if (ret.accidentals === undefined && retClef.token === undefined) { warn("error parsing key: ", origStr, 0); return {}; } var result = {}; if (retClef.token !== undefined) result.foundClef = true; if (ret.accidentals !== undefined) { // Adjust the octave of the accidentals, if necessary ret.accidentals.each(function(acc) { if (retClef.token === 'bass') { //if (acc.note === 'A') acc.note = 'a'; //if (acc.note === 'B') acc.note = 'b'; if (acc.note === 'C') acc.note = 'c'; if (acc.note === 'D' && acc.acc !== 'flat') acc.note = 'd'; if (acc.note === 'E' && acc.acc !== 'flat') acc.note = 'e'; if (acc.note === 'F' && acc.acc !== 'flat') acc.note = 'f'; if (acc.note === 'G' && acc.acc !== 'flat') acc.note = 'g'; } else { if (acc.note === 'a') acc.note = 'A'; if (acc.note === 'b') acc.note = 'B'; if (acc.note === 'C') acc.note = 'c'; } }); multilineVars.key = ret; result.foundKey = true; } return result; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f7c7e4a972bba135a553a5fbd23c045ebc24ee52/abc_parse_header.js/buggy/abc_parse_header.js
setMiddle(str);
setClefMiddle(str);
this.parseKey = function(str) // (and clef) { str = tokenizer.stripComment(str); var origStr = str; if (str.length === 0) { // an empty K: field is the same as K:none str = 'none'; } // The format is: // [space][tonic[#|b][ ][3-letter-mode][ignored-chars][space]][ accidentals...][ clef=treble|bass|bass3|tenor|alto|alto2|alto1|none [+8|-8]] // -- or -- the key can be "none" // First get the key letter: turn that into a index into the key array (0-11) // Then see if there is a sharp or flat. Increment or decrement. // Then see if there is a mode modifier. Add or subtract to the index. // Then do a mod 12 on the index and return the key. // TODO: This may leave unparsed characters at the end after something reasonable was found. // TODO: The above description does not seem to be valid as key names rather than indexes are used -- GD var setMiddle = function(str) { var i = tokenizer.skipWhiteSpace(str); str = str.substring(i); if (str.startsWith('m=') || str.startsWith('middle=')) { str = str.substring(str.indexOf('=')+1); multilineVars.clef.verticalPos = parseMiddle(str); } }; // check first to see if there is only a clef. If so, just take that, but ignore an error after that. var retClef = tokenizer.getClef(str); if (retClef.token !== undefined && (retClef.explicit === true || retClef.token !== 'none')) { // none is the only ambiguous marking. We need to assume that's a key multilineVars.clef = {type: retClef.token, verticalPos: calcMiddle(retClef.token, 0)}; str = str.substring(retClef.len); setMiddle(str); return {foundClef: true}; //TODO multilinevars.key is not set - is this normal? -- GD } var ret = {}; var retPitch = tokenizer.getKeyPitch(str); if (retPitch.len > 0) { var key = retPitch.token; str = str.substring(retPitch.len); // We got a pitch to start with, so we might also have an accidental and a mode var retAcc = tokenizer.getSharpFlat(str); if (retAcc.len > 0) { key += retAcc.token; str = str.substring(retAcc.len); } var retMode = tokenizer.getMode(str); if (retMode.len > 0) { key += retMode.token; str = str.substring(retMode.len); } // We need to do a deep copy because we are going to modify it ret = this.deepCopyKey({accidentals: keys[key]}); ret.root = retPitch.token; ret.acc = retAcc.token || ""; ret.mode = retMode.token || ""; } else if (str.startsWith('HP')) { this.addDirective("bagpipes"); ret.accidentals = []; ret.root = "HP"; ret.acc = ""; ret.mode = ""; multilineVars.key = ret; return {foundKey: true}; } else if (str.startsWith('Hp')) { ret.accidentals = [ {acc: 'natural', note: 'g'}, {acc: 'sharp', note: 'f'}, {acc: 'sharp', note: 'c'} ]; this.addDirective("bagpipes"); ret.root = "Hp"; ret.acc = ""; ret.mode = ""; multilineVars.key = ret; return {foundKey: true}; } else { var retNone = tokenizer.isMatch(str, 'none'); if (retNone > 0) { // we got the none key - that's the same as C to us ret.accidentals = []; ret.root = "none"; ret.acc = ""; ret.mode = ""; str = str.substring(retNone); } } // There are two special cases of deprecated syntax. Ignore them if they occur var j = tokenizer.skipWhiteSpace(str); str = str.substring(j); if (str.startsWith('exp') || str.startsWith('oct')) str = str.substring(3); // now see if there are extra accidentals var done = false; while (!done) { var retExtra = tokenizer.getKeyAccidental(str); if (retExtra.len === 0) done = true; else { str = str.substring(retExtra.len); if (retExtra.warn) warn("error parsing extra accidentals:", origStr, 0); else { if (!ret.accidentals) ret.accidentals = []; ret.accidentals.push(retExtra.token); } } } // now see if there is a clef retClef = tokenizer.getClef(str); if (retClef.len > 0) { if (retClef.warn) warn("error parsing clef:" + retClef.warn, origStr, 0); else { //ret.clef = retClef.token; multilineVars.clef = {type: retClef.token, verticalPos: calcMiddle(retClef.token, 0)}; str = str.substring(retClef.len); setMiddle(str); } } if (ret.accidentals === undefined && retClef.token === undefined) { warn("error parsing key: ", origStr, 0); return {}; } var result = {}; if (retClef.token !== undefined) result.foundClef = true; if (ret.accidentals !== undefined) { // Adjust the octave of the accidentals, if necessary ret.accidentals.each(function(acc) { if (retClef.token === 'bass') { //if (acc.note === 'A') acc.note = 'a'; //if (acc.note === 'B') acc.note = 'b'; if (acc.note === 'C') acc.note = 'c'; if (acc.note === 'D' && acc.acc !== 'flat') acc.note = 'd'; if (acc.note === 'E' && acc.acc !== 'flat') acc.note = 'e'; if (acc.note === 'F' && acc.acc !== 'flat') acc.note = 'f'; if (acc.note === 'G' && acc.acc !== 'flat') acc.note = 'g'; } else { if (acc.note === 'a') acc.note = 'A'; if (acc.note === 'b') acc.note = 'B'; if (acc.note === 'C') acc.note = 'c'; } }); multilineVars.key = ret; result.foundKey = true; } return result; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f7c7e4a972bba135a553a5fbd23c045ebc24ee52/abc_parse_header.js/buggy/abc_parse_header.js
var ret = {};
var ret = { root: 'none', acc: '', mode: '' };
this.parseKey = function(str) // (and clef) { str = tokenizer.stripComment(str); var origStr = str; if (str.length === 0) { // an empty K: field is the same as K:none str = 'none'; } // The format is: // [space][tonic[#|b][ ][3-letter-mode][ignored-chars][space]][ accidentals...][ clef=treble|bass|bass3|tenor|alto|alto2|alto1|none [+8|-8]] // -- or -- the key can be "none" // First get the key letter: turn that into a index into the key array (0-11) // Then see if there is a sharp or flat. Increment or decrement. // Then see if there is a mode modifier. Add or subtract to the index. // Then do a mod 12 on the index and return the key. // TODO: This may leave unparsed characters at the end after something reasonable was found. // TODO: The above description does not seem to be valid as key names rather than indexes are used -- GD var setMiddle = function(str) { var i = tokenizer.skipWhiteSpace(str); str = str.substring(i); if (str.startsWith('m=') || str.startsWith('middle=')) { str = str.substring(str.indexOf('=')+1); multilineVars.clef.verticalPos = parseMiddle(str); } }; // check first to see if there is only a clef. If so, just take that, but ignore an error after that. var retClef = tokenizer.getClef(str); if (retClef.token !== undefined && (retClef.explicit === true || retClef.token !== 'none')) { // none is the only ambiguous marking. We need to assume that's a key multilineVars.clef = {type: retClef.token, verticalPos: calcMiddle(retClef.token, 0)}; str = str.substring(retClef.len); setMiddle(str); return {foundClef: true}; //TODO multilinevars.key is not set - is this normal? -- GD } var ret = {}; var retPitch = tokenizer.getKeyPitch(str); if (retPitch.len > 0) { var key = retPitch.token; str = str.substring(retPitch.len); // We got a pitch to start with, so we might also have an accidental and a mode var retAcc = tokenizer.getSharpFlat(str); if (retAcc.len > 0) { key += retAcc.token; str = str.substring(retAcc.len); } var retMode = tokenizer.getMode(str); if (retMode.len > 0) { key += retMode.token; str = str.substring(retMode.len); } // We need to do a deep copy because we are going to modify it ret = this.deepCopyKey({accidentals: keys[key]}); ret.root = retPitch.token; ret.acc = retAcc.token || ""; ret.mode = retMode.token || ""; } else if (str.startsWith('HP')) { this.addDirective("bagpipes"); ret.accidentals = []; ret.root = "HP"; ret.acc = ""; ret.mode = ""; multilineVars.key = ret; return {foundKey: true}; } else if (str.startsWith('Hp')) { ret.accidentals = [ {acc: 'natural', note: 'g'}, {acc: 'sharp', note: 'f'}, {acc: 'sharp', note: 'c'} ]; this.addDirective("bagpipes"); ret.root = "Hp"; ret.acc = ""; ret.mode = ""; multilineVars.key = ret; return {foundKey: true}; } else { var retNone = tokenizer.isMatch(str, 'none'); if (retNone > 0) { // we got the none key - that's the same as C to us ret.accidentals = []; ret.root = "none"; ret.acc = ""; ret.mode = ""; str = str.substring(retNone); } } // There are two special cases of deprecated syntax. Ignore them if they occur var j = tokenizer.skipWhiteSpace(str); str = str.substring(j); if (str.startsWith('exp') || str.startsWith('oct')) str = str.substring(3); // now see if there are extra accidentals var done = false; while (!done) { var retExtra = tokenizer.getKeyAccidental(str); if (retExtra.len === 0) done = true; else { str = str.substring(retExtra.len); if (retExtra.warn) warn("error parsing extra accidentals:", origStr, 0); else { if (!ret.accidentals) ret.accidentals = []; ret.accidentals.push(retExtra.token); } } } // now see if there is a clef retClef = tokenizer.getClef(str); if (retClef.len > 0) { if (retClef.warn) warn("error parsing clef:" + retClef.warn, origStr, 0); else { //ret.clef = retClef.token; multilineVars.clef = {type: retClef.token, verticalPos: calcMiddle(retClef.token, 0)}; str = str.substring(retClef.len); setMiddle(str); } } if (ret.accidentals === undefined && retClef.token === undefined) { warn("error parsing key: ", origStr, 0); return {}; } var result = {}; if (retClef.token !== undefined) result.foundClef = true; if (ret.accidentals !== undefined) { // Adjust the octave of the accidentals, if necessary ret.accidentals.each(function(acc) { if (retClef.token === 'bass') { //if (acc.note === 'A') acc.note = 'a'; //if (acc.note === 'B') acc.note = 'b'; if (acc.note === 'C') acc.note = 'c'; if (acc.note === 'D' && acc.acc !== 'flat') acc.note = 'd'; if (acc.note === 'E' && acc.acc !== 'flat') acc.note = 'e'; if (acc.note === 'F' && acc.acc !== 'flat') acc.note = 'f'; if (acc.note === 'G' && acc.acc !== 'flat') acc.note = 'g'; } else { if (acc.note === 'a') acc.note = 'A'; if (acc.note === 'b') acc.note = 'B'; if (acc.note === 'C') acc.note = 'c'; } }); multilineVars.key = ret; result.foundKey = true; } return result; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f7c7e4a972bba135a553a5fbd23c045ebc24ee52/abc_parse_header.js/buggy/abc_parse_header.js
ret = this.deepCopyKey({accidentals: keys[key]}); ret.root = retPitch.token; ret.acc = retAcc.token || ""; ret.mode = retMode.token || "";
ret = this.deepCopyKey({accidentals: keys[key]}); ret.root = retPitch.token; ret.acc = retAcc.token || ""; ret.mode = retMode.token || "";
this.parseKey = function(str) // (and clef) { str = tokenizer.stripComment(str); var origStr = str; if (str.length === 0) { // an empty K: field is the same as K:none str = 'none'; } // The format is: // [space][tonic[#|b][ ][3-letter-mode][ignored-chars][space]][ accidentals...][ clef=treble|bass|bass3|tenor|alto|alto2|alto1|none [+8|-8]] // -- or -- the key can be "none" // First get the key letter: turn that into a index into the key array (0-11) // Then see if there is a sharp or flat. Increment or decrement. // Then see if there is a mode modifier. Add or subtract to the index. // Then do a mod 12 on the index and return the key. // TODO: This may leave unparsed characters at the end after something reasonable was found. // TODO: The above description does not seem to be valid as key names rather than indexes are used -- GD var setMiddle = function(str) { var i = tokenizer.skipWhiteSpace(str); str = str.substring(i); if (str.startsWith('m=') || str.startsWith('middle=')) { str = str.substring(str.indexOf('=')+1); multilineVars.clef.verticalPos = parseMiddle(str); } }; // check first to see if there is only a clef. If so, just take that, but ignore an error after that. var retClef = tokenizer.getClef(str); if (retClef.token !== undefined && (retClef.explicit === true || retClef.token !== 'none')) { // none is the only ambiguous marking. We need to assume that's a key multilineVars.clef = {type: retClef.token, verticalPos: calcMiddle(retClef.token, 0)}; str = str.substring(retClef.len); setMiddle(str); return {foundClef: true}; //TODO multilinevars.key is not set - is this normal? -- GD } var ret = {}; var retPitch = tokenizer.getKeyPitch(str); if (retPitch.len > 0) { var key = retPitch.token; str = str.substring(retPitch.len); // We got a pitch to start with, so we might also have an accidental and a mode var retAcc = tokenizer.getSharpFlat(str); if (retAcc.len > 0) { key += retAcc.token; str = str.substring(retAcc.len); } var retMode = tokenizer.getMode(str); if (retMode.len > 0) { key += retMode.token; str = str.substring(retMode.len); } // We need to do a deep copy because we are going to modify it ret = this.deepCopyKey({accidentals: keys[key]}); ret.root = retPitch.token; ret.acc = retAcc.token || ""; ret.mode = retMode.token || ""; } else if (str.startsWith('HP')) { this.addDirective("bagpipes"); ret.accidentals = []; ret.root = "HP"; ret.acc = ""; ret.mode = ""; multilineVars.key = ret; return {foundKey: true}; } else if (str.startsWith('Hp')) { ret.accidentals = [ {acc: 'natural', note: 'g'}, {acc: 'sharp', note: 'f'}, {acc: 'sharp', note: 'c'} ]; this.addDirective("bagpipes"); ret.root = "Hp"; ret.acc = ""; ret.mode = ""; multilineVars.key = ret; return {foundKey: true}; } else { var retNone = tokenizer.isMatch(str, 'none'); if (retNone > 0) { // we got the none key - that's the same as C to us ret.accidentals = []; ret.root = "none"; ret.acc = ""; ret.mode = ""; str = str.substring(retNone); } } // There are two special cases of deprecated syntax. Ignore them if they occur var j = tokenizer.skipWhiteSpace(str); str = str.substring(j); if (str.startsWith('exp') || str.startsWith('oct')) str = str.substring(3); // now see if there are extra accidentals var done = false; while (!done) { var retExtra = tokenizer.getKeyAccidental(str); if (retExtra.len === 0) done = true; else { str = str.substring(retExtra.len); if (retExtra.warn) warn("error parsing extra accidentals:", origStr, 0); else { if (!ret.accidentals) ret.accidentals = []; ret.accidentals.push(retExtra.token); } } } // now see if there is a clef retClef = tokenizer.getClef(str); if (retClef.len > 0) { if (retClef.warn) warn("error parsing clef:" + retClef.warn, origStr, 0); else { //ret.clef = retClef.token; multilineVars.clef = {type: retClef.token, verticalPos: calcMiddle(retClef.token, 0)}; str = str.substring(retClef.len); setMiddle(str); } } if (ret.accidentals === undefined && retClef.token === undefined) { warn("error parsing key: ", origStr, 0); return {}; } var result = {}; if (retClef.token !== undefined) result.foundClef = true; if (ret.accidentals !== undefined) { // Adjust the octave of the accidentals, if necessary ret.accidentals.each(function(acc) { if (retClef.token === 'bass') { //if (acc.note === 'A') acc.note = 'a'; //if (acc.note === 'B') acc.note = 'b'; if (acc.note === 'C') acc.note = 'c'; if (acc.note === 'D' && acc.acc !== 'flat') acc.note = 'd'; if (acc.note === 'E' && acc.acc !== 'flat') acc.note = 'e'; if (acc.note === 'F' && acc.acc !== 'flat') acc.note = 'f'; if (acc.note === 'G' && acc.acc !== 'flat') acc.note = 'g'; } else { if (acc.note === 'a') acc.note = 'A'; if (acc.note === 'b') acc.note = 'B'; if (acc.note === 'C') acc.note = 'c'; } }); multilineVars.key = ret; result.foundKey = true; } return result; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f7c7e4a972bba135a553a5fbd23c045ebc24ee52/abc_parse_header.js/buggy/abc_parse_header.js
ret.root = "HP"; ret.acc = ""; ret.mode = "";
ret.root = "HP";
this.parseKey = function(str) // (and clef) { str = tokenizer.stripComment(str); var origStr = str; if (str.length === 0) { // an empty K: field is the same as K:none str = 'none'; } // The format is: // [space][tonic[#|b][ ][3-letter-mode][ignored-chars][space]][ accidentals...][ clef=treble|bass|bass3|tenor|alto|alto2|alto1|none [+8|-8]] // -- or -- the key can be "none" // First get the key letter: turn that into a index into the key array (0-11) // Then see if there is a sharp or flat. Increment or decrement. // Then see if there is a mode modifier. Add or subtract to the index. // Then do a mod 12 on the index and return the key. // TODO: This may leave unparsed characters at the end after something reasonable was found. // TODO: The above description does not seem to be valid as key names rather than indexes are used -- GD var setMiddle = function(str) { var i = tokenizer.skipWhiteSpace(str); str = str.substring(i); if (str.startsWith('m=') || str.startsWith('middle=')) { str = str.substring(str.indexOf('=')+1); multilineVars.clef.verticalPos = parseMiddle(str); } }; // check first to see if there is only a clef. If so, just take that, but ignore an error after that. var retClef = tokenizer.getClef(str); if (retClef.token !== undefined && (retClef.explicit === true || retClef.token !== 'none')) { // none is the only ambiguous marking. We need to assume that's a key multilineVars.clef = {type: retClef.token, verticalPos: calcMiddle(retClef.token, 0)}; str = str.substring(retClef.len); setMiddle(str); return {foundClef: true}; //TODO multilinevars.key is not set - is this normal? -- GD } var ret = {}; var retPitch = tokenizer.getKeyPitch(str); if (retPitch.len > 0) { var key = retPitch.token; str = str.substring(retPitch.len); // We got a pitch to start with, so we might also have an accidental and a mode var retAcc = tokenizer.getSharpFlat(str); if (retAcc.len > 0) { key += retAcc.token; str = str.substring(retAcc.len); } var retMode = tokenizer.getMode(str); if (retMode.len > 0) { key += retMode.token; str = str.substring(retMode.len); } // We need to do a deep copy because we are going to modify it ret = this.deepCopyKey({accidentals: keys[key]}); ret.root = retPitch.token; ret.acc = retAcc.token || ""; ret.mode = retMode.token || ""; } else if (str.startsWith('HP')) { this.addDirective("bagpipes"); ret.accidentals = []; ret.root = "HP"; ret.acc = ""; ret.mode = ""; multilineVars.key = ret; return {foundKey: true}; } else if (str.startsWith('Hp')) { ret.accidentals = [ {acc: 'natural', note: 'g'}, {acc: 'sharp', note: 'f'}, {acc: 'sharp', note: 'c'} ]; this.addDirective("bagpipes"); ret.root = "Hp"; ret.acc = ""; ret.mode = ""; multilineVars.key = ret; return {foundKey: true}; } else { var retNone = tokenizer.isMatch(str, 'none'); if (retNone > 0) { // we got the none key - that's the same as C to us ret.accidentals = []; ret.root = "none"; ret.acc = ""; ret.mode = ""; str = str.substring(retNone); } } // There are two special cases of deprecated syntax. Ignore them if they occur var j = tokenizer.skipWhiteSpace(str); str = str.substring(j); if (str.startsWith('exp') || str.startsWith('oct')) str = str.substring(3); // now see if there are extra accidentals var done = false; while (!done) { var retExtra = tokenizer.getKeyAccidental(str); if (retExtra.len === 0) done = true; else { str = str.substring(retExtra.len); if (retExtra.warn) warn("error parsing extra accidentals:", origStr, 0); else { if (!ret.accidentals) ret.accidentals = []; ret.accidentals.push(retExtra.token); } } } // now see if there is a clef retClef = tokenizer.getClef(str); if (retClef.len > 0) { if (retClef.warn) warn("error parsing clef:" + retClef.warn, origStr, 0); else { //ret.clef = retClef.token; multilineVars.clef = {type: retClef.token, verticalPos: calcMiddle(retClef.token, 0)}; str = str.substring(retClef.len); setMiddle(str); } } if (ret.accidentals === undefined && retClef.token === undefined) { warn("error parsing key: ", origStr, 0); return {}; } var result = {}; if (retClef.token !== undefined) result.foundClef = true; if (ret.accidentals !== undefined) { // Adjust the octave of the accidentals, if necessary ret.accidentals.each(function(acc) { if (retClef.token === 'bass') { //if (acc.note === 'A') acc.note = 'a'; //if (acc.note === 'B') acc.note = 'b'; if (acc.note === 'C') acc.note = 'c'; if (acc.note === 'D' && acc.acc !== 'flat') acc.note = 'd'; if (acc.note === 'E' && acc.acc !== 'flat') acc.note = 'e'; if (acc.note === 'F' && acc.acc !== 'flat') acc.note = 'f'; if (acc.note === 'G' && acc.acc !== 'flat') acc.note = 'g'; } else { if (acc.note === 'a') acc.note = 'A'; if (acc.note === 'b') acc.note = 'B'; if (acc.note === 'C') acc.note = 'c'; } }); multilineVars.key = ret; result.foundKey = true; } return result; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f7c7e4a972bba135a553a5fbd23c045ebc24ee52/abc_parse_header.js/buggy/abc_parse_header.js
ret.root = "Hp"; ret.acc = ""; ret.mode = "";
ret.root = "Hp";
this.parseKey = function(str) // (and clef) { str = tokenizer.stripComment(str); var origStr = str; if (str.length === 0) { // an empty K: field is the same as K:none str = 'none'; } // The format is: // [space][tonic[#|b][ ][3-letter-mode][ignored-chars][space]][ accidentals...][ clef=treble|bass|bass3|tenor|alto|alto2|alto1|none [+8|-8]] // -- or -- the key can be "none" // First get the key letter: turn that into a index into the key array (0-11) // Then see if there is a sharp or flat. Increment or decrement. // Then see if there is a mode modifier. Add or subtract to the index. // Then do a mod 12 on the index and return the key. // TODO: This may leave unparsed characters at the end after something reasonable was found. // TODO: The above description does not seem to be valid as key names rather than indexes are used -- GD var setMiddle = function(str) { var i = tokenizer.skipWhiteSpace(str); str = str.substring(i); if (str.startsWith('m=') || str.startsWith('middle=')) { str = str.substring(str.indexOf('=')+1); multilineVars.clef.verticalPos = parseMiddle(str); } }; // check first to see if there is only a clef. If so, just take that, but ignore an error after that. var retClef = tokenizer.getClef(str); if (retClef.token !== undefined && (retClef.explicit === true || retClef.token !== 'none')) { // none is the only ambiguous marking. We need to assume that's a key multilineVars.clef = {type: retClef.token, verticalPos: calcMiddle(retClef.token, 0)}; str = str.substring(retClef.len); setMiddle(str); return {foundClef: true}; //TODO multilinevars.key is not set - is this normal? -- GD } var ret = {}; var retPitch = tokenizer.getKeyPitch(str); if (retPitch.len > 0) { var key = retPitch.token; str = str.substring(retPitch.len); // We got a pitch to start with, so we might also have an accidental and a mode var retAcc = tokenizer.getSharpFlat(str); if (retAcc.len > 0) { key += retAcc.token; str = str.substring(retAcc.len); } var retMode = tokenizer.getMode(str); if (retMode.len > 0) { key += retMode.token; str = str.substring(retMode.len); } // We need to do a deep copy because we are going to modify it ret = this.deepCopyKey({accidentals: keys[key]}); ret.root = retPitch.token; ret.acc = retAcc.token || ""; ret.mode = retMode.token || ""; } else if (str.startsWith('HP')) { this.addDirective("bagpipes"); ret.accidentals = []; ret.root = "HP"; ret.acc = ""; ret.mode = ""; multilineVars.key = ret; return {foundKey: true}; } else if (str.startsWith('Hp')) { ret.accidentals = [ {acc: 'natural', note: 'g'}, {acc: 'sharp', note: 'f'}, {acc: 'sharp', note: 'c'} ]; this.addDirective("bagpipes"); ret.root = "Hp"; ret.acc = ""; ret.mode = ""; multilineVars.key = ret; return {foundKey: true}; } else { var retNone = tokenizer.isMatch(str, 'none'); if (retNone > 0) { // we got the none key - that's the same as C to us ret.accidentals = []; ret.root = "none"; ret.acc = ""; ret.mode = ""; str = str.substring(retNone); } } // There are two special cases of deprecated syntax. Ignore them if they occur var j = tokenizer.skipWhiteSpace(str); str = str.substring(j); if (str.startsWith('exp') || str.startsWith('oct')) str = str.substring(3); // now see if there are extra accidentals var done = false; while (!done) { var retExtra = tokenizer.getKeyAccidental(str); if (retExtra.len === 0) done = true; else { str = str.substring(retExtra.len); if (retExtra.warn) warn("error parsing extra accidentals:", origStr, 0); else { if (!ret.accidentals) ret.accidentals = []; ret.accidentals.push(retExtra.token); } } } // now see if there is a clef retClef = tokenizer.getClef(str); if (retClef.len > 0) { if (retClef.warn) warn("error parsing clef:" + retClef.warn, origStr, 0); else { //ret.clef = retClef.token; multilineVars.clef = {type: retClef.token, verticalPos: calcMiddle(retClef.token, 0)}; str = str.substring(retClef.len); setMiddle(str); } } if (ret.accidentals === undefined && retClef.token === undefined) { warn("error parsing key: ", origStr, 0); return {}; } var result = {}; if (retClef.token !== undefined) result.foundClef = true; if (ret.accidentals !== undefined) { // Adjust the octave of the accidentals, if necessary ret.accidentals.each(function(acc) { if (retClef.token === 'bass') { //if (acc.note === 'A') acc.note = 'a'; //if (acc.note === 'B') acc.note = 'b'; if (acc.note === 'C') acc.note = 'c'; if (acc.note === 'D' && acc.acc !== 'flat') acc.note = 'd'; if (acc.note === 'E' && acc.acc !== 'flat') acc.note = 'e'; if (acc.note === 'F' && acc.acc !== 'flat') acc.note = 'f'; if (acc.note === 'G' && acc.acc !== 'flat') acc.note = 'g'; } else { if (acc.note === 'a') acc.note = 'A'; if (acc.note === 'b') acc.note = 'B'; if (acc.note === 'C') acc.note = 'c'; } }); multilineVars.key = ret; result.foundKey = true; } return result; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f7c7e4a972bba135a553a5fbd23c045ebc24ee52/abc_parse_header.js/buggy/abc_parse_header.js
ret.root = "none"; ret.acc = ""; ret.mode = "";
this.parseKey = function(str) // (and clef) { str = tokenizer.stripComment(str); var origStr = str; if (str.length === 0) { // an empty K: field is the same as K:none str = 'none'; } // The format is: // [space][tonic[#|b][ ][3-letter-mode][ignored-chars][space]][ accidentals...][ clef=treble|bass|bass3|tenor|alto|alto2|alto1|none [+8|-8]] // -- or -- the key can be "none" // First get the key letter: turn that into a index into the key array (0-11) // Then see if there is a sharp or flat. Increment or decrement. // Then see if there is a mode modifier. Add or subtract to the index. // Then do a mod 12 on the index and return the key. // TODO: This may leave unparsed characters at the end after something reasonable was found. // TODO: The above description does not seem to be valid as key names rather than indexes are used -- GD var setMiddle = function(str) { var i = tokenizer.skipWhiteSpace(str); str = str.substring(i); if (str.startsWith('m=') || str.startsWith('middle=')) { str = str.substring(str.indexOf('=')+1); multilineVars.clef.verticalPos = parseMiddle(str); } }; // check first to see if there is only a clef. If so, just take that, but ignore an error after that. var retClef = tokenizer.getClef(str); if (retClef.token !== undefined && (retClef.explicit === true || retClef.token !== 'none')) { // none is the only ambiguous marking. We need to assume that's a key multilineVars.clef = {type: retClef.token, verticalPos: calcMiddle(retClef.token, 0)}; str = str.substring(retClef.len); setMiddle(str); return {foundClef: true}; //TODO multilinevars.key is not set - is this normal? -- GD } var ret = {}; var retPitch = tokenizer.getKeyPitch(str); if (retPitch.len > 0) { var key = retPitch.token; str = str.substring(retPitch.len); // We got a pitch to start with, so we might also have an accidental and a mode var retAcc = tokenizer.getSharpFlat(str); if (retAcc.len > 0) { key += retAcc.token; str = str.substring(retAcc.len); } var retMode = tokenizer.getMode(str); if (retMode.len > 0) { key += retMode.token; str = str.substring(retMode.len); } // We need to do a deep copy because we are going to modify it ret = this.deepCopyKey({accidentals: keys[key]}); ret.root = retPitch.token; ret.acc = retAcc.token || ""; ret.mode = retMode.token || ""; } else if (str.startsWith('HP')) { this.addDirective("bagpipes"); ret.accidentals = []; ret.root = "HP"; ret.acc = ""; ret.mode = ""; multilineVars.key = ret; return {foundKey: true}; } else if (str.startsWith('Hp')) { ret.accidentals = [ {acc: 'natural', note: 'g'}, {acc: 'sharp', note: 'f'}, {acc: 'sharp', note: 'c'} ]; this.addDirective("bagpipes"); ret.root = "Hp"; ret.acc = ""; ret.mode = ""; multilineVars.key = ret; return {foundKey: true}; } else { var retNone = tokenizer.isMatch(str, 'none'); if (retNone > 0) { // we got the none key - that's the same as C to us ret.accidentals = []; ret.root = "none"; ret.acc = ""; ret.mode = ""; str = str.substring(retNone); } } // There are two special cases of deprecated syntax. Ignore them if they occur var j = tokenizer.skipWhiteSpace(str); str = str.substring(j); if (str.startsWith('exp') || str.startsWith('oct')) str = str.substring(3); // now see if there are extra accidentals var done = false; while (!done) { var retExtra = tokenizer.getKeyAccidental(str); if (retExtra.len === 0) done = true; else { str = str.substring(retExtra.len); if (retExtra.warn) warn("error parsing extra accidentals:", origStr, 0); else { if (!ret.accidentals) ret.accidentals = []; ret.accidentals.push(retExtra.token); } } } // now see if there is a clef retClef = tokenizer.getClef(str); if (retClef.len > 0) { if (retClef.warn) warn("error parsing clef:" + retClef.warn, origStr, 0); else { //ret.clef = retClef.token; multilineVars.clef = {type: retClef.token, verticalPos: calcMiddle(retClef.token, 0)}; str = str.substring(retClef.len); setMiddle(str); } } if (ret.accidentals === undefined && retClef.token === undefined) { warn("error parsing key: ", origStr, 0); return {}; } var result = {}; if (retClef.token !== undefined) result.foundClef = true; if (ret.accidentals !== undefined) { // Adjust the octave of the accidentals, if necessary ret.accidentals.each(function(acc) { if (retClef.token === 'bass') { //if (acc.note === 'A') acc.note = 'a'; //if (acc.note === 'B') acc.note = 'b'; if (acc.note === 'C') acc.note = 'c'; if (acc.note === 'D' && acc.acc !== 'flat') acc.note = 'd'; if (acc.note === 'E' && acc.acc !== 'flat') acc.note = 'e'; if (acc.note === 'F' && acc.acc !== 'flat') acc.note = 'f'; if (acc.note === 'G' && acc.acc !== 'flat') acc.note = 'g'; } else { if (acc.note === 'a') acc.note = 'A'; if (acc.note === 'b') acc.note = 'B'; if (acc.note === 'C') acc.note = 'c'; } }); multilineVars.key = ret; result.foundKey = true; } return result; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f7c7e4a972bba135a553a5fbd23c045ebc24ee52/abc_parse_header.js/buggy/abc_parse_header.js
setMiddle(str);
setClefMiddle(str);
this.parseKey = function(str) // (and clef) { str = tokenizer.stripComment(str); var origStr = str; if (str.length === 0) { // an empty K: field is the same as K:none str = 'none'; } // The format is: // [space][tonic[#|b][ ][3-letter-mode][ignored-chars][space]][ accidentals...][ clef=treble|bass|bass3|tenor|alto|alto2|alto1|none [+8|-8]] // -- or -- the key can be "none" // First get the key letter: turn that into a index into the key array (0-11) // Then see if there is a sharp or flat. Increment or decrement. // Then see if there is a mode modifier. Add or subtract to the index. // Then do a mod 12 on the index and return the key. // TODO: This may leave unparsed characters at the end after something reasonable was found. // TODO: The above description does not seem to be valid as key names rather than indexes are used -- GD var setMiddle = function(str) { var i = tokenizer.skipWhiteSpace(str); str = str.substring(i); if (str.startsWith('m=') || str.startsWith('middle=')) { str = str.substring(str.indexOf('=')+1); multilineVars.clef.verticalPos = parseMiddle(str); } }; // check first to see if there is only a clef. If so, just take that, but ignore an error after that. var retClef = tokenizer.getClef(str); if (retClef.token !== undefined && (retClef.explicit === true || retClef.token !== 'none')) { // none is the only ambiguous marking. We need to assume that's a key multilineVars.clef = {type: retClef.token, verticalPos: calcMiddle(retClef.token, 0)}; str = str.substring(retClef.len); setMiddle(str); return {foundClef: true}; //TODO multilinevars.key is not set - is this normal? -- GD } var ret = {}; var retPitch = tokenizer.getKeyPitch(str); if (retPitch.len > 0) { var key = retPitch.token; str = str.substring(retPitch.len); // We got a pitch to start with, so we might also have an accidental and a mode var retAcc = tokenizer.getSharpFlat(str); if (retAcc.len > 0) { key += retAcc.token; str = str.substring(retAcc.len); } var retMode = tokenizer.getMode(str); if (retMode.len > 0) { key += retMode.token; str = str.substring(retMode.len); } // We need to do a deep copy because we are going to modify it ret = this.deepCopyKey({accidentals: keys[key]}); ret.root = retPitch.token; ret.acc = retAcc.token || ""; ret.mode = retMode.token || ""; } else if (str.startsWith('HP')) { this.addDirective("bagpipes"); ret.accidentals = []; ret.root = "HP"; ret.acc = ""; ret.mode = ""; multilineVars.key = ret; return {foundKey: true}; } else if (str.startsWith('Hp')) { ret.accidentals = [ {acc: 'natural', note: 'g'}, {acc: 'sharp', note: 'f'}, {acc: 'sharp', note: 'c'} ]; this.addDirective("bagpipes"); ret.root = "Hp"; ret.acc = ""; ret.mode = ""; multilineVars.key = ret; return {foundKey: true}; } else { var retNone = tokenizer.isMatch(str, 'none'); if (retNone > 0) { // we got the none key - that's the same as C to us ret.accidentals = []; ret.root = "none"; ret.acc = ""; ret.mode = ""; str = str.substring(retNone); } } // There are two special cases of deprecated syntax. Ignore them if they occur var j = tokenizer.skipWhiteSpace(str); str = str.substring(j); if (str.startsWith('exp') || str.startsWith('oct')) str = str.substring(3); // now see if there are extra accidentals var done = false; while (!done) { var retExtra = tokenizer.getKeyAccidental(str); if (retExtra.len === 0) done = true; else { str = str.substring(retExtra.len); if (retExtra.warn) warn("error parsing extra accidentals:", origStr, 0); else { if (!ret.accidentals) ret.accidentals = []; ret.accidentals.push(retExtra.token); } } } // now see if there is a clef retClef = tokenizer.getClef(str); if (retClef.len > 0) { if (retClef.warn) warn("error parsing clef:" + retClef.warn, origStr, 0); else { //ret.clef = retClef.token; multilineVars.clef = {type: retClef.token, verticalPos: calcMiddle(retClef.token, 0)}; str = str.substring(retClef.len); setMiddle(str); } } if (ret.accidentals === undefined && retClef.token === undefined) { warn("error parsing key: ", origStr, 0); return {}; } var result = {}; if (retClef.token !== undefined) result.foundClef = true; if (ret.accidentals !== undefined) { // Adjust the octave of the accidentals, if necessary ret.accidentals.each(function(acc) { if (retClef.token === 'bass') { //if (acc.note === 'A') acc.note = 'a'; //if (acc.note === 'B') acc.note = 'b'; if (acc.note === 'C') acc.note = 'c'; if (acc.note === 'D' && acc.acc !== 'flat') acc.note = 'd'; if (acc.note === 'E' && acc.acc !== 'flat') acc.note = 'e'; if (acc.note === 'F' && acc.acc !== 'flat') acc.note = 'f'; if (acc.note === 'G' && acc.acc !== 'flat') acc.note = 'g'; } else { if (acc.note === 'a') acc.note = 'A'; if (acc.note === 'b') acc.note = 'B'; if (acc.note === 'C') acc.note = 'c'; } }); multilineVars.key = ret; result.foundKey = true; } return result; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f7c7e4a972bba135a553a5fbd23c045ebc24ee52/abc_parse_header.js/buggy/abc_parse_header.js
{ var origStr = str;
{ var origStr = str;
this.parseKey = function(str) // (and clef) { var origStr = str; // The format is: // [space][tonic[#|b][ ][3-letter-mode][ignored-chars][space]][ accidentals...][ clef=treble|bass|bass3|tenor|alto|alto2|alto1|none [+8|-8]] // -- or -- the key can be "none" // First get the key letter: turn that into a index into the key array (0-11) // Then see if there is a sharp or flat. Increment or decrement. // Then see if there is a mode modifier. Add or subtract to the index. // Then do a mod 12 on the index and return the key. // TODO: This may leave unparsed characters at the end after something reasonable was found. var setMiddle = function(str) { var i = tokenizer.skipWhiteSpace(str); str = str.substring(i); if (str.startsWith('m=') || str.startsWith('middle=')) { str = str.substring(str.indexOf('=')+1); multilineVars.clef.middle = parseMiddle(str); } }; // check first to see if there is only a clef. If so, just take that, but ignore an error after that. var retClef = tokenizer.getClef(str); if (retClef.token !== undefined && (retClef.explicit === true || retClef.token !== 'none')) { // none is the only ambiguous marking. We need to assume that's a key multilineVars.clef = { type: retClef.token, middle: calcMiddle(retClef.token, 0) }; str = str.substring(retClef.len); setMiddle(str); return {foundClef: true}; } var ret = {}; var retPitch = tokenizer.getKeyPitch(str); if (retPitch.len > 0) { var key = retPitch.token; str = str.substring(retPitch.len); // We got a pitch to start with, so we might also have an accidental and a mode var retAcc = tokenizer.getSharpFlat(str); if (retAcc.len > 0) { key += retAcc.token; str = str.substring(retAcc.len); } var retMode = tokenizer.getMode(str); if (retMode.len > 0) { key += retMode.token; str = str.substring(retMode.len); } // We need to do a deep copy because we are going to modify it ret.extraAccidentals = []; keys[key].each(function(k) { ret.extraAccidentals.push(Object.clone(k)); }); } else if (str.startsWith('HP')) { this.addDirective("bagpipes"); ret.extraAccidentals = []; multilineVars.key = ret; return {foundKey: true}; } else if (str.startsWith('Hp')) { ret.extraAccidentals = [ {acc: 'natural', note: 'g'}, {acc: 'sharp', note: 'f'}, {acc: 'sharp', note: 'c'} ]; this.addDirective("bagpipes"); multilineVars.key = ret; return {foundKey: true}; } else { var retNone = tokenizer.isMatch(str, 'none'); if (retNone > 0) { // we got the none key - that's the same as C to us ret.extraAccidentals = []; str = str.substring(retNone); } } // There are two special cases of deprecated syntax. Ignore them if they occur var j = tokenizer.skipWhiteSpace(str); str = str.substring(j); if (str.startsWith('exp') || str.startsWith('oct')) str = str.substring(3); // now see if there are extra accidentals var done = false; while (!done) { var retExtra = tokenizer.getKeyAccidental(str); if (retExtra.len === 0) done = true; else { str = str.substring(retExtra.len); if (retExtra.warn) warn("error parsing extra accidentals:", origStr, 0); else { if (!ret.extraAccidentals) ret.extraAccidentals = []; ret.extraAccidentals.push(retExtra.token); } } } // now see if there is a clef retClef = tokenizer.getClef(str); if (retClef.len > 0) { if (retClef.warn) warn("error parsing clef:" + retClef.warn, origStr, 0); else { //ret.clef = retClef.token; multilineVars.clef = { type: retClef.token, middle: calcMiddle(retClef.token, 0) }; str = str.substring(retClef.len); setMiddle(str); } } if (ret.regularKey === undefined && ret.extraAccidentals === undefined && retClef.token === undefined) { warn("error parsing key: ", origStr, 0); //ret.regularKey = keys.C; return {}; } var result = {}; if (retClef.token !== undefined) result.foundClef = true; if (ret.regularKey !== undefined || ret.extraAccidentals !== undefined) { multilineVars.key = ret; result.foundKey = true; } return result; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f5a9f7ef8d556b3359fab3994dac1ddd87440bb3/abc_parse_header.js/buggy/abc_parse_header.js
var setMiddle = function(str) { var i = tokenizer.skipWhiteSpace(str); str = str.substring(i); if (str.startsWith('m=') || str.startsWith('middle=')) { str = str.substring(str.indexOf('=')+1); multilineVars.clef.middle = parseMiddle(str);
var setMiddle = function(str) { var i = tokenizer.skipWhiteSpace(str); str = str.substring(i); if (str.startsWith('m=') || str.startsWith('middle=')) { str = str.substring(str.indexOf('=')+1); multilineVars.clef.middle = parseMiddle(str); } }; var retClef = tokenizer.getClef(str); if (retClef.token !== undefined && (retClef.explicit === true || retClef.token !== 'none')) { multilineVars.clef = { type: retClef.token, middle: calcMiddle(retClef.token, 0) }; str = str.substring(retClef.len); setMiddle(str); return {foundClef: true}; } var ret = {}; var retPitch = tokenizer.getKeyPitch(str); if (retPitch.len > 0) { var key = retPitch.token; str = str.substring(retPitch.len); var retAcc = tokenizer.getSharpFlat(str); if (retAcc.len > 0) { key += retAcc.token; str = str.substring(retAcc.len); } var retMode = tokenizer.getMode(str); if (retMode.len > 0) { key += retMode.token; str = str.substring(retMode.len); } ret.extraAccidentals = []; keys[key].each(function(k) { ret.extraAccidentals.push(Object.clone(k)); }); } else if (str.startsWith('HP')) { this.addDirective("bagpipes"); ret.extraAccidentals = []; multilineVars.key = ret; return {foundKey: true}; } else if (str.startsWith('Hp')) { ret.extraAccidentals = [ {acc: 'natural', note: 'g'}, {acc: 'sharp', note: 'f'}, {acc: 'sharp', note: 'c'} ]; this.addDirective("bagpipes"); multilineVars.key = ret; return {foundKey: true}; } else { var retNone = tokenizer.isMatch(str, 'none'); if (retNone > 0) { ret.extraAccidentals = []; str = str.substring(retNone); } } var j = tokenizer.skipWhiteSpace(str); str = str.substring(j); if (str.startsWith('exp') || str.startsWith('oct')) str = str.substring(3); var done = false; while (!done) { var retExtra = tokenizer.getKeyAccidental(str); if (retExtra.len === 0) done = true; else { str = str.substring(retExtra.len); if (retExtra.warn) warn("error parsing extra accidentals:", origStr, 0); else { if (!ret.extraAccidentals) ret.extraAccidentals = []; ret.extraAccidentals.push(retExtra.token);
this.parseKey = function(str) // (and clef) { var origStr = str; // The format is: // [space][tonic[#|b][ ][3-letter-mode][ignored-chars][space]][ accidentals...][ clef=treble|bass|bass3|tenor|alto|alto2|alto1|none [+8|-8]] // -- or -- the key can be "none" // First get the key letter: turn that into a index into the key array (0-11) // Then see if there is a sharp or flat. Increment or decrement. // Then see if there is a mode modifier. Add or subtract to the index. // Then do a mod 12 on the index and return the key. // TODO: This may leave unparsed characters at the end after something reasonable was found. var setMiddle = function(str) { var i = tokenizer.skipWhiteSpace(str); str = str.substring(i); if (str.startsWith('m=') || str.startsWith('middle=')) { str = str.substring(str.indexOf('=')+1); multilineVars.clef.middle = parseMiddle(str); } }; // check first to see if there is only a clef. If so, just take that, but ignore an error after that. var retClef = tokenizer.getClef(str); if (retClef.token !== undefined && (retClef.explicit === true || retClef.token !== 'none')) { // none is the only ambiguous marking. We need to assume that's a key multilineVars.clef = { type: retClef.token, middle: calcMiddle(retClef.token, 0) }; str = str.substring(retClef.len); setMiddle(str); return {foundClef: true}; } var ret = {}; var retPitch = tokenizer.getKeyPitch(str); if (retPitch.len > 0) { var key = retPitch.token; str = str.substring(retPitch.len); // We got a pitch to start with, so we might also have an accidental and a mode var retAcc = tokenizer.getSharpFlat(str); if (retAcc.len > 0) { key += retAcc.token; str = str.substring(retAcc.len); } var retMode = tokenizer.getMode(str); if (retMode.len > 0) { key += retMode.token; str = str.substring(retMode.len); } // We need to do a deep copy because we are going to modify it ret.extraAccidentals = []; keys[key].each(function(k) { ret.extraAccidentals.push(Object.clone(k)); }); } else if (str.startsWith('HP')) { this.addDirective("bagpipes"); ret.extraAccidentals = []; multilineVars.key = ret; return {foundKey: true}; } else if (str.startsWith('Hp')) { ret.extraAccidentals = [ {acc: 'natural', note: 'g'}, {acc: 'sharp', note: 'f'}, {acc: 'sharp', note: 'c'} ]; this.addDirective("bagpipes"); multilineVars.key = ret; return {foundKey: true}; } else { var retNone = tokenizer.isMatch(str, 'none'); if (retNone > 0) { // we got the none key - that's the same as C to us ret.extraAccidentals = []; str = str.substring(retNone); } } // There are two special cases of deprecated syntax. Ignore them if they occur var j = tokenizer.skipWhiteSpace(str); str = str.substring(j); if (str.startsWith('exp') || str.startsWith('oct')) str = str.substring(3); // now see if there are extra accidentals var done = false; while (!done) { var retExtra = tokenizer.getKeyAccidental(str); if (retExtra.len === 0) done = true; else { str = str.substring(retExtra.len); if (retExtra.warn) warn("error parsing extra accidentals:", origStr, 0); else { if (!ret.extraAccidentals) ret.extraAccidentals = []; ret.extraAccidentals.push(retExtra.token); } } } // now see if there is a clef retClef = tokenizer.getClef(str); if (retClef.len > 0) { if (retClef.warn) warn("error parsing clef:" + retClef.warn, origStr, 0); else { //ret.clef = retClef.token; multilineVars.clef = { type: retClef.token, middle: calcMiddle(retClef.token, 0) }; str = str.substring(retClef.len); setMiddle(str); } } if (ret.regularKey === undefined && ret.extraAccidentals === undefined && retClef.token === undefined) { warn("error parsing key: ", origStr, 0); //ret.regularKey = keys.C; return {}; } var result = {}; if (retClef.token !== undefined) result.foundClef = true; if (ret.regularKey !== undefined || ret.extraAccidentals !== undefined) { multilineVars.key = ret; result.foundKey = true; } return result; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f5a9f7ef8d556b3359fab3994dac1ddd87440bb3/abc_parse_header.js/buggy/abc_parse_header.js
}; var retClef = tokenizer.getClef(str); if (retClef.token !== undefined && (retClef.explicit === true || retClef.token !== 'none')) {
} } retClef = tokenizer.getClef(str); if (retClef.len > 0) { if (retClef.warn) warn("error parsing clef:" + retClef.warn, origStr, 0); else {
this.parseKey = function(str) // (and clef) { var origStr = str; // The format is: // [space][tonic[#|b][ ][3-letter-mode][ignored-chars][space]][ accidentals...][ clef=treble|bass|bass3|tenor|alto|alto2|alto1|none [+8|-8]] // -- or -- the key can be "none" // First get the key letter: turn that into a index into the key array (0-11) // Then see if there is a sharp or flat. Increment or decrement. // Then see if there is a mode modifier. Add or subtract to the index. // Then do a mod 12 on the index and return the key. // TODO: This may leave unparsed characters at the end after something reasonable was found. var setMiddle = function(str) { var i = tokenizer.skipWhiteSpace(str); str = str.substring(i); if (str.startsWith('m=') || str.startsWith('middle=')) { str = str.substring(str.indexOf('=')+1); multilineVars.clef.middle = parseMiddle(str); } }; // check first to see if there is only a clef. If so, just take that, but ignore an error after that. var retClef = tokenizer.getClef(str); if (retClef.token !== undefined && (retClef.explicit === true || retClef.token !== 'none')) { // none is the only ambiguous marking. We need to assume that's a key multilineVars.clef = { type: retClef.token, middle: calcMiddle(retClef.token, 0) }; str = str.substring(retClef.len); setMiddle(str); return {foundClef: true}; } var ret = {}; var retPitch = tokenizer.getKeyPitch(str); if (retPitch.len > 0) { var key = retPitch.token; str = str.substring(retPitch.len); // We got a pitch to start with, so we might also have an accidental and a mode var retAcc = tokenizer.getSharpFlat(str); if (retAcc.len > 0) { key += retAcc.token; str = str.substring(retAcc.len); } var retMode = tokenizer.getMode(str); if (retMode.len > 0) { key += retMode.token; str = str.substring(retMode.len); } // We need to do a deep copy because we are going to modify it ret.extraAccidentals = []; keys[key].each(function(k) { ret.extraAccidentals.push(Object.clone(k)); }); } else if (str.startsWith('HP')) { this.addDirective("bagpipes"); ret.extraAccidentals = []; multilineVars.key = ret; return {foundKey: true}; } else if (str.startsWith('Hp')) { ret.extraAccidentals = [ {acc: 'natural', note: 'g'}, {acc: 'sharp', note: 'f'}, {acc: 'sharp', note: 'c'} ]; this.addDirective("bagpipes"); multilineVars.key = ret; return {foundKey: true}; } else { var retNone = tokenizer.isMatch(str, 'none'); if (retNone > 0) { // we got the none key - that's the same as C to us ret.extraAccidentals = []; str = str.substring(retNone); } } // There are two special cases of deprecated syntax. Ignore them if they occur var j = tokenizer.skipWhiteSpace(str); str = str.substring(j); if (str.startsWith('exp') || str.startsWith('oct')) str = str.substring(3); // now see if there are extra accidentals var done = false; while (!done) { var retExtra = tokenizer.getKeyAccidental(str); if (retExtra.len === 0) done = true; else { str = str.substring(retExtra.len); if (retExtra.warn) warn("error parsing extra accidentals:", origStr, 0); else { if (!ret.extraAccidentals) ret.extraAccidentals = []; ret.extraAccidentals.push(retExtra.token); } } } // now see if there is a clef retClef = tokenizer.getClef(str); if (retClef.len > 0) { if (retClef.warn) warn("error parsing clef:" + retClef.warn, origStr, 0); else { //ret.clef = retClef.token; multilineVars.clef = { type: retClef.token, middle: calcMiddle(retClef.token, 0) }; str = str.substring(retClef.len); setMiddle(str); } } if (ret.regularKey === undefined && ret.extraAccidentals === undefined && retClef.token === undefined) { warn("error parsing key: ", origStr, 0); //ret.regularKey = keys.C; return {}; } var result = {}; if (retClef.token !== undefined) result.foundClef = true; if (ret.regularKey !== undefined || ret.extraAccidentals !== undefined) { multilineVars.key = ret; result.foundKey = true; } return result; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f5a9f7ef8d556b3359fab3994dac1ddd87440bb3/abc_parse_header.js/buggy/abc_parse_header.js
return {foundClef: true};
this.parseKey = function(str) // (and clef) { var origStr = str; // The format is: // [space][tonic[#|b][ ][3-letter-mode][ignored-chars][space]][ accidentals...][ clef=treble|bass|bass3|tenor|alto|alto2|alto1|none [+8|-8]] // -- or -- the key can be "none" // First get the key letter: turn that into a index into the key array (0-11) // Then see if there is a sharp or flat. Increment or decrement. // Then see if there is a mode modifier. Add or subtract to the index. // Then do a mod 12 on the index and return the key. // TODO: This may leave unparsed characters at the end after something reasonable was found. var setMiddle = function(str) { var i = tokenizer.skipWhiteSpace(str); str = str.substring(i); if (str.startsWith('m=') || str.startsWith('middle=')) { str = str.substring(str.indexOf('=')+1); multilineVars.clef.middle = parseMiddle(str); } }; // check first to see if there is only a clef. If so, just take that, but ignore an error after that. var retClef = tokenizer.getClef(str); if (retClef.token !== undefined && (retClef.explicit === true || retClef.token !== 'none')) { // none is the only ambiguous marking. We need to assume that's a key multilineVars.clef = { type: retClef.token, middle: calcMiddle(retClef.token, 0) }; str = str.substring(retClef.len); setMiddle(str); return {foundClef: true}; } var ret = {}; var retPitch = tokenizer.getKeyPitch(str); if (retPitch.len > 0) { var key = retPitch.token; str = str.substring(retPitch.len); // We got a pitch to start with, so we might also have an accidental and a mode var retAcc = tokenizer.getSharpFlat(str); if (retAcc.len > 0) { key += retAcc.token; str = str.substring(retAcc.len); } var retMode = tokenizer.getMode(str); if (retMode.len > 0) { key += retMode.token; str = str.substring(retMode.len); } // We need to do a deep copy because we are going to modify it ret.extraAccidentals = []; keys[key].each(function(k) { ret.extraAccidentals.push(Object.clone(k)); }); } else if (str.startsWith('HP')) { this.addDirective("bagpipes"); ret.extraAccidentals = []; multilineVars.key = ret; return {foundKey: true}; } else if (str.startsWith('Hp')) { ret.extraAccidentals = [ {acc: 'natural', note: 'g'}, {acc: 'sharp', note: 'f'}, {acc: 'sharp', note: 'c'} ]; this.addDirective("bagpipes"); multilineVars.key = ret; return {foundKey: true}; } else { var retNone = tokenizer.isMatch(str, 'none'); if (retNone > 0) { // we got the none key - that's the same as C to us ret.extraAccidentals = []; str = str.substring(retNone); } } // There are two special cases of deprecated syntax. Ignore them if they occur var j = tokenizer.skipWhiteSpace(str); str = str.substring(j); if (str.startsWith('exp') || str.startsWith('oct')) str = str.substring(3); // now see if there are extra accidentals var done = false; while (!done) { var retExtra = tokenizer.getKeyAccidental(str); if (retExtra.len === 0) done = true; else { str = str.substring(retExtra.len); if (retExtra.warn) warn("error parsing extra accidentals:", origStr, 0); else { if (!ret.extraAccidentals) ret.extraAccidentals = []; ret.extraAccidentals.push(retExtra.token); } } } // now see if there is a clef retClef = tokenizer.getClef(str); if (retClef.len > 0) { if (retClef.warn) warn("error parsing clef:" + retClef.warn, origStr, 0); else { //ret.clef = retClef.token; multilineVars.clef = { type: retClef.token, middle: calcMiddle(retClef.token, 0) }; str = str.substring(retClef.len); setMiddle(str); } } if (ret.regularKey === undefined && ret.extraAccidentals === undefined && retClef.token === undefined) { warn("error parsing key: ", origStr, 0); //ret.regularKey = keys.C; return {}; } var result = {}; if (retClef.token !== undefined) result.foundClef = true; if (ret.regularKey !== undefined || ret.extraAccidentals !== undefined) { multilineVars.key = ret; result.foundKey = true; } return result; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f5a9f7ef8d556b3359fab3994dac1ddd87440bb3/abc_parse_header.js/buggy/abc_parse_header.js
var ret = {}; var retPitch = tokenizer.getKeyPitch(str); if (retPitch.len > 0) { var key = retPitch.token; str = str.substring(retPitch.len); var retAcc = tokenizer.getSharpFlat(str); if (retAcc.len > 0) { key += retAcc.token; str = str.substring(retAcc.len); } var retMode = tokenizer.getMode(str); if (retMode.len > 0) { key += retMode.token; str = str.substring(retMode.len); } ret.extraAccidentals = []; keys[key].each(function(k) { ret.extraAccidentals.push(Object.clone(k)); }); } else if (str.startsWith('HP')) { this.addDirective("bagpipes"); ret.extraAccidentals = []; multilineVars.key = ret; return {foundKey: true}; } else if (str.startsWith('Hp')) { ret.extraAccidentals = [ {acc: 'natural', note: 'g'}, {acc: 'sharp', note: 'f'}, {acc: 'sharp', note: 'c'} ]; this.addDirective("bagpipes"); multilineVars.key = ret; return {foundKey: true}; } else { var retNone = tokenizer.isMatch(str, 'none'); if (retNone > 0) { ret.extraAccidentals = []; str = str.substring(retNone); } } var j = tokenizer.skipWhiteSpace(str); str = str.substring(j); if (str.startsWith('exp') || str.startsWith('oct')) str = str.substring(3); var done = false; while (!done) { var retExtra = tokenizer.getKeyAccidental(str); if (retExtra.len === 0) done = true; else { str = str.substring(retExtra.len); if (retExtra.warn) warn("error parsing extra accidentals:", origStr, 0); else { if (!ret.extraAccidentals) ret.extraAccidentals = []; ret.extraAccidentals.push(retExtra.token); } } } retClef = tokenizer.getClef(str); if (retClef.len > 0) { if (retClef.warn) warn("error parsing clef:" + retClef.warn, origStr, 0); else { multilineVars.clef = { type: retClef.token, middle: calcMiddle(retClef.token, 0) }; str = str.substring(retClef.len); setMiddle(str); } } if (ret.regularKey === undefined && ret.extraAccidentals === undefined && retClef.token === undefined) { warn("error parsing key: ", origStr, 0); return {}; } var result = {}; if (retClef.token !== undefined) result.foundClef = true; if (ret.regularKey !== undefined || ret.extraAccidentals !== undefined) { multilineVars.key = ret; result.foundKey = true; } return result; };
if (ret.regularKey === undefined && ret.extraAccidentals === undefined && retClef.token === undefined) { warn("error parsing key: ", origStr, 0); return {}; } var result = {}; if (retClef.token !== undefined) result.foundClef = true; if (ret.regularKey !== undefined || ret.extraAccidentals !== undefined) { multilineVars.key = ret; result.foundKey = true; } return result; };
this.parseKey = function(str) // (and clef) { var origStr = str; // The format is: // [space][tonic[#|b][ ][3-letter-mode][ignored-chars][space]][ accidentals...][ clef=treble|bass|bass3|tenor|alto|alto2|alto1|none [+8|-8]] // -- or -- the key can be "none" // First get the key letter: turn that into a index into the key array (0-11) // Then see if there is a sharp or flat. Increment or decrement. // Then see if there is a mode modifier. Add or subtract to the index. // Then do a mod 12 on the index and return the key. // TODO: This may leave unparsed characters at the end after something reasonable was found. var setMiddle = function(str) { var i = tokenizer.skipWhiteSpace(str); str = str.substring(i); if (str.startsWith('m=') || str.startsWith('middle=')) { str = str.substring(str.indexOf('=')+1); multilineVars.clef.middle = parseMiddle(str); } }; // check first to see if there is only a clef. If so, just take that, but ignore an error after that. var retClef = tokenizer.getClef(str); if (retClef.token !== undefined && (retClef.explicit === true || retClef.token !== 'none')) { // none is the only ambiguous marking. We need to assume that's a key multilineVars.clef = { type: retClef.token, middle: calcMiddle(retClef.token, 0) }; str = str.substring(retClef.len); setMiddle(str); return {foundClef: true}; } var ret = {}; var retPitch = tokenizer.getKeyPitch(str); if (retPitch.len > 0) { var key = retPitch.token; str = str.substring(retPitch.len); // We got a pitch to start with, so we might also have an accidental and a mode var retAcc = tokenizer.getSharpFlat(str); if (retAcc.len > 0) { key += retAcc.token; str = str.substring(retAcc.len); } var retMode = tokenizer.getMode(str); if (retMode.len > 0) { key += retMode.token; str = str.substring(retMode.len); } // We need to do a deep copy because we are going to modify it ret.extraAccidentals = []; keys[key].each(function(k) { ret.extraAccidentals.push(Object.clone(k)); }); } else if (str.startsWith('HP')) { this.addDirective("bagpipes"); ret.extraAccidentals = []; multilineVars.key = ret; return {foundKey: true}; } else if (str.startsWith('Hp')) { ret.extraAccidentals = [ {acc: 'natural', note: 'g'}, {acc: 'sharp', note: 'f'}, {acc: 'sharp', note: 'c'} ]; this.addDirective("bagpipes"); multilineVars.key = ret; return {foundKey: true}; } else { var retNone = tokenizer.isMatch(str, 'none'); if (retNone > 0) { // we got the none key - that's the same as C to us ret.extraAccidentals = []; str = str.substring(retNone); } } // There are two special cases of deprecated syntax. Ignore them if they occur var j = tokenizer.skipWhiteSpace(str); str = str.substring(j); if (str.startsWith('exp') || str.startsWith('oct')) str = str.substring(3); // now see if there are extra accidentals var done = false; while (!done) { var retExtra = tokenizer.getKeyAccidental(str); if (retExtra.len === 0) done = true; else { str = str.substring(retExtra.len); if (retExtra.warn) warn("error parsing extra accidentals:", origStr, 0); else { if (!ret.extraAccidentals) ret.extraAccidentals = []; ret.extraAccidentals.push(retExtra.token); } } } // now see if there is a clef retClef = tokenizer.getClef(str); if (retClef.len > 0) { if (retClef.warn) warn("error parsing clef:" + retClef.warn, origStr, 0); else { //ret.clef = retClef.token; multilineVars.clef = { type: retClef.token, middle: calcMiddle(retClef.token, 0) }; str = str.substring(retClef.len); setMiddle(str); } } if (ret.regularKey === undefined && ret.extraAccidentals === undefined && retClef.token === undefined) { warn("error parsing key: ", origStr, 0); //ret.regularKey = keys.C; return {}; } var result = {}; if (retClef.token !== undefined) result.foundClef = true; if (ret.regularKey !== undefined || ret.extraAccidentals !== undefined) { multilineVars.key = ret; result.foundKey = true; } return result; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f5a9f7ef8d556b3359fab3994dac1ddd87440bb3/abc_parse_header.js/buggy/abc_parse_header.js
if (str.length === 0) { str = 'none'; }
this.parseKey = function(str) // (and clef) { var origStr = str; // The format is: // [space][tonic[#|b][ ][3-letter-mode][ignored-chars][space]][ accidentals...][ clef=treble|bass|bass3|tenor|alto|alto2|alto1|none [+8|-8]] // -- or -- the key can be "none" // First get the key letter: turn that into a index into the key array (0-11) // Then see if there is a sharp or flat. Increment or decrement. // Then see if there is a mode modifier. Add or subtract to the index. // Then do a mod 12 on the index and return the key. // TODO: This may leave unparsed characters at the end after something reasonable was found. var setMiddle = function(str) { var i = tokenizer.skipWhiteSpace(str); str = str.substring(i); if (str.startsWith('m=') || str.startsWith('middle=')) { str = str.substring(str.indexOf('=')+1); multilineVars.clef.verticalPos = parseMiddle(str); } }; // check first to see if there is only a clef. If so, just take that, but ignore an error after that. var retClef = tokenizer.getClef(str); if (retClef.token !== undefined && (retClef.explicit === true || retClef.token !== 'none')) { // none is the only ambiguous marking. We need to assume that's a key multilineVars.clef = {type: retClef.token, verticalPos: calcMiddle(retClef.token, 0)}; str = str.substring(retClef.len); setMiddle(str); return {foundClef: true}; } var ret = {}; var retPitch = tokenizer.getKeyPitch(str); if (retPitch.len > 0) { var key = retPitch.token; str = str.substring(retPitch.len); // We got a pitch to start with, so we might also have an accidental and a mode var retAcc = tokenizer.getSharpFlat(str); if (retAcc.len > 0) { key += retAcc.token; str = str.substring(retAcc.len); } var retMode = tokenizer.getMode(str); if (retMode.len > 0) { key += retMode.token; str = str.substring(retMode.len); } // We need to do a deep copy because we are going to modify it ret = this.deepCopyKey(keys[key]); } else if (str.startsWith('HP')) { this.addDirective("bagpipes"); ret.accidentals = []; multilineVars.key = ret; return {foundKey: true}; } else if (str.startsWith('Hp')) { ret.accidentals = [ {acc: 'natural', note: 'g'}, {acc: 'sharp', note: 'f'}, {acc: 'sharp', note: 'c'} ]; this.addDirective("bagpipes"); multilineVars.key = ret; return {foundKey: true}; } else { var retNone = tokenizer.isMatch(str, 'none'); if (retNone > 0) { // we got the none key - that's the same as C to us ret.accidentals = []; str = str.substring(retNone); } } // There are two special cases of deprecated syntax. Ignore them if they occur var j = tokenizer.skipWhiteSpace(str); str = str.substring(j); if (str.startsWith('exp') || str.startsWith('oct')) str = str.substring(3); // now see if there are extra accidentals var done = false; while (!done) { var retExtra = tokenizer.getKeyAccidental(str); if (retExtra.len === 0) done = true; else { str = str.substring(retExtra.len); if (retExtra.warn) warn("error parsing extra accidentals:", origStr, 0); else { if (!ret.accidentals) ret.accidentals = []; ret.accidentals.push(retExtra.token); } } } // now see if there is a clef retClef = tokenizer.getClef(str); if (retClef.len > 0) { if (retClef.warn) warn("error parsing clef:" + retClef.warn, origStr, 0); else { //ret.clef = retClef.token; multilineVars.clef = {type: retClef.token, verticalPos: calcMiddle(retClef.token, 0)}; str = str.substring(retClef.len); setMiddle(str); } } if (ret.accidentals === undefined && retClef.token === undefined) { warn("error parsing key: ", origStr, 0); return {}; } var result = {}; if (retClef.token !== undefined) result.foundClef = true; if (ret.accidentals !== undefined) { multilineVars.key = ret; result.foundKey = true; } return result; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/4cdfce595a8f9d93cff8b5236768d677a69741ea/abc_parse_header.js/clean/abc_parse_header.js
multilineVars.clef = retClef.token;
multilineVars.clef = { type: retClef.token }; str = str.substring(retClef.len); setMiddle(str);
var parseKey = function(str) // (and clef) { var origStr = str; // The format is: // [space][tonic[#|b][ ][3-letter-mode][ignored-chars][space]][ accidentals...][ clef=treble|bass|bass3|tenor|alto|alto2|alto1|none [+8|-8]] // -- or -- the key can be "none" // First get the key letter: turn that into a index into the key array (0-11) // Then see if there is a sharp or flat. Increment or decrement. // Then see if there is a mode modifier. Add or subtract to the index. // Then do a mod 12 on the index and return the key. // TODO: This may leave unparsed characters at the end after something reasonable was found. // check first to see if there is only a clef. If so, just take that, but ignore an error after that. var retClef = tokenizer.getClef(str); if (retClef.token !== undefined && (retClef.explicit === true || retClef.token !== 'none')) { // none is the only ambiguous marking. We need to assume that's a key multilineVars.clef = retClef.token; return {foundClef: true}; } var ret = {}; var retPitch = tokenizer.getKeyPitch(str); if (retPitch.len > 0) { var key = retPitch.token; str = str.substring(retPitch.len); // We got a pitch to start with, so we might also have an accidental and a mode var retAcc = tokenizer.getSharpFlat(str); if (retAcc.len > 0) { key += retAcc.token; str = str.substring(retAcc.len); } var retMode = tokenizer.getMode(str); if (retMode.len > 0) { key += retMode.token; str = str.substring(retMode.len); } ret.regularKey = keys[key]; } else if (str.startsWith('HP')) { addDirective("bagpipes"); ret.regularKey = keys.C; multilineVars.key = ret; return {foundKey: true}; } else if (str.startsWith('Hp')) { ret.extraAccidentals = [ {acc: 'natural', note: 'g'}, {acc: 'sharp', note: 'f'}, {acc: 'sharp', note: 'c'} ]; addDirective("bagpipes"); multilineVars.key = ret; return {foundKey: true}; } else { var retNone = tokenizer.isMatch(str, 'none'); if (retNone > 0) { // we got the none key - that's the same as C to us ret.regularKey = keys.C; str = str.substring(retNone); } } // now see if there are extra accidentals var done = false; while (!done) { var retExtra = tokenizer.getKeyAccidental(str); if (retExtra.len === 0) done = true; else { str = str.substring(retExtra.len); if (retExtra.warn) addWarning("error parsing extra accidentals:" + origStr); else { if (!ret.extraAccidentals) ret.extraAccidentals = []; ret.extraAccidentals.push(retExtra.token); } } } // now see if there is a clef retClef = tokenizer.getClef(str); if (retClef.len > 0) { if (retClef.warn) addWarning("error parsing clef:" + retClef.warn); else { //ret.clef = retClef.token; multilineVars.clef = retClef.token; } } if (ret.regularKey === undefined && ret.extraAccidentals === undefined && retClef.token === undefined) { addWarning("error parsing key: " + origStr); //ret.regularKey = keys.C; return {}; } var result = {}; if (retClef.token !== undefined) result.foundClef = true; if (ret.regularKey !== undefined || ret.extraAccidentals !== undefined) { multilineVars.key = ret; result.foundKey = true; } return result; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/66c5771dcec8aa949d4f3e38d5c1edaf2264c555/abc_parse.js/buggy/abc_parse.js
multilineVars.clef = retClef.token;
multilineVars.clef = { type: retClef.token}; str = str.substring(retClef.len); setMiddle(str);
var parseKey = function(str) // (and clef) { var origStr = str; // The format is: // [space][tonic[#|b][ ][3-letter-mode][ignored-chars][space]][ accidentals...][ clef=treble|bass|bass3|tenor|alto|alto2|alto1|none [+8|-8]] // -- or -- the key can be "none" // First get the key letter: turn that into a index into the key array (0-11) // Then see if there is a sharp or flat. Increment or decrement. // Then see if there is a mode modifier. Add or subtract to the index. // Then do a mod 12 on the index and return the key. // TODO: This may leave unparsed characters at the end after something reasonable was found. // check first to see if there is only a clef. If so, just take that, but ignore an error after that. var retClef = tokenizer.getClef(str); if (retClef.token !== undefined && (retClef.explicit === true || retClef.token !== 'none')) { // none is the only ambiguous marking. We need to assume that's a key multilineVars.clef = retClef.token; return {foundClef: true}; } var ret = {}; var retPitch = tokenizer.getKeyPitch(str); if (retPitch.len > 0) { var key = retPitch.token; str = str.substring(retPitch.len); // We got a pitch to start with, so we might also have an accidental and a mode var retAcc = tokenizer.getSharpFlat(str); if (retAcc.len > 0) { key += retAcc.token; str = str.substring(retAcc.len); } var retMode = tokenizer.getMode(str); if (retMode.len > 0) { key += retMode.token; str = str.substring(retMode.len); } ret.regularKey = keys[key]; } else if (str.startsWith('HP')) { addDirective("bagpipes"); ret.regularKey = keys.C; multilineVars.key = ret; return {foundKey: true}; } else if (str.startsWith('Hp')) { ret.extraAccidentals = [ {acc: 'natural', note: 'g'}, {acc: 'sharp', note: 'f'}, {acc: 'sharp', note: 'c'} ]; addDirective("bagpipes"); multilineVars.key = ret; return {foundKey: true}; } else { var retNone = tokenizer.isMatch(str, 'none'); if (retNone > 0) { // we got the none key - that's the same as C to us ret.regularKey = keys.C; str = str.substring(retNone); } } // now see if there are extra accidentals var done = false; while (!done) { var retExtra = tokenizer.getKeyAccidental(str); if (retExtra.len === 0) done = true; else { str = str.substring(retExtra.len); if (retExtra.warn) addWarning("error parsing extra accidentals:" + origStr); else { if (!ret.extraAccidentals) ret.extraAccidentals = []; ret.extraAccidentals.push(retExtra.token); } } } // now see if there is a clef retClef = tokenizer.getClef(str); if (retClef.len > 0) { if (retClef.warn) addWarning("error parsing clef:" + retClef.warn); else { //ret.clef = retClef.token; multilineVars.clef = retClef.token; } } if (ret.regularKey === undefined && ret.extraAccidentals === undefined && retClef.token === undefined) { addWarning("error parsing key: " + origStr); //ret.regularKey = keys.C; return {}; } var result = {}; if (retClef.token !== undefined) result.foundClef = true; if (ret.regularKey !== undefined || ret.extraAccidentals !== undefined) { multilineVars.key = ret; result.foundKey = true; } return result; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/66c5771dcec8aa949d4f3e38d5c1edaf2264c555/abc_parse.js/buggy/abc_parse.js
tune.appendStartingElement('clef', -1, -1, {type: multilineVars.clef});
tune.appendStartingElement('clef', -1, -1, multilineVars.clef);
var parseLine = function(line) { if (line.startsWith('%%')) { var err = addDirective(line.substring(2)); if (err) warn(err, line, 2); return; } line = tokenizer.stripComment(line); if (line.length === 0) return; if (line.length >= 2) { if (line[1] === ':') { var field = metaTextHeaders[line[0]]; if (field !== undefined) { tune.addMetaText(field, tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); return; } else { switch(line[0]) { case 'H': tune.addMetaText("history", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); multilineVars.is_in_history = true; break; case 'K': // since the key is the last thing that can happen in the header, we can resolve the tempo now resolveTempo(); var result = parseKey(line.substring(2)); if (!multilineVars.is_in_header && tune.hasBeginMusic()) { if (result.foundClef) tune.appendStartingElement('clef', -1, -1, {type: multilineVars.clef}); if (result.foundKey) tune.appendStartingElement('key', -1, -1, multilineVars.key); } multilineVars.is_in_header = false; // The first key signifies the end of the header. break; case 'L': var len = line.substring(2).gsub(" ", ""); var len_arr = len.split('/'); if (len_arr.length === 2) { var n = parseInt(len_arr[0]); var d = parseInt(len_arr[1]); if (d > 0) { var q = n / d; multilineVars.default_length = q*8; // an eighth note is 1 multilineVars.havent_set_length = false; } } break; case 'M': setMeter(line.substring(2)); break; case 'P': // TODO-PER: There is more to do with parts, but the writer doesn't care. if (multilineVars.is_in_header) tune.addMetaText("partOrder", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); else multilineVars.partForNextLine = tokenizer.translateString(tokenizer.stripComment(line.substring(2))); break; case 'Q': setTempo(line, 2, line.length); break; case 'T': setTitle(line.substring(2)); break; case 'U': addUserDefinition(line, 2, line.length); break; case 'V': parseVoice(line, 2, line.length); if (!multilineVars.is_in_header) startNewLine(); break; case 'w': addWords(tune.getCurrentVoice(), line.substring(2)); break; case 'X': case 'E': break; default: // It wasn't a recognized header value, so parse it as music. parseRegularMusicLine(line); } } return; } } // If we got this far, we have a regular line of mulsic parseRegularMusicLine(line); };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/66c5771dcec8aa949d4f3e38d5c1edaf2264c555/abc_parse.js/buggy/abc_parse.js
var len = line.substring(2).gsub(" ", ""); var len_arr = len.split('/'); if (len_arr.length === 2) { var n = parseInt(len_arr[0]); var d = parseInt(len_arr[1]); if (d > 0) { var q = n / d; multilineVars.default_length = q*8; multilineVars.havent_set_length = false; } }
setDefaultLength(line, 2, line.length);
var parseLine = function(line) { if (line.startsWith('%%')) { var err = addDirective(line.substring(2)); if (err) warn(err, line, 2); return; } line = tokenizer.stripComment(line); if (line.length === 0) return; if (line.length >= 2) { if (line[1] === ':') { var field = metaTextHeaders[line[0]]; if (field !== undefined) { tune.addMetaText(field, tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); return; } else { switch(line[0]) { case 'H': tune.addMetaText("history", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); multilineVars.is_in_history = true; break; case 'K': // since the key is the last thing that can happen in the header, we can resolve the tempo now resolveTempo(); var result = parseKey(line.substring(2)); if (!multilineVars.is_in_header && tune.hasBeginMusic()) { if (result.foundClef) tune.appendStartingElement('clef', -1, -1, {type: multilineVars.clef}); if (result.foundKey) tune.appendStartingElement('key', -1, -1, multilineVars.key); } multilineVars.is_in_header = false; // The first key signifies the end of the header. break; case 'L': var len = line.substring(2).gsub(" ", ""); var len_arr = len.split('/'); if (len_arr.length === 2) { var n = parseInt(len_arr[0]); var d = parseInt(len_arr[1]); if (d > 0) { var q = n / d; multilineVars.default_length = q*8; // an eighth note is 1 multilineVars.havent_set_length = false; } } break; case 'M': setMeter(line.substring(2)); break; case 'P': // TODO-PER: There is more to do with parts, but the writer doesn't care. if (multilineVars.is_in_header) tune.addMetaText("partOrder", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); else multilineVars.partForNextLine = tokenizer.translateString(tokenizer.stripComment(line.substring(2))); break; case 'Q': setTempo(line, 2, line.length); break; case 'T': setTitle(line.substring(2)); break; case 'U': addUserDefinition(line, 2, line.length); break; case 'V': parseVoice(line, 2, line.length); if (!multilineVars.is_in_header) startNewLine(); break; case 'w': addWords(tune.getCurrentVoice(), line.substring(2)); break; case 'X': case 'E': break; default: // It wasn't a recognized header value, so parse it as music. parseRegularMusicLine(line); } } return; } } // If we got this far, we have a regular line of mulsic parseRegularMusicLine(line); };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/66c5771dcec8aa949d4f3e38d5c1edaf2264c555/abc_parse.js/buggy/abc_parse.js
parseRegularMusicLine(line);
if (nextLine.length) nextLine = "\x12" + nextLine; parseRegularMusicLine(line+nextLine); nextLine = "";
var parseLine = function(line) { if (line.startsWith('%%')) { var err = addDirective(line.substring(2)); if (err) warn(err, line, 2); return; } line = tokenizer.stripComment(line); if (line.length === 0) return; if (line.length >= 2) { if (line[1] === ':') { var field = metaTextHeaders[line[0]]; if (field !== undefined) { tune.addMetaText(field, tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); return; } else { switch(line[0]) { case 'H': tune.addMetaText("history", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); multilineVars.is_in_history = true; break; case 'K': // since the key is the last thing that can happen in the header, we can resolve the tempo now resolveTempo(); var result = parseKey(line.substring(2)); if (!multilineVars.is_in_header && tune.hasBeginMusic()) { if (result.foundClef) tune.appendStartingElement('clef', -1, -1, {type: multilineVars.clef}); if (result.foundKey) tune.appendStartingElement('key', -1, -1, multilineVars.key); } multilineVars.is_in_header = false; // The first key signifies the end of the header. break; case 'L': var len = line.substring(2).gsub(" ", ""); var len_arr = len.split('/'); if (len_arr.length === 2) { var n = parseInt(len_arr[0]); var d = parseInt(len_arr[1]); if (d > 0) { var q = n / d; multilineVars.default_length = q*8; // an eighth note is 1 multilineVars.havent_set_length = false; } } break; case 'M': setMeter(line.substring(2)); break; case 'P': // TODO-PER: There is more to do with parts, but the writer doesn't care. if (multilineVars.is_in_header) tune.addMetaText("partOrder", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); else multilineVars.partForNextLine = tokenizer.translateString(tokenizer.stripComment(line.substring(2))); break; case 'Q': setTempo(line, 2, line.length); break; case 'T': setTitle(line.substring(2)); break; case 'U': addUserDefinition(line, 2, line.length); break; case 'V': parseVoice(line, 2, line.length); if (!multilineVars.is_in_header) startNewLine(); break; case 'w': addWords(tune.getCurrentVoice(), line.substring(2)); break; case 'X': case 'E': break; default: // It wasn't a recognized header value, so parse it as music. parseRegularMusicLine(line); } } return; } } // If we got this far, we have a regular line of mulsic parseRegularMusicLine(line); };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/66c5771dcec8aa949d4f3e38d5c1edaf2264c555/abc_parse.js/buggy/abc_parse.js
if (nextLine.length > 0) parseLine(nextLine);
var parseLine = function(line) { if (line.startsWith('%%')) { var err = addDirective(line.substring(2)); if (err) warn(err, line, 2); return; } line = tokenizer.stripComment(line); if (line.length === 0) return; if (line.length >= 2) { if (line[1] === ':') { var field = metaTextHeaders[line[0]]; if (field !== undefined) { tune.addMetaText(field, tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); return; } else { switch(line[0]) { case 'H': tune.addMetaText("history", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); multilineVars.is_in_history = true; break; case 'K': // since the key is the last thing that can happen in the header, we can resolve the tempo now resolveTempo(); var result = parseKey(line.substring(2)); if (!multilineVars.is_in_header && tune.hasBeginMusic()) { if (result.foundClef) tune.appendStartingElement('clef', -1, -1, {type: multilineVars.clef}); if (result.foundKey) tune.appendStartingElement('key', -1, -1, multilineVars.key); } multilineVars.is_in_header = false; // The first key signifies the end of the header. break; case 'L': var len = line.substring(2).gsub(" ", ""); var len_arr = len.split('/'); if (len_arr.length === 2) { var n = parseInt(len_arr[0]); var d = parseInt(len_arr[1]); if (d > 0) { var q = n / d; multilineVars.default_length = q*8; // an eighth note is 1 multilineVars.havent_set_length = false; } } break; case 'M': setMeter(line.substring(2)); break; case 'P': // TODO-PER: There is more to do with parts, but the writer doesn't care. if (multilineVars.is_in_header) tune.addMetaText("partOrder", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); else multilineVars.partForNextLine = tokenizer.translateString(tokenizer.stripComment(line.substring(2))); break; case 'Q': setTempo(line, 2, line.length); break; case 'T': setTitle(line.substring(2)); break; case 'U': addUserDefinition(line, 2, line.length); break; case 'V': parseVoice(line, 2, line.length); if (!multilineVars.is_in_header) startNewLine(); break; case 'w': addWords(tune.getCurrentVoice(), line.substring(2)); break; case 'X': case 'E': break; default: // It wasn't a recognized header value, so parse it as music. parseRegularMusicLine(line); } } return; } } // If we got this far, we have a regular line of mulsic parseRegularMusicLine(line); };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/66c5771dcec8aa949d4f3e38d5c1edaf2264c555/abc_parse.js/buggy/abc_parse.js
var ret = header.parseHeader(line); if (ret.regular) parseRegularMusicLine(ret.str); if (ret.newline) startNewLine(); if (ret.words) addWords(tune.getCurrentVoice(), line.substring(2)); if (ret.recurse) parseLine(ret.str); };
var ret = header.parseHeader(line); if (ret.regular) parseRegularMusicLine(ret.str); if (ret.newline) startNewLine(); if (ret.words) addWords(tune.getCurrentVoice(), line.substring(2)); if (ret.recurse) parseLine(ret.str); };
var parseLine = function(line) { var ret = header.parseHeader(line); if (ret.regular) parseRegularMusicLine(ret.str); if (ret.newline) startNewLine(); if (ret.words) addWords(tune.getCurrentVoice(), line.substring(2)); if (ret.recurse) parseLine(ret.str); };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f5a9f7ef8d556b3359fab3994dac1ddd87440bb3/abc_parse.js/clean/abc_parse.js
setTempo(line, 2, line.length);
var tempo = setTempo(line, 2, line.length); if (tempo.type === 'delaySet') multilineVars.tempo = tempo.tempo; else if (tempo.type === 'immediate') tune.metaText.tempo = tempo.tempo;
var parseLine = function(line) { if (line.startsWith('%%')) { var err = addDirective(line.substring(2)); if (err) warn(err, line, 2); return; } line = tokenizer.stripComment(line); if (line.length === 0) return; if (line.length >= 2) { if (line[1] === ':') { var nextLine = ""; if (line.indexOf('\x12') >= 0) { nextLine = line.substring(line.indexOf('\x12')+1); line = line.substring(0, line.indexOf('\x12')); //This handles a continuation mark on a header field } var field = metaTextHeaders[line[0]]; if (field !== undefined) { tune.addMetaText(field, tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); return; } else { switch(line[0]) { case 'H': tune.addMetaText("history", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); multilineVars.is_in_history = true; break; case 'K': // since the key is the last thing that can happen in the header, we can resolve the tempo now resolveTempo(); var result = parseKey(line.substring(2)); if (!multilineVars.is_in_header && tune.hasBeginMusic()) { if (result.foundClef) tune.appendStartingElement('clef', -1, -1, multilineVars.clef); if (result.foundKey) tune.appendStartingElement('key', -1, -1, multilineVars.key); } multilineVars.is_in_header = false; // The first key signifies the end of the header. break; case 'L': setDefaultLength(line, 2, line.length); break; case 'M': setMeter(line.substring(2)); break; case 'P': // TODO-PER: There is more to do with parts, but the writer doesn't care. if (multilineVars.is_in_header) tune.addMetaText("partOrder", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); else multilineVars.partForNextLine = tokenizer.translateString(tokenizer.stripComment(line.substring(2))); break; case 'Q': setTempo(line, 2, line.length); break; case 'T': setTitle(line.substring(2)); break; case 'U': addUserDefinition(line, 2, line.length); break; case 'V': parseVoice(line, 2, line.length); if (!multilineVars.is_in_header) startNewLine(); break; case 'w': addWords(tune.getCurrentVoice(), line.substring(2)); break; case 'X': case 'E': break; default: // It wasn't a recognized header value, so parse it as music. if (nextLine.length) nextLine = "\x12" + nextLine; parseRegularMusicLine(line+nextLine); nextLine = ""; } } if (nextLine.length > 0) parseLine(nextLine); return; } } // If we got this far, we have a regular line of mulsic parseRegularMusicLine(line); };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/05b2dde631d4eb1677f46195c6c62184e7d629aa/abc_parse.js/clean/abc_parse.js
case 'm': warn("Unknown header", line, 0);
var parseLine = function(line) { if (line.startsWith('%%')) { var err = addDirective(line.substring(2)); if (err) warn(err, line, 2); return; } line = tokenizer.stripComment(line); if (line.length === 0) return; if (line.length >= 2) { if (line[1] === ':') { var nextLine = ""; if (line.indexOf('\x12') >= 0) { nextLine = line.substring(line.indexOf('\x12')+1); line = line.substring(0, line.indexOf('\x12')); //This handles a continuation mark on a header field } var field = metaTextHeaders[line[0]]; if (field !== undefined) { tune.addMetaText(field, tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); return; } else { switch(line[0]) { case 'H': tune.addMetaText("history", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); multilineVars.is_in_history = true; break; case 'K': // since the key is the last thing that can happen in the header, we can resolve the tempo now resolveTempo(); var result = parseKey(line.substring(2)); if (!multilineVars.is_in_header && tune.hasBeginMusic()) { if (result.foundClef) tune.appendStartingElement('clef', -1, -1, multilineVars.clef); if (result.foundKey) tune.appendStartingElement('key', -1, -1, multilineVars.key); } multilineVars.is_in_header = false; // The first key signifies the end of the header. break; case 'L': setDefaultLength(line, 2, line.length); break; case 'M': setMeter(line.substring(2)); break; case 'P': // TODO-PER: There is more to do with parts, but the writer doesn't care. if (multilineVars.is_in_header) tune.addMetaText("partOrder", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); else multilineVars.partForNextLine = tokenizer.translateString(tokenizer.stripComment(line.substring(2))); break; case 'Q': setTempo(line, 2, line.length); break; case 'T': setTitle(line.substring(2)); break; case 'U': addUserDefinition(line, 2, line.length); break; case 'V': parseVoice(line, 2, line.length); if (!multilineVars.is_in_header) startNewLine(); break; case 'w': addWords(tune.getCurrentVoice(), line.substring(2)); break; case 'X': case 'E': break; default: // It wasn't a recognized header value, so parse it as music. if (nextLine.length) nextLine = "\x12" + nextLine; parseRegularMusicLine(line+nextLine); nextLine = ""; } } if (nextLine.length > 0) parseLine(nextLine); return; } } // If we got this far, we have a regular line of mulsic parseRegularMusicLine(line); };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/05b2dde631d4eb1677f46195c6c62184e7d629aa/abc_parse.js/clean/abc_parse.js
case 'U': addUserDefinition(line, 2, line.length); break;
var parseLine = function(line) { if (line.startsWith('%%')) { var err = addDirective(line.substring(2)); if (err) warn(err, line, 2); return; } line = tokenizer.stripComment(line); if (line.length === 0) return; if (line.length >= 2) { if (line[1] === ':') { var field = metaTextHeaders[line[0]]; if (field !== undefined) { tune.addMetaText(field, tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); return; } else { switch(line[0]) { case 'H': tune.addMetaText("history", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); multilineVars.is_in_history = true; break; case 'K': // since the key is the last thing that can happen in the header, we can resolve the tempo now resolveTempo(); var result = parseKey(line.substring(2)); if (!multilineVars.is_in_header && tune.hasBeginMusic()) { if (result.foundClef) tune.appendStartingElement('clef', -1, -1, {type: multilineVars.clef}); if (result.foundKey) tune.appendStartingElement('key', -1, -1, multilineVars.key); } multilineVars.is_in_header = false; // The first key signifies the end of the header. break; case 'L': var len = line.substring(2).gsub(" ", ""); var len_arr = len.split('/'); if (len_arr.length === 2) { var n = parseInt(len_arr[0]); var d = parseInt(len_arr[1]); if (d > 0) { var q = n / d; multilineVars.default_length = q*8; // an eighth note is 1 multilineVars.havent_set_length = false; } } break; case 'M': setMeter(line.substring(2)); break; case 'P': // TODO-PER: There is more to do with parts, but the writer doesn't care. if (multilineVars.is_in_header) tune.addMetaText("partOrder", tokenizer.translateString(tokenizer.stripComment(line.substring(2)))); else multilineVars.partForNextLine = tokenizer.translateString(tokenizer.stripComment(line.substring(2))); break; case 'Q': setTempo(line, 2, line.length); break; case 'T': setTitle(line.substring(2)); break; case 'V': parseVoice(line, 2, line.length); if (!multilineVars.is_in_header) startNewLine(); break; case 'w': addWords(tune.getCurrentVoice(), line.substring(2)); break; case 'X': case 'E': break; default: // It wasn't a recognized header value, so parse it as music. parseRegularMusicLine(line); } } return; } } // If we got this far, we have a regular line of mulsic parseRegularMusicLine(line); };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/428481b43b5bb6c57aec5a856e5005f65972534f/abc_parse.js/clean/abc_parse.js
var mid = pitches[str[0]]; for (i = 1; i < str.length; i++) { if (str[i] === ',') mid -= 7; else if (str[i] === ',') mid += 7; } return mid; };
var mid = pitches[str[0]]; for (var i = 1; i < str.length; i++) { if (str[i] === ',') mid -= 7; else if (str[i] === ',') mid += 7; } return mid; };
var parseMiddle = function(str) { var mid = pitches[str[0]]; for (i = 1; i < str.length; i++) { if (str[i] === ',') mid -= 7; else if (str[i] === ',') mid += 7; } return mid; };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f5a9f7ef8d556b3359fab3994dac1ddd87440bb3/abc_parse_header.js/buggy/abc_parse_header.js
var ret = { value: 0, num: "" };
var ret = {value: 0, num: ""};
var parseNum = function() { // handles this much: [open_paren] decimal [ plus|dot decimal ]... [close_paren] var ret = { value: 0, num: "" }; var tok = tokens.shift(); if (tok.token === '(') tok = tokens.shift(); while (1) { if (tok.type !== 'number') throw "Expected top number of meter"; ret.value += parseInt(tok.token); ret.num += tok.token; if (tokens.length === 0 || tokens[0].token === '/') return ret; tok = tokens.shift(); if (tok.token === ')') { if (tokens.length === 0 || tokens[0].token === '/') return ret; throw "Unexpected paren in meter"; } if (tok.token !== '.' && tok.token !== '+') throw "Expected top number of meter"; ret.num += tok.token; if (tokens.length === 0) throw "Expected top number of meter"; tok = tokens.shift(); } return ret; // just to suppress warning };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/b469218ea3fed3fd3b63e64dfa8a3d3cd05c473d/abc_parse_header.js/clean/abc_parse_header.js
var ret = { value: 0, num: "" };
var ret = { value: 0, num: "" };
var parseNum = function() { // handles this much: [open_paren] decimal [ plus|dot decimal ]... [close_paren] var ret = { value: 0, num: "" }; var tok = tokens.shift(); if (tok.token === '(') tok = tokens.shift(); while (1) { if (tok.type !== 'number') throw "Expected top number of meter"; ret.value += parseInt(tok.token); ret.num += tok.token; if (tokens.length === 0 || tokens[0].token === '/') return ret; tok = tokens.shift(); if (tok.token === ')') { if (tokens.length === 0 || tokens[0].token === '/') return ret; throw "Unexpected paren in meter"; } if (tok.token !== '.' && tok.token !== '+') throw "Expected top number of meter"; ret.num += tok.token; if (tokens.length === 0) throw "Expected top number of meter"; tok = tokens.shift(); } return ret; // just to suppress warning };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f5a9f7ef8d556b3359fab3994dac1ddd87440bb3/abc_parse_header.js/buggy/abc_parse_header.js
var tok = tokens.shift(); if (tok.token === '(') tok = tokens.shift(); while (1) { if (tok.type !== 'number') throw "Expected top number of meter"; ret.value += parseInt(tok.token); ret.num += tok.token;
var tok = tokens.shift(); if (tok.token === '(') tok = tokens.shift(); while (1) { if (tok.type !== 'number') throw "Expected top number of meter"; ret.value += parseInt(tok.token); ret.num += tok.token; if (tokens.length === 0 || tokens[0].token === '/') return ret; tok = tokens.shift(); if (tok.token === ')') {
var parseNum = function() { // handles this much: [open_paren] decimal [ plus|dot decimal ]... [close_paren] var ret = { value: 0, num: "" }; var tok = tokens.shift(); if (tok.token === '(') tok = tokens.shift(); while (1) { if (tok.type !== 'number') throw "Expected top number of meter"; ret.value += parseInt(tok.token); ret.num += tok.token; if (tokens.length === 0 || tokens[0].token === '/') return ret; tok = tokens.shift(); if (tok.token === ')') { if (tokens.length === 0 || tokens[0].token === '/') return ret; throw "Unexpected paren in meter"; } if (tok.token !== '.' && tok.token !== '+') throw "Expected top number of meter"; ret.num += tok.token; if (tokens.length === 0) throw "Expected top number of meter"; tok = tokens.shift(); } return ret; // just to suppress warning };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f5a9f7ef8d556b3359fab3994dac1ddd87440bb3/abc_parse_header.js/buggy/abc_parse_header.js
tok = tokens.shift(); if (tok.token === ')') { if (tokens.length === 0 || tokens[0].token === '/') return ret; throw "Unexpected paren in meter"; } if (tok.token !== '.' && tok.token !== '+') throw "Expected top number of meter"; ret.num += tok.token; if (tokens.length === 0) throw "Expected top number of meter"; tok = tokens.shift();
throw "Unexpected paren in meter";
var parseNum = function() { // handles this much: [open_paren] decimal [ plus|dot decimal ]... [close_paren] var ret = { value: 0, num: "" }; var tok = tokens.shift(); if (tok.token === '(') tok = tokens.shift(); while (1) { if (tok.type !== 'number') throw "Expected top number of meter"; ret.value += parseInt(tok.token); ret.num += tok.token; if (tokens.length === 0 || tokens[0].token === '/') return ret; tok = tokens.shift(); if (tok.token === ')') { if (tokens.length === 0 || tokens[0].token === '/') return ret; throw "Unexpected paren in meter"; } if (tok.token !== '.' && tok.token !== '+') throw "Expected top number of meter"; ret.num += tok.token; if (tokens.length === 0) throw "Expected top number of meter"; tok = tokens.shift(); } return ret; // just to suppress warning };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f5a9f7ef8d556b3359fab3994dac1ddd87440bb3/abc_parse_header.js/buggy/abc_parse_header.js
return ret; };
if (tok.token !== '.' && tok.token !== '+') throw "Expected top number of meter"; ret.num += tok.token; if (tokens.length === 0) throw "Expected top number of meter"; tok = tokens.shift(); } return ret; };
var parseNum = function() { // handles this much: [open_paren] decimal [ plus|dot decimal ]... [close_paren] var ret = { value: 0, num: "" }; var tok = tokens.shift(); if (tok.token === '(') tok = tokens.shift(); while (1) { if (tok.type !== 'number') throw "Expected top number of meter"; ret.value += parseInt(tok.token); ret.num += tok.token; if (tokens.length === 0 || tokens[0].token === '/') return ret; tok = tokens.shift(); if (tok.token === ')') { if (tokens.length === 0 || tokens[0].token === '/') return ret; throw "Unexpected paren in meter"; } if (tok.token !== '.' && tok.token !== '+') throw "Expected top number of meter"; ret.num += tok.token; if (tokens.length === 0) throw "Expected top number of meter"; tok = tokens.shift(); } return ret; // just to suppress warning };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f5a9f7ef8d556b3359fab3994dac1ddd87440bb3/abc_parse_header.js/buggy/abc_parse_header.js
function parseOptions(opts) { $.extend(true, options, opts); if (options.grid.borderColor == null) options.grid.borderColor = options.grid.color; // backwards compatibility, to be removed in future if (options.xaxis.noTicks && options.xaxis.ticks == null) options.xaxis.ticks = options.xaxis.noTicks; if (options.yaxis.noTicks && options.yaxis.ticks == null) options.yaxis.ticks = options.yaxis.noTicks; if (options.grid.coloredAreas) options.grid.markings = options.grid.coloredAreas; if (options.grid.coloredAreasColor) options.grid.markingsColor = options.grid.coloredAreasColor; if (options.lines) $.extend(true, options.series.lines, options.lines); if (options.points) $.extend(true, options.series.points, options.points); if (options.bars) $.extend(true, options.series.bars, options.bars); if (options.shadowSize) options.series.shadowSize = options.shadowSize; for (var n in hooks) if (options.hooks[n] && options.hooks[n].length) hooks[n] = hooks[n].concat(options.hooks[n]); executeHooks(hooks.processOptions, [options]); }
1484 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/1484/479fa2785057565e0ba6a45b3905ba473f60ff53/jquery.flot.js/buggy/jquery.flot.js
multilineVars.havent_set_length = false;
var parseRegularMusicLine = function(line) { resolveTempo(); multilineVars.havent_set_length = false; // To late to set this now. multilineVars.is_in_header = false; // We should have gotten a key header by now, but just in case, this is definitely out of the header. var i = 0; var startOfLine = multilineVars.iChar; // see if there is nothing but a comment on this line. If so, just ignore it. A full line comment is optional white space followed by % while (tokenizer.isWhiteSpace(line[i]) && i < line.length) i++; if (i === line.length || line[i] === '%') return; // Start with the standard staff, clef and key symbols on each line if (multilineVars.start_new_line) { startNewLine(); } multilineVars.start_new_line = true; var tripletNotesLeft = 0; //var tripletMultiplier = 0; var inTie = false; var inTieChord = {}; // See if the line starts with a header field var retHeader = letter_to_body_header(line, i); if (retHeader[0] > 0) { i += retHeader[0]; // TODO-PER: Handle inline headers } var el = { }; while (i < line.length) { var startI = i; if (line[i] === '%') break; var retInlineHeader = letter_to_inline_header(line, i); if (retInlineHeader[0] > 0) { i += retInlineHeader[0]; // TODO-PER: Handle inline headers //multilineVars.start_new_line = false; } else {// var el = { }; // We need to decide if the following characters are a bar-marking or a note-group. // Unfortunately, that is ambiguous. Both can contain chord symbols and decorations. // If there is a grace note either before or after the chord symbols and decorations, then it is definitely a note-group. // If there is a bar marker, it is definitely a bar-marking. // If there is either a core-note or chord, it is definitely a note-group. // So, loop while we find grace-notes, chords-symbols, or decorations. [It is an error to have more than one grace-note group in a row; the others can be multiple] // Then, if there is a grace-note, we know where to go. // Else see if we have a chord, core-note, slur, triplet, or bar. while (1) { var ret = tokenizer.eatWhiteSpace(line, i); if (ret > 0) { i += ret; } if (i > 0 && line[i-1] === '\x12') { // there is one case where a line continuation isn't the same as being on the same line, and that is if the next character after it is a header. ret = letter_to_body_header(line, i); if (ret[0] > 0) { // TODO: insert header here i += ret[0]; multilineVars.start_new_line = false; } } // gather all the grace notes, chord symbols and decorations ret = letter_to_spacer(line, i); if (ret[0] > 0) { i += ret[0]; } ret = letter_to_chord(line, i); if (ret[0] > 0) { // TODO-PER: There could be more than one chord here if they have different positions. el.chord = {name: tokenizer.translateString(ret[1]), position: ret[2]}; i += ret[0]; i += tokenizer.skipWhiteSpace(line.substring(i)); } else { ret = letter_to_accent(line, i); if (ret[0] > 0) { if (ret[1] === null) { if (i+1 < line.length) startNewLine(); // There was a ! in the middle of the line. Start a new line if there is anything after it. } else if (ret[1].length > 0) { if (el.decoration === undefined) el.decoration = []; el.decoration.push(ret[1]); } i += ret[0]; } else { ret = letter_to_grace(line, i); // TODO-PER: Be sure there aren't already grace notes defined. That is an error. if (ret[0] > 0) { el.gracenotes = ret[1]; i += ret[0]; } else break; } } } ret = letter_to_bar(line, i); if (ret[0] > 0) { // This is definitely a bar if (el.gracenote !== undefined) warn("Can't have a grace note before a barline", line, i); var bar = {type: ret[1]}; if (bar.type.length === 0) warn("Unknown bar type", line, i); else { if (ret[2]) bar.number = ret[2]; if (el.decoration !== undefined) bar.decoration = el.decoration; if (el.chord !== undefined) bar.chord = el.chord; tune.appendElement('bar', startOfLine+i, startOfLine+i+ret[0], bar); el = {}; } i += ret[0]; } else { // This is definitely a note group // // Look for as many open slurs and triplets as there are. (Note: only the first triplet is valid.) ret = letter_to_open_slurs_and_triplets(line, i); if (ret.consumed > 0) { if (ret.startSlur !== undefined) el.startSlur = ret.startSlur; if (ret.triplet !== undefined) { if (tripletNotesLeft > 0) warn("Can't nest triplets", line, i); else { el.startTriplet = ret.triplet; tripletNotesLeft = ret.num_notes === undefined ? ret.triplet : ret.num_notes; } } i += ret.consumed; } // handle chords. if (line[i] === '[') { i++; var chordDuration = null; var done = false; while (!done) { var chordNote = getCoreNote(line, i, {}, false); if (chordNote !== null) { if (el.pitches === undefined) el.pitches = [ chordNote ]; else el.pitches.push(chordNote); if (inTieChord[el.pitches.length]) { chordNote.endTie = true; inTieChord[el.pitches.length] = undefined; } if (chordNote.startTie) inTieChord[el.pitches.length] = true; i = chordNote.endChar; } else if (line[i] === ' ') { // Spaces are not allowed in chords, but we can recover from it by ignoring it. warn("Spaces are not allowed in chords", line, i); i++; } else { if (i < line.length && line[i] === ']') { // consume the close bracket i++; if (multilineVars.next_note_duration !== 0) { el.pitches.each(function(p) { p.duration = p.duration * multilineVars.next_note_duration; }); multilineVars.next_note_duration = 0; } if (inTie) { el.endTie = true; inTie = false; } if (tripletNotesLeft > 0) { tripletNotesLeft--; if (tripletNotesLeft === 0) { el.endTriplet = true; } } var postChordDone = false; while (i < line.length && !postChordDone) { switch (line[i]) { case ' ': case '\t': addEndBeam(el); break; case ')': if (el.endSlur === undefined) el.endSlur = 1; else el.endSlur++; break; case '-': if (el.startTie === true) // can only have one of these postChordDone = true; else { el.startTie = true; inTie = true; } break; case '>': case '<': var br2 = getBrokenRhythm(line, i); i += br2[0] - 1; // index gets incremented below, so we'll let that happen multilineVars.next_note_duration = br2[2]; chordDuration = br2[1]; break; default: postChordDone = true; break; } if (!postChordDone) { i++; } } } else warn("Expected ']' to end the chords", line, i); if (el.pitches !== undefined) { if (chordDuration !== null) { el.pitches.each(function(p) { p.duration = p.duration * chordDuration; }); } tune.appendElement('note', startOfLine+i, startOfLine+i, el); el = {}; } done = true; } } } else { // Single pitch var core = getCoreNote(line, i, el, true); if (core !== null) { el = core; if (inTie) { el.endTie = true; inTie = false; } if (el.startTie) inTie = true; i = el.endChar; if (tripletNotesLeft > 0) { tripletNotesLeft--; if (tripletNotesLeft === 0) { el.endTriplet = true; } } if (ret.end_beam) addEndBeam(el); tune.appendElement('note', startOfLine+i, startOfLine+1, el); el = {}; } } if (i === startI) { // don't know what this is, so ignore it. if (line[i] !== ' ' && line[i] !== '`') warn("Unknown character ignored", line, i); i++; } } } } };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/66c5771dcec8aa949d4f3e38d5c1edaf2264c555/abc_parse.js/buggy/abc_parse.js
bar.number = ret[2];
bar.ending = ret[2];
var parseRegularMusicLine = function(line) { resolveTempo(); multilineVars.havent_set_length = false; // To late to set this now. multilineVars.is_in_header = false; // We should have gotten a key header by now, but just in case, this is definitely out of the header. var i = 0; var startOfLine = multilineVars.iChar; // see if there is nothing but a comment on this line. If so, just ignore it. A full line comment is optional white space followed by % while (tokenizer.isWhiteSpace(line[i]) && i < line.length) i++; if (i === line.length || line[i] === '%') return; // Start with the standard staff, clef and key symbols on each line if (multilineVars.start_new_line) { startNewLine(); } multilineVars.start_new_line = true; var tripletNotesLeft = 0; //var tripletMultiplier = 0; var inTie = false; var inTieChord = {}; // See if the line starts with a header field var retHeader = letter_to_body_header(line, i); if (retHeader[0] > 0) { i += retHeader[0]; // TODO-PER: Handle inline headers } var el = { }; while (i < line.length) { var startI = i; if (line[i] === '%') break; var retInlineHeader = letter_to_inline_header(line, i); if (retInlineHeader[0] > 0) { i += retInlineHeader[0]; // TODO-PER: Handle inline headers //multilineVars.start_new_line = false; } else {// var el = { }; // We need to decide if the following characters are a bar-marking or a note-group. // Unfortunately, that is ambiguous. Both can contain chord symbols and decorations. // If there is a grace note either before or after the chord symbols and decorations, then it is definitely a note-group. // If there is a bar marker, it is definitely a bar-marking. // If there is either a core-note or chord, it is definitely a note-group. // So, loop while we find grace-notes, chords-symbols, or decorations. [It is an error to have more than one grace-note group in a row; the others can be multiple] // Then, if there is a grace-note, we know where to go. // Else see if we have a chord, core-note, slur, triplet, or bar. while (1) { var ret = tokenizer.eatWhiteSpace(line, i); if (ret > 0) { i += ret; } if (i > 0 && line[i-1] === '\x12') { // there is one case where a line continuation isn't the same as being on the same line, and that is if the next character after it is a header. ret = letter_to_body_header(line, i); if (ret[0] > 0) { // TODO: insert header here i += ret[0]; multilineVars.start_new_line = false; } } // gather all the grace notes, chord symbols and decorations ret = letter_to_spacer(line, i); if (ret[0] > 0) { i += ret[0]; } ret = letter_to_chord(line, i); if (ret[0] > 0) { // TODO-PER: There could be more than one chord here if they have different positions. el.chord = {name: tokenizer.translateString(ret[1]), position: ret[2]}; i += ret[0]; i += tokenizer.skipWhiteSpace(line.substring(i)); } else { ret = letter_to_accent(line, i); if (ret[0] > 0) { if (ret[1] === null) { if (i+1 < line.length) startNewLine(); // There was a ! in the middle of the line. Start a new line if there is anything after it. } else if (ret[1].length > 0) { if (el.decoration === undefined) el.decoration = []; el.decoration.push(ret[1]); } i += ret[0]; } else { ret = letter_to_grace(line, i); // TODO-PER: Be sure there aren't already grace notes defined. That is an error. if (ret[0] > 0) { el.gracenotes = ret[1]; i += ret[0]; } else break; } } } ret = letter_to_bar(line, i); if (ret[0] > 0) { // This is definitely a bar if (el.gracenote !== undefined) warn("Can't have a grace note before a barline", line, i); var bar = {type: ret[1]}; if (bar.type.length === 0) warn("Unknown bar type", line, i); else { if (ret[2]) bar.number = ret[2]; if (el.decoration !== undefined) bar.decoration = el.decoration; if (el.chord !== undefined) bar.chord = el.chord; tune.appendElement('bar', startOfLine+i, startOfLine+i+ret[0], bar); el = {}; } i += ret[0]; } else { // This is definitely a note group // // Look for as many open slurs and triplets as there are. (Note: only the first triplet is valid.) ret = letter_to_open_slurs_and_triplets(line, i); if (ret.consumed > 0) { if (ret.startSlur !== undefined) el.startSlur = ret.startSlur; if (ret.triplet !== undefined) { if (tripletNotesLeft > 0) warn("Can't nest triplets", line, i); else { el.startTriplet = ret.triplet; tripletNotesLeft = ret.num_notes === undefined ? ret.triplet : ret.num_notes; } } i += ret.consumed; } // handle chords. if (line[i] === '[') { i++; var chordDuration = null; var done = false; while (!done) { var chordNote = getCoreNote(line, i, {}, false); if (chordNote !== null) { if (el.pitches === undefined) el.pitches = [ chordNote ]; else el.pitches.push(chordNote); if (inTieChord[el.pitches.length]) { chordNote.endTie = true; inTieChord[el.pitches.length] = undefined; } if (chordNote.startTie) inTieChord[el.pitches.length] = true; i = chordNote.endChar; } else if (line[i] === ' ') { // Spaces are not allowed in chords, but we can recover from it by ignoring it. warn("Spaces are not allowed in chords", line, i); i++; } else { if (i < line.length && line[i] === ']') { // consume the close bracket i++; if (multilineVars.next_note_duration !== 0) { el.pitches.each(function(p) { p.duration = p.duration * multilineVars.next_note_duration; }); multilineVars.next_note_duration = 0; } if (inTie) { el.endTie = true; inTie = false; } if (tripletNotesLeft > 0) { tripletNotesLeft--; if (tripletNotesLeft === 0) { el.endTriplet = true; } } var postChordDone = false; while (i < line.length && !postChordDone) { switch (line[i]) { case ' ': case '\t': addEndBeam(el); break; case ')': if (el.endSlur === undefined) el.endSlur = 1; else el.endSlur++; break; case '-': if (el.startTie === true) // can only have one of these postChordDone = true; else { el.startTie = true; inTie = true; } break; case '>': case '<': var br2 = getBrokenRhythm(line, i); i += br2[0] - 1; // index gets incremented below, so we'll let that happen multilineVars.next_note_duration = br2[2]; chordDuration = br2[1]; break; default: postChordDone = true; break; } if (!postChordDone) { i++; } } } else warn("Expected ']' to end the chords", line, i); if (el.pitches !== undefined) { if (chordDuration !== null) { el.pitches.each(function(p) { p.duration = p.duration * chordDuration; }); } tune.appendElement('note', startOfLine+i, startOfLine+i, el); el = {}; } done = true; } } } else { // Single pitch var core = getCoreNote(line, i, el, true); if (core !== null) { el = core; if (inTie) { el.endTie = true; inTie = false; } if (el.startTie) inTie = true; i = el.endChar; if (tripletNotesLeft > 0) { tripletNotesLeft--; if (tripletNotesLeft === 0) { el.endTriplet = true; } } if (ret.end_beam) addEndBeam(el); tune.appendElement('note', startOfLine+i, startOfLine+1, el); el = {}; } } if (i === startI) { // don't know what this is, so ignore it. if (line[i] !== ' ' && line[i] !== '`') warn("Unknown character ignored", line, i); i++; } } } } };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/66c5771dcec8aa949d4f3e38d5c1edaf2264c555/abc_parse.js/buggy/abc_parse.js
if (multilineVars.barNumOnNextNote) { el.barNumber = multilineVars.barNumOnNextNote; multilineVars.barNumOnNextNote = null; }
var parseRegularMusicLine = function(line) { resolveTempo(); multilineVars.havent_set_length = false; // To late to set this now. multilineVars.is_in_header = false; // We should have gotten a key header by now, but just in case, this is definitely out of the header. var i = 0; var startOfLine = multilineVars.iChar; // see if there is nothing but a comment on this line. If so, just ignore it. A full line comment is optional white space followed by % while (tokenizer.isWhiteSpace(line[i]) && i < line.length) i++; if (i === line.length || line[i] === '%') return; // Start with the standard staff, clef and key symbols on each line if (multilineVars.start_new_line) { startNewLine(); } multilineVars.start_new_line = true; var tripletNotesLeft = 0; //var tripletMultiplier = 0; var inTie = false; var inTieChord = {}; // See if the line starts with a header field var retHeader = letter_to_body_header(line, i); if (retHeader[0] > 0) { i += retHeader[0]; // TODO-PER: Handle inline headers } var el = { }; while (i < line.length) { var startI = i; if (line[i] === '%') break; var retInlineHeader = letter_to_inline_header(line, i); if (retInlineHeader[0] > 0) { i += retInlineHeader[0]; // TODO-PER: Handle inline headers //multilineVars.start_new_line = false; } else {// var el = { }; // We need to decide if the following characters are a bar-marking or a note-group. // Unfortunately, that is ambiguous. Both can contain chord symbols and decorations. // If there is a grace note either before or after the chord symbols and decorations, then it is definitely a note-group. // If there is a bar marker, it is definitely a bar-marking. // If there is either a core-note or chord, it is definitely a note-group. // So, loop while we find grace-notes, chords-symbols, or decorations. [It is an error to have more than one grace-note group in a row; the others can be multiple] // Then, if there is a grace-note, we know where to go. // Else see if we have a chord, core-note, slur, triplet, or bar. while (1) { var ret = tokenizer.eatWhiteSpace(line, i); if (ret > 0) { i += ret; } if (i > 0 && line[i-1] === '\x12') { // there is one case where a line continuation isn't the same as being on the same line, and that is if the next character after it is a header. ret = letter_to_body_header(line, i); if (ret[0] > 0) { // TODO: insert header here i += ret[0]; multilineVars.start_new_line = false; } } // gather all the grace notes, chord symbols and decorations ret = letter_to_spacer(line, i); if (ret[0] > 0) { i += ret[0]; } ret = letter_to_chord(line, i); if (ret[0] > 0) { // TODO-PER: There could be more than one chord here if they have different positions. el.chord = {name: tokenizer.translateString(ret[1]), position: ret[2]}; i += ret[0]; i += tokenizer.skipWhiteSpace(line.substring(i)); } else { ret = letter_to_accent(line, i); if (ret[0] > 0) { if (ret[1] === null) { if (i+1 < line.length) startNewLine(); // There was a ! in the middle of the line. Start a new line if there is anything after it. } else if (ret[1].length > 0) { if (el.decoration === undefined) el.decoration = []; el.decoration.push(ret[1]); } i += ret[0]; } else { ret = letter_to_grace(line, i); // TODO-PER: Be sure there aren't already grace notes defined. That is an error. if (ret[0] > 0) { el.gracenotes = ret[1]; i += ret[0]; } else break; } } } ret = letter_to_bar(line, i); if (ret[0] > 0) { // This is definitely a bar if (el.gracenote !== undefined) warn("Can't have a grace note before a barline", line, i); var bar = {type: ret[1]}; if (bar.type.length === 0) warn("Unknown bar type", line, i); else { if (ret[2]) bar.number = ret[2]; if (el.decoration !== undefined) bar.decoration = el.decoration; if (el.chord !== undefined) bar.chord = el.chord; tune.appendElement('bar', startOfLine+i, startOfLine+i+ret[0], bar); el = {}; } i += ret[0]; } else { // This is definitely a note group // // Look for as many open slurs and triplets as there are. (Note: only the first triplet is valid.) ret = letter_to_open_slurs_and_triplets(line, i); if (ret.consumed > 0) { if (ret.startSlur !== undefined) el.startSlur = ret.startSlur; if (ret.triplet !== undefined) { if (tripletNotesLeft > 0) warn("Can't nest triplets", line, i); else { el.startTriplet = ret.triplet; tripletNotesLeft = ret.num_notes === undefined ? ret.triplet : ret.num_notes; } } i += ret.consumed; } // handle chords. if (line[i] === '[') { i++; var chordDuration = null; var done = false; while (!done) { var chordNote = getCoreNote(line, i, {}, false); if (chordNote !== null) { if (el.pitches === undefined) el.pitches = [ chordNote ]; else el.pitches.push(chordNote); if (inTieChord[el.pitches.length]) { chordNote.endTie = true; inTieChord[el.pitches.length] = undefined; } if (chordNote.startTie) inTieChord[el.pitches.length] = true; i = chordNote.endChar; } else if (line[i] === ' ') { // Spaces are not allowed in chords, but we can recover from it by ignoring it. warn("Spaces are not allowed in chords", line, i); i++; } else { if (i < line.length && line[i] === ']') { // consume the close bracket i++; if (multilineVars.next_note_duration !== 0) { el.pitches.each(function(p) { p.duration = p.duration * multilineVars.next_note_duration; }); multilineVars.next_note_duration = 0; } if (inTie) { el.endTie = true; inTie = false; } if (tripletNotesLeft > 0) { tripletNotesLeft--; if (tripletNotesLeft === 0) { el.endTriplet = true; } } var postChordDone = false; while (i < line.length && !postChordDone) { switch (line[i]) { case ' ': case '\t': addEndBeam(el); break; case ')': if (el.endSlur === undefined) el.endSlur = 1; else el.endSlur++; break; case '-': if (el.startTie === true) // can only have one of these postChordDone = true; else { el.startTie = true; inTie = true; } break; case '>': case '<': var br2 = getBrokenRhythm(line, i); i += br2[0] - 1; // index gets incremented below, so we'll let that happen multilineVars.next_note_duration = br2[2]; chordDuration = br2[1]; break; default: postChordDone = true; break; } if (!postChordDone) { i++; } } } else warn("Expected ']' to end the chords", line, i); if (el.pitches !== undefined) { if (chordDuration !== null) { el.pitches.each(function(p) { p.duration = p.duration * chordDuration; }); } tune.appendElement('note', startOfLine+i, startOfLine+i, el); el = {}; } done = true; } } } else { // Single pitch var core = getCoreNote(line, i, el, true); if (core !== null) { el = core; if (inTie) { el.endTie = true; inTie = false; } if (el.startTie) inTie = true; i = el.endChar; if (tripletNotesLeft > 0) { tripletNotesLeft--; if (tripletNotesLeft === 0) { el.endTriplet = true; } } if (ret.end_beam) addEndBeam(el); tune.appendElement('note', startOfLine+i, startOfLine+1, el); el = {}; } } if (i === startI) { // don't know what this is, so ignore it. if (line[i] !== ' ' && line[i] !== '`') warn("Unknown character ignored", line, i); i++; } } } } };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/66c5771dcec8aa949d4f3e38d5c1edaf2264c555/abc_parse.js/buggy/abc_parse.js
i += ret[0];
i = ret[0];
var parseRegularMusicLine = function(line) { resolveTempo(); //multilineVars.havent_set_length = false; // To late to set this now. multilineVars.is_in_header = false; // We should have gotten a key header by now, but just in case, this is definitely out of the header. var i = 0; var startOfLine = multilineVars.iChar; // see if there is nothing but a comment on this line. If so, just ignore it. A full line comment is optional white space followed by % while (tokenizer.isWhiteSpace(line[i]) && i < line.length) i++; if (i === line.length || line[i] === '%') return; // Start with the standard staff, clef and key symbols on each line if (multilineVars.start_new_line) { startNewLine(); } multilineVars.start_new_line = true; var tripletNotesLeft = 0; //var tripletMultiplier = 0; var inTie = false; var inTieChord = {}; // See if the line starts with a header field var retHeader = letter_to_body_header(line, i); if (retHeader[0] > 0) { i += retHeader[0]; // TODO-PER: Handle inline headers } var el = { }; while (i < line.length) { var startI = i; if (line[i] === '%') break; var retInlineHeader = letter_to_inline_header(line, i); if (retInlineHeader[0] > 0) { i += retInlineHeader[0]; // TODO-PER: Handle inline headers //multilineVars.start_new_line = false; } else {// var el = { }; // We need to decide if the following characters are a bar-marking or a note-group. // Unfortunately, that is ambiguous. Both can contain chord symbols and decorations. // If there is a grace note either before or after the chord symbols and decorations, then it is definitely a note-group. // If there is a bar marker, it is definitely a bar-marking. // If there is either a core-note or chord, it is definitely a note-group. // So, loop while we find grace-notes, chords-symbols, or decorations. [It is an error to have more than one grace-note group in a row; the others can be multiple] // Then, if there is a grace-note, we know where to go. // Else see if we have a chord, core-note, slur, triplet, or bar. while (1) { var ret = tokenizer.eatWhiteSpace(line, i); if (ret > 0) { i += ret; } if (i > 0 && line[i-1] === '\x12') { // there is one case where a line continuation isn't the same as being on the same line, and that is if the next character after it is a header. ret = letter_to_body_header(line, i); if (ret[0] > 0) { // TODO: insert header here i += ret[0]; multilineVars.start_new_line = false; } } // gather all the grace notes, chord symbols and decorations ret = letter_to_spacer(line, i); if (ret[0] > 0) { i += ret[0]; } ret = letter_to_chord(line, i); if (ret[0] > 0) { // TODO-PER: There could be more than one chord here if they have different positions. el.chord = {name: tokenizer.translateString(ret[1]), position: ret[2]}; i += ret[0]; i += tokenizer.skipWhiteSpace(line.substring(i)); } else { ret = letter_to_accent(line, i); if (ret[0] > 0) { if (ret[1] === null) { if (i+1 < line.length) startNewLine(); // There was a ! in the middle of the line. Start a new line if there is anything after it. } else if (ret[1].length > 0) { if (el.decoration === undefined) el.decoration = []; el.decoration.push(ret[1]); } i += ret[0]; } else { ret = letter_to_grace(line, i); // TODO-PER: Be sure there aren't already grace notes defined. That is an error. if (ret[0] > 0) { el.gracenotes = ret[1]; i += ret[0]; } else break; } } } ret = letter_to_bar(line, i); if (ret[0] > 0) { // This is definitely a bar if (el.gracenote !== undefined) warn("Can't have a grace note before a barline", line, i); var bar = {type: ret[1]}; if (bar.type.length === 0) warn("Unknown bar type", line, i); else { if (ret[2]) bar.ending = ret[2]; if (el.decoration !== undefined) bar.decoration = el.decoration; if (el.chord !== undefined) bar.chord = el.chord; if (bar.type !== 'bar_invisible') { multilineVars.currBarNumber++; if (multilineVars.barNumbers && multilineVars.currBarNumber % multilineVars.barNumbers === 0) multilineVars.barNumOnNextNote = multilineVars.currBarNumber; } tune.appendElement('bar', startOfLine+i, startOfLine+i+ret[0], bar); el = {}; } i += ret[0]; } else { // This is definitely a note group // // Look for as many open slurs and triplets as there are. (Note: only the first triplet is valid.) ret = letter_to_open_slurs_and_triplets(line, i); if (ret.consumed > 0) { if (ret.startSlur !== undefined) el.startSlur = ret.startSlur; if (ret.triplet !== undefined) { if (tripletNotesLeft > 0) warn("Can't nest triplets", line, i); else { el.startTriplet = ret.triplet; tripletNotesLeft = ret.num_notes === undefined ? ret.triplet : ret.num_notes; } } i += ret.consumed; } // handle chords. if (line[i] === '[') { i++; var chordDuration = null; var done = false; while (!done) { var chordNote = getCoreNote(line, i, {}, false); if (chordNote !== null) { if (el.pitches === undefined) el.pitches = [ chordNote ]; else el.pitches.push(chordNote); if (inTieChord[el.pitches.length]) { chordNote.endTie = true; inTieChord[el.pitches.length] = undefined; } if (chordNote.startTie) inTieChord[el.pitches.length] = true; i = chordNote.endChar; } else if (line[i] === ' ') { // Spaces are not allowed in chords, but we can recover from it by ignoring it. warn("Spaces are not allowed in chords", line, i); i++; } else { if (i < line.length && line[i] === ']') { // consume the close bracket i++; if (multilineVars.next_note_duration !== 0) { el.pitches.each(function(p) { p.duration = p.duration * multilineVars.next_note_duration; }); multilineVars.next_note_duration = 0; } if (inTie) { el.endTie = true; inTie = false; } if (tripletNotesLeft > 0) { tripletNotesLeft--; if (tripletNotesLeft === 0) { el.endTriplet = true; } } var postChordDone = false; while (i < line.length && !postChordDone) { switch (line[i]) { case ' ': case '\t': addEndBeam(el); break; case ')': if (el.endSlur === undefined) el.endSlur = 1; else el.endSlur++; break; case '-': if (el.startTie === true) // can only have one of these postChordDone = true; else { el.startTie = true; inTie = true; } break; case '>': case '<': var br2 = getBrokenRhythm(line, i); i += br2[0] - 1; // index gets incremented below, so we'll let that happen multilineVars.next_note_duration = br2[2]; chordDuration = br2[1]; break; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '/': var fraction = tokenizer.getFraction(line, i); chordDuration = fraction.value; i = fraction.index; default: postChordDone = true; break; } if (!postChordDone) { i++; } } } else warn("Expected ']' to end the chords", line, i); if (el.pitches !== undefined) { if (chordDuration !== null) { el.pitches.each(function(p) { p.duration = p.duration * chordDuration; }); } if (multilineVars.barNumOnNextNote) { el.barNumber = multilineVars.barNumOnNextNote; multilineVars.barNumOnNextNote = null; } tune.appendElement('note', startOfLine+i, startOfLine+i, el); el = {}; } done = true; } } } else { // Single pitch var core = getCoreNote(line, i, el, true); if (core !== null) { el = core; if (inTie) { el.endTie = true; inTie = false; } if (el.startTie) inTie = true; i = el.endChar; if (tripletNotesLeft > 0) { tripletNotesLeft--; if (tripletNotesLeft === 0) { el.endTriplet = true; } } if (ret.end_beam) addEndBeam(el); if (multilineVars.barNumOnNextNote) { el.barNumber = multilineVars.barNumOnNextNote; multilineVars.barNumOnNextNote = null; } tune.appendElement('note', startOfLine+i, startOfLine+1, el); el = {}; } } if (i === startI) { // don't know what this is, so ignore it. if (line[i] !== ' ' && line[i] !== '`') warn("Unknown character ignored", line, i); i++; } } } } };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/05b2dde631d4eb1677f46195c6c62184e7d629aa/abc_parse.js/clean/abc_parse.js
if (el.gracenote !== undefined) warn("Can't have a grace note before a barline", line, i);
if (el.gracenotes !== undefined) { el.pitch = null; el.rest_type = 'spacer'; tune.appendElement('note', -1, -1, el); el = {}; }
var parseRegularMusicLine = function(line) { resolveTempo(); //multilineVars.havent_set_length = false; // To late to set this now. multilineVars.is_in_header = false; // We should have gotten a key header by now, but just in case, this is definitely out of the header. var i = 0; var startOfLine = multilineVars.iChar; // see if there is nothing but a comment on this line. If so, just ignore it. A full line comment is optional white space followed by % while (tokenizer.isWhiteSpace(line[i]) && i < line.length) i++; if (i === line.length || line[i] === '%') return; // Start with the standard staff, clef and key symbols on each line if (multilineVars.start_new_line) { startNewLine(); } multilineVars.start_new_line = true; var tripletNotesLeft = 0; //var tripletMultiplier = 0; var inTie = false; var inTieChord = {}; // See if the line starts with a header field var retHeader = letter_to_body_header(line, i); if (retHeader[0] > 0) { i += retHeader[0]; // TODO-PER: Handle inline headers } var el = { }; while (i < line.length) { var startI = i; if (line[i] === '%') break; var retInlineHeader = letter_to_inline_header(line, i); if (retInlineHeader[0] > 0) { i += retInlineHeader[0]; // TODO-PER: Handle inline headers //multilineVars.start_new_line = false; } else {// var el = { }; // We need to decide if the following characters are a bar-marking or a note-group. // Unfortunately, that is ambiguous. Both can contain chord symbols and decorations. // If there is a grace note either before or after the chord symbols and decorations, then it is definitely a note-group. // If there is a bar marker, it is definitely a bar-marking. // If there is either a core-note or chord, it is definitely a note-group. // So, loop while we find grace-notes, chords-symbols, or decorations. [It is an error to have more than one grace-note group in a row; the others can be multiple] // Then, if there is a grace-note, we know where to go. // Else see if we have a chord, core-note, slur, triplet, or bar. while (1) { var ret = tokenizer.eatWhiteSpace(line, i); if (ret > 0) { i += ret; } if (i > 0 && line[i-1] === '\x12') { // there is one case where a line continuation isn't the same as being on the same line, and that is if the next character after it is a header. ret = letter_to_body_header(line, i); if (ret[0] > 0) { // TODO: insert header here i += ret[0]; multilineVars.start_new_line = false; } } // gather all the grace notes, chord symbols and decorations ret = letter_to_spacer(line, i); if (ret[0] > 0) { i += ret[0]; } ret = letter_to_chord(line, i); if (ret[0] > 0) { // TODO-PER: There could be more than one chord here if they have different positions. el.chord = {name: tokenizer.translateString(ret[1]), position: ret[2]}; i += ret[0]; i += tokenizer.skipWhiteSpace(line.substring(i)); } else { ret = letter_to_accent(line, i); if (ret[0] > 0) { if (ret[1] === null) { if (i+1 < line.length) startNewLine(); // There was a ! in the middle of the line. Start a new line if there is anything after it. } else if (ret[1].length > 0) { if (el.decoration === undefined) el.decoration = []; el.decoration.push(ret[1]); } i += ret[0]; } else { ret = letter_to_grace(line, i); // TODO-PER: Be sure there aren't already grace notes defined. That is an error. if (ret[0] > 0) { el.gracenotes = ret[1]; i += ret[0]; } else break; } } } ret = letter_to_bar(line, i); if (ret[0] > 0) { // This is definitely a bar if (el.gracenote !== undefined) warn("Can't have a grace note before a barline", line, i); var bar = {type: ret[1]}; if (bar.type.length === 0) warn("Unknown bar type", line, i); else { if (ret[2]) bar.ending = ret[2]; if (el.decoration !== undefined) bar.decoration = el.decoration; if (el.chord !== undefined) bar.chord = el.chord; if (bar.type !== 'bar_invisible') { multilineVars.currBarNumber++; if (multilineVars.barNumbers && multilineVars.currBarNumber % multilineVars.barNumbers === 0) multilineVars.barNumOnNextNote = multilineVars.currBarNumber; } tune.appendElement('bar', startOfLine+i, startOfLine+i+ret[0], bar); el = {}; } i += ret[0]; } else { // This is definitely a note group // // Look for as many open slurs and triplets as there are. (Note: only the first triplet is valid.) ret = letter_to_open_slurs_and_triplets(line, i); if (ret.consumed > 0) { if (ret.startSlur !== undefined) el.startSlur = ret.startSlur; if (ret.triplet !== undefined) { if (tripletNotesLeft > 0) warn("Can't nest triplets", line, i); else { el.startTriplet = ret.triplet; tripletNotesLeft = ret.num_notes === undefined ? ret.triplet : ret.num_notes; } } i += ret.consumed; } // handle chords. if (line[i] === '[') { i++; var chordDuration = null; var done = false; while (!done) { var chordNote = getCoreNote(line, i, {}, false); if (chordNote !== null) { if (el.pitches === undefined) el.pitches = [ chordNote ]; else el.pitches.push(chordNote); if (inTieChord[el.pitches.length]) { chordNote.endTie = true; inTieChord[el.pitches.length] = undefined; } if (chordNote.startTie) inTieChord[el.pitches.length] = true; i = chordNote.endChar; } else if (line[i] === ' ') { // Spaces are not allowed in chords, but we can recover from it by ignoring it. warn("Spaces are not allowed in chords", line, i); i++; } else { if (i < line.length && line[i] === ']') { // consume the close bracket i++; if (multilineVars.next_note_duration !== 0) { el.pitches.each(function(p) { p.duration = p.duration * multilineVars.next_note_duration; }); multilineVars.next_note_duration = 0; } if (inTie) { el.endTie = true; inTie = false; } if (tripletNotesLeft > 0) { tripletNotesLeft--; if (tripletNotesLeft === 0) { el.endTriplet = true; } } var postChordDone = false; while (i < line.length && !postChordDone) { switch (line[i]) { case ' ': case '\t': addEndBeam(el); break; case ')': if (el.endSlur === undefined) el.endSlur = 1; else el.endSlur++; break; case '-': if (el.startTie === true) // can only have one of these postChordDone = true; else { el.startTie = true; inTie = true; } break; case '>': case '<': var br2 = getBrokenRhythm(line, i); i += br2[0] - 1; // index gets incremented below, so we'll let that happen multilineVars.next_note_duration = br2[2]; chordDuration = br2[1]; break; case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '/': var fraction = tokenizer.getFraction(line, i); chordDuration = fraction.value; i = fraction.index; default: postChordDone = true; break; } if (!postChordDone) { i++; } } } else warn("Expected ']' to end the chords", line, i); if (el.pitches !== undefined) { if (chordDuration !== null) { el.pitches.each(function(p) { p.duration = p.duration * chordDuration; }); } if (multilineVars.barNumOnNextNote) { el.barNumber = multilineVars.barNumOnNextNote; multilineVars.barNumOnNextNote = null; } tune.appendElement('note', startOfLine+i, startOfLine+i, el); el = {}; } done = true; } } } else { // Single pitch var core = getCoreNote(line, i, el, true); if (core !== null) { el = core; if (inTie) { el.endTie = true; inTie = false; } if (el.startTie) inTie = true; i = el.endChar; if (tripletNotesLeft > 0) { tripletNotesLeft--; if (tripletNotesLeft === 0) { el.endTriplet = true; } } if (ret.end_beam) addEndBeam(el); if (multilineVars.barNumOnNextNote) { el.barNumber = multilineVars.barNumOnNextNote; multilineVars.barNumOnNextNote = null; } tune.appendElement('note', startOfLine+i, startOfLine+1, el); el = {}; } } if (i === startI) { // don't know what this is, so ignore it. if (line[i] !== ' ' && line[i] !== '`') warn("Unknown character ignored", line, i); i++; } } } } };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/05b2dde631d4eb1677f46195c6c62184e7d629aa/abc_parse.js/clean/abc_parse.js
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(c){var e=a(".the-tags",c),d=a(".tagchecklist",c),b;if(!e.length){return}b=e.val().split(",");d.empty();a.each(b,function(h,i){var f,g,j=a(c).attr("id");i=a.trim(i);if(!i.match(/^\s+$/)&&""!=i){g=j+"-check-num-"+h;f='<span><a id="'+g+'" class="ntdelbutton">X</a>&nbsp;'+i+"</span> ";d.append(f);a("#"+g).click(function(){tagBox.parseTags(this)})}})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});a("#"+c).after(e)})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").siblings(".newtag").focus()});a("input.newtag",c).blur(function(){if(this.value==""){a(this).siblings(".taghint").css("visibility","")}}).focus(function(){a(this).siblings(".taghint").css("visibility","hidden")}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+d,{delay:500,minchars:2,multiple:true,multipleSep:", "})});a("#post").submit(function(){a("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){tagBox.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(b){a(".inside","#postimagediv").html(b)};WPSetThumbnailID=function(c){var b=a("input[value=_thumbnail_id]","#list-table");if(b.size()>0){a("#meta\\["+b.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(c)}};WPRemoveThumbnail=function(){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(b){if(b=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(b)}})}})(jQuery);jQuery(document).ready(function(f){var d,a,b,h="",i="post"==pagenow||"post-new"==pagenow,g="page"==pagenow||"page-new"==pagenow;if(i){type="post";if(typenow){type=typenow}postboxes.add_postbox_toggles(type)}else{if(g){postboxes.add_postbox_toggles("page")}}if(f("#tagsdiv-post_tag").length){tagBox.init()}else{f("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}if(f("#categorydiv").length){f("a","#category-tabs").click(function(){var j=f(this).attr("href");f(this).parent().addClass("tabs").siblings("li").removeClass("tabs");f("#category-tabs").siblings(".tabs-panel").hide();f(j).show();if("#categories-all"==j){deleteUserSetting("cats")}else{setUserSetting("cats","pop")}return false});if(getUserSetting("cats")){f('a[href="#categories-pop"]',"#category-tabs").click()}f("#newcat").one("focus",function(){f(this).val("").removeClass("form-input-tip")});f("#category-add-sumbit").click(function(){f("#newcat").focus()});catAddBefore=function(j){if(!f("#newcat").val()){return false}j.data+="&"+f(":checked","#categorychecklist").serialize();return j};d=function(m,l){var k,j=f("#newcat_parent");if("undefined"!=l.parsed.responses[0]&&(k=l.parsed.responses[0].supplemental.newcat_parent)){j.before(k);j.remove()}};f("#categorychecklist").wpList({alt:"",response:"category-ajax-response",addBefore:catAddBefore,addAfter:d});f("#category-add-toggle").click(function(){f("#category-adder").toggleClass("wp-hidden-children");f('a[href="#categories-all"]',"#category-tabs").click();return false});f("#categorychecklist").children("li.popular-category").add(f("#categorychecklist-pop").children()).find(":checkbox").live("click",function(){var j=f(this),l=j.is(":checked"),k=j.val();f("#in-category-"+k+", #in-popular-category-"+k).attr("checked",l)})}if(f("#postcustom").length){f("#the-list").wpList({addAfter:function(j,k){f("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(k.parsed.responses[0].supplemental.postid)}},addBefore:function(j){j.data+="&post_id="+f("#post_ID").val();return j}})}if(f("#submitdiv").length){a=f("#timestamp").html();b=f("#post-visibility-display").html();function e(){var j=f("#post-visibility-select");if(f("input:radio:checked",j).val()!="public"){f("#sticky").attr("checked",false);f("#sticky-span").hide()}else{f("#sticky-span").show()}if(f("input:radio:checked",j).val()!="password"){f("#password-span").hide()}else{f("#password-span").show()}}function c(){var q,r,k,t,s=f("#post_status"),l=f("option[value=publish]",s),j=f("#aa").val(),o=f("#mm").val(),p=f("#jj").val(),n=f("#hh").val(),m=f("#mn").val();q=new Date(j,o-1,p,n,m);r=new Date(f("#hidden_aa").val(),f("#hidden_mm").val()-1,f("#hidden_jj").val(),f("#hidden_hh").val(),f("#hidden_mn").val());k=new Date(f("#cur_aa").val(),f("#cur_mm").val()-1,f("#cur_jj").val(),f("#cur_hh").val(),f("#cur_mn").val());if(q.getFullYear()!=j||(1+q.getMonth())!=o||q.getDate()!=p||q.getMinutes()!=m){f(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{f(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(q>k&&f("#original_post_status").val()!="future"){t=postL10n.publishOnFuture;f("#publish").val(postL10n.schedule)}else{if(q<=k&&f("#original_post_status").val()!="publish"){t=postL10n.publishOn;f("#publish").val(postL10n.publish)}else{t=postL10n.publishOnPast;if(g){f("#publish").val(postL10n.updatePage)}else{f("#publish").val(postL10n.updatePost)}}}if(r.toUTCString()==q.toUTCString()){f("#timestamp").html(a)}else{f("#timestamp").html(t+" <b>"+f("option[value="+f("#mm").val()+"]","#mm").text()+" "+p+", "+j+" @ "+n+":"+m+"</b> ")}if(f("input:radio:checked","#post-visibility-select").val()=="private"){if(g){f("#publish").val(postL10n.updatePage)}else{f("#publish").val(postL10n.updatePost)}if(l.length==0){s.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{l.html(postL10n.privatelyPublished)}f("option[value=publish]",s).attr("selected",true);f(".edit-post-status","#misc-publishing-actions").hide()}else{if(f("#original_post_status").val()=="future"||f("#original_post_status").val()=="draft"){if(l.length){l.remove();s.val(f("#hidden_post_status").val())}}else{l.html(postL10n.published)}if(s.is(":hidden")){f(".edit-post-status","#misc-publishing-actions").show()}}f("#post-status-display").html(f("option:selected",s).text());if(f("option:selected",s).val()=="private"||f("option:selected",s).val()=="publish"){f("#save-post").hide()}else{f("#save-post").show();if(f("option:selected",s).val()=="pending"){f("#save-post").show().val(postL10n.savePending)}else{f("#save-post").show().val(postL10n.saveDraft)}}return true}f(".edit-visibility","#visibility").click(function(){if(f("#post-visibility-select").is(":hidden")){e();f("#post-visibility-select").slideDown("normal");f(this).hide()}return false});f(".cancel-post-visibility","#post-visibility-select").click(function(){f("#post-visibility-select").slideUp("normal");f("#visibility-radio-"+f("#hidden-post-visibility").val()).attr("checked",true);f("#post_password").val(f("#hidden_post_password").val());f("#sticky").attr("checked",f("#hidden-post-sticky").attr("checked"));f("#post-visibility-display").html(b);f(".edit-visibility","#visibility").show();c();return false});f(".save-post-visibility","#post-visibility-select").click(function(){var j=f("#post-visibility-select");j.slideUp("normal");f(".edit-visibility","#visibility").show();c();if(f("input:radio:checked",j).val()!="public"){f("#sticky").attr("checked",false)}if(true==f("#sticky").attr("checked")){h="Sticky"}else{h=""}f("#post-visibility-display").html(postL10n[f("input:radio:checked",j).val()+h]);return false});f("input:radio","#post-visibility-select").change(function(){e()});f("#timestampdiv").siblings("a.edit-timestamp").click(function(){if(f("#timestampdiv").is(":hidden")){f("#timestampdiv").slideDown("normal");f(this).hide()}return false});f(".cancel-timestamp","#timestampdiv").click(function(){f("#timestampdiv").slideUp("normal");f("#mm").val(f("#hidden_mm").val());f("#jj").val(f("#hidden_jj").val());f("#aa").val(f("#hidden_aa").val());f("#hh").val(f("#hidden_hh").val());f("#mn").val(f("#hidden_mn").val());f("#timestampdiv").siblings("a.edit-timestamp").show();c();return false});f(".save-timestamp","#timestampdiv").click(function(){if(c()){f("#timestampdiv").slideUp("normal");f("#timestampdiv").siblings("a.edit-timestamp").show()}return false});f("#post-status-select").siblings("a.edit-post-status").click(function(){if(f("#post-status-select").is(":hidden")){f("#post-status-select").slideDown("normal");f(this).hide()}return false});f(".save-post-status","#post-status-select").click(function(){f("#post-status-select").slideUp("normal");f("#post-status-select").siblings("a.edit-post-status").show();c();return false});f(".cancel-post-status","#post-status-select").click(function(){f("#post-status-select").slideUp("normal");f("#post_status").val(f("#hidden_post_status").val());f("#post-status-select").siblings("a.edit-post-status").show();c();return false})}if(f("#edit-slug-box").length){editPermalink=function(j){var k,n=0,m=f("#editable-post-name"),o=m.html(),r=f("#post_name"),s=r.html(),p=f("#edit-slug-buttons"),q=p.html(),l=f("#editable-post-name-full").html();f("#view-post-btn").hide();p.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");p.children(".save").click(function(){var t=m.children("input").val();f.post(ajaxurl,{action:"sample-permalink",post_id:j,new_slug:t,new_title:f("#title").val(),samplepermalinknonce:f("#samplepermalinknonce").val()},function(u){f("#edit-slug-box").html(u);p.html(q);r.attr("value",t);makeSlugeditClickable();f("#view-post-btn").show()});return false});f(".cancel","#edit-slug-buttons").click(function(){f("#view-post-btn").show();m.html(o);p.html(q);r.attr("value",s);return false});for(k=0;k<l.length;++k){if("%"==l.charAt(k)){n++}}slug_value=(n>l.length/4)?"":l;m.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(u){var t=u.keyCode||0;if(13==t){p.children(".save").click();return false}if(27==t){p.children(".cancel").click();return false}r.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){f("#editable-post-name").click(function(){f("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}});
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(c){var e=a(".the-tags",c),d=a(".tagchecklist",c),b;if(!e.length){return}b=e.val().split(",");d.empty();a.each(b,function(h,i){var f,g,j=a(c).attr("id");i=a.trim(i);if(!i.match(/^\s+$/)&&""!=i){g=j+"-check-num-"+h;f='<span><a id="'+g+'" class="ntdelbutton">X</a>&nbsp;'+i+"</span> ";d.append(f);a("#"+g).click(function(){tagBox.parseTags(this)})}})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});a("#"+c).after(e)})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").siblings(".newtag").focus()});a("input.newtag",c).blur(function(){if(this.value==""){a(this).siblings(".taghint").css("visibility","")}}).focus(function(){a(this).siblings(".taghint").css("visibility","hidden")}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+d,{delay:500,minchars:2,multiple:true,multipleSep:", "})});a("#post").submit(function(){a("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){tagBox.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(b){a(".inside","#postimagediv").html(b)};WPSetThumbnailID=function(c){var b=a("input[value=_thumbnail_id]","#list-table");if(b.size()>0){a("#meta\\["+b.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(c)}};WPRemoveThumbnail=function(){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(b){if(b=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(b)}})}})(jQuery);jQuery(document).ready(function(g){var c,a,h="",b="post"==pagenow||"post-new"==pagenow,f="page"==pagenow||"page-new"==pagenow;if(b){type="post";if(typenow){type=typenow}postboxes.add_postbox_toggles(type)}else{if(f){postboxes.add_postbox_toggles("page")}}if(g("#tagsdiv-post_tag").length){tagBox.init()}else{g("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}g(".categorydiv").each(function(){var o=g(this).attr("id"),j=false,m,p,l;var n=o.split("-");n.shift();var i=n.join("-");var k=i+"_tab";if(i=="category"){k="cats"}g("a","#"+i+"-tabs").click(function(){var q=g(this).attr("href");g(this).parent().addClass("tabs").siblings("li").removeClass("tabs");g("#"+i+"-tabs").siblings(".tabs-panel").hide();g(q).show();if("#"+i+"-all"==q){deleteUserSetting(k)}else{setUserSetting(k,"pop")}return false});if(getUserSetting(k)){g('a[href="#'+i+'-pop"]',"#"+i+"-tabs").click()}g("#new"+i).one("focus",function(){g(this).val("").removeClass("form-input-tip")});g("#"+i+"-add-submit").click(function(){g("#new"+i).focus()});m=function(){if(j){return}j=true;var q=jQuery(this),s=q.is(":checked"),r=q.val().toString();g("#in-"+i+"-"+r+", #in-"+i+"-category-"+r).attr("checked",s);j=false};catAddBefore=function(q){if(!g("#new"+i).val()){return false}q.data+="&"+g(":checked","#"+i+"checklist").serialize();return q};p=function(v,u){var t,q=g("#new"+i+"_parent");if("undefined"!=u.parsed.responses[0]&&(t=u.parsed.responses[0].supplemental.newcat_parent)){q.before(t);q.remove()}};g("#"+i+"checklist").wpList({alt:"",response:i+"-ajax-response",addBefore:catAddBefore,addAfter:p});g("#"+i+"-add-toggle").click(function(){g("#"+i+"-adder").toggleClass("wp-hidden-children");g('a[href="#'+i+'-all"]',"#"+i+"-tabs").click();return false});g("#"+i+"checklist").children("li.popular-category").add(g("#"+i+"checklist-pop").children()).find(":checkbox").live("click",function(){var q=g(this),s=q.is(":checked"),r=q.val();g("#in-"+i+"-"+r+", #in-popular-"+i+"-"+r).attr("checked",s)})});if(g("#postcustom").length){g("#the-list").wpList({addAfter:function(i,j){g("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(j.parsed.responses[0].supplemental.postid)}},addBefore:function(i){i.data+="&post_id="+g("#post_ID").val();return i}})}if(g("#submitdiv").length){c=g("#timestamp").html();a=g("#post-visibility-display").html();function e(){var i=g("#post-visibility-select");if(g("input:radio:checked",i).val()!="public"){g("#sticky").attr("checked",false);g("#sticky-span").hide()}else{g("#sticky-span").show()}if(g("input:radio:checked",i).val()!="password"){g("#password-span").hide()}else{g("#password-span").show()}}function d(){var p,q,j,s,r=g("#post_status"),k=g("option[value=publish]",r),i=g("#aa").val(),n=g("#mm").val(),o=g("#jj").val(),m=g("#hh").val(),l=g("#mn").val();p=new Date(i,n-1,o,m,l);q=new Date(g("#hidden_aa").val(),g("#hidden_mm").val()-1,g("#hidden_jj").val(),g("#hidden_hh").val(),g("#hidden_mn").val());j=new Date(g("#cur_aa").val(),g("#cur_mm").val()-1,g("#cur_jj").val(),g("#cur_hh").val(),g("#cur_mn").val());if(p.getFullYear()!=i||(1+p.getMonth())!=n||p.getDate()!=o||p.getMinutes()!=l){g(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{g(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(p>j&&g("#original_post_status").val()!="future"){s=postL10n.publishOnFuture;g("#publish").val(postL10n.schedule)}else{if(p<=j&&g("#original_post_status").val()!="publish"){s=postL10n.publishOn;g("#publish").val(postL10n.publish)}else{s=postL10n.publishOnPast;if(f){g("#publish").val(postL10n.updatePage)}else{g("#publish").val(postL10n.updatePost)}}}if(q.toUTCString()==p.toUTCString()){g("#timestamp").html(c)}else{g("#timestamp").html(s+" <b>"+g("option[value="+g("#mm").val()+"]","#mm").text()+" "+o+", "+i+" @ "+m+":"+l+"</b> ")}if(g("input:radio:checked","#post-visibility-select").val()=="private"){if(f){g("#publish").val(postL10n.updatePage)}else{g("#publish").val(postL10n.updatePost)}if(k.length==0){r.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{k.html(postL10n.privatelyPublished)}g("option[value=publish]",r).attr("selected",true);g(".edit-post-status","#misc-publishing-actions").hide()}else{if(g("#original_post_status").val()=="future"||g("#original_post_status").val()=="draft"){if(k.length){k.remove();r.val(g("#hidden_post_status").val())}}else{k.html(postL10n.published)}if(r.is(":hidden")){g(".edit-post-status","#misc-publishing-actions").show()}}g("#post-status-display").html(g("option:selected",r).text());if(g("option:selected",r).val()=="private"||g("option:selected",r).val()=="publish"){g("#save-post").hide()}else{g("#save-post").show();if(g("option:selected",r).val()=="pending"){g("#save-post").show().val(postL10n.savePending)}else{g("#save-post").show().val(postL10n.saveDraft)}}return true}g(".edit-visibility","#visibility").click(function(){if(g("#post-visibility-select").is(":hidden")){e();g("#post-visibility-select").slideDown("normal");g(this).hide()}return false});g(".cancel-post-visibility","#post-visibility-select").click(function(){g("#post-visibility-select").slideUp("normal");g("#visibility-radio-"+g("#hidden-post-visibility").val()).attr("checked",true);g("#post_password").val(g("#hidden_post_password").val());g("#sticky").attr("checked",g("#hidden-post-sticky").attr("checked"));g("#post-visibility-display").html(a);g(".edit-visibility","#visibility").show();d();return false});g(".save-post-visibility","#post-visibility-select").click(function(){var i=g("#post-visibility-select");i.slideUp("normal");g(".edit-visibility","#visibility").show();d();if(g("input:radio:checked",i).val()!="public"){g("#sticky").attr("checked",false)}if(true==g("#sticky").attr("checked")){h="Sticky"}else{h=""}g("#post-visibility-display").html(postL10n[g("input:radio:checked",i).val()+h]);return false});g("input:radio","#post-visibility-select").change(function(){e()});g("#timestampdiv").siblings("a.edit-timestamp").click(function(){if(g("#timestampdiv").is(":hidden")){g("#timestampdiv").slideDown("normal");g(this).hide()}return false});g(".cancel-timestamp","#timestampdiv").click(function(){g("#timestampdiv").slideUp("normal");g("#mm").val(g("#hidden_mm").val());g("#jj").val(g("#hidden_jj").val());g("#aa").val(g("#hidden_aa").val());g("#hh").val(g("#hidden_hh").val());g("#mn").val(g("#hidden_mn").val());g("#timestampdiv").siblings("a.edit-timestamp").show();d();return false});g(".save-timestamp","#timestampdiv").click(function(){if(d()){g("#timestampdiv").slideUp("normal");g("#timestampdiv").siblings("a.edit-timestamp").show()}return false});g("#post-status-select").siblings("a.edit-post-status").click(function(){if(g("#post-status-select").is(":hidden")){g("#post-status-select").slideDown("normal");g(this).hide()}return false});g(".save-post-status","#post-status-select").click(function(){g("#post-status-select").slideUp("normal");g("#post-status-select").siblings("a.edit-post-status").show();d();return false});g(".cancel-post-status","#post-status-select").click(function(){g("#post-status-select").slideUp("normal");g("#post_status").val(g("#hidden_post_status").val());g("#post-status-select").siblings("a.edit-post-status").show();d();return false})}if(g("#edit-slug-box").length){editPermalink=function(j){var k,n=0,m=g("#editable-post-name"),o=m.html(),r=g("#post_name"),s=r.html(),p=g("#edit-slug-buttons"),q=p.html(),l=g("#editable-post-name-full").html();g("#view-post-btn").hide();p.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");p.children(".save").click(function(){var i=m.children("input").val();g.post(ajaxurl,{action:"sample-permalink",post_id:j,new_slug:i,new_title:g("#title").val(),samplepermalinknonce:g("#samplepermalinknonce").val()},function(t){g("#edit-slug-box").html(t);p.html(q);r.attr("value",i);makeSlugeditClickable();g("#view-post-btn").show()});return false});g(".cancel","#edit-slug-buttons").click(function(){g("#view-post-btn").show();m.html(o);p.html(q);r.attr("value",s);return false});for(k=0;k<l.length;++k){if("%"==l.charAt(k)){n++}}slug_value=(n>l.length/4)?"":l;m.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(t){var i=t.keyCode||0;if(13==i){p.children(".save").click();return false}if(27==i){p.children(".cancel").click();return false}r.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){g("#editable-post-name").click(function(){g("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}});
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(c){var e=a(".the-tags",c),d=a(".tagchecklist",c),b;if(!e.length){return}b=e.val().split(",");d.empty();a.each(b,function(h,i){var f,g,j=a(c).attr("id");i=a.trim(i);if(!i.match(/^\s+$/)&&""!=i){g=j+"-check-num-"+h;f='<span><a id="'+g+'" class="ntdelbutton">X</a>&nbsp;'+i+"</span> ";d.append(f);a("#"+g).click(function(){tagBox.parseTags(this)})}})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});a("#"+c).after(e)})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").siblings(".newtag").focus()});a("input.newtag",c).blur(function(){if(this.value==""){a(this).siblings(".taghint").css("visibility","")}}).focus(function(){a(this).siblings(".taghint").css("visibility","hidden")}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+d,{delay:500,minchars:2,multiple:true,multipleSep:", "})});a("#post").submit(function(){a("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){tagBox.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(b){a(".inside","#postimagediv").html(b)};WPSetThumbnailID=function(c){var b=a("input[value=_thumbnail_id]","#list-table");if(b.size()>0){a("#meta\\["+b.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(c)}};WPRemoveThumbnail=function(){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(b){if(b=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(b)}})}})(jQuery);jQuery(document).ready(function(f){var d,a,b,h="",i="post"==pagenow||"post-new"==pagenow,g="page"==pagenow||"page-new"==pagenow;if(i){type="post";if(typenow){type=typenow}postboxes.add_postbox_toggles(type)}else{if(g){postboxes.add_postbox_toggles("page")}}if(f("#tagsdiv-post_tag").length){tagBox.init()}else{f("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}if(f("#categorydiv").length){f("a","#category-tabs").click(function(){var j=f(this).attr("href");f(this).parent().addClass("tabs").siblings("li").removeClass("tabs");f("#category-tabs").siblings(".tabs-panel").hide();f(j).show();if("#categories-all"==j){deleteUserSetting("cats")}else{setUserSetting("cats","pop")}return false});if(getUserSetting("cats")){f('a[href="#categories-pop"]',"#category-tabs").click()}f("#newcat").one("focus",function(){f(this).val("").removeClass("form-input-tip")});f("#category-add-sumbit").click(function(){f("#newcat").focus()});catAddBefore=function(j){if(!f("#newcat").val()){return false}j.data+="&"+f(":checked","#categorychecklist").serialize();return j};d=function(m,l){var k,j=f("#newcat_parent");if("undefined"!=l.parsed.responses[0]&&(k=l.parsed.responses[0].supplemental.newcat_parent)){j.before(k);j.remove()}};f("#categorychecklist").wpList({alt:"",response:"category-ajax-response",addBefore:catAddBefore,addAfter:d});f("#category-add-toggle").click(function(){f("#category-adder").toggleClass("wp-hidden-children");f('a[href="#categories-all"]',"#category-tabs").click();return false});f("#categorychecklist").children("li.popular-category").add(f("#categorychecklist-pop").children()).find(":checkbox").live("click",function(){var j=f(this),l=j.is(":checked"),k=j.val();f("#in-category-"+k+", #in-popular-category-"+k).attr("checked",l)})}if(f("#postcustom").length){f("#the-list").wpList({addAfter:function(j,k){f("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(k.parsed.responses[0].supplemental.postid)}},addBefore:function(j){j.data+="&post_id="+f("#post_ID").val();return j}})}if(f("#submitdiv").length){a=f("#timestamp").html();b=f("#post-visibility-display").html();function e(){var j=f("#post-visibility-select");if(f("input:radio:checked",j).val()!="public"){f("#sticky").attr("checked",false);f("#sticky-span").hide()}else{f("#sticky-span").show()}if(f("input:radio:checked",j).val()!="password"){f("#password-span").hide()}else{f("#password-span").show()}}function c(){var q,r,k,t,s=f("#post_status"),l=f("option[value=publish]",s),j=f("#aa").val(),o=f("#mm").val(),p=f("#jj").val(),n=f("#hh").val(),m=f("#mn").val();q=new Date(j,o-1,p,n,m);r=new Date(f("#hidden_aa").val(),f("#hidden_mm").val()-1,f("#hidden_jj").val(),f("#hidden_hh").val(),f("#hidden_mn").val());k=new Date(f("#cur_aa").val(),f("#cur_mm").val()-1,f("#cur_jj").val(),f("#cur_hh").val(),f("#cur_mn").val());if(q.getFullYear()!=j||(1+q.getMonth())!=o||q.getDate()!=p||q.getMinutes()!=m){f(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{f(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(q>k&&f("#original_post_status").val()!="future"){t=postL10n.publishOnFuture;f("#publish").val(postL10n.schedule)}else{if(q<=k&&f("#original_post_status").val()!="publish"){t=postL10n.publishOn;f("#publish").val(postL10n.publish)}else{t=postL10n.publishOnPast;if(g){f("#publish").val(postL10n.updatePage)}else{f("#publish").val(postL10n.updatePost)}}}if(r.toUTCString()==q.toUTCString()){f("#timestamp").html(a)}else{f("#timestamp").html(t+" <b>"+f("option[value="+f("#mm").val()+"]","#mm").text()+" "+p+", "+j+" @ "+n+":"+m+"</b> ")}if(f("input:radio:checked","#post-visibility-select").val()=="private"){if(g){f("#publish").val(postL10n.updatePage)}else{f("#publish").val(postL10n.updatePost)}if(l.length==0){s.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{l.html(postL10n.privatelyPublished)}f("option[value=publish]",s).attr("selected",true);f(".edit-post-status","#misc-publishing-actions").hide()}else{if(f("#original_post_status").val()=="future"||f("#original_post_status").val()=="draft"){if(l.length){l.remove();s.val(f("#hidden_post_status").val())}}else{l.html(postL10n.published)}if(s.is(":hidden")){f(".edit-post-status","#misc-publishing-actions").show()}}f("#post-status-display").html(f("option:selected",s).text());if(f("option:selected",s).val()=="private"||f("option:selected",s).val()=="publish"){f("#save-post").hide()}else{f("#save-post").show();if(f("option:selected",s).val()=="pending"){f("#save-post").show().val(postL10n.savePending)}else{f("#save-post").show().val(postL10n.saveDraft)}}return true}f(".edit-visibility","#visibility").click(function(){if(f("#post-visibility-select").is(":hidden")){e();f("#post-visibility-select").slideDown("normal");f(this).hide()}return false});f(".cancel-post-visibility","#post-visibility-select").click(function(){f("#post-visibility-select").slideUp("normal");f("#visibility-radio-"+f("#hidden-post-visibility").val()).attr("checked",true);f("#post_password").val(f("#hidden_post_password").val());f("#sticky").attr("checked",f("#hidden-post-sticky").attr("checked"));f("#post-visibility-display").html(b);f(".edit-visibility","#visibility").show();c();return false});f(".save-post-visibility","#post-visibility-select").click(function(){var j=f("#post-visibility-select");j.slideUp("normal");f(".edit-visibility","#visibility").show();c();if(f("input:radio:checked",j).val()!="public"){f("#sticky").attr("checked",false)}if(true==f("#sticky").attr("checked")){h="Sticky"}else{h=""}f("#post-visibility-display").html(postL10n[f("input:radio:checked",j).val()+h]);return false});f("input:radio","#post-visibility-select").change(function(){e()});f("#timestampdiv").siblings("a.edit-timestamp").click(function(){if(f("#timestampdiv").is(":hidden")){f("#timestampdiv").slideDown("normal");f(this).hide()}return false});f(".cancel-timestamp","#timestampdiv").click(function(){f("#timestampdiv").slideUp("normal");f("#mm").val(f("#hidden_mm").val());f("#jj").val(f("#hidden_jj").val());f("#aa").val(f("#hidden_aa").val());f("#hh").val(f("#hidden_hh").val());f("#mn").val(f("#hidden_mn").val());f("#timestampdiv").siblings("a.edit-timestamp").show();c();return false});f(".save-timestamp","#timestampdiv").click(function(){if(c()){f("#timestampdiv").slideUp("normal");f("#timestampdiv").siblings("a.edit-timestamp").show()}return false});f("#post-status-select").siblings("a.edit-post-status").click(function(){if(f("#post-status-select").is(":hidden")){f("#post-status-select").slideDown("normal");f(this).hide()}return false});f(".save-post-status","#post-status-select").click(function(){f("#post-status-select").slideUp("normal");f("#post-status-select").siblings("a.edit-post-status").show();c();return false});f(".cancel-post-status","#post-status-select").click(function(){f("#post-status-select").slideUp("normal");f("#post_status").val(f("#hidden_post_status").val());f("#post-status-select").siblings("a.edit-post-status").show();c();return false})}if(f("#edit-slug-box").length){editPermalink=function(j){var k,n=0,m=f("#editable-post-name"),o=m.html(),r=f("#post_name"),s=r.html(),p=f("#edit-slug-buttons"),q=p.html(),l=f("#editable-post-name-full").html();f("#view-post-btn").hide();p.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");p.children(".save").click(function(){var t=m.children("input").val();f.post(ajaxurl,{action:"sample-permalink",post_id:j,new_slug:t,new_title:f("#title").val(),samplepermalinknonce:f("#samplepermalinknonce").val()},function(u){f("#edit-slug-box").html(u);p.html(q);r.attr("value",t);makeSlugeditClickable();f("#view-post-btn").show()});return false});f(".cancel","#edit-slug-buttons").click(function(){f("#view-post-btn").show();m.html(o);p.html(q);r.attr("value",s);return false});for(k=0;k<l.length;++k){if("%"==l.charAt(k)){n++}}slug_value=(n>l.length/4)?"":l;m.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(u){var t=u.keyCode||0;if(13==t){p.children(".save").click();return false}if(27==t){p.children(".cancel").click();return false}r.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){f("#editable-post-name").click(function(){f("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}});
10574 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/10574/964f9a50d8704a8d8cc830959baa9ce80345ad79/post.js/clean/wp-admin/js/post.js
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(a){var out=[];jQuery.each(a,function(key,val){val=jQuery.trim(val);if(val&&jQuery.inArray(val,out)==-1){out.push(val)}});return out}(function($){tagBox={clean:function(tags){return tags.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(el){var id=el.id,num=id.split("-check-num-")[1],taxbox=$(el).closest(".tagsdiv"),thetags=taxbox.find(".the-tags"),current_tags=thetags.val().split(","),new_tags=[];delete current_tags[num];$.each(current_tags,function(key,val){val=$.trim(val);if(val){new_tags.push(val)}});thetags.val(this.clean(new_tags.join(",")));this.quickClicks(taxbox);return false},quickClicks:function(el){var thetags=$(".the-tags",el),tagchecklist=$(".tagchecklist",el),current_tags;if(!thetags.length){return}var disabled=thetags.attr("disabled");current_tags=thetags.val().split(",");tagchecklist.empty();$.each(current_tags,function(key,val){var txt,button_id,id=$(el).attr("id");val=$.trim(val);if(!val.match(/^\s+$/)&&""!=val){button_id=id+"-check-num-"+key;if(disabled){txt="<span>"+val+"</span> "}else{txt='<span><a id="'+button_id+'" class="ntdelbutton">X</a>&nbsp;'+val+"</span> "}tagchecklist.append(txt);if(!disabled){$("#"+button_id).click(function(){tagBox.parseTags(this)})}}})},flushTags:function(el,a,f){a=a||false;var text,tags=$(".the-tags",el),newtag=$("input.newtag",el),newtags;text=a?$(a).text():newtag.val();tagsval=tags.val();newtags=tagsval?tagsval+","+text:text;newtags=this.clean(newtags);newtags=array_unique_noempty(newtags.split(",")).join(",");tags.val(newtags);this.quickClicks(el);if(!a){newtag.val("")}if("undefined"==typeof(f)){newtag.focus()}return false},get:function(id){var tax=id.substr(id.indexOf("-")+1);$.post(ajaxurl,{action:"get-tagcloud",tax:tax},function(r,stat){if(0==r||"success"!=stat){r=wpAjax.broken}r=$('<p id="tagcloud-'+tax+'" class="the-tagcloud">'+r+"</p>");$("a",r).click(function(){tagBox.flushTags($(this).closest(".inside").children(".tagsdiv"),this);return false});$("#"+id).after(r)})},init:function(){var t=this,ajaxtag=$("div.ajaxtag");$(".tagsdiv").each(function(){tagBox.quickClicks(this)});$("input.tagadd",ajaxtag).click(function(){t.flushTags($(this).closest(".tagsdiv"))});$("div.taghint",ajaxtag).click(function(){$(this).css("visibility","hidden").parent().siblings(".newtag").focus()});$("input.newtag",ajaxtag).blur(function(){if(this.value==""){$(this).parent().siblings(".taghint").css("visibility","")}}).focus(function(){$(this).parent().siblings(".taghint").css("visibility","hidden")}).keyup(function(e){if(13==e.which){tagBox.flushTags($(this).closest(".tagsdiv"));return false}}).keypress(function(e){if(13==e.which){e.preventDefault();return false}}).each(function(){var tax=$(this).closest("div.tagsdiv").attr("id");$(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+tax,{delay:500,minchars:2,multiple:true,multipleSep:","})});$("#post").submit(function(){$("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});$("a.tagcloud-link").click(function(){tagBox.get($(this).attr("id"));$(this).unbind().click(function(){$(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(total,num){var st=this.st,data;if(!num){num=20}this.st+=num;this.total=total;$("#commentsdiv img.waiting").show();data={action:"get-comments",mode:"single",_ajax_nonce:$("#add_comment_nonce").val(),post_ID:$("#post_ID").val(),start:st,num:num};$.post(ajaxurl,data,function(r){r=wpAjax.parseAjaxResponse(r);$("#commentsdiv .widefat").show();$("#commentsdiv img.waiting").hide();if("object"==typeof r&&r.responses[0]){$("#the-comment-list").append(r.responses[0].data);theList=theExtraList=null;$("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){$("#show-comments").hide()}else{$("#show-comments").html(postL10n.showcomm)}return}else{if(1==r){$("#show-comments").parent().html(postL10n.endcomm);return}}$("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(html){$(".inside","#postimagediv").html(html)};WPSetThumbnailID=function(id){var field=$("input[value=_thumbnail_id]","#list-table");if(field.size()>0){$("#meta\\["+field.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(id)}};WPRemoveThumbnail=function(){$.post(ajaxurl,{action:"set-post-thumbnail",post_id:$("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(str){if(str=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(str)}})}})(jQuery);jQuery(document).ready(function($){var stamp,visibility,sticky="";postboxes.add_postbox_toggles(pagenow);if($("#tagsdiv-post_tag").length){tagBox.init()}else{$("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}$(".categorydiv").each(function(){var this_id=$(this).attr("id"),noSyncChecks=false,syncChecks,catAddAfter,taxonomyParts,taxonomy,settingName;taxonomyParts=this_id.split("-");taxonomyParts.shift();taxonomy=taxonomyParts.join("-");settingName=taxonomy+"_tab";if(taxonomy=="category"){settingName="cats"}$("a","#"+taxonomy+"-tabs").click(function(){var t=$(this).attr("href");$(this).parent().addClass("tabs").siblings("li").removeClass("tabs");$("#"+taxonomy+"-tabs").siblings(".tabs-panel").hide();$(t).show();if("#"+taxonomy+"-all"==t){deleteUserSetting(settingName)}else{setUserSetting(settingName,"pop")}return false});if(getUserSetting(settingName)){$('a[href="#'+taxonomy+'-pop"]',"#"+taxonomy+"-tabs").click()}$("#new"+taxonomy).one("focus",function(){$(this).val("").removeClass("form-input-tip")});$("#"+taxonomy+"-add-submit").click(function(){$("#new"+taxonomy).focus()});syncChecks=function(){if(noSyncChecks){return}noSyncChecks=true;var th=jQuery(this),c=th.is(":checked"),id=th.val().toString();$("#in-"+taxonomy+"-"+id+", #in-"+taxonomy+"-category-"+id).attr("checked",c);noSyncChecks=false};catAddBefore=function(s){if(!$("#new"+taxonomy).val()){return false}s.data+="&"+$(":checked","#"+taxonomy+"checklist").serialize();return s};catAddAfter=function(r,s){var sup,drop=$("#new"+taxonomy+"_parent");if("undefined"!=s.parsed.responses[0]&&(sup=s.parsed.responses[0].supplemental.newcat_parent)){drop.before(sup);drop.remove()}};$("#"+taxonomy+"checklist").wpList({alt:"",response:taxonomy+"-ajax-response",addBefore:catAddBefore,addAfter:catAddAfter});$("#"+taxonomy+"-add-toggle").click(function(){$("#"+taxonomy+"-adder").toggleClass("wp-hidden-children");$('a[href="#'+taxonomy+'-all"]',"#"+taxonomy+"-tabs").click();return false});$("#"+taxonomy+"checklist li.popular-category :checkbox, #"+taxonomy+"checklist-pop :checkbox").live("click",function(){var t=$(this),c=t.is(":checked"),id=t.val();if(id&&t.parents("#taxonomy-"+taxonomy).length){$("#in-"+taxonomy+"-"+id+", #in-popular-"+taxonomy+"-"+id).attr("checked",c)}})});if($("#postcustom").length){$("#the-list").wpList({addAfter:function(xml,s){$("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(s.parsed.responses[0].supplemental.postid)}},addBefore:function(s){s.data+="&post_id="+$("#post_ID").val();return s}})}if($("#submitdiv").length){stamp=$("#timestamp").html();visibility=$("#post-visibility-display").html();function updateVisibility(){var pvSelect=$("#post-visibility-select");if($("input:radio:checked",pvSelect).val()!="public"){$("#sticky").attr("checked",false);$("#sticky-span").hide()}else{$("#sticky-span").show()}if($("input:radio:checked",pvSelect).val()!="password"){$("#password-span").hide()}else{$("#password-span").show()}}function updateText(){var attemptedDate,originalDate,currentDate,publishOn,page="page"==pagenow||"page-new"==pagenow,postStatus=$("#post_status"),optPublish=$("option[value=publish]",postStatus),aa=$("#aa").val(),mm=$("#mm").val(),jj=$("#jj").val(),hh=$("#hh").val(),mn=$("#mn").val();attemptedDate=new Date(aa,mm-1,jj,hh,mn);originalDate=new Date($("#hidden_aa").val(),$("#hidden_mm").val()-1,$("#hidden_jj").val(),$("#hidden_hh").val(),$("#hidden_mn").val());currentDate=new Date($("#cur_aa").val(),$("#cur_mm").val()-1,$("#cur_jj").val(),$("#cur_hh").val(),$("#cur_mn").val());if(attemptedDate.getFullYear()!=aa||(1+attemptedDate.getMonth())!=mm||attemptedDate.getDate()!=jj||attemptedDate.getMinutes()!=mn){$(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{$(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(attemptedDate>currentDate&&$("#original_post_status").val()!="future"){publishOn=postL10n.publishOnFuture;$("#publish").val(postL10n.schedule)}else{if(attemptedDate<=currentDate&&$("#original_post_status").val()!="publish"){publishOn=postL10n.publishOn;$("#publish").val(postL10n.publish)}else{publishOn=postL10n.publishOnPast;if(page){$("#publish").val(postL10n.updatePage)}else{$("#publish").val(postL10n.updatePost)}}}if(originalDate.toUTCString()==attemptedDate.toUTCString()){$("#timestamp").html(stamp)}else{$("#timestamp").html(publishOn+" <b>"+$("option[value="+$("#mm").val()+"]","#mm").text()+" "+jj+", "+aa+" @ "+hh+":"+mn+"</b> ")}if($("input:radio:checked","#post-visibility-select").val()=="private"){if(page){$("#publish").val(postL10n.updatePage)}else{$("#publish").val(postL10n.updatePost)}if(optPublish.length==0){postStatus.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{optPublish.html(postL10n.privatelyPublished)}$("option[value=publish]",postStatus).attr("selected",true);$(".edit-post-status","#misc-publishing-actions").hide()}else{if($("#original_post_status").val()=="future"||$("#original_post_status").val()=="draft"){if(optPublish.length){optPublish.remove();postStatus.val($("#hidden_post_status").val())}}else{optPublish.html(postL10n.published)}if(postStatus.is(":hidden")){$(".edit-post-status","#misc-publishing-actions").show()}}$("#post-status-display").html($("option:selected",postStatus).text());if($("option:selected",postStatus).val()=="private"||$("option:selected",postStatus).val()=="publish"){$("#save-post").hide()}else{$("#save-post").show();if($("option:selected",postStatus).val()=="pending"){$("#save-post").show().val(postL10n.savePending)}else{$("#save-post").show().val(postL10n.saveDraft)}}return true}$(".edit-visibility","#visibility").click(function(){if($("#post-visibility-select").is(":hidden")){updateVisibility();$("#post-visibility-select").slideDown("normal");$(this).hide()}return false});$(".cancel-post-visibility","#post-visibility-select").click(function(){$("#post-visibility-select").slideUp("normal");$("#visibility-radio-"+$("#hidden-post-visibility").val()).attr("checked",true);$("#post_password").val($("#hidden_post_password").val());$("#sticky").attr("checked",$("#hidden-post-sticky").attr("checked"));$("#post-visibility-display").html(visibility);$(".edit-visibility","#visibility").show();updateText();return false});$(".save-post-visibility","#post-visibility-select").click(function(){var pvSelect=$("#post-visibility-select");pvSelect.slideUp("normal");$(".edit-visibility","#visibility").show();updateText();if($("input:radio:checked",pvSelect).val()!="public"){$("#sticky").attr("checked",false)}if(true==$("#sticky").attr("checked")){sticky="Sticky"}else{sticky=""}$("#post-visibility-display").html(postL10n[$("input:radio:checked",pvSelect).val()+sticky]);return false});$("input:radio","#post-visibility-select").change(function(){updateVisibility()});$("#timestampdiv").siblings("a.edit-timestamp").click(function(){if($("#timestampdiv").is(":hidden")){$("#timestampdiv").slideDown("normal");$(this).hide()}return false});$(".cancel-timestamp","#timestampdiv").click(function(){$("#timestampdiv").slideUp("normal");$("#mm").val($("#hidden_mm").val());$("#jj").val($("#hidden_jj").val());$("#aa").val($("#hidden_aa").val());$("#hh").val($("#hidden_hh").val());$("#mn").val($("#hidden_mn").val());$("#timestampdiv").siblings("a.edit-timestamp").show();updateText();return false});$(".save-timestamp","#timestampdiv").click(function(){if(updateText()){$("#timestampdiv").slideUp("normal");$("#timestampdiv").siblings("a.edit-timestamp").show()}return false});$("#post-status-select").siblings("a.edit-post-status").click(function(){if($("#post-status-select").is(":hidden")){$("#post-status-select").slideDown("normal");$(this).hide()}return false});$(".save-post-status","#post-status-select").click(function(){$("#post-status-select").slideUp("normal");$("#post-status-select").siblings("a.edit-post-status").show();updateText();return false});$(".cancel-post-status","#post-status-select").click(function(){$("#post-status-select").slideUp("normal");$("#post_status").val($("#hidden_post_status").val());$("#post-status-select").siblings("a.edit-post-status").show();updateText();return false})}if($("#edit-slug-box").length){editPermalink=function(post_id){var i,c=0,e=$("#editable-post-name"),revert_e=e.html(),real_slug=$("#post_name"),revert_slug=real_slug.val(),b=$("#edit-slug-buttons"),revert_b=b.html(),full=$("#editable-post-name-full").html();$("#view-post-btn").hide();b.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");b.children(".save").click(function(){var new_slug=e.children("input").val();$.post(ajaxurl,{action:"sample-permalink",post_id:post_id,new_slug:new_slug,new_title:$("#title").val(),samplepermalinknonce:$("#samplepermalinknonce").val()},function(data){$("#edit-slug-box").html(data);b.html(revert_b);real_slug.attr("value",new_slug);makeSlugeditClickable();$("#view-post-btn").show()});return false});$(".cancel","#edit-slug-buttons").click(function(){$("#view-post-btn").show();e.html(revert_e);b.html(revert_b);real_slug.attr("value",revert_slug);return false});for(i=0;i<full.length;++i){if("%"==full.charAt(i)){c++}}slug_value=(c>full.length/4)?"":full;e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(e){var key=e.keyCode||0;if(13==key){b.children(".save").click();return false}if(27==key){b.children(".cancel").click();return false}real_slug.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){$("#editable-post-name").click(function(){$("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}if($("#title").val()==""){$("#title").siblings("#title-prompt-text").css("visibility","")}$("#title-prompt-text").click(function(){$(this).css("visibility","hidden").siblings("#title").focus()});$("#title").blur(function(){if(this.value==""){$(this).siblings("#title-prompt-text").css("visibility","")}}).focus(function(){$(this).siblings("#title-prompt-text").css("visibility","hidden")}).keydown(function(e){$(this).siblings("#title-prompt-text").css("visibility","hidden");$(this).unbind(e)})});
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(d){var f=a(".the-tags",d),e=a(".tagchecklist",d),b;if(!f.length){return}var c=f.attr("disabled");b=f.val().split(",");e.empty();a.each(b,function(i,j){var g,h,k=a(d).attr("id");j=a.trim(j);if(!j.match(/^\s+$/)&&""!=j){h=k+"-check-num-"+i;if(c){g="<span>"+j+"</span> "}else{g='<span><a id="'+h+'" class="ntdelbutton">X</a>&nbsp;'+j+"</span> "}e.append(g);if(!c){a("#"+h).click(function(){tagBox.parseTags(this)})}}})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});a("#"+c).after(e)})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").parent().siblings(".newtag").focus()});a("input.newtag",c).blur(function(){if(this.value==""){a(this).parent().siblings(".taghint").css("visibility","")}}).focus(function(){a(this).parent().siblings(".taghint").css("visibility","hidden")}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+d,{delay:500,minchars:2,multiple:true,multipleSep:","})});a("#post").submit(function(){a("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){tagBox.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(b){a(".inside","#postimagediv").html(b)};WPSetThumbnailID=function(c){var b=a("input[value=_thumbnail_id]","#list-table");if(b.size()>0){a("#meta\\["+b.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(c)}};WPRemoveThumbnail=function(){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(b){if(b=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(b)}})}})(jQuery);jQuery(document).ready(function(e){var b,a,f="";postboxes.add_postbox_toggles(pagenow);if(e("#tagsdiv-post_tag").length){tagBox.init()}else{e("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}e(".categorydiv").each(function(){var l=e(this).attr("id"),h=false,k,m,j,g,i;j=l.split("-");j.shift();g=j.join("-");i=g+"_tab";if(g=="category"){i="cats"}e("a","#"+g+"-tabs").click(function(){var n=e(this).attr("href");e(this).parent().addClass("tabs").siblings("li").removeClass("tabs");e("#"+g+"-tabs").siblings(".tabs-panel").hide();e(n).show();if("#"+g+"-all"==n){deleteUserSetting(i)}else{setUserSetting(i,"pop")}return false});if(getUserSetting(i)){e('a[href="#'+g+'-pop"]',"#"+g+"-tabs").click()}e("#new"+g).one("focus",function(){e(this).val("").removeClass("form-input-tip")});e("#"+g+"-add-submit").click(function(){e("#new"+g).focus()});k=function(){if(h){return}h=true;var n=jQuery(this),p=n.is(":checked"),o=n.val().toString();e("#in-"+g+"-"+o+", #in-"+g+"-category-"+o).attr("checked",p);h=false};catAddBefore=function(n){if(!e("#new"+g).val()){return false}n.data+="&"+e(":checked","#"+g+"checklist").serialize();return n};m=function(q,p){var o,n=e("#new"+g+"_parent");if("undefined"!=p.parsed.responses[0]&&(o=p.parsed.responses[0].supplemental.newcat_parent)){n.before(o);n.remove()}};e("#"+g+"checklist").wpList({alt:"",response:g+"-ajax-response",addBefore:catAddBefore,addAfter:m});e("#"+g+"-add-toggle").click(function(){e("#"+g+"-adder").toggleClass("wp-hidden-children");e('a[href="#'+g+'-all"]',"#"+g+"-tabs").click();return false});e("#"+g+"checklist li.popular-category :checkbox, #"+g+"checklist-pop :checkbox").live("click",function(){var n=e(this),p=n.is(":checked"),o=n.val();if(o&&n.parents("#taxonomy-"+g).length){e("#in-"+g+"-"+o+", #in-popular-"+g+"-"+o).attr("checked",p)}})});if(e("#postcustom").length){e("#the-list").wpList({addAfter:function(g,h){e("table#list-table").show()},addBefore:function(g){g.data+="&post_id="+e("#post_ID").val();return g}})}if(e("#submitdiv").length){b=e("#timestamp").html();a=e("#post-visibility-display").html();function d(){var g=e("#post-visibility-select");if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false);e("#sticky-span").hide()}else{e("#sticky-span").show()}if(e("input:radio:checked",g).val()!="password"){e("#password-span").hide()}else{e("#password-span").show()}}function c(){var n,p,h,r,o="page"==pagenow||"page-new"==pagenow,q=e("#post_status"),i=e("option[value=publish]",q),g=e("#aa").val(),l=e("#mm").val(),m=e("#jj").val(),k=e("#hh").val(),j=e("#mn").val();n=new Date(g,l-1,m,k,j);p=new Date(e("#hidden_aa").val(),e("#hidden_mm").val()-1,e("#hidden_jj").val(),e("#hidden_hh").val(),e("#hidden_mn").val());h=new Date(e("#cur_aa").val(),e("#cur_mm").val()-1,e("#cur_jj").val(),e("#cur_hh").val(),e("#cur_mn").val());if(n.getFullYear()!=g||(1+n.getMonth())!=l||n.getDate()!=m||n.getMinutes()!=j){e(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{e(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(n>h&&e("#original_post_status").val()!="future"){r=postL10n.publishOnFuture;e("#publish").val(postL10n.schedule)}else{if(n<=h&&e("#original_post_status").val()!="publish"){r=postL10n.publishOn;e("#publish").val(postL10n.publish)}else{r=postL10n.publishOnPast;if(o){e("#publish").val(postL10n.updatePage)}else{e("#publish").val(postL10n.updatePost)}}}if(p.toUTCString()==n.toUTCString()){e("#timestamp").html(b)}else{e("#timestamp").html(r+" <b>"+e("option[value="+e("#mm").val()+"]","#mm").text()+" "+m+", "+g+" @ "+k+":"+j+"</b> ")}if(e("input:radio:checked","#post-visibility-select").val()=="private"){if(o){e("#publish").val(postL10n.updatePage)}else{e("#publish").val(postL10n.updatePost)}if(i.length==0){q.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{i.html(postL10n.privatelyPublished)}e("option[value=publish]",q).attr("selected",true);e(".edit-post-status","#misc-publishing-actions").hide()}else{if(e("#original_post_status").val()=="future"||e("#original_post_status").val()=="draft"){if(i.length){i.remove();q.val(e("#hidden_post_status").val())}}else{i.html(postL10n.published)}if(q.is(":hidden")){e(".edit-post-status","#misc-publishing-actions").show()}}e("#post-status-display").html(e("option:selected",q).text());if(e("option:selected",q).val()=="private"||e("option:selected",q).val()=="publish"){e("#save-post").hide()}else{e("#save-post").show();if(e("option:selected",q).val()=="pending"){e("#save-post").show().val(postL10n.savePending)}else{e("#save-post").show().val(postL10n.saveDraft)}}return true}e(".edit-visibility","#visibility").click(function(){if(e("#post-visibility-select").is(":hidden")){d();e("#post-visibility-select").slideDown("normal");e(this).hide()}return false});e(".cancel-post-visibility","#post-visibility-select").click(function(){e("#post-visibility-select").slideUp("normal");e("#visibility-radio-"+e("#hidden-post-visibility").val()).attr("checked",true);e("#post_password").val(e("#hidden_post_password").val());e("#sticky").attr("checked",e("#hidden-post-sticky").attr("checked"));e("#post-visibility-display").html(a);e(".edit-visibility","#visibility").show();c();return false});e(".save-post-visibility","#post-visibility-select").click(function(){var g=e("#post-visibility-select");g.slideUp("normal");e(".edit-visibility","#visibility").show();c();if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false)}if(true==e("#sticky").attr("checked")){f="Sticky"}else{f=""}e("#post-visibility-display").html(postL10n[e("input:radio:checked",g).val()+f]);return false});e("input:radio","#post-visibility-select").change(function(){d()});e("#timestampdiv").siblings("a.edit-timestamp").click(function(){if(e("#timestampdiv").is(":hidden")){e("#timestampdiv").slideDown("normal");e(this).hide()}return false});e(".cancel-timestamp","#timestampdiv").click(function(){e("#timestampdiv").slideUp("normal");e("#mm").val(e("#hidden_mm").val());e("#jj").val(e("#hidden_jj").val());e("#aa").val(e("#hidden_aa").val());e("#hh").val(e("#hidden_hh").val());e("#mn").val(e("#hidden_mn").val());e("#timestampdiv").siblings("a.edit-timestamp").show();c();return false});e(".save-timestamp","#timestampdiv").click(function(){if(c()){e("#timestampdiv").slideUp("normal");e("#timestampdiv").siblings("a.edit-timestamp").show()}return false});e("#post-status-select").siblings("a.edit-post-status").click(function(){if(e("#post-status-select").is(":hidden")){e("#post-status-select").slideDown("normal");e(this).hide()}return false});e(".save-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post-status-select").siblings("a.edit-post-status").show();c();return false});e(".cancel-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post_status").val(e("#hidden_post_status").val());e("#post-status-select").siblings("a.edit-post-status").show();c();return false})}if(e("#edit-slug-box").length){editPermalink=function(g){var h,l=0,k=e("#editable-post-name"),m=k.html(),p=e("#post_name"),q=p.val(),n=e("#edit-slug-buttons"),o=n.html(),j=e("#editable-post-name-full").html();e("#view-post-btn").hide();n.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");n.children(".save").click(function(){var i=k.children("input").val();e.post(ajaxurl,{action:"sample-permalink",post_id:g,new_slug:i,new_title:e("#title").val(),samplepermalinknonce:e("#samplepermalinknonce").val()},function(r){e("#edit-slug-box").html(r);n.html(o);p.attr("value",i);makeSlugeditClickable();e("#view-post-btn").show()});return false});e(".cancel","#edit-slug-buttons").click(function(){e("#view-post-btn").show();k.html(m);n.html(o);p.attr("value",q);return false});for(h=0;h<j.length;++h){if("%"==j.charAt(h)){l++}}slug_value=(l>j.length/4)?"":j;k.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(r){var i=r.keyCode||0;if(13==i){n.children(".save").click();return false}if(27==i){n.children(".cancel").click();return false}p.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){e("#editable-post-name").click(function(){e("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}if(e("#title").val()==""){e("#title").siblings("#title-prompt-text").css("visibility","")}e("#title-prompt-text").click(function(){e(this).css("visibility","hidden").siblings("#title").focus()});e("#title").blur(function(){if(this.value==""){e(this).siblings("#title-prompt-text").css("visibility","")}}).focus(function(){e(this).siblings("#title-prompt-text").css("visibility","hidden")}).keydown(function(g){e(this).siblings("#title-prompt-text").css("visibility","hidden");e(this).unbind(g)})});
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(a){var out=[];jQuery.each(a,function(key,val){val=jQuery.trim(val);if(val&&jQuery.inArray(val,out)==-1){out.push(val)}});return out}(function($){tagBox={clean:function(tags){return tags.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(el){var id=el.id,num=id.split("-check-num-")[1],taxbox=$(el).closest(".tagsdiv"),thetags=taxbox.find(".the-tags"),current_tags=thetags.val().split(","),new_tags=[];delete current_tags[num];$.each(current_tags,function(key,val){val=$.trim(val);if(val){new_tags.push(val)}});thetags.val(this.clean(new_tags.join(",")));this.quickClicks(taxbox);return false},quickClicks:function(el){var thetags=$(".the-tags",el),tagchecklist=$(".tagchecklist",el),current_tags;if(!thetags.length){return}var disabled=thetags.attr("disabled");current_tags=thetags.val().split(",");tagchecklist.empty();$.each(current_tags,function(key,val){var txt,button_id,id=$(el).attr("id");val=$.trim(val);if(!val.match(/^\s+$/)&&""!=val){button_id=id+"-check-num-"+key;if(disabled){txt="<span>"+val+"</span> "}else{txt='<span><a id="'+button_id+'" class="ntdelbutton">X</a>&nbsp;'+val+"</span> "}tagchecklist.append(txt);if(!disabled){$("#"+button_id).click(function(){tagBox.parseTags(this)})}}})},flushTags:function(el,a,f){a=a||false;var text,tags=$(".the-tags",el),newtag=$("input.newtag",el),newtags;text=a?$(a).text():newtag.val();tagsval=tags.val();newtags=tagsval?tagsval+","+text:text;newtags=this.clean(newtags);newtags=array_unique_noempty(newtags.split(",")).join(",");tags.val(newtags);this.quickClicks(el);if(!a){newtag.val("")}if("undefined"==typeof(f)){newtag.focus()}return false},get:function(id){var tax=id.substr(id.indexOf("-")+1);$.post(ajaxurl,{action:"get-tagcloud",tax:tax},function(r,stat){if(0==r||"success"!=stat){r=wpAjax.broken}r=$('<p id="tagcloud-'+tax+'" class="the-tagcloud">'+r+"</p>");$("a",r).click(function(){tagBox.flushTags($(this).closest(".inside").children(".tagsdiv"),this);return false});$("#"+id).after(r)})},init:function(){var t=this,ajaxtag=$("div.ajaxtag");$(".tagsdiv").each(function(){tagBox.quickClicks(this)});$("input.tagadd",ajaxtag).click(function(){t.flushTags($(this).closest(".tagsdiv"))});$("div.taghint",ajaxtag).click(function(){$(this).css("visibility","hidden").parent().siblings(".newtag").focus()});$("input.newtag",ajaxtag).blur(function(){if(this.value==""){$(this).parent().siblings(".taghint").css("visibility","")}}).focus(function(){$(this).parent().siblings(".taghint").css("visibility","hidden")}).keyup(function(e){if(13==e.which){tagBox.flushTags($(this).closest(".tagsdiv"));return false}}).keypress(function(e){if(13==e.which){e.preventDefault();return false}}).each(function(){var tax=$(this).closest("div.tagsdiv").attr("id");$(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+tax,{delay:500,minchars:2,multiple:true,multipleSep:","})});$("#post").submit(function(){$("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});$("a.tagcloud-link").click(function(){tagBox.get($(this).attr("id"));$(this).unbind().click(function(){$(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(total,num){var st=this.st,data;if(!num){num=20}this.st+=num;this.total=total;$("#commentsdiv img.waiting").show();data={action:"get-comments",mode:"single",_ajax_nonce:$("#add_comment_nonce").val(),post_ID:$("#post_ID").val(),start:st,num:num};$.post(ajaxurl,data,function(r){r=wpAjax.parseAjaxResponse(r);$("#commentsdiv .widefat").show();$("#commentsdiv img.waiting").hide();if("object"==typeof r&&r.responses[0]){$("#the-comment-list").append(r.responses[0].data);theList=theExtraList=null;$("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){$("#show-comments").hide()}else{$("#show-comments").html(postL10n.showcomm)}return}else{if(1==r){$("#show-comments").parent().html(postL10n.endcomm);return}}$("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(html){$(".inside","#postimagediv").html(html)};WPSetThumbnailID=function(id){var field=$("input[value=_thumbnail_id]","#list-table");if(field.size()>0){$("#meta\\["+field.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(id)}};WPRemoveThumbnail=function(){$.post(ajaxurl,{action:"set-post-thumbnail",post_id:$("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(str){if(str=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(str)}})}})(jQuery);jQuery(document).ready(function($){var stamp,visibility,sticky="";postboxes.add_postbox_toggles(pagenow);if($("#tagsdiv-post_tag").length){tagBox.init()}else{$("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}$(".categorydiv").each(function(){var this_id=$(this).attr("id"),noSyncChecks=false,syncChecks,catAddAfter,taxonomyParts,taxonomy,settingName;taxonomyParts=this_id.split("-");taxonomyParts.shift();taxonomy=taxonomyParts.join("-");settingName=taxonomy+"_tab";if(taxonomy=="category"){settingName="cats"}$("a","#"+taxonomy+"-tabs").click(function(){var t=$(this).attr("href");$(this).parent().addClass("tabs").siblings("li").removeClass("tabs");$("#"+taxonomy+"-tabs").siblings(".tabs-panel").hide();$(t).show();if("#"+taxonomy+"-all"==t){deleteUserSetting(settingName)}else{setUserSetting(settingName,"pop")}return false});if(getUserSetting(settingName)){$('a[href="#'+taxonomy+'-pop"]',"#"+taxonomy+"-tabs").click()}$("#new"+taxonomy).one("focus",function(){$(this).val("").removeClass("form-input-tip")});$("#"+taxonomy+"-add-submit").click(function(){$("#new"+taxonomy).focus()});syncChecks=function(){if(noSyncChecks){return}noSyncChecks=true;var th=jQuery(this),c=th.is(":checked"),id=th.val().toString();$("#in-"+taxonomy+"-"+id+", #in-"+taxonomy+"-category-"+id).attr("checked",c);noSyncChecks=false};catAddBefore=function(s){if(!$("#new"+taxonomy).val()){return false}s.data+="&"+$(":checked","#"+taxonomy+"checklist").serialize();return s};catAddAfter=function(r,s){var sup,drop=$("#new"+taxonomy+"_parent");if("undefined"!=s.parsed.responses[0]&&(sup=s.parsed.responses[0].supplemental.newcat_parent)){drop.before(sup);drop.remove()}};$("#"+taxonomy+"checklist").wpList({alt:"",response:taxonomy+"-ajax-response",addBefore:catAddBefore,addAfter:catAddAfter});$("#"+taxonomy+"-add-toggle").click(function(){$("#"+taxonomy+"-adder").toggleClass("wp-hidden-children");$('a[href="#'+taxonomy+'-all"]',"#"+taxonomy+"-tabs").click();return false});$("#"+taxonomy+"checklist li.popular-category :checkbox, #"+taxonomy+"checklist-pop :checkbox").live("click",function(){var t=$(this),c=t.is(":checked"),id=t.val();if(id&&t.parents("#taxonomy-"+taxonomy).length){$("#in-"+taxonomy+"-"+id+", #in-popular-"+taxonomy+"-"+id).attr("checked",c)}})});if($("#postcustom").length){$("#the-list").wpList({addAfter:function(xml,s){$("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(s.parsed.responses[0].supplemental.postid)}},addBefore:function(s){s.data+="&post_id="+$("#post_ID").val();return s}})}if($("#submitdiv").length){stamp=$("#timestamp").html();visibility=$("#post-visibility-display").html();function updateVisibility(){var pvSelect=$("#post-visibility-select");if($("input:radio:checked",pvSelect).val()!="public"){$("#sticky").attr("checked",false);$("#sticky-span").hide()}else{$("#sticky-span").show()}if($("input:radio:checked",pvSelect).val()!="password"){$("#password-span").hide()}else{$("#password-span").show()}}function updateText(){var attemptedDate,originalDate,currentDate,publishOn,page="page"==pagenow||"page-new"==pagenow,postStatus=$("#post_status"),optPublish=$("option[value=publish]",postStatus),aa=$("#aa").val(),mm=$("#mm").val(),jj=$("#jj").val(),hh=$("#hh").val(),mn=$("#mn").val();attemptedDate=new Date(aa,mm-1,jj,hh,mn);originalDate=new Date($("#hidden_aa").val(),$("#hidden_mm").val()-1,$("#hidden_jj").val(),$("#hidden_hh").val(),$("#hidden_mn").val());currentDate=new Date($("#cur_aa").val(),$("#cur_mm").val()-1,$("#cur_jj").val(),$("#cur_hh").val(),$("#cur_mn").val());if(attemptedDate.getFullYear()!=aa||(1+attemptedDate.getMonth())!=mm||attemptedDate.getDate()!=jj||attemptedDate.getMinutes()!=mn){$(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{$(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(attemptedDate>currentDate&&$("#original_post_status").val()!="future"){publishOn=postL10n.publishOnFuture;$("#publish").val(postL10n.schedule)}else{if(attemptedDate<=currentDate&&$("#original_post_status").val()!="publish"){publishOn=postL10n.publishOn;$("#publish").val(postL10n.publish)}else{publishOn=postL10n.publishOnPast;if(page){$("#publish").val(postL10n.updatePage)}else{$("#publish").val(postL10n.updatePost)}}}if(originalDate.toUTCString()==attemptedDate.toUTCString()){$("#timestamp").html(stamp)}else{$("#timestamp").html(publishOn+" <b>"+$("option[value="+$("#mm").val()+"]","#mm").text()+" "+jj+", "+aa+" @ "+hh+":"+mn+"</b> ")}if($("input:radio:checked","#post-visibility-select").val()=="private"){if(page){$("#publish").val(postL10n.updatePage)}else{$("#publish").val(postL10n.updatePost)}if(optPublish.length==0){postStatus.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{optPublish.html(postL10n.privatelyPublished)}$("option[value=publish]",postStatus).attr("selected",true);$(".edit-post-status","#misc-publishing-actions").hide()}else{if($("#original_post_status").val()=="future"||$("#original_post_status").val()=="draft"){if(optPublish.length){optPublish.remove();postStatus.val($("#hidden_post_status").val())}}else{optPublish.html(postL10n.published)}if(postStatus.is(":hidden")){$(".edit-post-status","#misc-publishing-actions").show()}}$("#post-status-display").html($("option:selected",postStatus).text());if($("option:selected",postStatus).val()=="private"||$("option:selected",postStatus).val()=="publish"){$("#save-post").hide()}else{$("#save-post").show();if($("option:selected",postStatus).val()=="pending"){$("#save-post").show().val(postL10n.savePending)}else{$("#save-post").show().val(postL10n.saveDraft)}}return true}$(".edit-visibility","#visibility").click(function(){if($("#post-visibility-select").is(":hidden")){updateVisibility();$("#post-visibility-select").slideDown("normal");$(this).hide()}return false});$(".cancel-post-visibility","#post-visibility-select").click(function(){$("#post-visibility-select").slideUp("normal");$("#visibility-radio-"+$("#hidden-post-visibility").val()).attr("checked",true);$("#post_password").val($("#hidden_post_password").val());$("#sticky").attr("checked",$("#hidden-post-sticky").attr("checked"));$("#post-visibility-display").html(visibility);$(".edit-visibility","#visibility").show();updateText();return false});$(".save-post-visibility","#post-visibility-select").click(function(){var pvSelect=$("#post-visibility-select");pvSelect.slideUp("normal");$(".edit-visibility","#visibility").show();updateText();if($("input:radio:checked",pvSelect).val()!="public"){$("#sticky").attr("checked",false)}if(true==$("#sticky").attr("checked")){sticky="Sticky"}else{sticky=""}$("#post-visibility-display").html(postL10n[$("input:radio:checked",pvSelect).val()+sticky]);return false});$("input:radio","#post-visibility-select").change(function(){updateVisibility()});$("#timestampdiv").siblings("a.edit-timestamp").click(function(){if($("#timestampdiv").is(":hidden")){$("#timestampdiv").slideDown("normal");$(this).hide()}return false});$(".cancel-timestamp","#timestampdiv").click(function(){$("#timestampdiv").slideUp("normal");$("#mm").val($("#hidden_mm").val());$("#jj").val($("#hidden_jj").val());$("#aa").val($("#hidden_aa").val());$("#hh").val($("#hidden_hh").val());$("#mn").val($("#hidden_mn").val());$("#timestampdiv").siblings("a.edit-timestamp").show();updateText();return false});$(".save-timestamp","#timestampdiv").click(function(){if(updateText()){$("#timestampdiv").slideUp("normal");$("#timestampdiv").siblings("a.edit-timestamp").show()}return false});$("#post-status-select").siblings("a.edit-post-status").click(function(){if($("#post-status-select").is(":hidden")){$("#post-status-select").slideDown("normal");$(this).hide()}return false});$(".save-post-status","#post-status-select").click(function(){$("#post-status-select").slideUp("normal");$("#post-status-select").siblings("a.edit-post-status").show();updateText();return false});$(".cancel-post-status","#post-status-select").click(function(){$("#post-status-select").slideUp("normal");$("#post_status").val($("#hidden_post_status").val());$("#post-status-select").siblings("a.edit-post-status").show();updateText();return false})}if($("#edit-slug-box").length){editPermalink=function(post_id){var i,c=0,e=$("#editable-post-name"),revert_e=e.html(),real_slug=$("#post_name"),revert_slug=real_slug.val(),b=$("#edit-slug-buttons"),revert_b=b.html(),full=$("#editable-post-name-full").html();$("#view-post-btn").hide();b.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");b.children(".save").click(function(){var new_slug=e.children("input").val();$.post(ajaxurl,{action:"sample-permalink",post_id:post_id,new_slug:new_slug,new_title:$("#title").val(),samplepermalinknonce:$("#samplepermalinknonce").val()},function(data){$("#edit-slug-box").html(data);b.html(revert_b);real_slug.attr("value",new_slug);makeSlugeditClickable();$("#view-post-btn").show()});return false});$(".cancel","#edit-slug-buttons").click(function(){$("#view-post-btn").show();e.html(revert_e);b.html(revert_b);real_slug.attr("value",revert_slug);return false});for(i=0;i<full.length;++i){if("%"==full.charAt(i)){c++}}slug_value=(c>full.length/4)?"":full;e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(e){var key=e.keyCode||0;if(13==key){b.children(".save").click();return false}if(27==key){b.children(".cancel").click();return false}real_slug.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){$("#editable-post-name").click(function(){$("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}if($("#title").val()==""){$("#title").siblings("#title-prompt-text").css("visibility","")}$("#title-prompt-text").click(function(){$(this).css("visibility","hidden").siblings("#title").focus()});$("#title").blur(function(){if(this.value==""){$(this).siblings("#title-prompt-text").css("visibility","")}}).focus(function(){$(this).siblings("#title-prompt-text").css("visibility","hidden")}).keydown(function(e){$(this).siblings("#title-prompt-text").css("visibility","hidden");$(this).unbind(e)})});
10574 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/10574/c2271518e9d53c145f888d452c175fdc2b4a0200/post.js/clean/wp-admin/js/post.js
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(d){var f=a(".the-tags",d),e=a(".tagchecklist",d),b;if(!f.length){return}var c=f.attr("disabled");b=f.val().split(",");e.empty();a.each(b,function(i,j){var g,h,k=a(d).attr("id");j=a.trim(j);if(!j.match(/^\s+$/)&&""!=j){h=k+"-check-num-"+i;if(c){g="<span>"+j+"</span> "}else{g='<span><a id="'+h+'" class="ntdelbutton">X</a>&nbsp;'+j+"</span> "}e.append(g);if(!c){a("#"+h).click(function(){tagBox.parseTags(this)})}}})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});a("#"+c).after(e)})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").parent().siblings(".newtag").focus()});a("input.newtag",c).blur(function(){if(this.value==""){a(this).parent().siblings(".taghint").css("visibility","")}}).focus(function(){a(this).parent().siblings(".taghint").css("visibility","hidden")}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+d,{delay:500,minchars:2,multiple:true,multipleSep:","})});a("#post").submit(function(){a("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){tagBox.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(b){a(".inside","#postimagediv").html(b)};WPSetThumbnailID=function(c){var b=a("input[value=_thumbnail_id]","#list-table");if(b.size()>0){a("#meta\\["+b.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(c)}};WPRemoveThumbnail=function(){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(b){if(b=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(b)}})}})(jQuery);jQuery(document).ready(function(e){var b,a,f="";postboxes.add_postbox_toggles(pagenow);if(e("#tagsdiv-post_tag").length){tagBox.init()}else{e("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}e(".categorydiv").each(function(){var l=e(this).attr("id"),h=false,k,m,j,g,i;j=l.split("-");j.shift();g=j.join("-");i=g+"_tab";if(g=="category"){i="cats"}e("a","#"+g+"-tabs").click(function(){var n=e(this).attr("href");e(this).parent().addClass("tabs").siblings("li").removeClass("tabs");e("#"+g+"-tabs").siblings(".tabs-panel").hide();e(n).show();if("#"+g+"-all"==n){deleteUserSetting(i)}else{setUserSetting(i,"pop")}return false});if(getUserSetting(i)){e('a[href="#'+g+'-pop"]',"#"+g+"-tabs").click()}e("#new"+g).one("focus",function(){e(this).val("").removeClass("form-input-tip")});e("#"+g+"-add-submit").click(function(){e("#new"+g).focus()});k=function(){if(h){return}h=true;var n=jQuery(this),p=n.is(":checked"),o=n.val().toString();e("#in-"+g+"-"+o+", #in-"+g+"-category-"+o).attr("checked",p);h=false};catAddBefore=function(n){if(!e("#new"+g).val()){return false}n.data+="&"+e(":checked","#"+g+"checklist").serialize();return n};m=function(q,p){var o,n=e("#new"+g+"_parent");if("undefined"!=p.parsed.responses[0]&&(o=p.parsed.responses[0].supplemental.newcat_parent)){n.before(o);n.remove()}};e("#"+g+"checklist").wpList({alt:"",response:g+"-ajax-response",addBefore:catAddBefore,addAfter:m});e("#"+g+"-add-toggle").click(function(){e("#"+g+"-adder").toggleClass("wp-hidden-children");e('a[href="#'+g+'-all"]',"#"+g+"-tabs").click();return false});e("#"+g+"checklist li.popular-category :checkbox, #"+g+"checklist-pop :checkbox").live("click",function(){var n=e(this),p=n.is(":checked"),o=n.val();if(o&&n.parents("#taxonomy-"+g).length){e("#in-"+g+"-"+o+", #in-popular-"+g+"-"+o).attr("checked",p)}})});if(e("#postcustom").length){e("#the-list").wpList({addAfter:function(g,h){e("table#list-table").show()},addBefore:function(g){g.data+="&post_id="+e("#post_ID").val();return g}})}if(e("#submitdiv").length){b=e("#timestamp").html();a=e("#post-visibility-display").html();function d(){var g=e("#post-visibility-select");if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false);e("#sticky-span").hide()}else{e("#sticky-span").show()}if(e("input:radio:checked",g).val()!="password"){e("#password-span").hide()}else{e("#password-span").show()}}function c(){var n,p,h,r,o="page"==pagenow||"page-new"==pagenow,q=e("#post_status"),i=e("option[value=publish]",q),g=e("#aa").val(),l=e("#mm").val(),m=e("#jj").val(),k=e("#hh").val(),j=e("#mn").val();n=new Date(g,l-1,m,k,j);p=new Date(e("#hidden_aa").val(),e("#hidden_mm").val()-1,e("#hidden_jj").val(),e("#hidden_hh").val(),e("#hidden_mn").val());h=new Date(e("#cur_aa").val(),e("#cur_mm").val()-1,e("#cur_jj").val(),e("#cur_hh").val(),e("#cur_mn").val());if(n.getFullYear()!=g||(1+n.getMonth())!=l||n.getDate()!=m||n.getMinutes()!=j){e(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{e(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(n>h&&e("#original_post_status").val()!="future"){r=postL10n.publishOnFuture;e("#publish").val(postL10n.schedule)}else{if(n<=h&&e("#original_post_status").val()!="publish"){r=postL10n.publishOn;e("#publish").val(postL10n.publish)}else{r=postL10n.publishOnPast;if(o){e("#publish").val(postL10n.updatePage)}else{e("#publish").val(postL10n.updatePost)}}}if(p.toUTCString()==n.toUTCString()){e("#timestamp").html(b)}else{e("#timestamp").html(r+" <b>"+e("option[value="+e("#mm").val()+"]","#mm").text()+" "+m+", "+g+" @ "+k+":"+j+"</b> ")}if(e("input:radio:checked","#post-visibility-select").val()=="private"){if(o){e("#publish").val(postL10n.updatePage)}else{e("#publish").val(postL10n.updatePost)}if(i.length==0){q.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{i.html(postL10n.privatelyPublished)}e("option[value=publish]",q).attr("selected",true);e(".edit-post-status","#misc-publishing-actions").hide()}else{if(e("#original_post_status").val()=="future"||e("#original_post_status").val()=="draft"){if(i.length){i.remove();q.val(e("#hidden_post_status").val())}}else{i.html(postL10n.published)}if(q.is(":hidden")){e(".edit-post-status","#misc-publishing-actions").show()}}e("#post-status-display").html(e("option:selected",q).text());if(e("option:selected",q).val()=="private"||e("option:selected",q).val()=="publish"){e("#save-post").hide()}else{e("#save-post").show();if(e("option:selected",q).val()=="pending"){e("#save-post").show().val(postL10n.savePending)}else{e("#save-post").show().val(postL10n.saveDraft)}}return true}e(".edit-visibility","#visibility").click(function(){if(e("#post-visibility-select").is(":hidden")){d();e("#post-visibility-select").slideDown("normal");e(this).hide()}return false});e(".cancel-post-visibility","#post-visibility-select").click(function(){e("#post-visibility-select").slideUp("normal");e("#visibility-radio-"+e("#hidden-post-visibility").val()).attr("checked",true);e("#post_password").val(e("#hidden_post_password").val());e("#sticky").attr("checked",e("#hidden-post-sticky").attr("checked"));e("#post-visibility-display").html(a);e(".edit-visibility","#visibility").show();c();return false});e(".save-post-visibility","#post-visibility-select").click(function(){var g=e("#post-visibility-select");g.slideUp("normal");e(".edit-visibility","#visibility").show();c();if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false)}if(true==e("#sticky").attr("checked")){f="Sticky"}else{f=""}e("#post-visibility-display").html(postL10n[e("input:radio:checked",g).val()+f]);return false});e("input:radio","#post-visibility-select").change(function(){d()});e("#timestampdiv").siblings("a.edit-timestamp").click(function(){if(e("#timestampdiv").is(":hidden")){e("#timestampdiv").slideDown("normal");e(this).hide()}return false});e(".cancel-timestamp","#timestampdiv").click(function(){e("#timestampdiv").slideUp("normal");e("#mm").val(e("#hidden_mm").val());e("#jj").val(e("#hidden_jj").val());e("#aa").val(e("#hidden_aa").val());e("#hh").val(e("#hidden_hh").val());e("#mn").val(e("#hidden_mn").val());e("#timestampdiv").siblings("a.edit-timestamp").show();c();return false});e(".save-timestamp","#timestampdiv").click(function(){if(c()){e("#timestampdiv").slideUp("normal");e("#timestampdiv").siblings("a.edit-timestamp").show()}return false});e("#post-status-select").siblings("a.edit-post-status").click(function(){if(e("#post-status-select").is(":hidden")){e("#post-status-select").slideDown("normal");e(this).hide()}return false});e(".save-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post-status-select").siblings("a.edit-post-status").show();c();return false});e(".cancel-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post_status").val(e("#hidden_post_status").val());e("#post-status-select").siblings("a.edit-post-status").show();c();return false})}if(e("#edit-slug-box").length){editPermalink=function(g){var h,l=0,k=e("#editable-post-name"),m=k.html(),p=e("#post_name"),q=p.val(),n=e("#edit-slug-buttons"),o=n.html(),j=e("#editable-post-name-full").html();e("#view-post-btn").hide();n.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");n.children(".save").click(function(){var i=k.children("input").val();e.post(ajaxurl,{action:"sample-permalink",post_id:g,new_slug:i,new_title:e("#title").val(),samplepermalinknonce:e("#samplepermalinknonce").val()},function(r){e("#edit-slug-box").html(r);n.html(o);p.attr("value",i);makeSlugeditClickable();e("#view-post-btn").show()});return false});e(".cancel","#edit-slug-buttons").click(function(){e("#view-post-btn").show();k.html(m);n.html(o);p.attr("value",q);return false});for(h=0;h<j.length;++h){if("%"==j.charAt(h)){l++}}slug_value=(l>j.length/4)?"":j;k.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(r){var i=r.keyCode||0;if(13==i){n.children(".save").click();return false}if(27==i){n.children(".cancel").click();return false}p.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){e("#editable-post-name").click(function(){e("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}if(e("#title").val()==""){e("#title").siblings("#title-prompt-text").css("visibility","")}e("#title-prompt-text").click(function(){e(this).css("visibility","hidden").siblings("#title").focus()});e("#title").blur(function(){if(this.value==""){e(this).siblings("#title-prompt-text").css("visibility","")}}).focus(function(){e(this).siblings("#title-prompt-text").css("visibility","hidden")}).keydown(function(g){e(this).siblings("#title-prompt-text").css("visibility","hidden");e(this).unbind(g)})});
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(a){var out=[];jQuery.each(a,function(key,val){val=jQuery.trim(val);if(val&&jQuery.inArray(val,out)==-1){out.push(val)}});return out}(function($){tagBox={clean:function(tags){return tags.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(el){var id=el.id,num=id.split("-check-num-")[1],taxbox=$(el).closest(".tagsdiv"),thetags=taxbox.find(".the-tags"),current_tags=thetags.val().split(","),new_tags=[];delete current_tags[num];$.each(current_tags,function(key,val){val=$.trim(val);if(val){new_tags.push(val)}});thetags.val(this.clean(new_tags.join(",")));this.quickClicks(taxbox);return false},quickClicks:function(el){var thetags=$(".the-tags",el),tagchecklist=$(".tagchecklist",el),current_tags;if(!thetags.length){return}var disabled=thetags.attr("disabled");current_tags=thetags.val().split(",");tagchecklist.empty();$.each(current_tags,function(key,val){var txt,button_id,id=$(el).attr("id");val=$.trim(val);if(!val.match(/^\s+$/)&&""!=val){button_id=id+"-check-num-"+key;if(disabled){txt="<span>"+val+"</span> "}else{txt='<span><a id="'+button_id+'" class="ntdelbutton">X</a>&nbsp;'+val+"</span> "}tagchecklist.append(txt);if(!disabled){$("#"+button_id).click(function(){tagBox.parseTags(this)})}}})},flushTags:function(el,a,f){a=a||false;var text,tags=$(".the-tags",el),newtag=$("input.newtag",el),newtags;text=a?$(a).text():newtag.val();tagsval=tags.val();newtags=tagsval?tagsval+","+text:text;newtags=this.clean(newtags);newtags=array_unique_noempty(newtags.split(",")).join(",");tags.val(newtags);this.quickClicks(el);if(!a){newtag.val("")}if("undefined"==typeof(f)){newtag.focus()}return false},get:function(id){var tax=id.substr(id.indexOf("-")+1);$.post(ajaxurl,{action:"get-tagcloud",tax:tax},function(r,stat){if(0==r||"success"!=stat){r=wpAjax.broken}r=$('<p id="tagcloud-'+tax+'" class="the-tagcloud">'+r+"</p>");$("a",r).click(function(){tagBox.flushTags($(this).closest(".inside").children(".tagsdiv"),this);return false});$("#"+id).after(r)})},init:function(){var t=this,ajaxtag=$("div.ajaxtag");$(".tagsdiv").each(function(){tagBox.quickClicks(this)});$("input.tagadd",ajaxtag).click(function(){t.flushTags($(this).closest(".tagsdiv"))});$("div.taghint",ajaxtag).click(function(){$(this).css("visibility","hidden").parent().siblings(".newtag").focus()});$("input.newtag",ajaxtag).blur(function(){if(this.value==""){$(this).parent().siblings(".taghint").css("visibility","")}}).focus(function(){$(this).parent().siblings(".taghint").css("visibility","hidden")}).keyup(function(e){if(13==e.which){tagBox.flushTags($(this).closest(".tagsdiv"));return false}}).keypress(function(e){if(13==e.which){e.preventDefault();return false}}).each(function(){var tax=$(this).closest("div.tagsdiv").attr("id");$(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+tax,{delay:500,minchars:2,multiple:true,multipleSep:","})});$("#post").submit(function(){$("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});$("a.tagcloud-link").click(function(){tagBox.get($(this).attr("id"));$(this).unbind().click(function(){$(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(total,num){var st=this.st,data;if(!num){num=20}this.st+=num;this.total=total;$("#commentsdiv img.waiting").show();data={action:"get-comments",mode:"single",_ajax_nonce:$("#add_comment_nonce").val(),post_ID:$("#post_ID").val(),start:st,num:num};$.post(ajaxurl,data,function(r){r=wpAjax.parseAjaxResponse(r);$("#commentsdiv .widefat").show();$("#commentsdiv img.waiting").hide();if("object"==typeof r&&r.responses[0]){$("#the-comment-list").append(r.responses[0].data);theList=theExtraList=null;$("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){$("#show-comments").hide()}else{$("#show-comments").html(postL10n.showcomm)}return}else{if(1==r){$("#show-comments").parent().html(postL10n.endcomm);return}}$("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(html){$(".inside","#postimagediv").html(html)};WPSetThumbnailID=function(id){var field=$("input[value=_thumbnail_id]","#list-table");if(field.size()>0){$("#meta\\["+field.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(id)}};WPRemoveThumbnail=function(nonce){$.post(ajaxurl,{action:"set-post-thumbnail",post_id:$("#post_ID").val(),thumbnail_id:-1,_ajax_nonce:nonce,cookie:encodeURIComponent(document.cookie)},function(str){if(str=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(str)}})}})(jQuery);jQuery(document).ready(function($){var stamp,visibility,sticky="";postboxes.add_postbox_toggles(pagenow);if($("#tagsdiv-post_tag").length){tagBox.init()}else{$("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}$(".categorydiv").each(function(){var this_id=$(this).attr("id"),noSyncChecks=false,syncChecks,catAddAfter,taxonomyParts,taxonomy,settingName;taxonomyParts=this_id.split("-");taxonomyParts.shift();taxonomy=taxonomyParts.join("-");settingName=taxonomy+"_tab";if(taxonomy=="category"){settingName="cats"}$("a","#"+taxonomy+"-tabs").click(function(){var t=$(this).attr("href");$(this).parent().addClass("tabs").siblings("li").removeClass("tabs");$("#"+taxonomy+"-tabs").siblings(".tabs-panel").hide();$(t).show();if("#"+taxonomy+"-all"==t){deleteUserSetting(settingName)}else{setUserSetting(settingName,"pop")}return false});if(getUserSetting(settingName)){$('a[href="#'+taxonomy+'-pop"]',"#"+taxonomy+"-tabs").click()}$("#new"+taxonomy).one("focus",function(){$(this).val("").removeClass("form-input-tip")});$("#"+taxonomy+"-add-submit").click(function(){$("#new"+taxonomy).focus()});syncChecks=function(){if(noSyncChecks){return}noSyncChecks=true;var th=jQuery(this),c=th.is(":checked"),id=th.val().toString();$("#in-"+taxonomy+"-"+id+", #in-"+taxonomy+"-category-"+id).attr("checked",c);noSyncChecks=false};catAddBefore=function(s){if(!$("#new"+taxonomy).val()){return false}s.data+="&"+$(":checked","#"+taxonomy+"checklist").serialize();return s};catAddAfter=function(r,s){var sup,drop=$("#new"+taxonomy+"_parent");if("undefined"!=s.parsed.responses[0]&&(sup=s.parsed.responses[0].supplemental.newcat_parent)){drop.before(sup);drop.remove()}};$("#"+taxonomy+"checklist").wpList({alt:"",response:taxonomy+"-ajax-response",addBefore:catAddBefore,addAfter:catAddAfter});$("#"+taxonomy+"-add-toggle").click(function(){$("#"+taxonomy+"-adder").toggleClass("wp-hidden-children");$('a[href="#'+taxonomy+'-all"]',"#"+taxonomy+"-tabs").click();return false});$("#"+taxonomy+"checklist li.popular-category :checkbox, #"+taxonomy+"checklist-pop :checkbox").live("click",function(){var t=$(this),c=t.is(":checked"),id=t.val();if(id&&t.parents("#taxonomy-"+taxonomy).length){$("#in-"+taxonomy+"-"+id+", #in-popular-"+taxonomy+"-"+id).attr("checked",c)}})});if($("#postcustom").length){$("#the-list").wpList({addAfter:function(xml,s){$("table#list-table").show()},addBefore:function(s){s.data+="&post_id="+$("#post_ID").val();return s}})}if($("#submitdiv").length){stamp=$("#timestamp").html();visibility=$("#post-visibility-display").html();function updateVisibility(){var pvSelect=$("#post-visibility-select");if($("input:radio:checked",pvSelect).val()!="public"){$("#sticky").attr("checked",false);$("#sticky-span").hide()}else{$("#sticky-span").show()}if($("input:radio:checked",pvSelect).val()!="password"){$("#password-span").hide()}else{$("#password-span").show()}}function updateText(){var attemptedDate,originalDate,currentDate,publishOn,page="page"==pagenow||"page-new"==pagenow,postStatus=$("#post_status"),optPublish=$("option[value=publish]",postStatus),aa=$("#aa").val(),mm=$("#mm").val(),jj=$("#jj").val(),hh=$("#hh").val(),mn=$("#mn").val();attemptedDate=new Date(aa,mm-1,jj,hh,mn);originalDate=new Date($("#hidden_aa").val(),$("#hidden_mm").val()-1,$("#hidden_jj").val(),$("#hidden_hh").val(),$("#hidden_mn").val());currentDate=new Date($("#cur_aa").val(),$("#cur_mm").val()-1,$("#cur_jj").val(),$("#cur_hh").val(),$("#cur_mn").val());if(attemptedDate.getFullYear()!=aa||(1+attemptedDate.getMonth())!=mm||attemptedDate.getDate()!=jj||attemptedDate.getMinutes()!=mn){$(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{$(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(attemptedDate>currentDate&&$("#original_post_status").val()!="future"){publishOn=postL10n.publishOnFuture;$("#publish").val(postL10n.schedule)}else{if(attemptedDate<=currentDate&&$("#original_post_status").val()!="publish"){publishOn=postL10n.publishOn;$("#publish").val(postL10n.publish)}else{publishOn=postL10n.publishOnPast;if(page){$("#publish").val(postL10n.updatePage)}else{$("#publish").val(postL10n.updatePost)}}}if(originalDate.toUTCString()==attemptedDate.toUTCString()){$("#timestamp").html(stamp)}else{$("#timestamp").html(publishOn+" <b>"+$("option[value="+$("#mm").val()+"]","#mm").text()+" "+jj+", "+aa+" @ "+hh+":"+mn+"</b> ")}if($("input:radio:checked","#post-visibility-select").val()=="private"){if(page){$("#publish").val(postL10n.updatePage)}else{$("#publish").val(postL10n.updatePost)}if(optPublish.length==0){postStatus.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{optPublish.html(postL10n.privatelyPublished)}$("option[value=publish]",postStatus).attr("selected",true);$(".edit-post-status","#misc-publishing-actions").hide()}else{if($("#original_post_status").val()=="future"||$("#original_post_status").val()=="draft"){if(optPublish.length){optPublish.remove();postStatus.val($("#hidden_post_status").val())}}else{optPublish.html(postL10n.published)}if(postStatus.is(":hidden")){$(".edit-post-status","#misc-publishing-actions").show()}}$("#post-status-display").html($("option:selected",postStatus).text());if($("option:selected",postStatus).val()=="private"||$("option:selected",postStatus).val()=="publish"){$("#save-post").hide()}else{$("#save-post").show();if($("option:selected",postStatus).val()=="pending"){$("#save-post").show().val(postL10n.savePending)}else{$("#save-post").show().val(postL10n.saveDraft)}}return true}$(".edit-visibility","#visibility").click(function(){if($("#post-visibility-select").is(":hidden")){updateVisibility();$("#post-visibility-select").slideDown("normal");$(this).hide()}return false});$(".cancel-post-visibility","#post-visibility-select").click(function(){$("#post-visibility-select").slideUp("normal");$("#visibility-radio-"+$("#hidden-post-visibility").val()).attr("checked",true);$("#post_password").val($("#hidden_post_password").val());$("#sticky").attr("checked",$("#hidden-post-sticky").attr("checked"));$("#post-visibility-display").html(visibility);$(".edit-visibility","#visibility").show();updateText();return false});$(".save-post-visibility","#post-visibility-select").click(function(){var pvSelect=$("#post-visibility-select");pvSelect.slideUp("normal");$(".edit-visibility","#visibility").show();updateText();if($("input:radio:checked",pvSelect).val()!="public"){$("#sticky").attr("checked",false)}if(true==$("#sticky").attr("checked")){sticky="Sticky"}else{sticky=""}$("#post-visibility-display").html(postL10n[$("input:radio:checked",pvSelect).val()+sticky]);return false});$("input:radio","#post-visibility-select").change(function(){updateVisibility()});$("#timestampdiv").siblings("a.edit-timestamp").click(function(){if($("#timestampdiv").is(":hidden")){$("#timestampdiv").slideDown("normal");$(this).hide()}return false});$(".cancel-timestamp","#timestampdiv").click(function(){$("#timestampdiv").slideUp("normal");$("#mm").val($("#hidden_mm").val());$("#jj").val($("#hidden_jj").val());$("#aa").val($("#hidden_aa").val());$("#hh").val($("#hidden_hh").val());$("#mn").val($("#hidden_mn").val());$("#timestampdiv").siblings("a.edit-timestamp").show();updateText();return false});$(".save-timestamp","#timestampdiv").click(function(){if(updateText()){$("#timestampdiv").slideUp("normal");$("#timestampdiv").siblings("a.edit-timestamp").show()}return false});$("#post-status-select").siblings("a.edit-post-status").click(function(){if($("#post-status-select").is(":hidden")){$("#post-status-select").slideDown("normal");$(this).hide()}return false});$(".save-post-status","#post-status-select").click(function(){$("#post-status-select").slideUp("normal");$("#post-status-select").siblings("a.edit-post-status").show();updateText();return false});$(".cancel-post-status","#post-status-select").click(function(){$("#post-status-select").slideUp("normal");$("#post_status").val($("#hidden_post_status").val());$("#post-status-select").siblings("a.edit-post-status").show();updateText();return false})}if($("#edit-slug-box").length){editPermalink=function(post_id){var i,c=0,e=$("#editable-post-name"),revert_e=e.html(),real_slug=$("#post_name"),revert_slug=real_slug.val(),b=$("#edit-slug-buttons"),revert_b=b.html(),full=$("#editable-post-name-full").html();$("#view-post-btn").hide();b.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");b.children(".save").click(function(){var new_slug=e.children("input").val();$.post(ajaxurl,{action:"sample-permalink",post_id:post_id,new_slug:new_slug,new_title:$("#title").val(),samplepermalinknonce:$("#samplepermalinknonce").val()},function(data){$("#edit-slug-box").html(data);b.html(revert_b);real_slug.attr("value",new_slug);makeSlugeditClickable();$("#view-post-btn").show()});return false});$(".cancel","#edit-slug-buttons").click(function(){$("#view-post-btn").show();e.html(revert_e);b.html(revert_b);real_slug.attr("value",revert_slug);return false});for(i=0;i<full.length;++i){if("%"==full.charAt(i)){c++}}slug_value=(c>full.length/4)?"":full;e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(e){var key=e.keyCode||0;if(13==key){b.children(".save").click();return false}if(27==key){b.children(".cancel").click();return false}real_slug.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){$("#editable-post-name").click(function(){$("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}if($("#title").val()==""){$("#title").siblings("#title-prompt-text").css("visibility","")}$("#title-prompt-text").click(function(){$(this).css("visibility","hidden").siblings("#title").focus()});$("#title").blur(function(){if(this.value==""){$(this).siblings("#title-prompt-text").css("visibility","")}}).focus(function(){$(this).siblings("#title-prompt-text").css("visibility","hidden")}).keydown(function(e){$(this).siblings("#title-prompt-text").css("visibility","hidden");$(this).unbind(e)})});
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(d){var f=a(".the-tags",d),e=a(".tagchecklist",d),b;if(!f.length){return}var c=f.attr("disabled");b=f.val().split(",");e.empty();a.each(b,function(i,j){var g,h,k=a(d).attr("id");j=a.trim(j);if(!j.match(/^\s+$/)&&""!=j){h=k+"-check-num-"+i;if(c){g="<span>"+j+"</span> "}else{g='<span><a id="'+h+'" class="ntdelbutton">X</a>&nbsp;'+j+"</span> "}e.append(g);if(!c){a("#"+h).click(function(){tagBox.parseTags(this)})}}})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});a("#"+c).after(e)})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").parent().siblings(".newtag").focus()});a("input.newtag",c).blur(function(){if(this.value==""){a(this).parent().siblings(".taghint").css("visibility","")}}).focus(function(){a(this).parent().siblings(".taghint").css("visibility","hidden")}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+d,{delay:500,minchars:2,multiple:true,multipleSep:","})});a("#post").submit(function(){a("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){tagBox.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(b){a(".inside","#postimagediv").html(b)};WPSetThumbnailID=function(c){var b=a("input[value=_thumbnail_id]","#list-table");if(b.size()>0){a("#meta\\["+b.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(c)}};WPRemoveThumbnail=function(){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(b){if(b=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(b)}})}})(jQuery);jQuery(document).ready(function(e){var b,a,f="";postboxes.add_postbox_toggles(pagenow);if(e("#tagsdiv-post_tag").length){tagBox.init()}else{e("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}e(".categorydiv").each(function(){var l=e(this).attr("id"),h=false,k,m,j,g,i;j=l.split("-");j.shift();g=j.join("-");i=g+"_tab";if(g=="category"){i="cats"}e("a","#"+g+"-tabs").click(function(){var n=e(this).attr("href");e(this).parent().addClass("tabs").siblings("li").removeClass("tabs");e("#"+g+"-tabs").siblings(".tabs-panel").hide();e(n).show();if("#"+g+"-all"==n){deleteUserSetting(i)}else{setUserSetting(i,"pop")}return false});if(getUserSetting(i)){e('a[href="#'+g+'-pop"]',"#"+g+"-tabs").click()}e("#new"+g).one("focus",function(){e(this).val("").removeClass("form-input-tip")});e("#"+g+"-add-submit").click(function(){e("#new"+g).focus()});k=function(){if(h){return}h=true;var n=jQuery(this),p=n.is(":checked"),o=n.val().toString();e("#in-"+g+"-"+o+", #in-"+g+"-category-"+o).attr("checked",p);h=false};catAddBefore=function(n){if(!e("#new"+g).val()){return false}n.data+="&"+e(":checked","#"+g+"checklist").serialize();return n};m=function(q,p){var o,n=e("#new"+g+"_parent");if("undefined"!=p.parsed.responses[0]&&(o=p.parsed.responses[0].supplemental.newcat_parent)){n.before(o);n.remove()}};e("#"+g+"checklist").wpList({alt:"",response:g+"-ajax-response",addBefore:catAddBefore,addAfter:m});e("#"+g+"-add-toggle").click(function(){e("#"+g+"-adder").toggleClass("wp-hidden-children");e('a[href="#'+g+'-all"]',"#"+g+"-tabs").click();return false});e("#"+g+"checklist li.popular-category :checkbox, #"+g+"checklist-pop :checkbox").live("click",function(){var n=e(this),p=n.is(":checked"),o=n.val();if(o&&n.parents("#taxonomy-"+g).length){e("#in-"+g+"-"+o+", #in-popular-"+g+"-"+o).attr("checked",p)}})});if(e("#postcustom").length){e("#the-list").wpList({addAfter:function(g,h){e("table#list-table").show()},addBefore:function(g){g.data+="&post_id="+e("#post_ID").val();return g}})}if(e("#submitdiv").length){b=e("#timestamp").html();a=e("#post-visibility-display").html();function d(){var g=e("#post-visibility-select");if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false);e("#sticky-span").hide()}else{e("#sticky-span").show()}if(e("input:radio:checked",g).val()!="password"){e("#password-span").hide()}else{e("#password-span").show()}}function c(){var n,p,h,r,o="page"==pagenow||"page-new"==pagenow,q=e("#post_status"),i=e("option[value=publish]",q),g=e("#aa").val(),l=e("#mm").val(),m=e("#jj").val(),k=e("#hh").val(),j=e("#mn").val();n=new Date(g,l-1,m,k,j);p=new Date(e("#hidden_aa").val(),e("#hidden_mm").val()-1,e("#hidden_jj").val(),e("#hidden_hh").val(),e("#hidden_mn").val());h=new Date(e("#cur_aa").val(),e("#cur_mm").val()-1,e("#cur_jj").val(),e("#cur_hh").val(),e("#cur_mn").val());if(n.getFullYear()!=g||(1+n.getMonth())!=l||n.getDate()!=m||n.getMinutes()!=j){e(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{e(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(n>h&&e("#original_post_status").val()!="future"){r=postL10n.publishOnFuture;e("#publish").val(postL10n.schedule)}else{if(n<=h&&e("#original_post_status").val()!="publish"){r=postL10n.publishOn;e("#publish").val(postL10n.publish)}else{r=postL10n.publishOnPast;if(o){e("#publish").val(postL10n.updatePage)}else{e("#publish").val(postL10n.updatePost)}}}if(p.toUTCString()==n.toUTCString()){e("#timestamp").html(b)}else{e("#timestamp").html(r+" <b>"+e("option[value="+e("#mm").val()+"]","#mm").text()+" "+m+", "+g+" @ "+k+":"+j+"</b> ")}if(e("input:radio:checked","#post-visibility-select").val()=="private"){if(o){e("#publish").val(postL10n.updatePage)}else{e("#publish").val(postL10n.updatePost)}if(i.length==0){q.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{i.html(postL10n.privatelyPublished)}e("option[value=publish]",q).attr("selected",true);e(".edit-post-status","#misc-publishing-actions").hide()}else{if(e("#original_post_status").val()=="future"||e("#original_post_status").val()=="draft"){if(i.length){i.remove();q.val(e("#hidden_post_status").val())}}else{i.html(postL10n.published)}if(q.is(":hidden")){e(".edit-post-status","#misc-publishing-actions").show()}}e("#post-status-display").html(e("option:selected",q).text());if(e("option:selected",q).val()=="private"||e("option:selected",q).val()=="publish"){e("#save-post").hide()}else{e("#save-post").show();if(e("option:selected",q).val()=="pending"){e("#save-post").show().val(postL10n.savePending)}else{e("#save-post").show().val(postL10n.saveDraft)}}return true}e(".edit-visibility","#visibility").click(function(){if(e("#post-visibility-select").is(":hidden")){d();e("#post-visibility-select").slideDown("normal");e(this).hide()}return false});e(".cancel-post-visibility","#post-visibility-select").click(function(){e("#post-visibility-select").slideUp("normal");e("#visibility-radio-"+e("#hidden-post-visibility").val()).attr("checked",true);e("#post_password").val(e("#hidden_post_password").val());e("#sticky").attr("checked",e("#hidden-post-sticky").attr("checked"));e("#post-visibility-display").html(a);e(".edit-visibility","#visibility").show();c();return false});e(".save-post-visibility","#post-visibility-select").click(function(){var g=e("#post-visibility-select");g.slideUp("normal");e(".edit-visibility","#visibility").show();c();if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false)}if(true==e("#sticky").attr("checked")){f="Sticky"}else{f=""}e("#post-visibility-display").html(postL10n[e("input:radio:checked",g).val()+f]);return false});e("input:radio","#post-visibility-select").change(function(){d()});e("#timestampdiv").siblings("a.edit-timestamp").click(function(){if(e("#timestampdiv").is(":hidden")){e("#timestampdiv").slideDown("normal");e(this).hide()}return false});e(".cancel-timestamp","#timestampdiv").click(function(){e("#timestampdiv").slideUp("normal");e("#mm").val(e("#hidden_mm").val());e("#jj").val(e("#hidden_jj").val());e("#aa").val(e("#hidden_aa").val());e("#hh").val(e("#hidden_hh").val());e("#mn").val(e("#hidden_mn").val());e("#timestampdiv").siblings("a.edit-timestamp").show();c();return false});e(".save-timestamp","#timestampdiv").click(function(){if(c()){e("#timestampdiv").slideUp("normal");e("#timestampdiv").siblings("a.edit-timestamp").show()}return false});e("#post-status-select").siblings("a.edit-post-status").click(function(){if(e("#post-status-select").is(":hidden")){e("#post-status-select").slideDown("normal");e(this).hide()}return false});e(".save-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post-status-select").siblings("a.edit-post-status").show();c();return false});e(".cancel-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post_status").val(e("#hidden_post_status").val());e("#post-status-select").siblings("a.edit-post-status").show();c();return false})}if(e("#edit-slug-box").length){editPermalink=function(g){var h,l=0,k=e("#editable-post-name"),m=k.html(),p=e("#post_name"),q=p.val(),n=e("#edit-slug-buttons"),o=n.html(),j=e("#editable-post-name-full").html();e("#view-post-btn").hide();n.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");n.children(".save").click(function(){var i=k.children("input").val();e.post(ajaxurl,{action:"sample-permalink",post_id:g,new_slug:i,new_title:e("#title").val(),samplepermalinknonce:e("#samplepermalinknonce").val()},function(r){e("#edit-slug-box").html(r);n.html(o);p.attr("value",i);makeSlugeditClickable();e("#view-post-btn").show()});return false});e(".cancel","#edit-slug-buttons").click(function(){e("#view-post-btn").show();k.html(m);n.html(o);p.attr("value",q);return false});for(h=0;h<j.length;++h){if("%"==j.charAt(h)){l++}}slug_value=(l>j.length/4)?"":j;k.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(r){var i=r.keyCode||0;if(13==i){n.children(".save").click();return false}if(27==i){n.children(".cancel").click();return false}p.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){e("#editable-post-name").click(function(){e("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}if(e("#title").val()==""){e("#title").siblings("#title-prompt-text").css("visibility","")}e("#title-prompt-text").click(function(){e(this).css("visibility","hidden").siblings("#title").focus()});e("#title").blur(function(){if(this.value==""){e(this).siblings("#title-prompt-text").css("visibility","")}}).focus(function(){e(this).siblings("#title-prompt-text").css("visibility","hidden")}).keydown(function(g){e(this).siblings("#title-prompt-text").css("visibility","hidden");e(this).unbind(g)})});
10574 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/10574/6288de4b34eb87a24c28c900b2c6bcd241b097fa/post.js/clean/wp-admin/js/post.js
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(c){var e=a(".the-tags",c),d=a(".tagchecklist",c),b;if(!e.length){return}b=e.val().split(",");d.empty();a.each(b,function(h,i){var f,g,j=a(c).attr("id");i=a.trim(i);if(!i.match(/^\s+$/)&&""!=i){g=j+"-check-num-"+h;f='<span><a id="'+g+'" class="ntdelbutton">X</a>&nbsp;'+i+"</span> ";d.append(f);a("#"+g).click(function(){tagBox.parseTags(this)})}})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});a("#"+c).after(e)})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").siblings(".newtag").focus()});a("input.newtag",c).blur(function(){if(this.value==""){a(this).siblings(".taghint").css("visibility","")}}).focus(function(){a(this).siblings(".taghint").css("visibility","hidden")}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+d,{delay:500,minchars:2,multiple:true,multipleSep:", "})});a("#post").submit(function(){a("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){tagBox.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(b){a(".inside","#postimagediv").html(b)};WPSetThumbnailID=function(c){var b=a("input[value=_thumbnail_id]","#list-table");if(b.size()>0){a("#meta\\["+b.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(c)}};WPRemoveThumbnail=function(){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(b){if(b=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(b)}})}})(jQuery);jQuery(document).ready(function(g){var c,a,h="",b="post"==pagenow||"post-new"==pagenow,f="page"==pagenow||"page-new"==pagenow;if(b){type="post";if(typenow){type=typenow}postboxes.add_postbox_toggles(type)}else{if(f){postboxes.add_postbox_toggles("page")}}if(g("#tagsdiv-post_tag").length){tagBox.init()}else{g("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}g(".categorydiv").each(function(){var n=g(this).attr("id"),j=false,m,o,l,i,k;l=n.split("-");l.shift();i=l.join("-");k=i+"_tab";if(i=="category"){k="cats"}g("a","#"+i+"-tabs").click(function(){var p=g(this).attr("href");g(this).parent().addClass("tabs").siblings("li").removeClass("tabs");g("#"+i+"-tabs").siblings(".tabs-panel").hide();g(p).show();if("#"+i+"-all"==p){deleteUserSetting(k)}else{setUserSetting(k,"pop")}return false});if(getUserSetting(k)){g('a[href="#'+i+'-pop"]',"#"+i+"-tabs").click()}g("#new"+i).one("focus",function(){g(this).val("").removeClass("form-input-tip")});g("#"+i+"-add-submit").click(function(){g("#new"+i).focus()});m=function(){if(j){return}j=true;var p=jQuery(this),r=p.is(":checked"),q=p.val().toString();g("#in-"+i+"-"+q+", #in-"+i+"-category-"+q).attr("checked",r);j=false};catAddBefore=function(p){if(!g("#new"+i).val()){return false}p.data+="&"+g(":checked","#"+i+"checklist").serialize();return p};o=function(u,t){var q,p=g("#new"+i+"_parent");if("undefined"!=t.parsed.responses[0]&&(q=t.parsed.responses[0].supplemental.newcat_parent)){p.before(q);p.remove()}};g("#"+i+"checklist").wpList({alt:"",response:i+"-ajax-response",addBefore:catAddBefore,addAfter:o});g("#"+i+"-add-toggle").click(function(){g("#"+i+"-adder").toggleClass("wp-hidden-children");g('a[href="#'+i+'-all"]',"#"+i+"-tabs").click();return false});g("#"+i+"checklist").children("li.popular-category").add(g("#"+i+"checklist-pop").children()).find(":checkbox").live("click",function(){var p=g(this),r=p.is(":checked"),q=p.val();if(q&&p.parents("#taxonomy-"+i).length){g("#in-"+i+"-"+q+", #in-popular-"+i+"-"+q).attr("checked",r)}})});if(g("#postcustom").length){g("#the-list").wpList({addAfter:function(i,j){g("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(j.parsed.responses[0].supplemental.postid)}},addBefore:function(i){i.data+="&post_id="+g("#post_ID").val();return i}})}if(g("#submitdiv").length){c=g("#timestamp").html();a=g("#post-visibility-display").html();function e(){var i=g("#post-visibility-select");if(g("input:radio:checked",i).val()!="public"){g("#sticky").attr("checked",false);g("#sticky-span").hide()}else{g("#sticky-span").show()}if(g("input:radio:checked",i).val()!="password"){g("#password-span").hide()}else{g("#password-span").show()}}function d(){var p,q,j,s,r=g("#post_status"),k=g("option[value=publish]",r),i=g("#aa").val(),n=g("#mm").val(),o=g("#jj").val(),m=g("#hh").val(),l=g("#mn").val();p=new Date(i,n-1,o,m,l);q=new Date(g("#hidden_aa").val(),g("#hidden_mm").val()-1,g("#hidden_jj").val(),g("#hidden_hh").val(),g("#hidden_mn").val());j=new Date(g("#cur_aa").val(),g("#cur_mm").val()-1,g("#cur_jj").val(),g("#cur_hh").val(),g("#cur_mn").val());if(p.getFullYear()!=i||(1+p.getMonth())!=n||p.getDate()!=o||p.getMinutes()!=l){g(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{g(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(p>j&&g("#original_post_status").val()!="future"){s=postL10n.publishOnFuture;g("#publish").val(postL10n.schedule)}else{if(p<=j&&g("#original_post_status").val()!="publish"){s=postL10n.publishOn;g("#publish").val(postL10n.publish)}else{s=postL10n.publishOnPast;if(f){g("#publish").val(postL10n.updatePage)}else{g("#publish").val(postL10n.updatePost)}}}if(q.toUTCString()==p.toUTCString()){g("#timestamp").html(c)}else{g("#timestamp").html(s+" <b>"+g("option[value="+g("#mm").val()+"]","#mm").text()+" "+o+", "+i+" @ "+m+":"+l+"</b> ")}if(g("input:radio:checked","#post-visibility-select").val()=="private"){if(f){g("#publish").val(postL10n.updatePage)}else{g("#publish").val(postL10n.updatePost)}if(k.length==0){r.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{k.html(postL10n.privatelyPublished)}g("option[value=publish]",r).attr("selected",true);g(".edit-post-status","#misc-publishing-actions").hide()}else{if(g("#original_post_status").val()=="future"||g("#original_post_status").val()=="draft"){if(k.length){k.remove();r.val(g("#hidden_post_status").val())}}else{k.html(postL10n.published)}if(r.is(":hidden")){g(".edit-post-status","#misc-publishing-actions").show()}}g("#post-status-display").html(g("option:selected",r).text());if(g("option:selected",r).val()=="private"||g("option:selected",r).val()=="publish"){g("#save-post").hide()}else{g("#save-post").show();if(g("option:selected",r).val()=="pending"){g("#save-post").show().val(postL10n.savePending)}else{g("#save-post").show().val(postL10n.saveDraft)}}return true}g(".edit-visibility","#visibility").click(function(){if(g("#post-visibility-select").is(":hidden")){e();g("#post-visibility-select").slideDown("normal");g(this).hide()}return false});g(".cancel-post-visibility","#post-visibility-select").click(function(){g("#post-visibility-select").slideUp("normal");g("#visibility-radio-"+g("#hidden-post-visibility").val()).attr("checked",true);g("#post_password").val(g("#hidden_post_password").val());g("#sticky").attr("checked",g("#hidden-post-sticky").attr("checked"));g("#post-visibility-display").html(a);g(".edit-visibility","#visibility").show();d();return false});g(".save-post-visibility","#post-visibility-select").click(function(){var i=g("#post-visibility-select");i.slideUp("normal");g(".edit-visibility","#visibility").show();d();if(g("input:radio:checked",i).val()!="public"){g("#sticky").attr("checked",false)}if(true==g("#sticky").attr("checked")){h="Sticky"}else{h=""}g("#post-visibility-display").html(postL10n[g("input:radio:checked",i).val()+h]);return false});g("input:radio","#post-visibility-select").change(function(){e()});g("#timestampdiv").siblings("a.edit-timestamp").click(function(){if(g("#timestampdiv").is(":hidden")){g("#timestampdiv").slideDown("normal");g(this).hide()}return false});g(".cancel-timestamp","#timestampdiv").click(function(){g("#timestampdiv").slideUp("normal");g("#mm").val(g("#hidden_mm").val());g("#jj").val(g("#hidden_jj").val());g("#aa").val(g("#hidden_aa").val());g("#hh").val(g("#hidden_hh").val());g("#mn").val(g("#hidden_mn").val());g("#timestampdiv").siblings("a.edit-timestamp").show();d();return false});g(".save-timestamp","#timestampdiv").click(function(){if(d()){g("#timestampdiv").slideUp("normal");g("#timestampdiv").siblings("a.edit-timestamp").show()}return false});g("#post-status-select").siblings("a.edit-post-status").click(function(){if(g("#post-status-select").is(":hidden")){g("#post-status-select").slideDown("normal");g(this).hide()}return false});g(".save-post-status","#post-status-select").click(function(){g("#post-status-select").slideUp("normal");g("#post-status-select").siblings("a.edit-post-status").show();d();return false});g(".cancel-post-status","#post-status-select").click(function(){g("#post-status-select").slideUp("normal");g("#post_status").val(g("#hidden_post_status").val());g("#post-status-select").siblings("a.edit-post-status").show();d();return false})}if(g("#edit-slug-box").length){editPermalink=function(j){var k,n=0,m=g("#editable-post-name"),o=m.html(),r=g("#post_name"),s=r.html(),p=g("#edit-slug-buttons"),q=p.html(),l=g("#editable-post-name-full").html();g("#view-post-btn").hide();p.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");p.children(".save").click(function(){var i=m.children("input").val();g.post(ajaxurl,{action:"sample-permalink",post_id:j,new_slug:i,new_title:g("#title").val(),samplepermalinknonce:g("#samplepermalinknonce").val()},function(t){g("#edit-slug-box").html(t);p.html(q);r.attr("value",i);makeSlugeditClickable();g("#view-post-btn").show()});return false});g(".cancel","#edit-slug-buttons").click(function(){g("#view-post-btn").show();m.html(o);p.html(q);r.attr("value",s);return false});for(k=0;k<l.length;++k){if("%"==l.charAt(k)){n++}}slug_value=(n>l.length/4)?"":l;m.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(t){var i=t.keyCode||0;if(13==i){p.children(".save").click();return false}if(27==i){p.children(".cancel").click();return false}r.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){g("#editable-post-name").click(function(){g("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}});
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(c){var e=a(".the-tags",c),d=a(".tagchecklist",c),b;if(!e.length){return}b=e.val().split(",");d.empty();a.each(b,function(h,i){var f,g,j=a(c).attr("id");i=a.trim(i);if(!i.match(/^\s+$/)&&""!=i){g=j+"-check-num-"+h;f='<span><a id="'+g+'" class="ntdelbutton">X</a>&nbsp;'+i+"</span> ";d.append(f);a("#"+g).click(function(){tagBox.parseTags(this)})}})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});a("#"+c).after(e)})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").siblings(".newtag").focus()});a("input.newtag",c).blur(function(){if(this.value==""){a(this).siblings(".taghint").css("visibility","")}}).focus(function(){a(this).siblings(".taghint").css("visibility","hidden")}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+d,{delay:500,minchars:2,multiple:true,multipleSep:", "})});a("#post").submit(function(){a("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){tagBox.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(b){a(".inside","#postimagediv").html(b)};WPSetThumbnailID=function(c){var b=a("input[value=_thumbnail_id]","#list-table");if(b.size()>0){a("#meta\\["+b.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(c)}};WPRemoveThumbnail=function(){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(b){if(b=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(b)}})}})(jQuery);jQuery(document).ready(function(g){var c,a,h="",b="post"==pagenow||"post-new"==pagenow,f="page"==pagenow||"page-new"==pagenow;if(b){type="post";if(typenow){type=typenow}postboxes.add_postbox_toggles(type)}else{if(f){postboxes.add_postbox_toggles("page")}}if(g("#tagsdiv-post_tag").length){tagBox.init()}else{g("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}g(".categorydiv").each(function(){var n=g(this).attr("id"),j=false,m,o,l,i,k;l=n.split("-");l.shift();i=l.join("-");k=i+"_tab";if(i=="category"){k="cats"}g("a","#"+i+"-tabs").click(function(){var p=g(this).attr("href");g(this).parent().addClass("tabs").siblings("li").removeClass("tabs");g("#"+i+"-tabs").siblings(".tabs-panel").hide();g(p).show();if("#"+i+"-all"==p){deleteUserSetting(k)}else{setUserSetting(k,"pop")}return false});if(getUserSetting(k)){g('a[href="#'+i+'-pop"]',"#"+i+"-tabs").click()}g("#new"+i).one("focus",function(){g(this).val("").removeClass("form-input-tip")});g("#"+i+"-add-submit").click(function(){g("#new"+i).focus()});m=function(){if(j){return}j=true;var p=jQuery(this),r=p.is(":checked"),q=p.val().toString();g("#in-"+i+"-"+q+", #in-"+i+"-category-"+q).attr("checked",r);j=false};catAddBefore=function(p){if(!g("#new"+i).val()){return false}p.data+="&"+g(":checked","#"+i+"checklist").serialize();return p};o=function(u,t){var q,p=g("#new"+i+"_parent");if("undefined"!=t.parsed.responses[0]&&(q=t.parsed.responses[0].supplemental.newcat_parent)){p.before(q);p.remove()}};g("#"+i+"checklist").wpList({alt:"",response:i+"-ajax-response",addBefore:catAddBefore,addAfter:o});g("#"+i+"-add-toggle").click(function(){g("#"+i+"-adder").toggleClass("wp-hidden-children");g('a[href="#'+i+'-all"]',"#"+i+"-tabs").click();return false});g("#"+i+"checklist li.popular-category :checkbox, #"+i+"checklist-pop :checkbox").live("click",function(){var p=g(this),r=p.is(":checked"),q=p.val();if(q&&p.parents("#taxonomy-"+i).length){g("#in-"+i+"-"+q+", #in-popular-"+i+"-"+q).attr("checked",r)}})});if(g("#postcustom").length){g("#the-list").wpList({addAfter:function(i,j){g("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(j.parsed.responses[0].supplemental.postid)}},addBefore:function(i){i.data+="&post_id="+g("#post_ID").val();return i}})}if(g("#submitdiv").length){c=g("#timestamp").html();a=g("#post-visibility-display").html();function e(){var i=g("#post-visibility-select");if(g("input:radio:checked",i).val()!="public"){g("#sticky").attr("checked",false);g("#sticky-span").hide()}else{g("#sticky-span").show()}if(g("input:radio:checked",i).val()!="password"){g("#password-span").hide()}else{g("#password-span").show()}}function d(){var p,q,j,s,r=g("#post_status"),k=g("option[value=publish]",r),i=g("#aa").val(),n=g("#mm").val(),o=g("#jj").val(),m=g("#hh").val(),l=g("#mn").val();p=new Date(i,n-1,o,m,l);q=new Date(g("#hidden_aa").val(),g("#hidden_mm").val()-1,g("#hidden_jj").val(),g("#hidden_hh").val(),g("#hidden_mn").val());j=new Date(g("#cur_aa").val(),g("#cur_mm").val()-1,g("#cur_jj").val(),g("#cur_hh").val(),g("#cur_mn").val());if(p.getFullYear()!=i||(1+p.getMonth())!=n||p.getDate()!=o||p.getMinutes()!=l){g(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{g(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(p>j&&g("#original_post_status").val()!="future"){s=postL10n.publishOnFuture;g("#publish").val(postL10n.schedule)}else{if(p<=j&&g("#original_post_status").val()!="publish"){s=postL10n.publishOn;g("#publish").val(postL10n.publish)}else{s=postL10n.publishOnPast;if(f){g("#publish").val(postL10n.updatePage)}else{g("#publish").val(postL10n.updatePost)}}}if(q.toUTCString()==p.toUTCString()){g("#timestamp").html(c)}else{g("#timestamp").html(s+" <b>"+g("option[value="+g("#mm").val()+"]","#mm").text()+" "+o+", "+i+" @ "+m+":"+l+"</b> ")}if(g("input:radio:checked","#post-visibility-select").val()=="private"){if(f){g("#publish").val(postL10n.updatePage)}else{g("#publish").val(postL10n.updatePost)}if(k.length==0){r.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{k.html(postL10n.privatelyPublished)}g("option[value=publish]",r).attr("selected",true);g(".edit-post-status","#misc-publishing-actions").hide()}else{if(g("#original_post_status").val()=="future"||g("#original_post_status").val()=="draft"){if(k.length){k.remove();r.val(g("#hidden_post_status").val())}}else{k.html(postL10n.published)}if(r.is(":hidden")){g(".edit-post-status","#misc-publishing-actions").show()}}g("#post-status-display").html(g("option:selected",r).text());if(g("option:selected",r).val()=="private"||g("option:selected",r).val()=="publish"){g("#save-post").hide()}else{g("#save-post").show();if(g("option:selected",r).val()=="pending"){g("#save-post").show().val(postL10n.savePending)}else{g("#save-post").show().val(postL10n.saveDraft)}}return true}g(".edit-visibility","#visibility").click(function(){if(g("#post-visibility-select").is(":hidden")){e();g("#post-visibility-select").slideDown("normal");g(this).hide()}return false});g(".cancel-post-visibility","#post-visibility-select").click(function(){g("#post-visibility-select").slideUp("normal");g("#visibility-radio-"+g("#hidden-post-visibility").val()).attr("checked",true);g("#post_password").val(g("#hidden_post_password").val());g("#sticky").attr("checked",g("#hidden-post-sticky").attr("checked"));g("#post-visibility-display").html(a);g(".edit-visibility","#visibility").show();d();return false});g(".save-post-visibility","#post-visibility-select").click(function(){var i=g("#post-visibility-select");i.slideUp("normal");g(".edit-visibility","#visibility").show();d();if(g("input:radio:checked",i).val()!="public"){g("#sticky").attr("checked",false)}if(true==g("#sticky").attr("checked")){h="Sticky"}else{h=""}g("#post-visibility-display").html(postL10n[g("input:radio:checked",i).val()+h]);return false});g("input:radio","#post-visibility-select").change(function(){e()});g("#timestampdiv").siblings("a.edit-timestamp").click(function(){if(g("#timestampdiv").is(":hidden")){g("#timestampdiv").slideDown("normal");g(this).hide()}return false});g(".cancel-timestamp","#timestampdiv").click(function(){g("#timestampdiv").slideUp("normal");g("#mm").val(g("#hidden_mm").val());g("#jj").val(g("#hidden_jj").val());g("#aa").val(g("#hidden_aa").val());g("#hh").val(g("#hidden_hh").val());g("#mn").val(g("#hidden_mn").val());g("#timestampdiv").siblings("a.edit-timestamp").show();d();return false});g(".save-timestamp","#timestampdiv").click(function(){if(d()){g("#timestampdiv").slideUp("normal");g("#timestampdiv").siblings("a.edit-timestamp").show()}return false});g("#post-status-select").siblings("a.edit-post-status").click(function(){if(g("#post-status-select").is(":hidden")){g("#post-status-select").slideDown("normal");g(this).hide()}return false});g(".save-post-status","#post-status-select").click(function(){g("#post-status-select").slideUp("normal");g("#post-status-select").siblings("a.edit-post-status").show();d();return false});g(".cancel-post-status","#post-status-select").click(function(){g("#post-status-select").slideUp("normal");g("#post_status").val(g("#hidden_post_status").val());g("#post-status-select").siblings("a.edit-post-status").show();d();return false})}if(g("#edit-slug-box").length){editPermalink=function(j){var k,n=0,m=g("#editable-post-name"),o=m.html(),r=g("#post_name"),s=r.html(),p=g("#edit-slug-buttons"),q=p.html(),l=g("#editable-post-name-full").html();g("#view-post-btn").hide();p.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");p.children(".save").click(function(){var i=m.children("input").val();g.post(ajaxurl,{action:"sample-permalink",post_id:j,new_slug:i,new_title:g("#title").val(),samplepermalinknonce:g("#samplepermalinknonce").val()},function(t){g("#edit-slug-box").html(t);p.html(q);r.attr("value",i);makeSlugeditClickable();g("#view-post-btn").show()});return false});g(".cancel","#edit-slug-buttons").click(function(){g("#view-post-btn").show();m.html(o);p.html(q);r.attr("value",s);return false});for(k=0;k<l.length;++k){if("%"==l.charAt(k)){n++}}slug_value=(n>l.length/4)?"":l;m.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(t){var i=t.keyCode||0;if(13==i){p.children(".save").click();return false}if(27==i){p.children(".cancel").click();return false}r.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){g("#editable-post-name").click(function(){g("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}});
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(c){var e=a(".the-tags",c),d=a(".tagchecklist",c),b;if(!e.length){return}b=e.val().split(",");d.empty();a.each(b,function(h,i){var f,g,j=a(c).attr("id");i=a.trim(i);if(!i.match(/^\s+$/)&&""!=i){g=j+"-check-num-"+h;f='<span><a id="'+g+'" class="ntdelbutton">X</a>&nbsp;'+i+"</span> ";d.append(f);a("#"+g).click(function(){tagBox.parseTags(this)})}})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});a("#"+c).after(e)})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").siblings(".newtag").focus()});a("input.newtag",c).blur(function(){if(this.value==""){a(this).siblings(".taghint").css("visibility","")}}).focus(function(){a(this).siblings(".taghint").css("visibility","hidden")}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+d,{delay:500,minchars:2,multiple:true,multipleSep:", "})});a("#post").submit(function(){a("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){tagBox.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(b){a(".inside","#postimagediv").html(b)};WPSetThumbnailID=function(c){var b=a("input[value=_thumbnail_id]","#list-table");if(b.size()>0){a("#meta\\["+b.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(c)}};WPRemoveThumbnail=function(){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(b){if(b=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(b)}})}})(jQuery);jQuery(document).ready(function(g){var c,a,h="",b="post"==pagenow||"post-new"==pagenow,f="page"==pagenow||"page-new"==pagenow;if(b){type="post";if(typenow){type=typenow}postboxes.add_postbox_toggles(type)}else{if(f){postboxes.add_postbox_toggles("page")}}if(g("#tagsdiv-post_tag").length){tagBox.init()}else{g("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}g(".categorydiv").each(function(){var n=g(this).attr("id"),j=false,m,o,l,i,k;l=n.split("-");l.shift();i=l.join("-");k=i+"_tab";if(i=="category"){k="cats"}g("a","#"+i+"-tabs").click(function(){var p=g(this).attr("href");g(this).parent().addClass("tabs").siblings("li").removeClass("tabs");g("#"+i+"-tabs").siblings(".tabs-panel").hide();g(p).show();if("#"+i+"-all"==p){deleteUserSetting(k)}else{setUserSetting(k,"pop")}return false});if(getUserSetting(k)){g('a[href="#'+i+'-pop"]',"#"+i+"-tabs").click()}g("#new"+i).one("focus",function(){g(this).val("").removeClass("form-input-tip")});g("#"+i+"-add-submit").click(function(){g("#new"+i).focus()});m=function(){if(j){return}j=true;var p=jQuery(this),r=p.is(":checked"),q=p.val().toString();g("#in-"+i+"-"+q+", #in-"+i+"-category-"+q).attr("checked",r);j=false};catAddBefore=function(p){if(!g("#new"+i).val()){return false}p.data+="&"+g(":checked","#"+i+"checklist").serialize();return p};o=function(u,t){var q,p=g("#new"+i+"_parent");if("undefined"!=t.parsed.responses[0]&&(q=t.parsed.responses[0].supplemental.newcat_parent)){p.before(q);p.remove()}};g("#"+i+"checklist").wpList({alt:"",response:i+"-ajax-response",addBefore:catAddBefore,addAfter:o});g("#"+i+"-add-toggle").click(function(){g("#"+i+"-adder").toggleClass("wp-hidden-children");g('a[href="#'+i+'-all"]',"#"+i+"-tabs").click();return false});g("#"+i+"checklist").children("li.popular-category").add(g("#"+i+"checklist-pop").children()).find(":checkbox").live("click",function(){var p=g(this),r=p.is(":checked"),q=p.val();if(q&&p.parents("#taxonomy-"+i).length){g("#in-"+i+"-"+q+", #in-popular-"+i+"-"+q).attr("checked",r)}})});if(g("#postcustom").length){g("#the-list").wpList({addAfter:function(i,j){g("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(j.parsed.responses[0].supplemental.postid)}},addBefore:function(i){i.data+="&post_id="+g("#post_ID").val();return i}})}if(g("#submitdiv").length){c=g("#timestamp").html();a=g("#post-visibility-display").html();function e(){var i=g("#post-visibility-select");if(g("input:radio:checked",i).val()!="public"){g("#sticky").attr("checked",false);g("#sticky-span").hide()}else{g("#sticky-span").show()}if(g("input:radio:checked",i).val()!="password"){g("#password-span").hide()}else{g("#password-span").show()}}function d(){var p,q,j,s,r=g("#post_status"),k=g("option[value=publish]",r),i=g("#aa").val(),n=g("#mm").val(),o=g("#jj").val(),m=g("#hh").val(),l=g("#mn").val();p=new Date(i,n-1,o,m,l);q=new Date(g("#hidden_aa").val(),g("#hidden_mm").val()-1,g("#hidden_jj").val(),g("#hidden_hh").val(),g("#hidden_mn").val());j=new Date(g("#cur_aa").val(),g("#cur_mm").val()-1,g("#cur_jj").val(),g("#cur_hh").val(),g("#cur_mn").val());if(p.getFullYear()!=i||(1+p.getMonth())!=n||p.getDate()!=o||p.getMinutes()!=l){g(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{g(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(p>j&&g("#original_post_status").val()!="future"){s=postL10n.publishOnFuture;g("#publish").val(postL10n.schedule)}else{if(p<=j&&g("#original_post_status").val()!="publish"){s=postL10n.publishOn;g("#publish").val(postL10n.publish)}else{s=postL10n.publishOnPast;if(f){g("#publish").val(postL10n.updatePage)}else{g("#publish").val(postL10n.updatePost)}}}if(q.toUTCString()==p.toUTCString()){g("#timestamp").html(c)}else{g("#timestamp").html(s+" <b>"+g("option[value="+g("#mm").val()+"]","#mm").text()+" "+o+", "+i+" @ "+m+":"+l+"</b> ")}if(g("input:radio:checked","#post-visibility-select").val()=="private"){if(f){g("#publish").val(postL10n.updatePage)}else{g("#publish").val(postL10n.updatePost)}if(k.length==0){r.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{k.html(postL10n.privatelyPublished)}g("option[value=publish]",r).attr("selected",true);g(".edit-post-status","#misc-publishing-actions").hide()}else{if(g("#original_post_status").val()=="future"||g("#original_post_status").val()=="draft"){if(k.length){k.remove();r.val(g("#hidden_post_status").val())}}else{k.html(postL10n.published)}if(r.is(":hidden")){g(".edit-post-status","#misc-publishing-actions").show()}}g("#post-status-display").html(g("option:selected",r).text());if(g("option:selected",r).val()=="private"||g("option:selected",r).val()=="publish"){g("#save-post").hide()}else{g("#save-post").show();if(g("option:selected",r).val()=="pending"){g("#save-post").show().val(postL10n.savePending)}else{g("#save-post").show().val(postL10n.saveDraft)}}return true}g(".edit-visibility","#visibility").click(function(){if(g("#post-visibility-select").is(":hidden")){e();g("#post-visibility-select").slideDown("normal");g(this).hide()}return false});g(".cancel-post-visibility","#post-visibility-select").click(function(){g("#post-visibility-select").slideUp("normal");g("#visibility-radio-"+g("#hidden-post-visibility").val()).attr("checked",true);g("#post_password").val(g("#hidden_post_password").val());g("#sticky").attr("checked",g("#hidden-post-sticky").attr("checked"));g("#post-visibility-display").html(a);g(".edit-visibility","#visibility").show();d();return false});g(".save-post-visibility","#post-visibility-select").click(function(){var i=g("#post-visibility-select");i.slideUp("normal");g(".edit-visibility","#visibility").show();d();if(g("input:radio:checked",i).val()!="public"){g("#sticky").attr("checked",false)}if(true==g("#sticky").attr("checked")){h="Sticky"}else{h=""}g("#post-visibility-display").html(postL10n[g("input:radio:checked",i).val()+h]);return false});g("input:radio","#post-visibility-select").change(function(){e()});g("#timestampdiv").siblings("a.edit-timestamp").click(function(){if(g("#timestampdiv").is(":hidden")){g("#timestampdiv").slideDown("normal");g(this).hide()}return false});g(".cancel-timestamp","#timestampdiv").click(function(){g("#timestampdiv").slideUp("normal");g("#mm").val(g("#hidden_mm").val());g("#jj").val(g("#hidden_jj").val());g("#aa").val(g("#hidden_aa").val());g("#hh").val(g("#hidden_hh").val());g("#mn").val(g("#hidden_mn").val());g("#timestampdiv").siblings("a.edit-timestamp").show();d();return false});g(".save-timestamp","#timestampdiv").click(function(){if(d()){g("#timestampdiv").slideUp("normal");g("#timestampdiv").siblings("a.edit-timestamp").show()}return false});g("#post-status-select").siblings("a.edit-post-status").click(function(){if(g("#post-status-select").is(":hidden")){g("#post-status-select").slideDown("normal");g(this).hide()}return false});g(".save-post-status","#post-status-select").click(function(){g("#post-status-select").slideUp("normal");g("#post-status-select").siblings("a.edit-post-status").show();d();return false});g(".cancel-post-status","#post-status-select").click(function(){g("#post-status-select").slideUp("normal");g("#post_status").val(g("#hidden_post_status").val());g("#post-status-select").siblings("a.edit-post-status").show();d();return false})}if(g("#edit-slug-box").length){editPermalink=function(j){var k,n=0,m=g("#editable-post-name"),o=m.html(),r=g("#post_name"),s=r.html(),p=g("#edit-slug-buttons"),q=p.html(),l=g("#editable-post-name-full").html();g("#view-post-btn").hide();p.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");p.children(".save").click(function(){var i=m.children("input").val();g.post(ajaxurl,{action:"sample-permalink",post_id:j,new_slug:i,new_title:g("#title").val(),samplepermalinknonce:g("#samplepermalinknonce").val()},function(t){g("#edit-slug-box").html(t);p.html(q);r.attr("value",i);makeSlugeditClickable();g("#view-post-btn").show()});return false});g(".cancel","#edit-slug-buttons").click(function(){g("#view-post-btn").show();m.html(o);p.html(q);r.attr("value",s);return false});for(k=0;k<l.length;++k){if("%"==l.charAt(k)){n++}}slug_value=(n>l.length/4)?"":l;m.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(t){var i=t.keyCode||0;if(13==i){p.children(".save").click();return false}if(27==i){p.children(".cancel").click();return false}r.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){g("#editable-post-name").click(function(){g("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}});
10574 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/10574/75c0e8d7b0866815cd7f531b387d7e940a518105/post.js/buggy/wp-admin/js/post.js
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(d){var f=a(".the-tags",d),e=a(".tagchecklist",d),b;if(!f.length){return}var c=f.attr("disabled");b=f.val().split(",");e.empty();a.each(b,function(i,j){var g,h,k=a(d).attr("id");j=a.trim(j);if(!j.match(/^\s+$/)&&""!=j){h=k+"-check-num-"+i;if(c){g="<span>"+j+"</span> "}else{g='<span><a id="'+h+'" class="ntdelbutton">X</a>&nbsp;'+j+"</span> "}e.append(g);if(!c){a("#"+h).click(function(){tagBox.parseTags(this)})}}})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});a("#"+c).after(e)})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").siblings(".newtag").focus()});a("input.newtag",c).blur(function(){if(this.value==""){a(this).siblings(".taghint").css("visibility","")}}).focus(function(){a(this).siblings(".taghint").css("visibility","hidden")}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+d,{delay:500,minchars:2,multiple:true,multipleSep:", "})});a("#post").submit(function(){a("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){tagBox.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(b){a(".inside","#postimagediv").html(b)};WPSetThumbnailID=function(c){var b=a("input[value=_thumbnail_id]","#list-table");if(b.size()>0){a("#meta\\["+b.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(c)}};WPRemoveThumbnail=function(){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(b){if(b=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(b)}})}})(jQuery);jQuery(document).ready(function(e){var b,a,f="";postboxes.add_postbox_toggles(pagenow);if(e("#tagsdiv-post_tag").length){tagBox.init()}else{e("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}e(".categorydiv").each(function(){var l=e(this).attr("id"),h=false,k,m,j,g,i;j=l.split("-");j.shift();g=j.join("-");i=g+"_tab";if(g=="category"){i="cats"}e("a","#"+g+"-tabs").click(function(){var n=e(this).attr("href");e(this).parent().addClass("tabs").siblings("li").removeClass("tabs");e("#"+g+"-tabs").siblings(".tabs-panel").hide();e(n).show();if("#"+g+"-all"==n){deleteUserSetting(i)}else{setUserSetting(i,"pop")}return false});if(getUserSetting(i)){e('a[href="#'+g+'-pop"]',"#"+g+"-tabs").click()}e("#new"+g).one("focus",function(){e(this).val("").removeClass("form-input-tip")});e("#"+g+"-add-submit").click(function(){e("#new"+g).focus()});k=function(){if(h){return}h=true;var n=jQuery(this),p=n.is(":checked"),o=n.val().toString();e("#in-"+g+"-"+o+", #in-"+g+"-category-"+o).attr("checked",p);h=false};catAddBefore=function(n){if(!e("#new"+g).val()){return false}n.data+="&"+e(":checked","#"+g+"checklist").serialize();return n};m=function(q,p){var o,n=e("#new"+g+"_parent");if("undefined"!=p.parsed.responses[0]&&(o=p.parsed.responses[0].supplemental.newcat_parent)){n.before(o);n.remove()}};e("#"+g+"checklist").wpList({alt:"",response:g+"-ajax-response",addBefore:catAddBefore,addAfter:m});e("#"+g+"-add-toggle").click(function(){e("#"+g+"-adder").toggleClass("wp-hidden-children");e('a[href="#'+g+'-all"]',"#"+g+"-tabs").click();return false});e("#"+g+"checklist li.popular-category :checkbox, #"+g+"checklist-pop :checkbox").live("click",function(){var n=e(this),p=n.is(":checked"),o=n.val();if(o&&n.parents("#taxonomy-"+g).length){e("#in-"+g+"-"+o+", #in-popular-"+g+"-"+o).attr("checked",p)}})});if(e("#postcustom").length){e("#the-list").wpList({addAfter:function(g,h){e("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(h.parsed.responses[0].supplemental.postid)}},addBefore:function(g){g.data+="&post_id="+e("#post_ID").val();return g}})}if(e("#submitdiv").length){b=e("#timestamp").html();a=e("#post-visibility-display").html();function d(){var g=e("#post-visibility-select");if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false);e("#sticky-span").hide()}else{e("#sticky-span").show()}if(e("input:radio:checked",g).val()!="password"){e("#password-span").hide()}else{e("#password-span").show()}}function c(){var n,o,h,q,p=e("#post_status"),i=e("option[value=publish]",p),g=e("#aa").val(),l=e("#mm").val(),m=e("#jj").val(),k=e("#hh").val(),j=e("#mn").val();n=new Date(g,l-1,m,k,j);o=new Date(e("#hidden_aa").val(),e("#hidden_mm").val()-1,e("#hidden_jj").val(),e("#hidden_hh").val(),e("#hidden_mn").val());h=new Date(e("#cur_aa").val(),e("#cur_mm").val()-1,e("#cur_jj").val(),e("#cur_hh").val(),e("#cur_mn").val());if(n.getFullYear()!=g||(1+n.getMonth())!=l||n.getDate()!=m||n.getMinutes()!=j){e(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{e(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(n>h&&e("#original_post_status").val()!="future"){q=postL10n.publishOnFuture;e("#publish").val(postL10n.schedule)}else{if(n<=h&&e("#original_post_status").val()!="publish"){q=postL10n.publishOn;e("#publish").val(postL10n.publish)}else{q=postL10n.publishOnPast;if(page){e("#publish").val(postL10n.updatePage)}else{e("#publish").val(postL10n.updatePost)}}}if(o.toUTCString()==n.toUTCString()){e("#timestamp").html(b)}else{e("#timestamp").html(q+" <b>"+e("option[value="+e("#mm").val()+"]","#mm").text()+" "+m+", "+g+" @ "+k+":"+j+"</b> ")}if(e("input:radio:checked","#post-visibility-select").val()=="private"){if(page){e("#publish").val(postL10n.updatePage)}else{e("#publish").val(postL10n.updatePost)}if(i.length==0){p.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{i.html(postL10n.privatelyPublished)}e("option[value=publish]",p).attr("selected",true);e(".edit-post-status","#misc-publishing-actions").hide()}else{if(e("#original_post_status").val()=="future"||e("#original_post_status").val()=="draft"){if(i.length){i.remove();p.val(e("#hidden_post_status").val())}}else{i.html(postL10n.published)}if(p.is(":hidden")){e(".edit-post-status","#misc-publishing-actions").show()}}e("#post-status-display").html(e("option:selected",p).text());if(e("option:selected",p).val()=="private"||e("option:selected",p).val()=="publish"){e("#save-post").hide()}else{e("#save-post").show();if(e("option:selected",p).val()=="pending"){e("#save-post").show().val(postL10n.savePending)}else{e("#save-post").show().val(postL10n.saveDraft)}}return true}e(".edit-visibility","#visibility").click(function(){if(e("#post-visibility-select").is(":hidden")){d();e("#post-visibility-select").slideDown("normal");e(this).hide()}return false});e(".cancel-post-visibility","#post-visibility-select").click(function(){e("#post-visibility-select").slideUp("normal");e("#visibility-radio-"+e("#hidden-post-visibility").val()).attr("checked",true);e("#post_password").val(e("#hidden_post_password").val());e("#sticky").attr("checked",e("#hidden-post-sticky").attr("checked"));e("#post-visibility-display").html(a);e(".edit-visibility","#visibility").show();c();return false});e(".save-post-visibility","#post-visibility-select").click(function(){var g=e("#post-visibility-select");g.slideUp("normal");e(".edit-visibility","#visibility").show();c();if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false)}if(true==e("#sticky").attr("checked")){f="Sticky"}else{f=""}e("#post-visibility-display").html(postL10n[e("input:radio:checked",g).val()+f]);return false});e("input:radio","#post-visibility-select").change(function(){d()});e("#timestampdiv").siblings("a.edit-timestamp").click(function(){if(e("#timestampdiv").is(":hidden")){e("#timestampdiv").slideDown("normal");e(this).hide()}return false});e(".cancel-timestamp","#timestampdiv").click(function(){e("#timestampdiv").slideUp("normal");e("#mm").val(e("#hidden_mm").val());e("#jj").val(e("#hidden_jj").val());e("#aa").val(e("#hidden_aa").val());e("#hh").val(e("#hidden_hh").val());e("#mn").val(e("#hidden_mn").val());e("#timestampdiv").siblings("a.edit-timestamp").show();c();return false});e(".save-timestamp","#timestampdiv").click(function(){if(c()){e("#timestampdiv").slideUp("normal");e("#timestampdiv").siblings("a.edit-timestamp").show()}return false});e("#post-status-select").siblings("a.edit-post-status").click(function(){if(e("#post-status-select").is(":hidden")){e("#post-status-select").slideDown("normal");e(this).hide()}return false});e(".save-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post-status-select").siblings("a.edit-post-status").show();c();return false});e(".cancel-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post_status").val(e("#hidden_post_status").val());e("#post-status-select").siblings("a.edit-post-status").show();c();return false})}if(e("#edit-slug-box").length){editPermalink=function(g){var h,l=0,k=e("#editable-post-name"),m=k.html(),p=e("#post_name"),q=p.val(),n=e("#edit-slug-buttons"),o=n.html(),j=e("#editable-post-name-full").html();e("#view-post-btn").hide();n.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");n.children(".save").click(function(){var i=k.children("input").val();e.post(ajaxurl,{action:"sample-permalink",post_id:g,new_slug:i,new_title:e("#title").val(),samplepermalinknonce:e("#samplepermalinknonce").val()},function(r){e("#edit-slug-box").html(r);n.html(o);p.attr("value",i);makeSlugeditClickable();e("#view-post-btn").show()});return false});e(".cancel","#edit-slug-buttons").click(function(){e("#view-post-btn").show();k.html(m);n.html(o);p.attr("value",q);return false});for(h=0;h<j.length;++h){if("%"==j.charAt(h)){l++}}slug_value=(l>j.length/4)?"":j;k.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(r){var i=r.keyCode||0;if(13==i){n.children(".save").click();return false}if(27==i){n.children(".cancel").click();return false}p.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){e("#editable-post-name").click(function(){e("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}if(e("#title").val()==""){e("#title").siblings("#title-prompt-text").css("visibility","")}e("#title-prompt-text").click(function(){e(this).css("visibility","hidden").siblings("#title").focus()});e("#title").blur(function(){if(this.value==""){e(this).siblings("#title-prompt-text").css("visibility","")}}).focus(function(){e(this).siblings("#title-prompt-text").css("visibility","hidden")}).keydown(function(g){e(this).siblings("#title-prompt-text").css("visibility","hidden");e(this).unbind(g)})});
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(a){var out=[];jQuery.each(a,function(key,val){val=jQuery.trim(val);if(val&&jQuery.inArray(val,out)==-1){out.push(val)}});return out}(function($){tagBox={clean:function(tags){return tags.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(el){var id=el.id,num=id.split("-check-num-")[1],taxbox=$(el).closest(".tagsdiv"),thetags=taxbox.find(".the-tags"),current_tags=thetags.val().split(","),new_tags=[];delete current_tags[num];$.each(current_tags,function(key,val){val=$.trim(val);if(val){new_tags.push(val)}});thetags.val(this.clean(new_tags.join(",")));this.quickClicks(taxbox);return false},quickClicks:function(el){var thetags=$(".the-tags",el),tagchecklist=$(".tagchecklist",el),current_tags;if(!thetags.length){return}var disabled=thetags.attr("disabled");current_tags=thetags.val().split(",");tagchecklist.empty();$.each(current_tags,function(key,val){var txt,button_id,id=$(el).attr("id");val=$.trim(val);if(!val.match(/^\s+$/)&&""!=val){button_id=id+"-check-num-"+key;if(disabled){txt="<span>"+val+"</span> "}else{txt='<span><a id="'+button_id+'" class="ntdelbutton">X</a>&nbsp;'+val+"</span> "}tagchecklist.append(txt);if(!disabled){$("#"+button_id).click(function(){tagBox.parseTags(this)})}}})},flushTags:function(el,a,f){a=a||false;var text,tags=$(".the-tags",el),newtag=$("input.newtag",el),newtags;text=a?$(a).text():newtag.val();tagsval=tags.val();newtags=tagsval?tagsval+","+text:text;newtags=this.clean(newtags);newtags=array_unique_noempty(newtags.split(",")).join(",");tags.val(newtags);this.quickClicks(el);if(!a){newtag.val("")}if("undefined"==typeof(f)){newtag.focus()}return false},get:function(id){var tax=id.substr(id.indexOf("-")+1);$.post(ajaxurl,{action:"get-tagcloud",tax:tax},function(r,stat){if(0==r||"success"!=stat){r=wpAjax.broken}r=$('<p id="tagcloud-'+tax+'" class="the-tagcloud">'+r+"</p>");$("a",r).click(function(){tagBox.flushTags($(this).closest(".inside").children(".tagsdiv"),this);return false});$("#"+id).after(r)})},init:function(){var t=this,ajaxtag=$("div.ajaxtag");$(".tagsdiv").each(function(){tagBox.quickClicks(this)});$("input.tagadd",ajaxtag).click(function(){t.flushTags($(this).closest(".tagsdiv"))});$("div.taghint",ajaxtag).click(function(){$(this).css("visibility","hidden").siblings(".newtag").focus()});$("input.newtag",ajaxtag).blur(function(){if(this.value==""){$(this).siblings(".taghint").css("visibility","")}}).focus(function(){$(this).siblings(".taghint").css("visibility","hidden")}).keyup(function(e){if(13==e.which){tagBox.flushTags($(this).closest(".tagsdiv"));return false}}).keypress(function(e){if(13==e.which){e.preventDefault();return false}}).each(function(){var tax=$(this).closest("div.tagsdiv").attr("id");$(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+tax,{delay:500,minchars:2,multiple:true,multipleSep:", "})});$("#post").submit(function(){$("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});$("a.tagcloud-link").click(function(){tagBox.get($(this).attr("id"));$(this).unbind().click(function(){$(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(total,num){var st=this.st,data;if(!num){num=20}this.st+=num;this.total=total;$("#commentsdiv img.waiting").show();data={action:"get-comments",mode:"single",_ajax_nonce:$("#add_comment_nonce").val(),post_ID:$("#post_ID").val(),start:st,num:num};$.post(ajaxurl,data,function(r){r=wpAjax.parseAjaxResponse(r);$("#commentsdiv .widefat").show();$("#commentsdiv img.waiting").hide();if("object"==typeof r&&r.responses[0]){$("#the-comment-list").append(r.responses[0].data);theList=theExtraList=null;$("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){$("#show-comments").hide()}else{$("#show-comments").html(postL10n.showcomm)}return}else{if(1==r){$("#show-comments").parent().html(postL10n.endcomm);return}}$("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(html){$(".inside","#postimagediv").html(html)};WPSetThumbnailID=function(id){var field=$("input[value=_thumbnail_id]","#list-table");if(field.size()>0){$("#meta\\["+field.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(id)}};WPRemoveThumbnail=function(){$.post(ajaxurl,{action:"set-post-thumbnail",post_id:$("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(str){if(str=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(str)}})}})(jQuery);jQuery(document).ready(function($){var stamp,visibility,sticky="";postboxes.add_postbox_toggles(pagenow);if($("#tagsdiv-post_tag").length){tagBox.init()}else{$("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}$(".categorydiv").each(function(){var this_id=$(this).attr("id"),noSyncChecks=false,syncChecks,catAddAfter,taxonomyParts,taxonomy,settingName;taxonomyParts=this_id.split("-");taxonomyParts.shift();taxonomy=taxonomyParts.join("-");settingName=taxonomy+"_tab";if(taxonomy=="category"){settingName="cats"}$("a","#"+taxonomy+"-tabs").click(function(){var t=$(this).attr("href");$(this).parent().addClass("tabs").siblings("li").removeClass("tabs");$("#"+taxonomy+"-tabs").siblings(".tabs-panel").hide();$(t).show();if("#"+taxonomy+"-all"==t){deleteUserSetting(settingName)}else{setUserSetting(settingName,"pop")}return false});if(getUserSetting(settingName)){$('a[href="#'+taxonomy+'-pop"]',"#"+taxonomy+"-tabs").click()}$("#new"+taxonomy).one("focus",function(){$(this).val("").removeClass("form-input-tip")});$("#"+taxonomy+"-add-submit").click(function(){$("#new"+taxonomy).focus()});syncChecks=function(){if(noSyncChecks){return}noSyncChecks=true;var th=jQuery(this),c=th.is(":checked"),id=th.val().toString();$("#in-"+taxonomy+"-"+id+", #in-"+taxonomy+"-category-"+id).attr("checked",c);noSyncChecks=false};catAddBefore=function(s){if(!$("#new"+taxonomy).val()){return false}s.data+="&"+$(":checked","#"+taxonomy+"checklist").serialize();return s};catAddAfter=function(r,s){var sup,drop=$("#new"+taxonomy+"_parent");if("undefined"!=s.parsed.responses[0]&&(sup=s.parsed.responses[0].supplemental.newcat_parent)){drop.before(sup);drop.remove()}};$("#"+taxonomy+"checklist").wpList({alt:"",response:taxonomy+"-ajax-response",addBefore:catAddBefore,addAfter:catAddAfter});$("#"+taxonomy+"-add-toggle").click(function(){$("#"+taxonomy+"-adder").toggleClass("wp-hidden-children");$('a[href="#'+taxonomy+'-all"]',"#"+taxonomy+"-tabs").click();return false});$("#"+taxonomy+"checklist li.popular-category :checkbox, #"+taxonomy+"checklist-pop :checkbox").live("click",function(){var t=$(this),c=t.is(":checked"),id=t.val();if(id&&t.parents("#taxonomy-"+taxonomy).length){$("#in-"+taxonomy+"-"+id+", #in-popular-"+taxonomy+"-"+id).attr("checked",c)}})});if($("#postcustom").length){$("#the-list").wpList({addAfter:function(xml,s){$("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(s.parsed.responses[0].supplemental.postid)}},addBefore:function(s){s.data+="&post_id="+$("#post_ID").val();return s}})}if($("#submitdiv").length){stamp=$("#timestamp").html();visibility=$("#post-visibility-display").html();function updateVisibility(){var pvSelect=$("#post-visibility-select");if($("input:radio:checked",pvSelect).val()!="public"){$("#sticky").attr("checked",false);$("#sticky-span").hide()}else{$("#sticky-span").show()}if($("input:radio:checked",pvSelect).val()!="password"){$("#password-span").hide()}else{$("#password-span").show()}}function updateText(){var attemptedDate,originalDate,currentDate,publishOn,page="page"==pagenow||"page-new"==pagenow,postStatus=$("#post_status"),optPublish=$("option[value=publish]",postStatus),aa=$("#aa").val(),mm=$("#mm").val(),jj=$("#jj").val(),hh=$("#hh").val(),mn=$("#mn").val();attemptedDate=new Date(aa,mm-1,jj,hh,mn);originalDate=new Date($("#hidden_aa").val(),$("#hidden_mm").val()-1,$("#hidden_jj").val(),$("#hidden_hh").val(),$("#hidden_mn").val());currentDate=new Date($("#cur_aa").val(),$("#cur_mm").val()-1,$("#cur_jj").val(),$("#cur_hh").val(),$("#cur_mn").val());if(attemptedDate.getFullYear()!=aa||(1+attemptedDate.getMonth())!=mm||attemptedDate.getDate()!=jj||attemptedDate.getMinutes()!=mn){$(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{$(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(attemptedDate>currentDate&&$("#original_post_status").val()!="future"){publishOn=postL10n.publishOnFuture;$("#publish").val(postL10n.schedule)}else{if(attemptedDate<=currentDate&&$("#original_post_status").val()!="publish"){publishOn=postL10n.publishOn;$("#publish").val(postL10n.publish)}else{publishOn=postL10n.publishOnPast;if(page){$("#publish").val(postL10n.updatePage)}else{$("#publish").val(postL10n.updatePost)}}}if(originalDate.toUTCString()==attemptedDate.toUTCString()){$("#timestamp").html(stamp)}else{$("#timestamp").html(publishOn+" <b>"+$("option[value="+$("#mm").val()+"]","#mm").text()+" "+jj+", "+aa+" @ "+hh+":"+mn+"</b> ")}if($("input:radio:checked","#post-visibility-select").val()=="private"){if(page){$("#publish").val(postL10n.updatePage)}else{$("#publish").val(postL10n.updatePost)}if(optPublish.length==0){postStatus.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{optPublish.html(postL10n.privatelyPublished)}$("option[value=publish]",postStatus).attr("selected",true);$(".edit-post-status","#misc-publishing-actions").hide()}else{if($("#original_post_status").val()=="future"||$("#original_post_status").val()=="draft"){if(optPublish.length){optPublish.remove();postStatus.val($("#hidden_post_status").val())}}else{optPublish.html(postL10n.published)}if(postStatus.is(":hidden")){$(".edit-post-status","#misc-publishing-actions").show()}}$("#post-status-display").html($("option:selected",postStatus).text());if($("option:selected",postStatus).val()=="private"||$("option:selected",postStatus).val()=="publish"){$("#save-post").hide()}else{$("#save-post").show();if($("option:selected",postStatus).val()=="pending"){$("#save-post").show().val(postL10n.savePending)}else{$("#save-post").show().val(postL10n.saveDraft)}}return true}$(".edit-visibility","#visibility").click(function(){if($("#post-visibility-select").is(":hidden")){updateVisibility();$("#post-visibility-select").slideDown("normal");$(this).hide()}return false});$(".cancel-post-visibility","#post-visibility-select").click(function(){$("#post-visibility-select").slideUp("normal");$("#visibility-radio-"+$("#hidden-post-visibility").val()).attr("checked",true);$("#post_password").val($("#hidden_post_password").val());$("#sticky").attr("checked",$("#hidden-post-sticky").attr("checked"));$("#post-visibility-display").html(visibility);$(".edit-visibility","#visibility").show();updateText();return false});$(".save-post-visibility","#post-visibility-select").click(function(){var pvSelect=$("#post-visibility-select");pvSelect.slideUp("normal");$(".edit-visibility","#visibility").show();updateText();if($("input:radio:checked",pvSelect).val()!="public"){$("#sticky").attr("checked",false)}if(true==$("#sticky").attr("checked")){sticky="Sticky"}else{sticky=""}$("#post-visibility-display").html(postL10n[$("input:radio:checked",pvSelect).val()+sticky]);return false});$("input:radio","#post-visibility-select").change(function(){updateVisibility()});$("#timestampdiv").siblings("a.edit-timestamp").click(function(){if($("#timestampdiv").is(":hidden")){$("#timestampdiv").slideDown("normal");$(this).hide()}return false});$(".cancel-timestamp","#timestampdiv").click(function(){$("#timestampdiv").slideUp("normal");$("#mm").val($("#hidden_mm").val());$("#jj").val($("#hidden_jj").val());$("#aa").val($("#hidden_aa").val());$("#hh").val($("#hidden_hh").val());$("#mn").val($("#hidden_mn").val());$("#timestampdiv").siblings("a.edit-timestamp").show();updateText();return false});$(".save-timestamp","#timestampdiv").click(function(){if(updateText()){$("#timestampdiv").slideUp("normal");$("#timestampdiv").siblings("a.edit-timestamp").show()}return false});$("#post-status-select").siblings("a.edit-post-status").click(function(){if($("#post-status-select").is(":hidden")){$("#post-status-select").slideDown("normal");$(this).hide()}return false});$(".save-post-status","#post-status-select").click(function(){$("#post-status-select").slideUp("normal");$("#post-status-select").siblings("a.edit-post-status").show();updateText();return false});$(".cancel-post-status","#post-status-select").click(function(){$("#post-status-select").slideUp("normal");$("#post_status").val($("#hidden_post_status").val());$("#post-status-select").siblings("a.edit-post-status").show();updateText();return false})}if($("#edit-slug-box").length){editPermalink=function(post_id){var i,c=0,e=$("#editable-post-name"),revert_e=e.html(),real_slug=$("#post_name"),revert_slug=real_slug.val(),b=$("#edit-slug-buttons"),revert_b=b.html(),full=$("#editable-post-name-full").html();$("#view-post-btn").hide();b.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");b.children(".save").click(function(){var new_slug=e.children("input").val();$.post(ajaxurl,{action:"sample-permalink",post_id:post_id,new_slug:new_slug,new_title:$("#title").val(),samplepermalinknonce:$("#samplepermalinknonce").val()},function(data){$("#edit-slug-box").html(data);b.html(revert_b);real_slug.attr("value",new_slug);makeSlugeditClickable();$("#view-post-btn").show()});return false});$(".cancel","#edit-slug-buttons").click(function(){$("#view-post-btn").show();e.html(revert_e);b.html(revert_b);real_slug.attr("value",revert_slug);return false});for(i=0;i<full.length;++i){if("%"==full.charAt(i)){c++}}slug_value=(c>full.length/4)?"":full;e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(e){var key=e.keyCode||0;if(13==key){b.children(".save").click();return false}if(27==key){b.children(".cancel").click();return false}real_slug.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){$("#editable-post-name").click(function(){$("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}if($("#title").val()==""){$("#title").siblings("#title-prompt-text").css("visibility","")}$("#title-prompt-text").click(function(){$(this).css("visibility","hidden").siblings("#title").focus()});$("#title").blur(function(){if(this.value==""){$(this).siblings("#title-prompt-text").css("visibility","")}}).focus(function(){$(this).siblings("#title-prompt-text").css("visibility","hidden")}).keydown(function(e){$(this).siblings("#title-prompt-text").css("visibility","hidden");$(this).unbind(e)})});
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(d){var f=a(".the-tags",d),e=a(".tagchecklist",d),b;if(!f.length){return}var c=f.attr("disabled");b=f.val().split(",");e.empty();a.each(b,function(i,j){var g,h,k=a(d).attr("id");j=a.trim(j);if(!j.match(/^\s+$/)&&""!=j){h=k+"-check-num-"+i;if(c){g="<span>"+j+"</span> "}else{g='<span><a id="'+h+'" class="ntdelbutton">X</a>&nbsp;'+j+"</span> "}e.append(g);if(!c){a("#"+h).click(function(){tagBox.parseTags(this)})}}})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});a("#"+c).after(e)})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").siblings(".newtag").focus()});a("input.newtag",c).blur(function(){if(this.value==""){a(this).siblings(".taghint").css("visibility","")}}).focus(function(){a(this).siblings(".taghint").css("visibility","hidden")}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+d,{delay:500,minchars:2,multiple:true,multipleSep:", "})});a("#post").submit(function(){a("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){tagBox.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(b){a(".inside","#postimagediv").html(b)};WPSetThumbnailID=function(c){var b=a("input[value=_thumbnail_id]","#list-table");if(b.size()>0){a("#meta\\["+b.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(c)}};WPRemoveThumbnail=function(){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(b){if(b=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(b)}})}})(jQuery);jQuery(document).ready(function(e){var b,a,f="";postboxes.add_postbox_toggles(pagenow);if(e("#tagsdiv-post_tag").length){tagBox.init()}else{e("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}e(".categorydiv").each(function(){var l=e(this).attr("id"),h=false,k,m,j,g,i;j=l.split("-");j.shift();g=j.join("-");i=g+"_tab";if(g=="category"){i="cats"}e("a","#"+g+"-tabs").click(function(){var n=e(this).attr("href");e(this).parent().addClass("tabs").siblings("li").removeClass("tabs");e("#"+g+"-tabs").siblings(".tabs-panel").hide();e(n).show();if("#"+g+"-all"==n){deleteUserSetting(i)}else{setUserSetting(i,"pop")}return false});if(getUserSetting(i)){e('a[href="#'+g+'-pop"]',"#"+g+"-tabs").click()}e("#new"+g).one("focus",function(){e(this).val("").removeClass("form-input-tip")});e("#"+g+"-add-submit").click(function(){e("#new"+g).focus()});k=function(){if(h){return}h=true;var n=jQuery(this),p=n.is(":checked"),o=n.val().toString();e("#in-"+g+"-"+o+", #in-"+g+"-category-"+o).attr("checked",p);h=false};catAddBefore=function(n){if(!e("#new"+g).val()){return false}n.data+="&"+e(":checked","#"+g+"checklist").serialize();return n};m=function(q,p){var o,n=e("#new"+g+"_parent");if("undefined"!=p.parsed.responses[0]&&(o=p.parsed.responses[0].supplemental.newcat_parent)){n.before(o);n.remove()}};e("#"+g+"checklist").wpList({alt:"",response:g+"-ajax-response",addBefore:catAddBefore,addAfter:m});e("#"+g+"-add-toggle").click(function(){e("#"+g+"-adder").toggleClass("wp-hidden-children");e('a[href="#'+g+'-all"]',"#"+g+"-tabs").click();return false});e("#"+g+"checklist li.popular-category :checkbox, #"+g+"checklist-pop :checkbox").live("click",function(){var n=e(this),p=n.is(":checked"),o=n.val();if(o&&n.parents("#taxonomy-"+g).length){e("#in-"+g+"-"+o+", #in-popular-"+g+"-"+o).attr("checked",p)}})});if(e("#postcustom").length){e("#the-list").wpList({addAfter:function(g,h){e("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(h.parsed.responses[0].supplemental.postid)}},addBefore:function(g){g.data+="&post_id="+e("#post_ID").val();return g}})}if(e("#submitdiv").length){b=e("#timestamp").html();a=e("#post-visibility-display").html();function d(){var g=e("#post-visibility-select");if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false);e("#sticky-span").hide()}else{e("#sticky-span").show()}if(e("input:radio:checked",g).val()!="password"){e("#password-span").hide()}else{e("#password-span").show()}}function c(){var n,o,h,q,p=e("#post_status"),i=e("option[value=publish]",p),g=e("#aa").val(),l=e("#mm").val(),m=e("#jj").val(),k=e("#hh").val(),j=e("#mn").val();n=new Date(g,l-1,m,k,j);o=new Date(e("#hidden_aa").val(),e("#hidden_mm").val()-1,e("#hidden_jj").val(),e("#hidden_hh").val(),e("#hidden_mn").val());h=new Date(e("#cur_aa").val(),e("#cur_mm").val()-1,e("#cur_jj").val(),e("#cur_hh").val(),e("#cur_mn").val());if(n.getFullYear()!=g||(1+n.getMonth())!=l||n.getDate()!=m||n.getMinutes()!=j){e(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{e(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(n>h&&e("#original_post_status").val()!="future"){q=postL10n.publishOnFuture;e("#publish").val(postL10n.schedule)}else{if(n<=h&&e("#original_post_status").val()!="publish"){q=postL10n.publishOn;e("#publish").val(postL10n.publish)}else{q=postL10n.publishOnPast;if(page){e("#publish").val(postL10n.updatePage)}else{e("#publish").val(postL10n.updatePost)}}}if(o.toUTCString()==n.toUTCString()){e("#timestamp").html(b)}else{e("#timestamp").html(q+" <b>"+e("option[value="+e("#mm").val()+"]","#mm").text()+" "+m+", "+g+" @ "+k+":"+j+"</b> ")}if(e("input:radio:checked","#post-visibility-select").val()=="private"){if(page){e("#publish").val(postL10n.updatePage)}else{e("#publish").val(postL10n.updatePost)}if(i.length==0){p.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{i.html(postL10n.privatelyPublished)}e("option[value=publish]",p).attr("selected",true);e(".edit-post-status","#misc-publishing-actions").hide()}else{if(e("#original_post_status").val()=="future"||e("#original_post_status").val()=="draft"){if(i.length){i.remove();p.val(e("#hidden_post_status").val())}}else{i.html(postL10n.published)}if(p.is(":hidden")){e(".edit-post-status","#misc-publishing-actions").show()}}e("#post-status-display").html(e("option:selected",p).text());if(e("option:selected",p).val()=="private"||e("option:selected",p).val()=="publish"){e("#save-post").hide()}else{e("#save-post").show();if(e("option:selected",p).val()=="pending"){e("#save-post").show().val(postL10n.savePending)}else{e("#save-post").show().val(postL10n.saveDraft)}}return true}e(".edit-visibility","#visibility").click(function(){if(e("#post-visibility-select").is(":hidden")){d();e("#post-visibility-select").slideDown("normal");e(this).hide()}return false});e(".cancel-post-visibility","#post-visibility-select").click(function(){e("#post-visibility-select").slideUp("normal");e("#visibility-radio-"+e("#hidden-post-visibility").val()).attr("checked",true);e("#post_password").val(e("#hidden_post_password").val());e("#sticky").attr("checked",e("#hidden-post-sticky").attr("checked"));e("#post-visibility-display").html(a);e(".edit-visibility","#visibility").show();c();return false});e(".save-post-visibility","#post-visibility-select").click(function(){var g=e("#post-visibility-select");g.slideUp("normal");e(".edit-visibility","#visibility").show();c();if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false)}if(true==e("#sticky").attr("checked")){f="Sticky"}else{f=""}e("#post-visibility-display").html(postL10n[e("input:radio:checked",g).val()+f]);return false});e("input:radio","#post-visibility-select").change(function(){d()});e("#timestampdiv").siblings("a.edit-timestamp").click(function(){if(e("#timestampdiv").is(":hidden")){e("#timestampdiv").slideDown("normal");e(this).hide()}return false});e(".cancel-timestamp","#timestampdiv").click(function(){e("#timestampdiv").slideUp("normal");e("#mm").val(e("#hidden_mm").val());e("#jj").val(e("#hidden_jj").val());e("#aa").val(e("#hidden_aa").val());e("#hh").val(e("#hidden_hh").val());e("#mn").val(e("#hidden_mn").val());e("#timestampdiv").siblings("a.edit-timestamp").show();c();return false});e(".save-timestamp","#timestampdiv").click(function(){if(c()){e("#timestampdiv").slideUp("normal");e("#timestampdiv").siblings("a.edit-timestamp").show()}return false});e("#post-status-select").siblings("a.edit-post-status").click(function(){if(e("#post-status-select").is(":hidden")){e("#post-status-select").slideDown("normal");e(this).hide()}return false});e(".save-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post-status-select").siblings("a.edit-post-status").show();c();return false});e(".cancel-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post_status").val(e("#hidden_post_status").val());e("#post-status-select").siblings("a.edit-post-status").show();c();return false})}if(e("#edit-slug-box").length){editPermalink=function(g){var h,l=0,k=e("#editable-post-name"),m=k.html(),p=e("#post_name"),q=p.val(),n=e("#edit-slug-buttons"),o=n.html(),j=e("#editable-post-name-full").html();e("#view-post-btn").hide();n.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");n.children(".save").click(function(){var i=k.children("input").val();e.post(ajaxurl,{action:"sample-permalink",post_id:g,new_slug:i,new_title:e("#title").val(),samplepermalinknonce:e("#samplepermalinknonce").val()},function(r){e("#edit-slug-box").html(r);n.html(o);p.attr("value",i);makeSlugeditClickable();e("#view-post-btn").show()});return false});e(".cancel","#edit-slug-buttons").click(function(){e("#view-post-btn").show();k.html(m);n.html(o);p.attr("value",q);return false});for(h=0;h<j.length;++h){if("%"==j.charAt(h)){l++}}slug_value=(l>j.length/4)?"":j;k.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(r){var i=r.keyCode||0;if(13==i){n.children(".save").click();return false}if(27==i){n.children(".cancel").click();return false}p.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){e("#editable-post-name").click(function(){e("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}if(e("#title").val()==""){e("#title").siblings("#title-prompt-text").css("visibility","")}e("#title-prompt-text").click(function(){e(this).css("visibility","hidden").siblings("#title").focus()});e("#title").blur(function(){if(this.value==""){e(this).siblings("#title-prompt-text").css("visibility","")}}).focus(function(){e(this).siblings("#title-prompt-text").css("visibility","hidden")}).keydown(function(g){e(this).siblings("#title-prompt-text").css("visibility","hidden");e(this).unbind(g)})});
10574 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/10574/1b2405d5677e2253b61d467d0e5288556f7b1146/post.js/clean/wp-admin/js/post.js
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(a){var out=[];jQuery.each(a,function(key,val){val=jQuery.trim(val);if(val&&jQuery.inArray(val,out)==-1){out.push(val)}});return out}(function($){tagBox={clean:function(tags){return tags.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(el){var id=el.id,num=id.split("-check-num-")[1],taxbox=$(el).closest(".tagsdiv"),thetags=taxbox.find(".the-tags"),current_tags=thetags.val().split(","),new_tags=[];delete current_tags[num];$.each(current_tags,function(key,val){val=$.trim(val);if(val){new_tags.push(val)}});thetags.val(this.clean(new_tags.join(",")));this.quickClicks(taxbox);return false},quickClicks:function(el){var thetags=$(".the-tags",el),tagchecklist=$(".tagchecklist",el),current_tags;if(!thetags.length){return}var disabled=thetags.attr("disabled");current_tags=thetags.val().split(",");tagchecklist.empty();$.each(current_tags,function(key,val){var txt,button_id,id=$(el).attr("id");val=$.trim(val);if(!val.match(/^\s+$/)&&""!=val){button_id=id+"-check-num-"+key;if(disabled){txt="<span>"+val+"</span> "}else{txt='<span><a id="'+button_id+'" class="ntdelbutton">X</a>&nbsp;'+val+"</span> "}tagchecklist.append(txt);if(!disabled){$("#"+button_id).click(function(){tagBox.parseTags(this)})}}})},flushTags:function(el,a,f){a=a||false;var text,tags=$(".the-tags",el),newtag=$("input.newtag",el),newtags;text=a?$(a).text():newtag.val();tagsval=tags.val();newtags=tagsval?tagsval+","+text:text;newtags=this.clean(newtags);newtags=array_unique_noempty(newtags.split(",")).join(",");tags.val(newtags);this.quickClicks(el);if(!a){newtag.val("")}if("undefined"==typeof(f)){newtag.focus()}return false},get:function(id){var tax=id.substr(id.indexOf("-")+1);$.post(ajaxurl,{action:"get-tagcloud",tax:tax},function(r,stat){if(0==r||"success"!=stat){r=wpAjax.broken}r=$('<p id="tagcloud-'+tax+'" class="the-tagcloud">'+r+"</p>");$("a",r).click(function(){tagBox.flushTags($(this).closest(".inside").children(".tagsdiv"),this);return false});$("#"+id).after(r)})},init:function(){var t=this,ajaxtag=$("div.ajaxtag");$(".tagsdiv").each(function(){tagBox.quickClicks(this)});$("input.tagadd",ajaxtag).click(function(){t.flushTags($(this).closest(".tagsdiv"))});$("div.taghint",ajaxtag).click(function(){$(this).css("visibility","hidden").siblings(".newtag").focus()});$("input.newtag",ajaxtag).blur(function(){if(this.value==""){$(this).siblings(".taghint").css("visibility","")}}).focus(function(){$(this).siblings(".taghint").css("visibility","hidden")}).keyup(function(e){if(13==e.which){tagBox.flushTags($(this).closest(".tagsdiv"));return false}}).keypress(function(e){if(13==e.which){e.preventDefault();return false}}).each(function(){var tax=$(this).closest("div.tagsdiv").attr("id");$(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+tax,{delay:500,minchars:2,multiple:true,multipleSep:","})});$("#post").submit(function(){$("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});$("a.tagcloud-link").click(function(){tagBox.get($(this).attr("id"));$(this).unbind().click(function(){$(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(total,num){var st=this.st,data;if(!num){num=20}this.st+=num;this.total=total;$("#commentsdiv img.waiting").show();data={action:"get-comments",mode:"single",_ajax_nonce:$("#add_comment_nonce").val(),post_ID:$("#post_ID").val(),start:st,num:num};$.post(ajaxurl,data,function(r){r=wpAjax.parseAjaxResponse(r);$("#commentsdiv .widefat").show();$("#commentsdiv img.waiting").hide();if("object"==typeof r&&r.responses[0]){$("#the-comment-list").append(r.responses[0].data);theList=theExtraList=null;$("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){$("#show-comments").hide()}else{$("#show-comments").html(postL10n.showcomm)}return}else{if(1==r){$("#show-comments").parent().html(postL10n.endcomm);return}}$("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(html){$(".inside","#postimagediv").html(html)};WPSetThumbnailID=function(id){var field=$("input[value=_thumbnail_id]","#list-table");if(field.size()>0){$("#meta\\["+field.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(id)}};WPRemoveThumbnail=function(){$.post(ajaxurl,{action:"set-post-thumbnail",post_id:$("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(str){if(str=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(str)}})}})(jQuery);jQuery(document).ready(function($){var stamp,visibility,sticky="";postboxes.add_postbox_toggles(pagenow);if($("#tagsdiv-post_tag").length){tagBox.init()}else{$("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}$(".categorydiv").each(function(){var this_id=$(this).attr("id"),noSyncChecks=false,syncChecks,catAddAfter,taxonomyParts,taxonomy,settingName;taxonomyParts=this_id.split("-");taxonomyParts.shift();taxonomy=taxonomyParts.join("-");settingName=taxonomy+"_tab";if(taxonomy=="category"){settingName="cats"}$("a","#"+taxonomy+"-tabs").click(function(){var t=$(this).attr("href");$(this).parent().addClass("tabs").siblings("li").removeClass("tabs");$("#"+taxonomy+"-tabs").siblings(".tabs-panel").hide();$(t).show();if("#"+taxonomy+"-all"==t){deleteUserSetting(settingName)}else{setUserSetting(settingName,"pop")}return false});if(getUserSetting(settingName)){$('a[href="#'+taxonomy+'-pop"]',"#"+taxonomy+"-tabs").click()}$("#new"+taxonomy).one("focus",function(){$(this).val("").removeClass("form-input-tip")});$("#"+taxonomy+"-add-submit").click(function(){$("#new"+taxonomy).focus()});syncChecks=function(){if(noSyncChecks){return}noSyncChecks=true;var th=jQuery(this),c=th.is(":checked"),id=th.val().toString();$("#in-"+taxonomy+"-"+id+", #in-"+taxonomy+"-category-"+id).attr("checked",c);noSyncChecks=false};catAddBefore=function(s){if(!$("#new"+taxonomy).val()){return false}s.data+="&"+$(":checked","#"+taxonomy+"checklist").serialize();return s};catAddAfter=function(r,s){var sup,drop=$("#new"+taxonomy+"_parent");if("undefined"!=s.parsed.responses[0]&&(sup=s.parsed.responses[0].supplemental.newcat_parent)){drop.before(sup);drop.remove()}};$("#"+taxonomy+"checklist").wpList({alt:"",response:taxonomy+"-ajax-response",addBefore:catAddBefore,addAfter:catAddAfter});$("#"+taxonomy+"-add-toggle").click(function(){$("#"+taxonomy+"-adder").toggleClass("wp-hidden-children");$('a[href="#'+taxonomy+'-all"]',"#"+taxonomy+"-tabs").click();return false});$("#"+taxonomy+"checklist li.popular-category :checkbox, #"+taxonomy+"checklist-pop :checkbox").live("click",function(){var t=$(this),c=t.is(":checked"),id=t.val();if(id&&t.parents("#taxonomy-"+taxonomy).length){$("#in-"+taxonomy+"-"+id+", #in-popular-"+taxonomy+"-"+id).attr("checked",c)}})});if($("#postcustom").length){$("#the-list").wpList({addAfter:function(xml,s){$("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(s.parsed.responses[0].supplemental.postid)}},addBefore:function(s){s.data+="&post_id="+$("#post_ID").val();return s}})}if($("#submitdiv").length){stamp=$("#timestamp").html();visibility=$("#post-visibility-display").html();function updateVisibility(){var pvSelect=$("#post-visibility-select");if($("input:radio:checked",pvSelect).val()!="public"){$("#sticky").attr("checked",false);$("#sticky-span").hide()}else{$("#sticky-span").show()}if($("input:radio:checked",pvSelect).val()!="password"){$("#password-span").hide()}else{$("#password-span").show()}}function updateText(){var attemptedDate,originalDate,currentDate,publishOn,page="page"==pagenow||"page-new"==pagenow,postStatus=$("#post_status"),optPublish=$("option[value=publish]",postStatus),aa=$("#aa").val(),mm=$("#mm").val(),jj=$("#jj").val(),hh=$("#hh").val(),mn=$("#mn").val();attemptedDate=new Date(aa,mm-1,jj,hh,mn);originalDate=new Date($("#hidden_aa").val(),$("#hidden_mm").val()-1,$("#hidden_jj").val(),$("#hidden_hh").val(),$("#hidden_mn").val());currentDate=new Date($("#cur_aa").val(),$("#cur_mm").val()-1,$("#cur_jj").val(),$("#cur_hh").val(),$("#cur_mn").val());if(attemptedDate.getFullYear()!=aa||(1+attemptedDate.getMonth())!=mm||attemptedDate.getDate()!=jj||attemptedDate.getMinutes()!=mn){$(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{$(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(attemptedDate>currentDate&&$("#original_post_status").val()!="future"){publishOn=postL10n.publishOnFuture;$("#publish").val(postL10n.schedule)}else{if(attemptedDate<=currentDate&&$("#original_post_status").val()!="publish"){publishOn=postL10n.publishOn;$("#publish").val(postL10n.publish)}else{publishOn=postL10n.publishOnPast;if(page){$("#publish").val(postL10n.updatePage)}else{$("#publish").val(postL10n.updatePost)}}}if(originalDate.toUTCString()==attemptedDate.toUTCString()){$("#timestamp").html(stamp)}else{$("#timestamp").html(publishOn+" <b>"+$("option[value="+$("#mm").val()+"]","#mm").text()+" "+jj+", "+aa+" @ "+hh+":"+mn+"</b> ")}if($("input:radio:checked","#post-visibility-select").val()=="private"){if(page){$("#publish").val(postL10n.updatePage)}else{$("#publish").val(postL10n.updatePost)}if(optPublish.length==0){postStatus.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{optPublish.html(postL10n.privatelyPublished)}$("option[value=publish]",postStatus).attr("selected",true);$(".edit-post-status","#misc-publishing-actions").hide()}else{if($("#original_post_status").val()=="future"||$("#original_post_status").val()=="draft"){if(optPublish.length){optPublish.remove();postStatus.val($("#hidden_post_status").val())}}else{optPublish.html(postL10n.published)}if(postStatus.is(":hidden")){$(".edit-post-status","#misc-publishing-actions").show()}}$("#post-status-display").html($("option:selected",postStatus).text());if($("option:selected",postStatus).val()=="private"||$("option:selected",postStatus).val()=="publish"){$("#save-post").hide()}else{$("#save-post").show();if($("option:selected",postStatus).val()=="pending"){$("#save-post").show().val(postL10n.savePending)}else{$("#save-post").show().val(postL10n.saveDraft)}}return true}$(".edit-visibility","#visibility").click(function(){if($("#post-visibility-select").is(":hidden")){updateVisibility();$("#post-visibility-select").slideDown("normal");$(this).hide()}return false});$(".cancel-post-visibility","#post-visibility-select").click(function(){$("#post-visibility-select").slideUp("normal");$("#visibility-radio-"+$("#hidden-post-visibility").val()).attr("checked",true);$("#post_password").val($("#hidden_post_password").val());$("#sticky").attr("checked",$("#hidden-post-sticky").attr("checked"));$("#post-visibility-display").html(visibility);$(".edit-visibility","#visibility").show();updateText();return false});$(".save-post-visibility","#post-visibility-select").click(function(){var pvSelect=$("#post-visibility-select");pvSelect.slideUp("normal");$(".edit-visibility","#visibility").show();updateText();if($("input:radio:checked",pvSelect).val()!="public"){$("#sticky").attr("checked",false)}if(true==$("#sticky").attr("checked")){sticky="Sticky"}else{sticky=""}$("#post-visibility-display").html(postL10n[$("input:radio:checked",pvSelect).val()+sticky]);return false});$("input:radio","#post-visibility-select").change(function(){updateVisibility()});$("#timestampdiv").siblings("a.edit-timestamp").click(function(){if($("#timestampdiv").is(":hidden")){$("#timestampdiv").slideDown("normal");$(this).hide()}return false});$(".cancel-timestamp","#timestampdiv").click(function(){$("#timestampdiv").slideUp("normal");$("#mm").val($("#hidden_mm").val());$("#jj").val($("#hidden_jj").val());$("#aa").val($("#hidden_aa").val());$("#hh").val($("#hidden_hh").val());$("#mn").val($("#hidden_mn").val());$("#timestampdiv").siblings("a.edit-timestamp").show();updateText();return false});$(".save-timestamp","#timestampdiv").click(function(){if(updateText()){$("#timestampdiv").slideUp("normal");$("#timestampdiv").siblings("a.edit-timestamp").show()}return false});$("#post-status-select").siblings("a.edit-post-status").click(function(){if($("#post-status-select").is(":hidden")){$("#post-status-select").slideDown("normal");$(this).hide()}return false});$(".save-post-status","#post-status-select").click(function(){$("#post-status-select").slideUp("normal");$("#post-status-select").siblings("a.edit-post-status").show();updateText();return false});$(".cancel-post-status","#post-status-select").click(function(){$("#post-status-select").slideUp("normal");$("#post_status").val($("#hidden_post_status").val());$("#post-status-select").siblings("a.edit-post-status").show();updateText();return false})}if($("#edit-slug-box").length){editPermalink=function(post_id){var i,c=0,e=$("#editable-post-name"),revert_e=e.html(),real_slug=$("#post_name"),revert_slug=real_slug.val(),b=$("#edit-slug-buttons"),revert_b=b.html(),full=$("#editable-post-name-full").html();$("#view-post-btn").hide();b.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");b.children(".save").click(function(){var new_slug=e.children("input").val();$.post(ajaxurl,{action:"sample-permalink",post_id:post_id,new_slug:new_slug,new_title:$("#title").val(),samplepermalinknonce:$("#samplepermalinknonce").val()},function(data){$("#edit-slug-box").html(data);b.html(revert_b);real_slug.attr("value",new_slug);makeSlugeditClickable();$("#view-post-btn").show()});return false});$(".cancel","#edit-slug-buttons").click(function(){$("#view-post-btn").show();e.html(revert_e);b.html(revert_b);real_slug.attr("value",revert_slug);return false});for(i=0;i<full.length;++i){if("%"==full.charAt(i)){c++}}slug_value=(c>full.length/4)?"":full;e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(e){var key=e.keyCode||0;if(13==key){b.children(".save").click();return false}if(27==key){b.children(".cancel").click();return false}real_slug.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){$("#editable-post-name").click(function(){$("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}if($("#title").val()==""){$("#title").siblings("#title-prompt-text").css("visibility","")}$("#title-prompt-text").click(function(){$(this).css("visibility","hidden").siblings("#title").focus()});$("#title").blur(function(){if(this.value==""){$(this).siblings("#title-prompt-text").css("visibility","")}}).focus(function(){$(this).siblings("#title-prompt-text").css("visibility","hidden")}).keydown(function(e){$(this).siblings("#title-prompt-text").css("visibility","hidden");$(this).unbind(e)})});
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(a){var out=[];jQuery.each(a,function(key,val){val=jQuery.trim(val);if(val&&jQuery.inArray(val,out)==-1){out.push(val)}});return out}(function($){tagBox={clean:function(tags){return tags.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(el){var id=el.id,num=id.split("-check-num-")[1],taxbox=$(el).closest(".tagsdiv"),thetags=taxbox.find(".the-tags"),current_tags=thetags.val().split(","),new_tags=[];delete current_tags[num];$.each(current_tags,function(key,val){val=$.trim(val);if(val){new_tags.push(val)}});thetags.val(this.clean(new_tags.join(",")));this.quickClicks(taxbox);return false},quickClicks:function(el){var thetags=$(".the-tags",el),tagchecklist=$(".tagchecklist",el),current_tags;if(!thetags.length){return}var disabled=thetags.attr("disabled");current_tags=thetags.val().split(",");tagchecklist.empty();$.each(current_tags,function(key,val){var txt,button_id,id=$(el).attr("id");val=$.trim(val);if(!val.match(/^\s+$/)&&""!=val){button_id=id+"-check-num-"+key;if(disabled){txt="<span>"+val+"</span> "}else{txt='<span><a id="'+button_id+'" class="ntdelbutton">X</a>&nbsp;'+val+"</span> "}tagchecklist.append(txt);if(!disabled){$("#"+button_id).click(function(){tagBox.parseTags(this)})}}})},flushTags:function(el,a,f){a=a||false;var text,tags=$(".the-tags",el),newtag=$("input.newtag",el),newtags;text=a?$(a).text():newtag.val();tagsval=tags.val();newtags=tagsval?tagsval+","+text:text;newtags=this.clean(newtags);newtags=array_unique_noempty(newtags.split(",")).join(",");tags.val(newtags);this.quickClicks(el);if(!a){newtag.val("")}if("undefined"==typeof(f)){newtag.focus()}return false},get:function(id){var tax=id.substr(id.indexOf("-")+1);$.post(ajaxurl,{action:"get-tagcloud",tax:tax},function(r,stat){if(0==r||"success"!=stat){r=wpAjax.broken}r=$('<p id="tagcloud-'+tax+'" class="the-tagcloud">'+r+"</p>");$("a",r).click(function(){tagBox.flushTags($(this).closest(".inside").children(".tagsdiv"),this);return false});$("#"+id).after(r)})},init:function(){var t=this,ajaxtag=$("div.ajaxtag");$(".tagsdiv").each(function(){tagBox.quickClicks(this)});$("input.tagadd",ajaxtag).click(function(){t.flushTags($(this).closest(".tagsdiv"))});$("div.taghint",ajaxtag).click(function(){$(this).css("visibility","hidden").parent().siblings(".newtag").focus()});$("input.newtag",ajaxtag).blur(function(){if(this.value==""){$(this).parent().siblings(".taghint").css("visibility","")}}).focus(function(){$(this).parent().siblings(".taghint").css("visibility","hidden")}).keyup(function(e){if(13==e.which){tagBox.flushTags($(this).closest(".tagsdiv"));return false}}).keypress(function(e){if(13==e.which){e.preventDefault();return false}}).each(function(){var tax=$(this).closest("div.tagsdiv").attr("id");$(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+tax,{delay:500,minchars:2,multiple:true,multipleSep:","})});$("#post").submit(function(){$("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});$("a.tagcloud-link").click(function(){tagBox.get($(this).attr("id"));$(this).unbind().click(function(){$(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(total,num){var st=this.st,data;if(!num){num=20}this.st+=num;this.total=total;$("#commentsdiv img.waiting").show();data={action:"get-comments",mode:"single",_ajax_nonce:$("#add_comment_nonce").val(),post_ID:$("#post_ID").val(),start:st,num:num};$.post(ajaxurl,data,function(r){r=wpAjax.parseAjaxResponse(r);$("#commentsdiv .widefat").show();$("#commentsdiv img.waiting").hide();if("object"==typeof r&&r.responses[0]){$("#the-comment-list").append(r.responses[0].data);theList=theExtraList=null;$("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){$("#show-comments").hide()}else{$("#show-comments").html(postL10n.showcomm)}return}else{if(1==r){$("#show-comments").parent().html(postL10n.endcomm);return}}$("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(html){$(".inside","#postimagediv").html(html)};WPSetThumbnailID=function(id){var field=$("input[value=_thumbnail_id]","#list-table");if(field.size()>0){$("#meta\\["+field.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(id)}};WPRemoveThumbnail=function(){$.post(ajaxurl,{action:"set-post-thumbnail",post_id:$("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(str){if(str=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(str)}})}})(jQuery);jQuery(document).ready(function($){var stamp,visibility,sticky="";postboxes.add_postbox_toggles(pagenow);if($("#tagsdiv-post_tag").length){tagBox.init()}else{$("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}$(".categorydiv").each(function(){var this_id=$(this).attr("id"),noSyncChecks=false,syncChecks,catAddAfter,taxonomyParts,taxonomy,settingName;taxonomyParts=this_id.split("-");taxonomyParts.shift();taxonomy=taxonomyParts.join("-");settingName=taxonomy+"_tab";if(taxonomy=="category"){settingName="cats"}$("a","#"+taxonomy+"-tabs").click(function(){var t=$(this).attr("href");$(this).parent().addClass("tabs").siblings("li").removeClass("tabs");$("#"+taxonomy+"-tabs").siblings(".tabs-panel").hide();$(t).show();if("#"+taxonomy+"-all"==t){deleteUserSetting(settingName)}else{setUserSetting(settingName,"pop")}return false});if(getUserSetting(settingName)){$('a[href="#'+taxonomy+'-pop"]',"#"+taxonomy+"-tabs").click()}$("#new"+taxonomy).one("focus",function(){$(this).val("").removeClass("form-input-tip")});$("#"+taxonomy+"-add-submit").click(function(){$("#new"+taxonomy).focus()});syncChecks=function(){if(noSyncChecks){return}noSyncChecks=true;var th=jQuery(this),c=th.is(":checked"),id=th.val().toString();$("#in-"+taxonomy+"-"+id+", #in-"+taxonomy+"-category-"+id).attr("checked",c);noSyncChecks=false};catAddBefore=function(s){if(!$("#new"+taxonomy).val()){return false}s.data+="&"+$(":checked","#"+taxonomy+"checklist").serialize();return s};catAddAfter=function(r,s){var sup,drop=$("#new"+taxonomy+"_parent");if("undefined"!=s.parsed.responses[0]&&(sup=s.parsed.responses[0].supplemental.newcat_parent)){drop.before(sup);drop.remove()}};$("#"+taxonomy+"checklist").wpList({alt:"",response:taxonomy+"-ajax-response",addBefore:catAddBefore,addAfter:catAddAfter});$("#"+taxonomy+"-add-toggle").click(function(){$("#"+taxonomy+"-adder").toggleClass("wp-hidden-children");$('a[href="#'+taxonomy+'-all"]',"#"+taxonomy+"-tabs").click();return false});$("#"+taxonomy+"checklist li.popular-category :checkbox, #"+taxonomy+"checklist-pop :checkbox").live("click",function(){var t=$(this),c=t.is(":checked"),id=t.val();if(id&&t.parents("#taxonomy-"+taxonomy).length){$("#in-"+taxonomy+"-"+id+", #in-popular-"+taxonomy+"-"+id).attr("checked",c)}})});if($("#postcustom").length){$("#the-list").wpList({addAfter:function(xml,s){$("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(s.parsed.responses[0].supplemental.postid)}},addBefore:function(s){s.data+="&post_id="+$("#post_ID").val();return s}})}if($("#submitdiv").length){stamp=$("#timestamp").html();visibility=$("#post-visibility-display").html();function updateVisibility(){var pvSelect=$("#post-visibility-select");if($("input:radio:checked",pvSelect).val()!="public"){$("#sticky").attr("checked",false);$("#sticky-span").hide()}else{$("#sticky-span").show()}if($("input:radio:checked",pvSelect).val()!="password"){$("#password-span").hide()}else{$("#password-span").show()}}function updateText(){var attemptedDate,originalDate,currentDate,publishOn,page="page"==pagenow||"page-new"==pagenow,postStatus=$("#post_status"),optPublish=$("option[value=publish]",postStatus),aa=$("#aa").val(),mm=$("#mm").val(),jj=$("#jj").val(),hh=$("#hh").val(),mn=$("#mn").val();attemptedDate=new Date(aa,mm-1,jj,hh,mn);originalDate=new Date($("#hidden_aa").val(),$("#hidden_mm").val()-1,$("#hidden_jj").val(),$("#hidden_hh").val(),$("#hidden_mn").val());currentDate=new Date($("#cur_aa").val(),$("#cur_mm").val()-1,$("#cur_jj").val(),$("#cur_hh").val(),$("#cur_mn").val());if(attemptedDate.getFullYear()!=aa||(1+attemptedDate.getMonth())!=mm||attemptedDate.getDate()!=jj||attemptedDate.getMinutes()!=mn){$(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{$(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(attemptedDate>currentDate&&$("#original_post_status").val()!="future"){publishOn=postL10n.publishOnFuture;$("#publish").val(postL10n.schedule)}else{if(attemptedDate<=currentDate&&$("#original_post_status").val()!="publish"){publishOn=postL10n.publishOn;$("#publish").val(postL10n.publish)}else{publishOn=postL10n.publishOnPast;if(page){$("#publish").val(postL10n.updatePage)}else{$("#publish").val(postL10n.updatePost)}}}if(originalDate.toUTCString()==attemptedDate.toUTCString()){$("#timestamp").html(stamp)}else{$("#timestamp").html(publishOn+" <b>"+$("option[value="+$("#mm").val()+"]","#mm").text()+" "+jj+", "+aa+" @ "+hh+":"+mn+"</b> ")}if($("input:radio:checked","#post-visibility-select").val()=="private"){if(page){$("#publish").val(postL10n.updatePage)}else{$("#publish").val(postL10n.updatePost)}if(optPublish.length==0){postStatus.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{optPublish.html(postL10n.privatelyPublished)}$("option[value=publish]",postStatus).attr("selected",true);$(".edit-post-status","#misc-publishing-actions").hide()}else{if($("#original_post_status").val()=="future"||$("#original_post_status").val()=="draft"){if(optPublish.length){optPublish.remove();postStatus.val($("#hidden_post_status").val())}}else{optPublish.html(postL10n.published)}if(postStatus.is(":hidden")){$(".edit-post-status","#misc-publishing-actions").show()}}$("#post-status-display").html($("option:selected",postStatus).text());if($("option:selected",postStatus).val()=="private"||$("option:selected",postStatus).val()=="publish"){$("#save-post").hide()}else{$("#save-post").show();if($("option:selected",postStatus).val()=="pending"){$("#save-post").show().val(postL10n.savePending)}else{$("#save-post").show().val(postL10n.saveDraft)}}return true}$(".edit-visibility","#visibility").click(function(){if($("#post-visibility-select").is(":hidden")){updateVisibility();$("#post-visibility-select").slideDown("normal");$(this).hide()}return false});$(".cancel-post-visibility","#post-visibility-select").click(function(){$("#post-visibility-select").slideUp("normal");$("#visibility-radio-"+$("#hidden-post-visibility").val()).attr("checked",true);$("#post_password").val($("#hidden_post_password").val());$("#sticky").attr("checked",$("#hidden-post-sticky").attr("checked"));$("#post-visibility-display").html(visibility);$(".edit-visibility","#visibility").show();updateText();return false});$(".save-post-visibility","#post-visibility-select").click(function(){var pvSelect=$("#post-visibility-select");pvSelect.slideUp("normal");$(".edit-visibility","#visibility").show();updateText();if($("input:radio:checked",pvSelect).val()!="public"){$("#sticky").attr("checked",false)}if(true==$("#sticky").attr("checked")){sticky="Sticky"}else{sticky=""}$("#post-visibility-display").html(postL10n[$("input:radio:checked",pvSelect).val()+sticky]);return false});$("input:radio","#post-visibility-select").change(function(){updateVisibility()});$("#timestampdiv").siblings("a.edit-timestamp").click(function(){if($("#timestampdiv").is(":hidden")){$("#timestampdiv").slideDown("normal");$(this).hide()}return false});$(".cancel-timestamp","#timestampdiv").click(function(){$("#timestampdiv").slideUp("normal");$("#mm").val($("#hidden_mm").val());$("#jj").val($("#hidden_jj").val());$("#aa").val($("#hidden_aa").val());$("#hh").val($("#hidden_hh").val());$("#mn").val($("#hidden_mn").val());$("#timestampdiv").siblings("a.edit-timestamp").show();updateText();return false});$(".save-timestamp","#timestampdiv").click(function(){if(updateText()){$("#timestampdiv").slideUp("normal");$("#timestampdiv").siblings("a.edit-timestamp").show()}return false});$("#post-status-select").siblings("a.edit-post-status").click(function(){if($("#post-status-select").is(":hidden")){$("#post-status-select").slideDown("normal");$(this).hide()}return false});$(".save-post-status","#post-status-select").click(function(){$("#post-status-select").slideUp("normal");$("#post-status-select").siblings("a.edit-post-status").show();updateText();return false});$(".cancel-post-status","#post-status-select").click(function(){$("#post-status-select").slideUp("normal");$("#post_status").val($("#hidden_post_status").val());$("#post-status-select").siblings("a.edit-post-status").show();updateText();return false})}if($("#edit-slug-box").length){editPermalink=function(post_id){var i,c=0,e=$("#editable-post-name"),revert_e=e.html(),real_slug=$("#post_name"),revert_slug=real_slug.val(),b=$("#edit-slug-buttons"),revert_b=b.html(),full=$("#editable-post-name-full").html();$("#view-post-btn").hide();b.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");b.children(".save").click(function(){var new_slug=e.children("input").val();$.post(ajaxurl,{action:"sample-permalink",post_id:post_id,new_slug:new_slug,new_title:$("#title").val(),samplepermalinknonce:$("#samplepermalinknonce").val()},function(data){$("#edit-slug-box").html(data);b.html(revert_b);real_slug.attr("value",new_slug);makeSlugeditClickable();$("#view-post-btn").show()});return false});$(".cancel","#edit-slug-buttons").click(function(){$("#view-post-btn").show();e.html(revert_e);b.html(revert_b);real_slug.attr("value",revert_slug);return false});for(i=0;i<full.length;++i){if("%"==full.charAt(i)){c++}}slug_value=(c>full.length/4)?"":full;e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(e){var key=e.keyCode||0;if(13==key){b.children(".save").click();return false}if(27==key){b.children(".cancel").click();return false}real_slug.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){$("#editable-post-name").click(function(){$("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}if($("#title").val()==""){$("#title").siblings("#title-prompt-text").css("visibility","")}$("#title-prompt-text").click(function(){$(this).css("visibility","hidden").siblings("#title").focus()});$("#title").blur(function(){if(this.value==""){$(this).siblings("#title-prompt-text").css("visibility","")}}).focus(function(){$(this).siblings("#title-prompt-text").css("visibility","hidden")}).keydown(function(e){$(this).siblings("#title-prompt-text").css("visibility","hidden");$(this).unbind(e)})});
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(a){var out=[];jQuery.each(a,function(key,val){val=jQuery.trim(val);if(val&&jQuery.inArray(val,out)==-1){out.push(val)}});return out}(function($){tagBox={clean:function(tags){return tags.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(el){var id=el.id,num=id.split("-check-num-")[1],taxbox=$(el).closest(".tagsdiv"),thetags=taxbox.find(".the-tags"),current_tags=thetags.val().split(","),new_tags=[];delete current_tags[num];$.each(current_tags,function(key,val){val=$.trim(val);if(val){new_tags.push(val)}});thetags.val(this.clean(new_tags.join(",")));this.quickClicks(taxbox);return false},quickClicks:function(el){var thetags=$(".the-tags",el),tagchecklist=$(".tagchecklist",el),current_tags;if(!thetags.length){return}var disabled=thetags.attr("disabled");current_tags=thetags.val().split(",");tagchecklist.empty();$.each(current_tags,function(key,val){var txt,button_id,id=$(el).attr("id");val=$.trim(val);if(!val.match(/^\s+$/)&&""!=val){button_id=id+"-check-num-"+key;if(disabled){txt="<span>"+val+"</span> "}else{txt='<span><a id="'+button_id+'" class="ntdelbutton">X</a>&nbsp;'+val+"</span> "}tagchecklist.append(txt);if(!disabled){$("#"+button_id).click(function(){tagBox.parseTags(this)})}}})},flushTags:function(el,a,f){a=a||false;var text,tags=$(".the-tags",el),newtag=$("input.newtag",el),newtags;text=a?$(a).text():newtag.val();tagsval=tags.val();newtags=tagsval?tagsval+","+text:text;newtags=this.clean(newtags);newtags=array_unique_noempty(newtags.split(",")).join(",");tags.val(newtags);this.quickClicks(el);if(!a){newtag.val("")}if("undefined"==typeof(f)){newtag.focus()}return false},get:function(id){var tax=id.substr(id.indexOf("-")+1);$.post(ajaxurl,{action:"get-tagcloud",tax:tax},function(r,stat){if(0==r||"success"!=stat){r=wpAjax.broken}r=$('<p id="tagcloud-'+tax+'" class="the-tagcloud">'+r+"</p>");$("a",r).click(function(){tagBox.flushTags($(this).closest(".inside").children(".tagsdiv"),this);return false});$("#"+id).after(r)})},init:function(){var t=this,ajaxtag=$("div.ajaxtag");$(".tagsdiv").each(function(){tagBox.quickClicks(this)});$("input.tagadd",ajaxtag).click(function(){t.flushTags($(this).closest(".tagsdiv"))});$("div.taghint",ajaxtag).click(function(){$(this).css("visibility","hidden").siblings(".newtag").focus()});$("input.newtag",ajaxtag).blur(function(){if(this.value==""){$(this).siblings(".taghint").css("visibility","")}}).focus(function(){$(this).siblings(".taghint").css("visibility","hidden")}).keyup(function(e){if(13==e.which){tagBox.flushTags($(this).closest(".tagsdiv"));return false}}).keypress(function(e){if(13==e.which){e.preventDefault();return false}}).each(function(){var tax=$(this).closest("div.tagsdiv").attr("id");$(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+tax,{delay:500,minchars:2,multiple:true,multipleSep:","})});$("#post").submit(function(){$("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});$("a.tagcloud-link").click(function(){tagBox.get($(this).attr("id"));$(this).unbind().click(function(){$(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(total,num){var st=this.st,data;if(!num){num=20}this.st+=num;this.total=total;$("#commentsdiv img.waiting").show();data={action:"get-comments",mode:"single",_ajax_nonce:$("#add_comment_nonce").val(),post_ID:$("#post_ID").val(),start:st,num:num};$.post(ajaxurl,data,function(r){r=wpAjax.parseAjaxResponse(r);$("#commentsdiv .widefat").show();$("#commentsdiv img.waiting").hide();if("object"==typeof r&&r.responses[0]){$("#the-comment-list").append(r.responses[0].data);theList=theExtraList=null;$("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){$("#show-comments").hide()}else{$("#show-comments").html(postL10n.showcomm)}return}else{if(1==r){$("#show-comments").parent().html(postL10n.endcomm);return}}$("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(html){$(".inside","#postimagediv").html(html)};WPSetThumbnailID=function(id){var field=$("input[value=_thumbnail_id]","#list-table");if(field.size()>0){$("#meta\\["+field.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(id)}};WPRemoveThumbnail=function(){$.post(ajaxurl,{action:"set-post-thumbnail",post_id:$("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(str){if(str=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(str)}})}})(jQuery);jQuery(document).ready(function($){var stamp,visibility,sticky="";postboxes.add_postbox_toggles(pagenow);if($("#tagsdiv-post_tag").length){tagBox.init()}else{$("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}$(".categorydiv").each(function(){var this_id=$(this).attr("id"),noSyncChecks=false,syncChecks,catAddAfter,taxonomyParts,taxonomy,settingName;taxonomyParts=this_id.split("-");taxonomyParts.shift();taxonomy=taxonomyParts.join("-");settingName=taxonomy+"_tab";if(taxonomy=="category"){settingName="cats"}$("a","#"+taxonomy+"-tabs").click(function(){var t=$(this).attr("href");$(this).parent().addClass("tabs").siblings("li").removeClass("tabs");$("#"+taxonomy+"-tabs").siblings(".tabs-panel").hide();$(t).show();if("#"+taxonomy+"-all"==t){deleteUserSetting(settingName)}else{setUserSetting(settingName,"pop")}return false});if(getUserSetting(settingName)){$('a[href="#'+taxonomy+'-pop"]',"#"+taxonomy+"-tabs").click()}$("#new"+taxonomy).one("focus",function(){$(this).val("").removeClass("form-input-tip")});$("#"+taxonomy+"-add-submit").click(function(){$("#new"+taxonomy).focus()});syncChecks=function(){if(noSyncChecks){return}noSyncChecks=true;var th=jQuery(this),c=th.is(":checked"),id=th.val().toString();$("#in-"+taxonomy+"-"+id+", #in-"+taxonomy+"-category-"+id).attr("checked",c);noSyncChecks=false};catAddBefore=function(s){if(!$("#new"+taxonomy).val()){return false}s.data+="&"+$(":checked","#"+taxonomy+"checklist").serialize();return s};catAddAfter=function(r,s){var sup,drop=$("#new"+taxonomy+"_parent");if("undefined"!=s.parsed.responses[0]&&(sup=s.parsed.responses[0].supplemental.newcat_parent)){drop.before(sup);drop.remove()}};$("#"+taxonomy+"checklist").wpList({alt:"",response:taxonomy+"-ajax-response",addBefore:catAddBefore,addAfter:catAddAfter});$("#"+taxonomy+"-add-toggle").click(function(){$("#"+taxonomy+"-adder").toggleClass("wp-hidden-children");$('a[href="#'+taxonomy+'-all"]',"#"+taxonomy+"-tabs").click();return false});$("#"+taxonomy+"checklist li.popular-category :checkbox, #"+taxonomy+"checklist-pop :checkbox").live("click",function(){var t=$(this),c=t.is(":checked"),id=t.val();if(id&&t.parents("#taxonomy-"+taxonomy).length){$("#in-"+taxonomy+"-"+id+", #in-popular-"+taxonomy+"-"+id).attr("checked",c)}})});if($("#postcustom").length){$("#the-list").wpList({addAfter:function(xml,s){$("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(s.parsed.responses[0].supplemental.postid)}},addBefore:function(s){s.data+="&post_id="+$("#post_ID").val();return s}})}if($("#submitdiv").length){stamp=$("#timestamp").html();visibility=$("#post-visibility-display").html();function updateVisibility(){var pvSelect=$("#post-visibility-select");if($("input:radio:checked",pvSelect).val()!="public"){$("#sticky").attr("checked",false);$("#sticky-span").hide()}else{$("#sticky-span").show()}if($("input:radio:checked",pvSelect).val()!="password"){$("#password-span").hide()}else{$("#password-span").show()}}function updateText(){var attemptedDate,originalDate,currentDate,publishOn,page="page"==pagenow||"page-new"==pagenow,postStatus=$("#post_status"),optPublish=$("option[value=publish]",postStatus),aa=$("#aa").val(),mm=$("#mm").val(),jj=$("#jj").val(),hh=$("#hh").val(),mn=$("#mn").val();attemptedDate=new Date(aa,mm-1,jj,hh,mn);originalDate=new Date($("#hidden_aa").val(),$("#hidden_mm").val()-1,$("#hidden_jj").val(),$("#hidden_hh").val(),$("#hidden_mn").val());currentDate=new Date($("#cur_aa").val(),$("#cur_mm").val()-1,$("#cur_jj").val(),$("#cur_hh").val(),$("#cur_mn").val());if(attemptedDate.getFullYear()!=aa||(1+attemptedDate.getMonth())!=mm||attemptedDate.getDate()!=jj||attemptedDate.getMinutes()!=mn){$(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{$(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(attemptedDate>currentDate&&$("#original_post_status").val()!="future"){publishOn=postL10n.publishOnFuture;$("#publish").val(postL10n.schedule)}else{if(attemptedDate<=currentDate&&$("#original_post_status").val()!="publish"){publishOn=postL10n.publishOn;$("#publish").val(postL10n.publish)}else{publishOn=postL10n.publishOnPast;if(page){$("#publish").val(postL10n.updatePage)}else{$("#publish").val(postL10n.updatePost)}}}if(originalDate.toUTCString()==attemptedDate.toUTCString()){$("#timestamp").html(stamp)}else{$("#timestamp").html(publishOn+" <b>"+$("option[value="+$("#mm").val()+"]","#mm").text()+" "+jj+", "+aa+" @ "+hh+":"+mn+"</b> ")}if($("input:radio:checked","#post-visibility-select").val()=="private"){if(page){$("#publish").val(postL10n.updatePage)}else{$("#publish").val(postL10n.updatePost)}if(optPublish.length==0){postStatus.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{optPublish.html(postL10n.privatelyPublished)}$("option[value=publish]",postStatus).attr("selected",true);$(".edit-post-status","#misc-publishing-actions").hide()}else{if($("#original_post_status").val()=="future"||$("#original_post_status").val()=="draft"){if(optPublish.length){optPublish.remove();postStatus.val($("#hidden_post_status").val())}}else{optPublish.html(postL10n.published)}if(postStatus.is(":hidden")){$(".edit-post-status","#misc-publishing-actions").show()}}$("#post-status-display").html($("option:selected",postStatus).text());if($("option:selected",postStatus).val()=="private"||$("option:selected",postStatus).val()=="publish"){$("#save-post").hide()}else{$("#save-post").show();if($("option:selected",postStatus).val()=="pending"){$("#save-post").show().val(postL10n.savePending)}else{$("#save-post").show().val(postL10n.saveDraft)}}return true}$(".edit-visibility","#visibility").click(function(){if($("#post-visibility-select").is(":hidden")){updateVisibility();$("#post-visibility-select").slideDown("normal");$(this).hide()}return false});$(".cancel-post-visibility","#post-visibility-select").click(function(){$("#post-visibility-select").slideUp("normal");$("#visibility-radio-"+$("#hidden-post-visibility").val()).attr("checked",true);$("#post_password").val($("#hidden_post_password").val());$("#sticky").attr("checked",$("#hidden-post-sticky").attr("checked"));$("#post-visibility-display").html(visibility);$(".edit-visibility","#visibility").show();updateText();return false});$(".save-post-visibility","#post-visibility-select").click(function(){var pvSelect=$("#post-visibility-select");pvSelect.slideUp("normal");$(".edit-visibility","#visibility").show();updateText();if($("input:radio:checked",pvSelect).val()!="public"){$("#sticky").attr("checked",false)}if(true==$("#sticky").attr("checked")){sticky="Sticky"}else{sticky=""}$("#post-visibility-display").html(postL10n[$("input:radio:checked",pvSelect).val()+sticky]);return false});$("input:radio","#post-visibility-select").change(function(){updateVisibility()});$("#timestampdiv").siblings("a.edit-timestamp").click(function(){if($("#timestampdiv").is(":hidden")){$("#timestampdiv").slideDown("normal");$(this).hide()}return false});$(".cancel-timestamp","#timestampdiv").click(function(){$("#timestampdiv").slideUp("normal");$("#mm").val($("#hidden_mm").val());$("#jj").val($("#hidden_jj").val());$("#aa").val($("#hidden_aa").val());$("#hh").val($("#hidden_hh").val());$("#mn").val($("#hidden_mn").val());$("#timestampdiv").siblings("a.edit-timestamp").show();updateText();return false});$(".save-timestamp","#timestampdiv").click(function(){if(updateText()){$("#timestampdiv").slideUp("normal");$("#timestampdiv").siblings("a.edit-timestamp").show()}return false});$("#post-status-select").siblings("a.edit-post-status").click(function(){if($("#post-status-select").is(":hidden")){$("#post-status-select").slideDown("normal");$(this).hide()}return false});$(".save-post-status","#post-status-select").click(function(){$("#post-status-select").slideUp("normal");$("#post-status-select").siblings("a.edit-post-status").show();updateText();return false});$(".cancel-post-status","#post-status-select").click(function(){$("#post-status-select").slideUp("normal");$("#post_status").val($("#hidden_post_status").val());$("#post-status-select").siblings("a.edit-post-status").show();updateText();return false})}if($("#edit-slug-box").length){editPermalink=function(post_id){var i,c=0,e=$("#editable-post-name"),revert_e=e.html(),real_slug=$("#post_name"),revert_slug=real_slug.val(),b=$("#edit-slug-buttons"),revert_b=b.html(),full=$("#editable-post-name-full").html();$("#view-post-btn").hide();b.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");b.children(".save").click(function(){var new_slug=e.children("input").val();$.post(ajaxurl,{action:"sample-permalink",post_id:post_id,new_slug:new_slug,new_title:$("#title").val(),samplepermalinknonce:$("#samplepermalinknonce").val()},function(data){$("#edit-slug-box").html(data);b.html(revert_b);real_slug.attr("value",new_slug);makeSlugeditClickable();$("#view-post-btn").show()});return false});$(".cancel","#edit-slug-buttons").click(function(){$("#view-post-btn").show();e.html(revert_e);b.html(revert_b);real_slug.attr("value",revert_slug);return false});for(i=0;i<full.length;++i){if("%"==full.charAt(i)){c++}}slug_value=(c>full.length/4)?"":full;e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(e){var key=e.keyCode||0;if(13==key){b.children(".save").click();return false}if(27==key){b.children(".cancel").click();return false}real_slug.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){$("#editable-post-name").click(function(){$("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}if($("#title").val()==""){$("#title").siblings("#title-prompt-text").css("visibility","")}$("#title-prompt-text").click(function(){$(this).css("visibility","hidden").siblings("#title").focus()});$("#title").blur(function(){if(this.value==""){$(this).siblings("#title-prompt-text").css("visibility","")}}).focus(function(){$(this).siblings("#title-prompt-text").css("visibility","hidden")}).keydown(function(e){$(this).siblings("#title-prompt-text").css("visibility","hidden");$(this).unbind(e)})});
10574 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/10574/689a9bed1ba9ed444c2e4895ace34e75d59f01e6/post.js/buggy/wp-admin/js/post.js
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(d){var f=a(".the-tags",d),e=a(".tagchecklist",d),b;if(!f.length){return}var c=f.attr("disabled");b=f.val().split(",");e.empty();a.each(b,function(i,j){var g,h,k=a(d).attr("id");j=a.trim(j);if(!j.match(/^\s+$/)&&""!=j){h=k+"-check-num-"+i;if(c){g="<span>"+j+"</span> "}else{g='<span><a id="'+h+'" class="ntdelbutton">X</a>&nbsp;'+j+"</span> "}e.append(g);if(!c){a("#"+h).click(function(){tagBox.parseTags(this)})}}})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});a("#"+c).after(e)})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").siblings(".newtag").focus()});a("input.newtag",c).blur(function(){if(this.value==""){a(this).siblings(".taghint").css("visibility","")}}).focus(function(){a(this).siblings(".taghint").css("visibility","hidden")}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+d,{delay:500,minchars:2,multiple:true,multipleSep:", "})});a("#post").submit(function(){a("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){tagBox.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(b){a(".inside","#postimagediv").html(b)};WPSetThumbnailID=function(c){var b=a("input[value=_thumbnail_id]","#list-table");if(b.size()>0){a("#meta\\["+b.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(c)}};WPRemoveThumbnail=function(){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(b){if(b=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(b)}})}})(jQuery);jQuery(document).ready(function(e){var b,a,f="";postboxes.add_postbox_toggles(pagenow);if(e("#tagsdiv-post_tag").length){tagBox.init()}else{e("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}e(".categorydiv").each(function(){var l=e(this).attr("id"),h=false,k,m,j,g,i;j=l.split("-");j.shift();g=j.join("-");i=g+"_tab";if(g=="category"){i="cats"}e("a","#"+g+"-tabs").click(function(){var n=e(this).attr("href");e(this).parent().addClass("tabs").siblings("li").removeClass("tabs");e("#"+g+"-tabs").siblings(".tabs-panel").hide();e(n).show();if("#"+g+"-all"==n){deleteUserSetting(i)}else{setUserSetting(i,"pop")}return false});if(getUserSetting(i)){e('a[href="#'+g+'-pop"]',"#"+g+"-tabs").click()}e("#new"+g).one("focus",function(){e(this).val("").removeClass("form-input-tip")});e("#"+g+"-add-submit").click(function(){e("#new"+g).focus()});k=function(){if(h){return}h=true;var n=jQuery(this),p=n.is(":checked"),o=n.val().toString();e("#in-"+g+"-"+o+", #in-"+g+"-category-"+o).attr("checked",p);h=false};catAddBefore=function(n){if(!e("#new"+g).val()){return false}n.data+="&"+e(":checked","#"+g+"checklist").serialize();return n};m=function(q,p){var o,n=e("#new"+g+"_parent");if("undefined"!=p.parsed.responses[0]&&(o=p.parsed.responses[0].supplemental.newcat_parent)){n.before(o);n.remove()}};e("#"+g+"checklist").wpList({alt:"",response:g+"-ajax-response",addBefore:catAddBefore,addAfter:m});e("#"+g+"-add-toggle").click(function(){e("#"+g+"-adder").toggleClass("wp-hidden-children");e('a[href="#'+g+'-all"]',"#"+g+"-tabs").click();return false});e("#"+g+"checklist li.popular-category :checkbox, #"+g+"checklist-pop :checkbox").live("click",function(){var n=e(this),p=n.is(":checked"),o=n.val();if(o&&n.parents("#taxonomy-"+g).length){e("#in-"+g+"-"+o+", #in-popular-"+g+"-"+o).attr("checked",p)}})});if(e("#postcustom").length){e("#the-list").wpList({addAfter:function(g,h){e("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(h.parsed.responses[0].supplemental.postid)}},addBefore:function(g){g.data+="&post_id="+e("#post_ID").val();return g}})}if(e("#submitdiv").length){b=e("#timestamp").html();a=e("#post-visibility-display").html();function d(){var g=e("#post-visibility-select");if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false);e("#sticky-span").hide()}else{e("#sticky-span").show()}if(e("input:radio:checked",g).val()!="password"){e("#password-span").hide()}else{e("#password-span").show()}}function c(){var n,o,h,q,p=e("#post_status"),i=e("option[value=publish]",p),g=e("#aa").val(),l=e("#mm").val(),m=e("#jj").val(),k=e("#hh").val(),j=e("#mn").val();n=new Date(g,l-1,m,k,j);o=new Date(e("#hidden_aa").val(),e("#hidden_mm").val()-1,e("#hidden_jj").val(),e("#hidden_hh").val(),e("#hidden_mn").val());h=new Date(e("#cur_aa").val(),e("#cur_mm").val()-1,e("#cur_jj").val(),e("#cur_hh").val(),e("#cur_mn").val());if(n.getFullYear()!=g||(1+n.getMonth())!=l||n.getDate()!=m||n.getMinutes()!=j){e(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{e(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(n>h&&e("#original_post_status").val()!="future"){q=postL10n.publishOnFuture;e("#publish").val(postL10n.schedule)}else{if(n<=h&&e("#original_post_status").val()!="publish"){q=postL10n.publishOn;e("#publish").val(postL10n.publish)}else{q=postL10n.publishOnPast;if(page){e("#publish").val(postL10n.updatePage)}else{e("#publish").val(postL10n.updatePost)}}}if(o.toUTCString()==n.toUTCString()){e("#timestamp").html(b)}else{e("#timestamp").html(q+" <b>"+e("option[value="+e("#mm").val()+"]","#mm").text()+" "+m+", "+g+" @ "+k+":"+j+"</b> ")}if(e("input:radio:checked","#post-visibility-select").val()=="private"){if(page){e("#publish").val(postL10n.updatePage)}else{e("#publish").val(postL10n.updatePost)}if(i.length==0){p.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{i.html(postL10n.privatelyPublished)}e("option[value=publish]",p).attr("selected",true);e(".edit-post-status","#misc-publishing-actions").hide()}else{if(e("#original_post_status").val()=="future"||e("#original_post_status").val()=="draft"){if(i.length){i.remove();p.val(e("#hidden_post_status").val())}}else{i.html(postL10n.published)}if(p.is(":hidden")){e(".edit-post-status","#misc-publishing-actions").show()}}e("#post-status-display").html(e("option:selected",p).text());if(e("option:selected",p).val()=="private"||e("option:selected",p).val()=="publish"){e("#save-post").hide()}else{e("#save-post").show();if(e("option:selected",p).val()=="pending"){e("#save-post").show().val(postL10n.savePending)}else{e("#save-post").show().val(postL10n.saveDraft)}}return true}e(".edit-visibility","#visibility").click(function(){if(e("#post-visibility-select").is(":hidden")){d();e("#post-visibility-select").slideDown("normal");e(this).hide()}return false});e(".cancel-post-visibility","#post-visibility-select").click(function(){e("#post-visibility-select").slideUp("normal");e("#visibility-radio-"+e("#hidden-post-visibility").val()).attr("checked",true);e("#post_password").val(e("#hidden_post_password").val());e("#sticky").attr("checked",e("#hidden-post-sticky").attr("checked"));e("#post-visibility-display").html(a);e(".edit-visibility","#visibility").show();c();return false});e(".save-post-visibility","#post-visibility-select").click(function(){var g=e("#post-visibility-select");g.slideUp("normal");e(".edit-visibility","#visibility").show();c();if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false)}if(true==e("#sticky").attr("checked")){f="Sticky"}else{f=""}e("#post-visibility-display").html(postL10n[e("input:radio:checked",g).val()+f]);return false});e("input:radio","#post-visibility-select").change(function(){d()});e("#timestampdiv").siblings("a.edit-timestamp").click(function(){if(e("#timestampdiv").is(":hidden")){e("#timestampdiv").slideDown("normal");e(this).hide()}return false});e(".cancel-timestamp","#timestampdiv").click(function(){e("#timestampdiv").slideUp("normal");e("#mm").val(e("#hidden_mm").val());e("#jj").val(e("#hidden_jj").val());e("#aa").val(e("#hidden_aa").val());e("#hh").val(e("#hidden_hh").val());e("#mn").val(e("#hidden_mn").val());e("#timestampdiv").siblings("a.edit-timestamp").show();c();return false});e(".save-timestamp","#timestampdiv").click(function(){if(c()){e("#timestampdiv").slideUp("normal");e("#timestampdiv").siblings("a.edit-timestamp").show()}return false});e("#post-status-select").siblings("a.edit-post-status").click(function(){if(e("#post-status-select").is(":hidden")){e("#post-status-select").slideDown("normal");e(this).hide()}return false});e(".save-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post-status-select").siblings("a.edit-post-status").show();c();return false});e(".cancel-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post_status").val(e("#hidden_post_status").val());e("#post-status-select").siblings("a.edit-post-status").show();c();return false})}if(e("#edit-slug-box").length){editPermalink=function(g){var h,l=0,k=e("#editable-post-name"),m=k.html(),p=e("#post_name"),q=p.val(),n=e("#edit-slug-buttons"),o=n.html(),j=e("#editable-post-name-full").html();e("#view-post-btn").hide();n.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");n.children(".save").click(function(){var i=k.children("input").val();e.post(ajaxurl,{action:"sample-permalink",post_id:g,new_slug:i,new_title:e("#title").val(),samplepermalinknonce:e("#samplepermalinknonce").val()},function(r){e("#edit-slug-box").html(r);n.html(o);p.attr("value",i);makeSlugeditClickable();e("#view-post-btn").show()});return false});e(".cancel","#edit-slug-buttons").click(function(){e("#view-post-btn").show();k.html(m);n.html(o);p.attr("value",q);return false});for(h=0;h<j.length;++h){if("%"==j.charAt(h)){l++}}slug_value=(l>j.length/4)?"":j;k.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(r){var i=r.keyCode||0;if(13==i){n.children(".save").click();return false}if(27==i){n.children(".cancel").click();return false}p.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){e("#editable-post-name").click(function(){e("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}e("#title-prompt-text").click(function(){e(this).css("visibility","hidden").siblings("#title").focus()});e("#title").blur(function(){if(this.value==""){e(this).siblings("#title-prompt-text").css("visibility","")}}).focus(function(){e(this).siblings("#title-prompt-text").css("visibility","hidden")}).keydown(function(g){e(this).siblings("#title-prompt-text").css("visibility","hidden");e(this).unbind(g)})});
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(d){var f=a(".the-tags",d),e=a(".tagchecklist",d),b;if(!f.length){return}var c=f.attr("disabled");b=f.val().split(",");e.empty();a.each(b,function(i,j){var g,h,k=a(d).attr("id");j=a.trim(j);if(!j.match(/^\s+$/)&&""!=j){h=k+"-check-num-"+i;if(c){g="<span>"+j+"</span> "}else{g='<span><a id="'+h+'" class="ntdelbutton">X</a>&nbsp;'+j+"</span> "}e.append(g);if(!c){a("#"+h).click(function(){tagBox.parseTags(this)})}}})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});a("#"+c).after(e)})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").siblings(".newtag").focus()});a("input.newtag",c).blur(function(){if(this.value==""){a(this).siblings(".taghint").css("visibility","")}}).focus(function(){a(this).siblings(".taghint").css("visibility","hidden")}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+d,{delay:500,minchars:2,multiple:true,multipleSep:", "})});a("#post").submit(function(){a("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){tagBox.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(b){a(".inside","#postimagediv").html(b)};WPSetThumbnailID=function(c){var b=a("input[value=_thumbnail_id]","#list-table");if(b.size()>0){a("#meta\\["+b.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(c)}};WPRemoveThumbnail=function(){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(b){if(b=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(b)}})}})(jQuery);jQuery(document).ready(function(e){var b,a,f="";postboxes.add_postbox_toggles(pagenow);if(e("#tagsdiv-post_tag").length){tagBox.init()}else{e("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}e(".categorydiv").each(function(){var l=e(this).attr("id"),h=false,k,m,j,g,i;j=l.split("-");j.shift();g=j.join("-");i=g+"_tab";if(g=="category"){i="cats"}e("a","#"+g+"-tabs").click(function(){var n=e(this).attr("href");e(this).parent().addClass("tabs").siblings("li").removeClass("tabs");e("#"+g+"-tabs").siblings(".tabs-panel").hide();e(n).show();if("#"+g+"-all"==n){deleteUserSetting(i)}else{setUserSetting(i,"pop")}return false});if(getUserSetting(i)){e('a[href="#'+g+'-pop"]',"#"+g+"-tabs").click()}e("#new"+g).one("focus",function(){e(this).val("").removeClass("form-input-tip")});e("#"+g+"-add-submit").click(function(){e("#new"+g).focus()});k=function(){if(h){return}h=true;var n=jQuery(this),p=n.is(":checked"),o=n.val().toString();e("#in-"+g+"-"+o+", #in-"+g+"-category-"+o).attr("checked",p);h=false};catAddBefore=function(n){if(!e("#new"+g).val()){return false}n.data+="&"+e(":checked","#"+g+"checklist").serialize();return n};m=function(q,p){var o,n=e("#new"+g+"_parent");if("undefined"!=p.parsed.responses[0]&&(o=p.parsed.responses[0].supplemental.newcat_parent)){n.before(o);n.remove()}};e("#"+g+"checklist").wpList({alt:"",response:g+"-ajax-response",addBefore:catAddBefore,addAfter:m});e("#"+g+"-add-toggle").click(function(){e("#"+g+"-adder").toggleClass("wp-hidden-children");e('a[href="#'+g+'-all"]',"#"+g+"-tabs").click();return false});e("#"+g+"checklist li.popular-category :checkbox, #"+g+"checklist-pop :checkbox").live("click",function(){var n=e(this),p=n.is(":checked"),o=n.val();if(o&&n.parents("#taxonomy-"+g).length){e("#in-"+g+"-"+o+", #in-popular-"+g+"-"+o).attr("checked",p)}})});if(e("#postcustom").length){e("#the-list").wpList({addAfter:function(g,h){e("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(h.parsed.responses[0].supplemental.postid)}},addBefore:function(g){g.data+="&post_id="+e("#post_ID").val();return g}})}if(e("#submitdiv").length){b=e("#timestamp").html();a=e("#post-visibility-display").html();function d(){var g=e("#post-visibility-select");if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false);e("#sticky-span").hide()}else{e("#sticky-span").show()}if(e("input:radio:checked",g).val()!="password"){e("#password-span").hide()}else{e("#password-span").show()}}function c(){var n,o,h,q,p=e("#post_status"),i=e("option[value=publish]",p),g=e("#aa").val(),l=e("#mm").val(),m=e("#jj").val(),k=e("#hh").val(),j=e("#mn").val();n=new Date(g,l-1,m,k,j);o=new Date(e("#hidden_aa").val(),e("#hidden_mm").val()-1,e("#hidden_jj").val(),e("#hidden_hh").val(),e("#hidden_mn").val());h=new Date(e("#cur_aa").val(),e("#cur_mm").val()-1,e("#cur_jj").val(),e("#cur_hh").val(),e("#cur_mn").val());if(n.getFullYear()!=g||(1+n.getMonth())!=l||n.getDate()!=m||n.getMinutes()!=j){e(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{e(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(n>h&&e("#original_post_status").val()!="future"){q=postL10n.publishOnFuture;e("#publish").val(postL10n.schedule)}else{if(n<=h&&e("#original_post_status").val()!="publish"){q=postL10n.publishOn;e("#publish").val(postL10n.publish)}else{q=postL10n.publishOnPast;if(page){e("#publish").val(postL10n.updatePage)}else{e("#publish").val(postL10n.updatePost)}}}if(o.toUTCString()==n.toUTCString()){e("#timestamp").html(b)}else{e("#timestamp").html(q+" <b>"+e("option[value="+e("#mm").val()+"]","#mm").text()+" "+m+", "+g+" @ "+k+":"+j+"</b> ")}if(e("input:radio:checked","#post-visibility-select").val()=="private"){if(page){e("#publish").val(postL10n.updatePage)}else{e("#publish").val(postL10n.updatePost)}if(i.length==0){p.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{i.html(postL10n.privatelyPublished)}e("option[value=publish]",p).attr("selected",true);e(".edit-post-status","#misc-publishing-actions").hide()}else{if(e("#original_post_status").val()=="future"||e("#original_post_status").val()=="draft"){if(i.length){i.remove();p.val(e("#hidden_post_status").val())}}else{i.html(postL10n.published)}if(p.is(":hidden")){e(".edit-post-status","#misc-publishing-actions").show()}}e("#post-status-display").html(e("option:selected",p).text());if(e("option:selected",p).val()=="private"||e("option:selected",p).val()=="publish"){e("#save-post").hide()}else{e("#save-post").show();if(e("option:selected",p).val()=="pending"){e("#save-post").show().val(postL10n.savePending)}else{e("#save-post").show().val(postL10n.saveDraft)}}return true}e(".edit-visibility","#visibility").click(function(){if(e("#post-visibility-select").is(":hidden")){d();e("#post-visibility-select").slideDown("normal");e(this).hide()}return false});e(".cancel-post-visibility","#post-visibility-select").click(function(){e("#post-visibility-select").slideUp("normal");e("#visibility-radio-"+e("#hidden-post-visibility").val()).attr("checked",true);e("#post_password").val(e("#hidden_post_password").val());e("#sticky").attr("checked",e("#hidden-post-sticky").attr("checked"));e("#post-visibility-display").html(a);e(".edit-visibility","#visibility").show();c();return false});e(".save-post-visibility","#post-visibility-select").click(function(){var g=e("#post-visibility-select");g.slideUp("normal");e(".edit-visibility","#visibility").show();c();if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false)}if(true==e("#sticky").attr("checked")){f="Sticky"}else{f=""}e("#post-visibility-display").html(postL10n[e("input:radio:checked",g).val()+f]);return false});e("input:radio","#post-visibility-select").change(function(){d()});e("#timestampdiv").siblings("a.edit-timestamp").click(function(){if(e("#timestampdiv").is(":hidden")){e("#timestampdiv").slideDown("normal");e(this).hide()}return false});e(".cancel-timestamp","#timestampdiv").click(function(){e("#timestampdiv").slideUp("normal");e("#mm").val(e("#hidden_mm").val());e("#jj").val(e("#hidden_jj").val());e("#aa").val(e("#hidden_aa").val());e("#hh").val(e("#hidden_hh").val());e("#mn").val(e("#hidden_mn").val());e("#timestampdiv").siblings("a.edit-timestamp").show();c();return false});e(".save-timestamp","#timestampdiv").click(function(){if(c()){e("#timestampdiv").slideUp("normal");e("#timestampdiv").siblings("a.edit-timestamp").show()}return false});e("#post-status-select").siblings("a.edit-post-status").click(function(){if(e("#post-status-select").is(":hidden")){e("#post-status-select").slideDown("normal");e(this).hide()}return false});e(".save-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post-status-select").siblings("a.edit-post-status").show();c();return false});e(".cancel-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post_status").val(e("#hidden_post_status").val());e("#post-status-select").siblings("a.edit-post-status").show();c();return false})}if(e("#edit-slug-box").length){editPermalink=function(g){var h,l=0,k=e("#editable-post-name"),m=k.html(),p=e("#post_name"),q=p.val(),n=e("#edit-slug-buttons"),o=n.html(),j=e("#editable-post-name-full").html();e("#view-post-btn").hide();n.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");n.children(".save").click(function(){var i=k.children("input").val();e.post(ajaxurl,{action:"sample-permalink",post_id:g,new_slug:i,new_title:e("#title").val(),samplepermalinknonce:e("#samplepermalinknonce").val()},function(r){e("#edit-slug-box").html(r);n.html(o);p.attr("value",i);makeSlugeditClickable();e("#view-post-btn").show()});return false});e(".cancel","#edit-slug-buttons").click(function(){e("#view-post-btn").show();k.html(m);n.html(o);p.attr("value",q);return false});for(h=0;h<j.length;++h){if("%"==j.charAt(h)){l++}}slug_value=(l>j.length/4)?"":j;k.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(r){var i=r.keyCode||0;if(13==i){n.children(".save").click();return false}if(27==i){n.children(".cancel").click();return false}p.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){e("#editable-post-name").click(function(){e("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}if(e("#title").val()==""){e("#title").siblings("#title-prompt-text").css("visibility","")}e("#title-prompt-text").click(function(){e(this).css("visibility","hidden").siblings("#title").focus()});e("#title").blur(function(){if(this.value==""){e(this).siblings("#title-prompt-text").css("visibility","")}}).focus(function(){e(this).siblings("#title-prompt-text").css("visibility","hidden")}).keydown(function(g){e(this).siblings("#title-prompt-text").css("visibility","hidden");e(this).unbind(g)})});
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(d){var f=a(".the-tags",d),e=a(".tagchecklist",d),b;if(!f.length){return}var c=f.attr("disabled");b=f.val().split(",");e.empty();a.each(b,function(i,j){var g,h,k=a(d).attr("id");j=a.trim(j);if(!j.match(/^\s+$/)&&""!=j){h=k+"-check-num-"+i;if(c){g="<span>"+j+"</span> "}else{g='<span><a id="'+h+'" class="ntdelbutton">X</a>&nbsp;'+j+"</span> "}e.append(g);if(!c){a("#"+h).click(function(){tagBox.parseTags(this)})}}})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});a("#"+c).after(e)})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").siblings(".newtag").focus()});a("input.newtag",c).blur(function(){if(this.value==""){a(this).siblings(".taghint").css("visibility","")}}).focus(function(){a(this).siblings(".taghint").css("visibility","hidden")}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+d,{delay:500,minchars:2,multiple:true,multipleSep:", "})});a("#post").submit(function(){a("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){tagBox.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(b){a(".inside","#postimagediv").html(b)};WPSetThumbnailID=function(c){var b=a("input[value=_thumbnail_id]","#list-table");if(b.size()>0){a("#meta\\["+b.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(c)}};WPRemoveThumbnail=function(){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(b){if(b=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(b)}})}})(jQuery);jQuery(document).ready(function(e){var b,a,f="";postboxes.add_postbox_toggles(pagenow);if(e("#tagsdiv-post_tag").length){tagBox.init()}else{e("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}e(".categorydiv").each(function(){var l=e(this).attr("id"),h=false,k,m,j,g,i;j=l.split("-");j.shift();g=j.join("-");i=g+"_tab";if(g=="category"){i="cats"}e("a","#"+g+"-tabs").click(function(){var n=e(this).attr("href");e(this).parent().addClass("tabs").siblings("li").removeClass("tabs");e("#"+g+"-tabs").siblings(".tabs-panel").hide();e(n).show();if("#"+g+"-all"==n){deleteUserSetting(i)}else{setUserSetting(i,"pop")}return false});if(getUserSetting(i)){e('a[href="#'+g+'-pop"]',"#"+g+"-tabs").click()}e("#new"+g).one("focus",function(){e(this).val("").removeClass("form-input-tip")});e("#"+g+"-add-submit").click(function(){e("#new"+g).focus()});k=function(){if(h){return}h=true;var n=jQuery(this),p=n.is(":checked"),o=n.val().toString();e("#in-"+g+"-"+o+", #in-"+g+"-category-"+o).attr("checked",p);h=false};catAddBefore=function(n){if(!e("#new"+g).val()){return false}n.data+="&"+e(":checked","#"+g+"checklist").serialize();return n};m=function(q,p){var o,n=e("#new"+g+"_parent");if("undefined"!=p.parsed.responses[0]&&(o=p.parsed.responses[0].supplemental.newcat_parent)){n.before(o);n.remove()}};e("#"+g+"checklist").wpList({alt:"",response:g+"-ajax-response",addBefore:catAddBefore,addAfter:m});e("#"+g+"-add-toggle").click(function(){e("#"+g+"-adder").toggleClass("wp-hidden-children");e('a[href="#'+g+'-all"]',"#"+g+"-tabs").click();return false});e("#"+g+"checklist li.popular-category :checkbox, #"+g+"checklist-pop :checkbox").live("click",function(){var n=e(this),p=n.is(":checked"),o=n.val();if(o&&n.parents("#taxonomy-"+g).length){e("#in-"+g+"-"+o+", #in-popular-"+g+"-"+o).attr("checked",p)}})});if(e("#postcustom").length){e("#the-list").wpList({addAfter:function(g,h){e("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(h.parsed.responses[0].supplemental.postid)}},addBefore:function(g){g.data+="&post_id="+e("#post_ID").val();return g}})}if(e("#submitdiv").length){b=e("#timestamp").html();a=e("#post-visibility-display").html();function d(){var g=e("#post-visibility-select");if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false);e("#sticky-span").hide()}else{e("#sticky-span").show()}if(e("input:radio:checked",g).val()!="password"){e("#password-span").hide()}else{e("#password-span").show()}}function c(){var n,o,h,q,p=e("#post_status"),i=e("option[value=publish]",p),g=e("#aa").val(),l=e("#mm").val(),m=e("#jj").val(),k=e("#hh").val(),j=e("#mn").val();n=new Date(g,l-1,m,k,j);o=new Date(e("#hidden_aa").val(),e("#hidden_mm").val()-1,e("#hidden_jj").val(),e("#hidden_hh").val(),e("#hidden_mn").val());h=new Date(e("#cur_aa").val(),e("#cur_mm").val()-1,e("#cur_jj").val(),e("#cur_hh").val(),e("#cur_mn").val());if(n.getFullYear()!=g||(1+n.getMonth())!=l||n.getDate()!=m||n.getMinutes()!=j){e(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{e(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(n>h&&e("#original_post_status").val()!="future"){q=postL10n.publishOnFuture;e("#publish").val(postL10n.schedule)}else{if(n<=h&&e("#original_post_status").val()!="publish"){q=postL10n.publishOn;e("#publish").val(postL10n.publish)}else{q=postL10n.publishOnPast;if(page){e("#publish").val(postL10n.updatePage)}else{e("#publish").val(postL10n.updatePost)}}}if(o.toUTCString()==n.toUTCString()){e("#timestamp").html(b)}else{e("#timestamp").html(q+" <b>"+e("option[value="+e("#mm").val()+"]","#mm").text()+" "+m+", "+g+" @ "+k+":"+j+"</b> ")}if(e("input:radio:checked","#post-visibility-select").val()=="private"){if(page){e("#publish").val(postL10n.updatePage)}else{e("#publish").val(postL10n.updatePost)}if(i.length==0){p.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{i.html(postL10n.privatelyPublished)}e("option[value=publish]",p).attr("selected",true);e(".edit-post-status","#misc-publishing-actions").hide()}else{if(e("#original_post_status").val()=="future"||e("#original_post_status").val()=="draft"){if(i.length){i.remove();p.val(e("#hidden_post_status").val())}}else{i.html(postL10n.published)}if(p.is(":hidden")){e(".edit-post-status","#misc-publishing-actions").show()}}e("#post-status-display").html(e("option:selected",p).text());if(e("option:selected",p).val()=="private"||e("option:selected",p).val()=="publish"){e("#save-post").hide()}else{e("#save-post").show();if(e("option:selected",p).val()=="pending"){e("#save-post").show().val(postL10n.savePending)}else{e("#save-post").show().val(postL10n.saveDraft)}}return true}e(".edit-visibility","#visibility").click(function(){if(e("#post-visibility-select").is(":hidden")){d();e("#post-visibility-select").slideDown("normal");e(this).hide()}return false});e(".cancel-post-visibility","#post-visibility-select").click(function(){e("#post-visibility-select").slideUp("normal");e("#visibility-radio-"+e("#hidden-post-visibility").val()).attr("checked",true);e("#post_password").val(e("#hidden_post_password").val());e("#sticky").attr("checked",e("#hidden-post-sticky").attr("checked"));e("#post-visibility-display").html(a);e(".edit-visibility","#visibility").show();c();return false});e(".save-post-visibility","#post-visibility-select").click(function(){var g=e("#post-visibility-select");g.slideUp("normal");e(".edit-visibility","#visibility").show();c();if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false)}if(true==e("#sticky").attr("checked")){f="Sticky"}else{f=""}e("#post-visibility-display").html(postL10n[e("input:radio:checked",g).val()+f]);return false});e("input:radio","#post-visibility-select").change(function(){d()});e("#timestampdiv").siblings("a.edit-timestamp").click(function(){if(e("#timestampdiv").is(":hidden")){e("#timestampdiv").slideDown("normal");e(this).hide()}return false});e(".cancel-timestamp","#timestampdiv").click(function(){e("#timestampdiv").slideUp("normal");e("#mm").val(e("#hidden_mm").val());e("#jj").val(e("#hidden_jj").val());e("#aa").val(e("#hidden_aa").val());e("#hh").val(e("#hidden_hh").val());e("#mn").val(e("#hidden_mn").val());e("#timestampdiv").siblings("a.edit-timestamp").show();c();return false});e(".save-timestamp","#timestampdiv").click(function(){if(c()){e("#timestampdiv").slideUp("normal");e("#timestampdiv").siblings("a.edit-timestamp").show()}return false});e("#post-status-select").siblings("a.edit-post-status").click(function(){if(e("#post-status-select").is(":hidden")){e("#post-status-select").slideDown("normal");e(this).hide()}return false});e(".save-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post-status-select").siblings("a.edit-post-status").show();c();return false});e(".cancel-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post_status").val(e("#hidden_post_status").val());e("#post-status-select").siblings("a.edit-post-status").show();c();return false})}if(e("#edit-slug-box").length){editPermalink=function(g){var h,l=0,k=e("#editable-post-name"),m=k.html(),p=e("#post_name"),q=p.val(),n=e("#edit-slug-buttons"),o=n.html(),j=e("#editable-post-name-full").html();e("#view-post-btn").hide();n.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");n.children(".save").click(function(){var i=k.children("input").val();e.post(ajaxurl,{action:"sample-permalink",post_id:g,new_slug:i,new_title:e("#title").val(),samplepermalinknonce:e("#samplepermalinknonce").val()},function(r){e("#edit-slug-box").html(r);n.html(o);p.attr("value",i);makeSlugeditClickable();e("#view-post-btn").show()});return false});e(".cancel","#edit-slug-buttons").click(function(){e("#view-post-btn").show();k.html(m);n.html(o);p.attr("value",q);return false});for(h=0;h<j.length;++h){if("%"==j.charAt(h)){l++}}slug_value=(l>j.length/4)?"":j;k.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(r){var i=r.keyCode||0;if(13==i){n.children(".save").click();return false}if(27==i){n.children(".cancel").click();return false}p.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){e("#editable-post-name").click(function(){e("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}e("#title-prompt-text").click(function(){e(this).css("visibility","hidden").siblings("#title").focus()});e("#title").blur(function(){if(this.value==""){e(this).siblings("#title-prompt-text").css("visibility","")}}).focus(function(){e(this).siblings("#title-prompt-text").css("visibility","hidden")}).keydown(function(g){e(this).siblings("#title-prompt-text").css("visibility","hidden");e(this).unbind(g)})});
10574 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/10574/30ffd75c8c34893183c03626f1c3de2e2d1b8e26/post.js/clean/wp-admin/js/post.js
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(d){var f=a(".the-tags",d),e=a(".tagchecklist",d),b,c;if(!f.length){return}c=f.attr("disabled");b=f.val().split(",");e.empty();a.each(b,function(i,j){var g,h,k=a(d).attr("id");j=a.trim(j);if(!j.match(/^\s+$/)&&""!=j){h=k+"-check-num-"+i;if(c){g="<span>"+j+"</span> "}else{g='<span><a id="'+h+'" class="ntdelbutton">X</a>&nbsp;'+j+"</span> "}e.append(g);if(!c){a("#"+h).click(function(){tagBox.parseTags(this)})}}})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});a("#"+c).after(e)})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").parent().siblings(".newtag").focus()});a("input.newtag",c).blur(function(){if(this.value==""){a(this).parent().siblings(".taghint").css("visibility","")}}).focus(function(){a(this).parent().siblings(".taghint").css("visibility","hidden")}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+d,{delay:500,minchars:2,multiple:true,multipleSep:","})});a("#post").submit(function(){a("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){tagBox.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(b){a(".inside","#postimagediv").html(b)};WPSetThumbnailID=function(c){var b=a("input[value=_thumbnail_id]","#list-table");if(b.size()>0){a("#meta\\["+b.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(c)}};WPRemoveThumbnail=function(b){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,_ajax_nonce:b,cookie:encodeURIComponent(document.cookie)},function(c){if(c=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(c)}})}})(jQuery);jQuery(document).ready(function(e){var b,a,f="";postboxes.add_postbox_toggles(pagenow);if(e("#tagsdiv-post_tag").length){tagBox.init()}else{e("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}e(".categorydiv").each(function(){var l=e(this).attr("id"),h=false,k,m,j,g,i;j=l.split("-");j.shift();g=j.join("-");i=g+"_tab";if(g=="category"){i="cats"}e("a","#"+g+"-tabs").click(function(){var n=e(this).attr("href");e(this).parent().addClass("tabs").siblings("li").removeClass("tabs");e("#"+g+"-tabs").siblings(".tabs-panel").hide();e(n).show();if("#"+g+"-all"==n){deleteUserSetting(i)}else{setUserSetting(i,"pop")}return false});if(getUserSetting(i)){e('a[href="#'+g+'-pop"]',"#"+g+"-tabs").click()}e("#new"+g).one("focus",function(){e(this).val("").removeClass("form-input-tip")});e("#"+g+"-add-submit").click(function(){e("#new"+g).focus()});k=function(){if(h){return}h=true;var n=jQuery(this),p=n.is(":checked"),o=n.val().toString();e("#in-"+g+"-"+o+", #in-"+g+"-category-"+o).attr("checked",p);h=false};catAddBefore=function(n){if(!e("#new"+g).val()){return false}n.data+="&"+e(":checked","#"+g+"checklist").serialize();return n};m=function(q,p){var o,n=e("#new"+g+"_parent");if("undefined"!=p.parsed.responses[0]&&(o=p.parsed.responses[0].supplemental.newcat_parent)){n.before(o);n.remove()}};e("#"+g+"checklist").wpList({alt:"",response:g+"-ajax-response",addBefore:catAddBefore,addAfter:m});e("#"+g+"-add-toggle").click(function(){e("#"+g+"-adder").toggleClass("wp-hidden-children");e('a[href="#'+g+'-all"]',"#"+g+"-tabs").click();e("#new"+g).focus();return false});e("#"+g+"checklist li.popular-category :checkbox, #"+g+"checklist-pop :checkbox").live("click",function(){var n=e(this),p=n.is(":checked"),o=n.val();if(o&&n.parents("#taxonomy-"+g).length){e("#in-"+g+"-"+o+", #in-popular-"+g+"-"+o).attr("checked",p)}})});if(e("#postcustom").length){e("#the-list").wpList({addAfter:function(g,h){e("table#list-table").show()},addBefore:function(g){g.data+="&post_id="+e("#post_ID").val();return g}})}if(e("#submitdiv").length){b=e("#timestamp").html();a=e("#post-visibility-display").html();function d(){var g=e("#post-visibility-select");if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false);e("#sticky-span").hide()}else{e("#sticky-span").show()}if(e("input:radio:checked",g).val()!="password"){e("#password-span").hide()}else{e("#password-span").show()}}function c(){var n,o,h,q,p=e("#post_status"),i=e("option[value=publish]",p),g=e("#aa").val(),l=e("#mm").val(),m=e("#jj").val(),k=e("#hh").val(),j=e("#mn").val();n=new Date(g,l-1,m,k,j);o=new Date(e("#hidden_aa").val(),e("#hidden_mm").val()-1,e("#hidden_jj").val(),e("#hidden_hh").val(),e("#hidden_mn").val());h=new Date(e("#cur_aa").val(),e("#cur_mm").val()-1,e("#cur_jj").val(),e("#cur_hh").val(),e("#cur_mn").val());if(n.getFullYear()!=g||(1+n.getMonth())!=l||n.getDate()!=m||n.getMinutes()!=j){e(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{e(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(n>h&&e("#original_post_status").val()!="future"){q=postL10n.publishOnFuture;e("#publish").val(postL10n.schedule)}else{if(n<=h&&e("#original_post_status").val()!="publish"){q=postL10n.publishOn;e("#publish").val(postL10n.publish)}else{q=postL10n.publishOnPast;e("#publish").val(postL10n.update)}}if(o.toUTCString()==n.toUTCString()){e("#timestamp").html(b)}else{e("#timestamp").html(q+" <b>"+e("option[value="+e("#mm").val()+"]","#mm").text()+" "+m+", "+g+" @ "+k+":"+j+"</b> ")}if(e("input:radio:checked","#post-visibility-select").val()=="private"){e("#publish").val(postL10n.update);if(i.length==0){p.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{i.html(postL10n.privatelyPublished)}e("option[value=publish]",p).attr("selected",true);e(".edit-post-status","#misc-publishing-actions").hide()}else{if(e("#original_post_status").val()=="future"||e("#original_post_status").val()=="draft"){if(i.length){i.remove();p.val(e("#hidden_post_status").val())}}else{i.html(postL10n.published)}if(p.is(":hidden")){e(".edit-post-status","#misc-publishing-actions").show()}}e("#post-status-display").html(e("option:selected",p).text());if(e("option:selected",p).val()=="private"||e("option:selected",p).val()=="publish"){e("#save-post").hide()}else{e("#save-post").show();if(e("option:selected",p).val()=="pending"){e("#save-post").show().val(postL10n.savePending)}else{e("#save-post").show().val(postL10n.saveDraft)}}return true}e(".edit-visibility","#visibility").click(function(){if(e("#post-visibility-select").is(":hidden")){d();e("#post-visibility-select").slideDown("normal");e(this).hide()}return false});e(".cancel-post-visibility","#post-visibility-select").click(function(){e("#post-visibility-select").slideUp("normal");e("#visibility-radio-"+e("#hidden-post-visibility").val()).attr("checked",true);e("#post_password").val(e("#hidden_post_password").val());e("#sticky").attr("checked",e("#hidden-post-sticky").attr("checked"));e("#post-visibility-display").html(a);e(".edit-visibility","#visibility").show();c();return false});e(".save-post-visibility","#post-visibility-select").click(function(){var g=e("#post-visibility-select");g.slideUp("normal");e(".edit-visibility","#visibility").show();c();if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false)}if(true==e("#sticky").attr("checked")){f="Sticky"}else{f=""}e("#post-visibility-display").html(postL10n[e("input:radio:checked",g).val()+f]);return false});e("input:radio","#post-visibility-select").change(function(){d()});e(".edit-post-format","#post-formats").click(function(){e("#post-formats-select").slideDown("normal");e(this).hide();return false});e(".cancel-post-format","#post-formats-select").click(function(){e("#post-formats-select").slideUp("normal");e("#post-format-"+e("#old-post-format").val()).attr("checked",true);e("#post-format-display").text(e('label[for="post-format-'+e("#old-post-format").val()+'"]',"#post-formats-select").text());e(".edit-post-format").show();return false});e(".save-post-format","#post-formats-select").click(function(){e("#post-formats-select").slideUp("normal");e("#post-format-display").text(e('label[for="'+e("input:checked","#post-formats-select").attr("id")+'"]',"#post-formats-select").text());e(".edit-post-format").show();return false});e("#timestampdiv").siblings("a.edit-timestamp").click(function(){if(e("#timestampdiv").is(":hidden")){e("#timestampdiv").slideDown("normal");e(this).hide()}return false});e(".cancel-timestamp","#timestampdiv").click(function(){e("#timestampdiv").slideUp("normal");e("#mm").val(e("#hidden_mm").val());e("#jj").val(e("#hidden_jj").val());e("#aa").val(e("#hidden_aa").val());e("#hh").val(e("#hidden_hh").val());e("#mn").val(e("#hidden_mn").val());e("#timestampdiv").siblings("a.edit-timestamp").show();c();return false});e(".save-timestamp","#timestampdiv").click(function(){if(c()){e("#timestampdiv").slideUp("normal");e("#timestampdiv").siblings("a.edit-timestamp").show()}return false});e("#post-status-select").siblings("a.edit-post-status").click(function(){if(e("#post-status-select").is(":hidden")){e("#post-status-select").slideDown("normal");e(this).hide()}return false});e(".save-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post-status-select").siblings("a.edit-post-status").show();c();return false});e(".cancel-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post_status").val(e("#hidden_post_status").val());e("#post-status-select").siblings("a.edit-post-status").show();c();return false})}if(e("#edit-slug-box").length){editPermalink=function(g){var h,l=0,k=e("#editable-post-name"),m=k.html(),p=e("#post_name"),q=p.val(),n=e("#edit-slug-buttons"),o=n.html(),j=e("#editable-post-name-full").html();e("#view-post-btn").hide();n.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");n.children(".save").click(function(){var i=k.children("input").val();e.post(ajaxurl,{action:"sample-permalink",post_id:g,new_slug:i,new_title:e("#title").val(),samplepermalinknonce:e("#samplepermalinknonce").val()},function(r){e("#edit-slug-box").html(r);n.html(o);p.attr("value",i);makeSlugeditClickable();e("#view-post-btn").show()});return false});e(".cancel","#edit-slug-buttons").click(function(){e("#view-post-btn").show();k.html(m);n.html(o);p.attr("value",q);return false});for(h=0;h<j.length;++h){if("%"==j.charAt(h)){l++}}slug_value=(l>j.length/4)?"":j;k.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(r){var i=r.keyCode||0;if(13==i){n.children(".save").click();return false}if(27==i){n.children(".cancel").click();return false}p.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){e("#editable-post-name").click(function(){e("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}if(e("#title").val()==""){e("#title").siblings("#title-prompt-text").css("visibility","")}e("#title-prompt-text").click(function(){e(this).css("visibility","hidden").siblings("#title").focus()});e("#title").blur(function(){if(this.value==""){e(this).siblings("#title-prompt-text").css("visibility","")}}).focus(function(){e(this).siblings("#title-prompt-text").css("visibility","hidden")}).keydown(function(g){e(this).siblings("#title-prompt-text").css("visibility","hidden");e(this).unbind(g)})});
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(d){var f=a(".the-tags",d),e=a(".tagchecklist",d),b,c;if(!f.length){return}c=f.attr("disabled");b=f.val().split(",");e.empty();a.each(b,function(i,j){var g,h,k=a(d).attr("id");j=a.trim(j);if(!j.match(/^\s+$/)&&""!=j){h=k+"-check-num-"+i;if(c){g="<span>"+j+"</span> "}else{g='<span><a id="'+h+'" class="ntdelbutton">X</a>&nbsp;'+j+"</span> "}e.append(g);if(!c){a("#"+h).click(function(){tagBox.parseTags(this)})}}})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});a("#"+c).after(e)})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").parent().siblings(".newtag").focus()});a("input.newtag",c).blur(function(){if(this.value==""){a(this).parent().siblings(".taghint").css("visibility","")}}).focus(function(){a(this).parent().siblings(".taghint").css("visibility","hidden")}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+d,{delay:500,minchars:2,multiple:true,multipleSep:","})});a("#post").submit(function(){a("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){tagBox.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),p:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(b){a(".inside","#postimagediv").html(b)};WPSetThumbnailID=function(c){var b=a("input[value=_thumbnail_id]","#list-table");if(b.size()>0){a("#meta\\["+b.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(c)}};WPRemoveThumbnail=function(b){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,_ajax_nonce:b,cookie:encodeURIComponent(document.cookie)},function(c){if(c=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(c)}})}})(jQuery);jQuery(document).ready(function(e){var b,a,f="";postboxes.add_postbox_toggles(pagenow);if(e("#tagsdiv-post_tag").length){tagBox.init()}else{e("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}e(".categorydiv").each(function(){var l=e(this).attr("id"),h=false,k,m,j,g,i;j=l.split("-");j.shift();g=j.join("-");i=g+"_tab";if(g=="category"){i="cats"}e("a","#"+g+"-tabs").click(function(){var n=e(this).attr("href");e(this).parent().addClass("tabs").siblings("li").removeClass("tabs");e("#"+g+"-tabs").siblings(".tabs-panel").hide();e(n).show();if("#"+g+"-all"==n){deleteUserSetting(i)}else{setUserSetting(i,"pop")}return false});if(getUserSetting(i)){e('a[href="#'+g+'-pop"]',"#"+g+"-tabs").click()}e("#new"+g).one("focus",function(){e(this).val("").removeClass("form-input-tip")});e("#"+g+"-add-submit").click(function(){e("#new"+g).focus()});k=function(){if(h){return}h=true;var n=jQuery(this),p=n.is(":checked"),o=n.val().toString();e("#in-"+g+"-"+o+", #in-"+g+"-category-"+o).attr("checked",p);h=false};catAddBefore=function(n){if(!e("#new"+g).val()){return false}n.data+="&"+e(":checked","#"+g+"checklist").serialize();return n};m=function(q,p){var o,n=e("#new"+g+"_parent");if("undefined"!=p.parsed.responses[0]&&(o=p.parsed.responses[0].supplemental.newcat_parent)){n.before(o);n.remove()}};e("#"+g+"checklist").wpList({alt:"",response:g+"-ajax-response",addBefore:catAddBefore,addAfter:m});e("#"+g+"-add-toggle").click(function(){e("#"+g+"-adder").toggleClass("wp-hidden-children");e('a[href="#'+g+'-all"]',"#"+g+"-tabs").click();e("#new"+g).focus();return false});e("#"+g+"checklist li.popular-category :checkbox, #"+g+"checklist-pop :checkbox").live("click",function(){var n=e(this),p=n.is(":checked"),o=n.val();if(o&&n.parents("#taxonomy-"+g).length){e("#in-"+g+"-"+o+", #in-popular-"+g+"-"+o).attr("checked",p)}})});if(e("#postcustom").length){e("#the-list").wpList({addAfter:function(g,h){e("table#list-table").show()},addBefore:function(g){g.data+="&post_id="+e("#post_ID").val();return g}})}if(e("#submitdiv").length){b=e("#timestamp").html();a=e("#post-visibility-display").html();function d(){var g=e("#post-visibility-select");if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false);e("#sticky-span").hide()}else{e("#sticky-span").show()}if(e("input:radio:checked",g).val()!="password"){e("#password-span").hide()}else{e("#password-span").show()}}function c(){var n,o,h,q,p=e("#post_status"),i=e("option[value=publish]",p),g=e("#aa").val(),l=e("#mm").val(),m=e("#jj").val(),k=e("#hh").val(),j=e("#mn").val();n=new Date(g,l-1,m,k,j);o=new Date(e("#hidden_aa").val(),e("#hidden_mm").val()-1,e("#hidden_jj").val(),e("#hidden_hh").val(),e("#hidden_mn").val());h=new Date(e("#cur_aa").val(),e("#cur_mm").val()-1,e("#cur_jj").val(),e("#cur_hh").val(),e("#cur_mn").val());if(n.getFullYear()!=g||(1+n.getMonth())!=l||n.getDate()!=m||n.getMinutes()!=j){e(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{e(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(n>h&&e("#original_post_status").val()!="future"){q=postL10n.publishOnFuture;e("#publish").val(postL10n.schedule)}else{if(n<=h&&e("#original_post_status").val()!="publish"){q=postL10n.publishOn;e("#publish").val(postL10n.publish)}else{q=postL10n.publishOnPast;e("#publish").val(postL10n.update)}}if(o.toUTCString()==n.toUTCString()){e("#timestamp").html(b)}else{e("#timestamp").html(q+" <b>"+e("option[value="+e("#mm").val()+"]","#mm").text()+" "+m+", "+g+" @ "+k+":"+j+"</b> ")}if(e("input:radio:checked","#post-visibility-select").val()=="private"){e("#publish").val(postL10n.update);if(i.length==0){p.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{i.html(postL10n.privatelyPublished)}e("option[value=publish]",p).attr("selected",true);e(".edit-post-status","#misc-publishing-actions").hide()}else{if(e("#original_post_status").val()=="future"||e("#original_post_status").val()=="draft"){if(i.length){i.remove();p.val(e("#hidden_post_status").val())}}else{i.html(postL10n.published)}if(p.is(":hidden")){e(".edit-post-status","#misc-publishing-actions").show()}}e("#post-status-display").html(e("option:selected",p).text());if(e("option:selected",p).val()=="private"||e("option:selected",p).val()=="publish"){e("#save-post").hide()}else{e("#save-post").show();if(e("option:selected",p).val()=="pending"){e("#save-post").show().val(postL10n.savePending)}else{e("#save-post").show().val(postL10n.saveDraft)}}return true}e(".edit-visibility","#visibility").click(function(){if(e("#post-visibility-select").is(":hidden")){d();e("#post-visibility-select").slideDown("normal");e(this).hide()}return false});e(".cancel-post-visibility","#post-visibility-select").click(function(){e("#post-visibility-select").slideUp("normal");e("#visibility-radio-"+e("#hidden-post-visibility").val()).attr("checked",true);e("#post_password").val(e("#hidden_post_password").val());e("#sticky").attr("checked",e("#hidden-post-sticky").attr("checked"));e("#post-visibility-display").html(a);e(".edit-visibility","#visibility").show();c();return false});e(".save-post-visibility","#post-visibility-select").click(function(){var g=e("#post-visibility-select");g.slideUp("normal");e(".edit-visibility","#visibility").show();c();if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false)}if(true==e("#sticky").attr("checked")){f="Sticky"}else{f=""}e("#post-visibility-display").html(postL10n[e("input:radio:checked",g).val()+f]);return false});e("input:radio","#post-visibility-select").change(function(){d()});e(".edit-post-format","#post-formats").click(function(){e("#post-formats-select").slideDown("normal");e(this).hide();return false});e(".cancel-post-format","#post-formats-select").click(function(){e("#post-formats-select").slideUp("normal");e("#post-format-"+e("#old-post-format").val()).attr("checked",true);e("#post-format-display").text(e('label[for="post-format-'+e("#old-post-format").val()+'"]',"#post-formats-select").text());e(".edit-post-format").show();return false});e(".save-post-format","#post-formats-select").click(function(){e("#post-formats-select").slideUp("normal");e("#post-format-display").text(e('label[for="'+e("input:checked","#post-formats-select").attr("id")+'"]',"#post-formats-select").text());e(".edit-post-format").show();return false});e("#timestampdiv").siblings("a.edit-timestamp").click(function(){if(e("#timestampdiv").is(":hidden")){e("#timestampdiv").slideDown("normal");e(this).hide()}return false});e(".cancel-timestamp","#timestampdiv").click(function(){e("#timestampdiv").slideUp("normal");e("#mm").val(e("#hidden_mm").val());e("#jj").val(e("#hidden_jj").val());e("#aa").val(e("#hidden_aa").val());e("#hh").val(e("#hidden_hh").val());e("#mn").val(e("#hidden_mn").val());e("#timestampdiv").siblings("a.edit-timestamp").show();c();return false});e(".save-timestamp","#timestampdiv").click(function(){if(c()){e("#timestampdiv").slideUp("normal");e("#timestampdiv").siblings("a.edit-timestamp").show()}return false});e("#post-status-select").siblings("a.edit-post-status").click(function(){if(e("#post-status-select").is(":hidden")){e("#post-status-select").slideDown("normal");e(this).hide()}return false});e(".save-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post-status-select").siblings("a.edit-post-status").show();c();return false});e(".cancel-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post_status").val(e("#hidden_post_status").val());e("#post-status-select").siblings("a.edit-post-status").show();c();return false})}if(e("#edit-slug-box").length){editPermalink=function(g){var h,l=0,k=e("#editable-post-name"),m=k.html(),p=e("#post_name"),q=p.val(),n=e("#edit-slug-buttons"),o=n.html(),j=e("#editable-post-name-full").html();e("#view-post-btn").hide();n.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");n.children(".save").click(function(){var i=k.children("input").val();e.post(ajaxurl,{action:"sample-permalink",post_id:g,new_slug:i,new_title:e("#title").val(),samplepermalinknonce:e("#samplepermalinknonce").val()},function(r){e("#edit-slug-box").html(r);n.html(o);p.attr("value",i);makeSlugeditClickable();e("#view-post-btn").show()});return false});e(".cancel","#edit-slug-buttons").click(function(){e("#view-post-btn").show();k.html(m);n.html(o);p.attr("value",q);return false});for(h=0;h<j.length;++h){if("%"==j.charAt(h)){l++}}slug_value=(l>j.length/4)?"":j;k.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(r){var i=r.keyCode||0;if(13==i){n.children(".save").click();return false}if(27==i){n.children(".cancel").click();return false}p.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){e("#editable-post-name").click(function(){e("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}if(e("#title").val()==""){e("#title").siblings("#title-prompt-text").css("visibility","")}e("#title-prompt-text").click(function(){e(this).css("visibility","hidden").siblings("#title").focus()});e("#title").blur(function(){if(this.value==""){e(this).siblings("#title-prompt-text").css("visibility","")}}).focus(function(){e(this).siblings("#title-prompt-text").css("visibility","hidden")}).keydown(function(g){e(this).siblings("#title-prompt-text").css("visibility","hidden");e(this).unbind(g)})});
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(d){var f=a(".the-tags",d),e=a(".tagchecklist",d),b,c;if(!f.length){return}c=f.attr("disabled");b=f.val().split(",");e.empty();a.each(b,function(i,j){var g,h,k=a(d).attr("id");j=a.trim(j);if(!j.match(/^\s+$/)&&""!=j){h=k+"-check-num-"+i;if(c){g="<span>"+j+"</span> "}else{g='<span><a id="'+h+'" class="ntdelbutton">X</a>&nbsp;'+j+"</span> "}e.append(g);if(!c){a("#"+h).click(function(){tagBox.parseTags(this)})}}})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});a("#"+c).after(e)})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").parent().siblings(".newtag").focus()});a("input.newtag",c).blur(function(){if(this.value==""){a(this).parent().siblings(".taghint").css("visibility","")}}).focus(function(){a(this).parent().siblings(".taghint").css("visibility","hidden")}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+d,{delay:500,minchars:2,multiple:true,multipleSep:","})});a("#post").submit(function(){a("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){tagBox.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(b){a(".inside","#postimagediv").html(b)};WPSetThumbnailID=function(c){var b=a("input[value=_thumbnail_id]","#list-table");if(b.size()>0){a("#meta\\["+b.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(c)}};WPRemoveThumbnail=function(b){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,_ajax_nonce:b,cookie:encodeURIComponent(document.cookie)},function(c){if(c=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(c)}})}})(jQuery);jQuery(document).ready(function(e){var b,a,f="";postboxes.add_postbox_toggles(pagenow);if(e("#tagsdiv-post_tag").length){tagBox.init()}else{e("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}e(".categorydiv").each(function(){var l=e(this).attr("id"),h=false,k,m,j,g,i;j=l.split("-");j.shift();g=j.join("-");i=g+"_tab";if(g=="category"){i="cats"}e("a","#"+g+"-tabs").click(function(){var n=e(this).attr("href");e(this).parent().addClass("tabs").siblings("li").removeClass("tabs");e("#"+g+"-tabs").siblings(".tabs-panel").hide();e(n).show();if("#"+g+"-all"==n){deleteUserSetting(i)}else{setUserSetting(i,"pop")}return false});if(getUserSetting(i)){e('a[href="#'+g+'-pop"]',"#"+g+"-tabs").click()}e("#new"+g).one("focus",function(){e(this).val("").removeClass("form-input-tip")});e("#"+g+"-add-submit").click(function(){e("#new"+g).focus()});k=function(){if(h){return}h=true;var n=jQuery(this),p=n.is(":checked"),o=n.val().toString();e("#in-"+g+"-"+o+", #in-"+g+"-category-"+o).attr("checked",p);h=false};catAddBefore=function(n){if(!e("#new"+g).val()){return false}n.data+="&"+e(":checked","#"+g+"checklist").serialize();return n};m=function(q,p){var o,n=e("#new"+g+"_parent");if("undefined"!=p.parsed.responses[0]&&(o=p.parsed.responses[0].supplemental.newcat_parent)){n.before(o);n.remove()}};e("#"+g+"checklist").wpList({alt:"",response:g+"-ajax-response",addBefore:catAddBefore,addAfter:m});e("#"+g+"-add-toggle").click(function(){e("#"+g+"-adder").toggleClass("wp-hidden-children");e('a[href="#'+g+'-all"]',"#"+g+"-tabs").click();e("#new"+g).focus();return false});e("#"+g+"checklist li.popular-category :checkbox, #"+g+"checklist-pop :checkbox").live("click",function(){var n=e(this),p=n.is(":checked"),o=n.val();if(o&&n.parents("#taxonomy-"+g).length){e("#in-"+g+"-"+o+", #in-popular-"+g+"-"+o).attr("checked",p)}})});if(e("#postcustom").length){e("#the-list").wpList({addAfter:function(g,h){e("table#list-table").show()},addBefore:function(g){g.data+="&post_id="+e("#post_ID").val();return g}})}if(e("#submitdiv").length){b=e("#timestamp").html();a=e("#post-visibility-display").html();function d(){var g=e("#post-visibility-select");if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false);e("#sticky-span").hide()}else{e("#sticky-span").show()}if(e("input:radio:checked",g).val()!="password"){e("#password-span").hide()}else{e("#password-span").show()}}function c(){var n,o,h,q,p=e("#post_status"),i=e("option[value=publish]",p),g=e("#aa").val(),l=e("#mm").val(),m=e("#jj").val(),k=e("#hh").val(),j=e("#mn").val();n=new Date(g,l-1,m,k,j);o=new Date(e("#hidden_aa").val(),e("#hidden_mm").val()-1,e("#hidden_jj").val(),e("#hidden_hh").val(),e("#hidden_mn").val());h=new Date(e("#cur_aa").val(),e("#cur_mm").val()-1,e("#cur_jj").val(),e("#cur_hh").val(),e("#cur_mn").val());if(n.getFullYear()!=g||(1+n.getMonth())!=l||n.getDate()!=m||n.getMinutes()!=j){e(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{e(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(n>h&&e("#original_post_status").val()!="future"){q=postL10n.publishOnFuture;e("#publish").val(postL10n.schedule)}else{if(n<=h&&e("#original_post_status").val()!="publish"){q=postL10n.publishOn;e("#publish").val(postL10n.publish)}else{q=postL10n.publishOnPast;e("#publish").val(postL10n.update)}}if(o.toUTCString()==n.toUTCString()){e("#timestamp").html(b)}else{e("#timestamp").html(q+" <b>"+e("option[value="+e("#mm").val()+"]","#mm").text()+" "+m+", "+g+" @ "+k+":"+j+"</b> ")}if(e("input:radio:checked","#post-visibility-select").val()=="private"){e("#publish").val(postL10n.update);if(i.length==0){p.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{i.html(postL10n.privatelyPublished)}e("option[value=publish]",p).attr("selected",true);e(".edit-post-status","#misc-publishing-actions").hide()}else{if(e("#original_post_status").val()=="future"||e("#original_post_status").val()=="draft"){if(i.length){i.remove();p.val(e("#hidden_post_status").val())}}else{i.html(postL10n.published)}if(p.is(":hidden")){e(".edit-post-status","#misc-publishing-actions").show()}}e("#post-status-display").html(e("option:selected",p).text());if(e("option:selected",p).val()=="private"||e("option:selected",p).val()=="publish"){e("#save-post").hide()}else{e("#save-post").show();if(e("option:selected",p).val()=="pending"){e("#save-post").show().val(postL10n.savePending)}else{e("#save-post").show().val(postL10n.saveDraft)}}return true}e(".edit-visibility","#visibility").click(function(){if(e("#post-visibility-select").is(":hidden")){d();e("#post-visibility-select").slideDown("normal");e(this).hide()}return false});e(".cancel-post-visibility","#post-visibility-select").click(function(){e("#post-visibility-select").slideUp("normal");e("#visibility-radio-"+e("#hidden-post-visibility").val()).attr("checked",true);e("#post_password").val(e("#hidden_post_password").val());e("#sticky").attr("checked",e("#hidden-post-sticky").attr("checked"));e("#post-visibility-display").html(a);e(".edit-visibility","#visibility").show();c();return false});e(".save-post-visibility","#post-visibility-select").click(function(){var g=e("#post-visibility-select");g.slideUp("normal");e(".edit-visibility","#visibility").show();c();if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false)}if(true==e("#sticky").attr("checked")){f="Sticky"}else{f=""}e("#post-visibility-display").html(postL10n[e("input:radio:checked",g).val()+f]);return false});e("input:radio","#post-visibility-select").change(function(){d()});e(".edit-post-format","#post-formats").click(function(){e("#post-formats-select").slideDown("normal");e(this).hide();return false});e(".cancel-post-format","#post-formats-select").click(function(){e("#post-formats-select").slideUp("normal");e("#post-format-"+e("#old-post-format").val()).attr("checked",true);e("#post-format-display").text(e('label[for="post-format-'+e("#old-post-format").val()+'"]',"#post-formats-select").text());e(".edit-post-format").show();return false});e(".save-post-format","#post-formats-select").click(function(){e("#post-formats-select").slideUp("normal");e("#post-format-display").text(e('label[for="'+e("input:checked","#post-formats-select").attr("id")+'"]',"#post-formats-select").text());e(".edit-post-format").show();return false});e("#timestampdiv").siblings("a.edit-timestamp").click(function(){if(e("#timestampdiv").is(":hidden")){e("#timestampdiv").slideDown("normal");e(this).hide()}return false});e(".cancel-timestamp","#timestampdiv").click(function(){e("#timestampdiv").slideUp("normal");e("#mm").val(e("#hidden_mm").val());e("#jj").val(e("#hidden_jj").val());e("#aa").val(e("#hidden_aa").val());e("#hh").val(e("#hidden_hh").val());e("#mn").val(e("#hidden_mn").val());e("#timestampdiv").siblings("a.edit-timestamp").show();c();return false});e(".save-timestamp","#timestampdiv").click(function(){if(c()){e("#timestampdiv").slideUp("normal");e("#timestampdiv").siblings("a.edit-timestamp").show()}return false});e("#post-status-select").siblings("a.edit-post-status").click(function(){if(e("#post-status-select").is(":hidden")){e("#post-status-select").slideDown("normal");e(this).hide()}return false});e(".save-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post-status-select").siblings("a.edit-post-status").show();c();return false});e(".cancel-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post_status").val(e("#hidden_post_status").val());e("#post-status-select").siblings("a.edit-post-status").show();c();return false})}if(e("#edit-slug-box").length){editPermalink=function(g){var h,l=0,k=e("#editable-post-name"),m=k.html(),p=e("#post_name"),q=p.val(),n=e("#edit-slug-buttons"),o=n.html(),j=e("#editable-post-name-full").html();e("#view-post-btn").hide();n.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");n.children(".save").click(function(){var i=k.children("input").val();e.post(ajaxurl,{action:"sample-permalink",post_id:g,new_slug:i,new_title:e("#title").val(),samplepermalinknonce:e("#samplepermalinknonce").val()},function(r){e("#edit-slug-box").html(r);n.html(o);p.attr("value",i);makeSlugeditClickable();e("#view-post-btn").show()});return false});e(".cancel","#edit-slug-buttons").click(function(){e("#view-post-btn").show();k.html(m);n.html(o);p.attr("value",q);return false});for(h=0;h<j.length;++h){if("%"==j.charAt(h)){l++}}slug_value=(l>j.length/4)?"":j;k.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(r){var i=r.keyCode||0;if(13==i){n.children(".save").click();return false}if(27==i){n.children(".cancel").click();return false}p.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){e("#editable-post-name").click(function(){e("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}if(e("#title").val()==""){e("#title").siblings("#title-prompt-text").css("visibility","")}e("#title-prompt-text").click(function(){e(this).css("visibility","hidden").siblings("#title").focus()});e("#title").blur(function(){if(this.value==""){e(this).siblings("#title-prompt-text").css("visibility","")}}).focus(function(){e(this).siblings("#title-prompt-text").css("visibility","hidden")}).keydown(function(g){e(this).siblings("#title-prompt-text").css("visibility","hidden");e(this).unbind(g)})});
10574 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/10574/b8fb6434ffdfa1fcc33eb0e586f83d12fbcf6028/post.js/clean/wp-admin/js/post.js
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(a){var out=[];jQuery.each(a,function(key,val){val=jQuery.trim(val);if(val&&jQuery.inArray(val,out)==-1){out.push(val)}});return out}(function($){tagBox={clean:function(tags){return tags.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(el){var id=el.id,num=id.split("-check-num-")[1],taxbox=$(el).closest(".tagsdiv"),thetags=taxbox.find(".the-tags"),current_tags=thetags.val().split(","),new_tags=[];delete current_tags[num];$.each(current_tags,function(key,val){val=$.trim(val);if(val){new_tags.push(val)}});thetags.val(this.clean(new_tags.join(",")));this.quickClicks(taxbox);return false},quickClicks:function(el){var thetags=$(".the-tags",el),tagchecklist=$(".tagchecklist",el),current_tags;if(!thetags.length){return}var disabled=thetags.attr("disabled");current_tags=thetags.val().split(",");tagchecklist.empty();$.each(current_tags,function(key,val){var txt,button_id,id=$(el).attr("id");val=$.trim(val);if(!val.match(/^\s+$/)&&""!=val){button_id=id+"-check-num-"+key;if(disabled){txt="<span>"+val+"</span> "}else{txt='<span><a id="'+button_id+'" class="ntdelbutton">X</a>&nbsp;'+val+"</span> "}tagchecklist.append(txt);if(!disabled){$("#"+button_id).click(function(){tagBox.parseTags(this)})}}})},flushTags:function(el,a,f){a=a||false;var text,tags=$(".the-tags",el),newtag=$("input.newtag",el),newtags;text=a?$(a).text():newtag.val();tagsval=tags.val();newtags=tagsval?tagsval+","+text:text;newtags=this.clean(newtags);newtags=array_unique_noempty(newtags.split(",")).join(",");tags.val(newtags);this.quickClicks(el);if(!a){newtag.val("")}if("undefined"==typeof(f)){newtag.focus()}return false},get:function(id){var tax=id.substr(id.indexOf("-")+1);$.post(ajaxurl,{action:"get-tagcloud",tax:tax},function(r,stat){if(0==r||"success"!=stat){r=wpAjax.broken}r=$('<p id="tagcloud-'+tax+'" class="the-tagcloud">'+r+"</p>");$("a",r).click(function(){tagBox.flushTags($(this).closest(".inside").children(".tagsdiv"),this);return false});$("#"+id).after(r)})},init:function(){var t=this,ajaxtag=$("div.ajaxtag");$(".tagsdiv").each(function(){tagBox.quickClicks(this)});$("input.tagadd",ajaxtag).click(function(){t.flushTags($(this).closest(".tagsdiv"))});$("div.taghint",ajaxtag).click(function(){$(this).css("visibility","hidden").siblings(".newtag").focus()});$("input.newtag",ajaxtag).blur(function(){if(this.value==""){$(this).siblings(".taghint").css("visibility","")}}).focus(function(){$(this).siblings(".taghint").css("visibility","hidden")}).keyup(function(e){if(13==e.which){tagBox.flushTags($(this).closest(".tagsdiv"));return false}}).keypress(function(e){if(13==e.which){e.preventDefault();return false}}).each(function(){var tax=$(this).closest("div.tagsdiv").attr("id");$(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+tax,{delay:500,minchars:2,multiple:true,multipleSep:", "})});$("#post").submit(function(){$("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});$("a.tagcloud-link").click(function(){tagBox.get($(this).attr("id"));$(this).unbind().click(function(){$(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(total,num){var st=this.st,data;if(!num){num=20}this.st+=num;this.total=total;$("#commentsdiv img.waiting").show();data={action:"get-comments",mode:"single",_ajax_nonce:$("#add_comment_nonce").val(),post_ID:$("#post_ID").val(),start:st,num:num};$.post(ajaxurl,data,function(r){r=wpAjax.parseAjaxResponse(r);$("#commentsdiv .widefat").show();$("#commentsdiv img.waiting").hide();if("object"==typeof r&&r.responses[0]){$("#the-comment-list").append(r.responses[0].data);theList=theExtraList=null;$("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){$("#show-comments").hide()}else{$("#show-comments").html(postL10n.showcomm)}return}else{if(1==r){$("#show-comments").parent().html(postL10n.endcomm);return}}$("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(html){$(".inside","#postimagediv").html(html)};WPSetThumbnailID=function(id){var field=$("input[value=_thumbnail_id]","#list-table");if(field.size()>0){$("#meta\\["+field.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(id)}};WPRemoveThumbnail=function(){$.post(ajaxurl,{action:"set-post-thumbnail",post_id:$("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(str){if(str=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(str)}})}})(jQuery);jQuery(document).ready(function($){var stamp,visibility,sticky="";postboxes.add_postbox_toggles(pagenow);if($("#tagsdiv-post_tag").length){tagBox.init()}else{$("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}$(".categorydiv").each(function(){var this_id=$(this).attr("id"),noSyncChecks=false,syncChecks,catAddAfter,taxonomyParts,taxonomy,settingName;taxonomyParts=this_id.split("-");taxonomyParts.shift();taxonomy=taxonomyParts.join("-");settingName=taxonomy+"_tab";if(taxonomy=="category"){settingName="cats"}$("a","#"+taxonomy+"-tabs").click(function(){var t=$(this).attr("href");$(this).parent().addClass("tabs").siblings("li").removeClass("tabs");$("#"+taxonomy+"-tabs").siblings(".tabs-panel").hide();$(t).show();if("#"+taxonomy+"-all"==t){deleteUserSetting(settingName)}else{setUserSetting(settingName,"pop")}return false});if(getUserSetting(settingName)){$('a[href="#'+taxonomy+'-pop"]',"#"+taxonomy+"-tabs").click()}$("#new"+taxonomy).one("focus",function(){$(this).val("").removeClass("form-input-tip")});$("#"+taxonomy+"-add-submit").click(function(){$("#new"+taxonomy).focus()});syncChecks=function(){if(noSyncChecks){return}noSyncChecks=true;var th=jQuery(this),c=th.is(":checked"),id=th.val().toString();$("#in-"+taxonomy+"-"+id+", #in-"+taxonomy+"-category-"+id).attr("checked",c);noSyncChecks=false};catAddBefore=function(s){if(!$("#new"+taxonomy).val()){return false}s.data+="&"+$(":checked","#"+taxonomy+"checklist").serialize();return s};catAddAfter=function(r,s){var sup,drop=$("#new"+taxonomy+"_parent");if("undefined"!=s.parsed.responses[0]&&(sup=s.parsed.responses[0].supplemental.newcat_parent)){drop.before(sup);drop.remove()}};$("#"+taxonomy+"checklist").wpList({alt:"",response:taxonomy+"-ajax-response",addBefore:catAddBefore,addAfter:catAddAfter});$("#"+taxonomy+"-add-toggle").click(function(){$("#"+taxonomy+"-adder").toggleClass("wp-hidden-children");$('a[href="#'+taxonomy+'-all"]',"#"+taxonomy+"-tabs").click();return false});$("#"+taxonomy+"checklist li.popular-category :checkbox, #"+taxonomy+"checklist-pop :checkbox").live("click",function(){var t=$(this),c=t.is(":checked"),id=t.val();if(id&&t.parents("#taxonomy-"+taxonomy).length){$("#in-"+taxonomy+"-"+id+", #in-popular-"+taxonomy+"-"+id).attr("checked",c)}})});if($("#postcustom").length){$("#the-list").wpList({addAfter:function(xml,s){$("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(s.parsed.responses[0].supplemental.postid)}},addBefore:function(s){s.data+="&post_id="+$("#post_ID").val();return s}})}if($("#submitdiv").length){stamp=$("#timestamp").html();visibility=$("#post-visibility-display").html();function updateVisibility(){var pvSelect=$("#post-visibility-select");if($("input:radio:checked",pvSelect).val()!="public"){$("#sticky").attr("checked",false);$("#sticky-span").hide()}else{$("#sticky-span").show()}if($("input:radio:checked",pvSelect).val()!="password"){$("#password-span").hide()}else{$("#password-span").show()}}function updateText(){var attemptedDate,originalDate,currentDate,publishOn,page="page"==pagenow||"page-new"==pagenow,postStatus=$("#post_status"),optPublish=$("option[value=publish]",postStatus),aa=$("#aa").val(),mm=$("#mm").val(),jj=$("#jj").val(),hh=$("#hh").val(),mn=$("#mn").val();attemptedDate=new Date(aa,mm-1,jj,hh,mn);originalDate=new Date($("#hidden_aa").val(),$("#hidden_mm").val()-1,$("#hidden_jj").val(),$("#hidden_hh").val(),$("#hidden_mn").val());currentDate=new Date($("#cur_aa").val(),$("#cur_mm").val()-1,$("#cur_jj").val(),$("#cur_hh").val(),$("#cur_mn").val());if(attemptedDate.getFullYear()!=aa||(1+attemptedDate.getMonth())!=mm||attemptedDate.getDate()!=jj||attemptedDate.getMinutes()!=mn){$(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{$(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(attemptedDate>currentDate&&$("#original_post_status").val()!="future"){publishOn=postL10n.publishOnFuture;$("#publish").val(postL10n.schedule)}else{if(attemptedDate<=currentDate&&$("#original_post_status").val()!="publish"){publishOn=postL10n.publishOn;$("#publish").val(postL10n.publish)}else{publishOn=postL10n.publishOnPast;if(page){$("#publish").val(postL10n.updatePage)}else{$("#publish").val(postL10n.updatePost)}}}if(originalDate.toUTCString()==attemptedDate.toUTCString()){$("#timestamp").html(stamp)}else{$("#timestamp").html(publishOn+" <b>"+$("option[value="+$("#mm").val()+"]","#mm").text()+" "+jj+", "+aa+" @ "+hh+":"+mn+"</b> ")}if($("input:radio:checked","#post-visibility-select").val()=="private"){if(page){$("#publish").val(postL10n.updatePage)}else{$("#publish").val(postL10n.updatePost)}if(optPublish.length==0){postStatus.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{optPublish.html(postL10n.privatelyPublished)}$("option[value=publish]",postStatus).attr("selected",true);$(".edit-post-status","#misc-publishing-actions").hide()}else{if($("#original_post_status").val()=="future"||$("#original_post_status").val()=="draft"){if(optPublish.length){optPublish.remove();postStatus.val($("#hidden_post_status").val())}}else{optPublish.html(postL10n.published)}if(postStatus.is(":hidden")){$(".edit-post-status","#misc-publishing-actions").show()}}$("#post-status-display").html($("option:selected",postStatus).text());if($("option:selected",postStatus).val()=="private"||$("option:selected",postStatus).val()=="publish"){$("#save-post").hide()}else{$("#save-post").show();if($("option:selected",postStatus).val()=="pending"){$("#save-post").show().val(postL10n.savePending)}else{$("#save-post").show().val(postL10n.saveDraft)}}return true}$(".edit-visibility","#visibility").click(function(){if($("#post-visibility-select").is(":hidden")){updateVisibility();$("#post-visibility-select").slideDown("normal");$(this).hide()}return false});$(".cancel-post-visibility","#post-visibility-select").click(function(){$("#post-visibility-select").slideUp("normal");$("#visibility-radio-"+$("#hidden-post-visibility").val()).attr("checked",true);$("#post_password").val($("#hidden_post_password").val());$("#sticky").attr("checked",$("#hidden-post-sticky").attr("checked"));$("#post-visibility-display").html(visibility);$(".edit-visibility","#visibility").show();updateText();return false});$(".save-post-visibility","#post-visibility-select").click(function(){var pvSelect=$("#post-visibility-select");pvSelect.slideUp("normal");$(".edit-visibility","#visibility").show();updateText();if($("input:radio:checked",pvSelect).val()!="public"){$("#sticky").attr("checked",false)}if(true==$("#sticky").attr("checked")){sticky="Sticky"}else{sticky=""}$("#post-visibility-display").html(postL10n[$("input:radio:checked",pvSelect).val()+sticky]);return false});$("input:radio","#post-visibility-select").change(function(){updateVisibility()});$("#timestampdiv").siblings("a.edit-timestamp").click(function(){if($("#timestampdiv").is(":hidden")){$("#timestampdiv").slideDown("normal");$(this).hide()}return false});$(".cancel-timestamp","#timestampdiv").click(function(){$("#timestampdiv").slideUp("normal");$("#mm").val($("#hidden_mm").val());$("#jj").val($("#hidden_jj").val());$("#aa").val($("#hidden_aa").val());$("#hh").val($("#hidden_hh").val());$("#mn").val($("#hidden_mn").val());$("#timestampdiv").siblings("a.edit-timestamp").show();updateText();return false});$(".save-timestamp","#timestampdiv").click(function(){if(updateText()){$("#timestampdiv").slideUp("normal");$("#timestampdiv").siblings("a.edit-timestamp").show()}return false});$("#post-status-select").siblings("a.edit-post-status").click(function(){if($("#post-status-select").is(":hidden")){$("#post-status-select").slideDown("normal");$(this).hide()}return false});$(".save-post-status","#post-status-select").click(function(){$("#post-status-select").slideUp("normal");$("#post-status-select").siblings("a.edit-post-status").show();updateText();return false});$(".cancel-post-status","#post-status-select").click(function(){$("#post-status-select").slideUp("normal");$("#post_status").val($("#hidden_post_status").val());$("#post-status-select").siblings("a.edit-post-status").show();updateText();return false})}if($("#edit-slug-box").length){editPermalink=function(post_id){var i,c=0,e=$("#editable-post-name"),revert_e=e.html(),real_slug=$("#post_name"),revert_slug=real_slug.val(),b=$("#edit-slug-buttons"),revert_b=b.html(),full=$("#editable-post-name-full").html();$("#view-post-btn").hide();b.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");b.children(".save").click(function(){var new_slug=e.children("input").val();$.post(ajaxurl,{action:"sample-permalink",post_id:post_id,new_slug:new_slug,new_title:$("#title").val(),samplepermalinknonce:$("#samplepermalinknonce").val()},function(data){$("#edit-slug-box").html(data);b.html(revert_b);real_slug.attr("value",new_slug);makeSlugeditClickable();$("#view-post-btn").show()});return false});$(".cancel","#edit-slug-buttons").click(function(){$("#view-post-btn").show();e.html(revert_e);b.html(revert_b);real_slug.attr("value",revert_slug);return false});for(i=0;i<full.length;++i){if("%"==full.charAt(i)){c++}}slug_value=(c>full.length/4)?"":full;e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(e){var key=e.keyCode||0;if(13==key){b.children(".save").click();return false}if(27==key){b.children(".cancel").click();return false}real_slug.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){$("#editable-post-name").click(function(){$("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}if($("#title").val()==""){$("#title").siblings("#title-prompt-text").css("visibility","")}$("#title-prompt-text").click(function(){$(this).css("visibility","hidden").siblings("#title").focus()});$("#title").blur(function(){if(this.value==""){$(this).siblings("#title-prompt-text").css("visibility","")}}).focus(function(){$(this).siblings("#title-prompt-text").css("visibility","hidden")}).keydown(function(e){$(this).siblings("#title-prompt-text").css("visibility","hidden");$(this).unbind(e)})});
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(a){var out=[];jQuery.each(a,function(key,val){val=jQuery.trim(val);if(val&&jQuery.inArray(val,out)==-1){out.push(val)}});return out}(function($){tagBox={clean:function(tags){return tags.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(el){var id=el.id,num=id.split("-check-num-")[1],taxbox=$(el).closest(".tagsdiv"),thetags=taxbox.find(".the-tags"),current_tags=thetags.val().split(","),new_tags=[];delete current_tags[num];$.each(current_tags,function(key,val){val=$.trim(val);if(val){new_tags.push(val)}});thetags.val(this.clean(new_tags.join(",")));this.quickClicks(taxbox);return false},quickClicks:function(el){var thetags=$(".the-tags",el),tagchecklist=$(".tagchecklist",el),current_tags;if(!thetags.length){return}var disabled=thetags.attr("disabled");current_tags=thetags.val().split(",");tagchecklist.empty();$.each(current_tags,function(key,val){var txt,button_id,id=$(el).attr("id");val=$.trim(val);if(!val.match(/^\s+$/)&&""!=val){button_id=id+"-check-num-"+key;if(disabled){txt="<span>"+val+"</span> "}else{txt='<span><a id="'+button_id+'" class="ntdelbutton">X</a>&nbsp;'+val+"</span> "}tagchecklist.append(txt);if(!disabled){$("#"+button_id).click(function(){tagBox.parseTags(this)})}}})},flushTags:function(el,a,f){a=a||false;var text,tags=$(".the-tags",el),newtag=$("input.newtag",el),newtags;text=a?$(a).text():newtag.val();tagsval=tags.val();newtags=tagsval?tagsval+","+text:text;newtags=this.clean(newtags);newtags=array_unique_noempty(newtags.split(",")).join(",");tags.val(newtags);this.quickClicks(el);if(!a){newtag.val("")}if("undefined"==typeof(f)){newtag.focus()}return false},get:function(id){var tax=id.substr(id.indexOf("-")+1);$.post(ajaxurl,{action:"get-tagcloud",tax:tax},function(r,stat){if(0==r||"success"!=stat){r=wpAjax.broken}r=$('<p id="tagcloud-'+tax+'" class="the-tagcloud">'+r+"</p>");$("a",r).click(function(){tagBox.flushTags($(this).closest(".inside").children(".tagsdiv"),this);return false});$("#"+id).after(r)})},init:function(){var t=this,ajaxtag=$("div.ajaxtag");$(".tagsdiv").each(function(){tagBox.quickClicks(this)});$("input.tagadd",ajaxtag).click(function(){t.flushTags($(this).closest(".tagsdiv"))});$("div.taghint",ajaxtag).click(function(){$(this).css("visibility","hidden").siblings(".newtag").focus()});$("input.newtag",ajaxtag).blur(function(){if(this.value==""){$(this).siblings(".taghint").css("visibility","")}}).focus(function(){$(this).siblings(".taghint").css("visibility","hidden")}).keyup(function(e){if(13==e.which){tagBox.flushTags($(this).closest(".tagsdiv"));return false}}).keypress(function(e){if(13==e.which){e.preventDefault();return false}}).each(function(){var tax=$(this).closest("div.tagsdiv").attr("id");$(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+tax,{delay:500,minchars:2,multiple:true,multipleSep:","})});$("#post").submit(function(){$("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});$("a.tagcloud-link").click(function(){tagBox.get($(this).attr("id"));$(this).unbind().click(function(){$(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(total,num){var st=this.st,data;if(!num){num=20}this.st+=num;this.total=total;$("#commentsdiv img.waiting").show();data={action:"get-comments",mode:"single",_ajax_nonce:$("#add_comment_nonce").val(),post_ID:$("#post_ID").val(),start:st,num:num};$.post(ajaxurl,data,function(r){r=wpAjax.parseAjaxResponse(r);$("#commentsdiv .widefat").show();$("#commentsdiv img.waiting").hide();if("object"==typeof r&&r.responses[0]){$("#the-comment-list").append(r.responses[0].data);theList=theExtraList=null;$("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){$("#show-comments").hide()}else{$("#show-comments").html(postL10n.showcomm)}return}else{if(1==r){$("#show-comments").parent().html(postL10n.endcomm);return}}$("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(html){$(".inside","#postimagediv").html(html)};WPSetThumbnailID=function(id){var field=$("input[value=_thumbnail_id]","#list-table");if(field.size()>0){$("#meta\\["+field.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(id)}};WPRemoveThumbnail=function(){$.post(ajaxurl,{action:"set-post-thumbnail",post_id:$("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(str){if(str=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(str)}})}})(jQuery);jQuery(document).ready(function($){var stamp,visibility,sticky="";postboxes.add_postbox_toggles(pagenow);if($("#tagsdiv-post_tag").length){tagBox.init()}else{$("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}$(".categorydiv").each(function(){var this_id=$(this).attr("id"),noSyncChecks=false,syncChecks,catAddAfter,taxonomyParts,taxonomy,settingName;taxonomyParts=this_id.split("-");taxonomyParts.shift();taxonomy=taxonomyParts.join("-");settingName=taxonomy+"_tab";if(taxonomy=="category"){settingName="cats"}$("a","#"+taxonomy+"-tabs").click(function(){var t=$(this).attr("href");$(this).parent().addClass("tabs").siblings("li").removeClass("tabs");$("#"+taxonomy+"-tabs").siblings(".tabs-panel").hide();$(t).show();if("#"+taxonomy+"-all"==t){deleteUserSetting(settingName)}else{setUserSetting(settingName,"pop")}return false});if(getUserSetting(settingName)){$('a[href="#'+taxonomy+'-pop"]',"#"+taxonomy+"-tabs").click()}$("#new"+taxonomy).one("focus",function(){$(this).val("").removeClass("form-input-tip")});$("#"+taxonomy+"-add-submit").click(function(){$("#new"+taxonomy).focus()});syncChecks=function(){if(noSyncChecks){return}noSyncChecks=true;var th=jQuery(this),c=th.is(":checked"),id=th.val().toString();$("#in-"+taxonomy+"-"+id+", #in-"+taxonomy+"-category-"+id).attr("checked",c);noSyncChecks=false};catAddBefore=function(s){if(!$("#new"+taxonomy).val()){return false}s.data+="&"+$(":checked","#"+taxonomy+"checklist").serialize();return s};catAddAfter=function(r,s){var sup,drop=$("#new"+taxonomy+"_parent");if("undefined"!=s.parsed.responses[0]&&(sup=s.parsed.responses[0].supplemental.newcat_parent)){drop.before(sup);drop.remove()}};$("#"+taxonomy+"checklist").wpList({alt:"",response:taxonomy+"-ajax-response",addBefore:catAddBefore,addAfter:catAddAfter});$("#"+taxonomy+"-add-toggle").click(function(){$("#"+taxonomy+"-adder").toggleClass("wp-hidden-children");$('a[href="#'+taxonomy+'-all"]',"#"+taxonomy+"-tabs").click();return false});$("#"+taxonomy+"checklist li.popular-category :checkbox, #"+taxonomy+"checklist-pop :checkbox").live("click",function(){var t=$(this),c=t.is(":checked"),id=t.val();if(id&&t.parents("#taxonomy-"+taxonomy).length){$("#in-"+taxonomy+"-"+id+", #in-popular-"+taxonomy+"-"+id).attr("checked",c)}})});if($("#postcustom").length){$("#the-list").wpList({addAfter:function(xml,s){$("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(s.parsed.responses[0].supplemental.postid)}},addBefore:function(s){s.data+="&post_id="+$("#post_ID").val();return s}})}if($("#submitdiv").length){stamp=$("#timestamp").html();visibility=$("#post-visibility-display").html();function updateVisibility(){var pvSelect=$("#post-visibility-select");if($("input:radio:checked",pvSelect).val()!="public"){$("#sticky").attr("checked",false);$("#sticky-span").hide()}else{$("#sticky-span").show()}if($("input:radio:checked",pvSelect).val()!="password"){$("#password-span").hide()}else{$("#password-span").show()}}function updateText(){var attemptedDate,originalDate,currentDate,publishOn,page="page"==pagenow||"page-new"==pagenow,postStatus=$("#post_status"),optPublish=$("option[value=publish]",postStatus),aa=$("#aa").val(),mm=$("#mm").val(),jj=$("#jj").val(),hh=$("#hh").val(),mn=$("#mn").val();attemptedDate=new Date(aa,mm-1,jj,hh,mn);originalDate=new Date($("#hidden_aa").val(),$("#hidden_mm").val()-1,$("#hidden_jj").val(),$("#hidden_hh").val(),$("#hidden_mn").val());currentDate=new Date($("#cur_aa").val(),$("#cur_mm").val()-1,$("#cur_jj").val(),$("#cur_hh").val(),$("#cur_mn").val());if(attemptedDate.getFullYear()!=aa||(1+attemptedDate.getMonth())!=mm||attemptedDate.getDate()!=jj||attemptedDate.getMinutes()!=mn){$(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{$(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(attemptedDate>currentDate&&$("#original_post_status").val()!="future"){publishOn=postL10n.publishOnFuture;$("#publish").val(postL10n.schedule)}else{if(attemptedDate<=currentDate&&$("#original_post_status").val()!="publish"){publishOn=postL10n.publishOn;$("#publish").val(postL10n.publish)}else{publishOn=postL10n.publishOnPast;if(page){$("#publish").val(postL10n.updatePage)}else{$("#publish").val(postL10n.updatePost)}}}if(originalDate.toUTCString()==attemptedDate.toUTCString()){$("#timestamp").html(stamp)}else{$("#timestamp").html(publishOn+" <b>"+$("option[value="+$("#mm").val()+"]","#mm").text()+" "+jj+", "+aa+" @ "+hh+":"+mn+"</b> ")}if($("input:radio:checked","#post-visibility-select").val()=="private"){if(page){$("#publish").val(postL10n.updatePage)}else{$("#publish").val(postL10n.updatePost)}if(optPublish.length==0){postStatus.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{optPublish.html(postL10n.privatelyPublished)}$("option[value=publish]",postStatus).attr("selected",true);$(".edit-post-status","#misc-publishing-actions").hide()}else{if($("#original_post_status").val()=="future"||$("#original_post_status").val()=="draft"){if(optPublish.length){optPublish.remove();postStatus.val($("#hidden_post_status").val())}}else{optPublish.html(postL10n.published)}if(postStatus.is(":hidden")){$(".edit-post-status","#misc-publishing-actions").show()}}$("#post-status-display").html($("option:selected",postStatus).text());if($("option:selected",postStatus).val()=="private"||$("option:selected",postStatus).val()=="publish"){$("#save-post").hide()}else{$("#save-post").show();if($("option:selected",postStatus).val()=="pending"){$("#save-post").show().val(postL10n.savePending)}else{$("#save-post").show().val(postL10n.saveDraft)}}return true}$(".edit-visibility","#visibility").click(function(){if($("#post-visibility-select").is(":hidden")){updateVisibility();$("#post-visibility-select").slideDown("normal");$(this).hide()}return false});$(".cancel-post-visibility","#post-visibility-select").click(function(){$("#post-visibility-select").slideUp("normal");$("#visibility-radio-"+$("#hidden-post-visibility").val()).attr("checked",true);$("#post_password").val($("#hidden_post_password").val());$("#sticky").attr("checked",$("#hidden-post-sticky").attr("checked"));$("#post-visibility-display").html(visibility);$(".edit-visibility","#visibility").show();updateText();return false});$(".save-post-visibility","#post-visibility-select").click(function(){var pvSelect=$("#post-visibility-select");pvSelect.slideUp("normal");$(".edit-visibility","#visibility").show();updateText();if($("input:radio:checked",pvSelect).val()!="public"){$("#sticky").attr("checked",false)}if(true==$("#sticky").attr("checked")){sticky="Sticky"}else{sticky=""}$("#post-visibility-display").html(postL10n[$("input:radio:checked",pvSelect).val()+sticky]);return false});$("input:radio","#post-visibility-select").change(function(){updateVisibility()});$("#timestampdiv").siblings("a.edit-timestamp").click(function(){if($("#timestampdiv").is(":hidden")){$("#timestampdiv").slideDown("normal");$(this).hide()}return false});$(".cancel-timestamp","#timestampdiv").click(function(){$("#timestampdiv").slideUp("normal");$("#mm").val($("#hidden_mm").val());$("#jj").val($("#hidden_jj").val());$("#aa").val($("#hidden_aa").val());$("#hh").val($("#hidden_hh").val());$("#mn").val($("#hidden_mn").val());$("#timestampdiv").siblings("a.edit-timestamp").show();updateText();return false});$(".save-timestamp","#timestampdiv").click(function(){if(updateText()){$("#timestampdiv").slideUp("normal");$("#timestampdiv").siblings("a.edit-timestamp").show()}return false});$("#post-status-select").siblings("a.edit-post-status").click(function(){if($("#post-status-select").is(":hidden")){$("#post-status-select").slideDown("normal");$(this).hide()}return false});$(".save-post-status","#post-status-select").click(function(){$("#post-status-select").slideUp("normal");$("#post-status-select").siblings("a.edit-post-status").show();updateText();return false});$(".cancel-post-status","#post-status-select").click(function(){$("#post-status-select").slideUp("normal");$("#post_status").val($("#hidden_post_status").val());$("#post-status-select").siblings("a.edit-post-status").show();updateText();return false})}if($("#edit-slug-box").length){editPermalink=function(post_id){var i,c=0,e=$("#editable-post-name"),revert_e=e.html(),real_slug=$("#post_name"),revert_slug=real_slug.val(),b=$("#edit-slug-buttons"),revert_b=b.html(),full=$("#editable-post-name-full").html();$("#view-post-btn").hide();b.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");b.children(".save").click(function(){var new_slug=e.children("input").val();$.post(ajaxurl,{action:"sample-permalink",post_id:post_id,new_slug:new_slug,new_title:$("#title").val(),samplepermalinknonce:$("#samplepermalinknonce").val()},function(data){$("#edit-slug-box").html(data);b.html(revert_b);real_slug.attr("value",new_slug);makeSlugeditClickable();$("#view-post-btn").show()});return false});$(".cancel","#edit-slug-buttons").click(function(){$("#view-post-btn").show();e.html(revert_e);b.html(revert_b);real_slug.attr("value",revert_slug);return false});for(i=0;i<full.length;++i){if("%"==full.charAt(i)){c++}}slug_value=(c>full.length/4)?"":full;e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(e){var key=e.keyCode||0;if(13==key){b.children(".save").click();return false}if(27==key){b.children(".cancel").click();return false}real_slug.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){$("#editable-post-name").click(function(){$("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}if($("#title").val()==""){$("#title").siblings("#title-prompt-text").css("visibility","")}$("#title-prompt-text").click(function(){$(this).css("visibility","hidden").siblings("#title").focus()});$("#title").blur(function(){if(this.value==""){$(this).siblings("#title-prompt-text").css("visibility","")}}).focus(function(){$(this).siblings("#title-prompt-text").css("visibility","hidden")}).keydown(function(e){$(this).siblings("#title-prompt-text").css("visibility","hidden");$(this).unbind(e)})});
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(a){var out=[];jQuery.each(a,function(key,val){val=jQuery.trim(val);if(val&&jQuery.inArray(val,out)==-1){out.push(val)}});return out}(function($){tagBox={clean:function(tags){return tags.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(el){var id=el.id,num=id.split("-check-num-")[1],taxbox=$(el).closest(".tagsdiv"),thetags=taxbox.find(".the-tags"),current_tags=thetags.val().split(","),new_tags=[];delete current_tags[num];$.each(current_tags,function(key,val){val=$.trim(val);if(val){new_tags.push(val)}});thetags.val(this.clean(new_tags.join(",")));this.quickClicks(taxbox);return false},quickClicks:function(el){var thetags=$(".the-tags",el),tagchecklist=$(".tagchecklist",el),current_tags;if(!thetags.length){return}var disabled=thetags.attr("disabled");current_tags=thetags.val().split(",");tagchecklist.empty();$.each(current_tags,function(key,val){var txt,button_id,id=$(el).attr("id");val=$.trim(val);if(!val.match(/^\s+$/)&&""!=val){button_id=id+"-check-num-"+key;if(disabled){txt="<span>"+val+"</span> "}else{txt='<span><a id="'+button_id+'" class="ntdelbutton">X</a>&nbsp;'+val+"</span> "}tagchecklist.append(txt);if(!disabled){$("#"+button_id).click(function(){tagBox.parseTags(this)})}}})},flushTags:function(el,a,f){a=a||false;var text,tags=$(".the-tags",el),newtag=$("input.newtag",el),newtags;text=a?$(a).text():newtag.val();tagsval=tags.val();newtags=tagsval?tagsval+","+text:text;newtags=this.clean(newtags);newtags=array_unique_noempty(newtags.split(",")).join(",");tags.val(newtags);this.quickClicks(el);if(!a){newtag.val("")}if("undefined"==typeof(f)){newtag.focus()}return false},get:function(id){var tax=id.substr(id.indexOf("-")+1);$.post(ajaxurl,{action:"get-tagcloud",tax:tax},function(r,stat){if(0==r||"success"!=stat){r=wpAjax.broken}r=$('<p id="tagcloud-'+tax+'" class="the-tagcloud">'+r+"</p>");$("a",r).click(function(){tagBox.flushTags($(this).closest(".inside").children(".tagsdiv"),this);return false});$("#"+id).after(r)})},init:function(){var t=this,ajaxtag=$("div.ajaxtag");$(".tagsdiv").each(function(){tagBox.quickClicks(this)});$("input.tagadd",ajaxtag).click(function(){t.flushTags($(this).closest(".tagsdiv"))});$("div.taghint",ajaxtag).click(function(){$(this).css("visibility","hidden").siblings(".newtag").focus()});$("input.newtag",ajaxtag).blur(function(){if(this.value==""){$(this).siblings(".taghint").css("visibility","")}}).focus(function(){$(this).siblings(".taghint").css("visibility","hidden")}).keyup(function(e){if(13==e.which){tagBox.flushTags($(this).closest(".tagsdiv"));return false}}).keypress(function(e){if(13==e.which){e.preventDefault();return false}}).each(function(){var tax=$(this).closest("div.tagsdiv").attr("id");$(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+tax,{delay:500,minchars:2,multiple:true,multipleSep:", "})});$("#post").submit(function(){$("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});$("a.tagcloud-link").click(function(){tagBox.get($(this).attr("id"));$(this).unbind().click(function(){$(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(total,num){var st=this.st,data;if(!num){num=20}this.st+=num;this.total=total;$("#commentsdiv img.waiting").show();data={action:"get-comments",mode:"single",_ajax_nonce:$("#add_comment_nonce").val(),post_ID:$("#post_ID").val(),start:st,num:num};$.post(ajaxurl,data,function(r){r=wpAjax.parseAjaxResponse(r);$("#commentsdiv .widefat").show();$("#commentsdiv img.waiting").hide();if("object"==typeof r&&r.responses[0]){$("#the-comment-list").append(r.responses[0].data);theList=theExtraList=null;$("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){$("#show-comments").hide()}else{$("#show-comments").html(postL10n.showcomm)}return}else{if(1==r){$("#show-comments").parent().html(postL10n.endcomm);return}}$("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(html){$(".inside","#postimagediv").html(html)};WPSetThumbnailID=function(id){var field=$("input[value=_thumbnail_id]","#list-table");if(field.size()>0){$("#meta\\["+field.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(id)}};WPRemoveThumbnail=function(){$.post(ajaxurl,{action:"set-post-thumbnail",post_id:$("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(str){if(str=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(str)}})}})(jQuery);jQuery(document).ready(function($){var stamp,visibility,sticky="";postboxes.add_postbox_toggles(pagenow);if($("#tagsdiv-post_tag").length){tagBox.init()}else{$("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}$(".categorydiv").each(function(){var this_id=$(this).attr("id"),noSyncChecks=false,syncChecks,catAddAfter,taxonomyParts,taxonomy,settingName;taxonomyParts=this_id.split("-");taxonomyParts.shift();taxonomy=taxonomyParts.join("-");settingName=taxonomy+"_tab";if(taxonomy=="category"){settingName="cats"}$("a","#"+taxonomy+"-tabs").click(function(){var t=$(this).attr("href");$(this).parent().addClass("tabs").siblings("li").removeClass("tabs");$("#"+taxonomy+"-tabs").siblings(".tabs-panel").hide();$(t).show();if("#"+taxonomy+"-all"==t){deleteUserSetting(settingName)}else{setUserSetting(settingName,"pop")}return false});if(getUserSetting(settingName)){$('a[href="#'+taxonomy+'-pop"]',"#"+taxonomy+"-tabs").click()}$("#new"+taxonomy).one("focus",function(){$(this).val("").removeClass("form-input-tip")});$("#"+taxonomy+"-add-submit").click(function(){$("#new"+taxonomy).focus()});syncChecks=function(){if(noSyncChecks){return}noSyncChecks=true;var th=jQuery(this),c=th.is(":checked"),id=th.val().toString();$("#in-"+taxonomy+"-"+id+", #in-"+taxonomy+"-category-"+id).attr("checked",c);noSyncChecks=false};catAddBefore=function(s){if(!$("#new"+taxonomy).val()){return false}s.data+="&"+$(":checked","#"+taxonomy+"checklist").serialize();return s};catAddAfter=function(r,s){var sup,drop=$("#new"+taxonomy+"_parent");if("undefined"!=s.parsed.responses[0]&&(sup=s.parsed.responses[0].supplemental.newcat_parent)){drop.before(sup);drop.remove()}};$("#"+taxonomy+"checklist").wpList({alt:"",response:taxonomy+"-ajax-response",addBefore:catAddBefore,addAfter:catAddAfter});$("#"+taxonomy+"-add-toggle").click(function(){$("#"+taxonomy+"-adder").toggleClass("wp-hidden-children");$('a[href="#'+taxonomy+'-all"]',"#"+taxonomy+"-tabs").click();return false});$("#"+taxonomy+"checklist li.popular-category :checkbox, #"+taxonomy+"checklist-pop :checkbox").live("click",function(){var t=$(this),c=t.is(":checked"),id=t.val();if(id&&t.parents("#taxonomy-"+taxonomy).length){$("#in-"+taxonomy+"-"+id+", #in-popular-"+taxonomy+"-"+id).attr("checked",c)}})});if($("#postcustom").length){$("#the-list").wpList({addAfter:function(xml,s){$("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(s.parsed.responses[0].supplemental.postid)}},addBefore:function(s){s.data+="&post_id="+$("#post_ID").val();return s}})}if($("#submitdiv").length){stamp=$("#timestamp").html();visibility=$("#post-visibility-display").html();function updateVisibility(){var pvSelect=$("#post-visibility-select");if($("input:radio:checked",pvSelect).val()!="public"){$("#sticky").attr("checked",false);$("#sticky-span").hide()}else{$("#sticky-span").show()}if($("input:radio:checked",pvSelect).val()!="password"){$("#password-span").hide()}else{$("#password-span").show()}}function updateText(){var attemptedDate,originalDate,currentDate,publishOn,page="page"==pagenow||"page-new"==pagenow,postStatus=$("#post_status"),optPublish=$("option[value=publish]",postStatus),aa=$("#aa").val(),mm=$("#mm").val(),jj=$("#jj").val(),hh=$("#hh").val(),mn=$("#mn").val();attemptedDate=new Date(aa,mm-1,jj,hh,mn);originalDate=new Date($("#hidden_aa").val(),$("#hidden_mm").val()-1,$("#hidden_jj").val(),$("#hidden_hh").val(),$("#hidden_mn").val());currentDate=new Date($("#cur_aa").val(),$("#cur_mm").val()-1,$("#cur_jj").val(),$("#cur_hh").val(),$("#cur_mn").val());if(attemptedDate.getFullYear()!=aa||(1+attemptedDate.getMonth())!=mm||attemptedDate.getDate()!=jj||attemptedDate.getMinutes()!=mn){$(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{$(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(attemptedDate>currentDate&&$("#original_post_status").val()!="future"){publishOn=postL10n.publishOnFuture;$("#publish").val(postL10n.schedule)}else{if(attemptedDate<=currentDate&&$("#original_post_status").val()!="publish"){publishOn=postL10n.publishOn;$("#publish").val(postL10n.publish)}else{publishOn=postL10n.publishOnPast;if(page){$("#publish").val(postL10n.updatePage)}else{$("#publish").val(postL10n.updatePost)}}}if(originalDate.toUTCString()==attemptedDate.toUTCString()){$("#timestamp").html(stamp)}else{$("#timestamp").html(publishOn+" <b>"+$("option[value="+$("#mm").val()+"]","#mm").text()+" "+jj+", "+aa+" @ "+hh+":"+mn+"</b> ")}if($("input:radio:checked","#post-visibility-select").val()=="private"){if(page){$("#publish").val(postL10n.updatePage)}else{$("#publish").val(postL10n.updatePost)}if(optPublish.length==0){postStatus.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{optPublish.html(postL10n.privatelyPublished)}$("option[value=publish]",postStatus).attr("selected",true);$(".edit-post-status","#misc-publishing-actions").hide()}else{if($("#original_post_status").val()=="future"||$("#original_post_status").val()=="draft"){if(optPublish.length){optPublish.remove();postStatus.val($("#hidden_post_status").val())}}else{optPublish.html(postL10n.published)}if(postStatus.is(":hidden")){$(".edit-post-status","#misc-publishing-actions").show()}}$("#post-status-display").html($("option:selected",postStatus).text());if($("option:selected",postStatus).val()=="private"||$("option:selected",postStatus).val()=="publish"){$("#save-post").hide()}else{$("#save-post").show();if($("option:selected",postStatus).val()=="pending"){$("#save-post").show().val(postL10n.savePending)}else{$("#save-post").show().val(postL10n.saveDraft)}}return true}$(".edit-visibility","#visibility").click(function(){if($("#post-visibility-select").is(":hidden")){updateVisibility();$("#post-visibility-select").slideDown("normal");$(this).hide()}return false});$(".cancel-post-visibility","#post-visibility-select").click(function(){$("#post-visibility-select").slideUp("normal");$("#visibility-radio-"+$("#hidden-post-visibility").val()).attr("checked",true);$("#post_password").val($("#hidden_post_password").val());$("#sticky").attr("checked",$("#hidden-post-sticky").attr("checked"));$("#post-visibility-display").html(visibility);$(".edit-visibility","#visibility").show();updateText();return false});$(".save-post-visibility","#post-visibility-select").click(function(){var pvSelect=$("#post-visibility-select");pvSelect.slideUp("normal");$(".edit-visibility","#visibility").show();updateText();if($("input:radio:checked",pvSelect).val()!="public"){$("#sticky").attr("checked",false)}if(true==$("#sticky").attr("checked")){sticky="Sticky"}else{sticky=""}$("#post-visibility-display").html(postL10n[$("input:radio:checked",pvSelect).val()+sticky]);return false});$("input:radio","#post-visibility-select").change(function(){updateVisibility()});$("#timestampdiv").siblings("a.edit-timestamp").click(function(){if($("#timestampdiv").is(":hidden")){$("#timestampdiv").slideDown("normal");$(this).hide()}return false});$(".cancel-timestamp","#timestampdiv").click(function(){$("#timestampdiv").slideUp("normal");$("#mm").val($("#hidden_mm").val());$("#jj").val($("#hidden_jj").val());$("#aa").val($("#hidden_aa").val());$("#hh").val($("#hidden_hh").val());$("#mn").val($("#hidden_mn").val());$("#timestampdiv").siblings("a.edit-timestamp").show();updateText();return false});$(".save-timestamp","#timestampdiv").click(function(){if(updateText()){$("#timestampdiv").slideUp("normal");$("#timestampdiv").siblings("a.edit-timestamp").show()}return false});$("#post-status-select").siblings("a.edit-post-status").click(function(){if($("#post-status-select").is(":hidden")){$("#post-status-select").slideDown("normal");$(this).hide()}return false});$(".save-post-status","#post-status-select").click(function(){$("#post-status-select").slideUp("normal");$("#post-status-select").siblings("a.edit-post-status").show();updateText();return false});$(".cancel-post-status","#post-status-select").click(function(){$("#post-status-select").slideUp("normal");$("#post_status").val($("#hidden_post_status").val());$("#post-status-select").siblings("a.edit-post-status").show();updateText();return false})}if($("#edit-slug-box").length){editPermalink=function(post_id){var i,c=0,e=$("#editable-post-name"),revert_e=e.html(),real_slug=$("#post_name"),revert_slug=real_slug.val(),b=$("#edit-slug-buttons"),revert_b=b.html(),full=$("#editable-post-name-full").html();$("#view-post-btn").hide();b.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");b.children(".save").click(function(){var new_slug=e.children("input").val();$.post(ajaxurl,{action:"sample-permalink",post_id:post_id,new_slug:new_slug,new_title:$("#title").val(),samplepermalinknonce:$("#samplepermalinknonce").val()},function(data){$("#edit-slug-box").html(data);b.html(revert_b);real_slug.attr("value",new_slug);makeSlugeditClickable();$("#view-post-btn").show()});return false});$(".cancel","#edit-slug-buttons").click(function(){$("#view-post-btn").show();e.html(revert_e);b.html(revert_b);real_slug.attr("value",revert_slug);return false});for(i=0;i<full.length;++i){if("%"==full.charAt(i)){c++}}slug_value=(c>full.length/4)?"":full;e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(e){var key=e.keyCode||0;if(13==key){b.children(".save").click();return false}if(27==key){b.children(".cancel").click();return false}real_slug.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){$("#editable-post-name").click(function(){$("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}if($("#title").val()==""){$("#title").siblings("#title-prompt-text").css("visibility","")}$("#title-prompt-text").click(function(){$(this).css("visibility","hidden").siblings("#title").focus()});$("#title").blur(function(){if(this.value==""){$(this).siblings("#title-prompt-text").css("visibility","")}}).focus(function(){$(this).siblings("#title-prompt-text").css("visibility","hidden")}).keydown(function(e){$(this).siblings("#title-prompt-text").css("visibility","hidden");$(this).unbind(e)})});
10574 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/10574/560c524bf1e5fe52e4798ad1823074714caeda74/post.js/buggy/wp-admin/js/post.js
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(a){var out=[];jQuery.each(a,function(key,val){val=jQuery.trim(val);if(val&&jQuery.inArray(val,out)==-1){out.push(val)}});return out}(function($){tagBox={clean:function(tags){return tags.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(el){var id=el.id,num=id.split("-check-num-")[1],taxbox=$(el).closest(".tagsdiv"),thetags=taxbox.find(".the-tags"),current_tags=thetags.val().split(","),new_tags=[];delete current_tags[num];$.each(current_tags,function(key,val){val=$.trim(val);if(val){new_tags.push(val)}});thetags.val(this.clean(new_tags.join(",")));this.quickClicks(taxbox);return false},quickClicks:function(el){var thetags=$(".the-tags",el),tagchecklist=$(".tagchecklist",el),current_tags;if(!thetags.length){return}var disabled=thetags.attr("disabled");current_tags=thetags.val().split(",");tagchecklist.empty();$.each(current_tags,function(key,val){var txt,button_id,id=$(el).attr("id");val=$.trim(val);if(!val.match(/^\s+$/)&&""!=val){button_id=id+"-check-num-"+key;if(disabled){txt="<span>"+val+"</span> "}else{txt='<span><a id="'+button_id+'" class="ntdelbutton">X</a>&nbsp;'+val+"</span> "}tagchecklist.append(txt);if(!disabled){$("#"+button_id).click(function(){tagBox.parseTags(this)})}}})},flushTags:function(el,a,f){a=a||false;var text,tags=$(".the-tags",el),newtag=$("input.newtag",el),newtags;text=a?$(a).text():newtag.val();tagsval=tags.val();newtags=tagsval?tagsval+","+text:text;newtags=this.clean(newtags);newtags=array_unique_noempty(newtags.split(",")).join(",");tags.val(newtags);this.quickClicks(el);if(!a){newtag.val("")}if("undefined"==typeof(f)){newtag.focus()}return false},get:function(id){var tax=id.substr(id.indexOf("-")+1);$.post(ajaxurl,{action:"get-tagcloud",tax:tax},function(r,stat){if(0==r||"success"!=stat){r=wpAjax.broken}r=$('<p id="tagcloud-'+tax+'" class="the-tagcloud">'+r+"</p>");$("a",r).click(function(){tagBox.flushTags($(this).closest(".inside").children(".tagsdiv"),this);return false});$("#"+id).after(r)})},init:function(){var t=this,ajaxtag=$("div.ajaxtag");$(".tagsdiv").each(function(){tagBox.quickClicks(this)});$("input.tagadd",ajaxtag).click(function(){t.flushTags($(this).closest(".tagsdiv"))});$("div.taghint",ajaxtag).click(function(){$(this).css("visibility","hidden").siblings(".newtag").focus()});$("input.newtag",ajaxtag).blur(function(){if(this.value==""){$(this).siblings(".taghint").css("visibility","")}}).focus(function(){$(this).siblings(".taghint").css("visibility","hidden")}).keyup(function(e){if(13==e.which){tagBox.flushTags($(this).closest(".tagsdiv"));return false}}).keypress(function(e){if(13==e.which){e.preventDefault();return false}}).each(function(){var tax=$(this).closest("div.tagsdiv").attr("id");$(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+tax,{delay:500,minchars:2,multiple:true,multipleSep:", "})});$("#post").submit(function(){$("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});$("a.tagcloud-link").click(function(){tagBox.get($(this).attr("id"));$(this).unbind().click(function(){$(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(total,num){var st=this.st,data;if(!num){num=20}this.st+=num;this.total=total;$("#commentsdiv img.waiting").show();data={action:"get-comments",mode:"single",_ajax_nonce:$("#add_comment_nonce").val(),post_ID:$("#post_ID").val(),start:st,num:num};$.post(ajaxurl,data,function(r){r=wpAjax.parseAjaxResponse(r);$("#commentsdiv .widefat").show();$("#commentsdiv img.waiting").hide();if("object"==typeof r&&r.responses[0]){$("#the-comment-list").append(r.responses[0].data);theList=theExtraList=null;$("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){$("#show-comments").hide()}else{$("#show-comments").html(postL10n.showcomm)}return}else{if(1==r){$("#show-comments").parent().html(postL10n.endcomm);return}}$("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(html){$(".inside","#postimagediv").html(html)};WPSetThumbnailID=function(id){var field=$("input[value=_thumbnail_id]","#list-table");if(field.size()>0){$("#meta\\["+field.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(id)}};WPRemoveThumbnail=function(){$.post(ajaxurl,{action:"set-post-thumbnail",post_id:$("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(str){if(str=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(str)}})}})(jQuery);jQuery(document).ready(function($){var stamp,visibility,sticky="";postboxes.add_postbox_toggles(pagenow);if($("#tagsdiv-post_tag").length){tagBox.init()}else{$("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}$(".categorydiv").each(function(){var this_id=$(this).attr("id"),noSyncChecks=false,syncChecks,catAddAfter,taxonomyParts,taxonomy,settingName;taxonomyParts=this_id.split("-");taxonomyParts.shift();taxonomy=taxonomyParts.join("-");settingName=taxonomy+"_tab";if(taxonomy=="category"){settingName="cats"}$("a","#"+taxonomy+"-tabs").click(function(){var t=$(this).attr("href");$(this).parent().addClass("tabs").siblings("li").removeClass("tabs");$("#"+taxonomy+"-tabs").siblings(".tabs-panel").hide();$(t).show();if("#"+taxonomy+"-all"==t){deleteUserSetting(settingName)}else{setUserSetting(settingName,"pop")}return false});if(getUserSetting(settingName)){$('a[href="#'+taxonomy+'-pop"]',"#"+taxonomy+"-tabs").click()}$("#new"+taxonomy).one("focus",function(){$(this).val("").removeClass("form-input-tip")});$("#"+taxonomy+"-add-submit").click(function(){$("#new"+taxonomy).focus()});syncChecks=function(){if(noSyncChecks){return}noSyncChecks=true;var th=jQuery(this),c=th.is(":checked"),id=th.val().toString();$("#in-"+taxonomy+"-"+id+", #in-"+taxonomy+"-category-"+id).attr("checked",c);noSyncChecks=false};catAddBefore=function(s){if(!$("#new"+taxonomy).val()){return false}s.data+="&"+$(":checked","#"+taxonomy+"checklist").serialize();return s};catAddAfter=function(r,s){var sup,drop=$("#new"+taxonomy+"_parent");if("undefined"!=s.parsed.responses[0]&&(sup=s.parsed.responses[0].supplemental.newcat_parent)){drop.before(sup);drop.remove()}};$("#"+taxonomy+"checklist").wpList({alt:"",response:taxonomy+"-ajax-response",addBefore:catAddBefore,addAfter:catAddAfter});$("#"+taxonomy+"-add-toggle").click(function(){$("#"+taxonomy+"-adder").toggleClass("wp-hidden-children");$('a[href="#'+taxonomy+'-all"]',"#"+taxonomy+"-tabs").click();return false});$("#"+taxonomy+"checklist li.popular-category :checkbox, #"+taxonomy+"checklist-pop :checkbox").live("click",function(){var t=$(this),c=t.is(":checked"),id=t.val();if(id&&t.parents("#taxonomy-"+taxonomy).length){$("#in-"+taxonomy+"-"+id+", #in-popular-"+taxonomy+"-"+id).attr("checked",c)}})});if($("#postcustom").length){$("#the-list").wpList({addAfter:function(xml,s){$("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(s.parsed.responses[0].supplemental.postid)}},addBefore:function(s){s.data+="&post_id="+$("#post_ID").val();return s}})}if($("#submitdiv").length){stamp=$("#timestamp").html();visibility=$("#post-visibility-display").html();function updateVisibility(){var pvSelect=$("#post-visibility-select");if($("input:radio:checked",pvSelect).val()!="public"){$("#sticky").attr("checked",false);$("#sticky-span").hide()}else{$("#sticky-span").show()}if($("input:radio:checked",pvSelect).val()!="password"){$("#password-span").hide()}else{$("#password-span").show()}}function updateText(){var attemptedDate,originalDate,currentDate,publishOn,postStatus=$("#post_status"),optPublish=$("option[value=publish]",postStatus),aa=$("#aa").val(),mm=$("#mm").val(),jj=$("#jj").val(),hh=$("#hh").val(),mn=$("#mn").val();attemptedDate=new Date(aa,mm-1,jj,hh,mn);originalDate=new Date($("#hidden_aa").val(),$("#hidden_mm").val()-1,$("#hidden_jj").val(),$("#hidden_hh").val(),$("#hidden_mn").val());currentDate=new Date($("#cur_aa").val(),$("#cur_mm").val()-1,$("#cur_jj").val(),$("#cur_hh").val(),$("#cur_mn").val());if(attemptedDate.getFullYear()!=aa||(1+attemptedDate.getMonth())!=mm||attemptedDate.getDate()!=jj||attemptedDate.getMinutes()!=mn){$(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{$(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(attemptedDate>currentDate&&$("#original_post_status").val()!="future"){publishOn=postL10n.publishOnFuture;$("#publish").val(postL10n.schedule)}else{if(attemptedDate<=currentDate&&$("#original_post_status").val()!="publish"){publishOn=postL10n.publishOn;$("#publish").val(postL10n.publish)}else{publishOn=postL10n.publishOnPast;if(page){$("#publish").val(postL10n.updatePage)}else{$("#publish").val(postL10n.updatePost)}}}if(originalDate.toUTCString()==attemptedDate.toUTCString()){$("#timestamp").html(stamp)}else{$("#timestamp").html(publishOn+" <b>"+$("option[value="+$("#mm").val()+"]","#mm").text()+" "+jj+", "+aa+" @ "+hh+":"+mn+"</b> ")}if($("input:radio:checked","#post-visibility-select").val()=="private"){if(page){$("#publish").val(postL10n.updatePage)}else{$("#publish").val(postL10n.updatePost)}if(optPublish.length==0){postStatus.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{optPublish.html(postL10n.privatelyPublished)}$("option[value=publish]",postStatus).attr("selected",true);$(".edit-post-status","#misc-publishing-actions").hide()}else{if($("#original_post_status").val()=="future"||$("#original_post_status").val()=="draft"){if(optPublish.length){optPublish.remove();postStatus.val($("#hidden_post_status").val())}}else{optPublish.html(postL10n.published)}if(postStatus.is(":hidden")){$(".edit-post-status","#misc-publishing-actions").show()}}$("#post-status-display").html($("option:selected",postStatus).text());if($("option:selected",postStatus).val()=="private"||$("option:selected",postStatus).val()=="publish"){$("#save-post").hide()}else{$("#save-post").show();if($("option:selected",postStatus).val()=="pending"){$("#save-post").show().val(postL10n.savePending)}else{$("#save-post").show().val(postL10n.saveDraft)}}return true}$(".edit-visibility","#visibility").click(function(){if($("#post-visibility-select").is(":hidden")){updateVisibility();$("#post-visibility-select").slideDown("normal");$(this).hide()}return false});$(".cancel-post-visibility","#post-visibility-select").click(function(){$("#post-visibility-select").slideUp("normal");$("#visibility-radio-"+$("#hidden-post-visibility").val()).attr("checked",true);$("#post_password").val($("#hidden_post_password").val());$("#sticky").attr("checked",$("#hidden-post-sticky").attr("checked"));$("#post-visibility-display").html(visibility);$(".edit-visibility","#visibility").show();updateText();return false});$(".save-post-visibility","#post-visibility-select").click(function(){var pvSelect=$("#post-visibility-select");pvSelect.slideUp("normal");$(".edit-visibility","#visibility").show();updateText();if($("input:radio:checked",pvSelect).val()!="public"){$("#sticky").attr("checked",false)}if(true==$("#sticky").attr("checked")){sticky="Sticky"}else{sticky=""}$("#post-visibility-display").html(postL10n[$("input:radio:checked",pvSelect).val()+sticky]);return false});$("input:radio","#post-visibility-select").change(function(){updateVisibility()});$("#timestampdiv").siblings("a.edit-timestamp").click(function(){if($("#timestampdiv").is(":hidden")){$("#timestampdiv").slideDown("normal");$(this).hide()}return false});$(".cancel-timestamp","#timestampdiv").click(function(){$("#timestampdiv").slideUp("normal");$("#mm").val($("#hidden_mm").val());$("#jj").val($("#hidden_jj").val());$("#aa").val($("#hidden_aa").val());$("#hh").val($("#hidden_hh").val());$("#mn").val($("#hidden_mn").val());$("#timestampdiv").siblings("a.edit-timestamp").show();updateText();return false});$(".save-timestamp","#timestampdiv").click(function(){if(updateText()){$("#timestampdiv").slideUp("normal");$("#timestampdiv").siblings("a.edit-timestamp").show()}return false});$("#post-status-select").siblings("a.edit-post-status").click(function(){if($("#post-status-select").is(":hidden")){$("#post-status-select").slideDown("normal");$(this).hide()}return false});$(".save-post-status","#post-status-select").click(function(){$("#post-status-select").slideUp("normal");$("#post-status-select").siblings("a.edit-post-status").show();updateText();return false});$(".cancel-post-status","#post-status-select").click(function(){$("#post-status-select").slideUp("normal");$("#post_status").val($("#hidden_post_status").val());$("#post-status-select").siblings("a.edit-post-status").show();updateText();return false})}if($("#edit-slug-box").length){editPermalink=function(post_id){var i,c=0,e=$("#editable-post-name"),revert_e=e.html(),real_slug=$("#post_name"),revert_slug=real_slug.html(),b=$("#edit-slug-buttons"),revert_b=b.html(),full=$("#editable-post-name-full").html();$("#view-post-btn").hide();b.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");b.children(".save").click(function(){var new_slug=e.children("input").val();$.post(ajaxurl,{action:"sample-permalink",post_id:post_id,new_slug:new_slug,new_title:$("#title").val(),samplepermalinknonce:$("#samplepermalinknonce").val()},function(data){$("#edit-slug-box").html(data);b.html(revert_b);real_slug.attr("value",new_slug);makeSlugeditClickable();$("#view-post-btn").show()});return false});$(".cancel","#edit-slug-buttons").click(function(){$("#view-post-btn").show();e.html(revert_e);b.html(revert_b);real_slug.attr("value",revert_slug);return false});for(i=0;i<full.length;++i){if("%"==full.charAt(i)){c++}}slug_value=(c>full.length/4)?"":full;e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(e){var key=e.keyCode||0;if(13==key){b.children(".save").click();return false}if(27==key){b.children(".cancel").click();return false}real_slug.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){$("#editable-post-name").click(function(){$("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}});
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(a){var out=[];jQuery.each(a,function(key,val){val=jQuery.trim(val);if(val&&jQuery.inArray(val,out)==-1){out.push(val)}});return out}(function($){tagBox={clean:function(tags){return tags.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(el){var id=el.id,num=id.split("-check-num-")[1],taxbox=$(el).closest(".tagsdiv"),thetags=taxbox.find(".the-tags"),current_tags=thetags.val().split(","),new_tags=[];delete current_tags[num];$.each(current_tags,function(key,val){val=$.trim(val);if(val){new_tags.push(val)}});thetags.val(this.clean(new_tags.join(",")));this.quickClicks(taxbox);return false},quickClicks:function(el){var thetags=$(".the-tags",el),tagchecklist=$(".tagchecklist",el),current_tags;if(!thetags.length){return}var disabled=thetags.attr("disabled");current_tags=thetags.val().split(",");tagchecklist.empty();$.each(current_tags,function(key,val){var txt,button_id,id=$(el).attr("id");val=$.trim(val);if(!val.match(/^\s+$/)&&""!=val){button_id=id+"-check-num-"+key;if(disabled){txt="<span>"+val+"</span> "}else{txt='<span><a id="'+button_id+'" class="ntdelbutton">X</a>&nbsp;'+val+"</span> "}tagchecklist.append(txt);if(!disabled){$("#"+button_id).click(function(){tagBox.parseTags(this)})}}})},flushTags:function(el,a,f){a=a||false;var text,tags=$(".the-tags",el),newtag=$("input.newtag",el),newtags;text=a?$(a).text():newtag.val();tagsval=tags.val();newtags=tagsval?tagsval+","+text:text;newtags=this.clean(newtags);newtags=array_unique_noempty(newtags.split(",")).join(",");tags.val(newtags);this.quickClicks(el);if(!a){newtag.val("")}if("undefined"==typeof(f)){newtag.focus()}return false},get:function(id){var tax=id.substr(id.indexOf("-")+1);$.post(ajaxurl,{action:"get-tagcloud",tax:tax},function(r,stat){if(0==r||"success"!=stat){r=wpAjax.broken}r=$('<p id="tagcloud-'+tax+'" class="the-tagcloud">'+r+"</p>");$("a",r).click(function(){tagBox.flushTags($(this).closest(".inside").children(".tagsdiv"),this);return false});$("#"+id).after(r)})},init:function(){var t=this,ajaxtag=$("div.ajaxtag");$(".tagsdiv").each(function(){tagBox.quickClicks(this)});$("input.tagadd",ajaxtag).click(function(){t.flushTags($(this).closest(".tagsdiv"))});$("div.taghint",ajaxtag).click(function(){$(this).css("visibility","hidden").siblings(".newtag").focus()});$("input.newtag",ajaxtag).blur(function(){if(this.value==""){$(this).siblings(".taghint").css("visibility","")}}).focus(function(){$(this).siblings(".taghint").css("visibility","hidden")}).keyup(function(e){if(13==e.which){tagBox.flushTags($(this).closest(".tagsdiv"));return false}}).keypress(function(e){if(13==e.which){e.preventDefault();return false}}).each(function(){var tax=$(this).closest("div.tagsdiv").attr("id");$(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+tax,{delay:500,minchars:2,multiple:true,multipleSep:", "})});$("#post").submit(function(){$("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});$("a.tagcloud-link").click(function(){tagBox.get($(this).attr("id"));$(this).unbind().click(function(){$(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(total,num){var st=this.st,data;if(!num){num=20}this.st+=num;this.total=total;$("#commentsdiv img.waiting").show();data={action:"get-comments",mode:"single",_ajax_nonce:$("#add_comment_nonce").val(),post_ID:$("#post_ID").val(),start:st,num:num};$.post(ajaxurl,data,function(r){r=wpAjax.parseAjaxResponse(r);$("#commentsdiv .widefat").show();$("#commentsdiv img.waiting").hide();if("object"==typeof r&&r.responses[0]){$("#the-comment-list").append(r.responses[0].data);theList=theExtraList=null;$("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){$("#show-comments").hide()}else{$("#show-comments").html(postL10n.showcomm)}return}else{if(1==r){$("#show-comments").parent().html(postL10n.endcomm);return}}$("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(html){$(".inside","#postimagediv").html(html)};WPSetThumbnailID=function(id){var field=$("input[value=_thumbnail_id]","#list-table");if(field.size()>0){$("#meta\\["+field.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(id)}};WPRemoveThumbnail=function(){$.post(ajaxurl,{action:"set-post-thumbnail",post_id:$("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(str){if(str=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(str)}})}})(jQuery);jQuery(document).ready(function($){var stamp,visibility,sticky="";postboxes.add_postbox_toggles(pagenow);if($("#tagsdiv-post_tag").length){tagBox.init()}else{$("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}$(".categorydiv").each(function(){var this_id=$(this).attr("id"),noSyncChecks=false,syncChecks,catAddAfter,taxonomyParts,taxonomy,settingName;taxonomyParts=this_id.split("-");taxonomyParts.shift();taxonomy=taxonomyParts.join("-");settingName=taxonomy+"_tab";if(taxonomy=="category"){settingName="cats"}$("a","#"+taxonomy+"-tabs").click(function(){var t=$(this).attr("href");$(this).parent().addClass("tabs").siblings("li").removeClass("tabs");$("#"+taxonomy+"-tabs").siblings(".tabs-panel").hide();$(t).show();if("#"+taxonomy+"-all"==t){deleteUserSetting(settingName)}else{setUserSetting(settingName,"pop")}return false});if(getUserSetting(settingName)){$('a[href="#'+taxonomy+'-pop"]',"#"+taxonomy+"-tabs").click()}$("#new"+taxonomy).one("focus",function(){$(this).val("").removeClass("form-input-tip")});$("#"+taxonomy+"-add-submit").click(function(){$("#new"+taxonomy).focus()});syncChecks=function(){if(noSyncChecks){return}noSyncChecks=true;var th=jQuery(this),c=th.is(":checked"),id=th.val().toString();$("#in-"+taxonomy+"-"+id+", #in-"+taxonomy+"-category-"+id).attr("checked",c);noSyncChecks=false};catAddBefore=function(s){if(!$("#new"+taxonomy).val()){return false}s.data+="&"+$(":checked","#"+taxonomy+"checklist").serialize();return s};catAddAfter=function(r,s){var sup,drop=$("#new"+taxonomy+"_parent");if("undefined"!=s.parsed.responses[0]&&(sup=s.parsed.responses[0].supplemental.newcat_parent)){drop.before(sup);drop.remove()}};$("#"+taxonomy+"checklist").wpList({alt:"",response:taxonomy+"-ajax-response",addBefore:catAddBefore,addAfter:catAddAfter});$("#"+taxonomy+"-add-toggle").click(function(){$("#"+taxonomy+"-adder").toggleClass("wp-hidden-children");$('a[href="#'+taxonomy+'-all"]',"#"+taxonomy+"-tabs").click();return false});$("#"+taxonomy+"checklist li.popular-category :checkbox, #"+taxonomy+"checklist-pop :checkbox").live("click",function(){var t=$(this),c=t.is(":checked"),id=t.val();if(id&&t.parents("#taxonomy-"+taxonomy).length){$("#in-"+taxonomy+"-"+id+", #in-popular-"+taxonomy+"-"+id).attr("checked",c)}})});if($("#postcustom").length){$("#the-list").wpList({addAfter:function(xml,s){$("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(s.parsed.responses[0].supplemental.postid)}},addBefore:function(s){s.data+="&post_id="+$("#post_ID").val();return s}})}if($("#submitdiv").length){stamp=$("#timestamp").html();visibility=$("#post-visibility-display").html();function updateVisibility(){var pvSelect=$("#post-visibility-select");if($("input:radio:checked",pvSelect).val()!="public"){$("#sticky").attr("checked",false);$("#sticky-span").hide()}else{$("#sticky-span").show()}if($("input:radio:checked",pvSelect).val()!="password"){$("#password-span").hide()}else{$("#password-span").show()}}function updateText(){var attemptedDate,originalDate,currentDate,publishOn,postStatus=$("#post_status"),optPublish=$("option[value=publish]",postStatus),aa=$("#aa").val(),mm=$("#mm").val(),jj=$("#jj").val(),hh=$("#hh").val(),mn=$("#mn").val();attemptedDate=new Date(aa,mm-1,jj,hh,mn);originalDate=new Date($("#hidden_aa").val(),$("#hidden_mm").val()-1,$("#hidden_jj").val(),$("#hidden_hh").val(),$("#hidden_mn").val());currentDate=new Date($("#cur_aa").val(),$("#cur_mm").val()-1,$("#cur_jj").val(),$("#cur_hh").val(),$("#cur_mn").val());if(attemptedDate.getFullYear()!=aa||(1+attemptedDate.getMonth())!=mm||attemptedDate.getDate()!=jj||attemptedDate.getMinutes()!=mn){$(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{$(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(attemptedDate>currentDate&&$("#original_post_status").val()!="future"){publishOn=postL10n.publishOnFuture;$("#publish").val(postL10n.schedule)}else{if(attemptedDate<=currentDate&&$("#original_post_status").val()!="publish"){publishOn=postL10n.publishOn;$("#publish").val(postL10n.publish)}else{publishOn=postL10n.publishOnPast;if(page){$("#publish").val(postL10n.updatePage)}else{$("#publish").val(postL10n.updatePost)}}}if(originalDate.toUTCString()==attemptedDate.toUTCString()){$("#timestamp").html(stamp)}else{$("#timestamp").html(publishOn+" <b>"+$("option[value="+$("#mm").val()+"]","#mm").text()+" "+jj+", "+aa+" @ "+hh+":"+mn+"</b> ")}if($("input:radio:checked","#post-visibility-select").val()=="private"){if(page){$("#publish").val(postL10n.updatePage)}else{$("#publish").val(postL10n.updatePost)}if(optPublish.length==0){postStatus.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{optPublish.html(postL10n.privatelyPublished)}$("option[value=publish]",postStatus).attr("selected",true);$(".edit-post-status","#misc-publishing-actions").hide()}else{if($("#original_post_status").val()=="future"||$("#original_post_status").val()=="draft"){if(optPublish.length){optPublish.remove();postStatus.val($("#hidden_post_status").val())}}else{optPublish.html(postL10n.published)}if(postStatus.is(":hidden")){$(".edit-post-status","#misc-publishing-actions").show()}}$("#post-status-display").html($("option:selected",postStatus).text());if($("option:selected",postStatus).val()=="private"||$("option:selected",postStatus).val()=="publish"){$("#save-post").hide()}else{$("#save-post").show();if($("option:selected",postStatus).val()=="pending"){$("#save-post").show().val(postL10n.savePending)}else{$("#save-post").show().val(postL10n.saveDraft)}}return true}$(".edit-visibility","#visibility").click(function(){if($("#post-visibility-select").is(":hidden")){updateVisibility();$("#post-visibility-select").slideDown("normal");$(this).hide()}return false});$(".cancel-post-visibility","#post-visibility-select").click(function(){$("#post-visibility-select").slideUp("normal");$("#visibility-radio-"+$("#hidden-post-visibility").val()).attr("checked",true);$("#post_password").val($("#hidden_post_password").val());$("#sticky").attr("checked",$("#hidden-post-sticky").attr("checked"));$("#post-visibility-display").html(visibility);$(".edit-visibility","#visibility").show();updateText();return false});$(".save-post-visibility","#post-visibility-select").click(function(){var pvSelect=$("#post-visibility-select");pvSelect.slideUp("normal");$(".edit-visibility","#visibility").show();updateText();if($("input:radio:checked",pvSelect).val()!="public"){$("#sticky").attr("checked",false)}if(true==$("#sticky").attr("checked")){sticky="Sticky"}else{sticky=""}$("#post-visibility-display").html(postL10n[$("input:radio:checked",pvSelect).val()+sticky]);return false});$("input:radio","#post-visibility-select").change(function(){updateVisibility()});$("#timestampdiv").siblings("a.edit-timestamp").click(function(){if($("#timestampdiv").is(":hidden")){$("#timestampdiv").slideDown("normal");$(this).hide()}return false});$(".cancel-timestamp","#timestampdiv").click(function(){$("#timestampdiv").slideUp("normal");$("#mm").val($("#hidden_mm").val());$("#jj").val($("#hidden_jj").val());$("#aa").val($("#hidden_aa").val());$("#hh").val($("#hidden_hh").val());$("#mn").val($("#hidden_mn").val());$("#timestampdiv").siblings("a.edit-timestamp").show();updateText();return false});$(".save-timestamp","#timestampdiv").click(function(){if(updateText()){$("#timestampdiv").slideUp("normal");$("#timestampdiv").siblings("a.edit-timestamp").show()}return false});$("#post-status-select").siblings("a.edit-post-status").click(function(){if($("#post-status-select").is(":hidden")){$("#post-status-select").slideDown("normal");$(this).hide()}return false});$(".save-post-status","#post-status-select").click(function(){$("#post-status-select").slideUp("normal");$("#post-status-select").siblings("a.edit-post-status").show();updateText();return false});$(".cancel-post-status","#post-status-select").click(function(){$("#post-status-select").slideUp("normal");$("#post_status").val($("#hidden_post_status").val());$("#post-status-select").siblings("a.edit-post-status").show();updateText();return false})}if($("#edit-slug-box").length){editPermalink=function(post_id){var i,c=0,e=$("#editable-post-name"),revert_e=e.html(),real_slug=$("#post_name"),revert_slug=real_slug.val(),b=$("#edit-slug-buttons"),revert_b=b.html(),full=$("#editable-post-name-full").html();$("#view-post-btn").hide();b.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");b.children(".save").click(function(){var new_slug=e.children("input").val();$.post(ajaxurl,{action:"sample-permalink",post_id:post_id,new_slug:new_slug,new_title:$("#title").val(),samplepermalinknonce:$("#samplepermalinknonce").val()},function(data){$("#edit-slug-box").html(data);b.html(revert_b);real_slug.attr("value",new_slug);makeSlugeditClickable();$("#view-post-btn").show()});return false});$(".cancel","#edit-slug-buttons").click(function(){$("#view-post-btn").show();e.html(revert_e);b.html(revert_b);real_slug.attr("value",revert_slug);return false});for(i=0;i<full.length;++i){if("%"==full.charAt(i)){c++}}slug_value=(c>full.length/4)?"":full;e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(e){var key=e.keyCode||0;if(13==key){b.children(".save").click();return false}if(27==key){b.children(".cancel").click();return false}real_slug.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){$("#editable-post-name").click(function(){$("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}});
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(a){var out=[];jQuery.each(a,function(key,val){val=jQuery.trim(val);if(val&&jQuery.inArray(val,out)==-1){out.push(val)}});return out}(function($){tagBox={clean:function(tags){return tags.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(el){var id=el.id,num=id.split("-check-num-")[1],taxbox=$(el).closest(".tagsdiv"),thetags=taxbox.find(".the-tags"),current_tags=thetags.val().split(","),new_tags=[];delete current_tags[num];$.each(current_tags,function(key,val){val=$.trim(val);if(val){new_tags.push(val)}});thetags.val(this.clean(new_tags.join(",")));this.quickClicks(taxbox);return false},quickClicks:function(el){var thetags=$(".the-tags",el),tagchecklist=$(".tagchecklist",el),current_tags;if(!thetags.length){return}var disabled=thetags.attr("disabled");current_tags=thetags.val().split(",");tagchecklist.empty();$.each(current_tags,function(key,val){var txt,button_id,id=$(el).attr("id");val=$.trim(val);if(!val.match(/^\s+$/)&&""!=val){button_id=id+"-check-num-"+key;if(disabled){txt="<span>"+val+"</span> "}else{txt='<span><a id="'+button_id+'" class="ntdelbutton">X</a>&nbsp;'+val+"</span> "}tagchecklist.append(txt);if(!disabled){$("#"+button_id).click(function(){tagBox.parseTags(this)})}}})},flushTags:function(el,a,f){a=a||false;var text,tags=$(".the-tags",el),newtag=$("input.newtag",el),newtags;text=a?$(a).text():newtag.val();tagsval=tags.val();newtags=tagsval?tagsval+","+text:text;newtags=this.clean(newtags);newtags=array_unique_noempty(newtags.split(",")).join(",");tags.val(newtags);this.quickClicks(el);if(!a){newtag.val("")}if("undefined"==typeof(f)){newtag.focus()}return false},get:function(id){var tax=id.substr(id.indexOf("-")+1);$.post(ajaxurl,{action:"get-tagcloud",tax:tax},function(r,stat){if(0==r||"success"!=stat){r=wpAjax.broken}r=$('<p id="tagcloud-'+tax+'" class="the-tagcloud">'+r+"</p>");$("a",r).click(function(){tagBox.flushTags($(this).closest(".inside").children(".tagsdiv"),this);return false});$("#"+id).after(r)})},init:function(){var t=this,ajaxtag=$("div.ajaxtag");$(".tagsdiv").each(function(){tagBox.quickClicks(this)});$("input.tagadd",ajaxtag).click(function(){t.flushTags($(this).closest(".tagsdiv"))});$("div.taghint",ajaxtag).click(function(){$(this).css("visibility","hidden").siblings(".newtag").focus()});$("input.newtag",ajaxtag).blur(function(){if(this.value==""){$(this).siblings(".taghint").css("visibility","")}}).focus(function(){$(this).siblings(".taghint").css("visibility","hidden")}).keyup(function(e){if(13==e.which){tagBox.flushTags($(this).closest(".tagsdiv"));return false}}).keypress(function(e){if(13==e.which){e.preventDefault();return false}}).each(function(){var tax=$(this).closest("div.tagsdiv").attr("id");$(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+tax,{delay:500,minchars:2,multiple:true,multipleSep:", "})});$("#post").submit(function(){$("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});$("a.tagcloud-link").click(function(){tagBox.get($(this).attr("id"));$(this).unbind().click(function(){$(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(total,num){var st=this.st,data;if(!num){num=20}this.st+=num;this.total=total;$("#commentsdiv img.waiting").show();data={action:"get-comments",mode:"single",_ajax_nonce:$("#add_comment_nonce").val(),post_ID:$("#post_ID").val(),start:st,num:num};$.post(ajaxurl,data,function(r){r=wpAjax.parseAjaxResponse(r);$("#commentsdiv .widefat").show();$("#commentsdiv img.waiting").hide();if("object"==typeof r&&r.responses[0]){$("#the-comment-list").append(r.responses[0].data);theList=theExtraList=null;$("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){$("#show-comments").hide()}else{$("#show-comments").html(postL10n.showcomm)}return}else{if(1==r){$("#show-comments").parent().html(postL10n.endcomm);return}}$("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(html){$(".inside","#postimagediv").html(html)};WPSetThumbnailID=function(id){var field=$("input[value=_thumbnail_id]","#list-table");if(field.size()>0){$("#meta\\["+field.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(id)}};WPRemoveThumbnail=function(){$.post(ajaxurl,{action:"set-post-thumbnail",post_id:$("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(str){if(str=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(str)}})}})(jQuery);jQuery(document).ready(function($){var stamp,visibility,sticky="";postboxes.add_postbox_toggles(pagenow);if($("#tagsdiv-post_tag").length){tagBox.init()}else{$("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}$(".categorydiv").each(function(){var this_id=$(this).attr("id"),noSyncChecks=false,syncChecks,catAddAfter,taxonomyParts,taxonomy,settingName;taxonomyParts=this_id.split("-");taxonomyParts.shift();taxonomy=taxonomyParts.join("-");settingName=taxonomy+"_tab";if(taxonomy=="category"){settingName="cats"}$("a","#"+taxonomy+"-tabs").click(function(){var t=$(this).attr("href");$(this).parent().addClass("tabs").siblings("li").removeClass("tabs");$("#"+taxonomy+"-tabs").siblings(".tabs-panel").hide();$(t).show();if("#"+taxonomy+"-all"==t){deleteUserSetting(settingName)}else{setUserSetting(settingName,"pop")}return false});if(getUserSetting(settingName)){$('a[href="#'+taxonomy+'-pop"]',"#"+taxonomy+"-tabs").click()}$("#new"+taxonomy).one("focus",function(){$(this).val("").removeClass("form-input-tip")});$("#"+taxonomy+"-add-submit").click(function(){$("#new"+taxonomy).focus()});syncChecks=function(){if(noSyncChecks){return}noSyncChecks=true;var th=jQuery(this),c=th.is(":checked"),id=th.val().toString();$("#in-"+taxonomy+"-"+id+", #in-"+taxonomy+"-category-"+id).attr("checked",c);noSyncChecks=false};catAddBefore=function(s){if(!$("#new"+taxonomy).val()){return false}s.data+="&"+$(":checked","#"+taxonomy+"checklist").serialize();return s};catAddAfter=function(r,s){var sup,drop=$("#new"+taxonomy+"_parent");if("undefined"!=s.parsed.responses[0]&&(sup=s.parsed.responses[0].supplemental.newcat_parent)){drop.before(sup);drop.remove()}};$("#"+taxonomy+"checklist").wpList({alt:"",response:taxonomy+"-ajax-response",addBefore:catAddBefore,addAfter:catAddAfter});$("#"+taxonomy+"-add-toggle").click(function(){$("#"+taxonomy+"-adder").toggleClass("wp-hidden-children");$('a[href="#'+taxonomy+'-all"]',"#"+taxonomy+"-tabs").click();return false});$("#"+taxonomy+"checklist li.popular-category :checkbox, #"+taxonomy+"checklist-pop :checkbox").live("click",function(){var t=$(this),c=t.is(":checked"),id=t.val();if(id&&t.parents("#taxonomy-"+taxonomy).length){$("#in-"+taxonomy+"-"+id+", #in-popular-"+taxonomy+"-"+id).attr("checked",c)}})});if($("#postcustom").length){$("#the-list").wpList({addAfter:function(xml,s){$("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(s.parsed.responses[0].supplemental.postid)}},addBefore:function(s){s.data+="&post_id="+$("#post_ID").val();return s}})}if($("#submitdiv").length){stamp=$("#timestamp").html();visibility=$("#post-visibility-display").html();function updateVisibility(){var pvSelect=$("#post-visibility-select");if($("input:radio:checked",pvSelect).val()!="public"){$("#sticky").attr("checked",false);$("#sticky-span").hide()}else{$("#sticky-span").show()}if($("input:radio:checked",pvSelect).val()!="password"){$("#password-span").hide()}else{$("#password-span").show()}}function updateText(){var attemptedDate,originalDate,currentDate,publishOn,postStatus=$("#post_status"),optPublish=$("option[value=publish]",postStatus),aa=$("#aa").val(),mm=$("#mm").val(),jj=$("#jj").val(),hh=$("#hh").val(),mn=$("#mn").val();attemptedDate=new Date(aa,mm-1,jj,hh,mn);originalDate=new Date($("#hidden_aa").val(),$("#hidden_mm").val()-1,$("#hidden_jj").val(),$("#hidden_hh").val(),$("#hidden_mn").val());currentDate=new Date($("#cur_aa").val(),$("#cur_mm").val()-1,$("#cur_jj").val(),$("#cur_hh").val(),$("#cur_mn").val());if(attemptedDate.getFullYear()!=aa||(1+attemptedDate.getMonth())!=mm||attemptedDate.getDate()!=jj||attemptedDate.getMinutes()!=mn){$(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{$(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(attemptedDate>currentDate&&$("#original_post_status").val()!="future"){publishOn=postL10n.publishOnFuture;$("#publish").val(postL10n.schedule)}else{if(attemptedDate<=currentDate&&$("#original_post_status").val()!="publish"){publishOn=postL10n.publishOn;$("#publish").val(postL10n.publish)}else{publishOn=postL10n.publishOnPast;if(page){$("#publish").val(postL10n.updatePage)}else{$("#publish").val(postL10n.updatePost)}}}if(originalDate.toUTCString()==attemptedDate.toUTCString()){$("#timestamp").html(stamp)}else{$("#timestamp").html(publishOn+" <b>"+$("option[value="+$("#mm").val()+"]","#mm").text()+" "+jj+", "+aa+" @ "+hh+":"+mn+"</b> ")}if($("input:radio:checked","#post-visibility-select").val()=="private"){if(page){$("#publish").val(postL10n.updatePage)}else{$("#publish").val(postL10n.updatePost)}if(optPublish.length==0){postStatus.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{optPublish.html(postL10n.privatelyPublished)}$("option[value=publish]",postStatus).attr("selected",true);$(".edit-post-status","#misc-publishing-actions").hide()}else{if($("#original_post_status").val()=="future"||$("#original_post_status").val()=="draft"){if(optPublish.length){optPublish.remove();postStatus.val($("#hidden_post_status").val())}}else{optPublish.html(postL10n.published)}if(postStatus.is(":hidden")){$(".edit-post-status","#misc-publishing-actions").show()}}$("#post-status-display").html($("option:selected",postStatus).text());if($("option:selected",postStatus).val()=="private"||$("option:selected",postStatus).val()=="publish"){$("#save-post").hide()}else{$("#save-post").show();if($("option:selected",postStatus).val()=="pending"){$("#save-post").show().val(postL10n.savePending)}else{$("#save-post").show().val(postL10n.saveDraft)}}return true}$(".edit-visibility","#visibility").click(function(){if($("#post-visibility-select").is(":hidden")){updateVisibility();$("#post-visibility-select").slideDown("normal");$(this).hide()}return false});$(".cancel-post-visibility","#post-visibility-select").click(function(){$("#post-visibility-select").slideUp("normal");$("#visibility-radio-"+$("#hidden-post-visibility").val()).attr("checked",true);$("#post_password").val($("#hidden_post_password").val());$("#sticky").attr("checked",$("#hidden-post-sticky").attr("checked"));$("#post-visibility-display").html(visibility);$(".edit-visibility","#visibility").show();updateText();return false});$(".save-post-visibility","#post-visibility-select").click(function(){var pvSelect=$("#post-visibility-select");pvSelect.slideUp("normal");$(".edit-visibility","#visibility").show();updateText();if($("input:radio:checked",pvSelect).val()!="public"){$("#sticky").attr("checked",false)}if(true==$("#sticky").attr("checked")){sticky="Sticky"}else{sticky=""}$("#post-visibility-display").html(postL10n[$("input:radio:checked",pvSelect).val()+sticky]);return false});$("input:radio","#post-visibility-select").change(function(){updateVisibility()});$("#timestampdiv").siblings("a.edit-timestamp").click(function(){if($("#timestampdiv").is(":hidden")){$("#timestampdiv").slideDown("normal");$(this).hide()}return false});$(".cancel-timestamp","#timestampdiv").click(function(){$("#timestampdiv").slideUp("normal");$("#mm").val($("#hidden_mm").val());$("#jj").val($("#hidden_jj").val());$("#aa").val($("#hidden_aa").val());$("#hh").val($("#hidden_hh").val());$("#mn").val($("#hidden_mn").val());$("#timestampdiv").siblings("a.edit-timestamp").show();updateText();return false});$(".save-timestamp","#timestampdiv").click(function(){if(updateText()){$("#timestampdiv").slideUp("normal");$("#timestampdiv").siblings("a.edit-timestamp").show()}return false});$("#post-status-select").siblings("a.edit-post-status").click(function(){if($("#post-status-select").is(":hidden")){$("#post-status-select").slideDown("normal");$(this).hide()}return false});$(".save-post-status","#post-status-select").click(function(){$("#post-status-select").slideUp("normal");$("#post-status-select").siblings("a.edit-post-status").show();updateText();return false});$(".cancel-post-status","#post-status-select").click(function(){$("#post-status-select").slideUp("normal");$("#post_status").val($("#hidden_post_status").val());$("#post-status-select").siblings("a.edit-post-status").show();updateText();return false})}if($("#edit-slug-box").length){editPermalink=function(post_id){var i,c=0,e=$("#editable-post-name"),revert_e=e.html(),real_slug=$("#post_name"),revert_slug=real_slug.html(),b=$("#edit-slug-buttons"),revert_b=b.html(),full=$("#editable-post-name-full").html();$("#view-post-btn").hide();b.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");b.children(".save").click(function(){var new_slug=e.children("input").val();$.post(ajaxurl,{action:"sample-permalink",post_id:post_id,new_slug:new_slug,new_title:$("#title").val(),samplepermalinknonce:$("#samplepermalinknonce").val()},function(data){$("#edit-slug-box").html(data);b.html(revert_b);real_slug.attr("value",new_slug);makeSlugeditClickable();$("#view-post-btn").show()});return false});$(".cancel","#edit-slug-buttons").click(function(){$("#view-post-btn").show();e.html(revert_e);b.html(revert_b);real_slug.attr("value",revert_slug);return false});for(i=0;i<full.length;++i){if("%"==full.charAt(i)){c++}}slug_value=(c>full.length/4)?"":full;e.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(e){var key=e.keyCode||0;if(13==key){b.children(".save").click();return false}if(27==key){b.children(".cancel").click();return false}real_slug.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){$("#editable-post-name").click(function(){$("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}});
10574 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/10574/51dac4a8c61f888c09dbd51ddc3a2c502be79491/post.js/clean/wp-admin/js/post.js
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(c){var e=a(".the-tags",c),d=a(".tagchecklist",c),b;if(!e.length){return}b=e.val().split(",");d.empty();a.each(b,function(h,i){var f,g,j=a(c).attr("id");i=a.trim(i);if(!i.match(/^\s+$/)&&""!=i){g=j+"-check-num-"+h;f='<span><a id="'+g+'" class="ntdelbutton">X</a>&nbsp;'+i+"</span> ";d.append(f);a("#"+g).click(function(){tagBox.parseTags(this)})}})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});a("#"+c).after(e)})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").siblings(".newtag").focus()});a("input.newtag",c).blur(function(){if(this.value==""){a(this).siblings(".taghint").css("visibility","")}}).focus(function(){a(this).siblings(".taghint").css("visibility","hidden")}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+d,{delay:500,minchars:2,multiple:true,multipleSep:", "})});a("#post").submit(function(){a("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){tagBox.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(b){a(".inside","#postimagediv").html(b)};WPSetThumbnailID=function(c){var b=a("input[value=_thumbnail_id]","#list-table");if(b.size()>0){a("#meta\\["+b.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(c)}};WPRemoveThumbnail=function(){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(b){if(b=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(b)}})}})(jQuery);jQuery(document).ready(function(g){var c,a,h="",b="post"==pagenow||"post-new"==pagenow,f="page"==pagenow||"page-new"==pagenow;if(b){type="post";if(typenow){type=typenow}postboxes.add_postbox_toggles(type)}else{if(f){postboxes.add_postbox_toggles("page")}}if(g("#tagsdiv-post_tag").length){tagBox.init()}else{g("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}g(".categorydiv").each(function(){var o=g(this).attr("id"),j=false,m,p,l;var n=o.split("-");n.shift();var i=n.join("-");var k=i+"_tab";if(i=="category"){k="cats"}g("a","#"+i+"-tabs").click(function(){var q=g(this).attr("href");g(this).parent().addClass("tabs").siblings("li").removeClass("tabs");g("#"+i+"-tabs").siblings(".tabs-panel").hide();g(q).show();if("#"+i+"-all"==q){deleteUserSetting(k)}else{setUserSetting(k,"pop")}return false});if(getUserSetting(k)){g('a[href="#'+i+'-pop"]',"#"+i+"-tabs").click()}g("#new"+i).one("focus",function(){g(this).val("").removeClass("form-input-tip")});g("#"+i+"-add-submit").click(function(){g("#new"+i).focus()});m=function(){if(j){return}j=true;var q=jQuery(this),s=q.is(":checked"),r=q.val().toString();g("#in-"+i+"-"+r+", #in-"+i+"-category-"+r).attr("checked",s);j=false};catAddBefore=function(q){if(!g("#new"+i).val()){return false}q.data+="&"+g(":checked","#"+i+"checklist").serialize();return q};p=function(v,u){var t,q=g("#new"+i+"_parent");if("undefined"!=u.parsed.responses[0]&&(t=u.parsed.responses[0].supplemental.newcat_parent)){q.before(t);q.remove()}};g("#"+i+"checklist").wpList({alt:"",response:i+"-ajax-response",addBefore:catAddBefore,addAfter:p});g("#"+i+"-add-toggle").click(function(){g("#"+i+"-adder").toggleClass("wp-hidden-children");g('a[href="#'+i+'-all"]',"#"+i+"-tabs").click();return false});g("#"+i+"checklist").children("li.popular-category").add(g("#"+i+"checklist-pop").children()).find(":checkbox").live("click",function(){var q=g(this),s=q.is(":checked"),r=q.val();g("#in-"+i+"-"+r+", #in-popular-"+i+"-"+r).attr("checked",s)})});if(g("#postcustom").length){g("#the-list").wpList({addAfter:function(i,j){g("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(j.parsed.responses[0].supplemental.postid)}},addBefore:function(i){i.data+="&post_id="+g("#post_ID").val();return i}})}if(g("#submitdiv").length){c=g("#timestamp").html();a=g("#post-visibility-display").html();function e(){var i=g("#post-visibility-select");if(g("input:radio:checked",i).val()!="public"){g("#sticky").attr("checked",false);g("#sticky-span").hide()}else{g("#sticky-span").show()}if(g("input:radio:checked",i).val()!="password"){g("#password-span").hide()}else{g("#password-span").show()}}function d(){var p,q,j,s,r=g("#post_status"),k=g("option[value=publish]",r),i=g("#aa").val(),n=g("#mm").val(),o=g("#jj").val(),m=g("#hh").val(),l=g("#mn").val();p=new Date(i,n-1,o,m,l);q=new Date(g("#hidden_aa").val(),g("#hidden_mm").val()-1,g("#hidden_jj").val(),g("#hidden_hh").val(),g("#hidden_mn").val());j=new Date(g("#cur_aa").val(),g("#cur_mm").val()-1,g("#cur_jj").val(),g("#cur_hh").val(),g("#cur_mn").val());if(p.getFullYear()!=i||(1+p.getMonth())!=n||p.getDate()!=o||p.getMinutes()!=l){g(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{g(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(p>j&&g("#original_post_status").val()!="future"){s=postL10n.publishOnFuture;g("#publish").val(postL10n.schedule)}else{if(p<=j&&g("#original_post_status").val()!="publish"){s=postL10n.publishOn;g("#publish").val(postL10n.publish)}else{s=postL10n.publishOnPast;if(f){g("#publish").val(postL10n.updatePage)}else{g("#publish").val(postL10n.updatePost)}}}if(q.toUTCString()==p.toUTCString()){g("#timestamp").html(c)}else{g("#timestamp").html(s+" <b>"+g("option[value="+g("#mm").val()+"]","#mm").text()+" "+o+", "+i+" @ "+m+":"+l+"</b> ")}if(g("input:radio:checked","#post-visibility-select").val()=="private"){if(f){g("#publish").val(postL10n.updatePage)}else{g("#publish").val(postL10n.updatePost)}if(k.length==0){r.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{k.html(postL10n.privatelyPublished)}g("option[value=publish]",r).attr("selected",true);g(".edit-post-status","#misc-publishing-actions").hide()}else{if(g("#original_post_status").val()=="future"||g("#original_post_status").val()=="draft"){if(k.length){k.remove();r.val(g("#hidden_post_status").val())}}else{k.html(postL10n.published)}if(r.is(":hidden")){g(".edit-post-status","#misc-publishing-actions").show()}}g("#post-status-display").html(g("option:selected",r).text());if(g("option:selected",r).val()=="private"||g("option:selected",r).val()=="publish"){g("#save-post").hide()}else{g("#save-post").show();if(g("option:selected",r).val()=="pending"){g("#save-post").show().val(postL10n.savePending)}else{g("#save-post").show().val(postL10n.saveDraft)}}return true}g(".edit-visibility","#visibility").click(function(){if(g("#post-visibility-select").is(":hidden")){e();g("#post-visibility-select").slideDown("normal");g(this).hide()}return false});g(".cancel-post-visibility","#post-visibility-select").click(function(){g("#post-visibility-select").slideUp("normal");g("#visibility-radio-"+g("#hidden-post-visibility").val()).attr("checked",true);g("#post_password").val(g("#hidden_post_password").val());g("#sticky").attr("checked",g("#hidden-post-sticky").attr("checked"));g("#post-visibility-display").html(a);g(".edit-visibility","#visibility").show();d();return false});g(".save-post-visibility","#post-visibility-select").click(function(){var i=g("#post-visibility-select");i.slideUp("normal");g(".edit-visibility","#visibility").show();d();if(g("input:radio:checked",i).val()!="public"){g("#sticky").attr("checked",false)}if(true==g("#sticky").attr("checked")){h="Sticky"}else{h=""}g("#post-visibility-display").html(postL10n[g("input:radio:checked",i).val()+h]);return false});g("input:radio","#post-visibility-select").change(function(){e()});g("#timestampdiv").siblings("a.edit-timestamp").click(function(){if(g("#timestampdiv").is(":hidden")){g("#timestampdiv").slideDown("normal");g(this).hide()}return false});g(".cancel-timestamp","#timestampdiv").click(function(){g("#timestampdiv").slideUp("normal");g("#mm").val(g("#hidden_mm").val());g("#jj").val(g("#hidden_jj").val());g("#aa").val(g("#hidden_aa").val());g("#hh").val(g("#hidden_hh").val());g("#mn").val(g("#hidden_mn").val());g("#timestampdiv").siblings("a.edit-timestamp").show();d();return false});g(".save-timestamp","#timestampdiv").click(function(){if(d()){g("#timestampdiv").slideUp("normal");g("#timestampdiv").siblings("a.edit-timestamp").show()}return false});g("#post-status-select").siblings("a.edit-post-status").click(function(){if(g("#post-status-select").is(":hidden")){g("#post-status-select").slideDown("normal");g(this).hide()}return false});g(".save-post-status","#post-status-select").click(function(){g("#post-status-select").slideUp("normal");g("#post-status-select").siblings("a.edit-post-status").show();d();return false});g(".cancel-post-status","#post-status-select").click(function(){g("#post-status-select").slideUp("normal");g("#post_status").val(g("#hidden_post_status").val());g("#post-status-select").siblings("a.edit-post-status").show();d();return false})}if(g("#edit-slug-box").length){editPermalink=function(j){var k,n=0,m=g("#editable-post-name"),o=m.html(),r=g("#post_name"),s=r.html(),p=g("#edit-slug-buttons"),q=p.html(),l=g("#editable-post-name-full").html();g("#view-post-btn").hide();p.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");p.children(".save").click(function(){var i=m.children("input").val();g.post(ajaxurl,{action:"sample-permalink",post_id:j,new_slug:i,new_title:g("#title").val(),samplepermalinknonce:g("#samplepermalinknonce").val()},function(t){g("#edit-slug-box").html(t);p.html(q);r.attr("value",i);makeSlugeditClickable();g("#view-post-btn").show()});return false});g(".cancel","#edit-slug-buttons").click(function(){g("#view-post-btn").show();m.html(o);p.html(q);r.attr("value",s);return false});for(k=0;k<l.length;++k){if("%"==l.charAt(k)){n++}}slug_value=(n>l.length/4)?"":l;m.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(t){var i=t.keyCode||0;if(13==i){p.children(".save").click();return false}if(27==i){p.children(".cancel").click();return false}r.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){g("#editable-post-name").click(function(){g("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}});
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(c){var e=a(".the-tags",c),d=a(".tagchecklist",c),b;if(!e.length){return}b=e.val().split(",");d.empty();a.each(b,function(h,i){var f,g,j=a(c).attr("id");i=a.trim(i);if(!i.match(/^\s+$/)&&""!=i){g=j+"-check-num-"+h;f='<span><a id="'+g+'" class="ntdelbutton">X</a>&nbsp;'+i+"</span> ";d.append(f);a("#"+g).click(function(){tagBox.parseTags(this)})}})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});a("#"+c).after(e)})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").siblings(".newtag").focus()});a("input.newtag",c).blur(function(){if(this.value==""){a(this).siblings(".taghint").css("visibility","")}}).focus(function(){a(this).siblings(".taghint").css("visibility","hidden")}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+d,{delay:500,minchars:2,multiple:true,multipleSep:", "})});a("#post").submit(function(){a("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){tagBox.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(b){a(".inside","#postimagediv").html(b)};WPSetThumbnailID=function(c){var b=a("input[value=_thumbnail_id]","#list-table");if(b.size()>0){a("#meta\\["+b.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(c)}};WPRemoveThumbnail=function(){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(b){if(b=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(b)}})}})(jQuery);jQuery(document).ready(function(g){var c,a,h="",b="post"==pagenow||"post-new"==pagenow,f="page"==pagenow||"page-new"==pagenow;if(b){type="post";if(typenow){type=typenow}postboxes.add_postbox_toggles(type)}else{if(f){postboxes.add_postbox_toggles("page")}}if(g("#tagsdiv-post_tag").length){tagBox.init()}else{g("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}g(".categorydiv").each(function(){var n=g(this).attr("id"),j=false,m,o,l,i,k;l=n.split("-");l.shift();i=l.join("-");k=i+"_tab";if(i=="category"){k="cats"}g("a","#"+i+"-tabs").click(function(){var p=g(this).attr("href");g(this).parent().addClass("tabs").siblings("li").removeClass("tabs");g("#"+i+"-tabs").siblings(".tabs-panel").hide();g(p).show();if("#"+i+"-all"==p){deleteUserSetting(k)}else{setUserSetting(k,"pop")}return false});if(getUserSetting(k)){g('a[href="#'+i+'-pop"]',"#"+i+"-tabs").click()}g("#new"+i).one("focus",function(){g(this).val("").removeClass("form-input-tip")});g("#"+i+"-add-submit").click(function(){g("#new"+i).focus()});m=function(){if(j){return}j=true;var p=jQuery(this),r=p.is(":checked"),q=p.val().toString();g("#in-"+i+"-"+q+", #in-"+i+"-category-"+q).attr("checked",r);j=false};catAddBefore=function(p){if(!g("#new"+i).val()){return false}p.data+="&"+g(":checked","#"+i+"checklist").serialize();return p};o=function(u,t){var q,p=g("#new"+i+"_parent");if("undefined"!=t.parsed.responses[0]&&(q=t.parsed.responses[0].supplemental.newcat_parent)){p.before(q);p.remove()}};g("#"+i+"checklist").wpList({alt:"",response:i+"-ajax-response",addBefore:catAddBefore,addAfter:o});g("#"+i+"-add-toggle").click(function(){g("#"+i+"-adder").toggleClass("wp-hidden-children");g('a[href="#'+i+'-all"]',"#"+i+"-tabs").click();return false});g("#"+i+"checklist").children("li.popular-category").add(g("#"+i+"checklist-pop").children()).find(":checkbox").live("click",function(){var p=g(this),r=p.is(":checked"),q=p.val();if(q&&p.parents("#taxonomy-"+i).length){g("#in-"+i+"-"+q+", #in-popular-"+i+"-"+q).attr("checked",r)}})});if(g("#postcustom").length){g("#the-list").wpList({addAfter:function(i,j){g("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(j.parsed.responses[0].supplemental.postid)}},addBefore:function(i){i.data+="&post_id="+g("#post_ID").val();return i}})}if(g("#submitdiv").length){c=g("#timestamp").html();a=g("#post-visibility-display").html();function e(){var i=g("#post-visibility-select");if(g("input:radio:checked",i).val()!="public"){g("#sticky").attr("checked",false);g("#sticky-span").hide()}else{g("#sticky-span").show()}if(g("input:radio:checked",i).val()!="password"){g("#password-span").hide()}else{g("#password-span").show()}}function d(){var p,q,j,s,r=g("#post_status"),k=g("option[value=publish]",r),i=g("#aa").val(),n=g("#mm").val(),o=g("#jj").val(),m=g("#hh").val(),l=g("#mn").val();p=new Date(i,n-1,o,m,l);q=new Date(g("#hidden_aa").val(),g("#hidden_mm").val()-1,g("#hidden_jj").val(),g("#hidden_hh").val(),g("#hidden_mn").val());j=new Date(g("#cur_aa").val(),g("#cur_mm").val()-1,g("#cur_jj").val(),g("#cur_hh").val(),g("#cur_mn").val());if(p.getFullYear()!=i||(1+p.getMonth())!=n||p.getDate()!=o||p.getMinutes()!=l){g(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{g(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(p>j&&g("#original_post_status").val()!="future"){s=postL10n.publishOnFuture;g("#publish").val(postL10n.schedule)}else{if(p<=j&&g("#original_post_status").val()!="publish"){s=postL10n.publishOn;g("#publish").val(postL10n.publish)}else{s=postL10n.publishOnPast;if(f){g("#publish").val(postL10n.updatePage)}else{g("#publish").val(postL10n.updatePost)}}}if(q.toUTCString()==p.toUTCString()){g("#timestamp").html(c)}else{g("#timestamp").html(s+" <b>"+g("option[value="+g("#mm").val()+"]","#mm").text()+" "+o+", "+i+" @ "+m+":"+l+"</b> ")}if(g("input:radio:checked","#post-visibility-select").val()=="private"){if(f){g("#publish").val(postL10n.updatePage)}else{g("#publish").val(postL10n.updatePost)}if(k.length==0){r.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{k.html(postL10n.privatelyPublished)}g("option[value=publish]",r).attr("selected",true);g(".edit-post-status","#misc-publishing-actions").hide()}else{if(g("#original_post_status").val()=="future"||g("#original_post_status").val()=="draft"){if(k.length){k.remove();r.val(g("#hidden_post_status").val())}}else{k.html(postL10n.published)}if(r.is(":hidden")){g(".edit-post-status","#misc-publishing-actions").show()}}g("#post-status-display").html(g("option:selected",r).text());if(g("option:selected",r).val()=="private"||g("option:selected",r).val()=="publish"){g("#save-post").hide()}else{g("#save-post").show();if(g("option:selected",r).val()=="pending"){g("#save-post").show().val(postL10n.savePending)}else{g("#save-post").show().val(postL10n.saveDraft)}}return true}g(".edit-visibility","#visibility").click(function(){if(g("#post-visibility-select").is(":hidden")){e();g("#post-visibility-select").slideDown("normal");g(this).hide()}return false});g(".cancel-post-visibility","#post-visibility-select").click(function(){g("#post-visibility-select").slideUp("normal");g("#visibility-radio-"+g("#hidden-post-visibility").val()).attr("checked",true);g("#post_password").val(g("#hidden_post_password").val());g("#sticky").attr("checked",g("#hidden-post-sticky").attr("checked"));g("#post-visibility-display").html(a);g(".edit-visibility","#visibility").show();d();return false});g(".save-post-visibility","#post-visibility-select").click(function(){var i=g("#post-visibility-select");i.slideUp("normal");g(".edit-visibility","#visibility").show();d();if(g("input:radio:checked",i).val()!="public"){g("#sticky").attr("checked",false)}if(true==g("#sticky").attr("checked")){h="Sticky"}else{h=""}g("#post-visibility-display").html(postL10n[g("input:radio:checked",i).val()+h]);return false});g("input:radio","#post-visibility-select").change(function(){e()});g("#timestampdiv").siblings("a.edit-timestamp").click(function(){if(g("#timestampdiv").is(":hidden")){g("#timestampdiv").slideDown("normal");g(this).hide()}return false});g(".cancel-timestamp","#timestampdiv").click(function(){g("#timestampdiv").slideUp("normal");g("#mm").val(g("#hidden_mm").val());g("#jj").val(g("#hidden_jj").val());g("#aa").val(g("#hidden_aa").val());g("#hh").val(g("#hidden_hh").val());g("#mn").val(g("#hidden_mn").val());g("#timestampdiv").siblings("a.edit-timestamp").show();d();return false});g(".save-timestamp","#timestampdiv").click(function(){if(d()){g("#timestampdiv").slideUp("normal");g("#timestampdiv").siblings("a.edit-timestamp").show()}return false});g("#post-status-select").siblings("a.edit-post-status").click(function(){if(g("#post-status-select").is(":hidden")){g("#post-status-select").slideDown("normal");g(this).hide()}return false});g(".save-post-status","#post-status-select").click(function(){g("#post-status-select").slideUp("normal");g("#post-status-select").siblings("a.edit-post-status").show();d();return false});g(".cancel-post-status","#post-status-select").click(function(){g("#post-status-select").slideUp("normal");g("#post_status").val(g("#hidden_post_status").val());g("#post-status-select").siblings("a.edit-post-status").show();d();return false})}if(g("#edit-slug-box").length){editPermalink=function(j){var k,n=0,m=g("#editable-post-name"),o=m.html(),r=g("#post_name"),s=r.html(),p=g("#edit-slug-buttons"),q=p.html(),l=g("#editable-post-name-full").html();g("#view-post-btn").hide();p.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");p.children(".save").click(function(){var i=m.children("input").val();g.post(ajaxurl,{action:"sample-permalink",post_id:j,new_slug:i,new_title:g("#title").val(),samplepermalinknonce:g("#samplepermalinknonce").val()},function(t){g("#edit-slug-box").html(t);p.html(q);r.attr("value",i);makeSlugeditClickable();g("#view-post-btn").show()});return false});g(".cancel","#edit-slug-buttons").click(function(){g("#view-post-btn").show();m.html(o);p.html(q);r.attr("value",s);return false});for(k=0;k<l.length;++k){if("%"==l.charAt(k)){n++}}slug_value=(n>l.length/4)?"":l;m.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(t){var i=t.keyCode||0;if(13==i){p.children(".save").click();return false}if(27==i){p.children(".cancel").click();return false}r.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){g("#editable-post-name").click(function(){g("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}});
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(c){var e=a(".the-tags",c),d=a(".tagchecklist",c),b;if(!e.length){return}b=e.val().split(",");d.empty();a.each(b,function(h,i){var f,g,j=a(c).attr("id");i=a.trim(i);if(!i.match(/^\s+$/)&&""!=i){g=j+"-check-num-"+h;f='<span><a id="'+g+'" class="ntdelbutton">X</a>&nbsp;'+i+"</span> ";d.append(f);a("#"+g).click(function(){tagBox.parseTags(this)})}})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});a("#"+c).after(e)})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").siblings(".newtag").focus()});a("input.newtag",c).blur(function(){if(this.value==""){a(this).siblings(".taghint").css("visibility","")}}).focus(function(){a(this).siblings(".taghint").css("visibility","hidden")}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+d,{delay:500,minchars:2,multiple:true,multipleSep:", "})});a("#post").submit(function(){a("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){tagBox.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(b){a(".inside","#postimagediv").html(b)};WPSetThumbnailID=function(c){var b=a("input[value=_thumbnail_id]","#list-table");if(b.size()>0){a("#meta\\["+b.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(c)}};WPRemoveThumbnail=function(){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(b){if(b=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(b)}})}})(jQuery);jQuery(document).ready(function(g){var c,a,h="",b="post"==pagenow||"post-new"==pagenow,f="page"==pagenow||"page-new"==pagenow;if(b){type="post";if(typenow){type=typenow}postboxes.add_postbox_toggles(type)}else{if(f){postboxes.add_postbox_toggles("page")}}if(g("#tagsdiv-post_tag").length){tagBox.init()}else{g("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}g(".categorydiv").each(function(){var o=g(this).attr("id"),j=false,m,p,l;var n=o.split("-");n.shift();var i=n.join("-");var k=i+"_tab";if(i=="category"){k="cats"}g("a","#"+i+"-tabs").click(function(){var q=g(this).attr("href");g(this).parent().addClass("tabs").siblings("li").removeClass("tabs");g("#"+i+"-tabs").siblings(".tabs-panel").hide();g(q).show();if("#"+i+"-all"==q){deleteUserSetting(k)}else{setUserSetting(k,"pop")}return false});if(getUserSetting(k)){g('a[href="#'+i+'-pop"]',"#"+i+"-tabs").click()}g("#new"+i).one("focus",function(){g(this).val("").removeClass("form-input-tip")});g("#"+i+"-add-submit").click(function(){g("#new"+i).focus()});m=function(){if(j){return}j=true;var q=jQuery(this),s=q.is(":checked"),r=q.val().toString();g("#in-"+i+"-"+r+", #in-"+i+"-category-"+r).attr("checked",s);j=false};catAddBefore=function(q){if(!g("#new"+i).val()){return false}q.data+="&"+g(":checked","#"+i+"checklist").serialize();return q};p=function(v,u){var t,q=g("#new"+i+"_parent");if("undefined"!=u.parsed.responses[0]&&(t=u.parsed.responses[0].supplemental.newcat_parent)){q.before(t);q.remove()}};g("#"+i+"checklist").wpList({alt:"",response:i+"-ajax-response",addBefore:catAddBefore,addAfter:p});g("#"+i+"-add-toggle").click(function(){g("#"+i+"-adder").toggleClass("wp-hidden-children");g('a[href="#'+i+'-all"]',"#"+i+"-tabs").click();return false});g("#"+i+"checklist").children("li.popular-category").add(g("#"+i+"checklist-pop").children()).find(":checkbox").live("click",function(){var q=g(this),s=q.is(":checked"),r=q.val();g("#in-"+i+"-"+r+", #in-popular-"+i+"-"+r).attr("checked",s)})});if(g("#postcustom").length){g("#the-list").wpList({addAfter:function(i,j){g("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(j.parsed.responses[0].supplemental.postid)}},addBefore:function(i){i.data+="&post_id="+g("#post_ID").val();return i}})}if(g("#submitdiv").length){c=g("#timestamp").html();a=g("#post-visibility-display").html();function e(){var i=g("#post-visibility-select");if(g("input:radio:checked",i).val()!="public"){g("#sticky").attr("checked",false);g("#sticky-span").hide()}else{g("#sticky-span").show()}if(g("input:radio:checked",i).val()!="password"){g("#password-span").hide()}else{g("#password-span").show()}}function d(){var p,q,j,s,r=g("#post_status"),k=g("option[value=publish]",r),i=g("#aa").val(),n=g("#mm").val(),o=g("#jj").val(),m=g("#hh").val(),l=g("#mn").val();p=new Date(i,n-1,o,m,l);q=new Date(g("#hidden_aa").val(),g("#hidden_mm").val()-1,g("#hidden_jj").val(),g("#hidden_hh").val(),g("#hidden_mn").val());j=new Date(g("#cur_aa").val(),g("#cur_mm").val()-1,g("#cur_jj").val(),g("#cur_hh").val(),g("#cur_mn").val());if(p.getFullYear()!=i||(1+p.getMonth())!=n||p.getDate()!=o||p.getMinutes()!=l){g(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{g(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(p>j&&g("#original_post_status").val()!="future"){s=postL10n.publishOnFuture;g("#publish").val(postL10n.schedule)}else{if(p<=j&&g("#original_post_status").val()!="publish"){s=postL10n.publishOn;g("#publish").val(postL10n.publish)}else{s=postL10n.publishOnPast;if(f){g("#publish").val(postL10n.updatePage)}else{g("#publish").val(postL10n.updatePost)}}}if(q.toUTCString()==p.toUTCString()){g("#timestamp").html(c)}else{g("#timestamp").html(s+" <b>"+g("option[value="+g("#mm").val()+"]","#mm").text()+" "+o+", "+i+" @ "+m+":"+l+"</b> ")}if(g("input:radio:checked","#post-visibility-select").val()=="private"){if(f){g("#publish").val(postL10n.updatePage)}else{g("#publish").val(postL10n.updatePost)}if(k.length==0){r.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{k.html(postL10n.privatelyPublished)}g("option[value=publish]",r).attr("selected",true);g(".edit-post-status","#misc-publishing-actions").hide()}else{if(g("#original_post_status").val()=="future"||g("#original_post_status").val()=="draft"){if(k.length){k.remove();r.val(g("#hidden_post_status").val())}}else{k.html(postL10n.published)}if(r.is(":hidden")){g(".edit-post-status","#misc-publishing-actions").show()}}g("#post-status-display").html(g("option:selected",r).text());if(g("option:selected",r).val()=="private"||g("option:selected",r).val()=="publish"){g("#save-post").hide()}else{g("#save-post").show();if(g("option:selected",r).val()=="pending"){g("#save-post").show().val(postL10n.savePending)}else{g("#save-post").show().val(postL10n.saveDraft)}}return true}g(".edit-visibility","#visibility").click(function(){if(g("#post-visibility-select").is(":hidden")){e();g("#post-visibility-select").slideDown("normal");g(this).hide()}return false});g(".cancel-post-visibility","#post-visibility-select").click(function(){g("#post-visibility-select").slideUp("normal");g("#visibility-radio-"+g("#hidden-post-visibility").val()).attr("checked",true);g("#post_password").val(g("#hidden_post_password").val());g("#sticky").attr("checked",g("#hidden-post-sticky").attr("checked"));g("#post-visibility-display").html(a);g(".edit-visibility","#visibility").show();d();return false});g(".save-post-visibility","#post-visibility-select").click(function(){var i=g("#post-visibility-select");i.slideUp("normal");g(".edit-visibility","#visibility").show();d();if(g("input:radio:checked",i).val()!="public"){g("#sticky").attr("checked",false)}if(true==g("#sticky").attr("checked")){h="Sticky"}else{h=""}g("#post-visibility-display").html(postL10n[g("input:radio:checked",i).val()+h]);return false});g("input:radio","#post-visibility-select").change(function(){e()});g("#timestampdiv").siblings("a.edit-timestamp").click(function(){if(g("#timestampdiv").is(":hidden")){g("#timestampdiv").slideDown("normal");g(this).hide()}return false});g(".cancel-timestamp","#timestampdiv").click(function(){g("#timestampdiv").slideUp("normal");g("#mm").val(g("#hidden_mm").val());g("#jj").val(g("#hidden_jj").val());g("#aa").val(g("#hidden_aa").val());g("#hh").val(g("#hidden_hh").val());g("#mn").val(g("#hidden_mn").val());g("#timestampdiv").siblings("a.edit-timestamp").show();d();return false});g(".save-timestamp","#timestampdiv").click(function(){if(d()){g("#timestampdiv").slideUp("normal");g("#timestampdiv").siblings("a.edit-timestamp").show()}return false});g("#post-status-select").siblings("a.edit-post-status").click(function(){if(g("#post-status-select").is(":hidden")){g("#post-status-select").slideDown("normal");g(this).hide()}return false});g(".save-post-status","#post-status-select").click(function(){g("#post-status-select").slideUp("normal");g("#post-status-select").siblings("a.edit-post-status").show();d();return false});g(".cancel-post-status","#post-status-select").click(function(){g("#post-status-select").slideUp("normal");g("#post_status").val(g("#hidden_post_status").val());g("#post-status-select").siblings("a.edit-post-status").show();d();return false})}if(g("#edit-slug-box").length){editPermalink=function(j){var k,n=0,m=g("#editable-post-name"),o=m.html(),r=g("#post_name"),s=r.html(),p=g("#edit-slug-buttons"),q=p.html(),l=g("#editable-post-name-full").html();g("#view-post-btn").hide();p.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");p.children(".save").click(function(){var i=m.children("input").val();g.post(ajaxurl,{action:"sample-permalink",post_id:j,new_slug:i,new_title:g("#title").val(),samplepermalinknonce:g("#samplepermalinknonce").val()},function(t){g("#edit-slug-box").html(t);p.html(q);r.attr("value",i);makeSlugeditClickable();g("#view-post-btn").show()});return false});g(".cancel","#edit-slug-buttons").click(function(){g("#view-post-btn").show();m.html(o);p.html(q);r.attr("value",s);return false});for(k=0;k<l.length;++k){if("%"==l.charAt(k)){n++}}slug_value=(n>l.length/4)?"":l;m.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(t){var i=t.keyCode||0;if(13==i){p.children(".save").click();return false}if(27==i){p.children(".cancel").click();return false}r.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){g("#editable-post-name").click(function(){g("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}});
10574 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/10574/714e695c08eadfc9f15f2908709c9e27c2401a23/post.js/buggy/wp-admin/js/post.js
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(c){var e=a(".the-tags",c),d=a(".tagchecklist",c),b;if(!e.length){return}b=e.val().split(",");d.empty();a.each(b,function(h,i){var f,g,j=a(c).attr("id");i=a.trim(i);if(!i.match(/^\s+$/)&&""!=i){g=j+"-check-num-"+h;f='<span><a id="'+g+'" class="ntdelbutton">X</a>&nbsp;'+i+"</span> ";d.append(f);a("#"+g).click(function(){tagBox.parseTags(this)})}})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});a("#"+c).after(e)})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").siblings(".newtag").focus()});a("input.newtag",c).blur(function(){if(this.value==""){a(this).siblings(".taghint").css("visibility","")}}).focus(function(){a(this).siblings(".taghint").css("visibility","hidden")}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+d,{delay:500,minchars:2,multiple:true,multipleSep:", "})});a("#post").submit(function(){a("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){tagBox.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(b){a(".inside","#postimagediv").html(b)};WPSetThumbnailID=function(c){var b=a("input[value=_thumbnail_id]","#list-table");if(b.size()>0){a("#meta\\["+b.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(c)}};WPRemoveThumbnail=function(){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(b){if(b=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(b)}})}})(jQuery);jQuery(document).ready(function(g){var c,a,h="",b="post"==pagenow||"post-new"==pagenow,f="page"==pagenow||"page-new"==pagenow;if(b){type="post";if(typenow){type=typenow}postboxes.add_postbox_toggles(type)}else{if(f){postboxes.add_postbox_toggles("page")}}if(g("#tagsdiv-post_tag").length){tagBox.init()}else{g("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}g(".categorydiv").each(function(){var n=g(this).attr("id"),j=false,m,o,l,i,k;l=n.split("-");l.shift();i=l.join("-");k=i+"_tab";if(i=="category"){k="cats"}g("a","#"+i+"-tabs").click(function(){var p=g(this).attr("href");g(this).parent().addClass("tabs").siblings("li").removeClass("tabs");g("#"+i+"-tabs").siblings(".tabs-panel").hide();g(p).show();if("#"+i+"-all"==p){deleteUserSetting(k)}else{setUserSetting(k,"pop")}return false});if(getUserSetting(k)){g('a[href="#'+i+'-pop"]',"#"+i+"-tabs").click()}g("#new"+i).one("focus",function(){g(this).val("").removeClass("form-input-tip")});g("#"+i+"-add-submit").click(function(){g("#new"+i).focus()});m=function(){if(j){return}j=true;var p=jQuery(this),r=p.is(":checked"),q=p.val().toString();g("#in-"+i+"-"+q+", #in-"+i+"-category-"+q).attr("checked",r);j=false};catAddBefore=function(p){if(!g("#new"+i).val()){return false}p.data+="&"+g(":checked","#"+i+"checklist").serialize();return p};o=function(u,t){var q,p=g("#new"+i+"_parent");if("undefined"!=t.parsed.responses[0]&&(q=t.parsed.responses[0].supplemental.newcat_parent)){p.before(q);p.remove()}};g("#"+i+"checklist").wpList({alt:"",response:i+"-ajax-response",addBefore:catAddBefore,addAfter:o});g("#"+i+"-add-toggle").click(function(){g("#"+i+"-adder").toggleClass("wp-hidden-children");g('a[href="#'+i+'-all"]',"#"+i+"-tabs").click();return false});g("#"+i+"checklist li.popular-category :checkbox, #"+i+"checklist-pop :checkbox").live("click",function(){var p=g(this),r=p.is(":checked"),q=p.val();if(q&&p.parents("#taxonomy-"+i).length){g("#in-"+i+"-"+q+", #in-popular-"+i+"-"+q).attr("checked",r)}})});if(g("#postcustom").length){g("#the-list").wpList({addAfter:function(i,j){g("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(j.parsed.responses[0].supplemental.postid)}},addBefore:function(i){i.data+="&post_id="+g("#post_ID").val();return i}})}if(g("#submitdiv").length){c=g("#timestamp").html();a=g("#post-visibility-display").html();function e(){var i=g("#post-visibility-select");if(g("input:radio:checked",i).val()!="public"){g("#sticky").attr("checked",false);g("#sticky-span").hide()}else{g("#sticky-span").show()}if(g("input:radio:checked",i).val()!="password"){g("#password-span").hide()}else{g("#password-span").show()}}function d(){var p,q,j,s,r=g("#post_status"),k=g("option[value=publish]",r),i=g("#aa").val(),n=g("#mm").val(),o=g("#jj").val(),m=g("#hh").val(),l=g("#mn").val();p=new Date(i,n-1,o,m,l);q=new Date(g("#hidden_aa").val(),g("#hidden_mm").val()-1,g("#hidden_jj").val(),g("#hidden_hh").val(),g("#hidden_mn").val());j=new Date(g("#cur_aa").val(),g("#cur_mm").val()-1,g("#cur_jj").val(),g("#cur_hh").val(),g("#cur_mn").val());if(p.getFullYear()!=i||(1+p.getMonth())!=n||p.getDate()!=o||p.getMinutes()!=l){g(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{g(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(p>j&&g("#original_post_status").val()!="future"){s=postL10n.publishOnFuture;g("#publish").val(postL10n.schedule)}else{if(p<=j&&g("#original_post_status").val()!="publish"){s=postL10n.publishOn;g("#publish").val(postL10n.publish)}else{s=postL10n.publishOnPast;if(f){g("#publish").val(postL10n.updatePage)}else{g("#publish").val(postL10n.updatePost)}}}if(q.toUTCString()==p.toUTCString()){g("#timestamp").html(c)}else{g("#timestamp").html(s+" <b>"+g("option[value="+g("#mm").val()+"]","#mm").text()+" "+o+", "+i+" @ "+m+":"+l+"</b> ")}if(g("input:radio:checked","#post-visibility-select").val()=="private"){if(f){g("#publish").val(postL10n.updatePage)}else{g("#publish").val(postL10n.updatePost)}if(k.length==0){r.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{k.html(postL10n.privatelyPublished)}g("option[value=publish]",r).attr("selected",true);g(".edit-post-status","#misc-publishing-actions").hide()}else{if(g("#original_post_status").val()=="future"||g("#original_post_status").val()=="draft"){if(k.length){k.remove();r.val(g("#hidden_post_status").val())}}else{k.html(postL10n.published)}if(r.is(":hidden")){g(".edit-post-status","#misc-publishing-actions").show()}}g("#post-status-display").html(g("option:selected",r).text());if(g("option:selected",r).val()=="private"||g("option:selected",r).val()=="publish"){g("#save-post").hide()}else{g("#save-post").show();if(g("option:selected",r).val()=="pending"){g("#save-post").show().val(postL10n.savePending)}else{g("#save-post").show().val(postL10n.saveDraft)}}return true}g(".edit-visibility","#visibility").click(function(){if(g("#post-visibility-select").is(":hidden")){e();g("#post-visibility-select").slideDown("normal");g(this).hide()}return false});g(".cancel-post-visibility","#post-visibility-select").click(function(){g("#post-visibility-select").slideUp("normal");g("#visibility-radio-"+g("#hidden-post-visibility").val()).attr("checked",true);g("#post_password").val(g("#hidden_post_password").val());g("#sticky").attr("checked",g("#hidden-post-sticky").attr("checked"));g("#post-visibility-display").html(a);g(".edit-visibility","#visibility").show();d();return false});g(".save-post-visibility","#post-visibility-select").click(function(){var i=g("#post-visibility-select");i.slideUp("normal");g(".edit-visibility","#visibility").show();d();if(g("input:radio:checked",i).val()!="public"){g("#sticky").attr("checked",false)}if(true==g("#sticky").attr("checked")){h="Sticky"}else{h=""}g("#post-visibility-display").html(postL10n[g("input:radio:checked",i).val()+h]);return false});g("input:radio","#post-visibility-select").change(function(){e()});g("#timestampdiv").siblings("a.edit-timestamp").click(function(){if(g("#timestampdiv").is(":hidden")){g("#timestampdiv").slideDown("normal");g(this).hide()}return false});g(".cancel-timestamp","#timestampdiv").click(function(){g("#timestampdiv").slideUp("normal");g("#mm").val(g("#hidden_mm").val());g("#jj").val(g("#hidden_jj").val());g("#aa").val(g("#hidden_aa").val());g("#hh").val(g("#hidden_hh").val());g("#mn").val(g("#hidden_mn").val());g("#timestampdiv").siblings("a.edit-timestamp").show();d();return false});g(".save-timestamp","#timestampdiv").click(function(){if(d()){g("#timestampdiv").slideUp("normal");g("#timestampdiv").siblings("a.edit-timestamp").show()}return false});g("#post-status-select").siblings("a.edit-post-status").click(function(){if(g("#post-status-select").is(":hidden")){g("#post-status-select").slideDown("normal");g(this).hide()}return false});g(".save-post-status","#post-status-select").click(function(){g("#post-status-select").slideUp("normal");g("#post-status-select").siblings("a.edit-post-status").show();d();return false});g(".cancel-post-status","#post-status-select").click(function(){g("#post-status-select").slideUp("normal");g("#post_status").val(g("#hidden_post_status").val());g("#post-status-select").siblings("a.edit-post-status").show();d();return false})}if(g("#edit-slug-box").length){editPermalink=function(j){var k,n=0,m=g("#editable-post-name"),o=m.html(),r=g("#post_name"),s=r.html(),p=g("#edit-slug-buttons"),q=p.html(),l=g("#editable-post-name-full").html();g("#view-post-btn").hide();p.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");p.children(".save").click(function(){var i=m.children("input").val();g.post(ajaxurl,{action:"sample-permalink",post_id:j,new_slug:i,new_title:g("#title").val(),samplepermalinknonce:g("#samplepermalinknonce").val()},function(t){g("#edit-slug-box").html(t);p.html(q);r.attr("value",i);makeSlugeditClickable();g("#view-post-btn").show()});return false});g(".cancel","#edit-slug-buttons").click(function(){g("#view-post-btn").show();m.html(o);p.html(q);r.attr("value",s);return false});for(k=0;k<l.length;++k){if("%"==l.charAt(k)){n++}}slug_value=(n>l.length/4)?"":l;m.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(t){var i=t.keyCode||0;if(13==i){p.children(".save").click();return false}if(27==i){p.children(".cancel").click();return false}r.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){g("#editable-post-name").click(function(){g("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}});
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(c){var e=a(".the-tags",c),d=a(".tagchecklist",c),b;if(!e.length){return}b=e.val().split(",");d.empty();a.each(b,function(h,i){var f,g,j=a(c).attr("id");i=a.trim(i);if(!i.match(/^\s+$/)&&""!=i){g=j+"-check-num-"+h;f='<span><a id="'+g+'" class="ntdelbutton">X</a>&nbsp;'+i+"</span> ";d.append(f);a("#"+g).click(function(){tagBox.parseTags(this)})}})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});a("#"+c).after(e)})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").siblings(".newtag").focus()});a("input.newtag",c).blur(function(){if(this.value==""){a(this).siblings(".taghint").css("visibility","")}}).focus(function(){a(this).siblings(".taghint").css("visibility","hidden")}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+d,{delay:500,minchars:2,multiple:true,multipleSep:", "})});a("#post").submit(function(){a("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){tagBox.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(b){a(".inside","#postimagediv").html(b)};WPSetThumbnailID=function(c){var b=a("input[value=_thumbnail_id]","#list-table");if(b.size()>0){a("#meta\\["+b.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(c)}};WPRemoveThumbnail=function(){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(b){if(b=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(b)}})}})(jQuery);jQuery(document).ready(function(e){var b,a,f="";postboxes.add_postbox_toggles(pagenow);if(e("#tagsdiv-post_tag").length){tagBox.init()}else{e("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}e(".categorydiv").each(function(){var l=e(this).attr("id"),h=false,k,m,j,g,i;j=l.split("-");j.shift();g=j.join("-");i=g+"_tab";if(g=="category"){i="cats"}e("a","#"+g+"-tabs").click(function(){var n=e(this).attr("href");e(this).parent().addClass("tabs").siblings("li").removeClass("tabs");e("#"+g+"-tabs").siblings(".tabs-panel").hide();e(n).show();if("#"+g+"-all"==n){deleteUserSetting(i)}else{setUserSetting(i,"pop")}return false});if(getUserSetting(i)){e('a[href="#'+g+'-pop"]',"#"+g+"-tabs").click()}e("#new"+g).one("focus",function(){e(this).val("").removeClass("form-input-tip")});e("#"+g+"-add-submit").click(function(){e("#new"+g).focus()});k=function(){if(h){return}h=true;var n=jQuery(this),p=n.is(":checked"),o=n.val().toString();e("#in-"+g+"-"+o+", #in-"+g+"-category-"+o).attr("checked",p);h=false};catAddBefore=function(n){if(!e("#new"+g).val()){return false}n.data+="&"+e(":checked","#"+g+"checklist").serialize();return n};m=function(q,p){var o,n=e("#new"+g+"_parent");if("undefined"!=p.parsed.responses[0]&&(o=p.parsed.responses[0].supplemental.newcat_parent)){n.before(o);n.remove()}};e("#"+g+"checklist").wpList({alt:"",response:g+"-ajax-response",addBefore:catAddBefore,addAfter:m});e("#"+g+"-add-toggle").click(function(){e("#"+g+"-adder").toggleClass("wp-hidden-children");e('a[href="#'+g+'-all"]',"#"+g+"-tabs").click();return false});e("#"+g+"checklist li.popular-category :checkbox, #"+g+"checklist-pop :checkbox").live("click",function(){var n=e(this),p=n.is(":checked"),o=n.val();if(o&&n.parents("#taxonomy-"+g).length){e("#in-"+g+"-"+o+", #in-popular-"+g+"-"+o).attr("checked",p)}})});if(e("#postcustom").length){e("#the-list").wpList({addAfter:function(g,h){e("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(h.parsed.responses[0].supplemental.postid)}},addBefore:function(g){g.data+="&post_id="+e("#post_ID").val();return g}})}if(e("#submitdiv").length){b=e("#timestamp").html();a=e("#post-visibility-display").html();function d(){var g=e("#post-visibility-select");if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false);e("#sticky-span").hide()}else{e("#sticky-span").show()}if(e("input:radio:checked",g).val()!="password"){e("#password-span").hide()}else{e("#password-span").show()}}function c(){var n,o,h,q,p=e("#post_status"),i=e("option[value=publish]",p),g=e("#aa").val(),l=e("#mm").val(),m=e("#jj").val(),k=e("#hh").val(),j=e("#mn").val();n=new Date(g,l-1,m,k,j);o=new Date(e("#hidden_aa").val(),e("#hidden_mm").val()-1,e("#hidden_jj").val(),e("#hidden_hh").val(),e("#hidden_mn").val());h=new Date(e("#cur_aa").val(),e("#cur_mm").val()-1,e("#cur_jj").val(),e("#cur_hh").val(),e("#cur_mn").val());if(n.getFullYear()!=g||(1+n.getMonth())!=l||n.getDate()!=m||n.getMinutes()!=j){e(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{e(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(n>h&&e("#original_post_status").val()!="future"){q=postL10n.publishOnFuture;e("#publish").val(postL10n.schedule)}else{if(n<=h&&e("#original_post_status").val()!="publish"){q=postL10n.publishOn;e("#publish").val(postL10n.publish)}else{q=postL10n.publishOnPast;if(page){e("#publish").val(postL10n.updatePage)}else{e("#publish").val(postL10n.updatePost)}}}if(o.toUTCString()==n.toUTCString()){e("#timestamp").html(b)}else{e("#timestamp").html(q+" <b>"+e("option[value="+e("#mm").val()+"]","#mm").text()+" "+m+", "+g+" @ "+k+":"+j+"</b> ")}if(e("input:radio:checked","#post-visibility-select").val()=="private"){if(page){e("#publish").val(postL10n.updatePage)}else{e("#publish").val(postL10n.updatePost)}if(i.length==0){p.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{i.html(postL10n.privatelyPublished)}e("option[value=publish]",p).attr("selected",true);e(".edit-post-status","#misc-publishing-actions").hide()}else{if(e("#original_post_status").val()=="future"||e("#original_post_status").val()=="draft"){if(i.length){i.remove();p.val(e("#hidden_post_status").val())}}else{i.html(postL10n.published)}if(p.is(":hidden")){e(".edit-post-status","#misc-publishing-actions").show()}}e("#post-status-display").html(e("option:selected",p).text());if(e("option:selected",p).val()=="private"||e("option:selected",p).val()=="publish"){e("#save-post").hide()}else{e("#save-post").show();if(e("option:selected",p).val()=="pending"){e("#save-post").show().val(postL10n.savePending)}else{e("#save-post").show().val(postL10n.saveDraft)}}return true}e(".edit-visibility","#visibility").click(function(){if(e("#post-visibility-select").is(":hidden")){d();e("#post-visibility-select").slideDown("normal");e(this).hide()}return false});e(".cancel-post-visibility","#post-visibility-select").click(function(){e("#post-visibility-select").slideUp("normal");e("#visibility-radio-"+e("#hidden-post-visibility").val()).attr("checked",true);e("#post_password").val(e("#hidden_post_password").val());e("#sticky").attr("checked",e("#hidden-post-sticky").attr("checked"));e("#post-visibility-display").html(a);e(".edit-visibility","#visibility").show();c();return false});e(".save-post-visibility","#post-visibility-select").click(function(){var g=e("#post-visibility-select");g.slideUp("normal");e(".edit-visibility","#visibility").show();c();if(e("input:radio:checked",g).val()!="public"){e("#sticky").attr("checked",false)}if(true==e("#sticky").attr("checked")){f="Sticky"}else{f=""}e("#post-visibility-display").html(postL10n[e("input:radio:checked",g).val()+f]);return false});e("input:radio","#post-visibility-select").change(function(){d()});e("#timestampdiv").siblings("a.edit-timestamp").click(function(){if(e("#timestampdiv").is(":hidden")){e("#timestampdiv").slideDown("normal");e(this).hide()}return false});e(".cancel-timestamp","#timestampdiv").click(function(){e("#timestampdiv").slideUp("normal");e("#mm").val(e("#hidden_mm").val());e("#jj").val(e("#hidden_jj").val());e("#aa").val(e("#hidden_aa").val());e("#hh").val(e("#hidden_hh").val());e("#mn").val(e("#hidden_mn").val());e("#timestampdiv").siblings("a.edit-timestamp").show();c();return false});e(".save-timestamp","#timestampdiv").click(function(){if(c()){e("#timestampdiv").slideUp("normal");e("#timestampdiv").siblings("a.edit-timestamp").show()}return false});e("#post-status-select").siblings("a.edit-post-status").click(function(){if(e("#post-status-select").is(":hidden")){e("#post-status-select").slideDown("normal");e(this).hide()}return false});e(".save-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post-status-select").siblings("a.edit-post-status").show();c();return false});e(".cancel-post-status","#post-status-select").click(function(){e("#post-status-select").slideUp("normal");e("#post_status").val(e("#hidden_post_status").val());e("#post-status-select").siblings("a.edit-post-status").show();c();return false})}if(e("#edit-slug-box").length){editPermalink=function(g){var h,l=0,k=e("#editable-post-name"),m=k.html(),p=e("#post_name"),q=p.html(),n=e("#edit-slug-buttons"),o=n.html(),j=e("#editable-post-name-full").html();e("#view-post-btn").hide();n.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");n.children(".save").click(function(){var i=k.children("input").val();e.post(ajaxurl,{action:"sample-permalink",post_id:g,new_slug:i,new_title:e("#title").val(),samplepermalinknonce:e("#samplepermalinknonce").val()},function(r){e("#edit-slug-box").html(r);n.html(o);p.attr("value",i);makeSlugeditClickable();e("#view-post-btn").show()});return false});e(".cancel","#edit-slug-buttons").click(function(){e("#view-post-btn").show();k.html(m);n.html(o);p.attr("value",q);return false});for(h=0;h<j.length;++h){if("%"==j.charAt(h)){l++}}slug_value=(l>j.length/4)?"":j;k.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(r){var i=r.keyCode||0;if(13==i){n.children(".save").click();return false}if(27==i){n.children(".cancel").click();return false}p.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){e("#editable-post-name").click(function(){e("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}});
var tagBox,commentsBox,editPermalink,makeSlugeditClickable,WPSetThumbnailHTML,WPSetThumbnailID,WPRemoveThumbnail;function array_unique_noempty(b){var c=[];jQuery.each(b,function(a,d){d=jQuery.trim(d);if(d&&jQuery.inArray(d,c)==-1){c.push(d)}});return c}(function(a){tagBox={clean:function(b){return b.replace(/\s*,\s*/g,",").replace(/,+/g,",").replace(/[,\s]+$/,"").replace(/^[,\s]+/,"")},parseTags:function(e){var h=e.id,b=h.split("-check-num-")[1],d=a(e).closest(".tagsdiv"),g=d.find(".the-tags"),c=g.val().split(","),f=[];delete c[b];a.each(c,function(i,j){j=a.trim(j);if(j){f.push(j)}});g.val(this.clean(f.join(",")));this.quickClicks(d);return false},quickClicks:function(c){var e=a(".the-tags",c),d=a(".tagchecklist",c),b;if(!e.length){return}b=e.val().split(",");d.empty();a.each(b,function(h,i){var f,g,j=a(c).attr("id");i=a.trim(i);if(!i.match(/^\s+$/)&&""!=i){g=j+"-check-num-"+h;f='<span><a id="'+g+'" class="ntdelbutton">X</a>&nbsp;'+i+"</span> ";d.append(f);a("#"+g).click(function(){tagBox.parseTags(this)})}})},flushTags:function(e,b,g){b=b||false;var i,c=a(".the-tags",e),h=a("input.newtag",e),d;i=b?a(b).text():h.val();tagsval=c.val();d=tagsval?tagsval+","+i:i;d=this.clean(d);d=array_unique_noempty(d.split(",")).join(",");c.val(d);this.quickClicks(e);if(!b){h.val("")}if("undefined"==typeof(g)){h.focus()}return false},get:function(c){var b=c.substr(c.indexOf("-")+1);a.post(ajaxurl,{action:"get-tagcloud",tax:b},function(e,d){if(0==e||"success"!=d){e=wpAjax.broken}e=a('<p id="tagcloud-'+b+'" class="the-tagcloud">'+e+"</p>");a("a",e).click(function(){tagBox.flushTags(a(this).closest(".inside").children(".tagsdiv"),this);return false});a("#"+c).after(e)})},init:function(){var b=this,c=a("div.ajaxtag");a(".tagsdiv").each(function(){tagBox.quickClicks(this)});a("input.tagadd",c).click(function(){b.flushTags(a(this).closest(".tagsdiv"))});a("div.taghint",c).click(function(){a(this).css("visibility","hidden").siblings(".newtag").focus()});a("input.newtag",c).blur(function(){if(this.value==""){a(this).siblings(".taghint").css("visibility","")}}).focus(function(){a(this).siblings(".taghint").css("visibility","hidden")}).keyup(function(d){if(13==d.which){tagBox.flushTags(a(this).closest(".tagsdiv"));return false}}).keypress(function(d){if(13==d.which){d.preventDefault();return false}}).each(function(){var d=a(this).closest("div.tagsdiv").attr("id");a(this).suggest(ajaxurl+"?action=ajax-tag-search&tax="+d,{delay:500,minchars:2,multiple:true,multipleSep:", "})});a("#post").submit(function(){a("div.tagsdiv").each(function(){tagBox.flushTags(this,false,1)})});a("a.tagcloud-link").click(function(){tagBox.get(a(this).attr("id"));a(this).unbind().click(function(){a(this).siblings(".the-tagcloud").toggle();return false});return false})}};commentsBox={st:0,get:function(d,c){var b=this.st,e;if(!c){c=20}this.st+=c;this.total=d;a("#commentsdiv img.waiting").show();e={action:"get-comments",mode:"single",_ajax_nonce:a("#add_comment_nonce").val(),post_ID:a("#post_ID").val(),start:b,num:c};a.post(ajaxurl,e,function(f){f=wpAjax.parseAjaxResponse(f);a("#commentsdiv .widefat").show();a("#commentsdiv img.waiting").hide();if("object"==typeof f&&f.responses[0]){a("#the-comment-list").append(f.responses[0].data);theList=theExtraList=null;a("a[className*=':']").unbind();setCommentsList();if(commentsBox.st>commentsBox.total){a("#show-comments").hide()}else{a("#show-comments").html(postL10n.showcomm)}return}else{if(1==f){a("#show-comments").parent().html(postL10n.endcomm);return}}a("#the-comment-list").append('<tr><td colspan="2">'+wpAjax.broken+"</td></tr>")});return false}};WPSetThumbnailHTML=function(b){a(".inside","#postimagediv").html(b)};WPSetThumbnailID=function(c){var b=a("input[value=_thumbnail_id]","#list-table");if(b.size()>0){a("#meta\\["+b.attr("id").match(/[0-9]+/)+"\\]\\[value\\]").text(c)}};WPRemoveThumbnail=function(){a.post(ajaxurl,{action:"set-post-thumbnail",post_id:a("#post_ID").val(),thumbnail_id:-1,cookie:encodeURIComponent(document.cookie)},function(b){if(b=="0"){alert(setPostThumbnailL10n.error)}else{WPSetThumbnailHTML(b)}})}})(jQuery);jQuery(document).ready(function(g){var c,a,h="",b="post"==pagenow||"post-new"==pagenow,f="page"==pagenow||"page-new"==pagenow;if(b){type="post";if(typenow){type=typenow}postboxes.add_postbox_toggles(type)}else{if(f){postboxes.add_postbox_toggles("page")}}if(g("#tagsdiv-post_tag").length){tagBox.init()}else{g("#side-sortables, #normal-sortables, #advanced-sortables").children("div.postbox").each(function(){if(this.id.indexOf("tagsdiv-")===0){tagBox.init();return false}})}g(".categorydiv").each(function(){var n=g(this).attr("id"),j=false,m,o,l,i,k;l=n.split("-");l.shift();i=l.join("-");k=i+"_tab";if(i=="category"){k="cats"}g("a","#"+i+"-tabs").click(function(){var p=g(this).attr("href");g(this).parent().addClass("tabs").siblings("li").removeClass("tabs");g("#"+i+"-tabs").siblings(".tabs-panel").hide();g(p).show();if("#"+i+"-all"==p){deleteUserSetting(k)}else{setUserSetting(k,"pop")}return false});if(getUserSetting(k)){g('a[href="#'+i+'-pop"]',"#"+i+"-tabs").click()}g("#new"+i).one("focus",function(){g(this).val("").removeClass("form-input-tip")});g("#"+i+"-add-submit").click(function(){g("#new"+i).focus()});m=function(){if(j){return}j=true;var p=jQuery(this),r=p.is(":checked"),q=p.val().toString();g("#in-"+i+"-"+q+", #in-"+i+"-category-"+q).attr("checked",r);j=false};catAddBefore=function(p){if(!g("#new"+i).val()){return false}p.data+="&"+g(":checked","#"+i+"checklist").serialize();return p};o=function(u,t){var q,p=g("#new"+i+"_parent");if("undefined"!=t.parsed.responses[0]&&(q=t.parsed.responses[0].supplemental.newcat_parent)){p.before(q);p.remove()}};g("#"+i+"checklist").wpList({alt:"",response:i+"-ajax-response",addBefore:catAddBefore,addAfter:o});g("#"+i+"-add-toggle").click(function(){g("#"+i+"-adder").toggleClass("wp-hidden-children");g('a[href="#'+i+'-all"]',"#"+i+"-tabs").click();return false});g("#"+i+"checklist li.popular-category :checkbox, #"+i+"checklist-pop :checkbox").live("click",function(){var p=g(this),r=p.is(":checked"),q=p.val();if(q&&p.parents("#taxonomy-"+i).length){g("#in-"+i+"-"+q+", #in-popular-"+i+"-"+q).attr("checked",r)}})});if(g("#postcustom").length){g("#the-list").wpList({addAfter:function(i,j){g("table#list-table").show();if(typeof(autosave_update_post_ID)!="undefined"){autosave_update_post_ID(j.parsed.responses[0].supplemental.postid)}},addBefore:function(i){i.data+="&post_id="+g("#post_ID").val();return i}})}if(g("#submitdiv").length){c=g("#timestamp").html();a=g("#post-visibility-display").html();function e(){var i=g("#post-visibility-select");if(g("input:radio:checked",i).val()!="public"){g("#sticky").attr("checked",false);g("#sticky-span").hide()}else{g("#sticky-span").show()}if(g("input:radio:checked",i).val()!="password"){g("#password-span").hide()}else{g("#password-span").show()}}function d(){var p,q,j,s,r=g("#post_status"),k=g("option[value=publish]",r),i=g("#aa").val(),n=g("#mm").val(),o=g("#jj").val(),m=g("#hh").val(),l=g("#mn").val();p=new Date(i,n-1,o,m,l);q=new Date(g("#hidden_aa").val(),g("#hidden_mm").val()-1,g("#hidden_jj").val(),g("#hidden_hh").val(),g("#hidden_mn").val());j=new Date(g("#cur_aa").val(),g("#cur_mm").val()-1,g("#cur_jj").val(),g("#cur_hh").val(),g("#cur_mn").val());if(p.getFullYear()!=i||(1+p.getMonth())!=n||p.getDate()!=o||p.getMinutes()!=l){g(".timestamp-wrap","#timestampdiv").addClass("form-invalid");return false}else{g(".timestamp-wrap","#timestampdiv").removeClass("form-invalid")}if(p>j&&g("#original_post_status").val()!="future"){s=postL10n.publishOnFuture;g("#publish").val(postL10n.schedule)}else{if(p<=j&&g("#original_post_status").val()!="publish"){s=postL10n.publishOn;g("#publish").val(postL10n.publish)}else{s=postL10n.publishOnPast;if(f){g("#publish").val(postL10n.updatePage)}else{g("#publish").val(postL10n.updatePost)}}}if(q.toUTCString()==p.toUTCString()){g("#timestamp").html(c)}else{g("#timestamp").html(s+" <b>"+g("option[value="+g("#mm").val()+"]","#mm").text()+" "+o+", "+i+" @ "+m+":"+l+"</b> ")}if(g("input:radio:checked","#post-visibility-select").val()=="private"){if(f){g("#publish").val(postL10n.updatePage)}else{g("#publish").val(postL10n.updatePost)}if(k.length==0){r.append('<option value="publish">'+postL10n.privatelyPublished+"</option>")}else{k.html(postL10n.privatelyPublished)}g("option[value=publish]",r).attr("selected",true);g(".edit-post-status","#misc-publishing-actions").hide()}else{if(g("#original_post_status").val()=="future"||g("#original_post_status").val()=="draft"){if(k.length){k.remove();r.val(g("#hidden_post_status").val())}}else{k.html(postL10n.published)}if(r.is(":hidden")){g(".edit-post-status","#misc-publishing-actions").show()}}g("#post-status-display").html(g("option:selected",r).text());if(g("option:selected",r).val()=="private"||g("option:selected",r).val()=="publish"){g("#save-post").hide()}else{g("#save-post").show();if(g("option:selected",r).val()=="pending"){g("#save-post").show().val(postL10n.savePending)}else{g("#save-post").show().val(postL10n.saveDraft)}}return true}g(".edit-visibility","#visibility").click(function(){if(g("#post-visibility-select").is(":hidden")){e();g("#post-visibility-select").slideDown("normal");g(this).hide()}return false});g(".cancel-post-visibility","#post-visibility-select").click(function(){g("#post-visibility-select").slideUp("normal");g("#visibility-radio-"+g("#hidden-post-visibility").val()).attr("checked",true);g("#post_password").val(g("#hidden_post_password").val());g("#sticky").attr("checked",g("#hidden-post-sticky").attr("checked"));g("#post-visibility-display").html(a);g(".edit-visibility","#visibility").show();d();return false});g(".save-post-visibility","#post-visibility-select").click(function(){var i=g("#post-visibility-select");i.slideUp("normal");g(".edit-visibility","#visibility").show();d();if(g("input:radio:checked",i).val()!="public"){g("#sticky").attr("checked",false)}if(true==g("#sticky").attr("checked")){h="Sticky"}else{h=""}g("#post-visibility-display").html(postL10n[g("input:radio:checked",i).val()+h]);return false});g("input:radio","#post-visibility-select").change(function(){e()});g("#timestampdiv").siblings("a.edit-timestamp").click(function(){if(g("#timestampdiv").is(":hidden")){g("#timestampdiv").slideDown("normal");g(this).hide()}return false});g(".cancel-timestamp","#timestampdiv").click(function(){g("#timestampdiv").slideUp("normal");g("#mm").val(g("#hidden_mm").val());g("#jj").val(g("#hidden_jj").val());g("#aa").val(g("#hidden_aa").val());g("#hh").val(g("#hidden_hh").val());g("#mn").val(g("#hidden_mn").val());g("#timestampdiv").siblings("a.edit-timestamp").show();d();return false});g(".save-timestamp","#timestampdiv").click(function(){if(d()){g("#timestampdiv").slideUp("normal");g("#timestampdiv").siblings("a.edit-timestamp").show()}return false});g("#post-status-select").siblings("a.edit-post-status").click(function(){if(g("#post-status-select").is(":hidden")){g("#post-status-select").slideDown("normal");g(this).hide()}return false});g(".save-post-status","#post-status-select").click(function(){g("#post-status-select").slideUp("normal");g("#post-status-select").siblings("a.edit-post-status").show();d();return false});g(".cancel-post-status","#post-status-select").click(function(){g("#post-status-select").slideUp("normal");g("#post_status").val(g("#hidden_post_status").val());g("#post-status-select").siblings("a.edit-post-status").show();d();return false})}if(g("#edit-slug-box").length){editPermalink=function(j){var k,n=0,m=g("#editable-post-name"),o=m.html(),r=g("#post_name"),s=r.html(),p=g("#edit-slug-buttons"),q=p.html(),l=g("#editable-post-name-full").html();g("#view-post-btn").hide();p.html('<a href="#" class="save button">'+postL10n.ok+'</a> <a class="cancel" href="#">'+postL10n.cancel+"</a>");p.children(".save").click(function(){var i=m.children("input").val();g.post(ajaxurl,{action:"sample-permalink",post_id:j,new_slug:i,new_title:g("#title").val(),samplepermalinknonce:g("#samplepermalinknonce").val()},function(t){g("#edit-slug-box").html(t);p.html(q);r.attr("value",i);makeSlugeditClickable();g("#view-post-btn").show()});return false});g(".cancel","#edit-slug-buttons").click(function(){g("#view-post-btn").show();m.html(o);p.html(q);r.attr("value",s);return false});for(k=0;k<l.length;++k){if("%"==l.charAt(k)){n++}}slug_value=(n>l.length/4)?"":l;m.html('<input type="text" id="new-post-slug" value="'+slug_value+'" />').children("input").keypress(function(t){var i=t.keyCode||0;if(13==i){p.children(".save").click();return false}if(27==i){p.children(".cancel").click();return false}r.attr("value",this.value)}).focus()};makeSlugeditClickable=function(){g("#editable-post-name").click(function(){g("#edit-slug-buttons").children(".edit-slug").click()})};makeSlugeditClickable()}});
10574 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/10574/0d2c5a59d9a9fe73894e87d141786caf874bf379/post.js/clean/wp-admin/js/post.js
a._djScaytConfig={baseUrl:y,addOnLoad:[function(){a.fireOnce('scaytReady');}],isDebug:false};a.document.getHead().append(a.document.createElement('script',{attributes:{type:'text/javascript',src:x}}));return null;},parseUrl:function(u){var v;if(u.match&&(v=u.match(/(.*)[\/\\](.*?\.\w+)$/)))return{path:v[1],file:v[2]};else return u;}};var r=j.scayt,s=function(u,v,w,x,y,z,A){u.addCommand(x,y);u.addMenuItem(x,{label:w,command:x,group:z,order:A});},t={preserveState:true,editorFocus:false,exec:function(u){if(r.isScaytReady(u)){var v=r.isScaytEnabled(u);this.setState(v?2:1);var w=r.getScayt(u);w.setDisabled(v);}else if(!u.config.scayt_autoStartup&&r.engineLoaded>=0){this.setState(0);u.on('showScaytState',function(){this.removeListener();this.setState(r.isScaytEnabled(u)?1:2);},this);r.loadEngine(u);}}};j.add('scayt',{requires:['menubutton'],beforeInit:function(u){u.config.menu_groups='scayt_suggest,scayt_moresuggest,scayt_control,'+u.config.menu_groups;},init:function(u){var v={},w={},x=u.addCommand(l,t);a.dialog.add(l,a.getUrl(this.path+'dialogs/options.js'));var y=u.config.scayt_uiTabs||'1,1,1',z=[];y=y.split(',');for(var A=0,B=3;A<B;A++){var C=parseInt(y[A]||'1',10);z.push(C);}var D='scaytButton';u.addMenuGroup(D);var E={};E.scaytToggle={label:u.lang.scayt.enable,command:l,group:D};if(z[0]==1)E.scaytOptions={label:u.lang.scayt.options,group:D,onClick:function(){m='options';u.openDialog(l);}};if(z[1]==1)E.scaytLangs={label:u.lang.scayt.langs,group:D,onClick:function(){m='langs';u.openDialog(l);}};if(z[2]==1)E.scaytDict={label:u.lang.scayt.dictionariesTab,group:D,onClick:function(){m='dictionaries';u.openDialog(l);}};E.scaytAbout={label:u.lang.scayt.about,group:D,onClick:function(){m='about';u.openDialog(l);}};z[3]=1;r.uiTabs=z;u.addMenuItems(E);u.ui.add('Scayt',5,{label:u.lang.scayt.title,title:u.lang.scayt.title,className:'cke_button_scayt',onRender:function(){x.on('state',function(){this.setState(x.state);},this);},onMenu:function(){var G=r.isScaytEnabled(u);u.getMenuItem('scaytToggle').label=u.lang.scayt[G?'disable':'enable'];return{scaytToggle:2,scaytOptions:G&&r.uiTabs[0]?2:0,scaytLangs:G&&r.uiTabs[1]?2:0,scaytDict:G&&r.uiTabs[2]?2:0,scaytAbout:G&&r.uiTabs[3]?2:0};}});if(u.contextMenu&&u.addMenuItems)u.contextMenu.addListener(function(){if(!r.isScaytEnabled(u))return null;var G=r.getScayt(u),H=G.getScaytNode();if(!H)return null;var I=G.getWord(H);if(!I)return null;var J=G.getLang(),K={},L=window.scayt.getSuggestion(I,J);if(!L||!L.length)return null;for(A in v){delete u._.menuItems[A];
});a.on('scaytReady',o,s);a.on('scaytReady',function(){this.engineLoaded=true;},this,null,0);this.engineLoaded=-1;var t=document.location.protocol;t=t.search(/https?:/)!=-1?t:'http:';var u='svc.spellchecker.net/scayt25/loader__base.js',v=s.config.scayt_srcUrl||t+'
a._djScaytConfig={baseUrl:y,addOnLoad:[function(){a.fireOnce('scaytReady');}],isDebug:false};a.document.getHead().append(a.document.createElement('script',{attributes:{type:'text/javascript',src:x}}));return null;},parseUrl:function(u){var v;if(u.match&&(v=u.match(/(.*)[\/\\](.*?\.\w+)$/)))return{path:v[1],file:v[2]};else return u;}};var r=j.scayt,s=function(u,v,w,x,y,z,A){u.addCommand(x,y);u.addMenuItem(x,{label:w,command:x,group:z,order:A});},t={preserveState:true,editorFocus:false,exec:function(u){if(r.isScaytReady(u)){var v=r.isScaytEnabled(u);this.setState(v?2:1);var w=r.getScayt(u);w.setDisabled(v);}else if(!u.config.scayt_autoStartup&&r.engineLoaded>=0){this.setState(0);u.on('showScaytState',function(){this.removeListener();this.setState(r.isScaytEnabled(u)?1:2);},this);r.loadEngine(u);}}};j.add('scayt',{requires:['menubutton'],beforeInit:function(u){u.config.menu_groups='scayt_suggest,scayt_moresuggest,scayt_control,'+u.config.menu_groups;},init:function(u){var v={},w={},x=u.addCommand(l,t);a.dialog.add(l,a.getUrl(this.path+'dialogs/options.js'));var y=u.config.scayt_uiTabs||'1,1,1',z=[];y=y.split(',');for(var A=0,B=3;A<B;A++){var C=parseInt(y[A]||'1',10);z.push(C);}var D='scaytButton';u.addMenuGroup(D);var E={};E.scaytToggle={label:u.lang.scayt.enable,command:l,group:D};if(z[0]==1)E.scaytOptions={label:u.lang.scayt.options,group:D,onClick:function(){m='options';u.openDialog(l);}};if(z[1]==1)E.scaytLangs={label:u.lang.scayt.langs,group:D,onClick:function(){m='langs';u.openDialog(l);}};if(z[2]==1)E.scaytDict={label:u.lang.scayt.dictionariesTab,group:D,onClick:function(){m='dictionaries';u.openDialog(l);}};E.scaytAbout={label:u.lang.scayt.about,group:D,onClick:function(){m='about';u.openDialog(l);}};z[3]=1;r.uiTabs=z;u.addMenuItems(E);u.ui.add('Scayt',5,{label:u.lang.scayt.title,title:u.lang.scayt.title,className:'cke_button_scayt',onRender:function(){x.on('state',function(){this.setState(x.state);},this);},onMenu:function(){var G=r.isScaytEnabled(u);u.getMenuItem('scaytToggle').label=u.lang.scayt[G?'disable':'enable'];return{scaytToggle:2,scaytOptions:G&&r.uiTabs[0]?2:0,scaytLangs:G&&r.uiTabs[1]?2:0,scaytDict:G&&r.uiTabs[2]?2:0,scaytAbout:G&&r.uiTabs[3]?2:0};}});if(u.contextMenu&&u.addMenuItems)u.contextMenu.addListener(function(){if(!r.isScaytEnabled(u))return null;var G=r.getScayt(u),H=G.getScaytNode();if(!H)return null;var I=G.getWord(H);if(!I)return null;var J=G.getLang(),K={},L=window.scayt.getSuggestion(I,J);if(!L||!L.length)return null;for(A in v){delete u._.menuItems[A];
8656 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/8656/debb161f7671ff5bddc8def2221db94ff111ff1b/ckeditor.js/buggy/ckeditor/ckeditor.js
multilineVars.staves.push({ index: multilineVars.staves.length, meter: multilineVars.origMeter });
multilineVars.staves.push({index: multilineVars.staves.length, meter: multilineVars.origMeter});
this.parseVoice = function(line, i, e) { //First truncate the string to the first non-space character after V: through either the //end of the line or a % character. Then remove trailing spaces, too. var ret = tokenizer.getMeat(line, i, e); var start = ret.start; var end = ret.end; //The first thing on the line is the ID. It can be any non-space string and terminates at the //first space. var id = tokenizer.getToken(line, start, end); if (id.length === 0) { warn("Expected a voice id", line, start); return; } var isNew = false; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = {}; isNew = true; if (multilineVars.score_is_present) warn("Can't have an unknown V: id when the %score directive is present", line, i); } start += id.length; start += tokenizer.eatWhiteSpace(line, start); var staffInfo = {startStaff: isNew}; var addNextTokenToStaffInfo = function(name) { var attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for " + name + " in voice: " + attr.warn, line, start); else if (attr.token.length === 0 && line[start] !== '"') warn("Expected value for " + name + " in voice", line, start); else staffInfo[name] = attr.token; start += attr.len; }; //Then the following items can occur in any order: while (start < end) { var token = tokenizer.getVoiceToken(line, start, end); start += token.len; if (token.warn) { warn("Error parsing voice: " + token.warn, line, start); } else { var attr = null; switch (token.token) { case 'clef': case 'cl': addNextTokenToStaffInfo('clef'); // TODO-PER: check for a legal clef; do octavizing var oct = 0;// for (var ii = 0; ii < staffInfo.clef.length; ii++) {// if (staffInfo.clef[ii] === ',') oct -= 7;// else if (staffInfo.clef[ii] === "'") oct += 7;// } if (staffInfo.clef !== undefined) { staffInfo.clef = staffInfo.clef.replace(/[',]/g, ""); if (staffInfo.clef.indexOf('+16') !== -1) { oct += 14; staffInfo.clef = staffInfo.clef.replace('+16', ''); } staffInfo.verticalPos = calcMiddle(staffInfo.clef, oct); } break; case 'treble': case 'bass': case 'tenor': case 'alto': case 'none': case 'treble\'': case 'bass\'': case 'tenor\'': case 'alto\'': case 'none\'': case 'treble\'\'': case 'bass\'\'': case 'tenor\'\'': case 'alto\'\'': case 'none\'\'': case 'treble,': case 'bass,': case 'tenor,': case 'alto,': case 'none,': case 'treble,,': case 'bass,,': case 'tenor,,': case 'alto,,': case 'none,,': // TODO-PER: handle the octave indicators on the clef by changing the middle property var oct2 = 0;// for (var iii = 0; iii < token.token.length; iii++) {// if (token.token[iii] === ',') oct2 -= 7;// else if (token.token[iii] === "'") oct2 += 7;// } staffInfo.clef = token.token.replace(/[',]/g, ""); staffInfo.verticalPos = calcMiddle(staffInfo.clef, oct2); break; case 'staves': case 'stave': case 'stv': addNextTokenToStaffInfo('staves'); break; case 'brace': case 'brc': addNextTokenToStaffInfo('brace'); break; case 'bracket': case 'brk': addNextTokenToStaffInfo('bracket'); break; case 'name': case 'nm': addNextTokenToStaffInfo('name'); break; case 'subname': case 'sname': case 'snm': addNextTokenToStaffInfo('subname'); break; case 'merge': staffInfo.startStaff = false; break; case 'stems': attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for stems in voice: " + attr.warn, line, start); else if (attr.token === 'up' || attr.token === 'down') multilineVars.voices[id].stem = attr.token; else warn("Expected up or down for voice stem", line, start); start += attr.len; break; case 'up': case 'down': multilineVars.voices[id].stem = token.token; break; case 'middle': case 'm': addNextTokenToStaffInfo('verticalPos'); staffInfo.verticalPos = parseMiddle(staffInfo.verticalPos); break; case 'gchords': case 'gch': multilineVars.voices[id].suppressChords = true; break; case 'space': case 'spc': addNextTokenToStaffInfo('spacing'); break; } } start += tokenizer.eatWhiteSpace(line, start); } // now we've filled up staffInfo, figure out what to do with this voice // TODO-PER: It is unclear from the standard and the examples what to do with brace, bracket, and staves, so they are ignored for now. if (staffInfo.startStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length, meter: multilineVars.origMeter }); if (!multilineVars.score_is_present) multilineVars.staves[multilineVars.staves.length-1].numVoices = 0; } if (multilineVars.voices[id].staffNum === undefined) { // store where to write this for quick access later. multilineVars.voices[id].staffNum = multilineVars.staves.length-1; var vi = 0; for(var v in multilineVars.voices) { if(multilineVars.voices.hasOwnProperty(v)) { if (multilineVars.voices[v].staffNum === multilineVars.voices[id].staffNum) vi++; } } multilineVars.voices[id].index = vi-1; } var s = multilineVars.staves[multilineVars.voices[id].staffNum]; if (!multilineVars.score_is_present) s.numVoices++; if (staffInfo.clef) s.clef = { type: staffInfo.clef, verticalPos: staffInfo.verticalPos }; if (staffInfo.spacing) s.spacing_below_offset = staffInfo.spacing; if (staffInfo.verticalPos) s.verticalPos = staffInfo.verticalPos; if (staffInfo.name) {if (s.name) s.name.push(staffInfo.name); else s.name = [ staffInfo.name ];} if (staffInfo.subname) {if (s.subname) s.subname.push(staffInfo.subname); else s.subname = [ staffInfo.subname ];} this.setCurrentVoice(id); };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/b469218ea3fed3fd3b63e64dfa8a3d3cd05c473d/abc_parse_header.js/clean/abc_parse_header.js
if (staffInfo.clef) s.clef = { type: staffInfo.clef, verticalPos: staffInfo.verticalPos };
if (staffInfo.clef) s.clef = {type: staffInfo.clef, verticalPos: staffInfo.verticalPos};
this.parseVoice = function(line, i, e) { //First truncate the string to the first non-space character after V: through either the //end of the line or a % character. Then remove trailing spaces, too. var ret = tokenizer.getMeat(line, i, e); var start = ret.start; var end = ret.end; //The first thing on the line is the ID. It can be any non-space string and terminates at the //first space. var id = tokenizer.getToken(line, start, end); if (id.length === 0) { warn("Expected a voice id", line, start); return; } var isNew = false; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = {}; isNew = true; if (multilineVars.score_is_present) warn("Can't have an unknown V: id when the %score directive is present", line, i); } start += id.length; start += tokenizer.eatWhiteSpace(line, start); var staffInfo = {startStaff: isNew}; var addNextTokenToStaffInfo = function(name) { var attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for " + name + " in voice: " + attr.warn, line, start); else if (attr.token.length === 0 && line[start] !== '"') warn("Expected value for " + name + " in voice", line, start); else staffInfo[name] = attr.token; start += attr.len; }; //Then the following items can occur in any order: while (start < end) { var token = tokenizer.getVoiceToken(line, start, end); start += token.len; if (token.warn) { warn("Error parsing voice: " + token.warn, line, start); } else { var attr = null; switch (token.token) { case 'clef': case 'cl': addNextTokenToStaffInfo('clef'); // TODO-PER: check for a legal clef; do octavizing var oct = 0;// for (var ii = 0; ii < staffInfo.clef.length; ii++) {// if (staffInfo.clef[ii] === ',') oct -= 7;// else if (staffInfo.clef[ii] === "'") oct += 7;// } if (staffInfo.clef !== undefined) { staffInfo.clef = staffInfo.clef.replace(/[',]/g, ""); if (staffInfo.clef.indexOf('+16') !== -1) { oct += 14; staffInfo.clef = staffInfo.clef.replace('+16', ''); } staffInfo.verticalPos = calcMiddle(staffInfo.clef, oct); } break; case 'treble': case 'bass': case 'tenor': case 'alto': case 'none': case 'treble\'': case 'bass\'': case 'tenor\'': case 'alto\'': case 'none\'': case 'treble\'\'': case 'bass\'\'': case 'tenor\'\'': case 'alto\'\'': case 'none\'\'': case 'treble,': case 'bass,': case 'tenor,': case 'alto,': case 'none,': case 'treble,,': case 'bass,,': case 'tenor,,': case 'alto,,': case 'none,,': // TODO-PER: handle the octave indicators on the clef by changing the middle property var oct2 = 0;// for (var iii = 0; iii < token.token.length; iii++) {// if (token.token[iii] === ',') oct2 -= 7;// else if (token.token[iii] === "'") oct2 += 7;// } staffInfo.clef = token.token.replace(/[',]/g, ""); staffInfo.verticalPos = calcMiddle(staffInfo.clef, oct2); break; case 'staves': case 'stave': case 'stv': addNextTokenToStaffInfo('staves'); break; case 'brace': case 'brc': addNextTokenToStaffInfo('brace'); break; case 'bracket': case 'brk': addNextTokenToStaffInfo('bracket'); break; case 'name': case 'nm': addNextTokenToStaffInfo('name'); break; case 'subname': case 'sname': case 'snm': addNextTokenToStaffInfo('subname'); break; case 'merge': staffInfo.startStaff = false; break; case 'stems': attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for stems in voice: " + attr.warn, line, start); else if (attr.token === 'up' || attr.token === 'down') multilineVars.voices[id].stem = attr.token; else warn("Expected up or down for voice stem", line, start); start += attr.len; break; case 'up': case 'down': multilineVars.voices[id].stem = token.token; break; case 'middle': case 'm': addNextTokenToStaffInfo('verticalPos'); staffInfo.verticalPos = parseMiddle(staffInfo.verticalPos); break; case 'gchords': case 'gch': multilineVars.voices[id].suppressChords = true; break; case 'space': case 'spc': addNextTokenToStaffInfo('spacing'); break; } } start += tokenizer.eatWhiteSpace(line, start); } // now we've filled up staffInfo, figure out what to do with this voice // TODO-PER: It is unclear from the standard and the examples what to do with brace, bracket, and staves, so they are ignored for now. if (staffInfo.startStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length, meter: multilineVars.origMeter }); if (!multilineVars.score_is_present) multilineVars.staves[multilineVars.staves.length-1].numVoices = 0; } if (multilineVars.voices[id].staffNum === undefined) { // store where to write this for quick access later. multilineVars.voices[id].staffNum = multilineVars.staves.length-1; var vi = 0; for(var v in multilineVars.voices) { if(multilineVars.voices.hasOwnProperty(v)) { if (multilineVars.voices[v].staffNum === multilineVars.voices[id].staffNum) vi++; } } multilineVars.voices[id].index = vi-1; } var s = multilineVars.staves[multilineVars.voices[id].staffNum]; if (!multilineVars.score_is_present) s.numVoices++; if (staffInfo.clef) s.clef = { type: staffInfo.clef, verticalPos: staffInfo.verticalPos }; if (staffInfo.spacing) s.spacing_below_offset = staffInfo.spacing; if (staffInfo.verticalPos) s.verticalPos = staffInfo.verticalPos; if (staffInfo.name) {if (s.name) s.name.push(staffInfo.name); else s.name = [ staffInfo.name ];} if (staffInfo.subname) {if (s.subname) s.subname.push(staffInfo.subname); else s.subname = [ staffInfo.subname ];} this.setCurrentVoice(id); };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/b469218ea3fed3fd3b63e64dfa8a3d3cd05c473d/abc_parse_header.js/clean/abc_parse_header.js
staffInfo.clef = staffInfo.clef.replace(/[',]/g, ""); if (staffInfo.clef.indexOf('+16') != -1) { oct += 14; staffInfo.clef = staffInfo.clef.replace('+16', '');
if (staffInfo.clef !== undefined) { staffInfo.clef = staffInfo.clef.replace(/[',]/g, ""); if (staffInfo.clef.indexOf('+16') != -1) { oct += 14; staffInfo.clef = staffInfo.clef.replace('+16', ''); } staffInfo.middle = calcMiddle(staffInfo.clef, oct);
this.parseVoice = function(line, i, e) { //First truncate the string to the first non-space character after V: through either the //end of the line or a % character. Then remove trailing spaces, too. var ret = tokenizer.getMeat(line, i, e); var start = ret.start; var end = ret.end; //The first thing on the line is the ID. It can be any non-space string and terminates at the //first space. var id = tokenizer.getToken(line, start, end); if (id.length === 0) { warn("Expected a voice id", line, start); return; } var isNew = false; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = {}; isNew = true; if (multilineVars.score_is_present) warn("Can't have an unknown V: id when the %score directive is present", line, i); } start += id.length; start += tokenizer.eatWhiteSpace(line, start); var staffInfo = {startStaff: isNew}; var addNextTokenToStaffInfo = function(name) { var attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for " + name + " in voice: " + attr.warn, line, start); else if (attr.token.length === 0 && line[start] !== '"') warn("Expected value for " + name + " in voice", line, start); else staffInfo[name] = attr.token; start += attr.len; }; //Then the following items can occur in any order: while (start < end) { var token = tokenizer.getVoiceToken(line, start, end); start += token.len; if (token.warn) { warn("Error parsing voice: " + token.warn, line, start); } else { var attr = null; switch (token.token) { case 'clef': case 'cl': addNextTokenToStaffInfo('clef'); // TODO-PER: check for a legal clef; do octavizing var oct = 0;// for (var ii = 0; ii < staffInfo.clef.length; ii++) {// if (staffInfo.clef[ii] === ',') oct -= 7;// else if (staffInfo.clef[ii] === "'") oct += 7;// } staffInfo.clef = staffInfo.clef.replace(/[',]/g, ""); if (staffInfo.clef.indexOf('+16') != -1) { oct += 14; staffInfo.clef = staffInfo.clef.replace('+16', ''); } staffInfo.middle = calcMiddle(staffInfo.clef, oct); break; case 'treble': case 'bass': case 'tenor': case 'alto': case 'none': case 'treble\'': case 'bass\'': case 'tenor\'': case 'alto\'': case 'none\'': case 'treble\'\'': case 'bass\'\'': case 'tenor\'\'': case 'alto\'\'': case 'none\'\'': case 'treble,': case 'bass,': case 'tenor,': case 'alto,': case 'none,': case 'treble,,': case 'bass,,': case 'tenor,,': case 'alto,,': case 'none,,': // TODO-PER: handle the octave indicators on the clef by changing the middle property var oct2 = 0;// for (var iii = 0; iii < token.token.length; iii++) {// if (token.token[iii] === ',') oct2 -= 7;// else if (token.token[iii] === "'") oct2 += 7;// } staffInfo.clef = token.token.replace(/[',]/g, ""); staffInfo.middle = calcMiddle(staffInfo.clef, oct2); break; case 'staves': case 'stave': case 'stv': addNextTokenToStaffInfo('staves'); break; case 'brace': case 'brc': addNextTokenToStaffInfo('brace'); break; case 'bracket': case 'brk': addNextTokenToStaffInfo('bracket'); break; case 'name': case 'nm': addNextTokenToStaffInfo('name'); break; case 'subname': case 'sname': case 'snm': addNextTokenToStaffInfo('subname'); break; case 'merge': staffInfo.startStaff = false; break; case 'stems': attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for stems in voice: " + attr.warn, line, start); else if (attr.token === 'up' || attr.token === 'down') multilineVars.voices[id].stem = attr.token; else warn("Expected up or down for voice stem", line, start); start += attr.len; break; case 'up': case 'down': multilineVars.voices[id].stem = token.token; break; case 'middle': case 'm': addNextTokenToStaffInfo('middle'); staffInfo.middle = parseMiddle(staffInfo.middle); break; case 'gchords': case 'gch': multilineVars.voices[id].suppressChords = true; break; case 'space': case 'spc': addNextTokenToStaffInfo('spacing'); break; } } start += tokenizer.eatWhiteSpace(line, start); } // now we've filled up staffInfo, figure out what to do with this voice // TODO-PER: It is unclear from the standard and the examples what to do with brace, bracket, and staves, so they are ignored for now. if (staffInfo.startStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length, meter: multilineVars.origMeter }); if (!multilineVars.score_is_present) multilineVars.staves[multilineVars.staves.length-1].numVoices = 0; } if (multilineVars.voices[id].staffNum === undefined) { // store where to write this for quick access later. multilineVars.voices[id].staffNum = multilineVars.staves.length-1; var vi = 0; for(var v in multilineVars.voices) { if(multilineVars.voices.hasOwnProperty(v)) { if (multilineVars.voices[v].staffNum === multilineVars.voices[id].staffNum) vi++; } } multilineVars.voices[id].index = vi-1; } var s = multilineVars.staves[multilineVars.voices[id].staffNum]; if (!multilineVars.score_is_present) s.numVoices++; if (staffInfo.clef) s.clef = { type: staffInfo.clef, middle: staffInfo.middle }; if (staffInfo.spacing) s.spacing_below_offset = staffInfo.spacing; if (staffInfo.middle) s.middle = staffInfo.middle; if (staffInfo.name) {if (s.name) s.name.push(staffInfo.name); else s.name = [ staffInfo.name ];} if (staffInfo.subname) {if (s.subname) s.subname.push(staffInfo.subname); else s.subname = [ staffInfo.subname ];} this.setCurrentVoice(id); };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/b9fe51368ab7ac2f2cd1784d6b85847085c5d12d/abc_parse_header.js/buggy/abc_parse_header.js
staffInfo.middle = calcMiddle(staffInfo.clef, oct);
this.parseVoice = function(line, i, e) { //First truncate the string to the first non-space character after V: through either the //end of the line or a % character. Then remove trailing spaces, too. var ret = tokenizer.getMeat(line, i, e); var start = ret.start; var end = ret.end; //The first thing on the line is the ID. It can be any non-space string and terminates at the //first space. var id = tokenizer.getToken(line, start, end); if (id.length === 0) { warn("Expected a voice id", line, start); return; } var isNew = false; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = {}; isNew = true; if (multilineVars.score_is_present) warn("Can't have an unknown V: id when the %score directive is present", line, i); } start += id.length; start += tokenizer.eatWhiteSpace(line, start); var staffInfo = {startStaff: isNew}; var addNextTokenToStaffInfo = function(name) { var attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for " + name + " in voice: " + attr.warn, line, start); else if (attr.token.length === 0 && line[start] !== '"') warn("Expected value for " + name + " in voice", line, start); else staffInfo[name] = attr.token; start += attr.len; }; //Then the following items can occur in any order: while (start < end) { var token = tokenizer.getVoiceToken(line, start, end); start += token.len; if (token.warn) { warn("Error parsing voice: " + token.warn, line, start); } else { var attr = null; switch (token.token) { case 'clef': case 'cl': addNextTokenToStaffInfo('clef'); // TODO-PER: check for a legal clef; do octavizing var oct = 0;// for (var ii = 0; ii < staffInfo.clef.length; ii++) {// if (staffInfo.clef[ii] === ',') oct -= 7;// else if (staffInfo.clef[ii] === "'") oct += 7;// } staffInfo.clef = staffInfo.clef.replace(/[',]/g, ""); if (staffInfo.clef.indexOf('+16') != -1) { oct += 14; staffInfo.clef = staffInfo.clef.replace('+16', ''); } staffInfo.middle = calcMiddle(staffInfo.clef, oct); break; case 'treble': case 'bass': case 'tenor': case 'alto': case 'none': case 'treble\'': case 'bass\'': case 'tenor\'': case 'alto\'': case 'none\'': case 'treble\'\'': case 'bass\'\'': case 'tenor\'\'': case 'alto\'\'': case 'none\'\'': case 'treble,': case 'bass,': case 'tenor,': case 'alto,': case 'none,': case 'treble,,': case 'bass,,': case 'tenor,,': case 'alto,,': case 'none,,': // TODO-PER: handle the octave indicators on the clef by changing the middle property var oct2 = 0;// for (var iii = 0; iii < token.token.length; iii++) {// if (token.token[iii] === ',') oct2 -= 7;// else if (token.token[iii] === "'") oct2 += 7;// } staffInfo.clef = token.token.replace(/[',]/g, ""); staffInfo.middle = calcMiddle(staffInfo.clef, oct2); break; case 'staves': case 'stave': case 'stv': addNextTokenToStaffInfo('staves'); break; case 'brace': case 'brc': addNextTokenToStaffInfo('brace'); break; case 'bracket': case 'brk': addNextTokenToStaffInfo('bracket'); break; case 'name': case 'nm': addNextTokenToStaffInfo('name'); break; case 'subname': case 'sname': case 'snm': addNextTokenToStaffInfo('subname'); break; case 'merge': staffInfo.startStaff = false; break; case 'stems': attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for stems in voice: " + attr.warn, line, start); else if (attr.token === 'up' || attr.token === 'down') multilineVars.voices[id].stem = attr.token; else warn("Expected up or down for voice stem", line, start); start += attr.len; break; case 'up': case 'down': multilineVars.voices[id].stem = token.token; break; case 'middle': case 'm': addNextTokenToStaffInfo('middle'); staffInfo.middle = parseMiddle(staffInfo.middle); break; case 'gchords': case 'gch': multilineVars.voices[id].suppressChords = true; break; case 'space': case 'spc': addNextTokenToStaffInfo('spacing'); break; } } start += tokenizer.eatWhiteSpace(line, start); } // now we've filled up staffInfo, figure out what to do with this voice // TODO-PER: It is unclear from the standard and the examples what to do with brace, bracket, and staves, so they are ignored for now. if (staffInfo.startStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length, meter: multilineVars.origMeter }); if (!multilineVars.score_is_present) multilineVars.staves[multilineVars.staves.length-1].numVoices = 0; } if (multilineVars.voices[id].staffNum === undefined) { // store where to write this for quick access later. multilineVars.voices[id].staffNum = multilineVars.staves.length-1; var vi = 0; for(var v in multilineVars.voices) { if(multilineVars.voices.hasOwnProperty(v)) { if (multilineVars.voices[v].staffNum === multilineVars.voices[id].staffNum) vi++; } } multilineVars.voices[id].index = vi-1; } var s = multilineVars.staves[multilineVars.voices[id].staffNum]; if (!multilineVars.score_is_present) s.numVoices++; if (staffInfo.clef) s.clef = { type: staffInfo.clef, middle: staffInfo.middle }; if (staffInfo.spacing) s.spacing_below_offset = staffInfo.spacing; if (staffInfo.middle) s.middle = staffInfo.middle; if (staffInfo.name) {if (s.name) s.name.push(staffInfo.name); else s.name = [ staffInfo.name ];} if (staffInfo.subname) {if (s.subname) s.subname.push(staffInfo.subname); else s.subname = [ staffInfo.subname ];} this.setCurrentVoice(id); };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/b9fe51368ab7ac2f2cd1784d6b85847085c5d12d/abc_parse_header.js/buggy/abc_parse_header.js
var ret = tokenizer.getMeat(line, i, e); var start = ret.start; var end = ret.end; var id = tokenizer.getToken(line, start, end); if (id.length === 0) { warn("Expected a voice id", line, start); return; } var isNew = false; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = {}; isNew = true; if (multilineVars.score_is_present) warn("Can't have an unknown V: id when the %score directive is present", line, i); } start += id.length; start += tokenizer.eatWhiteSpace(line, start);
var ret = tokenizer.getMeat(line, i, e); var start = ret.start; var end = ret.end; var id = tokenizer.getToken(line, start, end); if (id.length === 0) { warn("Expected a voice id", line, start); return; } var isNew = false; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = {}; isNew = true; if (multilineVars.score_is_present) warn("Can't have an unknown V: id when the %score directive is present", line, i); } start += id.length; start += tokenizer.eatWhiteSpace(line, start);
this.parseVoice = function(line, i, e) { //First truncate the string to the first non-space character after V: through either the //end of the line or a % character. Then remove trailing spaces, too. var ret = tokenizer.getMeat(line, i, e); var start = ret.start; var end = ret.end; //The first thing on the line is the ID. It can be any non-space string and terminates at the //first space. var id = tokenizer.getToken(line, start, end); if (id.length === 0) { warn("Expected a voice id", line, start); return; } var isNew = false; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = {}; isNew = true; if (multilineVars.score_is_present) warn("Can't have an unknown V: id when the %score directive is present", line, i); } start += id.length; start += tokenizer.eatWhiteSpace(line, start); var staffInfo = {startStaff: isNew}; var addNextTokenToStaffInfo = function(name) { var attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for " + name + " in voice: " + attr.warn, line, start); else if (attr.token.length === 0 && line[start] !== '"') warn("Expected value for " + name + " in voice", line, start); else staffInfo[name] = attr.token; start += attr.len; }; //Then the following items can occur in any order: while (start < end) { var token = tokenizer.getVoiceToken(line, start, end); start += token.len; if (token.warn) { warn("Error parsing voice: " + token.warn, line, start); } else { var attr = null; switch (token.token) { case 'clef': case 'cl': addNextTokenToStaffInfo('clef'); // TODO-PER: check for a legal clef; do octavizing var oct = 0;// for (var ii = 0; ii < staffInfo.clef.length; ii++) {// if (staffInfo.clef[ii] === ',') oct -= 7;// else if (staffInfo.clef[ii] === "'") oct += 7;// } if (staffInfo.clef !== undefined) { staffInfo.clef = staffInfo.clef.replace(/[',]/g, ""); if (staffInfo.clef.indexOf('+16') != -1) { oct += 14; staffInfo.clef = staffInfo.clef.replace('+16', ''); } staffInfo.middle = calcMiddle(staffInfo.clef, oct); } break; case 'treble': case 'bass': case 'tenor': case 'alto': case 'none': case 'treble\'': case 'bass\'': case 'tenor\'': case 'alto\'': case 'none\'': case 'treble\'\'': case 'bass\'\'': case 'tenor\'\'': case 'alto\'\'': case 'none\'\'': case 'treble,': case 'bass,': case 'tenor,': case 'alto,': case 'none,': case 'treble,,': case 'bass,,': case 'tenor,,': case 'alto,,': case 'none,,': // TODO-PER: handle the octave indicators on the clef by changing the middle property var oct2 = 0;// for (var iii = 0; iii < token.token.length; iii++) {// if (token.token[iii] === ',') oct2 -= 7;// else if (token.token[iii] === "'") oct2 += 7;// } staffInfo.clef = token.token.replace(/[',]/g, ""); staffInfo.middle = calcMiddle(staffInfo.clef, oct2); break; case 'staves': case 'stave': case 'stv': addNextTokenToStaffInfo('staves'); break; case 'brace': case 'brc': addNextTokenToStaffInfo('brace'); break; case 'bracket': case 'brk': addNextTokenToStaffInfo('bracket'); break; case 'name': case 'nm': addNextTokenToStaffInfo('name'); break; case 'subname': case 'sname': case 'snm': addNextTokenToStaffInfo('subname'); break; case 'merge': staffInfo.startStaff = false; break; case 'stems': attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for stems in voice: " + attr.warn, line, start); else if (attr.token === 'up' || attr.token === 'down') multilineVars.voices[id].stem = attr.token; else warn("Expected up or down for voice stem", line, start); start += attr.len; break; case 'up': case 'down': multilineVars.voices[id].stem = token.token; break; case 'middle': case 'm': addNextTokenToStaffInfo('middle'); staffInfo.middle = parseMiddle(staffInfo.middle); break; case 'gchords': case 'gch': multilineVars.voices[id].suppressChords = true; break; case 'space': case 'spc': addNextTokenToStaffInfo('spacing'); break; } } start += tokenizer.eatWhiteSpace(line, start); } // now we've filled up staffInfo, figure out what to do with this voice // TODO-PER: It is unclear from the standard and the examples what to do with brace, bracket, and staves, so they are ignored for now. if (staffInfo.startStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length, meter: multilineVars.origMeter }); if (!multilineVars.score_is_present) multilineVars.staves[multilineVars.staves.length-1].numVoices = 0; } if (multilineVars.voices[id].staffNum === undefined) { // store where to write this for quick access later. multilineVars.voices[id].staffNum = multilineVars.staves.length-1; var vi = 0; for(var v in multilineVars.voices) { if(multilineVars.voices.hasOwnProperty(v)) { if (multilineVars.voices[v].staffNum === multilineVars.voices[id].staffNum) vi++; } } multilineVars.voices[id].index = vi-1; } var s = multilineVars.staves[multilineVars.voices[id].staffNum]; if (!multilineVars.score_is_present) s.numVoices++; if (staffInfo.clef) s.clef = { type: staffInfo.clef, middle: staffInfo.middle }; if (staffInfo.spacing) s.spacing_below_offset = staffInfo.spacing; if (staffInfo.middle) s.middle = staffInfo.middle; if (staffInfo.name) {if (s.name) s.name.push(staffInfo.name); else s.name = [ staffInfo.name ];} if (staffInfo.subname) {if (s.subname) s.subname.push(staffInfo.subname); else s.subname = [ staffInfo.subname ];} this.setCurrentVoice(id); };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f5a9f7ef8d556b3359fab3994dac1ddd87440bb3/abc_parse_header.js/buggy/abc_parse_header.js
var staffInfo = {startStaff: isNew}; var addNextTokenToStaffInfo = function(name) { var attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for " + name + " in voice: " + attr.warn, line, start); else if (attr.token.length === 0 && line[start] !== '"') warn("Expected value for " + name + " in voice", line, start); else staffInfo[name] = attr.token; start += attr.len; };
var staffInfo = {startStaff: isNew}; var addNextTokenToStaffInfo = function(name) { var attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for " + name + " in voice: " + attr.warn, line, start); else if (attr.token.length === 0 && line[start] !== '"') warn("Expected value for " + name + " in voice", line, start); else staffInfo[name] = attr.token; start += attr.len; };
this.parseVoice = function(line, i, e) { //First truncate the string to the first non-space character after V: through either the //end of the line or a % character. Then remove trailing spaces, too. var ret = tokenizer.getMeat(line, i, e); var start = ret.start; var end = ret.end; //The first thing on the line is the ID. It can be any non-space string and terminates at the //first space. var id = tokenizer.getToken(line, start, end); if (id.length === 0) { warn("Expected a voice id", line, start); return; } var isNew = false; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = {}; isNew = true; if (multilineVars.score_is_present) warn("Can't have an unknown V: id when the %score directive is present", line, i); } start += id.length; start += tokenizer.eatWhiteSpace(line, start); var staffInfo = {startStaff: isNew}; var addNextTokenToStaffInfo = function(name) { var attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for " + name + " in voice: " + attr.warn, line, start); else if (attr.token.length === 0 && line[start] !== '"') warn("Expected value for " + name + " in voice", line, start); else staffInfo[name] = attr.token; start += attr.len; }; //Then the following items can occur in any order: while (start < end) { var token = tokenizer.getVoiceToken(line, start, end); start += token.len; if (token.warn) { warn("Error parsing voice: " + token.warn, line, start); } else { var attr = null; switch (token.token) { case 'clef': case 'cl': addNextTokenToStaffInfo('clef'); // TODO-PER: check for a legal clef; do octavizing var oct = 0;// for (var ii = 0; ii < staffInfo.clef.length; ii++) {// if (staffInfo.clef[ii] === ',') oct -= 7;// else if (staffInfo.clef[ii] === "'") oct += 7;// } if (staffInfo.clef !== undefined) { staffInfo.clef = staffInfo.clef.replace(/[',]/g, ""); if (staffInfo.clef.indexOf('+16') != -1) { oct += 14; staffInfo.clef = staffInfo.clef.replace('+16', ''); } staffInfo.middle = calcMiddle(staffInfo.clef, oct); } break; case 'treble': case 'bass': case 'tenor': case 'alto': case 'none': case 'treble\'': case 'bass\'': case 'tenor\'': case 'alto\'': case 'none\'': case 'treble\'\'': case 'bass\'\'': case 'tenor\'\'': case 'alto\'\'': case 'none\'\'': case 'treble,': case 'bass,': case 'tenor,': case 'alto,': case 'none,': case 'treble,,': case 'bass,,': case 'tenor,,': case 'alto,,': case 'none,,': // TODO-PER: handle the octave indicators on the clef by changing the middle property var oct2 = 0;// for (var iii = 0; iii < token.token.length; iii++) {// if (token.token[iii] === ',') oct2 -= 7;// else if (token.token[iii] === "'") oct2 += 7;// } staffInfo.clef = token.token.replace(/[',]/g, ""); staffInfo.middle = calcMiddle(staffInfo.clef, oct2); break; case 'staves': case 'stave': case 'stv': addNextTokenToStaffInfo('staves'); break; case 'brace': case 'brc': addNextTokenToStaffInfo('brace'); break; case 'bracket': case 'brk': addNextTokenToStaffInfo('bracket'); break; case 'name': case 'nm': addNextTokenToStaffInfo('name'); break; case 'subname': case 'sname': case 'snm': addNextTokenToStaffInfo('subname'); break; case 'merge': staffInfo.startStaff = false; break; case 'stems': attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for stems in voice: " + attr.warn, line, start); else if (attr.token === 'up' || attr.token === 'down') multilineVars.voices[id].stem = attr.token; else warn("Expected up or down for voice stem", line, start); start += attr.len; break; case 'up': case 'down': multilineVars.voices[id].stem = token.token; break; case 'middle': case 'm': addNextTokenToStaffInfo('middle'); staffInfo.middle = parseMiddle(staffInfo.middle); break; case 'gchords': case 'gch': multilineVars.voices[id].suppressChords = true; break; case 'space': case 'spc': addNextTokenToStaffInfo('spacing'); break; } } start += tokenizer.eatWhiteSpace(line, start); } // now we've filled up staffInfo, figure out what to do with this voice // TODO-PER: It is unclear from the standard and the examples what to do with brace, bracket, and staves, so they are ignored for now. if (staffInfo.startStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length, meter: multilineVars.origMeter }); if (!multilineVars.score_is_present) multilineVars.staves[multilineVars.staves.length-1].numVoices = 0; } if (multilineVars.voices[id].staffNum === undefined) { // store where to write this for quick access later. multilineVars.voices[id].staffNum = multilineVars.staves.length-1; var vi = 0; for(var v in multilineVars.voices) { if(multilineVars.voices.hasOwnProperty(v)) { if (multilineVars.voices[v].staffNum === multilineVars.voices[id].staffNum) vi++; } } multilineVars.voices[id].index = vi-1; } var s = multilineVars.staves[multilineVars.voices[id].staffNum]; if (!multilineVars.score_is_present) s.numVoices++; if (staffInfo.clef) s.clef = { type: staffInfo.clef, middle: staffInfo.middle }; if (staffInfo.spacing) s.spacing_below_offset = staffInfo.spacing; if (staffInfo.middle) s.middle = staffInfo.middle; if (staffInfo.name) {if (s.name) s.name.push(staffInfo.name); else s.name = [ staffInfo.name ];} if (staffInfo.subname) {if (s.subname) s.subname.push(staffInfo.subname); else s.subname = [ staffInfo.subname ];} this.setCurrentVoice(id); };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f5a9f7ef8d556b3359fab3994dac1ddd87440bb3/abc_parse_header.js/buggy/abc_parse_header.js
while (start < end) { var token = tokenizer.getVoiceToken(line, start, end); start += token.len;
while (start < end) { var token = tokenizer.getVoiceToken(line, start, end); start += token.len;
this.parseVoice = function(line, i, e) { //First truncate the string to the first non-space character after V: through either the //end of the line or a % character. Then remove trailing spaces, too. var ret = tokenizer.getMeat(line, i, e); var start = ret.start; var end = ret.end; //The first thing on the line is the ID. It can be any non-space string and terminates at the //first space. var id = tokenizer.getToken(line, start, end); if (id.length === 0) { warn("Expected a voice id", line, start); return; } var isNew = false; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = {}; isNew = true; if (multilineVars.score_is_present) warn("Can't have an unknown V: id when the %score directive is present", line, i); } start += id.length; start += tokenizer.eatWhiteSpace(line, start); var staffInfo = {startStaff: isNew}; var addNextTokenToStaffInfo = function(name) { var attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for " + name + " in voice: " + attr.warn, line, start); else if (attr.token.length === 0 && line[start] !== '"') warn("Expected value for " + name + " in voice", line, start); else staffInfo[name] = attr.token; start += attr.len; }; //Then the following items can occur in any order: while (start < end) { var token = tokenizer.getVoiceToken(line, start, end); start += token.len; if (token.warn) { warn("Error parsing voice: " + token.warn, line, start); } else { var attr = null; switch (token.token) { case 'clef': case 'cl': addNextTokenToStaffInfo('clef'); // TODO-PER: check for a legal clef; do octavizing var oct = 0;// for (var ii = 0; ii < staffInfo.clef.length; ii++) {// if (staffInfo.clef[ii] === ',') oct -= 7;// else if (staffInfo.clef[ii] === "'") oct += 7;// } if (staffInfo.clef !== undefined) { staffInfo.clef = staffInfo.clef.replace(/[',]/g, ""); if (staffInfo.clef.indexOf('+16') != -1) { oct += 14; staffInfo.clef = staffInfo.clef.replace('+16', ''); } staffInfo.middle = calcMiddle(staffInfo.clef, oct); } break; case 'treble': case 'bass': case 'tenor': case 'alto': case 'none': case 'treble\'': case 'bass\'': case 'tenor\'': case 'alto\'': case 'none\'': case 'treble\'\'': case 'bass\'\'': case 'tenor\'\'': case 'alto\'\'': case 'none\'\'': case 'treble,': case 'bass,': case 'tenor,': case 'alto,': case 'none,': case 'treble,,': case 'bass,,': case 'tenor,,': case 'alto,,': case 'none,,': // TODO-PER: handle the octave indicators on the clef by changing the middle property var oct2 = 0;// for (var iii = 0; iii < token.token.length; iii++) {// if (token.token[iii] === ',') oct2 -= 7;// else if (token.token[iii] === "'") oct2 += 7;// } staffInfo.clef = token.token.replace(/[',]/g, ""); staffInfo.middle = calcMiddle(staffInfo.clef, oct2); break; case 'staves': case 'stave': case 'stv': addNextTokenToStaffInfo('staves'); break; case 'brace': case 'brc': addNextTokenToStaffInfo('brace'); break; case 'bracket': case 'brk': addNextTokenToStaffInfo('bracket'); break; case 'name': case 'nm': addNextTokenToStaffInfo('name'); break; case 'subname': case 'sname': case 'snm': addNextTokenToStaffInfo('subname'); break; case 'merge': staffInfo.startStaff = false; break; case 'stems': attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for stems in voice: " + attr.warn, line, start); else if (attr.token === 'up' || attr.token === 'down') multilineVars.voices[id].stem = attr.token; else warn("Expected up or down for voice stem", line, start); start += attr.len; break; case 'up': case 'down': multilineVars.voices[id].stem = token.token; break; case 'middle': case 'm': addNextTokenToStaffInfo('middle'); staffInfo.middle = parseMiddle(staffInfo.middle); break; case 'gchords': case 'gch': multilineVars.voices[id].suppressChords = true; break; case 'space': case 'spc': addNextTokenToStaffInfo('spacing'); break; } } start += tokenizer.eatWhiteSpace(line, start); } // now we've filled up staffInfo, figure out what to do with this voice // TODO-PER: It is unclear from the standard and the examples what to do with brace, bracket, and staves, so they are ignored for now. if (staffInfo.startStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length, meter: multilineVars.origMeter }); if (!multilineVars.score_is_present) multilineVars.staves[multilineVars.staves.length-1].numVoices = 0; } if (multilineVars.voices[id].staffNum === undefined) { // store where to write this for quick access later. multilineVars.voices[id].staffNum = multilineVars.staves.length-1; var vi = 0; for(var v in multilineVars.voices) { if(multilineVars.voices.hasOwnProperty(v)) { if (multilineVars.voices[v].staffNum === multilineVars.voices[id].staffNum) vi++; } } multilineVars.voices[id].index = vi-1; } var s = multilineVars.staves[multilineVars.voices[id].staffNum]; if (!multilineVars.score_is_present) s.numVoices++; if (staffInfo.clef) s.clef = { type: staffInfo.clef, middle: staffInfo.middle }; if (staffInfo.spacing) s.spacing_below_offset = staffInfo.spacing; if (staffInfo.middle) s.middle = staffInfo.middle; if (staffInfo.name) {if (s.name) s.name.push(staffInfo.name); else s.name = [ staffInfo.name ];} if (staffInfo.subname) {if (s.subname) s.subname.push(staffInfo.subname); else s.subname = [ staffInfo.subname ];} this.setCurrentVoice(id); };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f5a9f7ef8d556b3359fab3994dac1ddd87440bb3/abc_parse_header.js/buggy/abc_parse_header.js
if (token.warn) { warn("Error parsing voice: " + token.warn, line, start); } else { var attr = null; switch (token.token) { case 'clef': case 'cl': addNextTokenToStaffInfo('clef'); var oct = 0;
if (token.warn) { warn("Error parsing voice: " + token.warn, line, start); } else { var attr = null; switch (token.token) { case 'clef': case 'cl': addNextTokenToStaffInfo('clef'); var oct = 0;
this.parseVoice = function(line, i, e) { //First truncate the string to the first non-space character after V: through either the //end of the line or a % character. Then remove trailing spaces, too. var ret = tokenizer.getMeat(line, i, e); var start = ret.start; var end = ret.end; //The first thing on the line is the ID. It can be any non-space string and terminates at the //first space. var id = tokenizer.getToken(line, start, end); if (id.length === 0) { warn("Expected a voice id", line, start); return; } var isNew = false; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = {}; isNew = true; if (multilineVars.score_is_present) warn("Can't have an unknown V: id when the %score directive is present", line, i); } start += id.length; start += tokenizer.eatWhiteSpace(line, start); var staffInfo = {startStaff: isNew}; var addNextTokenToStaffInfo = function(name) { var attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for " + name + " in voice: " + attr.warn, line, start); else if (attr.token.length === 0 && line[start] !== '"') warn("Expected value for " + name + " in voice", line, start); else staffInfo[name] = attr.token; start += attr.len; }; //Then the following items can occur in any order: while (start < end) { var token = tokenizer.getVoiceToken(line, start, end); start += token.len; if (token.warn) { warn("Error parsing voice: " + token.warn, line, start); } else { var attr = null; switch (token.token) { case 'clef': case 'cl': addNextTokenToStaffInfo('clef'); // TODO-PER: check for a legal clef; do octavizing var oct = 0;// for (var ii = 0; ii < staffInfo.clef.length; ii++) {// if (staffInfo.clef[ii] === ',') oct -= 7;// else if (staffInfo.clef[ii] === "'") oct += 7;// } if (staffInfo.clef !== undefined) { staffInfo.clef = staffInfo.clef.replace(/[',]/g, ""); if (staffInfo.clef.indexOf('+16') != -1) { oct += 14; staffInfo.clef = staffInfo.clef.replace('+16', ''); } staffInfo.middle = calcMiddle(staffInfo.clef, oct); } break; case 'treble': case 'bass': case 'tenor': case 'alto': case 'none': case 'treble\'': case 'bass\'': case 'tenor\'': case 'alto\'': case 'none\'': case 'treble\'\'': case 'bass\'\'': case 'tenor\'\'': case 'alto\'\'': case 'none\'\'': case 'treble,': case 'bass,': case 'tenor,': case 'alto,': case 'none,': case 'treble,,': case 'bass,,': case 'tenor,,': case 'alto,,': case 'none,,': // TODO-PER: handle the octave indicators on the clef by changing the middle property var oct2 = 0;// for (var iii = 0; iii < token.token.length; iii++) {// if (token.token[iii] === ',') oct2 -= 7;// else if (token.token[iii] === "'") oct2 += 7;// } staffInfo.clef = token.token.replace(/[',]/g, ""); staffInfo.middle = calcMiddle(staffInfo.clef, oct2); break; case 'staves': case 'stave': case 'stv': addNextTokenToStaffInfo('staves'); break; case 'brace': case 'brc': addNextTokenToStaffInfo('brace'); break; case 'bracket': case 'brk': addNextTokenToStaffInfo('bracket'); break; case 'name': case 'nm': addNextTokenToStaffInfo('name'); break; case 'subname': case 'sname': case 'snm': addNextTokenToStaffInfo('subname'); break; case 'merge': staffInfo.startStaff = false; break; case 'stems': attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for stems in voice: " + attr.warn, line, start); else if (attr.token === 'up' || attr.token === 'down') multilineVars.voices[id].stem = attr.token; else warn("Expected up or down for voice stem", line, start); start += attr.len; break; case 'up': case 'down': multilineVars.voices[id].stem = token.token; break; case 'middle': case 'm': addNextTokenToStaffInfo('middle'); staffInfo.middle = parseMiddle(staffInfo.middle); break; case 'gchords': case 'gch': multilineVars.voices[id].suppressChords = true; break; case 'space': case 'spc': addNextTokenToStaffInfo('spacing'); break; } } start += tokenizer.eatWhiteSpace(line, start); } // now we've filled up staffInfo, figure out what to do with this voice // TODO-PER: It is unclear from the standard and the examples what to do with brace, bracket, and staves, so they are ignored for now. if (staffInfo.startStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length, meter: multilineVars.origMeter }); if (!multilineVars.score_is_present) multilineVars.staves[multilineVars.staves.length-1].numVoices = 0; } if (multilineVars.voices[id].staffNum === undefined) { // store where to write this for quick access later. multilineVars.voices[id].staffNum = multilineVars.staves.length-1; var vi = 0; for(var v in multilineVars.voices) { if(multilineVars.voices.hasOwnProperty(v)) { if (multilineVars.voices[v].staffNum === multilineVars.voices[id].staffNum) vi++; } } multilineVars.voices[id].index = vi-1; } var s = multilineVars.staves[multilineVars.voices[id].staffNum]; if (!multilineVars.score_is_present) s.numVoices++; if (staffInfo.clef) s.clef = { type: staffInfo.clef, middle: staffInfo.middle }; if (staffInfo.spacing) s.spacing_below_offset = staffInfo.spacing; if (staffInfo.middle) s.middle = staffInfo.middle; if (staffInfo.name) {if (s.name) s.name.push(staffInfo.name); else s.name = [ staffInfo.name ];} if (staffInfo.subname) {if (s.subname) s.subname.push(staffInfo.subname); else s.subname = [ staffInfo.subname ];} this.setCurrentVoice(id); };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f5a9f7ef8d556b3359fab3994dac1ddd87440bb3/abc_parse_header.js/buggy/abc_parse_header.js
if (staffInfo.clef !== undefined) { staffInfo.clef = staffInfo.clef.replace(/[',]/g, ""); if (staffInfo.clef.indexOf('+16') != -1) { oct += 14; staffInfo.clef = staffInfo.clef.replace('+16', ''); } staffInfo.middle = calcMiddle(staffInfo.clef, oct);
if (staffInfo.clef !== undefined) { staffInfo.clef = staffInfo.clef.replace(/[',]/g, ""); if (staffInfo.clef.indexOf('+16') !== -1) { oct += 14; staffInfo.clef = staffInfo.clef.replace('+16', '');
this.parseVoice = function(line, i, e) { //First truncate the string to the first non-space character after V: through either the //end of the line or a % character. Then remove trailing spaces, too. var ret = tokenizer.getMeat(line, i, e); var start = ret.start; var end = ret.end; //The first thing on the line is the ID. It can be any non-space string and terminates at the //first space. var id = tokenizer.getToken(line, start, end); if (id.length === 0) { warn("Expected a voice id", line, start); return; } var isNew = false; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = {}; isNew = true; if (multilineVars.score_is_present) warn("Can't have an unknown V: id when the %score directive is present", line, i); } start += id.length; start += tokenizer.eatWhiteSpace(line, start); var staffInfo = {startStaff: isNew}; var addNextTokenToStaffInfo = function(name) { var attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for " + name + " in voice: " + attr.warn, line, start); else if (attr.token.length === 0 && line[start] !== '"') warn("Expected value for " + name + " in voice", line, start); else staffInfo[name] = attr.token; start += attr.len; }; //Then the following items can occur in any order: while (start < end) { var token = tokenizer.getVoiceToken(line, start, end); start += token.len; if (token.warn) { warn("Error parsing voice: " + token.warn, line, start); } else { var attr = null; switch (token.token) { case 'clef': case 'cl': addNextTokenToStaffInfo('clef'); // TODO-PER: check for a legal clef; do octavizing var oct = 0;// for (var ii = 0; ii < staffInfo.clef.length; ii++) {// if (staffInfo.clef[ii] === ',') oct -= 7;// else if (staffInfo.clef[ii] === "'") oct += 7;// } if (staffInfo.clef !== undefined) { staffInfo.clef = staffInfo.clef.replace(/[',]/g, ""); if (staffInfo.clef.indexOf('+16') != -1) { oct += 14; staffInfo.clef = staffInfo.clef.replace('+16', ''); } staffInfo.middle = calcMiddle(staffInfo.clef, oct); } break; case 'treble': case 'bass': case 'tenor': case 'alto': case 'none': case 'treble\'': case 'bass\'': case 'tenor\'': case 'alto\'': case 'none\'': case 'treble\'\'': case 'bass\'\'': case 'tenor\'\'': case 'alto\'\'': case 'none\'\'': case 'treble,': case 'bass,': case 'tenor,': case 'alto,': case 'none,': case 'treble,,': case 'bass,,': case 'tenor,,': case 'alto,,': case 'none,,': // TODO-PER: handle the octave indicators on the clef by changing the middle property var oct2 = 0;// for (var iii = 0; iii < token.token.length; iii++) {// if (token.token[iii] === ',') oct2 -= 7;// else if (token.token[iii] === "'") oct2 += 7;// } staffInfo.clef = token.token.replace(/[',]/g, ""); staffInfo.middle = calcMiddle(staffInfo.clef, oct2); break; case 'staves': case 'stave': case 'stv': addNextTokenToStaffInfo('staves'); break; case 'brace': case 'brc': addNextTokenToStaffInfo('brace'); break; case 'bracket': case 'brk': addNextTokenToStaffInfo('bracket'); break; case 'name': case 'nm': addNextTokenToStaffInfo('name'); break; case 'subname': case 'sname': case 'snm': addNextTokenToStaffInfo('subname'); break; case 'merge': staffInfo.startStaff = false; break; case 'stems': attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for stems in voice: " + attr.warn, line, start); else if (attr.token === 'up' || attr.token === 'down') multilineVars.voices[id].stem = attr.token; else warn("Expected up or down for voice stem", line, start); start += attr.len; break; case 'up': case 'down': multilineVars.voices[id].stem = token.token; break; case 'middle': case 'm': addNextTokenToStaffInfo('middle'); staffInfo.middle = parseMiddle(staffInfo.middle); break; case 'gchords': case 'gch': multilineVars.voices[id].suppressChords = true; break; case 'space': case 'spc': addNextTokenToStaffInfo('spacing'); break; } } start += tokenizer.eatWhiteSpace(line, start); } // now we've filled up staffInfo, figure out what to do with this voice // TODO-PER: It is unclear from the standard and the examples what to do with brace, bracket, and staves, so they are ignored for now. if (staffInfo.startStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length, meter: multilineVars.origMeter }); if (!multilineVars.score_is_present) multilineVars.staves[multilineVars.staves.length-1].numVoices = 0; } if (multilineVars.voices[id].staffNum === undefined) { // store where to write this for quick access later. multilineVars.voices[id].staffNum = multilineVars.staves.length-1; var vi = 0; for(var v in multilineVars.voices) { if(multilineVars.voices.hasOwnProperty(v)) { if (multilineVars.voices[v].staffNum === multilineVars.voices[id].staffNum) vi++; } } multilineVars.voices[id].index = vi-1; } var s = multilineVars.staves[multilineVars.voices[id].staffNum]; if (!multilineVars.score_is_present) s.numVoices++; if (staffInfo.clef) s.clef = { type: staffInfo.clef, middle: staffInfo.middle }; if (staffInfo.spacing) s.spacing_below_offset = staffInfo.spacing; if (staffInfo.middle) s.middle = staffInfo.middle; if (staffInfo.name) {if (s.name) s.name.push(staffInfo.name); else s.name = [ staffInfo.name ];} if (staffInfo.subname) {if (s.subname) s.subname.push(staffInfo.subname); else s.subname = [ staffInfo.subname ];} this.setCurrentVoice(id); };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f5a9f7ef8d556b3359fab3994dac1ddd87440bb3/abc_parse_header.js/buggy/abc_parse_header.js
break; case 'treble': case 'bass': case 'tenor': case 'alto': case 'none': case 'treble\'': case 'bass\'': case 'tenor\'': case 'alto\'': case 'none\'': case 'treble\'\'': case 'bass\'\'': case 'tenor\'\'': case 'alto\'\'': case 'none\'\'': case 'treble,': case 'bass,': case 'tenor,': case 'alto,': case 'none,': case 'treble,,': case 'bass,,': case 'tenor,,': case 'alto,,': case 'none,,': var oct2 = 0;
staffInfo.middle = calcMiddle(staffInfo.clef, oct); } break; case 'treble': case 'bass': case 'tenor': case 'alto': case 'none': case 'treble\'': case 'bass\'': case 'tenor\'': case 'alto\'': case 'none\'': case 'treble\'\'': case 'bass\'\'': case 'tenor\'\'': case 'alto\'\'': case 'none\'\'': case 'treble,': case 'bass,': case 'tenor,': case 'alto,': case 'none,': case 'treble,,': case 'bass,,': case 'tenor,,': case 'alto,,': case 'none,,': var oct2 = 0;
this.parseVoice = function(line, i, e) { //First truncate the string to the first non-space character after V: through either the //end of the line or a % character. Then remove trailing spaces, too. var ret = tokenizer.getMeat(line, i, e); var start = ret.start; var end = ret.end; //The first thing on the line is the ID. It can be any non-space string and terminates at the //first space. var id = tokenizer.getToken(line, start, end); if (id.length === 0) { warn("Expected a voice id", line, start); return; } var isNew = false; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = {}; isNew = true; if (multilineVars.score_is_present) warn("Can't have an unknown V: id when the %score directive is present", line, i); } start += id.length; start += tokenizer.eatWhiteSpace(line, start); var staffInfo = {startStaff: isNew}; var addNextTokenToStaffInfo = function(name) { var attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for " + name + " in voice: " + attr.warn, line, start); else if (attr.token.length === 0 && line[start] !== '"') warn("Expected value for " + name + " in voice", line, start); else staffInfo[name] = attr.token; start += attr.len; }; //Then the following items can occur in any order: while (start < end) { var token = tokenizer.getVoiceToken(line, start, end); start += token.len; if (token.warn) { warn("Error parsing voice: " + token.warn, line, start); } else { var attr = null; switch (token.token) { case 'clef': case 'cl': addNextTokenToStaffInfo('clef'); // TODO-PER: check for a legal clef; do octavizing var oct = 0;// for (var ii = 0; ii < staffInfo.clef.length; ii++) {// if (staffInfo.clef[ii] === ',') oct -= 7;// else if (staffInfo.clef[ii] === "'") oct += 7;// } if (staffInfo.clef !== undefined) { staffInfo.clef = staffInfo.clef.replace(/[',]/g, ""); if (staffInfo.clef.indexOf('+16') != -1) { oct += 14; staffInfo.clef = staffInfo.clef.replace('+16', ''); } staffInfo.middle = calcMiddle(staffInfo.clef, oct); } break; case 'treble': case 'bass': case 'tenor': case 'alto': case 'none': case 'treble\'': case 'bass\'': case 'tenor\'': case 'alto\'': case 'none\'': case 'treble\'\'': case 'bass\'\'': case 'tenor\'\'': case 'alto\'\'': case 'none\'\'': case 'treble,': case 'bass,': case 'tenor,': case 'alto,': case 'none,': case 'treble,,': case 'bass,,': case 'tenor,,': case 'alto,,': case 'none,,': // TODO-PER: handle the octave indicators on the clef by changing the middle property var oct2 = 0;// for (var iii = 0; iii < token.token.length; iii++) {// if (token.token[iii] === ',') oct2 -= 7;// else if (token.token[iii] === "'") oct2 += 7;// } staffInfo.clef = token.token.replace(/[',]/g, ""); staffInfo.middle = calcMiddle(staffInfo.clef, oct2); break; case 'staves': case 'stave': case 'stv': addNextTokenToStaffInfo('staves'); break; case 'brace': case 'brc': addNextTokenToStaffInfo('brace'); break; case 'bracket': case 'brk': addNextTokenToStaffInfo('bracket'); break; case 'name': case 'nm': addNextTokenToStaffInfo('name'); break; case 'subname': case 'sname': case 'snm': addNextTokenToStaffInfo('subname'); break; case 'merge': staffInfo.startStaff = false; break; case 'stems': attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for stems in voice: " + attr.warn, line, start); else if (attr.token === 'up' || attr.token === 'down') multilineVars.voices[id].stem = attr.token; else warn("Expected up or down for voice stem", line, start); start += attr.len; break; case 'up': case 'down': multilineVars.voices[id].stem = token.token; break; case 'middle': case 'm': addNextTokenToStaffInfo('middle'); staffInfo.middle = parseMiddle(staffInfo.middle); break; case 'gchords': case 'gch': multilineVars.voices[id].suppressChords = true; break; case 'space': case 'spc': addNextTokenToStaffInfo('spacing'); break; } } start += tokenizer.eatWhiteSpace(line, start); } // now we've filled up staffInfo, figure out what to do with this voice // TODO-PER: It is unclear from the standard and the examples what to do with brace, bracket, and staves, so they are ignored for now. if (staffInfo.startStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length, meter: multilineVars.origMeter }); if (!multilineVars.score_is_present) multilineVars.staves[multilineVars.staves.length-1].numVoices = 0; } if (multilineVars.voices[id].staffNum === undefined) { // store where to write this for quick access later. multilineVars.voices[id].staffNum = multilineVars.staves.length-1; var vi = 0; for(var v in multilineVars.voices) { if(multilineVars.voices.hasOwnProperty(v)) { if (multilineVars.voices[v].staffNum === multilineVars.voices[id].staffNum) vi++; } } multilineVars.voices[id].index = vi-1; } var s = multilineVars.staves[multilineVars.voices[id].staffNum]; if (!multilineVars.score_is_present) s.numVoices++; if (staffInfo.clef) s.clef = { type: staffInfo.clef, middle: staffInfo.middle }; if (staffInfo.spacing) s.spacing_below_offset = staffInfo.spacing; if (staffInfo.middle) s.middle = staffInfo.middle; if (staffInfo.name) {if (s.name) s.name.push(staffInfo.name); else s.name = [ staffInfo.name ];} if (staffInfo.subname) {if (s.subname) s.subname.push(staffInfo.subname); else s.subname = [ staffInfo.subname ];} this.setCurrentVoice(id); };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f5a9f7ef8d556b3359fab3994dac1ddd87440bb3/abc_parse_header.js/buggy/abc_parse_header.js
staffInfo.clef = token.token.replace(/[',]/g, ""); staffInfo.middle = calcMiddle(staffInfo.clef, oct2); break; case 'staves': case 'stave': case 'stv': addNextTokenToStaffInfo('staves'); break; case 'brace': case 'brc': addNextTokenToStaffInfo('brace'); break; case 'bracket': case 'brk': addNextTokenToStaffInfo('bracket'); break; case 'name': case 'nm': addNextTokenToStaffInfo('name'); break; case 'subname': case 'sname': case 'snm': addNextTokenToStaffInfo('subname'); break; case 'merge': staffInfo.startStaff = false; break; case 'stems': attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for stems in voice: " + attr.warn, line, start); else if (attr.token === 'up' || attr.token === 'down') multilineVars.voices[id].stem = attr.token; else warn("Expected up or down for voice stem", line, start); start += attr.len; break; case 'up': case 'down': multilineVars.voices[id].stem = token.token; break; case 'middle': case 'm': addNextTokenToStaffInfo('middle'); staffInfo.middle = parseMiddle(staffInfo.middle); break; case 'gchords': case 'gch': multilineVars.voices[id].suppressChords = true; break; case 'space': case 'spc': addNextTokenToStaffInfo('spacing'); break; }
staffInfo.clef = token.token.replace(/[',]/g, ""); staffInfo.middle = calcMiddle(staffInfo.clef, oct2); break; case 'staves': case 'stave': case 'stv': addNextTokenToStaffInfo('staves'); break; case 'brace': case 'brc': addNextTokenToStaffInfo('brace'); break; case 'bracket': case 'brk': addNextTokenToStaffInfo('bracket'); break; case 'name': case 'nm': addNextTokenToStaffInfo('name'); break; case 'subname': case 'sname': case 'snm': addNextTokenToStaffInfo('subname'); break; case 'merge': staffInfo.startStaff = false; break; case 'stems': attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for stems in voice: " + attr.warn, line, start); else if (attr.token === 'up' || attr.token === 'down') multilineVars.voices[id].stem = attr.token; else warn("Expected up or down for voice stem", line, start); start += attr.len; break; case 'up': case 'down': multilineVars.voices[id].stem = token.token; break; case 'middle': case 'm': addNextTokenToStaffInfo('middle'); staffInfo.middle = parseMiddle(staffInfo.middle); break; case 'gchords': case 'gch': multilineVars.voices[id].suppressChords = true; break; case 'space': case 'spc': addNextTokenToStaffInfo('spacing'); break;
this.parseVoice = function(line, i, e) { //First truncate the string to the first non-space character after V: through either the //end of the line or a % character. Then remove trailing spaces, too. var ret = tokenizer.getMeat(line, i, e); var start = ret.start; var end = ret.end; //The first thing on the line is the ID. It can be any non-space string and terminates at the //first space. var id = tokenizer.getToken(line, start, end); if (id.length === 0) { warn("Expected a voice id", line, start); return; } var isNew = false; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = {}; isNew = true; if (multilineVars.score_is_present) warn("Can't have an unknown V: id when the %score directive is present", line, i); } start += id.length; start += tokenizer.eatWhiteSpace(line, start); var staffInfo = {startStaff: isNew}; var addNextTokenToStaffInfo = function(name) { var attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for " + name + " in voice: " + attr.warn, line, start); else if (attr.token.length === 0 && line[start] !== '"') warn("Expected value for " + name + " in voice", line, start); else staffInfo[name] = attr.token; start += attr.len; }; //Then the following items can occur in any order: while (start < end) { var token = tokenizer.getVoiceToken(line, start, end); start += token.len; if (token.warn) { warn("Error parsing voice: " + token.warn, line, start); } else { var attr = null; switch (token.token) { case 'clef': case 'cl': addNextTokenToStaffInfo('clef'); // TODO-PER: check for a legal clef; do octavizing var oct = 0;// for (var ii = 0; ii < staffInfo.clef.length; ii++) {// if (staffInfo.clef[ii] === ',') oct -= 7;// else if (staffInfo.clef[ii] === "'") oct += 7;// } if (staffInfo.clef !== undefined) { staffInfo.clef = staffInfo.clef.replace(/[',]/g, ""); if (staffInfo.clef.indexOf('+16') != -1) { oct += 14; staffInfo.clef = staffInfo.clef.replace('+16', ''); } staffInfo.middle = calcMiddle(staffInfo.clef, oct); } break; case 'treble': case 'bass': case 'tenor': case 'alto': case 'none': case 'treble\'': case 'bass\'': case 'tenor\'': case 'alto\'': case 'none\'': case 'treble\'\'': case 'bass\'\'': case 'tenor\'\'': case 'alto\'\'': case 'none\'\'': case 'treble,': case 'bass,': case 'tenor,': case 'alto,': case 'none,': case 'treble,,': case 'bass,,': case 'tenor,,': case 'alto,,': case 'none,,': // TODO-PER: handle the octave indicators on the clef by changing the middle property var oct2 = 0;// for (var iii = 0; iii < token.token.length; iii++) {// if (token.token[iii] === ',') oct2 -= 7;// else if (token.token[iii] === "'") oct2 += 7;// } staffInfo.clef = token.token.replace(/[',]/g, ""); staffInfo.middle = calcMiddle(staffInfo.clef, oct2); break; case 'staves': case 'stave': case 'stv': addNextTokenToStaffInfo('staves'); break; case 'brace': case 'brc': addNextTokenToStaffInfo('brace'); break; case 'bracket': case 'brk': addNextTokenToStaffInfo('bracket'); break; case 'name': case 'nm': addNextTokenToStaffInfo('name'); break; case 'subname': case 'sname': case 'snm': addNextTokenToStaffInfo('subname'); break; case 'merge': staffInfo.startStaff = false; break; case 'stems': attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for stems in voice: " + attr.warn, line, start); else if (attr.token === 'up' || attr.token === 'down') multilineVars.voices[id].stem = attr.token; else warn("Expected up or down for voice stem", line, start); start += attr.len; break; case 'up': case 'down': multilineVars.voices[id].stem = token.token; break; case 'middle': case 'm': addNextTokenToStaffInfo('middle'); staffInfo.middle = parseMiddle(staffInfo.middle); break; case 'gchords': case 'gch': multilineVars.voices[id].suppressChords = true; break; case 'space': case 'spc': addNextTokenToStaffInfo('spacing'); break; } } start += tokenizer.eatWhiteSpace(line, start); } // now we've filled up staffInfo, figure out what to do with this voice // TODO-PER: It is unclear from the standard and the examples what to do with brace, bracket, and staves, so they are ignored for now. if (staffInfo.startStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length, meter: multilineVars.origMeter }); if (!multilineVars.score_is_present) multilineVars.staves[multilineVars.staves.length-1].numVoices = 0; } if (multilineVars.voices[id].staffNum === undefined) { // store where to write this for quick access later. multilineVars.voices[id].staffNum = multilineVars.staves.length-1; var vi = 0; for(var v in multilineVars.voices) { if(multilineVars.voices.hasOwnProperty(v)) { if (multilineVars.voices[v].staffNum === multilineVars.voices[id].staffNum) vi++; } } multilineVars.voices[id].index = vi-1; } var s = multilineVars.staves[multilineVars.voices[id].staffNum]; if (!multilineVars.score_is_present) s.numVoices++; if (staffInfo.clef) s.clef = { type: staffInfo.clef, middle: staffInfo.middle }; if (staffInfo.spacing) s.spacing_below_offset = staffInfo.spacing; if (staffInfo.middle) s.middle = staffInfo.middle; if (staffInfo.name) {if (s.name) s.name.push(staffInfo.name); else s.name = [ staffInfo.name ];} if (staffInfo.subname) {if (s.subname) s.subname.push(staffInfo.subname); else s.subname = [ staffInfo.subname ];} this.setCurrentVoice(id); };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f5a9f7ef8d556b3359fab3994dac1ddd87440bb3/abc_parse_header.js/buggy/abc_parse_header.js
start += tokenizer.eatWhiteSpace(line, start);
this.parseVoice = function(line, i, e) { //First truncate the string to the first non-space character after V: through either the //end of the line or a % character. Then remove trailing spaces, too. var ret = tokenizer.getMeat(line, i, e); var start = ret.start; var end = ret.end; //The first thing on the line is the ID. It can be any non-space string and terminates at the //first space. var id = tokenizer.getToken(line, start, end); if (id.length === 0) { warn("Expected a voice id", line, start); return; } var isNew = false; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = {}; isNew = true; if (multilineVars.score_is_present) warn("Can't have an unknown V: id when the %score directive is present", line, i); } start += id.length; start += tokenizer.eatWhiteSpace(line, start); var staffInfo = {startStaff: isNew}; var addNextTokenToStaffInfo = function(name) { var attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for " + name + " in voice: " + attr.warn, line, start); else if (attr.token.length === 0 && line[start] !== '"') warn("Expected value for " + name + " in voice", line, start); else staffInfo[name] = attr.token; start += attr.len; }; //Then the following items can occur in any order: while (start < end) { var token = tokenizer.getVoiceToken(line, start, end); start += token.len; if (token.warn) { warn("Error parsing voice: " + token.warn, line, start); } else { var attr = null; switch (token.token) { case 'clef': case 'cl': addNextTokenToStaffInfo('clef'); // TODO-PER: check for a legal clef; do octavizing var oct = 0;// for (var ii = 0; ii < staffInfo.clef.length; ii++) {// if (staffInfo.clef[ii] === ',') oct -= 7;// else if (staffInfo.clef[ii] === "'") oct += 7;// } if (staffInfo.clef !== undefined) { staffInfo.clef = staffInfo.clef.replace(/[',]/g, ""); if (staffInfo.clef.indexOf('+16') != -1) { oct += 14; staffInfo.clef = staffInfo.clef.replace('+16', ''); } staffInfo.middle = calcMiddle(staffInfo.clef, oct); } break; case 'treble': case 'bass': case 'tenor': case 'alto': case 'none': case 'treble\'': case 'bass\'': case 'tenor\'': case 'alto\'': case 'none\'': case 'treble\'\'': case 'bass\'\'': case 'tenor\'\'': case 'alto\'\'': case 'none\'\'': case 'treble,': case 'bass,': case 'tenor,': case 'alto,': case 'none,': case 'treble,,': case 'bass,,': case 'tenor,,': case 'alto,,': case 'none,,': // TODO-PER: handle the octave indicators on the clef by changing the middle property var oct2 = 0;// for (var iii = 0; iii < token.token.length; iii++) {// if (token.token[iii] === ',') oct2 -= 7;// else if (token.token[iii] === "'") oct2 += 7;// } staffInfo.clef = token.token.replace(/[',]/g, ""); staffInfo.middle = calcMiddle(staffInfo.clef, oct2); break; case 'staves': case 'stave': case 'stv': addNextTokenToStaffInfo('staves'); break; case 'brace': case 'brc': addNextTokenToStaffInfo('brace'); break; case 'bracket': case 'brk': addNextTokenToStaffInfo('bracket'); break; case 'name': case 'nm': addNextTokenToStaffInfo('name'); break; case 'subname': case 'sname': case 'snm': addNextTokenToStaffInfo('subname'); break; case 'merge': staffInfo.startStaff = false; break; case 'stems': attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for stems in voice: " + attr.warn, line, start); else if (attr.token === 'up' || attr.token === 'down') multilineVars.voices[id].stem = attr.token; else warn("Expected up or down for voice stem", line, start); start += attr.len; break; case 'up': case 'down': multilineVars.voices[id].stem = token.token; break; case 'middle': case 'm': addNextTokenToStaffInfo('middle'); staffInfo.middle = parseMiddle(staffInfo.middle); break; case 'gchords': case 'gch': multilineVars.voices[id].suppressChords = true; break; case 'space': case 'spc': addNextTokenToStaffInfo('spacing'); break; } } start += tokenizer.eatWhiteSpace(line, start); } // now we've filled up staffInfo, figure out what to do with this voice // TODO-PER: It is unclear from the standard and the examples what to do with brace, bracket, and staves, so they are ignored for now. if (staffInfo.startStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length, meter: multilineVars.origMeter }); if (!multilineVars.score_is_present) multilineVars.staves[multilineVars.staves.length-1].numVoices = 0; } if (multilineVars.voices[id].staffNum === undefined) { // store where to write this for quick access later. multilineVars.voices[id].staffNum = multilineVars.staves.length-1; var vi = 0; for(var v in multilineVars.voices) { if(multilineVars.voices.hasOwnProperty(v)) { if (multilineVars.voices[v].staffNum === multilineVars.voices[id].staffNum) vi++; } } multilineVars.voices[id].index = vi-1; } var s = multilineVars.staves[multilineVars.voices[id].staffNum]; if (!multilineVars.score_is_present) s.numVoices++; if (staffInfo.clef) s.clef = { type: staffInfo.clef, middle: staffInfo.middle }; if (staffInfo.spacing) s.spacing_below_offset = staffInfo.spacing; if (staffInfo.middle) s.middle = staffInfo.middle; if (staffInfo.name) {if (s.name) s.name.push(staffInfo.name); else s.name = [ staffInfo.name ];} if (staffInfo.subname) {if (s.subname) s.subname.push(staffInfo.subname); else s.subname = [ staffInfo.subname ];} this.setCurrentVoice(id); };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f5a9f7ef8d556b3359fab3994dac1ddd87440bb3/abc_parse_header.js/buggy/abc_parse_header.js
if (staffInfo.startStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length, meter: multilineVars.origMeter }); if (!multilineVars.score_is_present) multilineVars.staves[multilineVars.staves.length-1].numVoices = 0;
if (staffInfo.startStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length, meter: multilineVars.origMeter }); if (!multilineVars.score_is_present) multilineVars.staves[multilineVars.staves.length-1].numVoices = 0; } if (multilineVars.voices[id].staffNum === undefined) { multilineVars.voices[id].staffNum = multilineVars.staves.length-1; var vi = 0; for(var v in multilineVars.voices) { if(multilineVars.voices.hasOwnProperty(v)) { if (multilineVars.voices[v].staffNum === multilineVars.voices[id].staffNum) vi++; }
this.parseVoice = function(line, i, e) { //First truncate the string to the first non-space character after V: through either the //end of the line or a % character. Then remove trailing spaces, too. var ret = tokenizer.getMeat(line, i, e); var start = ret.start; var end = ret.end; //The first thing on the line is the ID. It can be any non-space string and terminates at the //first space. var id = tokenizer.getToken(line, start, end); if (id.length === 0) { warn("Expected a voice id", line, start); return; } var isNew = false; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = {}; isNew = true; if (multilineVars.score_is_present) warn("Can't have an unknown V: id when the %score directive is present", line, i); } start += id.length; start += tokenizer.eatWhiteSpace(line, start); var staffInfo = {startStaff: isNew}; var addNextTokenToStaffInfo = function(name) { var attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for " + name + " in voice: " + attr.warn, line, start); else if (attr.token.length === 0 && line[start] !== '"') warn("Expected value for " + name + " in voice", line, start); else staffInfo[name] = attr.token; start += attr.len; }; //Then the following items can occur in any order: while (start < end) { var token = tokenizer.getVoiceToken(line, start, end); start += token.len; if (token.warn) { warn("Error parsing voice: " + token.warn, line, start); } else { var attr = null; switch (token.token) { case 'clef': case 'cl': addNextTokenToStaffInfo('clef'); // TODO-PER: check for a legal clef; do octavizing var oct = 0;// for (var ii = 0; ii < staffInfo.clef.length; ii++) {// if (staffInfo.clef[ii] === ',') oct -= 7;// else if (staffInfo.clef[ii] === "'") oct += 7;// } if (staffInfo.clef !== undefined) { staffInfo.clef = staffInfo.clef.replace(/[',]/g, ""); if (staffInfo.clef.indexOf('+16') != -1) { oct += 14; staffInfo.clef = staffInfo.clef.replace('+16', ''); } staffInfo.middle = calcMiddle(staffInfo.clef, oct); } break; case 'treble': case 'bass': case 'tenor': case 'alto': case 'none': case 'treble\'': case 'bass\'': case 'tenor\'': case 'alto\'': case 'none\'': case 'treble\'\'': case 'bass\'\'': case 'tenor\'\'': case 'alto\'\'': case 'none\'\'': case 'treble,': case 'bass,': case 'tenor,': case 'alto,': case 'none,': case 'treble,,': case 'bass,,': case 'tenor,,': case 'alto,,': case 'none,,': // TODO-PER: handle the octave indicators on the clef by changing the middle property var oct2 = 0;// for (var iii = 0; iii < token.token.length; iii++) {// if (token.token[iii] === ',') oct2 -= 7;// else if (token.token[iii] === "'") oct2 += 7;// } staffInfo.clef = token.token.replace(/[',]/g, ""); staffInfo.middle = calcMiddle(staffInfo.clef, oct2); break; case 'staves': case 'stave': case 'stv': addNextTokenToStaffInfo('staves'); break; case 'brace': case 'brc': addNextTokenToStaffInfo('brace'); break; case 'bracket': case 'brk': addNextTokenToStaffInfo('bracket'); break; case 'name': case 'nm': addNextTokenToStaffInfo('name'); break; case 'subname': case 'sname': case 'snm': addNextTokenToStaffInfo('subname'); break; case 'merge': staffInfo.startStaff = false; break; case 'stems': attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for stems in voice: " + attr.warn, line, start); else if (attr.token === 'up' || attr.token === 'down') multilineVars.voices[id].stem = attr.token; else warn("Expected up or down for voice stem", line, start); start += attr.len; break; case 'up': case 'down': multilineVars.voices[id].stem = token.token; break; case 'middle': case 'm': addNextTokenToStaffInfo('middle'); staffInfo.middle = parseMiddle(staffInfo.middle); break; case 'gchords': case 'gch': multilineVars.voices[id].suppressChords = true; break; case 'space': case 'spc': addNextTokenToStaffInfo('spacing'); break; } } start += tokenizer.eatWhiteSpace(line, start); } // now we've filled up staffInfo, figure out what to do with this voice // TODO-PER: It is unclear from the standard and the examples what to do with brace, bracket, and staves, so they are ignored for now. if (staffInfo.startStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length, meter: multilineVars.origMeter }); if (!multilineVars.score_is_present) multilineVars.staves[multilineVars.staves.length-1].numVoices = 0; } if (multilineVars.voices[id].staffNum === undefined) { // store where to write this for quick access later. multilineVars.voices[id].staffNum = multilineVars.staves.length-1; var vi = 0; for(var v in multilineVars.voices) { if(multilineVars.voices.hasOwnProperty(v)) { if (multilineVars.voices[v].staffNum === multilineVars.voices[id].staffNum) vi++; } } multilineVars.voices[id].index = vi-1; } var s = multilineVars.staves[multilineVars.voices[id].staffNum]; if (!multilineVars.score_is_present) s.numVoices++; if (staffInfo.clef) s.clef = { type: staffInfo.clef, middle: staffInfo.middle }; if (staffInfo.spacing) s.spacing_below_offset = staffInfo.spacing; if (staffInfo.middle) s.middle = staffInfo.middle; if (staffInfo.name) {if (s.name) s.name.push(staffInfo.name); else s.name = [ staffInfo.name ];} if (staffInfo.subname) {if (s.subname) s.subname.push(staffInfo.subname); else s.subname = [ staffInfo.subname ];} this.setCurrentVoice(id); };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f5a9f7ef8d556b3359fab3994dac1ddd87440bb3/abc_parse_header.js/buggy/abc_parse_header.js
if (multilineVars.voices[id].staffNum === undefined) { multilineVars.voices[id].staffNum = multilineVars.staves.length-1; var vi = 0; for(var v in multilineVars.voices) { if(multilineVars.voices.hasOwnProperty(v)) { if (multilineVars.voices[v].staffNum === multilineVars.voices[id].staffNum) vi++; } } multilineVars.voices[id].index = vi-1; } var s = multilineVars.staves[multilineVars.voices[id].staffNum]; if (!multilineVars.score_is_present) s.numVoices++; if (staffInfo.clef) s.clef = { type: staffInfo.clef, middle: staffInfo.middle }; if (staffInfo.spacing) s.spacing_below_offset = staffInfo.spacing; if (staffInfo.middle) s.middle = staffInfo.middle;
multilineVars.voices[id].index = vi-1; } var s = multilineVars.staves[multilineVars.voices[id].staffNum]; if (!multilineVars.score_is_present) s.numVoices++; if (staffInfo.clef) s.clef = { type: staffInfo.clef, middle: staffInfo.middle }; if (staffInfo.spacing) s.spacing_below_offset = staffInfo.spacing; if (staffInfo.middle) s.middle = staffInfo.middle;
this.parseVoice = function(line, i, e) { //First truncate the string to the first non-space character after V: through either the //end of the line or a % character. Then remove trailing spaces, too. var ret = tokenizer.getMeat(line, i, e); var start = ret.start; var end = ret.end; //The first thing on the line is the ID. It can be any non-space string and terminates at the //first space. var id = tokenizer.getToken(line, start, end); if (id.length === 0) { warn("Expected a voice id", line, start); return; } var isNew = false; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = {}; isNew = true; if (multilineVars.score_is_present) warn("Can't have an unknown V: id when the %score directive is present", line, i); } start += id.length; start += tokenizer.eatWhiteSpace(line, start); var staffInfo = {startStaff: isNew}; var addNextTokenToStaffInfo = function(name) { var attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for " + name + " in voice: " + attr.warn, line, start); else if (attr.token.length === 0 && line[start] !== '"') warn("Expected value for " + name + " in voice", line, start); else staffInfo[name] = attr.token; start += attr.len; }; //Then the following items can occur in any order: while (start < end) { var token = tokenizer.getVoiceToken(line, start, end); start += token.len; if (token.warn) { warn("Error parsing voice: " + token.warn, line, start); } else { var attr = null; switch (token.token) { case 'clef': case 'cl': addNextTokenToStaffInfo('clef'); // TODO-PER: check for a legal clef; do octavizing var oct = 0;// for (var ii = 0; ii < staffInfo.clef.length; ii++) {// if (staffInfo.clef[ii] === ',') oct -= 7;// else if (staffInfo.clef[ii] === "'") oct += 7;// } if (staffInfo.clef !== undefined) { staffInfo.clef = staffInfo.clef.replace(/[',]/g, ""); if (staffInfo.clef.indexOf('+16') != -1) { oct += 14; staffInfo.clef = staffInfo.clef.replace('+16', ''); } staffInfo.middle = calcMiddle(staffInfo.clef, oct); } break; case 'treble': case 'bass': case 'tenor': case 'alto': case 'none': case 'treble\'': case 'bass\'': case 'tenor\'': case 'alto\'': case 'none\'': case 'treble\'\'': case 'bass\'\'': case 'tenor\'\'': case 'alto\'\'': case 'none\'\'': case 'treble,': case 'bass,': case 'tenor,': case 'alto,': case 'none,': case 'treble,,': case 'bass,,': case 'tenor,,': case 'alto,,': case 'none,,': // TODO-PER: handle the octave indicators on the clef by changing the middle property var oct2 = 0;// for (var iii = 0; iii < token.token.length; iii++) {// if (token.token[iii] === ',') oct2 -= 7;// else if (token.token[iii] === "'") oct2 += 7;// } staffInfo.clef = token.token.replace(/[',]/g, ""); staffInfo.middle = calcMiddle(staffInfo.clef, oct2); break; case 'staves': case 'stave': case 'stv': addNextTokenToStaffInfo('staves'); break; case 'brace': case 'brc': addNextTokenToStaffInfo('brace'); break; case 'bracket': case 'brk': addNextTokenToStaffInfo('bracket'); break; case 'name': case 'nm': addNextTokenToStaffInfo('name'); break; case 'subname': case 'sname': case 'snm': addNextTokenToStaffInfo('subname'); break; case 'merge': staffInfo.startStaff = false; break; case 'stems': attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for stems in voice: " + attr.warn, line, start); else if (attr.token === 'up' || attr.token === 'down') multilineVars.voices[id].stem = attr.token; else warn("Expected up or down for voice stem", line, start); start += attr.len; break; case 'up': case 'down': multilineVars.voices[id].stem = token.token; break; case 'middle': case 'm': addNextTokenToStaffInfo('middle'); staffInfo.middle = parseMiddle(staffInfo.middle); break; case 'gchords': case 'gch': multilineVars.voices[id].suppressChords = true; break; case 'space': case 'spc': addNextTokenToStaffInfo('spacing'); break; } } start += tokenizer.eatWhiteSpace(line, start); } // now we've filled up staffInfo, figure out what to do with this voice // TODO-PER: It is unclear from the standard and the examples what to do with brace, bracket, and staves, so they are ignored for now. if (staffInfo.startStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length, meter: multilineVars.origMeter }); if (!multilineVars.score_is_present) multilineVars.staves[multilineVars.staves.length-1].numVoices = 0; } if (multilineVars.voices[id].staffNum === undefined) { // store where to write this for quick access later. multilineVars.voices[id].staffNum = multilineVars.staves.length-1; var vi = 0; for(var v in multilineVars.voices) { if(multilineVars.voices.hasOwnProperty(v)) { if (multilineVars.voices[v].staffNum === multilineVars.voices[id].staffNum) vi++; } } multilineVars.voices[id].index = vi-1; } var s = multilineVars.staves[multilineVars.voices[id].staffNum]; if (!multilineVars.score_is_present) s.numVoices++; if (staffInfo.clef) s.clef = { type: staffInfo.clef, middle: staffInfo.middle }; if (staffInfo.spacing) s.spacing_below_offset = staffInfo.spacing; if (staffInfo.middle) s.middle = staffInfo.middle; if (staffInfo.name) {if (s.name) s.name.push(staffInfo.name); else s.name = [ staffInfo.name ];} if (staffInfo.subname) {if (s.subname) s.subname.push(staffInfo.subname); else s.subname = [ staffInfo.subname ];} this.setCurrentVoice(id); };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f5a9f7ef8d556b3359fab3994dac1ddd87440bb3/abc_parse_header.js/buggy/abc_parse_header.js
if (staffInfo.name) {if (s.name) s.name.push(staffInfo.name); else s.name = [ staffInfo.name ];} if (staffInfo.subname) {if (s.subname) s.subname.push(staffInfo.subname); else s.subname = [ staffInfo.subname ];}
if (staffInfo.name) {if (s.name) s.name.push(staffInfo.name); else s.name = [ staffInfo.name ];} if (staffInfo.subname) {if (s.subname) s.subname.push(staffInfo.subname); else s.subname = [ staffInfo.subname ];}
this.parseVoice = function(line, i, e) { //First truncate the string to the first non-space character after V: through either the //end of the line or a % character. Then remove trailing spaces, too. var ret = tokenizer.getMeat(line, i, e); var start = ret.start; var end = ret.end; //The first thing on the line is the ID. It can be any non-space string and terminates at the //first space. var id = tokenizer.getToken(line, start, end); if (id.length === 0) { warn("Expected a voice id", line, start); return; } var isNew = false; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = {}; isNew = true; if (multilineVars.score_is_present) warn("Can't have an unknown V: id when the %score directive is present", line, i); } start += id.length; start += tokenizer.eatWhiteSpace(line, start); var staffInfo = {startStaff: isNew}; var addNextTokenToStaffInfo = function(name) { var attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for " + name + " in voice: " + attr.warn, line, start); else if (attr.token.length === 0 && line[start] !== '"') warn("Expected value for " + name + " in voice", line, start); else staffInfo[name] = attr.token; start += attr.len; }; //Then the following items can occur in any order: while (start < end) { var token = tokenizer.getVoiceToken(line, start, end); start += token.len; if (token.warn) { warn("Error parsing voice: " + token.warn, line, start); } else { var attr = null; switch (token.token) { case 'clef': case 'cl': addNextTokenToStaffInfo('clef'); // TODO-PER: check for a legal clef; do octavizing var oct = 0;// for (var ii = 0; ii < staffInfo.clef.length; ii++) {// if (staffInfo.clef[ii] === ',') oct -= 7;// else if (staffInfo.clef[ii] === "'") oct += 7;// } if (staffInfo.clef !== undefined) { staffInfo.clef = staffInfo.clef.replace(/[',]/g, ""); if (staffInfo.clef.indexOf('+16') != -1) { oct += 14; staffInfo.clef = staffInfo.clef.replace('+16', ''); } staffInfo.middle = calcMiddle(staffInfo.clef, oct); } break; case 'treble': case 'bass': case 'tenor': case 'alto': case 'none': case 'treble\'': case 'bass\'': case 'tenor\'': case 'alto\'': case 'none\'': case 'treble\'\'': case 'bass\'\'': case 'tenor\'\'': case 'alto\'\'': case 'none\'\'': case 'treble,': case 'bass,': case 'tenor,': case 'alto,': case 'none,': case 'treble,,': case 'bass,,': case 'tenor,,': case 'alto,,': case 'none,,': // TODO-PER: handle the octave indicators on the clef by changing the middle property var oct2 = 0;// for (var iii = 0; iii < token.token.length; iii++) {// if (token.token[iii] === ',') oct2 -= 7;// else if (token.token[iii] === "'") oct2 += 7;// } staffInfo.clef = token.token.replace(/[',]/g, ""); staffInfo.middle = calcMiddle(staffInfo.clef, oct2); break; case 'staves': case 'stave': case 'stv': addNextTokenToStaffInfo('staves'); break; case 'brace': case 'brc': addNextTokenToStaffInfo('brace'); break; case 'bracket': case 'brk': addNextTokenToStaffInfo('bracket'); break; case 'name': case 'nm': addNextTokenToStaffInfo('name'); break; case 'subname': case 'sname': case 'snm': addNextTokenToStaffInfo('subname'); break; case 'merge': staffInfo.startStaff = false; break; case 'stems': attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for stems in voice: " + attr.warn, line, start); else if (attr.token === 'up' || attr.token === 'down') multilineVars.voices[id].stem = attr.token; else warn("Expected up or down for voice stem", line, start); start += attr.len; break; case 'up': case 'down': multilineVars.voices[id].stem = token.token; break; case 'middle': case 'm': addNextTokenToStaffInfo('middle'); staffInfo.middle = parseMiddle(staffInfo.middle); break; case 'gchords': case 'gch': multilineVars.voices[id].suppressChords = true; break; case 'space': case 'spc': addNextTokenToStaffInfo('spacing'); break; } } start += tokenizer.eatWhiteSpace(line, start); } // now we've filled up staffInfo, figure out what to do with this voice // TODO-PER: It is unclear from the standard and the examples what to do with brace, bracket, and staves, so they are ignored for now. if (staffInfo.startStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length, meter: multilineVars.origMeter }); if (!multilineVars.score_is_present) multilineVars.staves[multilineVars.staves.length-1].numVoices = 0; } if (multilineVars.voices[id].staffNum === undefined) { // store where to write this for quick access later. multilineVars.voices[id].staffNum = multilineVars.staves.length-1; var vi = 0; for(var v in multilineVars.voices) { if(multilineVars.voices.hasOwnProperty(v)) { if (multilineVars.voices[v].staffNum === multilineVars.voices[id].staffNum) vi++; } } multilineVars.voices[id].index = vi-1; } var s = multilineVars.staves[multilineVars.voices[id].staffNum]; if (!multilineVars.score_is_present) s.numVoices++; if (staffInfo.clef) s.clef = { type: staffInfo.clef, middle: staffInfo.middle }; if (staffInfo.spacing) s.spacing_below_offset = staffInfo.spacing; if (staffInfo.middle) s.middle = staffInfo.middle; if (staffInfo.name) {if (s.name) s.name.push(staffInfo.name); else s.name = [ staffInfo.name ];} if (staffInfo.subname) {if (s.subname) s.subname.push(staffInfo.subname); else s.subname = [ staffInfo.subname ];} this.setCurrentVoice(id); };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f5a9f7ef8d556b3359fab3994dac1ddd87440bb3/abc_parse_header.js/buggy/abc_parse_header.js
this.setCurrentVoice(id); };
this.setCurrentVoice(id); };
this.parseVoice = function(line, i, e) { //First truncate the string to the first non-space character after V: through either the //end of the line or a % character. Then remove trailing spaces, too. var ret = tokenizer.getMeat(line, i, e); var start = ret.start; var end = ret.end; //The first thing on the line is the ID. It can be any non-space string and terminates at the //first space. var id = tokenizer.getToken(line, start, end); if (id.length === 0) { warn("Expected a voice id", line, start); return; } var isNew = false; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = {}; isNew = true; if (multilineVars.score_is_present) warn("Can't have an unknown V: id when the %score directive is present", line, i); } start += id.length; start += tokenizer.eatWhiteSpace(line, start); var staffInfo = {startStaff: isNew}; var addNextTokenToStaffInfo = function(name) { var attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for " + name + " in voice: " + attr.warn, line, start); else if (attr.token.length === 0 && line[start] !== '"') warn("Expected value for " + name + " in voice", line, start); else staffInfo[name] = attr.token; start += attr.len; }; //Then the following items can occur in any order: while (start < end) { var token = tokenizer.getVoiceToken(line, start, end); start += token.len; if (token.warn) { warn("Error parsing voice: " + token.warn, line, start); } else { var attr = null; switch (token.token) { case 'clef': case 'cl': addNextTokenToStaffInfo('clef'); // TODO-PER: check for a legal clef; do octavizing var oct = 0;// for (var ii = 0; ii < staffInfo.clef.length; ii++) {// if (staffInfo.clef[ii] === ',') oct -= 7;// else if (staffInfo.clef[ii] === "'") oct += 7;// } if (staffInfo.clef !== undefined) { staffInfo.clef = staffInfo.clef.replace(/[',]/g, ""); if (staffInfo.clef.indexOf('+16') != -1) { oct += 14; staffInfo.clef = staffInfo.clef.replace('+16', ''); } staffInfo.middle = calcMiddle(staffInfo.clef, oct); } break; case 'treble': case 'bass': case 'tenor': case 'alto': case 'none': case 'treble\'': case 'bass\'': case 'tenor\'': case 'alto\'': case 'none\'': case 'treble\'\'': case 'bass\'\'': case 'tenor\'\'': case 'alto\'\'': case 'none\'\'': case 'treble,': case 'bass,': case 'tenor,': case 'alto,': case 'none,': case 'treble,,': case 'bass,,': case 'tenor,,': case 'alto,,': case 'none,,': // TODO-PER: handle the octave indicators on the clef by changing the middle property var oct2 = 0;// for (var iii = 0; iii < token.token.length; iii++) {// if (token.token[iii] === ',') oct2 -= 7;// else if (token.token[iii] === "'") oct2 += 7;// } staffInfo.clef = token.token.replace(/[',]/g, ""); staffInfo.middle = calcMiddle(staffInfo.clef, oct2); break; case 'staves': case 'stave': case 'stv': addNextTokenToStaffInfo('staves'); break; case 'brace': case 'brc': addNextTokenToStaffInfo('brace'); break; case 'bracket': case 'brk': addNextTokenToStaffInfo('bracket'); break; case 'name': case 'nm': addNextTokenToStaffInfo('name'); break; case 'subname': case 'sname': case 'snm': addNextTokenToStaffInfo('subname'); break; case 'merge': staffInfo.startStaff = false; break; case 'stems': attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for stems in voice: " + attr.warn, line, start); else if (attr.token === 'up' || attr.token === 'down') multilineVars.voices[id].stem = attr.token; else warn("Expected up or down for voice stem", line, start); start += attr.len; break; case 'up': case 'down': multilineVars.voices[id].stem = token.token; break; case 'middle': case 'm': addNextTokenToStaffInfo('middle'); staffInfo.middle = parseMiddle(staffInfo.middle); break; case 'gchords': case 'gch': multilineVars.voices[id].suppressChords = true; break; case 'space': case 'spc': addNextTokenToStaffInfo('spacing'); break; } } start += tokenizer.eatWhiteSpace(line, start); } // now we've filled up staffInfo, figure out what to do with this voice // TODO-PER: It is unclear from the standard and the examples what to do with brace, bracket, and staves, so they are ignored for now. if (staffInfo.startStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length, meter: multilineVars.origMeter }); if (!multilineVars.score_is_present) multilineVars.staves[multilineVars.staves.length-1].numVoices = 0; } if (multilineVars.voices[id].staffNum === undefined) { // store where to write this for quick access later. multilineVars.voices[id].staffNum = multilineVars.staves.length-1; var vi = 0; for(var v in multilineVars.voices) { if(multilineVars.voices.hasOwnProperty(v)) { if (multilineVars.voices[v].staffNum === multilineVars.voices[id].staffNum) vi++; } } multilineVars.voices[id].index = vi-1; } var s = multilineVars.staves[multilineVars.voices[id].staffNum]; if (!multilineVars.score_is_present) s.numVoices++; if (staffInfo.clef) s.clef = { type: staffInfo.clef, middle: staffInfo.middle }; if (staffInfo.spacing) s.spacing_below_offset = staffInfo.spacing; if (staffInfo.middle) s.middle = staffInfo.middle; if (staffInfo.name) {if (s.name) s.name.push(staffInfo.name); else s.name = [ staffInfo.name ];} if (staffInfo.subname) {if (s.subname) s.subname.push(staffInfo.subname); else s.subname = [ staffInfo.subname ];} this.setCurrentVoice(id); };
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/f5a9f7ef8d556b3359fab3994dac1ddd87440bb3/abc_parse_header.js/buggy/abc_parse_header.js
else if (attr.token.length === 0)
else if (attr.token.length === 0 && line[start] !== '"')
function parseVoice(line, i, e) { //First truncate the string to the first non-space character after V: through either the //end of the line or a % character. Then remove trailing spaces, too. var ret = tokenizer.getMeat(line, i, e); var start = ret.start; var end = ret.end; //The first thing on the line is the ID. It can be any non-space string and terminates at the //first space. var id = tokenizer.getToken(line, start, end); if (id.length === 0) { warn("Expected a voice id", line, start); return; } var isNew = false; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = {}; isNew = true; } start += id.length; start += tokenizer.eatWhiteSpace(line, start); var staffInfo = {startStaff: isNew}; var addNextTokenToStaffInfo = function(name) { var attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for " + name + " in voice: " + attr.warn, line, start); else if (attr.token.length === 0) warn("Expected value for " + name + " in voice", line, start); else staffInfo[name] = attr.token; start += attr.len; }; //Then the following items can occur in any order: while (start < end) { var token = tokenizer.getVoiceToken(line, start, end); start += token.len; if (token.warn) { warn("Error parsing voice: " + token.warn, line, start); } else { var attr = null; switch (token.token) { case 'clef': case 'cl': addNextTokenToStaffInfo('clef'); break; case 'treble': case 'bass': case 'tenor': case 'alto': case 'none': case 'treble\'': case 'bass\'': case 'tenor\'': case 'alto\'': case 'none\'': case 'treble\'\'': case 'bass\'\'': case 'tenor\'\'': case 'alto\'\'': case 'none\'\'': case 'treble,': case 'bass,': case 'tenor,': case 'alto,': case 'none,': case 'treble,,': case 'bass,,': case 'tenor,,': case 'alto,,': case 'none,,': staffInfo.clef = token.token; break; case 'staves': case 'stave': case 'stv': addNextTokenToStaffInfo('staves'); break; case 'brace': case 'brc': addNextTokenToStaffInfo('brace'); break; case 'bracket': case 'brk': addNextTokenToStaffInfo('bracket'); break; case 'name': case 'nm': addNextTokenToStaffInfo('name'); break; case 'subname': case 'sname': case 'snm': addNextTokenToStaffInfo('subname'); break; case 'merge': staffInfo.startStaff = false; break; case 'stems': attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for stems in voice: " + attr.warn, line, start); else if (attr.token === 'up' || attr.token === 'down') multilineVars.voices[id].stem = attr.token; else warn("Expected up or down for voice stem", line, start); start += attr.len; break; case 'up': case 'down': multilineVars.voices[id].stem = token.token; break; case 'middle': case 'm': addNextTokenToStaffInfo('middle'); break; case 'gchords': case 'gch': multilineVars.voices[id].suppressChords = true; break; case 'space': case 'spc': addNextTokenToStaffInfo('spacing'); break; } } start += tokenizer.eatWhiteSpace(line, start); } // now we've filled up staffInfo, figure out what to do with this voice // TODO-PER: It is unclear from the standard and the examples what to do with brace, bracket, and staves, so they are ignored for now. if (staffInfo.startStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length }); // TODO-PER: For now, the entire collection is bracketted. Refine this later. if (multilineVars.staves.length > 1) { multilineVars.staves[0].bracket = 'start'; for (var b = 1; b < multilineVars.staves.length-1; b++) multilineVars.staves[b].bracket = "continue"; multilineVars.staves[multilineVars.staves.length-1].bracket = 'end'; } multilineVars.staves[multilineVars.staves.length-1].numVoices = 0; } if (multilineVars.voices[id].staffNum === undefined) { // store where to write this for quick access later. multilineVars.voices[id].staffNum = multilineVars.staves.length-1; var vi = 0; for(var v in multilineVars.voices) { if(multilineVars.voices.hasOwnProperty(v)) { if (multilineVars.voices[v].staffNum === multilineVars.voices[id].staffNum) vi++; } } multilineVars.voices[id].index = vi-1; } var s = multilineVars.staves[multilineVars.staves.length-1]; s.numVoices++; if (staffInfo.clef) s.clef = staffInfo.clef; if (staffInfo.spacing) s.spacing_below_offset = staffInfo.spacing; if (staffInfo.middle) s.middle = staffInfo.middle; if (staffInfo.name) {if (s.name) s.name.push(staffInfo.name); else s.name = [ staffInfo.name ];} if (staffInfo.subname) {if (s.subname) s.name.push(staffInfo.subname); else s.subname = [ staffInfo.subname ];} setCurrentVoice(id); }
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/66c5771dcec8aa949d4f3e38d5c1edaf2264c555/abc_parse.js/buggy/abc_parse.js
if (staffInfo.clef) s.clef = staffInfo.clef;
if (staffInfo.clef) s.clef = { type: staffInfo.clef, middle: staffInfo.middle };
function parseVoice(line, i, e) { //First truncate the string to the first non-space character after V: through either the //end of the line or a % character. Then remove trailing spaces, too. var ret = tokenizer.getMeat(line, i, e); var start = ret.start; var end = ret.end; //The first thing on the line is the ID. It can be any non-space string and terminates at the //first space. var id = tokenizer.getToken(line, start, end); if (id.length === 0) { warn("Expected a voice id", line, start); return; } var isNew = false; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = {}; isNew = true; } start += id.length; start += tokenizer.eatWhiteSpace(line, start); var staffInfo = {startStaff: isNew}; var addNextTokenToStaffInfo = function(name) { var attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for " + name + " in voice: " + attr.warn, line, start); else if (attr.token.length === 0) warn("Expected value for " + name + " in voice", line, start); else staffInfo[name] = attr.token; start += attr.len; }; //Then the following items can occur in any order: while (start < end) { var token = tokenizer.getVoiceToken(line, start, end); start += token.len; if (token.warn) { warn("Error parsing voice: " + token.warn, line, start); } else { var attr = null; switch (token.token) { case 'clef': case 'cl': addNextTokenToStaffInfo('clef'); break; case 'treble': case 'bass': case 'tenor': case 'alto': case 'none': case 'treble\'': case 'bass\'': case 'tenor\'': case 'alto\'': case 'none\'': case 'treble\'\'': case 'bass\'\'': case 'tenor\'\'': case 'alto\'\'': case 'none\'\'': case 'treble,': case 'bass,': case 'tenor,': case 'alto,': case 'none,': case 'treble,,': case 'bass,,': case 'tenor,,': case 'alto,,': case 'none,,': staffInfo.clef = token.token; break; case 'staves': case 'stave': case 'stv': addNextTokenToStaffInfo('staves'); break; case 'brace': case 'brc': addNextTokenToStaffInfo('brace'); break; case 'bracket': case 'brk': addNextTokenToStaffInfo('bracket'); break; case 'name': case 'nm': addNextTokenToStaffInfo('name'); break; case 'subname': case 'sname': case 'snm': addNextTokenToStaffInfo('subname'); break; case 'merge': staffInfo.startStaff = false; break; case 'stems': attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for stems in voice: " + attr.warn, line, start); else if (attr.token === 'up' || attr.token === 'down') multilineVars.voices[id].stem = attr.token; else warn("Expected up or down for voice stem", line, start); start += attr.len; break; case 'up': case 'down': multilineVars.voices[id].stem = token.token; break; case 'middle': case 'm': addNextTokenToStaffInfo('middle'); break; case 'gchords': case 'gch': multilineVars.voices[id].suppressChords = true; break; case 'space': case 'spc': addNextTokenToStaffInfo('spacing'); break; } } start += tokenizer.eatWhiteSpace(line, start); } // now we've filled up staffInfo, figure out what to do with this voice // TODO-PER: It is unclear from the standard and the examples what to do with brace, bracket, and staves, so they are ignored for now. if (staffInfo.startStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length }); // TODO-PER: For now, the entire collection is bracketted. Refine this later. if (multilineVars.staves.length > 1) { multilineVars.staves[0].bracket = 'start'; for (var b = 1; b < multilineVars.staves.length-1; b++) multilineVars.staves[b].bracket = "continue"; multilineVars.staves[multilineVars.staves.length-1].bracket = 'end'; } multilineVars.staves[multilineVars.staves.length-1].numVoices = 0; } if (multilineVars.voices[id].staffNum === undefined) { // store where to write this for quick access later. multilineVars.voices[id].staffNum = multilineVars.staves.length-1; var vi = 0; for(var v in multilineVars.voices) { if(multilineVars.voices.hasOwnProperty(v)) { if (multilineVars.voices[v].staffNum === multilineVars.voices[id].staffNum) vi++; } } multilineVars.voices[id].index = vi-1; } var s = multilineVars.staves[multilineVars.staves.length-1]; s.numVoices++; if (staffInfo.clef) s.clef = staffInfo.clef; if (staffInfo.spacing) s.spacing_below_offset = staffInfo.spacing; if (staffInfo.middle) s.middle = staffInfo.middle; if (staffInfo.name) {if (s.name) s.name.push(staffInfo.name); else s.name = [ staffInfo.name ];} if (staffInfo.subname) {if (s.subname) s.name.push(staffInfo.subname); else s.subname = [ staffInfo.subname ];} setCurrentVoice(id); }
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/66c5771dcec8aa949d4f3e38d5c1edaf2264c555/abc_parse.js/buggy/abc_parse.js
if (multilineVars.staves.length > 1) { multilineVars.staves[0].bracket = 'start'; for (var b = 1; b < multilineVars.staves.length-1; b++) multilineVars.staves[b].bracket = "continue"; multilineVars.staves[multilineVars.staves.length-1].bracket = 'end'; }
function parseVoice(line, i, e) { //First truncate the string to the first non-space character after V: through either the //end of the line or a % character. Then remove trailing spaces, too. var ret = tokenizer.getMeat(line, i, e); var start = ret.start; var end = ret.end; //The first thing on the line is the ID. It can be any non-space string and terminates at the //first space. var id = tokenizer.getToken(line, start, end); if (id.length === 0) { warn("Expected a voice id", line, start); return; } var isNew = false; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = {}; isNew = true; } start += id.length; start += tokenizer.eatWhiteSpace(line, start); var staffInfo = {startStaff: isNew}; var addNextTokenToStaffInfo = function(name) { var attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for " + name + " in voice: " + attr.warn, line, start); else if (attr.token.length === 0 && line[start] !== '"') warn("Expected value for " + name + " in voice", line, start); else staffInfo[name] = attr.token; start += attr.len; }; //Then the following items can occur in any order: while (start < end) { var token = tokenizer.getVoiceToken(line, start, end); start += token.len; if (token.warn) { warn("Error parsing voice: " + token.warn, line, start); } else { var attr = null; switch (token.token) { case 'clef': case 'cl': addNextTokenToStaffInfo('clef'); break; case 'treble': case 'bass': case 'tenor': case 'alto': case 'none': case 'treble\'': case 'bass\'': case 'tenor\'': case 'alto\'': case 'none\'': case 'treble\'\'': case 'bass\'\'': case 'tenor\'\'': case 'alto\'\'': case 'none\'\'': case 'treble,': case 'bass,': case 'tenor,': case 'alto,': case 'none,': case 'treble,,': case 'bass,,': case 'tenor,,': case 'alto,,': case 'none,,': staffInfo.clef = token.token; break; case 'staves': case 'stave': case 'stv': addNextTokenToStaffInfo('staves'); break; case 'brace': case 'brc': addNextTokenToStaffInfo('brace'); break; case 'bracket': case 'brk': addNextTokenToStaffInfo('bracket'); break; case 'name': case 'nm': addNextTokenToStaffInfo('name'); break; case 'subname': case 'sname': case 'snm': addNextTokenToStaffInfo('subname'); break; case 'merge': staffInfo.startStaff = false; break; case 'stems': attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for stems in voice: " + attr.warn, line, start); else if (attr.token === 'up' || attr.token === 'down') multilineVars.voices[id].stem = attr.token; else warn("Expected up or down for voice stem", line, start); start += attr.len; break; case 'up': case 'down': multilineVars.voices[id].stem = token.token; break; case 'middle': case 'm': addNextTokenToStaffInfo('middle'); break; case 'gchords': case 'gch': multilineVars.voices[id].suppressChords = true; break; case 'space': case 'spc': addNextTokenToStaffInfo('spacing'); break; } } start += tokenizer.eatWhiteSpace(line, start); } // now we've filled up staffInfo, figure out what to do with this voice // TODO-PER: It is unclear from the standard and the examples what to do with brace, bracket, and staves, so they are ignored for now. if (staffInfo.startStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length }); // TODO-PER: For now, the entire collection is bracketted. Refine this later. if (multilineVars.staves.length > 1) { multilineVars.staves[0].bracket = 'start'; for (var b = 1; b < multilineVars.staves.length-1; b++) multilineVars.staves[b].bracket = "continue"; multilineVars.staves[multilineVars.staves.length-1].bracket = 'end'; } multilineVars.staves[multilineVars.staves.length-1].numVoices = 0; } if (multilineVars.voices[id].staffNum === undefined) { // store where to write this for quick access later. multilineVars.voices[id].staffNum = multilineVars.staves.length-1; var vi = 0; for(var v in multilineVars.voices) { if(multilineVars.voices.hasOwnProperty(v)) { if (multilineVars.voices[v].staffNum === multilineVars.voices[id].staffNum) vi++; } } multilineVars.voices[id].index = vi-1; } var s = multilineVars.staves[multilineVars.staves.length-1]; s.numVoices++; if (staffInfo.clef) s.clef = { type: staffInfo.clef, middle: staffInfo.middle }; if (staffInfo.spacing) s.spacing_below_offset = staffInfo.spacing; if (staffInfo.middle) s.middle = staffInfo.middle; if (staffInfo.name) {if (s.name) s.name.push(staffInfo.name); else s.name = [ staffInfo.name ];} if (staffInfo.subname) {if (s.subname) s.name.push(staffInfo.subname); else s.subname = [ staffInfo.subname ];} setCurrentVoice(id); }
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/05b2dde631d4eb1677f46195c6c62184e7d629aa/abc_parse.js/clean/abc_parse.js
var s = multilineVars.staves[multilineVars.staves.length-1];
var s = multilineVars.staves[multilineVars.voices[id].staffNum];
function parseVoice(line, i, e) { //First truncate the string to the first non-space character after V: through either the //end of the line or a % character. Then remove trailing spaces, too. var ret = tokenizer.getMeat(line, i, e); var start = ret.start; var end = ret.end; //The first thing on the line is the ID. It can be any non-space string and terminates at the //first space. var id = tokenizer.getToken(line, start, end); if (id.length === 0) { warn("Expected a voice id", line, start); return; } var isNew = false; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = {}; isNew = true; } start += id.length; start += tokenizer.eatWhiteSpace(line, start); var staffInfo = {startStaff: isNew}; var addNextTokenToStaffInfo = function(name) { var attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for " + name + " in voice: " + attr.warn, line, start); else if (attr.token.length === 0 && line[start] !== '"') warn("Expected value for " + name + " in voice", line, start); else staffInfo[name] = attr.token; start += attr.len; }; //Then the following items can occur in any order: while (start < end) { var token = tokenizer.getVoiceToken(line, start, end); start += token.len; if (token.warn) { warn("Error parsing voice: " + token.warn, line, start); } else { var attr = null; switch (token.token) { case 'clef': case 'cl': addNextTokenToStaffInfo('clef'); break; case 'treble': case 'bass': case 'tenor': case 'alto': case 'none': case 'treble\'': case 'bass\'': case 'tenor\'': case 'alto\'': case 'none\'': case 'treble\'\'': case 'bass\'\'': case 'tenor\'\'': case 'alto\'\'': case 'none\'\'': case 'treble,': case 'bass,': case 'tenor,': case 'alto,': case 'none,': case 'treble,,': case 'bass,,': case 'tenor,,': case 'alto,,': case 'none,,': staffInfo.clef = token.token; break; case 'staves': case 'stave': case 'stv': addNextTokenToStaffInfo('staves'); break; case 'brace': case 'brc': addNextTokenToStaffInfo('brace'); break; case 'bracket': case 'brk': addNextTokenToStaffInfo('bracket'); break; case 'name': case 'nm': addNextTokenToStaffInfo('name'); break; case 'subname': case 'sname': case 'snm': addNextTokenToStaffInfo('subname'); break; case 'merge': staffInfo.startStaff = false; break; case 'stems': attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for stems in voice: " + attr.warn, line, start); else if (attr.token === 'up' || attr.token === 'down') multilineVars.voices[id].stem = attr.token; else warn("Expected up or down for voice stem", line, start); start += attr.len; break; case 'up': case 'down': multilineVars.voices[id].stem = token.token; break; case 'middle': case 'm': addNextTokenToStaffInfo('middle'); break; case 'gchords': case 'gch': multilineVars.voices[id].suppressChords = true; break; case 'space': case 'spc': addNextTokenToStaffInfo('spacing'); break; } } start += tokenizer.eatWhiteSpace(line, start); } // now we've filled up staffInfo, figure out what to do with this voice // TODO-PER: It is unclear from the standard and the examples what to do with brace, bracket, and staves, so they are ignored for now. if (staffInfo.startStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length }); // TODO-PER: For now, the entire collection is bracketted. Refine this later. if (multilineVars.staves.length > 1) { multilineVars.staves[0].bracket = 'start'; for (var b = 1; b < multilineVars.staves.length-1; b++) multilineVars.staves[b].bracket = "continue"; multilineVars.staves[multilineVars.staves.length-1].bracket = 'end'; } multilineVars.staves[multilineVars.staves.length-1].numVoices = 0; } if (multilineVars.voices[id].staffNum === undefined) { // store where to write this for quick access later. multilineVars.voices[id].staffNum = multilineVars.staves.length-1; var vi = 0; for(var v in multilineVars.voices) { if(multilineVars.voices.hasOwnProperty(v)) { if (multilineVars.voices[v].staffNum === multilineVars.voices[id].staffNum) vi++; } } multilineVars.voices[id].index = vi-1; } var s = multilineVars.staves[multilineVars.staves.length-1]; s.numVoices++; if (staffInfo.clef) s.clef = { type: staffInfo.clef, middle: staffInfo.middle }; if (staffInfo.spacing) s.spacing_below_offset = staffInfo.spacing; if (staffInfo.middle) s.middle = staffInfo.middle; if (staffInfo.name) {if (s.name) s.name.push(staffInfo.name); else s.name = [ staffInfo.name ];} if (staffInfo.subname) {if (s.subname) s.name.push(staffInfo.subname); else s.subname = [ staffInfo.subname ];} setCurrentVoice(id); }
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/05b2dde631d4eb1677f46195c6c62184e7d629aa/abc_parse.js/clean/abc_parse.js
if (staffInfo.subname) {if (s.subname) s.name.push(staffInfo.subname); else s.subname = [ staffInfo.subname ];}
if (staffInfo.subname) {if (s.subname) s.subname.push(staffInfo.subname); else s.subname = [ staffInfo.subname ];}
function parseVoice(line, i, e) { //First truncate the string to the first non-space character after V: through either the //end of the line or a % character. Then remove trailing spaces, too. var ret = tokenizer.getMeat(line, i, e); var start = ret.start; var end = ret.end; //The first thing on the line is the ID. It can be any non-space string and terminates at the //first space. var id = tokenizer.getToken(line, start, end); if (id.length === 0) { warn("Expected a voice id", line, start); return; } var isNew = false; if (multilineVars.voices[id] === undefined) { multilineVars.voices[id] = {}; isNew = true; } start += id.length; start += tokenizer.eatWhiteSpace(line, start); var staffInfo = {startStaff: isNew}; var addNextTokenToStaffInfo = function(name) { var attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for " + name + " in voice: " + attr.warn, line, start); else if (attr.token.length === 0 && line[start] !== '"') warn("Expected value for " + name + " in voice", line, start); else staffInfo[name] = attr.token; start += attr.len; }; //Then the following items can occur in any order: while (start < end) { var token = tokenizer.getVoiceToken(line, start, end); start += token.len; if (token.warn) { warn("Error parsing voice: " + token.warn, line, start); } else { var attr = null; switch (token.token) { case 'clef': case 'cl': addNextTokenToStaffInfo('clef'); break; case 'treble': case 'bass': case 'tenor': case 'alto': case 'none': case 'treble\'': case 'bass\'': case 'tenor\'': case 'alto\'': case 'none\'': case 'treble\'\'': case 'bass\'\'': case 'tenor\'\'': case 'alto\'\'': case 'none\'\'': case 'treble,': case 'bass,': case 'tenor,': case 'alto,': case 'none,': case 'treble,,': case 'bass,,': case 'tenor,,': case 'alto,,': case 'none,,': staffInfo.clef = token.token; break; case 'staves': case 'stave': case 'stv': addNextTokenToStaffInfo('staves'); break; case 'brace': case 'brc': addNextTokenToStaffInfo('brace'); break; case 'bracket': case 'brk': addNextTokenToStaffInfo('bracket'); break; case 'name': case 'nm': addNextTokenToStaffInfo('name'); break; case 'subname': case 'sname': case 'snm': addNextTokenToStaffInfo('subname'); break; case 'merge': staffInfo.startStaff = false; break; case 'stems': attr = tokenizer.getVoiceToken(line, start, end); if (attr.warn !== undefined) warn("Expected value for stems in voice: " + attr.warn, line, start); else if (attr.token === 'up' || attr.token === 'down') multilineVars.voices[id].stem = attr.token; else warn("Expected up or down for voice stem", line, start); start += attr.len; break; case 'up': case 'down': multilineVars.voices[id].stem = token.token; break; case 'middle': case 'm': addNextTokenToStaffInfo('middle'); break; case 'gchords': case 'gch': multilineVars.voices[id].suppressChords = true; break; case 'space': case 'spc': addNextTokenToStaffInfo('spacing'); break; } } start += tokenizer.eatWhiteSpace(line, start); } // now we've filled up staffInfo, figure out what to do with this voice // TODO-PER: It is unclear from the standard and the examples what to do with brace, bracket, and staves, so they are ignored for now. if (staffInfo.startStaff || multilineVars.staves.length === 0) { multilineVars.staves.push({ index: multilineVars.staves.length }); // TODO-PER: For now, the entire collection is bracketted. Refine this later. if (multilineVars.staves.length > 1) { multilineVars.staves[0].bracket = 'start'; for (var b = 1; b < multilineVars.staves.length-1; b++) multilineVars.staves[b].bracket = "continue"; multilineVars.staves[multilineVars.staves.length-1].bracket = 'end'; } multilineVars.staves[multilineVars.staves.length-1].numVoices = 0; } if (multilineVars.voices[id].staffNum === undefined) { // store where to write this for quick access later. multilineVars.voices[id].staffNum = multilineVars.staves.length-1; var vi = 0; for(var v in multilineVars.voices) { if(multilineVars.voices.hasOwnProperty(v)) { if (multilineVars.voices[v].staffNum === multilineVars.voices[id].staffNum) vi++; } } multilineVars.voices[id].index = vi-1; } var s = multilineVars.staves[multilineVars.staves.length-1]; s.numVoices++; if (staffInfo.clef) s.clef = { type: staffInfo.clef, middle: staffInfo.middle }; if (staffInfo.spacing) s.spacing_below_offset = staffInfo.spacing; if (staffInfo.middle) s.middle = staffInfo.middle; if (staffInfo.name) {if (s.name) s.name.push(staffInfo.name); else s.name = [ staffInfo.name ];} if (staffInfo.subname) {if (s.subname) s.name.push(staffInfo.subname); else s.subname = [ staffInfo.subname ];} setCurrentVoice(id); }
2684 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/2684/05b2dde631d4eb1677f46195c6c62184e7d629aa/abc_parse.js/clean/abc_parse.js
htmlText += ' ' + xmlDocNode.attributes[i].nodeName + '=&quot;' + xmlDocNode.attributes[i].value + '&quot;';
htmlText += ' ' + xmlDocNode.attributes[i].nodeName + '=&quot;' + xmlDocNode.attributes[i].value + '&quot;';
var parseXmlToHtml = function(xmlDocNode, indent) { var htmlText; var isLeaf = isLeafNode(xmlDocNode); // Create opening tag with attributes htmlText = indent + '<span class="tag">&lt;' + xmlDocNode.tagName; for ( var i = 0; i < xmlDocNode.attributes.length; i++) { htmlText += ' ' + xmlDocNode.attributes[i].nodeName + '=&quot;' + xmlDocNode.attributes[i].value + '&quot;'; } htmlText += '&gt;</span>'; if (isLeaf) { var textContent = xmlDocNode.textContent ? xmlDocNode.textContent : xmlDocNode.text; htmlText += textContent; } else { htmlText += '<br/>'; } // Write any children Ext.each(xmlDocNode.childNodes, function(docNodeChild) { if (docNodeChild.nodeType == XML_NODE_ELEMENT) { htmlText += parseXmlToHtml(docNodeChild, indent + ' '); } }, this); // Write closing tag htmlText += '<span class="tag">' + (isLeaf ? '' : indent) + '&lt;/' + xmlDocNode.tagName + '&gt;</span><br/>'; return htmlText; };
6764 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/6764/ce6e30f73846e1454d45b3ae80df69e03b836e58/genericparser.js/clean/src/main/webapp/js/genericparser.js
htmlText += '<span class="tag">' + (isLeaf ? '' : indent) + '&lt;/' + xmlDocNode.tagName + '&gt;</span><br/>';
htmlText += '<span class="tag">' + (isLeaf ? '' : indent) + '&lt;/' + xmlDocNode.tagName + '&gt;</span><br/>';
var parseXmlToHtml = function(xmlDocNode, indent) { var htmlText; var isLeaf = isLeafNode(xmlDocNode); // Create opening tag with attributes htmlText = indent + '<span class="tag">&lt;' + xmlDocNode.tagName; for ( var i = 0; i < xmlDocNode.attributes.length; i++) { htmlText += ' ' + xmlDocNode.attributes[i].nodeName + '=&quot;' + xmlDocNode.attributes[i].value + '&quot;'; } htmlText += '&gt;</span>'; if (isLeaf) { var textContent = xmlDocNode.textContent ? xmlDocNode.textContent : xmlDocNode.text; htmlText += textContent; } else { htmlText += '<br/>'; } // Write any children Ext.each(xmlDocNode.childNodes, function(docNodeChild) { if (docNodeChild.nodeType == XML_NODE_ELEMENT) { htmlText += parseXmlToHtml(docNodeChild, indent + ' '); } }, this); // Write closing tag htmlText += '<span class="tag">' + (isLeaf ? '' : indent) + '&lt;/' + xmlDocNode.tagName + '&gt;</span><br/>'; return htmlText; };
6764 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/6764/ce6e30f73846e1454d45b3ae80df69e03b836e58/genericparser.js/clean/src/main/webapp/js/genericparser.js
if (isLeaf) htmlText += xmlDocNode.textContent; else
if (isLeaf) { var textContent = xmlDocNode.textContent ? xmlDocNode.textContent : xmlDocNode.text; htmlText += textContent; } else {
var parseXmlToHtml = function(xmlDocNode, indent) { var htmlText; var isLeaf = isLeafNode(xmlDocNode); // Create opening tag with attributes htmlText = indent + '<span class="tag">&lt;' + xmlDocNode.tagName; for ( var i = 0; i < xmlDocNode.attributes.length; i++) { htmlText += ' ' + xmlDocNode.attributes[i].nodeName + '=&quot;' + xmlDocNode.attributes[i].value + '&quot;'; } htmlText += '&gt;</span>'; if (isLeaf) htmlText += xmlDocNode.textContent; else htmlText += '<br/>'; // Write any children Ext.each(xmlDocNode.childNodes, function(docNodeChild) { if (docNodeChild.nodeType == XML_NODE_ELEMENT) { htmlText += parseXmlToHtml(docNodeChild, indent + ' '); } }, this); // Write closing tag htmlText += '<span class="tag">' + (isLeaf ? '' : indent) + '&lt;/' + xmlDocNode.tagName + '&gt;</span><br/>'; return htmlText; };
6764 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/6764/598271bac71a093c85c96c5b0bda9f0b842edede/genericparser.js/clean/src/main/webapp/js/genericparser.js
}
var parseXmlToHtml = function(xmlDocNode, indent) { var htmlText; var isLeaf = isLeafNode(xmlDocNode); // Create opening tag with attributes htmlText = indent + '<span class="tag">&lt;' + xmlDocNode.tagName; for ( var i = 0; i < xmlDocNode.attributes.length; i++) { htmlText += ' ' + xmlDocNode.attributes[i].nodeName + '=&quot;' + xmlDocNode.attributes[i].value + '&quot;'; } htmlText += '&gt;</span>'; if (isLeaf) htmlText += xmlDocNode.textContent; else htmlText += '<br/>'; // Write any children Ext.each(xmlDocNode.childNodes, function(docNodeChild) { if (docNodeChild.nodeType == XML_NODE_ELEMENT) { htmlText += parseXmlToHtml(docNodeChild, indent + ' '); } }, this); // Write closing tag htmlText += '<span class="tag">' + (isLeaf ? '' : indent) + '&lt;/' + xmlDocNode.tagName + '&gt;</span><br/>'; return htmlText; };
6764 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/6764/598271bac71a093c85c96c5b0bda9f0b842edede/genericparser.js/clean/src/main/webapp/js/genericparser.js
partition: function(iterator) {
partition: function(iterator, context) { iterator = iterator || Prototype.K;
partition: function(iterator) { var trues = [], falses = []; this.each(function(value, index) { ((iterator || Prototype.K)(value, index) ? trues : falses).push(value); }); return [trues, falses]; },
6136 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/6136/5543d40f16e51501a8d1e97b08f3ff550d8f9214/prototype.js/clean/web/src/main/webapp/js/prototype.js
((iterator || Prototype.K)(value, index) ?
(iterator.call(context, value, index) ?
partition: function(iterator) { var trues = [], falses = []; this.each(function(value, index) { ((iterator || Prototype.K)(value, index) ? trues : falses).push(value); }); return [trues, falses]; },
6136 /local1/tlutelli/issta_data/temp/all_js/javascript/2010_temp/2010/6136/5543d40f16e51501a8d1e97b08f3ff550d8f9214/prototype.js/clean/web/src/main/webapp/js/prototype.js