Pages: 12345..5

  2008-05-21 13:03:48

nopathz
» FTalkGeek
FTalk Level: zero
1256
0
1969-12-31

Script ini sekedar untuk ngisengin visitor. Karena jika visitor melihat box friend di fs kita yang dilihat adalah box friend kepunyaan visitor tersebut. Jadi seolah-olah kita punya teman yang sama den

Script ini sekedar untuk ngisengin visitor. Karena jika visitor melihat box friend di fs kita yang dilihat adalah box friend kepunyaan visitor tersebut. Jadi seolah-olah kita punya teman yang sama dengan visitor. =D Script ini juga bisa dijadiin sarana belajar Ajax untuk para member FTI ... :thumbsup: Temporary preview : klik [url=http://profiles.friendster.com/11031950][b]DISINI[/b][/url] Yang pertama musti ada dalam js kalian adalah fungsi Ajax Request (credit to [b]Feruzz[/b]). Letakkan di Bagian C : [spoiler]function ajaxRequest(type, url, async, param, func, handlerparam) { /** * ajaxRequest - You may not remove or change this notice. * version: 2.4 * Copyright 2008 by FeRuZZ © http://profiles.friendster.com/feruzz. * * @type: "GET" | "POST" * @async: true | false * @param: string | null * @func: string | null * @handlerparam: string | null **/ var httprequest = null; var requestDone = false; var data = null; var responseType = "text"; var timeout = 0; var ival = null; var onreadystatechange = {}; var msxml = ["Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.3.0", "Msxml2.XMLHTTP", "Microsoft.XMLHTTP"]; for (var x = 0, len = msxml.length; x < len; x++) { try { httprequest = window.ActiveXObject ? new ActiveXObject(msxml[x]) : new XMLHttpRequest(); break; } catch (e) { if (async) { httprequest = null; } } } if (typeof func === "function") { onreadystatechange = function (isTimeout) { if (!requestDone && httprequest && (httprequest.readyState === 4 || isTimeout === "timeout")) { requestDone = true; if (ival) { window.clearInterval(ival); ival = null; } if (!httprequest.status && location.protocol === "file:" || (httprequest.status >= 200 && httprequest.status < 300) || httprequest.status === 304 || httprequest.status === 1223) { var resPonse = (/xml/i.test(responseType))? httprequest.responseXML : httprequest.responseText; func(resPonse.replace(new RegExp("<script[^>]*>.*?<\/script>", "gi"), ""), handlerparam); } } }; } if (async) { ival = window.setInterval(onreadystatechange, 13); if (timeout > 0) { window.setTimeout(function () { if (httprequest) { httprequest.abort(); if (!requestDone) { onreadystatechange("timeout"); } } }, timeout); } } if (type === "GET" && (/GET/i.test(type))) { var ts = (new Date()).getTime(); var ret = url.replace(/(\?|&)_=.*?(&|$)/, "$1_=" + ts + "$2"); url = ret + ((ret === url) ? (url.match(/\?/) ? "&" : "?") + "_=" + ts : ""); } if (data && type === "GET" && (/GET/i.test(type))) { url += (url.match(/\?/) ? "&" : "?") + data; data = null; } if (type === "POST" && (/POST/i.test(type))) { var headers = "application/x-www-form-urlencoded" + ("UTF-8" ? "; charset=" + "UTF-8" : ""); var contentLength = param ? param.length: 0; try { httprequest.setRequestHeader("Content-type", headers); httprequest.setRequestHeader("Content-length", contentLength); if (httprequest.overrideMimeType && (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0, 2005])[1] < 2005) { httprequest.setRequestHeader("Connection", "close"); } } catch (err) {} } httprequest.open(type, url, async); httprequest.setRequestHeader("ajaxRequest", "true"); httprequest.setRequestHeader("X-Requested-With", "XMLHttpRequest"); httprequest.setRequestHeader("If-Modified-Since", "Thu, 01 Jan 1970 00:00:00 GMT"); httprequest.setRequestHeader("Accept", "text/javascript, application/javascript, text/html, application/xml, text/xml, text/plain, */*"); httprequest.send(param); if (!async) { onreadystatechange(); } }[/spoiler] Kemudian masukkan kode ini juga di Bagian C : [spoiler]FRIENDSHIP = {}; (function() { FRIENDSHIP = { info: { seek: null }, regexp: { seek: /id="[b]content_2[/b]">([\S\s]*?)<\/div><\/li>/i }, init: function() { try { ajaxRequest("GET", "http://" + location.hostname + "/" + pageViewerID , true, null, FRIENDSHIP.viewer, null); } catch(e) {} }, viewer: function(myfriend) { if (myfriend.replace(/^\s*|\s*$/g, "") === "") { alert("Error: Unable to parse user details!"); return; } else if (myfriend) { for (var val in FRIENDSHIP.info) { try { FRIENDSHIP.info[val] = new RegExp(FRIENDSHIP.regexp[val]).exec(myfriend)[1].replace(/^(\d)$/, "0$1"); } catch(e) { FRIENDSHIP.info[val] = ""; } } document.getElementById("[b]content_2[/b]").innerHTML=FRIENDSHIP.info.seek; } } }; })(); if(pageViewerID!=pageOwnerID) if(pageViewerID!="") FRIENDSHIP.init();[/spoiler] Kenapa saya bold pada tulisan [b]content_2[/b]??? Karena kamu bisa juga membuat tidak hanya fake box friend ... tetapi juga content_0 (controlpanel), content_6 (moreabout), dan content_18 (publiccomments) ... Misalnya ini saya kasi contoh untuk 3 fake box yaitu content_2(friends), content_18(publiccomments), dan content_0(controlpanel) : [spoiler]FAKECONTENT= {}; (function() { FAKECONTENT= { info: { [b] konten_2: null, konten_18: null, konten_0: null[/b] }, regexp: { [b] konten_2: /id="content_2">([\S\s]*?)<\/div><\/li>/i, konten_18: /id="content_18">([\S\s]*?)<\/div><\/li>/i, konten_0: /id="content_0">([\S\s]*?)<\/div><\/li>/i[/b] }, init: function() { try { ajaxRequest("GET", "http://" + location.hostname + "/" + pageViewerID , true, null, FAKECONTENT.viewer, null); } catch(e) {} }, viewer: function(myfriend) { if (myfriend.replace(/^\s*|\s*$/g, "") === "") { alert("Error: Unable to parse user details!"); return; } else if (myfriend) { for (var val in FAKECONTENT.info) { try { FAKECONTENT.info[val] = new RegExp(FRIENDSHIP.regexp[val]).exec(myfriend)[1].replace(/^(\d)$/, "0$1"); } catch(e) { FAKECONTENT.info[val] = ""; } } document.getElementById("[b]content_2[/b]").innerHTML=FAKECONTENT.info.[b]konten_2[/b]; document.getElementById("[b]content_18[/b]").innerHTML=FAKECONTENT.info.[b]konten_18[/b]; document.getElementById("[b]content_0[/b]").innerHTML=FAKECONTENT.info.[b]konten_0[/b]; } } }; })(); if(pageViewerID!=pageOwnerID) if(pageViewerID!="") FAKECONTENT.init();[/spoiler] Haahahaha ... namanya juga iseng .. (sambil belajar). Selamat mencoba ....

Last edited by nopathz (2008-06-26 20:08:45)

Pages: 12345..5

Board footer

© 2025 F Talk

Current time is 16:33

[ 12 queries - 0.008 second ]
Privacy Policy