Page Index Toggle Pages: 1 [2] 3  ReplyAdd Poll Send Topic
Very Hot Topic (More than 25 Replies) JavaScript errors (Read 12846 times)
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
YaBB Modder
*****
Online


I love YaBB 2.7!

Posts: 2234
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: JavaScript errors
Reply #15 - Aug 3rd, 2014 at 6:58pm
Mark & QuoteQuote  
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
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
*****
Online


I love YaBB 2.7!

Posts: 2234
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: JavaScript errors
Reply #16 - Aug 3rd, 2014 at 7:00pm
Mark & QuoteQuote  
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
 
Paste Member Name in Quick Reply Box Monni
Language
***
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Mood: Frustrated
Zodiac sign: Pisces
Re: JavaScript errors
Reply #17 - Aug 3rd, 2014 at 7:31pm
Mark & QuoteQuote  
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
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
*****
Online


I love YaBB 2.7!

Posts: 2234
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: JavaScript errors
Reply #18 - Aug 3rd, 2014 at 8:40pm
Mark & QuoteQuote  
Ah so.  Embarrassed
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Paste Member Name in Quick Reply Box Monni
Language
***
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Mood: Frustrated
Zodiac sign: Pisces
Re: JavaScript errors
Reply #19 - Aug 3rd, 2014 at 8:49pm
Mark & QuoteQuote  
Another thing is that it should use // operator instead of || operator... as // means defined-or and || means true-or.
  
Back to top
IP Logged
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
*****
Online


I love YaBB 2.7!

Posts: 2234
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: JavaScript errors
Reply #20 - Aug 3rd, 2014 at 9:09pm
Mark & QuoteQuote  
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
 
Paste Member Name in Quick Reply Box Monni
Language
***
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Mood: Frustrated
Zodiac sign: Pisces
Re: JavaScript errors
Reply #21 - Aug 3rd, 2014 at 9:22pm
Mark & QuoteQuote  
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
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
*****
Online


I love YaBB 2.7!

Posts: 2234
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: JavaScript errors
Reply #22 - Aug 3rd, 2014 at 9:39pm
Mark & QuoteQuote  
Okay. Smiley
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Paste Member Name in Quick Reply Box Monni
Language
***
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Mood: Frustrated
Zodiac sign: Pisces
Re: JavaScript errors
Reply #23 - Aug 3rd, 2014 at 9:45pm
Mark & QuoteQuote  
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
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
*****
Online


I love YaBB 2.7!

Posts: 2234
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: JavaScript errors
Reply #24 - Aug 3rd, 2014 at 10:12pm
Mark & QuoteQuote  
Oh, I'm sure there are still some waiting for you... Grin

But I do try to give credit where credit is due - and bug hunters are a valuable resource.
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Paste Member Name in Quick Reply Box Monni
Language
***
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Mood: Frustrated
Zodiac sign: Pisces
Re: JavaScript errors
Reply #25 - Aug 3rd, 2014 at 10:41pm
Mark & QuoteQuote  
Dandello wrote on Aug 3rd, 2014 at 10:12pm:
Oh, I'm sure there are still some waiting for you... Grin


I know... I'm just getting started... Like I mentioned in another thread, 2.6.1 shouldn't be current until we find all the bugs and hiccups and fix them Wink
  
Back to top
IP Logged
 
Paste Member Name in Quick Reply Box Batchman
Full Member
***
Offline


I Love YaBB!

Posts: 165
Location: Somewhere just East of Crazy
Joined: Jul 25th, 2014
Gender: Male
Mood: Depressed
Zodiac sign: Libra
Re: JavaScript errors
Reply #26 - Aug 4th, 2014 at 9:30pm
Mark & QuoteQuote  
Dandello wrote on Aug 3rd, 2014 at 2:26pm:
There are times I swear MoveSplitSplice simply hates me.
                     



Better than me ... you just have one small file that hates you. Computers hate me ... and when I love them so very much!

It's not fair, I tell you!
  

If you don't know where you are, but you don't care, you're not lost ... you're exploring!
Back to top
 
IP Logged
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
*****
Online


I love YaBB 2.7!

Posts: 2234
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: JavaScript errors
Reply #27 - Aug 8th, 2014 at 3:37pm
Mark & QuoteQuote  
Code (Perl)
Select All
+		$avatar_img_w    = $max_avatar_width // 0; 



I knew there was a reason I didn't use the defined-or method. It came into use in Perl 5.10 and an awful lot of hosting services are still using Perl 5.8. (Including the VPS here for testing.)
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Paste Member Name in Quick Reply Box Monni
Language
***
Offline


Min izāmō

Posts: 413
Location: Kaarina, Finland
Joined: Jul 16th, 2014
Gender: Male
Mood: Frustrated
Zodiac sign: Pisces
Re: JavaScript errors
Reply #28 - Aug 9th, 2014 at 6:15pm
Mark & QuoteQuote  
Dandello wrote on Aug 8th, 2014 at 3:37pm:
Code (Perl)
Select All
+            $avatar_img_w    = $max_avatar_width // 0; 



I knew there was a reason I didn't use the defined-or method. It came into use in Perl 5.10 and an awful lot of hosting services are still using Perl 5.8. (Including the VPS here for testing.)


We can't fix bad code with more bad code...

A // B equals defined A ? A : B
  
Back to top
IP Logged
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
*****
Online


I love YaBB 2.7!

Posts: 2234
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: JavaScript errors
Reply #29 - Aug 10th, 2014 at 3:47pm
Mark & QuoteQuote  
I'm not arguing that the error catch is needed - just that we can't use the shortcut until/unless we announce that X version of YaBB will require a version of Perl newer that what a lot of hosts are still using.
  

Perfection is not possible. Excellence, however, is excellent.
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1 [2] 3 
ReplyAdd Poll Send Topic
Bookmarks: del.icio.us Digg Facebook Google LinkedIn reddit Twitter Yahoo
JavaScript errors

Please type the characters exactly as they appear in the image,
without the first 2 and last 2 characters.
The characters must be typed in the same order,
and they are case-sensitive.
Open Preview Preview

You can resize the textbox by dragging the right or bottom border.
Off Topic Comment Insert Spoiler
Insert Hyperlink Insert FTP Link Insert Image Insert E-mail Insert Media Insert Table Insert Table Row Insert Table Column Insert Horizontal Rule Insert Teletype Insert Code Insert Quote Edited Superscript Subscript Insert List /me - my name Insert Marquee Insert Timestamp No Parse
Bold Italicized Underline Insert Strikethrough Highlight
                       
Change Text Color
Insert Preformatted Text Left Align Centered Right Align
resize_wb
resize_hb







Max 5000 characters. Remaining characters:
Text size: %
More Smilies
View All Smilies
Collapse additional features Collapse/Expand additional features Smiley Wink Cheesy Grin Angry Sad Shocked Cool Huh Roll Eyes Tongue Embarrassed Lips Sealed Undecided Kiss Cry