DragonPrime - LoGD Resource Community
Welcome Guest
  • Good evening, Guest.
    Please log in, or register.
  • May 18, 2013, 06:09:52 PM
Home Forums News Links Downloads Login Register Advanced Search
* * *
DragonPrime Menu
Login
 
 
Resource Pages
IRC Channels
Search

Pages: [1] 2   Go Down
  Print  
Author Topic: AJAX Commentary Preview  (Read 1003 times)
0 Members and 1 Guest are viewing this topic.
Aeo
Mod God
*****
Online Online

Posts: 1077


Doctor.. Who?


View Profile WWW
« on: April 09, 2012, 04:38:57 AM »

So, I've currently installed the AJAX Commentary. When typing, yeah, that's all fine, and you get that little line at the bottom that shows what you're typing, with the colours.
Then when you hit enter, that line of talking pops up in the chat, all good. The text in the commentary box disappears, all good.

BUT..

The preview UNDER the commentary box stays there.
Question for y'all (and remember, I barely know how to code, except copy and pasting >.>): How do I get that line of preview to disappear when I my talking goes into the chat?

[P.S. I tried to word that simply. xD]
Logged


Time Lords Online - A Doctor Who RPG! Open Now!
~ My Modules: PM me if you'd like me to code something! Smiley ~
Ironmars
Captain of the Guard
***
Offline Offline

Posts: 146



View Profile
« Reply #1 on: April 09, 2012, 09:10:55 AM »

If i understand you correctly the part that you typed in stays under the box where you typed it when you entered it. Try typing again or refreshing.
Logged
Aeo
Mod God
*****
Online Online

Posts: 1077


Doctor.. Who?


View Profile WWW
« Reply #2 on: April 09, 2012, 09:12:57 AM »

That all works fine, but when I hit <ENTER>, I want that preview to disappear.

I play on one site where that actually works- that's where I got the idea from xD
Logged


Time Lords Online - A Doctor Who RPG! Open Now!
~ My Modules: PM me if you'd like me to code something! Smiley ~
Ironmars
Captain of the Guard
***
Offline Offline

Posts: 146



View Profile
« Reply #3 on: April 09, 2012, 09:25:40 AM »

MAybe it's in the ajax code... i dont know i dont have it in front of me and im not good with ajax or javascript O.O
Logged
Megan|SaraBeth
Mod God
*****
Offline Offline

Posts: 823


View Profile WWW
« Reply #4 on: April 09, 2012, 06:10:58 PM »

So I figured it out.  I wanted it on my realm too.  I went on my test server and had datacache turned off to see if it worked.  All you do it open modules/ajaxcommentary.php and remove the following line:

$("previewtext").innerHTML = "<br />";

Once that line is removed you type in something and hit enter and the preview disappears after the text goes into the chat Cheesy

EDIT: But for some strange reason its still not working on my site...Thats really odd..But it works on the test server...
« Last Edit: April 09, 2012, 06:30:23 PM by Megan|SaraBeth » Logged

(\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(")_(") signature to help him gain world domination
Aeo
Mod God
*****
Online Online

Posts: 1077


Doctor.. Who?


View Profile WWW
« Reply #5 on: April 10, 2012, 06:25:37 AM »

Didn't work for me..
Logged


Time Lords Online - A Doctor Who RPG! Open Now!
~ My Modules: PM me if you'd like me to code something! Smiley ~
Megan|SaraBeth
Mod God
*****
Offline Offline

Posts: 823


View Profile WWW
« Reply #6 on: April 10, 2012, 08:20:23 AM »

Hmmm well someone should know how to do it...
Logged

(\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(")_(") signature to help him gain world domination
staticobj
Militia
**
Offline Offline

Posts: 90

Keep it Simple Stupid


View Profile WWW
« Reply #7 on: April 10, 2012, 12:37:49 PM »

I don't have time right now to go dig up a copy of the AJAX Commentary to reference where the changes need to be made in the files(and so many people seem to make so many changes that are solely in production on their own websites), but I can point you in the right direction.

The code(JavaScript and not PHP) will either use one of several event listeners for either keyup, keydown, keypress, or possibly event submit. What you need to do is look at the JavaScript code or paste it here or simply find the event listener that looks for the Enter keyCode-this will be the integer 13(this may not be so if it happens to be a submit event because there are different ways of achiving the same goal).

Right below that someplace should be the lines of code for the post request to the server to send the text the client types. After that line of code someplace we should be able to do the following...

Code: (JavaScript)
document.getElementById("previewtext").innerHTML = "";

Attach the code, paste the code, or link to the code if unable to find it.
Logged

Want a custom template? Private Message me for a quote.
Click here for web hosting offer. I'm willing to work with you. Please send a Private Message for further details.
www.legacyofdragon.com
Aeo
Mod God
*****
Online Online

Posts: 1077


Doctor.. Who?


View Profile WWW
« Reply #8 on: April 11, 2012, 01:05:20 AM »

And I dunno where to find any of that. o.o
Logged


Time Lords Online - A Doctor Who RPG! Open Now!
~ My Modules: PM me if you'd like me to code something! Smiley ~
Megan|SaraBeth
Mod God
*****
Offline Offline

Posts: 823


View Profile WWW
« Reply #9 on: April 11, 2012, 03:42:30 PM »

I'm kind of confused a bit staticobj....So I uploaded the file for you.  Its the file from the public-html/js folder...the prototype.js file.  Could you add the fix to make the preview text erased when your type is submitted and reupload?
Logged

(\__/)
(='.'=) This is Bunny. Copy and paste bunny into your
(")_(") signature to help him gain world domination
HunterD
Captain of the Guard
***
Offline Offline

Posts: 101



View Profile WWW
« Reply #10 on: April 11, 2012, 04:05:20 PM »

So I figured it out.  I wanted it on my realm too.  I went on my test server and had datacache turned off to see if it worked.  All you do it open modules/ajaxcommentary.php and remove the following line:

$("previewtext").innerHTML = "<br />";

Once that line is removed you type in something and hit enter and the preview disappears after the text goes into the chat Cheesy

EDIT: But for some strange reason its still not working on my site...Thats really odd..But it works on the test server...

Could it have something to do with the preview and colorprefs that we changed a while back?
Logged

staticobj
Militia
**
Offline Offline

Posts: 90

Keep it Simple Stupid


View Profile WWW
« Reply #11 on: April 11, 2012, 10:04:11 PM »

The prototype.js is just the library that was used. Not unlike if one were to use jQuery, MooTools, etc.

Found the code you want to change in modules/ajaxcommentary.php
Code: (JavaScript)
function ajaxpostsuccess(request) {
pagetimecounterstart = new Date();
$("inputinsertcommentary").value="";
$("previewtext").innerHTML = "<br />";
addNewCommentary(request);
}

This is triggered as a callback when post is successful. Hypothetically the snippet of code seen there:
Code: (JavaScript)
$("previewtext").innerHTML = "<br />";

This should be doing just what you asked, but then again I am not familiar with prototype.js but the usage looks very similar to jQuery. Either way what you need to do can be done without prototype.js by replacing that line with this:
Code: (JavaScript)
document.getElementById("previewtext").innerHTML = "";

If that doesn't work it could possibly be that the event isn't being triggered on success?
Logged

Want a custom template? Private Message me for a quote.
Click here for web hosting offer. I'm willing to work with you. Please send a Private Message for further details.
www.legacyofdragon.com
Aeo
Mod God
*****
Online Online

Posts: 1077


Doctor.. Who?


View Profile WWW
« Reply #12 on: April 12, 2012, 12:32:09 AM »

I changed the line of code staticobj told me to change- it didn't work.

If that doesn't work it could possibly be that the event isn't being triggered on success?

And what would cause that?

@Hunter: Just saying, probably not. It didn't work on my new site either, and I've barely edited stuff there.
« Last Edit: April 16, 2012, 05:51:11 PM by Aeolus » Logged


Time Lords Online - A Doctor Who RPG! Open Now!
~ My Modules: PM me if you'd like me to code something! Smiley ~
Aeo
Mod God
*****
Online Online

Posts: 1077


Doctor.. Who?


View Profile WWW
« Reply #13 on: April 15, 2012, 06:15:44 PM »

Bump.. Anyone have any other ideas? I really want this one to work for me. :/
Logged


Time Lords Online - A Doctor Who RPG! Open Now!
~ My Modules: PM me if you'd like me to code something! Smiley ~
staticobj
Militia
**
Offline Offline

Posts: 90

Keep it Simple Stupid


View Profile WWW
« Reply #14 on: April 16, 2012, 11:14:11 AM »

Locate the same l line that I mentioned before and add this line after it.
Code: (JavaScript)
document.getElementById("previewtextinsertcommentary").innerHTML="";

The previewtext element isn't being used for that node.
Logged

Want a custom template? Private Message me for a quote.
Click here for web hosting offer. I'm willing to work with you. Please send a Private Message for further details.
www.legacyofdragon.com
Pages: [1] 2   Go Up
  Print  
 
Jump to:  


*
DragonPrime Notices
Play LoGD on Dragonprime

Support Us
$100 raised this year
Your help is greatly appreciated!
Who's Online
18 Guests, 2 Users
Komali, Aeo
DragonPrime LoGD
Recent Topics
Home Forums News Links Downloads Login Register Advanced Search