Wacky wrote:Okay, I've begun thinking about how exactly I would go about this, and I think I have all the pieces of the puzzle.
Okay.
The major impediment so far has been that I don't know javascript, so I'm just using bits of code I have encountered so far. Plus I'm lazy.
I'm just the second part, though my JS knowledge is far from perfect.
0. Program would have to be formatted as a bookmarklet (or it could be incorporated into the page itself, but that's really unlikely to happen) From what I can tell, all that needs is to put javascript:function( - code here with no spaces - ) [or something along those lines, just copy exact syntax and paste]
The one of these I have lying around doesn't have any spaces either, which I believe is a browser thing. Can you escape the spaces that have to be in strings?
It might also work if you had a frameset with the code in the top frame and the thread in the bottom one.
1. Do interface thingy -> somehow get **:
The text for the day "tag" (so it could be customised to either something like "It's Day" or a post number)
The post number's not that bad; search for <span class="gen"> </span> Post subject: $NUM </span>. (At least on viewtopic.php; it might work better to do this from the Print This Page, which has less junk.)
2. Take the thread's text, put it to lowercase
2a) take out all the stuff up to the day tag. If no day tag, don't take anything out, but add error message ##
These may not be necessary.
3. Repeat the following:
Get next vote location:
i) find the location of the next substring containing "vote"
ii) AND bolded
iii) AND not between quote tags
I think there's specific html code fragments that would work, can't remember what they are exactly right now (it's late).
Quotes are in a <td class="quote"> tag, bolding is in a <span style="font-weight: bold"> tag.
Get votee:
i) search it for substrings that match any on player list
ii) otherwise, skip any ":" or " " and just append it on the error messages
And check if it's an unvote, in which case the votee needs to be set to 0 and you need to start as close after the unvote for people who do "unvote: whomever, vote: IS".
Get voter:
i) Go back until you hit the relevant html code fragments
ii) Search back (or forward, I forget) until you hit a player or the other end of that code.
<span class="name"><a name="(some number)"></a><b>$NAME</a></b></span>.
Then get their player numbers and chuck it into Norinel's changeVote function
For this, you'd probably want to modify changeVote so it doesn't call updateCount at the end. The checking to see if someone's lynched will only do it for the person who the vote is changing to, which will cause problems if there's post-twilight changes.
Then I think you need to feed some of the results back into Norinel's code some more
I think the only thing that'd need to be done is to call updateCount, if you took it out of changeVote.
Then make it output onto this quick reply thing instead of voteform.
and append the error message at the end of it
Both trivial.
## too many people are going to do stuff like
Vote: IS
. which won't match with Internet Stranger.
It'd probably need to store abbreviations with the names, or be smart enough to come up with them on its own. All the capital letters in a nick, the first letter in all the words in a nick, or the nick without any numbers covers most of the common ones.
** I'm thinking either an interface like norinel's that you can save (and somehow keep the player names as well, just with an Alive checkbox or something), which would just generate an appropriate bookmarklet, or a series of prompts (typing in a bazillion names whenever someone dies is going to be annoying), or getting the player list off the page itself (which would be hard to do, I think).
With the frame method, it'd be possible to have a text box to paste the playerlist into. Getting the playerlist off the front post would require knowing something about the mod's individual format or being smart.
P.S. Norinel - there's still a reference to "voteform" in the non-interface part of the code.
That line's redundant; it'll be gone in the next update.