function SongSelect(){ var _this=this; var _songs; var _selectedSong = {title:'', folder:'', difficulty:''}; var _code=""; this.run = function(){ _this.createCode(); _this.display(); $(window).resize(_this.display); var menuLoop = setInterval(_this.refresh, 20); $("#song-container").show(); $(".difficulty").click(function(e){ clearInterval(menuLoop); var difficultyElement = (e.target.className=="stars" || e.target.className=="diffname") ? e.target.parentElement : e.target; _selectedSong.difficulty = difficultyElement.classList[1]+'.osu'; var parentID = $(this).parent().closest(".song").attr("id"); var songID = parseInt(parentID.substr(5, parentID.length-1)); _selectedSong.title = $(this).parent().closest('.song').find('.song-title').html(); _selectedSong.folder = songID+" "+_selectedSong.title; new loadSong(_selectedSong); }); $(".song").hover(function(){ if(!$(this).hasClass("opened")) $(this).css("background", "rgba(255, 233, 125, 0.90)"); }, function(){ if(!$(this).hasClass("opened")) $(this).css("background", "rgba(255, 220, 47, 0.90)"); }); $(".song:not(.opened)").click(function(){ document.getElementById("don").play(); $(".difficulty").hide(); $(".opened").removeClass("opened", 300); $(this).addClass("opened", 300, "linear", function(){ $(this).find(".difficulty").show(); $(this).css("background", "rgba(255, 220, 47, 0.90)"); }); }); } this.createCode = function(){ for(var i=0; i b.difficulty) return 1; return 0; }); _code += "
"+songTitle+'
'; _code += "
"; } $("#song-container").html(_code); } this.display = function(){ } this.refresh = function(){ } $("#screen").load("/src/views/songselect.html", _this.run); }