1// wppa-utils.js 2// 3// conatins common vars and functions 4// 5 6var wppaJsUtilsVersion='6.5.03';var wppaDebug;function wppaTrim(str,arg){var result;result=wppaTrimLeft(str,arg);result=wppaTrimRight(result,arg);return result;} 7function wppaTrimLeft(str,arg){var result;var strlen;var arglen;var argcount;var i;var done;var oldStr,newStr;switch(typeof(arg)){case'string':result=str;strlen=str.length;arglen=arg.length;while(strlen>=arglen&&result.substr(0,arglen)==arg){result=result.substr(arglen);strlen=result.length;} 8break;case'object':done=false;newStr=str;while(!done){i=0;oldStr=newStr;while(i<arg.length){newStr=wppaTrimLeft(newStr,arg[i]);i++;} 9done=(oldStr==newStr);} 10result=newStr;break;default:return str.replace(/^\s\s*/,'');} 11return result;} 12function wppaTrimRight(str,arg){var result;var strlen;var arglen;var argcount;var i;var done;var oldStr,newStr;switch(typeof(arg)){case'string':result=str;strlen=str.length;arglen=arg.length;while(strlen>=arglen&&result.substr(strlen-arglen)==arg){result=result.substr(0,strlen-arglen);strlen=result.length;} 13break;case'object':done=false;newStr=str;while(!done){i=0;oldStr=newStr;while(i<arg.length){newStr=wppaTrimRight(newStr,arg[i]);i++;} 14done=(oldStr==newStr);} 15result=newStr;break;default:return str.replace(/\s\s*$/,'');} 16return result;} 17function wppa_setCookie(c_name,value,exdays){var exdate=new Date();exdate.setDate(exdate.getDate()+exdays);var c_value=escape(value)+((exdays==null)?"":"; expires="+exdate.toUTCString());document.cookie=c_name+"="+c_value;} 18function wppa_getCookie(c_name){var i,x,y,ARRcookies=document.cookie.split(";");for(i=0;i<ARRcookies.length;i++) 19{x=ARRcookies[i].substr(0,ARRcookies[i].indexOf("="));y=ARRcookies[i].substr(ARRcookies[i].indexOf("=")+1);x=x.replace(/^\s+|\s+$/g,"");if(x==c_name) 20{return unescape(y);}} 21return"";} 22function wppaStereoTypeChange(newval){wppa_setCookie('stereotype',newval,365);} 23function wppaStereoGlassChange(newval){wppa_setCookie('stereoglass',newval,365);} 24function wppaConsoleLog(arg,force){if(typeof(console)!='undefined'&&(wppaDebug||force=='force')){var d=new Date();var n=d.getTime();var t=n%(24*60*60*1000);var h=Math.floor(t/(60*60*1000));t-=h*60*60*1000;var m=Math.floor(t/(60*1000));t-=m*60*1000;var s=Math.floor(t/1000);t-=s*1000;console.log('At: '+h+':'+m+':'+s+'.'+t+' message: '+arg);}} 25function wppaConvertScriptToShortcode(scriptId,shortcodeId){var script;var workArr;var temp;var item;var value;var type;var album;var photo;var size;var align;var result;script=jQuery('#'+scriptId).val();if(typeof(script)!='string'||script.length==0){jQuery('#'+shortcodeId).val('No script found');jQuery('#'+shortcodeId).css('color','red');return;} 26workarr=script.split('%%');if(workarr[1]!='wppa'||workarr.length<3){jQuery('#'+shortcodeId).val('No %%wppa%% found');jQuery('#'+shortcodeId).css('color','red');return;} 27for(i=3;i<workarr.length;i+=2){temp=workarr[i].split('=');item=temp[0];value=temp[1];if(item&&value){switch(item){case'size':size=value;break;case'align':align=value;break;case'photo':case'mphoto':case'slphoto':type=item;photo=value;break;case'album':case'cover':case'slide':case'slideonly':case'slideonlyf':case'slidef':type=item;album=value;break;default:jQuery('#'+shortcodeId).val('Token "'+workarr[i]+'" not recognized');jQuery('#'+shortcodeId).css('color','red');return;}}} 28result='[wppa';if(type&&type.length>0){result+=' type="'+type+'"';} 29if(album&&album.length>0){result+=' album="'+album+'"';} 30if(photo&&photo.length>0){result+=' photo="'+photo+'"';} 31if(size&&size.length>0){result+=' size="'+size+'"';} 32if(align&&align.length>0){result+=' align="'+align+'"';} 33result+='][/wppa]';jQuery('#'+shortcodeId).val(result);jQuery('#'+shortcodeId).css('color','green');document.getElementById(shortcodeId).focus();document.getElementById(shortcodeId).select();} 34wppaConsoleLog('wppa-utils.js version '+wppaJsUtilsVersion+' loaded.','force');
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.