Author |
Message |
Registered: March 14, 2007 | Reputation: | Posts: 1,029 |
| Posted: | | | | Inspired by yet another attempt of a well known forum user to render any discussion impossible by spamming a topic, I came up with this little educational exercise. You can save the code below to an HTML file, call it up in your browser, enter an Invelos topic number and get the number of posts in that topic for each participating user, sorted both by name and by count, along with percentage. Please note: Only tested with IE, don't know if it works with other browsers.On Windows XP and newer, you have to unblock the created HTML file to enable scripting.You must be logged into the Invelos forums, the script uses the currently active login.The script calls up all topic pages, so this may take a while.In order to get unbiased results, you have to remove any forum blocksBTW, the top 5 participants of the topic in question were: 53 posts = 21 % skipnet50 27 posts = 10 % Addicted2DVD 20 posts = 8 % Rifter 13 posts = 5 % Telecine 12 posts = 5 % m.cellophane I don't know if it is allowed to link to the Rules Committee forum from the outside, but anyone who has access there knows the topic in question. EDIT: Small fix to avoid recursion problems if a topic has a lot of pages. Quote:
<HTML> <!-- *** Show topic post count per user *** Copyright (c) 2007 Matthias Wolf, Germany AKA goodguy --> <HEAD> <TITLE>Topic Post Count Per User</TITLE> <STYLE type="text/css"> </STYLE> <SCRIPT language=javascript>
var g_oXmlHttp; var g_nPageGet; var g_nPageDone; var g_aStats; var g_oByUser;
function errText(nErrNo, szErrDesc) { // Simple error text if (szErrDesc != null && szErrDesc != "") return szErrDesc; var n = nErrNo; if (n < 0) n = n + 0xFFFFFFFF + 1; return "Error " + nErrNo + " (0x" + n.toString(16) + ")"; }
function errHandler(e) { // Simple error handler alert(errText(e.number, e.description)); }
function pageGetNext() { // Get next topic page g_nPageGet++; try { idResult.innerText = "Querying page " + g_nPageGet + "..."; g_oXmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); g_oXmlHttp.onreadystatechange = xmlhttp_onreadystatechange; g_oXmlHttp.open("GET", lnkTopic.href + "&pageNum=" + g_nPageGet); g_oXmlHttp.send(); } catch (e) { errHandler(e) }; }
function pageAnalyze(szHtml) { // Analyzes page and returns true if there are more pages var re, m, o, sz; try { re = /HREF="\/UserProfile\.aspx\?Alias=(.*?)"/ig; while ((m = re.exec(szHtml)) != null) { sz = m[1]; o = g_oByUser[sz]; if (o == null) { o = { user: sz, count: 0 }; g_oByUser[sz] = o; g_aStats.push(o); } o.count++; } return (szHtml.search(/<IMG src="\/images\/next\.gif" border=0><\/A>/i) >= 0); } catch (e) { errHandler(e) }; return false; }
function sortByUser(o0, o1) { // Array sort callback return o0.user.localeCompare(o1.user); }
function sortByCount(o0, o1) { // Array sort callback var n = o1.count - o0.count; if (n != 0) return n; return o0.user.localeCompare(o1.user); }
function showResults() { // Create result tables var szTable; var aOut, aFn; var i, k, n; try { szTable = "<TABLE border=1><COLGROUP>" + "<COL><COL span=2 align=right></COLGROUP>" + "<TR><TH>User</TH><TH>Count</TH><TH>Percent</TH></TR>"; n = 0; for (i = 0; i < g_aStats.length; i++) n += g_aStats[i].count; aOut = new Array(); aFn = new Array(sortByCount, sortByUser); aOut.push("<TABLE border=0>" + "<TR><TH>By Count</TH><TH> </TH><TH>By User</TH></TR><TR>"); for (i = 0; i < aFn.length; i++) { g_aStats.sort(aFn[i]); if (i != 0) aOut.push("<TD> </TD>"); aOut.push("<TD>" + szTable); for (k = 0; k < g_aStats.length; k++) { o = g_aStats[k]; aOut.push("<TR><TD>" + o.user + "</TD><TD>" + o.count + "</TD><TD>" + Math.round(o.count * 100 / n) + " %</TD></TR>"); } aOut.push("</TABLE></TD>"); } aOut.push("</TR></TABLE>"); idResult.innerHTML = aOut.join("\n"); } catch (e) { errHandler(e) }; }
function xmlhttp_onreadystatechange() { // Fires on data retrieval try { if (g_oXmlHttp.readyState != 4) return; if (g_nPageGet == g_nPageDone) return; // Avoid multiple rs==4 g_nPageDone = g_nPageGet; if (g_oXmlHttp.status != 200) throw Error("HTTP Error " + g_oXmlHttp.status + " " + g_oXmlHttp.statusText); // Avoid recursion by putting next call outside event response if (pageAnalyze(g_oXmlHttp.responseText)) window.setTimeout(pageGetNext, 10); else window.setTimeout(showResults, 10); } catch (e) { errHandler(e) }; }
function frm1_onsubmit() { // Process form submit locally try { if (frm1.edtTopic.value == "") throw Error("Please enter a topic ID." + " See &topicID= in your browser's address bar."); lnkTopic.href = "http://www.invelos.com/Forums.aspx?" + "task=viewtopic&topicID=" + frm1.edtTopic.value; lnkTopic.innerText = lnkTopic.href; idResult.innerText = "Querying data..."; g_nPageGet = g_nPageDone = 0; g_aStats = new Array(); g_oByUser = {}; pageGetNext(); } catch (e) { errHandler(e) }; return false; }
</SCRIPT> </HEAD> <BODY> <B>Topic Post Count Per User</B><BR> Copyright (c) 2007 Matthias Wolf, Germany AKA goodguy <HR> <FORM id=frm1 onsubmit="return frm1_onsubmit()"> Enter topic ID: <INPUT type=text id=edtTopic> <INPUT type=submit value="Start"> </FORM> Topic URL: <A id=lnkTopic href=""></A> <HR> <DIV id=idResult> </DIV> </BODY> </HTML>
| | | Matthias | | | Last edited: by goodguy |
|
Registered: March 13, 2007 | Posts: 793 |
| Posted: | | | | Just tried in Firefox, it doesn't work. Works wonders in IE7 |
|
Registered: March 14, 2007 | Reputation: | Posts: 1,029 |
| Posted: | | | | Quoting RossRoy: Quote: Just tried in Firefox, it doesn't work.
Works wonders in IE7 For Firefox, try replacing the line Quote: g_oXmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); with Quote: g_oXmlHttp = new XMLHttpRequest(); Just a guess. I don't know for sure if this works, and if it is the only change required. If that is all that is needed I can modify the script to support both. | | | Matthias |
|
Registered: March 13, 2007 | Posts: 793 |
| Posted: | | | | Quoting goodguy: Quote: Just a guess. I don't know for sure if this works, and if it is the only change required. If that is all that is needed I can modify the script to support both. Still doesn't work. I enter the TopicID in the field, click go. It then clears the field and just sits there. |
|
Registered: March 14, 2007 | Reputation: | Posts: 1,029 |
| Posted: | | | | Well, I give it one last try, then I leave it to someone who actually uses Firefox. I addition to the previous change, replace the line: Quote: <INPUT type=submit value="Start"> with Quote: <INPUT type=submit value="Start" onclick="return frm1_onsubmit()"> You may have to click the button instead of simply pressing Enter. | | | Matthias |
|
Registered: March 13, 2007 | Posts: 793 |
| Posted: | | | | Still doesn't work. |
|
Registered: March 14, 2007 | Reputation: | Posts: 1,029 |
| Posted: | | | | Quoting RossRoy: Quote: Still doesn't work. Then I suggest using a real browser - IE for example. P.S.: Please note that I'm not responsible for any injuries caused by the excessive shaking of heads and rolling of eyes after reading the previous sentence. | | | Matthias |
|
Registered: March 29, 2007 | Reputation: | Posts: 4,479 |
| Posted: | | | | Quoting goodguy: Quote: Inspired by yet another attempt of a well known forum user to render any discussion impossible by spamming a topic, I came up with this little educational exercise.
Interesting and funny. But spamming a topic is not the only technique used by some users to avoid any discussion. The most irritating one is when they twist the others' statements, then decide themselves what the others think. And when they see that the discussion doesn't take a good way for them, they don't answer anymore in the topic, saying others don't understand, and fly to another topic where they attack once again, twisting once again the others' statements. This form of debate is a way to discourage contradictors that I find particularly unpleasant, I even should say disgusting. Some of forum users (especially one), cannot help doing that several times every day... | | | Images from movies | | | Last edited: by surfeur51 |
|
Registered: March 13, 2007 | Posts: 793 |
| Posted: | | | | Quoting goodguy: Quote: Then I suggest using a real browser - IE for example. Oh I do use IE, even more than Firefox actually |
|
Registered: March 13, 2007 | Posts: 21,610 |
| Posted: | | | | | | | ASSUME NOTHING!!!!!! CBE, MBE, MoA and proud of it. Outta here
Billy Video | | | Last edited: by Winston Smith |
|
Registered: March 13, 2007 | Reputation: | Posts: 5,635 |
| Posted: | | | | | | | If it wasn't for bad taste, I wouldn't have no taste at all.
Cliff |
|
Registered: March 13, 2007 | Posts: 21,610 |
| Posted: | | | | Everybody thinks he's a comedian. Thanks i needed that. Skip | | | ASSUME NOTHING!!!!!! CBE, MBE, MoA and proud of it. Outta here
Billy Video |
|
Registered: March 14, 2007 | Reputation: | Posts: 1,029 |
| |
Registered: March 13, 2007 | Posts: 775 |
| |
Registered: March 13, 2007 | Posts: 21,610 |
| Posted: | | | | Mathias:
And your behavior is beyond reproach...I think NOT. People who live in glass houses shouldn't throw rocks. There is no one in these forums who i would call stellar in their behavior and the vast nmmajority I would say are far WORSE.
Skip | | | ASSUME NOTHING!!!!!! CBE, MBE, MoA and proud of it. Outta here
Billy Video |
|
Registered: March 13, 2007 | Posts: 21,610 |
| Posted: | | | | | | | ASSUME NOTHING!!!!!! CBE, MBE, MoA and proud of it. Outta here
Billy Video |
|