Preview button in Reply page

Started by Tirea Aean, October 16, 2014, 11:45:39 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Tirea Aean

I've been seeing reports all around that when using Firefox or Safari, the Preview button inside the Reply page is broken.

Quote from: Kemaweyan on October 16, 2014, 11:25:40 AM
Oel tse'a fìkxeyeyti:

junk after document element index.php:14
TypeError: XMLDoc.getElementsByTagName(...)[0] is undefined


Nìsung tsatsenge lu pxaya kxeyey alahe:

GET http://s.learnnavi.org/js/jquery-1.10.2.min.js [HTTP/1.1 403 Forbidden 50ms]
GET http://s.learnnavi.org/js/inline-audio.js [HTTP/1.1 403 Forbidden 44ms]
GET http://s.learnnavi.org/js/jquery-animate-css-rotate-scale.js [HTTP/1.1 403 Forbidden 56ms]
GET http://www.learnnavi.org/images/facebookicon.png [HTTP/1.1 403 Forbidden 54ms]
GET http://www.learnnavi.org/images/twittericon.png [HTTP/1.1 403 Forbidden 84ms]
GET http://www.learnnavi.org/images/youtubeicon.png [HTTP/1.1 403 Forbidden 64ms]
GET http://s.learnnavi.org/tos_link.jpg [HTTP/1.1 403 Forbidden 56ms]
GET http://www.learnnavi.org/images/logo.png [HTTP/1.1 403 Forbidden 75ms]
GET http://files.learnnavi.org/images/LNF_Logo.jpg [HTTP/1.1 403 Forbidden 69ms]
GET http://www.learnnavi.org/downloads/LAL.jpg [HTTP/1.1 403 Forbidden 116ms]


The JavaScript function previewPost() called onclick "preview" button is this:

Code (JavaScript) Select

function previewPost() {
    if (window.XMLHttpRequest) {
        // Opera didn't support setRequestHeader() before 8.01.
        if (typeof(window.opera) != "undefined") {
            var test = new XMLHttpRequest();
            if (typeof(test.setRequestHeader) != "function")
                return submitThisOnce(document.forms.postmodify);
        }
        // !!! Currently not sending poll options and option checkboxes.
        var i, x = new Array();
        var textFields = ["subject", "message", "icon", "guestname", "email", "evtitle", "question", "topic"];
        var numericFields = [
            "board", "topic", "num_replies",
            "eventid", "calendar", "year", "month", "day",
            "poll_max_votes", "poll_expire", "poll_change_vote", "poll_hide"
        ];
        var checkboxFields = [
            "ns",
        ];

        for (i in textFields)
            if (document.forms.postmodify.elements[textFields[i]])
                x[x.length] = textFields[i] + "=" + escape(textToEntities(document.forms.postmodify[textFields[i]].value.replace(/&#/g, "&#"))).replace(/\+/g, "%2B");
        for (i in numericFields)
            if (document.forms.postmodify.elements[numericFields[i]] && typeof(document.forms.postmodify[numericFields[i]].value) != "undefined")
                x[x.length] = numericFields[i] + "=" + parseInt(document.forms.postmodify.elements[numericFields[i]].value);
        for (i in checkboxFields)
            if (document.forms.postmodify.elements[checkboxFields[i]] && document.forms.postmodify.elements[checkboxFields[i]].checked)
                x[x.length] = checkboxFields[i] + "=" + document.forms.postmodify.elements[checkboxFields[i]].value;

        sendXMLDocument(smf_scripturl + "?action=post2" + (current_board ? ";board=" + current_board : "") + (make_poll ? ";poll" : "") + ";preview;xml", x.join("&"), onDocSent);

        document.getElementById("preview_section").style.display = "";
        setInnerHTML(document.getElementById("preview_subject"), txt_preview_title);
        setInnerHTML(document.getElementById("preview_body"), txt_preview_fetch);

        return false;
    } else
        return submitThisOnce(document.forms.postmodify);
}


(disregard all those added </i> at the end which the forum seems to have added in when parsing the syntax highlighting... O.o)

The forum has been working as-is for ages (unless something was changed somewhere?) so I think this is a problem in these respective browsers. The problem does not exist when using Google Chrome or Opera Browser.

Wllìm

Irayo ma Tirea Aean for opening this thread :)

Interestingly, it looks like Chrome refreshes the page when clicking Preview, while Firefox tries the preview in-place, which apparently fails now. I have no idea at all why Chrome and Firefox behave differently here :(

Tirea Aean

Quote from: Wllìm on October 16, 2014, 12:02:12 PM
Irayo ma Tirea Aean for opening this thread :)

Interestingly, it looks like Chrome refreshes the page when clicking Preview, while Firefox tries the preview in-place, which apparently fails now. I have no idea at all why Chrome and Firefox behave differently here :(

Maybe Chrome has the fallback of refreshing the page with the values if it fails to do it in place. Or not. I'm not 100% certain.

Tìtstewan

#3
Do you can take a look at the browser console of chrome to see what it report?
Internet Explorer works but if I open the IE's browser console, I get this:

and everything is blocked...

EDIT:
From the 90k2 thread...
Quote from: Tìtstewan on October 14, 2014, 03:59:43 PM
Testing stuff with Opera as it base on the same engine like Google Chrome...

....

It works? Yes!




Forum preview work?

Firefox: no tested
Internet Explorer: yes tested (but in console mode it won't work...)
Chrome: yes (mentiond in some posts)
Safari: no (read that in the shout box)
Opera: yes tested

Quote from: Wllìm on October 12, 2014, 07:27:57 AM
Right... Does anybody know why Chrome does the "refresh-on-preview" thing? It seems that is the reason that Firefox doesn't work and Chrome does...
Opera do the same thing (?)

-----


Quote from: Tìtstewan on October 12, 2014, 07:01:25 AM
The mistake appears only on the separate post page, not in the quick reply nor in the PM page.


Quote from: Wllìm on October 12, 2014, 06:53:19 AM
Oh, this is interesting. If I look at the HTTP response that the server returns after the preview call, I see this:

Code (html) Select

<div>
<table border="0" width="80%" cellspacing="0" align="center" cellpadding="4" class="tborder">
<tr class="titlebg">
<td>An Error Has Occurred!</td>
</tr>
<tr class="windowbg">
<td style="padding: 3ex;">
Your session timed out while posting.  Please go back and try again.
</td>
</tr>
</table>
</div>
<div align="center" style="margin-top: 2ex;"><a href="javascript:history.go(-1)">Back</a></div>

-->
An Error Has Occurred!
Your session timed out while posting.  Please go back and try again.

-| Na'vi Vocab + Audio | Na'viteri as one HTML file | FAQ | Useful Links for Beginners |-
-| Kem si fu kem rä'ä si, ke lu tìfmi. |-

Kemaweyan

There is an error in Opera too, but preview works.

Uncaught exception: TypeError: 'XMLDoc.getElementsByTagName' is not a function
Nìrangal frapo tsirvun pivlltxe nìNa'vi :D

Tirea Aean

Testing Reply Preview on Chrome OS 38 Stable.

There was one error before the entire page refreshed. Upon refresh, no errors.

The error was:


Uncaught TypeError: undefined is not a fuction


It only appears in the console for that split second before the page refresh, so further investigation is nearly impossible. Even attempts to stop the page before it refreshes fail. There's not much more I can do to investigate this particular error here.

Vawmataw

#6
What I get with Mozilla Firefox on Ubuntu:
Quote from: What does the Firefox say?données incompréhensibles après l'élément de document                                              index.php:14
TypeError: XMLDoc.getElementsByTagName(...)[0] is undefined                                      post2:310
<div>
<table border="0" width="80%" cellspacing="0" align="center" cellpadding="4" class="tborder">
<tr class="titlebg">
<td>An Error Has Occurred!</td>
</tr>
<tr class="windowbg">
<td style="padding: 3ex;">
Sorry, you cannot post new topics in this board.
</td>
</tr>
</table>
</div>
<div align="center" style="margin-top: 2ex;"><a href="javascript:history.go(-1)">Back</a></div>
</div>
Fmawn Ta 'Rrta - News IN NA'VI ONLY (Discord)
Traducteur francophone de Kelutral.org, dict-navi et Reykunyu

Wllìm

I like how they translated junk as données incompréhensibles ;D




Has Chrome always refreshed the entire page when requesting a preview? If not, the refreshing could be a result of the problem.

Tirea Aean

Quote from: Wllìm on October 17, 2014, 11:31:05 AM
Has Chrome always refreshed the entire page when requesting a preview? If not, the refreshing could be a result of the problem.

I can't really remember. I want to say I do remember experiencing the behavior of a live preview where it jumps up to the anchor and not a refresh. But I can't say that with certainty. I thought of that earlier, what if Chrome refreshes the page and passes the data to the refreshed page in attempt to make it work despite the error at hand.

Tìtstewan

Quote from: Tirea Aean on October 17, 2014, 12:05:22 PM
I can't really remember.
Maybe, you can test this by this way: write yourself a PM and do in the PM mode a preview and you can see how chrome is doing it.

-| Na'vi Vocab + Audio | Na'viteri as one HTML file | FAQ | Useful Links for Beginners |-
-| Kem si fu kem rä'ä si, ke lu tìfmi. |-

Vawmataw

Test cheap low quality browser on android
:o Page reloads and function works.
Fmawn Ta 'Rrta - News IN NA'VI ONLY (Discord)
Traducteur francophone de Kelutral.org, dict-navi et Reykunyu

Tirea Aean

Quote from: Tìtstewan on October 18, 2014, 10:15:22 AM
Quote from: Tirea Aean on October 17, 2014, 12:05:22 PM
I can't really remember.
Maybe, you can test this by this way: write yourself a PM and do in the PM mode a preview and you can see how chrome is doing it.

It reloads on the PM page too. Except no error messages there.

Wllìm

For me, in Firefox, the page reloads as well on preview for PMs. :o

Tìtstewan

 ???
(because of those shocked smileys) Why you are shocked?

Don't remember me how FF did the preview on the normal post page... The PM page reloads for me too.
I still wondering why the PM preview works but not the standard preview page. :-\

-| Na'vi Vocab + Audio | Na'viteri as one HTML file | FAQ | Useful Links for Beginners |-
-| Kem si fu kem rä'ä si, ke lu tìfmi. |-

Wllìm

Quote from: Tìtstewan on October 19, 2014, 06:03:54 AM
???
(because of those shocked smileys) Why you are shocked?
Because Firefox doesn't reload on the previews for the posting page ???

Tìtstewan

I can't remember me, because I havn't spent attention how FF is doing the preview. :-X

But, I remember me, we had once a similar error:
Quote
Code (JavaScript) Select
{if
(typeof $.props['transform']=='undefined'&&(arg=='transform'||(typeof arg=='object'&&typeof arg['transform']!='undefined')))

--> TypeError: $.props is undefined[/size]
This was that code for the rotate function for Neytiri in the /Spam. The thing was, the code [$.props] no longer exists. It has been split into [$.attrFix] and [$.propFix].

So, it could be possible, that the function [XMLDoc.getElementsByTagName(...)[0]] has been changed to something else, doesn't it? ??? :-\

-| Na'vi Vocab + Audio | Na'viteri as one HTML file | FAQ | Useful Links for Beginners |-
-| Kem si fu kem rä'ä si, ke lu tìfmi. |-

Wllìm

No, I don't think so since it is a very widely used JavaScript function. See here, every browser supports it already for a very long time. ;)

Blue Elf

What is interesting - it doesn't work in FF 20.0 and 31.0, in both it worked before. FF wasn't updated, so why it suddenly doesn't work? Looks like update on the server!
Oe lu skxawng skxakep. Slä oe nerume mi.
"Oe tasyätxaw ulte koren za'u oehu" (Limonádový Joe)


`Eylan Ayfalulukanä

Fì'pamrel lu tìfmetok

I'm not sure Firefox reloads when it previews, but I seem to recall it does. Of course, not it is not trying to reload.

The fact that three different browsers experience the issue (I didn't try IE) tells me the problem is probably in the forum.

In other news: Back from a week at a place that had no internet service. (But they had a six month old liger cub :) )

Yawey ngahu!
pamrel si ro [email protected]

Toruk Makto

I think I have the preview problem fixed. Can someone confirm, please?

Lì'fyari leNa'vi 'Rrtamì, vay set 'almong a fra'u zera'u ta ngrrpongu
Na'vi Dictionary: http://files.learnnavi.org/dicts/NaviDictionary.pdf