You might disable that option - or fix that problem
Clicking 'select all' in MyList [FIXED?]
Moderator: AniDB
Clicking 'select all' in MyList [FIXED?]
Whenever there is only 1 file of a certain title and you expand that list, you`ll see that there is 1 checkbox and a 'select all' box. If you click the 'select all' box, the browser stalls for about 5 seconds or longer, and then nothing happens.
You might disable that option - or fix that problem
You might disable that option - or fix that problem
Problem is this, this code will say length is 151951.
var anime202 = new Array(151951);
alert(anime202.length);
This code will say length is 1.
var anime202 = new Array('151951');
alert(anime202.length);
So umm EXP. you need to make the numbers into strings for when there's only 1 file (or everywhere if the extra bytes is np).
var anime202 = new Array(151951);
alert(anime202.length);
This code will say length is 1.
var anime202 = new Array('151951');
alert(anime202.length);
So umm EXP. you need to make the numbers into strings for when there's only 1 file (or everywhere if the extra bytes is np).
Or assign them differently:
Or assign the checkboxes a class and use DOM to locate them. I'll have to recheck my JaveScript docu tho as I don't use it so frequently.
Code: Select all
var anime202 = new Array();
anime202[0] = 151951;Elberet, part of the reason the script is written as it is atm is to reduce the size of the code needed to find the stuff... ie, assigning the array by index = BAD.
There's probably some way to solve this better in DOM but then you'll have to write browser specific code to support the older browsers I believe. If there's some common way to do it in all browsers I don't know about it and I sure as hell wont take the time to figure it out when the current solution works just fine.
There's probably some way to solve this better in DOM but then you'll have to write browser specific code to support the older browsers I believe. If there's some common way to do it in all browsers I don't know about it and I sure as hell wont take the time to figure it out when the current solution works just fine.
Last edited by PetriW on Tue Aug 26, 2003 9:37 am, edited 1 time in total.
Ah, so a buggy script that freezes the browser works fine? 
By the way, another workaround for the current script would be to always create the array with an additional value and subtract 1 from the loop. I.e.:
By the way, another workaround for the current script would be to always create the array with an additional value and subtract 1 from the loop. I.e.:
Code: Select all
var anime202 = new Array(151951, 0);
var len = anime202.length - 1;The solution isn't buggy, only the array creation line in one case.
If you read the base code you'll see that the numbers are treated as strings, and that the bug is only the array creation line. Also, making changes in the base code by artificially adding one item to array is a really bad design habit and will only confuse other developers who might be using the code.
Better to do it properly and address the real issue, the fact that a string is treated as an array size number.
Edit: I should be nicer.
If you read the base code you'll see that the numbers are treated as strings, and that the bug is only the array creation line. Also, making changes in the base code by artificially adding one item to array is a really bad design habit and will only confuse other developers who might be using the code.
Better to do it properly and address the real issue, the fact that a string is treated as an array size number.
Edit: I should be nicer.
Yep, that's true. It's one of my vices to never care about JS code or HTML output that was generated by a PHP/Perl Script: as long as it runs and validates as proper HTML, anything goes...PetriW wrote:Also, making changes in the base code by artificially adding one item to array is a really bad design habit and will only confuse other developers who might be using the code.
Same goes for me. For some reason I've been quite cranky lately and must have stepped on some people's toes without even noticing...PetriW wrote:Edit: I should be nicer.