Page Index Toggle Pages: 1 [2] 3  Send TopicPrint
Very Hot Topic (More than 25 Replies) JavaScript errors (Read 21049 times)
Monni
Senior Member
****
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Re: JavaScript errors
Reply #23 - Aug 3rd, 2014 at 9:45pm
Print Post  
Dandello wrote on Aug 3rd, 2014 at 9:39pm:
Okay. Smiley


Now can I get a mention in Special thanks for 2.6.1 for finding and fixing most of the bugs after release of 2.6.0.  Smiley
  
Back to top
IP Logged
 
Dandello
Forum Administrator
*****
Offline


I love YaBB 2.7!

Posts: 1759
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Re: JavaScript errors
Reply #22 - Aug 3rd, 2014 at 9:39pm
Print Post  
Okay. Smiley
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Monni
Senior Member
****
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Re: JavaScript errors
Reply #21 - Aug 3rd, 2014 at 9:22pm
Print Post  
Little better...

But like this...

Code
Select All
Index: Subs.pm
===================================================================
--- Subs.pm	(revision 1520)
+++ Subs.pm	(working copy)
@@ -818,6 +818,19 @@
 s/"((avatar|avatarml|post|attach|signat|brd)_img_resize)"([^>]*>)/ check_image_resize($1,$2,$3) /gesm;

     if ($resize_num) {
+		$avatar_img_w    = $max_avatar_width // 0;
+		$avatar_img_h    = $max_avatar_height // 0;
+		$avatarml_img_w  = $max_avatarml_width // 0;
+		$avatarml_img_h  = $max_avatarml_height // 0;
+		$post_img_w      = $max_post_img_width // 0;
+		$post_img_h      = $max_post_img_height // 0;
+		$attach_img_w    = $max_attach_img_width // 0;
+		$attach_img_h    = $max_attach_img_height // 0;
+		$signat_img_w    = $max_signat_img_width // 0;
+		$signat_img_h    = $max_signat_img_height // 0;
+		$brd_img_w       = $max_brd_img_width // 0;
+		$brd_img_h       = $max_brd_img_height // 0;
+
         $resize_js =~ s/,$//xsm;
         $resize_js = qq~<script type="text/javascript">
     // resize image start
@@ -824,23 +837,23 @@
     var resize_time = 2;
     var img_resize_names = new Array ($resize_js);

-    var avatar_img_w    = $max_avatar_width;
-    var avatar_img_h    = $max_avatar_height;
+    var avatar_img_w    = $avatar_img_w;
+    var avatar_img_h    = $avatar_img_h;
     var fix_avatar_size = $fix_avatar_img_size;
-    var avatarml_img_w    = $max_avatarml_width;
-    var avatarml_img_h    = $max_avatarml_height;
+    var avatarml_img_w    = $avatarml_img_w;
+    var avatarml_img_h    = $avatarml_img_h;
     var fix_avatarml_size = $fix_avatarml_img_size;
-    var post_img_w      = $max_post_img_width;
-    var post_img_h      = $max_post_img_height;
+    var post_img_w      = $post_img_w;
+    var post_img_h      = $post_img_h;
     var fix_post_size   = $fix_post_img_size;
-    var attach_img_w    = $max_attach_img_width;
-    var attach_img_h    = $max_attach_img_height;
+    var attach_img_w    = $attach_img_w;
+    var attach_img_h    = $attach_img_h;
     var fix_attach_size = $fix_attach_img_size;
-    var signat_img_w    = $max_signat_img_width;
-    var signat_img_h    = $max_signat_img_height;
+    var signat_img_w    = $signat_img_w;
+    var signat_img_h    = $signat_img_h;
     var fix_signat_size = $fix_signat_img_size;
-    var brd_img_w       = $max_brd_img_width;
-    var brd_img_h       = $max_brd_img_height;
+    var brd_img_w       = $brd_img_w;
+    var brd_img_h       = $brd_img_h;
     var fix_brd_size    = $fix_brd_img_size;

     noimgdir   = '$imagesdir';
 

  
Back to top
IP Logged
 
Dandello
Forum Administrator
*****
Offline


I love YaBB 2.7!

Posts: 1759
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Re: JavaScript errors
Reply #20 - Aug 3rd, 2014 at 9:09pm
Print Post  
How about
Code
Select All
    if ($resize_num) {
		$avatar_img_w    = $max_avatar_width || 0;
		$avatar_img_h    = $max_avatar_height || 0;
		$avatarml_img_w    = $max_avatarml_width || 0;
		$avatarml_img_h    = $max_avatarml_height || 0;
		$post_img_w      = $max_post_img_width || 0;
		$post_img_h      = $max_post_img_height || 0;
		$attach_img_w    = $max_attach_img_width || 0;
		$attach_img_h    = $max_attach_img_height || 0;
		$signat_img_w    = $max_signat_img_width || 0;
		$signat_img_h    = $max_signat_img_height || 0;
		$brd_img_w       = $max_brd_img_width || 0;
		$brd_img_h       = $max_brd_img_height || 0;

        $resize_js =~ s/,$//xsm;
        $resize_js = qq~<script type="text/javascript">
    // resize image start
    var resize_time = 2;
    var img_resize_names = new Array ($resize_js);

    var avatar_img_w    = $avatar_img_w;
    var avatar_img_h    = $avatar_img_h;
    var fix_avatar_size = $fix_avatar_img_size;
    var avatarml_img_w    = $avatarml_img_w;
    var avatarml_img_h    = $avatarml_img_h;
    var fix_avatarml_size = $fix_avatarml_img_size;
    var post_img_w      = $post_img_w;
    var post_img_h      = $post_img_h;
    var fix_post_size   = $fix_post_img_size;
    var attach_img_w    = $attach_img_w;
    var attach_img_h    = $attach_img_h;
    var fix_attach_size = $fix_attach_img_size;
    var signat_img_w    = $signat_img_w;
    var signat_img_h    = $signat_img_h;
    var fix_signat_size = $fix_signat_img_size;
    var brd_img_w       = $brd_img_w;
    var brd_img_h       = $brd_img_h;
    var fix_brd_size    = $fix_brd_img_size;
 

  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Monni
Senior Member
****
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Re: JavaScript errors
Reply #19 - Aug 3rd, 2014 at 8:49pm
Print Post  
Another thing is that it should use // operator instead of || operator... as // means defined-or and || means true-or.
  
Back to top
IP Logged
 
Dandello
Forum Administrator
*****
Offline


I love YaBB 2.7!

Posts: 1759
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Re: JavaScript errors
Reply #18 - Aug 3rd, 2014 at 8:40pm
Print Post  
Ah so.  Embarrassed
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Monni
Senior Member
****
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Re: JavaScript errors
Reply #17 - Aug 3rd, 2014 at 7:31pm
Print Post  
Dandello wrote on Aug 3rd, 2014 at 7:00pm:
In theory, this should do it.


The problem is that the Perl parser can't know which part of the code is for Perl and which part is for the JavaScript code... it has to break the literal string to make it unambiguous.
  
Back to top
IP Logged
 
Dandello
Forum Administrator
*****
Offline


I love YaBB 2.7!

Posts: 1759
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Re: JavaScript errors
Reply #16 - Aug 3rd, 2014 at 7:00pm
Print Post  
Monni wrote on Aug 3rd, 2014 at 5:23pm:
People on the forum I upgraded noticed the missing semicolons because images in attachments stopped showing correctly. When I tried to debug the JavaScript code, it did suggest the error is on line number that is past end of the source code... After adding the missing semicolons it did correctly show the error is actually in the code that initializes board image scaling due to uninitialized variables. Like I mentioned in the first post the Perl code for injecting the values in JavaScript code is too simple and didn't default to 0 when the entry in settings file could not be read. 
                   



Okay. I know where to look now.

Edited:
In theory, this should do it.
In Subs.pm find
Code (Perl)
Select All
    var avatar_img_w    = $max_avatar_width;
    var avatar_img_h    = $max_avatar_height;
    var fix_avatar_size = $fix_avatar_img_size;
    var avatarml_img_w    = $max_avatarml_width;
    var avatarml_img_h    = $max_avatarml_height;
    var fix_avatarml_size = $fix_avatarml_img_size;
    var post_img_w      = $max_post_img_width;
    var post_img_h      = $max_post_img_height;
    var fix_post_size   = $fix_post_img_size;
    var attach_img_w    = $max_attach_img_width;
    var attach_img_h    = $max_attach_img_height;
    var fix_attach_size = $fix_attach_img_size;
    var signat_img_w    = $max_signat_img_width;
    var signat_img_h    = $max_signat_img_height;
    var fix_signat_size = $fix_signat_img_size;
    var brd_img_w       = $max_brd_img_width;
    var brd_img_h       = $max_brd_img_height;
    var fix_brd_size    = $fix_brd_img_size; 



and replace with
Code (Perl)
Select All
    var avatar_img_w    = $max_avatar_width || 0;
    var avatar_img_h    = $max_avatar_height || 0;
    var fix_avatar_size = $fix_avatar_img_size;
    var avatarml_img_w    = $max_avatarml_width || 0;
    var avatarml_img_h    = $max_avatarml_height || 0;
    var fix_avatarml_size = $fix_avatarml_img_size;
    var post_img_w      = $max_post_img_width || 0;
    var post_img_h      = $max_post_img_height || 0;
    var fix_post_size   = $fix_post_img_size;
    var attach_img_w    = $max_attach_img_width || 0;
    var attach_img_h    = $max_attach_img_height || 0;
    var fix_attach_size = $fix_attach_img_size;
    var signat_img_w    = $max_signat_img_width || 0;
    var signat_img_h    = $max_signat_img_height || 0;
    var fix_signat_size = $fix_signat_img_size;
    var brd_img_w       = $max_brd_img_width || 0;
    var brd_img_h       = $max_brd_img_height || 0;
    var fix_brd_size    = $fix_brd_img_size; 

  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Dandello
Forum Administrator
*****
Offline


I love YaBB 2.7!

Posts: 1759
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Re: JavaScript errors
Reply #15 - Aug 3rd, 2014 at 6:58pm
Print Post  
Monni wrote on Aug 3rd, 2014 at 6:11pm:
You broke it again?


No, it just hates me. (And it can't read my mind when I only want one post and forget to select that one post.  Wink)
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Monni
Senior Member
****
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Re: JavaScript errors
Reply #14 - Aug 3rd, 2014 at 6:11pm
Print Post  
Dandello wrote on Aug 3rd, 2014 at 2:26pm:
There are times I swear MoveSplitSplice simply hates me.


You broke it again?
  
Back to top
IP Logged
 
Monni
Senior Member
****
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Re: JavaScript errors
Reply #13 - Aug 3rd, 2014 at 5:23pm
Print Post  
Dandello wrote on Aug 3rd, 2014 at 2:21pm:
On the javascript - I just uploaded edited copies of ExtendedProfiles and PostBox for testing. My initial tests on my home server didn't catch any js errors in Chrome.


People on the forum I upgraded noticed the missing semicolons because images in attachments stopped showing correctly. When I tried to debug the JavaScript code, it did suggest the error is on line number that is past end of the source code... After adding the missing semicolons it did correctly show the error is actually in the code that initializes board image scaling due to uninitialized variables. Like I mentioned in the first post the Perl code for injecting the values in JavaScript code is too simple and didn't default to 0 when the entry in settings file could not be read.
  
Back to top
IP Logged
 
Dandello
Forum Administrator
*****
Offline


I love YaBB 2.7!

Posts: 1759
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Re: JavaScript errors
Reply #12 - Aug 3rd, 2014 at 2:26pm
Print Post  
There are times I swear MoveSplitSplice simply hates me.
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Dandello
Forum Administrator
*****
Offline


I love YaBB 2.7!

Posts: 1759
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Re: URI::Escape
Reply #11 - Aug 3rd, 2014 at 2:21pm
Print Post  
On the javascript - I just uploaded edited copies of ExtendedProfiles and PostBox for testing. My initial tests on my home server didn't catch any js errors in Chrome.
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Dandello
Forum Administrator
*****
Offline


I love YaBB 2.7!

Posts: 1759
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Re: URI::Escape
Reply #10 - Aug 3rd, 2014 at 2:25pm
Print Post  
Off-Topic replies have been moved to this Topic.
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Monni
Senior Member
****
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Re: JavaScript errors
Reply #9 - Aug 3rd, 2014 at 8:09am
Print Post  
Dandello wrote on Aug 2nd, 2014 at 10:44pm:

You know what happens to Yabbers who make comments like that?



They become moderators. Grin

In the first forum back in 2004 it took them about a week to promote me as an administrator... Because I was being such an annoying person... 
I ended up kicking out 90% of the users, including main sponsor of the company running the forum.
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1 [2] 3 
Send TopicPrint