Page Index Toggle Pages: 1 ReplyAdd Poll Send Topic
Normal Topic JavaScript error (Read 2551 times)
 
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
JavaScript error
Aug 17th, 2014 at 10:55am
Mark & QuoteQuote  
Uncaught TypeError: Cannot read property 'complete' of undefined YaBB.js:448
resize_brd_images YaBB.js:448
onload YaBB.pl:351

Code
Select All
 Index: cgi-bin/yabb2/Sources/BoardIndex.pm
 ===================================================================
 --- cgi-bin/yabb2/Sources/BoardIndex.pm	(revision 1534)
 +++ cgi-bin/yabb2/Sources/BoardIndex.pm	(working copy)
 @@ -1203,11 +1203,11 @@
  				$imgid = $brd_img_id{$curboard};
                  if ( $bdpic =~ /\//ism ) {
                      $bdpic =
 -qq~ <img src="$bdpic" alt="$boardname" title="$boardname" id="brd_id_$imgid" onload="resize_brd_images(brd_id_$imgid)" $brd_stylea$brd_w$brd_h$brd_styleb /> ~;
 +qq~ <img src="$bdpic" alt="$boardname" title="$boardname" id="brd_id_$imgid" onload="resize_brd_images(this);" $brd_stylea$brd_w$brd_h$brd_styleb /> ~;
                  }
                  elsif ($bdpic) {
                      $bdpic =
 -qq~ <img src="$imagesdir/$bdpicfld$bdpic" alt="$boardname" title="$boardname" id="brd_id_$imgid" onload="resize_brd_images(brd_id_$imgid)" /> ~;
 +qq~ <img src="$imagesdir/$bdpicfld$bdpic" alt="$boardname" title="$boardname" id="brd_id_$imgid" onload="resize_brd_images(this);" /> ~;
                  }

                  if ( $boardname !~ m/[ht|f]tp[s]{0,1}:\/\//sm ) {
  



Trick here is to use "this" instead of literal element id, because Chrome doesn't implicit cast the literal text as DOM object.
Like usually omitting the semicolon makes Chrome fail miserably.
« Last Edit: Aug 17th, 2014 at 12:36pm by Monni »  
Back to top
IP Logged
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
YaBB Modder
*****
Offline


I love YaBB 2.7!

Posts: 2235
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: JavaScript error
Reply #1 - Aug 17th, 2014 at 2:28pm
Mark & QuoteQuote  
Thanks -  learning more about js all the time.  Smiley

Edited:
Just uploaded the fix 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 error
Reply #2 - Aug 17th, 2014 at 2:48pm
Mark & QuoteQuote  
Chrome seems to be more picky about things... But I guess all browsers that share same JavaScript engine are equally picky... Quick look at the integrated debugger in Chrome's Developer Tools revealed again pretty amusingly how Chrome tried miserably to recover from missing semicolon...
  
Back to top
IP Logged
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
YaBB Modder
*****
Offline


I love YaBB 2.7!

Posts: 2235
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: JavaScript error
Reply #3 - Aug 17th, 2014 at 3:25pm
Mark & QuoteQuote  
Picky isn't bad if it makes us write better code.  Wink
  

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 error
Reply #4 - Aug 17th, 2014 at 3:57pm
Mark & QuoteQuote  
I noticed you committed the fix to SVN but you forgot to add the semicolons.
  
Back to top
IP Logged
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
YaBB Modder
*****
Offline


I love YaBB 2.7!

Posts: 2235
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: JavaScript error
Reply #5 - Aug 17th, 2014 at 4:19pm
Mark & QuoteQuote  
Got the beggars this time.  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 error
Reply #6 - Aug 17th, 2014 at 4:34pm
Mark & QuoteQuote  
One more time...

in trunk, the second change, the semicolon is now in wrong place...

it is before ), when it should be after it...
  
Back to top
IP Logged
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
YaBB Modder
*****
Offline


I love YaBB 2.7!

Posts: 2235
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: JavaScript error
Reply #7 - Aug 17th, 2014 at 4:42pm
Mark & QuoteQuote  
And this is why having more than one set of eyes looking at the code is such a good thing. 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 error
Reply #8 - Aug 17th, 2014 at 4:52pm
Mark & QuoteQuote  
Yeah...
When I write my own code, I write first, then think later... Sometimes it takes few hours to notice error in my own code, it happens sometimes after I have already turned off the computer or put it in sleep mode.
I guess I have developed my own style of quality control during the 31 years I have developed programs.
  
Back to top
IP Logged
 
Paste Member Name in Quick Reply Box Dandello
Forum Administrator
YaBB Modder
*****
Offline


I love YaBB 2.7!

Posts: 2235
Location: The Land of YaBB
Joined: Feb 12th, 2014
Gender: Female
Mood: Annoyed
Zodiac sign: Virgo
Re: JavaScript error
Reply #9 - Aug 17th, 2014 at 7:11pm
Mark & QuoteQuote  
Sometimes I realize I did something wrong when I'm out and about.
  

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

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