• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Watch/un-watch thread JS error. Completely stumped.

TrevC

Well-known member
#1
I'm hoping someone here who's more knowledgeable with Xenforo JS can point me in the right direction. I can't figure out what's causing this error after trying to watch or un-watch a thread:
Code:
TypeError: this.$form.parents(".xenOverlay").data("overlay") is undefined
That's from Firebug, Chrome's console shows:
Code:
Uncaught TypeError: Cannot call method 'getTrigger' of undefined
The ajax indicator then remains visible, and the watch/unwatch button text does not toggle.

I can reproduce this any time I do "Watch thread" then confirm within the dialog overlay. Un-watching a thread triggers the same error.

I'm afraid I've removed something from the templates which the Xenforo JS is referencing, but I have no idea what it could be. I've reverted many of the custom templates to originals for troubleshooting and had no luck.

What could I be missing here? What is that JS looking for and not finding?

Reverting to the completely stock Xenforo theme sorts it out, it works fine. I've gone as far as reverting all my custom templates right down to the page_container and still hit the same error.

Any pointers would be much appreciated. Thanks
 

Chris D

XenForo developer
Staff member
#2
Is this the only javascript thing that isn't working?

I've seen random JS errors caused by including a newer or older version of jQuery than the one provided.

The other thing could be you've included some other javascript (either external or inline) that is broken, but it is actually causing Xenforo code to be broken.

If you create a new style with no parent, does the problem still exist? That definitely proves it's more style/template related.

Also do a File Health Check in Admin CP > Tools > File Healthcheck this will make sure the js files have the expected contents.
 

TrevC

Well-known member
#3
It's most likely style/template related. Using a different child style adjacent to the broken one works fine.

I've reverted many of the templates in the affected style to find the culprit. It's extremely tedious/time-consuming... no luck so far. What is Xenforo expecting to find after that watch/un-watch dialog is confirmed?

I must have overlooked/missed something, or it's something more obscure and higher level (unlikely).
 

TrevC

Well-known member
#4
- jQuery is the stock version, 1.5.2 or whatever.
- File health just shows the /install dir missing, plus a few core files that have minor mods (mostly image/attachment related).

Neither of these will be it, since switching the style resolves the JS console errors/bugs. If the JS errors were more informative, I'd have a better idea where to look.
 

TrevC

Well-known member
#5
The full output from chrome console:
Code:
OverlayLoader for threads/speedy-x33-floating-in-space.3236/watch-confirm xenforo.js:13
XenForo.activate(
[div.xenOverlay __XenForoActivator, constructor: function, init: function, selector: "", jquery: "1.5.2", size: function…]
) xenforo.js:12
Abort pending field validation... xenforo.js:14
Event: AutoValidationDataReceived xenforo.js:13
: Okay xenforo.js:14
Event: AutoValidationComplete xenforo.js:13
DeCache
[div.xenOverlay, selector: "", context: undefined, constructor: function, init: function, selector: ""…]
xenforo.js:13
Uncaught TypeError: Cannot call method 'getTrigger' of undefined xenforo.js:13
XenForo.AutoValidator.ajaxSaveResponse xenforo.js:13
(anonymous function) xenforo.js:12
h xenforo.js:12
f.resolveWith jquery.min.js:16
v jquery.min.js:16
c jquery.min.js:16
 

Chris D

XenForo developer
Staff member
#6
Actually, you do have bigger javascript problems than you think...

I'm just registering at your site via Facebook.

There's two tabs. One to create a new account, one to associate an existing.

Both the tabs content is displayed. javascript would normally hide the unselected tabs content until the tab is clicked.

Capture.PNG
 

TrevC

Well-known member
#7
That's actually the old site theme. The newer version makes more drastic changes to the templates. A few changes/bugs might have trickled back to the old version.

Let me know your username and I'll put you on the even more broken v2.0 :)
 

Chris D

XenForo developer
Staff member
#10
Ok, all... I'm stuck!

This is not a javascript error. The same javascript files work fine on other styles. Only on the new style that TrevC is creating do we see this error with Thread Watch / UnWatch.

I asked Trev to enable debug mode and enable full/xenforo.js and this is the error:

Uncaught TypeError: Cannot call method 'getTrigger' of undefined xenforo.js:5590
XenForo.AutoValidator.ajaxSaveResponse xenforo.js:5590
(anonymous function) xenforo.js:90
successCallback xenforo.js:1159
f.resolveWith jquery.min.js:16
v jquery.min.js:16
c jquery.min.js:16

Which lines up with:


Does that provide any clues as to what I could have missed or messed up in the template?

Trev has reverted a number of templates and the issue persists and we as a precaution we overwrote the JS files with stock files from the xf package and problems persist.
Anyone else with ideas? Would be greatly appreciated :)
 

TrevC

Well-known member
#12
Is it possible that the data-overlay attribute on the xenOverlay is missing or null? Does the overlay display at all? Look at it's markup.
Any idea which template stores the overlay?

I was thinking something along those lines, but couldn't figure out where the overlay markup etc is generated from. Thanks for your input.
 

TrevC

Well-known member
#13
Just to follow up:

The overlay to confirm or cancel does show up, and is properly closed. I assume there's also supposed to be something like a .xenOverlay .timedMessage style overlay after an option is chosen? This is never created.
 

TrevC

Well-known member
#14
Yep. This is created on the stock Xenforo style, but not mine. Must be related to the error. Where is this overlay created from?


I'm running entirely stock JS files at this point, and have tried reverting many templates back to originals with no success.
 

cclaerhout

Well-known member
#15
When your recompiled the xenforo.js file did you include the external scripts such as jquery tools, easing, etc ?
About the error message try to see if the missing function is or is not in the js file. Don't only stop to the error. Correct me if I'm wrong but if you revert all your templates mods is it working (export your style first to make a backup of your modifications)
Try to turn off TMS to avoid any unwanted modification during the debugging
 

TrevC

Well-known member
#16
At the moment I'm running purely stock JS directory from 1.1.1, with the addition of TinyMCE Fix (which i'm very confident is not the issue here). Not running TMS. I've also tried disabling all add-ons (they're not the issue anyhow).

Right not I'm going through and reverting templates one by one, no matter how unrelated they seem. Still haven't hit the lucky one.

You'd think thread_view or the usual suspects for that page could be it, but they don't appear to be.
 

Chris D

XenForo developer
Staff member
#17
When your recompiled the xenforo.js file did you include the external scripts such as jquery tools, easing, etc ?
About the error message try to see if the missing function is or is not in the js file. Don't only stop to the error. Correct me if I'm wrong but if you revert all your templates mods is it working (export your style first to make a backup of your modifications)
Try to turn off TMS to avoid any unwanted modification during the debugging
It actually doesn't matter about the xenforo.js file. The same xenforo.js file works fine on another style.

So frustrating this issue is :(
 

TrevC

Well-known member
#18
Yeah, my hacked up JS didn't appear to be the culprit, at least not directly.

I still wanted to eliminate all possibilites, so I'll keep the 1.1.1 stock stuff running locally.
 

cclaerhout

Well-known member
#19
Yeah, my hacked up JS didn't appear to be the culprit, at least not directly.

I still wanted to eliminate all possibilites, so I'll keep the 1.1.1 stock stuff running locally.
Sorry my ipod ran out of battery. Don't hesitate to disable the FixTiny addon. In fact disable all addons is better.

To avoid to revert all your templates you can try to create a stupid template listener (after rendered) to display the templates name (use a simple echo, var_dump, etc.) which are loading on the page with the watch/unwatch function. As we've learnt with Chris the templates which use the xen tag "include" won't be displayed but you should still have most of them. Then check if among the displayed template names one has been modified.
 

TrevC

Well-known member
#20
Thanks for the suggestions.

For now I have a new problem. I deleted a style property group within my style, but it appears to have deleted the MASTER property group for overlays. Awesome.



So, now i need to restore that missing property group without disrupting an active forum. If I copy over the install folder and run the "Rebuild Master Data" option, will that create further problems on a live site?