javascript - Need help converting from prototype to jQuery -
i need converting below code. have software uses prototype really conflicts jquery. have used online auto scripts translate code, did nothing, tried manually don't have enough knowledge, , tried using $.noconflict had no effect, , no help. - please if can code below:
var menulist = new array(); var buttonlist = new array(); var scriptlist = new array(); /* ajax post request */ function scriptdoloadpost(scripturl, scriptform, scriptpos, scriptargs, noloading) { if(!scriptargs){ var scriptargs = ''; } scriptargs = $(scriptform).serialize() + scriptargs; myajax = new ajax.updater(scriptpos, scripturl, { method : 'post', parameters : scriptargs, evalscripts : true, onloading: function(request){ showloadingicon(scriptpos, noloading); }, insertion : insertion.append }); } /* ajax request */ function scriptdoload(scripturl, scriptpos, scriptargs, noloading) { myajax = new ajax.updater(scriptpos, scripturl, { method : 'get', parameters : scriptargs, evalscripts : true, onloading : function(request){ showloadingicon(scriptpos, noloading); }, insertion : insertion.append }); } function createcookie(name,value,days) { if (days) { var date = new date(); date.settime(date.gettime()+(days*24*60*60*1000)); var expires = "; expires="+date.togmtstring(); } else var expires = ""; document.cookie = name+"="+value+expires+"; path=/"; } function readcookie(name) { var nameeq = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charat(0)==' ') c = c.substring(1,c.length); if (c.indexof(nameeq) == 0) return c.substring(nameeq.length,c.length); } return null; } function erasecookie(name) { createcookie(name,"",-1); } /* site map request */ function sitemapdoloadpost(scripturl, scriptform, scriptpos, scriptargs, noloading) { hidediv('proceed'); showdiv('message'); if(!scriptargs){ var scriptargs = ''; } scriptargs = $(scriptform).serialize() + scriptargs; myajax = new ajax.updater(scriptpos, scripturl, { method : 'post', parameters : scriptargs, evalscripts : true, onloading: function(request){ showloadingicon(scriptpos, noloading); } }); } /* onloading image icon function */ function showloadingicon(scriptpos,noloading){ loading = 0; contentdiv = ""; switch (scriptpos){ case "content": contentdiv = '<div id="loading_content"></div>'; loading = 1; break; case "subcontent": contentdiv = '<div id="loading_subcontent"></div>'; loading = 1; break; case "contentframe": contentdiv = '<div id="loading_content_frame"></div>'; loading = 1; break; case "subcontmed": contentdiv = '<div id="loading_subcontmed"></div>'; loading = 1; break; case "newsalert": contentdiv = '<div id="loading_longthin"></div>'; loading = 1; break; default : contentdiv = '<div id="loading_rankarea"></div>'; loading = 1; break; } if((loading == 1) && (noloading != 1)){ document.getelementbyid(scriptpos).innerhtml = contentdiv; } } function confirmload(scripturl, scriptpos, scriptargs) { if (chkobject('wantproceed')) { wantproceed = "do want proceed?"; } var agree = confirm(wantproceed); if (agree) return scriptdoload(scripturl, scriptpos, scriptargs); else return false; } function confirmsubmit(scripturl, scriptform, scriptpos, scriptargs) { if(!scriptargs){ var scriptargs = ''; } if (chkobject('wantproceed')) { wantproceed = "do want proceed?"; } var agree = confirm(wantproceed); if (agree) return scriptdoloadpost(scripturl, scriptform, scriptpos, scriptargs); else return false; } function doaction(scripturl, scriptpos, scriptargs, actiondiv) { actval = document.getelementbyid(actiondiv).value; scriptargs += "&sec=" + actval; switch (actval) { case "select": break; case "checkstatus": case "edit": case "reports": case "viewreports": case "pagedetails": scriptdoload(scripturl, scriptpos, scriptargs); break; default: /* check whether system demo or not */ if(spdemo){ if((actval == 'delete') || (actval == 'activate') || (actval == 'inactivate') || (actval == 'recheckreport') || (actval == 'showrunproject') || (actval == 'checkscore') || (actval == 'deletepage') || (actval == 'upgrade') || (actval == 'reinstall') ){ alertdemomsg(); } } confirmload(scripturl, scriptpos, scriptargs); break; } } function doload(argval, scripturl, scriptpos, scriptargs) { actval = document.getelementbyid(argval).value; scriptargs += "&"+ argval +"=" + actval; scriptdoload(scripturl, scriptpos, scriptargs); } function doloadurl(argval, scripturl) { actval = document.getelementbyid(argval).value; window.location = scripturl += "&"+ argval +"=" + actval; } /* func show hide menu */ function showmenu(button, scriptpos){ (var i=0; i<menulist.length; i++) { if(menulist[i] == scriptpos){ var = document.getelementbyid(button).src; if(but.match("more") == "more"){ = but.replace(/more/,"hide"); document.getelementbyid(scriptpos).style.display = ''; document.getelementbyid(button).src = but; // load default script if(typeof(scriptlist[i]) != "undefined") { scriptdoload(scriptlist[i], 'content') } }else{ = but.replace(/hide/,"more"); document.getelementbyid(scriptpos).style.display = 'none'; document.getelementbyid(button).src = but; } }else{ var butclose = document.getelementbyid(buttonlist[i]).src; if(butclose.match("hide") == "hide"){ butclose = butclose.replace(/hide/,"more"); document.getelementbyid(menulist[i]).style.display = 'none'; document.getelementbyid(buttonlist[i]).src = butclose; } } } } function updatearea(scriptpos, content) { document.getelementbyid(scriptpos).innerhtml += content; } function chkobject(theval) { if (document.getelementbyid(theval) != null) { return true; } else { return false; } } function checksubmitinfo(scripturl, scriptform, scriptpos, catcol) { if(chkobject('captcha')){ value = document.getelementbyid('captcha').value; if (value==null||value==""){ alert('please enter code shown'); return false; } } var obj = document.getelementsbyname(catcol).item(0); value = obj.value; if (value==null||value==""||value==0){ alert('please select category'); return false; } scriptdoloadpost(scripturl, scriptform, scriptpos); } function loadjscssfile(filename, filetype){ if (filetype=="js"){ //if filename external javascript file var fileref=document.createelement('script') fileref.setattribute("type","text/javascript") fileref.setattribute("src", filename) }else if (filetype=="css"){ //if filename external css file var fileref=document.createelement("link") fileref.setattribute("rel", "stylesheet") fileref.setattribute("type", "text/css") fileref.setattribute("href", filename) } if (typeof fileref!="undefined") document.getelementsbytagname("head")[0].appendchild(fileref) } function hidediv(scriptpos){ document.getelementbyid(scriptpos).style.display = 'none'; } function showdiv(scriptpos){ document.getelementbyid(scriptpos).style.display = ''; } function crawlmetadata(url,scriptpos) { weburl = document.getelementbyid('weburl').value; if(weburl==null||weburl==""||weburl==0){ alert('website url empty!'); }else{ url = url + "&url=" + escape(weburl); scriptdoload(url, scriptpos); } } function hidenewsbox(scriptpos, cookievar, cookieval) { hidediv(scriptpos); createcookie(cookievar, cookieval, 1); } function alertdemomsg(){ if(spdemo){ alert('some features disabled in demo system due security threats. please download , install seo panel enjoy full features.'); exit; } } function checkdirectoryfilter(checkid, scripturl, scriptpos){ var nofilter = 0; if(document.getelementbyid(checkid).checked){ nofilter = 1; } scripturl = scripturl + "&" + checkid + "=" + nofilter; scriptdoload(scripturl, scriptpos); } function checklist(checkid) { checkall = document.getelementbyid(checkid).checked; (i = 0; < document.listform.elements.length; i++){ if(document.listform.elements[i].type=="checkbox") { document.listform.elements[i].checked = checkall ? true : false; } } } function selectalloptions(selectboxid, selectall) { selectbox = document.getelementbyid(selectboxid); (var = 0; < selectbox.options.length; i++) { selectbox.options[i].selected = selectall; } }
here site comparing commands prototype jquery equivalents, should find need translation:
Comments
Post a Comment