function wpPluginBuilderClass(pass){} if (typeof wpPluginBuilderClass != 'undefined') { wpPluginBuilderClass.prototype.get_element = function(id){ if(document.getElementById) { if(document.getElementById(id)!=null){ return document.getElementById(id); } } else { if (document.layers) { return document[id]; } else { return document.all[id]; } } return null; } wpPluginBuilderClass.prototype.get_content = function(id){ var elm = this.get_element(id); if(elm!=null){ if(elm.id!=undefined){ var tagname = elm.tagName; var tag = tagname.toLowerCase(); if(tag=='input'){ var type = elm.type; var typ = type.toLowerCase(); if(typ=='checkbox' || typ=='radio'){ if(elm.checked){ return " checked"; } }else{ return elm.value; } }else if(tag=='select' || tag=='button'){ return elm.value; }else{ return elm.innerHTML; } } } return ''; } wpPluginBuilderClass.prototype.set_content = function(id,content){ var elm = this.get_element(id); if(elm!=null){ if(elm.id!=undefined){ var tagname = elm.tagName; var tag = tagname.toLowerCase(); if(tag=='input'){ var type = elm.type; var typ = type.toLowerCase(); if(typ=='checkbox' || typ=='radio'){ elm.checked = content; }else{ elm.value = content; } }else if(tag=='select' || tag=='button'){ elm.value = content; }else{ elm.innerHTML = content; } } } } wpPluginBuilderClass.prototype.getdiv = function(divname,what,which){ if(this.get_element(divname)!=null){ if(which==null){ return this.get_element(divname)[what]; }else{ return this.get_element(divname)[what][which]; } } return null; } wpPluginBuilderClass.prototype.commanddiv = function(divname,what,which,how){ if(this.get_element(divname)!=null){ if(how==null){ this.get_element(divname)[what] = which; }else{ this.get_element(divname)[what][which] = how; } } } wpPluginBuilderClass.prototype.showdiv = function(divname){ this.commanddiv(divname,'style','display','block'); } wpPluginBuilderClass.prototype.hidediv = function(divname){ this.commanddiv(divname,'style','display','none'); } wpPluginBuilderClass.prototype.togglediv = function(divname){ var isit = this.getdiv(divname,'style','display'); if(isit!='none'){ this.hidediv(divname); }else{ this.showdiv(divname); } } wpPluginBuilderClass.prototype.verify_clear = function(pass){ if(pass!=null){ var answer = confirm(pass); }else{ var answer = confirm("Are you sure you wish to proceed?"); } if (answer){ return true; } return false; } wpPluginBuilderClass.prototype.in_array = function(arr, obj){ var i = arr.length; while (i--) { if (arr[i] === obj) { return true; } } return false; } wpPluginBuilderClass.prototype.is_numeric = function(n){ return !isNaN(parseFloat(n)) && isFinite(n); } wpPluginBuilderClass.prototype.get_value = function(arr,dex,def){ if(arr[dex]!=null){ return arr[dex]; } if(def==null){ var def = ''; } return def; } wpPluginBuilderClass.prototype.post_to_url = function(path, params, target){ if(params==null){var params = new Array();} if(target==null){var target = "_self";} var method="post"; var tempform = document.createElement("form"); tempform.setAttribute("method", "post"); tempform.setAttribute("action", path); tempform.setAttribute("target", target); for(var key in params) { var hiddenField = document.createElement("input"); hiddenField.setAttribute("type", "hidden"); hiddenField.setAttribute("name", key); hiddenField.setAttribute("value", params[key]); tempform.appendChild(hiddenField); } document.body.appendChild(tempform); tempform.submit(); } wpPluginBuilderClass.prototype.count = function(obj){ var size = 0, key; for (key in obj) { if (obj.hasOwnProperty(key)) size++; } return size; } wpPluginBuilderClass.prototype.array_move = function(arr, fromIndex, toIndex) { var element = arr[fromIndex]; arr.splice(fromIndex, 1); arr.splice(toIndex, 0, element); return arr; } wpPluginBuilderClass.prototype.get_get = function(param){ if(param==null){var param = 'all';} var sURL = window.document.URL.toString(); if (sURL.indexOf("?") > 0) { var arrParams = sURL.split("?"); if(param=='base'){ return arrParams[0]; } var RET = new Object(); var arrURLParams = arrParams[1].split("&"); var arrParamNames = new Array(arrURLParams.length); var arrParamValues = new Array(arrURLParams.length); var i = 0; for (i=0;i4){dec = 4;} var val = price.replace(/[^\d]/g, ''); if(num==true){return val;} var str = ''+val+''; var decs = ''; if(this.strstr(str,'.')){ var splode = str.split('.'); str = splode[0]; decs = splode[1]; } if(com==true){ var cnt = str.length; var digg = 0; price = ''; for(i=1;i<=cnt;i++){ var dig = str.substr(i*-1,1); if(digg==3){ digg = 0; price = ','+price; } price = dig+price; digg ++; } str = price; } if(dec>0){ len = decs.length; var newt = decs; if(len>dec){ newt = decs.substr(0,dec); }else if(len=0){return true;}else{return false;}} wpPluginBuilderClass.prototype.isset = function(elm){return jQuery(elm).length>0;} // [NOTE] initiate an instance of the class var wppb = new wpPluginBuilderClass('init'); } function wppb_toggle_settings_section(obj){var isopen = jQuery(obj).parent().hasClass("wppb-settingopen");if(isopen){jQuery(obj).children("span").html("+");jQuery(obj).parent().removeClass("wppb-settingopen");}else{jQuery(obj).children("span").html("- ");jQuery(obj).parent().addClass("wppb-settingopen");}} // SORTABLE LIST IF TEXT OBJECTS function sortablelist_command(method,id,input){ var current = document.getElementById(id+'_current').value; if(current==''){current = 0;} var fresh = false; var list = new Array(); if(method=='sort'){ if(current!='' || input=='add'){ list = sortablelist_get_list(id); var moving = false; var freshing = false; var newdex = Number(current); if(input=='up'){ newdex -= 1; moving = true; }else if(input=='down'){ newdex += 1; moving = true; }else if(input=='add'){ list.push(''); newdex = list.length-1; freshing = true; }else if(input=='delete'){ list.splice(current, 1); newdex = ''; freshing = true; } if(moving==true){ var maxdex = (list.length-1); if(newdex<0){newdex = 0;} if(newdex>maxdex){newdex = maxdex;} if(newdex!=current){ list = wppb.array_move(list,current,newdex); freshing = true; } } if(freshing==true){ document.getElementById(id+'_current').value = newdex; current = newdex; fresh = true; } } }else if(method=='select'){ jQuery('#'+id+'_content').children().removeClass('sortablelist-selected'); jQuery('#'+id+'_item_'+input).addClass('sortablelist-selected'); document.getElementById(id+'_current').value = input; } if(fresh==true){ //alert(list); jQuery('#'+id).val(list.join('[LIM]')); sortablelist_update_list(id,list,current); sortablelist_update_listout(id); if(input=='add'){ var obj = document.getElementById(id+'_item_'+current); sortablelist_dblclick(obj); } var field = jQuery('#'+id+'_field').val(); if(field!=''){ var val = jQuery('#'+id).val(); jQuery('#'+field).val(val); } } } function sortablelist_get_list(id){ var list = new Array(); var inputs = document.getElementsByName(id+'_item'); for (var i = 0; i < inputs.length; i++) { var itm = inputs[i].id; var html = inputs[i].innerHTML; list.push(html); } return list; } function sortablelist_update_list(id,list,current){ var listtxt = ''; var dbl = ' ondblclick="sortablelist_dblclick(this);"'; if(document.getElementById(id+'_editable').value=='false'){dbl = '';} for(dex in list){ var feat = list[dex]; var curtxt= ''; if(dex==current){curtxt = ' sortablelist-selected';} var listitem = '
'+feat+'
'; listtxt += listitem; } jQuery('#'+id+'_content').html(listtxt); } function sortablelist_update_listout(id){ var list = sortablelist_get_list(id); var listed = list.join('[LIM]'); jQuery('#'+id).val(listed); var lid = jQuery('#'+id+'_id').val(); var ajax = jQuery('#'+id+'_ajax').val(); if(lid!='' && ajax!=''){ var prams = new Array(); prams['id'] = lid; prams['value'] = listed; ajax_communication(ajax,function(com){sortablelist_ajax_return(com);},prams); } } function sortablelist_dblclick(obj){ var id = obj.id; var wid = jQuery('#'+id).width(); var txt = obj.innerHTML; newtxt = ''; obj.innerHTML = newtxt; jQuery('#'+id+'_temp').focus(); } function sortablelist_handle_input(obj){ var splt = obj.id.split('_item'); var id = splt[0]; sortablelist_clear_inputs(); sortablelist_update_listout(id); } function sortablelist_clear_inputs(){ var inputs = document.getElementsByName('temporary_input'); for (var i = 0; i < inputs.length; i++) { var itm = inputs[i].id; itm = itm.replace('_temp',''); var html = inputs[i].value; jQuery('#'+itm).html(html); } } function sortablelist_ajax_return(com){ //alert(com); } // FORM INPUT CHARACTER FILTERS function get_input_character(ev){ var keyv = window.event ? ev.keyCode : ev.which; var keychar = String.fromCharCode(keyv); return keychar; } function input_character_filter(ev,str,how){ var keyv = window.event ? ev.keyCode : ev.which; if(wppb.strstr(str,'0-9')){if(keyv>=96 && keyv<=105){return true;}} var ok = new Array(8,13,16,37,38,39,40,46); // backspace, enter, shift, arrows(37-40), delete if(wppb.in_array(ok,keyv)){return true;} var keychar = String.fromCharCode(keyv); if(how==1){var reg = RegExp("[^"+str+"]");}else{var reg = RegExp("["+str+"]");} return !reg.test(keychar); } function inputfilter_number(ev){return input_character_filter(ev,"0-9.",1);} function inputfilter_integer(ev){return input_character_filter(ev,"0-9",1);} function inputfilter_letters(ev){return input_character_filter(ev," A-Za-z",1);} function inputfilter_slug(ev){return input_character_filter(ev,"a-z",1);} function inputfilter_nopunctuation(ev){return input_character_filter(ev," 0-9A-Za-z",1);} function inputfilter_canonized(ev){return input_character_filter(ev," 0-9a-z",1);} function inputfilter_address(ev){return input_character_filter(ev," 0-9A-Za-z,.'\"_()#",1);} function inputfilter_phone(ev){return input_character_filter(ev,"0-9()",1);} function inputfilter_validatedphone(ev){return input_character_filter(ev,"0-9",1);} function inputfilter_safe(ev){return input_character_filter(ev," 0-9A-Za-z',._()#~!@$%*=+{}/<>",1);} function inputfilter_url(ev){return input_character_filter(ev,"0-9a-z:/._#~!@%=+?",1);} function inputfilter_email(ev){return input_character_filter(ev,"0-9A-Za-z._@",1);} function inputfilter_basic(ev){return input_character_filter(ev," 0-9A-Za-z._@!,?'=+#$%",1);} function inputfilter_login(ev){return input_character_filter(ev,"0-9A-Za-z._@!,?=+#$%",1);} function inputfilter_date(ev){return input_character_filter(ev,"0-9/ ",1);} function inputfilter_social(ev){return input_character_filter(ev,"0-9",1);} function inputfilter_domain(ev){return input_character_filter(ev,"0-9a-z.",1);} // AJAX functions and handlers var xmlhttp; if(window.XMLHttpRequest){AJAXcommunicationsupported = true;}else{AJAXcommunicationsupported = false;alert("Live form data saving is not fully supported in this browser. Some features of this website may not work as intended.");} function getXMLHttpRequest(){if(window.XMLHttpRequest){return new window.XMLHttpRequest;}else{try{return new ActiveXObject("MSXML2.XMLHTTP.3.0");}catch(ex){try{return new ActiveXObject("Microsoft.XMLHTTP");}catch(ex){return null;}}}} function ajax_communication(command,fct,params,type,sync){ if(type==null){ var type = "text"; //alert('here'); var file = ajaxurl; var pram = ""; xmlhttp = getXMLHttpRequest(); if(xmlhttp != null){ if(typeof params==="string"){ pram = "&"+params; }else{ for(p in params){ pram += "&"+p+"="+params[p]; } } var async = true; if(sync==false){var async = false;} var parameters = "action=wppb_ajax_communication&command="+command+pram; xmlhttp.open("POST",file,async); xmlhttp.commandtype = type; xmlhttp.commandfunction = fct;xmlhttp.onreadystatechange = ajax_communication_handler; xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); //xmlhttp.setRequestHeader("Content-type", "application/upload"); xmlhttp.setRequestHeader("Content-length", parameters.length); xmlhttp.setRequestHeader("Connection","close"); xmlhttp.send(parameters); } } } function ajax_parse_communication(icom){var RAT = new Array();if(icom!="" && icom.substr(0,1)=="["){var com = icom.substr(1);var coms = com.split("[");for(cc in coms){var dcom = coms[cc];var dcoms = dcom.split("]");var dex = dcoms[0];var data = dcoms[1];var dats = data.split("&");RAT[dex] = new Array();for(dd in dats){var fat = dats[dd];var fats = fat.split("=");var far = fats[0];var fal = fats[1];RAT[dex][far] = fal;}}}return RAT;} function ajax_communication_handler(incoming){if(xmlhttp.readyState==4){if(xmlhttp.status==200){var type = xmlhttp.commandtype;if(type=="xml"){var response = xmlhttp.responseXML;}else if(type=="text"){ var response = xmlhttp.responseText; var rep = response.substr(response.length-1); if(rep=='0' || rep==0){response = response.substring(0, response.length - 1);} }else{var response = ajax_parse_communication(xmlhttp.responseText);}xmlhttp.commandfunction(response);}}} function wppb_is_mobile(){ if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){return true;} if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0,4))) return true; return false; } function wppb_is_iDevice(){ if( /iPhone|iPad|iPod/i.test(navigator.userAgent) ) { return true; } return false; } function wppb_isFF(){ if(navigator.userAgent.toLowerCase().indexOf('firefox')>-1){return true;} return false; } function wppb_show_notice(title,message,tabs){ wppb_generate_notice(); if(title==null || title=='undefined'){var title = '';} if(message==null || message=='undefined'){var message = '';} if(tabs==null || tabs=='undefined'){var tabs = '';} if(message!=''){ jQuery('#wppbNotice').show(); jQuery('#wppbNoticeBG').show(); jQuery('#wppbNoticeTitle').html(title); jQuery('#wppbNoticeTabs').html(tabs); jQuery('#wppbNoticeContent').html(message); if(tabs==''){ jQuery('#wppbNoticeContent').css('min-height','20px'); jQuery('#wppbNoticeContent').css('min-width','100px'); }else{ jQuery('#wppbNoticeContent').css('min-height','60px'); jQuery('#wppbNoticeContent').css('min-width','300px'); } } } function wppb_cancel_notice(){ jQuery('#wppbNotice').hide(); jQuery('#wppbNoticeBG').hide(); jQuery('#wppbNoticeTitle').html(''); jQuery('#wppbNoticeTabs').html(''); jQuery('#wppbNoticeContent').html(''); } function wppb_generate_notice(){ if(jQuery('#wppbNotice').length==0){ var txt = ''; txt += ''; txt += '
'; txt += '
'; txt += '
'; txt += '
'; txt += '
'; txt += '
X
'; txt += '
'; txt += '
'; txt += '
'; txt += '
'; txt += '
'; jQuery('body').append(txt); } } function wppb_loading_ball(txt){ if(txt==null || txt=='undefined'){var txt = '';} var html = '
'; html += '
'+txt+'
'; html += '
'; return html; } function delimitit(input,delim,append){ if(input!=''){input += delim;} input += append; return input; } function explode(delim,str){ return str.split(delim); } function implode(delim,str){ return str.join(delim); } function str_replace(find, replace, str) { return str.replace(new RegExp(/find/, 'g'), replace); } var BAD_CHARS_64 = new Array('•','
','
','<','>','&','\\','"',"'",';','/','+'); var NEW_CHARS_64 = new Array('(_BL_)','(_BR_)','(_HR_)','(_LT_)','(_GT_)','(_AM_)','(_BS_)','(_DQ_)','(_SQ_)','(_SC_)','(_FS_)','(_PL_)'); function img_encrypt(nstr) { var cc; for(cc=0;cc','
','<','>','&','\\','"',"'",';'); var NEW_CHARS = new Array('(_BL_)','(_BR_)','(_HR_)','(_LT_)','(_GT_)','(_AM_)','(_BS_)','(_DQ_)','(_SQ_)','(_SC_)'); function htmlin(nstr) { var cc; for(cc=0;cc255){val = 255;} return val; } function tacg_is_composer_object(id){ if(id.substr(0,8)=='objedit_'){return true;} return false; } function tacg_hilite_picker(id){ //alert(id); jQuery('.nodewrap').removeClass('hilite'); if(id!=null){jQuery('#'+id+'_wrap').addClass('hilite');} } // this function does nothing by default, just there to let settings with no action trigger the unsaved changes flag function tacg_refset(){} function tacg_execute_onedit(id,val,flag){ if(flag!='temp'){jQuery('#'+id).val(val);} var fct = jQuery('#'+id).attr('data-onedit'); if(fct==''){fct = 'tacg_refset();';} if(fct!='' && fct!=null){ fct = fct.replace('[[VALUE]]',val); eval(fct); if(flag!='temp'){tacg_unsaved_changes();} } } var tacgTimedOnEdit = 0; var tacgTimedOnEditID = null; var tacgTimedOnEditVal = null; var tacgTimedOnEditFlag = null; var tacgTimedOnEditComs = null; var tacgTimedOnEditInterval = setInterval(function(){tacg_timed_onedit_trigger()},100); function tacg_timed_onedit(id,val,flag,coms){ // if somehow another field was being edited, trigger it's change then switch if(tacgTimedOnEditID!=null && tacgTimedOnEditID!=id){tacg_timed_onedit_trigger();} if(id=='pageorpost-title' || id=='archive-title'){ if(!jQuery('#LOADER_'+id).length>0){ jQuery('#'+id+'_wrap').append(wppb_loader(id)); } } tacgTimedOnEdit = 10; tacgTimedOnEditID = id; tacgTimedOnEditVal = val; tacgTimedOnEditFlag = flag; tacgTimedOnEditComs = coms; } function tacg_timed_onedit_trigger(){ if(tacgTimedOnEdit>0){ tacgTimedOnEdit -= 1; if(tacgTimedOnEdit==0){ var id = tacgTimedOnEditID; var val = tacgTimedOnEditVal; var flag = tacgTimedOnEditFlag; var coms = tacgTimedOnEditComs; tacgTimedOnEditID = null; tacgTimedOnEditVal = null; tacgTimedOnEditFlag = null; tacgTimedOnEditComs = null; if(flag=='alt'){ tacg_execute_onedit(id,val,'temp'); }else{ tacg_execute_onedit(id,val,flag); } } } } function tacg_live_pagetitle_edit(id,com){ var prams = new Array(); prams['id'] = id; prams['txt'] = com; prams['pagetype'] = wppb_type; prams['postid'] = wppb_postid; prams['termid'] = wppb_termid; ajax_communication('ajax_live_editor',function(){tacg_live_pagetitle_edit_return(id,com);},prams); } function tacg_live_pagetitle_edit_return(id,com){ wppb_loader_remove(); jQuery('.'+id).html(com); jQuery('.refresh-required').show(); } function tacg_execute_onclear(id,flag){ var fct = jQuery('#'+id).attr('data-onclear'); if(fct!=''){eval(fct);} if(flag!='temp'){tacg_unsaved_changes();} } function tacg_get_editor_type(obj){ var type = ''; if(jQuery(obj).hasClass('aseditor')){ type = 'editor'; }else if(jQuery(obj).hasClass('ashtml')){ type = 'html'; }else if(jQuery(obj).hasClass('astext')){ type = 'text'; }else if(jQuery(obj).hasClass('asimg')){ type = 'img'; }else if(jQuery(obj).hasClass('asbgimg')){ type = 'bgimg'; }else if(jQuery(obj).hasClass('ascolor')){ type = 'color'; } return type; } function tacg_notification(txt){ if(txt=='' || txt==null){ wppb_loader_remove(); jQuery('#NotifyWindowBG').hide(); jQuery('#NotifyWindowFG').hide(); jQuery('body, html').removeClass('bodyflow'); }else{ jQuery('#NotifyWindow').html(txt); jQuery('#NotifyWindowBG').show(); jQuery('#NotifyWindowFG').show(); jQuery('body, html').addClass('bodyflow'); } } function tacg_save_live_editor(){ tacg_clear_objects(); var nodes = new Array(); var prams = new Array(); var fresh = false; var arr = jQuery('#LiveEditorForm').find('.datanode'); for(i in arr){ var id = arr[i].id; if(id!=undefined){ var val = jQuery('#'+id).val(); var was = jQuery('#'+id).attr('data-was'); var flag = jQuery('#'+id).attr('data-flag'); var chg = jQuery('#'+id+'_css').html(); if(val!=was || chg!='' || flag==1){ nodes.push(id); var typ = jQuery('#'+id).attr('data-nodetype'); var onsave = jQuery('#'+id).attr('data-onsave'); if(onsave=='refresh'){fresh = true;} var val = ''; if(typ=='checkbox'){ if(jQuery('#'+id+'_in').is(':checked')){val = 1;} }else{ val = jQuery('#'+id).val(); } //alert(id+' = '+val); prams[id] = val; jQuery('#'+id).attr('data-was',val); jQuery('#'+id).attr('data-flag',0); jQuery('#'+id+'_css').removeClass('tempInit'); jQuery('#'+id+'_css').addClass('tempSaved'); } } } if(nodes.length>0){ prams['nodes'] = nodes.join(','); prams['postid'] = wppb_postid; var note = 'Saving changes...'; tacg_unsaved_changes(); if(fresh==true){note = 'Saving changes, you will have to refresh your browser to view all changes';} tacg_noticeloader(note); ajax_communication('ajax_live_editor',function(com){tacg_notification();},prams); }else{ alert('No changes have been made.'); } } function tacg_temp_class(id,tgt,css,how,not){ var style = ''; if(how=='link'){ style = '.'+id+'_temp, .'+id+'_temp:link, .'+id+'_temp:active, .'+id+'_temp:visited{'+css+'}'; }else if(how=='hover'){ style = '.'+id+'_temp:hover{'+css+'}'; }else{ style = '.'+id+'_temp{'+css+'}'; } jQuery('#'+id+'_css').html(''); jQuery(tgt).removeClass(id+'_temp'); if(not!=null){ jQuery(tgt).not(not).addClass(id+'_temp'); }else{ jQuery(tgt).addClass(id+'_temp'); } } function tacg_toggle_editor_bar(obj,id){ if(id==null){var leid = obj.id;}else{var leid = id;} var id = leid.replace('LE_',''); tacg_clear_editor_bars(); if(jQuery('#LE_'+id+'_sub').is(':visible')){ jQuery('#LE_'+id+'_sub').slideUp(); jQuery('#LE_'+id).removeClass('isopen'); }else{ jQuery('.live-editor-box').slideUp(); jQuery('#LE_'+id+'_sub').slideDown(); jQuery('#LE_'+id).addClass('isopen'); if(id=='social_editor'){tacg_buttonbar_dragup();} if(id=='banner' || id=='titlebar' || id=='sub-header' || id=='social_editor' || id=='footer'){ var sctop = 0; if(id=='footer'){sctop = jQuery('#footer').offset().top;} jQuery('html,body').animate({scrollTop:sctop}); } } } function tacg_toggle_live_editor(){ if(editorIsOn){ if(tacg_unsaved_changes()=='editor'){ if(confirm('You have an open editor window, which may contain UNSAVED CHANGES, are you sure you wish to close the Website Editor and refresh the page?')){overridePrompt = true;tacg_reload();} }else if(tacg_unsaved_changes()){ if(confirm('You have UNSAVED CHANGES, are you sure you wish to close the Website Editor and refresh the page?')){overridePrompt = true;tacg_reload();} }else{ editorIsOn = false; tacg_clear_objects(); tacg_manager_close(); jQuery('#LiveEditor').hide(); jQuery('body').removeClass('editorison'); jQuery('body').removeClass('settingison'); jQuery('.composerison').removeClass('composerison'); jQuery('.editlocation').removeClass('editlocation'); jQuery('#objectEditorBar').removeClass('composerpreview'); } }else{ editorIsOn = true; jQuery('#LiveEditor').show(); jQuery('body').addClass('editorison'); if(isnonamp==true){jQuery('body').addClass('isnonamp');} } tacg_position(); } function tacg_live_editor_hides(id,tgt){ if(tgt==null){var tgt = '.'+id.replace('_hide_','-');} if(jQuery('#'+id+'_in').is(':checked')){ tacg_temp_class(id,tgt,'display:none;'); }else{ if(id=='header_hidetitlebar' && tacgTheme=='base'){ // do nothing for now }else{ tacg_temp_class(id,tgt,'display:block;'); } } } function tacg_live_logo(id,src){ if(id=='clear'){ jQuery('#'+id).val(''); jQuery('.headerlogo').attr('src',''); jQuery('#logo').hide(); jQuery('.banner, .bloginfo').removeClass('haslogo'); }else{ if(id=='cancel'){var src = jQuery('#header_logoimage').attr('data-was');} jQuery('.headerlogo').attr('src',src); if(src==''){ jQuery('#logo').hide(); jQuery('.banner, .bloginfo').removeClass('haslogo'); }else{ jQuery('#logo').show(); jQuery('.banner, .bloginfo').addClass('haslogo'); var dims = tacgSelectedImageDims.split('x'); var wid = Number(dims[0]); var hit = Number(dims[1]); var pad = (wid+40); jQuery('.headerlogo').css('max-width',wid+'px'); jQuery('.bloginfo.haslogo').css('padding-left',pad+'px'); } } } function tacg_live_logopos(id){ var disp = 'left'; if(jQuery('#'+id+'_in').is(':checked')){disp = 'center';} tacg_temp_class(id,'#logo','text-align:'+disp+' !important;'); } function tacg_live_postsdisplaymode(how,val){ var hit = jQuery('#site_postsdisplayheight').val(); var mode = jQuery('#site_postsdisplaymode').val(); var height = hit+'px'; var isimg = false; var isart = false; if(mode.substr(0,5)=='image'){isimg = true;} if(mode.substr(0,7)=='article'){isart = true;} if(how=='height'){ height = val+'px'; }else{ var tgt = '.archive-posts'; jQuery(tgt).removeClass('posts-article'); jQuery(tgt).removeClass('posts-articlela'); jQuery(tgt).removeClass('posts-articlefw'); jQuery(tgt).removeClass('posts-articleno'); jQuery(tgt).removeClass('posts-articlehd'); jQuery(tgt).removeClass('posts-imagev1'); jQuery(tgt).removeClass('posts-imagev2'); jQuery(tgt).removeClass('posts-image'); jQuery(tgt).removeClass('posts-onethree'); jQuery(tgt).removeClass('posts-thumbnail'); jQuery(tgt).addClass('posts-'+val); jQuery(tgt+' .block').addClass('reflagged'); if(isimg){jQuery(tgt).addClass('posts-image');} if(isart){jQuery(tgt).addClass('posts-article');} } if(isimg==false){height = 'unset';} tacg_temp_class('site_postsdisplaymode','.archive-posts.posts-image .block-content, .author-box .posts-mod.posts-image .block-wrap','height:'+height+' !important;'); // tacg_responsive_images(); } function tacg_live_submenuborderhide(com){ if(com=='true'){ jQuery('.navigatorbar .sub-menu, .navigatorbar .sub-menu li').css('border-width',0); jQuery('.navigatorbar .sub-menu li .sub-menu').css('margin-top',0); }else{ jQuery('.navigatorbar .sub-menu, .navigatorbar .sub-menu li').css('border-width','1px'); jQuery('.navigatorbar .sub-menu li .sub-menu').css('margin-top','-1px'); } } function tacg_live_boldlast(com){ if(com=='true'){ jQuery('.lastcrumb').css('font-weight','bold'); }else{ jQuery('.lastcrumb').css('font-weight','normal'); } } function tacg_live_breadcrumbhide(com){ if(com=='true'){ jQuery('.breadcrumbs').hide(); }else{ jQuery('.breadcrumbs').show(); } } function tacg_live_breadcrumbsep(val){ if(val.substr(0,3)=='fa-'){var val = '';} jQuery('.crumbsep').html(val); } function tacg_live_footerhide(id){ var bid = id.replace('footer_hide',''); if(bid=='lower'){bid = 'mega';} if(jQuery('#'+id+'_in').is(':checked')){ jQuery('#'+bid+'-footer').hide(); }else{ jQuery('#'+bid+'-footer').show(); } } function tacg_live_articleborder(){ if(jQuery('#site_postsdisplayborder_in').is(':checked')){ jQuery('.posts-article:not(.posts-author)').addClass('bordered'); }else{ jQuery('.posts-article:not(.posts-author)').removeClass('bordered'); } } function tacg_live_hidebyline(){ if(jQuery('#site_hidebyline_in').is(':checked')){ jQuery('.posts-mod').addClass('nobyline'); jQuery('.posts-mod').removeClass('hasbyline'); }else{ jQuery('.posts-mod').removeClass('nobyline'); jQuery('.posts-mod').addClass('hasbyline'); } } function tacg_live_hidesearch(){ if(jQuery('#subheader_hidesearch_in').is(':checked')){ jQuery('#ampsearchform').addClass('nosearch'); jQuery('#ampsearchform').removeClass('hassearch'); }else{ jQuery('#ampsearchform').removeClass('nosearch'); jQuery('#ampsearchform').addClass('hassearch'); } } function tacg_live_layout(id){ var val = jQuery('#site_layout').val(); tacgTheme = val; jQuery('body').removeClass('layout_base'); jQuery('body').removeClass('layout_image'); jQuery('body').removeClass('layout_banner'); jQuery('body').removeClass('layout_sidebar'); jQuery('body').addClass('layout_'+val); tacg_position(); } function tacg_live_socialstyle(id,com){ if(id=='social_footerstyle'){ var tgt = '.socfoot'; jQuery(tgt).removeClass('circle'); jQuery(tgt).removeClass('square'); }else if(id=='social_footersize'){ var tgt = '.socfoot'; jQuery(tgt).removeClass('big'); jQuery(tgt).removeClass('bigger'); jQuery(tgt).removeClass('biggest'); }else{ var tgt = '.socmenu'; jQuery(tgt).removeClass('circle'); jQuery(tgt).removeClass('square'); } if(com!=''){jQuery(tgt).addClass(com);} } // LOADER ANIMATION WRAPPER function wppb_loader(id,mess){ if(!jQuery('#LOADER_'+id).length>0){ return '
'+wppb_loading_ball(mess)+'
'; } } function wppb_loader_remove(id){ if(id==null){ jQuery('.wppb-loader').remove(); }else{ jQuery('#LOADER_'+id).remove(); } } function tacg_provider_opts(prov){ if(prov==null){var prov = '';} jQuery('.varopt').hide(); jQuery('.varopt.prov-'+prov).show(); } function tacg_live_setting(id,val){ if(!jQuery('#LOADER_'+id).is(':visible')){jQuery('#'+id+'_wrap').append(wppb_loader(id));} var typ = jQuery('#'+id).attr('data-nodetype'); jQuery('#LOADER_'+id).addClass('wpl_'+typ); if(id=='HideSidebar'){tacg_live_sidebar(id,val);} var prams = new Array(); prams['typ'] = 'setting'; prams['id'] = id; prams['txt'] = val; prams['pagetype'] = wppb_type; prams['postid'] = wppb_postid; prams['termid'] = wppb_termid; var reloading = false; var prenot = ''; var postnot = ''; if(id=='featuredimage'){ reloading = true; var prenot = 'Assigning image'; var postnot = 'Image assigned'; if(val==''){ prenot = 'Clearing image'; postnot = 'Image cleared'; } } if(id=='HideFeaturedImage'){ if(jQuery('.wp-post-image').length>0){ jQuery('.wp-post-image').toggle(); }else{ jQuery('#pageorpost-content').addClass('reflagged'); } } if(id=='NonAMP'){ if(val=='true'){ jQuery('body').addClass('isnonamp'); }else{ jQuery('body').removeClass('isnonamp'); } } if(reloading==true){ tacg_notification(prenot+', the page will automatically refresh...'); ajax_communication('ajax_live_editor',function(com){tacg_reload(postnot+', refreshing browser...')},prams); }else{ ajax_communication('ajax_live_editor',function(com){wppb_loader_remove(id);},prams); } } function tacg_restore_defaults(){ if(confirm('Are you sure you wish to RESTORE DEFAULT SETTINGS? This only affects your styling and settings, it will not affect anything created in the "Composer".')){ var prams = new Array(); ajax_communication('ajax_restore_defaults',function(com){tacg_reload();},prams); } } function tacg_amp_preview(how){// started from generate_live_editor() tacg_noticeloader('Opening Preview Generator'); var prams = new Array(); prams['how'] = how; prams['url'] = wppb_url; ajax_communication('ajax_amp_preview',function(com){tacg_amp_preview_return(com);},prams); } function tacg_amp_preview_return(com){ tacg_notification(); tacg_preview(com); //jQuery('#arcpvlink').hide(); //jQuery('#amppvlink').show(); } function tacg_preview(txt){ if(txt=='' || txt==null){ wppb_loader_remove(); jQuery('#PreviewWindowBG').hide(); jQuery('#PreviewWindowFG').hide(); jQuery('body, html').removeClass('bodyflow'); }else{ jQuery('#PreviewWindow').html(txt); jQuery('#PreviewWindowBG').show(); jQuery('#PreviewWindowFG').show(); jQuery('body, html').addClass('bodyflow'); } } function tacg_preview_adjust(how){ jQuery('#PreviewWindowDevice').removeClass('astablet'); jQuery('#PreviewWindowDevice').removeClass('asmobile'); jQuery('#PreviewWindowDevice').removeClass('astabletflip'); jQuery('#PreviewWindowDevice').removeClass('asmobileflip'); jQuery('#PreviewWindowDevice').addClass('as'+how); } function tacg_noticeloader(txt){ if(txt==null){var txt = 'Processing...';} tacg_notification(wppb_loader('noticeloader',txt)); } function tacg_html_editor_fa(where){ tacg_noticeloader('Loading Font Awesome Library'); var prams = new Array(); prams['where'] = where; ajax_communication('ajax_choose_fontawesome',function(com){tacg_html_editor_fa_return(com);},prams); } function tacg_html_editor_fa_return(com){ tacg_notification(com); } function tacg_html_editor_fa_insert(obj){ tacg_notification(); var icon = jQuery(obj).attr('data-icon'); if(icon==''){ alert('ERROR'); }else{ tacg_html_editor_insert('  '); } } function tacg_html_editor_insert(com){ tinymce.activeEditor.execCommand('mceInsertContent','tacgwpeditor',com); } function tacg_fa_over(obj){ var icon = jQuery(obj).attr('data-icon'); icon = icon.substr(3); jQuery('#fachoosernote').html(icon); } function tacg_fa_out(obj){ jQuery('#fachoosernote').html(''); } function tacg_mobile_menu_block(type){ tacg_unsaved_changes(); if(type=='customhtml'){ var html = jQuery('#mobilemenu_custom_in').val(); tacg_mobile_menu_block_return(html); }else{ var prams = new Array(); prams['type'] = type; ajax_communication('ajax_mobile_menu_block',function(com){tacg_mobile_menu_block_return(com);},prams); } } function tacg_mobile_menu_block_return(com){ jQuery('#mobile-navmenu-preview').html(com); tacg_navmenu_ops('open'); } function tacg_filter_icons(){ var id = 'fachooserfilter'; var val = jQuery('#'+id).val(); if(val.length>=2){ jQuery('.fabutton').hide(); jQuery(".fabutton[data-icon*='"+val+"']").show(); }else{ jQuery('.fabutton').show(); } } function tacg_reload(txt){ if(txt==null){var txt = 'Refreshing browser...';} tacg_notification(); tacg_noticeloader(txt); document.location.reload(); } // WPTASK - when sidebar is integrated in theme, this needs to be enabled and fixed for lack of plugin function tacg_live_sidebar(id,hide){ var ect = false; if(hide==null){ var hide = false; if(jQuery('#'+id+'_in').is(':checked')){hide = true;} }else if(hide=='empty'){ ect = true; var a0 = jQuery('#widgetsb').html(); var a1 = jQuery('#sitewidesidebarhead .obj-inner').html(); var a2 = jQuery('#sidebarmain .obj-inner').html(); var a3 = jQuery('#sitewidesidebarfoot .obj-inner').html(); if(a0=='' && a1=='' && a2=='' && a3==''){hide = true;}else{hide = false;} } if(hide==true || hide=='true'){ jQuery('#pageorpost-content').removeClass('sidebarred'); jQuery('.archive-posts').removeClass('sidebarred'); if(ect==true){ jQuery('.sidebar').addClass('empty'); }else{ jQuery('.sidebar').addClass('dimmed'); } }else{ jQuery('#pageorpost-content').addClass('sidebarred'); jQuery('.archive-posts').addClass('sidebarred'); if(ect==true){ jQuery('.sidebar').removeClass('empty'); }else{ jQuery('.sidebar').removeClass('dimmed'); } } } function tacg_live_bgimagerepeat(id){ var reps = 'no-repeat'; var bsz = 'background-size:cover;'; if(jQuery('#'+id+'_in').is(':checked')){reps = 'repeat';bsz = 'background-size:auto;';} var tgt = ''; var attach = 'scroll'; if(id=='header_bgimagerepeat'){ tgt = '.banner'; }else if(id=='footer_bgimagerepeat'){ tgt = '.footer'; }else if(id=='site_bgimagerepeat'){ tgt = 'body'; var rep = jQuery('#'+id+'_in').val(); reps = rep; if(rep=='fixed'){reps = 'no-repeat';attach = 'fixed';} } if(tgt!=''){tacg_temp_class(id,tgt,'background-repeat:'+reps+';background-attachment:'+attach+';'+bsz);} } function tacg_live_titleblock(){ var val = jQuery('#site_tbkdisplay_in').val(); var clr = jQuery('#site_tbkbgcolor_in').val(); var modes = new Array('tabbed','solid','slash','hashed'); for(i in modes){var mode = modes[i];jQuery('.titleblock').removeClass(mode);} for(i=1;i<5;i++){jQuery('.titleblock').removeClass('hashed'+i);} for(i=1;i<4;i++){jQuery('.titleblock').removeClass('slash'+i);} if(val.substr(0,6)=='hashed'){jQuery('.titleblock').addClass('hashed');} if(val.substr(0,5)=='slash'){jQuery('.titleblock').addClass('slash');} jQuery('.titleblock').addClass(val); } function tacg_buttonbar_fa_insert(obj){ tacg_notification(); var icon = jQuery(obj).attr('data-icon'); if(icon==''){ alert('ERROR'); }else{ if(jQuery('#bbitem').is(':visible')){ alert('That icon already exists in the Button Bar.'); }else{ var ibox = tacg_buttonbar_button(icon); jQuery('#buttonbar_mgr').append(ibox); tacg_buttonbar_dragup(); //tacg_buttonbar_update(); } } } function tacg_buttonbar_button(icon,url,ttl){ if(url==null){var url = '';} if(ttl==null){var ttl = '';} jQuery('.buttonbar_item').removeClass('editing'); var ibox = '
'; ibox += '
'; ibox += '
'; ibox += '
'; ibox += '
'; ibox += '
EMPTY URL
'; ibox += '
INVALID URL
'; ibox += '
'; ibox += 'Link URL'; ibox += ''; ibox += 'Title (SEO information)'; ibox += ''; ibox += '
'; ibox += '
'; return ibox; } function tacg_socialbar_button(icon,url,ttl){ var cls = ''; if(icon=='fa-rss'){cls = ' rss';} return '
  •  
  • '; } function tacg_buttonbar_edit(icon,how){ var ups = true; if(how=='edit'){ ups = false; jQuery('#bbitem_'+icon).addClass('editing'); }else if(how=='save'){ ups = false; var isvalid = true; var btnurl = jQuery('#bbin_url_'+icon).val(); jQuery('#bbitem_'+icon).removeClass('invalid'); jQuery('#bbitem_'+icon).removeClass('invalidated'); if(btnurl==''){ isvalid = false; jQuery('#bbitem_'+icon).addClass('invalid'); }else if(!validateURL(btnurl)){ isvalid = false; jQuery('#bbitem_'+icon).addClass('invalidated'); } if(isvalid){ ups = true; jQuery('#bbitem_'+icon).removeClass('editing'); } }else if(how=='delete'){ jQuery('#bbitem_'+icon).remove(); } if(ups){tacg_buttonbar_update();} } function tacg_buttonbar_update(){ var btns = new Array(); var socs = new Array(); var txt = ''; jQuery('.buttonbar_item').each(function(index){ var icon = jQuery(this).attr('data-icon'); var url = jQuery('#bbin_url_'+icon).val(); var ttl = jQuery('#bbin_ttl_'+icon).val(); btns.push(icon+'[DD]'+url+'[DD]'+ttl); txt += tacg_socialbar_button(icon,url,ttl); }); var rss = jQuery('#social_rssfeed').val(); if(rss!='true' && rss!='1'){txt += tacg_socialbar_button('fa-rss',wppb_basepath+'feed','Click to open the site RSS feed.');} list = btns.join('[JJ]'); jQuery('#social_buttonlist').val(list); jQuery('.socialbar').html(txt); tacg_unsaved_changes(); } function tacg_buttonbar_dragup(){ jQuery('#buttonbar_mgr').sortable({ update: function(event, ui){ tacg_buttonbar_update(); } }); } function tacg_refresh_flag(tgt,ref){ if(ref=='clear'){ jQuery(tgt).removeClass('reflagged'); }else{ jQuery(tgt).addClass('reflagged'); } } function tacg_lestat(how){ if(how=='save'){ jQuery('#LiveEditorStat .lestat').html('You have made unsaved changes to your Site Settings.'); jQuery('#LiveEditorStat .saveit').show(); jQuery('#LiveEditorStat').show(); }else if(how=='unsave'){ jQuery('#LiveEditorStat .lestat').html(''); jQuery('#LiveEditorStat .saveit').hide(); jQuery('#LiveEditorStat').hide(); }else if(how==null){ jQuery('#LiveEditorStat .lestat').html(''); jQuery('#LiveEditorStat').hide(); }else{ jQuery('#LiveEditorStat .lestat').html(how); jQuery('#LiveEditorStat').show(); } } var tacgContentEditor; function tacg_content_editor_toggle(id){ if(tacgContentEditor==id){ tacgContentEditor = null; jQuery('body').removeClass('composerison'); jQuery('body').removeClass('settingison'); }else{ tacgContentEditor = id; if(id=='editor'){ jQuery('body').addClass('settingison'); jQuery('body').removeClass('composerison'); jQuery('#LiveEditorForm').show(); }else if(id=='composer' || id=='page'){ if(id=='page'){ var opn = 'Accessing API'; }else{ var opn = 'Opening Live Composer'; } if(jQuery('#ComposerContent').html()==''){ tacg_lestat('
    '+wppb_loader('ldr',opn+'...')+'
    '); var prams = new Array(); prams['id'] = id; prams['slug'] = wppb_slug; prams['pagetype'] = wppb_type; prams['postid'] = wppb_postid; prams['termid'] = wppb_termid; ajax_communication('ajax_content_editor',function(com){tacg_handle_composer(com);},prams); }else{ jQuery('body').addClass('composerison'); jQuery('body').removeClass('settingison'); } } } } function tacg_handle_composer(com){ tacg_notification(); tacg_lestat(); jQuery('#ComposerContent').html(com); jQuery('body').addClass('composerison'); jQuery('body').removeClass('settingison'); tacg_position(); } function tacg_manager_open(mgr,ttl,id){tacg_open_editor_window(ttl,wppb_loader('ldr','Opening '+ttl+'...'));} function tacg_manager_close(){tacg_close_editor_window();} function tacg_manager_text(com){jQuery('#LiveEditorWindowContent').html(com);} function tacg_open_editor_window(ttl,txt){ jQuery('#LiveEditorWindowTitle').html(ttl); jQuery('#LiveEditorWindowContent').html(txt); jQuery('body').addClass('windowison'); } function tacg_close_editor_window(){ jQuery('#LiveEditorWindowTitle').html(''); jQuery('#LiveEditorWindowContent').html(''); jQuery('body').removeClass('windowison'); } var tacgSelectedImageDims = null; function tacg_library_open(id){ var obj = jQuery("#"+id); var send_attachment_bkp = wp.media.editor.send.attachment; _custom_media = true; wp.media.editor.send.attachment = function(props,attachment){ if(_custom_media){ var src = attachment.url; jQuery("#"+id).val(src); jQuery('#'+id).attr('data-flag',1); jQuery('#browserZonePreview_'+id+' img').attr('src',src); tacgSelectedImageDims = attachment.width+'x'+attachment.height; if(!tacg_is_composer_object(id)){tacg_unsaved_changes();} tacg_execute_onedit(id,src,'temp'); // tacg_responsive_images(); }else{ return _orig_send_attachment.apply(this,[props,attachment]); }; } wp.media.editor.open(obj); } function validateURL(textval) { var urlregex = /^(https?|ftp):\/\/([a-zA-Z0-9.-]+(:[a-zA-Z0-9.&%$-]+)*@)*((25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3}|([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(:[0-9]+)*(\/($|[a-zA-Z0-9.,?'\\+&%$#=~_-]+))*$/; return urlregex.test(textval); }