jQuery Grouping Similar Items w/ Object Literal
- by NessDan
So I have this structure setup:
<ul>
<li>http://www.youtube.com/watch?v=dw1Vh9Yzryo</li> (Vid1)
<li>http://www.youtube.com/watch?v=bOF3o8B292U</li> (Vid2)
<li>http://www.youtube.com/watch?v=yAY4vNJd7A8</li> (Vid3)
<li>http://www.youtube.com/watch?v=yAY4vNJd7A8</li>
<li>http://www.youtube.com/watch?v=dw1Vh9Yzryo</li>
<li>http://www.youtube.com/watch?v=bOF3o8B292U</li>
<li>http://www.youtube.com/watch?v=yAY4vNJd7A8</li>
<li>http://www.youtube.com/watch?v=dw1Vh9Yzryo</li>
</ul>
Vid1 is repeated 3 times, Vid2 is repeated 3 times, and Vid3 is repeated 2 times. I want to put them into a structure where I can reference them like this:
youtube[0][repeated] = 3;
youtube[0][download] = "http://www.youtube.com/get_video?video_id=dw1Vh9Yzryo&fmt=36"
youtube[1][repeated] = 3;
youtube[1][download] = "http://www.youtube.com/get_video?video_id=bOF3o8B292U&fmt=36"
youtube[2][repeated] = 3;
youtube[2][download] = "http://www.youtube.com/get_video?video_id=yAY4vNJd7A8&fmt=36"
"This video was repeated " + youtube[0][repeated] + " times and you can download it here: " + youtube[0][download];
How can I set this multidimensional array up? Been Googling for hours and I don't know how to set it up. Can anyone help me out?