Skip to content

Instantly share code, notes, and snippets.

@Grassboy
Created November 20, 2011 12:36
Show Gist options
  • Save Grassboy/1380228 to your computer and use it in GitHub Desktop.
Save Grassboy/1380228 to your computer and use it in GitHub Desktop.
突破justin 30秒限制的javscript
(function(){
window.playerHTML = /*justin flash player 的 html code (<object> tag)*/;
jQuery("body").html(
'<span style="position:absolute; left:0px; top:20px;" id="player1"></span>' +
'<span style="position:absolute; left:0px; top:20px;" id="player2"></span>'
);
var refreshPlayer = function(current) {
var other = (current == "player1" ? "player2": "player1");
jQuery("#" + other).css("z-index", 10);
jQuery("#" + current).css("z-index", 1).html(window.playerHTML);
};
var resetAll = function() {
clearInterval(window.playerTimer1);
clearInterval(window.playerTimer2);
window.playerTimer1 = setInterval(function() {
refreshPlayer("player1");
},
30000);
refreshPlayer("player1");
setTimeout(function() {
window.playerTimer2 = setInterval(function() {
refreshPlayer("player2");
},
30000);
refreshPlayer("player2");
},
15000);
};
jQuery('<input type="button" style="position:absolute; top:0px; left:0px; width:99%; " value="重新讀取" />').appendTo("body").click(resetAll);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment