Register  |  Login




Advertisement

Start Your Own Q&A Site

Create your own Q&A site easily, allowing you to quickly grow a new community around any subject matter or generate new organic traffic for your existing website.

Question

Status: Open Points: 25 Time: 13:27 - Jun 02, 2008  

stopthemotion

Looping with strings in Javascript|Greasemonkey

I am creating a Greasemonkey script that further extends an already existing Greasemonkey script that is called dAx (dAmn.extend). dAx works on deviantART's chat client, dAmn. dAx has many subcommands that work with dAmn, but the one I am focusing on is the Away function. If you type /setaway [message], it posts *Username is away: [Message] and then you can remove that away by /setback'ing which returns *Username has returned from away. When a user highlights (mentions another user's username) the message gains a white background and if /setaway is active, it returns <Username> Username2: I am currently away, reason: [Message]. When a user has been in an active chat long enough, older messages start to disappear. My part of this script is to make it store the messages to the user while the user was away and repeat it in a private window on /setback. I've managed to have it do a simple storage by just setting the chatroom it was posted in, timestamp, username, and message in a variable: timeForm = hour + ':' + minutes + ':' + seconds + (userAM?"&nbsp;"+(ohour>12?"pm":"am"):&quo
t;");
twForm = "#"+current.split(':')[1]+", "+timeForm;
messForm = twForm+' ::'+from+':: '+body+"<br>";
(Outputs: #Chatroom, 13:17:21 ::Username2:: Username: Are you there?)

But if there were multiple highlighting, it would just return the first message highlighted. I want to know how I can make a loop for each highlighting that occurs.

Here is the script: http://hypnocloud.mywebcommunity.org/dax... Just click the button View Script Source when the window pops up.

Search for "while ago" to get to the function where someone highlights you. Under that a couple functions is the /setback function.

Categories

Answer Discussion
Tutorials

 

This question has not yet been answered.

Answer this Question

New User

Email:

Upon submission of this form, you will automatically be registered as a Quomon user and we will send your login information to this address

Registered User

Username:

Password:

Forgot Your Password?

Tutorials cannot be submitted until the Answer Discussion is complete.

Submit answers in the Answer Discussion area

Ask a Question

Have a new question? Ask!

You have 100 characters to use



Top Experts

View More

Rank

Expert

Points

1.

nidhi

10279

2.

oracleofDelphi

6493

3.

rcastagna

5596

4.

LAGM

4848

5.

PeterNZ

3487

6.

gonzalo

2840

7.

Mason

2770

8.

jgivoni

2303

9.

xarcus

1820

10.

Anpanman

917

Become an Expert

Register today to share your knowledge with the community and be recognized and rewarded for your contributions.


Register Here




"Psst, Quomon is a great site. Pass it on."     Tell a Friend  |   Link To Us  |   Save to Delicious  |   Digg! Digg it



Language Options

English:

www.quomon.com

Español:

www.quomon.es