var BeatHaven, _ajax, _beathaven, _pages, _player, _search, _session, _settings, _vkontakte; _beathaven = null; _session = 1; _vkontakte = null; _ajax = null; _player = null; _search = null; _pages = null; _settings = null; $(function() { var l, _ref; l = document.location; if ((_ref = l.host) !== 'beathaven.org' && _ref !== 'localhost') { l.href = 'http://beathaven.org/' + l.hash; } _beathaven = new BeatHaven(); _beathaven.init(); $(window).resize(function() { return _beathaven.adjustSizes(); }); return window.setTimeout(function() { return _beathaven.checkRedrawScrollbar(); }, 500); }); BeatHaven = (function() { function BeatHaven() {} BeatHaven.prototype.last_height = false; BeatHaven.prototype.init = function() { this.adjustSizes(); this.checkRedrawScrollbar(); _vkontakte = new Vkontakte(document.location.host === 'beathaven.org' ? 2335068 : 2383163); _vkontakte.init(); _ajax = new Ajax(); _player = new Player(); _player.initJplayer(); _search = new Search(); _pages = new Pages(); _settings = new Settings(); return _ajax.detectPage(); }; BeatHaven.prototype.adjustSizes = function() { $('.data-container').height($(window).height() - $('.header-container').height()); $('.data-container').width($(window).width() - $('.player').width()); $('.player-container').height($(window).height()); $('.playlist').height($(window).height() - $('.player').height() - $('.player-container .additional-controls').height()); $('.data-container').scrollbar(); return $('.playlist').scrollbar(); }; BeatHaven.prototype.checkRedrawScrollbar = function() { var focused_id, outer_height; focused_id = false; if (document.activeElement.id != null) { focused_id = document.activeElement.id; } outer_height = $('.data-container > div').outerHeight(); if (outer_height > 300 && outer_height !== this.last_height) { this.last_height = outer_height; this.redrawScrollbar(); } if (focused_id) { document.getElementById(focused_id).focus(); focused_id = false; } return window.setTimeout(function() { return _beathaven.checkRedrawScrollbar(); }, 500); }; BeatHaven.prototype.redrawScrollbar = function() { $('.data-container').html($('.data-container').find('.inner').first()); return $('.data-container').scrollbar(); }; return BeatHaven; })(); String.prototype.htmlsafe = function() { var item, replaces, str, _i, _len; replaces = [["\\", "\\\\"], ["\"", """], ["<", "<"], [">", ">"]]; str = this; for (_i = 0, _len = replaces.length; _i < _len; _i++) { item = replaces[_i]; str = str.replace(item[0], item[1]); } return str; }; String.prototype.trim = function() { var str; str = this; while (str.indexOf(' ') !== -1) { str = str.replace(' ', ' '); } if (str.charAt(0) === ' ') { str = str.substring(1); } if (str.charAt(str.length - 1) === ' ') { str = str.substring(0, str.length - 1); } return str; };