Jun 2, 2013 6:07:29 GMT -5
Oh, just saw your second comment haha.
Doesn't seem to work for me though
Smangii test
Smangii Smangii nope no luck @stinky666
Jun 2, 2013 6:09:00 GMT -5
Works for me.
Ok this is strange. Before, in my above post I used @lazy Ape and it changed it to
Xikeon, but now it wont do it. It does still change @
smangii though to
Smangii
Jun 2, 2013 10:38:05 GMT -5
I will go add some in in a while. But I've spent so much time working on it I'm going to leave it the way it is for a while.
I'm around and round we go
Moderator
Jun 2, 2013 11:22:06 GMT -5
I see the
Smangii but I can't click my name to go to profile... why?
Jun 2, 2013 17:00:54 GMT -5
It changes it as your typing, not after it is entered onto the page.
Jun 2, 2013 21:58:52 GMT -5
I see the
Smangii but I can't click my name to go to profile... why?
It changes it as your typing, not after it is entered onto the page.
This. Which I think is better than it changing AFTER you have posted.
Jun 3, 2013 9:04:13 GMT -5
That way, if the user changes there displayname post will still say @(admin) instead of @(smangii) which does absolutely nothing. Plus I don't believe it would actually tag the person if I changed it AFTER the post was submitted to the server.
Jun 3, 2013 9:39:13 GMT -5
Okay, sorry. Just found another bug. Soooooo you may want to update. However, it's not like the previous problems.
The problem was, if someone had a single character as there displayname "m" for instance. Then when you did @(m) it would automatically change it to there username. Sooooo I made it so the .length of the displayname has to be greater than 1 or the displayname isn't cached.
also
Xikeon: I believe why it doesn't work for you is that in the first update I had the array like this
atperson = {userdata[]}
. But I changed it too
atperson = []
. So now when I push to atperson it doesn't work cause the array is still
{userdata[]}
. I also put a fix for this in the code by adding a localStorage with the current version number. So if the version number doesn't equal the current one or if it doesn't exist than it clears localStorage.atperson which holds the usernames and such. That way every time I update the code it should clear the list so it doesn't have any problems with caching.
Jun 3, 2013 10:57:04 GMT -5
Texas that explains
Interesting enough though I don't see anything from your plugin in my localstorage (chrome).
Edit: oh I see why, my console shows an error for your code.
An error occurred during a document.ready call: TypeError: Cannot call method 'match' of undefined
Jun 3, 2013 11:15:36 GMT -5
Xikeon Yea, do:
localStorage.atperson=undefined;
in your console (if you haven't already) That should fix it.
Jun 3, 2013 11:21:45 GMT -5
Texas great, that fixed it. Also another issue might be worth taking a look at: If you add a username in the middle of a sentence, then the cursor moves to the end of the text.
Jun 3, 2013 11:32:10 GMT -5
Texas great, that fixed it. Also another issue might be worth taking a look at: If you add a username in the middle of a sentence, then the cursor moves to the end of the text.
I am totes trying this with (
Smangii this post to see if you're a liar!! haha it did
Jun 3, 2013 11:34:24 GMT -5
Texas great, that fixed it. Also another issue might be worth taking a look at: If you add a username in the middle of a sentence, then the cursor moves to the end of the text.
I am totes trying this with (
Smangii this post to see if you're a liar!! haha it did
Yes, if you change text in textarea's, you basically:
- get the current txt
- search & replace
- put it back in the textarea
Which then obv adds the cursor to the end.
You can save the caret position and then put it back where it was.
Jun 3, 2013 11:40:45 GMT -5
I am totes trying this with (
Smangii this post to see if you're a liar!! haha it did
Yes, if you change text in textarea's, you basically:
- get the current txt
- search & replace
- put it back in the textarea
Which then obv adds the cursor to the end.
You can save the caret position and then put it back where it was.
But, I don't like carrots...
Jun 3, 2013 11:43:40 GMT -5
@stinky666 neither do I, so that's good.
Jun 3, 2013 15:28:43 GMT -5
Xikeon: I looked into this and there is a problem. It is possible to get and set the Caret position. However, because the text is changed, the caret position will be different. For instance
|=caret
This is @(aa)| some text.
The caret position is 15
However, when the code kicks in and changes the displayname to the username the length is changed
This is @(areal"|"lylongdisplayname) some text
So even though the caret position is the same, the text length changed and so the caret will still have to be moved manually.
Jun 3, 2013 16:44:21 GMT -5
Okay, this has to be getting annoying. But I found another slight problem again. The problem was if someones name was displayname was "kan" for instance, and you tried to write "
Texas", as soon as you got to the "kan" part it would automatically replace it with "kan's" username without giving you a chance to finish kanglefritz's displayname. So I changed the code to search for @(displayname) plus a space. So there has to be a space after the displayname.
Jun 4, 2013 2:43:16 GMT -5
Xikeon: I looked into this and there is a problem. It is possible to get and set the Caret position. However, because the text is changed, the caret position will be different. For instance
|=caret
This is @(aa)| some text.
The caret position is 15
However, when the code kicks in and changes the displayname to the username the length is changed
This is @(areal"|"lylongdisplayname) some text
So even though the caret position is the same, the text length changed and so the caret will still have to be moved manually.
Well, good thing you know the username + display name lengths, so you could even do that in code. But even if you wouldn't do it, it's better to have it near the position you were rather than the end.
Okay, this has to be getting annoying. But I found another slight problem again. The problem was if someones name was displayname was "kan" for instance, and you tried to write "
Texas", as soon as you got to the "kan" part it would automatically replace it with "kan's" username without giving you a chance to finish kanglefritz's displayname. So I changed the code to search for @(displayname) plus a space. So there has to be a space after the displayname.
Yeah, not a bad idea. Nice.
Jun 4, 2013 7:42:50 GMT -5
Well, the user will still have to move the caret position with his mouse. (maybe with the keys) But he will still have to move it. I guess I'll put this on the to do list.
Aug 8, 2013 14:48:36 GMT -5
Okay, I updated it again. All special characters should be accepted ( some special characters however are not valid in a regular expression and thus cannot be included in the code ) however all other ones should be fine. Another important thing to note is that I changed the code from searching for @(displayname to search for {displayname} the reason being that if a user has the username of "hello" and a different user has a displayname of "hello" and a username of "test" it would be impossible to tag the user "hello" because it would change @(hello to
test even if you really actually wanted to tag the user "hello"