youtube-video-download.user.js
// createGroup(title, streams) - Creates a new menu group
createGroup(title, streams) - Creates a new menu group
createGroup ( title streams ) - Creates a new menu group
function createGroup(title, flat, streams)
 {
  var elem = document.createElement("div");
  elem.appendChild(createHeader(title));
  if (flat)
   for (var i = 0, max = streams.length; i < max; i ++)
    elem.appendChild(createMenuItemGroup([streams[i]]));
  else
  {
   var resolutions = [],
       resGroups = {};
   for (var i = 0, max = streams.length; i < max; i ++)
   {
    if (!resGroups[streams[i].height])
    {
     resolutions.push(streams[i].height);
     resGroups[streams[i].height] = [];
    }
    resGroups[streams[i].height].push(streams[i]);
   }
   for (var i = 0, max = resolutions.length; i < max; i ++)
    elem.appendChild(createMenuItemGroup(resGroups[resolutions[i]]));
  }
  return elem;
 }
function createGroup ( title , flat , streams ) { var elem = document . createElement ( "div" ) ; elem . appendChild ( createHeader ( title ) ) ; if ( flat ) for ( var i = 0 , max = streams . length ; i < max ; i ++ ) elem . appendChild ( createMenuItemGroup ( [ streams [ i ] ] ) ) ; else { var resolutions = [ ] , resGroups = { } ; for ( var i = 0 , max = streams . length ; i < max ; i ++ ) { if ( ! resGroups [ streams [ i ] . height ] ) { resolutions . push ( streams [ i ] . height ) ; resGroups [ streams [ i ] . height ] = [ ] ; } resGroups [ streams [ i ] . height ] . push ( streams [ i ] ) ; } for ( var i = 0 , max = resolutions . length ; i < max ; i ++ ) elem . appendChild ( createMenuItemGroup ( resGroups [ resolutions [ i ] ] ) ) ; } return elem ; }
createGroup(title, streams) - Creates a new menu group
createGroup ( title streams ) - Creates a new menu group