News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Finding differences/problem with js

Started by Gwenwyfar, March 18, 2015, 02:05:28 AM

Previous topic - Next topic

Gwenwyfar

Ok, so I have a chat mod installed that I was testing in a single board (yes, again... hopefully the last one, at this point I've now tried all of them :P). It works perfectly there. Then I finished working on it and moved it elsewhere, but there is a small bit of it that doesn't work anywhere else.

So, the problem would be kinda obvious, something is different, or I broke something, right?

In the testing I have now copied everything in the real forum to my test forum (on the same server). I tried the original chat on the test forum, works. I tried the modified files, it works. So I didn't break anything. Then I started copying other things to it: I now have copied all source files, all template files, all chat files, all js files for themes, language files, everything on root, I even tried using the same database, but it works on one, and not on the other. Also, since they are using the same database and files, even the chat itself is being loaded from the same folder now, since it calls for boardurl. Is there anything I'm missing here? Because obviously something is still different since it works in one and not in the other.

The only relevant thing that is different at this point that I can think of is the path, since the test forum is in a subfolder, but permissions, etc are all the same. It might still be valid to consider though, since the messageindex is the only part of the forum I tested it in that also has an extra "/" in the url.

Now, for the actual problem: The chat uses the database, and has a php file to load and another to send things, then a js file to do it. The refresh is a load on a txt file. The bit that doesn't work is the refresh. It can get and send messages, but not refresh them. So something is failing there, I tried making the url an absolute path and checking what was in the boardurl, but it seems all normal. On the browser console, the "get" function does not show up either as an error or as an attempt on pages it doesn't work.

Here is the bit responsible for it:

var check = '000';
function tbCheck(){
if($.cookie("tbcookie") == dcookie){
nocache = Math.random();
$.get('http://domain.com/talkbox/refresh.txt?'+nocache, function(data){
if(check != data){
if(data == 'clear'){
tbGet('full');
}
else{
if(check != '000'){
tbGet('normal');
}
}
check = data;
}
});
}
}


Any ideas on where else I could look? I've tried everything I had in mind already.
"It is impossible to communicate with one that does not wish to communicate"

margarett

Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Gwenwyfar

#2
Nope, it doesn't display anything at all when it is not working.

The only relevant thing in it is somewhere else, not sure if it makes a difference, it is there when working & when not: SyntaxError: missing ) after argument list (theme.js)

Edit: Found another page that has an extra "/", but it doesn't work there either... might not make any sense to be this after all :/

It is nothing in the template on messageindex, though, I've already stripped it entirely in one test, leaving only the chat.
"It is impossible to communicate with one that does not wish to communicate"

Gwenwyfar

#3
Seems to have something to do with cookies on messageindex.

Edit: Well, this is going to be more of a workaround than solution, but the problem seems to be that the cookie the js of the chat gets in messageindex of the main site gets "stuck" for some reason, whereas other pages don't create a permanent cookie, it probably reads and deletes it. For now I guess not letting it generate that cookie in the first place should work as a solution.
"It is impossible to communicate with one that does not wish to communicate"

Advertisement: