ladroop / Chaturbate Clean

TypeError: window.defchat_settings is undefined 1 Chaturbate_Clean.user.js:355:11


your error refers to this line :


This line is called on a page with chat and profile when the page loads and
when "clean profile" is clicked.
(At the end it will show the spy price in tk/min in the profile)
But i can't reproduce this error.
I looks like the script got no access to the page but it should have because
it runs in "@grant none".

Maybe you can give me more info about:
on what page does the error occur.
what browser do you use.
what monkey do you use ( e.g. tampermonkey , greasemonkey, violentmonkey).

Re: @ladroop:

I usually am doing other things but confirmed in SM with NoScript blocking domain. Go to any home page that has locked images/videos and you will see the locks visible since script execution is blocked by the error. The script also seems to not support GM4 at this time:

Here's a possibility on how you can fix these (tried to match your indentation style with the diff ignoring whitespace changes but probably failed ;):

--- a.user.js	2018-05-15 21:04:27.708858472 -0600
+++ b.user.js	2018-05-15 21:04:00.910999467 -0600
@@ -345,6 +345,10 @@

 // after clean up set spy/private/group price in the profile

+	// Test for GM4
+	var win = window.wrappedJSObject ? window.wrappedJSObject : window;
+	if (win.defchat_settings){
     if (document.getElementById('einfo')){
@@ -352,13 +356,13 @@
-	spyprc=window.defchat_settings.spy_price;
-	pvtprc=window.defchat_settings.private_price;
-	grpprc=window.defchat_settings.group_price;
-	noexhib=window.defchat_settings.allow_tipping;
+	  spyprc=win.defchat_settings.spy_price;
+	  pvtprc=win.defchat_settings.private_price;
+	  grpprc=win.defchat_settings.group_price;
+	  noexhib=win.defchat_settings.allow_tipping;
-		topictxt="<dt>Last Roomtopic:</dt><dd>"+decodeURIComponent(window.defchat_settings.default_subject)+"</dd>";
+		  topictxt="<dt>Last Roomtopic:</dt><dd>"+decodeURIComponent(win.defchat_settings.default_subject)+"</dd>";

     spytxt="<dt>Spy:</dt><dd>"+spyprc+" Tkns/Min.</dd>";
@@ -385,7 +389,10 @@"einfo";
     pnod.insertBefore(nnod, rnod.nextSibling);

-	}
+	}else{
+		// Domain script blocked by NoScript or equivalent
+		// Do not block script execution
+	}	}

     function blockelm(tag){
         image = container.getElementsByTagName(tag);

See also:

thank you serenity & Marti

Updated to v2.8
i use tampermonkey assuming that when it runs in @grant none it should all be compatible.
that was wrong ...

Re: @ladroop:

Appreciate your taking the time to address this. Thanks. Seems to be working well at your current revision.

GM is going through some growing pains with Fx... one would hope that Moz will proceed with their updates and allow GM to do what it is supposed to.