Fix #152; change JS load order to load faster

This commit is contained in:
calzoneman 2013-05-27 15:00:32 -04:00
parent 296bddefcd
commit 16d3c600fe
3 changed files with 20 additions and 24 deletions

View File

@ -617,12 +617,12 @@ Callbacks = {
}, },
changeMedia: function(data) { changeMedia: function(data) {
console.log(data);
$("#currenttitle").text("Currently Playing: " + data.title); $("#currenttitle").text("Currently Playing: " + data.title);
if(data.type != "sc" && MEDIATYPE == "sc") if(data.type != "sc" && PLAYER.type == "sc")
// [](/goddamnitmango) // [](/goddamnitmango)
fixSoundcloudShit(); fixSoundcloudShit();
if(data.type != MEDIATYPE) { if(data.type != PLAYER.type) {
MEDIATYPE = data.type;
PLAYER = new Media(data); PLAYER = new Media(data);
} }
if(PLAYER.update) { if(PLAYER.update) {

View File

@ -471,25 +471,21 @@ Media.prototype.removeOld = function() {
} }
Media.prototype.hide = function() { Media.prototype.hide = function() {
if(this.type == "null") { if(!/chrome/ig.test(navigator.userAgent)) {
return; return;
} }
this.getTime(function(seconds) { this.size = {
this.time = seconds; width: $("#ytapiplayer").attr("width"),
this.hidden = $("#ytapiplayer").detach(); height: $("#ytapiplayer").attr("height")
}.bind(this)); };
$("#ytapiplayer").attr("width", 1)
.attr("height", 1);
} }
Media.prototype.unhide = function() { Media.prototype.unhide = function() {
if(this.type == "null") { if(!/chrome/ig.test(navigator.userAgent)) {
return; return;
} }
this.hidden.appendTo($("#videodiv")); $("#ytapiplayer").attr("width", this.size.width)
var data = { .attr("height", this.size.height);
id: this.id,
currentTime: this.time
};
setTimeout(function() { this.load(data); }.bind(this), 1000);
delete this.hidden;
delete this.time;
} }

View File

@ -289,6 +289,13 @@
</div> </div>
<script src="./assets/js/jquery.js"></script>
<!-- My Javascript -->
<script src="./assets/js/iourl.js"></script>
<script src="./assets/js/functions.js"></script>
<script src="./assets/js/callbacks.js"></script>
<script src="./assets/js/media.js"></script>
<script src="./assets/js/client.js"></script>
<!-- APIs --> <!-- APIs -->
<script src="http://api.dmcdn.net/all.js"></script> <script src="http://api.dmcdn.net/all.js"></script>
<script src="http://jwpsrv.com/library/QouFCLBMEeKC+CIACpYGxA.js"></script> <script src="http://jwpsrv.com/library/QouFCLBMEeKC+CIACpYGxA.js"></script>
@ -296,16 +303,9 @@
<script src="./assets/js/froogaloop.min.js"></script> <script src="./assets/js/froogaloop.min.js"></script>
<script src="./assets/js/swf.js"></script> <script src="./assets/js/swf.js"></script>
<!-- Third party --> <!-- Third party -->
<script src="./assets/js/jquery.js"></script>
<script src="./assets/js/bootstrap.js"></script> <script src="./assets/js/bootstrap.js"></script>
<script src="./assets/js/bootstrap-transition.js"></script> <script src="./assets/js/bootstrap-transition.js"></script>
<script src="./assets/js/bootstrap-modal.js"></script> <script src="./assets/js/bootstrap-modal.js"></script>
<!-- My Javascript -->
<script src="./assets/js/iourl.js"></script>
<script src="./assets/js/functions.js"></script>
<script src="./assets/js/callbacks.js"></script>
<script src="./assets/js/media.js"></script>
<script src="./assets/js/client.js"></script>
</body> </body>
</html> </html>