Created
October 27, 2013 09:12
-
-
Save perminder-klair/7179481 to your computer and use it in GitHub Desktop.
blugaa ajax code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getRandomString(e) { | |
var t = ""; | |
var n = "abcdefghijklmnopqrstuvqxyz"; | |
for (var r = 0; r < e; r++) t += n.charAt(Math.floor(Math.random() * n.length)); | |
return t | |
} | |
function blugaaRadio() { | |
this.queue = new Array; | |
this.dequeue = function() { | |
this.enqueue(); | |
return this.queue.shift() | |
}; | |
this.power = false; | |
this.setup = function() { | |
this.enqueue(); | |
this.enqueue() | |
}; | |
this.enqueue = function() { | |
f = getRandomString(5); | |
$.getJSON("/api/radio.php?id=" + f, function(e) { | |
bplayer.radio.queue.push(e) | |
}) | |
}; | |
this.play = function() { | |
bplayer.playTrack(this.dequeue()) | |
}; | |
this.activate = function() { | |
this.power = true; | |
soundManager.stopAll(); | |
$("#player_buttonRadio").removeClass("player_buttonRadioOff").addClass("player_buttonRadioOn"); | |
this.play() | |
}; | |
this.deactivate = function() { | |
bplayer.resetRadio(); | |
$("#player_buttonRadio").removeClass("player_buttonRadioOn").addClass("player_buttonRadioOff") | |
}; | |
this.getNextTrack = function() { | |
return this.queue[0] | |
} | |
} | |
function reloadAds() { | |
return; | |
googletag.pubads().refresh([slot1]); | |
googletag.cmd.push(function() { | |
googletag.display("div-gpt-ad-1358757159521-0") | |
}); | |
if ($("#div-gpt-ad-1367927631285-0").length) { | |
googletag.display("div-gpt-ad-1367927631285-0") | |
} | |
if ($("#div-gpt-ad-1368271506639-0").length) { | |
googletag.display("div-gpt-ad-1368271506639-0") | |
} | |
} | |
function trackPage(e) { | |
e = e.replace('http://www.blugaa.com', '').replace('http://blugaa.com', ''); | |
_gaq.push(["_trackPageview", e]); | |
} | |
function cantPlay() { | |
alert("This Track is unavailable due to licensing restrictions. \nYou can enjoy videos.") | |
} | |
function addToPlaylist(e) { | |
if (!loggedIn) { | |
showToast("You Need To Be Logged In!"); | |
return | |
} | |
$.post("/api/favourite.php", { | |
track: e, | |
action: 1 | |
}, function(e) { | |
if (e.status) { | |
showToast("Added To Favourites") | |
} | |
}) | |
} | |
function playTrackIfReqested() { | |
var e = window.location.search; | |
if (e) { | |
e = e.substr(6); | |
if (e) { | |
if (e == "album") { | |
playAllTracks() | |
} else { | |
bplayer.enqueue(e) | |
} | |
} | |
} | |
} | |
function fbShare(e) { | |
NewWindow("https://www.facebook.com/sharer/sharer.php?u=" + e, "login", 500, 500, "no") | |
} | |
function bindContactForm() { | |
$.post("/api/contact/index.php", $("#contact").serialize(), function(e) { | |
if (e) alert("You Message Was Sent."); | |
else alert("There was some error.!") | |
}) | |
} | |
function openLoginWindow(e) { | |
NewWindow("/auth/authenticate.php?provider=" + e, "login", 500, 500, "no") | |
} | |
function openLogoutWindow() { | |
NewWindow("/auth/authenticate.php?mode=logout", "login", 500, 500, "no") | |
} | |
function NewWindow(e, t, n, r, i) { | |
LeftPosition = screen.width ? (screen.width - n) / 2 : 0; | |
TopPosition = screen.height ? (screen.height - r) / 2 : 0; | |
settings = "height=" + r + ",width=" + n + ",top=" + TopPosition + ",left=" + LeftPosition + ",scrollbars=" + i + ",resizable=no"; | |
win = window.open(e, t, settings) | |
} | |
function bindRemoveTrackFromQueue() { | |
$(".removeAllTracksFromQueue").click(function() { | |
bplayer.reset(); | |
bplayer.updatePlaylist(); | |
hideToast() | |
}); | |
$("div.removeTrackFromQueue").click(function() { | |
bplayer.remove($(this).attr("data-id")); | |
bplayer.updatePlaylist(); | |
var e = bplayer.getNextTrack(); | |
if (e == undefined) { | |
e.title = "" | |
} | |
$("#player_nextTrackTitle").text(e.title.substring(0, 17)) | |
}) | |
} | |
function showToast(e, t) { | |
clearTimeout(toastTimer); | |
$("#notificationToast").show(); | |
$("#notificationToast").text(e); | |
if (t == undefined) { | |
toastTimer = setTimeout(hideToast, 5e3) | |
} else { | |
if (t != 0) { | |
toastTimer = setTimeout(hideToast, t * 1e3) | |
} | |
} | |
} | |
function hideToast() { | |
$("#notificationToast").fadeOut("slow") | |
} | |
function bindAllLinks() { | |
$("a").click(function() { | |
if ($(this).attr("no-ajax") == 1) { | |
return true | |
} | |
if ($(this).attr("href") == undefined) { | |
return false | |
} | |
if ($(this).attr("href") == "#") { | |
return false | |
} | |
var e = $(this).attr("href"); | |
History.pushState({ | |
state: 1 | |
}, "Loading. Please Wait....", e); | |
return false | |
}) | |
} | |
function blugaaPlayer() { | |
this.setup = function() { | |
seekSlider.slider("disable"); | |
soundManager.setup({ | |
url: "/swf/v2", | |
ontimeout: function() { | |
alert("Error") | |
}, | |
debugMode: true, | |
useConsole: true, | |
useHTML5Audio: true | |
}); | |
soundManager.onready(function() { | |
playTrackIfReqested() | |
}); | |
bplayer.updateHd(); | |
bplayer.radio.setup() | |
}; | |
this.radio = new blugaaRadio; | |
this.currentTrack = null; | |
this.play = function(e) { | |
if (!e) { | |
if (!this.currentTrack) { | |
showToast("Nothing to play!"); | |
return | |
} | |
soundManager.play(this.currentTrack.id); | |
return | |
} | |
showToast("Buffering"); | |
$.getJSON("/api/getTrackInfo.php?id=" + e, function(e) { | |
bplayer.playTrack(e) | |
}) | |
}; | |
this.playtime = 1; | |
this.cover = ""; | |
this.shuffle = false; | |
this.hd = readCookie("hd") == 1 ? true : false; | |
this.repeat = true; | |
this.lastRandom = -1; | |
this.pause = function() { | |
soundManager.pause(this.currentTrack.id) | |
}; | |
this.volume = function(e) { | |
if (this.currentTrack != null) { | |
soundManager.setVolume(this.currentTrack.id, e) | |
} | |
showToast("Volume: " + e) | |
}; | |
this.playTrack = function(e) { | |
if (e == null) { | |
return | |
} | |
_gaq.push(['_trackEvent', 'desktop', 'play']); | |
console.log('play tracked');; | |
if (this.currentTrack) { | |
this.currentTrack.destruct() | |
} | |
seekSlider.slider("value", 0); | |
this.playtime = e.playtime; | |
this.cover = e.cover; | |
this.likeStatus = false; | |
showToast('Initializing: "' + e.title + '"'); | |
this.currentTrack = soundManager.createSound({ | |
id: e.id, | |
url: this.hd ? e.urlHd ? e.urlHd : e.url : e.url, | |
title: e.title, | |
playtime: e.playtime, | |
autoLoad: false, | |
autoPlay: true, | |
multishot: false, | |
volume: volumeSlider.slider("value"), | |
whileloading: function() {}, | |
whileplaying: function() { | |
var e = this.position / 10; | |
var t = e / bplayer.playtime; | |
seekSlider.slider("value", t) | |
}, | |
onload: function() { | |
$("#player_buttonPlay").hide(); | |
$("#player_buttonPause").show(); | |
seekSlider.slider("enable") | |
}, | |
onplay: function() { | |
showToast('Now Playing: "' + e.title + '"'); | |
$("#player_curTrackTitle").text(e.title); | |
var t = bplayer.getNextTrack(); | |
var n = new Object; | |
if (!t) { | |
t.title = "" | |
} | |
$("#player_nextTrackTitle").text(t.title.substring(0, 17)); | |
$("#player_albumCover").attr("src", bplayer.cover); | |
$("#player_buttonPlay").hide(); | |
$("#player_buttonPause").show(); | |
seekSlider.slider("enable"); | |
bplayer.isPlaying = true | |
}, | |
onfinish: function() { | |
bplayer.isPlaying = false; | |
showToast("Finished !"); | |
$("#player_buttonPause").hide(); | |
$("#player_buttonPlay").show(); | |
seekSlider.slider("value", 0); | |
seekSlider.slider("disable"); | |
bplayer.next() | |
}, | |
onpause: function() { | |
showToast("Paused"); | |
$("#player_buttonPause").hide(); | |
$("#player_buttonPlay").show() | |
}, | |
onresume: function() { | |
showToast('Resuming: "' + e.title + '"'); | |
$("#player_buttonPlay").hide(); | |
$("#player_buttonPause").show() | |
}, | |
onstop: function() { | |
$("#player_buttonPause").hide(); | |
$("#player_buttonPlay").show(); | |
this.isPlaying = false | |
} | |
}); | |
this.updatePlaylist(); | |
this.likeStatus = e.likeStatus; | |
this.updateLikeStatus() | |
}; | |
this.updateLikeStatus = function() { | |
if (this.currentPointer >= 0) this.queue[this.currentPointer].likeStatus = this.likeStatus; | |
if (this.likeStatus == true) { | |
$("#player_buttonLike").removeClass("player_buttonNotLiked").addClass("player_buttonLiked"); | |
return | |
} | |
$("#player_buttonLike").removeClass("player_buttonLiked").addClass("player_buttonNotLiked"); | |
return | |
}; | |
this.likeIt = function() { | |
if (!this.isPlaying) return; | |
if (this.likeStatus == false) { | |
if (!loggedIn) { | |
showToast("You Need To Be Logged In!"); | |
return | |
} | |
$.post("/api/favourite.php", { | |
track: bplayer.currentTrack.id, | |
action: 1 | |
}, function(e) { | |
bplayer.likeStatus = e.status; | |
bplayer.updateLikeStatus() | |
}) | |
} | |
if (this.likeStatus == true) { | |
if (!loggedIn) { | |
showToast("You Need To Be Logged In!"); | |
return | |
} | |
$.post("/api/favourite.php", { | |
track: bplayer.currentTrack.id, | |
action: 0 | |
}, function(e) { | |
bplayer.likeStatus = e.status; | |
bplayer.updateLikeStatus() | |
}) | |
} | |
}; | |
this.toggleShuffle = function() { | |
if (!this.shuffle) { | |
$("#player_buttonShuffle").removeClass("player_buttonShuffleOff").addClass("player_buttonShuffleOn"); | |
this.shuffle = true; | |
showToast("Shuffle On"); | |
return | |
} | |
$("#player_buttonShuffle").removeClass("player_buttonShuffleOn").addClass("player_buttonShuffleOff"); | |
this.shuffle = false; | |
showToast("Shuffle Off") | |
}; | |
this.toggleRadio = function() { | |
if (!this.radio.power) { | |
this.radio.activate(); | |
return | |
} else this.radio.deactivate() | |
}; | |
this.toggleHd = function() { | |
if (!this.hd) { | |
$("#player_buttonHd").removeClass("player_buttonHdOff").addClass("player_buttonHdOn"); | |
this.hd = true; | |
createCookie("hd", "1", 365); | |
showToast("HD On"); | |
if (bplayer.currentPointer != -1) bplayer.playNthTrack(bplayer.currentPointer, true); | |
return | |
} | |
$("#player_buttonHd").removeClass("player_buttonHdOn").addClass("player_buttonHdOff"); | |
this.hd = false; | |
createCookie("hd", "0", 365); | |
showToast("HD Off"); | |
if (bplayer.currentPointer != -1) bplayer.playNthTrack(bplayer.currentPointer, true) | |
}; | |
this.updateHd = function() { | |
if (!this.hd) { | |
$("#player_buttonHd").removeClass("player_buttonHdOn").addClass("player_buttonHdOff"); | |
return | |
} | |
$("#player_buttonHd").removeClass("player_buttonHdOff").addClass("player_buttonHdOn") | |
}; | |
this.toggleRepeat = function() { | |
if (!this.repeat) { | |
$("#player_buttonRepeat").removeClass("player_buttonRepeatOff").addClass("player_buttonRepeatOn"); | |
this.repeat = true; | |
showToast("Repeat On"); | |
return | |
} | |
$("#player_buttonRepeat").removeClass("player_buttonRepeatOn").addClass("player_buttonRepeatOff"); | |
this.repeat = false; | |
showToast("Repeat Off") | |
}; | |
this.getNextTrack = function() { | |
if (this.radio.power) { | |
return this.radio.getNextTrack(); | |
return | |
} | |
if (this.queue.length == 0) { | |
return null | |
} | |
var e = this.currentPointer; | |
e++; | |
e %= this.queue.length; | |
return this.queue[e] | |
}; | |
this.queue = new Array; | |
this.shuffleQueue = new Array; | |
this.enqueue = function(e) { | |
if (this.radio.power) { | |
this.radio.deactivate() | |
} | |
var t = -1; | |
$(this.queue).each(function(n, r) { | |
if (r.id == e) { | |
t = n; | |
return | |
} | |
}); | |
if (t != -1) { | |
showToast("Alread IN Queue"); | |
bplayer.playNthTrack(t); | |
return | |
} | |
$.getJSON("/api/getTrackInfo.php?id=" + e, function(e) { | |
bplayer.queue.push(e); | |
showToast("Added To Queue."); | |
if (bplayer.queue.length == 1) { | |
bplayer.next() | |
} | |
if (bplayer.currentPointer == bplayer.queue.length) { | |
bplayer.currentPointer = 0 | |
} | |
var t = bplayer.getNextTrack(); | |
if (t == undefined) { | |
t.title = "" | |
} | |
$("#player_nextTrackTitle").text(t.title.substring(0, 17)) | |
}) | |
}; | |
this.currentPointer = -1; | |
this.dequeue = function() { | |
if (this.radio.power) { | |
return this.radio.dequeue() | |
} | |
if (this.queue.length == 0) { | |
return null | |
} | |
if (this.shuffle) { | |
while (this.queue.length > 1 && this.lastRandom == this.currentPointer) { | |
this.currentPointer = Math.round(Math.random() * (this.queue.length - 1)) | |
} | |
this.lastRandom = this.currentPointer; | |
return this.queue[this.currentPointer] | |
} | |
this.currentPointer++; | |
if (this.repeat == false && this.currentPointer == this.queue.length) { | |
this.currentPointer--; | |
showToast("List Finished."); | |
return null | |
} | |
this.currentPointer %= this.queue.length; | |
this.lastRandom = this.currentPointer; | |
return this.queue[this.currentPointer] | |
}; | |
this.prev = function() { | |
if (this.queue.length == 0) { | |
bplayer.playTrack(null); | |
return | |
} | |
this.currentPointer--; | |
if (this.currentPointer < 0) { | |
this.currentPointer = this.queue.length - 1 | |
} | |
bplayer.playTrack(this.queue[this.currentPointer]) | |
}; | |
this.next = function() { | |
this.playTrack(this.dequeue()) | |
}; | |
this.playNthTrack = function(e, t) { | |
if (typeof t === "undefined") t = false; | |
if (this.currentPointer == e && !t) { | |
showToast("Already Playing"); | |
return | |
} | |
this.playTrack(this.queue[e]); | |
this.currentPointer = e; | |
this.lastRandom = this.currentPointer | |
}; | |
this.updatePlaylist = function() { | |
$("#playlist").html(""); | |
if (this.queue.length == 0) { | |
$("#playlist").html("<h1>Songs are added to the queue when you start playing.</h1>"); | |
return | |
} | |
var e = 0; | |
$("#playlist").html("<h3>" + bplayer.queue.length + " Songs in Queue</h3>"); | |
$("#playlist").append('<ol id="playlistOl">'); | |
$("#playlistOl").append('<li class="removeAllTracksFromQueue"> <a href="javascript:void(0)");">Remove All</a></span></li>'); | |
$(this.queue).each(function(t, n) { | |
if (bplayer.currentTrack.id == n.id) { | |
$("#playlistOl").append('<li class="currentTrack">' + (e + 1) + '. <a href="javascript:void(0)" onclick="bplayer.playNthTrack(' + e + ');">' + n.title + '</a><div class="removeTrackFromQueue" data-id="' + e + '"></div></li>') | |
} else { | |
$("#playlistOl").append("<li>" + (e + 1) + '. <a href="javascript:void(0)" onclick="bplayer.playNthTrack(' + e + ');">' + n.title + '</a><div class="removeTrackFromQueue" data-id="' + e + '"></div></li>') | |
} | |
e++ | |
}); | |
$("#playlist").append("</ol>"); | |
bindRemoveTrackFromQueue() | |
}; | |
this.remove = function(e) { | |
if (this.queue.length == 1) { | |
this.reset(); | |
return | |
} | |
this.queue.splice(e, 1); | |
if (this.currentPointer >= e) { | |
this.currentPointer-- | |
} | |
if (this.currentPointer == e - 1) { | |
this.next() | |
} | |
}; | |
this.reset = function() { | |
this.queue.splice(0, this.queue.length); | |
soundManager.stopAll(); | |
this.currentPointer = -1; | |
$("#player_curTrackTitle").text("Click To Play"); | |
$("#player_nextTrackTitle").text(""); | |
$("#player_albumCover").attr("src", "http://cdn.blugaa.com/images/no-song.jpg"); | |
$("#player_buttonPlay").show(); | |
$("#player_buttonPause").hide(); | |
seekSlider.slider("disable"); | |
bplayer.isPlaying = false; | |
this.likeStatus = false; | |
this.updateLikeStatus(); | |
showToast("Queue Cleared") | |
}; | |
this.resetRadio = function() { | |
bplayer.isPlaying = false; | |
soundManager.stopAll(); | |
this.currentTrack = null; | |
$("#player_curTrackTitle").text("Click To Play"); | |
$("#player_nextTrackTitle").text(""); | |
$("#player_albumCover").attr("src", "http://cdn.blugaa.com/images/no-song.jpg"); | |
$("#player_buttonPlay").show(); | |
$("#player_buttonPause").hide(); | |
seekSlider.slider("disable"); | |
if (bplayer.currentPointer != -1 && bplayer.radio.power) { | |
var e = bplayer.queue[bplayer.currentPointer]; | |
bplayer.currentTrack = soundManager.createSound({ | |
id: e.id, | |
url: bplayer.hd ? e.urlHd ? e.urlHd : e.url : e.url, | |
title: e.title, | |
playtime: e.playtime, | |
autoLoad: false, | |
autoPlay: true, | |
multishot: false, | |
volume: volumeSlider.slider("value"), | |
whileloading: function() {}, | |
whileplaying: function() { | |
var e = this.position / 10; | |
var t = e / bplayer.playtime; | |
seekSlider.slider("value", t) | |
}, | |
onload: function() { | |
$("#player_buttonPlay").hide(); | |
$("#player_buttonPause").show(); | |
seekSlider.slider("enable") | |
}, | |
onplay: function() { | |
showToast('Now Playing: "' + e.title + '"'); | |
$("#player_curTrackTitle").text(e.title); | |
var t = bplayer.getNextTrack(); | |
var n = new Object; | |
if (!t) { | |
t.title = "" | |
} | |
$("#player_nextTrackTitle").text(t.title.substring(0, 17)); | |
$("#player_albumCover").attr("src", bplayer.cover); | |
$("#player_buttonPlay").hide(); | |
$("#player_buttonPause").show(); | |
seekSlider.slider("enable"); | |
bplayer.isPlaying = true | |
}, | |
onfinish: function() { | |
bplayer.isPlaying = false; | |
showToast("Finished !"); | |
$("#player_buttonPause").hide(); | |
$("#player_buttonPlay").show(); | |
seekSlider.slider("value", 0); | |
seekSlider.slider("disable"); | |
bplayer.next() | |
}, | |
onpause: function() { | |
showToast("Paused"); | |
$("#player_buttonPause").hide(); | |
$("#player_buttonPlay").show() | |
}, | |
onresume: function() { | |
showToast('Resuming: "' + e.title + '"'); | |
$("#player_buttonPlay").hide(); | |
$("#player_buttonPause").show() | |
}, | |
onstop: function() { | |
$("#player_buttonPause").hide(); | |
$("#player_buttonPlay").show(); | |
this.isPlaying = false | |
} | |
}); | |
this.updatePlaylist(); | |
this.likeStatus = e.likeStatus; | |
this.updateLikeStatus() | |
} | |
bplayer.radio.power = false | |
} | |
} | |
function showPlaylist() {} | |
function createCookie(e, t, n) { | |
if (n) { | |
var r = new Date; | |
r.setTime(r.getTime() + n * 24 * 60 * 60 * 1e3); | |
var i = "; expires=" + r.toGMTString() | |
} else { | |
var i = "" | |
} | |
document.cookie = e + "=" + t + i + "; path=/" | |
} | |
function readCookie(e) { | |
var t = e + "="; | |
var n = document.cookie.split(";"); | |
for (var r = 0; r < n.length; r++) { | |
var i = n[r]; | |
while (i.charAt(0) == " ") { | |
i = i.substring(1, i.length) | |
} | |
if (i.indexOf(t) == 0) { | |
return i.substring(t.length, i.length) | |
} | |
} | |
return null | |
} | |
function eraseCookie(e) { | |
createCookie(e, "", -1) | |
} | |
function playAllTracks() { | |
if (allCheckedFlag == 0) { | |
checkAllBoxes() | |
} | |
$("#play").submit() | |
} | |
function checkAllBoxes() { | |
if (allCheckedFlag == 0) { | |
$('input[type="checkbox"]').each(function() { | |
$(this).attr("checked", true) | |
}); | |
$("a#selectAll").text("Deselect All"); | |
allCheckedFlag = 1 | |
} else { | |
$('input[type="checkbox"]').each(function() { | |
$(this).attr("checked", false) | |
}); | |
$("a#selectAll").text("Select All"); | |
allCheckedFlag = 0 | |
} | |
} | |
function bindPlayButton() { | |
allCheckedFlag = 0; | |
$("ul.trackList li").hover(function() { | |
$(this).css("background-color", "#D0E4F0") | |
}, function() { | |
$(this).css("background-color", "") | |
}); | |
$('input[type="checkbox"][name="checkAll"]').change(function() { | |
checkAllBoxes() | |
}); | |
$("a#selectAll").click(function() { | |
checkAllBoxes() | |
}); | |
$("a#playAll").click(function() { | |
playAllTracks() | |
}); | |
$("a#playSelected").click(function() { | |
$("#play").submit() | |
}) | |
} | |
function playButtonListener() { | |
$('input[name="play[]"]').each(function() { | |
if ($(this).attr("checked")) { | |
bplayer.enqueue($(this).val()) | |
} | |
}); | |
return false | |
} | |
function getUserDetails() { | |
$.ajaxSetup({ | |
cache: false | |
}); | |
$.getJSON("/api/mydetails.php", function(e) { | |
var t = '<a href="/login.php" style="color:#fff;font-weight:bold;"> Login</a>'; | |
if (e.name != "Login") { | |
t = '<a href="' + e.url + '" style="color:#fff;font-weight:bold;"><img src="' + e.image + '"/>' + e.name + "</a>"; | |
loggedIn = true | |
} | |
$("#userLinks").html(t); | |
bindAllLinks(); | |
$.ajaxSetup({ | |
cache: true | |
}) | |
}) | |
} | |
function delTrackFromPlaylist(e, t) { | |
$.post("/playlists/editPlaylist.php", { | |
action: "deleteTrack", | |
track_id: e, | |
playlist_id: t | |
}, function(e) { | |
var t = $(e).find("#content").contents(); | |
$("#content").html(t); | |
bindAllLinks(); | |
bindPlayButton(); | |
showToast("Track Deleted"); | |
$("#playlistCreateSubmit").removeAttr("disabled"); | |
$("#playlistCreateSubmit").val("Create") | |
}) | |
} | |
var bplayer; | |
var lastAjaxRequest; | |
var toastTimer = null; | |
var allCheckedFlag = 0; | |
var trackToAdd = null; | |
var myPlaylists = Array(); | |
var loggedIn = false; | |
$(document).ready(function() { | |
volumeSlider = $("#volumeSlider"); | |
volumeSlider.slider({ | |
range: "min", | |
min: 0, | |
max: 100, | |
value: readCookie("volumeCookie") ? readCookie("volumeCookie") : 33, | |
slide: function(e, t) { | |
createCookie("volumeCookie", t.value, 365); | |
bplayer.volume(t.value) | |
} | |
}); | |
seekSlider = $("#seekSlider"); | |
seekSlider.slider({ | |
range: "min", | |
min: 0, | |
max: 100, | |
value: 0, | |
slide: function(e, t) { | |
var n = Math.round(t.value / 100 * bplayer.playtime * 1e3); | |
soundManager.setPosition(bplayer.currentTrack.id, n) | |
} | |
}); | |
bplayer = new blugaaPlayer; | |
bplayer.setup(); | |
$("#player_buttonPlay").click(function() { | |
bplayer.play() | |
}); | |
$("#player_buttonPlaylist").click(function() { | |
bplayer.updatePlaylist(); | |
$("#playlistArea").modal({ | |
autoPosition: false, | |
overlayClose: true, | |
appendTo: "#playlist_container" | |
}) | |
}); | |
bindRemoveTrackFromQueue(); | |
$("#player_buttonPause").click(function() { | |
bplayer.pause() | |
}); | |
$("#player_buttonRepeat").click(function() { | |
bplayer.toggleRepeat() | |
}); | |
$("#player_buttonShuffle").click(function() { | |
bplayer.toggleShuffle() | |
}); | |
$("#player_buttonHd").click(function() { | |
bplayer.toggleHd() | |
}); | |
$("#player_buttonRadio").click(function() { | |
bplayer.toggleRadio() | |
}); | |
$("#player_buttonNext").click(function() { | |
bplayer.next() | |
}); | |
$("#player_nextTrackTitle").click(function() { | |
bplayer.next() | |
}); | |
$("#player_buttonPrev").click(function() { | |
bplayer.prev() | |
}); | |
$("#player_buttonLike").click(function() { | |
bplayer.likeIt() | |
}); | |
var e = window.History; | |
if (!e.enabled) { | |
return | |
} | |
getUserDetails(); | |
bindAllLinks(); | |
bindPlayButton(); | |
$("#search").submit(function() { | |
var t = $("#searchBoxTop").val(); | |
if (t.length < 3) { | |
showToast("Please Type At Least 3 Characters To Search."); | |
return false | |
} | |
var n = "/search.php?q=" + t; | |
e.pushState({ | |
state: 1 | |
}, "Loading. Please Wait....", n); | |
return false | |
}); | |
e.Adapter.bind(window, "statechange", function() { | |
var t = e.getState(); | |
showToast("Loading.....", 0); | |
var n = t.url; | |
$(window).scrollTop(0); | |
$("#content").html('<img src="http://static.blugaa.com/images/splash-loader.gif" style="margin:150px 300px;">'); | |
if (lastAjaxRequest) { | |
lastAjaxRequest.abort() | |
} | |
lastAjaxRequest = $.ajax({ | |
url: encodeURI(n), | |
type: "get", | |
error: function(t, n, r) { | |
showToast("Error: " + t.status + " " + t.statusText, 1); | |
e.back(1) | |
}, | |
success: function(e) { | |
var t = $(e); | |
$(document).attr("title", t.filter("title").text()); | |
$("#wrapper").replaceWith($("#wrapper", e)); | |
reloadAds(); | |
trackPage(n); | |
hideToast(); | |
bindAllLinks(); | |
bindPlayButton(); | |
FB.XFBML.parse() | |
} | |
}) | |
}) | |
}); | |
(function(e) { | |
"function" === typeof define && define.amd ? define(["jquery"], e) : e(jQuery) | |
})(function(e) { | |
var t = [], | |
n = e(document), | |
r = e.browser.msie && 6 === parseInt(e.browser.version) && "object" !== typeof window.XMLHttpRequest, | |
i = e.browser.msie && 7 === parseInt(e.browser.version), | |
s = null, | |
o = e(window), | |
u = []; | |
e.modal = function(t, n) { | |
return e.modal.impl.init(t, n) | |
}; | |
e.modal.close = function() { | |
e.modal.impl.close() | |
}; | |
e.modal.focus = function(t) { | |
e.modal.impl.focus(t) | |
}; | |
e.modal.setContainerDimensions = function() { | |
e.modal.impl.setContainerDimensions() | |
}; | |
e.modal.setPosition = function() { | |
e.modal.impl.setPosition() | |
}; | |
e.modal.update = function(t, n) { | |
e.modal.impl.update(t, n) | |
}; | |
e.fn.modal = function(t) { | |
return e.modal.impl.init(this, t) | |
}; | |
e.modal.defaults = { | |
appendTo: "body", | |
focus: !0, | |
opacity: 50, | |
overlayId: "simplemodal-overlay", | |
overlayCss: {}, | |
containerId: "simplemodal-container", | |
containerCss: {}, | |
dataId: "simplemodal-data", | |
dataCss: {}, | |
minHeight: null, | |
minWidth: null, | |
maxHeight: null, | |
maxWidth: null, | |
autoResize: !1, | |
autoPosition: !0, | |
zIndex: 1e3, | |
close: !0, | |
closeHTML: '<a class="modalCloseImg" title="Close"></a>', | |
closeClass: "simplemodal-close", | |
escClose: !0, | |
overlayClose: !1, | |
fixed: !0, | |
position: null, | |
persist: !1, | |
modal: !0, | |
onOpen: null, | |
onShow: null, | |
onClose: null | |
}; | |
e.modal.impl = { | |
d: {}, | |
init: function(t, n) { | |
if (this.d.data) return !1; | |
s = e.browser.msie && !e.support.boxModel; | |
this.o = e.extend({}, e.modal.defaults, n); | |
this.zIndex = this.o.zIndex; | |
this.occb = !1; | |
if ("object" === typeof t) { | |
if (t = t instanceof e ? t : e(t), this.d.placeholder = !1, 0 < t.parent().parent().size() && (t.before(e("<span></span>").attr("id", "simplemodal-placeholder").css({ | |
display: "none" | |
})), this.d.placeholder = !0, this.display = t.css("display"), !this.o.persist)) this.d.orig = t.clone(!0) | |
} else if ("string" === typeof t || "number" === typeof t) t = e("<div></div>").html(t); | |
else return alert("SimpleModal Error: Unsupported data type: " + typeof t), this; | |
this.create(t); | |
this.open(); | |
e.isFunction(this.o.onShow) && this.o.onShow.apply(this, [this.d]); | |
return this | |
}, | |
create: function(n) { | |
this.getDimensions(); | |
if (this.o.modal && r) this.d.iframe = e('<iframe src="javascript:false;"></iframe>').css(e.extend(this.o.iframeCss, { | |
display: "none", | |
opacity: 0, | |
position: "fixed", | |
height: u[0], | |
width: u[1], | |
zIndex: this.o.zIndex, | |
top: 0, | |
left: 0 | |
})).appendTo(this.o.appendTo); | |
this.d.overlay = e("<div></div>").attr("id", this.o.overlayId).addClass("simplemodal-overlay").css(e.extend(this.o.overlayCss, { | |
display: "none", | |
opacity: this.o.opacity / 100, | |
height: this.o.modal ? t[0] : 0, | |
width: this.o.modal ? t[1] : 0, | |
position: "fixed", | |
left: 0, | |
top: 0, | |
zIndex: this.o.zIndex + 1 | |
})).appendTo(this.o.appendTo); | |
this.d.container = e("<div></div>").attr("id", this.o.containerId).addClass("simplemodal-container").css(e.extend({ | |
position: this.o.fixed ? "fixed" : "absolute" | |
}, this.o.containerCss, { | |
display: "none", | |
zIndex: this.o.zIndex + 2 | |
})).append(this.o.close && this.o.closeHTML ? e(this.o.closeHTML).addClass(this.o.closeClass) : "").appendTo(this.o.appendTo); | |
this.d.wrap = e("<div></div>").attr("tabIndex", -1).addClass("simplemodal-wrap").css({ | |
height: "100%", | |
outline: 0, | |
width: "100%" | |
}).appendTo(this.d.container); | |
this.d.data = n.attr("id", n.attr("id") || this.o.dataId).addClass("simplemodal-data").css(e.extend(this.o.dataCss, { | |
display: "none" | |
})).appendTo("body"); | |
this.setContainerDimensions(); | |
this.d.data.appendTo(this.d.wrap); | |
(r || s) && this.fixIE() | |
}, | |
bindEvents: function() { | |
var i = this; | |
e("." + i.o.closeClass).bind("click.simplemodal", function(e) { | |
e.preventDefault(); | |
i.close() | |
}); | |
i.o.modal && i.o.close && i.o.overlayClose && i.d.overlay.bind("click.simplemodal", function(e) { | |
e.preventDefault(); | |
i.close() | |
}); | |
n.bind("keydown.simplemodal", function(e) { | |
i.o.modal && 9 === e.keyCode ? i.watchTab(e) : i.o.close && i.o.escClose && 27 === e.keyCode && (e.preventDefault(), i.close()) | |
}); | |
o.bind("resize.simplemodal orientationchange.simplemodal", function() { | |
i.getDimensions(); | |
i.o.autoResize ? i.setContainerDimensions() : i.o.autoPosition && i.setPosition(); | |
r || s ? i.fixIE() : i.o.modal && (i.d.iframe && i.d.iframe.css({ | |
height: u[0], | |
width: u[1] | |
}), i.d.overlay.css({ | |
height: t[0], | |
width: t[1] | |
})) | |
}) | |
}, | |
unbindEvents: function() { | |
e("." + this.o.closeClass).unbind("click.simplemodal"); | |
n.unbind("keydown.simplemodal"); | |
o.unbind(".simplemodal"); | |
this.d.overlay.unbind("click.simplemodal") | |
}, | |
fixIE: function() { | |
var t = this.o.position; | |
e.each([this.d.iframe || null, !this.o.modal ? null : this.d.overlay, "fixed" === this.d.container.css("position") ? this.d.container : null], function(e, n) { | |
if (n) { | |
var r = n[0].style; | |
r.position = "absolute"; | |
if (2 > e) r.removeExpression("height"), r.removeExpression("width"), r.setExpression("height", 'document.body.scrollHeight > document.body.clientHeight ? document.body.scrollHeight : document.body.clientHeight + "px"'), r.setExpression("width", 'document.body.scrollWidth > document.body.clientWidth ? document.body.scrollWidth : document.body.clientWidth + "px"'); | |
else { | |
var i, s; | |
t && t.constructor === Array ? (i = t[0] ? "number" === typeof t[0] ? t[0].toString() : t[0].replace(/px/, "") : n.css("top").replace(/px/, ""), i = -1 === i.indexOf("%") ? i + ' + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"' : parseInt(i.replace(/%/, "")) + ' * ((document.documentElement.clientHeight || document.body.clientHeight) / 100) + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"', t[1] && (s = "number" === typeof t[1] ? t[1].toString() : t[1].replace(/px/, ""), s = -1 === s.indexOf("%") ? s + ' + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"' : parseInt(s.replace(/%/, "")) + ' * ((document.documentElement.clientWidth || document.body.clientWidth) / 100) + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"')) : (i = '(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"', s = '(document.documentElement.clientWidth || document.body.clientWidth) / 2 - (this.offsetWidth / 2) + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"'); | |
r.removeExpression("top"); | |
r.removeExpression("left"); | |
r.setExpression("top", i); | |
r.setExpression("left", s) | |
} | |
} | |
}) | |
}, | |
focus: function(t) { | |
var n = this, | |
t = t && -1 !== e.inArray(t, ["first", "last"]) ? t : "first", | |
r = e(":input:enabled:visible:" + t, n.d.wrap); | |
setTimeout(function() { | |
0 < r.length ? r.focus() : n.d.wrap.focus() | |
}, 10) | |
}, | |
getDimensions: function() { | |
var e = "undefined" === typeof window.innerHeight ? o.height() : window.innerHeight; | |
t = [n.height(), n.width()]; | |
u = [e, o.width()] | |
}, | |
getVal: function(e, t) { | |
return e ? "number" === typeof e ? e : "auto" === e ? 0 : 0 < e.indexOf("%") ? parseInt(e.replace(/%/, "")) / 100 * ("h" === t ? u[0] : u[1]) : parseInt(e.replace(/px/, "")) : null | |
}, | |
update: function(e, t) { | |
if (!this.d.data) return !1; | |
this.d.origHeight = this.getVal(e, "h"); | |
this.d.origWidth = this.getVal(t, "w"); | |
this.d.data.hide(); | |
e && this.d.container.css("height", e); | |
t && this.d.container.css("width", t); | |
this.setContainerDimensions(); | |
this.d.data.show(); | |
this.o.focus && this.focus(); | |
this.unbindEvents(); | |
this.bindEvents() | |
}, | |
setContainerDimensions: function() { | |
var t = r || i, | |
n = this.d.origHeight ? this.d.origHeight : e.browser.opera ? this.d.container.height() : this.getVal(t ? this.d.container[0].currentStyle.height : this.d.container.css("height"), "h"), | |
t = this.d.origWidth ? this.d.origWidth : e.browser.opera ? this.d.container.width() : this.getVal(t ? this.d.container[0].currentStyle.width : this.d.container.css("width"), "w"), | |
s = this.d.data.outerHeight(!0), | |
o = this.d.data.outerWidth(!0); | |
this.d.origHeight = this.d.origHeight || n; | |
this.d.origWidth = this.d.origWidth || t; | |
var a = this.o.maxHeight ? this.getVal(this.o.maxHeight, "h") : null, | |
f = this.o.maxWidth ? this.getVal(this.o.maxWidth, "w") : null, | |
a = a && a < u[0] ? a : u[0], | |
f = f && f < u[1] ? f : u[1], | |
l = this.o.minHeight ? this.getVal(this.o.minHeight, "h") : "auto", | |
n = n ? this.o.autoResize && n > a ? a : n < l ? l : n : s ? s > a ? a : this.o.minHeight && "auto" !== l && s < l ? l : s : l, | |
a = this.o.minWidth ? this.getVal(this.o.minWidth, "w") : "auto", | |
t = t ? this.o.autoResize && t > f ? f : t < a ? a : t : o ? o > f ? f : this.o.minWidth && "auto" !== a && o < a ? a : o : a; | |
this.d.container.css({ | |
height: n, | |
width: t | |
}); | |
this.d.wrap.css({ | |
overflow: s > n || o > t ? "auto" : "visible" | |
}); | |
this.o.autoPosition && this.setPosition() | |
}, | |
setPosition: function() { | |
var e, t; | |
e = u[0] / 2 - this.d.container.outerHeight(!0) / 2; | |
t = u[1] / 2 - this.d.container.outerWidth(!0) / 2; | |
var n = "fixed" !== this.d.container.css("position") ? o.scrollTop() : 0; | |
this.o.position && "[object Array]" === Object.prototype.toString.call(this.o.position) ? (e = n + (this.o.position[0] || e), t = this.o.position[1] || t) : e = n + e; | |
this.d.container.css({ | |
left: t, | |
top: e | |
}) | |
}, | |
watchTab: function(t) { | |
if (0 < e(t.target).parents(".simplemodal-container").length) { | |
if (this.inputs = e(":input:enabled:visible:first, :input:enabled:visible:last", this.d.data[0]), !t.shiftKey && t.target === this.inputs[this.inputs.length - 1] || t.shiftKey && t.target === this.inputs[0] || 0 === this.inputs.length) t.preventDefault(), this.focus(t.shiftKey ? "last" : "first") | |
} else t.preventDefault(), this.focus() | |
}, | |
open: function() { | |
this.d.iframe && this.d.iframe.show(); | |
e.isFunction(this.o.onOpen) ? this.o.onOpen.apply(this, [this.d]) : (this.d.overlay.show(), this.d.container.show(), this.d.data.show()); | |
this.o.focus && this.focus(); | |
this.bindEvents() | |
}, | |
close: function() { | |
if (!this.d.data) return !1; | |
this.unbindEvents(); | |
if (e.isFunction(this.o.onClose) && !this.occb) this.occb = !0, this.o.onClose.apply(this, [this.d]); | |
else { | |
if (this.d.placeholder) { | |
var t = e("#simplemodal-placeholder"); | |
this.o.persist ? t.replaceWith(this.d.data.removeClass("simplemodal-data").css("display", this.display)) : (this.d.data.hide().remove(), t.replaceWith(this.d.orig)) | |
} else this.d.data.hide().remove(); | |
this.d.container.hide().remove(); | |
this.d.overlay.hide(); | |
this.d.iframe && this.d.iframe.hide().remove(); | |
this.d.overlay.remove(); | |
this.d = {} | |
} | |
} | |
} | |
}); | |
(function(e) { | |
function t(t, n) { | |
function r(e) { | |
return a.preferFlash && St && !a.ignoreFlash && "undefined" !== typeof a.flash[e] && a.flash[e] | |
} | |
function i(e) { | |
return function(t) { | |
var n = this._t; | |
return !n || !n._a ? null : e.call(this, t) | |
} | |
} | |
this.setupOptions = { | |
url: t || null, | |
flashVersion: 8, | |
debugMode: !0, | |
debugFlash: !1, | |
useConsole: !0, | |
consoleOnly: !0, | |
waitForWindowLoad: !1, | |
bgColor: "#ffffff", | |
useHighPerformance: !1, | |
flashPollingInterval: null, | |
html5PollingInterval: null, | |
flashLoadTimeout: 1e3, | |
wmode: null, | |
allowScriptAccess: "always", | |
useFlashBlock: !1, | |
useHTML5Audio: !0, | |
html5Test: /^(probably|maybe)$/i, | |
preferFlash: !0, | |
noSWFCache: !1 | |
}; | |
this.defaultOptions = { | |
autoLoad: !1, | |
autoPlay: !1, | |
from: null, | |
loops: 1, | |
onid3: null, | |
onload: null, | |
whileloading: null, | |
onplay: null, | |
onpause: null, | |
onresume: null, | |
whileplaying: null, | |
onposition: null, | |
onstop: null, | |
onfailure: null, | |
onfinish: null, | |
multiShot: !0, | |
multiShotEvents: !1, | |
position: null, | |
pan: 0, | |
stream: !0, | |
to: null, | |
type: null, | |
usePolicyFile: !1, | |
volume: 100 | |
}; | |
this.flash9Options = { | |
isMovieStar: null, | |
usePeakData: !1, | |
useWaveformData: !1, | |
useEQData: !1, | |
onbufferchange: null, | |
ondataerror: null | |
}; | |
this.movieStarOptions = { | |
bufferTime: 3, | |
serverURL: null, | |
onconnect: null, | |
duration: null | |
}; | |
this.audioFormats = { | |
mp3: { | |
type: ['audio/mpeg; codecs="mp3"', "audio/mpeg", "audio/mp3", "audio/MPA", "audio/mpa-robust"], | |
required: !0 | |
}, | |
mp4: { | |
related: ["aac", "m4a", "m4b"], | |
type: ['audio/mp4; codecs="mp4a.40.2"', "audio/aac", "audio/x-m4a", "audio/MP4A-LATM", "audio/mpeg4-generic"], | |
required: !1 | |
}, | |
ogg: { | |
type: ["audio/ogg; codecs=vorbis"], | |
required: !1 | |
}, | |
wav: { | |
type: ['audio/wav; codecs="1"', "audio/wav", "audio/wave", "audio/x-wav"], | |
required: !1 | |
} | |
}; | |
this.movieID = "sm2-container"; | |
this.id = n || "sm2movie"; | |
this.debugID = "soundmanager-debug"; | |
this.debugURLParam = /([#?&])debug=1/i; | |
this.versionNumber = "V2.97a.20120916"; | |
this.altURL = this.movieURL = this.version = null; | |
this.enabled = this.swfLoaded = !1; | |
this.oMC = null; | |
this.sounds = {}; | |
this.soundIDs = []; | |
this.didFlashBlock = this.muted = !1; | |
this.filePattern = null; | |
this.filePatterns = { | |
flash8: /\.mp3(\?.*)?$/i, | |
flash9: /\.mp3(\?.*)?$/i | |
}; | |
this.features = { | |
buffering: !1, | |
peakData: !1, | |
waveformData: !1, | |
eqData: !1, | |
movieStar: !1 | |
}; | |
this.sandbox = {}; | |
var s; | |
try { | |
s = "undefined" !== typeof Audio && "undefined" !== typeof(Mt && 10 > opera.version() ? new Audio(null) : new Audio).canPlayType | |
} catch (o) { | |
s = !1 | |
} | |
this.hasHTML5 = s; | |
this.html5 = { | |
usingFlash: null | |
}; | |
this.flash = {}; | |
this.ignoreFlash = this.html5Only = !1; | |
var u, a = this, | |
f = null, | |
l, c = navigator.userAgent, | |
h = e, | |
p = h.location.href.toString(), | |
d = document, | |
v, m, g, y, b = [], | |
w = !1, | |
E = !1, | |
S = !1, | |
x = !1, | |
T = !1, | |
N, C, k, L, A, O, M, _, D, P, H, B, j, F, I, q, R, U, z, W, X, V, $, J = null, | |
K = null, | |
Q, G, Y, Z, et, tt, nt, rt = !1, | |
it = !1, | |
st, ot, ut, at = 0, | |
ft = null, | |
lt, ct = null, | |
ht, pt, dt, vt, mt, gt, yt, bt, wt = Array.prototype.slice, | |
Et = !1, | |
St, xt, Tt, Nt, Ct, kt = c.match(/(ipad|iphone|ipod)/i), | |
Lt = c.match(/msie/i), | |
At = c.match(/webkit/i), | |
Ot = c.match(/safari/i) && !c.match(/chrome/i), | |
Mt = c.match(/opera/i), | |
_t = c.match(/(mobile|pre\/|xoom)/i) || kt, | |
Dt = !p.match(/usehtml5audio/i) && !p.match(/sm2\-ignorebadua/i) && Ot && !c.match(/silk/i) && c.match(/OS X 10_6_([3-7])/i), | |
Pt = "undefined" !== typeof d.hasFocus ? d.hasFocus() : null, | |
Ht = Ot && ("undefined" === typeof d.hasFocus || !d.hasFocus()), | |
Bt = !Ht, | |
jt = /(mp3|mp4|mpa|m4a|m4b)/i, | |
Ft = d.location ? d.location.protocol.match(/http/i) : null, | |
It = !Ft ? "http://" : "", | |
qt = /^\s*audio\/(?:x-)?(?:mpeg4|aac|flv|mov|mp4||m4v|m4a|m4b|mp4v|3gp|3g2)\s*(?:$|;)/i, | |
Rt = "mpeg4,aac,flv,mov,mp4,m4v,f4v,m4a,m4b,mp4v,3gp,3g2".split(","), | |
Ut = RegExp("\\.(" + Rt.join("|") + ")(\\?.*)?$", "i"); | |
this.mimePattern = /^\s*audio\/(?:x-)?(?:mp(?:eg|3))\s*(?:$|;)/i; | |
this.useAltURL = !Ft; | |
this._global_a = null; | |
if (_t && (a.useHTML5Audio = !0, a.preferFlash = !1, kt)) Et = a.ignoreFlash = !0; | |
this.setup = function(e) { | |
var t = !a.url; | |
"undefined" !== typeof e && S && ct && a.ok() && ("undefined" !== typeof e.flashVersion || "undefined" !== typeof e.url) && tt(Q("setupLate")); | |
k(e); | |
t && I && "undefined" !== typeof e.url && a.beginDelayedInit(); | |
!I && "undefined" !== typeof e.url && "complete" === d.readyState && setTimeout(j, 1); | |
return a | |
}; | |
this.supported = this.ok = function() { | |
return ct ? S && !x : a.useHTML5Audio && a.hasHTML5 | |
}; | |
this.getMovie = function(e) { | |
return l(e) || d[e] || h[e] | |
}; | |
this.createSound = function(e, t) { | |
function n() { | |
r = Z(r); | |
a.sounds[s.id] = new u(s); | |
a.soundIDs.push(s.id); | |
return a.sounds[s.id] | |
} | |
var r = null, | |
i = null, | |
s = null; | |
if (!S || !a.ok()) return tt(void 0), !1; | |
"undefined" !== typeof t && (e = { | |
id: e, | |
url: t | |
}); | |
r = C(e); | |
r.url = lt(r.url); | |
s = r; | |
if (nt(s.id, !0)) return a.sounds[s.id]; | |
if (pt(s)) i = n(), i._setup_html5(s); | |
else { | |
if (8 < y && null === s.isMovieStar) s.isMovieStar = !(!s.serverURL && !(s.type && s.type.match(qt) || s.url.match(Ut))); | |
s = et(s, void 0); | |
i = n(); | |
if (8 === y) f._createSound(s.id, s.loops || 1, s.usePolicyFile); | |
else if (f._createSound(s.id, s.url, s.usePeakData, s.useWaveformData, s.useEQData, s.isMovieStar, s.isMovieStar ? s.bufferTime : !1, s.loops || 1, s.serverURL, s.duration || null, s.autoPlay, !0, s.autoLoad, s.usePolicyFile), !s.serverURL) i.connected = !0, s.onconnect && s.onconnect.apply(i); | |
!s.serverURL && (s.autoLoad || s.autoPlay) && i.load(s) | |
}!s.serverURL && s.autoPlay && i.play(); | |
return i | |
}; | |
this.destroySound = function(e, t) { | |
if (!nt(e)) return !1; | |
var n = a.sounds[e], | |
r; | |
n._iO = {}; | |
n.stop(); | |
n.unload(); | |
for (r = 0; r < a.soundIDs.length; r++) if (a.soundIDs[r] === e) { | |
a.soundIDs.splice(r, 1); | |
break | |
} | |
t || n.destruct(!0); | |
delete a.sounds[e]; | |
return !0 | |
}; | |
this.load = function(e, t) { | |
return !nt(e) ? !1 : a.sounds[e].load(t) | |
}; | |
this.unload = function(e) { | |
return !nt(e) ? !1 : a.sounds[e].unload() | |
}; | |
this.onposition = this.onPosition = function(e, t, n, r) { | |
return !nt(e) ? !1 : a.sounds[e].onposition(t, n, r) | |
}; | |
this.clearOnPosition = function(e, t, n) { | |
return !nt(e) ? !1 : a.sounds[e].clearOnPosition(t, n) | |
}; | |
this.start = this.play = function(e, t) { | |
var n = !1; | |
if (!S || !a.ok()) return tt("soundManager.play(): " + Q(!S ? "notReady" : "notOK")), n; | |
if (!nt(e)) { | |
t instanceof Object || (t = { | |
url: t | |
}); | |
if (t && t.url) t.id = e, n = a.createSound(t).play(); | |
return n | |
} | |
return a.sounds[e].play(t) | |
}; | |
this.setPosition = function(e, t) { | |
return !nt(e) ? !1 : a.sounds[e].setPosition(t) | |
}; | |
this.stop = function(e) { | |
return !nt(e) ? !1 : a.sounds[e].stop() | |
}; | |
this.stopAll = function() { | |
for (var e in a.sounds) a.sounds.hasOwnProperty(e) && a.sounds[e].stop() | |
}; | |
this.pause = function(e) { | |
return !nt(e) ? !1 : a.sounds[e].pause() | |
}; | |
this.pauseAll = function() { | |
var e; | |
for (e = a.soundIDs.length - 1; 0 <= e; e--) a.sounds[a.soundIDs[e]].pause() | |
}; | |
this.resume = function(e) { | |
return !nt(e) ? !1 : a.sounds[e].resume() | |
}; | |
this.resumeAll = function() { | |
var e; | |
for (e = a.soundIDs.length - 1; 0 <= e; e--) a.sounds[a.soundIDs[e]].resume() | |
}; | |
this.togglePause = function(e) { | |
return !nt(e) ? !1 : a.sounds[e].togglePause() | |
}; | |
this.setPan = function(e, t) { | |
return !nt(e) ? !1 : a.sounds[e].setPan(t) | |
}; | |
this.setVolume = function(e, t) { | |
return !nt(e) ? !1 : a.sounds[e].setVolume(t) | |
}; | |
this.mute = function(e) { | |
var t = 0; | |
"string" !== typeof e && (e = null); | |
if (e) return !nt(e) ? !1 : a.sounds[e].mute(); | |
for (t = a.soundIDs.length - 1; 0 <= t; t--) a.sounds[a.soundIDs[t]].mute(); | |
return a.muted = !0 | |
}; | |
this.muteAll = function() { | |
a.mute() | |
}; | |
this.unmute = function(e) { | |
"string" !== typeof e && (e = null); | |
if (e) return !nt(e) ? !1 : a.sounds[e].unmute(); | |
for (e = a.soundIDs.length - 1; 0 <= e; e--) a.sounds[a.soundIDs[e]].unmute(); | |
a.muted = !1; | |
return !0 | |
}; | |
this.unmuteAll = function() { | |
a.unmute() | |
}; | |
this.toggleMute = function(e) { | |
return !nt(e) ? !1 : a.sounds[e].toggleMute() | |
}; | |
this.getMemoryUse = function() { | |
var e = 0; | |
f && 8 !== y && (e = parseInt(f._getMemoryUse(), 10)); | |
return e | |
}; | |
this.disable = function(e) { | |
var t; | |
"undefined" === typeof e && (e = !1); | |
if (x) return !1; | |
x = !0; | |
for (t = a.soundIDs.length - 1; 0 <= t; t--) X(a.sounds[a.soundIDs[t]]); | |
N(e); | |
bt.remove(h, "load", M); | |
return !0 | |
}; | |
this.canPlayMIME = function(e) { | |
var t; | |
a.hasHTML5 && (t = dt({ | |
type: e | |
})); | |
!t && ct && (t = e && a.ok() ? !! (8 < y && e.match(qt) || e.match(a.mimePattern)) : null); | |
return t | |
}; | |
this.canPlayURL = function(e) { | |
var t; | |
a.hasHTML5 && (t = dt({ | |
url: e | |
})); | |
!t && ct && (t = e && a.ok() ? !! e.match(a.filePattern) : null); | |
return t | |
}; | |
this.canPlayLink = function(e) { | |
return "undefined" !== typeof e.type && e.type && a.canPlayMIME(e.type) ? !0 : a.canPlayURL(e.href) | |
}; | |
this.getSoundById = function(e) { | |
if (!e) throw Error("soundManager.getSoundById(): sID is null/undefined"); | |
return a.sounds[e] | |
}; | |
this.onready = function(e, t) { | |
var n = !1; | |
if ("function" === typeof e) t || (t = h), A("onready", e, t), O(); | |
else throw Q("needFunction", "onready"); | |
return !0 | |
}; | |
this.ontimeout = function(e, t) { | |
var n = !1; | |
if ("function" === typeof e) t || (t = h), A("ontimeout", e, t), O({ | |
type: "ontimeout" | |
}); | |
else throw Q("needFunction", "ontimeout"); | |
return !0 | |
}; | |
this._wD = this._writeDebug = function() { | |
return !0 | |
}; | |
this._debug = function() {}; | |
this.reboot = function() { | |
var e, t; | |
for (e = a.soundIDs.length - 1; 0 <= e; e--) a.sounds[a.soundIDs[e]].destruct(); | |
if (f) try { | |
if (Lt) K = f.innerHTML; | |
J = f.parentNode.removeChild(f) | |
} catch (n) {} | |
K = J = ct = null; | |
a.enabled = I = S = rt = it = w = E = x = a.swfLoaded = !1; | |
a.soundIDs = []; | |
a.sounds = {}; | |
f = null; | |
for (e in b) if (b.hasOwnProperty(e)) for (t = b[e].length - 1; 0 <= t; t--) b[e][t].fired = !1; | |
h.setTimeout(a.beginDelayedInit, 20) | |
}; | |
this.getMoviePercent = function() { | |
return f && "undefined" !== typeof f.PercentLoaded ? f.PercentLoaded() : null | |
}; | |
this.beginDelayedInit = function() { | |
T = !0; | |
j(); | |
setTimeout(function() { | |
if (it) return !1; | |
R(); | |
B(); | |
return it = !0 | |
}, 20); | |
_() | |
}; | |
this.destruct = function() { | |
a.disable(!0) | |
}; | |
u = function(e) { | |
var t, n, r = this, | |
i, s, o, u, l, c, h = !1, | |
p = [], | |
d = 0, | |
v, m, g = null; | |
t = null; | |
n = null; | |
this.sID = this.id = e.id; | |
this.url = e.url; | |
this._iO = this.instanceOptions = this.options = C(e); | |
this.pan = this.options.pan; | |
this.volume = this.options.volume; | |
this.isHTML5 = !1; | |
this._a = null; | |
this.id3 = {}; | |
this._debug = function() {}; | |
this.load = function(e) { | |
var t = null; | |
if ("undefined" !== typeof e) r._iO = C(e, r.options), r.instanceOptions = r._iO; | |
else if (e = r.options, r._iO = e, r.instanceOptions = r._iO, g && g !== r.url) r._iO.url = r.url, r.url = null; | |
if (!r._iO.url) r._iO.url = r.url; | |
r._iO.url = lt(r._iO.url); | |
if (r._iO.url === r.url && 0 !== r.readyState && 2 !== r.readyState) return 3 === r.readyState && r._iO.onload && r._iO.onload.apply(r, [ !! r.duration]), r; | |
e = r._iO; | |
g = r.url && r.url.toString ? r.url.toString() : null; | |
r.loaded = !1; | |
r.readyState = 1; | |
r.playState = 0; | |
r.id3 = {}; | |
if (pt(e)) { | |
if (t = r._setup_html5(e), !t._called_load) { | |
r._html5_canplay = !1; | |
if (r._a.src !== e.url) r._a.src = e.url, r.setPosition(0); | |
r._a.autobuffer = "auto"; | |
r._a.preload = "auto"; | |
t._called_load = !0; | |
e.autoPlay && r.play() | |
} | |
} else try { | |
r.isHTML5 = !1, r._iO = et(Z(e)), e = r._iO, 8 === y ? f._load(r.id, e.url, e.stream, e.autoPlay, e.whileloading ? 1 : 0, e.loops || 1, e.usePolicyFile) : f._load(r.id, e.url, !! e.stream, !! e.autoPlay, e.loops || 1, !! e.autoLoad, e.usePolicyFile) | |
} catch (n) { | |
U({ | |
type: "SMSOUND_LOAD_JS_EXCEPTION", | |
fatal: !0 | |
}) | |
} | |
r.url = e.url; | |
return r | |
}; | |
this.unload = function() { | |
if (0 !== r.readyState) { | |
if (r.isHTML5) { | |
if (u(), r._a) r._a.pause(), mt(r._a, "about:blank"), r.url = "about:blank" | |
} else 8 === y ? f._unload(r.id, "about:blank") : f._unload(r.id); | |
i() | |
} | |
return r | |
}; | |
this.destruct = function(e) { | |
if (r.isHTML5) { | |
if (u(), r._a) r._a.pause(), mt(r._a), Et || o(), r._a._t = null, r._a = null | |
} else r._iO.onfailure = null, f._destroySound(r.id); | |
e || a.destroySound(r.id, !0) | |
}; | |
this.start = this.play = function(e, t) { | |
var n, i; | |
i = !0; | |
i = null; | |
t = "undefined" === typeof t ? !0 : t; | |
e || (e = {}); | |
if (r.url) r._iO.url = r.url; | |
r._iO = C(r._iO, r.options); | |
r._iO = C(e, r._iO); | |
r._iO.url = lt(r._iO.url); | |
r.instanceOptions = r._iO; | |
if (r._iO.serverURL && !r.connected) return r.getAutoPlay() || r.setAutoPlay(!0), r; | |
pt(r._iO) && (r._setup_html5(r._iO), l()); | |
if (1 === r.playState && !r.paused)(n = r._iO.multiShot) || (i = r); | |
if (null !== i) return i; | |
e.url && e.url !== r.url && r.load(r._iO); | |
if (!r.loaded) if (0 === r.readyState) { | |
if (!r.isHTML5) r._iO.autoPlay = !0; | |
r.load(r._iO) | |
} else 2 === r.readyState && (i = r); | |
if (null !== i) return i; | |
if (!r.isHTML5 && 9 === y && 0 < r.position && r.position === r.duration) e.position = 0; | |
if (r.paused && 0 <= r.position && (!r._iO.serverURL || 0 < r.position)) r.resume(); | |
else { | |
r._iO = C(e, r._iO); | |
if (null !== r._iO.from && null !== r._iO.to && 0 === r.instanceCount && 0 === r.playState && !r._iO.serverURL) { | |
n = function() { | |
r._iO = C(e, r._iO); | |
r.play(r._iO) | |
}; | |
if (r.isHTML5 && !r._html5_canplay) r.load({ | |
_oncanplay: n | |
}), i = !1; | |
else if (!r.isHTML5 && !r.loaded && (!r.readyState || 2 !== r.readyState)) r.load({ | |
onload: n | |
}), i = !1; | |
if (null !== i) return i; | |
r._iO = m() | |
}(!r.instanceCount || r._iO.multiShotEvents || !r.isHTML5 && 8 < y && !r.getAutoPlay()) && r.instanceCount++; | |
r._iO.onposition && 0 === r.playState && c(r); | |
r.playState = 1; | |
r.paused = !1; | |
r.position = "undefined" !== typeof r._iO.position && !isNaN(r._iO.position) ? r._iO.position : 0; | |
if (!r.isHTML5) r._iO = et(Z(r._iO)); | |
r._iO.onplay && t && (r._iO.onplay.apply(r), h = !0); | |
r.setVolume(r._iO.volume, !0); | |
r.setPan(r._iO.pan, !0); | |
r.isHTML5 ? (l(), i = r._setup_html5(), r.setPosition(r._iO.position), i.play()) : (i = f._start(r.id, r._iO.loops || 1, 9 === y ? r._iO.position : r._iO.position / 1e3, r._iO.multiShot), 9 === y && !i && r._iO.onplayerror && r._iO.onplayerror.apply(r)) | |
} | |
return r | |
}; | |
this.stop = function(e) { | |
var t = r._iO; | |
if (1 === r.playState) { | |
r._onbufferchange(0); | |
r._resetOnPosition(0); | |
r.paused = !1; | |
if (!r.isHTML5) r.playState = 0; | |
v(); | |
t.to && r.clearOnPosition(t.to); | |
if (r.isHTML5) { | |
if (r._a) e = r.position, r.setPosition(0), r.position = e, r._a.pause(), r.playState = 0, r._onTimer(), u() | |
} else f._stop(r.id, e), t.serverURL && r.unload(); | |
r.instanceCount = 0; | |
r._iO = {}; | |
t.onstop && t.onstop.apply(r) | |
} | |
return r | |
}; | |
this.setAutoPlay = function(e) { | |
r._iO.autoPlay = e; | |
r.isHTML5 || (f._setAutoPlay(r.id, e), e && !r.instanceCount && 1 === r.readyState && r.instanceCount++) | |
}; | |
this.getAutoPlay = function() { | |
return r._iO.autoPlay | |
}; | |
this.setPosition = function(e) { | |
"undefined" === typeof e && (e = 0); | |
var t = r.isHTML5 ? Math.max(e, 0) : Math.min(r.duration || r._iO.duration, Math.max(e, 0)); | |
r.position = t; | |
e = r.position / 1e3; | |
r._resetOnPosition(r.position); | |
r._iO.position = t; | |
if (r.isHTML5) { | |
if (r._a && r._html5_canplay && r._a.currentTime !== e) try { | |
r._a.currentTime = e, (0 === r.playState || r.paused) && r._a.pause() | |
} catch (n) {} | |
} else e = 9 === y ? r.position : e, r.readyState && 2 !== r.readyState && f._setPosition(r.id, e, r.paused || !r.playState, r._iO.multiShot); | |
r.isHTML5 && r.paused && r._onTimer(!0); | |
return r | |
}; | |
this.pause = function(e) { | |
if (r.paused || 0 === r.playState && 1 !== r.readyState) return r; | |
r.paused = !0; | |
r.isHTML5 ? (r._setup_html5().pause(), u()) : (e || "undefined" === typeof e) && f._pause(r.id, r._iO.multiShot); | |
r._iO.onpause && r._iO.onpause.apply(r); | |
return r | |
}; | |
this.resume = function() { | |
var e = r._iO; | |
if (!r.paused) return r; | |
r.paused = !1; | |
r.playState = 1; | |
r.isHTML5 ? (r._setup_html5().play(), l()) : (e.isMovieStar && !e.serverURL && r.setPosition(r.position), f._pause(r.id, e.multiShot)); | |
!h && e.onplay ? (e.onplay.apply(r), h = !0) : e.onresume && e.onresume.apply(r); | |
return r | |
}; | |
this.togglePause = function() { | |
if (0 === r.playState) return r.play({ | |
position: 9 === y && !r.isHTML5 ? r.position : r.position / 1e3 | |
}), r; | |
r.paused ? r.resume() : r.pause(); | |
return r | |
}; | |
this.setPan = function(e, t) { | |
"undefined" === typeof e && (e = 0); | |
"undefined" === typeof t && (t = !1); | |
r.isHTML5 || f._setPan(r.id, e); | |
r._iO.pan = e; | |
if (!t) r.pan = e, r.options.pan = e; | |
return r | |
}; | |
this.setVolume = function(e, t) { | |
"undefined" === typeof e && (e = 100); | |
"undefined" === typeof t && (t = !1); | |
if (r.isHTML5) { | |
if (r._a) r._a.volume = Math.max(0, Math.min(1, e / 100)) | |
} else f._setVolume(r.id, a.muted && !r.muted || r.muted ? 0 : e); | |
r._iO.volume = e; | |
if (!t) r.volume = e, r.options.volume = e; | |
return r | |
}; | |
this.mute = function() { | |
r.muted = !0; | |
if (r.isHTML5) { | |
if (r._a) r._a.muted = !0 | |
} else f._setVolume(r.id, 0); | |
return r | |
}; | |
this.unmute = function() { | |
r.muted = !1; | |
var e = "undefined" !== typeof r._iO.volume; | |
if (r.isHTML5) { | |
if (r._a) r._a.muted = !1 | |
} else f._setVolume(r.id, e ? r._iO.volume : r.options.volume); | |
return r | |
}; | |
this.toggleMute = function() { | |
return r.muted ? r.unmute() : r.mute() | |
}; | |
this.onposition = this.onPosition = function(e, t, n) { | |
p.push({ | |
position: parseInt(e, 10), | |
method: t, | |
scope: "undefined" !== typeof n ? n : r, | |
fired: !1 | |
}); | |
return r | |
}; | |
this.clearOnPosition = function(e, t) { | |
var n, e = parseInt(e, 10); | |
if (isNaN(e)) return !1; | |
for (n = 0; n < p.length; n++) if (e === p[n].position && (!t || t === p[n].method)) p[n].fired && d--, p.splice(n, 1) | |
}; | |
this._processOnPosition = function() { | |
var e, t; | |
e = p.length; | |
if (!e || !r.playState || d >= e) return !1; | |
for (e -= 1; 0 <= e; e--) if (t = p[e], !t.fired && r.position >= t.position) t.fired = !0, d++, t.method.apply(t.scope, [t.position]); | |
return !0 | |
}; | |
this._resetOnPosition = function(e) { | |
var t, n; | |
t = p.length; | |
if (!t) return !1; | |
for (t -= 1; 0 <= t; t--) if (n = p[t], n.fired && e <= n.position) n.fired = !1, d--; | |
return !0 | |
}; | |
m = function() { | |
var e = r._iO, | |
t = e.from, | |
n = e.to, | |
i, s; | |
s = function() { | |
r.clearOnPosition(n, s); | |
r.stop() | |
}; | |
i = function() { | |
if (null !== n && !isNaN(n)) r.onPosition(n, s) | |
}; | |
if (null !== t && !isNaN(t)) e.position = t, e.multiShot = !1, i(); | |
return e | |
}; | |
c = function() { | |
var e, t = r._iO.onposition; | |
if (t) for (e in t) if (t.hasOwnProperty(e)) r.onPosition(parseInt(e, 10), t[e]) | |
}; | |
v = function() { | |
var e, t = r._iO.onposition; | |
if (t) for (e in t) t.hasOwnProperty(e) && r.clearOnPosition(parseInt(e, 10)) | |
}; | |
l = function() { | |
r.isHTML5 && st(r) | |
}; | |
u = function() { | |
r.isHTML5 && ot(r) | |
}; | |
i = function(e) { | |
e || (p = [], d = 0); | |
h = !1; | |
r._hasTimer = null; | |
r._a = null; | |
r._html5_canplay = !1; | |
r.bytesLoaded = null; | |
r.bytesTotal = null; | |
r.duration = r._iO && r._iO.duration ? r._iO.duration : null; | |
r.durationEstimate = null; | |
r.buffered = []; | |
r.eqData = []; | |
r.eqData.left = []; | |
r.eqData.right = []; | |
r.failures = 0; | |
r.isBuffering = !1; | |
r.instanceOptions = {}; | |
r.instanceCount = 0; | |
r.loaded = !1; | |
r.metadata = {}; | |
r.readyState = 0; | |
r.muted = !1; | |
r.paused = !1; | |
r.peakData = { | |
left: 0, | |
right: 0 | |
}; | |
r.waveformData = { | |
left: [], | |
right: [] | |
}; | |
r.playState = 0; | |
r.position = null; | |
r.id3 = {} | |
}; | |
i(); | |
this._onTimer = function(e) { | |
var i, s = !1, | |
o = {}; | |
if (r._hasTimer || e) { | |
if (r._a && (e || (0 < r.playState || 1 === r.readyState) && !r.paused)) { | |
i = r._get_html5_duration(); | |
if (i !== t) t = i, r.duration = i, s = !0; | |
r.durationEstimate = r.duration; | |
i = 1e3 * r._a.currentTime || 0; | |
i !== n && (n = i, s = !0); | |
(s || e) && r._whileplaying(i, o, o, o, o) | |
} | |
return s | |
} | |
}; | |
this._get_html5_duration = function() { | |
var e = r._iO; | |
return (e = r._a && r._a.duration ? 1e3 * r._a.duration : e && e.duration ? e.duration : null) && !isNaN(e) && Infinity !== e ? e : null | |
}; | |
this._apply_loop = function(e, t) { | |
e.loop = 1 < t ? "loop" : "" | |
}; | |
this._setup_html5 = function(e) { | |
var e = C(r._iO, e), | |
t = decodeURI, | |
n = Et ? a._global_a : r._a, | |
o = t(e.url), | |
u = n && n._t ? n._t.instanceOptions : null, | |
f; | |
if (n) { | |
if (n._t) { | |
if (!Et && o === t(g)) f = n; | |
else if (Et && u.url === e.url && (!g || g === u.url)) f = n; | |
if (f) return r._apply_loop(n, e.loops), f | |
} | |
Et && n._t && n._t.playState && e.url !== u.url && n._t.stop(); | |
i(u && u.url ? e.url === u.url : g ? g === e.url : !1); | |
n.src = e.url; | |
g = r.url = e.url; | |
n._called_load = !1 | |
} else if (r._a = e.autoLoad || e.autoPlay ? new Audio(e.url) : Mt && 10 > opera.version() ? new Audio(null) : new Audio, n = r._a, n._called_load = !1, Et) a._global_a = n; | |
r.isHTML5 = !0; | |
r._a = n; | |
n._t = r; | |
s(); | |
r._apply_loop(n, e.loops); | |
e.autoLoad || e.autoPlay ? r.load() : (n.autobuffer = !1, n.preload = "auto"); | |
return n | |
}; | |
s = function() { | |
if (r._a._added_events) return !1; | |
var e; | |
r._a._added_events = !0; | |
for (e in Nt) Nt.hasOwnProperty(e) && r._a && r._a.addEventListener(e, Nt[e], !1); | |
return !0 | |
}; | |
o = function() { | |
var e; | |
r._a._added_events = !1; | |
for (e in Nt) Nt.hasOwnProperty(e) && r._a && r._a.removeEventListener(e, Nt[e], !1) | |
}; | |
this._onload = function(e) { | |
e = !! e || !r.isHTML5 && 8 === y && r.duration; | |
r.loaded = e; | |
r.readyState = e ? 3 : 2; | |
r._onbufferchange(0); | |
r._iO.onload && r._iO.onload.apply(r, [e]); | |
return !0 | |
}; | |
this._onbufferchange = function(e) { | |
if (0 === r.playState || e && r.isBuffering || !e && !r.isBuffering) return !1; | |
r.isBuffering = 1 === e; | |
r._iO.onbufferchange && r._iO.onbufferchange.apply(r); | |
return !0 | |
}; | |
this._onsuspend = function() { | |
r._iO.onsuspend && r._iO.onsuspend.apply(r); | |
return !0 | |
}; | |
this._onfailure = function(e, t, n) { | |
r.failures++; | |
if (r._iO.onfailure && 1 === r.failures) r._iO.onfailure(r, e, t, n) | |
}; | |
this._onfinish = function() { | |
var e = r._iO.onfinish; | |
r._onbufferchange(0); | |
r._resetOnPosition(0); | |
if (r.instanceCount) { | |
r.instanceCount--; | |
if (!r.instanceCount && (v(), r.playState = 0, r.paused = !1, r.instanceCount = 0, r.instanceOptions = {}, r._iO = {}, u(), r.isHTML5)) r.position = 0; | |
(!r.instanceCount || r._iO.multiShotEvents) && e && e.apply(r) | |
} | |
}; | |
this._whileloading = function(e, t, n, i) { | |
var s = r._iO; | |
r.bytesLoaded = e; | |
r.bytesTotal = t; | |
r.duration = Math.floor(n); | |
r.bufferLength = i; | |
r.durationEstimate = !r.isHTML5 && !s.isMovieStar ? s.duration ? r.duration > s.duration ? r.duration : s.duration : parseInt(r.bytesTotal / r.bytesLoaded * r.duration, 10) : r.duration; | |
if (!r.isHTML5) r.buffered = [{ | |
start: 0, | |
end: r.duration | |
}]; | |
(3 !== r.readyState || r.isHTML5) && s.whileloading && s.whileloading.apply(r) | |
}; | |
this._whileplaying = function(e, t, n, i, s) { | |
var o = r._iO; | |
if (isNaN(e) || null === e) return !1; | |
r.position = Math.max(0, e); | |
r._processOnPosition(); | |
if (!r.isHTML5 && 8 < y) { | |
if (o.usePeakData && "undefined" !== typeof t && t) r.peakData = { | |
left: t.leftPeak, | |
right: t.rightPeak | |
}; | |
if (o.useWaveformData && "undefined" !== typeof n && n) r.waveformData = { | |
left: n.split(","), | |
right: i.split(",") | |
}; | |
if (o.useEQData && "undefined" !== typeof s && s && s.leftEQ && (e = s.leftEQ.split(","), r.eqData = e, r.eqData.left = e, "undefined" !== typeof s.rightEQ && s.rightEQ)) r.eqData.right = s.rightEQ.split(",") | |
} | |
1 === r.playState && (!r.isHTML5 && 8 === y && !r.position && r.isBuffering && r._onbufferchange(0), o.whileplaying && o.whileplaying.apply(r)); | |
return !0 | |
}; | |
this._oncaptiondata = function(e) { | |
r.captiondata = e; | |
r._iO.oncaptiondata && r._iO.oncaptiondata.apply(r, [e]) | |
}; | |
this._onmetadata = function(e, t) { | |
var n = {}, | |
i, s; | |
for (i = 0, s = e.length; i < s; i++) n[e[i]] = t[i]; | |
r.metadata = n; | |
r._iO.onmetadata && r._iO.onmetadata.apply(r) | |
}; | |
this._onid3 = function(e, t) { | |
var n = [], | |
i, s; | |
for (i = 0, s = e.length; i < s; i++) n[e[i]] = t[i]; | |
r.id3 = C(r.id3, n); | |
r._iO.onid3 && r._iO.onid3.apply(r) | |
}; | |
this._onconnect = function(e) { | |
e = 1 === e; | |
if (r.connected = e) r.failures = 0, nt(r.id) && (r.getAutoPlay() ? r.play(void 0, r.getAutoPlay()) : r._iO.autoLoad && r.load()), r._iO.onconnect && r._iO.onconnect.apply(r, [e]) | |
}; | |
this._ondataerror = function() { | |
0 < r.playState && r._iO.ondataerror && r._iO.ondataerror.apply(r) | |
} | |
}; | |
q = function() { | |
return d.body || d._docElement || d.getElementsByTagName("div")[0] | |
}; | |
l = function(e) { | |
return d.getElementById(e) | |
}; | |
C = function(e, t) { | |
var n = e || {}, | |
r, i; | |
r = "undefined" === typeof t ? a.defaultOptions : t; | |
for (i in r) r.hasOwnProperty(i) && "undefined" === typeof n[i] && (n[i] = "object" !== typeof r[i] || null === r[i] ? r[i] : C(n[i], r[i])); | |
return n | |
}; | |
L = { | |
onready: 1, | |
ontimeout: 1, | |
defaultOptions: 1, | |
flash9Options: 1, | |
movieStarOptions: 1 | |
}; | |
k = function(e, t) { | |
var n, r = !0, | |
i = "undefined" !== typeof t, | |
s = a.setupOptions; | |
for (n in e) if (e.hasOwnProperty(n)) if ("object" !== typeof e[n] || null === e[n] || e[n] instanceof Array) i && "undefined" !== typeof L[t] ? a[t][n] = e[n] : "undefined" !== typeof s[n] ? (a.setupOptions[n] = e[n], a[n] = e[n]) : "undefined" === typeof L[n] ? (tt(Q("undefined" === typeof a[n] ? "setupUndef" : "setupError", n), 2), r = !1) : a[n] instanceof Function ? a[n].apply(a, e[n] instanceof Array ? e[n] : [e[n]]) : a[n] = e[n]; | |
else if ("undefined" === typeof L[n]) tt(Q("undefined" === typeof a[n] ? "setupUndef" : "setupError", n), 2), r = !1; | |
else return k(e[n], n); | |
return r | |
}; | |
bt = function() { | |
function e(e) { | |
var e = wt.call(e), | |
t = e.length; | |
n ? (e[1] = "on" + e[1], 3 < t && e.pop()) : 3 === t && e.push(!1); | |
return e | |
} | |
function t(e, t) { | |
var i = e.shift(), | |
s = [r[t]]; | |
if (n) i[s](e[0], e[1]); | |
else i[s].apply(i, e) | |
} | |
var n = h.attachEvent, | |
r = { | |
add: n ? "attachEvent" : "addEventListener", | |
remove: n ? "detachEvent" : "removeEventListener" | |
}; | |
return { | |
add: function() { | |
t(e(arguments), "add") | |
}, | |
remove: function() { | |
t(e(arguments), "remove") | |
} | |
} | |
}(); | |
Nt = { | |
abort: i(function() {}), | |
canplay: i(function() { | |
var e = this._t, | |
t; | |
if (e._html5_canplay) return !0; | |
e._html5_canplay = !0; | |
e._onbufferchange(0); | |
t = "undefined" !== typeof e._iO.position && !isNaN(e._iO.position) ? e._iO.position / 1e3 : null; | |
if (e.position && this.currentTime !== t) try { | |
this.currentTime = t | |
} catch (n) {} | |
e._iO._oncanplay && e._iO._oncanplay() | |
}), | |
canplaythrough: i(function() { | |
var e = this._t; | |
e.loaded || (e._onbufferchange(0), e._whileloading(e.bytesLoaded, e.bytesTotal, e._get_html5_duration()), e._onload(!0)) | |
}), | |
ended: i(function() { | |
this._t._onfinish() | |
}), | |
error: i(function() { | |
this._t._onload(!1) | |
}), | |
loadeddata: i(function() { | |
var e = this._t; | |
if (!e._loaded && !Ot) e.duration = e._get_html5_duration() | |
}), | |
loadedmetadata: i(function() {}), | |
loadstart: i(function() { | |
this._t._onbufferchange(1) | |
}), | |
play: i(function() { | |
this._t._onbufferchange(0) | |
}), | |
playing: i(function() { | |
this._t._onbufferchange(0) | |
}), | |
progress: i(function(e) { | |
var t = this._t, | |
n, r, i = 0, | |
i = e.target.buffered; | |
n = e.loaded || 0; | |
var s = e.total || 1; | |
t.buffered = []; | |
if (i && i.length) { | |
for (n = 0, r = i.length; n < r; n++) t.buffered.push({ | |
start: 1e3 * i.start(n), | |
end: 1e3 * i.end(n) | |
}); | |
i = 1e3 * (i.end(0) - i.start(0)); | |
n = i / (1e3 * e.target.duration) | |
} | |
isNaN(n) || (t._onbufferchange(0), t._whileloading(n, s, t._get_html5_duration()), n && s && n === s && Nt.canplaythrough.call(this, e)) | |
}), | |
ratechange: i(function() {}), | |
suspend: i(function(e) { | |
var t = this._t; | |
Nt.progress.call(this, e); | |
t._onsuspend() | |
}), | |
stalled: i(function() {}), | |
timeupdate: i(function() { | |
this._t._onTimer() | |
}), | |
waiting: i(function() { | |
this._t._onbufferchange(1) | |
}) | |
}; | |
pt = function(e) { | |
return e.serverURL || e.type && r(e.type) ? !1 : e.type ? dt({ | |
type: e.type | |
}) : dt({ | |
url: e.url | |
}) || a.html5Only | |
}; | |
mt = function(e, t) { | |
if (e) e.src = t | |
}; | |
dt = function(e) { | |
if (!a.useHTML5Audio || !a.hasHTML5) return !1; | |
var t = e.url || null, | |
e = e.type || null, | |
n = a.audioFormats, | |
i; | |
if (e && "undefined" !== typeof a.html5[e]) return a.html5[e] && !r(e); | |
if (!vt) { | |
vt = []; | |
for (i in n) n.hasOwnProperty(i) && (vt.push(i), n[i].related && (vt = vt.concat(n[i].related))); | |
vt = RegExp("\\.(" + vt.join("|") + ")(\\?.*)?$", "i") | |
} | |
i = t ? t.toLowerCase().match(vt) : null; | |
!i || !i.length ? e && (t = e.indexOf(";"), i = (-1 !== t ? e.substr(0, t) : e).substr(6)) : i = i[1]; | |
i && "undefined" !== typeof a.html5[i] ? t = a.html5[i] && !r(i) : (e = "audio/" + i, t = a.html5.canPlayType({ | |
type: e | |
}), t = (a.html5[i] = t) && a.html5[e] && !r(e)); | |
return t | |
}; | |
yt = function() { | |
function e(e) { | |
var n, r, i = n = !1; | |
if (!t || "function" !== typeof t.canPlayType) return n; | |
if (e instanceof Array) { | |
for (n = 0, r = e.length; n < r; n++) if (a.html5[e[n]] || t.canPlayType(e[n]).match(a.html5Test)) i = !0, a.html5[e[n]] = !0, a.flash[e[n]] = !! e[n].match(jt); | |
n = i | |
} else e = t && "function" === typeof t.canPlayType ? t.canPlayType(e) : !1, n = !(!e || !e.match(a.html5Test)); | |
return n | |
} | |
if (!a.useHTML5Audio || !a.hasHTML5) return !1; | |
var t = "undefined" !== typeof Audio ? Mt && 10 > opera.version() ? new Audio(null) : new Audio : null, | |
n, r, i = {}, | |
s; | |
s = a.audioFormats; | |
for (n in s) if (s.hasOwnProperty(n) && (r = "audio/" + n, i[n] = e(s[n].type), i[r] = i[n], n.match(jt) ? (a.flash[n] = !0, a.flash[r] = !0) : (a.flash[n] = !1, a.flash[r] = !1), s[n] && s[n].related)) for (r = s[n].related.length - 1; 0 <= r; r--) i["audio/" + s[n].related[r]] = i[n], a.html5[s[n].related[r]] = i[n], a.flash[s[n].related[r]] = i[n]; | |
i.canPlayType = t ? e : null; | |
a.html5 = C(a.html5, i); | |
return !0 | |
}; | |
Q = function() {}; | |
Z = function(e) { | |
if (8 === y && 1 < e.loops && e.stream) e.stream = !1; | |
return e | |
}; | |
et = function(e) { | |
if (e && !e.usePolicyFile && (e.onid3 || e.usePeakData || e.useWaveformData || e.useEQData)) e.usePolicyFile = !0; | |
return e | |
}; | |
tt = function() {}; | |
v = function() { | |
return !1 | |
}; | |
X = function(e) { | |
for (var t in e) e.hasOwnProperty(t) && "function" === typeof e[t] && (e[t] = v) | |
}; | |
V = function(e) { | |
"undefined" === typeof e && (e = !1); | |
(x || e) && a.disable(e) | |
}; | |
$ = function(e) { | |
var t = null; | |
if (e) if (e.match(/\.swf(\?.*)?$/i)) { | |
if (t = e.substr(e.toLowerCase().lastIndexOf(".swf?") + 4)) return e | |
} else e.lastIndexOf("/") !== e.length - 1 && (e += "/"); | |
e = (e && -1 !== e.lastIndexOf("/") ? e.substr(0, e.lastIndexOf("/") + 1) : "./") + a.movieURL; | |
a.noSWFCache && (e += "?ts=" + (new Date).getTime()); | |
return e | |
}; | |
P = function() { | |
y = parseInt(a.flashVersion, 10); | |
if (8 !== y && 9 !== y) a.flashVersion = y = 8; | |
var e = a.debugMode || a.debugFlash ? "_debug.swf" : ".swf"; | |
if (a.useHTML5Audio && !a.html5Only && a.audioFormats.mp4.required && 9 > y) a.flashVersion = y = 9; | |
a.version = a.versionNumber + (a.html5Only ? " (HTML5-only mode)" : 9 === y ? " (AS3/Flash 9)" : " (AS2/Flash 8)"); | |
8 < y ? (a.defaultOptions = C(a.defaultOptions, a.flash9Options), a.features.buffering = !0, a.defaultOptions = C(a.defaultOptions, a.movieStarOptions), a.filePatterns.flash9 = RegExp("\\.(mp3|" + Rt.join("|") + ")(\\?.*)?$", "i"), a.features.movieStar = !0) : a.features.movieStar = !1; | |
a.filePattern = a.filePatterns[8 !== y ? "flash9" : "flash8"]; | |
a.movieURL = (8 === y ? "soundmanager2.swf" : "soundmanager2_flash9.swf").replace(".swf", e); | |
a.features.peakData = a.features.waveformData = a.features.eqData = 8 < y | |
}; | |
z = function(e, t) { | |
if (!f) return !1; | |
f._setPolling(e, t) | |
}; | |
W = function() { | |
if (a.debugURLParam.test(p)) a.debugMode = !0 | |
}; | |
nt = this.getSoundById; | |
Y = function() { | |
var e = []; | |
a.debugMode && e.push("sm2_debug"); | |
a.debugFlash && e.push("flash_debug"); | |
a.useHighPerformance && e.push("high_performance"); | |
return e.join(" ") | |
}; | |
G = function() { | |
Q("fbHandler"); | |
var e = a.getMoviePercent(), | |
t = { | |
type: "FLASHBLOCK" | |
}; | |
if (a.html5Only) return !1; | |
if (a.ok()) { | |
if (a.oMC) a.oMC.className = [Y(), "movieContainer", "swf_loaded" + (a.didFlashBlock ? " swf_unblocked" : "")].join(" ") | |
} else { | |
if (ct) a.oMC.className = Y() + " movieContainer " + (null === e ? "swf_timedout" : "swf_error"); | |
a.didFlashBlock = !0; | |
O({ | |
type: "ontimeout", | |
ignoreInit: !0, | |
error: t | |
}); | |
U(t) | |
} | |
}; | |
A = function(e, t, n) { | |
"undefined" === typeof b[e] && (b[e] = []); | |
b[e].push({ | |
method: t, | |
scope: n || null, | |
fired: !1 | |
}) | |
}; | |
O = function(e) { | |
e || (e = { | |
type: a.ok() ? "onready" : "ontimeout" | |
}); | |
if (!S && e && !e.ignoreInit || "ontimeout" === e.type && (a.ok() || x && !e.ignoreInit)) return !1; | |
var t = { | |
success: e && e.ignoreInit ? a.ok() : !x | |
}, | |
n = e && e.type ? b[e.type] || [] : [], | |
r = [], | |
i, t = [t], | |
s = ct && a.useFlashBlock && !a.ok(); | |
if (e.error) t[0].error = e.error; | |
for (e = 0, i = n.length; e < i; e++)!0 !== n[e].fired && r.push(n[e]); | |
if (r.length) for (e = 0, i = r.length; e < i; e++) if (r[e].scope ? r[e].method.apply(r[e].scope, t) : r[e].method.apply(this, t), !s) r[e].fired = !0; | |
return !0 | |
}; | |
M = function() { | |
h.setTimeout(function() { | |
a.useFlashBlock && G(); | |
O(); | |
"function" === typeof a.onload && a.onload.apply(h); | |
a.waitForWindowLoad && bt.add(h, "load", M) | |
}, 1) | |
}; | |
xt = function() { | |
if ("undefined" !== typeof St) return St; | |
var e = !1, | |
t = navigator, | |
n = t.plugins, | |
r, i = h.ActiveXObject; | |
if (n && n.length)(t = t.mimeTypes) && t["application/x-shockwave-flash"] && t["application/x-shockwave-flash"].enabledPlugin && t["application/x-shockwave-flash"].enabledPlugin.description && (e = !0); | |
else if ("undefined" !== typeof i) { | |
try { | |
r = new i("ShockwaveFlash.ShockwaveFlash") | |
} catch (s) {} | |
e = !! r | |
} | |
return St = e | |
}; | |
ht = function() { | |
var e, t, n = a.audioFormats; | |
if (kt && c.match(/os (1|2|3_0|3_1)/i)) { | |
if (a.hasHTML5 = !1, a.html5Only = !0, a.oMC) a.oMC.style.display = "none" | |
} else if (a.useHTML5Audio && (!a.html5 || !a.html5.canPlayType)) a.hasHTML5 = !1; | |
if (a.useHTML5Audio && a.hasHTML5) for (t in n) if (n.hasOwnProperty(t) && (n[t].required && !a.html5.canPlayType(n[t].type) || a.preferFlash && (a.flash[t] || a.flash[n[t].type]))) e = !0; | |
a.ignoreFlash && (e = !1); | |
a.html5Only = a.hasHTML5 && a.useHTML5Audio && !e; | |
return !a.html5Only | |
}; | |
lt = function(e) { | |
var t, n, r = 0; | |
if (e instanceof Array) { | |
for (t = 0, n = e.length; t < n; t++) if (e[t] instanceof Object) { | |
if (a.canPlayMIME(e[t].type)) { | |
r = t; | |
break | |
} | |
} else if (a.canPlayURL(e[t])) { | |
r = t; | |
break | |
} | |
if (e[r].url) e[r] = e[r].url; | |
e = e[r] | |
} | |
return e | |
}; | |
st = function(e) { | |
if (!e._hasTimer) e._hasTimer = !0, !_t && a.html5PollingInterval && (null === ft && 0 === at && (ft = h.setInterval(ut, a.html5PollingInterval)), at++) | |
}; | |
ot = function(e) { | |
if (e._hasTimer) e._hasTimer = !1, !_t && a.html5PollingInterval && at-- | |
}; | |
ut = function() { | |
var e; | |
if (null !== ft && !at) return h.clearInterval(ft), ft = null, !1; | |
for (e = a.soundIDs.length - 1; 0 <= e; e--) a.sounds[a.soundIDs[e]].isHTML5 && a.sounds[a.soundIDs[e]]._hasTimer && a.sounds[a.soundIDs[e]]._onTimer() | |
}; | |
U = function(e) { | |
e = "undefined" !== typeof e ? e : {}; | |
"function" === typeof a.onerror && a.onerror.apply(h, [{ | |
type: "undefined" !== typeof e.type ? e.type : null | |
}]); | |
"undefined" !== typeof e.fatal && e.fatal && a.disable() | |
}; | |
Tt = function() { | |
if (!Dt || !xt()) return !1; | |
var e = a.audioFormats, | |
t, n; | |
for (n in e) if (e.hasOwnProperty(n) && ("mp3" === n || "mp4" === n)) if (a.html5[n] = !1, e[n] && e[n].related) for (t = e[n].related.length - 1; 0 <= t; t--) a.html5[e[n].related[t]] = !1 | |
}; | |
this._setSandboxType = function() {}; | |
this._externalInterfaceOK = function() { | |
if (a.swfLoaded) return !1; | |
(new Date).getTime(); | |
a.swfLoaded = !0; | |
Ht = !1; | |
Dt && Tt(); | |
setTimeout(g, Lt ? 100 : 1) | |
}; | |
R = function(e, t) { | |
function n(e, t) { | |
return '<param name="' + e + '" value="' + t + '" />' | |
} | |
if (w && E) return !1; | |
if (a.html5Only) return P(), a.oMC = l(a.movieID), g(), E = w = !0, !1; | |
var r = t || a.url, | |
i = a.altURL || r, | |
s = q(), | |
o = Y(), | |
u = null, | |
u = d.getElementsByTagName("html")[0], | |
f, h, p, u = u && u.dir && u.dir.match(/rtl/i), | |
e = "undefined" === typeof e ? a.id : e; | |
P(); | |
a.url = $(Ft ? r : i); | |
t = a.url; | |
a.wmode = !a.wmode && a.useHighPerformance ? "transparent" : a.wmode; | |
if (null !== a.wmode && (c.match(/msie 8/i) || !Lt && !a.useHighPerformance) && navigator.platform.match(/win32|win64/i)) a.wmode = null; | |
s = { | |
name: e, | |
id: e, | |
src: t, | |
quality: "high", | |
allowScriptAccess: a.allowScriptAccess, | |
bgcolor: a.bgColor, | |
pluginspage: It + "www.macromedia.com/go/getflashplayer", | |
title: "JS/Flash audio component (SoundManager 2)", | |
type: "application/x-shockwave-flash", | |
wmode: a.wmode, | |
hasPriority: "true" | |
}; | |
if (a.debugFlash) s.FlashVars = "debug=1"; | |
a.wmode || delete s.wmode; | |
if (Lt) r = d.createElement("div"), h = ['<object id="' + e + '" data="' + t + '" type="' + s.type + '" title="' + s.title + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="' + It + 'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0">', n("movie", t), n("AllowScriptAccess", a.allowScriptAccess), n("quality", s.quality), a.wmode ? n("wmode", a.wmode) : "", n("bgcolor", a.bgColor), n("hasPriority", "true"), a.debugFlash ? n("FlashVars", s.FlashVars) : "", "</object>"].join(""); | |
else for (f in r = d.createElement("embed"), s) s.hasOwnProperty(f) && r.setAttribute(f, s[f]); | |
W(); | |
o = Y(); | |
if (s = q()) if (a.oMC = l(a.movieID) || d.createElement("div"), a.oMC.id) { | |
p = a.oMC.className; | |
a.oMC.className = (p ? p + " " : "movieContainer") + (o ? " " + o : ""); | |
a.oMC.appendChild(r); | |
if (Lt) f = a.oMC.appendChild(d.createElement("div")), f.className = "sm2-object-box", f.innerHTML = h; | |
E = !0 | |
} else { | |
a.oMC.id = a.movieID; | |
a.oMC.className = "movieContainer " + o; | |
f = o = null; | |
if (!a.useFlashBlock) if (a.useHighPerformance) o = { | |
position: "fixed", | |
width: "8px", | |
height: "8px", | |
bottom: "0px", | |
left: "0px", | |
overflow: "hidden" | |
}; | |
else if (o = { | |
position: "absolute", | |
width: "6px", | |
height: "6px", | |
top: "-9999px", | |
left: "-9999px" | |
}, u) o.left = Math.abs(parseInt(o.left, 10)) + "px"; | |
if (At) a.oMC.style.zIndex = 1e4; | |
if (!a.debugFlash) for (p in o) o.hasOwnProperty(p) && (a.oMC.style[p] = o[p]); | |
try { | |
Lt || a.oMC.appendChild(r); | |
s.appendChild(a.oMC); | |
if (Lt) f = a.oMC.appendChild(d.createElement("div")), f.className = "sm2-object-box", f.innerHTML = h; | |
E = !0 | |
} catch (v) { | |
throw Error(Q("domError") + " \n" + v.toString()) | |
} | |
} | |
return w = !0 | |
}; | |
B = function() { | |
if (a.html5Only) return R(), !1; | |
if (f || !a.url) return !1; | |
f = a.getMovie(a.id); | |
if (!f) J ? (Lt ? a.oMC.innerHTML = K : a.oMC.appendChild(J), J = null, w = !0) : R(a.id, a.url), f = a.getMovie(a.id); | |
"function" === typeof a.oninitmovie && setTimeout(a.oninitmovie, 1); | |
return !0 | |
}; | |
_ = function() { | |
setTimeout(D, 1e3) | |
}; | |
D = function() { | |
var e, t = !1; | |
if (!a.url || rt) return !1; | |
rt = !0; | |
bt.remove(h, "load", _); | |
if (Ht && !Pt) return !1; | |
S || (e = a.getMoviePercent(), 0 < e && 100 > e && (t = !0)); | |
setTimeout(function() { | |
e = a.getMoviePercent(); | |
if (t) return rt = !1, h.setTimeout(_, 1), !1; | |
!S && Bt && (null === e ? a.useFlashBlock || 0 === a.flashLoadTimeout ? a.useFlashBlock && G() : V(!0) : 0 !== a.flashLoadTimeout && V(!0)) | |
}, a.flashLoadTimeout) | |
}; | |
H = function() { | |
if (Pt || !Ht) return bt.remove(h, "focus", H), !0; | |
Pt = Bt = !0; | |
rt = !1; | |
_(); | |
bt.remove(h, "focus", H); | |
return !0 | |
}; | |
Ct = function() {}; | |
N = function(e) { | |
if (S) return !1; | |
if (a.html5Only) return S = !0, M(), !0; | |
var t = !0, | |
n; | |
if (!a.useFlashBlock || !a.flashLoadTimeout || a.getMoviePercent()) S = !0, x && (n = { | |
type: !St && ct ? "NO_FLASH" : "INIT_TIMEOUT" | |
}); | |
if (x || e) { | |
if (a.useFlashBlock && a.oMC) a.oMC.className = Y() + " " + (null === a.getMoviePercent() ? "swf_timedout" : "swf_error"); | |
O({ | |
type: "ontimeout", | |
error: n, | |
ignoreInit: !0 | |
}); | |
U(n); | |
t = !1 | |
} | |
x || (a.waitForWindowLoad && !T ? bt.add(h, "load", M) : M()); | |
return t | |
}; | |
m = function() { | |
var e, t = a.setupOptions; | |
for (e in t) t.hasOwnProperty(e) && ("undefined" === typeof a[e] ? a[e] = t[e] : a[e] !== t[e] && (a.setupOptions[e] = a[e])) | |
}; | |
g = function() { | |
if (S) return !1; | |
if (a.html5Only) { | |
if (!S) bt.remove(h, "load", a.beginDelayedInit), a.enabled = !0, N(); | |
return !0 | |
} | |
B(); | |
try { | |
f._externalInterfaceTest(!1), z(!0, a.flashPollingInterval || (a.useHighPerformance ? 10 : 50)), a.debugMode || f._disableDebug(), a.enabled = !0, a.html5Only || bt.add(h, "unload", v) | |
} catch (e) { | |
return U({ | |
type: "JS_TO_FLASH_EXCEPTION", | |
fatal: !0 | |
}), V(!0), N(), !1 | |
} | |
N(); | |
bt.remove(h, "load", a.beginDelayedInit); | |
return !0 | |
}; | |
j = function() { | |
if (I) return !1; | |
I = !0; | |
m(); | |
W(); | |
!St && a.hasHTML5 && a.setup({ | |
useHTML5Audio: !0, | |
preferFlash: !1 | |
}); | |
yt(); | |
a.html5.usingFlash = ht(); | |
ct = a.html5.usingFlash; | |
Ct(); | |
!St && ct && a.setup({ | |
flashLoadTimeout: 1 | |
}); | |
d.removeEventListener && d.removeEventListener("DOMContentLoaded", j, !1); | |
B(); | |
return !0 | |
}; | |
gt = function() { | |
"complete" === d.readyState && (j(), d.detachEvent("onreadystatechange", gt)); | |
return !0 | |
}; | |
F = function() { | |
T = !0; | |
bt.remove(h, "load", F) | |
}; | |
xt(); | |
bt.add(h, "focus", H); | |
bt.add(h, "load", _); | |
bt.add(h, "load", F); | |
d.addEventListener ? d.addEventListener("DOMContentLoaded", j, !1) : d.attachEvent ? d.attachEvent("onreadystatechange", gt) : U({ | |
type: "NO_DOM2_EVENTS", | |
fatal: !0 | |
}) | |
} | |
var n = null; | |
if ("undefined" === typeof SM2_DEFER || !SM2_DEFER) n = new t; | |
e.SoundManager = t; | |
e.soundManager = n | |
})(window); | |
(function(e, t) { | |
function n(t, n) { | |
var i, s, o, u = t.nodeName.toLowerCase(); | |
return "area" === u ? (i = t.parentNode, s = i.name, !t.href || !s || i.nodeName.toLowerCase() !== "map" ? !1 : (o = e("img[usemap=#" + s + "]")[0], !! o && r(o))) : (/input|select|textarea|button|object/.test(u) ? !t.disabled : "a" === u ? t.href || n : n) && r(t) | |
} | |
function r(t) { | |
return e.expr.filters.visible(t) && !e(t).parents().andSelf().filter(function() { | |
return e.css(this, "visibility") === "hidden" | |
}).length | |
} | |
var i = 0, | |
s = /^ui-id-\d+$/; | |
e.ui = e.ui || {}; | |
if (e.ui.version) return; | |
e.extend(e.ui, { | |
version: "1.9.2", | |
keyCode: { | |
BACKSPACE: 8, | |
COMMA: 188, | |
DELETE: 46, | |
DOWN: 40, | |
END: 35, | |
ENTER: 13, | |
ESCAPE: 27, | |
HOME: 36, | |
LEFT: 37, | |
NUMPAD_ADD: 107, | |
NUMPAD_DECIMAL: 110, | |
NUMPAD_DIVIDE: 111, | |
NUMPAD_ENTER: 108, | |
NUMPAD_MULTIPLY: 106, | |
NUMPAD_SUBTRACT: 109, | |
PAGE_DOWN: 34, | |
PAGE_UP: 33, | |
PERIOD: 190, | |
RIGHT: 39, | |
SPACE: 32, | |
TAB: 9, | |
UP: 38 | |
} | |
}), e.fn.extend({ | |
_focus: e.fn.focus, | |
focus: function(t, n) { | |
return typeof t == "number" ? this.each(function() { | |
var r = this; | |
setTimeout(function() { | |
e(r).focus(), n && n.call(r) | |
}, t) | |
}) : this._focus.apply(this, arguments) | |
}, | |
scrollParent: function() { | |
var t; | |
return e.ui.ie && /(static|relative)/.test(this.css("position")) || /absolute/.test(this.css("position")) ? t = this.parents().filter(function() { | |
return /(relative|absolute|fixed)/.test(e.css(this, "position")) && /(auto|scroll)/.test(e.css(this, "overflow") + e.css(this, "overflow-y") + e.css(this, "overflow-x")) | |
}).eq(0) : t = this.parents().filter(function() { | |
return /(auto|scroll)/.test(e.css(this, "overflow") + e.css(this, "overflow-y") + e.css(this, "overflow-x")) | |
}).eq(0), /fixed/.test(this.css("position")) || !t.length ? e(document) : t | |
}, | |
zIndex: function(n) { | |
if (n !== t) return this.css("zIndex", n); | |
if (this.length) { | |
var r = e(this[0]), | |
i, s; | |
while (r.length && r[0] !== document) { | |
i = r.css("position"); | |
if (i === "absolute" || i === "relative" || i === "fixed") { | |
s = parseInt(r.css("zIndex"), 10); | |
if (!isNaN(s) && s !== 0) return s | |
} | |
r = r.parent() | |
} | |
} | |
return 0 | |
}, | |
uniqueId: function() { | |
return this.each(function() { | |
this.id || (this.id = "ui-id-" + ++i) | |
}) | |
}, | |
removeUniqueId: function() { | |
return this.each(function() { | |
s.test(this.id) && e(this).removeAttr("id") | |
}) | |
} | |
}), e.extend(e.expr[":"], { | |
data: e.expr.createPseudo ? e.expr.createPseudo(function(t) { | |
return function(n) { | |
return !!e.data(n, t) | |
} | |
}) : function(t, n, r) { | |
return !!e.data(t, r[3]) | |
}, | |
focusable: function(t) { | |
return n(t, !isNaN(e.attr(t, "tabindex"))) | |
}, | |
tabbable: function(t) { | |
var r = e.attr(t, "tabindex"), | |
i = isNaN(r); | |
return (i || r >= 0) && n(t, !i) | |
} | |
}), e(function() { | |
var t = document.body, | |
n = t.appendChild(n = document.createElement("div")); | |
n.offsetHeight, e.extend(n.style, { | |
minHeight: "100px", | |
height: "auto", | |
padding: 0, | |
borderWidth: 0 | |
}), e.support.minHeight = n.offsetHeight === 100, e.support.selectstart = "onselectstart" in n, t.removeChild(n).style.display = "none" | |
}), e("<a>").outerWidth(1).jquery || e.each(["Width", "Height"], function(n, r) { | |
function i(t, n, r, i) { | |
return e.each(s, function() { | |
n -= parseFloat(e.css(t, "padding" + this)) || 0, r && (n -= parseFloat(e.css(t, "border" + this + "Width")) || 0), i && (n -= parseFloat(e.css(t, "margin" + this)) || 0) | |
}), n | |
} | |
var s = r === "Width" ? ["Left", "Right"] : ["Top", "Bottom"], | |
o = r.toLowerCase(), | |
u = { | |
innerWidth: e.fn.innerWidth, | |
innerHeight: e.fn.innerHeight, | |
outerWidth: e.fn.outerWidth, | |
outerHeight: e.fn.outerHeight | |
}; | |
e.fn["inner" + r] = function(n) { | |
return n === t ? u["inner" + r].call(this) : this.each(function() { | |
e(this).css(o, i(this, n) + "px") | |
}) | |
}, e.fn["outer" + r] = function(t, n) { | |
return typeof t != "number" ? u["outer" + r].call(this, t) : this.each(function() { | |
e(this).css(o, i(this, t, !0, n) + "px") | |
}) | |
} | |
}), e("<a>").data("a-b", "a").removeData("a-b").data("a-b") && (e.fn.removeData = function(t) { | |
return function(n) { | |
return arguments.length ? t.call(this, e.camelCase(n)) : t.call(this) | |
} | |
}(e.fn.removeData)), function() { | |
var t = /msie ([\w.]+)/.exec(navigator.userAgent.toLowerCase()) || []; | |
e.ui.ie = t.length ? !0 : !1, e.ui.ie6 = parseFloat(t[1], 10) === 6 | |
}(), e.fn.extend({ | |
disableSelection: function() { | |
return this.bind((e.support.selectstart ? "selectstart" : "mousedown") + ".ui-disableSelection", function(e) { | |
e.preventDefault() | |
}) | |
}, | |
enableSelection: function() { | |
return this.unbind(".ui-disableSelection") | |
} | |
}), e.extend(e.ui, { | |
plugin: { | |
add: function(t, n, r) { | |
var i, s = e.ui[t].prototype; | |
for (i in r) s.plugins[i] = s.plugins[i] || [], s.plugins[i].push([n, r[i]]) | |
}, | |
call: function(e, t, n) { | |
var r, i = e.plugins[t]; | |
if (!i || !e.element[0].parentNode || e.element[0].parentNode.nodeType === 11) return; | |
for (r = 0; r < i.length; r++) e.options[i[r][0]] && i[r][1].apply(e.element, n) | |
} | |
}, | |
contains: e.contains, | |
hasScroll: function(t, n) { | |
if (e(t).css("overflow") === "hidden") return !1; | |
var r = n && n === "left" ? "scrollLeft" : "scrollTop", | |
i = !1; | |
return t[r] > 0 ? !0 : (t[r] = 1, i = t[r] > 0, t[r] = 0, i) | |
}, | |
isOverAxis: function(e, t, n) { | |
return e > t && e < t + n | |
}, | |
isOver: function(t, n, r, i, s, o) { | |
return e.ui.isOverAxis(t, r, s) && e.ui.isOverAxis(n, i, o) | |
} | |
}) | |
})(jQuery); | |
(function(e, t) { | |
var n = 0, | |
r = Array.prototype.slice, | |
i = e.cleanData; | |
e.cleanData = function(t) { | |
for (var n = 0, r; | |
(r = t[n]) != null; n++) try { | |
e(r).triggerHandler("remove") | |
} catch (s) {} | |
i(t) | |
}, e.widget = function(t, n, r) { | |
var i, s, o, u, a = t.split(".")[0]; | |
t = t.split(".")[1], i = a + "-" + t, r || (r = n, n = e.Widget), e.expr[":"][i.toLowerCase()] = function(t) { | |
return !!e.data(t, i) | |
}, e[a] = e[a] || {}, s = e[a][t], o = e[a][t] = function(e, t) { | |
if (!this._createWidget) return new o(e, t); | |
arguments.length && this._createWidget(e, t) | |
}, e.extend(o, s, { | |
version: r.version, | |
_proto: e.extend({}, r), | |
_childConstructors: [] | |
}), u = new n, u.options = e.widget.extend({}, u.options), e.each(r, function(t, i) { | |
e.isFunction(i) && (r[t] = function() { | |
var e = function() { | |
return n.prototype[t].apply(this, arguments) | |
}, | |
r = function(e) { | |
return n.prototype[t].apply(this, e) | |
}; | |
return function() { | |
var t = this._super, | |
n = this._superApply, | |
s; | |
return this._super = e, this._superApply = r, s = i.apply(this, arguments), this._super = t, this._superApply = n, s | |
} | |
}()) | |
}), o.prototype = e.widget.extend(u, { | |
widgetEventPrefix: s ? u.widgetEventPrefix : t | |
}, r, { | |
constructor: o, | |
namespace: a, | |
widgetName: t, | |
widgetBaseClass: i, | |
widgetFullName: i | |
}), s ? (e.each(s._childConstructors, function(t, n) { | |
var r = n.prototype; | |
e.widget(r.namespace + "." + r.widgetName, o, n._proto) | |
}), delete s._childConstructors) : n._childConstructors.push(o), e.widget.bridge(t, o) | |
}, e.widget.extend = function(n) { | |
var i = r.call(arguments, 1), | |
s = 0, | |
o = i.length, | |
u, a; | |
for (; s < o; s++) for (u in i[s]) a = i[s][u], i[s].hasOwnProperty(u) && a !== t && (e.isPlainObject(a) ? n[u] = e.isPlainObject(n[u]) ? e.widget.extend({}, n[u], a) : e.widget.extend({}, a) : n[u] = a); | |
return n | |
}, e.widget.bridge = function(n, i) { | |
var s = i.prototype.widgetFullName || n; | |
e.fn[n] = function(o) { | |
var u = typeof o == "string", | |
a = r.call(arguments, 1), | |
f = this; | |
return o = !u && a.length ? e.widget.extend.apply(null, [o].concat(a)) : o, u ? this.each(function() { | |
var r, i = e.data(this, s); | |
if (!i) return e.error("cannot call methods on " + n + " prior to initialization; " + "attempted to call method '" + o + "'"); | |
if (!e.isFunction(i[o]) || o.charAt(0) === "_") return e.error("no such method '" + o + "' for " + n + " widget instance"); | |
r = i[o].apply(i, a); | |
if (r !== i && r !== t) return f = r && r.jquery ? f.pushStack(r.get()) : r, !1 | |
}) : this.each(function() { | |
var t = e.data(this, s); | |
t ? t.option(o || {})._init() : e.data(this, s, new i(o, this)) | |
}), f | |
} | |
}, e.Widget = function() {}, e.Widget._childConstructors = [], e.Widget.prototype = { | |
widgetName: "widget", | |
widgetEventPrefix: "", | |
defaultElement: "<div>", | |
options: { | |
disabled: !1, | |
create: null | |
}, | |
_createWidget: function(t, r) { | |
r = e(r || this.defaultElement || this)[0], this.element = e(r), this.uuid = n++, this.eventNamespace = "." + this.widgetName + this.uuid, this.options = e.widget.extend({}, this.options, this._getCreateOptions(), t), this.bindings = e(), this.hoverable = e(), this.focusable = e(), r !== this && (e.data(r, this.widgetName, this), e.data(r, this.widgetFullName, this), this._on(!0, this.element, { | |
remove: function(e) { | |
e.target === r && this.destroy() | |
} | |
}), this.document = e(r.style ? r.ownerDocument : r.document || r), this.window = e(this.document[0].defaultView || this.document[0].parentWindow)), this._create(), this._trigger("create", null, this._getCreateEventData()), this._init() | |
}, | |
_getCreateOptions: e.noop, | |
_getCreateEventData: e.noop, | |
_create: e.noop, | |
_init: e.noop, | |
destroy: function() { | |
this._destroy(), this.element.unbind(this.eventNamespace).removeData(this.widgetName).removeData(this.widgetFullName).removeData(e.camelCase(this.widgetFullName)), this.widget().unbind(this.eventNamespace).removeAttr("aria-disabled").removeClass(this.widgetFullName + "-disabled " + "ui-state-disabled"), this.bindings.unbind(this.eventNamespace), this.hoverable.removeClass("ui-state-hover"), this.focusable.removeClass("ui-state-focus") | |
}, | |
_destroy: e.noop, | |
widget: function() { | |
return this.element | |
}, | |
option: function(n, r) { | |
var i = n, | |
s, o, u; | |
if (arguments.length === 0) return e.widget.extend({}, this.options); | |
if (typeof n == "string") { | |
i = {}, s = n.split("."), n = s.shift(); | |
if (s.length) { | |
o = i[n] = e.widget.extend({}, this.options[n]); | |
for (u = 0; u < s.length - 1; u++) o[s[u]] = o[s[u]] || {}, o = o[s[u]]; | |
n = s.pop(); | |
if (r === t) return o[n] === t ? null : o[n]; | |
o[n] = r | |
} else { | |
if (r === t) return this.options[n] === t ? null : this.options[n]; | |
i[n] = r | |
} | |
} | |
return this._setOptions(i), this | |
}, | |
_setOptions: function(e) { | |
var t; | |
for (t in e) this._setOption(t, e[t]); | |
return this | |
}, | |
_setOption: function(e, t) { | |
return this.options[e] = t, e === "disabled" && (this.widget().toggleClass(this.widgetFullName + "-disabled ui-state-disabled", !! t).attr("aria-disabled", t), this.hoverable.removeClass("ui-state-hover"), this.focusable.removeClass("ui-state-focus")), this | |
}, | |
enable: function() { | |
return this._setOption("disabled", !1) | |
}, | |
disable: function() { | |
return this._setOption("disabled", !0) | |
}, | |
_on: function(t, n, r) { | |
var i, s = this; | |
typeof t != "boolean" && (r = n, n = t, t = !1), r ? (n = i = e(n), this.bindings = this.bindings.add(n)) : (r = n, n = this.element, i = this.widget()), e.each(r, function(r, o) { | |
function u() { | |
if (!t && (s.options.disabled === !0 || e(this).hasClass("ui-state-disabled"))) return; | |
return (typeof o == "string" ? s[o] : o).apply(s, arguments) | |
} | |
typeof o != "string" && (u.guid = o.guid = o.guid || u.guid || e.guid++); | |
var a = r.match(/^(\w+)\s*(.*)$/), | |
f = a[1] + s.eventNamespace, | |
l = a[2]; | |
l ? i.delegate(l, f, u) : n.bind(f, u) | |
}) | |
}, | |
_off: function(e, t) { | |
t = (t || "").split(" ").join(this.eventNamespace + " ") + this.eventNamespace, e.unbind(t).undelegate(t) | |
}, | |
_delay: function(e, t) { | |
function n() { | |
return (typeof e == "string" ? r[e] : e).apply(r, arguments) | |
} | |
var r = this; | |
return setTimeout(n, t || 0) | |
}, | |
_hoverable: function(t) { | |
this.hoverable = this.hoverable.add(t), this._on(t, { | |
mouseenter: function(t) { | |
e(t.currentTarget).addClass("ui-state-hover") | |
}, | |
mouseleave: function(t) { | |
e(t.currentTarget).removeClass("ui-state-hover") | |
} | |
}) | |
}, | |
_focusable: function(t) { | |
this.focusable = this.focusable.add(t), this._on(t, { | |
focusin: function(t) { | |
e(t.currentTarget).addClass("ui-state-focus") | |
}, | |
focusout: function(t) { | |
e(t.currentTarget).removeClass("ui-state-focus") | |
} | |
}) | |
}, | |
_trigger: function(t, n, r) { | |
var i, s, o = this.options[t]; | |
r = r || {}, n = e.Event(n), n.type = (t === this.widgetEventPrefix ? t : this.widgetEventPrefix + t).toLowerCase(), n.target = this.element[0], s = n.originalEvent; | |
if (s) for (i in s) i in n || (n[i] = s[i]); | |
return this.element.trigger(n, r), !(e.isFunction(o) && o.apply(this.element[0], [n].concat(r)) === !1 || n.isDefaultPrevented()) | |
} | |
}, e.each({ | |
show: "fadeIn", | |
hide: "fadeOut" | |
}, function(t, n) { | |
e.Widget.prototype["_" + t] = function(r, i, s) { | |
typeof i == "string" && (i = { | |
effect: i | |
}); | |
var o, u = i ? i === !0 || typeof i == "number" ? n : i.effect || n : t; | |
i = i || {}, typeof i == "number" && (i = { | |
duration: i | |
}), o = !e.isEmptyObject(i), i.complete = s, i.delay && r.delay(i.delay), o && e.effects && (e.effects.effect[u] || e.uiBackCompat !== !1 && e.effects[u]) ? r[t](i) : u !== t && r[u] ? r[u](i.duration, i.easing, s) : r.queue(function(n) { | |
e(this)[t](), s && s.call(r[0]), n() | |
}) | |
} | |
}), e.uiBackCompat !== !1 && (e.Widget.prototype._getCreateOptions = function() { | |
return e.metadata && e.metadata.get(this.element[0])[this.widgetName] | |
}) | |
})(jQuery); | |
(function(e, t) { | |
var n = !1; | |
e(document).mouseup(function(e) { | |
n = !1 | |
}), e.widget("ui.mouse", { | |
version: "1.9.2", | |
options: { | |
cancel: "input,textarea,button,select,option", | |
distance: 1, | |
delay: 0 | |
}, | |
_mouseInit: function() { | |
var t = this; | |
this.element.bind("mousedown." + this.widgetName, function(e) { | |
return t._mouseDown(e) | |
}).bind("click." + this.widgetName, function(n) { | |
if (!0 === e.data(n.target, t.widgetName + ".preventClickEvent")) return e.removeData(n.target, t.widgetName + ".preventClickEvent"), n.stopImmediatePropagation(), !1 | |
}), this.started = !1 | |
}, | |
_mouseDestroy: function() { | |
this.element.unbind("." + this.widgetName), this._mouseMoveDelegate && e(document).unbind("mousemove." + this.widgetName, this._mouseMoveDelegate).unbind("mouseup." + this.widgetName, this._mouseUpDelegate) | |
}, | |
_mouseDown: function(t) { | |
if (n) return; | |
this._mouseStarted && this._mouseUp(t), this._mouseDownEvent = t; | |
var r = this, | |
i = t.which === 1, | |
s = typeof this.options.cancel == "string" && t.target.nodeName ? e(t.target).closest(this.options.cancel).length : !1; | |
if (!i || s || !this._mouseCapture(t)) return !0; | |
this.mouseDelayMet = !this.options.delay, this.mouseDelayMet || (this._mouseDelayTimer = setTimeout(function() { | |
r.mouseDelayMet = !0 | |
}, this.options.delay)); | |
if (this._mouseDistanceMet(t) && this._mouseDelayMet(t)) { | |
this._mouseStarted = this._mouseStart(t) !== !1; | |
if (!this._mouseStarted) return t.preventDefault(), !0 | |
} | |
return !0 === e.data(t.target, this.widgetName + ".preventClickEvent") && e.removeData(t.target, this.widgetName + ".preventClickEvent"), this._mouseMoveDelegate = function(e) { | |
return r._mouseMove(e) | |
}, this._mouseUpDelegate = function(e) { | |
return r._mouseUp(e) | |
}, e(document).bind("mousemove." + this.widgetName, this._mouseMoveDelegate).bind("mouseup." + this.widgetName, this._mouseUpDelegate), t.preventDefault(), n = !0, !0 | |
}, | |
_mouseMove: function(t) { | |
return !e.ui.ie || document.documentMode >= 9 || !! t.button ? this._mouseStarted ? (this._mouseDrag(t), t.preventDefault()) : (this._mouseDistanceMet(t) && this._mouseDelayMet(t) && (this._mouseStarted = this._mouseStart(this._mouseDownEvent, t) !== !1, this._mouseStarted ? this._mouseDrag(t) : this._mouseUp(t)), !this._mouseStarted) : this._mouseUp(t) | |
}, | |
_mouseUp: function(t) { | |
return e(document).unbind("mousemove." + this.widgetName, this._mouseMoveDelegate).unbind("mouseup." + this.widgetName, this._mouseUpDelegate), this._mouseStarted && (this._mouseStarted = !1, t.target === this._mouseDownEvent.target && e.data(t.target, this.widgetName + ".preventClickEvent", !0), this._mouseStop(t)), !1 | |
}, | |
_mouseDistanceMet: function(e) { | |
return Math.max(Math.abs(this._mouseDownEvent.pageX - e.pageX), Math.abs(this._mouseDownEvent.pageY - e.pageY)) >= this.options.distance | |
}, | |
_mouseDelayMet: function(e) { | |
return this.mouseDelayMet | |
}, | |
_mouseStart: function(e) {}, | |
_mouseDrag: function(e) {}, | |
_mouseStop: function(e) {}, | |
_mouseCapture: function(e) { | |
return !0 | |
} | |
}) | |
})(jQuery); | |
(function(e, t) { | |
var n = 5; | |
e.widget("ui.slider", e.ui.mouse, { | |
version: "1.9.2", | |
widgetEventPrefix: "slide", | |
options: { | |
animate: !1, | |
distance: 0, | |
max: 100, | |
min: 0, | |
orientation: "horizontal", | |
range: !1, | |
step: 1, | |
value: 0, | |
values: null | |
}, | |
_create: function() { | |
var t, r, i = this.options, | |
s = this.element.find(".ui-slider-handle").addClass("ui-state-default ui-corner-all"), | |
o = "<a class='ui-slider-handle ui-state-default ui-corner-all' href='#'></a>", | |
u = []; | |
this._keySliding = !1, this._mouseSliding = !1, this._animateOff = !0, this._handleIndex = null, this._detectOrientation(), this._mouseInit(), this.element.addClass("ui-slider ui-slider-" + this.orientation + " ui-widget" + " ui-widget-content" + " ui-corner-all" + (i.disabled ? " ui-slider-disabled ui-disabled" : "")), this.range = e([]), i.range && (i.range === !0 && (i.values || (i.values = [this._valueMin(), this._valueMin()]), i.values.length && i.values.length !== 2 && (i.values = [i.values[0], i.values[0]])), this.range = e("<div></div>").appendTo(this.element).addClass("ui-slider-range ui-widget-header" + (i.range === "min" || i.range === "max" ? " ui-slider-range-" + i.range : ""))), r = i.values && i.values.length || 1; | |
for (t = s.length; t < r; t++) u.push(o); | |
this.handles = s.add(e(u.join("")).appendTo(this.element)), this.handle = this.handles.eq(0), this.handles.add(this.range).filter("a").click(function(e) { | |
e.preventDefault() | |
}).mouseenter(function() { | |
i.disabled || e(this).addClass("ui-state-hover") | |
}).mouseleave(function() { | |
e(this).removeClass("ui-state-hover") | |
}).focus(function() { | |
i.disabled ? e(this).blur() : (e(".ui-slider .ui-state-focus").removeClass("ui-state-focus"), e(this).addClass("ui-state-focus")) | |
}).blur(function() { | |
e(this).removeClass("ui-state-focus") | |
}), this.handles.each(function(t) { | |
e(this).data("ui-slider-handle-index", t) | |
}), this._on(this.handles, { | |
keydown: function(t) { | |
var r, i, s, o, u = e(t.target).data("ui-slider-handle-index"); | |
switch (t.keyCode) { | |
case e.ui.keyCode.HOME: | |
case e.ui.keyCode.END: | |
case e.ui.keyCode.PAGE_UP: | |
case e.ui.keyCode.PAGE_DOWN: | |
case e.ui.keyCode.UP: | |
case e.ui.keyCode.RIGHT: | |
case e.ui.keyCode.DOWN: | |
case e.ui.keyCode.LEFT: | |
t.preventDefault(); | |
if (!this._keySliding) { | |
this._keySliding = !0, e(t.target).addClass("ui-state-active"), r = this._start(t, u); | |
if (r === !1) return | |
} | |
} | |
o = this.options.step, this.options.values && this.options.values.length ? i = s = this.values(u) : i = s = this.value(); | |
switch (t.keyCode) { | |
case e.ui.keyCode.HOME: | |
s = this._valueMin(); | |
break; | |
case e.ui.keyCode.END: | |
s = this._valueMax(); | |
break; | |
case e.ui.keyCode.PAGE_UP: | |
s = this._trimAlignValue(i + (this._valueMax() - this._valueMin()) / n); | |
break; | |
case e.ui.keyCode.PAGE_DOWN: | |
s = this._trimAlignValue(i - (this._valueMax() - this._valueMin()) / n); | |
break; | |
case e.ui.keyCode.UP: | |
case e.ui.keyCode.RIGHT: | |
if (i === this._valueMax()) return; | |
s = this._trimAlignValue(i + o); | |
break; | |
case e.ui.keyCode.DOWN: | |
case e.ui.keyCode.LEFT: | |
if (i === this._valueMin()) return; | |
s = this._trimAlignValue(i - o) | |
} | |
this._slide(t, u, s) | |
}, | |
keyup: function(t) { | |
var n = e(t.target).data("ui-slider-handle-index"); | |
this._keySliding && (this._keySliding = !1, this._stop(t, n), this._change(t, n), e(t.target).removeClass("ui-state-active")) | |
} | |
}), this._refreshValue(), this._animateOff = !1 | |
}, | |
_destroy: function() { | |
this.handles.remove(), this.range.remove(), this.element.removeClass("ui-slider ui-slider-horizontal ui-slider-vertical ui-slider-disabled ui-widget ui-widget-content ui-corner-all"), this._mouseDestroy() | |
}, | |
_mouseCapture: function(t) { | |
var n, r, i, s, o, u, a, f, l = this, | |
c = this.options; | |
return c.disabled ? !1 : (this.elementSize = { | |
width: this.element.outerWidth(), | |
height: this.element.outerHeight() | |
}, this.elementOffset = this.element.offset(), n = { | |
x: t.pageX, | |
y: t.pageY | |
}, r = this._normValueFromMouse(n), i = this._valueMax() - this._valueMin() + 1, this.handles.each(function(t) { | |
var n = Math.abs(r - l.values(t)); | |
i > n && (i = n, s = e(this), o = t) | |
}), c.range === !0 && this.values(1) === c.min && (o += 1, s = e(this.handles[o])), u = this._start(t, o), u === !1 ? !1 : (this._mouseSliding = !0, this._handleIndex = o, s.addClass("ui-state-active").focus(), a = s.offset(), f = !e(t.target).parents().andSelf().is(".ui-slider-handle"), this._clickOffset = f ? { | |
left: 0, | |
top: 0 | |
} : { | |
left: t.pageX - a.left - s.width() / 2, | |
top: t.pageY - a.top - s.height() / 2 - (parseInt(s.css("borderTopWidth"), 10) || 0) - (parseInt(s.css("borderBottomWidth"), 10) || 0) + (parseInt(s.css("marginTop"), 10) || 0) | |
}, this.handles.hasClass("ui-state-hover") || this._slide(t, o, r), this._animateOff = !0, !0)) | |
}, | |
_mouseStart: function() { | |
return !0 | |
}, | |
_mouseDrag: function(e) { | |
var t = { | |
x: e.pageX, | |
y: e.pageY | |
}, | |
n = this._normValueFromMouse(t); | |
return this._slide(e, this._handleIndex, n), !1 | |
}, | |
_mouseStop: function(e) { | |
return this.handles.removeClass("ui-state-active"), this._mouseSliding = !1, this._stop(e, this._handleIndex), this._change(e, this._handleIndex), this._handleIndex = null, this._clickOffset = null, this._animateOff = !1, !1 | |
}, | |
_detectOrientation: function() { | |
this.orientation = this.options.orientation === "vertical" ? "vertical" : "horizontal" | |
}, | |
_normValueFromMouse: function(e) { | |
var t, n, r, i, s; | |
return this.orientation === "horizontal" ? (t = this.elementSize.width, n = e.x - this.elementOffset.left - (this._clickOffset ? this._clickOffset.left : 0)) : (t = this.elementSize.height, n = e.y - this.elementOffset.top - (this._clickOffset ? this._clickOffset.top : 0)), r = n / t, r > 1 && (r = 1), r < 0 && (r = 0), this.orientation === "vertical" && (r = 1 - r), i = this._valueMax() - this._valueMin(), s = this._valueMin() + r * i, this._trimAlignValue(s) | |
}, | |
_start: function(e, t) { | |
var n = { | |
handle: this.handles[t], | |
value: this.value() | |
}; | |
return this.options.values && this.options.values.length && (n.value = this.values(t), n.values = this.values()), this._trigger("start", e, n) | |
}, | |
_slide: function(e, t, n) { | |
var r, i, s; | |
this.options.values && this.options.values.length ? (r = this.values(t ? 0 : 1), this.options.values.length === 2 && this.options.range === !0 && (t === 0 && n > r || t === 1 && n < r) && (n = r), n !== this.values(t) && (i = this.values(), i[t] = n, s = this._trigger("slide", e, { | |
handle: this.handles[t], | |
value: n, | |
values: i | |
}), r = this.values(t ? 0 : 1), s !== !1 && this.values(t, n, !0))) : n !== this.value() && (s = this._trigger("slide", e, { | |
handle: this.handles[t], | |
value: n | |
}), s !== !1 && this.value(n)) | |
}, | |
_stop: function(e, t) { | |
var n = { | |
handle: this.handles[t], | |
value: this.value() | |
}; | |
this.options.values && this.options.values.length && (n.value = this.values(t), n.values = this.values()), this._trigger("stop", e, n) | |
}, | |
_change: function(e, t) { | |
if (!this._keySliding && !this._mouseSliding) { | |
var n = { | |
handle: this.handles[t], | |
value: this.value() | |
}; | |
this.options.values && this.options.values.length && (n.value = this.values(t), n.values = this.values()), this._trigger("change", e, n) | |
} | |
}, | |
value: function(e) { | |
if (arguments.length) { | |
this.options.value = this._trimAlignValue(e), this._refreshValue(), this._change(null, 0); | |
return | |
} | |
return this._value() | |
}, | |
values: function(t, n) { | |
var r, i, s; | |
if (arguments.length > 1) { | |
this.options.values[t] = this._trimAlignValue(n), this._refreshValue(), this._change(null, t); | |
return | |
} | |
if (!arguments.length) return this._values(); | |
if (!e.isArray(arguments[0])) return this.options.values && this.options.values.length ? this._values(t) : this.value(); | |
r = this.options.values, i = arguments[0]; | |
for (s = 0; s < r.length; s += 1) r[s] = this._trimAlignValue(i[s]), this._change(null, s); | |
this._refreshValue() | |
}, | |
_setOption: function(t, n) { | |
var r, i = 0; | |
e.isArray(this.options.values) && (i = this.options.values.length), e.Widget.prototype._setOption.apply(this, arguments); | |
switch (t) { | |
case "disabled": | |
n ? (this.handles.filter(".ui-state-focus").blur(), this.handles.removeClass("ui-state-hover"), this.handles.prop("disabled", !0), this.element.addClass("ui-disabled")) : (this.handles.prop("disabled", !1), this.element.removeClass("ui-disabled")); | |
break; | |
case "orientation": | |
this._detectOrientation(), this.element.removeClass("ui-slider-horizontal ui-slider-vertical").addClass("ui-slider-" + this.orientation), this._refreshValue(); | |
break; | |
case "value": | |
this._animateOff = !0, this._refreshValue(), this._change(null, 0), this._animateOff = !1; | |
break; | |
case "values": | |
this._animateOff = !0, this._refreshValue(); | |
for (r = 0; r < i; r += 1) this._change(null, r); | |
this._animateOff = !1; | |
break; | |
case "min": | |
case "max": | |
this._animateOff = !0, this._refreshValue(), this._animateOff = !1 | |
} | |
}, | |
_value: function() { | |
var e = this.options.value; | |
return e = this._trimAlignValue(e), e | |
}, | |
_values: function(e) { | |
var t, n, r; | |
if (arguments.length) return t = this.options.values[e], t = this._trimAlignValue(t), t; | |
n = this.options.values.slice(); | |
for (r = 0; r < n.length; r += 1) n[r] = this._trimAlignValue(n[r]); | |
return n | |
}, | |
_trimAlignValue: function(e) { | |
if (e <= this._valueMin()) return this._valueMin(); | |
if (e >= this._valueMax()) return this._valueMax(); | |
var t = this.options.step > 0 ? this.options.step : 1, | |
n = (e - this._valueMin()) % t, | |
r = e - n; | |
return Math.abs(n) * 2 >= t && (r += n > 0 ? t : -t), parseFloat(r.toFixed(5)) | |
}, | |
_valueMin: function() { | |
return this.options.min | |
}, | |
_valueMax: function() { | |
return this.options.max | |
}, | |
_refreshValue: function() { | |
var t, n, r, i, s, o = this.options.range, | |
u = this.options, | |
a = this, | |
f = this._animateOff ? !1 : u.animate, | |
l = {}; | |
this.options.values && this.options.values.length ? this.handles.each(function(r) { | |
n = (a.values(r) - a._valueMin()) / (a._valueMax() - a._valueMin()) * 100, l[a.orientation === "horizontal" ? "left" : "bottom"] = n + "%", e(this).stop(1, 1)[f ? "animate" : "css"](l, u.animate), a.options.range === !0 && (a.orientation === "horizontal" ? (r === 0 && a.range.stop(1, 1)[f ? "animate" : "css"]({ | |
left: n + "%" | |
}, u.animate), r === 1 && a.range[f ? "animate" : "css"]({ | |
width: n - t + "%" | |
}, { | |
queue: !1, | |
duration: u.animate | |
})) : (r === 0 && a.range.stop(1, 1)[f ? "animate" : "css"]({ | |
bottom: n + "%" | |
}, u.animate), r === 1 && a.range[f ? "animate" : "css"]({ | |
height: n - t + "%" | |
}, { | |
queue: !1, | |
duration: u.animate | |
}))), t = n | |
}) : (r = this.value(), i = this._valueMin(), s = this._valueMax(), n = s !== i ? (r - i) / (s - i) * 100 : 0, l[this.orientation === "horizontal" ? "left" : "bottom"] = n + "%", this.handle.stop(1, 1)[f ? "animate" : "css"](l, u.animate), o === "min" && this.orientation === "horizontal" && this.range.stop(1, 1)[f ? "animate" : "css"]({ | |
width: n + "%" | |
}, u.animate), o === "max" && this.orientation === "horizontal" && this.range[f ? "animate" : "css"]({ | |
width: 100 - n + "%" | |
}, { | |
queue: !1, | |
duration: u.animate | |
}), o === "min" && this.orientation === "vertical" && this.range.stop(1, 1)[f ? "animate" : "css"]({ | |
height: n + "%" | |
}, u.animate), o === "max" && this.orientation === "vertical" && this.range[f ? "animate" : "css"]({ | |
height: 100 - n + "%" | |
}, { | |
queue: !1, | |
duration: u.animate | |
})) | |
} | |
}) | |
})(jQuery); | |
window.JSON || (window.JSON = {}), function() { | |
function f(e) { | |
return e < 10 ? "0" + e : e | |
} | |
function quote(e) { | |
return escapable.lastIndex = 0, escapable.test(e) ? '"' + e.replace(escapable, function(e) { | |
var t = meta[e]; | |
return typeof t == "string" ? t : "\\u" + ("0000" + e.charCodeAt(0).toString(16)).slice(-4) | |
}) + '"' : '"' + e + '"' | |
} | |
function str(e, t) { | |
var n, r, i, s, o = gap, | |
u, a = t[e]; | |
a && typeof a == "object" && typeof a.toJSON == "function" && (a = a.toJSON(e)), typeof rep == "function" && (a = rep.call(t, e, a)); | |
switch (typeof a) { | |
case "string": | |
return quote(a); | |
case "number": | |
return isFinite(a) ? String(a) : "null"; | |
case "boolean": | |
case "null": | |
return String(a); | |
case "object": | |
if (!a) return "null"; | |
gap += indent, u = []; | |
if (Object.prototype.toString.apply(a) === "[object Array]") { | |
s = a.length; | |
for (n = 0; n < s; n += 1) u[n] = str(n, a) || "null"; | |
return i = u.length === 0 ? "[]" : gap ? "[\n" + gap + u.join(",\n" + gap) + "\n" + o + "]" : "[" + u.join(",") + "]", gap = o, i | |
} | |
if (rep && typeof rep == "object") { | |
s = rep.length; | |
for (n = 0; n < s; n += 1) r = rep[n], typeof r == "string" && (i = str(r, a), i && u.push(quote(r) + (gap ? ": " : ":") + i)) | |
} else for (r in a) Object.hasOwnProperty.call(a, r) && (i = str(r, a), i && u.push(quote(r) + (gap ? ": " : ":") + i)); | |
return i = u.length === 0 ? "{}" : gap ? "{\n" + gap + u.join(",\n" + gap) + "\n" + o + "}" : "{" + u.join(",") + "}", gap = o, i | |
} | |
} | |
"use strict", typeof Date.prototype.toJSON != "function" && (Date.prototype.toJSON = function(e) { | |
return isFinite(this.valueOf()) ? this.getUTCFullYear() + "-" + f(this.getUTCMonth() + 1) + "-" + f(this.getUTCDate()) + "T" + f(this.getUTCHours()) + ":" + f(this.getUTCMinutes()) + ":" + f(this.getUTCSeconds()) + "Z" : null | |
}, String.prototype.toJSON = Number.prototype.toJSON = Boolean.prototype.toJSON = function(e) { | |
return this.valueOf() | |
}); | |
var JSON = window.JSON, | |
cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, | |
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, | |
gap, indent, meta = { | |
"\b": "\\b", | |
" ": "\\t", | |
"\n": "\\n", | |
"\f": "\\f", | |
"\r": "\\r", | |
'"': '\\"', | |
"\\": "\\\\" | |
}, | |
rep; | |
typeof JSON.stringify != "function" && (JSON.stringify = function(e, t, n) { | |
var r; | |
gap = "", indent = ""; | |
if (typeof n == "number") for (r = 0; r < n; r += 1) indent += " "; | |
else typeof n == "string" && (indent = n); | |
rep = t; | |
if (!t || typeof t == "function" || typeof t == "object" && typeof t.length == "number") return str("", { | |
"": e | |
}); | |
throw new Error("JSON.stringify") | |
}), typeof JSON.parse != "function" && (JSON.parse = function(text, reviver) { | |
function walk(e, t) { | |
var n, r, i = e[t]; | |
if (i && typeof i == "object") for (n in i) Object.hasOwnProperty.call(i, n) && (r = walk(i, n), r !== undefined ? i[n] = r : delete i[n]); | |
return reviver.call(e, t, i) | |
} | |
var j; | |
text = String(text), cx.lastIndex = 0, cx.test(text) && (text = text.replace(cx, function(e) { | |
return "\\u" + ("0000" + e.charCodeAt(0).toString(16)).slice(-4) | |
})); | |
if (/^[\],:{}\s]*$/.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, "@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, "]").replace(/(?:^|:|,)(?:\s*\[)+/g, ""))) return j = eval("(" + text + ")"), typeof reviver == "function" ? walk({ | |
"": j | |
}, "") : j; | |
throw new SyntaxError("JSON.parse") | |
}) | |
}(), function(e, t) { | |
"use strict"; | |
var n = e.History = e.History || {}, | |
r = e.jQuery; | |
if (typeof n.Adapter != "undefined") throw new Error("History.js Adapter has already been loaded..."); | |
n.Adapter = { | |
bind: function(e, t, n) { | |
r(e).bind(t, n) | |
}, | |
trigger: function(e, t, n) { | |
r(e).trigger(t, n) | |
}, | |
extractEventData: function(e, n, r) { | |
var i = n && n.originalEvent && n.originalEvent[e] || r && r[e] || t; | |
return i | |
}, | |
onDomLoad: function(e) { | |
r(e) | |
} | |
}, typeof n.init != "undefined" && n.init() | |
}(window), function(e, t) { | |
"use strict"; | |
var n = e.document, | |
r = e.setTimeout || r, | |
i = e.clearTimeout || i, | |
s = e.setInterval || s, | |
o = e.History = e.History || {}; | |
if (typeof o.initHtml4 != "undefined") throw new Error("History.js HTML4 Support has already been loaded..."); | |
o.initHtml4 = function() { | |
if (typeof o.initHtml4.initialized != "undefined") return !1; | |
o.initHtml4.initialized = !0, o.enabled = !0, o.savedHashes = [], o.isLastHash = function(e) { | |
var t = o.getHashByIndex(), | |
n; | |
return n = e === t, n | |
}, o.saveHash = function(e) { | |
return o.isLastHash(e) ? !1 : (o.savedHashes.push(e), !0) | |
}, o.getHashByIndex = function(e) { | |
var t = null; | |
return typeof e == "undefined" ? t = o.savedHashes[o.savedHashes.length - 1] : e < 0 ? t = o.savedHashes[o.savedHashes.length + e] : t = o.savedHashes[e], t | |
}, o.discardedHashes = {}, o.discardedStates = {}, o.discardState = function(e, t, n) { | |
var r = o.getHashByState(e), | |
i; | |
return i = { | |
discardedState: e, | |
backState: n, | |
forwardState: t | |
}, o.discardedStates[r] = i, !0 | |
}, o.discardHash = function(e, t, n) { | |
var r = { | |
discardedHash: e, | |
backState: n, | |
forwardState: t | |
}; | |
return o.discardedHashes[e] = r, !0 | |
}, o.discardedState = function(e) { | |
var t = o.getHashByState(e), | |
n; | |
return n = o.discardedStates[t] || !1, n | |
}, o.discardedHash = function(e) { | |
var t = o.discardedHashes[e] || !1; | |
return t | |
}, o.recycleState = function(e) { | |
var t = o.getHashByState(e); | |
return o.discardedState(e) && delete o.discardedStates[t], !0 | |
}, o.emulated.hashChange && (o.hashChangeInit = function() { | |
o.checkerFunction = null; | |
var t = "", | |
r, i, u, a; | |
return o.isInternetExplorer() ? (r = "historyjs-iframe", i = n.createElement("iframe"), i.setAttribute("id", r), i.style.display = "none", n.body.appendChild(i), i.contentWindow.document.open(), i.contentWindow.document.close(), u = "", a = !1, o.checkerFunction = function() { | |
if (a) return !1; | |
a = !0; | |
var n = o.getHash() || "", | |
r = o.unescapeHash(i.contentWindow.document.location.hash) || ""; | |
return n !== t ? (t = n, r !== n && (u = r = n, i.contentWindow.document.open(), i.contentWindow.document.close(), i.contentWindow.document.location.hash = o.escapeHash(n)), o.Adapter.trigger(e, "hashchange")) : r !== u && (u = r, o.setHash(r, !1)), a = !1, !0 | |
}) : o.checkerFunction = function() { | |
var n = o.getHash(); | |
return n !== t && (t = n, o.Adapter.trigger(e, "hashchange")), !0 | |
}, o.intervalList.push(s(o.checkerFunction, o.options.hashChangeInterval)), !0 | |
}, o.Adapter.onDomLoad(o.hashChangeInit)), o.emulated.pushState && (o.onHashChange = function(t) { | |
var r = t && t.newURL || n.location.href, | |
i = o.getHashByUrl(r), | |
s = null, | |
u = null, | |
a = null, | |
f; | |
return o.isLastHash(i) ? (o.busy(!1), !1) : (o.doubleCheckComplete(), o.saveHash(i), i && o.isTraditionalAnchor(i) ? (o.Adapter.trigger(e, "anchorchange"), o.busy(!1), !1) : (s = o.extractState(o.getFullUrl(i || n.location.href, !1), !0), o.isLastSavedState(s) ? (o.busy(!1), !1) : (u = o.getHashByState(s), f = o.discardedState(s), f ? (o.getHashByIndex(-2) === o.getHashByState(f.forwardState) ? o.back(!1) : o.forward(!1), !1) : (o.pushState(s.data, s.title, s.url, !1), !0)))) | |
}, o.Adapter.bind(e, "hashchange", o.onHashChange), o.pushState = function(t, r, i, s) { | |
if (o.getHashByUrl(i)) throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors)."); | |
if (s !== !1 && o.busy()) return o.pushQueue({ | |
scope: o, | |
callback: o.pushState, | |
args: arguments, | |
queue: s | |
}), !1; | |
o.busy(!0); | |
var u = o.createStateObject(t, r, i), | |
a = o.getHashByState(u), | |
f = o.getState(!1), | |
l = o.getHashByState(f), | |
c = o.getHash(); | |
return o.storeState(u), o.expectedStateId = u.id, o.recycleState(u), o.setTitle(u), a === l ? (o.busy(!1), !1) : a !== c && a !== o.getShortUrl(n.location.href) ? (o.setHash(a, !1), !1) : (o.saveState(u), o.Adapter.trigger(e, "statechange"), o.busy(!1), !0) | |
}, o.replaceState = function(e, t, n, r) { | |
if (o.getHashByUrl(n)) throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors)."); | |
if (r !== !1 && o.busy()) return o.pushQueue({ | |
scope: o, | |
callback: o.replaceState, | |
args: arguments, | |
queue: r | |
}), !1; | |
o.busy(!0); | |
var i = o.createStateObject(e, t, n), | |
s = o.getState(!1), | |
u = o.getStateByIndex(-2); | |
return o.discardState(s, i, u), o.pushState(i.data, i.title, i.url, !1), !0 | |
}), o.emulated.pushState && o.getHash() && !o.emulated.hashChange && o.Adapter.onDomLoad(function() { | |
o.Adapter.trigger(e, "hashchange") | |
}) | |
}, typeof o.init != "undefined" && o.init() | |
}(window), function(e, t) { | |
"use strict"; | |
var n = e.console || t, | |
r = e.document, | |
i = e.navigator, | |
s = e.sessionStorage || !1, | |
o = e.setTimeout, | |
u = e.clearTimeout, | |
a = e.setInterval, | |
f = e.clearInterval, | |
l = e.JSON, | |
c = e.alert, | |
h = e.History = e.History || {}, | |
p = e.history; | |
l.stringify = l.stringify || l.encode, l.parse = l.parse || l.decode; | |
if (typeof h.init != "undefined") throw new Error("History.js Core has already been loaded..."); | |
h.init = function() { | |
return typeof h.Adapter == "undefined" ? !1 : (typeof h.initCore != "undefined" && h.initCore(), typeof h.initHtml4 != "undefined" && h.initHtml4(), !0) | |
}, h.initCore = function() { | |
if (typeof h.initCore.initialized != "undefined") return !1; | |
h.initCore.initialized = !0, h.options = h.options || {}, h.options.hashChangeInterval = h.options.hashChangeInterval || 100, h.options.safariPollInterval = h.options.safariPollInterval || 500, h.options.doubleCheckInterval = h.options.doubleCheckInterval || 500, h.options.storeInterval = h.options.storeInterval || 1e3, h.options.busyDelay = h.options.busyDelay || 250, h.options.debug = h.options.debug || !1, h.options.initialTitle = h.options.initialTitle || r.title, h.intervalList = [], h.clearAllIntervals = function() { | |
var e, t = h.intervalList; | |
if (typeof t != "undefined" && t !== null) { | |
for (e = 0; e < t.length; e++) f(t[e]); | |
h.intervalList = null | |
} | |
}, h.debug = function() { | |
(h.options.debug || !1) && h.log.apply(h, arguments) | |
}, h.log = function() { | |
var e = typeof n != "undefined" && typeof n.log != "undefined" && typeof n.log.apply != "undefined", | |
t = r.getElementById("log"), | |
i, s, o, u, a; | |
e ? (u = Array.prototype.slice.call(arguments), i = u.shift(), typeof n.debug != "undefined" ? n.debug.apply(n, [i, u]) : n.log.apply(n, [i, u])) : i = "\n" + arguments[0] + "\n"; | |
for (s = 1, o = arguments.length; s < o; ++s) { | |
a = arguments[s]; | |
if (typeof a == "object" && typeof l != "undefined") try { | |
a = l.stringify(a) | |
} catch (f) {} | |
i += "\n" + a + "\n" | |
} | |
return t ? (t.value += i + "\n-----\n", t.scrollTop = t.scrollHeight - t.clientHeight) : e || c(i), !0 | |
}, h.getInternetExplorerMajorVersion = function() { | |
var e = h.getInternetExplorerMajorVersion.cached = typeof h.getInternetExplorerMajorVersion.cached != "undefined" ? h.getInternetExplorerMajorVersion.cached : function() { | |
var e = 3, | |
t = r.createElement("div"), | |
n = t.getElementsByTagName("i"); | |
while ((t.innerHTML = "<!--[if gt IE " + ++e + "]><i></i><![endif]-->") && n[0]); | |
return e > 4 ? e : !1 | |
}(); | |
return e | |
}, h.isInternetExplorer = function() { | |
var e = h.isInternetExplorer.cached = typeof h.isInternetExplorer.cached != "undefined" ? h.isInternetExplorer.cached : Boolean(h.getInternetExplorerMajorVersion()); | |
return e | |
}, h.emulated = { | |
pushState: !Boolean(e.history && e.history.pushState && e.history.replaceState && !/ Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i.test(i.userAgent) && !/AppleWebKit\/5([0-2]|3[0-2])/i.test(i.userAgent)), | |
hashChange: Boolean(!("onhashchange" in e || "onhashchange" in r) || h.isInternetExplorer() && h.getInternetExplorerMajorVersion() < 8) | |
}, h.enabled = !h.emulated.pushState, h.bugs = { | |
setHash: Boolean(!h.emulated.pushState && i.vendor === "Apple Computer, Inc." && /AppleWebKit\/5([0-2]|3[0-3])/.test(i.userAgent)), | |
safariPoll: Boolean(!h.emulated.pushState && i.vendor === "Apple Computer, Inc." && /AppleWebKit\/5([0-2]|3[0-3])/.test(i.userAgent)), | |
ieDoubleCheck: Boolean(h.isInternetExplorer() && h.getInternetExplorerMajorVersion() < 8), | |
hashEscape: Boolean(h.isInternetExplorer() && h.getInternetExplorerMajorVersion() < 7) | |
}, h.isEmptyObject = function(e) { | |
for (var t in e) return !1; | |
return !0 | |
}, h.cloneObject = function(e) { | |
var t, n; | |
return e ? (t = l.stringify(e), n = l.parse(t)) : n = {}, n | |
}, h.getRootUrl = function() { | |
var e = r.location.protocol + "//" + (r.location.hostname || r.location.host); | |
if (r.location.port || !1) e += ":" + r.location.port; | |
return e += "/", e | |
}, h.getBaseHref = function() { | |
var e = r.getElementsByTagName("base"), | |
t = null, | |
n = ""; | |
return e.length === 1 && (t = e[0], n = t.href.replace(/[^\/]+$/, "")), n = n.replace(/\/+$/, ""), n && (n += "/"), n | |
}, h.getBaseUrl = function() { | |
var e = h.getBaseHref() || h.getBasePageUrl() || h.getRootUrl(); | |
return e | |
}, h.getPageUrl = function() { | |
var e = h.getState(!1, !1), | |
t = (e || {}).url || r.location.href, | |
n; | |
return n = t.replace(/\/+$/, "").replace(/[^\/]+$/, function(e, t, n) { | |
return /\./.test(e) ? e : e + "/" | |
}), n | |
}, h.getBasePageUrl = function() { | |
var e = r.location.href.replace(/[#\?].*/, "").replace(/[^\/]+$/, function(e, t, n) { | |
return /[^\/]$/.test(e) ? "" : e | |
}).replace(/\/+$/, "") + "/"; | |
return e | |
}, h.getFullUrl = function(e, t) { | |
var n = e, | |
r = e.substring(0, 1); | |
return t = typeof t == "undefined" ? !0 : t, /[a-z]+\:\/\//.test(e) || (r === "/" ? n = h.getRootUrl() + e.replace(/^\/+/, "") : r === "#" ? n = h.getPageUrl().replace(/#.*/, "") + e : r === "?" ? n = h.getPageUrl().replace(/[\?#].*/, "") + e : t ? n = h.getBaseUrl() + e.replace(/^(\.\/)+/, "") : n = h.getBasePageUrl() + e.replace(/^(\.\/)+/, "")), n.replace(/\#$/, "") | |
}, h.getShortUrl = function(e) { | |
var t = e, | |
n = h.getBaseUrl(), | |
r = h.getRootUrl(); | |
return h.emulated.pushState && (t = t.replace(n, "")), t = t.replace(r, "/"), h.isTraditionalAnchor(t) && (t = "./" + t), t = t.replace(/^(\.\/)+/g, "./").replace(/\#$/, ""), t | |
}, h.store = {}, h.idToState = h.idToState || {}, h.stateToId = h.stateToId || {}, h.urlToId = h.urlToId || {}, h.storedStates = h.storedStates || [], h.savedStates = h.savedStates || [], h.normalizeStore = function() { | |
h.store.idToState = h.store.idToState || {}, h.store.urlToId = h.store.urlToId || {}, h.store.stateToId = h.store.stateToId || {} | |
}, h.getState = function(e, t) { | |
typeof e == "undefined" && (e = !0), typeof t == "undefined" && (t = !0); | |
var n = h.getLastSavedState(); | |
return !n && t && (n = h.createStateObject()), e && (n = h.cloneObject(n), n.url = n.cleanUrl || n.url), n | |
}, h.getIdByState = function(e) { | |
var t = h.extractId(e.url), | |
n; | |
if (!t) { | |
n = h.getStateString(e); | |
if (typeof h.stateToId[n] != "undefined") t = h.stateToId[n]; | |
else if (typeof h.store.stateToId[n] != "undefined") t = h.store.stateToId[n]; | |
else { | |
for (;;) { | |
t = (new Date).getTime() + String(Math.random()).replace(/\D/g, ""); | |
if (typeof h.idToState[t] == "undefined" && typeof h.store.idToState[t] == "undefined") break | |
} | |
h.stateToId[n] = t, h.idToState[t] = e | |
} | |
} | |
return t | |
}, h.normalizeState = function(e) { | |
var t, n; | |
if (!e || typeof e != "object") e = {}; | |
if (typeof e.normalized != "undefined") return e; | |
if (!e.data || typeof e.data != "object") e.data = {}; | |
t = {}, t.normalized = !0, t.title = e.title || "", t.url = h.getFullUrl(h.unescapeString(e.url || r.location.href)), t.hash = h.getShortUrl(t.url), t.data = h.cloneObject(e.data), t.id = h.getIdByState(t), t.cleanUrl = t.url.replace(/\??\&_suid.*/, ""), t.url = t.cleanUrl, n = !h.isEmptyObject(t.data); | |
if (t.title || n) t.hash = h.getShortUrl(t.url).replace(/\??\&_suid.*/, ""), /\?/.test(t.hash) || (t.hash += "?"), t.hash += "&_suid=" + t.id; | |
return t.hashedUrl = h.getFullUrl(t.hash), (h.emulated.pushState || h.bugs.safariPoll) && h.hasUrlDuplicate(t) && (t.url = t.hashedUrl), t | |
}, h.createStateObject = function(e, t, n) { | |
var r = { | |
data: e, | |
title: t, | |
url: n | |
}; | |
return r = h.normalizeState(r), r | |
}, h.getStateById = function(e) { | |
e = String(e); | |
var n = h.idToState[e] || h.store.idToState[e] || t; | |
return n | |
}, h.getStateString = function(e) { | |
var t, n, r; | |
return t = h.normalizeState(e), n = { | |
data: t.data, | |
title: e.title, | |
url: e.url | |
}, r = l.stringify(n), r | |
}, h.getStateId = function(e) { | |
var t, n; | |
return t = h.normalizeState(e), n = t.id, n | |
}, h.getHashByState = function(e) { | |
var t, n; | |
return t = h.normalizeState(e), n = t.hash, n | |
}, h.extractId = function(e) { | |
var t, n, r; | |
return n = /(.*)\&_suid=([0-9]+)$/.exec(e), r = n ? n[1] || e : e, t = n ? String(n[2] || "") : "", t || !1 | |
}, h.isTraditionalAnchor = function(e) { | |
var t = !/[\/\?\.]/.test(e); | |
return t | |
}, h.extractState = function(e, t) { | |
var n = null, | |
r, i; | |
return t = t || !1, r = h.extractId(e), r && (n = h.getStateById(r)), n || (i = h.getFullUrl(e), r = h.getIdByUrl(i) || !1, r && (n = h.getStateById(r)), !n && t && !h.isTraditionalAnchor(e) && (n = h.createStateObject(null, null, i))), n | |
}, h.getIdByUrl = function(e) { | |
var n = h.urlToId[e] || h.store.urlToId[e] || t; | |
return n | |
}, h.getLastSavedState = function() { | |
return h.savedStates[h.savedStates.length - 1] || t | |
}, h.getLastStoredState = function() { | |
return h.storedStates[h.storedStates.length - 1] || t | |
}, h.hasUrlDuplicate = function(e) { | |
var t = !1, | |
n; | |
return n = h.extractState(e.url), t = n && n.id !== e.id, t | |
}, h.storeState = function(e) { | |
return h.urlToId[e.url] = e.id, h.storedStates.push(h.cloneObject(e)), e | |
}, h.isLastSavedState = function(e) { | |
var t = !1, | |
n, r, i; | |
return h.savedStates.length && (n = e.id, r = h.getLastSavedState(), i = r.id, t = n === i), t | |
}, h.saveState = function(e) { | |
return h.isLastSavedState(e) ? !1 : (h.savedStates.push(h.cloneObject(e)), !0) | |
}, h.getStateByIndex = function(e) { | |
var t = null; | |
return typeof e == "undefined" ? t = h.savedStates[h.savedStates.length - 1] : e < 0 ? t = h.savedStates[h.savedStates.length + e] : t = h.savedStates[e], t | |
}, h.getHash = function() { | |
var e = h.unescapeHash(r.location.hash); | |
return e | |
}, h.unescapeString = function(t) { | |
var n = t, | |
r; | |
for (;;) { | |
r = e.unescape(n); | |
if (r === n) break; | |
n = r | |
} | |
return n | |
}, h.unescapeHash = function(e) { | |
var t = h.normalizeHash(e); | |
return t = h.unescapeString(t), t | |
}, h.normalizeHash = function(e) { | |
var t = e.replace(/[^#]*#/, "").replace(/#.*/, ""); | |
return t | |
}, h.setHash = function(e, t) { | |
var n, i, s; | |
return t !== !1 && h.busy() ? (h.pushQueue({ | |
scope: h, | |
callback: h.setHash, | |
args: arguments, | |
queue: t | |
}), !1) : (n = h.escapeHash(e), h.busy(!0), i = h.extractState(e, !0), i && !h.emulated.pushState ? h.pushState(i.data, i.title, i.url, !1) : r.location.hash !== n && (h.bugs.setHash ? (s = h.getPageUrl(), h.pushState(null, null, s + "#" + n, !1)) : r.location.hash = n), h) | |
}, h.escapeHash = function(t) { | |
var n = h.normalizeHash(t); | |
return n = e.escape(n), h.bugs.hashEscape || (n = n.replace(/\%21/g, "!").replace(/\%26/g, "&").replace(/\%3D/g, "=").replace(/\%3F/g, "?")), n | |
}, h.getHashByUrl = function(e) { | |
var t = String(e).replace(/([^#]*)#?([^#]*)#?(.*)/, "$2"); | |
return t = h.unescapeHash(t), t | |
}, h.setTitle = function(e) { | |
var t = e.title, | |
n; | |
t || (n = h.getStateByIndex(0), n && n.url === e.url && (t = n.title || h.options.initialTitle)); | |
try { | |
r.getElementsByTagName("title")[0].innerHTML = t.replace("<", "<").replace(">", ">").replace(" & ", " & ") | |
} catch (i) {} | |
return r.title = t, h | |
}, h.queues = [], h.busy = function(e) { | |
typeof e != "undefined" ? h.busy.flag = e : typeof h.busy.flag == "undefined" && (h.busy.flag = !1); | |
if (!h.busy.flag) { | |
u(h.busy.timeout); | |
var t = function() { | |
var e, n, r; | |
if (h.busy.flag) return; | |
for (e = h.queues.length - 1; e >= 0; --e) { | |
n = h.queues[e]; | |
if (n.length === 0) continue; | |
r = n.shift(), h.fireQueueItem(r), h.busy.timeout = o(t, h.options.busyDelay) | |
} | |
}; | |
h.busy.timeout = o(t, h.options.busyDelay) | |
} | |
return h.busy.flag | |
}, h.busy.flag = !1, h.fireQueueItem = function(e) { | |
return e.callback.apply(e.scope || h, e.args || []) | |
}, h.pushQueue = function(e) { | |
return h.queues[e.queue || 0] = h.queues[e.queue || 0] || [], h.queues[e.queue || 0].push(e), h | |
}, h.queue = function(e, t) { | |
return typeof e == "function" && (e = { | |
callback: e | |
}), typeof t != "undefined" && (e.queue = t), h.busy() ? h.pushQueue(e) : h.fireQueueItem(e), h | |
}, h.clearQueue = function() { | |
return h.busy.flag = !1, h.queues = [], h | |
}, h.stateChanged = !1, h.doubleChecker = !1, h.doubleCheckComplete = function() { | |
return h.stateChanged = !0, h.doubleCheckClear(), h | |
}, h.doubleCheckClear = function() { | |
return h.doubleChecker && (u(h.doubleChecker), h.doubleChecker = !1), h | |
}, h.doubleCheck = function(e) { | |
return h.stateChanged = !1, h.doubleCheckClear(), h.bugs.ieDoubleCheck && (h.doubleChecker = o(function() { | |
return h.doubleCheckClear(), h.stateChanged || e(), !0 | |
}, h.options.doubleCheckInterval)), h | |
}, h.safariStatePoll = function() { | |
var t = h.extractState(r.location.href), | |
n; | |
if (!h.isLastSavedState(t)) n = t; | |
else return; | |
return n || (n = h.createStateObject()), h.Adapter.trigger(e, "popstate"), h | |
}, h.back = function(e) { | |
return e !== !1 && h.busy() ? (h.pushQueue({ | |
scope: h, | |
callback: h.back, | |
args: arguments, | |
queue: e | |
}), !1) : (h.busy(!0), h.doubleCheck(function() { | |
h.back(!1) | |
}), p.go(-1), !0) | |
}, h.forward = function(e) { | |
return e !== !1 && h.busy() ? (h.pushQueue({ | |
scope: h, | |
callback: h.forward, | |
args: arguments, | |
queue: e | |
}), !1) : (h.busy(!0), h.doubleCheck(function() { | |
h.forward(!1) | |
}), p.go(1), !0) | |
}, h.go = function(e, t) { | |
var n; | |
if (e > 0) for (n = 1; n <= e; ++n) h.forward(t); | |
else { | |
if (!(e < 0)) throw new Error("History.go: History.go requires a positive or negative integer passed."); | |
for (n = -1; n >= e; --n) h.back(t) | |
} | |
return h | |
}; | |
if (h.emulated.pushState) { | |
var d = function() {}; | |
h.pushState = h.pushState || d, h.replaceState = h.replaceState || d | |
} else h.onPopState = function(t, n) { | |
var i = !1, | |
s = !1, | |
o, u; | |
return h.doubleCheckComplete(), o = h.getHash(), o ? (u = h.extractState(o || r.location.href, !0), u ? h.replaceState(u.data, u.title, u.url, !1) : (h.Adapter.trigger(e, "anchorchange"), h.busy(!1)), h.expectedStateId = !1, !1) : (i = h.Adapter.extractEventData("state", t, n) || !1, i ? s = h.getStateById(i) : h.expectedStateId ? s = h.getStateById(h.expectedStateId) : s = h.extractState(r.location.href), s || (s = h.createStateObject(null, null, r.location.href)), h.expectedStateId = !1, h.isLastSavedState(s) ? (h.busy(!1), !1) : (h.storeState(s), h.saveState(s), h.setTitle(s), h.Adapter.trigger(e, "statechange"), h.busy(!1), !0)) | |
}, h.Adapter.bind(e, "popstate", h.onPopState), h.pushState = function(t, n, r, i) { | |
if (h.getHashByUrl(r) && h.emulated.pushState) throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors)."); | |
if (i !== !1 && h.busy()) return h.pushQueue({ | |
scope: h, | |
callback: h.pushState, | |
args: arguments, | |
queue: i | |
}), !1; | |
h.busy(!0); | |
var s = h.createStateObject(t, n, r); | |
return h.isLastSavedState(s) ? h.busy(!1) : (h.storeState(s), h.expectedStateId = s.id, p.pushState(s.id, s.title, s.url), h.Adapter.trigger(e, "popstate")), !0 | |
}, h.replaceState = function(t, n, r, i) { | |
if (h.getHashByUrl(r) && h.emulated.pushState) throw new Error("History.js does not support states with fragement-identifiers (hashes/anchors)."); | |
if (i !== !1 && h.busy()) return h.pushQueue({ | |
scope: h, | |
callback: h.replaceState, | |
args: arguments, | |
queue: i | |
}), !1; | |
h.busy(!0); | |
var s = h.createStateObject(t, n, r); | |
return h.isLastSavedState(s) ? h.busy(!1) : (h.storeState(s), h.expectedStateId = s.id, p.replaceState(s.id, s.title, s.url), h.Adapter.trigger(e, "popstate")), !0 | |
}; | |
if (s) { | |
try { | |
h.store = l.parse(s.getItem("History.store")) || {} | |
} catch (v) { | |
h.store = {} | |
} | |
h.normalizeStore() | |
} else h.store = {}, h.normalizeStore(); | |
h.Adapter.bind(e, "beforeunload", h.clearAllIntervals), h.Adapter.bind(e, "unload", h.clearAllIntervals), h.saveState(h.storeState(h.extractState(r.location.href, !0))), s && (h.onUnload = function() { | |
var e, t; | |
try { | |
e = l.parse(s.getItem("History.store")) || {} | |
} catch (n) { | |
e = {} | |
} | |
e.idToState = e.idToState || {}, e.urlToId = e.urlToId || {}, e.stateToId = e.stateToId || {}; | |
for (t in h.idToState) { | |
if (!h.idToState.hasOwnProperty(t)) continue; | |
e.idToState[t] = h.idToState[t] | |
} | |
for (t in h.urlToId) { | |
if (!h.urlToId.hasOwnProperty(t)) continue; | |
e.urlToId[t] = h.urlToId[t] | |
} | |
for (t in h.stateToId) { | |
if (!h.stateToId.hasOwnProperty(t)) continue; | |
e.stateToId[t] = h.stateToId[t] | |
} | |
h.store = e, h.normalizeStore(), s.setItem("History.store", l.stringify(e)) | |
}, h.intervalList.push(a(h.onUnload, h.options.storeInterval)), h.Adapter.bind(e, "beforeunload", h.onUnload), h.Adapter.bind(e, "unload", h.onUnload)); | |
if (!h.emulated.pushState) { | |
h.bugs.safariPoll && h.intervalList.push(a(h.safariStatePoll, h.options.safariPollInterval)); | |
if (i.vendor === "Apple Computer, Inc." || (i.appCodeName || "") === "Mozilla") h.Adapter.bind(e, "hashchange", function() { | |
h.Adapter.trigger(e, "popstate") | |
}), h.getHash() && h.Adapter.onDomLoad(function() { | |
h.Adapter.trigger(e, "hashchange") | |
}) | |
} | |
}, h.init() | |
}(window) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment