2007-11-26 13:25:50

wwackywizards
» n00b
FTalk Level: zero
19
0
1969-12-31

Re: [quote][b][color=red]For educational purposes only.[/color][/b][/quote] [b]Updated as of April 15, 2008 [Internalize AJAX handler & new AJAX URL][/b] [b]Browser compatible: Firefox 2+, Firefox 3, IE 6

help me with the js code... i cant understand it... please.... this is just 1 thing... help me with this... please... i can understand this when you teach me the right thing to do.... can i put this two in one js code: [quote][b]Viewer's Main Photo at Sidebar[/b] Code: if (!attachOnLoadHandler(function() { mainVpic();})) window.onload = function() { mainVpic();}; function mainVpic() { if(pageViewerID!="") SPAWNPIC.init(); } if (typeof SPAWNPIC == "undefined") { SPAWNPIC = {}; } SPAWNPIC = { photo: [], li: [], ul: [], info: { name: null, photo: null, status: null, since: null, location: null }, regexp: { name: /controlpanel_header">([^@]+?)<a\s+name="controlpanel/i, photo: /imgblock200"><a[^@]*?>([^@]+?)<\/a><\/div>/i, status: /data">([^@]+?)<\/span><\/li>/i, since: /Since\:\s+<\/span>([^@]+?)<\/li>/i, location: /Location\:\s+<\/span>([^@]+?)<\/li>/i }, init: function() { this.ajaxRequest("/"+pageViewerID,"SPAWNPIC.viewer",null); }, viewer: function(ph) { if (ph.replace(/^\s*|\s*$/g,"") === "") { alert("VMP Error: Unable to parse the photo!"); return; }else if (ph) { for (val in this.info) { try { this.info[val] = new RegExp(this.regexp[val]).exec(ph)[1].replace(/^(\d)$/,"0$1"); }catch(e) { this.info[val] = ""; } } this.photo = "<div class=\"fitem1wrapper\">"+ "<table class\"fitem1table\">"+ "<tr>"+ "<td class=\"itd\">"+ "<a href=\"/"+pageViewerID+"\" title=\""+pageViewerFName+"\">"+ this.info.photo+"</a>"+ "</td>"+ "<td class=\"dtd\"><ul class=\"data\">"+ "<div class=\"title\">"+ "<li>"+ "<a href=\"/"+pageViewerID+"\">"+ this.info.name+"</a>\n"+ "Friendster ID: <a href=\"/"+pageViewerID+"\">"+pageViewerID+"</a>"+ this.info.status+"\n"+ "Member Since: "+this.info.since+"\n"+ "Location: "+this.info.location+"</li>"+ "</div>"+ "</ul>"+ "</td>"+ "</tr>"+ "</table>"+ "</div>"; this.photo = this.photo.replace(/\n/g,"<br />").replace(/<br>/gi,"<br />"); this.HTML("Hello "+this.info.name,this.photo,"spawnpic",/friends/i,"above"); } }, ajaxRequest: function(url,ajaxfunc,handler) { if(handler) handler = ","+handler; else handler = ""; var httprequest= window.XMLHttpRequest? new XMLHttpRequest():new ActiveXObject("Msxml2.XMLHTTP"); if(ajaxfunc) eval("httprequest.onreadystatechange=function(){if (httprequest.readyState==4) {"+ajaxfunc+"(httprequest.responseText"+handler+");}}"); httprequest.open('GET', url, true); httprequest.send(null); }, HTML: function(head,code,id,sibling,x) { this.li = document.createElement("LI"); if (!head) head = ""; else head = "<h2>"+head+"</h2>"; this.li.innerHTML = "<div class=\"commonbox "+id+"\" id=\""+id+"\">"+ head+ "<div id=\"content_"+id+"\">"+ code+ "</div>"+ "</div>"; if (!x) this.getModuleByClassName(sibling)[0].parentNode.parentNode.appendChild(this.li); else if (x == "below") this.getModuleByClassName(sibling)[0].parentNode.appendChild(this.li); else if (x == "above") { this.ul = this.getModuleByClassName(sibling)[0]; this.ul.parentNode.parentNode.insertBefore(this.li,this.ul.parentNode); } }, getModuleByClassName: function(sClass) { var elm = []; var els = document.getElementsByTagName("*") || document.all; for (var j=0,k=els.length;j<k;j++) { if (new RegExp(sClass).test(els[j].className))elm.push(els[j]); } return elm; } };[/quote] [b]Viewer's Main Photo at Who I Want to Meet are[/b] [quote]if (!attachOnLoadHandler(function(){viewer();})) window.onload = function(){viewer();}; function viewer() { if(pageViewerID!="") VIEWERPIC.init(); } if (typeof VIEWERPIC == "undefined") { VIEWERPIC = {}; } VIEWERPIC = { photo: [], info: { photo: null }, regexp: { photo: /imgblock200"><a[^@]*?>([^@]+?)<\/a><\/div>/i }, init: function() { if(document.getElementById("viewerpic") != null) { this.ajaxRequest("/"+pageViewerID,"VIEWERPIC.viewer",null); } }, viewer: function(ph) { if (ph.replace(/^\s*|\s*$/g,"") === "") { alert("VMP Error: Unable to parse the photo!");return; }else if (ph) { try { this.info.photo = new RegExp(this.regexp.photo).exec(ph)[1].replace(/^(\d)$/,"0$1"); this.photo = document.createElement("DIV"); this.photo.setAttribute("align","center"); this.photo.innerHTML = "<a href=\"/"+pageViewerID+"\" target=\"_blank\" title=\""+pageViewerFName+"\">"+this.info.photo+"</a>"; document.getElementById("viewerpic").appendChild(this.photo); }catch(e) { this.info.photo = ""; } } }, ajaxRequest: function(url,ajaxfunc,handler) { if(handler) handler = ","+handler; else handler = ""; var httprequest= window.XMLHttpRequest? new XMLHttpRequest():new ActiveXObject("Msxml2.XMLHTTP"); if(ajaxfunc) eval("httprequest.onreadystatechange=function(){if (httprequest.readyState==4) {"+ajaxfunc+"(httprequest.responseText"+handler+");}}"); httprequest.open('GET', url, true); httprequest.send(null); } };[/quote] Then after this... ill put this two in one notepad... save it as js file then upload.... then put it in media are... then after that whats next? am i still in the correct path??

Board footer

© 2024 F Talk

Current time is 14:26

[ 12 queries - 0.052 second ]
Privacy Policy