-
-
Save anonymous/23bff2f5006c675f9cff49f75245d5b5 to your computer and use it in GitHub Desktop.
This file contains 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 Note(e) { | |
this.coord = e | |
} | |
function Interval(e) { | |
this.coord = e | |
} | |
function add_addsubtract_func(e) { | |
return e.add = function(e) { | |
var t, n = []; | |
for (t in this) "object" == typeof this[t] && (n[t] = this[t].add(e)); | |
return add_addsubtract_func(n), n | |
}, e.subtract = function(e) { | |
var t, n = []; | |
for (t in this) "object" == typeof this[t] && (n[t] = this[t].subtract(e)); | |
return add_addsubtract_func(n), n | |
}, e | |
} | |
function BufferLoader(e, t, n, i) { | |
this.context = e, this.urlList = t, this.onload = n, this.onerror = i, this.bufferList = [], this.loadCount = 0 | |
} | |
function Oscilloscope(e, t, n) { | |
this.analyser = e, this.data = new Uint8Array(e.frequencyBinCount), this.data2 = new Uint8Array(e.frequencyBinCount), this.width = t, this.height = n, this.draw_counter = 0, this.min_freq = Math.log(20) / Math.LN10, this.max_freq = Math.log(2e4) / Math.LN10 | |
} | |
function findFirstPositiveZeroCrossing(e, t) { | |
for (var n, i = 0, o = -1; i < t && e[i] > 128;) i++; | |
if (i >= t) return 0; | |
for (; i < t && (n = e[i]) < MINVAL;) n >= 128 ? o == -1 && (o = i) : o = -1, i++; | |
return o == -1 && (o = i), i == t ? 0 : 0 == o ? 0 : o | |
} | |
function startup() { | |
if ("standalone" in window.navigator && window.navigator.standalone && window.location.href != baseUrl + "/") return void(window.location = baseUrl); | |
timerWorker = new Worker("/interval.js"), timerWorker.onmessage = function(e) { | |
"interval.start" === e.data && playTone() | |
}, 1 == simulateNewUser && clearLocalStorage(), setInterval(function() { | |
ping() | |
}, 3e5), isMobileDevice() && (spectrumEnabled = !1), setupLayout(), loadCurrentUser(), tone = $.extend(!0, {}, toneTemplate), tone.preset.settings = JSON.parse(JSON.stringify(tone.settings)); | |
var e = getStoredTone(); | |
null != e && (tone = JSON.parse(JSON.stringify(e))); | |
var t = getStoredSettings(); | |
if (null != t && (repeatBar = t.repeat_bar, currentBar = t.current_bar, selectedLFO = t.selected_lfo, selectedEnvelope = t.selected_envelope, selectedEffect = t.selected_effect, selectedHomeTab = t.selected_home_tab, "undefined" != typeof t.copied_notes && (copiedNotes = t.copied_notes), "undefined" != typeof t.selected_sound_setting && (selectedSoundSetting = t.selected_sound_setting), 1 == repeatBar ? enableRepeat() : disableRepeat()), setupEvents(), setupAudio(), loadSamples(), setupMatrix(), setupSettings(), setupTone(), setupInfo(), setupMainMenu(), setupHome(), setupMessages(), setupProfile(), drawAnimations(), addToViewHistory("tone", tone.id), selectView("create", !1), startWorkerTimer(), preload(["https://d8ev4i00v2x30.cloudfront.net/assets/pop-arrow-bottom-0a3676576d9085c6a53c2a5a2d3107c84c40347555e203769e70f19edb8a22d4.png", "https://d8ev4i00v2x30.cloudfront.net/assets/pop-arrow-bottom-gray-527765ce65d46fd3758f3c643219a60325e338002146715b06c70a0c20b353cd.png", "https://d8ev4i00v2x30.cloudfront.net/assets/pop-arrow-top-26e9a697bd13bb25c96f157d55f395975cd1dbfd06071103f14d202e85eec23e.png", "https://d8ev4i00v2x30.cloudfront.net/assets/drum-9523ecf69f2728c3ee51760156f156bdb424896cca548ad627a6641efc29bd4c.png", "https://d8ev4i00v2x30.cloudfront.net/assets/wave-sawtooth-594f1d6aeb8dc0f5e6faaa1fcab1911a9e32c70e499d6463c2570edb1bc60a9e.png", "https://d8ev4i00v2x30.cloudfront.net/assets/wave-square-ea2a989a5032fa152f73bce9dd80dbd653efc031c716309b78c5f7678c331682.png", "https://d8ev4i00v2x30.cloudfront.net/assets/wave-sine-6af064c7a0c2a59610449bfaf796a4a51550e91fba124376a8f6cb05a41d3c47.png", "https://d8ev4i00v2x30.cloudfront.net/assets/wave-triangle-85c933f142858d2bb289a623ad7e7d7d940a3b0f59717d436879fa41c192351b.png", "https://d8ev4i00v2x30.cloudfront.net/assets/padlock-65deacaadb80db972682874b78fc6c41f1614854e188dbbd3d22561b9904caf0.png", "https://d8ev4i00v2x30.cloudfront.net/assets/loading-rolling-40px-544a6925f11f3510a73c08cff5c2d8c123596e5a11b676cc24b55e9549f9ce8b.gif", "https://d8ev4i00v2x30.cloudfront.net/assets/loading-gray-100px-c505eb4dbae98f90a1df47db7170ea8a1d22198b00b41f40d97865b0912759b5.gif"]), "feed" == requestPath) selectedHomeTab = 0, showHome(); | |
else if ("discover" == requestPath) selectedHomeTab = 1, showHome(); | |
else if ("charts" == requestPath) selectedHomeTab = 2, showHome(); | |
else if ("new" == requestPath) selectedHomeTab = 3, showHome(); | |
else if ("messages" == requestPath) selectedMessagesTab = 0, showMessages(); | |
else if (requestPath.split("messages/").length > 1) { | |
var n = requestPath.split("messages/")[1]; | |
selectedMessagesTab = 0, showMessages(!1, !0, !1), loadMessage(n) | |
} else "notifications" == requestPath ? (selectedMessagesTab = 1, showMessages()) : "settings" == requestPath ? (showMainMenu(), showSettingsMenu()) : "help" == requestPath ? showHelp(!0, !0) : "undefined" != typeof loadToneFromUrl && loadToneFromUrl != tone.id ? (setupVoices(), loadTone(loadToneFromUrl, !0, !1, !1)) : "undefined" != typeof loadProfileFromUrl ? showProfile(loadProfileFromUrl) : (setupVoices(), 0 == tone.id && setTimeout(function() { | |
var e = !0; | |
isMobileDevice() && (e = !1), tone.edited = !1, loadTone(defaultToneId, !0, !1, e) | |
}, 1800)); | |
updatePageTitle(), updateUrlState(), updateUnreadDisplay(), setTimeout(function() { | |
hideLoadingOverlay() | |
}, 200), reloadUser(), setTimeout(function() { | |
0 == browseLastId && loadBrowse() | |
}, 1e3), setTimeout(function() { | |
showFirstTimeMessage() | |
}, 25e3) | |
} | |
function showFirstTimeMessage() { | |
"undefined" != typeof $.cookie("first_time") || userLoggedIn() || (showDialog("first_time"), $.cookie("first_time", "false", { | |
expires: 1825, | |
path: "/" | |
})) | |
} | |
function hideLoadingOverlay() { | |
1 != loadingOverlayHidden && ($("#loading_text").hide(), $("#loading_logo, #loading_headphones").show(), $("#loading_logo img").show().css("animation-duration", "1.1s").animateCss("rotateIn"), $("#loading_headphones").show().css("animation-duration", "0.6s").animateCss("fadeIn"), setTimeout(function() { | |
$("#loading_headphones_icon").css("animation-duration", "1.1s").animateCss("jello") | |
}, 600), $("#layout_inner").hide(), setTimeout(function() { | |
loadingOverlayHidden = !0, $("#loading_wrap, #loading_headphones").hide(), $("#loading_overlay").css("animation-duration", "0.24s").animateCss("fadeOut", function() { | |
$("#loading_overlay").hide() | |
}), setTimeout(function() { | |
$("#layout_inner").show().css("animation-duration", "0.6s").animateCss("zoomIn") | |
}, 10) | |
}, 1700)) | |
} | |
function ping() { | |
$.ajax({ | |
url: "/api/1/ping", | |
data: { | |
version: appVersion | |
}, | |
type: "GET", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
e.version != appVersion && location.reload(!0), unreadMessages = e.unread_messages, unreadNotifications = e.unread_notifications, updateUnreadDisplay() | |
} | |
}) | |
} | |
function setupEvents() { | |
setupVisibilityEvent(), $(document).keydown(function(e) { | |
if ($("input:focus").length > 0 || $("textarea:focus").length > 0) return !0; | |
if (32 == e.which) return togglePlay(), !1; | |
if (37 == e.which) { | |
var t = currentBar - 1; | |
return t < 0 && (t = tone.bars.length - 1), selectBar(t), !1 | |
} | |
if (39 == e.which) { | |
var t = currentBar + 1; | |
return t >= tone.bars.length && (t = 0), selectBar(t), !1 | |
} | |
return 13 == e.which ? (toggleRepeat(), !1) : (49 == e.which ? selectBar(0) : 50 == e.which ? selectBar(1) : 51 == e.which ? selectBar(2) : 52 == e.which ? selectBar(3) : 53 == e.which ? selectBar(4) : 54 == e.which ? selectBar(5) : 55 == e.which ? selectBar(6) : 56 == e.which ? selectBar(7) : 57 == e.which ? selectBar(8) : 48 == e.which && selectBar(9), !0) | |
}), $("#save_title").keydown(function(e) { | |
if (13 == e.which) return saveTone(), !1 | |
}), $("#login_username, #login_password").keydown(function(e) { | |
if (13 == e.which) return loginUser(), !1 | |
}), $("#register_password").keydown(function(e) { | |
if (13 == e.which) return registerUser(), !1 | |
}); | |
var e = "mousedown", | |
t = "mouseup"; | |
isMobileDevice() && (e = "touchstart", t = "touchend"), $(document).on("click", function(e) { | |
0 == $(e.target).closest(".settings-cell").length && 0 == $(e.target).closest(".settings-label").length && 0 == $(e.target).closest(".settings-popover").length && 0 == $(e.target).closest(".info-cover").length && 0 == $(e.target).closest(".play-button").length && 0 == $(e.target).closest(".back-button").length && 0 == $(e.target).closest(".profile-more-button").length && 0 == $(e.target).closest(".repeat-button").length && 0 == $(e.target).closest(".bar").length && hideSettings() | |
}), $(window).on("scroll", function() { | |
"browse" == currentView && (currentScrollTop = $(this).scrollTop()) | |
}), $("#matrix").on("touchmove", function(e) { | |
return e.preventDefault(), e.stopPropagation(), !1 | |
}), $(".settings-popover").on("touchmove", function(e) { | |
if (1 == $(e.target).hasClass("settings-popover") || 1 == $(e.target).hasClass("settings-popover-inner")) return e.preventDefault(), e.stopPropagation(), !1 | |
}), $("#menu_button").on("click", function() { | |
showMainMenu() | |
}), $("#back_button").on("click", function() { | |
goBackViewHistory() | |
}), $("#play_button").on(e, function() { | |
togglePlay() | |
}), $("#repeat_button").on(e, function() { | |
toggleRepeat() | |
}), $(document).on(e, function() { | |
if (0 == webAudioActivated) { | |
webAudioActivated = !0; | |
var e = audioContext.createOscillator(); | |
e.frequency.value = 440; | |
var t = audioContext.createGain(); | |
t.gain.value = 1e-4, e.connect(t), t.connect(audioContext.destination), e.noteOn ? (e.noteOn(audioContext.currentTime), e.noteOff(audioContext.currentTime + .001)) : (e.start(audioContext.currentTime), e.stop(audioContext.currentTime + .001)), setupVoices() | |
} | |
}), $(document).on(t, function(e) { | |
1 == menuOpen && 0 == $(e.target).closest("#info_more_button").length && 0 == $(e.target).closest("#profile_more_button").length && setTimeout(function() { | |
hideMenu() | |
}, 10), $(".medium-button").removeClass("medium-button-on"), $(".large-button").removeClass("large-button-on"), $(".small-button-push").removeClass("small-button-push-on"), $(".small-button-like").removeClass("small-button-like-on"), $("#messages_wrap .small-button").removeClass("small-button-on"), clearInterval(buttonTriggerTimer), clearInterval(buttonRepeatTimer) | |
}), $("#layout_inner").on("touchstart", function(e) { | |
var t = e.originalEvent, | |
n = { | |
x: t.touches[t.touches.length - 1].pageX - $(this).offset().left, | |
y: t.touches[t.touches.length - 1].pageY - $(this).offset().top | |
}; | |
documentTouchStartX = n.x | |
}), $("#layout_inner").on("touchmove", function(e) { | |
var t = e.originalEvent, | |
n = { | |
x: t.touches[t.touches.length - 1].pageX - $(this).offset().left, | |
y: t.touches[t.touches.length - 1].pageY - $(this).offset().top | |
}; | |
documentTouchEndX = n.x | |
}), $("#layout_inner").on("touchend", function() { | |
documentTouchStartX <= 20 && documentTouchEndX > 25 && goBackViewHistory(), documentTouchStartX = -1, documentTouchEndX = -1 | |
}), $(window).resize(function() { | |
resizeEvent() | |
}), $(window).on("orientationchange", function() { | |
resizeEvent() | |
}) | |
} | |
function resizeEvent(e) { | |
var e = "undefined" != typeof e && e; | |
if (0 != e || screenHeight != $(window).height() || screenWidth != $(window).width()) { | |
var t = null; | |
viewHistory.length > 0 && (t = viewHistory.slice(viewHistory.length - 1, viewHistory.length)[0]), hideDialogs(), hideSettings(), hideMainMenu(), $("#bars_container, #matrix").html(""), $("#bars_container, #layout_bars_cell, #layout_grid_cell, #bars, #layout_matrix, #matrix, #bars_parent").removeAttr("style"), clearTimeout(resizeTimer), resizeTimer = setTimeout(function() { | |
setupLayout(), drawBars(), setupMatrix(), drawBackCanvas(), animatingNotes = [], updateLayoutScrollHeight() | |
}, 300) | |
} | |
} | |
function setupLayout() { | |
updateLayoutSizes(); | |
var e = barSize + 5; | |
$("#bars_container").height(e), $("#layout_bars_cell").height(e + 1), $("#layout_grid_cell").css("height", "100%"), $("#bars_parent").height(e + 1), $("#bars").height(e + 20), $("#bars").width($("#layout_inner").width()), null != oscilloscope && (oscilloscope.width = canvasSize, oscilloscope.height = canvasSize) | |
} | |
function updateLayoutSizes() { | |
var e = currentView; | |
selectView("create"), barSize = $("#layout_bars_cell").height() - 5, canvasSize = $("#layout_grid_cell").width(), $("#layout_grid_cell").width() > $("#layout_grid_cell").height() && (canvasSize = $("#layout_grid_cell").height()); | |
var t = barSize; | |
barSize < 70 && (barSize = 70, canvasSize -= barSize - t), canvasSize -= 5, screenHeight = $(window).height(), screenWidth = $(window).width(), contentHeight = $("#content_cell").height(), selectView(e) | |
} | |
function addToViewHistory(e, t) { | |
if ("tone" != e || 0 != t) { | |
if (viewHistory.length > 0) { | |
var n = viewHistory.slice(viewHistory.length - 1, viewHistory.length)[0]; | |
if (n.view_type == e && n.view_type_id == t) return | |
} | |
viewHistory.push({ | |
view_type: e, | |
view_type_id: t | |
}), showHideBackButton() | |
} | |
} | |
function goBackViewHistory() { | |
if (!(viewHistory.length <= 1)) { | |
viewHistory.pop(); | |
var e = viewHistory.slice(viewHistory.length - 1, viewHistory.length)[0]; | |
if ("tone" == e.view_type) { | |
if (null != currentToneCopy) { | |
var t = !1; | |
1 == playing && (t = !0, stopPlaying()), tone = JSON.parse(currentToneCopy), currentBar = 0, currentTick = 0, animatingNotes = [], currentToneCopy = null, setupTone(!0, t) | |
} | |
showCreate(!1), tone.id != e.view_type_id ? loadTone(e.view_type_id, !1, !0, !1) : (updatePageTitle(), updateUrlState()) | |
} else if ("home" == e.view_type) "feed" == e.view_type_id ? selectedHomeTab = 0 : "discover" == e.view_type_id ? selectedHomeTab = 1 : "charts" == e.view_type_id ? selectedHomeTab = 2 : "new" == e.view_type_id && (selectedHomeTab = 3), showHome(!1); | |
else if ("messages" == e.view_type) | |
if ("notifications" != e.view_type_id && "messages" != e.view_type_id) { | |
var n = e.view_type_id; | |
selectedMessagesTab = 0, showMessages(!1, !0, !1), loadMessage(n) | |
} else "messages" == e.view_type_id ? selectedMessagesTab = 0 : "notifications" == e.view_type_id && (selectedMessagesTab = 1), showMessages(!1); | |
else "help" == e.view_type ? showHelp(!0, !0) : showProfile(e.view_type_id, !1); | |
viewHistory.length <= 1 && (loadToneCache = []), showHideBackButton() | |
} | |
} | |
function showHideBackButton() { | |
viewHistory.length > 1 ? ($("#back_button").show(), $("#menu_button").addClass("menu-button-indented")) : ($("#back_button").hide(), $("#menu_button").removeClass("menu-button-indented")) | |
} | |
function updateUrlState() { | |
if (history.replaceState) { | |
var e = location.protocol + "//" + location.hostname + (location.port ? ":" + location.port : ""); | |
if (viewHistory.length > 0 && "undefined" != typeof tone.user && 0 != tone.user.id) { | |
var t = viewHistory.slice(viewHistory.length - 1, viewHistory.length)[0]; | |
"tone" == t.view_type ? 1 == tone["private"] ? history.replaceState({ | |
tone_id: tone.id | |
}, document.title, e + "/") : history.replaceState({ | |
tone_id: tone.id | |
}, document.title, e + "/" + tone.user.username + "/" + tone.url_title) : "home" == t.view_type ? 0 == selectedHomeTab ? history.replaceState({ | |
tone_id: tone.id | |
}, document.title, e + "/feed") : 1 == selectedHomeTab ? history.replaceState({ | |
tone_id: tone.id | |
}, document.title, e + "/discover") : 2 == selectedHomeTab ? history.replaceState({ | |
tone_id: tone.id | |
}, document.title, e + "/charts") : 3 == selectedHomeTab && history.replaceState({ | |
tone_id: tone.id | |
}, document.title, e + "/new") : "messages" == t.view_type ? "notifications" != t.view_type_id && "messages" != t.view_type_id ? history.replaceState({ | |
tone_id: tone.id | |
}, document.title, e + "/messages/" + t.view_type_id) : 0 == selectedMessagesTab ? history.replaceState({ | |
tone_id: tone.id | |
}, document.title, e + "/messages") : 1 == selectedMessagesTab && history.replaceState({ | |
tone_id: tone.id | |
}, document.title, e + "/notifications") : history.replaceState({ | |
username: t.view_type_id | |
}, document.title, e + "/" + t.view_type_id) | |
} else history.replaceState({ | |
tone_id: tone.id | |
}, document.title, e + "/") | |
} | |
} | |
function updatePageTitle() { | |
if (viewHistory.length < 1) return void(document.title = "Tones"); | |
var e = viewHistory.slice(viewHistory.length - 1, viewHistory.length)[0]; | |
"tone" == e.view_type ? "undefined" == typeof tone.user || 0 == tone.user.id ? document.title = "Tones" : document.title = tone.title + (1 == tone.version ? "" : " " + tone.version) + " by " + (null != tone.user.name ? tone.user.name : tone.user.username) + " - Tones" : "home" == e.view_type ? 0 == selectedHomeTab ? document.title = "Feed - Tones" : 1 == selectedHomeTab ? document.title = "Discover - Tones" : 2 == selectedHomeTab ? document.title = "Charts - Tones" : 3 == selectedHomeTab && (document.title = "New - Tones") : "messages" == e.view_type ? "notifications" != e.view_type_id && "messages" != e.view_type_id ? document.title = "Message - Tones" : 0 == selectedMessagesTab ? document.title = "Messages - Tones" : 1 == selectedMessagesTab && (document.title = "Notifications - Tones") : "help" == e.view_type ? document.title = "Help - Tones" : document.title = e.view_type_id + " - Tones" | |
} | |
function setupHome() { | |
$("#home_tabs div").on("click", function() { | |
selectedHomeTab = parseInt($(this).attr("id").split("_")[2]), showHomeTab(!1), storeSettings() | |
}), $(".home-tab-selected").removeClass("home-tab-selected"), $("#home_tab_" + selectedHomeTab).addClass("home-tab-selected"), $(".home-content").hide(), $("#home_content_" + selectedHomeTab).show() | |
} | |
function showHome(e, t) { | |
var e = "undefined" == typeof e || e, | |
t = "undefined" != typeof t && t; | |
1 != homeLoading && (userLoggedIn() || (selectedHomeTab = 2), homeLoading = !0, hideMainMenu(), hideDialogs(), hideSettings(), selectView("home"), 1 == t && viewHistory.length > 0 && (viewHistory = [], loadToneCache = []), showHomeTab(e)) | |
} | |
function showHomeTab(e) { | |
var e = "undefined" == typeof e || e; | |
1 == e && (0 == selectedHomeTab ? addToViewHistory("home", "feed") : 1 == selectedHomeTab ? addToViewHistory("home", "discover") : 2 == selectedHomeTab ? addToViewHistory("home", "charts") : 3 == selectedHomeTab && addToViewHistory("home", "new")), updatePageTitle(), updateUrlState(), $(".home-tab-selected").removeClass("home-tab-selected"), $("#home_tab_" + selectedHomeTab).addClass("home-tab-selected"), $("#home_loading").show(), $(".home-content").hide(), $.ajax({ | |
url: "/api/1/get_feed", | |
data: { | |
section: selectedHomeTab | |
}, | |
type: "GET", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
homeLoading = !1, 0 == e.success ? showAlert("Error", "Unable to load feed.") : drawHome(e) | |
}, | |
error: function() { | |
showAlert("Error", "Unable to load feed."), homeLoading = !1 | |
} | |
}) | |
} | |
function drawHome(e) { | |
$("#home_loading").hide(), $(".home-content").hide(); | |
var t = $("#home_content_" + selectedHomeTab).html(""); | |
if (0 == e.tones.length) { | |
var n = ($("<div />").addClass("home-content-none-icon").html('<i class="fa fa-user-plus fa-3x fa-fw" aria-hidden="true"></i>').appendTo(t), $("<div />").addClass("home-content-none").appendTo(t)); | |
return 0 == selectedHomeTab ? n.text("Follow people to see their latest tones here.") : 1 == selectedHomeTab && n.text("Follow people to see their favorite tones here."), void t.show() | |
} | |
drawTones(e, "home"), t.show() | |
} | |
function showHelp(e, t) { | |
var e = "undefined" == typeof e || e, | |
t = "undefined" != typeof t && t; | |
hideMainMenu(), hideDialogs(), hideSettings(), selectView("help"), 1 == t && viewHistory.length > 0 && (viewHistory = [], loadToneCache = []), showHelpView(e) | |
} | |
function showHelpView(e) { | |
var e = "undefined" == typeof e || e; | |
1 == e && addToViewHistory("help", "help"), updatePageTitle(), updateUrlState() | |
} | |
function trackView(e) { | |
$.ajax({ | |
url: "/api/1/track_view", | |
data: { | |
section: e | |
}, | |
type: "POST", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function() {}, | |
error: function() {} | |
}) | |
} | |
function setupMessages() { | |
$("#messages_tabs div").on("click", function() { | |
selectedMessagesTab != parseInt($(this).attr("id").split("_")[2]) && viewHistory.length > 0 && (viewHistory = [], loadToneCache = [], showHideBackButton()), selectedMessagesTab = parseInt($(this).attr("id").split("_")[2]); | |
var e = !1; | |
if (viewHistory.length > 0) { | |
var t = viewHistory.slice(viewHistory.length - 1, viewHistory.length)[0]; | |
"messages" == t.view_type && "notifications" != t.view_type_id && "messages" != t.view_type_id && (e = !0) | |
} else e = !0; | |
showMessagesTab(e) | |
}), $("#messages_tabs .home-tab-selected").removeClass("home-tab-selected"), $("#messages_tab_" + selectedMessagesTab).addClass("home-tab-selected"), $("#messages_wrap .home-content").hide(), $("#messages_content_" + selectedMessagesTab).show() | |
} | |
function showMessages(e, t, n) { | |
var e = "undefined" == typeof e || e, | |
t = "undefined" != typeof t && t, | |
n = "undefined" == typeof n || n; | |
return userLoggedIn() ? void(1 != messagesLoading && (messagesLoading = !0, hideMainMenu(), hideDialogs(), hideSettings(), selectView("messages"), 1 == t && viewHistory.length > 0 && (viewHistory = [], loadToneCache = []), 1 == n && showMessagesTab(e), updateUnreadDisplay())) : void showRegisterDialog() | |
} | |
function updateUnreadDisplay() { | |
unreadMessages > 0 ? $("#messages_tab_0").text("Messages (" + unreadMessages + ")") : $("#messages_tab_0").text("Messages"), unreadNotifications > 0 ? $("#messages_tab_1").text("Notifications (" + unreadNotifications + ")") : $("#messages_tab_1").text("Notifications"), unreadMessages > 0 || unreadNotifications > 0 ? $(".menu-button-number, .menu-item-number").show() : $(".menu-button-number, .menu-item-number").hide() | |
} | |
function showMessagesTab(e) { | |
var e = "undefined" == typeof e || e; | |
1 == e && (0 == selectedMessagesTab ? addToViewHistory("messages", "messages") : 1 == selectedMessagesTab && addToViewHistory("messages", "notifications")), updatePageTitle(), updateUrlState(), $("#messages_tabs .home-tab-selected").removeClass("home-tab-selected"), $("#messages_tab_" + selectedMessagesTab).addClass("home-tab-selected"), $("#messages_loading").show(), $("#messages_wrap .home-content").hide(); | |
var t = "get_messages"; | |
1 == selectedMessagesTab && (t = "get_notifications"), $.ajax({ | |
url: "/api/1/" + t, | |
data: {}, | |
type: "GET", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
messagesLoading = !1, 0 == e.success ? showAlert("Error", "Unable to load messages.") : drawMessages(e) | |
}, | |
error: function() { | |
showAlert("Error", "Unable to load messages."), messagesLoading = !1 | |
} | |
}) | |
} | |
function drawMessages(e) { | |
unreadMessages = e.unread_messages, unreadNotifications = e.unread_notifications, updateUnreadDisplay(), $("#messages_loading").hide(), $("#messages_wrap .home-content").hide(); | |
var t = $("#messages_content_" + selectedMessagesTab).html(""); | |
if (0 == selectedMessagesTab && 0 == e.messages.length || 1 == selectedMessagesTab && 0 == e.notifications.length) { | |
var n = $("<div />").addClass("home-content-none-icon").appendTo(t), | |
i = $("<div />").addClass("home-content-none").appendTo(t); | |
return 0 == selectedMessagesTab ? (n.html('<i class="fa fa-envelope fa-3x fa-fw" aria-hidden="true"></i>'), i.text("No messages.")) : 1 == selectedMessagesTab && (n.html('<i class="fa fa-bell fa-3x fa-fw" aria-hidden="true"></i>'), i.text("No notifications.")), void t.show() | |
} | |
0 == selectedMessagesTab ? drawMessagesContent(t, e) : drawNotifications(t, e), t.show() | |
} | |
function drawMessagesContent(e, t) { | |
for (var n = $("<div />").addClass("messages-wrap").appendTo(e), i = 0; i < t.messages.length; i++) { | |
var o = "", | |
s = ""; | |
t.messages[i].from_user.id != currentUser.id ? (o = null == t.messages[i].from_user.name || 0 == t.messages[i].from_user.name.length ? t.messages[i].from_user.username : t.messages[i].from_user.name, s = t.messages[i].from_user.avatar) : (o = null == t.messages[i].to_user.name || 0 == t.messages[i].to_user.name.length ? t.messages[i].to_user.username : t.messages[i].to_user.name, s = t.messages[i].to_user.avatar); | |
var a = $("<div />").addClass("messages-row-wrap").attr("id", "message_row_" + t.messages[i].id).appendTo(n); | |
a.data("username", t.messages[i].from_user.id != currentUser.id ? t.messages[i].from_user.username : t.messages[i].to_user.username), (t.messages[i].from_user.id == currentUser.id && 1 == t.messages[i].from_unread || t.messages[i].to_user.id == currentUser.id && 1 == t.messages[i].to_unread) && a.addClass("messages-row-wrap-unread"); | |
var r = $("<table />").addClass("messages-table").attr("cellspacing", 0).attr("cellpadding", 0).appendTo(a), | |
l = $("<tr />").appendTo(r), | |
u = $("<td />").attr("valign", "top").addClass("messages-row-avatar").appendTo(l), | |
c = ($("<div />").css("background", "rgb(" + s + ")").data("username", o).appendTo(u), $("<td />").attr("valign", "top").addClass("messages-row-info").appendTo(l)); | |
$("<div />").addClass("messages-row-oldness").html(getOldness(t.messages[i].last_reply_timestamp, !1, !1, !1) + '<i class="fa fa-circle fa-3x fa-fw"></i>').appendTo(c), $("<div />").addClass("messages-row-user").html("<span>" + o + "</span>").appendTo(c), $("<div />").addClass("messages-row-preview").text(t.messages[i].message.slice(0, 40) + (t.messages[i].message.length > 40 ? "..." : "")).appendTo(c) | |
} | |
$(".messages-row-wrap").on("click", function() { | |
var e = $(this).data("username"); | |
loadMessage(e) | |
}) | |
} | |
function loadMessage(e) { | |
$("#messages_tabs .home-tab-selected").removeClass("home-tab-selected"), $("#messages_tab_" + selectedMessagesTab).addClass("home-tab-selected"), $("#messages_loading").show(), $("#messages_wrap .home-content").hide(), addToViewHistory("messages", e), updatePageTitle(), updateUrlState(), $.ajax({ | |
url: "/api/1/get_message/" + e, | |
type: "GET", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
messagesLoading = !1, 0 == e.success ? showAlert("Error", "Unable to load message: " + e.error) : drawMessage(e) | |
}, | |
error: function() { | |
showAlert("Error", "Unable to load message."), messagesLoading = !1 | |
} | |
}) | |
} | |
function drawMessage(e) { | |
unreadMessages = e.unread_messages, unreadNotifications = e.unread_notifications, updateUnreadDisplay(), $("#messages_loading").hide(), $("#messages_wrap .home-content").hide(); | |
var t = $("#messages_content_" + selectedMessagesTab).html(""), | |
n = $("<div />").addClass("messages-header").appendTo(t), | |
i = $("<div />").addClass("small-button messages-delete-button").html('<i class="fa fa-trash fa-3x fa-fw"></i>').appendTo(n), | |
o = $("<div />").addClass("small-button").html("Report").appendTo(n); | |
i.on("click", function() { | |
showDialog("delete_message") | |
}), o.on("click", function() { | |
showDialog("report") | |
}); | |
var s = "mousedown", | |
a = "mouseup"; | |
isMobileDevice() && (s = "touchstart", a = "touchend"), $(".small-button", n).on(s, function() { | |
$(this).addClass("small-button-on") | |
}), $(".small-button", n).on(a, function() { | |
$(this).removeClass("small-button-on") | |
}); | |
var r = ""; | |
r = e.message.from_user.id != currentUser.id ? null == e.message.from_user.name || 0 == e.message.from_user.name.length ? e.message.from_user.username : e.message.from_user.name : null == e.message.to_user.name || 0 == e.message.to_user.name.length ? e.message.to_user.username : e.message.to_user.name; | |
for (var l = ($("<div />").addClass("messages-header-title").text(r).appendTo(n), $("<div />").addClass("messages-wrap").appendTo(t)), u = 0; u < e.messages.length; u++) { | |
var c = $("<div />").addClass("messages-row-wrap messages-row-wrap-full").attr("id", "message_row_" + e.messages[u].id).data("message_id", e.messages[u].id).appendTo(l), | |
d = $("<table />").addClass("messages-table").attr("cellspacing", 0).attr("cellpadding", 0).appendTo(c), | |
p = $("<tr />").appendTo(d), | |
f = $("<td />").attr("valign", "top").addClass("messages-row-avatar").appendTo(p), | |
h = ($("<div />").css("background", "rgb(" + e.messages[u].user.avatar + ")").data("username", e.messages[u].user.username).appendTo(f), $("<td />").attr("valign", "top").addClass("messages-row-info").appendTo(p)); | |
$("<div />").addClass("messages-row-oldness").text(getOldness(e.messages[u].date_timestamp, !1, !1, !1)).appendTo(h), $("<div />").addClass("messages-row-user messages-row-user-full").data("username", e.messages[u].user.username).html("<span>" + (null == e.messages[u].user.name || 0 == e.messages[u].user.name.length ? e.messages[u].user.username : e.messages[u].user.name) + "</span>").appendTo(h), $("<div />").addClass("messages-row-text").html(cleanupText(e.messages[u].message)).appendTo(h) | |
} | |
$(".messages-row-avatar div, .messages-row-user").on("click", function() { | |
var e = $(this).data("username"); | |
showProfile(e) | |
}); | |
var g = $("<div />").addClass("messages-reply-wrap").appendTo(t), | |
m = $("<table />").addClass("messages-table").attr("cellspacing", 0).attr("cellpadding", 0).appendTo(g), | |
v = $("<tr />").appendTo(m), | |
b = $("<td />").attr("valign", "top").addClass("messages-row-info").appendTo(v), | |
y = ($("<textarea />").attr("id", "message_textarea").addClass("messages-textarea").attr("placeholder", "Write your message...").appendTo(b), $("<div />").attr("id", "message_send_button").addClass("small-button-push messages-send-button").html(" Send ").appendTo(b)); | |
y.data("username", e.message.from_user.id != currentUser.id ? e.message.from_user.username : e.message.to_user.username), y.on("click", function() { | |
var e = $(this).data("username"), | |
t = $("#message_textarea").val(); | |
sendMessage(e, t) | |
}), t.show(), $("#messages_wrap .layout-scroll-wrap").scrollTop($("#messages_wrap .layout-scroll-wrap")[0].scrollHeight + 200), $("#message_textarea").focus() | |
} | |
function drawNotifications(e, t) { | |
for (var n = $("<div />").addClass("messages-wrap").appendTo(e), i = 0; i < t.notifications.length; i++) { | |
var o = $("<div />").addClass("messages-row-wrap messages-row-wrap-notification").appendTo(n), | |
s = $("<table />").addClass("messages-table").attr("cellspacing", 0).attr("cellpadding", 0).appendTo(o), | |
a = $("<tr />").appendTo(s), | |
r = $("<td />").attr("valign", "top").addClass("messages-row-avatar").appendTo(a), | |
l = ($("<div />").css("background", "rgb(" + t.notifications[i].from_user.avatar + ")").data("username", t.notifications[i].from_user.username).appendTo(r), $("<td />").attr("valign", "top").addClass("messages-row-info").appendTo(a)), | |
u = ($("<div />").addClass("messages-row-oldness").text(getOldness(t.notifications[i].date_timestamp, !1, !1, !1)).appendTo(l), $("<div />").addClass("messages-row-user").appendTo(l)); | |
$("<span />").data("username", t.notifications[i].from_user.username).html(null == t.notifications[i].from_user.name || 0 == t.notifications[i].from_user.name.length ? t.notifications[i].from_user.username : t.notifications[i].from_user.name).appendTo(u); | |
0 == t.notifications[i].category ? u.append(" liked") : 1 == t.notifications[i].category ? u.append(" commented on") : 2 == t.notifications[i].category ? u.append(" followed you") : 3 == t.notifications[i].category && u.append(" remixed"), 2 != t.notifications[i].category && $("<div />").addClass("messages-row-tone").data("tone_id", t.notifications[i].tone.id).text(t.notifications[i].tone.title + (1 == t.notifications[i].tone.version ? "" : " " + t.notifications[i].tone.version)).appendTo(l), 3 == t.notifications[i].category && $("<div />").addClass("messages-row-tone2").data("tone_id", t.notifications[i].tone2.id).html('<div><i class="fa fa-random fa-3x fa-fw" aria-hidden="true"></i>' + t.notifications[i].tone2.title + (1 == t.notifications[i].tone2.version ? "" : " " + t.notifications[i].tone2.version) + "</div>").appendTo(l), 1 == t.notifications[i].category && $("<div />").addClass("messages-row-preview").text('"' + t.notifications[i].message.slice(0, 40) + (t.notifications[i].message.length > 40 ? "..." : "") + '"').appendTo(l) | |
} | |
$(".messages-row-avatar div, .messages-row-user span").on("click", function() { | |
var e = $(this).data("username"); | |
showProfile(e) | |
}), $(".messages-row-tone, .messages-row-tone2").on("click", function() { | |
var e = parseInt($(this).data("tone_id")); | |
loadTone(e, !0, !0) | |
}) | |
} | |
function sendNewMessage() { | |
if (1 != messageSending) { | |
var e = $("#new_message_input").val(); | |
if (e.replace(/\s/g, "").length < 1) return void $("#new_message_input").focus(); | |
messageSending = !0, $("#new_message_submit_button").addClass("small-button-push-disabled").text("Sending..."); | |
var t = viewHistory.slice(viewHistory.length - 1, viewHistory.length)[0], | |
n = t.view_type_id; | |
$.ajax({ | |
url: "/api/1/send_message", | |
data: { | |
recipient: n, | |
message: e | |
}, | |
type: "POST", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
messageSending = !1, hideDialogs(), $("#new_message_submit_button").removeClass("small-button-push-disabled").html(" Send "), $("#new_message_input").val(""), 0 == e.success && showAlert("Error", e.error) | |
}, | |
error: function() { | |
showAlert("Error", "Unable to send message."), $("#new_message_submit_button").removeClass("small-button-push-disabled").html(" Send "), messageSending = !1 | |
} | |
}) | |
} | |
} | |
function sendMessage(e, t) { | |
if (1 != messageSending) { | |
if (t.replace(/\s/g, "").length < 1) return void $("#message_textarea").focus(); | |
messageSending = !0, $("#message_send_button").addClass("small-button-push-disabled").text("Sending..."), $.ajax({ | |
url: "/api/1/send_message", | |
data: { | |
recipient: e, | |
message: t | |
}, | |
type: "POST", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function(t) { | |
messageSending = !1, $("#message_send_button").removeClass("small-button-push-disabled").html(" Send "), $("#message_textarea").val(""), $("#message_textarea").blur(), 0 == t.success ? showAlert("Error", t.error) : loadMessage(e) | |
}, | |
error: function() { | |
showAlert("Error", "Unable to send message."), $("#message_send_button").removeClass("small-button-push-disabled").html(" Send "), messageSending = !1 | |
} | |
}) | |
} | |
} | |
function deleteMessage() { | |
if (1 != messageDeleting) { | |
messageDeleting = !0, $("#delete_message_submit_button").addClass("small-button-push-disabled").text("Archiving..."); | |
var e = viewHistory.slice(viewHistory.length - 1, viewHistory.length)[0], | |
t = e.view_type_id; | |
$.ajax({ | |
url: "/api/1/delete_message", | |
data: { | |
username: t | |
}, | |
type: "POST", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
messageDeleting = !1, hideDialogs(), $("#delete_message_submit_button").removeClass("small-button-push-disabled").text("Archive"), 0 == e.success ? showAlert("Error", e.error) : goBackViewHistory() | |
}, | |
error: function() { | |
showAlert("Error", "Unable to archive message."), $("#delete_message_submit_button").removeClass("small-button-push-disabled").text("Archive"), messageDeleting = !1 | |
} | |
}) | |
} | |
} | |
function showCreate(e, t) { | |
var e = "undefined" == typeof e || e, | |
t = "undefined" != typeof t && t; | |
hideMainMenu(), 1 == t && viewHistory.length > 0 && (viewHistory = [], loadToneCache = []), 1 == e && addToViewHistory("tone", tone.id), updatePageTitle(), updateUrlState(), selectView("create"), $(document).scrollTop(0) | |
} | |
function setupVisibilityEvent() { | |
var e, t, n; | |
"undefined" != typeof document.hidden ? (e = "hidden", n = "visibilitychange", t = "visibilityState") : "undefined" != typeof document.msHidden && (e = "msHidden", n = "msvisibilitychange", t = "msVisibilityState"); | |
var i = document[e]; | |
document.addEventListener(n, function() { | |
i != document[e] && (focussed = !document[e], i = document[e]) | |
}) | |
} | |
function saveTone() { | |
if (1 == editingTone) return void editTone(); | |
if (1 != toneSaving) { | |
if ($("#save_title").val().replace(/\s/g, "").length < 1) return void setTimeout(function() { | |
showSaveDialog("Please enter a valid title.") | |
}, 0); | |
toneSaving = !0, $("#save_title").val($.trim($("#save_title").val())), $("#save_notes").val($.trim($("#save_notes").val())), tone.title = $("#save_title").val(), tone.notes = $("#save_notes").val(), tone["private"] = $("#privacy_button_0 div").hasClass("dialog-radio-button-on"), 0 != tone.id && (tone.parent_id = tone.id), tone.liked = !1, tone.plays_count = 0, tone.favorites_count = 0, tone.comments_count = 0, tone.remix_count = 0, storeTone(); | |
for (var e = $.extend(!0, {}, tone), t = 0; t < e.bars.length; t++) delete e.bars[t].notes, delete e.bars[t].notes_start_index, delete e.bars[t].repeat_current, delete e.bars[t].undo, delete e.bars[t].redo; | |
hideDialogs(), showInfoAlert("Saving, please wait..."), $.ajax({ | |
url: "/api/1/save_tone", | |
data: { | |
tone: JSON.stringify(e), | |
bars: JSON.stringify(e.bars), | |
settings: JSON.stringify(e.settings), | |
color: e.color | |
}, | |
type: "POST", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
hideDialogs(), toneSaving = !1, tone.id = e.tone.id, | |
tone.url_title = e.tone.url_title, tone.version = e.tone.version, tone.date_timestamp = e.tone.date_timestamp, tone.user_id = e.tone.user_id, tone.user = e.tone.user, tone.parent_id = e.tone.parent_id, tone.parent_tone = e.parent_tone, tone.preset.id = tone.id, tone.preset.version = tone.version, tone.preset.title = tone.title, tone.preset.settings = JSON.parse(e.tone.settings), tone.original_bars = JSON.parse(JSON.stringify(tone.bars)), tone.original_tempo = tone.tempo, tone.original_preset_id = tone.preset.id, addToViewHistory("tone", tone.id), browseLastId = 0, loadBrowse(), loadToneCache = [], profileCache = [], profileTonesCache = [], setupToneSettings(), reloadInfoContent(), storeTone(), updatePageTitle(), updateUrlState(), setTimeout(function() { | |
showInfoSettings() | |
}, 400) | |
}, | |
error: function() { | |
hideDialogs(), toneSaving = !1 | |
} | |
}) | |
} | |
} | |
function editTone() { | |
if (1 != toneSaving) { | |
if ($("#save_title").val().replace(/\s/g, "").length < 1) return void setTimeout(function() { | |
showSaveDialog("Please enter a valid title.") | |
}, 0); | |
toneSaving = !0, $("#save_title").val($.trim($("#save_title").val())), $("#save_notes").val($.trim($("#save_notes").val())), tone.title = $("#save_title").val(), tone.notes = $("#save_notes").val(), tone["private"] = $("#privacy_button_0 div").hasClass("dialog-radio-button-on"), storeTone(), hideDialogs(), showInfoAlert("Saving, please wait..."), $.ajax({ | |
url: "/api/1/edit_tone/" + tone.id, | |
data: { | |
title: tone.title, | |
notes: tone.notes, | |
"private": tone["private"] | |
}, | |
type: "POST", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
hideDialogs(), toneSaving = !1, tone.url_title = e.tone.url_title, tone.version = e.tone.version, browseLastId = 0, loadBrowse(), loadToneCache = [], profileCache = [], profileTonesCache = [], storeTone(), updatePageTitle(), updateUrlState(); | |
var t = getLoadToneCacheIndex(tone.id); | |
t != -1 && loadToneCache.splice(t, 1), setTimeout(function() { | |
showInfoSettings() | |
}, 150) | |
}, | |
error: function() { | |
hideDialogs(), toneSaving = !1 | |
} | |
}) | |
} | |
} | |
function likeTone() { | |
return userLoggedIn() ? (0 == tone.liked ? ($("#like_button").addClass("medium-button-selected"), $("#like_button span").text("Liked")) : ($("#like_button").removeClass("medium-button-selected"), $("#like_button span").text("Like")), void $.ajax({ | |
url: "/api/1/like_tone/" + tone.id, | |
type: "POST", | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
0 == e.success ? showAlert("Error", "Unable to like tone.") : (tone.liked = e.liked, tone.favorites_count = e.likes, browseLastId = 0, browseKeepScrollPos = !0, loadBrowse(), profileCache = [], profileTonesCache = [], storeTone(), $("#tone_info_likes").text(tone.favorites_count), showInfoLikes()) | |
} | |
})) : void showRegisterDialog() | |
} | |
function likeProfileTone(e, t) { | |
if (!userLoggedIn()) return void showRegisterDialog(); | |
var n = $("#profile_like_" + e + "_" + t).data("tone_liked"), | |
i = $("#profile_like_" + e + "_" + t).data("tone_favs"); | |
null == n ? ($(".profile-like-" + e).data("tone_liked", !0).data("tone_favs", i + 1).addClass("small-button-like-selected"), $(".profile-like-" + e + " span").text(i + 1)) : ($(".profile-like-" + e).data("tone_liked", null).data("tone_favs", i - 1).removeClass("small-button-like-selected"), $(".profile-like-" + e + " span").text(i - 1 == 0 ? "Like" : i - 1)), $.ajax({ | |
url: "/api/1/like_tone/" + e, | |
type: "POST", | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
0 == e.success ? showAlert("Error", "Unable to like tone.") : (tone.liked = e.liked, tone.favorites_count = e.likes, browseLastId = 0, browseKeepScrollPos = !0, loadBrowse(), profileCache = [], profileTonesCache = [], updateInfoTabContent(), reloadInfoContent(), $("#tone_info_likes").text(tone.favorites_count), storeTone()) | |
} | |
}) | |
} | |
function deleteTone() { | |
stopPlaying(), hideDialogs(), $.ajax({ | |
url: "/api/1/delete_tone/" + tone.id, | |
type: "POST", | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
0 == e.success ? showAlert("Error", "Unable to delete tone.") : (stopPlaying(), tone = $.extend(!0, {}, toneTemplate), tone.preset.settings = JSON.parse(JSON.stringify(tone.settings)), currentBar = 0, currentTick = 0, animatingNotes = [], setupTone(), storeTone(), viewHistory = [], loadToneCache = [], profileCache = [], profileTonesCache = [], showHideBackButton(), addToViewHistory("tone", tone.id), presetsLastId = 0, browseKeepScrollPos = !0, browseLastId = 0, loadBrowse(), updatePageTitle(), updateUrlState()) | |
} | |
}) | |
} | |
function confirmLoadTone() { | |
0 != loadToneConfirmId ? (hideDialogs(), loadTone(loadToneConfirmId, !0, !0)) : (hideDialogs(), currentToneCopy = null, showCreate(), addToViewHistory("tone", tone.id)) | |
} | |
function loadTone(e, t, n, i, o) { | |
var t = "undefined" == typeof t || t, | |
n = "undefined" != typeof n && n, | |
i = "undefined" == typeof i || i, | |
o = "undefined" == typeof o || o; | |
if (1 == tone.edited && loadToneConfirmId != e && 1 == o) return $(".preset-row-selected-loading").removeClass("preset-row-selected-loading"), loadToneConfirmId = e, void showDialog("confirm_load"); | |
loadingToneId = e, "info" == settingsOpenSection && ($("#tone_info_content_wrap").hide(), $("#tone_info_loading").show()); | |
var s = getLoadToneCacheIndex(e); | |
if (s != -1) { | |
if (Math.floor(Date.now() / 1e3) - loadToneCache[s].timestamp < 120) { | |
1 == t && addToViewHistory("tone", e); | |
var a = JSON.parse(JSON.stringify(loadToneCache[s].tone_data)); | |
return processToneData(a, n, i, o), void(loadingToneId = 0) | |
} | |
loadToneCache.splice(s, 1) | |
} | |
$.ajax({ | |
url: "/api/1/get_tone/" + e, | |
type: "GET", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
if (0 == e.success) showAlert("Error", e.error), loadingToneId = 0; | |
else { | |
var s = e.tone; | |
if (s.id != loadingToneId) return; | |
1 == t && addToViewHistory("tone", s.id), s.parent_tone = e.parent_tone, s.liked = e.liked; | |
var a = getLoadToneCacheIndex(s.id); | |
a != -1 ? loadToneCache[a].tone_data = s : loadToneCache.push({ | |
tone_id: s.id, | |
tone_data: s, | |
timestamp: Math.floor(Date.now() / 1e3) | |
}), processToneData(s, n, i, o), loadingToneId = 0, loadToneConfirmId = 0 | |
} | |
} | |
}) | |
} | |
function loadTonePlayButton(e) { | |
currentToneCopy = JSON.stringify(tone), loadTone(e, !1, !1, !0, !1) | |
} | |
function getLoadToneCacheIndex(e) { | |
for (var t = -1, n = 0; n < loadToneCache.length; n++) | |
if (loadToneCache[n].tone_id == e) { | |
t = n; | |
break | |
} | |
return t | |
} | |
function getLoadToneCacheCount(e) { | |
for (var t = 0, n = 0; n < loadToneCache.length; n++) | |
if (loadToneCache[n].tone_id == e) { | |
t++; | |
break | |
} | |
return t | |
} | |
function processToneData(e, t, n, i) { | |
var t = "undefined" != typeof t && t, | |
n = "undefined" == typeof n || n, | |
i = "undefined" == typeof i || i; | |
loadToneWithData(e, n), $("#presets_wrap").html(""), presetsLastId = 0, "sound" == settingsOpenSection && "preset" == selectedSoundSetting && loadPresets(), $(".preset-row-selected-loading").removeClass("preset-row-selected-loading"), null != currentToneCopy && ($("#profile_play_" + tone.id + "_" + playItemId).addClass("profile-play-button-avatar-on"), $("#profile_play_" + tone.id + "_" + playItemId + " i").removeClass("fa-ellipsis-h fa-play").addClass("fa-pause")), updateInfoTabContent(), reloadInfoContent(), 1 == t && (showInfoSettings(!0), showInfoAbout()), 1 == i && showCreate() | |
} | |
function loadToneWithData(e, t) { | |
var t = "undefined" == typeof t || t; | |
tone = $.extend(!0, {}, toneTemplate), tone.id = e.id, tone.title = e.title, tone.url_title = e.url_title, tone.notes = e.notes, tone.user = e.user, tone.user_id = e.user_id, tone.tempo = e.tempo, tone.color = e.color, tone.plays_count = e.plays_count, tone.favorites_count = e.favorites_count, tone.comments_count = e.comments_count, tone.remix_count = e.remix_count, tone.version = e.version, tone.format = e.format, tone.date_timestamp = e.date_timestamp, tone.parent_id = e.parent_id, tone.parent_tone = e.parent_tone, tone["private"] = e["private"], tone.liked = e.liked, null != e.settings && (tone.settings = JSON.parse(e.settings)), tone.preset = { | |
id: tone.id, | |
title: tone.title, | |
version: 1, | |
edited: !1, | |
settings: JSON.parse(e.settings) | |
}, tone.bars = JSON.parse(e.bars), currentBar = 0, currentTick = 0, animatingNotes = [], setupTone(!0, t) | |
} | |
function setupTone(e, t) { | |
var e = "undefined" != typeof e && e, | |
t = "undefined" == typeof t || t; | |
"undefined" == typeof tone.settings.filter.rolloff && (tone.settings.filter.rolloff = 0), "undefined" == typeof tone.settings.probability && (tone.settings.probability = 1), "undefined" == typeof tone["private"] && (tone["private"] = !1), "undefined" == typeof tone.settings.delay.pingpong && (tone.settings.delay.pingpong = !0), "undefined" == typeof tone.edited && (tone.edited = !1), "undefined" == typeof tone.settings.volume.envelope.sustain && (tone.settings.volume.envelope.sustain = 0, tone.settings.volume.envelope.hold = 0, tone.settings.volume.envelope.release = 0, tone.settings.filter.envelope.sustain = 0, tone.settings.filter.envelope.hold = 0, tone.settings.filter.envelope.release = 0, tone.settings.filter.envelope.amount = 0), "undefined" == typeof tone.settings.pitch && (tone.settings.pitch = { | |
envelope: { | |
attack: .003, | |
decay: .4, | |
sustain: 0, | |
hold: 0, | |
release: 0, | |
amount: 0 | |
} | |
}), "undefined" == typeof tone.settings.filter.envelope.invert && (tone.settings.filter.envelope.invert = !1, tone.preset.settings.filter.envelope.invert = !1), "undefined" == typeof tone.settings.pitch.envelope.invert && (tone.settings.pitch.envelope.invert = !1, tone.preset.settings.pitch.envelope.invert = !1), tone.settings.filter.envelope.amount < 0 && (tone.settings.filter.envelope.amount = tone.settings.filter.envelope.amount * -1, tone.settings.filter.envelope.invert = !0, tone.preset.settings.filter.envelope.amount = tone.preset.settings.filter.envelope.amount * -1, tone.preset.settings.filter.envelope.invert = !0), tone.settings.pitch.envelope.amount < 0 && (tone.settings.pitch.envelope.amount = tone.settings.pitch.envelope.amount * -1, tone.settings.pitch.envelope.invert = !0, tone.preset.settings.pitch.envelope.amount = tone.preset.settings.pitch.envelope.amount * -1, tone.preset.settings.pitch.envelope.invert = !0), "undefined" == typeof tone.settings.noise.resonance && (tone.settings.noise = { | |
level: 0, | |
lowcut: 0, | |
highcut: 1, | |
resonance: 0 | |
}), "undefined" == typeof tone.settings.noise.highcut && (tone.settings.noise.lowcut = 0, tone.settings.noise.highcut = JSON.parse(JSON.stringify(tone.settings.noise.cutoff)), delete tone.settings.noise.cutoff), "undefined" == typeof tone.preset.settings.noise.highcut && (tone.preset.settings.noise.lowcut = 0, tone.preset.settings.noise.highcut = JSON.parse(JSON.stringify(tone.preset.settings.noise.cutoff)), delete tone.preset.settings.noise.cutoff), 1 == tone.format && "undefined" == typeof tone.settings.lfo.volume.sync && (tone.settings.lfo = { | |
volume: { | |
sync: !0, | |
duration: "1/8", | |
frequency: 6.4, | |
level: 0, | |
waveform: "sine" | |
}, | |
pitch: { | |
sync: !0, | |
duration: "1/8", | |
frequency: 6.4, | |
level: 0, | |
waveform: "sine" | |
}, | |
cutoff: { | |
sync: !0, | |
duration: "1/8", | |
frequency: 6.4, | |
level: 0, | |
waveform: "sine" | |
} | |
}), ("undefined" == typeof tone.color || null == tone.color || tone.color < 0 || tone.color >= colors.length) && (tone.color = 3), tone.settings.delay.pingpong = !0, tone.settings.filter.rolloff = 1; | |
for (var n = 0; n < tone.bars.length; n++) { | |
tone.bars[n].grid = [], tone.bars[n].repeat_current = 0, "undefined" == typeof tone.bars[n].drums && (tone.bars[n].drums = !1); | |
for (var i = tone.bars[n].matrix.split(","), o = 0; o < i.length; o++) { | |
var s = i[o].split(""); | |
tone.bars[n].grid.push(s) | |
} | |
tone.bars[n].undo = [], tone.bars[n].redo = [] | |
} | |
"undefined" == typeof tone.original_bars && (tone.original_bars = JSON.parse(JSON.stringify(tone.bars)), tone.original_tempo = tone.tempo, tone.original_preset_id = tone.preset.id); | |
for (var n = 0; n < tone.bars.length; n++) generateScaleNotes(n); | |
tempo = tone.tempo, 1 == e ? updateToneSettings(t) : setupToneSettings(), drawBackCanvas(), drawBars(), setTimeout(function() { | |
selectBar(currentBar, !0, !1) | |
}, 10), $(".sliders .noUi-connect").css("background", getColor(.8)), $("#matrix").css("background-color", getColor()), storeTone(), updateSaveButton(), updatePageTitle(), updateUrlState() | |
} | |
function setupToneSettings(e) { | |
var e = "undefined" != typeof e && e; | |
updateSoundSettings(), drawSelectedLfoTab(), updateFilterAmountSlider(), updatePitchAmountSlider(), updateFilter(e), updateReverb(), updateNoise(e), setTimeout(function() { | |
updateDelay(e) | |
}, 70), updateSettingsLabels(), updateSoundSettingsLabels(), updateLfoSettingsLabels(), voiceUpdateNeeded = !0 | |
} | |
function playTone() { | |
if (0 != playing) { | |
restartLFOs(), tone.bars[currentBar].repeat > 1 && $("#bar_" + currentBar + " .bar-repeat span").text(tone.bars[currentBar].repeat_current + 1 + " /"), null != changeTempoTo && currentTick % 1 == 0 && (tone.tempo = changeTempoTo, tempo = tone.tempo, changeTempoTo = null, startWorkerTimer()), 0 == currentTick && (needleX.grid = 0, needleX.bar = 0, null != changeBarTo && (0 != repeatBar && null == currentToneCopy || (animatingNotes = [], selectBar(changeBarTo, !0, !0, !0, !1)), changeBarTo = null)), playDrums(), 1 == tone.bars[currentBar].drums && currentTick % 4 == 0 && "notes" == settingsOpenSection; | |
for (var e = 0; e < tone.bars[currentBar].grid.length; e++) 1 == tone.bars[currentBar].grid[e][currentTick] && playNote(e); | |
currentTick++, currentTick >= 16 && (tone.bars[currentBar].repeat_current++, tone.bars[currentBar].repeat_current >= tone.bars[currentBar].repeat && (tone.bars[currentBar].repeat_current = 0, 0 != repeatBar && null == currentToneCopy || (barFrontContexts[currentBar].clearRect(0, 0, barSize, barSize), changeBarTo = currentBar + 1, changeBarTo >= tone.bars.length && (changeBarTo = 0))), currentTick = 0) | |
} | |
} | |
function playNote(e) { | |
var t = randomIntFromInterval(0, 99); | |
if (!(t / 100 >= tone.settings.probability)) { | |
1 == focussed && animatingNotes.push({ | |
grid_x: currentTick, | |
grid_y: e, | |
bar: currentBar, | |
tick: animatingTicks, | |
hover: !1 | |
}), setupVoices(), 1 == voiceUpdateNeeded && (updateVoices(), voiceUpdateNeeded = !1); | |
var n = audioContext.currentTime + startTimeOffset; | |
n += randomIntFromInterval(0, soundSettings.humanize.attack) / 100; | |
var i = getScaleNote(currentBar, 15 - e), | |
o = i.frequency(); | |
o = parseFloat(o.toFixed(3)), voices[e].osc.frequency.setValueAtTime(o, n), applyVolumeEnvelope(e, n), applyFilterEnvelope(e, n), applyPitchEnvelope(e, n) | |
} | |
} | |
function applyVolumeEnvelope(e, t, n) { | |
var i = tone.settings.volume.envelope.attack, | |
o = (tone.settings.volume.envelope.hold, tone.settings.volume.envelope.decay), | |
s = tone.settings.volume.envelope.sustain, | |
a = tone.settings.volume.envelope.release, | |
r = tone.settings.volume.level, | |
n = r; | |
n += randomIntFromInterval(0, soundSettings.humanize.volume) / 100; | |
var l = 0; | |
tone.bars[currentBar].octave > 5 && (l = n * ((tone.bars[currentBar].octave - 5) / 12) + 0), n > 1 && (n = 1), n < 0 && (n = 0); | |
var u = n * s; | |
voices[e].envelope.gain.cancelScheduledValues(t), voices[e].envelope.gain.setTargetAtTime(n, t, secondsToTimeConstant(i)), voices[e].envelope.gain.setTargetAtTime(u, t + i, secondsToTimeConstant(o)), voices[e].envelope.gain.setTargetAtTime(0, t + i + o, secondsToTimeConstant(a)) | |
} | |
function applyFilterEnvelope(e, t) { | |
var n = tone.settings.filter.envelope.attack, | |
i = (tone.settings.filter.envelope.hold, tone.settings.filter.envelope.decay), | |
o = tone.settings.filter.envelope.sustain, | |
s = tone.settings.filter.envelope.release, | |
a = tone.settings.filter.envelope.amount; | |
1 == tone.settings.filter.envelope.invert && (a = -a); | |
var r = 12e3 * a, | |
l = r * o; | |
return voices[e].filter.detune.cancelScheduledValues(t), voices[e].filter2.detune.cancelScheduledValues(t), 0 == a ? (voices[e].filter.detune.setValueAtTime(0, t), void voices[e].filter2.detune.setValueAtTime(0, t)) : (voices[e].filter.detune.setTargetAtTime(r, t, secondsToTimeConstant(n)), voices[e].filter2.detune.setTargetAtTime(r, t, secondsToTimeConstant(n)), voices[e].filter.detune.setTargetAtTime(l, t + n, secondsToTimeConstant(i)), voices[e].filter2.detune.setTargetAtTime(l, t + n, secondsToTimeConstant(i)), voices[e].filter.detune.setTargetAtTime(0, t + n + i, secondsToTimeConstant(s)), void voices[e].filter2.detune.setTargetAtTime(0, t + n + i, secondsToTimeConstant(s))) | |
} | |
function applyPitchEnvelope(e, t) { | |
var n = tone.settings.pitch.envelope.attack, | |
i = (tone.settings.pitch.envelope.hold, tone.settings.pitch.envelope.decay), | |
o = tone.settings.pitch.envelope.sustain, | |
s = tone.settings.pitch.envelope.release, | |
a = tone.settings.pitch.envelope.amount; | |
1 == tone.settings.pitch.envelope.invert && (a = -a); | |
var r = 0, | |
l = r + 10800 * a, | |
u = l * o; | |
return voices[e].osc.detune.cancelScheduledValues(t), 0 == a ? void voices[e].osc.detune.setValueAtTime(r, t) : (voices[e].osc.detune.setTargetAtTime(l, t, secondsToTimeConstant(n)), voices[e].osc.detune.setTargetAtTime(u, t + n, secondsToTimeConstant(i)), void voices[e].osc.detune.setTargetAtTime(r, t + n + i, secondsToTimeConstant(s))) | |
} | |
function setupAudio() { | |
try { | |
null == audioContext && (audioContext = getAudioContext()) | |
} catch (e) { | |
return void alert("Web Audio API is not supported.") | |
} | |
tuna = new Tuna(audioContext), mixer = audioContext.createGain(), mixer.gain.value = 1, master = audioContext.createGain(), master.gain.value = .1, master2 = audioContext.createGain(), master2.gain.value = 1, pingPongDelay = new tuna.PingPongDelay({ | |
bypass: 0, | |
dryLevel: 1, | |
wetLevel: 0, | |
feedback: tone.settings.delay.feedback, | |
lowCut: tone.settings.delay.lowcut, | |
highCut: tone.settings.delay.highcut, | |
delayTimeLeft: 150, | |
delayTimeRight: 200 | |
}), updateDelay(), reverb = new tuna.Convolver({ | |
bypass: 0, | |
highCut: 22050, | |
lowCut: 22050, | |
dryLevel: 1, | |
wetLevel: 0, | |
level: 1, | |
impulse: "https://d8ev4i00v2x30.cloudfront.net/assets/reverb-481f2c0ff786e1606c28602dbdb8e968f6831a215ac1f8e43c0b93b045b42735.mp3" | |
}), updateReverb(), setupNoise(), noise.mixer = audioContext.createGain(), noise.filterLow = audioContext.createBiquadFilter(), noise.filterHigh = audioContext.createBiquadFilter(), noise.filterLow.type = "highpass", noise.filterHigh.type = "lowpass", setNoiseFilterLowFrequency(0), setNoiseFilterHighFrequency(1), setNoiseFilterQ(0), noise.source.connect(noise.mixer), noise.mixer.connect(noise.filterLow), noise.filterLow.connect(noise.filterHigh), 1 == spectrumEnabled && (analyser = audioContext.createAnalyser(), analyser.fftSize = 2048, analyser.smoothingTimeConstant = .9, analyser.minDecibels = -90, analyser.maxDecibels = -7, oscilloscope = new Oscilloscope(analyser, canvasSize, canvasSize)), master.connect(pingPongDelay), pingPongDelay.connect(master2), master2.connect(reverb), 1 == spectrumEnabled && master2.connect(analyser), reverb.connect(mixer), mixer.connect(audioContext.destination) | |
} | |
function refreshDelaySetup() { | |
try { | |
master.disconnect(), pingPongDelay.disconnect(), pingPongDelay = null | |
} catch (e) {} | |
pingPongDelay = new tuna.PingPongDelay({ | |
bypass: 0, | |
dryLevel: 1, | |
wetLevel: 0, | |
feedback: tone.settings.delay.feedback, | |
lowCut: tone.settings.delay.lowcut, | |
highCut: tone.settings.delay.highcut, | |
delayTimeLeft: 150, | |
delayTimeRight: 200 | |
}), updateDelay(), master.connect(pingPongDelay), pingPongDelay.connect(master2) | |
} | |
function setupNoise() { | |
noise.source = audioContext.createBufferSource(); | |
for (var e = 2 * audioContext.sampleRate, t = audioContext.createBuffer(1, e, audioContext.sampleRate), n = t.getChannelData(0), i = 0; i < e; i++) n[i] = 2 * Math.random() - 1; | |
noise.source.buffer = t, noise.source.loop = !0, noise.source.noteOn ? noise.source.noteOn(0) : noise.source.start(0) | |
} | |
function updateFilter(e) { | |
var e = "undefined" != typeof e && e; | |
updateFilterFrequency(e), updateFilterResonance(e) | |
} | |
function updateFilterFrequency(e) { | |
for (var e = "undefined" != typeof e && e, t = audioContext.sampleRate / 2, n = 0; n < voices.length; n++) null != voices[n] && (t = getFilterFrequency(tone.settings.filter.cutoff), voices[n].filter.frequency.cancelScheduledValues(audioContext.currentTime), voices[n].filter2.frequency.cancelScheduledValues(audioContext.currentTime), 0 == e ? voices[n].filter.frequency.setValueAtTime(t, audioContext.currentTime) : voices[n].filter.frequency.setTargetAtTime(t, audioContext.currentTime, secondsToTimeConstant(smoothTimeFilter)), 0 == tone.settings.filter.rolloff && (t = audioContext.sampleRate / 2), 0 == e ? voices[n].filter2.frequency.setValueAtTime(t, audioContext.currentTime) : voices[n].filter2.frequency.setTargetAtTime(t, audioContext.currentTime, secondsToTimeConstant(smoothTimeFilter))) | |
} | |
function updateFilterResonance(e) { | |
for (var e = "undefined" != typeof e && e, t = 0, n = 0; n < voices.length; n++) null != voices[n] && (t = getFilterQ(tone.settings.filter.resonance), voices[n].filter.Q.cancelScheduledValues(audioContext.currentTime), voices[n].filter2.Q.cancelScheduledValues(audioContext.currentTime), 0 == e ? voices[n].filter.Q.setValueAtTime(t, audioContext.currentTime) : voices[n].filter.Q.setTargetAtTime(t, audioContext.currentTime, secondsToTimeConstant(smoothTimeFilter)), 0 == tone.settings.filter.rolloff && (t = 0), 0 == e ? voices[n].filter2.Q.setValueAtTime(t, audioContext.currentTime) : voices[n].filter2.Q.setTargetAtTime(t, audioContext.currentTime, secondsToTimeConstant(smoothTimeFilter))) | |
} | |
function updateDelay(e) { | |
setDelayPingPong(tone.settings.delay.pingpong), setDelayDuration(tone.settings.delay.duration), setDelayFeedback(tone.settings.delay.feedback), setDelayMix(tone.settings.delay.level), setDelayFilterLow(tone.settings.delay.lowcut), setDelayFilterHigh(tone.settings.delay.highcut) | |
} | |
function updateReverb() { | |
setReverbMix(tone.settings.reverb.level), setReverbFilterLow(tone.settings.reverb.lowcut), setReverbFilterHigh(tone.settings.reverb.highcut) | |
} | |
function updateNoise(e) { | |
var e = "undefined" != typeof e && e; | |
setNoiseFilterLowFrequency(tone.settings.noise.lowcut, e), setNoiseFilterHighFrequency(tone.settings.noise.highcut, e), setNoiseFilterQ(tone.settings.noise.resonance, e) | |
} | |
function setupVoices() { | |
if (null == voices[0]) { | |
for (var e = 0; e < 16; e++) voices[e] = { | |
note_index: e, | |
osc: audioContext.createOscillator(), | |
envelope: audioContext.createGain(), | |
filter: audioContext.createBiquadFilter(), | |
filter2: audioContext.createBiquadFilter(), | |
noise: null | |
}, voices[e].envelope.gain.value = 0, voices[e].filter.type = "lowpass", voices[e].filter2.type = "lowpass", voices[e].noise = audioContext.createGain(), voices[e].noise.gain.value = 0, noise.filterHigh.connect(voices[e].noise), voices[e].noise.connect(voices[e].filter), voices[e].osc.connect(voices[e].filter), voices[e].filter.connect(voices[e].filter2), voices[e].filter2.connect(voices[e].envelope), voices[e].envelope.connect(master), voices[e].osc.start(audioContext.currentTime); | |
setupLFOs() | |
} | |
} | |
function updateVoices() { | |
for (var e = 0; e < voices.length; e++) updateVoice(e) | |
} | |
function updateVoice(e) { | |
voices[e].osc.type = tone.settings.oscillator.waveform, voices[e].noise.gain.value = tone.settings.noise.level; | |
var t = getFilterFrequency(tone.settings.filter.cutoff), | |
n = getFilterQ(tone.settings.filter.resonance); | |
voices[e].filter.frequency.value = t, voices[e].filter2.frequency.value = t, voices[e].filter.Q.value = n, voices[e].filter2.Q.value = n, 0 == tone.settings.filter.rolloff && (voices[e].filter2.frequency.value = audioContext.sampleRate / 2, voices[e].filter2.Q.value = 0) | |
} | |
function setupLFOs() { | |
if (!(LFOs.length > 0)) { | |
for (var e = 0; e < 3; e++) LFOs[e] = { | |
oscillator: audioContext.createOscillator(), | |
amp: audioContext.createGain(), | |
target_amp: audioContext.createGain() | |
}, LFOs[e].oscillator.connect(LFOs[e].amp), LFOs[e].amp.connect(LFOs[e].target_amp); | |
startLFOs() | |
} | |
} | |
function updateLFOs() { | |
for (var e = 0; e < LFOs.length; e++) setLfoWaveform(e, getLfoSettings(e).waveform, !1), 1 == getLfoSettings(e).sync ? setLfoDuration(e, getLfoSettings(e).duration, !1) : setLfoFrequency(e, getLfoSettings(e).frequency), setLfoTargetLevel(e) | |
} | |
function startLFOs() { | |
for (var e = 0; e < LFOs.length; e++) startLFO(e) | |
} | |
function startLFO(e) { | |
try { | |
2 == LFOs[e].oscillator.playbackState && LFOs[e].oscillator.stop(0), LFOs[e].oscillator.disconnect(), LFOs[e].oscillator = null | |
} catch (e) {} | |
setupLfoTarget(e), LFOs[e].oscillator = audioContext.createOscillator(), setLfoWaveform(e, getLfoSettings(e).waveform, !1), 1 == getLfoSettings(e).sync ? setLfoDuration(e, getLfoSettings(e).duration, !1) : setLfoFrequency(e, getLfoSettings(e).frequency), LFOs[e].oscillator.connect(LFOs[e].amp), LFOs[e].oscillator.noteOn ? LFOs[e].oscillator.noteOn(0) : LFOs[e].oscillator.start(0) | |
} | |
function restartLFOs() { | |
if (0 != restartLFO && 0 == currentTick) { | |
for (var e = 0; e < LFOs.length; e++) startLFO(e); | |
restartLFO = !1 | |
} | |
} | |
function setupLfoTarget(e) { | |
LFOs[e].target_amp.disconnect(), LFOs[e].target_amp.gain.cancelScheduledValues(audioContext.currentTime), LFOs[e].target_amp.gain.linearRampToValueAtTime(0, audioContext.currentTime + .02), setTimeout(function() { | |
if (LFOs[e].target_amp.gain.cancelScheduledValues(audioContext.currentTime), LFOs[e].target_amp.gain.setValueAtTime(0, audioContext.currentTime), 0 == e) LFOs[e].target_amp.connect(master2.gain); | |
else if (1 == e) | |
for (var t = 0; t < voices.length; t++) LFOs[e].target_amp.connect(voices[t].osc.detune); | |
else | |
for (var t = 0; t < voices.length; t++) LFOs[e].target_amp.connect(voices[t].filter.detune), LFOs[e].target_amp.connect(voices[t].filter2.detune); | |
setLfoTargetLevel(e) | |
}, 30) | |
} | |
function setLfoDuration(e, t, n) { | |
var n = "undefined" == typeof n || n; | |
if (0 != LFOs.length) { | |
var i = getDelayInfo(t); | |
setLfoFrequency(e, i.frequency), 1 == n && (restartLFO = !0) | |
} | |
} | |
function setLfoFrequency(e, t) { | |
0 != LFOs.length && (LFOs[e].oscillator.frequency.value = parseFloat(t).toFixed(3), 0 == t ? LFOs[e].amp.gain.value = 0 : LFOs[e].amp.gain.value = 1) | |
} | |
function setLfoTargetLevel(e) { | |
0 != LFOs.length && (0 == e ? setLfoVolume(e, getLfoSettings(e).level) : 1 == e ? setLfoPitch(e, getLfoSettings(e).level) : setLfoFilter(e, getLfoSettings(e).level)) | |
} | |
function setLfoWaveform(e, t, n) { | |
var n = "undefined" == typeof n || n; | |
0 != LFOs.length && ("sawtooth2" == t && (t = "sawtooth"), LFOs[e].oscillator.type != t && (LFOs[e].oscillator.type = t), 1 == n && (restartLFO = !0)) | |
} | |
function setLfoVolume(e, t) { | |
0 != LFOs.length && (LFOs[e].target_amp.gain.cancelScheduledValues(audioContext.currentTime), LFOs[e].target_amp.gain.linearRampToValueAtTime(t, audioContext.currentTime + 0)) | |
} | |
function setLfoPitch(e, t) { | |
0 != LFOs.length && (LFOs[e].target_amp.gain.cancelScheduledValues(audioContext.currentTime), LFOs[e].target_amp.gain.linearRampToValueAtTime(3100 * t, audioContext.currentTime + 0)) | |
} | |
function setLfoFilter(e, t) { | |
if (0 != LFOs.length) { | |
var n = 6e3 * t; | |
LFOs[e].target_amp.gain.cancelScheduledValues(audioContext.currentTime), LFOs[e].target_amp.gain.linearRampToValueAtTime(n, audioContext.currentTime + 0) | |
} | |
} | |
function getLfoSettings(e) { | |
return 0 == e ? tone.settings.lfo.volume : 1 == e ? tone.settings.lfo.pitch : tone.settings.lfo.cutoff | |
} | |
function getLfoPresetSettings(e) { | |
return 0 == e ? tone.preset.settings.lfo.volume : 1 == e ? tone.preset.settings.lfo.pitch : tone.preset.settings.lfo.cutoff | |
} | |
function getTotalActiveLfos() { | |
for (var e = 0, t = 0; t < LFOs.length; t++) 1 == isLfoActive(t) && e++; | |
return e | |
} | |
function isLfoActive(e) { | |
var t = tone.settings.lfo.volume; | |
return 1 == e ? t = tone.settings.lfo.pitch : 2 == e && (t = tone.settings.lfo.cutoff), t.level > 0 | |
} | |
function loadSamples() { | |
var e = new XMLHttpRequest; | |
e.open("GET", "https://d8ev4i00v2x30.cloudfront.net/assets/BD0050-7f25e10c782f4a99c57ca346743a912e9104a414a3a22d06595329b3370d4362.WAV", !0), e.responseType = "arraybuffer", e.onload = function() { | |
audioContext.decodeAudioData(e.response, function(e) { | |
e && (bdBuffer = e) | |
}) | |
}, e.onerror = function() {}, e.send() | |
} | |
function playDrums() { | |
if (0 != tone.bars[currentBar].drums && 0 != playing && null != bdBuffer && currentTick % 4 == 0) { | |
var e = audioContext.createGain(); | |
e.gain.value = tone.settings.drums.bd, 1 == spectrumEnabled && e.connect(analyser), e.connect(audioContext.destination); | |
var t = audioContext.createBufferSource(); | |
t.connect(e), t.buffer = bdBuffer, t.start(audioContext.currentTime + startTimeOffset) | |
} | |
} | |
function startWorkerTimer() { | |
updateAnimatingTicks(), stopWorkerTimer(), timerWorker.postMessage({ | |
start: !0, | |
ms: 6e4 / tempo / 4 | |
}) | |
} | |
function stopWorkerTimer() { | |
timerWorker.postMessage({ | |
stop: !0 | |
}) | |
} | |
function updateAnimatingTicks() { | |
animatingNotes = [], animatingTicks = scale(tempo, tempoMin, tempoMax, 140, 15) | |
} | |
function getTapTempo() { | |
var e = new Date, | |
t = e.getTime(), | |
n = tempo; | |
if (t - tapTempoTimePrev > 2e3 && (tapTempoCount = 0), 0 == tapTempoCount) tapTempoTimeFirst = t, tapTempoCount = 1; | |
else { | |
var i = 6e4 * tapTempoCount / (t - tapTempoTimeFirst); | |
n = Math.floor(Math.round(100 * i) / 100), n < tempoMin && (n = tempoMin), n > tempoMax && (n = tempoMax), tapTempoCount++ | |
} | |
return tapTempoTimePrev = t, n | |
} | |
function setupMatrix() { | |
var e = $("#matrix").html(""); | |
$("#matrix").css("background-color", getColor()), e.height(canvasSize), $("#layout_matrix").width(canvasSize).height(canvasSize), canvasBack = createCanvas("canvas_back", canvasSize, canvasSize), canvasBackContext = canvasBack[0].getContext("2d"), canvasFront = createCanvas("canvas_front", canvasSize, canvasSize), canvasFrontContext = canvasFront[0].getContext("2d"), e.append(canvasBack).append(canvasFront); | |
var t = "mousedown", | |
n = "mousemove", | |
i = "mouseup"; | |
isMobileDevice() && (t = "touchstart", n = "touchmove", i = "touchend"), e.off(t).on(t, function(e) { | |
if ("mousedown" != e.type || 1 === e.which) { | |
touchedCell = !0; | |
var t = { | |
x: 0, | |
y: 0 | |
}; | |
if ("touchstart" == e.type) { | |
var n = e.originalEvent; | |
t = { | |
x: n.touches[n.touches.length - 1].pageX - $(this).offset().left, | |
y: n.touches[n.touches.length - 1].pageY - $(this).offset().top | |
} | |
} else t = { | |
x: e.pageX - $(this).offset().left, | |
y: e.pageY - $(this).offset().top | |
}; | |
var i = canvasPadding, | |
o = getMatrixPadding(); | |
i += Math.ceil(o / 2); | |
var s = (canvasSize - 2 * canvasPadding) / 16, | |
a = Math.floor((t.x - canvasPadding) / s), | |
r = Math.floor((t.y - i) / s); | |
a < 0 && (a = 0), r < 0 && (r = 0), a > 15 && (a = 15), r > 15 && (r = 15), touchedCellActive = 1 == tone.bars[currentBar].grid[r][a], toggleGridCell(a, r), storeTone(), drawBackCanvas() | |
} | |
}), e.off(n).on(n, function(e) { | |
var t = { | |
x: 0, | |
y: 0 | |
}; | |
if ("touchmove" == e.type) { | |
var n = e.originalEvent; | |
t = { | |
x: n.touches[n.touches.length - 1].pageX - $(this).offset().left, | |
y: n.touches[n.touches.length - 1].pageY - $(this).offset().top | |
} | |
} else t = { | |
x: e.pageX - $(this).offset().left, | |
y: e.pageY - $(this).offset().top | |
}; | |
var i = canvasPadding, | |
o = getMatrixPadding(); | |
i += Math.ceil(o / 2); | |
var s = (canvasSize - 2 * canvasPadding) / 16, | |
a = Math.floor((t.x - canvasPadding) / s), | |
r = Math.floor((t.y - i) / s); | |
if (a < 0 && (a = 0), r < 0 && (r = 0), a > 15 && (a = 15), r > 15 && (r = 15), a != moveGridX || r != moveGridY) { | |
var l = !0; | |
tone.bars[currentBar].grid[r][a] == (1 == touchedCellActive ? 0 : 1) && (l = !1), moveGridX = a, moveGridY = r, 1 == touchedCell && 1 == l && (setGridCell(a, r, 1 == touchedCellActive ? 0 : 1), storeTone(), drawBackCanvas()), "mousemove" == e.type && 1 == focussed && (hoverGridX = a, hoverGridY = r, animatingNotes.push({ | |
grid_x: a, | |
grid_y: r, | |
bar: currentBar, | |
tick: 1, | |
hover: !0 | |
})) | |
} | |
}), e.off(i).on(i, function() { | |
touchedCell = !1, moveGridX = -1, moveGridY = -1 | |
}), e.off("mouseleave").on("mouseleave", function() { | |
hoverGridX = -1, hoverGridY = -1 | |
}), setTimeout(function() { | |
var e = canvasSize, | |
t = $("#matrix_overlay"); | |
t.width(canvasSize), t.height(e) | |
}, 10) | |
} | |
function getMatrixPadding() { | |
return 0 | |
} | |
function toggleGridCell(e, t) { | |
setGridCell(e, t, 1 == tone.bars[currentBar].grid[t][e] ? 0 : 1) | |
} | |
function setGridCell(e, t, n) { | |
if (addToHistory(currentBar), tone.bars[currentBar].grid[t][e] = n.toString(), 0 == n && removeAnimatingNotes(currentBar, e, t), regenerateMatrix(currentBar), updateEditButtons(currentBar), drawBarCanvas(currentBar, $("#canvas_back_bar_" + currentBar)[0].getContext("2d"), barSize), currentBar == tone.bars.length - 1) { | |
var i = $("#canvas_bar_new")[0].getContext("2d"); | |
drawBarCanvas(tone.bars.length - 1, i, barSize) | |
} | |
updateToneEdited() | |
} | |
function removeAnimatingNotes(e, t, n) { | |
for (var i = 0; i < animatingNotes.length; i++) animatingNotes[i].grid_x == t && animatingNotes[i].grid_y == n && animatingNotes[i].bar == e && (animatingNotes.splice(i, 1), i--) | |
} | |
function regenerateMatrix(e) { | |
tone.bars[e].matrix = ""; | |
for (var t = 0; t < tone.bars[e].grid.length; t++) { | |
for (var n = 0; n < tone.bars[e].grid[t].length; n++) tone.bars[e].matrix += "" + tone.bars[e].grid[t][n]; | |
t < 15 && (tone.bars[e].matrix += ",") | |
} | |
} | |
function drawBackCanvas() { | |
canvasBackContext.clearRect(0, 0, canvasSize, canvasSize), canvasBackContext.fillStyle = getColor(1), canvasBackContext.fillRect(0, 0, canvasSize, canvasSize); | |
for (var e = 0; e < tone.bars[currentBar].grid.length; e++) | |
for (var t = 0; t < tone.bars[currentBar].grid[e].length; t++) { | |
var n = (canvasSize - 2 * canvasPadding) / 16, | |
i = n / 2 - 1, | |
o = n * t + n / 2 + canvasPadding, | |
s = n * e + n / 2 + canvasPadding, | |
a = "rgba(0,0,0,0.05)"; | |
1 == tone.bars[currentBar].grid[e][t] && (a = "rgba(255,255,255,0.75)", i = n / 2 - 1), drawCircle(canvasBackContext, o, s, i, a, 1, !1) | |
} | |
} | |
function drawFrontCanvas() { | |
var e = currentBar - 1; | |
e < 0 && (e = tone.bars.length - 1); | |
var t = barFrontContexts[currentBar], | |
n = barFrontContexts[e]; | |
if (0 == spectrumEnabled && canvasFrontContext.clearRect(0, 0, canvasSize, canvasSize), t.clearRect(0, 0, barSize, barSize), n.clearRect(0, 0, barSize, barSize), 0 != focussed) { | |
updateNeedlePosition(), 1 == playing && (drawNeedle(canvasFrontContext), drawNeedle(t, !0)); | |
var i, o, s, a, r; | |
if (hoverGridX != -1 && hoverGridY != -1 && 1 != tone.bars[currentBar].grid[hoverGridY][hoverGridX]) { | |
var r = "rgba(0,0,0,0.11)", | |
i = (canvasSize - 2 * canvasPadding) / 16, | |
o = i / 2, | |
s = i * hoverGridX + i / 2 + canvasPadding, | |
a = i * hoverGridY + i / 2 + canvasPadding; | |
drawCircle(canvasFrontContext, s, a, o, r, 1, !1), i = (barSize - 2 * barPadding) / 16, o = i / 2, s = i * hoverGridX + i / 2 + barPadding, a = i * hoverGridY + i / 2 + barPadding, drawCircle(t, s, a, o, r, 1, !1) | |
} | |
for (var l = 0; l < animatingNotes.length; l++) { | |
var i = (canvasSize - 2 * canvasPadding) / 16, | |
o = i / 2 + animatingEnlarge * (animatingNotes[l].tick / animatingTicks), | |
s = i * animatingNotes[l].grid_x + i / 2 + canvasPadding, | |
a = i * animatingNotes[l].grid_y + i / 2 + canvasPadding, | |
r = "rgba(255,255,255,1)"; | |
if (animatingNotes[l].bar != currentBar && (r = getColor(0)), animatingNotes[l].bar != currentBar, 1 == animatingNotes[l].hover) { | |
if (r = "rgba(1,2,4,0.04)", r = "rgba(1,2,4,0)", 1 == tone.bars[currentBar].grid[animatingNotes[l].grid_y][animatingNotes[l].grid_x]) continue; | |
if (animatingNotes[l].grid_x == hoverGridX && animatingNotes[l].grid_y == hoverGridY) continue | |
} | |
r = "rgba(255,255,255," + 1 * (animatingNotes[l].tick / animatingTicks) + ")", drawCircle(canvasFrontContext, s, a, o, r, 1, !1), o = i / 2 + (animatingExpand - animatingExpand * (animatingNotes[l].tick / animatingTicks)), r = "rgba(255,255,255," + animatingExpandOpacity * (animatingNotes[l].tick / animatingTicks) + ")", drawCircle(canvasFrontContext, s, a, o, r, 1, !1), i = (barSize - 2 * barPadding) / 16, o = i / 2 + animatingEnlargeBar * (animatingNotes[l].tick / animatingTicks), s = i * animatingNotes[l].grid_x + i / 2 + barPadding, a = i * animatingNotes[l].grid_y + i / 2 + barPadding, r = "rgba(255,255,255,1)", r = "rgba(255,255,255," + 1 * (animatingNotes[l].tick / animatingTicks) + ")", 1 == animatingNotes[l].hover && (r = "rgba(1,2,4,0.04)", r = "rgba(1,2,4,0)"), animatingNotes[l].bar == currentBar ? drawCircle(t, s, a, o, r, 1, !1) : drawCircle(n, s, a, o, r, 1, !1), o = i / 2 + (animatingExpandBar - animatingExpandBar * (animatingNotes[l].tick / animatingTicks)), r = "rgba(255,255,255," + animatingExpandOpacity * (animatingNotes[l].tick / animatingTicks) + ")", animatingNotes[l].bar == currentBar ? drawCircle(t, s, a, o, r, 1, !1) : drawCircle(n, s, a, o, r, 1, !1) | |
} | |
} | |
} | |
function updateNeedlePosition() { | |
now = Date.now(), delta = (now - then) / 1e3, then = now; | |
var e = .25 * (60 / tempo / 4), | |
t = 16 * e, | |
n = (canvasSize - 2 * canvasPadding) / 4, | |
i = (barSize - 2 * barPadding) / 4, | |
o = n / t, | |
s = i / t; | |
needleX.grid = needleX.grid + o * delta, needleX.bar = needleX.bar + s * delta | |
} | |
function drawNeedle(e, t) { | |
var t = "undefined" != typeof t && t, | |
n = currentTick - 1; | |
n < 0 && (n = 15); | |
var i = canvasSize - 1 * canvasPadding, | |
o = .5, | |
s = "rgba(255,255,255,0.6)", | |
a = Math.floor(needleX.grid) + canvasPadding - 1, | |
r = 0, | |
l = canvasSize; | |
1 == t && (o = .4, i = barSize - 1 * barPadding, a = Math.floor(needleX.bar) + barPadding - 1, | |
r = barPadding, l = barSize - barPadding), e.beginPath(), e.lineWidth = o, e.strokeStyle = s, e.moveTo(a, r), e.lineTo(a, l), e.closePath(), e.stroke() | |
} | |
function drawVisualizers() { | |
0 == oscilloscopeEnabled && 0 == spectrumEnabled || (canvasFrontContext.clearRect(0, 0, canvasSize * window.devicePixelRatio, canvasSize * window.devicePixelRatio), oscilloscope.draw(canvasFrontContext, oscilloscopeEnabled, spectrumEnabled)) | |
} | |
function clearVisualizers() { | |
canvasFrontContext.clearRect(0, 0, canvasSize * window.devicePixelRatio, canvasSize * window.devicePixelRatio) | |
} | |
function drawAnimations() { | |
requestAnimFrame(drawAnimations), drawVisualizers(), drawFrontCanvas(); | |
for (var e = 0; e < animatingNotes.length; e++) animatingNotes[e].tick--, animatingNotes[e].tick < 0 && (animatingNotes.splice(e, 1), e--) | |
} | |
function drawCircle(e, t, n, i, o, s, a) { | |
var s = "undefined" == typeof s ? 1 : s, | |
a = "undefined" == typeof a || a; | |
e.lineWidth = s, e.fillStyle = o, e.strokeStyle = o, e.beginPath(), e.arc(t, n, i, 0, 2 * Math.PI, !1), e.fill(), 1 == a && e.stroke() | |
} | |
function drawBars() { | |
var e = "mousedown"; | |
isMobileDevice() && (e = "touchstart"); | |
for (var t = $("#bars_container").html(""), n = 0; n < tone.bars.length; n++) { | |
var i = $("<div />").addClass("bar").attr("id", "bar_" + n).data("bar_index", n).appendTo(t); | |
n == currentBar && i.addClass("bar-selected"); | |
var o = n - 1; | |
o < 0 && (o = tone.bars.length - 1); | |
var s = n + 1; | |
s > tone.bars.length - 1 && (s = 0), i.width(barSize).height(barSize); | |
var a = createCanvas("canvas_back_bar_" + n, barSize - 0, barSize - 0), | |
r = a[0].getContext("2d"), | |
l = createCanvas("canvas_front_bar_" + n, barSize - 0, barSize - 0), | |
u = l[0].getContext("2d"); | |
barFrontContexts[n] = u, a.addClass("bar-canvas-back"), l.addClass("bar-canvas-front"), i.append(a), i.append(l), drawBarCanvas(n, r, barSize - 0); | |
var c = $("<div />").addClass("bar-number").attr("id", "bar_number_" + n).text(n + 1).appendTo(i); | |
c.css("width", barSize - 1 + "px"); | |
var d = $("<div />").addClass("bar-repeat").attr("id", "bar_repeat_" + n).data("bar_index", n).html("<span> </span><div>" + (tone.bars[n].repeat > 0 ? tone.bars[n].repeat : "") + '</div><i class="fa fa-chevron-down fa-3x fa-fw" aria-hidden="true"></i>').appendTo(i); | |
d.on("click", function() { | |
var e = parseInt($(this).data("bar_index")); | |
return showBarSettings(e), !1 | |
}) | |
} | |
$(".bar").on("click", function() { | |
if (currentDragBarIndex == -1) { | |
var e = parseInt($(this).data("bar_index")), | |
t = currentBar; | |
e == t ? (currentTick = 0, tone.bars[e].repeat_current = 0, animatingNotes = []) : (currentTick = 0, tone.bars[e].repeat_current = 0, animatingNotes = [], selectBar(e, !0)) | |
} | |
}); | |
var p = $("<div />").addClass("bar bar-add").appendTo(t).width(barSize - 0).height(barSize - 0).hide(), | |
f = $("<div />").addClass("bar-add-label").width(barSize - 2).height(barSize - 2).appendTo(p); | |
$("<i />").addClass("fa fa-plus fa-3x fa-fw").attr("aria-hidden", "true").appendTo(f); | |
f.css("top", barSize / 2 - 13 + "px"); | |
var h = createCanvas("canvas_bar_new", barSize, barSize), | |
g = h[0].getContext("2d"); | |
p.append(h), drawBarCanvas(tone.bars.length - 1, g, barSize), p.on("click", function() { | |
addBar() | |
}), tone.bars.length < barsMaximum && p.show(), $("#bars").off("scroll").on("scroll", function() { | |
"bar" == settingsOpenSection && 1 == hideMenuOnScroll && hideSettings() | |
}), setupBarsDragDrop() | |
} | |
function drawBarCanvas(e, t) { | |
t.clearRect(0, 0, barSize, barSize), t.fillStyle = getColor(1), t.fillRect(0, 0, barSize, barSize); | |
for (var n = 0; n < tone.bars[e].grid.length; n++) | |
for (var i = 0; i < tone.bars[e].grid[n].length; i++) { | |
var o = (barSize - 2 * barPadding) / 16, | |
s = o / 2 - .4, | |
a = o * i + o / 2 + barPadding, | |
r = o * n + o / 2 + barPadding, | |
l = "rgba(0,0,0,0.05)"; | |
1 == tone.bars[e].grid[n][i] && (l = "rgba(255,255,255,0.75)", s = o / 2 - .2), drawCircle(t, a, r, s, l, 1, !1) | |
} | |
} | |
function setupBarsDragDrop() { | |
$("#bars_container").sortable({ | |
revert: 100, | |
disabled: !1, | |
axis: "x", | |
items: ".bar", | |
handle: !!isMobileDevice() && ".bar-number", | |
tolerance: "pointer", | |
cancel: ".bar-add", | |
scrollSensitivity: 60, | |
scrollSpeed: 20, | |
distance: 5, | |
forcePlaceholderSize: !0, | |
forceHelperSize: !1, | |
start: function(e, t) { | |
currentDragBarIndex = parseInt(t.item.attr("id").split("_")[1]), "bar" == settingsOpenSection && hideSettings() | |
}, | |
stop: function() { | |
currentDragBarIndex = -1 | |
}, | |
update: function() { | |
for (var e = $("#bars_container").sortable("toArray"), t = !1, n = currentDragBarIndex, i = 0; i < e.length; i++) | |
if ("" != e[i]) { | |
var o = parseInt(e[i].split("_")[1]); | |
o == currentDragBarIndex && n == currentDragBarIndex && (n = i), currentBar == o && 0 == t && (currentBar = i, t = !0) | |
} | |
tone.bars.splice(n, 0, tone.bars.splice(currentDragBarIndex, 1)[0]); | |
var s = $("#bars").scrollLeft(); | |
drawBars(), drawBackCanvas(), animatingNotes = [], $("#bars").scrollLeft(s), storeTone(), storeSettings() | |
} | |
}) | |
} | |
function selectBar(e, t, n, i, o) { | |
var t = "undefined" == typeof t || t, | |
n = "undefined" == typeof n || n, | |
o = "undefined" == typeof o || o; | |
if (!(e >= tone.bars.length) && 1 != touchedCell) { | |
var s = currentBar; | |
currentBar = e, 1 == o && barFrontContexts[s].clearRect(0, 0, barSize, barSize), storeSettings(), $(".bar-selected").removeClass("bar-selected"), $("#bar_" + currentBar).addClass("bar-selected"), $(".bar-repeat span").html(" "), 1 == playing && e == currentBar && tone.bars[currentBar].repeat > 1 && $("#bar_" + currentBar + " .bar-repeat span").text("1 /"); | |
for (var a = 0; a < tone.bars.length; a++) tone.bars[a].repeat_current = 0; | |
drawBackCanvas(), updateEditButtons(currentBar), 1 == t && setTimeout(function() { | |
scrollToBar(currentBar, n) | |
}, 10), "notes" == settingsOpenSection && (updateSettingsLabels(), drawScaleButtons(), drawPiano(), $(".menu-notes-octave-label").text(tone.bars[currentBar].octave)) | |
} | |
} | |
function scrollToBar(e, t) { | |
var t = "undefined" == typeof t || t, | |
n = $("#bars").scrollLeft(), | |
i = $("#bars").offset().left, | |
o = $("#bar_" + e).offset().left, | |
s = n - i + o - .3 * barSize, | |
a = barsTotal; | |
barsTotal > tone.bars.length && (a = tone.bars.length), e < a && (s = 0); | |
var r = 100; | |
1 == t && 0 == isMobileDevice() ? $("#bars").stop().animate({ | |
scrollLeft: s | |
}, { | |
duration: r, | |
easing: "swing" | |
}) : $("#bars").scrollLeft(s) | |
} | |
function deleteBar(e) { | |
if (1 != tone.bars.length) { | |
hideSettings(), currentBar >= e && (currentBar--, currentBar < 0 && (currentBar = 0)), tone.bars.splice(e, 1); | |
var t = $("#bars").scrollLeft(); | |
drawBars(), drawBackCanvas(), $("#bars").scrollLeft(t), storeTone() | |
} | |
} | |
function moveBar(e, t) { | |
var t = "undefined" != typeof t && t, | |
n = 1 == t ? e - 1 : e + 1, | |
i = !1, | |
o = !1; | |
n < 0 && (n = tone.bars.length - 1, i = !0), n >= tone.bars.length && (n = 0, o = !0), tone.bars.move(e, n), currentBar == e ? currentBar = n : currentBar == n ? 1 == t ? 1 == i ? currentBar-- : currentBar++ : 1 == o ? currentBar++ : currentBar-- : 1 == i ? currentBar-- : 1 == o && currentBar++, drawBars(), moveMenuToBar(n), storeTone() | |
} | |
function chainBar(e, t) { | |
var t = "undefined" == typeof t || t; | |
1 == t ? tone.bars[e].chain = !0 : tone.bars[e].chain = !1, drawBars(), storeTone(), updateBarButtons(e) | |
} | |
function duplicateBar(e) { | |
if (!(tone.bars.length >= barsMaximum)) { | |
var t = JSON.parse(JSON.stringify(tone.bars[e])); | |
tone.bars.splice(e, 0, t), currentBar >= e && (currentBar++, currentBar >= tone.bars.length && (currentBar = tone.bars.length - 1)); | |
var n = e + 1; | |
generateScaleNotes(e), generateScaleNotes(n), drawBars(), moveMenuToBar(n), storeTone() | |
} | |
} | |
function moveMenuToBar(e) { | |
var t = $("#bars").scrollLeft(); | |
hideMenuOnScroll = !1; | |
var n = $("#bar_" + e).offset().left; | |
setTimeout(function() { | |
n < 0 || n > $("#bars").width() ? scrollToBar(e, !1) : $("#bars").scrollLeft(t), settingsOpenSection = "", showBarSettings(e) | |
}, 10), setTimeout(function() { | |
hideMenuOnScroll = !0 | |
}, 100) | |
} | |
function copyBar(e) { | |
copiedNotes = []; | |
for (var t = 0; t < tone.bars[e].grid.length; t++) { | |
copiedNotes.push([]); | |
for (var n = 0; n < tone.bars[e].grid[t].length; n++) copiedNotes[t].push(tone.bars[e].grid[t][n]) | |
} | |
$("#paste_button").removeClass("medium-button-disabled"), storeSettings() | |
} | |
function pasteBar(e) { | |
if (0 != copiedNotes.length) { | |
addToHistory(e), tone.bars[e].grid = [], e == currentBar && (animatingNotes = []); | |
for (var t = 0; t < copiedNotes.length; t++) { | |
tone.bars[e].grid.push([]); | |
for (var n = 0; n < copiedNotes[t].length; n++) tone.bars[e].grid[t].push(copiedNotes[t][n]) | |
} | |
regenerateMatrix(e), drawBackCanvas(), drawBarCanvas(e, $("#canvas_back_bar_" + e)[0].getContext("2d"), barSize), storeTone() | |
} | |
} | |
function addBar() { | |
if (!(tone.bars.length >= barsMaximum)) { | |
var e = JSON.parse(JSON.stringify(tone.bars[tone.bars.length - 1])); | |
tone.bars.push(e), currentBar = tone.bars.length - 1, regenerateMatrix(currentBar), animatingNotes = [], generateScaleNotes(currentBar), drawBars(), selectBar(currentBar, !0, !1), storeTone() | |
} | |
} | |
function clearBar(e) { | |
addToHistory(e); | |
for (var t = 0; t < tone.bars[e].grid.length; t++) | |
for (var n = 0; n < tone.bars[e].grid[t].length; n++) tone.bars[e].grid[t][n] = 0; | |
regenerateMatrix(e), animatingNotes = [], drawBackCanvas(), drawBarCanvas(e, $("#canvas_back_bar_" + e)[0].getContext("2d"), barSize), storeTone(), updateEditButtons(e) | |
} | |
function shuffleBar(e) { | |
addToHistory(e); | |
var t = getBarNotesOnTotal(e); | |
if (256 != t) { | |
0 == t && (t = randomIntFromInterval(5, 25)); | |
for (var n = 0; n < tone.bars[e].grid.length; n++) | |
for (var i = 0; i < tone.bars[e].grid[n].length; i++) tone.bars[e].grid[n][i] = 0; | |
for (; t > 0;) { | |
var i = randomIntFromInterval(0, 15), | |
n = randomIntFromInterval(0, 15); | |
1 != tone.bars[e].grid[n][i] && (tone.bars[e].grid[n][i] = 1, t--) | |
} | |
regenerateMatrix(e), animatingNotes = [], drawBackCanvas(), drawBarCanvas(e, $("#canvas_back_bar_" + e)[0].getContext("2d"), barSize), updateEditButtons(e), storeTone() | |
} | |
} | |
function getBarNotesOnTotal(e) { | |
for (var t = 0, n = 0; n < tone.bars[e].grid.length; n++) | |
for (var i = 0; i < tone.bars[e].grid[n].length; i++) 1 == tone.bars[e].grid[n][i] && t++; | |
return t | |
} | |
function flipBar(e, t) { | |
var t = "undefined" == typeof t || t; | |
if (addToHistory(e), 1 == t) | |
for (var n = 0; n < tone.bars[e].grid.length; n++) { | |
for (var i = tone.bars[e].grid[n].slice(0), o = 0; o < tone.bars[e].grid[n].length; o++) tone.bars[e].grid[n][o] = 0; | |
for (var o = i.length - 1; o >= 0; o--) tone.bars[e].grid[n][o] = i[i.length - 1 - o] | |
} else | |
for (var s = tone.bars[e].grid.slice(0), n = s.length - 1; n >= 0; n--) tone.bars[e].grid[n] = s[s.length - 1 - n]; | |
regenerateMatrix(e), animatingNotes = [], drawBackCanvas(), drawBarCanvas(e, $("#canvas_back_bar_" + e)[0].getContext("2d"), barSize), storeTone() | |
} | |
function rotateBar(e, t) { | |
var t = "undefined" == typeof t || t; | |
addToHistory(e); | |
var n = getCopyOfGrid(e); | |
if (1 == t) | |
for (var i = 0; i < n.length; i++) | |
for (var o = 0; o < n[i].length; o++) tone.bars[e].grid[o][15 - i] = n[i][o]; | |
else | |
for (var i = 0; i < n.length; i++) | |
for (var o = 0; o < n[i].length; o++) tone.bars[e].grid[15 - o][i] = n[i][o]; | |
regenerateMatrix(e), animatingNotes = [], drawBackCanvas(), drawBarCanvas(e, $("#canvas_back_bar_" + e)[0].getContext("2d"), barSize), storeTone() | |
} | |
function shiftBar(e, t) { | |
var t = "undefined" == typeof t ? "up" : t; | |
if (addToHistory(e), "up" == t) tone.bars[e].grid.push(tone.bars[e].grid.shift()); | |
else if ("down" == t) tone.bars[e].grid.unshift(tone.bars[e].grid.pop()); | |
else | |
for (var n = 0; n < tone.bars[e].grid.length; n++) "left" == t ? tone.bars[e].grid[n].push(tone.bars[e].grid[n].shift()) : "right" == t && tone.bars[e].grid[n].unshift(tone.bars[e].grid[n].pop()); | |
regenerateMatrix(e), animatingNotes = [], drawBackCanvas(), drawBarCanvas(e, $("#canvas_back_bar_" + e)[0].getContext("2d"), barSize), storeTone() | |
} | |
function getCopyOfGrid(e) { | |
for (var t = [], n = 0; n < tone.bars[e].grid.length; n++) { | |
t.push([]); | |
for (var i = 0; i < tone.bars[e].grid[n].length; i++) t[n].push(tone.bars[e].grid[n][i]) | |
} | |
return t | |
} | |
function addToHistory(e) { | |
var t = getCopyOfGrid(e); | |
tone.bars[e].undo.push(t), tone.bars[e].redo = [], updateEditButtons(e) | |
} | |
function undoBar(e) { | |
if (0 != tone.bars[e].undo.length) { | |
var t = getCopyOfGrid(e); | |
tone.bars[e].redo.push(t), tone.bars[e].grid = tone.bars[e].undo.pop(); | |
for (var n = 0; n < t.length; n++) | |
for (var i = 0; i < t[n].length; i++) 1 == t[n][i] && 0 == tone.bars[e].grid[n][i] && removeAnimatingNotes(e, i, n); | |
regenerateMatrix(e), drawBackCanvas(), drawBarCanvas(e, $("#canvas_back_bar_" + e)[0].getContext("2d"), barSize), storeTone(), updateEditButtons(e) | |
} | |
} | |
function redoBar(e) { | |
if (0 != tone.bars[e].redo.length) { | |
var t = getCopyOfGrid(e); | |
tone.bars[e].undo.push(t), tone.bars[e].grid = tone.bars[e].redo.pop(), regenerateMatrix(e), drawBackCanvas(), drawBarCanvas(e, $("#canvas_back_bar_" + e)[0].getContext("2d"), barSize), storeTone(), updateEditButtons(e) | |
} | |
} | |
function updateEditButtons(e) { | |
if ("edit" == settingsOpenSection) { | |
0 == tone.bars[e].undo.length ? $("#undo_button").addClass("medium-button-disabled") : $("#undo_button").removeClass("medium-button-disabled"), 0 == tone.bars[e].redo.length ? $("#redo_button").addClass("medium-button-disabled") : $("#redo_button").removeClass("medium-button-disabled"); | |
var t = getBarNotesOnTotal(e); | |
0 == t ? $("#clear_button").addClass("medium-button-disabled") : $("#clear_button").removeClass("medium-button-disabled") | |
} | |
} | |
function updateBarButtons(e) { | |
"bar" == settingsOpenSection && (tone.bars.length > 1 ? $("#delete_bar_button").removeClass("medium-button-disabled") : $("#delete_bar_button").addClass("medium-button-disabled"), $("#repeat_slider")[0].noUiSlider.set(tone.bars[e].repeat), $("#repeat_slider .noUi-connect").css("background", getColor(.8))) | |
} | |
function togglePlay() { | |
0 == playing ? startPlaying() : stopPlaying() | |
} | |
function startPlaying() { | |
needleX.grid = 0, needleX.bar = 0, playing = !0, startLFOs(), startWorkerTimer(), playTone(), selectBar(currentBar), $("#play_button span").removeClass("glyphicon-play").addClass("glyphicon-stop"), null != currentToneCopy && ($("#profile_play_" + tone.id + "_" + playItemId).addClass("profile-play-button-avatar-on"), $("#profile_play_" + tone.id + "_" + playItemId + " i").removeClass("fa-ellipsis-h fa-play").addClass("fa-pause")) | |
} | |
function stopPlaying() { | |
playing = !1; | |
var e = $("#canvas_front_bar_" + currentBar)[0].getContext("2d"); | |
e.clearRect(0, 0, barSize, barSize), currentTick = 0, changeBarTo = null; | |
for (var t = 0; t < tone.bars.length; t++) tone.bars[t].repeat_current = 0; | |
$(".bar-repeat span").html(" "), $("#play_button span").removeClass("glyphicon-stop").addClass("glyphicon-play"), $(".profile-play-button").removeClass("profile-play-button-avatar-on"), $(".profile-play-button .fa-pause").removeClass("fa-pause").addClass("fa-play") | |
} | |
function toggleRepeat() { | |
0 == repeatBar ? enableRepeat() : disableRepeat() | |
} | |
function enableRepeat() { | |
repeatBar = !0, storeSettings(), $("#repeat_button span").addClass("repeat-button-on") | |
} | |
function disableRepeat() { | |
repeatBar = !1, storeSettings(), $("#repeat_button span").removeClass("repeat-button-on") | |
} | |
function setupSettings() { | |
setupBrowseSettings(), setupBarSettings(), setupSoundSettings(), setupEditSettings(), drawScaleButtons(), $(".sliders .noUi-connect").css("background", getColor(.8)); | |
var e = "mousedown", | |
t = "mouseup"; | |
isMobileDevice() && (e = "touchstart", t = "touchend"), $("#drums_toggle").on(e, function() { | |
tone.bars[currentBar].drums = !tone.bars[currentBar].drums, 1 == tone.bars[currentBar].drums ? $(this).addClass("settings-drum-toggle-on") : $(this).removeClass("settings-drum-toggle-on"), storeTone() | |
}), $("#save_privacy .dialog-radio-button-wrap").on(t, function() { | |
parseInt($(this).attr("id").split("_")[2]); | |
$(".dialog-radio-button").removeClass("dialog-radio-button-on"), $(".dialog-radio-button", this).addClass("dialog-radio-button-on") | |
}), $("#browse_value_cell, #browse_label_cell").on("click", function() { | |
showBrowse() | |
}), $("#sound_value_cell, #sound_label_cell").on(e, function() { | |
showSoundSettings() | |
}), $("#notes_value_cell, #notes_label_cell").on(e, function() { | |
showNotesSettings() | |
}), $("#edit_value_cell, #edit_label_cell").on(e, function() { | |
showEditSettings() | |
}), $("#info_value_cell, #info_label_cell").on(e, function() { | |
showInfoSettings() | |
}), $("#save_value_cell, #save_label_cell").on("click", function() { | |
showSaveTone() | |
}) | |
} | |
function updateSoundSettingsLabels() { | |
$("#waveform_switch_0, #waveform_switch_1, #waveform_switch_2, #waveform_switch_3").removeClass("settings-switcher-selected"), $("#waveform_switch_" + getWaveformIndex(tone.settings.oscillator.waveform)).addClass("settings-switcher-selected"), updateSwitcherDots() | |
} | |
function updateSettingsValue(e, t, n, i) { | |
var n = "undefined" != typeof n && n, | |
i = "undefined" != typeof i && i; | |
if ("tempo" == e) 1 == playing ? changeTempoTo = t : (tone.tempo = t, tempo = tone.tempo, startWorkerTimer()), clearTimeout(settingsTempoTimer), settingsTempoTimer = setTimeout(function() { | |
updateDelay(), startLFOs(), restartLFO = !0, storeTone() | |
}, 150); | |
else if ("cutoff" == e) tone.settings.filter.cutoff = t, 1 == n && updateFilterFrequency(), 1 == i && $("#cutoff_slider")[0].noUiSlider.set(100 * tone.settings.filter.cutoff); | |
else if ("resonance" == e) tone.settings.filter.resonance = t, 1 == n && updateFilterResonance(), 1 == i && $("#resonance_slider")[0].noUiSlider.set(100 * tone.settings.filter.resonance); | |
else if ("drum_volume" == e) tone.settings.drums.bd = t, 1 == i && $("#drum_volume_slider")[0].noUiSlider.set(100 * tone.settings.drums.bd); | |
else if ("volume" == e) tone.settings.volume.level = getSettingsValueToFixed(t), 1 == i && $("#volume_slider")[0].noUiSlider.set(100 * tone.settings.volume.level); | |
else if ("attack" == e) tone.settings.volume.envelope.attack = getSettingsValueToFixed(t), 1 == i && $("#attack_slider")[0].noUiSlider.set(100 * tone.settings.volume.envelope.attack); | |
else if ("decay" == e) tone.settings.volume.envelope.decay = getSettingsValueToFixed(t), 1 == i && $("#decay_slider")[0].noUiSlider.set(100 * tone.settings.volume.envelope.decay); | |
else if ("sustain" == e) tone.settings.volume.envelope.sustain = t, 1 == i && $("#sustain_slider")[0].noUiSlider.set(100 * tone.settings.volume.envelope.sustain); | |
else if ("hold" == e) tone.settings.volume.envelope.hold = getSettingsValueToFixed(t), 1 == i && $("#hold_slider")[0].noUiSlider.set(100 * tone.settings.volume.envelope.hold); | |
else if ("release" == e) tone.settings.volume.envelope.release = getSettingsValueToFixed(t), 1 == i && $("#release_slider")[0].noUiSlider.set(100 * tone.settings.volume.envelope.release); | |
else if ("filter_amount" == e) tone.settings.filter.envelope.amount = getSettingsValueToFixed(t), 1 == i && ($("#filter_amount_slider")[0].noUiSlider.set(100 * tone.settings.filter.envelope.amount), updateFilterAmountSlider()); | |
else if ("filter_attack" == e) tone.settings.filter.envelope.attack = getSettingsValueToFixed(t), 1 == i && $("#filter_attack_slider")[0].noUiSlider.set(100 * tone.settings.filter.envelope.attack); | |
else if ("filter_decay" == e) tone.settings.filter.envelope.decay = getSettingsValueToFixed(t), 1 == i && $("#filter_decay_slider")[0].noUiSlider.set(100 * tone.settings.filter.envelope.decay); | |
else if ("filter_sustain" == e) tone.settings.filter.envelope.sustain = t, 1 == i && $("#filter_sustain_slider")[0].noUiSlider.set(100 * tone.settings.filter.envelope.sustain); | |
else if ("filter_hold" == e) tone.settings.filter.envelope.hold = getSettingsValueToFixed(t), 1 == i && $("#filter_hold_slider")[0].noUiSlider.set(100 * tone.settings.filter.envelope.hold); | |
else if ("filter_release" == e) tone.settings.filter.envelope.release = getSettingsValueToFixed(t), 1 == i && $("#filter_release_slider")[0].noUiSlider.set(100 * tone.settings.filter.envelope.release); | |
else if ("pitch_amount" == e) tone.settings.pitch.envelope.amount = getSettingsValueToFixed(t), 1 == i && ($("#pitch_amount_slider")[0].noUiSlider.set(100 * tone.settings.pitch.envelope.amount), updatePitchAmountSlider()); | |
else if ("pitch_attack" == e) tone.settings.pitch.envelope.attack = getSettingsValueToFixed(t), 1 == i && $("#pitch_attack_slider")[0].noUiSlider.set(100 * tone.settings.pitch.envelope.attack); | |
else if ("pitch_decay" == e) tone.settings.pitch.envelope.decay = getSettingsValueToFixed(t), 1 == i && $("#pitch_decay_slider")[0].noUiSlider.set(100 * tone.settings.pitch.envelope.decay); | |
else if ("pitch_sustain" == e) tone.settings.pitch.envelope.sustain = t, 1 == i && $("#pitch_sustain_slider")[0].noUiSlider.set(100 * tone.settings.pitch.envelope.sustain); | |
else if ("pitch_hold" == e) tone.settings.pitch.envelope.hold = getSettingsValueToFixed(t), 1 == i && $("#pitch_hold_slider")[0].noUiSlider.set(100 * tone.settings.pitch.envelope.hold); | |
else if ("pitch_release" == e) tone.settings.pitch.envelope.release = getSettingsValueToFixed(t), 1 == i && $("#pitch_release_slider")[0].noUiSlider.set(100 * tone.settings.pitch.envelope.release); | |
else if ("lfo_amount" == e) { | |
var o = getSettingsValueToFixed(t), | |
s = 0; | |
0 == selectedLFO ? (s = tone.settings.lfo.volume.level, tone.settings.lfo.volume.level = parseFloat(o)) : 1 == selectedLFO ? (s = tone.settings.lfo.pitch.level, tone.settings.lfo.pitch.level = parseFloat(o)) : (s = tone.settings.lfo.cutoff.level, tone.settings.lfo.cutoff.level = parseFloat(o)), 1 == n && setLfoTargetLevel(selectedLFO), 1 == i && updateLfoSettings() | |
} else if ("lfo_rate_freq" == e) { | |
if (1 == getLfoSettings(selectedLFO).sync) { | |
var a = t, | |
r = !1; | |
0 == selectedLFO ? (tone.settings.lfo.volume.duration != a && (r = !0), tone.settings.lfo.volume.duration = a) : 1 == selectedLFO ? (tone.settings.lfo.pitch.duration != a && (r = !0), tone.settings.lfo.pitch.duration = a) : (tone.settings.lfo.cutoff.duration != a && (r = !0), tone.settings.lfo.cutoff.duration = a), 1 == n && setLfoDuration(selectedLFO, getLfoSettings(selectedLFO).duration, r) | |
} else { | |
var o = getSettingsValueToFixed(t); | |
0 == selectedLFO ? tone.settings.lfo.volume.frequency = parseFloat(o) : 1 == selectedLFO ? tone.settings.lfo.pitch.frequency = parseFloat(o) : tone.settings.lfo.cutoff.frequency = parseFloat(o), 1 == n && setLfoFrequency(selectedLFO, getLfoSettings(selectedLFO).frequency) | |
} | |
1 == i && updateLfoSettings() | |
} else if ("lfo_waveform" == e) 0 == selectedLFO ? tone.settings.lfo.volume.waveform = t : 1 == selectedLFO ? tone.settings.lfo.pitch.waveform = t : tone.settings.lfo.cutoff.waveform = t, 1 == n && setLfoWaveform(selectedLFO, getLfoSettings(selectedLFO).waveform), 1 == i && updateLfoSettings(); | |
else if ("noise" == e) { | |
if (tone.settings.noise.level = getSettingsValueToFixed(t), 1 == n) | |
for (var l = 0; l < voices.length; l++) null != voices[l] && (voices[l].noise.gain.value = tone.settings.noise.level); | |
1 == i && $("#noise_slider")[0].noUiSlider.set(100 * tone.settings.noise.level) | |
} else "noise_resonance" == e ? (tone.settings.noise.resonance = t, 1 == n && setNoiseFilterQ(tone.settings.noise.resonance), 1 == i && $("#noise_resonance_slider")[0].noUiSlider.set(100 * tone.settings.noise.resonance)) : "noise_lowcut" == e ? (tone.settings.noise.lowcut = t, 1 == n && setNoiseFilterLowFrequency(tone.settings.noise.lowcut), 1 == i && $("#noise_lowcut_slider")[0].noUiSlider.set(100 * tone.settings.noise.lowcut)) : "noise_highcut" == e ? (tone.settings.noise.highcut = t, 1 == n && setNoiseFilterHighFrequency(tone.settings.noise.highcut), 1 == i && $("#noise_highcut_slider")[0].noUiSlider.set(100 * tone.settings.noise.highcut)) : "delay_level" == e ? (tone.settings.delay.level = t, 1 == n && updateDelay(), 1 == i && $("#delay_level_slider")[0].noUiSlider.set(100 * tone.settings.delay.level)) : "delay_duration" == e ? (tone.settings.delay.duration = t, 1 == n && updateDelay(), 1 == i && $("#delay_duration_slider")[0].noUiSlider.set(getDelayTimeIndex(tone.settings.delay.duration))) : "delay_feedback" == e ? (tone.settings.delay.feedback = t, 1 == n && updateDelay(), 1 == i && $("#delay_feedback_slider")[0].noUiSlider.set(100 * tone.settings.delay.feedback)) : "delay_lowcut" == e ? (tone.settings.delay.lowcut = t, 1 == n && setDelayFilterLow(tone.settings.delay.lowcut), 1 == i && $("#delay_lowcut_slider")[0].noUiSlider.set(100 * tone.settings.delay.lowcut)) : "delay_highcut" == e ? (tone.settings.delay.highcut = t, 1 == n && setDelayFilterHigh(tone.settings.delay.highcut), 1 == i && $("#delay_highcut_slider")[0].noUiSlider.set(100 * tone.settings.delay.highcut)) : "reverb_level" == e ? (tone.settings.reverb.level = t, 1 == n && setReverbMix(tone.settings.reverb.level), 1 == i && $("#reverb_level_slider")[0].noUiSlider.set(100 * tone.settings.reverb.level)) : "reverb_lowcut" == e ? (tone.settings.reverb.lowcut = t, 1 == n && setReverbFilterLow(tone.settings.reverb.lowcut), 1 == i && $("#reverb_lowcut_slider")[0].noUiSlider.set(100 * tone.settings.reverb.lowcut)) : "reverb_highcut" == e && (tone.settings.reverb.highcut = t, 1 == n && setReverbFilterHigh(tone.settings.reverb.highcut), 1 == i && $("#reverb_highcut_slider")[0].noUiSlider.set(100 * tone.settings.reverb.highcut)); | |
storeTone() | |
} | |
function restoreSettingsValue(e) { | |
"cutoff" == e ? updateSettingsValue(e, tone.preset.settings.filter.cutoff, !0, !0) : "resonance" == e ? updateSettingsValue(e, tone.preset.settings.filter.resonance, !0, !0) : "drum_volume" == e ? updateSettingsValue(e, tone.preset.settings.drums.bd, !0, !0) : "volume" == e ? updateSettingsValue(e, tone.preset.settings.volume.level, !0, !0) : "attack" == e ? updateSettingsValue(e, tone.preset.settings.volume.envelope.attack, !0, !0) : "decay" == e ? updateSettingsValue(e, tone.preset.settings.volume.envelope.decay, !0, !0) : "sustain" == e ? updateSettingsValue(e, tone.preset.settings.volume.envelope.sustain, !0, !0) : "hold" == e ? updateSettingsValue(e, tone.preset.settings.volume.envelope.hold, !0, !0) : "release" == e ? updateSettingsValue(e, tone.preset.settings.volume.envelope.release, !0, !0) : "filter_amount" == e ? (tone.settings.filter.envelope.invert = tone.preset.settings.filter.envelope.invert, updateSettingsValue(e, tone.preset.settings.filter.envelope.amount, !0, !0)) : "filter_attack" == e ? updateSettingsValue(e, tone.preset.settings.filter.envelope.attack, !0, !0) : "filter_decay" == e ? updateSettingsValue(e, tone.preset.settings.filter.envelope.decay, !0, !0) : "filter_sustain" == e ? updateSettingsValue(e, tone.preset.settings.filter.envelope.sustain, !0, !0) : "filter_hold" == e ? updateSettingsValue(e, tone.preset.settings.filter.envelope.hold, !0, !0) : "filter_release" == e ? updateSettingsValue(e, tone.preset.settings.filter.envelope.release, !0, !0) : "pitch_amount" == e ? (tone.settings.pitch.envelope.invert = tone.preset.settings.pitch.envelope.invert, updateSettingsValue(e, tone.preset.settings.pitch.envelope.amount, !0, !0)) : "pitch_attack" == e ? updateSettingsValue(e, tone.preset.settings.pitch.envelope.attack, !0, !0) : "pitch_decay" == e ? updateSettingsValue(e, tone.preset.settings.pitch.envelope.decay, !0, !0) : "pitch_sustain" == e ? updateSettingsValue(e, tone.preset.settings.pitch.envelope.sustain, !0, !0) : "pitch_hold" == e ? updateSettingsValue(e, tone.preset.settings.pitch.envelope.hold, !0, !0) : "pitch_release" == e ? updateSettingsValue(e, tone.preset.settings.pitch.envelope.release, !0, !0) : "lfo_amount" == e ? 0 == selectedLFO ? updateSettingsValue(e, tone.preset.settings.lfo.volume.level, !0, !0) : 1 == selectedLFO ? updateSettingsValue(e, tone.preset.settings.lfo.pitch.level, !0, !0) : updateSettingsValue(e, tone.preset.settings.lfo.cutoff.level, !0, !0) : "lfo_rate_freq" == e ? 1 == getLfoSettings(selectedLFO).sync ? 0 == selectedLFO ? updateSettingsValue(e, tone.preset.settings.lfo.volume.duration, !0, !0) : 1 == selectedLFO ? updateSettingsValue(e, tone.preset.settings.lfo.pitch.duration, !0, !0) : updateSettingsValue(e, tone.preset.settings.lfo.cutoff.duration, !0, !0) : 0 == selectedLFO ? updateSettingsValue(e, tone.preset.settings.lfo.volume.frequency, !0, !0) : 1 == selectedLFO ? updateSettingsValue(e, tone.preset.settings.lfo.pitch.frequency, !0, !0) : updateSettingsValue(e, tone.preset.settings.lfo.cutoff.frequency, !0, !0) : "lfo_waveform" == e ? 0 == selectedLFO ? updateSettingsValue(e, tone.preset.settings.lfo.volume.waveform, !0, !0) : 1 == selectedLFO ? updateSettingsValue(e, tone.preset.settings.lfo.pitch.waveform, !0, !0) : updateSettingsValue(e, tone.preset.settings.lfo.cutoff.waveform, !0, !0) : "noise" == e ? updateSettingsValue(e, tone.preset.settings.noise.level, !0, !0) : "noise_resonance" == e ? updateSettingsValue(e, tone.preset.settings.noise.resonance, !0, !0) : "noise_lowcut" == e ? updateSettingsValue(e, tone.preset.settings.noise.lowcut, !0, !0) : "noise_highcut" == e ? updateSettingsValue(e, tone.preset.settings.noise.highcut, !0, !0) : "delay_level" == e ? updateSettingsValue(e, tone.preset.settings.delay.level, !0, !0) : "delay_duration" == e ? updateSettingsValue(e, tone.preset.settings.delay.duration, !0, !0) : "delay_feedback" == e ? updateSettingsValue(e, tone.preset.settings.delay.feedback, !0, !0) : "delay_lowcut" == e ? updateSettingsValue(e, tone.preset.settings.delay.lowcut, !0, !0) : "delay_highcut" == e ? updateSettingsValue(e, tone.preset.settings.delay.highcut, !0, !0) : "reverb_level" == e ? updateSettingsValue(e, tone.preset.settings.reverb.level, !0, !0) : "reverb_lowcut" == e ? updateSettingsValue(e, tone.preset.settings.reverb.lowcut, !0, !0) : "reverb_highcut" == e && updateSettingsValue(e, tone.preset.settings.reverb.highcut, !0, !0) | |
} | |
function updateSettingsLabel(e) { | |
if ("tempo" == e) $("#tempo_value").text(tone.tempo + ""); | |
else if ("cutoff" == e) $("#cutoff_value").text(parseInt(100 * tone.settings.filter.cutoff) + "%"); | |
else if ("resonance" == e) $("#resonance_value").text(parseInt(100 * tone.settings.filter.resonance) + "%"); | |
else if ("drum_volume" == e) $("#drum_volume_value").text(parseInt(100 * tone.settings.drums.bd) + "%"); | |
else if ("volume" == e) $("#volume_value").text(getSettingsAmountToFixed(tone.settings.volume.level)), updateSwitcherDots(); | |
else if ("attack" == e) $("#attack_value").text(tone.settings.volume.envelope.attack); | |
else if ("decay" == e) $("#decay_value").text(tone.settings.volume.envelope.decay); | |
else if ("sustain" == e) $("#sustain_value").text(parseInt(100 * tone.settings.volume.envelope.sustain) + "%"); | |
else if ("hold" == e) $("#hold_value").text(tone.settings.volume.envelope.hold); | |
else if ("release" == e) $("#release_value").text(tone.settings.volume.envelope.release); | |
else if ("filter_amount" == e) { | |
var t = getSettingsAmountToFixed(tone.settings.filter.envelope.amount); | |
1 == tone.settings.filter.envelope.invert && 0 != tone.settings.filter.envelope.amount && (t = "-" + t), $("#filter_amount_value").text(t), updateSwitcherDots() | |
} else if ("filter_attack" == e) $("#filter_attack_value").text(tone.settings.filter.envelope.attack); | |
else if ("filter_decay" == e) $("#filter_decay_value").text(tone.settings.filter.envelope.decay); | |
else if ("filter_sustain" == e) $("#filter_sustain_value").text(parseInt(100 * tone.settings.filter.envelope.sustain) + "%"); | |
else if ("filter_hold" == e) $("#filter_hold_value").text(tone.settings.filter.envelope.hold); | |
else if ("filter_release" == e) $("#filter_release_value").text(tone.settings.filter.envelope.release); | |
else if ("pitch_amount" == e) { | |
var n = getSettingsAmountToFixed(tone.settings.pitch.envelope.amount); | |
1 == tone.settings.pitch.envelope.invert && 0 != tone.settings.pitch.envelope.amount && (n = "-" + n), $("#pitch_amount_value").text(n), updateSwitcherDots() | |
} else "pitch_attack" == e ? $("#pitch_attack_value").text(tone.settings.pitch.envelope.attack) : "pitch_decay" == e ? $("#pitch_decay_value").text(tone.settings.pitch.envelope.decay) : "pitch_sustain" == e ? $("#pitch_sustain_value").text(parseInt(100 * tone.settings.pitch.envelope.sustain) + "%") : "pitch_hold" == e ? $("#pitch_hold_value").text(tone.settings.pitch.envelope.hold) : "pitch_release" == e ? $("#pitch_release_value").text(tone.settings.pitch.envelope.release) : "lfo_amount" == e ? ($("#lfo_amount_value").text(getSettingsAmountToFixed(getLfoSettings(selectedLFO).level)), updateSwitcherDots()) : "lfo_rate_freq" == e ? updateLfoSettingsLabels() : "lfo_waveform" == e ? updateLfoSettingsLabels() : "noise" == e ? ($("#noise_value").text(getSettingsAmountToFixed(tone.settings.noise.level)), updateSwitcherDots()) : "noise_resonance" == e ? $("#noise_resonance_value").text(parseInt(100 * tone.settings.noise.resonance) + "%") : "noise_lowcut" == e ? $("#noise_lowcut_value").text(parseInt(100 * tone.settings.noise.lowcut) + "%") : "noise_highcut" == e ? $("#noise_highcut_value").text(parseInt(100 * tone.settings.noise.highcut) + "%") : "delay_level" == e ? ($("#delay_level_value").text(getSettingsAmountToFixed(tone.settings.delay.level)), updateSwitcherDots()) : "delay_duration" == e ? $("#delay_duration_value").text(tone.settings.delay.duration) : "delay_feedback" == e ? $("#delay_feedback_value").text(parseInt(100 * tone.settings.delay.feedback) + "%") : "delay_lowcut" == e ? $("#delay_lowcut_value").text(parseInt(100 * tone.settings.delay.lowcut) + "%") : "delay_highcut" == e ? $("#delay_highcut_value").text(parseInt(100 * tone.settings.delay.highcut) + "%") : "reverb_level" == e ? ($("#reverb_level_value").text(getSettingsAmountToFixed(tone.settings.reverb.level)), updateSwitcherDots()) : "reverb_lowcut" == e ? $("#reverb_lowcut_value").text(parseInt(100 * tone.settings.reverb.lowcut) + "%") : "reverb_highcut" == e && $("#reverb_highcut_value").text(parseInt(100 * tone.settings.reverb.highcut) + "%"); | |
updateSettingsPresetLabel(e) | |
} | |
function updateSettingsPresetLabel(e) { | |
if ($("#" + e + "_preset_value").hide(), "cutoff" == e) tone.settings.filter.cutoff != tone.preset.settings.filter.cutoff && $("#cutoff_preset_value").text(parseInt(100 * tone.preset.settings.filter.cutoff) + "%").show(); | |
else if ("resonance" == e) tone.settings.filter.resonance != tone.preset.settings.filter.resonance && $("#resonance_preset_value").text(parseInt(100 * tone.preset.settings.filter.resonance) + "%").show(); | |
else if ("drum_volume" == e) tone.settings.drums.bd != tone.preset.settings.drums.bd && $("#drum_volume_preset_value").text(parseInt(100 * tone.preset.settings.drums.bd) + "%").show(); | |
else if ("volume" == e) tone.settings.volume.level != tone.preset.settings.volume.level && $("#volume_preset_value").text(getSettingsAmountToFixed(tone.preset.settings.volume.level)).show(); | |
else if ("attack" == e) tone.settings.volume.envelope.attack != tone.preset.settings.volume.envelope.attack && $("#attack_preset_value").text(tone.preset.settings.volume.envelope.attack).show(); | |
else if ("decay" == e) tone.settings.volume.envelope.decay != tone.preset.settings.volume.envelope.decay && $("#decay_preset_value").text(tone.preset.settings.volume.envelope.decay).show(); | |
else if ("sustain" == e) tone.settings.volume.envelope.sustain != tone.preset.settings.volume.envelope.sustain && $("#sustain_preset_value").text(parseInt(100 * tone.preset.settings.volume.envelope.sustain) + "%").show(); | |
else if ("hold" == e) tone.settings.volume.envelope.hold != tone.preset.settings.volume.envelope.hold && $("#hold_preset_value").text(tone.preset.settings.volume.envelope.hold).show(); | |
else if ("release" == e) tone.settings.volume.envelope.release != tone.preset.settings.volume.envelope.release && $("#release_preset_value").text(tone.preset.settings.volume.envelope.release).show(); | |
else if ("filter_amount" == e) { | |
if (tone.settings.filter.envelope.amount != tone.preset.settings.filter.envelope.amount || tone.settings.filter.envelope.invert != tone.preset.settings.filter.envelope.invert) { | |
var t = getSettingsAmountToFixed(tone.preset.settings.filter.envelope.amount); | |
1 == tone.preset.settings.filter.envelope.invert && (t = "-" + t), 0 == tone.settings.filter.envelope.amount && 0 == tone.preset.settings.filter.envelope.amount || $("#filter_amount_preset_value").text(t).show() | |
} | |
} else if ("filter_attack" == e) tone.settings.filter.envelope.attack != tone.preset.settings.filter.envelope.attack && $("#filter_attack_preset_value").text(tone.preset.settings.filter.envelope.attack).show(); | |
else if ("filter_decay" == e) tone.settings.filter.envelope.decay != tone.preset.settings.filter.envelope.decay && $("#filter_decay_preset_value").text(tone.preset.settings.filter.envelope.decay).show(); | |
else if ("filter_sustain" == e) tone.settings.filter.envelope.sustain != tone.preset.settings.filter.envelope.sustain && $("#filter_sustain_preset_value").text(parseInt(100 * tone.preset.settings.filter.envelope.sustain) + "%").show(); | |
else if ("filter_hold" == e) tone.settings.filter.envelope.hold != tone.preset.settings.filter.envelope.hold && $("#filter_hold_preset_value").text(tone.preset.settings.filter.envelope.hold).show(); | |
else if ("filter_release" == e) tone.settings.filter.envelope.release != tone.preset.settings.filter.envelope.release && $("#filter_release_preset_value").text(tone.preset.settings.filter.envelope.release).show(); | |
else if ("pitch_amount" == e) { | |
if (tone.settings.pitch.envelope.amount != tone.preset.settings.pitch.envelope.amount || tone.settings.pitch.envelope.invert != tone.preset.settings.pitch.envelope.invert) { | |
var n = getSettingsAmountToFixed(tone.preset.settings.pitch.envelope.amount); | |
1 == tone.preset.settings.pitch.envelope.invert && (n = "-" + n), 0 == tone.settings.pitch.envelope.amount && 0 == tone.preset.settings.pitch.envelope.amount || $("#pitch_amount_preset_value").text(n).show() | |
} | |
} else "pitch_attack" == e ? tone.settings.pitch.envelope.attack != tone.preset.settings.pitch.envelope.attack && $("#pitch_attack_preset_value").text(tone.preset.settings.pitch.envelope.attack).show() : "pitch_decay" == e ? tone.settings.pitch.envelope.decay != tone.preset.settings.pitch.envelope.decay && $("#pitch_decay_preset_value").text(tone.preset.settings.pitch.envelope.decay).show() : "pitch_sustain" == e ? tone.settings.pitch.envelope.sustain != tone.preset.settings.pitch.envelope.sustain && $("#pitch_sustain_preset_value").text(parseInt(100 * tone.preset.settings.pitch.envelope.sustain) + "%").show() : "pitch_hold" == e ? tone.settings.pitch.envelope.hold != tone.preset.settings.pitch.envelope.hold && $("#pitch_hold_preset_value").text(tone.preset.settings.pitch.envelope.hold).show() : "pitch_release" == e ? tone.settings.pitch.envelope.release != tone.preset.settings.pitch.envelope.release && $("#pitch_release_preset_value").text(tone.preset.settings.pitch.envelope.release).show() : "lfo_amount" == e ? 0 == selectedLFO ? tone.settings.lfo.volume.level != tone.preset.settings.lfo.volume.level && $("#lfo_amount_preset_value").text(getSettingsAmountToFixed(tone.preset.settings.lfo.volume.level)).show() : 1 == selectedLFO ? tone.settings.lfo.pitch.level != tone.preset.settings.lfo.pitch.level && $("#lfo_amount_preset_value").text(getSettingsAmountToFixed(tone.preset.settings.lfo.pitch.level)).show() : tone.settings.lfo.cutoff.level != tone.preset.settings.lfo.cutoff.level && $("#lfo_amount_preset_value").text(getSettingsAmountToFixed(tone.preset.settings.lfo.cutoff.level)).show() : "lfo_rate_freq" == e ? 1 == getLfoSettings(selectedLFO).sync ? getLfoSettings(selectedLFO).duration != getLfoPresetSettings(selectedLFO).duration && $("#lfo_rate_freq_preset_value").text(getLfoPresetSettings(selectedLFO).duration).show() : getLfoSettings(selectedLFO).frequency != getLfoPresetSettings(selectedLFO).frequency && $("#lfo_rate_freq_preset_value").text(getLfoPresetSettings(selectedLFO).frequency).show() : "lfo_waveform" == e ? getLfoSettings(selectedLFO).waveform != getLfoPresetSettings(selectedLFO).waveform && $("#lfo_waveform_preset_value").text(getLfoPresetSettings(selectedLFO).waveform).show() : "noise" == e ? tone.settings.noise.level != tone.preset.settings.noise.level && $("#noise_preset_value").text(getSettingsAmountToFixed(tone.preset.settings.noise.level)).show() : "noise_resonance" == e ? tone.settings.noise.resonance != tone.preset.settings.noise.resonance && $("#noise_resonance_preset_value").text(parseInt(100 * tone.preset.settings.noise.resonance) + "%").show() : "noise_lowcut" == e ? tone.settings.noise.lowcut != tone.preset.settings.noise.lowcut && $("#noise_lowcut_preset_value").text(parseInt(100 * tone.preset.settings.noise.lowcut) + "%").show() : "noise_highcut" == e ? tone.settings.noise.highcut != tone.preset.settings.noise.highcut && $("#noise_highcut_preset_value").text(parseInt(100 * tone.preset.settings.noise.highcut) + "%").show() : "delay_level" == e ? tone.settings.delay.level != tone.preset.settings.delay.level && $("#delay_level_preset_value").text(getSettingsAmountToFixed(tone.preset.settings.delay.level)).show() : "delay_duration" == e ? tone.settings.delay.duration != tone.preset.settings.delay.duration && $("#delay_duration_preset_value").text(tone.preset.settings.delay.duration).show() : "delay_feedback" == e ? tone.settings.delay.feedback != tone.preset.settings.delay.feedback && $("#delay_feedback_preset_value").text(parseInt(100 * tone.preset.settings.delay.feedback) + "%").show() : "delay_lowcut" == e ? tone.settings.delay.lowcut != tone.preset.settings.delay.lowcut && $("#delay_lowcut_preset_value").text(parseInt(100 * tone.preset.settings.delay.lowcut) + "%").show() : "delay_highcut" == e ? tone.settings.delay.highcut != tone.preset.settings.delay.highcut && $("#delay_highcut_preset_value").text(parseInt(100 * tone.preset.settings.delay.highcut) + "%").show() : "reverb_level" == e ? tone.settings.reverb.level != tone.preset.settings.reverb.level && $("#reverb_level_preset_value").text(getSettingsAmountToFixed(tone.preset.settings.reverb.level)).show() : "reverb_lowcut" == e ? tone.settings.reverb.lowcut != tone.preset.settings.reverb.lowcut && $("#reverb_lowcut_preset_value").text(parseInt(100 * tone.preset.settings.reverb.lowcut) + "%").show() : "reverb_highcut" == e && tone.settings.reverb.highcut != tone.preset.settings.reverb.highcut && $("#reverb_highcut_preset_value").text(parseInt(100 * tone.preset.settings.reverb.highcut) + "%").show() | |
} | |
function getSettingsValueToFixed(e) { | |
return e = e > 1 ? e.toFixed(2) : e.toFixed(3), parseFloat(e) | |
} | |
function getSettingsAmountToFixed(e) { | |
var t = parseFloat(100 * e); | |
return t = e <= .25 ? parseFloat(t.toFixed(1)) : parseFloat(t.toFixed(0)), 0 == e ? t = "Off" : t += "%", t | |
} | |
function updateSettingsLabels() { | |
"notes" == settingsOpenSection && (1 == tone.bars[currentBar].drums ? $("#drums_toggle").addClass("settings-drum-toggle-on") : $("#drums_toggle").removeClass("settings-drum-toggle-on")) | |
} | |
function updateSwitcherDots() { | |
$(".settings-switcher span").css("background", "#ddd"); | |
var e = .7; | |
1 == isLfoActive(0) && $("#lfo_switch_0 span").css("background", getColor(e)), 1 == isLfoActive(1) && $("#lfo_switch_1 span").css("background", getColor(e)), 1 == isLfoActive(2) && $("#lfo_switch_2 span").css("background", getColor(e)), 0 != tone.settings.volume.level && $("#envelope_switch_0 span").css("background", getColor(e)), 0 != tone.settings.filter.envelope.amount && $("#envelope_switch_1 span").css("background", getColor(e)), 0 != tone.settings.pitch.envelope.amount && $("#envelope_switch_2 span").css("background", getColor(e)), tone.settings.delay.level > 0 && $("#effects_switch_0 span").css("background", getColor(e)), tone.settings.reverb.level > 0 && $("#effects_switch_2 span").css("background", getColor(e)), tone.settings.noise.level > 0 && $("#effects_switch_1 span").css("background", getColor(e)), 0 == selectedEnvelope ? $("#shape_title").text("Volume") : 1 == selectedEnvelope ? $("#shape_title").text("Filter") : $("#shape_title").text("Pitch"), 0 == selectedEffect ? $("#effects_title").text("Echo") : 1 == selectedEffect ? $("#effects_title").text("Noise") : $("#effects_title").text("Reverb") | |
} | |
function updateSoundSettings() { | |
try { | |
$("#tempo_slider")[0].noUiSlider.set(tone.tempo), $("#volume_slider")[0].noUiSlider.set(100 * tone.settings.volume.level), $("#attack_slider")[0].noUiSlider.set(100 * tone.settings.volume.envelope.attack), $("#decay_slider")[0].noUiSlider.set(100 * tone.settings.volume.envelope.decay), $("#sustain_slider")[0].noUiSlider.set(100 * tone.settings.volume.envelope.sustain), $("#hold_slider")[0].noUiSlider.set(100 * tone.settings.volume.envelope.hold), $("#release_slider")[0].noUiSlider.set(100 * tone.settings.volume.envelope.release), $("#cutoff_slider")[0].noUiSlider.set(100 * tone.settings.filter.cutoff), $("#resonance_slider")[0].noUiSlider.set(100 * tone.settings.filter.resonance), $("#filter_attack_slider")[0].noUiSlider.set(100 * tone.settings.filter.envelope.attack), $("#filter_decay_slider")[0].noUiSlider.set(100 * tone.settings.filter.envelope.decay), $("#filter_sustain_slider")[0].noUiSlider.set(100 * tone.settings.filter.envelope.sustain), $("#filter_hold_slider")[0].noUiSlider.set(100 * tone.settings.filter.envelope.hold), $("#filter_release_slider")[0].noUiSlider.set(100 * tone.settings.filter.envelope.release), $("#filter_amount_slider")[0].noUiSlider.set(100 * tone.settings.filter.envelope.amount), $("#pitch_attack_slider")[0].noUiSlider.set(100 * tone.settings.pitch.envelope.attack), $("#pitch_decay_slider")[0].noUiSlider.set(100 * tone.settings.pitch.envelope.decay), $("#pitch_sustain_slider")[0].noUiSlider.set(100 * tone.settings.pitch.envelope.sustain), $("#pitch_hold_slider")[0].noUiSlider.set(100 * tone.settings.pitch.envelope.hold), $("#pitch_release_slider")[0].noUiSlider.set(100 * tone.settings.pitch.envelope.release), $("#pitch_amount_slider")[0].noUiSlider.set(100 * tone.settings.pitch.envelope.amount), $("#drum_volume_slider")[0].noUiSlider.set(100 * tone.settings.drums.bd), $("#noise_slider")[0].noUiSlider.set(100 * tone.settings.noise.level), $("#noise_lowcut_slider")[0].noUiSlider.set(100 * tone.settings.noise.lowcut), $("#noise_highcut_slider")[0].noUiSlider.set(100 * tone.settings.noise.highcut), $("#noise_resonance_slider")[0].noUiSlider.set(100 * tone.settings.noise.resonance), $("#delay_duration_slider")[0].noUiSlider.set(getDelayTimeIndex(tone.settings.delay.duration)), $("#delay_feedback_slider")[0].noUiSlider.set(100 * tone.settings.delay.feedback), $("#delay_level_slider")[0].noUiSlider.set(100 * tone.settings.delay.level), $("#delay_lowcut_slider")[0].noUiSlider.set(100 * tone.settings.delay.lowcut), $("#delay_highcut_slider")[0].noUiSlider.set(100 * tone.settings.delay.highcut), $("#reverb_level_slider")[0].noUiSlider.set(100 * tone.settings.reverb.level), $("#reverb_lowcut_slider")[0].noUiSlider.set(100 * tone.settings.reverb.lowcut), $("#reverb_highcut_slider")[0].noUiSlider.set(100 * tone.settings.reverb.highcut) | |
} catch (e) {} | |
} | |
function updateLfoSettings() { | |
var e = getLfoSettings(selectedLFO); | |
try { | |
$("#lfo_waveform_slider")[0].noUiSlider.set(getWaveformIndex(e.waveform, !0)), $("#lfo_amount_slider")[0].noUiSlider.set(100 * e.level), 1 == e.sync ? $("#lfo_rate_slider")[0].noUiSlider.set(getNoteDurationIndex(e.duration)) : $("#lfo_frequency_slider")[0].noUiSlider.set(100 * e.frequency), 0 == selectedLFO || 2 == selectedLFO ? $("#lfo_waveform_slider")[0].noUiSlider.updateOptions({ | |
range: { | |
min: 0, | |
max: 1 | |
} | |
}) : $("#lfo_waveform_slider")[0].noUiSlider.updateOptions({ | |
range: { | |
min: 0, | |
max: waveformsList2.length - 1 | |
} | |
}) | |
} catch (e) {} | |
} | |
function getDiv(e) { | |
return void 0 !== cachedDivs[e] ? cachedDivs[e] : (cachedDivs[e] = $("#" + e), cachedDivs[e]) | |
} | |
function setupEditSettings() { | |
var e = "mousedown", | |
t = "mouseup"; | |
isMobileDevice() && (e = "touchstart", t = "touchend"), $("#clear_button").on("click", function() { | |
clearBar(currentBar) | |
}), $("#shuffle_button").on(e, function() { | |
shuffleBar(currentBar), clearInterval(buttonTriggerTimer), buttonTriggerTimer = setInterval(function() { | |
clearInterval(buttonRepeatTimer), buttonRepeatTimer = setInterval(function() { | |
shuffleBar(currentBar) | |
}, buttonRepeatInterval) | |
}, buttonRepeatAfter) | |
}), $("#undo_button").on(e, function() { | |
undoBar(currentBar), clearInterval(buttonTriggerTimer), buttonTriggerTimer = setInterval(function() { | |
clearInterval(buttonRepeatTimer), buttonRepeatTimer = setInterval(function() { | |
undoBar(currentBar) | |
}, buttonRepeatInterval) | |
}, buttonRepeatAfter) | |
}), $("#redo_button").on(e, function() { | |
redoBar(currentBar), clearInterval(buttonTriggerTimer), buttonTriggerTimer = setInterval(function() { | |
clearInterval(buttonRepeatTimer), buttonRepeatTimer = setInterval(function() { | |
redoBar(currentBar) | |
}, buttonRepeatInterval) | |
}, buttonRepeatAfter) | |
}), $("#copy_button").on(e, function() { | |
copyBar(currentBar) | |
}), $("#paste_button").on(e, function() { | |
pasteBar(currentBar) | |
}), $("#flip_horizontal_button").on(e, function() { | |
flipBar(currentBar, !0), clearInterval(buttonTriggerTimer), buttonTriggerTimer = setInterval(function() { | |
clearInterval(buttonRepeatTimer), buttonRepeatTimer = setInterval(function() { | |
flipBar(currentBar, !0) | |
}, buttonRepeatInterval) | |
}, buttonRepeatAfter) | |
}), $("#flip_vertical_button").on(e, function() { | |
flipBar(currentBar, !1), clearInterval(buttonTriggerTimer), buttonTriggerTimer = setInterval(function() { | |
clearInterval(buttonRepeatTimer), buttonRepeatTimer = setInterval(function() { | |
flipBar(currentBar, !1) | |
}, buttonRepeatInterval) | |
}, buttonRepeatAfter) | |
}), $("#rotate_clock").on(e, function() { | |
rotateBar(currentBar, !0), clearInterval(buttonTriggerTimer), buttonTriggerTimer = setInterval(function() { | |
clearInterval(buttonRepeatTimer), buttonRepeatTimer = setInterval(function() { | |
rotateBar(currentBar, !0) | |
}, buttonRepeatInterval) | |
}, buttonRepeatAfter) | |
}), $("#rotate_counter").on(e, function() { | |
rotateBar(currentBar, !1), clearInterval(buttonTriggerTimer), buttonTriggerTimer = setInterval(function() { | |
clearInterval(buttonRepeatTimer), buttonRepeatTimer = setInterval(function() { | |
rotateBar(currentBar, !1) | |
}, buttonRepeatInterval) | |
}, buttonRepeatAfter) | |
}), $("#shift_up_button").on(e, function() { | |
shiftBar(currentBar, "up"), clearInterval(buttonTriggerTimer), buttonTriggerTimer = setInterval(function() { | |
clearInterval(buttonRepeatTimer), buttonRepeatTimer = setInterval(function() { | |
shiftBar(currentBar, "up") | |
}, buttonRepeatInterval) | |
}, buttonRepeatAfter) | |
}), $("#shift_down_button").on(e, function() { | |
shiftBar(currentBar, "down"), clearInterval(buttonTriggerTimer), buttonTriggerTimer = setInterval(function() { | |
clearInterval(buttonRepeatTimer), buttonRepeatTimer = setInterval(function() { | |
shiftBar(currentBar, "down") | |
}, buttonRepeatInterval) | |
}, buttonRepeatAfter) | |
}), $("#shift_left_button").on(e, function() { | |
shiftBar(currentBar, "left"), clearInterval(buttonTriggerTimer), buttonTriggerTimer = setInterval(function() { | |
clearInterval(buttonRepeatTimer), buttonRepeatTimer = setInterval(function() { | |
shiftBar(currentBar, "left") | |
}, buttonRepeatInterval) | |
}, buttonRepeatAfter) | |
}), $("#shift_right_button").on(e, function() { | |
shiftBar(currentBar, "right"), clearInterval(buttonTriggerTimer), buttonTriggerTimer = setInterval(function() { | |
clearInterval(buttonRepeatTimer), buttonRepeatTimer = setInterval(function() { | |
shiftBar(currentBar, "right") | |
}, buttonRepeatInterval) | |
}, buttonRepeatAfter) | |
}) | |
} | |
function setupBrowseSettings() { | |
var e = "mousedown", | |
t = "mouseup"; | |
isMobileDevice() && (e = "touchstart", t = "touchend"), $("#browse_switcher div").on(e, function() { | |
browseSection = $(this).attr("id").split("_")[2], $("#browse_tones_loading").show(), $("#browse_tones_content").hide(), $("#browse_tones_wrap").scrollTop(0), updatePopoverPosition("browse"), browseLastId = 0, loadBrowse(), $("#browse_switcher div").removeClass("settings-switcher-selected"), $(this).addClass("settings-switcher-selected") | |
}) | |
} | |
function setupBarSettings() { | |
noUiSlider.create($("#repeat_slider")[0], { | |
start: tone.bars[currentBar].repeat, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
step: 1, | |
range: { | |
min: 1, | |
max: 16 | |
} | |
}), $("#repeat_slider")[0].noUiSlider.on("update", function() { | |
barSettingsIndex != -1 && ($("#bar_repeat_" + barSettingsIndex + " div").text(parseInt(this.get())), tone.bars[barSettingsIndex].repeat = parseInt(this.get()), storeTone()) | |
}), $("#delete_bar_button").on("click", function() { | |
tone.bars.length > 1 && deleteBar(barSettingsIndex) | |
}), $("#duplicate_bar_button").on("click", function() { | |
duplicateBar(barSettingsIndex) | |
}), $("#move_bar_left_button").on("click", function() { | |
moveBar(barSettingsIndex, !0) | |
}), $("#move_bar_right_button").on("click", function() { | |
moveBar(barSettingsIndex) | |
}); | |
var e = "mousedown", | |
t = "mouseup"; | |
isMobileDevice() && (e = "touchstart", t = "touchend"), $(".small-button-push").on(e, function() { | |
0 == $(this).hasClass("small-button-push-disabled") && $(this).addClass("small-button-push-on") | |
}), $(".small-button-push").on(t, function() { | |
$(this).removeClass("small-button-push-on") | |
}), $(".medium-button").on(e, function() { | |
0 == $(this).hasClass("medium-button-disabled") && $(this).addClass("medium-button-on") | |
}), $(".medium-button").on(t, function() { | |
$(this).removeClass("medium-button-on") | |
}), $(".large-button").on(e, function() { | |
0 == $(this).hasClass("large-button-disabled") && $(this).addClass("large-button-on") | |
}), $(".large-button").on(t, function() { | |
$(this).removeClass("large-button-on") | |
}) | |
} | |
function setupSoundSettings() { | |
var e = "mousedown", | |
t = "mouseup"; | |
isMobileDevice() && (e = "touchstart", t = "touchend"), $("#envelope_switch_0, #envelope_switch_1, #envelope_switch_2").on("click", function() { | |
selectedEnvelope = parseInt($(this).attr("id").split("_")[2]), $("#envelope_switch_0, #envelope_switch_1, #envelope_switch_2").removeClass("settings-switcher-selected"), $("#envelope_switch_" + selectedEnvelope).addClass("settings-switcher-selected"), $("#envelope_wrap_0, #envelope_wrap_1, #envelope_wrap_2").hide(), $("#envelope_wrap_" + selectedEnvelope).show(), 0 == selectedEnvelope ? $("#shape_title").text("Volume") : 1 == selectedEnvelope ? $("#shape_title").text("Filter") : $("#shape_title").text("Pitch"), updatePopoverPosition("sound"), storeSettings() | |
}), $("#effects_switch_0, #effects_switch_1, #effects_switch_2").on("click", function() { | |
selectedEffect = parseInt($(this).attr("id").split("_")[2]), $("#effects_switch_0, #effects_switch_1, #effects_switch_2").removeClass("settings-switcher-selected"), $("#effects_switch_" + selectedEffect).addClass("settings-switcher-selected"), $("#effects_wrap_0, #effects_wrap_1, #effects_wrap_2").hide(), $("#effects_wrap_" + selectedEffect).show(), 0 == selectedEffect ? $("#effects_title").text("Echo") : 1 == selectedEffect ? $("#effects_title").text("Noise") : $("#effects_title").text("Reverb"), updatePopoverPosition("sound"), storeSettings() | |
}), $("#waveform_switch_0, #waveform_switch_1, #waveform_switch_2, #waveform_switch_3").on("click", function() { | |
var e = parseInt($(this).attr("id").split("_")[2]); | |
tone.settings.oscillator.waveform = waveformsList[e]; | |
for (var t = 0; t < voices.length; t++) null != voices[t] && (voices[t].osc.type = tone.settings.oscillator.waveform); | |
$("#waveform_switch_0, #waveform_switch_1, #waveform_switch_2, #waveform_switch_3").removeClass("settings-switcher-selected"), $("#waveform_switch_" + e).addClass("settings-switcher-selected"), storeTone() | |
}), $("#envelope_switch_0, #envelope_switch_1, #envelope_switch_2").removeClass("settings-switcher-selected"), $("#envelope_switch_" + selectedEnvelope).addClass("settings-switcher-selected"), $("#effects_switch_0, #effects_switch_1, #effects_switch_2").removeClass("settings-switcher-selected"), $("#effects_switch_" + selectedEffect).addClass("settings-switcher-selected"), $("#envelope_wrap_0, #envelope_wrap_1, #envelope_wrap_2").hide(), $("#envelope_wrap_" + selectedEnvelope).show(), $("#effects_wrap_0, #effects_wrap_1, #effects_wrap_2").hide(), $("#effects_wrap_" + selectedEffect).show(), $(".sound-settings-tabs div").on(e, function() { | |
selectedSoundSetting = $(this).attr("id").split("_")[3], updateSelectedSoundSettingsTab(), updatePopoverPosition("sound"), storeSettings() | |
}), $(".settings-slider-preset-value").on(e, function() { | |
var e = $(this).attr("id").replace("_preset_value", ""); | |
restoreSettingsValue(e), $(this).hide() | |
}), setupLfoSettings(), setupVolumeEnvelopeSettings(), setupFilterEnvelopeSettings(), setupPitchEnvelopeSettings(), setupDelaySettings(), setupReverbSettings(), setupNoiseSettings(), setupColorSettings(), noUiSlider.create($("#tempo_slider")[0], { | |
start: tempo, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
step: 1, | |
range: { | |
min: tempoMin, | |
max: tempoMax | |
} | |
}), $("#tempo_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("tempo", parseInt(this.get()), !0), $("#tempo_value").text(parseInt(this.get())) | |
}), $("#tempo_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("tempo") | |
}), $("#tap_tempo_button").off("click").on("click", function() { | |
var e = getTapTempo(); | |
tone.tempo = e, $("#tempo_slider")[0].noUiSlider.set(tone.tempo), setupTone(), startWorkerTimer() | |
}), $("#rolloff_button").on("click", function() { | |
0 == tone.settings.filter.rolloff ? (tone.settings.filter.rolloff = 1, $(this).addClass("small-button-on")) : (tone.settings.filter.rolloff = 0, $(this).removeClass("small-button-on")) | |
}), noUiSlider.create($("#cutoff_slider")[0], { | |
start: 100 * tone.settings.filter.cutoff, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
step: 1, | |
range: { | |
min: 0, | |
max: 100 | |
} | |
}), $("#cutoff_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("cutoff", parseFloat(this.get()) / 100, !0), updateSettingsLabel("cutoff") | |
}), $("#cutoff_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("cutoff") | |
}), noUiSlider.create($("#resonance_slider")[0], { | |
start: 100 * tone.settings.filter.resonance, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
step: 1, | |
range: { | |
min: 0, | |
max: 100 | |
} | |
}), $("#resonance_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("resonance", parseFloat(this.get()) / 100, !0), updateSettingsLabel("resonance") | |
}), $("#resonance_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("resonance") | |
}), noUiSlider.create($("#drum_volume_slider")[0], { | |
start: 100 * tone.settings.drums.bd, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
step: 1, | |
range: { | |
min: 0, | |
max: 100 | |
} | |
}), $("#drum_volume_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("drum_volume", parseFloat(this.get()) / 100, !0), updateSettingsLabel("drum_volume") | |
}), $("#drum_volume_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("drum_volume") | |
}) | |
} | |
function updateSelectedSoundSettingsTab() { | |
$(".settings-sound-wrap").hide(), $("#settings_sound_" + selectedSoundSetting).show(), $(".sound-settings-tabs div").removeClass("sound-settings-tab-selected"), $("#sound_settings_tab_" + selectedSoundSetting).addClass("sound-settings-tab-selected"), "preset" == selectedSoundSetting && loadPresets() | |
} | |
function loadPresets() { | |
$.ajax({ | |
url: "/api/1/get_presets/" + tone.id, | |
type: "GET", | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
if (0 == e.success); | |
else { | |
if (e.last_id == presetsLastId) return; | |
presetsLastId = e.last_id, presets = e.presets, drawPresets() | |
} | |
} | |
}) | |
} | |
function updatePresetTitle() { | |
$("#preset_title").text(tone.preset.title + (tone.preset.version > 1 ? " " + tone.preset.version : "")), updatePopoverPosition("sound") | |
} | |
function drawPresets() { | |
if (0 != presets.length) { | |
var e = JSON.parse(JSON.stringify(presets)), | |
t = $("#presets_wrap").html(""), | |
n = $("<div />").addClass("preset-row").attr("id", "preset_" + tone.id).appendTo(t); | |
$("<div />").text(tone.title + (tone.version > 1 ? " " + tone.version : "")).appendTo(n); | |
tone.preset.id == tone.id && n.addClass("preset-row-selected").css("background", getColor(1)); | |
for (var i = 0; i < e.length; i++) { | |
var o = $("<div />").addClass("preset-row").attr("id", "preset_" + e[i].id).appendTo(t); | |
$("<div />").text(e[i].title + (e[i].version > 1 ? " " + e[i].version : "")).appendTo(o); | |
e[i].id == tone.preset.id && o.addClass("preset-row-selected").css("background", getColor(1)) | |
} | |
$("#presets_wrap .preset-row").on("click", function() { | |
var e = parseInt($(this).attr("id").split("_")[1]); | |
$(".preset-row-selected").removeClass("preset-row-selected").css("background", ""), $(this).addClass("preset-row-selected").css("background", getColor(1)), loadPreset(e) | |
}), updatePopoverPosition("sound") | |
} | |
} | |
function loadPreset(e) { | |
doLoadPreset(e) | |
} | |
function doLoadPreset(e) { | |
$.ajax({ | |
url: "/api/1/get_preset/" + e, | |
type: "GET", | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
0 == e.success || setTonePreset(e.preset) | |
} | |
}) | |
} | |
function setTonePreset(e) { | |
tone.preset = e, tone.preset.settings = JSON.parse(tone.preset.settings), updateToneEdited(), updateToneSettings() | |
} | |
function updateToneEdited() { | |
clearTimeout(updatePresetEditedTimer), updatePresetEditedTimer = setTimeout(function() { | |
tone.edited = !1, tone.original_tempo != tone.tempo && (tone.edited = !0), tone.original_preset_id != tone.preset.id && (tone.edited = !0), JSON.stringify(tone.preset.settings) != JSON.stringify(tone.settings) && (tone.edited = !0); | |
for (var e = JSON.parse(JSON.stringify(tone.bars)), t = 0; t < e.length; t++) delete e[t].notes, delete e[t].notes_start_index, delete e[t].undo, delete e[t].redo, delete e[t].repeat_current; | |
for (var t = 0; t < tone.original_bars.length; t++) delete tone.original_bars[t].notes, delete tone.original_bars[t].notes_start_index, delete tone.original_bars[t].undo, delete tone.original_bars[t].redo, delete tone.original_bars[t].repeat_current; | |
JSON.stringify(tone.original_bars) != JSON.stringify(e) && (tone.edited = !0), updateSaveButton() | |
}, 300) | |
} | |
function updateSaveButton() { | |
1 == tone.edited ? showSaveButton() : showInfoButton() | |
} | |
function showSaveButton() { | |
$("#save_value_cell").css("display", "table-cell"), $("#save_label_cell").css("display", "table-cell"), $("#info_value_cell").hide(), $("#info_label_cell").hide() | |
} | |
function showInfoButton() { | |
$("#save_value_cell").hide(), $("#save_label_cell").hide(), $("#info_value_cell").css("display", "table-cell"), $("#info_label_cell").css("display", "table-cell") | |
} | |
function updateToneSettings(e) { | |
var e = "undefined" != typeof e && e, | |
t = !1; | |
1 == playing && (t = !0, stopPlaying()), setDelayFeedback(0); | |
for (var n = 0; n < voices.length; n++) voices[n].envelope.gain.cancelScheduledValues(audioContext.currentTime), voices[n].envelope.gain.setTargetAtTime(0, audioContext.currentTime, secondsToTimeConstant(.25)), voices[n].osc.detune.cancelScheduledValues(audioContext.currentTime), voices[n].osc.detune.setTargetAtTime(0, audioContext.currentTime, secondsToTimeConstant(.01)), voices[n].filter.detune.cancelScheduledValues(audioContext.currentTime), voices[n].filter2.detune.cancelScheduledValues(audioContext.currentTime), voices[n].filter.detune.setTargetAtTime(0, audioContext.currentTime, secondsToTimeConstant(.25)), voices[n].filter2.detune.setTargetAtTime(0, audioContext.currentTime, secondsToTimeConstant(.25)); | |
clearTimeout(setToneSettingsTimer), setToneSettingsTimer = setTimeout(function() { | |
tone.settings = JSON.parse(JSON.stringify(tone.preset.settings)), setupToneSettings(), currentBar = 0, currentTick = 0, animatingNotes = [], 1 != t && 1 != e || setTimeout(function() { | |
startPlaying(!0) | |
}, 250), storeTone() | |
}, 300) | |
} | |
function setupVolumeEnvelopeSettings() { | |
noUiSlider.create($("#volume_slider")[0], { | |
start: 100 * tone.settings.volume.level, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
step: 1, | |
range: { | |
min: [0, .1], | |
"58%": [10, .5], | |
"68%": [25, 1], | |
"90%": [50, 5], | |
max: [100] | |
} | |
}), $("#volume_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("volume", parseFloat(this.get()) / 100, !0), updateSettingsLabel("volume") | |
}), $("#volume_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("volume") | |
}), noUiSlider.create($("#attack_slider")[0], { | |
start: 100 * tone.settings.volume.envelope.attack, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
range: { | |
min: [.3, .1], | |
"58%": [10, 5], | |
"68%": [100, 10], | |
"90%": [500, 50], | |
max: [1e3] | |
} | |
}), $("#attack_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("attack", parseFloat(this.get()) / 100, !0), updateSettingsLabel("attack") | |
}), $("#attack_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("attack") | |
}), noUiSlider.create($("#decay_slider")[0], { | |
start: 100 * tone.settings.volume.envelope.decay, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
range: { | |
min: [.3, .1], | |
"58%": [10, 5], | |
"68%": [100, 10], | |
"90%": [500, 50], | |
max: [1e3] | |
} | |
}), $("#decay_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("decay", parseFloat(this.get()) / 100, !0), updateSettingsLabel("decay") | |
}), $("#decay_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("decay") | |
}), noUiSlider.create($("#sustain_slider")[0], { | |
start: 100 * tone.settings.volume.envelope.sustain, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
step: 1, | |
range: { | |
min: 0, | |
max: 100 | |
} | |
}), $("#sustain_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("sustain", parseFloat(this.get()) / 100, !0), updateSettingsLabel("sustain") | |
}), $("#sustain_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("sustain") | |
}), noUiSlider.create($("#hold_slider")[0], { | |
start: 100 * tone.settings.volume.envelope.hold, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
range: { | |
min: [.3, .1], | |
"58%": [10, 5], | |
"68%": [100, 10], | |
"90%": [500, 50], | |
max: [1e3] | |
} | |
}), $("#hold_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("hold", parseFloat(this.get()) / 100, !0), updateSettingsLabel("hold") | |
}), $("#hold_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("hold") | |
}), noUiSlider.create($("#release_slider")[0], { | |
start: 100 * tone.settings.volume.envelope.release, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
range: { | |
min: [.3, .1], | |
"58%": [10, 5], | |
"68%": [100, 10], | |
"90%": [500, 50], | |
max: [1e3] | |
} | |
}), $("#release_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("release", parseFloat(this.get()) / 100, !0), updateSettingsLabel("release") | |
}), $("#release_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("release") | |
}) | |
} | |
function updateFilterAmountSlider() { | |
0 == tone.settings.filter.envelope.invert ? $("#filter_amount_invert").removeClass("small-button-on") : $("#filter_amount_invert").addClass("small-button-on") | |
} | |
function updatePitchAmountSlider() { | |
0 == tone.settings.pitch.envelope.invert ? $("#pitch_amount_invert").removeClass("small-button-on") : $("#pitch_amount_invert").addClass("small-button-on") | |
} | |
function setupFilterEnvelopeSettings() { | |
$("#filter_amount_invert").on("click", function() { | |
tone.settings.filter.envelope.invert = !tone.settings.filter.envelope.invert, updateFilterAmountSlider(), updateSettingsValue("filter_amount", tone.settings.filter.envelope.amount, !0), updateSettingsLabel("filter_amount"), storeTone() | |
}), noUiSlider.create($("#filter_amount_slider")[0], { | |
start: 100 * tone.settings.filter.envelope.amount, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
step: 1, | |
range: { | |
min: [0, .1], | |
"58%": [10, .5], | |
"68%": [25, 1], | |
"90%": [50, 5], | |
max: [100] | |
} | |
}), $("#filter_amount_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("filter_amount", parseFloat(this.get()) / 100, !0), updateSettingsLabel("filter_amount") | |
}), $("#filter_amount_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("filter_amount") | |
}), noUiSlider.create($("#filter_attack_slider")[0], { | |
start: 100 * tone.settings.filter.envelope.attack, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
range: { | |
min: [.3, .1], | |
"58%": [10, 5], | |
"68%": [100, 10], | |
"90%": [500, 50], | |
max: [1e3] | |
} | |
}), $("#filter_attack_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("filter_attack", parseFloat(this.get()) / 100, !0), updateSettingsLabel("filter_attack") | |
}), $("#filter_attack_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("filter_attack") | |
}), noUiSlider.create($("#filter_decay_slider")[0], { | |
start: 100 * tone.settings.filter.envelope.decay, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
range: { | |
min: [.3, .1], | |
"58%": [10, 5], | |
"68%": [100, 10], | |
"90%": [500, 50], | |
max: [1e3] | |
} | |
}), $("#filter_decay_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("filter_decay", parseFloat(this.get()) / 100, !0), updateSettingsLabel("filter_decay") | |
}), $("#filter_decay_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("filter_decay") | |
}), noUiSlider.create($("#filter_sustain_slider")[0], { | |
start: 100 * tone.settings.filter.envelope.sustain, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
step: 1, | |
range: { | |
min: 0, | |
max: 100 | |
} | |
}), $("#filter_sustain_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("filter_sustain", parseFloat(this.get()) / 100, !0), updateSettingsLabel("filter_sustain") | |
}), $("#filter_sustain_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("filter_sustain") | |
}), noUiSlider.create($("#filter_hold_slider")[0], { | |
start: 100 * tone.settings.filter.envelope.hold, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
range: { | |
min: [.3, .1], | |
"58%": [10, 5], | |
"68%": [100, 10], | |
"90%": [500, 50], | |
max: [1e3] | |
} | |
}), $("#filter_hold_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("filter_hold", parseFloat(this.get()) / 100, !0), updateSettingsLabel("filter_hold") | |
}), $("#filter_hold_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("filter_hold") | |
}), noUiSlider.create($("#filter_release_slider")[0], { | |
start: 100 * tone.settings.filter.envelope.release, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
range: { | |
min: [.3, .1], | |
"58%": [10, 5], | |
"68%": [100, 10], | |
"90%": [500, 50], | |
max: [1e3] | |
} | |
}), $("#filter_release_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("filter_release", parseFloat(this.get()) / 100, !0), updateSettingsLabel("filter_release") | |
}), $("#filter_release_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("filter_release") | |
}) | |
} | |
function setupPitchEnvelopeSettings() { | |
$("#pitch_amount_invert").on("click", function() { | |
tone.settings.pitch.envelope.invert = !tone.settings.pitch.envelope.invert, updatePitchAmountSlider(), updateSettingsValue("pitch_amount", tone.settings.pitch.envelope.amount, !0), updateSettingsLabel("pitch_amount"), storeTone() | |
}), noUiSlider.create($("#pitch_amount_slider")[0], { | |
start: 100 * tone.settings.pitch.envelope.amount, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
step: 1, | |
range: { | |
min: [0, .1], | |
"58%": [10, .5], | |
"68%": [25, 1], | |
"90%": [50, 5], | |
max: [100] | |
} | |
}), $("#pitch_amount_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("pitch_amount", parseFloat(this.get()) / 100, !0), updateSettingsLabel("pitch_amount") | |
}), $("#pitch_amount_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("pitch_amount") | |
}), noUiSlider.create($("#pitch_attack_slider")[0], { | |
start: 100 * tone.settings.pitch.envelope.attack, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
range: { | |
min: [.3, .1], | |
"58%": [10, 5], | |
"68%": [100, 10], | |
"90%": [500, 50], | |
max: [1e3] | |
} | |
}), $("#pitch_attack_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("pitch_attack", parseFloat(this.get()) / 100, !0), updateSettingsLabel("pitch_attack") | |
}), $("#pitch_attack_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("pitch_attack") | |
}), noUiSlider.create($("#pitch_decay_slider")[0], { | |
start: 100 * tone.settings.pitch.envelope.decay, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
range: { | |
min: [.3, .1], | |
"58%": [10, 5], | |
"68%": [100, 10], | |
"90%": [500, 50], | |
max: [1e3] | |
} | |
}), $("#pitch_decay_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("pitch_decay", parseFloat(this.get()) / 100, !0), updateSettingsLabel("pitch_decay") | |
}), $("#pitch_decay_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("pitch_decay") | |
}), noUiSlider.create($("#pitch_sustain_slider")[0], { | |
start: 100 * tone.settings.pitch.envelope.sustain, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
step: 1, | |
range: { | |
min: 0, | |
max: 100 | |
} | |
}), $("#pitch_sustain_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("pitch_sustain", parseFloat(this.get()) / 100, !0), updateSettingsLabel("pitch_sustain") | |
}), $("#pitch_sustain_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("pitch_sustain") | |
}), noUiSlider.create($("#pitch_hold_slider")[0], { | |
start: 100 * tone.settings.pitch.envelope.hold, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
range: { | |
min: [.3, .1], | |
"58%": [10, 5], | |
"68%": [100, 10], | |
"90%": [500, 50], | |
max: [1e3] | |
} | |
}), $("#pitch_hold_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("pitch_hold", parseFloat(this.get()) / 100, !0), updateSettingsLabel("pitch_hold") | |
}), $("#pitch_hold_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("pitch_hold") | |
}), noUiSlider.create($("#pitch_release_slider")[0], { | |
start: 100 * tone.settings.pitch.envelope.release, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
range: { | |
min: [.3, .1], | |
"58%": [10, 5], | |
"68%": [100, 10], | |
"90%": [500, 50], | |
max: [1e3] | |
} | |
}), $("#pitch_release_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("pitch_release", parseFloat(this.get()) / 100, !0), updateSettingsLabel("pitch_release") | |
}), $("#pitch_release_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("pitch_release") | |
}) | |
} | |
function setupLfoSettings() { | |
$("#lfo_switch_0, #lfo_switch_1, #lfo_switch_2").on("click", function() { | |
var e = parseInt($(this).attr("id").split("_")[2]); | |
selectedLFO = e, 0 == selectedLFO ? $("#lfo_title").text("Volume") : 1 == selectedLFO ? $("#lfo_title").text("Pitch") : $("#lfo_title").text("Filter"), drawSelectedLfoTab(), storeSettings() | |
}), noUiSlider.create($("#lfo_amount_slider")[0], { | |
start: 100 * getLfoSettings(selectedLFO).level, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
range: { | |
min: [0, .1], | |
"58%": [10, .5], | |
"68%": [25, 1], | |
"90%": [50, 5], | |
max: [100] | |
} | |
}), $("#lfo_amount_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("lfo_amount", parseFloat(this.get()) / 100, !0), updateSettingsLabel("lfo_amount") | |
}), $("#lfo_amount_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("lfo_amount") | |
}), noUiSlider.create($("#lfo_rate_slider")[0], { | |
start: getNoteDurationIndex(getLfoSettings(selectedLFO).duration), | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
step: 1, | |
range: { | |
min: 1, | |
max: noteDurationStrings.length - 1 | |
} | |
}), $("#lfo_rate_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("lfo_rate_freq", noteDurationStrings[parseInt(this.get())], !0), updateSettingsLabel("lfo_rate_freq") | |
}), $("#lfo_rate_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("lfo_rate_freq") | |
}), noUiSlider.create($("#lfo_frequency_slider")[0], { | |
start: 100 * getLfoSettings(selectedLFO).frequency, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
range: { | |
min: [.1, .01], | |
"25%": [5, 10], | |
"70%": [1e3, 50], | |
max: [3e3] | |
} | |
}), $("#lfo_frequency_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("lfo_rate_freq", parseFloat(this.get()) / 100, !0), updateSettingsLabel("lfo_rate_freq") | |
}), $("#lfo_frequency_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("lfo_rate_freq") | |
}), $("#lfo_sync_button").on("click", function() { | |
0 == getLfoSettings(selectedLFO).sync ? (0 == selectedLFO ? tone.settings.lfo.volume.sync = !0 : 1 == selectedLFO ? tone.settings.lfo.pitch.sync = !0 : tone.settings.lfo.cutoff.sync = !0, $(this).addClass("small-button-on"), $("#lfo_rate_wrap").show(), $("#lfo_frequency_wrap").hide()) : (0 == selectedLFO ? tone.settings.lfo.volume.sync = !1 : 1 == selectedLFO ? tone.settings.lfo.pitch.sync = !1 : tone.settings.lfo.cutoff.sync = !1, $(this).removeClass("small-button-on"), $("#lfo_rate_wrap").hide(), $("#lfo_frequency_wrap").show()), 1 == getLfoSettings(selectedLFO).sync ? setLfoDuration(selectedLFO, getLfoSettings(selectedLFO).duration, !1) : setLfoFrequency(selectedLFO, getLfoSettings(selectedLFO).frequency), drawSelectedLfoTab(), storeTone() | |
}), noUiSlider.create($("#lfo_waveform_slider")[0], { | |
start: getWaveformIndex(getLfoSettings(selectedLFO).waveform, !0), | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
step: 1, | |
range: { | |
min: 0, | |
max: waveformsList2.length - 1 | |
} | |
}), $("#lfo_waveform_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("lfo_waveform", waveformsList2[parseInt(this.get())], !0), updateSettingsLabel("lfo_waveform") | |
}), $("#lfo_waveform_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("lfo_waveform") | |
}) | |
} | |
function drawSelectedLfoTab() { | |
$("#lfo_switch_0, #lfo_switch_1, #lfo_switch_2").removeClass("settings-switcher-selected"), $("#lfo_switch_" + selectedLFO).addClass("settings-switcher-selected"), updateLfoSettingsLabels(), updateLfoSettings() | |
} | |
function updateLfoSettingsLabels() { | |
var e = getLfoSettings(selectedLFO); | |
if (0 == selectedLFO ? $("#lfo_title").text("Volume") : 1 == selectedLFO ? $("#lfo_title").text("Pitch") : $("#lfo_title").text("Filter"), 1 == e.sync ? ($("#lfo_sync_button").addClass("small-button-on"), $("#lfo_rate_wrap").show(), $("#lfo_frequency_wrap").hide()) : ($("#lfo_sync_button").removeClass("small-button-on"), $("#lfo_rate_wrap").hide(), $("#lfo_frequency_wrap").show()), $("#lfo_waveform_value").text(e.waveform), $("#lfo_amount_value").text(getSettingsAmountToFixed(e.level)), 1 == e.sync) $("#lfo_rate_freq_label").text("Speed"), $("#lfo_rate_freq_value").text(e.duration); | |
else { | |
$("#lfo_rate_freq_label").text("Speed"); | |
var t = e.frequency; | |
0 == t || (t += " Hz"), $("#lfo_rate_freq_value").text(t) | |
} | |
} | |
function setupDelaySettings() { | |
noUiSlider.create($("#delay_level_slider")[0], { | |
start: 100 * tone.settings.delay.level, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
step: 1, | |
range: { | |
min: 0, | |
max: 100 | |
} | |
}), $("#delay_level_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("delay_level", parseFloat(this.get()) / 100, !0), updateSettingsLabel("delay_level") | |
}), $("#delay_level_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("delay_level") | |
}), noUiSlider.create($("#delay_duration_slider")[0], { | |
start: getDelayTimeIndex(tone.settings.delay.duration), | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
step: 1, | |
range: { | |
min: 0, | |
max: delayTimeStrings.length - 1 | |
} | |
}), $("#delay_duration_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("delay_duration", delayTimeStrings[parseInt(this.get())], !0), updateSettingsLabel("delay_duration") | |
}), $("#delay_duration_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("delay_duration") | |
}), noUiSlider.create($("#delay_feedback_slider")[0], { | |
start: 100 * tone.settings.delay.feedback, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
step: 1, | |
range: { | |
min: 0, | |
max: 80 | |
} | |
}), $("#delay_feedback_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("delay_feedback", parseFloat(this.get()) / 100, !0), updateSettingsLabel("delay_feedback") | |
}), $("#delay_feedback_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("delay_feedback") | |
}), noUiSlider.create($("#delay_lowcut_slider")[0], { | |
start: 100 * tone.settings.delay.lowcut, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
step: 1, | |
range: { | |
min: 0, | |
max: 100 | |
} | |
}), $("#delay_lowcut_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("delay_lowcut", parseFloat(this.get()) / 100, !0), updateSettingsLabel("delay_lowcut") | |
}), $("#delay_lowcut_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("delay_lowcut") | |
}), noUiSlider.create($("#delay_highcut_slider")[0], { | |
start: 100 * tone.settings.delay.highcut, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
step: 1, | |
range: { | |
min: 0, | |
max: 100 | |
} | |
}), $("#delay_highcut_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("delay_highcut", parseFloat(this.get()) / 100, !0), updateSettingsLabel("delay_highcut") | |
}), $("#delay_highcut_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("delay_highcut") | |
}) | |
} | |
function setupReverbSettings() { | |
noUiSlider.create($("#reverb_level_slider")[0], { | |
start: 100 * tone.settings.reverb.level, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
step: 1, | |
range: { | |
min: 0, | |
max: 100 | |
} | |
}), $("#reverb_level_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("reverb_level", parseFloat(this.get()) / 100, !0), updateSettingsLabel("reverb_level") | |
}), $("#reverb_level_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("reverb_level") | |
}), noUiSlider.create($("#reverb_lowcut_slider")[0], { | |
start: 100 * tone.settings.reverb.lowcut, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
step: 1, | |
range: { | |
min: 0, | |
max: 100 | |
} | |
}), $("#reverb_lowcut_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("reverb_lowcut", parseFloat(this.get()) / 100, !0), updateSettingsLabel("reverb_lowcut") | |
}), $("#reverb_lowcut_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("reverb_lowcut") | |
}), noUiSlider.create($("#reverb_highcut_slider")[0], { | |
start: 100 * tone.settings.reverb.highcut, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
step: 1, | |
range: { | |
min: 0, | |
max: 100 | |
} | |
}), $("#reverb_highcut_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("reverb_highcut", parseFloat(this.get()) / 100, !0), updateSettingsLabel("reverb_highcut") | |
}), $("#reverb_highcut_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("reverb_highcut") | |
}) | |
} | |
function setupNoiseSettings() { | |
noUiSlider.create($("#noise_slider")[0], { | |
start: 100 * tone.settings.noise.level, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
step: 1, | |
range: { | |
min: [0, .1], | |
"58%": [10, .5], | |
"68%": [25, 1], | |
"90%": [50, 5], | |
max: [100] | |
} | |
}), $("#noise_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("noise", parseFloat(this.get()) / 100, !0), updateSettingsLabel("noise") | |
}), $("#noise_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("noise") | |
}), noUiSlider.create($("#noise_resonance_slider")[0], { | |
start: 100 * tone.settings.noise.resonance, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
step: 1, | |
range: { | |
min: 0, | |
max: 100 | |
} | |
}), $("#noise_resonance_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("noise_resonance", parseFloat(this.get()) / 100, !0), updateSettingsLabel("noise_resonance") | |
}), $("#noise_resonance_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("noise_resonance") | |
}), noUiSlider.create($("#noise_lowcut_slider")[0], { | |
start: 100 * tone.settings.noise.lowcut, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
step: 1, | |
range: { | |
min: 0, | |
max: 100 | |
} | |
}), $("#noise_lowcut_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("noise_lowcut", parseFloat(this.get()) / 100, !0), updateSettingsLabel("noise_lowcut") | |
}), $("#noise_lowcut_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("noise_lowcut") | |
}), noUiSlider.create($("#noise_highcut_slider")[0], { | |
start: 100 * tone.settings.noise.highcut, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
step: 1, | |
range: { | |
min: 0, | |
max: 100 | |
} | |
}), $("#noise_highcut_slider")[0].noUiSlider.on("slide", function() { | |
updateSettingsValue("noise_highcut", parseFloat(this.get()) / 100, !0), updateSettingsLabel("noise_highcut") | |
}), $("#noise_highcut_slider")[0].noUiSlider.on("set", function() { | |
updateSettingsLabel("noise_highcut") | |
}) | |
} | |
function setupColorSettings() {} | |
function getColorIndexFromHue(e) { | |
for (var t = 0; t < colors.length; t++) | |
if (colors[t].hue == e) return t; | |
return 0 | |
} | |
function drawScaleButtons() { | |
$("#settings_scale_wrap").html(""); | |
for (var e = 0; e < scaleStrings.length; e++) { | |
var t = $("<span />").attr("id", "settings_scale_" + e).data("scale_index", e).appendTo("#settings_scale_wrap"); | |
"Pentatonic Major" == scaleStrings[e] ? t.text("Major") : t.text("Minor"), tone.bars[currentBar].scale == scaleStrings[e] && t.addClass("settings-segments-selected"), t.on("click", function() { | |
var e = parseInt($(this).data("scale_index")); | |
tone.bars[currentBar].scale = scaleStrings[e], $("#settings_scale_wrap .settings-segments-selected").css("background", "").removeClass("settings-segments-selected"), $(this).addClass("settings-segments-selected"), "Pentatonic Minor" == tone.bars[currentBar].scale ? $("#scale_value").text("Minor") : $("#scale_value").text("Major"), $("#settings_scale_wrap .settings-segments-selected").css("background", getColor()), generateScaleNotes(currentBar), storeTone() | |
}) | |
} | |
$("#settings_scale_wrap .settings-segments-selected").css("background", getColor()) | |
} | |
function hideSettings() { | |
hideMenu(), $(".settings-popover").hide(), $("#matrix_overlay").hide(), settingsOpenSection = "", barSettingsIndex = -1 | |
} | |
function showSettings(e) { | |
settingsOpenSection != e && (hideMenu(), $(".settings-popover").hide(), $("#matrix_overlay").show(), $("#settings_" + e).show(), settingsOpenSection = e) | |
} | |
function showBrowseSettings() { | |
return "browse" == settingsOpenSection ? void hideSettings() : (showSettings("browse"), void updatePopoverPosition("browse")) | |
} | |
function showSoundSettings() { | |
return "sound" == settingsOpenSection ? void hideSettings() : (updateSelectedSoundSettingsTab(), updateLfoSettings(), updateFilterAmountSlider(), updatePitchAmountSlider(), updateToneEdited(), $(".preset-row-selected").css("background", getColor(1)), showSettings("sound"), void updatePopoverPosition("sound")) | |
} | |
function showNotesSettings() { | |
return "notes" == settingsOpenSection ? void hideSettings() : (drawScaleButtons(), drawPiano(), 1 == tone.bars[currentBar].drums ? $("#drums_toggle").addClass("settings-drum-toggle-on") : $("#drums_toggle").removeClass("settings-drum-toggle-on"), $(".menu-notes-octave-label").text(tone.bars[currentBar].octave), showSettings("notes"), void updatePopoverPosition("notes")) | |
} | |
function drawPiano() { | |
for (var e = $("#key_piano").html(""), t = $("<div />").addClass("menu-notes-container").appendTo(e), n = tone.bars[currentBar].key, i = tone.bars[currentBar].octave, o = $("<div />").addClass("menu-notes-wrap").appendTo(t), s = 0; s < pianoNotes.length; s++) { | |
var a = $("<div />").attr("id", "menu_piano_" + s).addClass("menu-notes-key").html("<span>" + pianoNotes[s] + "</span>").appendTo(o); | |
a.addClass("menu-notes-key-" + s), pianoNotes[s].indexOf("#") != -1 && a.addClass("menu-notes-key-black"), pianoNotes[s] == n && (pianoNotes[s].indexOf("#") != -1 ? a.addClass("menu-notes-key-black-selected") : a.addClass("menu-notes-key-white-selected")), a.on("click", function() { | |
var e = parseInt($(this).attr("id").split("_")[2]), | |
t = pianoNotes[e]; | |
tone.bars[currentBar].key = t, generateScaleNotes(currentBar), storeTone(), $(".menu-notes-key-white-selected").removeClass("menu-notes-key-white-selected"), $(".menu-notes-key-black-selected").removeClass("menu-notes-key-black-selected"), t.indexOf("#") != -1 ? $(this).addClass("menu-notes-key-black-selected") : $(this).addClass("menu-notes-key-white-selected") | |
}) | |
} | |
var r = $("<div />").addClass("menu-notes-octave-wrap").appendTo(t), | |
l = $("<div />").addClass("menu-notes-octave-up").html("<i class='fa fa-sort-asc fa-2x'></i>").appendTo(r), | |
u = ($("<div />").addClass("menu-notes-octave-label").text(i).appendTo(r), $("<div />").addClass("menu-notes-octave-down").html("<i class='fa fa-sort-desc fa-2x'></i>").appendTo(r)); | |
l.on("click", function() { | |
tone.bars[currentBar].octave++, tone.bars[currentBar].octave > 10 && (tone.bars[currentBar].octave = 10), generateScaleNotes(currentBar), storeTone(), $(".menu-notes-octave-label").text(tone.bars[currentBar].octave) | |
}), u.on("click", function() { | |
tone.bars[currentBar].octave--, tone.bars[currentBar].octave < -10 && (tone.bars[currentBar].octave = -10), generateScaleNotes(currentBar), storeTone(), $(".menu-notes-octave-label").text(tone.bars[currentBar].octave) | |
}) | |
} | |
function showEditSettings() { | |
return "edit" == settingsOpenSection ? void hideSettings() : (showSettings("edit"), updatePopoverPosition("edit"), void updateEditButtons(currentBar)) | |
} | |
function showInfoSettings(e) { | |
var e = "undefined" != typeof e && e; | |
return "info" == settingsOpenSection && 0 == e ? void hideSettings() : ($("#tone_info_content_wrap").show(), $("#tone_info_loading").hide(), updateInfoTabContent(), showSettings("info"), updatePopoverPosition("info"), void setTimeout(function() { | |
updatePopoverPosition("info") | |
}, 10)) | |
} | |
function updateInfoTabContent() { | |
if ($("#tone_info_title").html(cleanupText(tone.title) + (tone.version > 1 ? " " + tone.version : "")), $("#tone_info_oldness").text(getOldness(tone.date_timestamp, !1, !1, !1)), $("#info_cover").data("username", tone.user.username).css("background", "rgba(" + getUserColor(tone.user) + ",1.0)"), null != tone.notes && tone.notes.length > 0 ? $("#tone_info_notes").show().html(cleanupText(tone.notes)) : $("#tone_info_notes").hide(), 1 == tone["private"] ? $("#tone_info_privacy").show() : $("#tone_info_privacy").hide(), $("#tone_info_plays").text(tone.plays_count), $("#tone_info_likes").text(tone.favorites_count), $("#tone_info_comments").text(tone.comments_count), $("#tone_info_remixes").text(tone.remix_count), null != tone.parent_tone) { | |
$("#tone_info_remix_wrap").show(); | |
var e = $("#tone_info_remix").html("Remix of "); | |
1 == tone.parent_tone["private"] && e.append('<i class="fa fa-lock fa-3x fa-fw"></i>'); | |
var t = $("<span />").data("tone_id", tone.parent_tone.id).html(cleanupText(tone.parent_tone.title) + (tone.parent_tone.version > 1 ? " " + tone.parent_tone.version : "")).appendTo(e); | |
t.off("click").on("click", function() { | |
var e = parseInt($(this).data("tone_id")); | |
setTimeout(function() { | |
loadToneFromInfo(e) | |
}, 20) | |
}), e.append(" by "); | |
var n = $("<span />").data("username", tone.parent_tone.user.username).html(cleanupText(null == tone.parent_tone.user.name ? tone.parent_tone.user.username : tone.parent_tone.user.name)).appendTo(e); | |
n.off("click").on("click", function() { | |
var e = $(this).data("username"); | |
setTimeout(function() { | |
showProfile(e) | |
}, 20) | |
}) | |
} else $("#tone_info_remix_wrap").hide(); | |
var i = tone.user.username; | |
null != tone.user.name && tone.user.name.length > 0 && (i = tone.user.name), $("#tone_info_author").data("username", tone.user.username).text(i), $("#tone_info_author, #info_cover").off("click").on("click", function() { | |
var e = $(this).data("username"); | |
showProfile(e) | |
}), 1 == tone.liked ? ($("#like_button").addClass("medium-button-selected"), $("#like_button span").text("Liked")) : ($("#like_button").removeClass("medium-button-selected"), $("#like_button span").text("Like")) | |
} | |
function cleanupText(e, t) { | |
var t = "undefined" == typeof t || t; | |
return e = e.split("<").join("<"), e = e.split(">").join(">"), e = jQuery.trim(e), e = e.replace(/(\n\n\n)+/g, "\n\n"), 1 == t && (e = e.replace(/\r\n/g, "<br />").replace(/\n/g, "<br />")), e | |
} | |
function getUserColor(e) { | |
var t = "252,16,81"; | |
return null != e.avatar && (t = e.avatar), t | |
} | |
function showToneMenu() { | |
return 1 == menuOpen ? void hideMenu() : (menuParent = $("#info_more_button"), menuType = "tone", void showMenu()) | |
} | |
function showProfileMenu() { | |
return 1 == menuOpen ? void hideMenu() : (menuParent = $("#profile_more_button"), menuType = "profile", void showMenu()) | |
} | |
function hideMenu() { | |
0 != menuOpen && ($("#context_menu").hide(), menuOpen = !1, menuTouched = !1) | |
} | |
function showMenu() { | |
if (null != menuParent) { | |
var e = $("#context_menu"); | |
drawMenu(), $(".context-menu-wrap div", e).length > 0 && (e.show(), menuOpen = !0), updateMenuPosition() | |
} | |
} | |
function updateMenuPosition() { | |
if (null != menuParent) { | |
var e = menuParent.offset(), | |
t = e.top + menuParent.height(), | |
n = e.left, | |
i = $("#context_menu"), | |
o = i.outerWidth(), | |
s = i.outerHeight(), | |
a = menuParent.outerWidth(), | |
r = menuParent.outerHeight(); | |
"tone" != menuType && "profile" != menuType || (n -= o - a, t += 12), n + o > $(window).innerWidth() && (n = n - o + a), t + s > $(window).innerHeight() + $(window).scrollTop() && (t = t - s - r), i.css("top", t + "px").css("left", n + "px") | |
} | |
} | |
function drawMenu() { | |
if (null != menuParent) { | |
var e = $("#context_menu").html(""), | |
t = $("<div />").addClass("context-menu-container").appendTo(e), | |
n = $("<div />").addClass("context-menu-wrap").appendTo(t); | |
if ("tone" == menuType) | |
if (userLoggedIn() && tone.user.id == currentUser.id) { | |
var i = $("<div />").addClass("context-menu-item").appendTo(n); | |
$("<i />").addClass("fa fa-pencil fa-3x fa-fw").appendTo(i), $("<span />").text("Edit").addClass("").appendTo(i), i.on("click", function(e) { | |
return showEditTone(), e.preventDefault(), e.stopPropagation(), !1 | |
}); | |
var o = $("<div />").addClass("context-menu-item").appendTo(n); | |
$("<i />").addClass("fa fa-trash fa-3x fa-fw").appendTo(o), $("<span />").text("Delete").addClass("").appendTo(o), o.on("click", function() { | |
showDialog("delete") | |
}) | |
} else { | |
var s = $("<div />").addClass("context-menu-item").appendTo(n); | |
$("<i />").addClass("fa fa-exclamation-circle fa-3x fa-fw").appendTo(s), $("<span />").text("Report").addClass("").appendTo(s), s.on("click", function() { | |
showDialog("report") | |
}) | |
} | |
else if ("profile" == menuType) { | |
var s = $("<div />").addClass("context-menu-item").appendTo(n); | |
$("<i />").addClass("fa fa-exclamation-circle fa-3x fa-fw").appendTo(s), $("<span />").text("Report").addClass("").appendTo(s), s.on("click", function() { | |
showDialog("report") | |
}) | |
} | |
} | |
} | |
function showEditTone() { | |
hideSettings(), editingTone = !0, $("#save_header_title").text("Edit Tone"), $("#save_title").val(tone.title), $("#save_notes").val(tone.notes), $(".dialog-radio-button").removeClass("dialog-radio-button-on"), 1 == tone["private"] ? $("#privacy_button_0 div").addClass("dialog-radio-button-on") : $("#privacy_button_1 div").addClass("dialog-radio-button-on"), showSaveDialog() | |
} | |
function showSaveTone() { | |
hideSettings(), editingTone = !1, $("#save_header_title").text("Save Tone"), $("#save_title").val(tone.title), $("#save_notes").val(""), $(".dialog-radio-button").removeClass("dialog-radio-button-on"), 1 == tone["private"] ? $("#privacy_button_0 div").addClass("dialog-radio-button-on") : $("#privacy_button_1 div").addClass("dialog-radio-button-on"), showSaveDialog() | |
} | |
function showSaveDialog(e) { | |
var e = "undefined" == typeof e ? "" : e; | |
if (!userLoggedIn()) return void showRegisterDialog(); | |
e.length > 0 ? $("#save_error").text(e).show() : $("#save_error").hide(), showDialog("save"), setTimeout(function() { | |
var e = $("#save_title").val(), | |
t = $("#save_notes").val(); | |
e.length > 0 ? ($("#save_notes").focus(), $("#save_notes").val(""), $("#save_notes").val(t)) : $("#save_title").focus() | |
}, 50) | |
} | |
function updatePopoverPosition(e) { | |
var t = $("#" + e + "_button").width(), | |
n = $("#" + e + "_button").offset().left - 10, | |
i = $(window).width() / 2 - $("#settings_" + e).width() / 2, | |
o = $("#" + e + "_button").offset().left - 10, | |
s = $("#settings_wrap").offset().top - $("#settings_" + e + " .settings-popover-inner").height() - 21; | |
if (i > n - t / 2 && i < n + t / 2 && (o = i), o > $("#" + e + "_button").offset().left - 10 && (o = $("#" + e + "_button").offset().left - 10), "sound" == e ? s += 12 : "notes" == e ? (s -= 11, o += 10) : "browse" == e && (s += 12), o + $("#settings_" + e).width() > $("#layout_table").offset().left - 26 + $("#layout_table").width()) { | |
var a = Math.round($("#layout_table").offset().left - 26 + $("#layout_table").width()) - (o + $("#settings_" + e).width()), | |
r = -3; | |
"notes" == e || "info" == e && (r = -1), $("#settings_" + e + " .settings-popover-arrow").css("left", Math.abs(a) + r + "px"), o = o + a + 10 | |
} else { | |
var r = 10; | |
"notes" == e && (r = 30), $("#settings_" + e + " .settings-popover-arrow").css("left", n - o + r + "px") | |
} | |
$("#settings_" + e).css("left", o).css("top", s) | |
} | |
function showBarSettings(e) { | |
if ("bar" == settingsOpenSection && e == barSettingsIndex) return void hideSettings(); | |
barSettingsIndex = e; | |
var t = $("#bar_" + e).offset().left + $("#bar_" + e).width() - 37, | |
n = $("#bar_" + e).offset().top + $("#bar_" + e).height() - 5; | |
if (t + $("#settings_bar").width() > $("#layout_table").offset().left - 7 + $("#layout_table").width()) { | |
var i = Math.round($("#layout_table").offset().left - 7 + $("#layout_table").width()) - (t + $("#settings_bar").width()); | |
$("#settings_bar_arrow").css("left", 0 - i + 7 + "px"), t += i | |
} else $("#settings_bar_arrow").css("left", "9px"); | |
$("#settings_bar").css("left", t).css("top", n), showSettings("bar"), updateBarButtons(e) | |
} | |
function shareTone() {} | |
function getColorByHue(e, t) { | |
var t = "undefined" == typeof t ? 1 : t, | |
n = HSVtoRGB(e / 360, 1, 1); | |
return "rgba(" + n.r + "," + n.g + "," + n.b + "," + t + ")" | |
} | |
function getColor(e) { | |
var e = "undefined" == typeof e ? 1 : e; | |
return getColorByHue(colors[0].hue, e) | |
} | |
function HSVtoRGB(e, t, n) { | |
var i, o, s, a, r, l, u, c; | |
switch (1 === arguments.length && (t = e.s, n = e.v, e = e.h), a = Math.floor(6 * e), r = 6 * e - a, l = n * (1 - t), u = n * (1 - r * t), c = n * (1 - (1 - r) * t), a % 6) { | |
case 0: | |
i = n, o = c, s = l; | |
break; | |
case 1: | |
i = u, o = n, s = l; | |
break; | |
case 2: | |
i = l, o = n, s = c; | |
break; | |
case 3: | |
i = l, o = u, s = n; | |
break; | |
case 4: | |
i = c, o = l, s = n; | |
break; | |
case 5: | |
i = n, o = l, s = u | |
} | |
return { | |
r: Math.round(255 * i), | |
g: Math.round(255 * o), | |
b: Math.round(255 * s) | |
} | |
} | |
function selectView(e, t) { | |
"profile" == e || "home" == e || "messages" == e || "help" == e ? $(".layout-header").addClass("layout-header-shadow") : $(".layout-header").removeClass("layout-header-shadow"), $(".layout-content-wrap").hide(), currentView = e, $("#" + currentView + "_wrap").show(), "create" == currentView ? $("#repeat_button").show() : $("#repeat_button").hide(), updateLayoutScrollHeight(), "help" != currentView ? $("[data-src]").each(function() { | |
$(this).attr("src", "https://d8ev4i00v2x30.cloudfront.net/assets/blank-6d8ba81d1b60a18707722a1f2b62dad48a6acced95a1933f49a68b5016620b93.gif") | |
}) : $("[data-src]").each(function() { | |
$(this).attr("src", $(this).data("src")) | |
}) | |
} | |
function updateLayoutScrollHeight() { | |
$("#" + currentView + "_wrap .layout-scroll-wrap").height(contentHeight) | |
} | |
function showShareDialog(e, t, n) { | |
var e = "undefined" == typeof e ? tone.id : e, | |
t = "undefined" == typeof t ? tone.user.username : t, | |
n = "undefined" == typeof n ? tone.url_title : n; | |
if (hideSettings(), shareToneId = e, e == tone.id) { | |
if (0 == tone.user.id) return void showAlert("Tone Not Saved", "You must save this tone before you can share it."); | |
if (1 == tone["private"]) return void showAlert("Private Tone", "You need to edit this tone and make it public before you can share it.") | |
} | |
$("#share_url").val("https://www.tones.fm/" + t + "/" + n), generateShareUrls(), $("#share_twitter_button").attr("href", shareTwitterUrl), $("#share_facebook_button").attr("href", shareFacebookUrl), $("#share_pinterest_button").attr("href", sharePinterestUrl), $("#share_tumblr_button").attr("href", shareTumblrUrl), $("#share_google_button").attr("href", shareGoogleUrl), $("#share_email_button").attr("href", shareEmailUrl), showDialog("share") | |
} | |
function generateShareUrls() { | |
shareUrl = $("#share_url").val(), shareFacebookUrl = "https://www.facebook.com/sharer/sharer.php?u=" + encodeURIComponent(shareUrl), shareGoogleUrl = "https://plus.google.com/share?url=" + encodeURIComponent(shareUrl), shareTwitterUrl = "https://twitter.com/share?url=" + encodeURIComponent(shareUrl) + "&text=Have%20you%20heard%20%E2%80%98" + encodeURIComponent(tone.title) + "%E2%80%99%20by%20" + encodeURIComponent(tone.user.username) + "%20on%20%23tonesfm%3F", sharePinterestUrl = "http://pinterest.com/pin/create/link/?url=" + encodeURIComponent(shareUrl) + "&description=" + encodeURIComponent(tone.title), shareTumblrUrl = "https://www.tumblr.com/widgets/share/tool?shareSource=legacy&canonicalUrl=" + encodeURIComponent(shareUrl) + "&posttype=link", shareEmailUrl = "mailto:?subject=" + encodeURIComponent(tone.title + " - Tones.fm") + "&body=" + encodeURIComponent(shareUrl) | |
} | |
function openSharer(e) { | |
if (isMobileDevice()) return !0; | |
generateShareUrls(), trackShareClick(shareToneId); | |
return "twitter" == e ? popupCenter(shareTwitterUrl, "twitterwindow", 255, 550) : "facebook" == e ? popupCenter(shareFacebookUrl, "sharer", 424, 555) : "google" == e ? popupCenter(shareGoogleUrl, "Google Share", 436, 626) : "pinterest" == e ? popupCenter(sharePinterestUrl, "pinterest", 700, 626) : "tumblr" == e ? popupCenter(shareTumblrUrl, "tumblr", 436, 626) : setTimeout(function() { | |
window.location.href = shareEmailUrl | |
}, 300), !1 | |
} | |
function trackShareClick(e) { | |
userLoggedIn() && $.ajax({ | |
url: "/api/1/track_share", | |
data: { | |
tone_id: e | |
}, | |
type: "POST", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function() {}, | |
error: function() {} | |
}) | |
} | |
function popupCenter(e, t, n, i) { | |
var o = void 0 != window.screenLeft ? window.screenLeft : window.screenX, | |
s = void 0 != window.screenTop ? window.screenTop : window.screenY, | |
a = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width, | |
r = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height, | |
l = a / 2 - i / 2 + o, | |
u = r / 2 - n / 2 + s, | |
c = window.open(e, t, "scrollbars=yes, width=" + i + ", height=" + n + ", top=" + u + ", left=" + l); | |
window.focus && c.focus() | |
} | |
function submitReport() { | |
if (1 != reportPosting) { | |
var e = $.trim($("#report_comment").val()); | |
reportPosting = !0; | |
var t = null, | |
n = null, | |
i = null, | |
o = null; | |
if (viewHistory.length > 0) { | |
var s = viewHistory.slice(viewHistory.length - 1, viewHistory.length)[0]; | |
"messages" == s.view_type ? i = s.view_type_id : "profile" == s.view_type ? t = s.view_type_id : "tone" == s.view_type && (n = s.view_type_id) | |
} else n = tone.id; | |
$.ajax({ | |
url: "/api/1/save_report", | |
data: { | |
profile_id: t, | |
tone_id: n, | |
message_id: i, | |
comment_id: o, | |
comment: e | |
}, | |
type: "POST", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function() { | |
reportPosting = !1, $("#report_comment").val(""), showAlert("Thanks", "Your report has been received and will be reviewed as soon as possible.") | |
}, | |
error: function() { | |
showAlert("Error", "There was a problem sending the report."), reportPosting = !1 | |
} | |
}) | |
} | |
} | |
function postComment() { | |
if (!userLoggedIn()) return void showRegisterDialog(); | |
if (1 != commentPosting) { | |
var e = $.trim($("#tone_info_comments_input").val()); | |
if (0 == e.length) return void $("#tone_info_comments_input").focus(); | |
commentPosting = !0, $("#tone_info_comments_button").addClass("small-button-push-disabled").text("Posting..."), $.ajax({ | |
url: "/api/1/save_comment/" + tone.id, | |
data: { | |
comment: e | |
}, | |
type: "POST", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
commentPosting = !1, $("#tone_info_comments_button").removeClass("small-button-push-disabled").text("Post Comment"), $("#tone_info_comments_input").val(""), $("#tone_info_comments_input").blur(), 0 == e.success ? showAlert("Error", "Unable to save comment.") : (tone.comments_count = e.comments_count, $("#tone_info_comments").text(tone.comments_count), profileCache = [], storeTone(), showInfoComments()) | |
}, | |
error: function() { | |
showAlert("Error", "Unable to save comment."), $("#tone_info_comments_button").removeClass("small-button-push-disabled").text("Post Comment"), commentPosting = !1 | |
} | |
}) | |
} | |
} | |
function setupInfo() { | |
$("#tone_info_tabs div").on("click", function() { | |
selectedInfoTab = parseInt($(this).attr("id").split("_")[3]), $(".tone-info-tab-selected").removeClass("tone-info-tab-selected"), $(this).addClass("tone-info-tab-selected"), $(".tone-info-content").hide(), $("#tone_info_content_" + selectedInfoTab).show(), 1 == selectedInfoTab ? showInfoComments() : 2 == selectedInfoTab ? showInfoLikes() : 3 == selectedInfoTab && showInfoRemixes(), updatePopoverPosition("info") | |
}), $(".tone-info-tab-selected").removeClass("tone-info-tab-selected"), $("#tone_info_tab_" + selectedInfoTab).addClass("tone-info-tab-selected"), $(".tone-info-content").hide(), $("#tone_info_content_" + selectedInfoTab).show(), $("#tone_info_comments_input").on("focus", function() { | |
$(this).css("height", "50px"), $("#tone_info_comments_button").show() | |
}), $("#tone_info_comments_input").on("blur", function() { | |
0 == $(this).val().length && ($(this).css("height", "34px"), $("#tone_info_comments_button").hide()) | |
}), $("#tone_info_comments_input").on("input", function() { | |
$(this).val().length > 0 && ($(this).css("height", "50px"), $("#tone_info_comments_button").show()) | |
}) | |
} | |
function showInfoAbout() { | |
selectedInfoTab = 0, $(".tone-info-tab-selected").removeClass("tone-info-tab-selected"), $("#tone_info_tab_" + selectedInfoTab).addClass("tone-info-tab-selected"), $(".tone-info-content").hide(), $("#tone_info_content_" + selectedInfoTab).show() | |
} | |
function clearInfoContent() { | |
$("#tone_info_comments_content").hide(), $("#tone_info_likes_content").hide(), $("#tone_info_remixes_content").hide(), $("#tone_info_comments_loading").show(), $("#tone_info_likes_loading").show(), $("#tone_info_remixes_loading").show() | |
} | |
function reloadInfoContent() { | |
clearInfoContent(), 1 == selectedInfoTab ? showInfoComments() : 2 == selectedInfoTab ? showInfoLikes() : 3 == selectedInfoTab && showInfoRemixes() | |
} | |
function showInfoComments() { | |
1 != infoCommentsLoading && (infoCommentsLoading = !0, $("#tone_info_comments_loading").show(), $("#tone_info_comments_content").hide(), $.ajax({ | |
url: "/api/1/get_comments/" + tone.id, | |
data: {}, | |
type: "GET", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
infoCommentsLoading = !1, drawComments(e.comments) | |
}, | |
error: function() { | |
infoCommentsLoading = !1 | |
} | |
})) | |
} | |
function showInfoLikes() { | |
1 != infoLikesLoading && (infoLikesLoading = !0, $("#tone_info_likes_loading").show(), $("#tone_info_likes_content").hide(), $.ajax({ | |
url: "/api/1/get_likes/" + tone.id, | |
data: {}, | |
type: "GET", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
infoLikesLoading = !1, drawLikes(e.likes) | |
}, | |
error: function() { | |
infoLikesLoading = !1 | |
} | |
})) | |
} | |
function showInfoRemixes() { | |
1 != infoRemixesLoading && (infoRemixesLoading = !0, $("#tone_info_remixes_loading").show(), $("#tone_info_remixes_content").hide(), $.ajax({ | |
url: "/api/1/get_remixes/" + tone.id, | |
data: {}, | |
type: "GET", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
infoRemixesLoading = !1, drawRemixes(e.remixes) | |
}, | |
error: function() { | |
infoRemixesLoading = !1 | |
} | |
})) | |
} | |
function drawComments(e) { | |
$("#tone_info_comments_loading").hide(); | |
var t = $("#tone_info_comments_content").html(""); | |
if (0 == e.length) return $("<div />").addClass("info-content-none").text("No comments yet.").appendTo(t), void t.show(); | |
for (var n = 0; n < e.length; n++) { | |
var i = $("<table />").addClass("tone-info-comments-table").attr("cellspacing", 0).attr("cellpadding", 0).attr("id", "comment_" + e[n].id).appendTo(t), | |
o = $("<tr />").appendTo(i), | |
s = $("<td />").attr("valign", "top").addClass("tone-info-comments-avatar").appendTo(o), | |
a = ($("<div />").css("background", "rgb(" + e[n].user.avatar + ")").data("username", e[n].user.username).appendTo(s), $("<td />").attr("valign", "top").addClass("tone-info-comments-body").appendTo(o)); | |
$("<b />").text(e[n].user.name).data("username", e[n].user.username).appendTo(a), $("<span />").text(getOldness(e[n].date_timestamp, !1, !1, !1)).appendTo(a), $("<div />").text(e[n].comment).appendTo(a) | |
} | |
$("td.tone-info-comments-avatar div, td.tone-info-comments-body b").on("click", function() { | |
var e = $(this).data("username"); | |
showProfile(e) | |
}), t.show() | |
} | |
function drawLikes(e) { | |
$("#tone_info_likes_loading").hide(); | |
var t = $("#tone_info_likes_content").html(""); | |
if (0 == e.length) return $("<div />").addClass("info-content-none").text("No likes yet.").appendTo(t), void t.show(); | |
for (var n = 0; n < e.length; n++) { | |
var i = $("<table />").addClass("tone-info-likes-table").attr("cellspacing", 0).attr("cellpadding", 0).attr("id", "like_" + e[n].id).appendTo(t), | |
o = $("<tr />").appendTo(i), | |
s = $("<td />").attr("valign", "top").addClass("tone-info-likes-avatar").appendTo(o), | |
a = ($("<div />").css("background", "rgb(" + e[n].user.avatar + ")").data("username", e[n].user.username).appendTo(s), $("<td />").attr("valign", "top").addClass("tone-info-likes-body").appendTo(o)); | |
$("<b />").text(e[n].user.name).data("username", e[n].user.username).appendTo(a) | |
} | |
$("td.tone-info-likes-avatar div, td.tone-info-likes-body b").on("click", function() { | |
var e = $(this).data("username"); | |
showProfile(e) | |
}), t.show() | |
} | |
function drawRemixes(e) { | |
$("#tone_info_remixes_loading").hide(); | |
var t = $("#tone_info_remixes_content").html(""); | |
if (0 == e.length) return $("<div />").addClass("info-content-none").text("No remixes yet.").appendTo(t), void t.show(); | |
for (var n = 0; n < e.length; n++) { | |
var i = $("<table />").addClass("tone-info-remixes-table").attr("cellspacing", 0).attr("cellpadding", 0).attr("id", "remix_" + e[n].id).appendTo(t), | |
o = $("<tr />").appendTo(i), | |
s = $("<td />").attr("valign", "top").addClass("tone-info-remixes-avatar").appendTo(o), | |
a = ($("<div />").css("background", "rgb(" + e[n].user.avatar + ")").data("tone_id", e[n].id).appendTo(s), $("<td />").attr("valign", "top").addClass("tone-info-remixes-body").appendTo(o)); | |
$("<div />").text(e[n].title + (1 == e[n].version ? "" : " " + e[n].version)).data("tone_id", e[n].id).appendTo(a), $("<b />").text(e[n].user.name).data("username", e[n].user.username).appendTo(a) | |
} | |
$("td.tone-info-remixes-avatar div, td.tone-info-remixes-body div").on("click", function() { | |
var e = parseInt($(this).data("tone_id")); | |
loadToneFromInfo(e) | |
}), $("td.tone-info-remixes-body b").on("click", function() { | |
var e = $(this).data("username"); | |
showProfile(e) | |
}), t.show() | |
} | |
function loadToneFromInfo(e) { | |
loadTone(e, !0, !0), 0 != $("#browse_row_" + e).length ? ($(".preset-row-selected").removeClass("preset-row-selected").css("background", ""), $("#browse_row_" + e).addClass("preset-row-selected").css("background", getColor(1))) : (browseLastId = 0, "browse" == settingsOpenSection && loadBrowse()) | |
} | |
function setupProfile() { | |
$("#profile_tabs div").on("click", function() { | |
selectedProfileTab = parseInt($(this).attr("id").split("_")[2]), showProfileTab() | |
}), $(".profile-tab-selected").removeClass("profile-tab-selected"), $("#profile_tab_" + selectedProfileTab).addClass("profile-tab-selected"), $(".profile-content").hide(), $("#profile_content_" + selectedProfileTab).show(); | |
var e = "mousedown", | |
t = "mouseup"; | |
isMobileDevice() && (e = "touchstart", t = "touchend"), $("#follow_button").on("click", function() { | |
followUser() | |
}), $("#profile_edit_button").on("click", function() { | |
setTimeout(function() { | |
showEditProfile() | |
}, 10) | |
}), $("#message_button").on("click", function() { | |
return userLoggedIn() ? (showDialog("message"), void setTimeout(function() { | |
$("#new_message_input").focus() | |
}, 100)) : void showRegisterDialog() | |
}), $("#edit_profile_avatar").on(t, function() { | |
0 == selectedEditColor ? (selectedEditColor = !0, $("#edit_profile_color_wrap, #edit_profile_color_top_wrap").show(), $("#edit_profile_fields_wrap, #edit_profile_fields_top_wrap").hide(), $("#edit_profile_avatar i").removeClass("fa-chevron-down").addClass("fa-chevron-left")) : (selectedEditColor = !1, $("#edit_profile_color_wrap, #edit_profile_color_top_wrap").hide(), $("#edit_profile_fields_wrap, #edit_profile_fields_top_wrap").show(), $("#edit_profile_avatar i").removeClass("fa-chevron-left").addClass("fa-chevron-down")) | |
}), noUiSlider.create($("#edit_profile_red_slider")[0], { | |
start: 0, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
step: 1, | |
range: { | |
min: 0, | |
max: 255 | |
} | |
}), noUiSlider.create($("#edit_profile_green_slider")[0], { | |
start: 0, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
step: 1, | |
range: { | |
min: 0, | |
max: 255 | |
} | |
}), noUiSlider.create($("#edit_profile_blue_slider")[0], { | |
start: 0, | |
animate: !1, | |
connect: "lower", | |
behaviour: "drag", | |
step: 1, | |
range: { | |
min: 0, | |
max: 255 | |
} | |
}), $("#edit_profile_red_slider")[0].noUiSlider.on("slide", function() { | |
updateEditProfileColor() | |
}), $("#edit_profile_green_slider")[0].noUiSlider.on("slide", function() { | |
updateEditProfileColor() | |
}), $("#edit_profile_blue_slider")[0].noUiSlider.on("slide", function() { | |
updateEditProfileColor() | |
}), $("#edit_profile_color_wrap .sliders .noUi-connect").css("background", getColor(.8)), $("#edit_profile_color_code").on("input", function() { | |
var e = hexToRgb($(this).val()); | |
null != e && ($("#edit_profile_red_slider")[0].noUiSlider.set(e.r), $("#edit_profile_green_slider")[0].noUiSlider.set(e.g), $("#edit_profile_blue_slider")[0].noUiSlider.set(e.b), updateEditProfileColor(!1)) | |
}) | |
} | |
function rgbToHex(e, t, n) { | |
return e = parseInt(e), t = parseInt(t), n = parseInt(n), "#" + ((1 << 24) + (e << 16) + (t << 8) + n).toString(16).slice(1) | |
} | |
function hexToRgb(e) { | |
var t = /^#?([a-f\d])([a-f\d])([a-f\d])$/i; | |
e = e.replace(t, function(e, t, n, i) { | |
return t + t + n + n + i + i | |
}); | |
var n = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e); | |
return n ? { | |
r: parseInt(n[1], 16), | |
g: parseInt(n[2], 16), | |
b: parseInt(n[3], 16) | |
} : null | |
} | |
function showEditProfile() { | |
if (0 != userLoggedIn()) { | |
$("#edit_profile_name").val(currentUser.name), $("#edit_profile_location").val(null == currentUser.location ? "" : currentUser.location), $("#edit_profile_bio").val(null == currentUser.about ? "" : currentUser.about); | |
var e = currentUser.avatar.split(","); | |
$("#edit_profile_red_slider")[0].noUiSlider.set(e[0]), $("#edit_profile_green_slider")[0].noUiSlider.set(e[1]), $("#edit_profile_blue_slider")[0].noUiSlider.set(e[2]), updateEditProfileColor(), showEditProfileDialog(), $("#dialog_edit_profile input").blur() | |
} | |
} | |
function updateEditProfileColor(e) { | |
var e = "undefined" == typeof e || e, | |
t = parseInt($("#edit_profile_red_slider")[0].noUiSlider.get()), | |
n = parseInt($("#edit_profile_green_slider")[0].noUiSlider.get()), | |
i = parseInt($("#edit_profile_blue_slider")[0].noUiSlider.get()), | |
o = t + "," + n + "," + i; | |
$("#edit_profile_avatar").css("background", "rgb(" + o + ")"), $("#edit_profile_color_wrap .sliders .noUi-connect").css("background", "rgb(" + o + ")"), 1 == e && $("#edit_profile_color_code").val(rgbToHex(t, n, i)) | |
} | |
function showEditProfileDialog(e) { | |
var e = "undefined" == typeof e ? "" : e; | |
e.length > 0 ? $("#edit_profile_error").text(e).show() : $("#edit_profile_error").hide(), showDialog("edit_profile") | |
} | |
function setProfileFollowButton(e) { | |
var e = "undefined" == typeof e || e; | |
0 == e ? ($("#follow_button").removeClass("medium-button-selected"), $("#follow_button i").addClass("fa-user-plus").removeClass("fa-check"), $("#follow_button span").text("Follow")) : ($("#follow_button").addClass("medium-button-selected"), $("#follow_button i").removeClass("fa-user-plus").addClass("fa-check"), $("#follow_button span").text("Following")) | |
} | |
function saveProfile() { | |
if (1 != profileSaving) { | |
currentUser.name = $("#edit_profile_name").val(), currentUser.location = $("#edit_profile_location").val(), currentUser.about = $("#edit_profile_bio").val(); | |
var e = parseInt($("#edit_profile_red_slider")[0].noUiSlider.get()), | |
t = parseInt($("#edit_profile_green_slider")[0].noUiSlider.get()), | |
n = parseInt($("#edit_profile_blue_slider")[0].noUiSlider.get()); | |
currentUser.avatar = e + "," + t + "," + n, updateCurrentUserStorage(), hideDialogs(), showInfoAlert("Saving, please wait..."), $.ajax({ | |
url: "/api/1/save_profile", | |
data: { | |
name: currentUser.name, | |
location: currentUser.location, | |
about: currentUser.about, | |
avatar: currentUser.avatar | |
}, | |
type: "POST", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
hideDialogs(), profileSaving = !1, 0 == e.success ? showAlert("Error", "Unable to save profile.") : (profileCache = [], profileTonesCache = [], tone.user.id == currentUser.id && (tone.user.name = currentUser.name, tone.user.avatar = currentUser.avatar, storeTone()), reloadInfoContent(), updatePageTitle(), setTimeout(function() { | |
showProfile(currentUser.username) | |
}, 20)) | |
}, | |
error: function() { | |
showAlert("Error", "Unable to save profile."), hideDialogs(), profileSaving = !1 | |
} | |
}) | |
} | |
} | |
function followUser() { | |
if (!userLoggedIn()) return void showRegisterDialog(); | |
var e = viewHistory.slice(viewHistory.length - 1, viewHistory.length)[0], | |
t = e.view_type_id; | |
$.ajax({ | |
url: "/api/1/follow/" + t, | |
type: "POST", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
0 == e.success ? showAlert("Error", "Unable to follow user.") : (profileCache = [], $("#profile_followers_count").text(e.profile.followers_count), setProfileFollowButton(e.following), 4 == selectedProfileTab && showProfileFollowers()) | |
} | |
}) | |
} | |
function followUsername(e) { | |
return userLoggedIn() ? void $.ajax({ | |
url: "/api/1/follow/" + e, | |
type: "POST", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
0 == e.success && showAlert("Error", "Unable to follow user.") | |
} | |
}) : void showRegisterDialog() | |
} | |
function showProfileTab() { | |
$(".profile-tab-selected").removeClass("profile-tab-selected"), $("#profile_tab_" + selectedProfileTab).addClass("profile-tab-selected"), $(".profile-content").html(""), $(".profile-content").hide(), $("#profile_content_" + selectedProfileTab).show(), 0 == selectedProfileTab ? showProfileTones() : 1 == selectedProfileTab ? showProfileLikes() : 2 == selectedProfileTab ? showProfileComments() : 3 == selectedProfileTab ? showProfileFollowing() : 4 == selectedProfileTab && showProfileFollowers() | |
} | |
function getProfileCacheIndex(e) { | |
for (var t = -1, n = 0; n < profileCache.length; n++) | |
if (profileCache[n].username == e) { | |
t = n; | |
break | |
} | |
return t | |
} | |
function showProfile(e, t) { | |
var t = "undefined" == typeof t || t; | |
loadingProfileUsername = e, hideMainMenu(), hideDialogs(), hideSettings(), selectView("profile"), $("#profile_loading").show(), $("#profile_content_wrap").hide(); | |
var n = getProfileCacheIndex(e); | |
if (n != -1) { | |
if (Math.floor(Date.now() / 1e3) - profileCache[n].timestamp < 300) { | |
1 == t && (selectedProfileTab = 0, addToViewHistory("profile", e)); | |
var i = JSON.parse(JSON.stringify(profileCache[n].profile_data)); | |
return processProfileData(i), void(loadingProfileUsername = "") | |
} | |
profileCache.splice(n, 1) | |
} | |
$.ajax({ | |
url: "/api/1/get_profile/" + e, | |
type: "GET", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
if (0 == e.success) showAlert("Error", "Unable to load profile."), loadingProfileUsername = ""; | |
else { | |
if (e.profile.username != loadingProfileUsername) return; | |
var n = getProfileCacheIndex(e.profile.username); | |
n != -1 ? profileCache[n].profile_data = e : profileCache.push({ | |
username: e.profile.username, | |
profile_data: e, | |
timestamp: Math.floor(Date.now() / 1e3) | |
}), 1 == t && (selectedProfileTab = 0, addToViewHistory("profile", e.profile.username)), processProfileData(e) | |
} | |
} | |
}) | |
} | |
function processProfileData(e) { | |
drawProfile(e), updatePageTitle(), updateUrlState(), $("#profile_loading").hide(), $("#profile_content_wrap").show(), $(document).scrollTop(currentScrollTop), loadingProfileUsername = "", showProfileTab() | |
} | |
function drawProfile(e) { | |
$("#profile_avatar").css("background", "rgb(" + e.profile.avatar + ")"), $("#profile_name").text(null == e.profile.name || 0 == e.profile.name.length ? e.profile.username : e.profile.name), $("#profile_username").text(e.profile.username), null != e.profile.about && e.profile.about.length > 0 ? $("#profile_bio").html(cleanupText(e.profile.about)).show() : $("#profile_bio").text("").hide(), null != e.profile.location && e.profile.location.length > 0 ? ($("#profile_location span").text(e.profile.location), $("#profile_location").show()) : ($("#profile_location span").text(""), $("#profile_location").hide()), $("#profile_tones_count").text(formatNumber(e.profile.tones_count)), $("#profile_likes_count").text(formatNumber(e.profile.favorites_count)), $("#profile_comments_count").text(formatNumber(e.profile.comments_count)), $("#profile_following_count").text(formatNumber(e.profile.following_count)), $("#profile_followers_count").text(formatNumber(e.profile.followers_count)), userLoggedIn() && e.profile.id == currentUser.id ? ($("#profile_own_buttons").show(), $("#profile_buttons").hide()) : ($("#profile_own_buttons").hide(), $("#profile_buttons").show()), setProfileFollowButton(e.following), $("#new_message_avatar").css("background", "rgb(" + e.profile.avatar + ")"), $("#new_message_user").text(null == e.profile.name || 0 == e.profile.name.length ? e.profile.username : e.profile.name), $("#new_message_input").val(""), $("#new_message_submit_button").html(" Send ") | |
} | |
function getProfileTonesCacheIndex(e) { | |
for (var t = -1, n = 0; n < profileTonesCache.length; n++) | |
if (profileTonesCache[n].username == e) { | |
t = n; | |
break | |
} | |
return t | |
} | |
function showProfileTones() { | |
if (1 != profileTonesLoading) { | |
profileTonesLoading = !0, $("#profile_content_0").hide(), $("#profile_content_loading").show(); | |
var e = viewHistory.slice(viewHistory.length - 1, viewHistory.length)[0], | |
t = e.view_type_id, | |
n = getProfileTonesCacheIndex(t); | |
if (n != -1) | |
if (Math.floor(Date.now() / 1e3) - profileTonesCache[n].timestamp < 300) { | |
var i = JSON.parse(JSON.stringify(profileTonesCache[n].profile_data)); | |
drawTones(i), profileTonesLoading = !1 | |
} else profileTonesCache.splice(n, 1); | |
$.ajax({ | |
url: "/api/1/get_profile/" + t + "/tones", | |
data: {}, | |
type: "GET", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
profileTonesLoading = !1; | |
var t = getProfileTonesCacheIndex(e.profile.username); | |
t != -1 && e.tones.length > 0 && e.tones[e.tones.length - 1].id == profileTonesCache[t].last_id || (t != -1 ? (profileTonesCache[t].profile_data = e, profileTonesCache[t].last_id = 0 == e.tones.length ? 0 : e.tones[e.tones.length - 1].id, profileTonesCache[t].timestamp = Math.floor(Date.now() / 1e3)) : profileTonesCache.push({ | |
username: e.profile.username, | |
profile_data: e, | |
last_id: 0 == e.tones.length ? 0 : e.tones[e.tones.length - 1].id, | |
timestamp: Math.floor(Date.now() / 1e3) | |
}), 0 == selectedProfileTab && drawTones(e)) | |
}, | |
error: function() { | |
profileTonesLoading = !1 | |
} | |
}) | |
} | |
} | |
function showProfileLikes() { | |
if (1 != profileLikesLoading) { | |
profileLikesLoading = !0, $("#profile_content_1").hide(), $("#profile_content_loading").show(); | |
var e = viewHistory.slice(viewHistory.length - 1, viewHistory.length)[0], | |
t = e.view_type_id; | |
$.ajax({ | |
url: "/api/1/get_profile/" + t + "/likes", | |
data: {}, | |
type: "GET", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
profileLikesLoading = !1, 1 == selectedProfileTab && drawTones(e, "likes") | |
}, | |
error: function() { | |
profileLikesLoading = !1 | |
} | |
}) | |
} | |
} | |
function showProfileComments() { | |
if (1 != profileCommentsLoading) { | |
profileCommentsLoading = !0, $("#profile_content_2").hide(), $("#profile_content_loading").show(); | |
var e = viewHistory.slice(viewHistory.length - 1, viewHistory.length)[0], | |
t = e.view_type_id; | |
$.ajax({ | |
url: "/api/1/get_profile/" + t + "/comments", | |
data: {}, | |
type: "GET", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
profileCommentsLoading = !1, 2 == selectedProfileTab && drawTones(e, "comments") | |
}, | |
error: function() { | |
profileCommentsLoading = !1 | |
} | |
}) | |
} | |
} | |
function showProfileFollowing() { | |
if (1 != profileFollowingLoading) { | |
profileFollowingLoading = !0, $("#profile_content_3").hide(), $("#profile_content_loading").show(); | |
var e = viewHistory.slice(viewHistory.length - 1, viewHistory.length)[0], | |
t = e.view_type_id; | |
$.ajax({ | |
url: "/api/1/get_profile/" + t + "/following", | |
data: {}, | |
type: "GET", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
profileFollowingLoading = !1, 3 == selectedProfileTab && drawProfileFollowers(e, !0) | |
}, | |
error: function() { | |
profileFollowingLoading = !1 | |
} | |
}) | |
} | |
} | |
function showProfileFollowers() { | |
if (1 != profileFollowersLoading) { | |
profileFollowersLoading = !0, $("#profile_content_4").hide(), $("#profile_content_loading").show(); | |
var e = viewHistory.slice(viewHistory.length - 1, viewHistory.length)[0], | |
t = e.view_type_id; | |
$.ajax({ | |
url: "/api/1/get_profile/" + t + "/followers", | |
data: {}, | |
type: "GET", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
profileFollowersLoading = !1, 4 == selectedProfileTab && drawProfileFollowers(e) | |
}, | |
error: function() { | |
profileFollowersLoading = !1 | |
} | |
}) | |
} | |
} | |
function drawProfileFollowers(e, t) { | |
var t = "undefined" != typeof t && t; | |
$("#profile_content_loading").hide(); | |
var n = $("#profile_content_4").html(""); | |
1 == t && (n = $("#profile_content_3").html("")); | |
var i = e.followers; | |
if (null == i || 0 == i.length) { | |
var o = "hasn't got any followers yet."; | |
return 1 == t && (o = "isn't following anyone yet."), $("<div />").addClass("profile-content-none").text((null != e.profile.name && e.profile.name.length > 0 ? e.profile.name : e.profile.username) + " " + o).appendTo(n), void n.show() | |
} | |
for (var s = $("<div />").addClass("profile-followers-wrap").appendTo(n), a = 0; a < i.length; a++) { | |
var r = $("<table />").addClass("profile-followers-table").attr("cellspacing", 0).attr("cellpadding", 0).attr("id", "follower_" + i[a].id).appendTo(s), | |
l = $("<tr />").appendTo(r), | |
u = $("<td />").attr("valign", "top").addClass("profile-followers-avatar").appendTo(l), | |
c = ($("<div />").css("background", "rgb(" + i[a].avatar + ")").data("username", i[a].username).appendTo(u), $("<td />").attr("valign", "top").addClass("profile-followers-body").appendTo(l)), | |
d = ($("<b />").text(i[a].name).data("username", i[a].username).appendTo(c), '<div><i class="fa fa-user fa-3x fa-fw"></i>' + formatNumber(i[a].followers_count)); | |
i[a].tones_count > 0 ? d = d + ' <span class="profile-followers-tones-icon"></span>' + formatNumber(i[a].tones_count) + "</div>" : d += "</div>"; | |
var p = ($("<div />").addClass("profile-followers-stats").html(d).appendTo(c), $("<td />").attr("valign", "middle").addClass("profile-followers-right").appendTo(l)), | |
f = $("<div />").addClass("small-button-like profile-followers-button").html('<i class="fa fa-user-plus fa-3x fa-fw"></i><span>Follow</span>').appendTo(p); | |
f.data("username", i[a].username), null != i[a].following && (f.addClass("small-button-like-selected"), $("i", f).removeClass("fa-user-plus").addClass("fa-check"), $("span", f).text("Following")), userLoggedIn() && i[a].id == currentUser.id && f.hide() | |
} | |
$(".profile-followers-body b, .profile-followers-avatar div", s).on("click", function() { | |
var e = $(this).data("username"); | |
setTimeout(function() { | |
showProfile(e) | |
}, 20) | |
}), $(".profile-followers-button", s).on("click", function() { | |
var e = $(this).data("username"); | |
followUsername(e), $(this).hasClass("small-button-like-selected") ? ($(this).removeClass("small-button-like-selected"), $("i", this).addClass("fa-user-plus").removeClass("fa-check"), $("span", this).text("Follow")) : ($(this).addClass("small-button-like-selected"), $("i", this).removeClass("fa-user-plus").addClass("fa-check"), $("span", this).text("Following")) | |
}), n.show() | |
} | |
function drawTones(e, t) { | |
var t = "undefined" == typeof t ? "tones" : t; | |
$("#profile_content_loading").hide(); | |
var n = $("#profile_content_0").html(""); | |
if ("likes" == t) n = $("#profile_content_1").html(""); | |
else if ("home" == t) { | |
n = $("#home_content_" + selectedHomeTab).html(""); | |
var i = $("<div />").addClass("home-info-heading").appendTo(n); | |
0 == selectedHomeTab ? i.text("The latest tones from people you follow: ") : 1 == selectedHomeTab ? i.text("Recent favorites of people you follow: ") : 2 == selectedHomeTab ? i.text("The most popular tones right now: ") : 3 == selectedHomeTab && i.text("The latest tones from everyone: ") | |
} | |
if (0 == e.tones.length) { | |
var o = $("<div />").addClass("profile-content-none").appendTo(n); | |
if ("home" == t) o.text("Follow other users to see their latest tones here."); | |
else { | |
var s = "released any tones"; | |
"likes" == t ? s = "liked any tones" : "comments" == t && (s = "posted any comments"), o.text((null != e.profile.name && e.profile.name.length > 0 ? e.profile.name : e.profile.username) + " hasn't " + s + " yet.") | |
} | |
return void n.show() | |
} | |
for (var a = $("<div />").addClass("profile-tones-wrap").appendTo(n), r = 0, l = 0; l < e.tones.length; l++) { | |
if ("home" == t && 1 == selectedHomeTab) { | |
var u = ($("<div />").addClass("profile-description-oldness").text(getOldness(e.tones[l].f_timestamp, !1, !1, !1)).appendTo(a), $("<div />").addClass("profile-description").appendTo(a)); | |
$("<div />").addClass("profile-description-avatar").css("background", "rgb(" + e.tones[l].f_avatar + ")").data("f_user", e.tones[l].f_username).appendTo(u), $("<span />").addClass("profile-description-user").text(0 == e.tones[l].f_name.length ? e.tones[l].f_username : e.tones[l].f_name).data("f_user", e.tones[l].f_username).appendTo(u); | |
$("<span />").text(" liked").appendTo(u) | |
} | |
var c = $("<div />").addClass("profile-row").appendTo(a), | |
d = $("<table />").addClass("profile-tone-table").attr("cellspacing", 0).attr("cellpadding", 0).appendTo(c), | |
p = $("<tr />").appendTo(d); | |
"home" == t && 2 == selectedHomeTab && (r++, $("<td />").attr("valign", "top").html("<span>" + r + "</span>").addClass("profile-row-number").appendTo(p)); | |
var f = 0; | |
"comments" == t ? f = e.tones[l].comments_id : "home" == t && 1 == selectedHomeTab && (f = e.tones[l].f_username); | |
var h = $("<td />").attr("valign", "top").addClass("profile-play-button-td").appendTo(p), | |
g = $("<div />").attr("id", "profile_play_" + e.tones[l].id + "_" + f).addClass("profile-play-button").html('<div><i class="fa fa-play fa-3x -fa-fw" aria-hidden="true"></i></div>').data("tone_id", e.tones[l].id).data("item_id", f).data("section", t).appendTo(h); | |
"likes" == t || "comments" == t || "home" == t ? g.css("background", "rgb(" + e.tones[l].user.avatar + ")") : g.css("background", "rgb(" + e.profile.avatar + ")"), g.addClass("profile-play-button-avatar-small"), 1 == playing && tone.id == e.tones[l].id && (g.addClass("profile-play-button-avatar-on"), $("i", g).removeClass("fa-ellipsis-h fa-play").addClass("fa-pause")); | |
var m = $("<td />").attr("valign", "top").addClass("profile-tone-body").appendTo(p); | |
if ("likes" == t || "comments" == t || "home" == t) { | |
$("<div />").addClass("profile-row-user").text(null == e.tones[l].user.name ? e.tones[l].user.username : e.tones[l].user.name).data("tone_user", e.tones[l].user.username).appendTo(m) | |
} | |
$("<div />").addClass("profile-row-title").text(e.tones[l].title + (1 == e.tones[l].version ? "" : " " + e.tones[l].version)).data("tone_id", e.tones[l].id).appendTo(m); | |
if ("comments" == t) { | |
$("<div />").addClass("profile-comment").html('"' + cleanupText(e.tones[l].comment) + '"').appendTo(m) | |
} else { | |
var v = ""; | |
e.tones[l].plays_count > 0 && (v = v + '<i class="fa fa-play fa-3x fa-fw"></i>' + e.tones[l].plays_count), e.tones[l].comments_count > 0 && (v = v + '<i class="fa fa-comment fa-3x fa-fw"></i>' + e.tones[l].comments_count); | |
var b = $("<div />").addClass("profile-row-stats").html(v).appendTo(m), | |
y = $("<div />").addClass("small-button-like profile-share-button").html('<i class="fa fa-share fa-3x fa-fw"></i><span>Share</span>').data("url_title", e.tones[l].url_title).data("tone_id", e.tones[l].id).prependTo(b); | |
"likes" == t || "home" == t ? y.data("username", e.tones[l].user.username) : y.data("username", e.profile.username); | |
var _ = "Like"; | |
e.tones[l].favorites_count > 0 && (_ = e.tones[l].favorites_count); | |
var w = $("<div />").attr("id", "profile_like_" + e.tones[l].id + "_" + f).addClass("profile-like-" + e.tones[l].id + " small-button-like profile-like-button").html('<i class="fa fa-heart fa-3x fa-fw"></i><span>' + _ + "</span>").data("tone_id", e.tones[l].id).data("item_id", f).data("tone_favs", e.tones[l].favorites_count).data("tone_liked", e.tones[l].liked).prependTo(b); | |
null != e.tones[l].liked && 0 != e.tones[l].liked && w.addClass("small-button-like-selected") | |
} | |
var x = $("<td />").attr("valign", "top").addClass("profile-tone-info-td").appendTo(p); | |
if ("home" != t || 1 != selectedHomeTab) { | |
var T = $("<div />").addClass("profile-row-info").appendTo(x); | |
"likes" == t ? T.text(getOldness(e.tones[l].f_timestamp, !1, !1, !1)) : T.text(getOldness(e.tones[l].date_timestamp, !1, !1, !1)) | |
} | |
} | |
$(".profile-play-button", n).on("click", function() { | |
var e = parseInt($(this).data("tone_id")); | |
playItemId = $(this).data("item_id"), 1 == playing && tone.id == e && $("i", this).hasClass("fa-pause") ? (stopPlaying(), $(this).removeClass("profile-play-button-avatar-on"), $("i", this).removeClass("fa-ellipsis-h fa-pause").addClass("fa-play")) : ($(".profile-play-button-avatar-on").removeClass("profile-play-button-avatar-on"), $(this).addClass("profile-play-button-avatar-on"), $("i", this).removeClass("fa-ellipsis-h fa-play").addClass("fa-ellipsis-h"), setTimeout(function() { | |
loadTonePlayButton(e) | |
}, 20)) | |
}), $(".profile-row-title", n).on("click", function() { | |
var e = parseInt($(this).data("tone_id")); | |
if (null != currentToneCopy && tone.id == e) { | |
var t = JSON.parse(currentToneCopy); | |
1 == t.edited ? (loadToneConfirmId = 0, showDialog("confirm_load")) : (currentToneCopy = null, showCreate(), addToViewHistory("tone", tone.id), updatePageTitle(), updateUrlState()) | |
} else setTimeout(function() { | |
loadTone(e, !0, !0) | |
}, 20) | |
}), $(".profile-row-user", n).on("click", function() { | |
var e = $(this).data("tone_user"); | |
setTimeout(function() { | |
showProfile(e) | |
}, 20) | |
}), $(".profile-description-avatar, .profile-description-user", n).on("click", function() { | |
var e = $(this).data("f_user"); | |
setTimeout(function() { | |
showProfile(e) | |
}, 20) | |
}); | |
var S = "mousedown", | |
C = "mouseup"; | |
isMobileDevice() && (S = "touchstart", C = "touchend"), $(".profile-like-button", n).off(S).on(S, function() { | |
0 == $(this).hasClass("small-button-like-disabled") && $(this).addClass("small-button-like-on") | |
}), $(".profile-like-button", n).off("click").on("click", function() { | |
$(this).removeClass("small-button-like-on"); | |
var e = parseInt($(this).data("tone_id")), | |
t = $(this).data("item_id"); | |
likeProfileTone(e, t) | |
}), $(".profile-share-button", n).off(S).on(S, function() { | |
0 == $(this).hasClass("small-button-like-disabled") && $(this).addClass("small-button-like-on") | |
}), $(".profile-share-button", n).off("click").on("click", function() { | |
$(this).removeClass("small-button-like-on"); | |
var e = $(this).data("username"), | |
t = $(this).data("url_title"), | |
n = $(this).data("tone_id"); | |
showShareDialog(n, e, t) | |
}), n.show() | |
} | |
function showBrowse() { | |
showBrowseSettings(), loadBrowse(), $(".preset-row-selected").removeClass("preset-row-selected").css("background", ""), $("#browse_row_" + tone.id).addClass("preset-row-selected").css("background", getColor(1)) | |
} | |
function loadBrowse() { | |
browseLoading = !0, $.ajax({ | |
url: "/api/1/get_tones", | |
data: { | |
section: browseSection | |
}, | |
type: "GET", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
browseLoading = !1, e.section == browseSection && (e.last_id == browseLastId && 0 != e.last_id || (browseLastId = e.last_id, drawBrowse(e))) | |
}, | |
error: function() { | |
browseLoading = !1 | |
} | |
}) | |
} | |
function drawBrowse(e) { | |
$("#browse_tones_loading").hide(); | |
var t = $("#browse_tones_content").html(""); | |
if (null == e.tones || 0 == e.tones.length) { | |
var n = ($("<div />").addClass("browse-none-icon").html('<i class="fa fa-heart fa-3x fa-fw" aria-hidden="true"></i>').appendTo(t), $("<div />").addClass("browse-none").appendTo(t)); | |
n.text("No favorites yet.") | |
} else { | |
for (var i = JSON.parse(JSON.stringify(e.tones)), o = 0; o < i.length; o++) { | |
var s = $("<div />").addClass("preset-row").attr("id", "browse_row_" + i[o].id).appendTo(t), | |
a = $("<div />").text(i[o].title + (i[o].version > 1 ? " " + i[o].version : "")).appendTo(s); | |
if (1 == i[o].preset) { | |
$("<span />").addClass("preset-row-demo").text("Demo").appendTo(a) | |
} | |
if (1 == i[o]["private"]) { | |
$("<i />").addClass("preset-row-private fa fa-lock fa-3x fa-fw").appendTo(a) | |
} | |
null != i[o].liked && 0 != i[o].liked && $("<i />").addClass("preset-row-info fa fa-heart fa-3x fa-fw").appendTo(s), i[o].id == tone.id && s.addClass("preset-row-selected").css("background", getColor(1)) | |
} | |
$("#browse_tones_wrap .preset-row").on("click", function() { | |
var e = parseInt($(this).attr("id").split("_")[2]); | |
$(".preset-row-selected").removeClass("preset-row-selected").css("background", ""), $(this).addClass("preset-row-selected").css("background-color", getColor(1)), $(".preset-row-selected-loading").removeClass("preset-row-selected-loading"), $(this).addClass("preset-row-selected-loading"), loadTone(e, !0, !1) | |
}) | |
} | |
t.show(), 0 == browseKeepScrollPos && $("#browse_tones_wrap").scrollTop(0), browseKeepScrollPos = !1, updatePopoverPosition("browse") | |
} | |
function setupMainMenu() { | |
$("#menu_notif_message").on("click", function() { | |
0 == currentUser.email_message ? (currentUser.email_message = !0, $("#menu_notif_message .fa").removeClass("fa-toggle-off").addClass("fa-toggle-on")) : (currentUser.email_message = !1, $("#menu_notif_message .fa").removeClass("fa-toggle-on").addClass("fa-toggle-off")), saveUserSettings() | |
}), $("#menu_notif_follow").on("click", function() { | |
0 == currentUser.email_follow ? (currentUser.email_follow = !0, $("#menu_notif_follow .fa").removeClass("fa-toggle-off").addClass("fa-toggle-on")) : (currentUser.email_follow = !1, $("#menu_notif_follow .fa").removeClass("fa-toggle-on").addClass("fa-toggle-off")), saveUserSettings() | |
}), $("#menu_notif_like").on("click", function() { | |
0 == currentUser.email_like ? (currentUser.email_like = !0, $("#menu_notif_like .fa").removeClass("fa-toggle-off").addClass("fa-toggle-on")) : (currentUser.email_like = !1, $("#menu_notif_like .fa").removeClass("fa-toggle-on").addClass("fa-toggle-off")), saveUserSettings() | |
}), $("#menu_notif_comment").on("click", function() { | |
0 == currentUser.email_comment ? (currentUser.email_comment = !0, $("#menu_notif_comment .fa").removeClass("fa-toggle-off").addClass("fa-toggle-on")) : (currentUser.email_comment = !1, $("#menu_notif_comment .fa").removeClass("fa-toggle-on").addClass("fa-toggle-off")), saveUserSettings() | |
}), $("#menu_notif_remix").on("click", function() { | |
0 == currentUser.email_remix ? (currentUser.email_remix = !0, $("#menu_notif_remix .fa").removeClass("fa-toggle-off").addClass("fa-toggle-on")) : (currentUser.email_remix = !1, $("#menu_notif_remix .fa").removeClass("fa-toggle-on").addClass("fa-toggle-off")), saveUserSettings() | |
}), updateMainMenu() | |
} | |
function saveUserSettings() { | |
$.ajax({ | |
url: "/api/1/save_settings", | |
data: { | |
email_message: currentUser.email_message, | |
email_follow: currentUser.email_follow, | |
email_like: currentUser.email_like, | |
email_comment: currentUser.email_comment, | |
email_remix: currentUser.email_remix | |
}, | |
type: "POST", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function() {} | |
}), updateCurrentUserStorage() | |
} | |
function updateMainMenu() { | |
userLoggedIn() && ($("#menu_notifs .menu-toggle-item .fa").removeClass("fa-toggle-on").addClass("fa-toggle-off"), 1 == currentUser.email_message && $("#menu_notif_message .fa").removeClass("fa-toggle-off").addClass("fa-toggle-on"), 1 == currentUser.email_follow && $("#menu_notif_follow .fa").removeClass("fa-toggle-off").addClass("fa-toggle-on"), 1 == currentUser.email_like && $("#menu_notif_like .fa").removeClass("fa-toggle-off").addClass("fa-toggle-on"), 1 == currentUser.email_comment && $("#menu_notif_comment .fa").removeClass("fa-toggle-off").addClass("fa-toggle-on"), 1 == currentUser.email_remix && $("#menu_notif_remix .fa").removeClass("fa-toggle-off").addClass("fa-toggle-on")) | |
} | |
function toggleMainMenu() { | |
1 == mainMenuOpen ? hideMainMenu() : showMainMenu() | |
} | |
function showMainMenu() { | |
1 != mainMenuOpen && (setTimeout(function() { | |
mainMenuOpen = !0 | |
}, 50), hideSettings(), showOverlay(), updateMainMenu(), $("#menu").css("height", $("#layout_table").height() + "px"), $("#layout_inner").width() < 380 ? $("#menu").css("width", Math.round($("#layout_table").width() / 100 * 84) + "px") : $("#menu").css("width", Math.round($("#layout_table").width() / 100 * 64) + "px"), $("#menu").css("left", $("#layout_table").offset().left + "px").css("top", $("#layout_table").position().top + "px"), drawMainMenu(), $(window).width() <= $("#layout_inner").width() ? $("#menu").show().css("animation-duration", "0.19s").animateCss("slideInLeft") : $("#menu").show()) | |
} | |
function hideMainMenu() { | |
0 != mainMenuOpen && (hideOverlay(), $(window).width() <= $("#layout_inner").width() ? $("#menu").css("animation-duration", "0.22s").animateCss("slideOutLeft", function() { | |
$("#menu").hide() | |
}) : $("#menu").css("animation-duration", "0.22s").animateCss("fadeOut", function() { | |
$("#menu").hide() | |
}), mainMenuOpen = !1) | |
} | |
function drawMainMenu() { | |
$("#menu_user_wrap, #menu_register_wrap").hide(), userLoggedIn() ? ($("#menu_avatar").css("background", "rgba(" + getUserColor(currentUser) + ",1.0)"), null != currentUser.name ? $("#menu_realname").text(currentUser.name) : $("#menu_realname").text(currentUser.username), $("#menu_username div").text(currentUser.username), $("#menu_user_wrap").show(), $("#menu_avatar, #menu_user_wrap").off("click").on("click", function() { | |
showProfile(currentUser.username) | |
}), $("#menu_logout_item").show()) : ($("#menu_avatar").css("background", "#FC1051"), $("#menu_register_wrap").show(), $("#menu_logout_item").hide()) | |
} | |
function showSettingsMenu() { | |
return userLoggedIn() ? ($("#menu_close").hide(), $("#menu_wrap").hide(), $("#menu_settings_wrap").show(), void trackView("settings")) : void showRegisterDialog() | |
} | |
function backToMainMenu() { | |
$("#menu_settings_wrap").hide(), isMobileDevice() || $("#menu_close").show(), $("#menu_wrap").show() | |
} | |
function showOverlay() { | |
var e = $("#overlay"); | |
e.off("touchmove").on("touchmove", function(e) { | |
return hideMainMenu(), hideDialogs(), e.preventDefault(), e.stopPropagation(), !1 | |
}), e.off("click").on("click", function() { | |
hideMainMenu(), hideDialogs() | |
}), e.show().css("animation-duration", "0.21s").animateCss("fadeIn") | |
} | |
function hideOverlay() { | |
$("#overlay").css("animation-duration", "0.22s").animateCss("fadeOut", function() { | |
$("#overlay").hide() | |
}) | |
} | |
function showDialog(e) { | |
hideDialogs(!1), hideSettings(), hideMainMenu(); | |
var t = $("#dialog_" + e); | |
t.off("touchmove").on("touchmove", function(e) { | |
if (!($(e.target).closest(".dialog-content").length > 0)) return hideDialogs(), e.preventDefault(), e.stopPropagation(), !1 | |
}), t.off("click").on("click", function(e) { | |
$(e.target).closest(".dialog-content").length > 0 || hideDialogs() | |
}), t.show(); | |
var n = $(".dialog-content", t), | |
i = $(window).width() / 2 - n.width() / 2, | |
o = ($("#layout_table").height() + 1) / 2 - n.height() / 2; | |
o = o / 10 * 9, "loading_alert" == e && (o = 0), n.css("left", i + "px").css("top", o + "px") | |
} | |
function hideDialogs(e) { | |
$(".dialog-wrap").hide() | |
} | |
function hideTermsAndPrivacy() { | |
hideDialogs(), userLoggedIn() || showRegisterDialog() | |
} | |
function showLoginDialog(e) { | |
var e = "undefined" == typeof e ? "" : e; | |
e.length > 0 ? $("#login_error").text(e).show() : $("#login_error").hide(), showDialog("login"), setTimeout(function() { | |
$("#login_username").focus() | |
}, 50) | |
} | |
function showRegisterDialog(e) { | |
var e = "undefined" == typeof e ? "" : e; | |
e.length > 0 ? $("#register_error").text(e).show() : $("#register_error").hide(), showDialog("register"), setTimeout(function() { | |
$("#register_username").focus() | |
}, 50) | |
} | |
function showTermsDialog() { | |
showDialog("terms") | |
} | |
function showPrivacyDialog() { | |
showDialog("privacy") | |
} | |
function showLoadingAlert() { | |
showDialog("loading_alert") | |
} | |
function showInfoAlert(e) { | |
$("#info_alert_message").text(e), showDialog("info_alert") | |
} | |
function showAlert(e, t) { | |
$("#alert_title").text(e), $("#alert_message").html(t), showDialog("alert") | |
} | |
function registerUser() { | |
var e = $("#register_username").val(), | |
t = $("#register_email").val(), | |
n = $("#register_password").val(), | |
i = $("#register_terms").is(":checked"); | |
if (null == e.match(/^[a-z0-9_-]{2,15}$/i)) return void setTimeout(function() { | |
showRegisterDialog("Please enter a valid username (2 to 15 letters or numbers).") | |
}, 0); | |
if ("" == e.replace(/[0-9]/g, "")) return void setTimeout(function() { | |
showRegisterDialog("Username must contain at least 1 letter.") | |
}, 0); | |
if (null == t.match(/^([^\s]+)((?:[-a-z0-9]\.)[a-z]{2,})$/i)) return void setTimeout(function() { | |
showRegisterDialog("Please enter a valid email address.") | |
}, 0); | |
if (n.length < 8) return void setTimeout(function() { | |
showRegisterDialog("Password is too short (must be at least 8 characters)."); | |
}, 0); | |
if (0 == i) return void setTimeout(function() { | |
showRegisterDialog("You must agree to the terms.") | |
}, 0); | |
showInfoAlert("Registering, please wait..."); | |
var o = new Date, | |
s = o.getTimezoneOffset(); | |
$.ajax({ | |
url: "/api/1/register", | |
data: { | |
username: e, | |
email: t, | |
password: n, | |
timezone_offset: s | |
}, | |
type: "POST", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
0 == e.success ? showRegisterDialog(e.error_msg) : (storeCurrentUser(e), drawMainMenu(), hideDialogs(), showAlert("Welcome", "You are now signed in."), $("#register_username").val(""), $("#register_email").val(""), $("#register_password").val(""), $("#register_terms").prop("checked", !1)) | |
} | |
}) | |
} | |
function loginUser() { | |
var e = $("#login_username").val(), | |
t = $("#login_password").val(); | |
return e.length < 2 ? void setTimeout(function() { | |
showLoginDialog("Please enter a valid username.") | |
}, 0) : (showInfoAlert("Signing in, please wait..."), void $.ajax({ | |
url: "/api/1/login", | |
data: { | |
username: e, | |
password: t | |
}, | |
type: "POST", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
0 == e.success ? showLoginDialog(e.error_msg) : (storeCurrentUser(e), drawMainMenu(), hideDialogs(), $("#login_username").val(""), $("#login_password").val(""), showMainMenu(), browseLastId = 0, loadBrowse(), ping()) | |
} | |
})) | |
} | |
function reloadUser() { | |
userLoggedIn() && $.ajax({ | |
url: "/api/1/get_current_user", | |
type: "POST", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function(e) { | |
0 == e.success ? logOutUser() : (profileCache = [], storeCurrentUser(e), ping()) | |
} | |
}) | |
} | |
function logOutUser() { | |
$.ajax({ | |
url: "/api/1/logout", | |
type: "POST", | |
timeout: 15e3, | |
cache: !1, | |
dataType: "json", | |
success: function() { | |
clearCurrentUser(), viewHistory = [], loadToneCache = [], profileCache = [], profileTonesCache = [], showHideBackButton(), showCreate(), backToMainMenu(), drawMainMenu(), unreadMessages = 0, unreadNotifications = 0, updateUnreadDisplay(), browseLastId = 0, loadBrowse() | |
} | |
}) | |
} | |
function userLoggedIn() { | |
return null != currentUser && "undefined" != typeof currentUser.username | |
} | |
function getCurrentUserId() { | |
return null != currentUser && "undefined" != typeof currentUser.id ? currentUser.id : 0 | |
} | |
function storeCurrentUser(e) { | |
$.cookie("user_token", e.session_hash, { | |
expires: 1825, | |
path: "/" | |
}), $.cookie("user", JSON.stringify(e.user), { | |
expires: 1825, | |
path: "/" | |
}), loadCurrentUser() | |
} | |
function updateCurrentUserStorage() { | |
$.cookie("user", JSON.stringify(currentUser), { | |
expires: 1825, | |
path: "/" | |
}) | |
} | |
function loadCurrentUser() { | |
"undefined" != typeof $.cookie("user") && (currentUser = JSON.parse($.cookie("user")), drawMainMenu()) | |
} | |
function clearCurrentUser() { | |
$.removeCookie("user_token", { | |
path: "/" | |
}), $.removeCookie("user", { | |
path: "/" | |
}), currentUser = null, drawMainMenu() | |
} | |
function isProUser() { | |
return 1 == userLoggedIn() && 1 == currentUser.pro | |
} | |
function generateScaleNotes(e) { | |
var t = tone.bars[e].scale, | |
n = tone.bars[e].octave; | |
"A" != tone.bars[e].key && "A#" != tone.bars[e].key && "B" != tone.bars[e].key && "G#" != tone.bars[e].key && "G" != tone.bars[e].key && "F#" != tone.bars[e].key && "F" != tone.bars[e].key, n = 2; | |
var i = tone.bars[e].key + n.toString(); | |
tone.bars[e].notes = getNotesForScale(t, i, 200); | |
for (var o = "", s = 0; s < tone.bars[e].notes.length; s++) { | |
var a = tone.bars[e].notes[s].latin() + tone.bars[e].notes[s].octave(); | |
o = o + "" + (a + ", "), a == i && (tone.bars[e].notes_start_index = s) | |
} | |
} | |
function getNotesForScale(e, t, n) { | |
var i = [], | |
o = Note.fromLatin(t), | |
s = Interval.fromSemitones(12); | |
o = o.subtract(s).subtract(s).subtract(s); | |
for (var a = 0; a < n; a++) { | |
for (var r = o.scale(e), l = 0; l < r.length - 1; l++) i.push(r[l]); | |
if (i.length >= n) break; | |
o = r[r.length - 1] | |
} | |
return i | |
} | |
function getScaleNote(e, t) { | |
var n = tone.bars[e].notes, | |
i = tone.bars[e].notes_start_index + t + tone.bars[e].octave; | |
i < 0 && (i = 0), i >= n.length && (i = n.length - 1); | |
var o = n[i]; | |
return o | |
} | |
function setDelayPingPong() {} | |
function setDelayDuration(e) { | |
var t = "undefined" == typeof t ? audioContext.currentTime : t, | |
n = getDelayInfo(e); | |
1 == tone.settings.delay.pingpong ? (pingPongDelay.delayTimeLeft = 1e3 * n.time, pingPongDelay.delayTimeRight = 1e3 * n.time) : delay.delayTime = 1e3 * n.time | |
} | |
function setDelayFeedback(e, t) { | |
var t = "undefined" == typeof t ? audioContext.currentTime : t; | |
e > .8 || (1 == tone.settings.delay.pingpong ? pingPongDelay.feedback = e : delay.feedback = e) | |
} | |
function setDelayFilterLow(e) { | |
var t = "undefined" == typeof t ? audioContext.currentTime : t, | |
n = getFilterFrequency(e); | |
1 == tone.settings.delay.pingpong ? pingPongDelay.lowCut = n : delay.lowCut = n | |
} | |
function setDelayFilterHigh(e) { | |
var t = "undefined" == typeof t ? audioContext.currentTime : t, | |
n = getFilterFrequency(e); | |
1 == tone.settings.delay.pingpong ? pingPongDelay.highCut = n : delay.highCut = n | |
} | |
function setDelayMix(e) { | |
e = parseFloat(e); | |
var t = Math.cos(.5 * e * Math.PI), | |
n = Math.cos(.5 * (1 - e) * Math.PI); | |
1 == t && (n = 0), 1 == n && (t = 0), 1 == tone.settings.delay.pingpong ? (pingPongDelay.dryLevel = t, pingPongDelay.wetLevel = n) : (delay.dryLevel = t, delay.wetLevel = n) | |
} | |
function setReverbFilterLow(e) { | |
var t = "undefined" == typeof t ? audioContext.currentTime : t, | |
n = getFilterFrequency(e); | |
reverb.lowCut = n | |
} | |
function setReverbFilterHigh(e) { | |
var t = "undefined" == typeof t ? audioContext.currentTime : t, | |
n = getFilterFrequency(e); | |
reverb.highCut = n | |
} | |
function setReverbMix(e) { | |
e = parseFloat(e); | |
var t = Math.cos(.5 * e * Math.PI), | |
n = Math.cos(.5 * (1 - e) * Math.PI); | |
1 == t && (n = 0), 1 == n && (t = 0), reverb.dryLevel = t, reverb.wetLevel = n | |
} | |
function getStoredSettings() { | |
if (0 == localStorageSupported()) return null; | |
if (null == localStorage.getItem("settings")) return null; | |
var e = JSON.parse(localStorage.getItem("settings")); | |
return e | |
} | |
function getStoredTone() { | |
if (0 == localStorageSupported()) return null; | |
if (null == localStorage.getItem("tone_data")) return null; | |
var e = JSON.parse(localStorage.getItem("tone_data")); | |
return e | |
} | |
function storeSettings() { | |
return 0 != localStorageSupported() && (clearTimeout(storeSettingsTimer), storeSettingsTimer = setTimeout(function() { | |
var e = JSON.stringify({ | |
repeat_bar: repeatBar, | |
current_bar: currentBar, | |
selected_lfo: selectedLFO, | |
selected_envelope: selectedEnvelope, | |
selected_effect: selectedEffect, | |
selected_sound_setting: selectedSoundSetting, | |
selected_home_tab: selectedHomeTab, | |
copied_notes: copiedNotes | |
}); | |
localStorage.setItem("settings", e) | |
}, 500), !0) | |
} | |
function storeTone() { | |
return 0 != localStorageSupported() && (updateToneEdited(), clearTimeout(storeToneTimer), storeToneTimer = setTimeout(function() { | |
for (var e = JSON.parse(JSON.stringify(tone)), t = 0; t < e.bars.length; t++) delete e.bars[t].grid, delete e.bars[t].repeat_current; | |
var n = JSON.stringify(e); | |
localStorage.setItem("tone_data", n) | |
}, 500), !0) | |
} | |
function clearLocalStorage() { | |
localStorage.removeItem("settings"), localStorage.removeItem("tone_data") | |
} | |
function localStorageSupported() { | |
if (null != localStorageSupport) return localStorageSupport; | |
var e = "test"; | |
try { | |
localStorage.setItem(e, e), localStorage.removeItem(e), localStorageSupport = !0 | |
} catch (e) { | |
localStorageSupport = !1 | |
} | |
return localStorageSupport | |
} | |
function consoleLog(e) { | |
console.log(e) | |
} | |
function createCanvas(e, t, n) { | |
var e = "undefined" == typeof e ? "" : e, | |
i = $("<canvas />"); | |
e.length > 0 && i.attr("id", e), i.height(t), i.width(n), i[0].height = t * window.devicePixelRatio, i[0].width = n * window.devicePixelRatio; | |
var o = i[0].getContext("2d"); | |
return o.scale(window.devicePixelRatio, window.devicePixelRatio), i | |
} | |
function formatNumber(e) { | |
return e = e.toString(), e.replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,") | |
} | |
function randomIntFromInterval(e, t) { | |
return Math.floor(Math.random() * (t - e + 1) + e) | |
} | |
function scale(e, t, n, i, o) { | |
return (e - t) * (o - i) / (n - t) + i | |
} | |
function secondsToTimeConstant(e) { | |
return 2 * e / 10 | |
} | |
function getOldness(e, t, n, i) { | |
var t = "undefined" != typeof t && t, | |
n = "undefined" == typeof n || n, | |
i = "undefined" != typeof i && i, | |
o = Math.round((new Date).getTime() / 1e3), | |
s = o - e, | |
a = s, | |
r = parseInt(s / 60), | |
l = parseInt(s / 3600), | |
u = parseInt(s / 86400), | |
c = parseInt(s / 604800), | |
d = Math.round(s / 2678400), | |
p = Math.round(s / 31536e3), | |
f = 0; | |
1 == n && (f = 59); | |
var h = ""; | |
return h = p >= 1 ? p + (i ? "y" : " year" + (1 != p ? "s" : "")) + (t ? " ago" : "") : d >= 2 ? d + (i ? "mo" : " month" + (1 != d ? "s" : "")) + (t ? " ago" : "") : c >= 2 ? c + (i ? "w" : " week" + (1 != c ? "s" : "")) + (t ? " ago" : "") : l > 23 ? u + (i ? "d" : " day" + (1 != u ? "s" : "")) + (t ? " ago" : "") : l >= 1 ? l + (i ? "h" : " hour" + (1 != l ? "s" : "")) + (t ? " ago" : "") : a > f ? r + (i ? "m" : " min" + (1 != r ? "s" : "")) + (t ? " ago" : "") : a + (i ? "s" : " sec" + (1 != a ? "s" : "")) + (t ? " ago" : "") | |
} | |
function getWaveformIndex(e, t) { | |
var t = "undefined" != typeof t && t, | |
n = 0, | |
i = waveformsList; | |
1 == t && (i = waveformsList2); | |
for (var o = 0; o < i.length; o++) | |
if (i[o] == e) { | |
n = o; | |
break | |
} | |
return n | |
} | |
function getNoteDurationIndex(e) { | |
for (var t = 0; t < noteDurationStrings.length; t++) | |
if (noteDurationStrings[t] == e) return t; | |
return 0 | |
} | |
function setNoiseFilterLowFrequency(e, t) { | |
var t = "undefined" != typeof t && t, | |
n = audioContext.currentTime, | |
i = getFilterFrequency(e); | |
noise.filterLow.frequency.cancelScheduledValues(n), 0 == t ? noise.filterLow.frequency.setValueAtTime(i, n + 0) : noise.filterLow.frequency.setTargetAtTime(i, n, secondsToTimeConstant(smoothTime)) | |
} | |
function setNoiseFilterHighFrequency(e, t) { | |
var t = "undefined" != typeof t && t, | |
n = audioContext.currentTime, | |
i = getFilterFrequency(e); | |
noise.filterHigh.frequency.cancelScheduledValues(n), 0 == t ? noise.filterHigh.frequency.setValueAtTime(i, n + 0) : noise.filterHigh.frequency.setTargetAtTime(i, n, secondsToTimeConstant(smoothTime)) | |
} | |
function setNoiseFilterQ(e, t) { | |
var t = "undefined" != typeof t && t, | |
n = audioContext.currentTime, | |
i = 10, | |
o = parseFloat(e * i); | |
noise.filterLow.Q.cancelScheduledValues(n), noise.filterHigh.Q.cancelScheduledValues(n), 0 == t ? (noise.filterLow.Q.linearRampToValueAtTime(o, n + .05), noise.filterHigh.Q.linearRampToValueAtTime(o, n + .05)) : (noise.filterLow.Q.setTargetAtTime(o, n, secondsToTimeConstant(smoothTime)), noise.filterHigh.Q.setTargetAtTime(o, n, secondsToTimeConstant(smoothTime))) | |
} | |
function getFilterFrequency(e) { | |
var t = 40, | |
n = audioContext.sampleRate / 2, | |
i = Math.log(n / t) / Math.LN2, | |
o = Math.pow(2, i * (e - 1)), | |
s = n * o; | |
return s | |
} | |
function getFilterQ(e) { | |
var t = 10; | |
0 == tone.settings.filter.rolloff && (t = 2 * t); | |
var n = parseFloat(e * t); | |
return n | |
} | |
function getDelayTimeIndex(e) { | |
for (var t = 0; t < delayTimeStrings.length; t++) | |
if (delayTimeStrings[t] == e) return t; | |
return 0 | |
} | |
function getPianoNotesIndex(e) { | |
for (var t = 0, n = 0; n < pianoNotes.length; n++) pianoNotes[n] == e && (t = n); | |
return t | |
} | |
function getScalesListIndex(e) { | |
for (var t = 0, n = 0; n < scalesList.length; n++) scalesList[n] == e && (t = n); | |
return t | |
} | |
function getDelayInfo(e) { | |
var t = 0, | |
n = 0, | |
i = 6e4 / tempo; | |
return "1/64T" == e ? (t = i / 16 * 2 / 3, n = tempo / 240 * 96) : "1/64" == e ? (t = i / 16, n = tempo / 240 * 64) : "1/32T" == e ? (t = i / 8 * 2 / 3, n = tempo / 240 * 48) : "1/64." == e ? (t = i / 16 * 1.5, n = tempo / 240 * 64 * 2 / 3) : "1/32" == e ? (t = i / 8, n = tempo / 240 * 32) : "1/16T" == e ? (t = i / 6, n = tempo / 240 * 24) : "1/32." == e ? (t = i / 8 * 1.5, n = tempo / 240 * 32 * 2 / 3) : "1/16" == e ? (t = i / 4, n = tempo / 240 * 16) : "1/8T" == e ? (t = i / 3, n = tempo / 240 * 12) : "1/16." == e ? (t = i / 4 * 1.5, n = tempo / 240 * 16 * 2 / 3) : "1/8" == e ? (t = i / 2, n = tempo / 240 * 8) : "1/4T" == e ? (t = 2 * i / 3, n = tempo / 240 * 6) : "1/8." == e ? (t = i / 2 * 1.5, n = tempo / 240 * 8 * 2 / 3) : "1/4" == e ? (t = i, n = tempo / 240 * 4) : "1/2T" == e ? (t = 2 * i * 2 / 3, n = tempo / 240 * 3) : "1/4." == e ? (t = 1.5 * i, n = tempo / 240 * 4 * 2 / 3) : "1/2" == e ? (t = 2 * i, n = tempo / 240 * 2) : "1/1T" == e ? (t = 4 * i * 2 / 3, n = tempo / 240 * 1.5) : "1/2." == e ? (t = 2 * i * 1.5, n = tempo / 240 * 2 * 2 / 3) : "1/1" == e ? (t = 4 * i, n = tempo / 240) : "1/1." == e ? (t = 4 * i * 1.5, n = tempo / 240 * 2 / 3) : "2 bars" == e ? (t = 4 * i * 2, n = tempo / 240 / 2) : "3 bars" == e ? (t = 4 * i * 3, n = tempo / 240 / 3) : "4 bars" == e ? (t = 4 * i * 4, n = tempo / 240 / 4) : "5 bars" == e ? (t = 4 * i * 5, n = tempo / 240 / 5) : "6 bars" == e ? (t = 4 * i * 6, n = tempo / 240 / 6) : "7 bars" == e ? (t = 4 * i * 7, n = tempo / 240 / 7) : "8 bars" == e ? (t = 4 * i * 8, n = tempo / 240 / 8) : "16 bars" == e ? (t = 4 * i * 16, n = tempo / 240 / 16) : "32 bars" == e ? (t = 4 * i * 32, n = tempo / 240 / 32) : "64 bars" == e ? (t = 4 * i * 64, n = tempo / 240 / 64) : "128 bars" == e && (t = 4 * i * 128, n = tempo / 240 / 128), t /= 1e3, { | |
name: e, | |
time: t, | |
frequency: n | |
} | |
} | |
function getAudioContext() { | |
return "undefined" != typeof AudioContext ? new AudioContext : "undefined" != typeof webkitAudioContext ? new webkitAudioContext : "undefined" != typeof mozAudioContext ? new mozAudioContext : void alert("Web Audio API is not supported.") | |
} | |
function isMobileDevice() { | |
return "desktop" != devicePlatform | |
} | |
function isMac() { | |
return navigator.platform.toUpperCase().indexOf("MAC") >= 0 | |
} | |
function preload(e) { | |
$(e).each(function() { | |
$("<img />").attr("src", this).appendTo("body").css("display", "none") | |
}) | |
} | |
if (function(e, t) { | |
"object" == typeof module && "object" == typeof module.exports ? module.exports = e.document ? t(e, !0) : function(e) { | |
if (!e.document) throw new Error("jQuery requires a window with a document"); | |
return t(e) | |
} : t(e) | |
}("undefined" != typeof window ? window : this, function(e, t) { | |
function n(e) { | |
var t = !!e && "length" in e && e.length, | |
n = fe.type(e); | |
return "function" !== n && !fe.isWindow(e) && ("array" === n || 0 === t || "number" == typeof t && t > 0 && t - 1 in e) | |
} | |
function i(e, t, n) { | |
if (fe.isFunction(t)) return fe.grep(e, function(e, i) { | |
return !!t.call(e, i, e) !== n | |
}); | |
if (t.nodeType) return fe.grep(e, function(e) { | |
return e === t !== n | |
}); | |
if ("string" == typeof t) { | |
if (Te.test(t)) return fe.filter(t, e, n); | |
t = fe.filter(t, e) | |
} | |
return fe.grep(e, function(e) { | |
return fe.inArray(e, t) > -1 !== n | |
}) | |
} | |
function o(e, t) { | |
do e = e[t]; while (e && 1 !== e.nodeType); | |
return e | |
} | |
function s(e) { | |
var t = {}; | |
return fe.each(e.match(Le) || [], function(e, n) { | |
t[n] = !0 | |
}), t | |
} | |
function a() { | |
ie.addEventListener ? (ie.removeEventListener("DOMContentLoaded", r), e.removeEventListener("load", r)) : (ie.detachEvent("onreadystatechange", r), e.detachEvent("onload", r)) | |
} | |
function r() { | |
(ie.addEventListener || "load" === e.event.type || "complete" === ie.readyState) && (a(), fe.ready()) | |
} | |
function l(e, t, n) { | |
if (void 0 === n && 1 === e.nodeType) { | |
var i = "data-" + t.replace(Oe, "-$1").toLowerCase(); | |
if (n = e.getAttribute(i), "string" == typeof n) { | |
try { | |
n = "true" === n || "false" !== n && ("null" === n ? null : +n + "" === n ? +n : Ee.test(n) ? fe.parseJSON(n) : n) | |
} catch (e) {} | |
fe.data(e, t, n) | |
} else n = void 0 | |
} | |
return n | |
} | |
function u(e) { | |
var t; | |
for (t in e) | |
if (("data" !== t || !fe.isEmptyObject(e[t])) && "toJSON" !== t) return !1; | |
return !0 | |
} | |
function c(e, t, n, i) { | |
if (Ie(e)) { | |
var o, s, a = fe.expando, | |
r = e.nodeType, | |
l = r ? fe.cache : e, | |
u = r ? e[a] : e[a] && a; | |
if (u && l[u] && (i || l[u].data) || void 0 !== n || "string" != typeof t) return u || (u = r ? e[a] = ne.pop() || fe.guid++ : a), l[u] || (l[u] = r ? {} : { | |
toJSON: fe.noop | |
}), "object" != typeof t && "function" != typeof t || (i ? l[u] = fe.extend(l[u], t) : l[u].data = fe.extend(l[u].data, t)), s = l[u], i || (s.data || (s.data = {}), s = s.data), void 0 !== n && (s[fe.camelCase(t)] = n), "string" == typeof t ? (o = s[t], null == o && (o = s[fe.camelCase(t)])) : o = s, o | |
} | |
} | |
function d(e, t, n) { | |
if (Ie(e)) { | |
var i, o, s = e.nodeType, | |
a = s ? fe.cache : e, | |
r = s ? e[fe.expando] : fe.expando; | |
if (a[r]) { | |
if (t && (i = n ? a[r] : a[r].data)) { | |
fe.isArray(t) ? t = t.concat(fe.map(t, fe.camelCase)) : t in i ? t = [t] : (t = fe.camelCase(t), t = t in i ? [t] : t.split(" ")), o = t.length; | |
for (; o--;) delete i[t[o]]; | |
if (n ? !u(i) : !fe.isEmptyObject(i)) return | |
}(n || (delete a[r].data, u(a[r]))) && (s ? fe.cleanData([e], !0) : de.deleteExpando || a != a.window ? delete a[r] : a[r] = void 0) | |
} | |
} | |
} | |
function p(e, t, n, i) { | |
var o, s = 1, | |
a = 20, | |
r = i ? function() { | |
return i.cur() | |
} : function() { | |
return fe.css(e, t, "") | |
}, | |
l = r(), | |
u = n && n[3] || (fe.cssNumber[t] ? "" : "px"), | |
c = (fe.cssNumber[t] || "px" !== u && +l) && Ae.exec(fe.css(e, t)); | |
if (c && c[3] !== u) { | |
u = u || c[3], n = n || [], c = +l || 1; | |
do s = s || ".5", c /= s, fe.style(e, t, c + u); while (s !== (s = r() / l) && 1 !== s && --a) | |
} | |
return n && (c = +c || +l || 0, o = n[1] ? c + (n[1] + 1) * n[2] : +n[2], i && (i.unit = u, i.start = c, i.end = o)), o | |
} | |
function f(e) { | |
var t = qe.split("|"), | |
n = e.createDocumentFragment(); | |
if (n.createElement) | |
for (; t.length;) n.createElement(t.pop()); | |
return n | |
} | |
function h(e, t) { | |
var n, i, o = 0, | |
s = "undefined" != typeof e.getElementsByTagName ? e.getElementsByTagName(t || "*") : "undefined" != typeof e.querySelectorAll ? e.querySelectorAll(t || "*") : void 0; | |
if (!s) | |
for (s = [], n = e.childNodes || e; null != (i = n[o]); o++) !t || fe.nodeName(i, t) ? s.push(i) : fe.merge(s, h(i, t)); | |
return void 0 === t || t && fe.nodeName(e, t) ? fe.merge([e], s) : s | |
} | |
function g(e, t) { | |
for (var n, i = 0; null != (n = e[i]); i++) fe._data(n, "globalEval", !t || fe._data(t[i], "globalEval")) | |
} | |
function m(e) { | |
He.test(e.type) && (e.defaultChecked = e.checked) | |
} | |
function v(e, t, n, i, o) { | |
for (var s, a, r, l, u, c, d, p = e.length, v = f(t), b = [], y = 0; y < p; y++) | |
if (a = e[y], a || 0 === a) | |
if ("object" === fe.type(a)) fe.merge(b, a.nodeType ? [a] : a); | |
else if (We.test(a)) { | |
for (l = l || v.appendChild(t.createElement("div")), u = (Re.exec(a) || ["", ""])[1].toLowerCase(), d = ze[u] || ze._default, l.innerHTML = d[1] + fe.htmlPrefilter(a) + d[2], s = d[0]; s--;) l = l.lastChild; | |
if (!de.leadingWhitespace && Ve.test(a) && b.push(t.createTextNode(Ve.exec(a)[0])), !de.tbody) | |
for (a = "table" !== u || Ge.test(a) ? "<table>" !== d[1] || Ge.test(a) ? 0 : l : l.firstChild, s = a && a.childNodes.length; s--;) fe.nodeName(c = a.childNodes[s], "tbody") && !c.childNodes.length && a.removeChild(c); | |
for (fe.merge(b, l.childNodes), l.textContent = ""; l.firstChild;) l.removeChild(l.firstChild); | |
l = v.lastChild | |
} else b.push(t.createTextNode(a)); | |
for (l && v.removeChild(l), de.appendChecked || fe.grep(h(b, "input"), m), y = 0; a = b[y++];) | |
if (i && fe.inArray(a, i) > -1) o && o.push(a); | |
else if (r = fe.contains(a.ownerDocument, a), l = h(v.appendChild(a), "script"), r && g(l), n) | |
for (s = 0; a = l[s++];) je.test(a.type || "") && n.push(a); | |
return l = null, v | |
} | |
function b() { | |
return !0 | |
} | |
function y() { | |
return !1 | |
} | |
function _() { | |
try { | |
return ie.activeElement | |
} catch (e) {} | |
} | |
function w(e, t, n, i, o, s) { | |
var a, r; | |
if ("object" == typeof t) { | |
"string" != typeof n && (i = i || n, n = void 0); | |
for (r in t) w(e, r, n, i, t[r], s); | |
return e | |
} | |
if (null == i && null == o ? (o = n, i = n = void 0) : null == o && ("string" == typeof n ? (o = i, i = void 0) : (o = i, i = n, n = void 0)), o === !1) o = y; | |
else if (!o) return e; | |
return 1 === s && (a = o, o = function(e) { | |
return fe().off(e), a.apply(this, arguments) | |
}, o.guid = a.guid || (a.guid = fe.guid++)), e.each(function() { | |
fe.event.add(this, t, o, i, n) | |
}) | |
} | |
function x(e, t) { | |
return fe.nodeName(e, "table") && fe.nodeName(11 !== t.nodeType ? t : t.firstChild, "tr") ? e.getElementsByTagName("tbody")[0] || e.appendChild(e.ownerDocument.createElement("tbody")) : e | |
} | |
function T(e) { | |
return e.type = (null !== fe.find.attr(e, "type")) + "/" + e.type, e | |
} | |
function S(e) { | |
var t = ot.exec(e.type); | |
return t ? e.type = t[1] : e.removeAttribute("type"), e | |
} | |
function C(e, t) { | |
if (1 === t.nodeType && fe.hasData(e)) { | |
var n, i, o, s = fe._data(e), | |
a = fe._data(t, s), | |
r = s.events; | |
if (r) { | |
delete a.handle, a.events = {}; | |
for (n in r) | |
for (i = 0, o = r[n].length; i < o; i++) fe.event.add(t, n, r[n][i]) | |
} | |
a.data && (a.data = fe.extend({}, a.data)) | |
} | |
} | |
function $(e, t) { | |
var n, i, o; | |
if (1 === t.nodeType) { | |
if (n = t.nodeName.toLowerCase(), !de.noCloneEvent && t[fe.expando]) { | |
o = fe._data(t); | |
for (i in o.events) fe.removeEvent(t, i, o.handle); | |
t.removeAttribute(fe.expando) | |
} | |
"script" === n && t.text !== e.text ? (T(t).text = e.text, S(t)) : "object" === n ? (t.parentNode && (t.outerHTML = e.outerHTML), de.html5Clone && e.innerHTML && !fe.trim(t.innerHTML) && (t.innerHTML = e.innerHTML)) : "input" === n && He.test(e.type) ? (t.defaultChecked = t.checked = e.checked, t.value !== e.value && (t.value = e.value)) : "option" === n ? t.defaultSelected = t.selected = e.defaultSelected : "input" !== n && "textarea" !== n || (t.defaultValue = e.defaultValue) | |
} | |
} | |
function k(e, t, n, i) { | |
t = se.apply([], t); | |
var o, s, a, r, l, u, c = 0, | |
d = e.length, | |
p = d - 1, | |
f = t[0], | |
g = fe.isFunction(f); | |
if (g || d > 1 && "string" == typeof f && !de.checkClone && it.test(f)) return e.each(function(o) { | |
var s = e.eq(o); | |
g && (t[0] = f.call(this, o, s.html())), k(s, t, n, i) | |
}); | |
if (d && (u = v(t, e[0].ownerDocument, !1, e, i), o = u.firstChild, 1 === u.childNodes.length && (u = o), o || i)) { | |
for (r = fe.map(h(u, "script"), T), a = r.length; c < d; c++) s = u, c !== p && (s = fe.clone(s, !0, !0), a && fe.merge(r, h(s, "script"))), n.call(e[c], s, c); | |
if (a) | |
for (l = r[r.length - 1].ownerDocument, fe.map(r, S), c = 0; c < a; c++) s = r[c], je.test(s.type || "") && !fe._data(s, "globalEval") && fe.contains(l, s) && (s.src ? fe._evalUrl && fe._evalUrl(s.src) : fe.globalEval((s.text || s.textContent || s.innerHTML || "").replace(st, ""))); | |
u = o = null | |
} | |
return e | |
} | |
function P(e, t, n) { | |
for (var i, o = t ? fe.filter(t, e) : e, s = 0; null != (i = o[s]); s++) n || 1 !== i.nodeType || fe.cleanData(h(i)), i.parentNode && (n && fe.contains(i.ownerDocument, i) && g(h(i, "script")), i.parentNode.removeChild(i)); | |
return e | |
} | |
function L(e, t) { | |
var n = fe(t.createElement(e)).appendTo(t.body), | |
i = fe.css(n[0], "display"); | |
return n.detach(), i | |
} | |
function N(e) { | |
var t = ie, | |
n = ut[e]; | |
return n || (n = L(e, t), "none" !== n && n || (lt = (lt || fe("<iframe frameborder='0' width='0' height='0'/>")).appendTo(t.documentElement), t = (lt[0].contentWindow || lt[0].contentDocument).document, t.write(), t.close(), n = L(e, t), lt.detach()), ut[e] = n), n | |
} | |
function F(e, t) { | |
return { | |
get: function() { | |
return e() ? void delete this.get : (this.get = t).apply(this, arguments) | |
} | |
} | |
} | |
function I(e) { | |
if (e in St) return e; | |
for (var t = e.charAt(0).toUpperCase() + e.slice(1), n = Tt.length; n--;) | |
if (e = Tt[n] + t, e in St) return e | |
} | |
function E(e, t) { | |
for (var n, i, o, s = [], a = 0, r = e.length; a < r; a++) i = e[a], i.style && (s[a] = fe._data(i, "olddisplay"), n = i.style.display, t ? (s[a] || "none" !== n || (i.style.display = ""), "" === i.style.display && Be(i) && (s[a] = fe._data(i, "olddisplay", N(i.nodeName)))) : (o = Be(i), (n && "none" !== n || !o) && fe._data(i, "olddisplay", o ? n : fe.css(i, "display")))); | |
for (a = 0; a < r; a++) i = e[a], i.style && (t && "none" !== i.style.display && "" !== i.style.display || (i.style.display = t ? s[a] || "" : "none")); | |
return e | |
} | |
function O(e, t, n) { | |
var i = _t.exec(t); | |
return i ? Math.max(0, i[1] - (n || 0)) + (i[2] || "px") : t | |
} | |
function D(e, t, n, i, o) { | |
for (var s = n === (i ? "border" : "content") ? 4 : "width" === t ? 1 : 0, a = 0; s < 4; s += 2) "margin" === n && (a += fe.css(e, n + Me[s], !0, o)), i ? ("content" === n && (a -= fe.css(e, "padding" + Me[s], !0, o)), "margin" !== n && (a -= fe.css(e, "border" + Me[s] + "Width", !0, o))) : (a += fe.css(e, "padding" + Me[s], !0, o), "padding" !== n && (a += fe.css(e, "border" + Me[s] + "Width", !0, o))); | |
return a | |
} | |
function A(e, t, n) { | |
var i = !0, | |
o = "width" === t ? e.offsetWidth : e.offsetHeight, | |
s = ht(e), | |
a = de.boxSizing && "border-box" === fe.css(e, "boxSizing", !1, s); | |
if (o <= 0 || null == o) { | |
if (o = gt(e, t, s), (o < 0 || null == o) && (o = e.style[t]), dt.test(o)) return o; | |
i = a && (de.boxSizingReliable() || o === e.style[t]), o = parseFloat(o) || 0 | |
} | |
return o + D(e, t, n || (a ? "border" : "content"), i, s) + "px" | |
} | |
function M(e, t, n, i, o) { | |
return new M.prototype.init(e, t, n, i, o) | |
} | |
function B() { | |
return e.setTimeout(function() { | |
Ct = void 0 | |
}), Ct = fe.now() | |
} | |
function U(e, t) { | |
var n, i = { | |
height: e | |
}, | |
o = 0; | |
for (t = t ? 1 : 0; o < 4; o += 2 - t) n = Me[o], i["margin" + n] = i["padding" + n] = e; | |
return t && (i.opacity = i.width = e), i | |
} | |
function H(e, t, n) { | |
for (var i, o = (V.tweeners[t] || []).concat(V.tweeners["*"]), s = 0, a = o.length; s < a; s++) | |
if (i = o[s].call(n, t, e)) return i | |
} | |
function R(e, t, n) { | |
var i, o, s, a, r, l, u, c, d = this, | |
p = {}, | |
f = e.style, | |
h = e.nodeType && Be(e), | |
g = fe._data(e, "fxshow"); | |
n.queue || (r = fe._queueHooks(e, "fx"), null == r.unqueued && (r.unqueued = 0, l = r.empty.fire, r.empty.fire = function() { | |
r.unqueued || l() | |
}), r.unqueued++, d.always(function() { | |
d.always(function() { | |
r.unqueued--, fe.queue(e, "fx").length || r.empty.fire() | |
}) | |
})), 1 === e.nodeType && ("height" in t || "width" in t) && (n.overflow = [f.overflow, f.overflowX, f.overflowY], u = fe.css(e, "display"), c = "none" === u ? fe._data(e, "olddisplay") || N(e.nodeName) : u, "inline" === c && "none" === fe.css(e, "float") && (de.inlineBlockNeedsLayout && "inline" !== N(e.nodeName) ? f.zoom = 1 : f.display = "inline-block")), n.overflow && (f.overflow = "hidden", de.shrinkWrapBlocks() || d.always(function() { | |
f.overflow = n.overflow[0], f.overflowX = n.overflow[1], f.overflowY = n.overflow[2] | |
})); | |
for (i in t) | |
if (o = t[i], kt.exec(o)) { | |
if (delete t[i], s = s || "toggle" === o, o === (h ? "hide" : "show")) { | |
if ("show" !== o || !g || void 0 === g[i]) continue; | |
h = !0 | |
} | |
p[i] = g && g[i] || fe.style(e, i) | |
} else u = void 0; | |
if (fe.isEmptyObject(p)) "inline" === ("none" === u ? N(e.nodeName) : u) && (f.display = u); | |
else { | |
g ? "hidden" in g && (h = g.hidden) : g = fe._data(e, "fxshow", {}), s && (g.hidden = !h), h ? fe(e).show() : d.done(function() { | |
fe(e).hide() | |
}), d.done(function() { | |
var t; | |
fe._removeData(e, "fxshow"); | |
for (t in p) fe.style(e, t, p[t]) | |
}); | |
for (i in p) a = H(h ? g[i] : 0, i, d), i in g || (g[i] = a.start, h && (a.end = a.start, a.start = "width" === i || "height" === i ? 1 : 0)) | |
} | |
} | |
function j(e, t) { | |
var n, i, o, s, a; | |
for (n in e) | |
if (i = fe.camelCase(n), o = t[i], s = e[n], fe.isArray(s) && (o = s[1], s = e[n] = s[0]), n !== i && (e[i] = s, delete e[n]), a = fe.cssHooks[i], a && "expand" in a) { | |
s = a.expand(s), delete e[i]; | |
for (n in s) n in e || (e[n] = s[n], t[n] = o) | |
} else t[i] = o | |
} | |
function V(e, t, n) { | |
var i, o, s = 0, | |
a = V.prefilters.length, | |
r = fe.Deferred().always(function() { | |
delete l.elem | |
}), | |
l = function() { | |
if (o) return !1; | |
for (var t = Ct || B(), n = Math.max(0, u.startTime + u.duration - t), i = n / u.duration || 0, s = 1 - i, a = 0, l = u.tweens.length; a < l; a++) u.tweens[a].run(s); | |
return r.notifyWith(e, [u, s, n]), s < 1 && l ? n : (r.resolveWith(e, [u]), !1) | |
}, | |
u = r.promise({ | |
elem: e, | |
props: fe.extend({}, t), | |
opts: fe.extend(!0, { | |
specialEasing: {}, | |
easing: fe.easing._default | |
}, n), | |
originalProperties: t, | |
originalOptions: n, | |
startTime: Ct || B(), | |
duration: n.duration, | |
tweens: [], | |
createTween: function(t, n) { | |
var i = fe.Tween(e, u.opts, t, n, u.opts.specialEasing[t] || u.opts.easing); | |
return u.tweens.push(i), i | |
}, | |
stop: function(t) { | |
var n = 0, | |
i = t ? u.tweens.length : 0; | |
if (o) return this; | |
for (o = !0; n < i; n++) u.tweens[n].run(1); | |
return t ? (r.notifyWith(e, [u, 1, 0]), r.resolveWith(e, [u, t])) : r.rejectWith(e, [u, t]), this | |
} | |
}), | |
c = u.props; | |
for (j(c, u.opts.specialEasing); s < a; s++) | |
if (i = V.prefilters[s].call(u, e, c, u.opts)) return fe.isFunction(i.stop) && (fe._queueHooks(u.elem, u.opts.queue).stop = fe.proxy(i.stop, i)), i; | |
return fe.map(c, H, u), fe.isFunction(u.opts.start) && u.opts.start.call(e, u), fe.fx.timer(fe.extend(l, { | |
elem: e, | |
anim: u, | |
queue: u.opts.queue | |
})), u.progress(u.opts.progress).done(u.opts.done, u.opts.complete).fail(u.opts.fail).always(u.opts.always) | |
} | |
function q(e) { | |
return fe.attr(e, "class") || "" | |
} | |
function z(e) { | |
return function(t, n) { | |
"string" != typeof t && (n = t, t = "*"); | |
var i, o = 0, | |
s = t.toLowerCase().match(Le) || []; | |
if (fe.isFunction(n)) | |
for (; i = s[o++];) "+" === i.charAt(0) ? (i = i.slice(1) || "*", (e[i] = e[i] || []).unshift(n)) : (e[i] = e[i] || []).push(n) | |
} | |
} | |
function W(e, t, n, i) { | |
function o(r) { | |
var l; | |
return s[r] = !0, fe.each(e[r] || [], function(e, r) { | |
var u = r(t, n, i); | |
return "string" != typeof u || a || s[u] ? a ? !(l = u) : void 0 : (t.dataTypes.unshift(u), o(u), !1) | |
}), l | |
} | |
var s = {}, | |
a = e === Kt; | |
return o(t.dataTypes[0]) || !s["*"] && o("*") | |
} | |
function G(e, t) { | |
var n, i, o = fe.ajaxSettings.flatOptions || {}; | |
for (i in t) void 0 !== t[i] && ((o[i] ? e : n || (n = {}))[i] = t[i]); | |
return n && fe.extend(!0, e, n), e | |
} | |
function X(e, t, n) { | |
for (var i, o, s, a, r = e.contents, l = e.dataTypes; | |
"*" === l[0];) l.shift(), void 0 === o && (o = e.mimeType || t.getResponseHeader("Content-Type")); | |
if (o) | |
for (a in r) | |
if (r[a] && r[a].test(o)) { | |
l.unshift(a); | |
break | |
} | |
if (l[0] in n) s = l[0]; | |
else { | |
for (a in n) { | |
if (!l[0] || e.converters[a + " " + l[0]]) { | |
s = a; | |
break | |
} | |
i || (i = a) | |
} | |
s = s || i | |
} | |
if (s) return s !== l[0] && l.unshift(s), n[s] | |
} | |
function Y(e, t, n, i) { | |
var o, s, a, r, l, u = {}, | |
c = e.dataTypes.slice(); | |
if (c[1]) | |
for (a in e.converters) u[a.toLowerCase()] = e.converters[a]; | |
for (s = c.shift(); s;) | |
if (e.responseFields[s] && (n[e.responseFields[s]] = t), !l && i && e.dataFilter && (t = e.dataFilter(t, e.dataType)), l = s, s = c.shift()) | |
if ("*" === s) s = l; | |
else if ("*" !== l && l !== s) { | |
if (a = u[l + " " + s] || u["* " + s], !a) | |
for (o in u) | |
if (r = o.split(" "), r[1] === s && (a = u[l + " " + r[0]] || u["* " + r[0]])) { | |
a === !0 ? a = u[o] : u[o] !== !0 && (s = r[0], c.unshift(r[1])); | |
break | |
} | |
if (a !== !0) | |
if (a && e["throws"]) t = a(t); | |
else try { | |
t = a(t) | |
} catch (e) { | |
return { | |
state: "parsererror", | |
error: a ? e : "No conversion from " + l + " to " + s | |
} | |
} | |
} | |
return { | |
state: "success", | |
data: t | |
} | |
} | |
function Q(e) { | |
return e.style && e.style.display || fe.css(e, "display") | |
} | |
function J(e) { | |
if (!fe.contains(e.ownerDocument || ie, e)) return !0; | |
for (; e && 1 === e.nodeType;) { | |
if ("none" === Q(e) || "hidden" === e.type) return !0; | |
e = e.parentNode | |
} | |
return !1 | |
} | |
function K(e, t, n, i) { | |
var o; | |
if (fe.isArray(t)) fe.each(t, function(t, o) { | |
n || on.test(e) ? i(e, o) : K(e + "[" + ("object" == typeof o && null != o ? t : "") + "]", o, n, i) | |
}); | |
else if (n || "object" !== fe.type(t)) i(e, t); | |
else | |
for (o in t) K(e + "[" + o + "]", t[o], n, i) | |
} | |
function Z() { | |
try { | |
return new e.XMLHttpRequest | |
} catch (e) {} | |
} | |
function ee() { | |
try { | |
return new e.ActiveXObject("Microsoft.XMLHTTP") | |
} catch (e) {} | |
} | |
function te(e) { | |
return fe.isWindow(e) ? e : 9 === e.nodeType && (e.defaultView || e.parentWindow) | |
} | |
var ne = [], | |
ie = e.document, | |
oe = ne.slice, | |
se = ne.concat, | |
ae = ne.push, | |
re = ne.indexOf, | |
le = {}, | |
ue = le.toString, | |
ce = le.hasOwnProperty, | |
de = {}, | |
pe = "1.12.4", | |
fe = function(e, t) { | |
return new fe.fn.init(e, t) | |
}, | |
he = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, | |
ge = /^-ms-/, | |
me = /-([\da-z])/gi, | |
ve = function(e, t) { | |
return t.toUpperCase() | |
}; | |
fe.fn = fe.prototype = { | |
jquery: pe, | |
constructor: fe, | |
selector: "", | |
length: 0, | |
toArray: function() { | |
return oe.call(this) | |
}, | |
get: function(e) { | |
return null != e ? e < 0 ? this[e + this.length] : this[e] : oe.call(this) | |
}, | |
pushStack: function(e) { | |
var t = fe.merge(this.constructor(), e); | |
return t.prevObject = this, t.context = this.context, t | |
}, | |
each: function(e) { | |
return fe.each(this, e) | |
}, | |
map: function(e) { | |
return this.pushStack(fe.map(this, function(t, n) { | |
return e.call(t, n, t) | |
})) | |
}, | |
slice: function() { | |
return this.pushStack(oe.apply(this, arguments)) | |
}, | |
first: function() { | |
return this.eq(0) | |
}, | |
last: function() { | |
return this.eq(-1) | |
}, | |
eq: function(e) { | |
var t = this.length, | |
n = +e + (e < 0 ? t : 0); | |
return this.pushStack(n >= 0 && n < t ? [this[n]] : []) | |
}, | |
end: function() { | |
return this.prevObject || this.constructor() | |
}, | |
push: ae, | |
sort: ne.sort, | |
splice: ne.splice | |
}, fe.extend = fe.fn.extend = function() { | |
var e, t, n, i, o, s, a = arguments[0] || {}, | |
r = 1, | |
l = arguments.length, | |
u = !1; | |
for ("boolean" == typeof a && (u = a, a = arguments[r] || {}, r++), "object" == typeof a || fe.isFunction(a) || (a = {}), r === l && (a = this, r--); r < l; r++) | |
if (null != (o = arguments[r])) | |
for (i in o) e = a[i], n = o[i], a !== n && (u && n && (fe.isPlainObject(n) || (t = fe.isArray(n))) ? (t ? (t = !1, s = e && fe.isArray(e) ? e : []) : s = e && fe.isPlainObject(e) ? e : {}, a[i] = fe.extend(u, s, n)) : void 0 !== n && (a[i] = n)); | |
return a | |
}, fe.extend({ | |
expando: "jQuery" + (pe + Math.random()).replace(/\D/g, ""), | |
isReady: !0, | |
error: function(e) { | |
throw new Error(e) | |
}, | |
noop: function() {}, | |
isFunction: function(e) { | |
return "function" === fe.type(e) | |
}, | |
isArray: Array.isArray || function(e) { | |
return "array" === fe.type(e) | |
}, | |
isWindow: function(e) { | |
return null != e && e == e.window | |
}, | |
isNumeric: function(e) { | |
var t = e && e.toString(); | |
return !fe.isArray(e) && t - parseFloat(t) + 1 >= 0 | |
}, | |
isEmptyObject: function(e) { | |
var t; | |
for (t in e) return !1; | |
return !0 | |
}, | |
isPlainObject: function(e) { | |
var t; | |
if (!e || "object" !== fe.type(e) || e.nodeType || fe.isWindow(e)) return !1; | |
try { | |
if (e.constructor && !ce.call(e, "constructor") && !ce.call(e.constructor.prototype, "isPrototypeOf")) return !1 | |
} catch (e) { | |
return !1 | |
} | |
if (!de.ownFirst) | |
for (t in e) return ce.call(e, t); | |
for (t in e); | |
return void 0 === t || ce.call(e, t) | |
}, | |
type: function(e) { | |
return null == e ? e + "" : "object" == typeof e || "function" == typeof e ? le[ue.call(e)] || "object" : typeof e | |
}, | |
globalEval: function(t) { | |
t && fe.trim(t) && (e.execScript || function(t) { | |
e.eval.call(e, t) | |
})(t) | |
}, | |
camelCase: function(e) { | |
return e.replace(ge, "ms-").replace(me, ve) | |
}, | |
nodeName: function(e, t) { | |
return e.nodeName && e.nodeName.toLowerCase() === t.toLowerCase() | |
}, | |
each: function(e, t) { | |
var i, o = 0; | |
if (n(e)) | |
for (i = e.length; o < i && t.call(e[o], o, e[o]) !== !1; o++); | |
else | |
for (o in e) | |
if (t.call(e[o], o, e[o]) === !1) break; | |
return e | |
}, | |
trim: function(e) { | |
return null == e ? "" : (e + "").replace(he, "") | |
}, | |
makeArray: function(e, t) { | |
var i = t || []; | |
return null != e && (n(Object(e)) ? fe.merge(i, "string" == typeof e ? [e] : e) : ae.call(i, e)), i | |
}, | |
inArray: function(e, t, n) { | |
var i; | |
if (t) { | |
if (re) return re.call(t, e, n); | |
for (i = t.length, n = n ? n < 0 ? Math.max(0, i + n) : n : 0; n < i; n++) | |
if (n in t && t[n] === e) return n | |
} | |
return -1 | |
}, | |
merge: function(e, t) { | |
for (var n = +t.length, i = 0, o = e.length; i < n;) e[o++] = t[i++]; | |
if (n !== n) | |
for (; void 0 !== t[i];) e[o++] = t[i++]; | |
return e.length = o, e | |
}, | |
grep: function(e, t, n) { | |
for (var i, o = [], s = 0, a = e.length, r = !n; s < a; s++) i = !t(e[s], s), i !== r && o.push(e[s]); | |
return o | |
}, | |
map: function(e, t, i) { | |
var o, s, a = 0, | |
r = []; | |
if (n(e)) | |
for (o = e.length; a < o; a++) s = t(e[a], a, i), null != s && r.push(s); | |
else | |
for (a in e) s = t(e[a], a, i), null != s && r.push(s); | |
return se.apply([], r) | |
}, | |
guid: 1, | |
proxy: function(e, t) { | |
var n, i, o; | |
if ("string" == typeof t && (o = e[t], t = e, e = o), fe.isFunction(e)) return n = oe.call(arguments, 2), i = function() { | |
return e.apply(t || this, n.concat(oe.call(arguments))) | |
}, i.guid = e.guid = e.guid || fe.guid++, i | |
}, | |
now: function() { | |
return +new Date | |
}, | |
support: de | |
}), "function" == typeof Symbol && (fe.fn[Symbol.iterator] = ne[Symbol.iterator]), fe.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "), function(e, t) { | |
le["[object " + t + "]"] = t.toLowerCase() | |
}); | |
var be = function(e) { | |
function t(e, t, n, i) { | |
var o, s, a, r, l, u, d, f, h = t && t.ownerDocument, | |
g = t ? t.nodeType : 9; | |
if (n = n || [], "string" != typeof e || !e || 1 !== g && 9 !== g && 11 !== g) return n; | |
if (!i && ((t ? t.ownerDocument || t : H) !== I && F(t), t = t || I, O)) { | |
if (11 !== g && (u = ve.exec(e))) | |
if (o = u[1]) { | |
if (9 === g) { | |
if (!(a = t.getElementById(o))) return n; | |
if (a.id === o) return n.push(a), n | |
} else if (h && (a = h.getElementById(o)) && B(t, a) && a.id === o) return n.push(a), n | |
} else { | |
if (u[2]) return K.apply(n, t.getElementsByTagName(e)), n; | |
if ((o = u[3]) && w.getElementsByClassName && t.getElementsByClassName) return K.apply(n, t.getElementsByClassName(o)), n | |
} | |
if (w.qsa && !z[e + " "] && (!D || !D.test(e))) { | |
if (1 !== g) h = t, f = e; | |
else if ("object" !== t.nodeName.toLowerCase()) { | |
for ((r = t.getAttribute("id")) ? r = r.replace(ye, "\\$&") : t.setAttribute("id", r = U), d = C(e), s = d.length, l = pe.test(r) ? "#" + r : "[id='" + r + "']"; s--;) d[s] = l + " " + p(d[s]); | |
f = d.join(","), h = be.test(e) && c(t.parentNode) || t | |
} | |
if (f) try { | |
return K.apply(n, h.querySelectorAll(f)), n | |
} catch (e) {} finally { | |
r === U && t.removeAttribute("id") | |
} | |
} | |
} | |
return k(e.replace(re, "$1"), t, n, i) | |
} | |
function n() { | |
function e(n, i) { | |
return t.push(n + " ") > x.cacheLength && delete e[t.shift()], e[n + " "] = i | |
} | |
var t = []; | |
return e | |
} | |
function i(e) { | |
return e[U] = !0, e | |
} | |
function o(e) { | |
var t = I.createElement("div"); | |
try { | |
return !!e(t) | |
} catch (e) { | |
return !1 | |
} finally { | |
t.parentNode && t.parentNode.removeChild(t), t = null | |
} | |
} | |
function s(e, t) { | |
for (var n = e.split("|"), i = n.length; i--;) x.attrHandle[n[i]] = t | |
} | |
function a(e, t) { | |
var n = t && e, | |
i = n && 1 === e.nodeType && 1 === t.nodeType && (~t.sourceIndex || G) - (~e.sourceIndex || G); | |
if (i) return i; | |
if (n) | |
for (; n = n.nextSibling;) | |
if (n === t) return -1; | |
return e ? 1 : -1 | |
} | |
function r(e) { | |
return function(t) { | |
var n = t.nodeName.toLowerCase(); | |
return "input" === n && t.type === e | |
} | |
} | |
function l(e) { | |
return function(t) { | |
var n = t.nodeName.toLowerCase(); | |
return ("input" === n || "button" === n) && t.type === e | |
} | |
} | |
function u(e) { | |
return i(function(t) { | |
return t = +t, i(function(n, i) { | |
for (var o, s = e([], n.length, t), a = s.length; a--;) n[o = s[a]] && (n[o] = !(i[o] = n[o])) | |
}) | |
}) | |
} | |
function c(e) { | |
return e && "undefined" != typeof e.getElementsByTagName && e | |
} | |
function d() {} | |
function p(e) { | |
for (var t = 0, n = e.length, i = ""; t < n; t++) i += e[t].value; | |
return i | |
} | |
function f(e, t, n) { | |
var i = t.dir, | |
o = n && "parentNode" === i, | |
s = j++; | |
return t.first ? function(t, n, s) { | |
for (; t = t[i];) | |
if (1 === t.nodeType || o) return e(t, n, s) | |
} : function(t, n, a) { | |
var r, l, u, c = [R, s]; | |
if (a) { | |
for (; t = t[i];) | |
if ((1 === t.nodeType || o) && e(t, n, a)) return !0 | |
} else | |
for (; t = t[i];) | |
if (1 === t.nodeType || o) { | |
if (u = t[U] || (t[U] = {}), l = u[t.uniqueID] || (u[t.uniqueID] = {}), (r = l[i]) && r[0] === R && r[1] === s) return c[2] = r[2]; | |
if (l[i] = c, c[2] = e(t, n, a)) return !0 | |
} | |
} | |
} | |
function h(e) { | |
return e.length > 1 ? function(t, n, i) { | |
for (var o = e.length; o--;) | |
if (!e[o](t, n, i)) return !1; | |
return !0 | |
} : e[0] | |
} | |
function g(e, n, i) { | |
for (var o = 0, s = n.length; o < s; o++) t(e, n[o], i); | |
return i | |
} | |
function m(e, t, n, i, o) { | |
for (var s, a = [], r = 0, l = e.length, u = null != t; r < l; r++)(s = e[r]) && (n && !n(s, i, o) || (a.push(s), u && t.push(r))); | |
return a | |
} | |
function v(e, t, n, o, s, a) { | |
return o && !o[U] && (o = v(o)), s && !s[U] && (s = v(s, a)), i(function(i, a, r, l) { | |
var u, c, d, p = [], | |
f = [], | |
h = a.length, | |
v = i || g(t || "*", r.nodeType ? [r] : r, []), | |
b = !e || !i && t ? v : m(v, p, e, r, l), | |
y = n ? s || (i ? e : h || o) ? [] : a : b; | |
if (n && n(b, y, r, l), o) | |
for (u = m(y, f), o(u, [], r, l), c = u.length; c--;)(d = u[c]) && (y[f[c]] = !(b[f[c]] = d)); | |
if (i) { | |
if (s || e) { | |
if (s) { | |
for (u = [], c = y.length; c--;)(d = y[c]) && u.push(b[c] = d); | |
s(null, y = [], u, l) | |
} | |
for (c = y.length; c--;)(d = y[c]) && (u = s ? ee(i, d) : p[c]) > -1 && (i[u] = !(a[u] = d)) | |
} | |
} else y = m(y === a ? y.splice(h, y.length) : y), s ? s(null, a, y, l) : K.apply(a, y) | |
}) | |
} | |
function b(e) { | |
for (var t, n, i, o = e.length, s = x.relative[e[0].type], a = s || x.relative[" "], r = s ? 1 : 0, l = f(function(e) { | |
return e === t | |
}, a, !0), u = f(function(e) { | |
return ee(t, e) > -1 | |
}, a, !0), c = [function(e, n, i) { | |
var o = !s && (i || n !== P) || ((t = n).nodeType ? l(e, n, i) : u(e, n, i)); | |
return t = null, o | |
}]; r < o; r++) | |
if (n = x.relative[e[r].type]) c = [f(h(c), n)]; | |
else { | |
if (n = x.filter[e[r].type].apply(null, e[r].matches), n[U]) { | |
for (i = ++r; i < o && !x.relative[e[i].type]; i++); | |
return v(r > 1 && h(c), r > 1 && p(e.slice(0, r - 1).concat({ | |
value: " " === e[r - 2].type ? "*" : "" | |
})).replace(re, "$1"), n, r < i && b(e.slice(r, i)), i < o && b(e = e.slice(i)), i < o && p(e)) | |
} | |
c.push(n) | |
} | |
return h(c) | |
} | |
function y(e, n) { | |
var o = n.length > 0, | |
s = e.length > 0, | |
a = function(i, a, r, l, u) { | |
var c, d, p, f = 0, | |
h = "0", | |
g = i && [], | |
v = [], | |
b = P, | |
y = i || s && x.find.TAG("*", u), | |
_ = R += null == b ? 1 : Math.random() || .1, | |
w = y.length; | |
for (u && (P = a === I || a || u); h !== w && null != (c = y[h]); h++) { | |
if (s && c) { | |
for (d = 0, a || c.ownerDocument === I || (F(c), r = !O); p = e[d++];) | |
if (p(c, a || I, r)) { | |
l.push(c); | |
break | |
} | |
u && (R = _) | |
} | |
o && ((c = !p && c) && f--, i && g.push(c)) | |
} | |
if (f += h, o && h !== f) { | |
for (d = 0; p = n[d++];) p(g, v, a, r); | |
if (i) { | |
if (f > 0) | |
for (; h--;) g[h] || v[h] || (v[h] = Q.call(l)); | |
v = m(v) | |
} | |
K.apply(l, v), u && !i && v.length > 0 && f + n.length > 1 && t.uniqueSort(l) | |
} | |
return u && (R = _, P = b), g | |
}; | |
return o ? i(a) : a | |
} | |
var _, w, x, T, S, C, $, k, P, L, N, F, I, E, O, D, A, M, B, U = "sizzle" + 1 * new Date, | |
H = e.document, | |
R = 0, | |
j = 0, | |
V = n(), | |
q = n(), | |
z = n(), | |
W = function(e, t) { | |
return e === t && (N = !0), 0 | |
}, | |
G = 1 << 31, | |
X = {}.hasOwnProperty, | |
Y = [], | |
Q = Y.pop, | |
J = Y.push, | |
K = Y.push, | |
Z = Y.slice, | |
ee = function(e, t) { | |
for (var n = 0, i = e.length; n < i; n++) | |
if (e[n] === t) return n; | |
return -1 | |
}, | |
te = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", | |
ne = "[\\x20\\t\\r\\n\\f]", | |
ie = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", | |
oe = "\\[" + ne + "*(" + ie + ")(?:" + ne + "*([*^$|!~]?=)" + ne + "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + ie + "))|)" + ne + "*\\]", | |
se = ":(" + ie + ")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|" + oe + ")*)|.*)\\)|)", | |
ae = new RegExp(ne + "+", "g"), | |
re = new RegExp("^" + ne + "+|((?:^|[^\\\\])(?:\\\\.)*)" + ne + "+$", "g"), | |
le = new RegExp("^" + ne + "*," + ne + "*"), | |
ue = new RegExp("^" + ne + "*([>+~]|" + ne + ")" + ne + "*"), | |
ce = new RegExp("=" + ne + "*([^\\]'\"]*?)" + ne + "*\\]", "g"), | |
de = new RegExp(se), | |
pe = new RegExp("^" + ie + "$"), | |
fe = { | |
ID: new RegExp("^#(" + ie + ")"), | |
CLASS: new RegExp("^\\.(" + ie + ")"), | |
TAG: new RegExp("^(" + ie + "|[*])"), | |
ATTR: new RegExp("^" + oe), | |
PSEUDO: new RegExp("^" + se), | |
CHILD: new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + ne + "*(even|odd|(([+-]|)(\\d*)n|)" + ne + "*(?:([+-]|)" + ne + "*(\\d+)|))" + ne + "*\\)|)", "i"), | |
bool: new RegExp("^(?:" + te + ")$", "i"), | |
needsContext: new RegExp("^" + ne + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + ne + "*((?:-\\d)?\\d*)" + ne + "*\\)|)(?=[^-]|$)", "i") | |
}, | |
he = /^(?:input|select|textarea|button)$/i, | |
ge = /^h\d$/i, | |
me = /^[^{]+\{\s*\[native \w/, | |
ve = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, | |
be = /[+~]/, | |
ye = /'|\\/g, | |
_e = new RegExp("\\\\([\\da-f]{1,6}" + ne + "?|(" + ne + ")|.)", "ig"), | |
we = function(e, t, n) { | |
var i = "0x" + t - 65536; | |
return i !== i || n ? t : i < 0 ? String.fromCharCode(i + 65536) : String.fromCharCode(i >> 10 | 55296, 1023 & i | 56320) | |
}, | |
xe = function() { | |
F() | |
}; | |
try { | |
K.apply(Y = Z.call(H.childNodes), H.childNodes), Y[H.childNodes.length].nodeType | |
} catch (e) { | |
K = { | |
apply: Y.length ? function(e, t) { | |
J.apply(e, Z.call(t)) | |
} : function(e, t) { | |
for (var n = e.length, i = 0; e[n++] = t[i++];); | |
e.length = n - 1 | |
} | |
} | |
} | |
w = t.support = {}, S = t.isXML = function(e) { | |
var t = e && (e.ownerDocument || e).documentElement; | |
return !!t && "HTML" !== t.nodeName | |
}, F = t.setDocument = function(e) { | |
var t, n, i = e ? e.ownerDocument || e : H; | |
return i !== I && 9 === i.nodeType && i.documentElement ? (I = i, E = I.documentElement, O = !S(I), (n = I.defaultView) && n.top !== n && (n.addEventListener ? n.addEventListener("unload", xe, !1) : n.attachEvent && n.attachEvent("onunload", xe)), w.attributes = o(function(e) { | |
return e.className = "i", !e.getAttribute("className") | |
}), w.getElementsByTagName = o(function(e) { | |
return e.appendChild(I.createComment("")), !e.getElementsByTagName("*").length | |
}), w.getElementsByClassName = me.test(I.getElementsByClassName), w.getById = o(function(e) { | |
return E.appendChild(e).id = U, !I.getElementsByName || !I.getElementsByName(U).length | |
}), w.getById ? (x.find.ID = function(e, t) { | |
if ("undefined" != typeof t.getElementById && O) { | |
var n = t.getElementById(e); | |
return n ? [n] : [] | |
} | |
}, x.filter.ID = function(e) { | |
var t = e.replace(_e, we); | |
return function(e) { | |
return e.getAttribute("id") === t | |
} | |
}) : (delete x.find.ID, x.filter.ID = function(e) { | |
var t = e.replace(_e, we); | |
return function(e) { | |
var n = "undefined" != typeof e.getAttributeNode && e.getAttributeNode("id"); | |
return n && n.value === t | |
} | |
}), x.find.TAG = w.getElementsByTagName ? function(e, t) { | |
return "undefined" != typeof t.getElementsByTagName ? t.getElementsByTagName(e) : w.qsa ? t.querySelectorAll(e) : void 0 | |
} : function(e, t) { | |
var n, i = [], | |
o = 0, | |
s = t.getElementsByTagName(e); | |
if ("*" === e) { | |
for (; n = s[o++];) 1 === n.nodeType && i.push(n); | |
return i | |
} | |
return s | |
}, x.find.CLASS = w.getElementsByClassName && function(e, t) { | |
if ("undefined" != typeof t.getElementsByClassName && O) return t.getElementsByClassName(e) | |
}, A = [], D = [], (w.qsa = me.test(I.querySelectorAll)) && (o(function(e) { | |
E.appendChild(e).innerHTML = "<a id='" + U + "'></a><select id='" + U + "-\r\\' msallowcapture=''><option selected=''></option></select>", e.querySelectorAll("[msallowcapture^='']").length && D.push("[*^$]=" + ne + "*(?:''|\"\")"), e.querySelectorAll("[selected]").length || D.push("\\[" + ne + "*(?:value|" + te + ")"), e.querySelectorAll("[id~=" + U + "-]").length || D.push("~="), e.querySelectorAll(":checked").length || D.push(":checked"), e.querySelectorAll("a#" + U + "+*").length || D.push(".#.+[+~]") | |
}), o(function(e) { | |
var t = I.createElement("input"); | |
t.setAttribute("type", "hidden"), e.appendChild(t).setAttribute("name", "D"), e.querySelectorAll("[name=d]").length && D.push("name" + ne + "*[*^$|!~]?="), e.querySelectorAll(":enabled").length || D.push(":enabled", ":disabled"), e.querySelectorAll("*,:x"), D.push(",.*:") | |
})), (w.matchesSelector = me.test(M = E.matches || E.webkitMatchesSelector || E.mozMatchesSelector || E.oMatchesSelector || E.msMatchesSelector)) && o(function(e) { | |
w.disconnectedMatch = M.call(e, "div"), M.call(e, "[s!='']:x"), A.push("!=", se) | |
}), D = D.length && new RegExp(D.join("|")), A = A.length && new RegExp(A.join("|")), t = me.test(E.compareDocumentPosition), B = t || me.test(E.contains) ? function(e, t) { | |
var n = 9 === e.nodeType ? e.documentElement : e, | |
i = t && t.parentNode; | |
return e === i || !(!i || 1 !== i.nodeType || !(n.contains ? n.contains(i) : e.compareDocumentPosition && 16 & e.compareDocumentPosition(i))) | |
} : function(e, t) { | |
if (t) | |
for (; t = t.parentNode;) | |
if (t === e) return !0; | |
return !1 | |
}, W = t ? function(e, t) { | |
if (e === t) return N = !0, 0; | |
var n = !e.compareDocumentPosition - !t.compareDocumentPosition; | |
return n ? n : (n = (e.ownerDocument || e) === (t.ownerDocument || t) ? e.compareDocumentPosition(t) : 1, 1 & n || !w.sortDetached && t.compareDocumentPosition(e) === n ? e === I || e.ownerDocument === H && B(H, e) ? -1 : t === I || t.ownerDocument === H && B(H, t) ? 1 : L ? ee(L, e) - ee(L, t) : 0 : 4 & n ? -1 : 1) | |
} : function(e, t) { | |
if (e === t) return N = !0, 0; | |
var n, i = 0, | |
o = e.parentNode, | |
s = t.parentNode, | |
r = [e], | |
l = [t]; | |
if (!o || !s) return e === I ? -1 : t === I ? 1 : o ? -1 : s ? 1 : L ? ee(L, e) - ee(L, t) : 0; | |
if (o === s) return a(e, t); | |
for (n = e; n = n.parentNode;) r.unshift(n); | |
for (n = t; n = n.parentNode;) l.unshift(n); | |
for (; r[i] === l[i];) i++; | |
return i ? a(r[i], l[i]) : r[i] === H ? -1 : l[i] === H ? 1 : 0 | |
}, I) : I | |
}, t.matches = function(e, n) { | |
return t(e, null, null, n) | |
}, t.matchesSelector = function(e, n) { | |
if ((e.ownerDocument || e) !== I && F(e), n = n.replace(ce, "='$1']"), w.matchesSelector && O && !z[n + " "] && (!A || !A.test(n)) && (!D || !D.test(n))) try { | |
var i = M.call(e, n); | |
if (i || w.disconnectedMatch || e.document && 11 !== e.document.nodeType) return i | |
} catch (e) {} | |
return t(n, I, null, [e]).length > 0 | |
}, t.contains = function(e, t) { | |
return (e.ownerDocument || e) !== I && F(e), B(e, t) | |
}, t.attr = function(e, t) { | |
(e.ownerDocument || e) !== I && F(e); | |
var n = x.attrHandle[t.toLowerCase()], | |
i = n && X.call(x.attrHandle, t.toLowerCase()) ? n(e, t, !O) : void 0; | |
return void 0 !== i ? i : w.attributes || !O ? e.getAttribute(t) : (i = e.getAttributeNode(t)) && i.specified ? i.value : null | |
}, t.error = function(e) { | |
throw new Error("Syntax error, unrecognized expression: " + e) | |
}, t.uniqueSort = function(e) { | |
var t, n = [], | |
i = 0, | |
o = 0; | |
if (N = !w.detectDuplicates, L = !w.sortStable && e.slice(0), e.sort(W), N) { | |
for (; t = e[o++];) t === e[o] && (i = n.push(o)); | |
for (; i--;) e.splice(n[i], 1) | |
} | |
return L = null, e | |
}, T = t.getText = function(e) { | |
var t, n = "", | |
i = 0, | |
o = e.nodeType; | |
if (o) { | |
if (1 === o || 9 === o || 11 === o) { | |
if ("string" == typeof e.textContent) return e.textContent; | |
for (e = e.firstChild; e; e = e.nextSibling) n += T(e) | |
} else if (3 === o || 4 === o) return e.nodeValue | |
} else | |
for (; t = e[i++];) n += T(t); | |
return n | |
}, x = t.selectors = { | |
cacheLength: 50, | |
createPseudo: i, | |
match: fe, | |
attrHandle: {}, | |
find: {}, | |
relative: { | |
">": { | |
dir: "parentNode", | |
first: !0 | |
}, | |
" ": { | |
dir: "parentNode" | |
}, | |
"+": { | |
dir: "previousSibling", | |
first: !0 | |
}, | |
"~": { | |
dir: "previousSibling" | |
} | |
}, | |
preFilter: { | |
ATTR: function(e) { | |
return e[1] = e[1].replace(_e, we), e[3] = (e[3] || e[4] || e[5] || "").replace(_e, we), "~=" === e[2] && (e[3] = " " + e[3] + " "), e.slice(0, 4) | |
}, | |
CHILD: function(e) { | |
return e[1] = e[1].toLowerCase(), "nth" === e[1].slice(0, 3) ? (e[3] || t.error(e[0]), e[4] = +(e[4] ? e[5] + (e[6] || 1) : 2 * ("even" === e[3] || "odd" === e[3])), e[5] = +(e[7] + e[8] || "odd" === e[3])) : e[3] && t.error(e[0]), e | |
}, | |
PSEUDO: function(e) { | |
var t, n = !e[6] && e[2]; | |
return fe.CHILD.test(e[0]) ? null : (e[3] ? e[2] = e[4] || e[5] || "" : n && de.test(n) && (t = C(n, !0)) && (t = n.indexOf(")", n.length - t) - n.length) && (e[0] = e[0].slice(0, t), e[2] = n.slice(0, t)), e.slice(0, 3)) | |
} | |
}, | |
filter: { | |
TAG: function(e) { | |
var t = e.replace(_e, we).toLowerCase(); | |
return "*" === e ? function() { | |
return !0 | |
} : function(e) { | |
return e.nodeName && e.nodeName.toLowerCase() === t | |
} | |
}, | |
CLASS: function(e) { | |
var t = V[e + " "]; | |
return t || (t = new RegExp("(^|" + ne + ")" + e + "(" + ne + "|$)")) && V(e, function(e) { | |
return t.test("string" == typeof e.className && e.className || "undefined" != typeof e.getAttribute && e.getAttribute("class") || "") | |
}) | |
}, | |
ATTR: function(e, n, i) { | |
return function(o) { | |
var s = t.attr(o, e); | |
return null == s ? "!=" === n : !n || (s += "", "=" === n ? s === i : "!=" === n ? s !== i : "^=" === n ? i && 0 === s.indexOf(i) : "*=" === n ? i && s.indexOf(i) > -1 : "$=" === n ? i && s.slice(-i.length) === i : "~=" === n ? (" " + s.replace(ae, " ") + " ").indexOf(i) > -1 : "|=" === n && (s === i || s.slice(0, i.length + 1) === i + "-")) | |
} | |
}, | |
CHILD: function(e, t, n, i, o) { | |
var s = "nth" !== e.slice(0, 3), | |
a = "last" !== e.slice(-4), | |
r = "of-type" === t; | |
return 1 === i && 0 === o ? function(e) { | |
return !!e.parentNode | |
} : function(t, n, l) { | |
var u, c, d, p, f, h, g = s !== a ? "nextSibling" : "previousSibling", | |
m = t.parentNode, | |
v = r && t.nodeName.toLowerCase(), | |
b = !l && !r, | |
y = !1; | |
if (m) { | |
if (s) { | |
for (; g;) { | |
for (p = t; p = p[g];) | |
if (r ? p.nodeName.toLowerCase() === v : 1 === p.nodeType) return !1; | |
h = g = "only" === e && !h && "nextSibling" | |
} | |
return !0 | |
} | |
if (h = [a ? m.firstChild : m.lastChild], a && b) { | |
for (p = m, d = p[U] || (p[U] = {}), c = d[p.uniqueID] || (d[p.uniqueID] = {}), u = c[e] || [], f = u[0] === R && u[1], y = f && u[2], p = f && m.childNodes[f]; p = ++f && p && p[g] || (y = f = 0) || h.pop();) | |
if (1 === p.nodeType && ++y && p === t) { | |
c[e] = [R, f, y]; | |
break | |
} | |
} else if (b && (p = t, d = p[U] || (p[U] = {}), c = d[p.uniqueID] || (d[p.uniqueID] = {}), u = c[e] || [], f = u[0] === R && u[1], y = f), y === !1) | |
for (; | |
(p = ++f && p && p[g] || (y = f = 0) || h.pop()) && ((r ? p.nodeName.toLowerCase() !== v : 1 !== p.nodeType) || !++y || (b && (d = p[U] || (p[U] = {}), c = d[p.uniqueID] || (d[p.uniqueID] = {}), c[e] = [R, y]), p !== t));); | |
return y -= o, y === i || y % i === 0 && y / i >= 0 | |
} | |
} | |
}, | |
PSEUDO: function(e, n) { | |
var o, s = x.pseudos[e] || x.setFilters[e.toLowerCase()] || t.error("unsupported pseudo: " + e); | |
return s[U] ? s(n) : s.length > 1 ? (o = [e, e, "", n], x.setFilters.hasOwnProperty(e.toLowerCase()) ? i(function(e, t) { | |
for (var i, o = s(e, n), a = o.length; a--;) i = ee(e, o[a]), e[i] = !(t[i] = o[a]) | |
}) : function(e) { | |
return s(e, 0, o) | |
}) : s | |
} | |
}, | |
pseudos: { | |
not: i(function(e) { | |
var t = [], | |
n = [], | |
o = $(e.replace(re, "$1")); | |
return o[U] ? i(function(e, t, n, i) { | |
for (var s, a = o(e, null, i, []), r = e.length; r--;)(s = a[r]) && (e[r] = !(t[r] = s)) | |
}) : function(e, i, s) { | |
return t[0] = e, o(t, null, s, n), t[0] = null, !n.pop() | |
} | |
}), | |
has: i(function(e) { | |
return function(n) { | |
return t(e, n).length > 0 | |
} | |
}), | |
contains: i(function(e) { | |
return e = e.replace(_e, we), | |
function(t) { | |
return (t.textContent || t.innerText || T(t)).indexOf(e) > -1 | |
} | |
}), | |
lang: i(function(e) { | |
return pe.test(e || "") || t.error("unsupported lang: " + e), e = e.replace(_e, we).toLowerCase(), | |
function(t) { | |
var n; | |
do | |
if (n = O ? t.lang : t.getAttribute("xml:lang") || t.getAttribute("lang")) return n = n.toLowerCase(), n === e || 0 === n.indexOf(e + "-"); while ((t = t.parentNode) && 1 === t.nodeType); | |
return !1 | |
} | |
}), | |
target: function(t) { | |
var n = e.location && e.location.hash; | |
return n && n.slice(1) === t.id | |
}, | |
root: function(e) { | |
return e === E | |
}, | |
focus: function(e) { | |
return e === I.activeElement && (!I.hasFocus || I.hasFocus()) && !!(e.type || e.href || ~e.tabIndex) | |
}, | |
enabled: function(e) { | |
return e.disabled === !1 | |
}, | |
disabled: function(e) { | |
return e.disabled === !0 | |
}, | |
checked: function(e) { | |
var t = e.nodeName.toLowerCase(); | |
return "input" === t && !!e.checked || "option" === t && !!e.selected | |
}, | |
selected: function(e) { | |
return e.parentNode && e.parentNode.selectedIndex, e.selected === !0 | |
}, | |
empty: function(e) { | |
for (e = e.firstChild; e; e = e.nextSibling) | |
if (e.nodeType < 6) return !1; | |
return !0 | |
}, | |
parent: function(e) { | |
return !x.pseudos.empty(e) | |
}, | |
header: function(e) { | |
return ge.test(e.nodeName) | |
}, | |
input: function(e) { | |
return he.test(e.nodeName) | |
}, | |
button: function(e) { | |
var t = e.nodeName.toLowerCase(); | |
return "input" === t && "button" === e.type || "button" === t | |
}, | |
text: function(e) { | |
var t; | |
return "input" === e.nodeName.toLowerCase() && "text" === e.type && (null == (t = e.getAttribute("type")) || "text" === t.toLowerCase()) | |
}, | |
first: u(function() { | |
return [0] | |
}), | |
last: u(function(e, t) { | |
return [t - 1] | |
}), | |
eq: u(function(e, t, n) { | |
return [n < 0 ? n + t : n] | |
}), | |
even: u(function(e, t) { | |
for (var n = 0; n < t; n += 2) e.push(n); | |
return e | |
}), | |
odd: u(function(e, t) { | |
for (var n = 1; n < t; n += 2) e.push(n); | |
return e | |
}), | |
lt: u(function(e, t, n) { | |
for (var i = n < 0 ? n + t : n; --i >= 0;) e.push(i); | |
return e | |
}), | |
gt: u(function(e, t, n) { | |
for (var i = n < 0 ? n + t : n; ++i < t;) e.push(i); | |
return e | |
}) | |
} | |
}, x.pseudos.nth = x.pseudos.eq; | |
for (_ in { | |
radio: !0, | |
checkbox: !0, | |
file: !0, | |
password: !0, | |
image: !0 | |
}) x.pseudos[_] = r(_); | |
for (_ in { | |
submit: !0, | |
reset: !0 | |
}) x.pseudos[_] = l(_); | |
return d.prototype = x.filters = x.pseudos, x.setFilters = new d, C = t.tokenize = function(e, n) { | |
var i, o, s, a, r, l, u, c = q[e + " "]; | |
if (c) return n ? 0 : c.slice(0); | |
for (r = e, l = [], u = x.preFilter; r;) { | |
i && !(o = le.exec(r)) || (o && (r = r.slice(o[0].length) || r), l.push(s = [])), i = !1, (o = ue.exec(r)) && (i = o.shift(), s.push({ | |
value: i, | |
type: o[0].replace(re, " ") | |
}), r = r.slice(i.length)); | |
for (a in x.filter) !(o = fe[a].exec(r)) || u[a] && !(o = u[a](o)) || (i = o.shift(), s.push({ | |
value: i, | |
type: a, | |
matches: o | |
}), r = r.slice(i.length)); | |
if (!i) break | |
} | |
return n ? r.length : r ? t.error(e) : q(e, l).slice(0) | |
}, $ = t.compile = function(e, t) { | |
var n, i = [], | |
o = [], | |
s = z[e + " "]; | |
if (!s) { | |
for (t || (t = C(e)), n = t.length; n--;) s = b(t[n]), s[U] ? i.push(s) : o.push(s); | |
s = z(e, y(o, i)), s.selector = e | |
} | |
return s | |
}, k = t.select = function(e, t, n, i) { | |
var o, s, a, r, l, u = "function" == typeof e && e, | |
d = !i && C(e = u.selector || e); | |
if (n = n || [], 1 === d.length) { | |
if (s = d[0] = d[0].slice(0), s.length > 2 && "ID" === (a = s[0]).type && w.getById && 9 === t.nodeType && O && x.relative[s[1].type]) { | |
if (t = (x.find.ID(a.matches[0].replace(_e, we), t) || [])[0], !t) return n; | |
u && (t = t.parentNode), e = e.slice(s.shift().value.length) | |
} | |
for (o = fe.needsContext.test(e) ? 0 : s.length; o-- && (a = s[o], !x.relative[r = a.type]);) | |
if ((l = x.find[r]) && (i = l(a.matches[0].replace(_e, we), be.test(s[0].type) && c(t.parentNode) || t))) { | |
if (s.splice(o, 1), e = i.length && p(s), !e) return K.apply(n, i), n; | |
break | |
} | |
} | |
return (u || $(e, d))(i, t, !O, n, !t || be.test(e) && c(t.parentNode) || t), n | |
}, w.sortStable = U.split("").sort(W).join("") === U, w.detectDuplicates = !!N, F(), w.sortDetached = o(function(e) { | |
return 1 & e.compareDocumentPosition(I.createElement("div")) | |
}), o(function(e) { | |
return e.innerHTML = "<a href='#'></a>", "#" === e.firstChild.getAttribute("href") | |
}) || s("type|href|height|width", function(e, t, n) { | |
if (!n) return e.getAttribute(t, "type" === t.toLowerCase() ? 1 : 2) | |
}), w.attributes && o(function(e) { | |
return e.innerHTML = "<input/>", e.firstChild.setAttribute("value", ""), "" === e.firstChild.getAttribute("value") | |
}) || s("value", function(e, t, n) { | |
if (!n && "input" === e.nodeName.toLowerCase()) return e.defaultValue | |
}), o(function(e) { | |
return null == e.getAttribute("disabled") | |
}) || s(te, function(e, t, n) { | |
var i; | |
if (!n) return e[t] === !0 ? t.toLowerCase() : (i = e.getAttributeNode(t)) && i.specified ? i.value : null | |
}), t | |
}(e); | |
fe.find = be, fe.expr = be.selectors, fe.expr[":"] = fe.expr.pseudos, fe.uniqueSort = fe.unique = be.uniqueSort, fe.text = be.getText, fe.isXMLDoc = be.isXML, fe.contains = be.contains; | |
var ye = function(e, t, n) { | |
for (var i = [], o = void 0 !== n; | |
(e = e[t]) && 9 !== e.nodeType;) | |
if (1 === e.nodeType) { | |
if (o && fe(e).is(n)) break; | |
i.push(e) | |
} | |
return i | |
}, | |
_e = function(e, t) { | |
for (var n = []; e; e = e.nextSibling) 1 === e.nodeType && e !== t && n.push(e); | |
return n | |
}, | |
we = fe.expr.match.needsContext, | |
xe = /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/, | |
Te = /^.[^:#\[\.,]*$/; | |
fe.filter = function(e, t, n) { | |
var i = t[0]; | |
return n && (e = ":not(" + e + ")"), 1 === t.length && 1 === i.nodeType ? fe.find.matchesSelector(i, e) ? [i] : [] : fe.find.matches(e, fe.grep(t, function(e) { | |
return 1 === e.nodeType | |
})) | |
}, fe.fn.extend({ | |
find: function(e) { | |
var t, n = [], | |
i = this, | |
o = i.length; | |
if ("string" != typeof e) return this.pushStack(fe(e).filter(function() { | |
for (t = 0; t < o; t++) | |
if (fe.contains(i[t], this)) return !0 | |
})); | |
for (t = 0; t < o; t++) fe.find(e, i[t], n); | |
return n = this.pushStack(o > 1 ? fe.unique(n) : n), n.selector = this.selector ? this.selector + " " + e : e, n | |
}, | |
filter: function(e) { | |
return this.pushStack(i(this, e || [], !1)) | |
}, | |
not: function(e) { | |
return this.pushStack(i(this, e || [], !0)) | |
}, | |
is: function(e) { | |
return !!i(this, "string" == typeof e && we.test(e) ? fe(e) : e || [], !1).length | |
} | |
}); | |
var Se, Ce = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, | |
$e = fe.fn.init = function(e, t, n) { | |
var i, o; | |
if (!e) return this; | |
if (n = n || Se, "string" == typeof e) { | |
if (i = "<" === e.charAt(0) && ">" === e.charAt(e.length - 1) && e.length >= 3 ? [null, e, null] : Ce.exec(e), !i || !i[1] && t) return !t || t.jquery ? (t || n).find(e) : this.constructor(t).find(e); | |
if (i[1]) { | |
if (t = t instanceof fe ? t[0] : t, fe.merge(this, fe.parseHTML(i[1], t && t.nodeType ? t.ownerDocument || t : ie, !0)), xe.test(i[1]) && fe.isPlainObject(t)) | |
for (i in t) fe.isFunction(this[i]) ? this[i](t[i]) : this.attr(i, t[i]); | |
return this | |
} | |
if (o = ie.getElementById(i[2]), o && o.parentNode) { | |
if (o.id !== i[2]) return Se.find(e); | |
this.length = 1, this[0] = o | |
} | |
return this.context = ie, this.selector = e, this | |
} | |
return e.nodeType ? (this.context = this[0] = e, this.length = 1, this) : fe.isFunction(e) ? "undefined" != typeof n.ready ? n.ready(e) : e(fe) : (void 0 !== e.selector && (this.selector = e.selector, this.context = e.context), fe.makeArray(e, this)) | |
}; | |
$e.prototype = fe.fn, Se = fe(ie); | |
var ke = /^(?:parents|prev(?:Until|All))/, | |
Pe = { | |
children: !0, | |
contents: !0, | |
next: !0, | |
prev: !0 | |
}; | |
fe.fn.extend({ | |
has: function(e) { | |
var t, n = fe(e, this), | |
i = n.length; | |
return this.filter(function() { | |
for (t = 0; t < i; t++) | |
if (fe.contains(this, n[t])) return !0 | |
}) | |
}, | |
closest: function(e, t) { | |
for (var n, i = 0, o = this.length, s = [], a = we.test(e) || "string" != typeof e ? fe(e, t || this.context) : 0; i < o; i++) | |
for (n = this[i]; n && n !== t; n = n.parentNode) | |
if (n.nodeType < 11 && (a ? a.index(n) > -1 : 1 === n.nodeType && fe.find.matchesSelector(n, e))) { | |
s.push(n); | |
break | |
} | |
return this.pushStack(s.length > 1 ? fe.uniqueSort(s) : s) | |
}, | |
index: function(e) { | |
return e ? "string" == typeof e ? fe.inArray(this[0], fe(e)) : fe.inArray(e.jquery ? e[0] : e, this) : this[0] && this[0].parentNode ? this.first().prevAll().length : -1 | |
}, | |
add: function(e, t) { | |
return this.pushStack(fe.uniqueSort(fe.merge(this.get(), fe(e, t)))) | |
}, | |
addBack: function(e) { | |
return this.add(null == e ? this.prevObject : this.prevObject.filter(e)) | |
} | |
}), fe.each({ | |
parent: function(e) { | |
var t = e.parentNode; | |
return t && 11 !== t.nodeType ? t : null | |
}, | |
parents: function(e) { | |
return ye(e, "parentNode") | |
}, | |
parentsUntil: function(e, t, n) { | |
return ye(e, "parentNode", n) | |
}, | |
next: function(e) { | |
return o(e, "nextSibling") | |
}, | |
prev: function(e) { | |
return o(e, "previousSibling") | |
}, | |
nextAll: function(e) { | |
return ye(e, "nextSibling") | |
}, | |
prevAll: function(e) { | |
return ye(e, "previousSibling") | |
}, | |
nextUntil: function(e, t, n) { | |
return ye(e, "nextSibling", n) | |
}, | |
prevUntil: function(e, t, n) { | |
return ye(e, "previousSibling", n) | |
}, | |
siblings: function(e) { | |
return _e((e.parentNode || {}).firstChild, e) | |
}, | |
children: function(e) { | |
return _e(e.firstChild) | |
}, | |
contents: function(e) { | |
return fe.nodeName(e, "iframe") ? e.contentDocument || e.contentWindow.document : fe.merge([], e.childNodes) | |
} | |
}, function(e, t) { | |
fe.fn[e] = function(n, i) { | |
var o = fe.map(this, t, n); | |
return "Until" !== e.slice(-5) && (i = n), i && "string" == typeof i && (o = fe.filter(i, o)), this.length > 1 && (Pe[e] || (o = fe.uniqueSort(o)), ke.test(e) && (o = o.reverse())), this.pushStack(o) | |
} | |
}); | |
var Le = /\S+/g; | |
fe.Callbacks = function(e) { | |
e = "string" == typeof e ? s(e) : fe.extend({}, e); | |
var t, n, i, o, a = [], | |
r = [], | |
l = -1, | |
u = function() { | |
for (o = e.once, i = t = !0; r.length; l = -1) | |
for (n = r.shift(); ++l < a.length;) a[l].apply(n[0], n[1]) === !1 && e.stopOnFalse && (l = a.length, n = !1); | |
e.memory || (n = !1), t = !1, o && (a = n ? [] : "") | |
}, | |
c = { | |
add: function() { | |
return a && (n && !t && (l = a.length - 1, r.push(n)), function t(n) { | |
fe.each(n, function(n, i) { | |
fe.isFunction(i) ? e.unique && c.has(i) || a.push(i) : i && i.length && "string" !== fe.type(i) && t(i) | |
}) | |
}(arguments), n && !t && u()), this | |
}, | |
remove: function() { | |
return fe.each(arguments, function(e, t) { | |
for (var n; | |
(n = fe.inArray(t, a, n)) > -1;) a.splice(n, 1), n <= l && l-- | |
}), this | |
}, | |
has: function(e) { | |
return e ? fe.inArray(e, a) > -1 : a.length > 0 | |
}, | |
empty: function() { | |
return a && (a = []), this | |
}, | |
disable: function() { | |
return o = r = [], a = n = "", this | |
}, | |
disabled: function() { | |
return !a | |
}, | |
lock: function() { | |
return o = !0, n || c.disable(), this | |
}, | |
locked: function() { | |
return !!o | |
}, | |
fireWith: function(e, n) { | |
return o || (n = n || [], n = [e, n.slice ? n.slice() : n], r.push(n), t || u()), this | |
}, | |
fire: function() { | |
return c.fireWith(this, arguments), this | |
}, | |
fired: function() { | |
return !!i | |
} | |
}; | |
return c | |
}, fe.extend({ | |
Deferred: function(e) { | |
var t = [ | |
["resolve", "done", fe.Callbacks("once memory"), "resolved"], | |
["reject", "fail", fe.Callbacks("once memory"), "rejected"], | |
["notify", "progress", fe.Callbacks("memory")] | |
], | |
n = "pending", | |
i = { | |
state: function() { | |
return n | |
}, | |
always: function() { | |
return o.done(arguments).fail(arguments), this | |
}, | |
then: function() { | |
var e = arguments; | |
return fe.Deferred(function(n) { | |
fe.each(t, function(t, s) { | |
var a = fe.isFunction(e[t]) && e[t]; | |
o[s[1]](function() { | |
var e = a && a.apply(this, arguments); | |
e && fe.isFunction(e.promise) ? e.promise().progress(n.notify).done(n.resolve).fail(n.reject) : n[s[0] + "With"](this === i ? n.promise() : this, a ? [e] : arguments) | |
}) | |
}), e = null | |
}).promise() | |
}, | |
promise: function(e) { | |
return null != e ? fe.extend(e, i) : i | |
} | |
}, | |
o = {}; | |
return i.pipe = i.then, fe.each(t, function(e, s) { | |
var a = s[2], | |
r = s[3]; | |
i[s[1]] = a.add, r && a.add(function() { | |
n = r | |
}, t[1 ^ e][2].disable, t[2][2].lock), o[s[0]] = function() { | |
return o[s[0] + "With"](this === o ? i : this, arguments), this | |
}, o[s[0] + "With"] = a.fireWith | |
}), i.promise(o), e && e.call(o, o), o | |
}, | |
when: function(e) { | |
var t, n, i, o = 0, | |
s = oe.call(arguments), | |
a = s.length, | |
r = 1 !== a || e && fe.isFunction(e.promise) ? a : 0, | |
l = 1 === r ? e : fe.Deferred(), | |
u = function(e, n, i) { | |
return function(o) { | |
n[e] = this, i[e] = arguments.length > 1 ? oe.call(arguments) : o, i === t ? l.notifyWith(n, i) : --r || l.resolveWith(n, i) | |
} | |
}; | |
if (a > 1) | |
for (t = new Array(a), n = new Array(a), i = new Array(a); o < a; o++) s[o] && fe.isFunction(s[o].promise) ? s[o].promise().progress(u(o, n, t)).done(u(o, i, s)).fail(l.reject) : --r; | |
return r || l.resolveWith(i, s), l.promise() | |
} | |
}); | |
var Ne; | |
fe.fn.ready = function(e) { | |
return fe.ready.promise().done(e), this | |
}, fe.extend({ | |
isReady: !1, | |
readyWait: 1, | |
holdReady: function(e) { | |
e ? fe.readyWait++ : fe.ready(!0) | |
}, | |
ready: function(e) { | |
(e === !0 ? --fe.readyWait : fe.isReady) || (fe.isReady = !0, e !== !0 && --fe.readyWait > 0 || (Ne.resolveWith(ie, [fe]), fe.fn.triggerHandler && (fe(ie).triggerHandler("ready"), fe(ie).off("ready")))) | |
} | |
}), fe.ready.promise = function(t) { | |
if (!Ne) | |
if (Ne = fe.Deferred(), "complete" === ie.readyState || "loading" !== ie.readyState && !ie.documentElement.doScroll) e.setTimeout(fe.ready); | |
else if (ie.addEventListener) ie.addEventListener("DOMContentLoaded", r), e.addEventListener("load", r); | |
else { | |
ie.attachEvent("onreadystatechange", r), e.attachEvent("onload", r); | |
var n = !1; | |
try { | |
n = null == e.frameElement && ie.documentElement | |
} catch (e) {} | |
n && n.doScroll && ! function t() { | |
if (!fe.isReady) { | |
try { | |
n.doScroll("left") | |
} catch (n) { | |
return e.setTimeout(t, 50) | |
} | |
a(), fe.ready() | |
} | |
}() | |
} | |
return Ne.promise(t) | |
}, fe.ready.promise(); | |
var Fe; | |
for (Fe in fe(de)) break; | |
de.ownFirst = "0" === Fe, de.inlineBlockNeedsLayout = !1, fe(function() { | |
var e, t, n, i; | |
n = ie.getElementsByTagName("body")[0], n && n.style && (t = ie.createElement("div"), i = ie.createElement("div"), i.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px", n.appendChild(i).appendChild(t), "undefined" != typeof t.style.zoom && (t.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1", de.inlineBlockNeedsLayout = e = 3 === t.offsetWidth, e && (n.style.zoom = 1)), n.removeChild(i)) | |
}), | |
function() { | |
var e = ie.createElement("div"); | |
de.deleteExpando = !0; | |
try { | |
delete e.test | |
} catch (e) { | |
de.deleteExpando = !1 | |
} | |
e = null | |
}(); | |
var Ie = function(e) { | |
var t = fe.noData[(e.nodeName + " ").toLowerCase()], | |
n = +e.nodeType || 1; | |
return (1 === n || 9 === n) && (!t || t !== !0 && e.getAttribute("classid") === t) | |
}, | |
Ee = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, | |
Oe = /([A-Z])/g; | |
fe.extend({ | |
cache: {}, | |
noData: { | |
"applet ": !0, | |
"embed ": !0, | |
"object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" | |
}, | |
hasData: function(e) { | |
return e = e.nodeType ? fe.cache[e[fe.expando]] : e[fe.expando], !!e && !u(e) | |
}, | |
data: function(e, t, n) { | |
return c(e, t, n) | |
}, | |
removeData: function(e, t) { | |
return d(e, t) | |
}, | |
_data: function(e, t, n) { | |
return c(e, t, n, !0) | |
}, | |
_removeData: function(e, t) { | |
return d(e, t, !0) | |
} | |
}), fe.fn.extend({ | |
data: function(e, t) { | |
var n, i, o, s = this[0], | |
a = s && s.attributes; | |
if (void 0 === e) { | |
if (this.length && (o = fe.data(s), 1 === s.nodeType && !fe._data(s, "parsedAttrs"))) { | |
for (n = a.length; n--;) a[n] && (i = a[n].name, 0 === i.indexOf("data-") && (i = fe.camelCase(i.slice(5)), l(s, i, o[i]))); | |
fe._data(s, "parsedAttrs", !0) | |
} | |
return o | |
} | |
return "object" == typeof e ? this.each(function() { | |
fe.data(this, e) | |
}) : arguments.length > 1 ? this.each(function() { | |
fe.data(this, e, t) | |
}) : s ? l(s, e, fe.data(s, e)) : void 0 | |
}, | |
removeData: function(e) { | |
return this.each(function() { | |
fe.removeData(this, e) | |
}) | |
} | |
}), fe.extend({ | |
queue: function(e, t, n) { | |
var i; | |
if (e) return t = (t || "fx") + "queue", i = fe._data(e, t), n && (!i || fe.isArray(n) ? i = fe._data(e, t, fe.makeArray(n)) : i.push(n)), i || [] | |
}, | |
dequeue: function(e, t) { | |
t = t || "fx"; | |
var n = fe.queue(e, t), | |
i = n.length, | |
o = n.shift(), | |
s = fe._queueHooks(e, t), | |
a = function() { | |
fe.dequeue(e, t) | |
}; | |
"inprogress" === o && (o = n.shift(), i--), o && ("fx" === t && n.unshift("inprogress"), delete s.stop, o.call(e, a, s)), !i && s && s.empty.fire() | |
}, | |
_queueHooks: function(e, t) { | |
var n = t + "queueHooks"; | |
return fe._data(e, n) || fe._data(e, n, { | |
empty: fe.Callbacks("once memory").add(function() { | |
fe._removeData(e, t + "queue"), fe._removeData(e, n) | |
}) | |
}) | |
} | |
}), fe.fn.extend({ | |
queue: function(e, t) { | |
var n = 2; | |
return "string" != typeof e && (t = e, e = "fx", n--), arguments.length < n ? fe.queue(this[0], e) : void 0 === t ? this : this.each(function() { | |
var n = fe.queue(this, e, t); | |
fe._queueHooks(this, e), "fx" === e && "inprogress" !== n[0] && fe.dequeue(this, e) | |
}) | |
}, | |
dequeue: function(e) { | |
return this.each(function() { | |
fe.dequeue(this, e) | |
}) | |
}, | |
clearQueue: function(e) { | |
return this.queue(e || "fx", []) | |
}, | |
promise: function(e, t) { | |
var n, i = 1, | |
o = fe.Deferred(), | |
s = this, | |
a = this.length, | |
r = function() { | |
--i || o.resolveWith(s, [s]) | |
}; | |
for ("string" != typeof e && (t = e, e = void 0), e = e || "fx"; a--;) n = fe._data(s[a], e + "queueHooks"), n && n.empty && (i++, n.empty.add(r)); | |
return r(), o.promise(t) | |
} | |
}), | |
function() { | |
var e; | |
de.shrinkWrapBlocks = function() { | |
if (null != e) return e; | |
e = !1; | |
var t, n, i; | |
return n = ie.getElementsByTagName("body")[0], n && n.style ? (t = ie.createElement("div"), i = ie.createElement("div"), i.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px", n.appendChild(i).appendChild(t), "undefined" != typeof t.style.zoom && (t.style.cssText = "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:1px;width:1px;zoom:1", t.appendChild(ie.createElement("div")).style.width = "5px", e = 3 !== t.offsetWidth), n.removeChild(i), e) : void 0 | |
} | |
}(); | |
var De = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, | |
Ae = new RegExp("^(?:([+-])=|)(" + De + ")([a-z%]*)$", "i"), | |
Me = ["Top", "Right", "Bottom", "Left"], | |
Be = function(e, t) { | |
return e = t || e, "none" === fe.css(e, "display") || !fe.contains(e.ownerDocument, e) | |
}, | |
Ue = function(e, t, n, i, o, s, a) { | |
var r = 0, | |
l = e.length, | |
u = null == n; | |
if ("object" === fe.type(n)) { | |
o = !0; | |
for (r in n) Ue(e, t, r, n[r], !0, s, a) | |
} else if (void 0 !== i && (o = !0, fe.isFunction(i) || (a = !0), u && (a ? (t.call(e, i), t = null) : (u = t, t = function(e, t, n) { | |
return u.call(fe(e), n) | |
})), t)) | |
for (; r < l; r++) t(e[r], n, a ? i : i.call(e[r], r, t(e[r], n))); | |
return o ? e : u ? t.call(e) : l ? t(e[0], n) : s | |
}, | |
He = /^(?:checkbox|radio)$/i, | |
Re = /<([\w:-]+)/, | |
je = /^$|\/(?:java|ecma)script/i, | |
Ve = /^\s+/, | |
qe = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|dialog|figcaption|figure|footer|header|hgroup|main|mark|meter|nav|output|picture|progress|section|summary|template|time|video"; | |
! function() { | |
var e = ie.createElement("div"), | |
t = ie.createDocumentFragment(), | |
n = ie.createElement("input"); | |
e.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>", de.leadingWhitespace = 3 === e.firstChild.nodeType, de.tbody = !e.getElementsByTagName("tbody").length, de.htmlSerialize = !!e.getElementsByTagName("link").length, de.html5Clone = "<:nav></:nav>" !== ie.createElement("nav").cloneNode(!0).outerHTML, n.type = "checkbox", n.checked = !0, t.appendChild(n), de.appendChecked = n.checked, e.innerHTML = "<textarea>x</textarea>", de.noCloneChecked = !!e.cloneNode(!0).lastChild.defaultValue, t.appendChild(e), n = ie.createElement("input"), n.setAttribute("type", "radio"), n.setAttribute("checked", "checked"), n.setAttribute("name", "t"), e.appendChild(n), de.checkClone = e.cloneNode(!0).cloneNode(!0).lastChild.checked, de.noCloneEvent = !!e.addEventListener, e[fe.expando] = 1, de.attributes = !e.getAttribute(fe.expando) | |
}(); | |
var ze = { | |
option: [1, "<select multiple='multiple'>", "</select>"], | |
legend: [1, "<fieldset>", "</fieldset>"], | |
area: [1, "<map>", "</map>"], | |
param: [1, "<object>", "</object>"], | |
thead: [1, "<table>", "</table>"], | |
tr: [2, "<table><tbody>", "</tbody></table>"], | |
col: [2, "<table><tbody></tbody><colgroup>", "</colgroup></table>"], | |
td: [3, "<table><tbody><tr>", "</tr></tbody></table>"], | |
_default: de.htmlSerialize ? [0, "", ""] : [1, "X<div>", "</div>"] | |
}; | |
ze.optgroup = ze.option, ze.tbody = ze.tfoot = ze.colgroup = ze.caption = ze.thead, ze.th = ze.td; | |
var We = /<|&#?\w+;/, | |
Ge = /<tbody/i; | |
! function() { | |
var t, n, i = ie.createElement("div"); | |
for (t in { | |
submit: !0, | |
change: !0, | |
focusin: !0 | |
}) n = "on" + t, (de[t] = n in e) || (i.setAttribute(n, "t"), de[t] = i.attributes[n].expando === !1); | |
i = null | |
}(); | |
var Xe = /^(?:input|select|textarea)$/i, | |
Ye = /^key/, | |
Qe = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, | |
Je = /^(?:focusinfocus|focusoutblur)$/, | |
Ke = /^([^.]*)(?:\.(.+)|)/; | |
fe.event = { | |
global: {}, | |
add: function(e, t, n, i, o) { | |
var s, a, r, l, u, c, d, p, f, h, g, m = fe._data(e); | |
if (m) { | |
for (n.handler && (l = n, n = l.handler, o = l.selector), n.guid || (n.guid = fe.guid++), (a = m.events) || (a = m.events = {}), (c = m.handle) || (c = m.handle = function(e) { | |
return "undefined" == typeof fe || e && fe.event.triggered === e.type ? void 0 : fe.event.dispatch.apply(c.elem, arguments) | |
}, c.elem = e), t = (t || "").match(Le) || [""], r = t.length; r--;) s = Ke.exec(t[r]) || [], f = g = s[1], h = (s[2] || "").split(".").sort(), f && (u = fe.event.special[f] || {}, f = (o ? u.delegateType : u.bindType) || f, u = fe.event.special[f] || {}, d = fe.extend({ | |
type: f, | |
origType: g, | |
data: i, | |
handler: n, | |
guid: n.guid, | |
selector: o, | |
needsContext: o && fe.expr.match.needsContext.test(o), | |
namespace: h.join(".") | |
}, l), (p = a[f]) || (p = a[f] = [], p.delegateCount = 0, u.setup && u.setup.call(e, i, h, c) !== !1 || (e.addEventListener ? e.addEventListener(f, c, !1) : e.attachEvent && e.attachEvent("on" + f, c))), u.add && (u.add.call(e, d), d.handler.guid || (d.handler.guid = n.guid)), o ? p.splice(p.delegateCount++, 0, d) : p.push(d), fe.event.global[f] = !0); | |
e = null | |
} | |
}, | |
remove: function(e, t, n, i, o) { | |
var s, a, r, l, u, c, d, p, f, h, g, m = fe.hasData(e) && fe._data(e); | |
if (m && (c = m.events)) { | |
for (t = (t || "").match(Le) || [""], u = t.length; u--;) | |
if (r = Ke.exec(t[u]) || [], f = g = r[1], h = (r[2] || "").split(".").sort(), f) { | |
for (d = fe.event.special[f] || {}, f = (i ? d.delegateType : d.bindType) || f, p = c[f] || [], r = r[2] && new RegExp("(^|\\.)" + h.join("\\.(?:.*\\.|)") + "(\\.|$)"), l = s = p.length; s--;) a = p[s], !o && g !== a.origType || n && n.guid !== a.guid || r && !r.test(a.namespace) || i && i !== a.selector && ("**" !== i || !a.selector) || (p.splice(s, 1), a.selector && p.delegateCount--, d.remove && d.remove.call(e, a)); | |
l && !p.length && (d.teardown && d.teardown.call(e, h, m.handle) !== !1 || fe.removeEvent(e, f, m.handle), delete c[f]) | |
} else | |
for (f in c) fe.event.remove(e, f + t[u], n, i, !0); | |
fe.isEmptyObject(c) && (delete m.handle, fe._removeData(e, "events")) | |
} | |
}, | |
trigger: function(t, n, i, o) { | |
var s, a, r, l, u, c, d, p = [i || ie], | |
f = ce.call(t, "type") ? t.type : t, | |
h = ce.call(t, "namespace") ? t.namespace.split(".") : []; | |
if (r = c = i = i || ie, 3 !== i.nodeType && 8 !== i.nodeType && !Je.test(f + fe.event.triggered) && (f.indexOf(".") > -1 && (h = f.split("."), f = h.shift(), h.sort()), a = f.indexOf(":") < 0 && "on" + f, t = t[fe.expando] ? t : new fe.Event(f, "object" == typeof t && t), t.isTrigger = o ? 2 : 3, t.namespace = h.join("."), t.rnamespace = t.namespace ? new RegExp("(^|\\.)" + h.join("\\.(?:.*\\.|)") + "(\\.|$)") : null, t.result = void 0, t.target || (t.target = i), n = null == n ? [t] : fe.makeArray(n, [t]), u = fe.event.special[f] || {}, o || !u.trigger || u.trigger.apply(i, n) !== !1)) { | |
if (!o && !u.noBubble && !fe.isWindow(i)) { | |
for (l = u.delegateType || f, Je.test(l + f) || (r = r.parentNode); r; r = r.parentNode) p.push(r), c = r; | |
c === (i.ownerDocument || ie) && p.push(c.defaultView || c.parentWindow || e) | |
} | |
for (d = 0; | |
(r = p[d++]) && !t.isPropagationStopped();) t.type = d > 1 ? l : u.bindType || f, s = (fe._data(r, "events") || {})[t.type] && fe._data(r, "handle"), s && s.apply(r, n), s = a && r[a], s && s.apply && Ie(r) && (t.result = s.apply(r, n), t.result === !1 && t.preventDefault()); | |
if (t.type = f, !o && !t.isDefaultPrevented() && (!u._default || u._default.apply(p.pop(), n) === !1) && Ie(i) && a && i[f] && !fe.isWindow(i)) { | |
c = i[a], c && (i[a] = null), fe.event.triggered = f; | |
try { | |
i[f]() | |
} catch (e) {} | |
fe.event.triggered = void 0, c && (i[a] = c) | |
} | |
return t.result | |
} | |
}, | |
dispatch: function(e) { | |
e = fe.event.fix(e); | |
var t, n, i, o, s, a = [], | |
r = oe.call(arguments), | |
l = (fe._data(this, "events") || {})[e.type] || [], | |
u = fe.event.special[e.type] || {}; | |
if (r[0] = e, e.delegateTarget = this, !u.preDispatch || u.preDispatch.call(this, e) !== !1) { | |
for (a = fe.event.handlers.call(this, e, l), t = 0; | |
(o = a[t++]) && !e.isPropagationStopped();) | |
for (e.currentTarget = o.elem, n = 0; | |
(s = o.handlers[n++]) && !e.isImmediatePropagationStopped();) e.rnamespace && !e.rnamespace.test(s.namespace) || (e.handleObj = s, | |
e.data = s.data, i = ((fe.event.special[s.origType] || {}).handle || s.handler).apply(o.elem, r), void 0 !== i && (e.result = i) === !1 && (e.preventDefault(), e.stopPropagation())); | |
return u.postDispatch && u.postDispatch.call(this, e), e.result | |
} | |
}, | |
handlers: function(e, t) { | |
var n, i, o, s, a = [], | |
r = t.delegateCount, | |
l = e.target; | |
if (r && l.nodeType && ("click" !== e.type || isNaN(e.button) || e.button < 1)) | |
for (; l != this; l = l.parentNode || this) | |
if (1 === l.nodeType && (l.disabled !== !0 || "click" !== e.type)) { | |
for (i = [], n = 0; n < r; n++) s = t[n], o = s.selector + " ", void 0 === i[o] && (i[o] = s.needsContext ? fe(o, this).index(l) > -1 : fe.find(o, this, null, [l]).length), i[o] && i.push(s); | |
i.length && a.push({ | |
elem: l, | |
handlers: i | |
}) | |
} | |
return r < t.length && a.push({ | |
elem: this, | |
handlers: t.slice(r) | |
}), a | |
}, | |
fix: function(e) { | |
if (e[fe.expando]) return e; | |
var t, n, i, o = e.type, | |
s = e, | |
a = this.fixHooks[o]; | |
for (a || (this.fixHooks[o] = a = Qe.test(o) ? this.mouseHooks : Ye.test(o) ? this.keyHooks : {}), i = a.props ? this.props.concat(a.props) : this.props, e = new fe.Event(s), t = i.length; t--;) n = i[t], e[n] = s[n]; | |
return e.target || (e.target = s.srcElement || ie), 3 === e.target.nodeType && (e.target = e.target.parentNode), e.metaKey = !!e.metaKey, a.filter ? a.filter(e, s) : e | |
}, | |
props: "altKey bubbles cancelable ctrlKey currentTarget detail eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), | |
fixHooks: {}, | |
keyHooks: { | |
props: "char charCode key keyCode".split(" "), | |
filter: function(e, t) { | |
return null == e.which && (e.which = null != t.charCode ? t.charCode : t.keyCode), e | |
} | |
}, | |
mouseHooks: { | |
props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), | |
filter: function(e, t) { | |
var n, i, o, s = t.button, | |
a = t.fromElement; | |
return null == e.pageX && null != t.clientX && (i = e.target.ownerDocument || ie, o = i.documentElement, n = i.body, e.pageX = t.clientX + (o && o.scrollLeft || n && n.scrollLeft || 0) - (o && o.clientLeft || n && n.clientLeft || 0), e.pageY = t.clientY + (o && o.scrollTop || n && n.scrollTop || 0) - (o && o.clientTop || n && n.clientTop || 0)), !e.relatedTarget && a && (e.relatedTarget = a === e.target ? t.toElement : a), e.which || void 0 === s || (e.which = 1 & s ? 1 : 2 & s ? 3 : 4 & s ? 2 : 0), e | |
} | |
}, | |
special: { | |
load: { | |
noBubble: !0 | |
}, | |
focus: { | |
trigger: function() { | |
if (this !== _() && this.focus) try { | |
return this.focus(), !1 | |
} catch (e) {} | |
}, | |
delegateType: "focusin" | |
}, | |
blur: { | |
trigger: function() { | |
if (this === _() && this.blur) return this.blur(), !1 | |
}, | |
delegateType: "focusout" | |
}, | |
click: { | |
trigger: function() { | |
if (fe.nodeName(this, "input") && "checkbox" === this.type && this.click) return this.click(), !1 | |
}, | |
_default: function(e) { | |
return fe.nodeName(e.target, "a") | |
} | |
}, | |
beforeunload: { | |
postDispatch: function(e) { | |
void 0 !== e.result && e.originalEvent && (e.originalEvent.returnValue = e.result) | |
} | |
} | |
}, | |
simulate: function(e, t, n) { | |
var i = fe.extend(new fe.Event, n, { | |
type: e, | |
isSimulated: !0 | |
}); | |
fe.event.trigger(i, null, t), i.isDefaultPrevented() && n.preventDefault() | |
} | |
}, fe.removeEvent = ie.removeEventListener ? function(e, t, n) { | |
e.removeEventListener && e.removeEventListener(t, n) | |
} : function(e, t, n) { | |
var i = "on" + t; | |
e.detachEvent && ("undefined" == typeof e[i] && (e[i] = null), e.detachEvent(i, n)) | |
}, fe.Event = function(e, t) { | |
return this instanceof fe.Event ? (e && e.type ? (this.originalEvent = e, this.type = e.type, this.isDefaultPrevented = e.defaultPrevented || void 0 === e.defaultPrevented && e.returnValue === !1 ? b : y) : this.type = e, t && fe.extend(this, t), this.timeStamp = e && e.timeStamp || fe.now(), void(this[fe.expando] = !0)) : new fe.Event(e, t) | |
}, fe.Event.prototype = { | |
constructor: fe.Event, | |
isDefaultPrevented: y, | |
isPropagationStopped: y, | |
isImmediatePropagationStopped: y, | |
preventDefault: function() { | |
var e = this.originalEvent; | |
this.isDefaultPrevented = b, e && (e.preventDefault ? e.preventDefault() : e.returnValue = !1) | |
}, | |
stopPropagation: function() { | |
var e = this.originalEvent; | |
this.isPropagationStopped = b, e && !this.isSimulated && (e.stopPropagation && e.stopPropagation(), e.cancelBubble = !0) | |
}, | |
stopImmediatePropagation: function() { | |
var e = this.originalEvent; | |
this.isImmediatePropagationStopped = b, e && e.stopImmediatePropagation && e.stopImmediatePropagation(), this.stopPropagation() | |
} | |
}, fe.each({ | |
mouseenter: "mouseover", | |
mouseleave: "mouseout", | |
pointerenter: "pointerover", | |
pointerleave: "pointerout" | |
}, function(e, t) { | |
fe.event.special[e] = { | |
delegateType: t, | |
bindType: t, | |
handle: function(e) { | |
var n, i = this, | |
o = e.relatedTarget, | |
s = e.handleObj; | |
return o && (o === i || fe.contains(i, o)) || (e.type = s.origType, n = s.handler.apply(this, arguments), e.type = t), n | |
} | |
} | |
}), de.submit || (fe.event.special.submit = { | |
setup: function() { | |
return !fe.nodeName(this, "form") && void fe.event.add(this, "click._submit keypress._submit", function(e) { | |
var t = e.target, | |
n = fe.nodeName(t, "input") || fe.nodeName(t, "button") ? fe.prop(t, "form") : void 0; | |
n && !fe._data(n, "submit") && (fe.event.add(n, "submit._submit", function(e) { | |
e._submitBubble = !0 | |
}), fe._data(n, "submit", !0)) | |
}) | |
}, | |
postDispatch: function(e) { | |
e._submitBubble && (delete e._submitBubble, this.parentNode && !e.isTrigger && fe.event.simulate("submit", this.parentNode, e)) | |
}, | |
teardown: function() { | |
return !fe.nodeName(this, "form") && void fe.event.remove(this, "._submit") | |
} | |
}), de.change || (fe.event.special.change = { | |
setup: function() { | |
return Xe.test(this.nodeName) ? ("checkbox" !== this.type && "radio" !== this.type || (fe.event.add(this, "propertychange._change", function(e) { | |
"checked" === e.originalEvent.propertyName && (this._justChanged = !0) | |
}), fe.event.add(this, "click._change", function(e) { | |
this._justChanged && !e.isTrigger && (this._justChanged = !1), fe.event.simulate("change", this, e) | |
})), !1) : void fe.event.add(this, "beforeactivate._change", function(e) { | |
var t = e.target; | |
Xe.test(t.nodeName) && !fe._data(t, "change") && (fe.event.add(t, "change._change", function(e) { | |
!this.parentNode || e.isSimulated || e.isTrigger || fe.event.simulate("change", this.parentNode, e) | |
}), fe._data(t, "change", !0)) | |
}) | |
}, | |
handle: function(e) { | |
var t = e.target; | |
if (this !== t || e.isSimulated || e.isTrigger || "radio" !== t.type && "checkbox" !== t.type) return e.handleObj.handler.apply(this, arguments) | |
}, | |
teardown: function() { | |
return fe.event.remove(this, "._change"), !Xe.test(this.nodeName) | |
} | |
}), de.focusin || fe.each({ | |
focus: "focusin", | |
blur: "focusout" | |
}, function(e, t) { | |
var n = function(e) { | |
fe.event.simulate(t, e.target, fe.event.fix(e)) | |
}; | |
fe.event.special[t] = { | |
setup: function() { | |
var i = this.ownerDocument || this, | |
o = fe._data(i, t); | |
o || i.addEventListener(e, n, !0), fe._data(i, t, (o || 0) + 1) | |
}, | |
teardown: function() { | |
var i = this.ownerDocument || this, | |
o = fe._data(i, t) - 1; | |
o ? fe._data(i, t, o) : (i.removeEventListener(e, n, !0), fe._removeData(i, t)) | |
} | |
} | |
}), fe.fn.extend({ | |
on: function(e, t, n, i) { | |
return w(this, e, t, n, i) | |
}, | |
one: function(e, t, n, i) { | |
return w(this, e, t, n, i, 1) | |
}, | |
off: function(e, t, n) { | |
var i, o; | |
if (e && e.preventDefault && e.handleObj) return i = e.handleObj, fe(e.delegateTarget).off(i.namespace ? i.origType + "." + i.namespace : i.origType, i.selector, i.handler), this; | |
if ("object" == typeof e) { | |
for (o in e) this.off(o, t, e[o]); | |
return this | |
} | |
return t !== !1 && "function" != typeof t || (n = t, t = void 0), n === !1 && (n = y), this.each(function() { | |
fe.event.remove(this, e, n, t) | |
}) | |
}, | |
trigger: function(e, t) { | |
return this.each(function() { | |
fe.event.trigger(e, t, this) | |
}) | |
}, | |
triggerHandler: function(e, t) { | |
var n = this[0]; | |
if (n) return fe.event.trigger(e, t, n, !0) | |
} | |
}); | |
var Ze = / jQuery\d+="(?:null|\d+)"/g, | |
et = new RegExp("<(?:" + qe + ")[\\s/>]", "i"), | |
tt = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi, | |
nt = /<script|<style|<link/i, | |
it = /checked\s*(?:[^=]|=\s*.checked.)/i, | |
ot = /^true\/(.*)/, | |
st = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g, | |
at = f(ie), | |
rt = at.appendChild(ie.createElement("div")); | |
fe.extend({ | |
htmlPrefilter: function(e) { | |
return e.replace(tt, "<$1></$2>") | |
}, | |
clone: function(e, t, n) { | |
var i, o, s, a, r, l = fe.contains(e.ownerDocument, e); | |
if (de.html5Clone || fe.isXMLDoc(e) || !et.test("<" + e.nodeName + ">") ? s = e.cloneNode(!0) : (rt.innerHTML = e.outerHTML, rt.removeChild(s = rt.firstChild)), !(de.noCloneEvent && de.noCloneChecked || 1 !== e.nodeType && 11 !== e.nodeType || fe.isXMLDoc(e))) | |
for (i = h(s), r = h(e), a = 0; null != (o = r[a]); ++a) i[a] && $(o, i[a]); | |
if (t) | |
if (n) | |
for (r = r || h(e), i = i || h(s), a = 0; null != (o = r[a]); a++) C(o, i[a]); | |
else C(e, s); | |
return i = h(s, "script"), i.length > 0 && g(i, !l && h(e, "script")), i = r = o = null, s | |
}, | |
cleanData: function(e, t) { | |
for (var n, i, o, s, a = 0, r = fe.expando, l = fe.cache, u = de.attributes, c = fe.event.special; null != (n = e[a]); a++) | |
if ((t || Ie(n)) && (o = n[r], s = o && l[o])) { | |
if (s.events) | |
for (i in s.events) c[i] ? fe.event.remove(n, i) : fe.removeEvent(n, i, s.handle); | |
l[o] && (delete l[o], u || "undefined" == typeof n.removeAttribute ? n[r] = void 0 : n.removeAttribute(r), ne.push(o)) | |
} | |
} | |
}), fe.fn.extend({ | |
domManip: k, | |
detach: function(e) { | |
return P(this, e, !0) | |
}, | |
remove: function(e) { | |
return P(this, e) | |
}, | |
text: function(e) { | |
return Ue(this, function(e) { | |
return void 0 === e ? fe.text(this) : this.empty().append((this[0] && this[0].ownerDocument || ie).createTextNode(e)) | |
}, null, e, arguments.length) | |
}, | |
append: function() { | |
return k(this, arguments, function(e) { | |
if (1 === this.nodeType || 11 === this.nodeType || 9 === this.nodeType) { | |
var t = x(this, e); | |
t.appendChild(e) | |
} | |
}) | |
}, | |
prepend: function() { | |
return k(this, arguments, function(e) { | |
if (1 === this.nodeType || 11 === this.nodeType || 9 === this.nodeType) { | |
var t = x(this, e); | |
t.insertBefore(e, t.firstChild) | |
} | |
}) | |
}, | |
before: function() { | |
return k(this, arguments, function(e) { | |
this.parentNode && this.parentNode.insertBefore(e, this) | |
}) | |
}, | |
after: function() { | |
return k(this, arguments, function(e) { | |
this.parentNode && this.parentNode.insertBefore(e, this.nextSibling) | |
}) | |
}, | |
empty: function() { | |
for (var e, t = 0; null != (e = this[t]); t++) { | |
for (1 === e.nodeType && fe.cleanData(h(e, !1)); e.firstChild;) e.removeChild(e.firstChild); | |
e.options && fe.nodeName(e, "select") && (e.options.length = 0) | |
} | |
return this | |
}, | |
clone: function(e, t) { | |
return e = null != e && e, t = null == t ? e : t, this.map(function() { | |
return fe.clone(this, e, t) | |
}) | |
}, | |
html: function(e) { | |
return Ue(this, function(e) { | |
var t = this[0] || {}, | |
n = 0, | |
i = this.length; | |
if (void 0 === e) return 1 === t.nodeType ? t.innerHTML.replace(Ze, "") : void 0; | |
if ("string" == typeof e && !nt.test(e) && (de.htmlSerialize || !et.test(e)) && (de.leadingWhitespace || !Ve.test(e)) && !ze[(Re.exec(e) || ["", ""])[1].toLowerCase()]) { | |
e = fe.htmlPrefilter(e); | |
try { | |
for (; n < i; n++) t = this[n] || {}, 1 === t.nodeType && (fe.cleanData(h(t, !1)), t.innerHTML = e); | |
t = 0 | |
} catch (e) {} | |
} | |
t && this.empty().append(e) | |
}, null, e, arguments.length) | |
}, | |
replaceWith: function() { | |
var e = []; | |
return k(this, arguments, function(t) { | |
var n = this.parentNode; | |
fe.inArray(this, e) < 0 && (fe.cleanData(h(this)), n && n.replaceChild(t, this)) | |
}, e) | |
} | |
}), fe.each({ | |
appendTo: "append", | |
prependTo: "prepend", | |
insertBefore: "before", | |
insertAfter: "after", | |
replaceAll: "replaceWith" | |
}, function(e, t) { | |
fe.fn[e] = function(e) { | |
for (var n, i = 0, o = [], s = fe(e), a = s.length - 1; i <= a; i++) n = i === a ? this : this.clone(!0), fe(s[i])[t](n), ae.apply(o, n.get()); | |
return this.pushStack(o) | |
} | |
}); | |
var lt, ut = { | |
HTML: "block", | |
BODY: "block" | |
}, | |
ct = /^margin/, | |
dt = new RegExp("^(" + De + ")(?!px)[a-z%]+$", "i"), | |
pt = function(e, t, n, i) { | |
var o, s, a = {}; | |
for (s in t) a[s] = e.style[s], e.style[s] = t[s]; | |
o = n.apply(e, i || []); | |
for (s in t) e.style[s] = a[s]; | |
return o | |
}, | |
ft = ie.documentElement; | |
! function() { | |
function t() { | |
var t, c, d = ie.documentElement; | |
d.appendChild(l), u.style.cssText = "-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;display:block;margin:auto;border:1px;padding:1px;top:1%;width:50%", n = o = r = !1, i = a = !0, e.getComputedStyle && (c = e.getComputedStyle(u), n = "1%" !== (c || {}).top, r = "2px" === (c || {}).marginLeft, o = "4px" === (c || { | |
width: "4px" | |
}).width, u.style.marginRight = "50%", i = "4px" === (c || { | |
marginRight: "4px" | |
}).marginRight, t = u.appendChild(ie.createElement("div")), t.style.cssText = u.style.cssText = "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0", t.style.marginRight = t.style.width = "0", u.style.width = "1px", a = !parseFloat((e.getComputedStyle(t) || {}).marginRight), u.removeChild(t)), u.style.display = "none", s = 0 === u.getClientRects().length, s && (u.style.display = "", u.innerHTML = "<table><tr><td></td><td>t</td></tr></table>", u.childNodes[0].style.borderCollapse = "separate", t = u.getElementsByTagName("td"), t[0].style.cssText = "margin:0;border:0;padding:0;display:none", s = 0 === t[0].offsetHeight, s && (t[0].style.display = "", t[1].style.display = "none", s = 0 === t[0].offsetHeight)), d.removeChild(l) | |
} | |
var n, i, o, s, a, r, l = ie.createElement("div"), | |
u = ie.createElement("div"); | |
u.style && (u.style.cssText = "float:left;opacity:.5", de.opacity = "0.5" === u.style.opacity, de.cssFloat = !!u.style.cssFloat, u.style.backgroundClip = "content-box", u.cloneNode(!0).style.backgroundClip = "", de.clearCloneStyle = "content-box" === u.style.backgroundClip, l = ie.createElement("div"), l.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;padding:0;margin-top:1px;position:absolute", u.innerHTML = "", l.appendChild(u), de.boxSizing = "" === u.style.boxSizing || "" === u.style.MozBoxSizing || "" === u.style.WebkitBoxSizing, fe.extend(de, { | |
reliableHiddenOffsets: function() { | |
return null == n && t(), s | |
}, | |
boxSizingReliable: function() { | |
return null == n && t(), o | |
}, | |
pixelMarginRight: function() { | |
return null == n && t(), i | |
}, | |
pixelPosition: function() { | |
return null == n && t(), n | |
}, | |
reliableMarginRight: function() { | |
return null == n && t(), a | |
}, | |
reliableMarginLeft: function() { | |
return null == n && t(), r | |
} | |
})) | |
}(); | |
var ht, gt, mt = /^(top|right|bottom|left)$/; | |
e.getComputedStyle ? (ht = function(t) { | |
var n = t.ownerDocument.defaultView; | |
return n && n.opener || (n = e), n.getComputedStyle(t) | |
}, gt = function(e, t, n) { | |
var i, o, s, a, r = e.style; | |
return n = n || ht(e), a = n ? n.getPropertyValue(t) || n[t] : void 0, "" !== a && void 0 !== a || fe.contains(e.ownerDocument, e) || (a = fe.style(e, t)), n && !de.pixelMarginRight() && dt.test(a) && ct.test(t) && (i = r.width, o = r.minWidth, s = r.maxWidth, r.minWidth = r.maxWidth = r.width = a, a = n.width, r.width = i, r.minWidth = o, r.maxWidth = s), void 0 === a ? a : a + "" | |
}) : ft.currentStyle && (ht = function(e) { | |
return e.currentStyle | |
}, gt = function(e, t, n) { | |
var i, o, s, a, r = e.style; | |
return n = n || ht(e), a = n ? n[t] : void 0, null == a && r && r[t] && (a = r[t]), dt.test(a) && !mt.test(t) && (i = r.left, o = e.runtimeStyle, s = o && o.left, s && (o.left = e.currentStyle.left), r.left = "fontSize" === t ? "1em" : a, a = r.pixelLeft + "px", r.left = i, s && (o.left = s)), void 0 === a ? a : a + "" || "auto" | |
}); | |
var vt = /alpha\([^)]*\)/i, | |
bt = /opacity\s*=\s*([^)]*)/i, | |
yt = /^(none|table(?!-c[ea]).+)/, | |
_t = new RegExp("^(" + De + ")(.*)$", "i"), | |
wt = { | |
position: "absolute", | |
visibility: "hidden", | |
display: "block" | |
}, | |
xt = { | |
letterSpacing: "0", | |
fontWeight: "400" | |
}, | |
Tt = ["Webkit", "O", "Moz", "ms"], | |
St = ie.createElement("div").style; | |
fe.extend({ | |
cssHooks: { | |
opacity: { | |
get: function(e, t) { | |
if (t) { | |
var n = gt(e, "opacity"); | |
return "" === n ? "1" : n | |
} | |
} | |
} | |
}, | |
cssNumber: { | |
animationIterationCount: !0, | |
columnCount: !0, | |
fillOpacity: !0, | |
flexGrow: !0, | |
flexShrink: !0, | |
fontWeight: !0, | |
lineHeight: !0, | |
opacity: !0, | |
order: !0, | |
orphans: !0, | |
widows: !0, | |
zIndex: !0, | |
zoom: !0 | |
}, | |
cssProps: { | |
"float": de.cssFloat ? "cssFloat" : "styleFloat" | |
}, | |
style: function(e, t, n, i) { | |
if (e && 3 !== e.nodeType && 8 !== e.nodeType && e.style) { | |
var o, s, a, r = fe.camelCase(t), | |
l = e.style; | |
if (t = fe.cssProps[r] || (fe.cssProps[r] = I(r) || r), a = fe.cssHooks[t] || fe.cssHooks[r], void 0 === n) return a && "get" in a && void 0 !== (o = a.get(e, !1, i)) ? o : l[t]; | |
if (s = typeof n, "string" === s && (o = Ae.exec(n)) && o[1] && (n = p(e, t, o), s = "number"), null != n && n === n && ("number" === s && (n += o && o[3] || (fe.cssNumber[r] ? "" : "px")), de.clearCloneStyle || "" !== n || 0 !== t.indexOf("background") || (l[t] = "inherit"), !(a && "set" in a && void 0 === (n = a.set(e, n, i))))) try { | |
l[t] = n | |
} catch (e) {} | |
} | |
}, | |
css: function(e, t, n, i) { | |
var o, s, a, r = fe.camelCase(t); | |
return t = fe.cssProps[r] || (fe.cssProps[r] = I(r) || r), a = fe.cssHooks[t] || fe.cssHooks[r], a && "get" in a && (s = a.get(e, !0, n)), void 0 === s && (s = gt(e, t, i)), "normal" === s && t in xt && (s = xt[t]), "" === n || n ? (o = parseFloat(s), n === !0 || isFinite(o) ? o || 0 : s) : s | |
} | |
}), fe.each(["height", "width"], function(e, t) { | |
fe.cssHooks[t] = { | |
get: function(e, n, i) { | |
if (n) return yt.test(fe.css(e, "display")) && 0 === e.offsetWidth ? pt(e, wt, function() { | |
return A(e, t, i) | |
}) : A(e, t, i) | |
}, | |
set: function(e, n, i) { | |
var o = i && ht(e); | |
return O(e, n, i ? D(e, t, i, de.boxSizing && "border-box" === fe.css(e, "boxSizing", !1, o), o) : 0) | |
} | |
} | |
}), de.opacity || (fe.cssHooks.opacity = { | |
get: function(e, t) { | |
return bt.test((t && e.currentStyle ? e.currentStyle.filter : e.style.filter) || "") ? .01 * parseFloat(RegExp.$1) + "" : t ? "1" : "" | |
}, | |
set: function(e, t) { | |
var n = e.style, | |
i = e.currentStyle, | |
o = fe.isNumeric(t) ? "alpha(opacity=" + 100 * t + ")" : "", | |
s = i && i.filter || n.filter || ""; | |
n.zoom = 1, (t >= 1 || "" === t) && "" === fe.trim(s.replace(vt, "")) && n.removeAttribute && (n.removeAttribute("filter"), "" === t || i && !i.filter) || (n.filter = vt.test(s) ? s.replace(vt, o) : s + " " + o) | |
} | |
}), fe.cssHooks.marginRight = F(de.reliableMarginRight, function(e, t) { | |
if (t) return pt(e, { | |
display: "inline-block" | |
}, gt, [e, "marginRight"]) | |
}), fe.cssHooks.marginLeft = F(de.reliableMarginLeft, function(e, t) { | |
if (t) return (parseFloat(gt(e, "marginLeft")) || (fe.contains(e.ownerDocument, e) ? e.getBoundingClientRect().left - pt(e, { | |
marginLeft: 0 | |
}, function() { | |
return e.getBoundingClientRect().left | |
}) : 0)) + "px" | |
}), fe.each({ | |
margin: "", | |
padding: "", | |
border: "Width" | |
}, function(e, t) { | |
fe.cssHooks[e + t] = { | |
expand: function(n) { | |
for (var i = 0, o = {}, s = "string" == typeof n ? n.split(" ") : [n]; i < 4; i++) o[e + Me[i] + t] = s[i] || s[i - 2] || s[0]; | |
return o | |
} | |
}, ct.test(e) || (fe.cssHooks[e + t].set = O) | |
}), fe.fn.extend({ | |
css: function(e, t) { | |
return Ue(this, function(e, t, n) { | |
var i, o, s = {}, | |
a = 0; | |
if (fe.isArray(t)) { | |
for (i = ht(e), o = t.length; a < o; a++) s[t[a]] = fe.css(e, t[a], !1, i); | |
return s | |
} | |
return void 0 !== n ? fe.style(e, t, n) : fe.css(e, t) | |
}, e, t, arguments.length > 1) | |
}, | |
show: function() { | |
return E(this, !0) | |
}, | |
hide: function() { | |
return E(this) | |
}, | |
toggle: function(e) { | |
return "boolean" == typeof e ? e ? this.show() : this.hide() : this.each(function() { | |
Be(this) ? fe(this).show() : fe(this).hide() | |
}) | |
} | |
}), fe.Tween = M, M.prototype = { | |
constructor: M, | |
init: function(e, t, n, i, o, s) { | |
this.elem = e, this.prop = n, this.easing = o || fe.easing._default, this.options = t, this.start = this.now = this.cur(), this.end = i, this.unit = s || (fe.cssNumber[n] ? "" : "px") | |
}, | |
cur: function() { | |
var e = M.propHooks[this.prop]; | |
return e && e.get ? e.get(this) : M.propHooks._default.get(this) | |
}, | |
run: function(e) { | |
var t, n = M.propHooks[this.prop]; | |
return this.options.duration ? this.pos = t = fe.easing[this.easing](e, this.options.duration * e, 0, 1, this.options.duration) : this.pos = t = e, this.now = (this.end - this.start) * t + this.start, this.options.step && this.options.step.call(this.elem, this.now, this), n && n.set ? n.set(this) : M.propHooks._default.set(this), this | |
} | |
}, M.prototype.init.prototype = M.prototype, M.propHooks = { | |
_default: { | |
get: function(e) { | |
var t; | |
return 1 !== e.elem.nodeType || null != e.elem[e.prop] && null == e.elem.style[e.prop] ? e.elem[e.prop] : (t = fe.css(e.elem, e.prop, ""), t && "auto" !== t ? t : 0) | |
}, | |
set: function(e) { | |
fe.fx.step[e.prop] ? fe.fx.step[e.prop](e) : 1 !== e.elem.nodeType || null == e.elem.style[fe.cssProps[e.prop]] && !fe.cssHooks[e.prop] ? e.elem[e.prop] = e.now : fe.style(e.elem, e.prop, e.now + e.unit) | |
} | |
} | |
}, M.propHooks.scrollTop = M.propHooks.scrollLeft = { | |
set: function(e) { | |
e.elem.nodeType && e.elem.parentNode && (e.elem[e.prop] = e.now) | |
} | |
}, fe.easing = { | |
linear: function(e) { | |
return e | |
}, | |
swing: function(e) { | |
return .5 - Math.cos(e * Math.PI) / 2 | |
}, | |
_default: "swing" | |
}, fe.fx = M.prototype.init, fe.fx.step = {}; | |
var Ct, $t, kt = /^(?:toggle|show|hide)$/, | |
Pt = /queueHooks$/; | |
fe.Animation = fe.extend(V, { | |
tweeners: { | |
"*": [function(e, t) { | |
var n = this.createTween(e, t); | |
return p(n.elem, e, Ae.exec(t), n), n | |
}] | |
}, | |
tweener: function(e, t) { | |
fe.isFunction(e) ? (t = e, e = ["*"]) : e = e.match(Le); | |
for (var n, i = 0, o = e.length; i < o; i++) n = e[i], V.tweeners[n] = V.tweeners[n] || [], V.tweeners[n].unshift(t) | |
}, | |
prefilters: [R], | |
prefilter: function(e, t) { | |
t ? V.prefilters.unshift(e) : V.prefilters.push(e) | |
} | |
}), fe.speed = function(e, t, n) { | |
var i = e && "object" == typeof e ? fe.extend({}, e) : { | |
complete: n || !n && t || fe.isFunction(e) && e, | |
duration: e, | |
easing: n && t || t && !fe.isFunction(t) && t | |
}; | |
return i.duration = fe.fx.off ? 0 : "number" == typeof i.duration ? i.duration : i.duration in fe.fx.speeds ? fe.fx.speeds[i.duration] : fe.fx.speeds._default, null != i.queue && i.queue !== !0 || (i.queue = "fx"), i.old = i.complete, i.complete = function() { | |
fe.isFunction(i.old) && i.old.call(this), i.queue && fe.dequeue(this, i.queue) | |
}, i | |
}, fe.fn.extend({ | |
fadeTo: function(e, t, n, i) { | |
return this.filter(Be).css("opacity", 0).show().end().animate({ | |
opacity: t | |
}, e, n, i) | |
}, | |
animate: function(e, t, n, i) { | |
var o = fe.isEmptyObject(e), | |
s = fe.speed(t, n, i), | |
a = function() { | |
var t = V(this, fe.extend({}, e), s); | |
(o || fe._data(this, "finish")) && t.stop(!0) | |
}; | |
return a.finish = a, o || s.queue === !1 ? this.each(a) : this.queue(s.queue, a) | |
}, | |
stop: function(e, t, n) { | |
var i = function(e) { | |
var t = e.stop; | |
delete e.stop, t(n) | |
}; | |
return "string" != typeof e && (n = t, t = e, e = void 0), t && e !== !1 && this.queue(e || "fx", []), this.each(function() { | |
var t = !0, | |
o = null != e && e + "queueHooks", | |
s = fe.timers, | |
a = fe._data(this); | |
if (o) a[o] && a[o].stop && i(a[o]); | |
else | |
for (o in a) a[o] && a[o].stop && Pt.test(o) && i(a[o]); | |
for (o = s.length; o--;) s[o].elem !== this || null != e && s[o].queue !== e || (s[o].anim.stop(n), t = !1, s.splice(o, 1)); | |
!t && n || fe.dequeue(this, e) | |
}) | |
}, | |
finish: function(e) { | |
return e !== !1 && (e = e || "fx"), this.each(function() { | |
var t, n = fe._data(this), | |
i = n[e + "queue"], | |
o = n[e + "queueHooks"], | |
s = fe.timers, | |
a = i ? i.length : 0; | |
for (n.finish = !0, fe.queue(this, e, []), o && o.stop && o.stop.call(this, !0), t = s.length; t--;) s[t].elem === this && s[t].queue === e && (s[t].anim.stop(!0), s.splice(t, 1)); | |
for (t = 0; t < a; t++) i[t] && i[t].finish && i[t].finish.call(this); | |
delete n.finish | |
}) | |
} | |
}), fe.each(["toggle", "show", "hide"], function(e, t) { | |
var n = fe.fn[t]; | |
fe.fn[t] = function(e, i, o) { | |
return null == e || "boolean" == typeof e ? n.apply(this, arguments) : this.animate(U(t, !0), e, i, o) | |
} | |
}), fe.each({ | |
slideDown: U("show"), | |
slideUp: U("hide"), | |
slideToggle: U("toggle"), | |
fadeIn: { | |
opacity: "show" | |
}, | |
fadeOut: { | |
opacity: "hide" | |
}, | |
fadeToggle: { | |
opacity: "toggle" | |
} | |
}, function(e, t) { | |
fe.fn[e] = function(e, n, i) { | |
return this.animate(t, e, n, i) | |
} | |
}), fe.timers = [], fe.fx.tick = function() { | |
var e, t = fe.timers, | |
n = 0; | |
for (Ct = fe.now(); n < t.length; n++) e = t[n], e() || t[n] !== e || t.splice(n--, 1); | |
t.length || fe.fx.stop(), Ct = void 0 | |
}, fe.fx.timer = function(e) { | |
fe.timers.push(e), e() ? fe.fx.start() : fe.timers.pop() | |
}, fe.fx.interval = 13, fe.fx.start = function() { | |
$t || ($t = e.setInterval(fe.fx.tick, fe.fx.interval)) | |
}, fe.fx.stop = function() { | |
e.clearInterval($t), $t = null | |
}, fe.fx.speeds = { | |
slow: 600, | |
fast: 200, | |
_default: 400 | |
}, fe.fn.delay = function(t, n) { | |
return t = fe.fx ? fe.fx.speeds[t] || t : t, n = n || "fx", this.queue(n, function(n, i) { | |
var o = e.setTimeout(n, t); | |
i.stop = function() { | |
e.clearTimeout(o) | |
} | |
}) | |
}, | |
function() { | |
var e, t = ie.createElement("input"), | |
n = ie.createElement("div"), | |
i = ie.createElement("select"), | |
o = i.appendChild(ie.createElement("option")); | |
n = ie.createElement("div"), n.setAttribute("className", "t"), n.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>", e = n.getElementsByTagName("a")[0], t.setAttribute("type", "checkbox"), n.appendChild(t), e = n.getElementsByTagName("a")[0], e.style.cssText = "top:1px", de.getSetAttribute = "t" !== n.className, de.style = /top/.test(e.getAttribute("style")), de.hrefNormalized = "/a" === e.getAttribute("href"), de.checkOn = !!t.value, de.optSelected = o.selected, de.enctype = !!ie.createElement("form").enctype, i.disabled = !0, de.optDisabled = !o.disabled, t = ie.createElement("input"), t.setAttribute("value", ""), de.input = "" === t.getAttribute("value"), t.value = "t", t.setAttribute("type", "radio"), de.radioValue = "t" === t.value | |
}(); | |
var Lt = /\r/g, | |
Nt = /[\x20\t\r\n\f]+/g; | |
fe.fn.extend({ | |
val: function(e) { | |
var t, n, i, o = this[0]; { | |
if (arguments.length) return i = fe.isFunction(e), this.each(function(n) { | |
var o; | |
1 === this.nodeType && (o = i ? e.call(this, n, fe(this).val()) : e, null == o ? o = "" : "number" == typeof o ? o += "" : fe.isArray(o) && (o = fe.map(o, function(e) { | |
return null == e ? "" : e + "" | |
})), t = fe.valHooks[this.type] || fe.valHooks[this.nodeName.toLowerCase()], t && "set" in t && void 0 !== t.set(this, o, "value") || (this.value = o)) | |
}); | |
if (o) return t = fe.valHooks[o.type] || fe.valHooks[o.nodeName.toLowerCase()], t && "get" in t && void 0 !== (n = t.get(o, "value")) ? n : (n = o.value, "string" == typeof n ? n.replace(Lt, "") : null == n ? "" : n) | |
} | |
} | |
}), fe.extend({ | |
valHooks: { | |
option: { | |
get: function(e) { | |
var t = fe.find.attr(e, "value"); | |
return null != t ? t : fe.trim(fe.text(e)).replace(Nt, " ") | |
} | |
}, | |
select: { | |
get: function(e) { | |
for (var t, n, i = e.options, o = e.selectedIndex, s = "select-one" === e.type || o < 0, a = s ? null : [], r = s ? o + 1 : i.length, l = o < 0 ? r : s ? o : 0; l < r; l++) | |
if (n = i[l], (n.selected || l === o) && (de.optDisabled ? !n.disabled : null === n.getAttribute("disabled")) && (!n.parentNode.disabled || !fe.nodeName(n.parentNode, "optgroup"))) { | |
if (t = fe(n).val(), s) return t; | |
a.push(t) | |
} | |
return a | |
}, | |
set: function(e, t) { | |
for (var n, i, o = e.options, s = fe.makeArray(t), a = o.length; a--;) | |
if (i = o[a], fe.inArray(fe.valHooks.option.get(i), s) > -1) try { | |
i.selected = n = !0 | |
} catch (e) { | |
i.scrollHeight | |
} else i.selected = !1; | |
return n || (e.selectedIndex = -1), o | |
} | |
} | |
} | |
}), fe.each(["radio", "checkbox"], function() { | |
fe.valHooks[this] = { | |
set: function(e, t) { | |
if (fe.isArray(t)) return e.checked = fe.inArray(fe(e).val(), t) > -1 | |
} | |
}, de.checkOn || (fe.valHooks[this].get = function(e) { | |
return null === e.getAttribute("value") ? "on" : e.value | |
}) | |
}); | |
var Ft, It, Et = fe.expr.attrHandle, | |
Ot = /^(?:checked|selected)$/i, | |
Dt = de.getSetAttribute, | |
At = de.input; | |
fe.fn.extend({ | |
attr: function(e, t) { | |
return Ue(this, fe.attr, e, t, arguments.length > 1) | |
}, | |
removeAttr: function(e) { | |
return this.each(function() { | |
fe.removeAttr(this, e) | |
}) | |
} | |
}), fe.extend({ | |
attr: function(e, t, n) { | |
var i, o, s = e.nodeType; | |
if (3 !== s && 8 !== s && 2 !== s) return "undefined" == typeof e.getAttribute ? fe.prop(e, t, n) : (1 === s && fe.isXMLDoc(e) || (t = t.toLowerCase(), o = fe.attrHooks[t] || (fe.expr.match.bool.test(t) ? It : Ft)), void 0 !== n ? null === n ? void fe.removeAttr(e, t) : o && "set" in o && void 0 !== (i = o.set(e, n, t)) ? i : (e.setAttribute(t, n + ""), n) : o && "get" in o && null !== (i = o.get(e, t)) ? i : (i = fe.find.attr(e, t), null == i ? void 0 : i)) | |
}, | |
attrHooks: { | |
type: { | |
set: function(e, t) { | |
if (!de.radioValue && "radio" === t && fe.nodeName(e, "input")) { | |
var n = e.value; | |
return e.setAttribute("type", t), n && (e.value = n), t | |
} | |
} | |
} | |
}, | |
removeAttr: function(e, t) { | |
var n, i, o = 0, | |
s = t && t.match(Le); | |
if (s && 1 === e.nodeType) | |
for (; n = s[o++];) i = fe.propFix[n] || n, fe.expr.match.bool.test(n) ? At && Dt || !Ot.test(n) ? e[i] = !1 : e[fe.camelCase("default-" + n)] = e[i] = !1 : fe.attr(e, n, ""), e.removeAttribute(Dt ? n : i) | |
} | |
}), It = { | |
set: function(e, t, n) { | |
return t === !1 ? fe.removeAttr(e, n) : At && Dt || !Ot.test(n) ? e.setAttribute(!Dt && fe.propFix[n] || n, n) : e[fe.camelCase("default-" + n)] = e[n] = !0, n | |
} | |
}, fe.each(fe.expr.match.bool.source.match(/\w+/g), function(e, t) { | |
var n = Et[t] || fe.find.attr; | |
At && Dt || !Ot.test(t) ? Et[t] = function(e, t, i) { | |
var o, s; | |
return i || (s = Et[t], Et[t] = o, o = null != n(e, t, i) ? t.toLowerCase() : null, Et[t] = s), o | |
} : Et[t] = function(e, t, n) { | |
if (!n) return e[fe.camelCase("default-" + t)] ? t.toLowerCase() : null | |
} | |
}), At && Dt || (fe.attrHooks.value = { | |
set: function(e, t, n) { | |
return fe.nodeName(e, "input") ? void(e.defaultValue = t) : Ft && Ft.set(e, t, n) | |
} | |
}), Dt || (Ft = { | |
set: function(e, t, n) { | |
var i = e.getAttributeNode(n); | |
if (i || e.setAttributeNode(i = e.ownerDocument.createAttribute(n)), i.value = t += "", "value" === n || t === e.getAttribute(n)) return t | |
} | |
}, Et.id = Et.name = Et.coords = function(e, t, n) { | |
var i; | |
if (!n) return (i = e.getAttributeNode(t)) && "" !== i.value ? i.value : null | |
}, fe.valHooks.button = { | |
get: function(e, t) { | |
var n = e.getAttributeNode(t); | |
if (n && n.specified) return n.value | |
}, | |
set: Ft.set | |
}, fe.attrHooks.contenteditable = { | |
set: function(e, t, n) { | |
Ft.set(e, "" !== t && t, n) | |
} | |
}, fe.each(["width", "height"], function(e, t) { | |
fe.attrHooks[t] = { | |
set: function(e, n) { | |
if ("" === n) return e.setAttribute(t, "auto"), n | |
} | |
} | |
})), de.style || (fe.attrHooks.style = { | |
get: function(e) { | |
return e.style.cssText || void 0 | |
}, | |
set: function(e, t) { | |
return e.style.cssText = t + "" | |
} | |
}); | |
var Mt = /^(?:input|select|textarea|button|object)$/i, | |
Bt = /^(?:a|area)$/i; | |
fe.fn.extend({ | |
prop: function(e, t) { | |
return Ue(this, fe.prop, e, t, arguments.length > 1) | |
}, | |
removeProp: function(e) { | |
return e = fe.propFix[e] || e, this.each(function() { | |
try { | |
this[e] = void 0, delete this[e] | |
} catch (e) {} | |
}) | |
} | |
}), fe.extend({ | |
prop: function(e, t, n) { | |
var i, o, s = e.nodeType; | |
if (3 !== s && 8 !== s && 2 !== s) return 1 === s && fe.isXMLDoc(e) || (t = fe.propFix[t] || t, o = fe.propHooks[t]), void 0 !== n ? o && "set" in o && void 0 !== (i = o.set(e, n, t)) ? i : e[t] = n : o && "get" in o && null !== (i = o.get(e, t)) ? i : e[t] | |
}, | |
propHooks: { | |
tabIndex: { | |
get: function(e) { | |
var t = fe.find.attr(e, "tabindex"); | |
return t ? parseInt(t, 10) : Mt.test(e.nodeName) || Bt.test(e.nodeName) && e.href ? 0 : -1 | |
} | |
} | |
}, | |
propFix: { | |
"for": "htmlFor", | |
"class": "className" | |
} | |
}), de.hrefNormalized || fe.each(["href", "src"], function(e, t) { | |
fe.propHooks[t] = { | |
get: function(e) { | |
return e.getAttribute(t, 4) | |
} | |
} | |
}), de.optSelected || (fe.propHooks.selected = { | |
get: function(e) { | |
var t = e.parentNode; | |
return t && (t.selectedIndex, t.parentNode && t.parentNode.selectedIndex), null | |
}, | |
set: function(e) { | |
var t = e.parentNode; | |
t && (t.selectedIndex, t.parentNode && t.parentNode.selectedIndex) | |
} | |
}), fe.each(["tabIndex", "readOnly", "maxLength", "cellSpacing", "cellPadding", "rowSpan", "colSpan", "useMap", "frameBorder", "contentEditable"], function() { | |
fe.propFix[this.toLowerCase()] = this | |
}), de.enctype || (fe.propFix.enctype = "encoding"); | |
var Ut = /[\t\r\n\f]/g; | |
fe.fn.extend({ | |
addClass: function(e) { | |
var t, n, i, o, s, a, r, l = 0; | |
if (fe.isFunction(e)) return this.each(function(t) { | |
fe(this).addClass(e.call(this, t, q(this))) | |
}); | |
if ("string" == typeof e && e) | |
for (t = e.match(Le) || []; n = this[l++];) | |
if (o = q(n), i = 1 === n.nodeType && (" " + o + " ").replace(Ut, " ")) { | |
for (a = 0; s = t[a++];) i.indexOf(" " + s + " ") < 0 && (i += s + " "); | |
r = fe.trim(i), o !== r && fe.attr(n, "class", r) | |
} | |
return this | |
}, | |
removeClass: function(e) { | |
var t, n, i, o, s, a, r, l = 0; | |
if (fe.isFunction(e)) return this.each(function(t) { | |
fe(this).removeClass(e.call(this, t, q(this))) | |
}); | |
if (!arguments.length) return this.attr("class", ""); | |
if ("string" == typeof e && e) | |
for (t = e.match(Le) || []; n = this[l++];) | |
if (o = q(n), i = 1 === n.nodeType && (" " + o + " ").replace(Ut, " ")) { | |
for (a = 0; s = t[a++];) | |
for (; i.indexOf(" " + s + " ") > -1;) i = i.replace(" " + s + " ", " "); | |
r = fe.trim(i), o !== r && fe.attr(n, "class", r) | |
} | |
return this | |
}, | |
toggleClass: function(e, t) { | |
var n = typeof e; | |
return "boolean" == typeof t && "string" === n ? t ? this.addClass(e) : this.removeClass(e) : fe.isFunction(e) ? this.each(function(n) { | |
fe(this).toggleClass(e.call(this, n, q(this), t), t) | |
}) : this.each(function() { | |
var t, i, o, s; | |
if ("string" === n) | |
for (i = 0, o = fe(this), s = e.match(Le) || []; t = s[i++];) o.hasClass(t) ? o.removeClass(t) : o.addClass(t); | |
else void 0 !== e && "boolean" !== n || (t = q(this), t && fe._data(this, "__className__", t), fe.attr(this, "class", t || e === !1 ? "" : fe._data(this, "__className__") || "")) | |
}) | |
}, | |
hasClass: function(e) { | |
var t, n, i = 0; | |
for (t = " " + e + " "; n = this[i++];) | |
if (1 === n.nodeType && (" " + q(n) + " ").replace(Ut, " ").indexOf(t) > -1) return !0; | |
return !1 | |
} | |
}), fe.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "), function(e, t) { | |
fe.fn[t] = function(e, n) { | |
return arguments.length > 0 ? this.on(t, null, e, n) : this.trigger(t) | |
} | |
}), fe.fn.extend({ | |
hover: function(e, t) { | |
return this.mouseenter(e).mouseleave(t || e) | |
} | |
}); | |
var Ht = e.location, | |
Rt = fe.now(), | |
jt = /\?/, | |
Vt = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g; | |
fe.parseJSON = function(t) { | |
if (e.JSON && e.JSON.parse) return e.JSON.parse(t + ""); | |
var n, i = null, | |
o = fe.trim(t + ""); | |
return o && !fe.trim(o.replace(Vt, function(e, t, o, s) { | |
return n && t && (i = 0), 0 === i ? e : (n = o || t, i += !s - !o, "") | |
})) ? Function("return " + o)() : fe.error("Invalid JSON: " + t) | |
}, fe.parseXML = function(t) { | |
var n, i; | |
if (!t || "string" != typeof t) return null; | |
try { | |
e.DOMParser ? (i = new e.DOMParser, n = i.parseFromString(t, "text/xml")) : (n = new e.ActiveXObject("Microsoft.XMLDOM"), n.async = "false", n.loadXML(t)) | |
} catch (e) { | |
n = void 0 | |
} | |
return n && n.documentElement && !n.getElementsByTagName("parsererror").length || fe.error("Invalid XML: " + t), n | |
}; | |
var qt = /#.*$/, | |
zt = /([?&])_=[^&]*/, | |
Wt = /^(.*?):[ \t]*([^\r\n]*)\r?$/gm, | |
Gt = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, | |
Xt = /^(?:GET|HEAD)$/, | |
Yt = /^\/\//, | |
Qt = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/, | |
Jt = {}, | |
Kt = {}, | |
Zt = "*/".concat("*"), | |
en = Ht.href, | |
tn = Qt.exec(en.toLowerCase()) || []; | |
fe.extend({ | |
active: 0, | |
lastModified: {}, | |
etag: {}, | |
ajaxSettings: { | |
url: en, | |
type: "GET", | |
isLocal: Gt.test(tn[1]), | |
global: !0, | |
processData: !0, | |
async: !0, | |
contentType: "application/x-www-form-urlencoded; charset=UTF-8", | |
accepts: { | |
"*": Zt, | |
text: "text/plain", | |
html: "text/html", | |
xml: "application/xml, text/xml", | |
json: "application/json, text/javascript" | |
}, | |
contents: { | |
xml: /\bxml\b/, | |
html: /\bhtml/, | |
json: /\bjson\b/ | |
}, | |
responseFields: { | |
xml: "responseXML", | |
text: "responseText", | |
json: "responseJSON" | |
}, | |
converters: { | |
"* text": String, | |
"text html": !0, | |
"text json": fe.parseJSON, | |
"text xml": fe.parseXML | |
}, | |
flatOptions: { | |
url: !0, | |
context: !0 | |
} | |
}, | |
ajaxSetup: function(e, t) { | |
return t ? G(G(e, fe.ajaxSettings), t) : G(fe.ajaxSettings, e) | |
}, | |
ajaxPrefilter: z(Jt), | |
ajaxTransport: z(Kt), | |
ajax: function(t, n) { | |
function i(t, n, i, o) { | |
var s, d, b, y, w, T = n; | |
2 !== _ && (_ = 2, l && e.clearTimeout(l), c = void 0, r = o || "", x.readyState = t > 0 ? 4 : 0, s = t >= 200 && t < 300 || 304 === t, i && (y = X(p, x, i)), y = Y(p, y, x, s), s ? (p.ifModified && (w = x.getResponseHeader("Last-Modified"), w && (fe.lastModified[a] = w), w = x.getResponseHeader("etag"), w && (fe.etag[a] = w)), 204 === t || "HEAD" === p.type ? T = "nocontent" : 304 === t ? T = "notmodified" : (T = y.state, d = y.data, b = y.error, s = !b)) : (b = T, !t && T || (T = "error", t < 0 && (t = 0))), x.status = t, x.statusText = (n || T) + "", s ? g.resolveWith(f, [d, T, x]) : g.rejectWith(f, [x, T, b]), x.statusCode(v), v = void 0, u && h.trigger(s ? "ajaxSuccess" : "ajaxError", [x, p, s ? d : b]), m.fireWith(f, [x, T]), u && (h.trigger("ajaxComplete", [x, p]), --fe.active || fe.event.trigger("ajaxStop"))) | |
} | |
"object" == typeof t && (n = t, t = void 0), n = n || {}; | |
var o, s, a, r, l, u, c, d, p = fe.ajaxSetup({}, n), | |
f = p.context || p, | |
h = p.context && (f.nodeType || f.jquery) ? fe(f) : fe.event, | |
g = fe.Deferred(), | |
m = fe.Callbacks("once memory"), | |
v = p.statusCode || {}, | |
b = {}, | |
y = {}, | |
_ = 0, | |
w = "canceled", | |
x = { | |
readyState: 0, | |
getResponseHeader: function(e) { | |
var t; | |
if (2 === _) { | |
if (!d) | |
for (d = {}; t = Wt.exec(r);) d[t[1].toLowerCase()] = t[2]; | |
t = d[e.toLowerCase()] | |
} | |
return null == t ? null : t | |
}, | |
getAllResponseHeaders: function() { | |
return 2 === _ ? r : null | |
}, | |
setRequestHeader: function(e, t) { | |
var n = e.toLowerCase(); | |
return _ || (e = y[n] = y[n] || e, b[e] = t), this | |
}, | |
overrideMimeType: function(e) { | |
return _ || (p.mimeType = e), this | |
}, | |
statusCode: function(e) { | |
var t; | |
if (e) | |
if (_ < 2) | |
for (t in e) v[t] = [v[t], e[t]]; | |
else x.always(e[x.status]); | |
return this | |
}, | |
abort: function(e) { | |
var t = e || w; | |
return c && c.abort(t), i(0, t), this | |
} | |
}; | |
if (g.promise(x).complete = m.add, x.success = x.done, x.error = x.fail, p.url = ((t || p.url || en) + "").replace(qt, "").replace(Yt, tn[1] + "//"), p.type = n.method || n.type || p.method || p.type, p.dataTypes = fe.trim(p.dataType || "*").toLowerCase().match(Le) || [""], null == p.crossDomain && (o = Qt.exec(p.url.toLowerCase()), p.crossDomain = !(!o || o[1] === tn[1] && o[2] === tn[2] && (o[3] || ("http:" === o[1] ? "80" : "443")) === (tn[3] || ("http:" === tn[1] ? "80" : "443")))), p.data && p.processData && "string" != typeof p.data && (p.data = fe.param(p.data, p.traditional)), | |
W(Jt, p, n, x), 2 === _) return x; | |
u = fe.event && p.global, u && 0 === fe.active++ && fe.event.trigger("ajaxStart"), p.type = p.type.toUpperCase(), p.hasContent = !Xt.test(p.type), a = p.url, p.hasContent || (p.data && (a = p.url += (jt.test(a) ? "&" : "?") + p.data, delete p.data), p.cache === !1 && (p.url = zt.test(a) ? a.replace(zt, "$1_=" + Rt++) : a + (jt.test(a) ? "&" : "?") + "_=" + Rt++)), p.ifModified && (fe.lastModified[a] && x.setRequestHeader("If-Modified-Since", fe.lastModified[a]), fe.etag[a] && x.setRequestHeader("If-None-Match", fe.etag[a])), (p.data && p.hasContent && p.contentType !== !1 || n.contentType) && x.setRequestHeader("Content-Type", p.contentType), x.setRequestHeader("Accept", p.dataTypes[0] && p.accepts[p.dataTypes[0]] ? p.accepts[p.dataTypes[0]] + ("*" !== p.dataTypes[0] ? ", " + Zt + "; q=0.01" : "") : p.accepts["*"]); | |
for (s in p.headers) x.setRequestHeader(s, p.headers[s]); | |
if (p.beforeSend && (p.beforeSend.call(f, x, p) === !1 || 2 === _)) return x.abort(); | |
w = "abort"; | |
for (s in { | |
success: 1, | |
error: 1, | |
complete: 1 | |
}) x[s](p[s]); | |
if (c = W(Kt, p, n, x)) { | |
if (x.readyState = 1, u && h.trigger("ajaxSend", [x, p]), 2 === _) return x; | |
p.async && p.timeout > 0 && (l = e.setTimeout(function() { | |
x.abort("timeout") | |
}, p.timeout)); | |
try { | |
_ = 1, c.send(b, i) | |
} catch (e) { | |
if (!(_ < 2)) throw e; | |
i(-1, e) | |
} | |
} else i(-1, "No Transport"); | |
return x | |
}, | |
getJSON: function(e, t, n) { | |
return fe.get(e, t, n, "json") | |
}, | |
getScript: function(e, t) { | |
return fe.get(e, void 0, t, "script") | |
} | |
}), fe.each(["get", "post"], function(e, t) { | |
fe[t] = function(e, n, i, o) { | |
return fe.isFunction(n) && (o = o || i, i = n, n = void 0), fe.ajax(fe.extend({ | |
url: e, | |
type: t, | |
dataType: o, | |
data: n, | |
success: i | |
}, fe.isPlainObject(e) && e)) | |
} | |
}), fe._evalUrl = function(e) { | |
return fe.ajax({ | |
url: e, | |
type: "GET", | |
dataType: "script", | |
cache: !0, | |
async: !1, | |
global: !1, | |
"throws": !0 | |
}) | |
}, fe.fn.extend({ | |
wrapAll: function(e) { | |
if (fe.isFunction(e)) return this.each(function(t) { | |
fe(this).wrapAll(e.call(this, t)) | |
}); | |
if (this[0]) { | |
var t = fe(e, this[0].ownerDocument).eq(0).clone(!0); | |
this[0].parentNode && t.insertBefore(this[0]), t.map(function() { | |
for (var e = this; e.firstChild && 1 === e.firstChild.nodeType;) e = e.firstChild; | |
return e | |
}).append(this) | |
} | |
return this | |
}, | |
wrapInner: function(e) { | |
return fe.isFunction(e) ? this.each(function(t) { | |
fe(this).wrapInner(e.call(this, t)) | |
}) : this.each(function() { | |
var t = fe(this), | |
n = t.contents(); | |
n.length ? n.wrapAll(e) : t.append(e) | |
}) | |
}, | |
wrap: function(e) { | |
var t = fe.isFunction(e); | |
return this.each(function(n) { | |
fe(this).wrapAll(t ? e.call(this, n) : e) | |
}) | |
}, | |
unwrap: function() { | |
return this.parent().each(function() { | |
fe.nodeName(this, "body") || fe(this).replaceWith(this.childNodes) | |
}).end() | |
} | |
}), fe.expr.filters.hidden = function(e) { | |
return de.reliableHiddenOffsets() ? e.offsetWidth <= 0 && e.offsetHeight <= 0 && !e.getClientRects().length : J(e) | |
}, fe.expr.filters.visible = function(e) { | |
return !fe.expr.filters.hidden(e) | |
}; | |
var nn = /%20/g, | |
on = /\[\]$/, | |
sn = /\r?\n/g, | |
an = /^(?:submit|button|image|reset|file)$/i, | |
rn = /^(?:input|select|textarea|keygen)/i; | |
fe.param = function(e, t) { | |
var n, i = [], | |
o = function(e, t) { | |
t = fe.isFunction(t) ? t() : null == t ? "" : t, i[i.length] = encodeURIComponent(e) + "=" + encodeURIComponent(t) | |
}; | |
if (void 0 === t && (t = fe.ajaxSettings && fe.ajaxSettings.traditional), fe.isArray(e) || e.jquery && !fe.isPlainObject(e)) fe.each(e, function() { | |
o(this.name, this.value) | |
}); | |
else | |
for (n in e) K(n, e[n], t, o); | |
return i.join("&").replace(nn, "+") | |
}, fe.fn.extend({ | |
serialize: function() { | |
return fe.param(this.serializeArray()) | |
}, | |
serializeArray: function() { | |
return this.map(function() { | |
var e = fe.prop(this, "elements"); | |
return e ? fe.makeArray(e) : this | |
}).filter(function() { | |
var e = this.type; | |
return this.name && !fe(this).is(":disabled") && rn.test(this.nodeName) && !an.test(e) && (this.checked || !He.test(e)) | |
}).map(function(e, t) { | |
var n = fe(this).val(); | |
return null == n ? null : fe.isArray(n) ? fe.map(n, function(e) { | |
return { | |
name: t.name, | |
value: e.replace(sn, "\r\n") | |
} | |
}) : { | |
name: t.name, | |
value: n.replace(sn, "\r\n") | |
} | |
}).get() | |
} | |
}), fe.ajaxSettings.xhr = void 0 !== e.ActiveXObject ? function() { | |
return this.isLocal ? ee() : ie.documentMode > 8 ? Z() : /^(get|post|head|put|delete|options)$/i.test(this.type) && Z() || ee() | |
} : Z; | |
var ln = 0, | |
un = {}, | |
cn = fe.ajaxSettings.xhr(); | |
e.attachEvent && e.attachEvent("onunload", function() { | |
for (var e in un) un[e](void 0, !0) | |
}), de.cors = !!cn && "withCredentials" in cn, cn = de.ajax = !!cn, cn && fe.ajaxTransport(function(t) { | |
if (!t.crossDomain || de.cors) { | |
var n; | |
return { | |
send: function(i, o) { | |
var s, a = t.xhr(), | |
r = ++ln; | |
if (a.open(t.type, t.url, t.async, t.username, t.password), t.xhrFields) | |
for (s in t.xhrFields) a[s] = t.xhrFields[s]; | |
t.mimeType && a.overrideMimeType && a.overrideMimeType(t.mimeType), t.crossDomain || i["X-Requested-With"] || (i["X-Requested-With"] = "XMLHttpRequest"); | |
for (s in i) void 0 !== i[s] && a.setRequestHeader(s, i[s] + ""); | |
a.send(t.hasContent && t.data || null), n = function(e, i) { | |
var s, l, u; | |
if (n && (i || 4 === a.readyState)) | |
if (delete un[r], n = void 0, a.onreadystatechange = fe.noop, i) 4 !== a.readyState && a.abort(); | |
else { | |
u = {}, s = a.status, "string" == typeof a.responseText && (u.text = a.responseText); | |
try { | |
l = a.statusText | |
} catch (e) { | |
l = "" | |
} | |
s || !t.isLocal || t.crossDomain ? 1223 === s && (s = 204) : s = u.text ? 200 : 404 | |
} | |
u && o(s, l, u, a.getAllResponseHeaders()) | |
}, t.async ? 4 === a.readyState ? e.setTimeout(n) : a.onreadystatechange = un[r] = n : n() | |
}, | |
abort: function() { | |
n && n(void 0, !0) | |
} | |
} | |
} | |
}), fe.ajaxSetup({ | |
accepts: { | |
script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" | |
}, | |
contents: { | |
script: /\b(?:java|ecma)script\b/ | |
}, | |
converters: { | |
"text script": function(e) { | |
return fe.globalEval(e), e | |
} | |
} | |
}), fe.ajaxPrefilter("script", function(e) { | |
void 0 === e.cache && (e.cache = !1), e.crossDomain && (e.type = "GET", e.global = !1) | |
}), fe.ajaxTransport("script", function(e) { | |
if (e.crossDomain) { | |
var t, n = ie.head || fe("head")[0] || ie.documentElement; | |
return { | |
send: function(i, o) { | |
t = ie.createElement("script"), t.async = !0, e.scriptCharset && (t.charset = e.scriptCharset), t.src = e.url, t.onload = t.onreadystatechange = function(e, n) { | |
(n || !t.readyState || /loaded|complete/.test(t.readyState)) && (t.onload = t.onreadystatechange = null, t.parentNode && t.parentNode.removeChild(t), t = null, n || o(200, "success")) | |
}, n.insertBefore(t, n.firstChild) | |
}, | |
abort: function() { | |
t && t.onload(void 0, !0) | |
} | |
} | |
} | |
}); | |
var dn = [], | |
pn = /(=)\?(?=&|$)|\?\?/; | |
fe.ajaxSetup({ | |
jsonp: "callback", | |
jsonpCallback: function() { | |
var e = dn.pop() || fe.expando + "_" + Rt++; | |
return this[e] = !0, e | |
} | |
}), fe.ajaxPrefilter("json jsonp", function(t, n, i) { | |
var o, s, a, r = t.jsonp !== !1 && (pn.test(t.url) ? "url" : "string" == typeof t.data && 0 === (t.contentType || "").indexOf("application/x-www-form-urlencoded") && pn.test(t.data) && "data"); | |
if (r || "jsonp" === t.dataTypes[0]) return o = t.jsonpCallback = fe.isFunction(t.jsonpCallback) ? t.jsonpCallback() : t.jsonpCallback, r ? t[r] = t[r].replace(pn, "$1" + o) : t.jsonp !== !1 && (t.url += (jt.test(t.url) ? "&" : "?") + t.jsonp + "=" + o), t.converters["script json"] = function() { | |
return a || fe.error(o + " was not called"), a[0] | |
}, t.dataTypes[0] = "json", s = e[o], e[o] = function() { | |
a = arguments | |
}, i.always(function() { | |
void 0 === s ? fe(e).removeProp(o) : e[o] = s, t[o] && (t.jsonpCallback = n.jsonpCallback, dn.push(o)), a && fe.isFunction(s) && s(a[0]), a = s = void 0 | |
}), "script" | |
}), fe.parseHTML = function(e, t, n) { | |
if (!e || "string" != typeof e) return null; | |
"boolean" == typeof t && (n = t, t = !1), t = t || ie; | |
var i = xe.exec(e), | |
o = !n && []; | |
return i ? [t.createElement(i[1])] : (i = v([e], t, o), o && o.length && fe(o).remove(), fe.merge([], i.childNodes)) | |
}; | |
var fn = fe.fn.load; | |
fe.fn.load = function(e, t, n) { | |
if ("string" != typeof e && fn) return fn.apply(this, arguments); | |
var i, o, s, a = this, | |
r = e.indexOf(" "); | |
return r > -1 && (i = fe.trim(e.slice(r, e.length)), e = e.slice(0, r)), fe.isFunction(t) ? (n = t, t = void 0) : t && "object" == typeof t && (o = "POST"), a.length > 0 && fe.ajax({ | |
url: e, | |
type: o || "GET", | |
dataType: "html", | |
data: t | |
}).done(function(e) { | |
s = arguments, a.html(i ? fe("<div>").append(fe.parseHTML(e)).find(i) : e) | |
}).always(n && function(e, t) { | |
a.each(function() { | |
n.apply(this, s || [e.responseText, t, e]) | |
}) | |
}), this | |
}, fe.each(["ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend"], function(e, t) { | |
fe.fn[t] = function(e) { | |
return this.on(t, e) | |
} | |
}), fe.expr.filters.animated = function(e) { | |
return fe.grep(fe.timers, function(t) { | |
return e === t.elem | |
}).length | |
}, fe.offset = { | |
setOffset: function(e, t, n) { | |
var i, o, s, a, r, l, u, c = fe.css(e, "position"), | |
d = fe(e), | |
p = {}; | |
"static" === c && (e.style.position = "relative"), r = d.offset(), s = fe.css(e, "top"), l = fe.css(e, "left"), u = ("absolute" === c || "fixed" === c) && fe.inArray("auto", [s, l]) > -1, u ? (i = d.position(), a = i.top, o = i.left) : (a = parseFloat(s) || 0, o = parseFloat(l) || 0), fe.isFunction(t) && (t = t.call(e, n, fe.extend({}, r))), null != t.top && (p.top = t.top - r.top + a), null != t.left && (p.left = t.left - r.left + o), "using" in t ? t.using.call(e, p) : d.css(p) | |
} | |
}, fe.fn.extend({ | |
offset: function(e) { | |
if (arguments.length) return void 0 === e ? this : this.each(function(t) { | |
fe.offset.setOffset(this, e, t) | |
}); | |
var t, n, i = { | |
top: 0, | |
left: 0 | |
}, | |
o = this[0], | |
s = o && o.ownerDocument; | |
if (s) return t = s.documentElement, fe.contains(t, o) ? ("undefined" != typeof o.getBoundingClientRect && (i = o.getBoundingClientRect()), n = te(s), { | |
top: i.top + (n.pageYOffset || t.scrollTop) - (t.clientTop || 0), | |
left: i.left + (n.pageXOffset || t.scrollLeft) - (t.clientLeft || 0) | |
}) : i | |
}, | |
position: function() { | |
if (this[0]) { | |
var e, t, n = { | |
top: 0, | |
left: 0 | |
}, | |
i = this[0]; | |
return "fixed" === fe.css(i, "position") ? t = i.getBoundingClientRect() : (e = this.offsetParent(), t = this.offset(), fe.nodeName(e[0], "html") || (n = e.offset()), n.top += fe.css(e[0], "borderTopWidth", !0), n.left += fe.css(e[0], "borderLeftWidth", !0)), { | |
top: t.top - n.top - fe.css(i, "marginTop", !0), | |
left: t.left - n.left - fe.css(i, "marginLeft", !0) | |
} | |
} | |
}, | |
offsetParent: function() { | |
return this.map(function() { | |
for (var e = this.offsetParent; e && !fe.nodeName(e, "html") && "static" === fe.css(e, "position");) e = e.offsetParent; | |
return e || ft | |
}) | |
} | |
}), fe.each({ | |
scrollLeft: "pageXOffset", | |
scrollTop: "pageYOffset" | |
}, function(e, t) { | |
var n = /Y/.test(t); | |
fe.fn[e] = function(i) { | |
return Ue(this, function(e, i, o) { | |
var s = te(e); | |
return void 0 === o ? s ? t in s ? s[t] : s.document.documentElement[i] : e[i] : void(s ? s.scrollTo(n ? fe(s).scrollLeft() : o, n ? o : fe(s).scrollTop()) : e[i] = o) | |
}, e, i, arguments.length, null) | |
} | |
}), fe.each(["top", "left"], function(e, t) { | |
fe.cssHooks[t] = F(de.pixelPosition, function(e, n) { | |
if (n) return n = gt(e, t), dt.test(n) ? fe(e).position()[t] + "px" : n | |
}) | |
}), fe.each({ | |
Height: "height", | |
Width: "width" | |
}, function(e, t) { | |
fe.each({ | |
padding: "inner" + e, | |
content: t, | |
"": "outer" + e | |
}, function(n, i) { | |
fe.fn[i] = function(i, o) { | |
var s = arguments.length && (n || "boolean" != typeof i), | |
a = n || (i === !0 || o === !0 ? "margin" : "border"); | |
return Ue(this, function(t, n, i) { | |
var o; | |
return fe.isWindow(t) ? t.document.documentElement["client" + e] : 9 === t.nodeType ? (o = t.documentElement, Math.max(t.body["scroll" + e], o["scroll" + e], t.body["offset" + e], o["offset" + e], o["client" + e])) : void 0 === i ? fe.css(t, n, a) : fe.style(t, n, i, a) | |
}, t, s ? i : void 0, s, null) | |
} | |
}) | |
}), fe.fn.extend({ | |
bind: function(e, t, n) { | |
return this.on(e, null, t, n) | |
}, | |
unbind: function(e, t) { | |
return this.off(e, null, t) | |
}, | |
delegate: function(e, t, n, i) { | |
return this.on(t, e, n, i) | |
}, | |
undelegate: function(e, t, n) { | |
return 1 === arguments.length ? this.off(e, "**") : this.off(t, e || "**", n) | |
} | |
}), fe.fn.size = function() { | |
return this.length | |
}, fe.fn.andSelf = fe.fn.addBack, "function" == typeof define && define.amd && define("jquery", [], function() { | |
return fe | |
}); | |
var hn = e.jQuery, | |
gn = e.$; | |
return fe.noConflict = function(t) { | |
return e.$ === fe && (e.$ = gn), t && e.jQuery === fe && (e.jQuery = hn), fe | |
}, t || (e.jQuery = e.$ = fe), fe | |
}), function(e, t) { | |
"use strict"; | |
e.rails !== t && e.error("jquery-ujs has already been loaded!"); | |
var n, i = e(document); | |
e.rails = n = { | |
linkClickSelector: "a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]", | |
buttonClickSelector: "button[data-remote]:not([form]):not(form button), button[data-confirm]:not([form]):not(form button)", | |
inputChangeSelector: "select[data-remote], input[data-remote], textarea[data-remote]", | |
formSubmitSelector: "form", | |
formInputClickSelector: "form input[type=submit], form input[type=image], form button[type=submit], form button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])", | |
disableSelector: "input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled", | |
enableSelector: "input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled", | |
requiredInputSelector: "input[name][required]:not([disabled]), textarea[name][required]:not([disabled])", | |
fileInputSelector: "input[name][type=file]:not([disabled])", | |
linkDisableSelector: "a[data-disable-with], a[data-disable]", | |
buttonDisableSelector: "button[data-remote][data-disable-with], button[data-remote][data-disable]", | |
csrfToken: function() { | |
return e("meta[name=csrf-token]").attr("content") | |
}, | |
csrfParam: function() { | |
return e("meta[name=csrf-param]").attr("content") | |
}, | |
CSRFProtection: function(e) { | |
var t = n.csrfToken(); | |
t && e.setRequestHeader("X-CSRF-Token", t) | |
}, | |
refreshCSRFTokens: function() { | |
e('form input[name="' + n.csrfParam() + '"]').val(n.csrfToken()) | |
}, | |
fire: function(t, n, i) { | |
var o = e.Event(n); | |
return t.trigger(o, i), o.result !== !1 | |
}, | |
confirm: function(e) { | |
return confirm(e) | |
}, | |
ajax: function(t) { | |
return e.ajax(t) | |
}, | |
href: function(e) { | |
return e[0].href | |
}, | |
isRemote: function(e) { | |
return e.data("remote") !== t && e.data("remote") !== !1 | |
}, | |
handleRemote: function(i) { | |
var o, s, a, r, l, u; | |
if (n.fire(i, "ajax:before")) { | |
if (r = i.data("with-credentials") || null, l = i.data("type") || e.ajaxSettings && e.ajaxSettings.dataType, i.is("form")) { | |
o = i.data("ujs:submit-button-formmethod") || i.attr("method"), s = i.data("ujs:submit-button-formaction") || i.attr("action"), a = e(i[0]).serializeArray(); | |
var c = i.data("ujs:submit-button"); | |
c && (a.push(c), i.data("ujs:submit-button", null)), i.data("ujs:submit-button-formmethod", null), i.data("ujs:submit-button-formaction", null) | |
} else i.is(n.inputChangeSelector) ? (o = i.data("method"), s = i.data("url"), a = i.serialize(), i.data("params") && (a = a + "&" + i.data("params"))) : i.is(n.buttonClickSelector) ? (o = i.data("method") || "get", s = i.data("url"), a = i.serialize(), i.data("params") && (a = a + "&" + i.data("params"))) : (o = i.data("method"), s = n.href(i), a = i.data("params") || null); | |
return u = { | |
type: o || "GET", | |
data: a, | |
dataType: l, | |
beforeSend: function(e, o) { | |
return o.dataType === t && e.setRequestHeader("accept", "*/*;q=0.5, " + o.accepts.script), !!n.fire(i, "ajax:beforeSend", [e, o]) && void i.trigger("ajax:send", e) | |
}, | |
success: function(e, t, n) { | |
i.trigger("ajax:success", [e, t, n]) | |
}, | |
complete: function(e, t) { | |
i.trigger("ajax:complete", [e, t]) | |
}, | |
error: function(e, t, n) { | |
i.trigger("ajax:error", [e, t, n]) | |
}, | |
crossDomain: n.isCrossDomain(s) | |
}, r && (u.xhrFields = { | |
withCredentials: r | |
}), s && (u.url = s), n.ajax(u) | |
} | |
return !1 | |
}, | |
isCrossDomain: function(e) { | |
var t = document.createElement("a"); | |
t.href = location.href; | |
var n = document.createElement("a"); | |
try { | |
return n.href = e, n.href = n.href, !((!n.protocol || ":" === n.protocol) && !n.host || t.protocol + "//" + t.host == n.protocol + "//" + n.host) | |
} catch (e) { | |
return !0 | |
} | |
}, | |
handleMethod: function(i) { | |
var o = n.href(i), | |
s = i.data("method"), | |
a = i.attr("target"), | |
r = n.csrfToken(), | |
l = n.csrfParam(), | |
u = e('<form method="post" action="' + o + '"></form>'), | |
c = '<input name="_method" value="' + s + '" type="hidden" />'; | |
l === t || r === t || n.isCrossDomain(o) || (c += '<input name="' + l + '" value="' + r + '" type="hidden" />'), a && u.attr("target", a), u.hide().append(c).appendTo("body"), u.submit() | |
}, | |
formElements: function(t, n) { | |
return t.is("form") ? e(t[0].elements).filter(n) : t.find(n) | |
}, | |
disableFormElements: function(t) { | |
n.formElements(t, n.disableSelector).each(function() { | |
n.disableFormElement(e(this)) | |
}) | |
}, | |
disableFormElement: function(e) { | |
var n, i; | |
n = e.is("button") ? "html" : "val", i = e.data("disable-with"), i !== t && (e.data("ujs:enable-with", e[n]()), e[n](i)), e.prop("disabled", !0), e.data("ujs:disabled", !0) | |
}, | |
enableFormElements: function(t) { | |
n.formElements(t, n.enableSelector).each(function() { | |
n.enableFormElement(e(this)) | |
}) | |
}, | |
enableFormElement: function(e) { | |
var n = e.is("button") ? "html" : "val"; | |
e.data("ujs:enable-with") !== t && (e[n](e.data("ujs:enable-with")), e.removeData("ujs:enable-with")), e.prop("disabled", !1), e.removeData("ujs:disabled") | |
}, | |
allowAction: function(e) { | |
var t, i = e.data("confirm"), | |
o = !1; | |
if (!i) return !0; | |
if (n.fire(e, "confirm")) { | |
try { | |
o = n.confirm(i) | |
} catch (e) { | |
(console.error || console.log).call(console, e.stack || e) | |
} | |
t = n.fire(e, "confirm:complete", [o]) | |
} | |
return o && t | |
}, | |
blankInputs: function(t, n, i) { | |
var o, s, a, r, l = e(), | |
u = n || "input,textarea", | |
c = t.find(u), | |
d = {}; | |
return c.each(function() { | |
o = e(this), o.is("input[type=radio]") ? (r = o.attr("name"), d[r] || (0 === t.find('input[type=radio]:checked[name="' + r + '"]').length && (a = t.find('input[type=radio][name="' + r + '"]'), l = l.add(a)), d[r] = r)) : (s = o.is("input[type=checkbox],input[type=radio]") ? o.is(":checked") : !!o.val(), s === i && (l = l.add(o))) | |
}), !!l.length && l | |
}, | |
nonBlankInputs: function(e, t) { | |
return n.blankInputs(e, t, !0) | |
}, | |
stopEverything: function(t) { | |
return e(t.target).trigger("ujs:everythingStopped"), t.stopImmediatePropagation(), !1 | |
}, | |
disableElement: function(e) { | |
var i = e.data("disable-with"); | |
i !== t && (e.data("ujs:enable-with", e.html()), e.html(i)), e.bind("click.railsDisable", function(e) { | |
return n.stopEverything(e) | |
}), e.data("ujs:disabled", !0) | |
}, | |
enableElement: function(e) { | |
e.data("ujs:enable-with") !== t && (e.html(e.data("ujs:enable-with")), e.removeData("ujs:enable-with")), e.unbind("click.railsDisable"), e.removeData("ujs:disabled") | |
} | |
}, n.fire(i, "rails:attachBindings") && (e.ajaxPrefilter(function(e, t, i) { | |
e.crossDomain || n.CSRFProtection(i) | |
}), e(window).on("pageshow.rails", function() { | |
e(e.rails.enableSelector).each(function() { | |
var t = e(this); | |
t.data("ujs:disabled") && e.rails.enableFormElement(t) | |
}), e(e.rails.linkDisableSelector).each(function() { | |
var t = e(this); | |
t.data("ujs:disabled") && e.rails.enableElement(t) | |
}) | |
}), i.on("ajax:complete", n.linkDisableSelector, function() { | |
n.enableElement(e(this)) | |
}), i.on("ajax:complete", n.buttonDisableSelector, function() { | |
n.enableFormElement(e(this)) | |
}), i.on("click.rails", n.linkClickSelector, function(t) { | |
var i = e(this), | |
o = i.data("method"), | |
s = i.data("params"), | |
a = t.metaKey || t.ctrlKey; | |
if (!n.allowAction(i)) return n.stopEverything(t); | |
if (!a && i.is(n.linkDisableSelector) && n.disableElement(i), n.isRemote(i)) { | |
if (a && (!o || "GET" === o) && !s) return !0; | |
var r = n.handleRemote(i); | |
return r === !1 ? n.enableElement(i) : r.fail(function() { | |
n.enableElement(i) | |
}), !1 | |
} | |
return o ? (n.handleMethod(i), !1) : void 0 | |
}), i.on("click.rails", n.buttonClickSelector, function(t) { | |
var i = e(this); | |
if (!n.allowAction(i) || !n.isRemote(i)) return n.stopEverything(t); | |
i.is(n.buttonDisableSelector) && n.disableFormElement(i); | |
var o = n.handleRemote(i); | |
return o === !1 ? n.enableFormElement(i) : o.fail(function() { | |
n.enableFormElement(i) | |
}), !1 | |
}), i.on("change.rails", n.inputChangeSelector, function(t) { | |
var i = e(this); | |
return n.allowAction(i) && n.isRemote(i) ? (n.handleRemote(i), !1) : n.stopEverything(t) | |
}), i.on("submit.rails", n.formSubmitSelector, function(i) { | |
var o, s, a = e(this), | |
r = n.isRemote(a); | |
if (!n.allowAction(a)) return n.stopEverything(i); | |
if (a.attr("novalidate") === t) | |
if (a.data("ujs:formnovalidate-button") === t) { | |
if (o = n.blankInputs(a, n.requiredInputSelector, !1), o && n.fire(a, "ajax:aborted:required", [o])) return n.stopEverything(i) | |
} else a.data("ujs:formnovalidate-button", t); | |
if (r) { | |
if (s = n.nonBlankInputs(a, n.fileInputSelector)) { | |
setTimeout(function() { | |
n.disableFormElements(a) | |
}, 13); | |
var l = n.fire(a, "ajax:aborted:file", [s]); | |
return l || setTimeout(function() { | |
n.enableFormElements(a) | |
}, 13), l | |
} | |
return n.handleRemote(a), !1 | |
} | |
setTimeout(function() { | |
n.disableFormElements(a) | |
}, 13) | |
}), i.on("click.rails", n.formInputClickSelector, function(t) { | |
var i = e(this); | |
if (!n.allowAction(i)) return n.stopEverything(t); | |
var o = i.attr("name"), | |
s = o ? { | |
name: o, | |
value: i.val() | |
} : null, | |
a = i.closest("form"); | |
0 === a.length && (a = e("#" + i.attr("form"))), a.data("ujs:submit-button", s), a.data("ujs:formnovalidate-button", i.attr("formnovalidate")), a.data("ujs:submit-button-formaction", i.attr("formaction")), a.data("ujs:submit-button-formmethod", i.attr("formmethod")) | |
}), i.on("ajax:send.rails", n.formSubmitSelector, function(t) { | |
this === t.target && n.disableFormElements(e(this)) | |
}), i.on("ajax:complete.rails", n.formSubmitSelector, function(t) { | |
this === t.target && n.enableFormElements(e(this)) | |
}), e(function() { | |
n.refreshCSRFTokens() | |
})) | |
}(jQuery), function(e) { | |
"function" == typeof define && define.amd ? define(["jquery"], e) : e(jQuery) | |
}(function(e) { | |
function t(t, i) { | |
var o, s, a, r = t.nodeName.toLowerCase(); | |
return "area" === r ? (o = t.parentNode, s = o.name, !(!t.href || !s || "map" !== o.nodeName.toLowerCase()) && (a = e("img[usemap='#" + s + "']")[0], !!a && n(a))) : (/^(input|select|textarea|button|object)$/.test(r) ? !t.disabled : "a" === r ? t.href || i : i) && n(t) | |
} | |
function n(t) { | |
return e.expr.filters.visible(t) && !e(t).parents().addBack().filter(function() { | |
return "hidden" === e.css(this, "visibility") | |
}).length | |
} | |
e.ui = e.ui || {}, e.extend(e.ui, { | |
version: "1.11.4", | |
keyCode: { | |
BACKSPACE: 8, | |
COMMA: 188, | |
DELETE: 46, | |
DOWN: 40, | |
END: 35, | |
ENTER: 13, | |
ESCAPE: 27, | |
HOME: 36, | |
LEFT: 37, | |
PAGE_DOWN: 34, | |
PAGE_UP: 33, | |
PERIOD: 190, | |
RIGHT: 39, | |
SPACE: 32, | |
TAB: 9, | |
UP: 38 | |
} | |
}), e.fn.extend({ | |
scrollParent: function(t) { | |
var n = this.css("position"), | |
i = "absolute" === n, | |
o = t ? /(auto|scroll|hidden)/ : /(auto|scroll)/, | |
s = this.parents().filter(function() { | |
var t = e(this); | |
return (!i || "static" !== t.css("position")) && o.test(t.css("overflow") + t.css("overflow-y") + t.css("overflow-x")) | |
}).eq(0); | |
return "fixed" !== n && s.length ? s : e(this[0].ownerDocument || document) | |
}, | |
uniqueId: function() { | |
var e = 0; | |
return function() { | |
return this.each(function() { | |
this.id || (this.id = "ui-id-" + ++e) | |
}) | |
} | |
}(), | |
removeUniqueId: function() { | |
return this.each(function() { | |
/^ui-id-\d+$/.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, i) { | |
return !!e.data(t, i[3]) | |
}, | |
focusable: function(n) { | |
return t(n, !isNaN(e.attr(n, "tabindex"))) | |
}, | |
tabbable: function(n) { | |
var i = e.attr(n, "tabindex"), | |
o = isNaN(i); | |
return (o || i >= 0) && t(n, !o) | |
} | |
}), e("<a>").outerWidth(1).jquery || e.each(["Width", "Height"], function(t, n) { | |
function i(t, n, i, s) { | |
return e.each(o, function() { | |
n -= parseFloat(e.css(t, "padding" + this)) || 0, i && (n -= parseFloat(e.css(t, "border" + this + "Width")) || 0), s && (n -= parseFloat(e.css(t, "margin" + this)) || 0) | |
}), n | |
} | |
var o = "Width" === n ? ["Left", "Right"] : ["Top", "Bottom"], | |
s = n.toLowerCase(), | |
a = { | |
innerWidth: e.fn.innerWidth, | |
innerHeight: e.fn.innerHeight, | |
outerWidth: e.fn.outerWidth, | |
outerHeight: e.fn.outerHeight | |
}; | |
e.fn["inner" + n] = function(t) { | |
return void 0 === t ? a["inner" + n].call(this) : this.each(function() { | |
e(this).css(s, i(this, t) + "px") | |
}) | |
}, e.fn["outer" + n] = function(t, o) { | |
return "number" != typeof t ? a["outer" + n].call(this, t) : this.each(function() { | |
e(this).css(s, i(this, t, !0, o) + "px") | |
}) | |
} | |
}), e.fn.addBack || (e.fn.addBack = function(e) { | |
return this.add(null == e ? this.prevObject : this.prevObject.filter(e)) | |
}), 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)), e.ui.ie = !!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase()), e.fn.extend({ | |
focus: function(t) { | |
return function(n, i) { | |
return "number" == typeof n ? this.each(function() { | |
var t = this; | |
setTimeout(function() { | |
e(t).focus(), i && i.call(t) | |
}, n) | |
}) : t.apply(this, arguments) | |
} | |
}(e.fn.focus), | |
disableSelection: function() { | |
var e = "onselectstart" in document.createElement("div") ? "selectstart" : "mousedown"; | |
return function() { | |
return this.bind(e + ".ui-disableSelection", function(e) { | |
e.preventDefault() | |
}) | |
} | |
}(), | |
enableSelection: function() { | |
return this.unbind(".ui-disableSelection") | |
}, | |
zIndex: function(t) { | |
if (void 0 !== t) return this.css("zIndex", t); | |
if (this.length) | |
for (var n, i, o = e(this[0]); o.length && o[0] !== document;) { | |
if (n = o.css("position"), ("absolute" === n || "relative" === n || "fixed" === n) && (i = parseInt(o.css("zIndex"), 10), !isNaN(i) && 0 !== i)) return i; | |
o = o.parent() | |
} | |
return 0 | |
} | |
}), e.ui.plugin = { | |
add: function(t, n, i) { | |
var o, s = e.ui[t].prototype; | |
for (o in i) s.plugins[o] = s.plugins[o] || [], s.plugins[o].push([n, i[o]]) | |
}, | |
call: function(e, t, n, i) { | |
var o, s = e.plugins[t]; | |
if (s && (i || e.element[0].parentNode && 11 !== e.element[0].parentNode.nodeType)) | |
for (o = 0; s.length > o; o++) e.options[s[o][0]] && s[o][1].apply(e.element, n) | |
} | |
}; | |
var i = 0, | |
o = Array.prototype.slice; | |
e.cleanData = function(t) { | |
return function(n) { | |
var i, o, s; | |
for (s = 0; null != (o = n[s]); s++) try { | |
i = e._data(o, "events"), i && i.remove && e(o).triggerHandler("remove") | |
} catch (e) {} | |
t(n) | |
} | |
}(e.cleanData), e.widget = function(t, n, i) { | |
var o, s, a, r, l = {}, | |
u = t.split(".")[0]; | |
return t = t.split(".")[1], o = u + "-" + t, i || (i = n, n = e.Widget), e.expr[":"][o.toLowerCase()] = function(t) { | |
return !!e.data(t, o) | |
}, e[u] = e[u] || {}, s = e[u][t], a = e[u][t] = function(e, t) { | |
return this._createWidget ? void(arguments.length && this._createWidget(e, t)) : new a(e, t) | |
}, e.extend(a, s, { | |
version: i.version, | |
_proto: e.extend({}, i), | |
_childConstructors: [] | |
}), r = new n, r.options = e.widget.extend({}, r.options), e.each(i, function(t, i) { | |
return e.isFunction(i) ? void(l[t] = function() { | |
var e = function() { | |
return n.prototype[t].apply(this, arguments) | |
}, | |
o = function(e) { | |
return n.prototype[t].apply(this, e) | |
}; | |
return function() { | |
var t, n = this._super, | |
s = this._superApply; | |
return this._super = e, this._superApply = o, t = i.apply(this, arguments), this._super = n, this._superApply = s, t | |
} | |
}()) : void(l[t] = i) | |
}), a.prototype = e.widget.extend(r, { | |
widgetEventPrefix: s ? r.widgetEventPrefix || t : t | |
}, l, { | |
constructor: a, | |
namespace: u, | |
widgetName: t, | |
widgetFullName: o | |
}), s ? (e.each(s._childConstructors, function(t, n) { | |
var i = n.prototype; | |
e.widget(i.namespace + "." + i.widgetName, a, n._proto) | |
}), delete s._childConstructors) : n._childConstructors.push(a), e.widget.bridge(t, a), a | |
}, e.widget.extend = function(t) { | |
for (var n, i, s = o.call(arguments, 1), a = 0, r = s.length; r > a; a++) | |
for (n in s[a]) i = s[a][n], s[a].hasOwnProperty(n) && void 0 !== i && (t[n] = e.isPlainObject(i) ? e.isPlainObject(t[n]) ? e.widget.extend({}, t[n], i) : e.widget.extend({}, i) : i); | |
return t | |
}, e.widget.bridge = function(t, n) { | |
var i = n.prototype.widgetFullName || t; | |
e.fn[t] = function(s) { | |
var a = "string" == typeof s, | |
r = o.call(arguments, 1), | |
l = this; | |
return a ? this.each(function() { | |
var n, o = e.data(this, i); | |
return "instance" === s ? (l = o, !1) : o ? e.isFunction(o[s]) && "_" !== s.charAt(0) ? (n = o[s].apply(o, r), n !== o && void 0 !== n ? (l = n && n.jquery ? l.pushStack(n.get()) : n, !1) : void 0) : e.error("no such method '" + s + "' for " + t + " widget instance") : e.error("cannot call methods on " + t + " prior to initialization; attempted to call method '" + s + "'") | |
}) : (r.length && (s = e.widget.extend.apply(null, [s].concat(r))), this.each(function() { | |
var t = e.data(this, i); | |
t ? (t.option(s || {}), t._init && t._init()) : e.data(this, i, new n(s, this)) | |
})), l | |
} | |
}, e.Widget = function() {}, e.Widget._childConstructors = [], e.Widget.prototype = { | |
widgetName: "widget", | |
widgetEventPrefix: "", | |
defaultElement: "<div>", | |
options: { | |
disabled: !1, | |
create: null | |
}, | |
_createWidget: function(t, n) { | |
n = e(n || this.defaultElement || this)[0], this.element = e(n), this.uuid = i++, this.eventNamespace = "." + this.widgetName + this.uuid, this.bindings = e(), this.hoverable = e(), this.focusable = e(), n !== this && (e.data(n, this.widgetFullName, this), this._on(!0, this.element, { | |
remove: function(e) { | |
e.target === n && this.destroy() | |
} | |
}), this.document = e(n.style ? n.ownerDocument : n.document || n), this.window = e(this.document[0].defaultView || this.document[0].parentWindow)), this.options = e.widget.extend({}, this.options, this._getCreateOptions(), t), 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.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(t, n) { | |
var i, o, s, a = t; | |
if (0 === arguments.length) return e.widget.extend({}, this.options); | |
if ("string" == typeof t) | |
if (a = {}, i = t.split("."), t = i.shift(), i.length) { | |
for (o = a[t] = e.widget.extend({}, this.options[t]), s = 0; i.length - 1 > s; s++) o[i[s]] = o[i[s]] || {}, o = o[i[s]]; | |
if (t = i.pop(), 1 === arguments.length) return void 0 === o[t] ? null : o[t]; | |
o[t] = n | |
} else { | |
if (1 === arguments.length) return void 0 === this.options[t] ? null : this.options[t]; | |
a[t] = n | |
} | |
return this._setOptions(a), 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, "disabled" === e && (this.widget().toggleClass(this.widgetFullName + "-disabled", !!t), t && (this.hoverable.removeClass("ui-state-hover"), this.focusable.removeClass("ui-state-focus"))), this | |
}, | |
enable: function() { | |
return this._setOptions({ | |
disabled: !1 | |
}) | |
}, | |
disable: function() { | |
return this._setOptions({ | |
disabled: !0 | |
}) | |
}, | |
_on: function(t, n, i) { | |
var o, s = this; | |
"boolean" != typeof t && (i = n, n = t, t = !1), i ? (n = o = e(n), this.bindings = this.bindings.add(n)) : (i = n, n = this.element, o = this.widget()), e.each(i, function(i, a) { | |
function r() { | |
return t || s.options.disabled !== !0 && !e(this).hasClass("ui-state-disabled") ? ("string" == typeof a ? s[a] : a).apply(s, arguments) : void 0 | |
} | |
"string" != typeof a && (r.guid = a.guid = a.guid || r.guid || e.guid++); | |
var l = i.match(/^([\w:-]*)\s*(.*)$/), | |
u = l[1] + s.eventNamespace, | |
c = l[2]; | |
c ? o.delegate(c, u, r) : n.bind(u, r) | |
}) | |
}, | |
_off: function(t, n) { | |
n = (n || "").split(" ").join(this.eventNamespace + " ") + this.eventNamespace, t.unbind(n).undelegate(n), this.bindings = e(this.bindings.not(t).get()), this.focusable = e(this.focusable.not(t).get()), this.hoverable = e(this.hoverable.not(t).get()) | |
}, | |
_delay: function(e, t) { | |
function n() { | |
return ("string" == typeof e ? i[e] : e).apply(i, arguments) | |
} | |
var i = 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, i) { | |
var o, s, a = this.options[t]; | |
if (i = i || {}, n = e.Event(n), n.type = (t === this.widgetEventPrefix ? t : this.widgetEventPrefix + t).toLowerCase(), n.target = this.element[0], s = n.originalEvent) | |
for (o in s) o in n || (n[o] = s[o]); | |
return this.element.trigger(n, i), !(e.isFunction(a) && a.apply(this.element[0], [n].concat(i)) === !1 || n.isDefaultPrevented()) | |
} | |
}, e.each({ | |
show: "fadeIn", | |
hide: "fadeOut" | |
}, function(t, n) { | |
e.Widget.prototype["_" + t] = function(i, o, s) { | |
"string" == typeof o && (o = { | |
effect: o | |
}); | |
var a, r = o ? o === !0 || "number" == typeof o ? n : o.effect || n : t; | |
o = o || {}, "number" == typeof o && (o = { | |
duration: o | |
}), a = !e.isEmptyObject(o), o.complete = s, o.delay && i.delay(o.delay), a && e.effects && e.effects.effect[r] ? i[t](o) : r !== t && i[r] ? i[r](o.duration, o.easing, s) : i.queue(function(n) { | |
e(this)[t](), s && s.call(i[0]), n() | |
}) | |
} | |
}), e.widget; | |
var s = !1; | |
e(document).mouseup(function() { | |
s = !1 | |
}), e.widget("ui.mouse", { | |
version: "1.11.4", | |
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) { | |
return !0 === e.data(n.target, t.widgetName + ".preventClickEvent") ? (e.removeData(n.target, t.widgetName + ".preventClickEvent"), n.stopImmediatePropagation(), !1) : void 0 | |
}), this.started = !1 | |
}, | |
_mouseDestroy: function() { | |
this.element.unbind("." + this.widgetName), this._mouseMoveDelegate && this.document.unbind("mousemove." + this.widgetName, this._mouseMoveDelegate).unbind("mouseup." + this.widgetName, this._mouseUpDelegate) | |
}, | |
_mouseDown: function(t) { | |
if (!s) { | |
this._mouseMoved = !1, this._mouseStarted && this._mouseUp(t), this._mouseDownEvent = t; | |
var n = this, | |
i = 1 === t.which, | |
o = !("string" != typeof this.options.cancel || !t.target.nodeName) && e(t.target).closest(this.options.cancel).length; | |
return !(i && !o && this._mouseCapture(t)) || (this.mouseDelayMet = !this.options.delay, this.mouseDelayMet || (this._mouseDelayTimer = setTimeout(function() { | |
n.mouseDelayMet = !0 | |
}, this.options.delay)), this._mouseDistanceMet(t) && this._mouseDelayMet(t) && (this._mouseStarted = this._mouseStart(t) !== !1, !this._mouseStarted) ? (t.preventDefault(), !0) : (!0 === e.data(t.target, this.widgetName + ".preventClickEvent") && e.removeData(t.target, this.widgetName + ".preventClickEvent"), this._mouseMoveDelegate = function(e) { | |
return n._mouseMove(e) | |
}, this._mouseUpDelegate = function(e) { | |
return n._mouseUp(e) | |
}, this.document.bind("mousemove." + this.widgetName, this._mouseMoveDelegate).bind("mouseup." + this.widgetName, this._mouseUpDelegate), t.preventDefault(), s = !0, !0)) | |
} | |
}, | |
_mouseMove: function(t) { | |
if (this._mouseMoved) { | |
if (e.ui.ie && (!document.documentMode || 9 > document.documentMode) && !t.button) return this._mouseUp(t); | |
if (!t.which) return this._mouseUp(t) | |
} | |
return (t.which || t.button) && (this._mouseMoved = !0), 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) | |
}, | |
_mouseUp: function(t) { | |
return this.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)), s = !1, !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() { | |
return this.mouseDelayMet | |
}, | |
_mouseStart: function() {}, | |
_mouseDrag: function() {}, | |
_mouseStop: function() {}, | |
_mouseCapture: function() { | |
return !0 | |
} | |
}), | |
function() { | |
function t(e, t, n) { | |
return [parseFloat(e[0]) * (f.test(e[0]) ? t / 100 : 1), parseFloat(e[1]) * (f.test(e[1]) ? n / 100 : 1)] | |
} | |
function n(t, n) { | |
return parseInt(e.css(t, n), 10) || 0 | |
} | |
function i(t) { | |
var n = t[0]; | |
return 9 === n.nodeType ? { | |
width: t.width(), | |
height: t.height(), | |
offset: { | |
top: 0, | |
left: 0 | |
} | |
} : e.isWindow(n) ? { | |
width: t.width(), | |
height: t.height(), | |
offset: { | |
top: t.scrollTop(), | |
left: t.scrollLeft() | |
} | |
} : n.preventDefault ? { | |
width: 0, | |
height: 0, | |
offset: { | |
top: n.pageY, | |
left: n.pageX | |
} | |
} : { | |
width: t.outerWidth(), | |
height: t.outerHeight(), | |
offset: t.offset() | |
} | |
} | |
e.ui = e.ui || {}; | |
var o, s, a = Math.max, | |
r = Math.abs, | |
l = Math.round, | |
u = /left|center|right/, | |
c = /top|center|bottom/, | |
d = /[\+\-]\d+(\.[\d]+)?%?/, | |
p = /^\w+/, | |
f = /%$/, | |
h = e.fn.position; | |
e.position = { | |
scrollbarWidth: function() { | |
if (void 0 !== o) return o; | |
var t, n, i = e("<div style='display:block;position:absolute;width:50px;height:50px;overflow:hidden;'><div style='height:100px;width:auto;'></div></div>"), | |
s = i.children()[0]; | |
return e("body").append(i), t = s.offsetWidth, i.css("overflow", "scroll"), n = s.offsetWidth, t === n && (n = i[0].clientWidth), i.remove(), o = t - n | |
}, | |
getScrollInfo: function(t) { | |
var n = t.isWindow || t.isDocument ? "" : t.element.css("overflow-x"), | |
i = t.isWindow || t.isDocument ? "" : t.element.css("overflow-y"), | |
o = "scroll" === n || "auto" === n && t.width < t.element[0].scrollWidth, | |
s = "scroll" === i || "auto" === i && t.height < t.element[0].scrollHeight; | |
return { | |
width: s ? e.position.scrollbarWidth() : 0, | |
height: o ? e.position.scrollbarWidth() : 0 | |
} | |
}, | |
getWithinInfo: function(t) { | |
var n = e(t || window), | |
i = e.isWindow(n[0]), | |
o = !!n[0] && 9 === n[0].nodeType; | |
return { | |
element: n, | |
isWindow: i, | |
isDocument: o, | |
offset: n.offset() || { | |
left: 0, | |
top: 0 | |
}, | |
scrollLeft: n.scrollLeft(), | |
scrollTop: n.scrollTop(), | |
width: i || o ? n.width() : n.outerWidth(), | |
height: i || o ? n.height() : n.outerHeight() | |
} | |
} | |
}, e.fn.position = function(o) { | |
if (!o || !o.of) return h.apply(this, arguments); | |
o = e.extend({}, o); | |
var f, g, m, v, b, y, _ = e(o.of), | |
w = e.position.getWithinInfo(o.within), | |
x = e.position.getScrollInfo(w), | |
T = (o.collision || "flip").split(" "), | |
S = {}; | |
return y = i(_), _[0].preventDefault && (o.at = "left top"), g = y.width, m = y.height, v = y.offset, b = e.extend({}, v), e.each(["my", "at"], function() { | |
var e, t, n = (o[this] || "").split(" "); | |
1 === n.length && (n = u.test(n[0]) ? n.concat(["center"]) : c.test(n[0]) ? ["center"].concat(n) : ["center", "center"]), n[0] = u.test(n[0]) ? n[0] : "center", n[1] = c.test(n[1]) ? n[1] : "center", e = d.exec(n[0]), t = d.exec(n[1]), S[this] = [e ? e[0] : 0, t ? t[0] : 0], o[this] = [p.exec(n[0])[0], p.exec(n[1])[0]] | |
}), 1 === T.length && (T[1] = T[0]), "right" === o.at[0] ? b.left += g : "center" === o.at[0] && (b.left += g / 2), "bottom" === o.at[1] ? b.top += m : "center" === o.at[1] && (b.top += m / 2), f = t(S.at, g, m), b.left += f[0], b.top += f[1], this.each(function() { | |
var i, u, c = e(this), | |
d = c.outerWidth(), | |
p = c.outerHeight(), | |
h = n(this, "marginLeft"), | |
y = n(this, "marginTop"), | |
C = d + h + n(this, "marginRight") + x.width, | |
$ = p + y + n(this, "marginBottom") + x.height, | |
k = e.extend({}, b), | |
P = t(S.my, c.outerWidth(), c.outerHeight()); | |
"right" === o.my[0] ? k.left -= d : "center" === o.my[0] && (k.left -= d / 2), "bottom" === o.my[1] ? k.top -= p : "center" === o.my[1] && (k.top -= p / 2), k.left += P[0], k.top += P[1], s || (k.left = l(k.left), k.top = l(k.top)), i = { | |
marginLeft: h, | |
marginTop: y | |
}, e.each(["left", "top"], function(t, n) { | |
e.ui.position[T[t]] && e.ui.position[T[t]][n](k, { | |
targetWidth: g, | |
targetHeight: m, | |
elemWidth: d, | |
elemHeight: p, | |
collisionPosition: i, | |
collisionWidth: C, | |
collisionHeight: $, | |
offset: [f[0] + P[0], f[1] + P[1]], | |
my: o.my, | |
at: o.at, | |
within: w, | |
elem: c | |
}) | |
}), o.using && (u = function(e) { | |
var t = v.left - k.left, | |
n = t + g - d, | |
i = v.top - k.top, | |
s = i + m - p, | |
l = { | |
target: { | |
element: _, | |
left: v.left, | |
top: v.top, | |
width: g, | |
height: m | |
}, | |
element: { | |
element: c, | |
left: k.left, | |
top: k.top, | |
width: d, | |
height: p | |
}, | |
horizontal: 0 > n ? "left" : t > 0 ? "right" : "center", | |
vertical: 0 > s ? "top" : i > 0 ? "bottom" : "middle" | |
}; | |
d > g && g > r(t + n) && (l.horizontal = "center"), p > m && m > r(i + s) && (l.vertical = "middle"), l.important = a(r(t), r(n)) > a(r(i), r(s)) ? "horizontal" : "vertical", o.using.call(this, e, l) | |
}), c.offset(e.extend(k, { | |
using: u | |
})) | |
}) | |
}, e.ui.position = { | |
fit: { | |
left: function(e, t) { | |
var n, i = t.within, | |
o = i.isWindow ? i.scrollLeft : i.offset.left, | |
s = i.width, | |
r = e.left - t.collisionPosition.marginLeft, | |
l = o - r, | |
u = r + t.collisionWidth - s - o; | |
t.collisionWidth > s ? l > 0 && 0 >= u ? (n = e.left + l + t.collisionWidth - s - o, e.left += l - n) : e.left = u > 0 && 0 >= l ? o : l > u ? o + s - t.collisionWidth : o : l > 0 ? e.left += l : u > 0 ? e.left -= u : e.left = a(e.left - r, e.left) | |
}, | |
top: function(e, t) { | |
var n, i = t.within, | |
o = i.isWindow ? i.scrollTop : i.offset.top, | |
s = t.within.height, | |
r = e.top - t.collisionPosition.marginTop, | |
l = o - r, | |
u = r + t.collisionHeight - s - o; | |
t.collisionHeight > s ? l > 0 && 0 >= u ? (n = e.top + l + t.collisionHeight - s - o, e.top += l - n) : e.top = u > 0 && 0 >= l ? o : l > u ? o + s - t.collisionHeight : o : l > 0 ? e.top += l : u > 0 ? e.top -= u : e.top = a(e.top - r, e.top) | |
} | |
}, | |
flip: { | |
left: function(e, t) { | |
var n, i, o = t.within, | |
s = o.offset.left + o.scrollLeft, | |
a = o.width, | |
l = o.isWindow ? o.scrollLeft : o.offset.left, | |
u = e.left - t.collisionPosition.marginLeft, | |
c = u - l, | |
d = u + t.collisionWidth - a - l, | |
p = "left" === t.my[0] ? -t.elemWidth : "right" === t.my[0] ? t.elemWidth : 0, | |
f = "left" === t.at[0] ? t.targetWidth : "right" === t.at[0] ? -t.targetWidth : 0, | |
h = -2 * t.offset[0]; | |
0 > c ? (n = e.left + p + f + h + t.collisionWidth - a - s, (0 > n || r(c) > n) && (e.left += p + f + h)) : d > 0 && (i = e.left - t.collisionPosition.marginLeft + p + f + h - l, (i > 0 || d > r(i)) && (e.left += p + f + h)) | |
}, | |
top: function(e, t) { | |
var n, i, o = t.within, | |
s = o.offset.top + o.scrollTop, | |
a = o.height, | |
l = o.isWindow ? o.scrollTop : o.offset.top, | |
u = e.top - t.collisionPosition.marginTop, | |
c = u - l, | |
d = u + t.collisionHeight - a - l, | |
p = "top" === t.my[1], | |
f = p ? -t.elemHeight : "bottom" === t.my[1] ? t.elemHeight : 0, | |
h = "top" === t.at[1] ? t.targetHeight : "bottom" === t.at[1] ? -t.targetHeight : 0, | |
g = -2 * t.offset[1]; | |
0 > c ? (i = e.top + f + h + g + t.collisionHeight - a - s, (0 > i || r(c) > i) && (e.top += f + h + g)) : d > 0 && (n = e.top - t.collisionPosition.marginTop + f + h + g - l, (n > 0 || d > r(n)) && (e.top += f + h + g)) | |
} | |
}, | |
flipfit: { | |
left: function() { | |
e.ui.position.flip.left.apply(this, arguments), e.ui.position.fit.left.apply(this, arguments) | |
}, | |
top: function() { | |
e.ui.position.flip.top.apply(this, arguments), e.ui.position.fit.top.apply(this, arguments) | |
} | |
} | |
}, | |
function() { | |
var t, n, i, o, a, r = document.getElementsByTagName("body")[0], | |
l = document.createElement("div"); | |
t = document.createElement(r ? "div" : "body"), i = { | |
visibility: "hidden", | |
width: 0, | |
height: 0, | |
border: 0, | |
margin: 0, | |
background: "none" | |
}, r && e.extend(i, { | |
position: "absolute", | |
left: "-1000px", | |
top: "-1000px" | |
}); | |
for (a in i) t.style[a] = i[a]; | |
t.appendChild(l), n = r || document.documentElement, n.insertBefore(t, n.firstChild), l.style.cssText = "position: absolute; left: 10.7432222px;", o = e(l).offset().left, s = o > 10 && 11 > o, t.innerHTML = "", n.removeChild(t) | |
}() | |
}(), e.ui.position, e.widget("ui.draggable", e.ui.mouse, { | |
version: "1.11.4", | |
widgetEventPrefix: "drag", | |
options: { | |
addClasses: !0, | |
appendTo: "parent", | |
axis: !1, | |
connectToSortable: !1, | |
containment: !1, | |
cursor: "auto", | |
cursorAt: !1, | |
grid: !1, | |
handle: !1, | |
helper: "original", | |
iframeFix: !1, | |
opacity: !1, | |
refreshPositions: !1, | |
revert: !1, | |
revertDuration: 500, | |
scope: "default", | |
scroll: !0, | |
scrollSensitivity: 20, | |
scrollSpeed: 20, | |
snap: !1, | |
snapMode: "both", | |
snapTolerance: 20, | |
stack: !1, | |
zIndex: !1, | |
drag: null, | |
start: null, | |
stop: null | |
}, | |
_create: function() { | |
"original" === this.options.helper && this._setPositionRelative(), this.options.addClasses && this.element.addClass("ui-draggable"), this.options.disabled && this.element.addClass("ui-draggable-disabled"), this._setHandleClassName(), this._mouseInit() | |
}, | |
_setOption: function(e, t) { | |
this._super(e, t), "handle" === e && (this._removeHandleClassName(), this._setHandleClassName()) | |
}, | |
_destroy: function() { | |
return (this.helper || this.element).is(".ui-draggable-dragging") ? void(this.destroyOnClear = !0) : (this.element.removeClass("ui-draggable ui-draggable-dragging ui-draggable-disabled"), this._removeHandleClassName(), void this._mouseDestroy()) | |
}, | |
_mouseCapture: function(t) { | |
var n = this.options; | |
return this._blurActiveElement(t), !(this.helper || n.disabled || e(t.target).closest(".ui-resizable-handle").length > 0) && (this.handle = this._getHandle(t), !!this.handle && (this._blockFrames(n.iframeFix === !0 ? "iframe" : n.iframeFix), !0)) | |
}, | |
_blockFrames: function(t) { | |
this.iframeBlocks = this.document.find(t).map(function() { | |
var t = e(this); | |
return e("<div>").css("position", "absolute").appendTo(t.parent()).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).offset(t.offset())[0] | |
}) | |
}, | |
_unblockFrames: function() { | |
this.iframeBlocks && (this.iframeBlocks.remove(), delete this.iframeBlocks) | |
}, | |
_blurActiveElement: function(t) { | |
var n = this.document[0]; | |
if (this.handleElement.is(t.target)) try { | |
n.activeElement && "body" !== n.activeElement.nodeName.toLowerCase() && e(n.activeElement).blur() | |
} catch (e) {} | |
}, | |
_mouseStart: function(t) { | |
var n = this.options; | |
return this.helper = this._createHelper(t), this.helper.addClass("ui-draggable-dragging"), this._cacheHelperProportions(), e.ui.ddmanager && (e.ui.ddmanager.current = this), this._cacheMargins(), this.cssPosition = this.helper.css("position"), this.scrollParent = this.helper.scrollParent(!0), this.offsetParent = this.helper.offsetParent(), this.hasFixedAncestor = this.helper.parents().filter(function() { | |
return "fixed" === e(this).css("position") | |
}).length > 0, this.positionAbs = this.element.offset(), this._refreshOffsets(t), this.originalPosition = this.position = this._generatePosition(t, !1), this.originalPageX = t.pageX, this.originalPageY = t.pageY, n.cursorAt && this._adjustOffsetFromHelper(n.cursorAt), this._setContainment(), this._trigger("start", t) === !1 ? (this._clear(), !1) : (this._cacheHelperProportions(), e.ui.ddmanager && !n.dropBehaviour && e.ui.ddmanager.prepareOffsets(this, t), this._normalizeRightBottom(), this._mouseDrag(t, !0), e.ui.ddmanager && e.ui.ddmanager.dragStart(this, t), !0) | |
}, | |
_refreshOffsets: function(e) { | |
this.offset = { | |
top: this.positionAbs.top - this.margins.top, | |
left: this.positionAbs.left - this.margins.left, | |
scroll: !1, | |
parent: this._getParentOffset(), | |
relative: this._getRelativeOffset() | |
}, this.offset.click = { | |
left: e.pageX - this.offset.left, | |
top: e.pageY - this.offset.top | |
} | |
}, | |
_mouseDrag: function(t, n) { | |
if (this.hasFixedAncestor && (this.offset.parent = this._getParentOffset()), this.position = this._generatePosition(t, !0), this.positionAbs = this._convertPositionTo("absolute"), !n) { | |
var i = this._uiHash(); | |
if (this._trigger("drag", t, i) === !1) return this._mouseUp({}), !1; | |
this.position = i.position | |
} | |
return this.helper[0].style.left = this.position.left + "px", this.helper[0].style.top = this.position.top + "px", e.ui.ddmanager && e.ui.ddmanager.drag(this, t), !1 | |
}, | |
_mouseStop: function(t) { | |
var n = this, | |
i = !1; | |
return e.ui.ddmanager && !this.options.dropBehaviour && (i = e.ui.ddmanager.drop(this, t)), this.dropped && (i = this.dropped, this.dropped = !1), "invalid" === this.options.revert && !i || "valid" === this.options.revert && i || this.options.revert === !0 || e.isFunction(this.options.revert) && this.options.revert.call(this.element, i) ? e(this.helper).animate(this.originalPosition, parseInt(this.options.revertDuration, 10), function() { | |
n._trigger("stop", t) !== !1 && n._clear() | |
}) : this._trigger("stop", t) !== !1 && this._clear(), !1 | |
}, | |
_mouseUp: function(t) { | |
return this._unblockFrames(), e.ui.ddmanager && e.ui.ddmanager.dragStop(this, t), this.handleElement.is(t.target) && this.element.focus(), e.ui.mouse.prototype._mouseUp.call(this, t) | |
}, | |
cancel: function() { | |
return this.helper.is(".ui-draggable-dragging") ? this._mouseUp({}) : this._clear(), this | |
}, | |
_getHandle: function(t) { | |
return !this.options.handle || !!e(t.target).closest(this.element.find(this.options.handle)).length | |
}, | |
_setHandleClassName: function() { | |
this.handleElement = this.options.handle ? this.element.find(this.options.handle) : this.element, this.handleElement.addClass("ui-draggable-handle") | |
}, | |
_removeHandleClassName: function() { | |
this.handleElement.removeClass("ui-draggable-handle") | |
}, | |
_createHelper: function(t) { | |
var n = this.options, | |
i = e.isFunction(n.helper), | |
o = i ? e(n.helper.apply(this.element[0], [t])) : "clone" === n.helper ? this.element.clone().removeAttr("id") : this.element; | |
return o.parents("body").length || o.appendTo("parent" === n.appendTo ? this.element[0].parentNode : n.appendTo), i && o[0] === this.element[0] && this._setPositionRelative(), o[0] === this.element[0] || /(fixed|absolute)/.test(o.css("position")) || o.css("position", "absolute"), o | |
}, | |
_setPositionRelative: function() { | |
/^(?:r|a|f)/.test(this.element.css("position")) || (this.element[0].style.position = "relative") | |
}, | |
_adjustOffsetFromHelper: function(t) { | |
"string" == typeof t && (t = t.split(" ")), e.isArray(t) && (t = { | |
left: +t[0], | |
top: +t[1] || 0 | |
}), "left" in t && (this.offset.click.left = t.left + this.margins.left), "right" in t && (this.offset.click.left = this.helperProportions.width - t.right + this.margins.left), "top" in t && (this.offset.click.top = t.top + this.margins.top), "bottom" in t && (this.offset.click.top = this.helperProportions.height - t.bottom + this.margins.top) | |
}, | |
_isRootNode: function(e) { | |
return /(html|body)/i.test(e.tagName) || e === this.document[0] | |
}, | |
_getParentOffset: function() { | |
var t = this.offsetParent.offset(), | |
n = this.document[0]; | |
return "absolute" === this.cssPosition && this.scrollParent[0] !== n && e.contains(this.scrollParent[0], this.offsetParent[0]) && (t.left += this.scrollParent.scrollLeft(), t.top += this.scrollParent.scrollTop()), this._isRootNode(this.offsetParent[0]) && (t = { | |
top: 0, | |
left: 0 | |
}), { | |
top: t.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), | |
left: t.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0) | |
} | |
}, | |
_getRelativeOffset: function() { | |
if ("relative" !== this.cssPosition) return { | |
top: 0, | |
left: 0 | |
}; | |
var e = this.element.position(), | |
t = this._isRootNode(this.scrollParent[0]); | |
return { | |
top: e.top - (parseInt(this.helper.css("top"), 10) || 0) + (t ? 0 : this.scrollParent.scrollTop()), | |
left: e.left - (parseInt(this.helper.css("left"), 10) || 0) + (t ? 0 : this.scrollParent.scrollLeft()) | |
} | |
}, | |
_cacheMargins: function() { | |
this.margins = { | |
left: parseInt(this.element.css("marginLeft"), 10) || 0, | |
top: parseInt(this.element.css("marginTop"), 10) || 0, | |
right: parseInt(this.element.css("marginRight"), 10) || 0, | |
bottom: parseInt(this.element.css("marginBottom"), 10) || 0 | |
} | |
}, | |
_cacheHelperProportions: function() { | |
this.helperProportions = { | |
width: this.helper.outerWidth(), | |
height: this.helper.outerHeight() | |
} | |
}, | |
_setContainment: function() { | |
var t, n, i, o = this.options, | |
s = this.document[0]; | |
return this.relativeContainer = null, o.containment ? "window" === o.containment ? void(this.containment = [e(window).scrollLeft() - this.offset.relative.left - this.offset.parent.left, e(window).scrollTop() - this.offset.relative.top - this.offset.parent.top, e(window).scrollLeft() + e(window).width() - this.helperProportions.width - this.margins.left, e(window).scrollTop() + (e(window).height() || s.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top]) : "document" === o.containment ? void(this.containment = [0, 0, e(s).width() - this.helperProportions.width - this.margins.left, (e(s).height() || s.body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top]) : o.containment.constructor === Array ? void(this.containment = o.containment) : ("parent" === o.containment && (o.containment = this.helper[0].parentNode), n = e(o.containment), i = n[0], void(i && (t = /(scroll|auto)/.test(n.css("overflow")), this.containment = [(parseInt(n.css("borderLeftWidth"), 10) || 0) + (parseInt(n.css("paddingLeft"), 10) || 0), (parseInt(n.css("borderTopWidth"), 10) || 0) + (parseInt(n.css("paddingTop"), 10) || 0), (t ? Math.max(i.scrollWidth, i.offsetWidth) : i.offsetWidth) - (parseInt(n.css("borderRightWidth"), 10) || 0) - (parseInt(n.css("paddingRight"), 10) || 0) - this.helperProportions.width - this.margins.left - this.margins.right, (t ? Math.max(i.scrollHeight, i.offsetHeight) : i.offsetHeight) - (parseInt(n.css("borderBottomWidth"), 10) || 0) - (parseInt(n.css("paddingBottom"), 10) || 0) - this.helperProportions.height - this.margins.top - this.margins.bottom], this.relativeContainer = n))) : void(this.containment = null) | |
}, | |
_convertPositionTo: function(e, t) { | |
t || (t = this.position); | |
var n = "absolute" === e ? 1 : -1, | |
i = this._isRootNode(this.scrollParent[0]); | |
return { | |
top: t.top + this.offset.relative.top * n + this.offset.parent.top * n - ("fixed" === this.cssPosition ? -this.offset.scroll.top : i ? 0 : this.offset.scroll.top) * n, | |
left: t.left + this.offset.relative.left * n + this.offset.parent.left * n - ("fixed" === this.cssPosition ? -this.offset.scroll.left : i ? 0 : this.offset.scroll.left) * n | |
} | |
}, | |
_generatePosition: function(e, t) { | |
var n, i, o, s, a = this.options, | |
r = this._isRootNode(this.scrollParent[0]), | |
l = e.pageX, | |
u = e.pageY; | |
return r && this.offset.scroll || (this.offset.scroll = { | |
top: this.scrollParent.scrollTop(), | |
left: this.scrollParent.scrollLeft() | |
}), t && (this.containment && (this.relativeContainer ? (i = this.relativeContainer.offset(), n = [this.containment[0] + i.left, this.containment[1] + i.top, this.containment[2] + i.left, this.containment[3] + i.top]) : n = this.containment, e.pageX - this.offset.click.left < n[0] && (l = n[0] + this.offset.click.left), e.pageY - this.offset.click.top < n[1] && (u = n[1] + this.offset.click.top), e.pageX - this.offset.click.left > n[2] && (l = n[2] + this.offset.click.left), e.pageY - this.offset.click.top > n[3] && (u = n[3] + this.offset.click.top)), a.grid && (o = a.grid[1] ? this.originalPageY + Math.round((u - this.originalPageY) / a.grid[1]) * a.grid[1] : this.originalPageY, u = n ? o - this.offset.click.top >= n[1] || o - this.offset.click.top > n[3] ? o : o - this.offset.click.top >= n[1] ? o - a.grid[1] : o + a.grid[1] : o, s = a.grid[0] ? this.originalPageX + Math.round((l - this.originalPageX) / a.grid[0]) * a.grid[0] : this.originalPageX, l = n ? s - this.offset.click.left >= n[0] || s - this.offset.click.left > n[2] ? s : s - this.offset.click.left >= n[0] ? s - a.grid[0] : s + a.grid[0] : s), "y" === a.axis && (l = this.originalPageX), "x" === a.axis && (u = this.originalPageY)), { | |
top: u - this.offset.click.top - this.offset.relative.top - this.offset.parent.top + ("fixed" === this.cssPosition ? -this.offset.scroll.top : r ? 0 : this.offset.scroll.top), | |
left: l - this.offset.click.left - this.offset.relative.left - this.offset.parent.left + ("fixed" === this.cssPosition ? -this.offset.scroll.left : r ? 0 : this.offset.scroll.left) | |
} | |
}, | |
_clear: function() { | |
this.helper.removeClass("ui-draggable-dragging"), this.helper[0] === this.element[0] || this.cancelHelperRemoval || this.helper.remove(), this.helper = null, this.cancelHelperRemoval = !1, this.destroyOnClear && this.destroy() | |
}, | |
_normalizeRightBottom: function() { | |
"y" !== this.options.axis && "auto" !== this.helper.css("right") && (this.helper.width(this.helper.width()), this.helper.css("right", "auto")), "x" !== this.options.axis && "auto" !== this.helper.css("bottom") && (this.helper.height(this.helper.height()), this.helper.css("bottom", "auto")) | |
}, | |
_trigger: function(t, n, i) { | |
return i = i || this._uiHash(), e.ui.plugin.call(this, t, [n, i, this], !0), /^(drag|start|stop)/.test(t) && (this.positionAbs = this._convertPositionTo("absolute"), i.offset = this.positionAbs), e.Widget.prototype._trigger.call(this, t, n, i) | |
}, | |
plugins: {}, | |
_uiHash: function() { | |
return { | |
helper: this.helper, | |
position: this.position, | |
originalPosition: this.originalPosition, | |
offset: this.positionAbs | |
} | |
} | |
}), e.ui.plugin.add("draggable", "connectToSortable", { | |
start: function(t, n, i) { | |
var o = e.extend({}, n, { | |
item: i.element | |
}); | |
i.sortables = [], e(i.options.connectToSortable).each(function() { | |
var n = e(this).sortable("instance"); | |
n && !n.options.disabled && (i.sortables.push(n), n.refreshPositions(), n._trigger("activate", t, o)) | |
}) | |
}, | |
stop: function(t, n, i) { | |
var o = e.extend({}, n, { | |
item: i.element | |
}); | |
i.cancelHelperRemoval = !1, e.each(i.sortables, function() { | |
var e = this; | |
e.isOver ? (e.isOver = 0, i.cancelHelperRemoval = !0, e.cancelHelperRemoval = !1, e._storedCSS = { | |
position: e.placeholder.css("position"), | |
top: e.placeholder.css("top"), | |
left: e.placeholder.css("left") | |
}, e._mouseStop(t), e.options.helper = e.options._helper) : (e.cancelHelperRemoval = !0, e._trigger("deactivate", t, o)) | |
}) | |
}, | |
drag: function(t, n, i) { | |
e.each(i.sortables, function() { | |
var o = !1, | |
s = this; | |
s.positionAbs = i.positionAbs, s.helperProportions = i.helperProportions, s.offset.click = i.offset.click, s._intersectsWith(s.containerCache) && (o = !0, e.each(i.sortables, function() { | |
return this.positionAbs = i.positionAbs, this.helperProportions = i.helperProportions, this.offset.click = i.offset.click, this !== s && this._intersectsWith(this.containerCache) && e.contains(s.element[0], this.element[0]) && (o = !1), o | |
})), o ? (s.isOver || (s.isOver = 1, i._parent = n.helper.parent(), s.currentItem = n.helper.appendTo(s.element).data("ui-sortable-item", !0), s.options._helper = s.options.helper, s.options.helper = function() { | |
return n.helper[0] | |
}, t.target = s.currentItem[0], s._mouseCapture(t, !0), s._mouseStart(t, !0, !0), s.offset.click.top = i.offset.click.top, s.offset.click.left = i.offset.click.left, s.offset.parent.left -= i.offset.parent.left - s.offset.parent.left, s.offset.parent.top -= i.offset.parent.top - s.offset.parent.top, i._trigger("toSortable", t), i.dropped = s.element, e.each(i.sortables, function() { | |
this.refreshPositions() | |
}), i.currentItem = i.element, s.fromOutside = i), s.currentItem && (s._mouseDrag(t), n.position = s.position)) : s.isOver && (s.isOver = 0, s.cancelHelperRemoval = !0, s.options._revert = s.options.revert, s.options.revert = !1, s._trigger("out", t, s._uiHash(s)), s._mouseStop(t, !0), s.options.revert = s.options._revert, s.options.helper = s.options._helper, s.placeholder && s.placeholder.remove(), n.helper.appendTo(i._parent), i._refreshOffsets(t), n.position = i._generatePosition(t, !0), i._trigger("fromSortable", t), i.dropped = !1, e.each(i.sortables, function() { | |
this.refreshPositions() | |
})) | |
}) | |
} | |
}), e.ui.plugin.add("draggable", "cursor", { | |
start: function(t, n, i) { | |
var o = e("body"), | |
s = i.options; | |
o.css("cursor") && (s._cursor = o.css("cursor")), o.css("cursor", s.cursor) | |
}, | |
stop: function(t, n, i) { | |
var o = i.options; | |
o._cursor && e("body").css("cursor", o._cursor) | |
} | |
}), e.ui.plugin.add("draggable", "opacity", { | |
start: function(t, n, i) { | |
var o = e(n.helper), | |
s = i.options; | |
o.css("opacity") && (s._opacity = o.css("opacity")), o.css("opacity", s.opacity) | |
}, | |
stop: function(t, n, i) { | |
var o = i.options; | |
o._opacity && e(n.helper).css("opacity", o._opacity) | |
} | |
}), e.ui.plugin.add("draggable", "scroll", { | |
start: function(e, t, n) { | |
n.scrollParentNotHidden || (n.scrollParentNotHidden = n.helper.scrollParent(!1)), n.scrollParentNotHidden[0] !== n.document[0] && "HTML" !== n.scrollParentNotHidden[0].tagName && (n.overflowOffset = n.scrollParentNotHidden.offset()) | |
}, | |
drag: function(t, n, i) { | |
var o = i.options, | |
s = !1, | |
a = i.scrollParentNotHidden[0], | |
r = i.document[0]; | |
a !== r && "HTML" !== a.tagName ? (o.axis && "x" === o.axis || (i.overflowOffset.top + a.offsetHeight - t.pageY < o.scrollSensitivity ? a.scrollTop = s = a.scrollTop + o.scrollSpeed : t.pageY - i.overflowOffset.top < o.scrollSensitivity && (a.scrollTop = s = a.scrollTop - o.scrollSpeed)), o.axis && "y" === o.axis || (i.overflowOffset.left + a.offsetWidth - t.pageX < o.scrollSensitivity ? a.scrollLeft = s = a.scrollLeft + o.scrollSpeed : t.pageX - i.overflowOffset.left < o.scrollSensitivity && (a.scrollLeft = s = a.scrollLeft - o.scrollSpeed))) : (o.axis && "x" === o.axis || (t.pageY - e(r).scrollTop() < o.scrollSensitivity ? s = e(r).scrollTop(e(r).scrollTop() - o.scrollSpeed) : e(window).height() - (t.pageY - e(r).scrollTop()) < o.scrollSensitivity && (s = e(r).scrollTop(e(r).scrollTop() + o.scrollSpeed))), o.axis && "y" === o.axis || (t.pageX - e(r).scrollLeft() < o.scrollSensitivity ? s = e(r).scrollLeft(e(r).scrollLeft() - o.scrollSpeed) : e(window).width() - (t.pageX - e(r).scrollLeft()) < o.scrollSensitivity && (s = e(r).scrollLeft(e(r).scrollLeft() + o.scrollSpeed)))), s !== !1 && e.ui.ddmanager && !o.dropBehaviour && e.ui.ddmanager.prepareOffsets(i, t) | |
} | |
}), e.ui.plugin.add("draggable", "snap", { | |
start: function(t, n, i) { | |
var o = i.options; | |
i.snapElements = [], e(o.snap.constructor !== String ? o.snap.items || ":data(ui-draggable)" : o.snap).each(function() { | |
var t = e(this), | |
n = t.offset(); | |
this !== i.element[0] && i.snapElements.push({ | |
item: this, | |
width: t.outerWidth(), | |
height: t.outerHeight(), | |
top: n.top, | |
left: n.left | |
}) | |
}) | |
}, | |
drag: function(t, n, i) { | |
var o, s, a, r, l, u, c, d, p, f, h = i.options, | |
g = h.snapTolerance, | |
m = n.offset.left, | |
v = m + i.helperProportions.width, | |
b = n.offset.top, | |
y = b + i.helperProportions.height; | |
for (p = i.snapElements.length - 1; p >= 0; p--) l = i.snapElements[p].left - i.margins.left, u = l + i.snapElements[p].width, c = i.snapElements[p].top - i.margins.top, d = c + i.snapElements[p].height, l - g > v || m > u + g || c - g > y || b > d + g || !e.contains(i.snapElements[p].item.ownerDocument, i.snapElements[p].item) ? (i.snapElements[p].snapping && i.options.snap.release && i.options.snap.release.call(i.element, t, e.extend(i._uiHash(), { | |
snapItem: i.snapElements[p].item | |
})), i.snapElements[p].snapping = !1) : ("inner" !== h.snapMode && (o = g >= Math.abs(c - y), s = g >= Math.abs(d - b), a = g >= Math.abs(l - v), r = g >= Math.abs(u - m), o && (n.position.top = i._convertPositionTo("relative", { | |
top: c - i.helperProportions.height, | |
left: 0 | |
}).top), s && (n.position.top = i._convertPositionTo("relative", { | |
top: d, | |
left: 0 | |
}).top), a && (n.position.left = i._convertPositionTo("relative", { | |
top: 0, | |
left: l - i.helperProportions.width | |
}).left), r && (n.position.left = i._convertPositionTo("relative", { | |
top: 0, | |
left: u | |
}).left)), f = o || s || a || r, "outer" !== h.snapMode && (o = g >= Math.abs(c - b), s = g >= Math.abs(d - y), a = g >= Math.abs(l - m), r = g >= Math.abs(u - v), o && (n.position.top = i._convertPositionTo("relative", { | |
top: c, | |
left: 0 | |
}).top), s && (n.position.top = i._convertPositionTo("relative", { | |
top: d - i.helperProportions.height, | |
left: 0 | |
}).top), a && (n.position.left = i._convertPositionTo("relative", { | |
top: 0, | |
left: l | |
}).left), r && (n.position.left = i._convertPositionTo("relative", { | |
top: 0, | |
left: u - i.helperProportions.width | |
}).left)), !i.snapElements[p].snapping && (o || s || a || r || f) && i.options.snap.snap && i.options.snap.snap.call(i.element, t, e.extend(i._uiHash(), { | |
snapItem: i.snapElements[p].item | |
})), i.snapElements[p].snapping = o || s || a || r || f) | |
} | |
}), e.ui.plugin.add("draggable", "stack", { | |
start: function(t, n, i) { | |
var o, s = i.options, | |
a = e.makeArray(e(s.stack)).sort(function(t, n) { | |
return (parseInt(e(t).css("zIndex"), 10) || 0) - (parseInt(e(n).css("zIndex"), 10) || 0) | |
}); | |
a.length && (o = parseInt(e(a[0]).css("zIndex"), 10) || 0, e(a).each(function(t) { | |
e(this).css("zIndex", o + t) | |
}), this.css("zIndex", o + a.length)) | |
} | |
}), e.ui.plugin.add("draggable", "zIndex", { | |
start: function(t, n, i) { | |
var o = e(n.helper), | |
s = i.options; | |
o.css("zIndex") && (s._zIndex = o.css("zIndex")), o.css("zIndex", s.zIndex) | |
}, | |
stop: function(t, n, i) { | |
var o = i.options; | |
o._zIndex && e(n.helper).css("zIndex", o._zIndex) | |
} | |
}), e.ui.draggable, e.widget("ui.droppable", { | |
version: "1.11.4", | |
widgetEventPrefix: "drop", | |
options: { | |
accept: "*", | |
activeClass: !1, | |
addClasses: !0, | |
greedy: !1, | |
hoverClass: !1, | |
scope: "default", | |
tolerance: "intersect", | |
activate: null, | |
deactivate: null, | |
drop: null, | |
out: null, | |
over: null | |
}, | |
_create: function() { | |
var t, n = this.options, | |
i = n.accept; | |
this.isover = !1, this.isout = !0, this.accept = e.isFunction(i) ? i : function(e) { | |
return e.is(i) | |
}, this.proportions = function() { | |
return arguments.length ? void(t = arguments[0]) : t ? t : t = { | |
width: this.element[0].offsetWidth, | |
height: this.element[0].offsetHeight | |
} | |
}, this._addToManager(n.scope), n.addClasses && this.element.addClass("ui-droppable") | |
}, | |
_addToManager: function(t) { | |
e.ui.ddmanager.droppables[t] = e.ui.ddmanager.droppables[t] || [], e.ui.ddmanager.droppables[t].push(this) | |
}, | |
_splice: function(e) { | |
for (var t = 0; e.length > t; t++) e[t] === this && e.splice(t, 1) | |
}, | |
_destroy: function() { | |
var t = e.ui.ddmanager.droppables[this.options.scope]; | |
this._splice(t), this.element.removeClass("ui-droppable ui-droppable-disabled") | |
}, | |
_setOption: function(t, n) { | |
if ("accept" === t) this.accept = e.isFunction(n) ? n : function(e) { | |
return e.is(n) | |
}; | |
else if ("scope" === t) { | |
var i = e.ui.ddmanager.droppables[this.options.scope]; | |
this._splice(i), this._addToManager(n) | |
} | |
this._super(t, n) | |
}, | |
_activate: function(t) { | |
var n = e.ui.ddmanager.current; | |
this.options.activeClass && this.element.addClass(this.options.activeClass), n && this._trigger("activate", t, this.ui(n)) | |
}, | |
_deactivate: function(t) { | |
var n = e.ui.ddmanager.current; | |
this.options.activeClass && this.element.removeClass(this.options.activeClass), n && this._trigger("deactivate", t, this.ui(n)) | |
}, | |
_over: function(t) { | |
var n = e.ui.ddmanager.current; | |
n && (n.currentItem || n.element)[0] !== this.element[0] && this.accept.call(this.element[0], n.currentItem || n.element) && (this.options.hoverClass && this.element.addClass(this.options.hoverClass), this._trigger("over", t, this.ui(n))) | |
}, | |
_out: function(t) { | |
var n = e.ui.ddmanager.current; | |
n && (n.currentItem || n.element)[0] !== this.element[0] && this.accept.call(this.element[0], n.currentItem || n.element) && (this.options.hoverClass && this.element.removeClass(this.options.hoverClass), this._trigger("out", t, this.ui(n))) | |
}, | |
_drop: function(t, n) { | |
var i = n || e.ui.ddmanager.current, | |
o = !1; | |
return !(!i || (i.currentItem || i.element)[0] === this.element[0]) && (this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function() { | |
var n = e(this).droppable("instance"); | |
return n.options.greedy && !n.options.disabled && n.options.scope === i.options.scope && n.accept.call(n.element[0], i.currentItem || i.element) && e.ui.intersect(i, e.extend(n, { | |
offset: n.element.offset() | |
}), n.options.tolerance, t) ? (o = !0, !1) : void 0 | |
}), !o && (!!this.accept.call(this.element[0], i.currentItem || i.element) && (this.options.activeClass && this.element.removeClass(this.options.activeClass), this.options.hoverClass && this.element.removeClass(this.options.hoverClass), this._trigger("drop", t, this.ui(i)), this.element))) | |
}, | |
ui: function(e) { | |
return { | |
draggable: e.currentItem || e.element, | |
helper: e.helper, | |
position: e.position, | |
offset: e.positionAbs | |
} | |
} | |
}), e.ui.intersect = function() { | |
function e(e, t, n) { | |
return e >= t && t + n > e | |
} | |
return function(t, n, i, o) { | |
if (!n.offset) return !1; | |
var s = (t.positionAbs || t.position.absolute).left + t.margins.left, | |
a = (t.positionAbs || t.position.absolute).top + t.margins.top, | |
r = s + t.helperProportions.width, | |
l = a + t.helperProportions.height, | |
u = n.offset.left, | |
c = n.offset.top, | |
d = u + n.proportions().width, | |
p = c + n.proportions().height; | |
switch (i) { | |
case "fit": | |
return s >= u && d >= r && a >= c && p >= l; | |
case "intersect": | |
return s + t.helperProportions.width / 2 > u && d > r - t.helperProportions.width / 2 && a + t.helperProportions.height / 2 > c && p > l - t.helperProportions.height / 2; | |
case "pointer": | |
return e(o.pageY, c, n.proportions().height) && e(o.pageX, u, n.proportions().width); | |
case "touch": | |
return (a >= c && p >= a || l >= c && p >= l || c > a && l > p) && (s >= u && d >= s || r >= u && d >= r || u > s && r > d); | |
default: | |
return !1 | |
} | |
} | |
}(), e.ui.ddmanager = { | |
current: null, | |
droppables: { | |
"default": [] | |
}, | |
prepareOffsets: function(t, n) { | |
var i, o, s = e.ui.ddmanager.droppables[t.options.scope] || [], | |
a = n ? n.type : null, | |
r = (t.currentItem || t.element).find(":data(ui-droppable)").addBack(); | |
e: for (i = 0; s.length > i; i++) | |
if (!(s[i].options.disabled || t && !s[i].accept.call(s[i].element[0], t.currentItem || t.element))) { | |
for (o = 0; r.length > o; o++) | |
if (r[o] === s[i].element[0]) { | |
s[i].proportions().height = 0; | |
continue e | |
} | |
s[i].visible = "none" !== s[i].element.css("display"), s[i].visible && ("mousedown" === a && s[i]._activate.call(s[i], n), s[i].offset = s[i].element.offset(), s[i].proportions({ | |
width: s[i].element[0].offsetWidth, | |
height: s[i].element[0].offsetHeight | |
})) | |
} | |
}, | |
drop: function(t, n) { | |
var i = !1; | |
return e.each((e.ui.ddmanager.droppables[t.options.scope] || []).slice(), function() { | |
this.options && (!this.options.disabled && this.visible && e.ui.intersect(t, this, this.options.tolerance, n) && (i = this._drop.call(this, n) || i), !this.options.disabled && this.visible && this.accept.call(this.element[0], t.currentItem || t.element) && (this.isout = !0, this.isover = !1, this._deactivate.call(this, n))) | |
}), i | |
}, | |
dragStart: function(t, n) { | |
t.element.parentsUntil("body").bind("scroll.droppable", function() { | |
t.options.refreshPositions || e.ui.ddmanager.prepareOffsets(t, n) | |
}) | |
}, | |
drag: function(t, n) { | |
t.options.refreshPositions && e.ui.ddmanager.prepareOffsets(t, n), e.each(e.ui.ddmanager.droppables[t.options.scope] || [], function() { | |
if (!this.options.disabled && !this.greedyChild && this.visible) { | |
var i, o, s, a = e.ui.intersect(t, this, this.options.tolerance, n), | |
r = !a && this.isover ? "isout" : a && !this.isover ? "isover" : null; | |
r && (this.options.greedy && (o = this.options.scope, s = this.element.parents(":data(ui-droppable)").filter(function() { | |
return e(this).droppable("instance").options.scope === o | |
}), s.length && (i = e(s[0]).droppable("instance"), i.greedyChild = "isover" === r)), i && "isover" === r && (i.isover = !1, i.isout = !0, i._out.call(i, n)), this[r] = !0, this["isout" === r ? "isover" : "isout"] = !1, this["isover" === r ? "_over" : "_out"].call(this, n), i && "isout" === r && (i.isout = !1, i.isover = !0, i._over.call(i, n))) | |
} | |
}) | |
}, | |
dragStop: function(t, n) { | |
t.element.parentsUntil("body").unbind("scroll.droppable"), t.options.refreshPositions || e.ui.ddmanager.prepareOffsets(t, n) | |
} | |
}, e.ui.droppable, e.widget("ui.selectable", e.ui.mouse, { | |
version: "1.11.4", | |
options: { | |
appendTo: "body", | |
autoRefresh: !0, | |
distance: 0, | |
filter: "*", | |
tolerance: "touch", | |
selected: null, | |
selecting: null, | |
start: null, | |
stop: null, | |
unselected: null, | |
unselecting: null | |
}, | |
_create: function() { | |
var t, n = this; | |
this.element.addClass("ui-selectable"), this.dragged = !1, this.refresh = function() { | |
t = e(n.options.filter, n.element[0]), t.addClass("ui-selectee"), t.each(function() { | |
var t = e(this), | |
n = t.offset(); | |
e.data(this, "selectable-item", { | |
element: this, | |
$element: t, | |
left: n.left, | |
top: n.top, | |
right: n.left + t.outerWidth(), | |
bottom: n.top + t.outerHeight(), | |
startselected: !1, | |
selected: t.hasClass("ui-selected"), | |
selecting: t.hasClass("ui-selecting"), | |
unselecting: t.hasClass("ui-unselecting") | |
}) | |
}) | |
}, this.refresh(), this.selectees = t.addClass("ui-selectee"), this._mouseInit(), this.helper = e("<div class='ui-selectable-helper'></div>") | |
}, | |
_destroy: function() { | |
this.selectees.removeClass("ui-selectee").removeData("selectable-item"), this.element.removeClass("ui-selectable ui-selectable-disabled"), this._mouseDestroy() | |
}, | |
_mouseStart: function(t) { | |
var n = this, | |
i = this.options; | |
this.opos = [t.pageX, t.pageY], this.options.disabled || (this.selectees = e(i.filter, this.element[0]), this._trigger("start", t), e(i.appendTo).append(this.helper), this.helper.css({ | |
left: t.pageX, | |
top: t.pageY, | |
width: 0, | |
height: 0 | |
}), i.autoRefresh && this.refresh(), this.selectees.filter(".ui-selected").each(function() { | |
var i = e.data(this, "selectable-item"); | |
i.startselected = !0, t.metaKey || t.ctrlKey || (i.$element.removeClass("ui-selected"), i.selected = !1, i.$element.addClass("ui-unselecting"), i.unselecting = !0, n._trigger("unselecting", t, { | |
unselecting: i.element | |
})) | |
}), e(t.target).parents().addBack().each(function() { | |
var i, o = e.data(this, "selectable-item"); | |
return o ? (i = !t.metaKey && !t.ctrlKey || !o.$element.hasClass("ui-selected"), o.$element.removeClass(i ? "ui-unselecting" : "ui-selected").addClass(i ? "ui-selecting" : "ui-unselecting"), o.unselecting = !i, o.selecting = i, o.selected = i, i ? n._trigger("selecting", t, { | |
selecting: o.element | |
}) : n._trigger("unselecting", t, { | |
unselecting: o.element | |
}), !1) : void 0 | |
})) | |
}, | |
_mouseDrag: function(t) { | |
if (this.dragged = !0, !this.options.disabled) { | |
var n, i = this, | |
o = this.options, | |
s = this.opos[0], | |
a = this.opos[1], | |
r = t.pageX, | |
l = t.pageY; | |
return s > r && (n = r, r = s, s = n), a > l && (n = l, l = a, a = n), this.helper.css({ | |
left: s, | |
top: a, | |
width: r - s, | |
height: l - a | |
}), this.selectees.each(function() { | |
var n = e.data(this, "selectable-item"), | |
u = !1; | |
n && n.element !== i.element[0] && ("touch" === o.tolerance ? u = !(n.left > r || s > n.right || n.top > l || a > n.bottom) : "fit" === o.tolerance && (u = n.left > s && r > n.right && n.top > a && l > n.bottom), | |
u ? (n.selected && (n.$element.removeClass("ui-selected"), n.selected = !1), n.unselecting && (n.$element.removeClass("ui-unselecting"), n.unselecting = !1), n.selecting || (n.$element.addClass("ui-selecting"), n.selecting = !0, i._trigger("selecting", t, { | |
selecting: n.element | |
}))) : (n.selecting && ((t.metaKey || t.ctrlKey) && n.startselected ? (n.$element.removeClass("ui-selecting"), n.selecting = !1, n.$element.addClass("ui-selected"), n.selected = !0) : (n.$element.removeClass("ui-selecting"), n.selecting = !1, n.startselected && (n.$element.addClass("ui-unselecting"), n.unselecting = !0), i._trigger("unselecting", t, { | |
unselecting: n.element | |
}))), n.selected && (t.metaKey || t.ctrlKey || n.startselected || (n.$element.removeClass("ui-selected"), n.selected = !1, n.$element.addClass("ui-unselecting"), n.unselecting = !0, i._trigger("unselecting", t, { | |
unselecting: n.element | |
}))))) | |
}), !1 | |
} | |
}, | |
_mouseStop: function(t) { | |
var n = this; | |
return this.dragged = !1, e(".ui-unselecting", this.element[0]).each(function() { | |
var i = e.data(this, "selectable-item"); | |
i.$element.removeClass("ui-unselecting"), i.unselecting = !1, i.startselected = !1, n._trigger("unselected", t, { | |
unselected: i.element | |
}) | |
}), e(".ui-selecting", this.element[0]).each(function() { | |
var i = e.data(this, "selectable-item"); | |
i.$element.removeClass("ui-selecting").addClass("ui-selected"), i.selecting = !1, i.selected = !0, i.startselected = !0, n._trigger("selected", t, { | |
selected: i.element | |
}) | |
}), this._trigger("stop", t), this.helper.remove(), !1 | |
} | |
}), e.widget("ui.sortable", e.ui.mouse, { | |
version: "1.11.4", | |
widgetEventPrefix: "sort", | |
ready: !1, | |
options: { | |
appendTo: "parent", | |
axis: !1, | |
connectWith: !1, | |
containment: !1, | |
cursor: "auto", | |
cursorAt: !1, | |
dropOnEmpty: !0, | |
forcePlaceholderSize: !1, | |
forceHelperSize: !1, | |
grid: !1, | |
handle: !1, | |
helper: "original", | |
items: "> *", | |
opacity: !1, | |
placeholder: !1, | |
revert: !1, | |
scroll: !0, | |
scrollSensitivity: 20, | |
scrollSpeed: 20, | |
scope: "default", | |
tolerance: "intersect", | |
zIndex: 1e3, | |
activate: null, | |
beforeStop: null, | |
change: null, | |
deactivate: null, | |
out: null, | |
over: null, | |
receive: null, | |
remove: null, | |
sort: null, | |
start: null, | |
stop: null, | |
update: null | |
}, | |
_isOverAxis: function(e, t, n) { | |
return e >= t && t + n > e | |
}, | |
_isFloating: function(e) { | |
return /left|right/.test(e.css("float")) || /inline|table-cell/.test(e.css("display")) | |
}, | |
_create: function() { | |
this.containerCache = {}, this.element.addClass("ui-sortable"), this.refresh(), this.offset = this.element.offset(), this._mouseInit(), this._setHandleClassName(), this.ready = !0 | |
}, | |
_setOption: function(e, t) { | |
this._super(e, t), "handle" === e && this._setHandleClassName() | |
}, | |
_setHandleClassName: function() { | |
this.element.find(".ui-sortable-handle").removeClass("ui-sortable-handle"), e.each(this.items, function() { | |
(this.instance.options.handle ? this.item.find(this.instance.options.handle) : this.item).addClass("ui-sortable-handle") | |
}) | |
}, | |
_destroy: function() { | |
this.element.removeClass("ui-sortable ui-sortable-disabled").find(".ui-sortable-handle").removeClass("ui-sortable-handle"), this._mouseDestroy(); | |
for (var e = this.items.length - 1; e >= 0; e--) this.items[e].item.removeData(this.widgetName + "-item"); | |
return this | |
}, | |
_mouseCapture: function(t, n) { | |
var i = null, | |
o = !1, | |
s = this; | |
return !this.reverting && (!this.options.disabled && "static" !== this.options.type && (this._refreshItems(t), e(t.target).parents().each(function() { | |
return e.data(this, s.widgetName + "-item") === s ? (i = e(this), !1) : void 0 | |
}), e.data(t.target, s.widgetName + "-item") === s && (i = e(t.target)), !!i && (!(this.options.handle && !n && (e(this.options.handle, i).find("*").addBack().each(function() { | |
this === t.target && (o = !0) | |
}), !o)) && (this.currentItem = i, this._removeCurrentsFromItems(), !0)))) | |
}, | |
_mouseStart: function(t, n, i) { | |
var o, s, a = this.options; | |
if (this.currentContainer = this, this.refreshPositions(), this.helper = this._createHelper(t), this._cacheHelperProportions(), this._cacheMargins(), this.scrollParent = this.helper.scrollParent(), this.offset = this.currentItem.offset(), this.offset = { | |
top: this.offset.top - this.margins.top, | |
left: this.offset.left - this.margins.left | |
}, e.extend(this.offset, { | |
click: { | |
left: t.pageX - this.offset.left, | |
top: t.pageY - this.offset.top | |
}, | |
parent: this._getParentOffset(), | |
relative: this._getRelativeOffset() | |
}), this.helper.css("position", "absolute"), this.cssPosition = this.helper.css("position"), this.originalPosition = this._generatePosition(t), this.originalPageX = t.pageX, this.originalPageY = t.pageY, a.cursorAt && this._adjustOffsetFromHelper(a.cursorAt), this.domPosition = { | |
prev: this.currentItem.prev()[0], | |
parent: this.currentItem.parent()[0] | |
}, this.helper[0] !== this.currentItem[0] && this.currentItem.hide(), this._createPlaceholder(), a.containment && this._setContainment(), a.cursor && "auto" !== a.cursor && (s = this.document.find("body"), this.storedCursor = s.css("cursor"), s.css("cursor", a.cursor), this.storedStylesheet = e("<style>*{ cursor: " + a.cursor + " !important; }</style>").appendTo(s)), a.opacity && (this.helper.css("opacity") && (this._storedOpacity = this.helper.css("opacity")), this.helper.css("opacity", a.opacity)), a.zIndex && (this.helper.css("zIndex") && (this._storedZIndex = this.helper.css("zIndex")), this.helper.css("zIndex", a.zIndex)), this.scrollParent[0] !== this.document[0] && "HTML" !== this.scrollParent[0].tagName && (this.overflowOffset = this.scrollParent.offset()), this._trigger("start", t, this._uiHash()), this._preserveHelperProportions || this._cacheHelperProportions(), !i) | |
for (o = this.containers.length - 1; o >= 0; o--) this.containers[o]._trigger("activate", t, this._uiHash(this)); | |
return e.ui.ddmanager && (e.ui.ddmanager.current = this), e.ui.ddmanager && !a.dropBehaviour && e.ui.ddmanager.prepareOffsets(this, t), this.dragging = !0, this.helper.addClass("ui-sortable-helper"), this._mouseDrag(t), !0 | |
}, | |
_mouseDrag: function(t) { | |
var n, i, o, s, a = this.options, | |
r = !1; | |
for (this.position = this._generatePosition(t), this.positionAbs = this._convertPositionTo("absolute"), this.lastPositionAbs || (this.lastPositionAbs = this.positionAbs), this.options.scroll && (this.scrollParent[0] !== this.document[0] && "HTML" !== this.scrollParent[0].tagName ? (this.overflowOffset.top + this.scrollParent[0].offsetHeight - t.pageY < a.scrollSensitivity ? this.scrollParent[0].scrollTop = r = this.scrollParent[0].scrollTop + a.scrollSpeed : t.pageY - this.overflowOffset.top < a.scrollSensitivity && (this.scrollParent[0].scrollTop = r = this.scrollParent[0].scrollTop - a.scrollSpeed), this.overflowOffset.left + this.scrollParent[0].offsetWidth - t.pageX < a.scrollSensitivity ? this.scrollParent[0].scrollLeft = r = this.scrollParent[0].scrollLeft + a.scrollSpeed : t.pageX - this.overflowOffset.left < a.scrollSensitivity && (this.scrollParent[0].scrollLeft = r = this.scrollParent[0].scrollLeft - a.scrollSpeed)) : (t.pageY - this.document.scrollTop() < a.scrollSensitivity ? r = this.document.scrollTop(this.document.scrollTop() - a.scrollSpeed) : this.window.height() - (t.pageY - this.document.scrollTop()) < a.scrollSensitivity && (r = this.document.scrollTop(this.document.scrollTop() + a.scrollSpeed)), t.pageX - this.document.scrollLeft() < a.scrollSensitivity ? r = this.document.scrollLeft(this.document.scrollLeft() - a.scrollSpeed) : this.window.width() - (t.pageX - this.document.scrollLeft()) < a.scrollSensitivity && (r = this.document.scrollLeft(this.document.scrollLeft() + a.scrollSpeed))), r !== !1 && e.ui.ddmanager && !a.dropBehaviour && e.ui.ddmanager.prepareOffsets(this, t)), this.positionAbs = this._convertPositionTo("absolute"), this.options.axis && "y" === this.options.axis || (this.helper[0].style.left = this.position.left + "px"), this.options.axis && "x" === this.options.axis || (this.helper[0].style.top = this.position.top + "px"), n = this.items.length - 1; n >= 0; n--) | |
if (i = this.items[n], o = i.item[0], s = this._intersectsWithPointer(i), s && i.instance === this.currentContainer && o !== this.currentItem[0] && this.placeholder[1 === s ? "next" : "prev"]()[0] !== o && !e.contains(this.placeholder[0], o) && ("semi-dynamic" !== this.options.type || !e.contains(this.element[0], o))) { | |
if (this.direction = 1 === s ? "down" : "up", "pointer" !== this.options.tolerance && !this._intersectsWithSides(i)) break; | |
this._rearrange(t, i), this._trigger("change", t, this._uiHash()); | |
break | |
} | |
return this._contactContainers(t), e.ui.ddmanager && e.ui.ddmanager.drag(this, t), this._trigger("sort", t, this._uiHash()), this.lastPositionAbs = this.positionAbs, !1 | |
}, | |
_mouseStop: function(t, n) { | |
if (t) { | |
if (e.ui.ddmanager && !this.options.dropBehaviour && e.ui.ddmanager.drop(this, t), this.options.revert) { | |
var i = this, | |
o = this.placeholder.offset(), | |
s = this.options.axis, | |
a = {}; | |
s && "x" !== s || (a.left = o.left - this.offset.parent.left - this.margins.left + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollLeft)), s && "y" !== s || (a.top = o.top - this.offset.parent.top - this.margins.top + (this.offsetParent[0] === this.document[0].body ? 0 : this.offsetParent[0].scrollTop)), this.reverting = !0, e(this.helper).animate(a, parseInt(this.options.revert, 10) || 500, function() { | |
i._clear(t) | |
}) | |
} else this._clear(t, n); | |
return !1 | |
} | |
}, | |
cancel: function() { | |
if (this.dragging) { | |
this._mouseUp({ | |
target: null | |
}), "original" === this.options.helper ? this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper") : this.currentItem.show(); | |
for (var t = this.containers.length - 1; t >= 0; t--) this.containers[t]._trigger("deactivate", null, this._uiHash(this)), this.containers[t].containerCache.over && (this.containers[t]._trigger("out", null, this._uiHash(this)), this.containers[t].containerCache.over = 0) | |
} | |
return this.placeholder && (this.placeholder[0].parentNode && this.placeholder[0].parentNode.removeChild(this.placeholder[0]), "original" !== this.options.helper && this.helper && this.helper[0].parentNode && this.helper.remove(), e.extend(this, { | |
helper: null, | |
dragging: !1, | |
reverting: !1, | |
_noFinalSort: null | |
}), this.domPosition.prev ? e(this.domPosition.prev).after(this.currentItem) : e(this.domPosition.parent).prepend(this.currentItem)), this | |
}, | |
serialize: function(t) { | |
var n = this._getItemsAsjQuery(t && t.connected), | |
i = []; | |
return t = t || {}, e(n).each(function() { | |
var n = (e(t.item || this).attr(t.attribute || "id") || "").match(t.expression || /(.+)[\-=_](.+)/); | |
n && i.push((t.key || n[1] + "[]") + "=" + (t.key && t.expression ? n[1] : n[2])) | |
}), !i.length && t.key && i.push(t.key + "="), i.join("&") | |
}, | |
toArray: function(t) { | |
var n = this._getItemsAsjQuery(t && t.connected), | |
i = []; | |
return t = t || {}, n.each(function() { | |
i.push(e(t.item || this).attr(t.attribute || "id") || "") | |
}), i | |
}, | |
_intersectsWith: function(e) { | |
var t = this.positionAbs.left, | |
n = t + this.helperProportions.width, | |
i = this.positionAbs.top, | |
o = i + this.helperProportions.height, | |
s = e.left, | |
a = s + e.width, | |
r = e.top, | |
l = r + e.height, | |
u = this.offset.click.top, | |
c = this.offset.click.left, | |
d = "x" === this.options.axis || i + u > r && l > i + u, | |
p = "y" === this.options.axis || t + c > s && a > t + c, | |
f = d && p; | |
return "pointer" === this.options.tolerance || this.options.forcePointerForContainers || "pointer" !== this.options.tolerance && this.helperProportions[this.floating ? "width" : "height"] > e[this.floating ? "width" : "height"] ? f : t + this.helperProportions.width / 2 > s && a > n - this.helperProportions.width / 2 && i + this.helperProportions.height / 2 > r && l > o - this.helperProportions.height / 2 | |
}, | |
_intersectsWithPointer: function(e) { | |
var t = "x" === this.options.axis || this._isOverAxis(this.positionAbs.top + this.offset.click.top, e.top, e.height), | |
n = "y" === this.options.axis || this._isOverAxis(this.positionAbs.left + this.offset.click.left, e.left, e.width), | |
i = t && n, | |
o = this._getDragVerticalDirection(), | |
s = this._getDragHorizontalDirection(); | |
return !!i && (this.floating ? s && "right" === s || "down" === o ? 2 : 1 : o && ("down" === o ? 2 : 1)) | |
}, | |
_intersectsWithSides: function(e) { | |
var t = this._isOverAxis(this.positionAbs.top + this.offset.click.top, e.top + e.height / 2, e.height), | |
n = this._isOverAxis(this.positionAbs.left + this.offset.click.left, e.left + e.width / 2, e.width), | |
i = this._getDragVerticalDirection(), | |
o = this._getDragHorizontalDirection(); | |
return this.floating && o ? "right" === o && n || "left" === o && !n : i && ("down" === i && t || "up" === i && !t) | |
}, | |
_getDragVerticalDirection: function() { | |
var e = this.positionAbs.top - this.lastPositionAbs.top; | |
return 0 !== e && (e > 0 ? "down" : "up") | |
}, | |
_getDragHorizontalDirection: function() { | |
var e = this.positionAbs.left - this.lastPositionAbs.left; | |
return 0 !== e && (e > 0 ? "right" : "left") | |
}, | |
refresh: function(e) { | |
return this._refreshItems(e), this._setHandleClassName(), this.refreshPositions(), this | |
}, | |
_connectWith: function() { | |
var e = this.options; | |
return e.connectWith.constructor === String ? [e.connectWith] : e.connectWith | |
}, | |
_getItemsAsjQuery: function(t) { | |
function n() { | |
r.push(this) | |
} | |
var i, o, s, a, r = [], | |
l = [], | |
u = this._connectWith(); | |
if (u && t) | |
for (i = u.length - 1; i >= 0; i--) | |
for (s = e(u[i], this.document[0]), o = s.length - 1; o >= 0; o--) a = e.data(s[o], this.widgetFullName), a && a !== this && !a.options.disabled && l.push([e.isFunction(a.options.items) ? a.options.items.call(a.element) : e(a.options.items, a.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), a]); | |
for (l.push([e.isFunction(this.options.items) ? this.options.items.call(this.element, null, { | |
options: this.options, | |
item: this.currentItem | |
}) : e(this.options.items, this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"), this]), i = l.length - 1; i >= 0; i--) l[i][0].each(n); | |
return e(r) | |
}, | |
_removeCurrentsFromItems: function() { | |
var t = this.currentItem.find(":data(" + this.widgetName + "-item)"); | |
this.items = e.grep(this.items, function(e) { | |
for (var n = 0; t.length > n; n++) | |
if (t[n] === e.item[0]) return !1; | |
return !0 | |
}) | |
}, | |
_refreshItems: function(t) { | |
this.items = [], this.containers = [this]; | |
var n, i, o, s, a, r, l, u, c = this.items, | |
d = [ | |
[e.isFunction(this.options.items) ? this.options.items.call(this.element[0], t, { | |
item: this.currentItem | |
}) : e(this.options.items, this.element), this] | |
], | |
p = this._connectWith(); | |
if (p && this.ready) | |
for (n = p.length - 1; n >= 0; n--) | |
for (o = e(p[n], this.document[0]), i = o.length - 1; i >= 0; i--) s = e.data(o[i], this.widgetFullName), s && s !== this && !s.options.disabled && (d.push([e.isFunction(s.options.items) ? s.options.items.call(s.element[0], t, { | |
item: this.currentItem | |
}) : e(s.options.items, s.element), s]), this.containers.push(s)); | |
for (n = d.length - 1; n >= 0; n--) | |
for (a = d[n][1], r = d[n][0], i = 0, u = r.length; u > i; i++) l = e(r[i]), l.data(this.widgetName + "-item", a), c.push({ | |
item: l, | |
instance: a, | |
width: 0, | |
height: 0, | |
left: 0, | |
top: 0 | |
}) | |
}, | |
refreshPositions: function(t) { | |
this.floating = !!this.items.length && ("x" === this.options.axis || this._isFloating(this.items[0].item)), this.offsetParent && this.helper && (this.offset.parent = this._getParentOffset()); | |
var n, i, o, s; | |
for (n = this.items.length - 1; n >= 0; n--) i = this.items[n], i.instance !== this.currentContainer && this.currentContainer && i.item[0] !== this.currentItem[0] || (o = this.options.toleranceElement ? e(this.options.toleranceElement, i.item) : i.item, t || (i.width = o.outerWidth(), i.height = o.outerHeight()), s = o.offset(), i.left = s.left, i.top = s.top); | |
if (this.options.custom && this.options.custom.refreshContainers) this.options.custom.refreshContainers.call(this); | |
else | |
for (n = this.containers.length - 1; n >= 0; n--) s = this.containers[n].element.offset(), this.containers[n].containerCache.left = s.left, this.containers[n].containerCache.top = s.top, this.containers[n].containerCache.width = this.containers[n].element.outerWidth(), this.containers[n].containerCache.height = this.containers[n].element.outerHeight(); | |
return this | |
}, | |
_createPlaceholder: function(t) { | |
t = t || this; | |
var n, i = t.options; | |
i.placeholder && i.placeholder.constructor !== String || (n = i.placeholder, i.placeholder = { | |
element: function() { | |
var i = t.currentItem[0].nodeName.toLowerCase(), | |
o = e("<" + i + ">", t.document[0]).addClass(n || t.currentItem[0].className + " ui-sortable-placeholder").removeClass("ui-sortable-helper"); | |
return "tbody" === i ? t._createTrPlaceholder(t.currentItem.find("tr").eq(0), e("<tr>", t.document[0]).appendTo(o)) : "tr" === i ? t._createTrPlaceholder(t.currentItem, o) : "img" === i && o.attr("src", t.currentItem.attr("src")), n || o.css("visibility", "hidden"), o | |
}, | |
update: function(e, o) { | |
(!n || i.forcePlaceholderSize) && (o.height() || o.height(t.currentItem.innerHeight() - parseInt(t.currentItem.css("paddingTop") || 0, 10) - parseInt(t.currentItem.css("paddingBottom") || 0, 10)), o.width() || o.width(t.currentItem.innerWidth() - parseInt(t.currentItem.css("paddingLeft") || 0, 10) - parseInt(t.currentItem.css("paddingRight") || 0, 10))) | |
} | |
}), t.placeholder = e(i.placeholder.element.call(t.element, t.currentItem)), t.currentItem.after(t.placeholder), i.placeholder.update(t, t.placeholder) | |
}, | |
_createTrPlaceholder: function(t, n) { | |
var i = this; | |
t.children().each(function() { | |
e("<td> </td>", i.document[0]).attr("colspan", e(this).attr("colspan") || 1).appendTo(n) | |
}) | |
}, | |
_contactContainers: function(t) { | |
var n, i, o, s, a, r, l, u, c, d, p = null, | |
f = null; | |
for (n = this.containers.length - 1; n >= 0; n--) | |
if (!e.contains(this.currentItem[0], this.containers[n].element[0])) | |
if (this._intersectsWith(this.containers[n].containerCache)) { | |
if (p && e.contains(this.containers[n].element[0], p.element[0])) continue; | |
p = this.containers[n], f = n | |
} else this.containers[n].containerCache.over && (this.containers[n]._trigger("out", t, this._uiHash(this)), this.containers[n].containerCache.over = 0); | |
if (p) | |
if (1 === this.containers.length) this.containers[f].containerCache.over || (this.containers[f]._trigger("over", t, this._uiHash(this)), this.containers[f].containerCache.over = 1); | |
else { | |
for (o = 1e4, s = null, c = p.floating || this._isFloating(this.currentItem), a = c ? "left" : "top", r = c ? "width" : "height", d = c ? "clientX" : "clientY", i = this.items.length - 1; i >= 0; i--) e.contains(this.containers[f].element[0], this.items[i].item[0]) && this.items[i].item[0] !== this.currentItem[0] && (l = this.items[i].item.offset()[a], u = !1, t[d] - l > this.items[i][r] / 2 && (u = !0), o > Math.abs(t[d] - l) && (o = Math.abs(t[d] - l), s = this.items[i], this.direction = u ? "up" : "down")); | |
if (!s && !this.options.dropOnEmpty) return; | |
if (this.currentContainer === this.containers[f]) return void(this.currentContainer.containerCache.over || (this.containers[f]._trigger("over", t, this._uiHash()), this.currentContainer.containerCache.over = 1)); | |
s ? this._rearrange(t, s, null, !0) : this._rearrange(t, null, this.containers[f].element, !0), this._trigger("change", t, this._uiHash()), this.containers[f]._trigger("change", t, this._uiHash(this)), this.currentContainer = this.containers[f], this.options.placeholder.update(this.currentContainer, this.placeholder), this.containers[f]._trigger("over", t, this._uiHash(this)), this.containers[f].containerCache.over = 1 | |
} | |
}, | |
_createHelper: function(t) { | |
var n = this.options, | |
i = e.isFunction(n.helper) ? e(n.helper.apply(this.element[0], [t, this.currentItem])) : "clone" === n.helper ? this.currentItem.clone() : this.currentItem; | |
return i.parents("body").length || e("parent" !== n.appendTo ? n.appendTo : this.currentItem[0].parentNode)[0].appendChild(i[0]), i[0] === this.currentItem[0] && (this._storedCSS = { | |
width: this.currentItem[0].style.width, | |
height: this.currentItem[0].style.height, | |
position: this.currentItem.css("position"), | |
top: this.currentItem.css("top"), | |
left: this.currentItem.css("left") | |
}), (!i[0].style.width || n.forceHelperSize) && i.width(this.currentItem.width()), (!i[0].style.height || n.forceHelperSize) && i.height(this.currentItem.height()), i | |
}, | |
_adjustOffsetFromHelper: function(t) { | |
"string" == typeof t && (t = t.split(" ")), e.isArray(t) && (t = { | |
left: +t[0], | |
top: +t[1] || 0 | |
}), "left" in t && (this.offset.click.left = t.left + this.margins.left), "right" in t && (this.offset.click.left = this.helperProportions.width - t.right + this.margins.left), "top" in t && (this.offset.click.top = t.top + this.margins.top), "bottom" in t && (this.offset.click.top = this.helperProportions.height - t.bottom + this.margins.top) | |
}, | |
_getParentOffset: function() { | |
this.offsetParent = this.helper.offsetParent(); | |
var t = this.offsetParent.offset(); | |
return "absolute" === this.cssPosition && this.scrollParent[0] !== this.document[0] && e.contains(this.scrollParent[0], this.offsetParent[0]) && (t.left += this.scrollParent.scrollLeft(), t.top += this.scrollParent.scrollTop()), (this.offsetParent[0] === this.document[0].body || this.offsetParent[0].tagName && "html" === this.offsetParent[0].tagName.toLowerCase() && e.ui.ie) && (t = { | |
top: 0, | |
left: 0 | |
}), { | |
top: t.top + (parseInt(this.offsetParent.css("borderTopWidth"), 10) || 0), | |
left: t.left + (parseInt(this.offsetParent.css("borderLeftWidth"), 10) || 0) | |
} | |
}, | |
_getRelativeOffset: function() { | |
if ("relative" === this.cssPosition) { | |
var e = this.currentItem.position(); | |
return { | |
top: e.top - (parseInt(this.helper.css("top"), 10) || 0) + this.scrollParent.scrollTop(), | |
left: e.left - (parseInt(this.helper.css("left"), 10) || 0) + this.scrollParent.scrollLeft() | |
} | |
} | |
return { | |
top: 0, | |
left: 0 | |
} | |
}, | |
_cacheMargins: function() { | |
this.margins = { | |
left: parseInt(this.currentItem.css("marginLeft"), 10) || 0, | |
top: parseInt(this.currentItem.css("marginTop"), 10) || 0 | |
} | |
}, | |
_cacheHelperProportions: function() { | |
this.helperProportions = { | |
width: this.helper.outerWidth(), | |
height: this.helper.outerHeight() | |
} | |
}, | |
_setContainment: function() { | |
var t, n, i, o = this.options; | |
"parent" === o.containment && (o.containment = this.helper[0].parentNode), ("document" === o.containment || "window" === o.containment) && (this.containment = [0 - this.offset.relative.left - this.offset.parent.left, 0 - this.offset.relative.top - this.offset.parent.top, "document" === o.containment ? this.document.width() : this.window.width() - this.helperProportions.width - this.margins.left, ("document" === o.containment ? this.document.width() : this.window.height() || this.document[0].body.parentNode.scrollHeight) - this.helperProportions.height - this.margins.top]), /^(document|window|parent)$/.test(o.containment) || (t = e(o.containment)[0], n = e(o.containment).offset(), i = "hidden" !== e(t).css("overflow"), this.containment = [n.left + (parseInt(e(t).css("borderLeftWidth"), 10) || 0) + (parseInt(e(t).css("paddingLeft"), 10) || 0) - this.margins.left, n.top + (parseInt(e(t).css("borderTopWidth"), 10) || 0) + (parseInt(e(t).css("paddingTop"), 10) || 0) - this.margins.top, n.left + (i ? Math.max(t.scrollWidth, t.offsetWidth) : t.offsetWidth) - (parseInt(e(t).css("borderLeftWidth"), 10) || 0) - (parseInt(e(t).css("paddingRight"), 10) || 0) - this.helperProportions.width - this.margins.left, n.top + (i ? Math.max(t.scrollHeight, t.offsetHeight) : t.offsetHeight) - (parseInt(e(t).css("borderTopWidth"), 10) || 0) - (parseInt(e(t).css("paddingBottom"), 10) || 0) - this.helperProportions.height - this.margins.top]) | |
}, | |
_convertPositionTo: function(t, n) { | |
n || (n = this.position); | |
var i = "absolute" === t ? 1 : -1, | |
o = "absolute" !== this.cssPosition || this.scrollParent[0] !== this.document[0] && e.contains(this.scrollParent[0], this.offsetParent[0]) ? this.scrollParent : this.offsetParent, | |
s = /(html|body)/i.test(o[0].tagName); | |
return { | |
top: n.top + this.offset.relative.top * i + this.offset.parent.top * i - ("fixed" === this.cssPosition ? -this.scrollParent.scrollTop() : s ? 0 : o.scrollTop()) * i, | |
left: n.left + this.offset.relative.left * i + this.offset.parent.left * i - ("fixed" === this.cssPosition ? -this.scrollParent.scrollLeft() : s ? 0 : o.scrollLeft()) * i | |
} | |
}, | |
_generatePosition: function(t) { | |
var n, i, o = this.options, | |
s = t.pageX, | |
a = t.pageY, | |
r = "absolute" !== this.cssPosition || this.scrollParent[0] !== this.document[0] && e.contains(this.scrollParent[0], this.offsetParent[0]) ? this.scrollParent : this.offsetParent, | |
l = /(html|body)/i.test(r[0].tagName); | |
return "relative" !== this.cssPosition || this.scrollParent[0] !== this.document[0] && this.scrollParent[0] !== this.offsetParent[0] || (this.offset.relative = this._getRelativeOffset()), this.originalPosition && (this.containment && (t.pageX - this.offset.click.left < this.containment[0] && (s = this.containment[0] + this.offset.click.left), t.pageY - this.offset.click.top < this.containment[1] && (a = this.containment[1] + this.offset.click.top), t.pageX - this.offset.click.left > this.containment[2] && (s = this.containment[2] + this.offset.click.left), t.pageY - this.offset.click.top > this.containment[3] && (a = this.containment[3] + this.offset.click.top)), o.grid && (n = this.originalPageY + Math.round((a - this.originalPageY) / o.grid[1]) * o.grid[1], a = this.containment ? n - this.offset.click.top >= this.containment[1] && n - this.offset.click.top <= this.containment[3] ? n : n - this.offset.click.top >= this.containment[1] ? n - o.grid[1] : n + o.grid[1] : n, i = this.originalPageX + Math.round((s - this.originalPageX) / o.grid[0]) * o.grid[0], s = this.containment ? i - this.offset.click.left >= this.containment[0] && i - this.offset.click.left <= this.containment[2] ? i : i - this.offset.click.left >= this.containment[0] ? i - o.grid[0] : i + o.grid[0] : i)), { | |
top: a - this.offset.click.top - this.offset.relative.top - this.offset.parent.top + ("fixed" === this.cssPosition ? -this.scrollParent.scrollTop() : l ? 0 : r.scrollTop()), | |
left: s - this.offset.click.left - this.offset.relative.left - this.offset.parent.left + ("fixed" === this.cssPosition ? -this.scrollParent.scrollLeft() : l ? 0 : r.scrollLeft()) | |
} | |
}, | |
_rearrange: function(e, t, n, i) { | |
n ? n[0].appendChild(this.placeholder[0]) : t.item[0].parentNode.insertBefore(this.placeholder[0], "down" === this.direction ? t.item[0] : t.item[0].nextSibling), this.counter = this.counter ? ++this.counter : 1; | |
var o = this.counter; | |
this._delay(function() { | |
o === this.counter && this.refreshPositions(!i) | |
}) | |
}, | |
_clear: function(e, t) { | |
function n(e, t, n) { | |
return function(i) { | |
n._trigger(e, i, t._uiHash(t)) | |
} | |
} | |
this.reverting = !1; | |
var i, o = []; | |
if (!this._noFinalSort && this.currentItem.parent().length && this.placeholder.before(this.currentItem), this._noFinalSort = null, this.helper[0] === this.currentItem[0]) { | |
for (i in this._storedCSS)("auto" === this._storedCSS[i] || "static" === this._storedCSS[i]) && (this._storedCSS[i] = ""); | |
this.currentItem.css(this._storedCSS).removeClass("ui-sortable-helper") | |
} else this.currentItem.show(); | |
for (this.fromOutside && !t && o.push(function(e) { | |
this._trigger("receive", e, this._uiHash(this.fromOutside)) | |
}), !this.fromOutside && this.domPosition.prev === this.currentItem.prev().not(".ui-sortable-helper")[0] && this.domPosition.parent === this.currentItem.parent()[0] || t || o.push(function(e) { | |
this._trigger("update", e, this._uiHash()) | |
}), this !== this.currentContainer && (t || (o.push(function(e) { | |
this._trigger("remove", e, this._uiHash()) | |
}), o.push(function(e) { | |
return function(t) { | |
e._trigger("receive", t, this._uiHash(this)) | |
} | |
}.call(this, this.currentContainer)), o.push(function(e) { | |
return function(t) { | |
e._trigger("update", t, this._uiHash(this)) | |
} | |
}.call(this, this.currentContainer)))), i = this.containers.length - 1; i >= 0; i--) t || o.push(n("deactivate", this, this.containers[i])), this.containers[i].containerCache.over && (o.push(n("out", this, this.containers[i])), this.containers[i].containerCache.over = 0); | |
if (this.storedCursor && (this.document.find("body").css("cursor", this.storedCursor), this.storedStylesheet.remove()), this._storedOpacity && this.helper.css("opacity", this._storedOpacity), this._storedZIndex && this.helper.css("zIndex", "auto" === this._storedZIndex ? "" : this._storedZIndex), this.dragging = !1, t || this._trigger("beforeStop", e, this._uiHash()), this.placeholder[0].parentNode.removeChild(this.placeholder[0]), this.cancelHelperRemoval || (this.helper[0] !== this.currentItem[0] && this.helper.remove(), this.helper = null), !t) { | |
for (i = 0; o.length > i; i++) o[i].call(this, e); | |
this._trigger("stop", e, this._uiHash()) | |
} | |
return this.fromOutside = !1, !this.cancelHelperRemoval | |
}, | |
_trigger: function() { | |
e.Widget.prototype._trigger.apply(this, arguments) === !1 && this.cancel() | |
}, | |
_uiHash: function(t) { | |
var n = t || this; | |
return { | |
helper: n.helper, | |
placeholder: n.placeholder || e([]), | |
position: n.position, | |
originalPosition: n.originalPosition, | |
offset: n.positionAbs, | |
item: n.currentItem, | |
sender: t ? t.element : null | |
} | |
} | |
}) | |
}), ! function(e) { | |
function t(e, t) { | |
if (!(e.originalEvent.touches.length > 1)) { | |
e.preventDefault(); | |
var n = e.originalEvent.changedTouches[0], | |
i = document.createEvent("MouseEvents"); | |
i.initMouseEvent(t, !0, !0, window, 1, n.screenX, n.screenY, n.clientX, n.clientY, !1, !1, !1, !1, 0, null), e.target.dispatchEvent(i) | |
} | |
} | |
if (e.support.touch = "ontouchend" in document, e.support.touch) { | |
var n, i = e.ui.mouse.prototype, | |
o = i._mouseInit, | |
s = i._mouseDestroy; | |
i._touchStart = function(e) { | |
var i = this; | |
!n && i._mouseCapture(e.originalEvent.changedTouches[0]) && (n = !0, i._touchMoved = !1, t(e, "mouseover"), t(e, "mousemove"), t(e, "mousedown")) | |
}, i._touchMove = function(e) { | |
n && (this._touchMoved = !0, t(e, "mousemove")) | |
}, i._touchEnd = function(e) { | |
n && (t(e, "mouseup"), t(e, "mouseout"), this._touchMoved || t(e, "click"), n = !1) | |
}, i._mouseInit = function() { | |
var t = this; | |
t.element.bind({ | |
touchstart: e.proxy(t, "_touchStart"), | |
touchmove: e.proxy(t, "_touchMove"), | |
touchend: e.proxy(t, "_touchEnd") | |
}), o.call(t) | |
}, i._mouseDestroy = function() { | |
var t = this; | |
t.element.unbind({ | |
touchstart: e.proxy(t, "_touchStart"), | |
touchmove: e.proxy(t, "_touchMove"), | |
touchend: e.proxy(t, "_touchEnd") | |
}), s.call(t) | |
} | |
} | |
}(jQuery), function(e) { | |
"function" == typeof define && define.amd ? define(["jquery"], e) : "object" == typeof exports ? module.exports = e(require("jquery")) : e(jQuery) | |
}(function(e) { | |
function t(e) { | |
return r.raw ? e : encodeURIComponent(e) | |
} | |
function n(e) { | |
return r.raw ? e : decodeURIComponent(e) | |
} | |
function i(e) { | |
return t(r.json ? JSON.stringify(e) : String(e)) | |
} | |
function o(e) { | |
0 === e.indexOf('"') && (e = e.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, "\\")); | |
try { | |
return e = decodeURIComponent(e.replace(a, " ")), r.json ? JSON.parse(e) : e | |
} catch (e) {} | |
} | |
function s(t, n) { | |
var i = r.raw ? t : o(t); | |
return e.isFunction(n) ? n(i) : i | |
} | |
var a = /\+/g, | |
r = e.cookie = function(o, a, l) { | |
if (arguments.length > 1 && !e.isFunction(a)) { | |
if (l = e.extend({}, r.defaults, l), "number" == typeof l.expires) { | |
var u = l.expires, | |
c = l.expires = new Date; | |
c.setMilliseconds(c.getMilliseconds() + 864e5 * u) | |
} | |
return document.cookie = [t(o), "=", i(a), l.expires ? "; expires=" + l.expires.toUTCString() : "", l.path ? "; path=" + l.path : "", l.domain ? "; domain=" + l.domain : "", l.secure ? "; secure" : ""].join("") | |
} | |
for (var d = o ? void 0 : {}, p = document.cookie ? document.cookie.split("; ") : [], f = 0, h = p.length; f < h; f++) { | |
var g = p[f].split("="), | |
m = n(g.shift()), | |
v = g.join("="); | |
if (o === m) { | |
d = s(v, a); | |
break | |
} | |
o || void 0 === (v = s(v)) || (d[m] = v) | |
} | |
return d | |
}; | |
r.defaults = {}, e.removeCookie = function(t, n) { | |
return e.cookie(t, "", e.extend({}, n, { | |
expires: -1 | |
})), !e.cookie(t) | |
} | |
}), "undefined" == typeof jQuery) throw new Error("Bootstrap's JavaScript requires jQuery"); + function(e) { | |
"use strict"; | |
var t = e.fn.jquery.split(" ")[0].split("."); | |
if (t[0] < 2 && t[1] < 9 || 1 == t[0] && 9 == t[1] && t[2] < 1 || t[0] > 3) throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4") | |
}(jQuery), + function(e) { | |
"use strict"; | |
function t() { | |
var e = document.createElement("bootstrap"), | |
t = { | |
WebkitTransition: "webkitTransitionEnd", | |
MozTransition: "transitionend", | |
OTransition: "oTransitionEnd otransitionend", | |
transition: "transitionend" | |
}; | |
for (var n in t) | |
if (void 0 !== e.style[n]) return { | |
end: t[n] | |
}; | |
return !1 | |
} | |
e.fn.emulateTransitionEnd = function(t) { | |
var n = !1, | |
i = this; | |
e(this).one("bsTransitionEnd", function() { | |
n = !0 | |
}); | |
var o = function() { | |
n || e(i).trigger(e.support.transition.end) | |
}; | |
return setTimeout(o, t), this | |
}, e(function() { | |
e.support.transition = t(), e.support.transition && (e.event.special.bsTransitionEnd = { | |
bindType: e.support.transition.end, | |
delegateType: e.support.transition.end, | |
handle: function(t) { | |
if (e(t.target).is(this)) return t.handleObj.handler.apply(this, arguments) | |
} | |
}) | |
}) | |
}(jQuery), + function(e) { | |
"use strict"; | |
function t(t) { | |
return this.each(function() { | |
var n = e(this), | |
o = n.data("bs.alert"); | |
o || n.data("bs.alert", o = new i(this)), "string" == typeof t && o[t].call(n) | |
}) | |
} | |
var n = '[data-dismiss="alert"]', | |
i = function(t) { | |
e(t).on("click", n, this.close) | |
}; | |
i.VERSION = "3.3.7", i.TRANSITION_DURATION = 150, i.prototype.close = function(t) { | |
function n() { | |
a.detach().trigger("closed.bs.alert").remove() | |
} | |
var o = e(this), | |
s = o.attr("data-target"); | |
s || (s = o.attr("href"), s = s && s.replace(/.*(?=#[^\s]*$)/, "")); | |
var a = e("#" === s ? [] : s); | |
t && t.preventDefault(), a.length || (a = o.closest(".alert")), a.trigger(t = e.Event("close.bs.alert")), t.isDefaultPrevented() || (a.removeClass("in"), e.support.transition && a.hasClass("fade") ? a.one("bsTransitionEnd", n).emulateTransitionEnd(i.TRANSITION_DURATION) : n()) | |
}; | |
var o = e.fn.alert; | |
e.fn.alert = t, e.fn.alert.Constructor = i, e.fn.alert.noConflict = function() { | |
return e.fn.alert = o, this | |
}, e(document).on("click.bs.alert.data-api", n, i.prototype.close) | |
}(jQuery), + function(e) { | |
"use strict"; | |
function t(t) { | |
return this.each(function() { | |
var i = e(this), | |
o = i.data("bs.button"), | |
s = "object" == typeof t && t; | |
o || i.data("bs.button", o = new n(this, s)), "toggle" == t ? o.toggle() : t && o.setState(t) | |
}) | |
} | |
var n = function(t, i) { | |
this.$element = e(t), this.options = e.extend({}, n.DEFAULTS, i), this.isLoading = !1 | |
}; | |
n.VERSION = "3.3.7", n.DEFAULTS = { | |
loadingText: "loading..." | |
}, n.prototype.setState = function(t) { | |
var n = "disabled", | |
i = this.$element, | |
o = i.is("input") ? "val" : "html", | |
s = i.data(); | |
t += "Text", null == s.resetText && i.data("resetText", i[o]()), setTimeout(e.proxy(function() { | |
i[o](null == s[t] ? this.options[t] : s[t]), "loadingText" == t ? (this.isLoading = !0, i.addClass(n).attr(n, n).prop(n, !0)) : this.isLoading && (this.isLoading = !1, i.removeClass(n).removeAttr(n).prop(n, !1)) | |
}, this), 0) | |
}, n.prototype.toggle = function() { | |
var e = !0, | |
t = this.$element.closest('[data-toggle="buttons"]'); | |
if (t.length) { | |
var n = this.$element.find("input"); | |
"radio" == n.prop("type") ? (n.prop("checked") && (e = !1), t.find(".active").removeClass("active"), this.$element.addClass("active")) : "checkbox" == n.prop("type") && (n.prop("checked") !== this.$element.hasClass("active") && (e = !1), this.$element.toggleClass("active")), n.prop("checked", this.$element.hasClass("active")), e && n.trigger("change") | |
} else this.$element.attr("aria-pressed", !this.$element.hasClass("active")), this.$element.toggleClass("active") | |
}; | |
var i = e.fn.button; | |
e.fn.button = t, e.fn.button.Constructor = n, e.fn.button.noConflict = function() { | |
return e.fn.button = i, this | |
}, e(document).on("click.bs.button.data-api", '[data-toggle^="button"]', function(n) { | |
var i = e(n.target).closest(".btn"); | |
t.call(i, "toggle"), e(n.target).is('input[type="radio"], input[type="checkbox"]') || (n.preventDefault(), i.is("input,button") ? i.trigger("focus") : i.find("input:visible,button:visible").first().trigger("focus")) | |
}).on("focus.bs.button.data-api blur.bs.button.data-api", '[data-toggle^="button"]', function(t) { | |
e(t.target).closest(".btn").toggleClass("focus", /^focus(in)?$/.test(t.type)) | |
}) | |
}(jQuery), + function(e) { | |
"use strict"; | |
function t(t) { | |
return this.each(function() { | |
var i = e(this), | |
o = i.data("bs.carousel"), | |
s = e.extend({}, n.DEFAULTS, i.data(), "object" == typeof t && t), | |
a = "string" == typeof t ? t : s.slide; | |
o || i.data("bs.carousel", o = new n(this, s)), "number" == typeof t ? o.to(t) : a ? o[a]() : s.interval && o.pause().cycle() | |
}) | |
} | |
var n = function(t, n) { | |
this.$element = e(t), this.$indicators = this.$element.find(".carousel-indicators"), this.options = n, this.paused = null, this.sliding = null, this.interval = null, | |
this.$active = null, this.$items = null, this.options.keyboard && this.$element.on("keydown.bs.carousel", e.proxy(this.keydown, this)), "hover" == this.options.pause && !("ontouchstart" in document.documentElement) && this.$element.on("mouseenter.bs.carousel", e.proxy(this.pause, this)).on("mouseleave.bs.carousel", e.proxy(this.cycle, this)) | |
}; | |
n.VERSION = "3.3.7", n.TRANSITION_DURATION = 600, n.DEFAULTS = { | |
interval: 5e3, | |
pause: "hover", | |
wrap: !0, | |
keyboard: !0 | |
}, n.prototype.keydown = function(e) { | |
if (!/input|textarea/i.test(e.target.tagName)) { | |
switch (e.which) { | |
case 37: | |
this.prev(); | |
break; | |
case 39: | |
this.next(); | |
break; | |
default: | |
return | |
} | |
e.preventDefault() | |
} | |
}, n.prototype.cycle = function(t) { | |
return t || (this.paused = !1), this.interval && clearInterval(this.interval), this.options.interval && !this.paused && (this.interval = setInterval(e.proxy(this.next, this), this.options.interval)), this | |
}, n.prototype.getItemIndex = function(e) { | |
return this.$items = e.parent().children(".item"), this.$items.index(e || this.$active) | |
}, n.prototype.getItemForDirection = function(e, t) { | |
var n = this.getItemIndex(t), | |
i = "prev" == e && 0 === n || "next" == e && n == this.$items.length - 1; | |
if (i && !this.options.wrap) return t; | |
var o = "prev" == e ? -1 : 1, | |
s = (n + o) % this.$items.length; | |
return this.$items.eq(s) | |
}, n.prototype.to = function(e) { | |
var t = this, | |
n = this.getItemIndex(this.$active = this.$element.find(".item.active")); | |
if (!(e > this.$items.length - 1 || e < 0)) return this.sliding ? this.$element.one("slid.bs.carousel", function() { | |
t.to(e) | |
}) : n == e ? this.pause().cycle() : this.slide(e > n ? "next" : "prev", this.$items.eq(e)) | |
}, n.prototype.pause = function(t) { | |
return t || (this.paused = !0), this.$element.find(".next, .prev").length && e.support.transition && (this.$element.trigger(e.support.transition.end), this.cycle(!0)), this.interval = clearInterval(this.interval), this | |
}, n.prototype.next = function() { | |
if (!this.sliding) return this.slide("next") | |
}, n.prototype.prev = function() { | |
if (!this.sliding) return this.slide("prev") | |
}, n.prototype.slide = function(t, i) { | |
var o = this.$element.find(".item.active"), | |
s = i || this.getItemForDirection(t, o), | |
a = this.interval, | |
r = "next" == t ? "left" : "right", | |
l = this; | |
if (s.hasClass("active")) return this.sliding = !1; | |
var u = s[0], | |
c = e.Event("slide.bs.carousel", { | |
relatedTarget: u, | |
direction: r | |
}); | |
if (this.$element.trigger(c), !c.isDefaultPrevented()) { | |
if (this.sliding = !0, a && this.pause(), this.$indicators.length) { | |
this.$indicators.find(".active").removeClass("active"); | |
var d = e(this.$indicators.children()[this.getItemIndex(s)]); | |
d && d.addClass("active") | |
} | |
var p = e.Event("slid.bs.carousel", { | |
relatedTarget: u, | |
direction: r | |
}); | |
return e.support.transition && this.$element.hasClass("slide") ? (s.addClass(t), s[0].offsetWidth, o.addClass(r), s.addClass(r), o.one("bsTransitionEnd", function() { | |
s.removeClass([t, r].join(" ")).addClass("active"), o.removeClass(["active", r].join(" ")), l.sliding = !1, setTimeout(function() { | |
l.$element.trigger(p) | |
}, 0) | |
}).emulateTransitionEnd(n.TRANSITION_DURATION)) : (o.removeClass("active"), s.addClass("active"), this.sliding = !1, this.$element.trigger(p)), a && this.cycle(), this | |
} | |
}; | |
var i = e.fn.carousel; | |
e.fn.carousel = t, e.fn.carousel.Constructor = n, e.fn.carousel.noConflict = function() { | |
return e.fn.carousel = i, this | |
}; | |
var o = function(n) { | |
var i, o = e(this), | |
s = e(o.attr("data-target") || (i = o.attr("href")) && i.replace(/.*(?=#[^\s]+$)/, "")); | |
if (s.hasClass("carousel")) { | |
var a = e.extend({}, s.data(), o.data()), | |
r = o.attr("data-slide-to"); | |
r && (a.interval = !1), t.call(s, a), r && s.data("bs.carousel").to(r), n.preventDefault() | |
} | |
}; | |
e(document).on("click.bs.carousel.data-api", "[data-slide]", o).on("click.bs.carousel.data-api", "[data-slide-to]", o), e(window).on("load", function() { | |
e('[data-ride="carousel"]').each(function() { | |
var n = e(this); | |
t.call(n, n.data()) | |
}) | |
}) | |
}(jQuery), + function(e) { | |
"use strict"; | |
function t(t) { | |
var n, i = t.attr("data-target") || (n = t.attr("href")) && n.replace(/.*(?=#[^\s]+$)/, ""); | |
return e(i) | |
} | |
function n(t) { | |
return this.each(function() { | |
var n = e(this), | |
o = n.data("bs.collapse"), | |
s = e.extend({}, i.DEFAULTS, n.data(), "object" == typeof t && t); | |
!o && s.toggle && /show|hide/.test(t) && (s.toggle = !1), o || n.data("bs.collapse", o = new i(this, s)), "string" == typeof t && o[t]() | |
}) | |
} | |
var i = function(t, n) { | |
this.$element = e(t), this.options = e.extend({}, i.DEFAULTS, n), this.$trigger = e('[data-toggle="collapse"][href="#' + t.id + '"],[data-toggle="collapse"][data-target="#' + t.id + '"]'), this.transitioning = null, this.options.parent ? this.$parent = this.getParent() : this.addAriaAndCollapsedClass(this.$element, this.$trigger), this.options.toggle && this.toggle() | |
}; | |
i.VERSION = "3.3.7", i.TRANSITION_DURATION = 350, i.DEFAULTS = { | |
toggle: !0 | |
}, i.prototype.dimension = function() { | |
var e = this.$element.hasClass("width"); | |
return e ? "width" : "height" | |
}, i.prototype.show = function() { | |
if (!this.transitioning && !this.$element.hasClass("in")) { | |
var t, o = this.$parent && this.$parent.children(".panel").children(".in, .collapsing"); | |
if (!(o && o.length && (t = o.data("bs.collapse"), t && t.transitioning))) { | |
var s = e.Event("show.bs.collapse"); | |
if (this.$element.trigger(s), !s.isDefaultPrevented()) { | |
o && o.length && (n.call(o, "hide"), t || o.data("bs.collapse", null)); | |
var a = this.dimension(); | |
this.$element.removeClass("collapse").addClass("collapsing")[a](0).attr("aria-expanded", !0), this.$trigger.removeClass("collapsed").attr("aria-expanded", !0), this.transitioning = 1; | |
var r = function() { | |
this.$element.removeClass("collapsing").addClass("collapse in")[a](""), this.transitioning = 0, this.$element.trigger("shown.bs.collapse") | |
}; | |
if (!e.support.transition) return r.call(this); | |
var l = e.camelCase(["scroll", a].join("-")); | |
this.$element.one("bsTransitionEnd", e.proxy(r, this)).emulateTransitionEnd(i.TRANSITION_DURATION)[a](this.$element[0][l]) | |
} | |
} | |
} | |
}, i.prototype.hide = function() { | |
if (!this.transitioning && this.$element.hasClass("in")) { | |
var t = e.Event("hide.bs.collapse"); | |
if (this.$element.trigger(t), !t.isDefaultPrevented()) { | |
var n = this.dimension(); | |
this.$element[n](this.$element[n]())[0].offsetHeight, this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded", !1), this.$trigger.addClass("collapsed").attr("aria-expanded", !1), this.transitioning = 1; | |
var o = function() { | |
this.transitioning = 0, this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse") | |
}; | |
return e.support.transition ? void this.$element[n](0).one("bsTransitionEnd", e.proxy(o, this)).emulateTransitionEnd(i.TRANSITION_DURATION) : o.call(this) | |
} | |
} | |
}, i.prototype.toggle = function() { | |
this[this.$element.hasClass("in") ? "hide" : "show"]() | |
}, i.prototype.getParent = function() { | |
return e(this.options.parent).find('[data-toggle="collapse"][data-parent="' + this.options.parent + '"]').each(e.proxy(function(n, i) { | |
var o = e(i); | |
this.addAriaAndCollapsedClass(t(o), o) | |
}, this)).end() | |
}, i.prototype.addAriaAndCollapsedClass = function(e, t) { | |
var n = e.hasClass("in"); | |
e.attr("aria-expanded", n), t.toggleClass("collapsed", !n).attr("aria-expanded", n) | |
}; | |
var o = e.fn.collapse; | |
e.fn.collapse = n, e.fn.collapse.Constructor = i, e.fn.collapse.noConflict = function() { | |
return e.fn.collapse = o, this | |
}, e(document).on("click.bs.collapse.data-api", '[data-toggle="collapse"]', function(i) { | |
var o = e(this); | |
o.attr("data-target") || i.preventDefault(); | |
var s = t(o), | |
a = s.data("bs.collapse"), | |
r = a ? "toggle" : o.data(); | |
n.call(s, r) | |
}) | |
}(jQuery), + function(e) { | |
"use strict"; | |
function t(t) { | |
var n = t.attr("data-target"); | |
n || (n = t.attr("href"), n = n && /#[A-Za-z]/.test(n) && n.replace(/.*(?=#[^\s]*$)/, "")); | |
var i = n && e(n); | |
return i && i.length ? i : t.parent() | |
} | |
function n(n) { | |
n && 3 === n.which || (e(o).remove(), e(s).each(function() { | |
var i = e(this), | |
o = t(i), | |
s = { | |
relatedTarget: this | |
}; | |
o.hasClass("open") && (n && "click" == n.type && /input|textarea/i.test(n.target.tagName) && e.contains(o[0], n.target) || (o.trigger(n = e.Event("hide.bs.dropdown", s)), n.isDefaultPrevented() || (i.attr("aria-expanded", "false"), o.removeClass("open").trigger(e.Event("hidden.bs.dropdown", s))))) | |
})) | |
} | |
function i(t) { | |
return this.each(function() { | |
var n = e(this), | |
i = n.data("bs.dropdown"); | |
i || n.data("bs.dropdown", i = new a(this)), "string" == typeof t && i[t].call(n) | |
}) | |
} | |
var o = ".dropdown-backdrop", | |
s = '[data-toggle="dropdown"]', | |
a = function(t) { | |
e(t).on("click.bs.dropdown", this.toggle) | |
}; | |
a.VERSION = "3.3.7", a.prototype.toggle = function(i) { | |
var o = e(this); | |
if (!o.is(".disabled, :disabled")) { | |
var s = t(o), | |
a = s.hasClass("open"); | |
if (n(), !a) { | |
"ontouchstart" in document.documentElement && !s.closest(".navbar-nav").length && e(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(e(this)).on("click", n); | |
var r = { | |
relatedTarget: this | |
}; | |
if (s.trigger(i = e.Event("show.bs.dropdown", r)), i.isDefaultPrevented()) return; | |
o.trigger("focus").attr("aria-expanded", "true"), s.toggleClass("open").trigger(e.Event("shown.bs.dropdown", r)) | |
} | |
return !1 | |
} | |
}, a.prototype.keydown = function(n) { | |
if (/(38|40|27|32)/.test(n.which) && !/input|textarea/i.test(n.target.tagName)) { | |
var i = e(this); | |
if (n.preventDefault(), n.stopPropagation(), !i.is(".disabled, :disabled")) { | |
var o = t(i), | |
a = o.hasClass("open"); | |
if (!a && 27 != n.which || a && 27 == n.which) return 27 == n.which && o.find(s).trigger("focus"), i.trigger("click"); | |
var r = " li:not(.disabled):visible a", | |
l = o.find(".dropdown-menu" + r); | |
if (l.length) { | |
var u = l.index(n.target); | |
38 == n.which && u > 0 && u--, 40 == n.which && u < l.length - 1 && u++, ~u || (u = 0), l.eq(u).trigger("focus") | |
} | |
} | |
} | |
}; | |
var r = e.fn.dropdown; | |
e.fn.dropdown = i, e.fn.dropdown.Constructor = a, e.fn.dropdown.noConflict = function() { | |
return e.fn.dropdown = r, this | |
}, e(document).on("click.bs.dropdown.data-api", n).on("click.bs.dropdown.data-api", ".dropdown form", function(e) { | |
e.stopPropagation() | |
}).on("click.bs.dropdown.data-api", s, a.prototype.toggle).on("keydown.bs.dropdown.data-api", s, a.prototype.keydown).on("keydown.bs.dropdown.data-api", ".dropdown-menu", a.prototype.keydown) | |
}(jQuery), + function(e) { | |
"use strict"; | |
function t(t, i) { | |
return this.each(function() { | |
var o = e(this), | |
s = o.data("bs.modal"), | |
a = e.extend({}, n.DEFAULTS, o.data(), "object" == typeof t && t); | |
s || o.data("bs.modal", s = new n(this, a)), "string" == typeof t ? s[t](i) : a.show && s.show(i) | |
}) | |
} | |
var n = function(t, n) { | |
this.options = n, this.$body = e(document.body), this.$element = e(t), this.$dialog = this.$element.find(".modal-dialog"), this.$backdrop = null, this.isShown = null, this.originalBodyPad = null, this.scrollbarWidth = 0, this.ignoreBackdropClick = !1, this.options.remote && this.$element.find(".modal-content").load(this.options.remote, e.proxy(function() { | |
this.$element.trigger("loaded.bs.modal") | |
}, this)) | |
}; | |
n.VERSION = "3.3.7", n.TRANSITION_DURATION = 300, n.BACKDROP_TRANSITION_DURATION = 150, n.DEFAULTS = { | |
backdrop: !0, | |
keyboard: !0, | |
show: !0 | |
}, n.prototype.toggle = function(e) { | |
return this.isShown ? this.hide() : this.show(e) | |
}, n.prototype.show = function(t) { | |
var i = this, | |
o = e.Event("show.bs.modal", { | |
relatedTarget: t | |
}); | |
this.$element.trigger(o), this.isShown || o.isDefaultPrevented() || (this.isShown = !0, this.checkScrollbar(), this.setScrollbar(), this.$body.addClass("modal-open"), this.escape(), this.resize(), this.$element.on("click.dismiss.bs.modal", '[data-dismiss="modal"]', e.proxy(this.hide, this)), this.$dialog.on("mousedown.dismiss.bs.modal", function() { | |
i.$element.one("mouseup.dismiss.bs.modal", function(t) { | |
e(t.target).is(i.$element) && (i.ignoreBackdropClick = !0) | |
}) | |
}), this.backdrop(function() { | |
var o = e.support.transition && i.$element.hasClass("fade"); | |
i.$element.parent().length || i.$element.appendTo(i.$body), i.$element.show().scrollTop(0), i.adjustDialog(), o && i.$element[0].offsetWidth, i.$element.addClass("in"), i.enforceFocus(); | |
var s = e.Event("shown.bs.modal", { | |
relatedTarget: t | |
}); | |
o ? i.$dialog.one("bsTransitionEnd", function() { | |
i.$element.trigger("focus").trigger(s) | |
}).emulateTransitionEnd(n.TRANSITION_DURATION) : i.$element.trigger("focus").trigger(s) | |
})) | |
}, n.prototype.hide = function(t) { | |
t && t.preventDefault(), t = e.Event("hide.bs.modal"), this.$element.trigger(t), this.isShown && !t.isDefaultPrevented() && (this.isShown = !1, this.escape(), this.resize(), e(document).off("focusin.bs.modal"), this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"), this.$dialog.off("mousedown.dismiss.bs.modal"), e.support.transition && this.$element.hasClass("fade") ? this.$element.one("bsTransitionEnd", e.proxy(this.hideModal, this)).emulateTransitionEnd(n.TRANSITION_DURATION) : this.hideModal()) | |
}, n.prototype.enforceFocus = function() { | |
e(document).off("focusin.bs.modal").on("focusin.bs.modal", e.proxy(function(e) { | |
document === e.target || this.$element[0] === e.target || this.$element.has(e.target).length || this.$element.trigger("focus") | |
}, this)) | |
}, n.prototype.escape = function() { | |
this.isShown && this.options.keyboard ? this.$element.on("keydown.dismiss.bs.modal", e.proxy(function(e) { | |
27 == e.which && this.hide() | |
}, this)) : this.isShown || this.$element.off("keydown.dismiss.bs.modal") | |
}, n.prototype.resize = function() { | |
this.isShown ? e(window).on("resize.bs.modal", e.proxy(this.handleUpdate, this)) : e(window).off("resize.bs.modal") | |
}, n.prototype.hideModal = function() { | |
var e = this; | |
this.$element.hide(), this.backdrop(function() { | |
e.$body.removeClass("modal-open"), e.resetAdjustments(), e.resetScrollbar(), e.$element.trigger("hidden.bs.modal") | |
}) | |
}, n.prototype.removeBackdrop = function() { | |
this.$backdrop && this.$backdrop.remove(), this.$backdrop = null | |
}, n.prototype.backdrop = function(t) { | |
var i = this, | |
o = this.$element.hasClass("fade") ? "fade" : ""; | |
if (this.isShown && this.options.backdrop) { | |
var s = e.support.transition && o; | |
if (this.$backdrop = e(document.createElement("div")).addClass("modal-backdrop " + o).appendTo(this.$body), this.$element.on("click.dismiss.bs.modal", e.proxy(function(e) { | |
return this.ignoreBackdropClick ? void(this.ignoreBackdropClick = !1) : void(e.target === e.currentTarget && ("static" == this.options.backdrop ? this.$element[0].focus() : this.hide())) | |
}, this)), s && this.$backdrop[0].offsetWidth, this.$backdrop.addClass("in"), !t) return; | |
s ? this.$backdrop.one("bsTransitionEnd", t).emulateTransitionEnd(n.BACKDROP_TRANSITION_DURATION) : t() | |
} else if (!this.isShown && this.$backdrop) { | |
this.$backdrop.removeClass("in"); | |
var a = function() { | |
i.removeBackdrop(), t && t() | |
}; | |
e.support.transition && this.$element.hasClass("fade") ? this.$backdrop.one("bsTransitionEnd", a).emulateTransitionEnd(n.BACKDROP_TRANSITION_DURATION) : a() | |
} else t && t() | |
}, n.prototype.handleUpdate = function() { | |
this.adjustDialog() | |
}, n.prototype.adjustDialog = function() { | |
var e = this.$element[0].scrollHeight > document.documentElement.clientHeight; | |
this.$element.css({ | |
paddingLeft: !this.bodyIsOverflowing && e ? this.scrollbarWidth : "", | |
paddingRight: this.bodyIsOverflowing && !e ? this.scrollbarWidth : "" | |
}) | |
}, n.prototype.resetAdjustments = function() { | |
this.$element.css({ | |
paddingLeft: "", | |
paddingRight: "" | |
}) | |
}, n.prototype.checkScrollbar = function() { | |
var e = window.innerWidth; | |
if (!e) { | |
var t = document.documentElement.getBoundingClientRect(); | |
e = t.right - Math.abs(t.left) | |
} | |
this.bodyIsOverflowing = document.body.clientWidth < e, this.scrollbarWidth = this.measureScrollbar() | |
}, n.prototype.setScrollbar = function() { | |
var e = parseInt(this.$body.css("padding-right") || 0, 10); | |
this.originalBodyPad = document.body.style.paddingRight || "", this.bodyIsOverflowing && this.$body.css("padding-right", e + this.scrollbarWidth) | |
}, n.prototype.resetScrollbar = function() { | |
this.$body.css("padding-right", this.originalBodyPad) | |
}, n.prototype.measureScrollbar = function() { | |
var e = document.createElement("div"); | |
e.className = "modal-scrollbar-measure", this.$body.append(e); | |
var t = e.offsetWidth - e.clientWidth; | |
return this.$body[0].removeChild(e), t | |
}; | |
var i = e.fn.modal; | |
e.fn.modal = t, e.fn.modal.Constructor = n, e.fn.modal.noConflict = function() { | |
return e.fn.modal = i, this | |
}, e(document).on("click.bs.modal.data-api", '[data-toggle="modal"]', function(n) { | |
var i = e(this), | |
o = i.attr("href"), | |
s = e(i.attr("data-target") || o && o.replace(/.*(?=#[^\s]+$)/, "")), | |
a = s.data("bs.modal") ? "toggle" : e.extend({ | |
remote: !/#/.test(o) && o | |
}, s.data(), i.data()); | |
i.is("a") && n.preventDefault(), s.one("show.bs.modal", function(e) { | |
e.isDefaultPrevented() || s.one("hidden.bs.modal", function() { | |
i.is(":visible") && i.trigger("focus") | |
}) | |
}), t.call(s, a, this) | |
}) | |
}(jQuery), + function(e) { | |
"use strict"; | |
function t(t) { | |
return this.each(function() { | |
var i = e(this), | |
o = i.data("bs.tooltip"), | |
s = "object" == typeof t && t; | |
!o && /destroy|hide/.test(t) || (o || i.data("bs.tooltip", o = new n(this, s)), "string" == typeof t && o[t]()) | |
}) | |
} | |
var n = function(e, t) { | |
this.type = null, this.options = null, this.enabled = null, this.timeout = null, this.hoverState = null, this.$element = null, this.inState = null, this.init("tooltip", e, t) | |
}; | |
n.VERSION = "3.3.7", n.TRANSITION_DURATION = 150, n.DEFAULTS = { | |
animation: !0, | |
placement: "top", | |
selector: !1, | |
template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>', | |
trigger: "hover focus", | |
title: "", | |
delay: 0, | |
html: !1, | |
container: !1, | |
viewport: { | |
selector: "body", | |
padding: 0 | |
} | |
}, n.prototype.init = function(t, n, i) { | |
if (this.enabled = !0, this.type = t, this.$element = e(n), this.options = this.getOptions(i), this.$viewport = this.options.viewport && e(e.isFunction(this.options.viewport) ? this.options.viewport.call(this, this.$element) : this.options.viewport.selector || this.options.viewport), this.inState = { | |
click: !1, | |
hover: !1, | |
focus: !1 | |
}, this.$element[0] instanceof document.constructor && !this.options.selector) throw new Error("`selector` option must be specified when initializing " + this.type + " on the window.document object!"); | |
for (var o = this.options.trigger.split(" "), s = o.length; s--;) { | |
var a = o[s]; | |
if ("click" == a) this.$element.on("click." + this.type, this.options.selector, e.proxy(this.toggle, this)); | |
else if ("manual" != a) { | |
var r = "hover" == a ? "mouseenter" : "focusin", | |
l = "hover" == a ? "mouseleave" : "focusout"; | |
this.$element.on(r + "." + this.type, this.options.selector, e.proxy(this.enter, this)), this.$element.on(l + "." + this.type, this.options.selector, e.proxy(this.leave, this)) | |
} | |
} | |
this.options.selector ? this._options = e.extend({}, this.options, { | |
trigger: "manual", | |
selector: "" | |
}) : this.fixTitle() | |
}, n.prototype.getDefaults = function() { | |
return n.DEFAULTS | |
}, n.prototype.getOptions = function(t) { | |
return t = e.extend({}, this.getDefaults(), this.$element.data(), t), t.delay && "number" == typeof t.delay && (t.delay = { | |
show: t.delay, | |
hide: t.delay | |
}), t | |
}, n.prototype.getDelegateOptions = function() { | |
var t = {}, | |
n = this.getDefaults(); | |
return this._options && e.each(this._options, function(e, i) { | |
n[e] != i && (t[e] = i) | |
}), t | |
}, n.prototype.enter = function(t) { | |
var n = t instanceof this.constructor ? t : e(t.currentTarget).data("bs." + this.type); | |
return n || (n = new this.constructor(t.currentTarget, this.getDelegateOptions()), e(t.currentTarget).data("bs." + this.type, n)), t instanceof e.Event && (n.inState["focusin" == t.type ? "focus" : "hover"] = !0), n.tip().hasClass("in") || "in" == n.hoverState ? void(n.hoverState = "in") : (clearTimeout(n.timeout), n.hoverState = "in", n.options.delay && n.options.delay.show ? void(n.timeout = setTimeout(function() { | |
"in" == n.hoverState && n.show() | |
}, n.options.delay.show)) : n.show()) | |
}, n.prototype.isInStateTrue = function() { | |
for (var e in this.inState) | |
if (this.inState[e]) return !0; | |
return !1 | |
}, n.prototype.leave = function(t) { | |
var n = t instanceof this.constructor ? t : e(t.currentTarget).data("bs." + this.type); | |
if (n || (n = new this.constructor(t.currentTarget, this.getDelegateOptions()), e(t.currentTarget).data("bs." + this.type, n)), t instanceof e.Event && (n.inState["focusout" == t.type ? "focus" : "hover"] = !1), !n.isInStateTrue()) return clearTimeout(n.timeout), n.hoverState = "out", n.options.delay && n.options.delay.hide ? void(n.timeout = setTimeout(function() { | |
"out" == n.hoverState && n.hide() | |
}, n.options.delay.hide)) : n.hide() | |
}, n.prototype.show = function() { | |
var t = e.Event("show.bs." + this.type); | |
if (this.hasContent() && this.enabled) { | |
this.$element.trigger(t); | |
var i = e.contains(this.$element[0].ownerDocument.documentElement, this.$element[0]); | |
if (t.isDefaultPrevented() || !i) return; | |
var o = this, | |
s = this.tip(), | |
a = this.getUID(this.type); | |
this.setContent(), s.attr("id", a), this.$element.attr("aria-describedby", a), this.options.animation && s.addClass("fade"); | |
var r = "function" == typeof this.options.placement ? this.options.placement.call(this, s[0], this.$element[0]) : this.options.placement, | |
l = /\s?auto?\s?/i, | |
u = l.test(r); | |
u && (r = r.replace(l, "") || "top"), s.detach().css({ | |
top: 0, | |
left: 0, | |
display: "block" | |
}).addClass(r).data("bs." + this.type, this), this.options.container ? s.appendTo(this.options.container) : s.insertAfter(this.$element), this.$element.trigger("inserted.bs." + this.type); | |
var c = this.getPosition(), | |
d = s[0].offsetWidth, | |
p = s[0].offsetHeight; | |
if (u) { | |
var f = r, | |
h = this.getPosition(this.$viewport); | |
r = "bottom" == r && c.bottom + p > h.bottom ? "top" : "top" == r && c.top - p < h.top ? "bottom" : "right" == r && c.right + d > h.width ? "left" : "left" == r && c.left - d < h.left ? "right" : r, s.removeClass(f).addClass(r) | |
} | |
var g = this.getCalculatedOffset(r, c, d, p); | |
this.applyPlacement(g, r); | |
var m = function() { | |
var e = o.hoverState; | |
o.$element.trigger("shown.bs." + o.type), o.hoverState = null, "out" == e && o.leave(o) | |
}; | |
e.support.transition && this.$tip.hasClass("fade") ? s.one("bsTransitionEnd", m).emulateTransitionEnd(n.TRANSITION_DURATION) : m() | |
} | |
}, n.prototype.applyPlacement = function(t, n) { | |
var i = this.tip(), | |
o = i[0].offsetWidth, | |
s = i[0].offsetHeight, | |
a = parseInt(i.css("margin-top"), 10), | |
r = parseInt(i.css("margin-left"), 10); | |
isNaN(a) && (a = 0), isNaN(r) && (r = 0), t.top += a, t.left += r, e.offset.setOffset(i[0], e.extend({ | |
using: function(e) { | |
i.css({ | |
top: Math.round(e.top), | |
left: Math.round(e.left) | |
}) | |
} | |
}, t), 0), i.addClass("in"); | |
var l = i[0].offsetWidth, | |
u = i[0].offsetHeight; | |
"top" == n && u != s && (t.top = t.top + s - u); | |
var c = this.getViewportAdjustedDelta(n, t, l, u); | |
c.left ? t.left += c.left : t.top += c.top; | |
var d = /top|bottom/.test(n), | |
p = d ? 2 * c.left - o + l : 2 * c.top - s + u, | |
f = d ? "offsetWidth" : "offsetHeight"; | |
i.offset(t), this.replaceArrow(p, i[0][f], d) | |
}, n.prototype.replaceArrow = function(e, t, n) { | |
this.arrow().css(n ? "left" : "top", 50 * (1 - e / t) + "%").css(n ? "top" : "left", "") | |
}, n.prototype.setContent = function() { | |
var e = this.tip(), | |
t = this.getTitle(); | |
e.find(".tooltip-inner")[this.options.html ? "html" : "text"](t), e.removeClass("fade in top bottom left right") | |
}, n.prototype.hide = function(t) { | |
function i() { | |
"in" != o.hoverState && s.detach(), o.$element && o.$element.removeAttr("aria-describedby").trigger("hidden.bs." + o.type), t && t() | |
} | |
var o = this, | |
s = e(this.$tip), | |
a = e.Event("hide.bs." + this.type); | |
if (this.$element.trigger(a), !a.isDefaultPrevented()) return s.removeClass("in"), e.support.transition && s.hasClass("fade") ? s.one("bsTransitionEnd", i).emulateTransitionEnd(n.TRANSITION_DURATION) : i(), this.hoverState = null, this | |
}, n.prototype.fixTitle = function() { | |
var e = this.$element; | |
(e.attr("title") || "string" != typeof e.attr("data-original-title")) && e.attr("data-original-title", e.attr("title") || "").attr("title", "") | |
}, n.prototype.hasContent = function() { | |
return this.getTitle() | |
}, n.prototype.getPosition = function(t) { | |
t = t || this.$element; | |
var n = t[0], | |
i = "BODY" == n.tagName, | |
o = n.getBoundingClientRect(); | |
null == o.width && (o = e.extend({}, o, { | |
width: o.right - o.left, | |
height: o.bottom - o.top | |
})); | |
var s = window.SVGElement && n instanceof window.SVGElement, | |
a = i ? { | |
top: 0, | |
left: 0 | |
} : s ? null : t.offset(), | |
r = { | |
scroll: i ? document.documentElement.scrollTop || document.body.scrollTop : t.scrollTop() | |
}, | |
l = i ? { | |
width: e(window).width(), | |
height: e(window).height() | |
} : null; | |
return e.extend({}, o, r, l, a) | |
}, n.prototype.getCalculatedOffset = function(e, t, n, i) { | |
return "bottom" == e ? { | |
top: t.top + t.height, | |
left: t.left + t.width / 2 - n / 2 | |
} : "top" == e ? { | |
top: t.top - i, | |
left: t.left + t.width / 2 - n / 2 | |
} : "left" == e ? { | |
top: t.top + t.height / 2 - i / 2, | |
left: t.left - n | |
} : { | |
top: t.top + t.height / 2 - i / 2, | |
left: t.left + t.width | |
} | |
}, n.prototype.getViewportAdjustedDelta = function(e, t, n, i) { | |
var o = { | |
top: 0, | |
left: 0 | |
}; | |
if (!this.$viewport) return o; | |
var s = this.options.viewport && this.options.viewport.padding || 0, | |
a = this.getPosition(this.$viewport); | |
if (/right|left/.test(e)) { | |
var r = t.top - s - a.scroll, | |
l = t.top + s - a.scroll + i; | |
r < a.top ? o.top = a.top - r : l > a.top + a.height && (o.top = a.top + a.height - l) | |
} else { | |
var u = t.left - s, | |
c = t.left + s + n; | |
u < a.left ? o.left = a.left - u : c > a.right && (o.left = a.left + a.width - c) | |
} | |
return o | |
}, n.prototype.getTitle = function() { | |
var e, t = this.$element, | |
n = this.options; | |
return e = t.attr("data-original-title") || ("function" == typeof n.title ? n.title.call(t[0]) : n.title) | |
}, n.prototype.getUID = function(e) { | |
do e += ~~(1e6 * Math.random()); while (document.getElementById(e)); | |
return e | |
}, n.prototype.tip = function() { | |
if (!this.$tip && (this.$tip = e(this.options.template), 1 != this.$tip.length)) throw new Error(this.type + " `template` option must consist of exactly 1 top-level element!"); | |
return this.$tip | |
}, n.prototype.arrow = function() { | |
return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow") | |
}, n.prototype.enable = function() { | |
this.enabled = !0 | |
}, n.prototype.disable = function() { | |
this.enabled = !1 | |
}, n.prototype.toggleEnabled = function() { | |
this.enabled = !this.enabled | |
}, n.prototype.toggle = function(t) { | |
var n = this; | |
t && (n = e(t.currentTarget).data("bs." + this.type), n || (n = new this.constructor(t.currentTarget, this.getDelegateOptions()), e(t.currentTarget).data("bs." + this.type, n))), t ? (n.inState.click = !n.inState.click, n.isInStateTrue() ? n.enter(n) : n.leave(n)) : n.tip().hasClass("in") ? n.leave(n) : n.enter(n) | |
}, n.prototype.destroy = function() { | |
var e = this; | |
clearTimeout(this.timeout), this.hide(function() { | |
e.$element.off("." + e.type).removeData("bs." + e.type), e.$tip && e.$tip.detach(), e.$tip = null, e.$arrow = null, e.$viewport = null, e.$element = null | |
}) | |
}; | |
var i = e.fn.tooltip; | |
e.fn.tooltip = t, e.fn.tooltip.Constructor = n, e.fn.tooltip.noConflict = function() { | |
return e.fn.tooltip = i, this | |
} | |
}(jQuery), + function(e) { | |
"use strict"; | |
function t(t) { | |
return this.each(function() { | |
var i = e(this), | |
o = i.data("bs.popover"), | |
s = "object" == typeof t && t; | |
!o && /destroy|hide/.test(t) || (o || i.data("bs.popover", o = new n(this, s)), "string" == typeof t && o[t]()) | |
}) | |
} | |
var n = function(e, t) { | |
this.init("popover", e, t) | |
}; | |
if (!e.fn.tooltip) throw new Error("Popover requires tooltip.js"); | |
n.VERSION = "3.3.7", n.DEFAULTS = e.extend({}, e.fn.tooltip.Constructor.DEFAULTS, { | |
placement: "right", | |
trigger: "click", | |
content: "", | |
template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>' | |
}), n.prototype = e.extend({}, e.fn.tooltip.Constructor.prototype), n.prototype.constructor = n, n.prototype.getDefaults = function() { | |
return n.DEFAULTS | |
}, n.prototype.setContent = function() { | |
var e = this.tip(), | |
t = this.getTitle(), | |
n = this.getContent(); | |
e.find(".popover-title")[this.options.html ? "html" : "text"](t), e.find(".popover-content").children().detach().end()[this.options.html ? "string" == typeof n ? "html" : "append" : "text"](n), e.removeClass("fade top bottom left right in"), e.find(".popover-title").html() || e.find(".popover-title").hide() | |
}, n.prototype.hasContent = function() { | |
return this.getTitle() || this.getContent() | |
}, n.prototype.getContent = function() { | |
var e = this.$element, | |
t = this.options; | |
return e.attr("data-content") || ("function" == typeof t.content ? t.content.call(e[0]) : t.content) | |
}, n.prototype.arrow = function() { | |
return this.$arrow = this.$arrow || this.tip().find(".arrow") | |
}; | |
var i = e.fn.popover; | |
e.fn.popover = t, e.fn.popover.Constructor = n, e.fn.popover.noConflict = function() { | |
return e.fn.popover = i, this | |
} | |
}(jQuery), + function(e) { | |
"use strict"; | |
function t(n, i) { | |
this.$body = e(document.body), this.$scrollElement = e(e(n).is(document.body) ? window : n), this.options = e.extend({}, t.DEFAULTS, i), this.selector = (this.options.target || "") + " .nav li > a", this.offsets = [], this.targets = [], this.activeTarget = null, this.scrollHeight = 0, this.$scrollElement.on("scroll.bs.scrollspy", e.proxy(this.process, this)), this.refresh(), this.process() | |
} | |
function n(n) { | |
return this.each(function() { | |
var i = e(this), | |
o = i.data("bs.scrollspy"), | |
s = "object" == typeof n && n; | |
o || i.data("bs.scrollspy", o = new t(this, s)), "string" == typeof n && o[n]() | |
}) | |
} | |
t.VERSION = "3.3.7", t.DEFAULTS = { | |
offset: 10 | |
}, t.prototype.getScrollHeight = function() { | |
return this.$scrollElement[0].scrollHeight || Math.max(this.$body[0].scrollHeight, document.documentElement.scrollHeight) | |
}, t.prototype.refresh = function() { | |
var t = this, | |
n = "offset", | |
i = 0; | |
this.offsets = [], this.targets = [], this.scrollHeight = this.getScrollHeight(), e.isWindow(this.$scrollElement[0]) || (n = "position", i = this.$scrollElement.scrollTop()), this.$body.find(this.selector).map(function() { | |
var t = e(this), | |
o = t.data("target") || t.attr("href"), | |
s = /^#./.test(o) && e(o); | |
return s && s.length && s.is(":visible") && [ | |
[s[n]().top + i, o] | |
] || null | |
}).sort(function(e, t) { | |
return e[0] - t[0] | |
}).each(function() { | |
t.offsets.push(this[0]), t.targets.push(this[1]) | |
}) | |
}, t.prototype.process = function() { | |
var e, t = this.$scrollElement.scrollTop() + this.options.offset, | |
n = this.getScrollHeight(), | |
i = this.options.offset + n - this.$scrollElement.height(), | |
o = this.offsets, | |
s = this.targets, | |
a = this.activeTarget; | |
if (this.scrollHeight != n && this.refresh(), t >= i) return a != (e = s[s.length - 1]) && this.activate(e); | |
if (a && t < o[0]) return this.activeTarget = null, this.clear(); | |
for (e = o.length; e--;) a != s[e] && t >= o[e] && (void 0 === o[e + 1] || t < o[e + 1]) && this.activate(s[e]) | |
}, t.prototype.activate = function(t) { | |
this.activeTarget = t, this.clear(); | |
var n = this.selector + '[data-target="' + t + '"],' + this.selector + '[href="' + t + '"]', | |
i = e(n).parents("li").addClass("active"); | |
i.parent(".dropdown-menu").length && (i = i.closest("li.dropdown").addClass("active")), i.trigger("activate.bs.scrollspy") | |
}, t.prototype.clear = function() { | |
e(this.selector).parentsUntil(this.options.target, ".active").removeClass("active") | |
}; | |
var i = e.fn.scrollspy; | |
e.fn.scrollspy = n, e.fn.scrollspy.Constructor = t, e.fn.scrollspy.noConflict = function() { | |
return e.fn.scrollspy = i, this | |
}, e(window).on("load.bs.scrollspy.data-api", function() { | |
e('[data-spy="scroll"]').each(function() { | |
var t = e(this); | |
n.call(t, t.data()) | |
}) | |
}) | |
}(jQuery), + function(e) { | |
"use strict"; | |
function t(t) { | |
return this.each(function() { | |
var i = e(this), | |
o = i.data("bs.tab"); | |
o || i.data("bs.tab", o = new n(this)), "string" == typeof t && o[t]() | |
}) | |
} | |
var n = function(t) { | |
this.element = e(t) | |
}; | |
n.VERSION = "3.3.7", n.TRANSITION_DURATION = 150, n.prototype.show = function() { | |
var t = this.element, | |
n = t.closest("ul:not(.dropdown-menu)"), | |
i = t.data("target"); | |
if (i || (i = t.attr("href"), i = i && i.replace(/.*(?=#[^\s]*$)/, "")), !t.parent("li").hasClass("active")) { | |
var o = n.find(".active:last a"), | |
s = e.Event("hide.bs.tab", { | |
relatedTarget: t[0] | |
}), | |
a = e.Event("show.bs.tab", { | |
relatedTarget: o[0] | |
}); | |
if (o.trigger(s), t.trigger(a), !a.isDefaultPrevented() && !s.isDefaultPrevented()) { | |
var r = e(i); | |
this.activate(t.closest("li"), n), this.activate(r, r.parent(), function() { | |
o.trigger({ | |
type: "hidden.bs.tab", | |
relatedTarget: t[0] | |
}), t.trigger({ | |
type: "shown.bs.tab", | |
relatedTarget: o[0] | |
}) | |
}) | |
} | |
} | |
}, n.prototype.activate = function(t, i, o) { | |
function s() { | |
a.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded", !1), t.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded", !0), r ? (t[0].offsetWidth, t.addClass("in")) : t.removeClass("fade"), t.parent(".dropdown-menu").length && t.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded", !0), o && o() | |
} | |
var a = i.find("> .active"), | |
r = o && e.support.transition && (a.length && a.hasClass("fade") || !!i.find("> .fade").length); | |
a.length && r ? a.one("bsTransitionEnd", s).emulateTransitionEnd(n.TRANSITION_DURATION) : s(), a.removeClass("in") | |
}; | |
var i = e.fn.tab; | |
e.fn.tab = t, e.fn.tab.Constructor = n, e.fn.tab.noConflict = function() { | |
return e.fn.tab = i, this | |
}; | |
var o = function(n) { | |
n.preventDefault(), t.call(e(this), "show") | |
}; | |
e(document).on("click.bs.tab.data-api", '[data-toggle="tab"]', o).on("click.bs.tab.data-api", '[data-toggle="pill"]', o) | |
}(jQuery), + function(e) { | |
"use strict"; | |
function t(t) { | |
return this.each(function() { | |
var i = e(this), | |
o = i.data("bs.affix"), | |
s = "object" == typeof t && t; | |
o || i.data("bs.affix", o = new n(this, s)), "string" == typeof t && o[t]() | |
}) | |
} | |
var n = function(t, i) { | |
this.options = e.extend({}, n.DEFAULTS, i), this.$target = e(this.options.target).on("scroll.bs.affix.data-api", e.proxy(this.checkPosition, this)).on("click.bs.affix.data-api", e.proxy(this.checkPositionWithEventLoop, this)), this.$element = e(t), this.affixed = null, this.unpin = null, this.pinnedOffset = null, this.checkPosition() | |
}; | |
n.VERSION = "3.3.7", n.RESET = "affix affix-top affix-bottom", n.DEFAULTS = { | |
offset: 0, | |
target: window | |
}, n.prototype.getState = function(e, t, n, i) { | |
var o = this.$target.scrollTop(), | |
s = this.$element.offset(), | |
a = this.$target.height(); | |
if (null != n && "top" == this.affixed) return o < n && "top"; | |
if ("bottom" == this.affixed) return null != n ? !(o + this.unpin <= s.top) && "bottom" : !(o + a <= e - i) && "bottom"; | |
var r = null == this.affixed, | |
l = r ? o : s.top, | |
u = r ? a : t; | |
return null != n && o <= n ? "top" : null != i && l + u >= e - i && "bottom" | |
}, n.prototype.getPinnedOffset = function() { | |
if (this.pinnedOffset) return this.pinnedOffset; | |
this.$element.removeClass(n.RESET).addClass("affix"); | |
var e = this.$target.scrollTop(), | |
t = this.$element.offset(); | |
return this.pinnedOffset = t.top - e | |
}, n.prototype.checkPositionWithEventLoop = function() { | |
setTimeout(e.proxy(this.checkPosition, this), 1) | |
}, n.prototype.checkPosition = function() { | |
if (this.$element.is(":visible")) { | |
var t = this.$element.height(), | |
i = this.options.offset, | |
o = i.top, | |
s = i.bottom, | |
a = Math.max(e(document).height(), e(document.body).height()); | |
"object" != typeof i && (s = o = i), "function" == typeof o && (o = i.top(this.$element)), "function" == typeof s && (s = i.bottom(this.$element)); | |
var r = this.getState(a, t, o, s); | |
if (this.affixed != r) { | |
null != this.unpin && this.$element.css("top", ""); | |
var l = "affix" + (r ? "-" + r : ""), | |
u = e.Event(l + ".bs.affix"); | |
if (this.$element.trigger(u), u.isDefaultPrevented()) return; | |
this.affixed = r, this.unpin = "bottom" == r ? this.getPinnedOffset() : null, this.$element.removeClass(n.RESET).addClass(l).trigger(l.replace("affix", "affixed") + ".bs.affix") | |
} | |
"bottom" == r && this.$element.offset({ | |
top: a - t - s | |
}) | |
} | |
}; | |
var i = e.fn.affix; | |
e.fn.affix = t, e.fn.affix.Constructor = n, e.fn.affix.noConflict = function() { | |
return e.fn.affix = i, this | |
}, e(window).on("load", function() { | |
e('[data-spy="affix"]').each(function() { | |
var n = e(this), | |
i = n.data(); | |
i.offset = i.offset || {}, null != i.offsetBottom && (i.offset.bottom = i.offsetBottom), null != i.offsetTop && (i.offset.top = i.offsetTop), t.call(n, i) | |
}) | |
}) | |
}(jQuery); | |
var MUSIC = { | |
notes: { | |
Fb: [6, -10], | |
Cb: [5, -9], | |
Gb: [5, -8], | |
Db: [4, -7], | |
Ab: [4, -6], | |
Eb: [3, -5], | |
Bb: [3, -4], | |
F: [2, -3], | |
C: [1, -2], | |
G: [1, -1], | |
D: [0, 0], | |
A: [0, 1], | |
E: [-1, 2], | |
B: [-1, 3], | |
"F#": [-2, 4], | |
"C#": [-3, 5], | |
"G#": [-3, 6], | |
"D#": [-4, 7], | |
"A#": [-4, 8], | |
"E#": [-5, 9], | |
"B#": [-5, 10] | |
}, | |
baseFreq: 440, | |
baseOffset: [4, 1], | |
intervals: { | |
unison: [0, 0], | |
"minor second": [3, -5], | |
"major second": [-1, 2], | |
"minor third": [2, -3], | |
"major third": [-2, 4], | |
fourth: [1, -1], | |
"augmented fourth": [-3, 6], | |
tritone: [-3, 6], | |
"diminished fifth": [4, -6], | |
fifth: [0, 1], | |
"minor sixth": [3, -4], | |
"major sixth": [-1, 3], | |
"minor seventh": [2, -2], | |
"major seventh": [-2, 5], | |
octave: [1, 0] | |
}, | |
intervals_semitones: { | |
0: [0, 0], | |
1: [3, -5], | |
2: [-1, 2], | |
3: [2, -3], | |
4: [-2, 4], | |
5: [1, -1], | |
6: [-3, 6], | |
7: [0, 1], | |
8: [3, -4], | |
9: [-1, 3], | |
10: [2, -2], | |
11: [-2, 5], | |
12: [1, 0] | |
}, | |
scales: { | |
chromatic: ["minor second", "major second", "minor third", "major third", "fourth", "augmented fourth", "fifth", "minor sixth", "major sixth", "minor seventh", "major seventh"], | |
"whole-tone": ["major second", "major third", "augmented fourth", "minor sixth", "minor seventh"], | |
major: ["major second", "major third", "fourth", "fifth", "major sixth", "major seventh"], | |
"natural minor": ["major second", "minor third", "fourth", "fifth", "minor sixth", "minor seventh"], | |
"harmonic minor": ["major second", "minor third", "fourth", "fifth", "minor sixth", "major seventh"], | |
"pentatonic major": ["major second", "major third", "fifth", "major sixth"], | |
"pentatonic minor": ["minor third", "fourth", "fifth", "minor seventh"], | |
"blues major": ["major second", "minor third", "major third", "fifth", "major sixth"], | |
"blues minor": ["minor third", "fourth", "augmented fourth", "fifth", "minor seventh"] | |
} | |
}; | |
Note.prototype.frequency = function() { | |
return MUSIC.baseFreq * Math.pow(2, (1200 * this.coord[0] + 700 * this.coord[1]) / 1200) | |
}, Note.prototype.accidental = function() { | |
return Math.round((this.coord[1] + MUSIC.baseOffset[1]) / 7) | |
}, Note.prototype.octave = function() { | |
var e = this.accidental(); | |
return this.coord[0] + MUSIC.baseOffset[0] + 4 * e + Math.floor((this.coord[1] + MUSIC.baseOffset[1] - 7 * e) / 2) | |
}, Note.prototype.latin = function() { | |
var e = ["F", "C", "G", "D", "A", "E", "B"], | |
t = ["bb", "b", "", "#", "x"], | |
n = this.accidental(); | |
return e[this.coord[1] + MUSIC.baseOffset[1] - 7 * n + 3] + t[n + 2] | |
}, Note.fromLatin = function(e) { | |
var t, n, i = [], | |
o = 0, | |
s = e.split(/(\d+)/); | |
if (s.length > 3) { | |
for (t = 0; t < (s.length - 1) / 2; t++) n = MUSIC.notes[s[o]], n = [n[0] + parseInt(s[o + 1]), n[1]], n[0] -= MUSIC.baseOffset[0], n[1] -= MUSIC.baseOffset[1], i[t] = new Note(n), o += 2; | |
return i | |
} | |
return n = MUSIC.notes[s[0]], n = [n[0] + parseInt(s[1]), n[1]], n[0] -= MUSIC.baseOffset[0], n[1] -= MUSIC.baseOffset[1], new Note(n) | |
}, Note.prototype.scale = function(e) { | |
var t, n = [], | |
i = MUSIC.scales[e.toLowerCase()]; | |
for (n.push(this.add("unison")), t = 0; t < i.length; t++) n[t + 1] = this.add(Interval.fromName(i[t])); | |
return n.push(this.add("octave")), n | |
}, Note.prototype.add = function(e) { | |
var t, n = []; | |
if ("string" == typeof e && (e = Interval.fromName(e)), e.length) { | |
for (t = 0; t < e.length; t++) n[t] = this.add(e[t]); | |
return add_addsubtract_func(n), n | |
} | |
return new Note([this.coord[0] + e.coord[0], this.coord[1] + e.coord[1]]) | |
}, Note.prototype.subtract = function(e) { | |
var t, n, i = []; | |
if ("string" == typeof e && (e = Interval.fromName(e)), e.length) { | |
for (t = 0; t < e.length; t++) i[t] = this.subtract(e[t]); | |
return add_addsubtract_func(i), i | |
} | |
return n = [this.coord[0] - e.coord[0], this.coord[1] - e.coord[1]], "function" == typeof e.frequency ? new Interval(n) : new Note(n) | |
}, Interval.fromName = function(e) { | |
return new Interval(MUSIC.intervals[e]) | |
}, Interval.fromSemitones = function(e) { | |
return new Interval(MUSIC.intervals_semitones[e]) | |
}, Interval.fromTonesSemitones = function(e) { | |
return new Interval([e[0] * -1 + 3 * e[1], 2 * e[0] + e[1] * -5]) | |
}, Interval.prototype.tone_semitone = function() { | |
return [5 * this.coord[0] + 3 * this.coord[1], 2 * this.coord[0] + 1 * this.coord[1]] | |
}, Interval.prototype.semitone = function() { | |
var e = this.tone_semitone(); | |
return 2 * e[0] + e[1] | |
}, Interval.prototype.add = function(e) { | |
return "string" == typeof e && (e = Interval.fromName(e)), new Interval([this.coord[0] + e.coord[0], this.coord[1] + e.coord[1]]) | |
}, Interval.prototype.subtract = function(e) { | |
return "string" == typeof e && (e = Interval.fromName(e)), new Note([this.coord[0] - e.coord[0], this.coord[1] - e.coord[1]]) | |
}, ! function(e) { | |
"function" == typeof define && define.amd ? define([], e) : "object" == typeof exports ? module.exports = e() : window.noUiSlider = e() | |
}(function() { | |
"use strict"; | |
function e(e) { | |
return "object" == typeof e && "function" == typeof e.to && "function" == typeof e.from | |
} | |
function t(e) { | |
e.parentElement.removeChild(e) | |
} | |
function n(e) { | |
e.preventDefault() | |
} | |
function i(e) { | |
return e.filter(function(e) { | |
return !this[e] && (this[e] = !0) | |
}, {}) | |
} | |
function o(e, t) { | |
return Math.round(e / t) * t | |
} | |
function s(e, t) { | |
var n = e.getBoundingClientRect(), | |
i = e.ownerDocument, | |
o = i.documentElement, | |
s = h(i); | |
return /webkit.*Chrome.*Mobile/i.test(navigator.userAgent) && (s.x = 0), t ? n.top + s.y - o.clientTop : n.left + s.x - o.clientLeft | |
} | |
function a(e) { | |
return "number" == typeof e && !isNaN(e) && isFinite(e) | |
} | |
function r(e, t, n) { | |
n > 0 && (d(e, t), setTimeout(function() { | |
p(e, t) | |
}, n)) | |
} | |
function l(e) { | |
return Math.max(Math.min(e, 100), 0) | |
} | |
function u(e) { | |
return Array.isArray(e) ? e : [e] | |
} | |
function c(e) { | |
e = String(e); | |
var t = e.split("."); | |
return t.length > 1 ? t[1].length : 0 | |
} | |
function d(e, t) { | |
e.classList ? e.classList.add(t) : e.className += " " + t | |
} | |
function p(e, t) { | |
e.classList ? e.classList.remove(t) : e.className = e.className.replace(new RegExp("(^|\\b)" + t.split(" ").join("|") + "(\\b|$)", "gi"), " ") | |
} | |
function f(e, t) { | |
return e.classList ? e.classList.contains(t) : new RegExp("\\b" + t + "\\b").test(e.className) | |
} | |
function h(e) { | |
var t = void 0 !== window.pageXOffset, | |
n = "CSS1Compat" === (e.compatMode || ""), | |
i = t ? window.pageXOffset : n ? e.documentElement.scrollLeft : e.body.scrollLeft, | |
o = t ? window.pageYOffset : n ? e.documentElement.scrollTop : e.body.scrollTop; | |
return { | |
x: i, | |
y: o | |
} | |
} | |
function g() { | |
return window.navigator.pointerEnabled ? { | |
start: "pointerdown", | |
move: "pointermove", | |
end: "pointerup" | |
} : window.navigator.msPointerEnabled ? { | |
start: "MSPointerDown", | |
move: "MSPointerMove", | |
end: "MSPointerUp" | |
} : { | |
start: "mousedown touchstart", | |
move: "mousemove touchmove", | |
end: "mouseup touchend" | |
} | |
} | |
function m() { | |
var e = !1; | |
try { | |
var t = Object.defineProperty({}, "passive", { | |
get: function() { | |
e = !0 | |
} | |
}); | |
window.addEventListener("test", null, t) | |
} catch (e) {} | |
return e | |
} | |
function v() { | |
return window.CSS && CSS.supports && CSS.supports("touch-action", "none") | |
} | |
function b(e, t) { | |
return 100 / (t - e) | |
} | |
function y(e, t) { | |
return 100 * t / (e[1] - e[0]) | |
} | |
function _(e, t) { | |
return y(e, e[0] < 0 ? t + Math.abs(e[0]) : t - e[0]) | |
} | |
function w(e, t) { | |
return t * (e[1] - e[0]) / 100 + e[0] | |
} | |
function x(e, t) { | |
for (var n = 1; e >= t[n];) n += 1; | |
return n | |
} | |
function T(e, t, n) { | |
if (n >= e.slice(-1)[0]) return 100; | |
var i, o, s, a, r = x(n, e); | |
return i = e[r - 1], o = e[r], s = t[r - 1], a = t[r], s + _([i, o], n) / b(s, a) | |
} | |
function S(e, t, n) { | |
if (n >= 100) return e.slice(-1)[0]; | |
var i, o, s, a, r = x(n, t); | |
return i = e[r - 1], o = e[r], s = t[r - 1], a = t[r], w([i, o], (n - s) * b(s, a)) | |
} | |
function C(e, t, n, i) { | |
if (100 === i) return i; | |
var s, a, r = x(i, e); | |
return n ? (s = e[r - 1], a = e[r], i - s > (a - s) / 2 ? a : s) : t[r - 1] ? e[r - 1] + o(i - e[r - 1], t[r - 1]) : i | |
} | |
function $(e, t, n) { | |
var i; | |
if ("number" == typeof t && (t = [t]), "[object Array]" !== Object.prototype.toString.call(t)) throw new Error("noUiSlider (" + K + "): 'range' contains invalid value."); | |
if (i = "min" === e ? 0 : "max" === e ? 100 : parseFloat(e), !a(i) || !a(t[0])) throw new Error("noUiSlider (" + K + "): 'range' value isn't numeric."); | |
n.xPct.push(i), n.xVal.push(t[0]), i ? n.xSteps.push(!isNaN(t[1]) && t[1]) : isNaN(t[1]) || (n.xSteps[0] = t[1]), n.xHighestCompleteStep.push(0) | |
} | |
function k(e, t, n) { | |
if (!t) return !0; | |
n.xSteps[e] = y([n.xVal[e], n.xVal[e + 1]], t) / b(n.xPct[e], n.xPct[e + 1]); | |
var i = (n.xVal[e + 1] - n.xVal[e]) / n.xNumSteps[e], | |
o = Math.ceil(Number(i.toFixed(3)) - 1), | |
s = n.xVal[e] + n.xNumSteps[e] * o; | |
n.xHighestCompleteStep[e] = s | |
} | |
function P(e, t, n) { | |
this.xPct = [], this.xVal = [], this.xSteps = [n || !1], this.xNumSteps = [!1], this.xHighestCompleteStep = [], this.snap = t; | |
var i, o = []; | |
for (i in e) e.hasOwnProperty(i) && o.push([e[i], i]); | |
for (o.sort(o.length && "object" == typeof o[0][0] ? function(e, t) { | |
return e[0][0] - t[0][0] | |
} : function(e, t) { | |
return e[0] - t[0] | |
}), i = 0; i < o.length; i++) $(o[i][1], o[i][0], this); | |
for (this.xNumSteps = this.xSteps.slice(0), i = 0; i < this.xNumSteps.length; i++) k(i, this.xNumSteps[i], this) | |
} | |
function L(t) { | |
if (e(t)) return !0; | |
throw new Error("noUiSlider (" + K + "): 'format' requires 'to' and 'from' methods.") | |
} | |
function N(e, t) { | |
if (!a(t)) throw new Error("noUiSlider (" + K + "): 'step' is not numeric."); | |
e.singleStep = t | |
} | |
function F(e, t) { | |
if ("object" != typeof t || Array.isArray(t)) throw new Error("noUiSlider (" + K + "): 'range' is not an object."); | |
if (void 0 === t.min || void 0 === t.max) throw new Error("noUiSlider (" + K + "): Missing 'min' or 'max' in 'range'."); | |
if (t.min === t.max) throw new Error("noUiSlider (" + K + "): 'range' 'min' and 'max' cannot be equal."); | |
e.spectrum = new P(t, e.snap, e.singleStep) | |
} | |
function I(e, t) { | |
if (t = u(t), !Array.isArray(t) || !t.length) throw new Error("noUiSlider (" + K + "): 'start' option is incorrect."); | |
e.handles = t.length, e.start = t | |
} | |
function E(e, t) { | |
if (e.snap = t, "boolean" != typeof t) throw new Error("noUiSlider (" + K + "): 'snap' option must be a boolean.") | |
} | |
function O(e, t) { | |
if (e.animate = t, "boolean" != typeof t) throw new Error("noUiSlider (" + K + "): 'animate' option must be a boolean.") | |
} | |
function D(e, t) { | |
if (e.animationDuration = t, "number" != typeof t) throw new Error("noUiSlider (" + K + "): 'animationDuration' option must be a number.") | |
} | |
function A(e, t) { | |
var n, i = [!1]; | |
if ("lower" === t ? t = [!0, !1] : "upper" === t && (t = [!1, !0]), t === !0 || t === !1) { | |
for (n = 1; n < e.handles; n++) i.push(t); | |
i.push(!1) | |
} else { | |
if (!Array.isArray(t) || !t.length || t.length !== e.handles + 1) throw new Error("noUiSlider (" + K + "): 'connect' option doesn't match handle count."); | |
i = t | |
} | |
e.connect = i | |
} | |
function M(e, t) { | |
switch (t) { | |
case "horizontal": | |
e.ort = 0; | |
break; | |
case "vertical": | |
e.ort = 1; | |
break; | |
default: | |
throw new Error("noUiSlider (" + K + "): 'orientation' option is invalid.") | |
} | |
} | |
function B(e, t) { | |
if (!a(t)) throw new Error("noUiSlider (" + K + "): 'margin' option must be numeric."); | |
if (0 !== t && (e.margin = e.spectrum.getMargin(t), !e.margin)) throw new Error("noUiSlider (" + K + "): 'margin' option is only supported on linear sliders.") | |
} | |
function U(e, t) { | |
if (!a(t)) throw new Error("noUiSlider (" + K + "): 'limit' option must be numeric."); | |
if (e.limit = e.spectrum.getMargin(t), !e.limit || e.handles < 2) throw new Error("noUiSlider (" + K + "): 'limit' option is only supported on linear sliders with 2 or more handles.") | |
} | |
function H(e, t) { | |
if (!a(t)) throw new Error("noUiSlider (" + K + "): 'padding' option must be numeric."); | |
if (0 !== t) { | |
if (e.padding = e.spectrum.getMargin(t), !e.padding) throw new Error("noUiSlider (" + K + "): 'padding' option is only supported on linear sliders."); | |
if (e.padding < 0) throw new Error("noUiSlider (" + K + "): 'padding' option must be a positive number."); | |
if (e.padding >= 50) throw new Error("noUiSlider (" + K + "): 'padding' option must be less than half the range.") | |
} | |
} | |
function R(e, t) { | |
switch (t) { | |
case "ltr": | |
e.dir = 0; | |
break; | |
case "rtl": | |
e.dir = 1; | |
break; | |
default: | |
throw new Error("noUiSlider (" + K + "): 'direction' option was not recognized.") | |
} | |
} | |
function j(e, t) { | |
if ("string" != typeof t) throw new Error("noUiSlider (" + K + "): 'behaviour' must be a string containing options."); | |
var n = t.indexOf("tap") >= 0, | |
i = t.indexOf("drag") >= 0, | |
o = t.indexOf("fixed") >= 0, | |
s = t.indexOf("snap") >= 0, | |
a = t.indexOf("hover") >= 0; | |
if (o) { | |
if (2 !== e.handles) throw new Error("noUiSlider (" + K + "): 'fixed' behaviour must be used with 2 handles"); | |
B(e, e.start[1] - e.start[0]) | |
} | |
e.events = { | |
tap: n || s, | |
drag: i, | |
fixed: o, | |
snap: s, | |
hover: a | |
} | |
} | |
function V(e, t) { | |
if (t !== !1) | |
if (t === !0) { | |
e.tooltips = []; | |
for (var n = 0; n < e.handles; n++) e.tooltips.push(!0) | |
} else { | |
if (e.tooltips = u(t), e.tooltips.length !== e.handles) throw new Error("noUiSlider (" + K + "): must pass a formatter for all handles."); | |
e.tooltips.forEach(function(e) { | |
if ("boolean" != typeof e && ("object" != typeof e || "function" != typeof e.to)) throw new Error("noUiSlider (" + K + "): 'tooltips' must be passed a formatter or 'false'.") | |
}) | |
} | |
} | |
function q(e, t) { | |
e.ariaFormat = t, L(t) | |
} | |
function z(e, t) { | |
e.format = t, L(t) | |
} | |
function W(e, t) { | |
if (void 0 !== t && "string" != typeof t && t !== !1) throw new Error("noUiSlider (" + K + "): 'cssPrefix' must be a string or `false`."); | |
e.cssPrefix = t | |
} | |
function G(e, t) { | |
if (void 0 !== t && "object" != typeof t) throw new Error("noUiSlider (" + K + "): 'cssClasses' must be an object."); | |
if ("string" == typeof e.cssPrefix) { | |
e.cssClasses = {}; | |
for (var n in t) t.hasOwnProperty(n) && (e.cssClasses[n] = e.cssPrefix + t[n]) | |
} else e.cssClasses = t | |
} | |
function X(e, t) { | |
if (t !== !0 && t !== !1) throw new Error("noUiSlider (" + K + "): 'useRequestAnimationFrame' option should be true (default) or false."); | |
e.useRequestAnimationFrame = t | |
} | |
function Y(e) { | |
var t = { | |
margin: 0, | |
limit: 0, | |
padding: 0, | |
animate: !0, | |
animationDuration: 300, | |
ariaFormat: Z, | |
format: Z | |
}, | |
n = { | |
step: { | |
r: !1, | |
t: N | |
}, | |
start: { | |
r: !0, | |
t: I | |
}, | |
connect: { | |
r: !0, | |
t: A | |
}, | |
direction: { | |
r: !0, | |
t: R | |
}, | |
snap: { | |
r: !1, | |
t: E | |
}, | |
animate: { | |
r: !1, | |
t: O | |
}, | |
animationDuration: { | |
r: !1, | |
t: D | |
}, | |
range: { | |
r: !0, | |
t: F | |
}, | |
orientation: { | |
r: !1, | |
t: M | |
}, | |
margin: { | |
r: !1, | |
t: B | |
}, | |
limit: { | |
r: !1, | |
t: U | |
}, | |
padding: { | |
r: !1, | |
t: H | |
}, | |
behaviour: { | |
r: !0, | |
t: j | |
}, | |
ariaFormat: { | |
r: !1, | |
t: q | |
}, | |
format: { | |
r: !1, | |
t: z | |
}, | |
tooltips: { | |
r: !1, | |
t: V | |
}, | |
cssPrefix: { | |
r: !1, | |
t: W | |
}, | |
cssClasses: { | |
r: !1, | |
t: G | |
}, | |
useRequestAnimationFrame: { | |
r: !1, | |
t: X | |
} | |
}, | |
i = { | |
connect: !1, | |
direction: "ltr", | |
behaviour: "tap", | |
orientation: "horizontal", | |
cssPrefix: "noUi-", | |
cssClasses: { | |
target: "target", | |
base: "base", | |
origin: "origin", | |
handle: "handle", | |
handleLower: "handle-lower", | |
handleUpper: "handle-upper", | |
horizontal: "horizontal", | |
vertical: "vertical", | |
background: "background", | |
connect: "connect", | |
ltr: "ltr", | |
rtl: "rtl", | |
draggable: "draggable", | |
drag: "state-drag", | |
tap: "state-tap", | |
active: "active", | |
tooltip: "tooltip", | |
pips: "pips", | |
pipsHorizontal: "pips-horizontal", | |
pipsVertical: "pips-vertical", | |
marker: "marker", | |
markerHorizontal: "marker-horizontal", | |
markerVertical: "marker-vertical", | |
markerNormal: "marker-normal", | |
markerLarge: "marker-large", | |
markerSub: "marker-sub", | |
value: "value", | |
valueHorizontal: "value-horizontal", | |
valueVertical: "value-vertical", | |
valueNormal: "value-normal", | |
valueLarge: "value-large", | |
valueSub: "value-sub" | |
}, | |
useRequestAnimationFrame: !0 | |
}; | |
e.format && !e.ariaFormat && (e.ariaFormat = e.format), Object.keys(n).forEach(function(o) { | |
if (void 0 === e[o] && void 0 === i[o]) { | |
if (n[o].r) throw new Error("noUiSlider (" + K + "): '" + o + "' is required."); | |
return !0 | |
} | |
n[o].t(t, void 0 === e[o] ? i[o] : e[o]) | |
}), t.pips = e.pips; | |
var o = [ | |
["left", "top"], | |
["right", "bottom"] | |
]; | |
return t.style = o[t.dir][t.ort], t.styleOposite = o[t.dir ? 0 : 1][t.ort], t | |
} | |
function Q(e, o, a) { | |
function c(e, t) { | |
var n = Te.createElement("div"); | |
return t && d(n, t), e.appendChild(n), n | |
} | |
function b(e, t) { | |
var n = c(e, o.cssClasses.origin), | |
i = c(n, o.cssClasses.handle); | |
return i.setAttribute("data-handle", t), i.setAttribute("tabindex", "0"), i.setAttribute("role", "slider"), i.setAttribute("aria-orientation", o.ort ? "vertical" : "horizontal"), 0 === t ? d(i, o.cssClasses.handleLower) : t === o.handles - 1 && d(i, o.cssClasses.handleUpper), n | |
} | |
function y(e, t) { | |
return !!t && c(e, o.cssClasses.connect) | |
} | |
function _(e, t) { | |
le = [], ue = [], ue.push(y(t, e[0])); | |
for (var n = 0; n < o.handles; n++) le.push(b(t, n)), ve[n] = n, ue.push(y(t, e[n + 1])) | |
} | |
function w(e) { | |
d(e, o.cssClasses.target), 0 === o.dir ? d(e, o.cssClasses.ltr) : d(e, o.cssClasses.rtl), 0 === o.ort ? d(e, o.cssClasses.horizontal) : d(e, o.cssClasses.vertical), re = c(e, o.cssClasses.base) | |
} | |
function x(e, t) { | |
return !!o.tooltips[t] && c(e.firstChild, o.cssClasses.tooltip) | |
} | |
function T() { | |
var e = le.map(x); | |
oe("update", function(t, n, i) { | |
if (e[n]) { | |
var s = t[n]; | |
o.tooltips[n] !== !0 && (s = o.tooltips[n].to(i[n])), e[n].innerHTML = s | |
} | |
}) | |
} | |
function S() { | |
oe("update", function(e, t, n, i, s) { | |
ve.forEach(function(e) { | |
var t = le[e], | |
i = q(me, e, 0, !0, !0, !0), | |
a = q(me, e, 100, !0, !0, !0), | |
r = s[e], | |
l = o.ariaFormat.to(n[e]); | |
t.children[0].setAttribute("aria-valuemin", i.toFixed(1)), t.children[0].setAttribute("aria-valuemax", a.toFixed(1)), t.children[0].setAttribute("aria-valuenow", r.toFixed(1)), t.children[0].setAttribute("aria-valuetext", l) | |
}) | |
}) | |
} | |
function C(e, t, n) { | |
if ("range" === e || "steps" === e) return ye.xVal; | |
if ("count" === e) { | |
if (!t) throw new Error("noUiSlider (" + K + "): 'values' required for mode 'count'."); | |
var i, o = 100 / (t - 1), | |
s = 0; | |
for (t = []; | |
(i = s++ * o) <= 100;) t.push(i); | |
e = "positions" | |
} | |
return "positions" === e ? t.map(function(e) { | |
return ye.fromStepping(n ? ye.getStep(e) : e) | |
}) : "values" === e ? n ? t.map(function(e) { | |
return ye.fromStepping(ye.getStep(ye.toStepping(e))) | |
}) : t : void 0 | |
} | |
function $(e, t, n) { | |
function o(e, t) { | |
return (e + t).toFixed(7) / 1 | |
} | |
var s = {}, | |
a = ye.xVal[0], | |
r = ye.xVal[ye.xVal.length - 1], | |
l = !1, | |
u = !1, | |
c = 0; | |
return n = i(n.slice().sort(function(e, t) { | |
return e - t | |
})), n[0] !== a && (n.unshift(a), l = !0), n[n.length - 1] !== r && (n.push(r), u = !0), n.forEach(function(i, a) { | |
var r, d, p, f, h, g, m, v, b, y, _ = i, | |
w = n[a + 1]; | |
if ("steps" === t && (r = ye.xNumSteps[a]), r || (r = w - _), _ !== !1 && void 0 !== w) | |
for (r = Math.max(r, 1e-7), d = _; w >= d; d = o(d, r)) { | |
for (f = ye.toStepping(d), h = f - c, v = h / e, b = Math.round(v), y = h / b, p = 1; b >= p; p += 1) g = c + p * y, s[g.toFixed(5)] = ["x", 0]; | |
m = n.indexOf(d) > -1 ? 1 : "steps" === t ? 2 : 0, !a && l && (m = 0), d === w && u || (s[f.toFixed(5)] = [d, m]), c = f | |
} | |
}), s | |
} | |
function k(e, t, n) { | |
function i(e, t) { | |
var n = t === o.cssClasses.value, | |
i = n ? u : p, | |
s = n ? r : l; | |
return t + " " + i[o.ort] + " " + s[e] | |
} | |
function s(e, s) { | |
s[1] = s[1] && t ? t(s[0], s[1]) : s[1]; | |
var r = c(a, !1); | |
r.className = i(s[1], o.cssClasses.marker), r.style[o.style] = e + "%", s[1] && (r = c(a, !1), r.className = i(s[1], o.cssClasses.value), r.style[o.style] = e + "%", r.innerText = n.to(s[0])) | |
} | |
var a = Te.createElement("div"), | |
r = [o.cssClasses.valueNormal, o.cssClasses.valueLarge, o.cssClasses.valueSub], | |
l = [o.cssClasses.markerNormal, o.cssClasses.markerLarge, o.cssClasses.markerSub], | |
u = [o.cssClasses.valueHorizontal, o.cssClasses.valueVertical], | |
p = [o.cssClasses.markerHorizontal, o.cssClasses.markerVertical]; | |
return d(a, o.cssClasses.pips), d(a, 0 === o.ort ? o.cssClasses.pipsHorizontal : o.cssClasses.pipsVertical), Object.keys(e).forEach(function(t) { | |
s(t, e[t]) | |
}), a | |
} | |
function P() { | |
de && (t(de), de = null) | |
} | |
function L(e) { | |
P(); | |
var t = e.mode, | |
n = e.density || 1, | |
i = e.filter || !1, | |
o = e.values || !1, | |
s = e.stepped || !1, | |
a = C(t, o, s), | |
r = $(n, t, a), | |
l = e.format || { | |
to: Math.round | |
}; | |
return de = ge.appendChild(k(r, i, l)) | |
} | |
function N() { | |
var e = re.getBoundingClientRect(), | |
t = "offset" + ["Width", "Height"][o.ort]; | |
return 0 === o.ort ? e.width || re[t] : e.height || re[t] | |
} | |
function F(e, t, n, i) { | |
var s = function(t) { | |
return !ge.hasAttribute("disabled") && (!f(ge, o.cssClasses.tap) && (!!(t = I(t, i.pageOffset)) && (!(e === pe.start && void 0 !== t.buttons && t.buttons > 1) && ((!i.hover || !t.buttons) && (he || t.preventDefault(), t.calcPoint = t.points[o.ort], void n(t, i)))))) | |
}, | |
a = []; | |
return e.split(" ").forEach(function(e) { | |
t.addEventListener(e, s, !!he && { | |
passive: !0 | |
}), a.push([e, s]) | |
}), a | |
} | |
function I(e, t) { | |
var n, i, o = 0 === e.type.indexOf("touch"), | |
s = 0 === e.type.indexOf("mouse"), | |
a = 0 === e.type.indexOf("pointer"); | |
if (0 === e.type.indexOf("MSPointer") && (a = !0), o) { | |
if (e.touches.length > 1) return !1; | |
n = e.changedTouches[0].pageX, i = e.changedTouches[0].pageY | |
} | |
return t = t || h(Te), (s || a) && (n = e.clientX + t.x, i = e.clientY + t.y), e.pageOffset = t, e.points = [n, i], e.cursor = s || a, e | |
} | |
function E(e) { | |
var t = e - s(re, o.ort), | |
n = 100 * t / N(); | |
return o.dir ? 100 - n : n | |
} | |
function O(e) { | |
var t = 100, | |
n = !1; | |
return le.forEach(function(i, o) { | |
if (!i.hasAttribute("disabled")) { | |
var s = Math.abs(me[o] - e); | |
t > s && (n = o, t = s) | |
} | |
}), n | |
} | |
function D(e, t, n, i) { | |
var o = n.slice(), | |
s = [!e, e], | |
a = [e, !e]; | |
i = i.slice(), e && i.reverse(), i.length > 1 ? i.forEach(function(e, n) { | |
var i = q(o, e, o[e] + t, s[n], a[n], !1); | |
i === !1 ? t = 0 : (t = i - o[e], o[e] = i) | |
}) : s = a = [!0]; | |
var r = !1; | |
i.forEach(function(e, i) { | |
r = X(e, n[e] + t, s[i], a[i]) || r | |
}), r && i.forEach(function(e) { | |
A("update", e), A("slide", e) | |
}) | |
} | |
function A(e, t, n) { | |
Object.keys(we).forEach(function(i) { | |
var s = i.split(".")[0]; | |
e === s && we[i].forEach(function(e) { | |
e.call(ce, _e.map(o.format.to), t, _e.slice(), n || !1, me.slice()) | |
}) | |
}) | |
} | |
function M(e, t) { | |
"mouseout" === e.type && "HTML" === e.target.nodeName && null === e.relatedTarget && U(e, t) | |
} | |
function B(e, t) { | |
if (-1 === navigator.appVersion.indexOf("MSIE 9") && 0 === e.buttons && 0 !== t.buttonsProperty) return U(e, t); | |
var n = (o.dir ? -1 : 1) * (e.calcPoint - t.startCalcPoint), | |
i = 100 * n / t.baseSize; | |
D(n > 0, i, t.locations, t.handleNumbers) | |
} | |
function U(e, t) { | |
be && (p(be, o.cssClasses.active), be = !1), e.cursor && (Ce.style.cursor = "", Ce.removeEventListener("selectstart", n)), xe.forEach(function(e) { | |
Se.removeEventListener(e[0], e[1]) | |
}), p(ge, o.cssClasses.drag), G(), t.handleNumbers.forEach(function(e) { | |
A("change", e), A("set", e), A("end", e) | |
}) | |
} | |
function H(e, t) { | |
if (1 === t.handleNumbers.length) { | |
var i = le[t.handleNumbers[0]]; | |
if (i.hasAttribute("disabled")) return !1; | |
be = i.children[0], d(be, o.cssClasses.active) | |
} | |
e.stopPropagation(); | |
var s = F(pe.move, Se, B, { | |
startCalcPoint: e.calcPoint, | |
baseSize: N(), | |
pageOffset: e.pageOffset, | |
handleNumbers: t.handleNumbers, | |
buttonsProperty: e.buttons, | |
locations: me.slice() | |
}), | |
a = F(pe.end, Se, U, { | |
handleNumbers: t.handleNumbers | |
}), | |
r = F("mouseout", Se, M, { | |
handleNumbers: t.handleNumbers | |
}); | |
xe = s.concat(a, r), e.cursor && (Ce.style.cursor = getComputedStyle(e.target).cursor, le.length > 1 && d(ge, o.cssClasses.drag), Ce.addEventListener("selectstart", n, !1)), t.handleNumbers.forEach(function(e) { | |
A("start", e) | |
}) | |
} | |
function R(e) { | |
e.stopPropagation(); | |
var t = E(e.calcPoint), | |
n = O(t); | |
return n !== !1 && (o.events.snap || r(ge, o.cssClasses.tap, o.animationDuration), X(n, t, !0, !0), G(), A("slide", n, !0), A("update", n, !0), A("change", n, !0), A("set", n, !0), void(o.events.snap && H(e, { | |
handleNumbers: [n] | |
}))) | |
} | |
function j(e) { | |
var t = E(e.calcPoint), | |
n = ye.getStep(t), | |
i = ye.fromStepping(n); | |
Object.keys(we).forEach(function(e) { | |
"hover" === e.split(".")[0] && we[e].forEach(function(e) { | |
e.call(ce, i) | |
}) | |
}) | |
} | |
function V(e) { | |
e.fixed || le.forEach(function(e, t) { | |
F(pe.start, e.children[0], H, { | |
handleNumbers: [t] | |
}) | |
}), e.tap && F(pe.start, re, R, {}), e.hover && F(pe.move, re, j, { | |
hover: !0 | |
}), e.drag && ue.forEach(function(t, n) { | |
if (t !== !1 && 0 !== n && n !== ue.length - 1) { | |
var i = le[n - 1], | |
s = le[n], | |
a = [t]; | |
d(t, o.cssClasses.draggable), e.fixed && (a.push(i.children[0]), a.push(s.children[0])), a.forEach(function(e) { | |
F(pe.start, e, H, { | |
handles: [i, s], | |
handleNumbers: [n - 1, n] | |
}) | |
}) | |
} | |
}) | |
} | |
function q(e, t, n, i, s, a) { | |
return le.length > 1 && (i && t > 0 && (n = Math.max(n, e[t - 1] + o.margin)), s && t < le.length - 1 && (n = Math.min(n, e[t + 1] - o.margin))), le.length > 1 && o.limit && (i && t > 0 && (n = Math.min(n, e[t - 1] + o.limit)), s && t < le.length - 1 && (n = Math.max(n, e[t + 1] - o.limit))), o.padding && (0 === t && (n = Math.max(n, o.padding)), t === le.length - 1 && (n = Math.min(n, 100 - o.padding))), n = ye.getStep(n), n = l(n), !(n === e[t] && !a) && n | |
} | |
function z(e) { | |
return e + "%" | |
} | |
function W(e, t) { | |
me[e] = t, _e[e] = ye.fromStepping(t); | |
var n = function() { | |
le[e].style[o.style] = z(t), Q(e), Q(e + 1) | |
}; | |
window.requestAnimationFrame && o.useRequestAnimationFrame ? window.requestAnimationFrame(n) : n() | |
} | |
function G() { | |
ve.forEach(function(e) { | |
var t = me[e] > 50 ? -1 : 1, | |
n = 3 + (le.length + t * e); | |
le[e].childNodes[0].style.zIndex = n | |
}) | |
} | |
function X(e, t, n, i) { | |
return t = q(me, e, t, n, i, !1), t !== !1 && (W(e, t), !0) | |
} | |
function Q(e) { | |
if (ue[e]) { | |
var t = 0, | |
n = 100; | |
0 !== e && (t = me[e - 1]), e !== ue.length - 1 && (n = me[e]), ue[e].style[o.style] = z(t), ue[e].style[o.styleOposite] = z(100 - n) | |
} | |
} | |
function J(e, t) { | |
null !== e && e !== !1 && ("number" == typeof e && (e = String(e)), e = o.format.from(e), e === !1 || isNaN(e) || X(t, ye.toStepping(e), !1, !1)) | |
} | |
function Z(e, t) { | |
var n = u(e), | |
i = void 0 === me[0]; | |
t = void 0 === t || !!t, n.forEach(J), o.animate && !i && r(ge, o.cssClasses.tap, o.animationDuration), ve.forEach(function(e) { | |
X(e, me[e], !0, !1) | |
}), G(), ve.forEach(function(e) { | |
A("update", e), null !== n[e] && t && A("set", e) | |
}) | |
} | |
function ee(e) { | |
Z(o.start, e) | |
} | |
function te() { | |
var e = _e.map(o.format.to); | |
return 1 === e.length ? e[0] : e | |
} | |
function ne() { | |
for (var e in o.cssClasses) o.cssClasses.hasOwnProperty(e) && p(ge, o.cssClasses[e]); | |
for (; ge.firstChild;) ge.removeChild(ge.firstChild); | |
delete ge.noUiSlider | |
} | |
function ie() { | |
return me.map(function(e, t) { | |
var n = ye.getNearbySteps(e), | |
i = _e[t], | |
o = n.thisStep.step, | |
s = null; | |
o !== !1 && i + o > n.stepAfter.startValue && (o = n.stepAfter.startValue - i), s = i > n.thisStep.startValue ? n.thisStep.step : n.stepBefore.step !== !1 && i - n.stepBefore.highestStep, 100 === e ? o = null : 0 === e && (s = null); | |
var a = ye.countStepDecimals(); | |
return null !== o && o !== !1 && (o = Number(o.toFixed(a))), null !== s && s !== !1 && (s = Number(s.toFixed(a))), [s, o] | |
}) | |
} | |
function oe(e, t) { | |
we[e] = we[e] || [], we[e].push(t), "update" === e.split(".")[0] && le.forEach(function(e, t) { | |
A("update", t) | |
}) | |
} | |
function se(e) { | |
var t = e && e.split(".")[0], | |
n = t && e.substring(t.length); | |
Object.keys(we).forEach(function(e) { | |
var i = e.split(".")[0], | |
o = e.substring(i.length); | |
t && t !== i || n && n !== o || delete we[e] | |
}) | |
} | |
function ae(e, t) { | |
var n = te(), | |
i = ["margin", "limit", "padding", "range", "animate", "snap", "step", "format"]; | |
i.forEach(function(t) { | |
void 0 !== e[t] && (a[t] = e[t]) | |
}); | |
var s = Y(a); | |
i.forEach(function(t) { | |
void 0 !== e[t] && (o[t] = s[t]) | |
}), ye = s.spectrum, o.margin = s.margin, o.limit = s.limit, o.padding = s.padding, o.pips && L(o.pips), me = [], Z(e.start || n, t) | |
} | |
var re, le, ue, ce, de, pe = g(), | |
fe = v(), | |
he = fe && m(), | |
ge = e, | |
me = [], | |
ve = [], | |
be = !1, | |
ye = o.spectrum, | |
_e = [], | |
we = {}, | |
xe = null, | |
Te = e.ownerDocument, | |
Se = Te.documentElement, | |
Ce = Te.body; | |
if (ge.noUiSlider) throw new Error("noUiSlider (" + K + "): Slider was already initialized."); | |
return w(ge), _(o.connect, re), ce = { | |
destroy: ne, | |
steps: ie, | |
on: oe, | |
off: se, | |
get: te, | |
set: Z, | |
reset: ee, | |
__moveHandles: function(e, t, n) { | |
D(e, t, me, n) | |
}, | |
options: a, | |
updateOptions: ae, | |
target: ge, | |
removePips: P, | |
pips: L | |
}, V(o.events), Z(o.start), o.pips && L(o.pips), o.tooltips && T(), S(), ce | |
} | |
function J(e, t) { | |
if (!e || !e.nodeName) throw new Error("noUiSlider (" + K + "): create requires a single element, got: " + e); | |
var n = Y(t, e), | |
i = Q(e, n, t); | |
return e.noUiSlider = i, i | |
} | |
var K = "10.0.0"; | |
P.prototype.getMargin = function(e) { | |
var t = this.xNumSteps[0]; | |
if (t && e / t % 1 !== 0) throw new Error("noUiSlider (" + K + "): 'limit', 'margin' and 'padding' must be divisible by step."); | |
return 2 === this.xPct.length && y(this.xVal, e) | |
}, P.prototype.toStepping = function(e) { | |
return e = T(this.xVal, this.xPct, e) | |
}, P.prototype.fromStepping = function(e) { | |
return S(this.xVal, this.xPct, e) | |
}, P.prototype.getStep = function(e) { | |
return e = C(this.xPct, this.xSteps, this.snap, e) | |
}, P.prototype.getNearbySteps = function(e) { | |
var t = x(e, this.xPct); | |
return { | |
stepBefore: { | |
startValue: this.xVal[t - 2], | |
step: this.xNumSteps[t - 2], | |
highestStep: this.xHighestCompleteStep[t - 2] | |
}, | |
thisStep: { | |
startValue: this.xVal[t - 1], | |
step: this.xNumSteps[t - 1], | |
highestStep: this.xHighestCompleteStep[t - 1] | |
}, | |
stepAfter: { | |
startValue: this.xVal[t - 0], | |
step: this.xNumSteps[t - 0], | |
highestStep: this.xHighestCompleteStep[t - 0] | |
} | |
} | |
}, P.prototype.countStepDecimals = function() { | |
var e = this.xNumSteps.map(c); | |
return Math.max.apply(null, e) | |
}, P.prototype.convert = function(e) { | |
return this.getStep(this.toStepping(e)) | |
}; | |
var Z = { | |
to: function(e) { | |
return void 0 !== e && e.toFixed(2) | |
}, | |
from: Number | |
}; | |
return { | |
version: K, | |
create: J | |
} | |
}), BufferLoader.prototype.loadBuffer = function(e) { | |
var t = new XMLHttpRequest; | |
t.open("GET", e.url, !0), t.responseType = "arraybuffer"; | |
var n = this; | |
t.onload = function() { | |
n.context.decodeAudioData(t.response, function(t) { | |
return t ? (n.bufferList.push({ | |
buffer: t, | |
instrument_id: e.instrument_id, | |
sample_index: e.sample_index | |
}), void(++n.loadCount == n.urlList.length && n.onload(n.bufferList))) : void alert("Error decoding audio file data.") | |
}) | |
}, t.onerror = function() { | |
n.onerror() | |
}, t.send() | |
}, BufferLoader.prototype.load = function() { | |
for (var e = 0; e < this.urlList.length; ++e) this.loadBuffer(this.urlList[e]) | |
}, Oscilloscope.prototype.draw = function(e, t, n) { | |
var t = "undefined" == typeof t || t, | |
n = "undefined" == typeof n || n; | |
if (this.draw_counter++, e.clearRect(0, 0, this.width, this.height), 1 == t) { | |
var i = this.data, | |
o = (this.height / 4, this.height / 256); | |
this.analyser.getByteTimeDomainData(i), e.strokeStyle = "rgba(0,0,0,0.12)", e.lineWidth = 2, e.beginPath(); | |
var s = findFirstPositiveZeroCrossing(i, this.width); | |
e.moveTo(0, (256 - i[s]) * o); | |
for (var a = s, r = 0; r < this.width && a < i.length; a++, r++) e.lineTo(r, (256 - i[a]) * o); | |
e.stroke() | |
} | |
if (1 == n) { | |
var l = this.data2; | |
this.analyser.getByteFrequencyData(l); | |
var u = 256; | |
e.strokeStyle = "rgba(0,0,0,0.12)", e.fillStyle = "rgba(0,0,0,0.11)", e.lineJoin = "round", e.lineCap = "round", e.lineWidth = 1, e.beginPath(), e.moveTo(-10, this.height + 1); | |
for (var c = 0, a = 0; a < u; a++) { | |
var d = a * (this.width / u * 1), | |
p = (this.width / u * 1, this.height - l[a] / 2 + 1), | |
f = (a + 1) * (44100 / this.analyser.fftSize); | |
d = this.frequencyToPixel(f), 0 == a && (c = d), d -= c, d = 1.25 * d, 0 == a ? e.lineTo(d - 0, p) : e.lineTo(d, p) | |
} | |
e.lineTo(d, this.height + 1), e.closePath(), e.fill(), e.stroke() | |
} | |
}, Oscilloscope.prototype.frequencyToPixel = function(e) { | |
var t = this.max_freq - this.min_freq, | |
n = (Math.log(e) / Math.LN10 - this.min_freq) / t * this.width; | |
return n | |
}; | |
var MINVAL = 134; | |
! function(e) { | |
"use strict"; | |
function t(e) { | |
var t = e.length, | |
i = n.type(e); | |
return "function" !== i && !n.isWindow(e) && (!(1 !== e.nodeType || !t) || "array" === i || 0 === t || "number" == typeof t && t > 0 && t - 1 in e) | |
} | |
if (!e.jQuery) { | |
var n = function(e, t) { | |
return new n.fn.init(e, t) | |
}; | |
n.isWindow = function(e) { | |
return e && e === e.window | |
}, n.type = function(e) { | |
return e ? "object" == typeof e || "function" == typeof e ? o[a.call(e)] || "object" : typeof e : e + "" | |
}, n.isArray = Array.isArray || function(e) { | |
return "array" === n.type(e) | |
}, n.isPlainObject = function(e) { | |
var t; | |
if (!e || "object" !== n.type(e) || e.nodeType || n.isWindow(e)) return !1; | |
try { | |
if (e.constructor && !s.call(e, "constructor") && !s.call(e.constructor.prototype, "isPrototypeOf")) return !1 | |
} catch (e) { | |
return !1 | |
} | |
for (t in e); | |
return void 0 === t || s.call(e, t) | |
}, n.each = function(e, n, i) { | |
var o, s = 0, | |
a = e.length, | |
r = t(e); | |
if (i) { | |
if (r) | |
for (; s < a && (o = n.apply(e[s], i), o !== !1); s++); | |
else | |
for (s in e) | |
if (e.hasOwnProperty(s) && (o = n.apply(e[s], i), o === !1)) break | |
} else if (r) | |
for (; s < a && (o = n.call(e[s], s, e[s]), o !== !1); s++); | |
else | |
for (s in e) | |
if (e.hasOwnProperty(s) && (o = n.call(e[s], s, e[s]), o === !1)) break; | |
return e | |
}, n.data = function(e, t, o) { | |
if (void 0 === o) { | |
var s = e[n.expando], | |
a = s && i[s]; | |
if (void 0 === t) return a; | |
if (a && t in a) return a[t] | |
} else if (void 0 !== t) { | |
var r = e[n.expando] || (e[n.expando] = ++n.uuid); | |
return i[r] = i[r] || {}, i[r][t] = o, o | |
} | |
}, n.removeData = function(e, t) { | |
var o = e[n.expando], | |
s = o && i[o]; | |
s && (t ? n.each(t, function(e, t) { | |
delete s[t] | |
}) : delete i[o]) | |
}, n.extend = function() { | |
var e, t, i, o, s, a, r = arguments[0] || {}, | |
l = 1, | |
u = arguments.length, | |
c = !1; | |
for ("boolean" == typeof r && (c = r, r = arguments[l] || {}, l++), "object" != typeof r && "function" !== n.type(r) && (r = {}), l === u && (r = this, l--); l < u; l++) | |
if (s = arguments[l]) | |
for (o in s) s.hasOwnProperty(o) && (e = r[o], i = s[o], r !== i && (c && i && (n.isPlainObject(i) || (t = n.isArray(i))) ? (t ? (t = !1, a = e && n.isArray(e) ? e : []) : a = e && n.isPlainObject(e) ? e : {}, r[o] = n.extend(c, a, i)) : void 0 !== i && (r[o] = i))); | |
return r | |
}, n.queue = function(e, i, o) { | |
function s(e, n) { | |
var i = n || []; | |
return e && (t(Object(e)) ? ! function(e, t) { | |
for (var n = +t.length, i = 0, o = e.length; i < n;) e[o++] = t[i++]; | |
if (n !== n) | |
for (; void 0 !== t[i];) e[o++] = t[i++]; | |
return e.length = o, e | |
}(i, "string" == typeof e ? [e] : e) : [].push.call(i, e)), i | |
} | |
if (e) { | |
i = (i || "fx") + "queue"; | |
var a = n.data(e, i); | |
return o ? (!a || n.isArray(o) ? a = n.data(e, i, s(o)) : a.push(o), a) : a || [] | |
} | |
}, n.dequeue = function(e, t) { | |
n.each(e.nodeType ? [e] : e, function(e, i) { | |
t = t || "fx"; | |
var o = n.queue(i, t), | |
s = o.shift(); | |
"inprogress" === s && (s = o.shift()), s && ("fx" === t && o.unshift("inprogress"), s.call(i, function() { | |
n.dequeue(i, t) | |
})) | |
}) | |
}, n.fn = n.prototype = { | |
init: function(e) { | |
if (e.nodeType) return this[0] = e, this; | |
throw new Error("Not a DOM node.") | |
}, | |
offset: function() { | |
var t = this[0].getBoundingClientRect ? this[0].getBoundingClientRect() : { | |
top: 0, | |
left: 0 | |
}; | |
return { | |
top: t.top + (e.pageYOffset || document.scrollTop || 0) - (document.clientTop || 0), | |
left: t.left + (e.pageXOffset || document.scrollLeft || 0) - (document.clientLeft || 0) | |
} | |
}, | |
position: function() { | |
function e(e) { | |
for (var t = e.offsetParent || document; t && "html" !== t.nodeType.toLowerCase && "static" === t.style.position;) t = t.offsetParent; | |
return t || document | |
} | |
var t = this[0], | |
i = e(t), | |
o = this.offset(), | |
s = /^(?:body|html)$/i.test(i.nodeName) ? { | |
top: 0, | |
left: 0 | |
} : n(i).offset(); | |
return o.top -= parseFloat(t.style.marginTop) || 0, o.left -= parseFloat(t.style.marginLeft) || 0, i.style && (s.top += parseFloat(i.style.borderTopWidth) || 0, s.left += parseFloat(i.style.borderLeftWidth) || 0), { | |
top: o.top - s.top, | |
left: o.left - s.left | |
} | |
} | |
}; | |
var i = {}; | |
n.expando = "velocity" + (new Date).getTime(), n.uuid = 0; | |
for (var o = {}, s = o.hasOwnProperty, a = o.toString, r = "Boolean Number String Function Array Date RegExp Object Error".split(" "), l = 0; l < r.length; l++) o["[object " + r[l] + "]"] = r[l].toLowerCase(); | |
n.fn.init.prototype = n.fn, e.Velocity = { | |
Utilities: n | |
} | |
} | |
}(window), | |
function(e) { | |
"use strict"; | |
"object" == typeof module && "object" == typeof module.exports ? module.exports = e() : "function" == typeof define && define.amd ? define(e) : e() | |
}(function() { | |
"use strict"; | |
return function(e, t, n, i) { | |
function o(e) { | |
for (var t = -1, n = e ? e.length : 0, i = []; ++t < n;) { | |
var o = e[t]; | |
o && i.push(o) | |
} | |
return i | |
} | |
function s(e) { | |
return g.isWrapped(e) ? e = [].slice.call(e) : g.isNode(e) && (e = [e]), e | |
} | |
function a(e) { | |
var t = p.data(e, "velocity"); | |
return null === t ? i : t | |
} | |
function r(e) { | |
return function(t) { | |
return Math.round(t * e) * (1 / e) | |
} | |
} | |
function l(e, n, i, o) { | |
function s(e, t) { | |
return 1 - 3 * t + 3 * e | |
} | |
function a(e, t) { | |
return 3 * t - 6 * e | |
} | |
function r(e) { | |
return 3 * e | |
} | |
function l(e, t, n) { | |
return ((s(t, n) * e + a(t, n)) * e + r(t)) * e | |
} | |
function u(e, t, n) { | |
return 3 * s(t, n) * e * e + 2 * a(t, n) * e + r(t) | |
} | |
function c(t, n) { | |
for (var o = 0; o < g; ++o) { | |
var s = u(n, e, i); | |
if (0 === s) return n; | |
var a = l(n, e, i) - t; | |
n -= a / s | |
} | |
return n | |
} | |
function d() { | |
for (var t = 0; t < y; ++t) T[t] = l(t * _, e, i) | |
} | |
function p(t, n, o) { | |
var s, a, r = 0; | |
do a = n + (o - n) / 2, s = l(a, e, i) - t, s > 0 ? o = a : n = a; while (Math.abs(s) > v && ++r < b); | |
return a | |
} | |
function f(t) { | |
for (var n = 0, o = 1, s = y - 1; o !== s && T[o] <= t; ++o) n += _; | |
--o; | |
var a = (t - T[o]) / (T[o + 1] - T[o]), | |
r = n + a * _, | |
l = u(r, e, i); | |
return l >= m ? c(t, r) : 0 === l ? r : p(t, n, n + _) | |
} | |
function h() { | |
S = !0, e === n && i === o || d() | |
} | |
var g = 4, | |
m = .001, | |
v = 1e-7, | |
b = 10, | |
y = 11, | |
_ = 1 / (y - 1), | |
w = "Float32Array" in t; | |
if (4 !== arguments.length) return !1; | |
for (var x = 0; x < 4; ++x) | |
if ("number" != typeof arguments[x] || isNaN(arguments[x]) || !isFinite(arguments[x])) return !1; | |
e = Math.min(e, 1), i = Math.min(i, 1), e = Math.max(e, 0), i = Math.max(i, 0); | |
var T = w ? new Float32Array(y) : new Array(y), | |
S = !1, | |
C = function(t) { | |
return S || h(), e === n && i === o ? t : 0 === t ? 0 : 1 === t ? 1 : l(f(t), n, o) | |
}; | |
C.getControlPoints = function() { | |
return [{ | |
x: e, | |
y: n | |
}, { | |
x: i, | |
y: o | |
}] | |
}; | |
var $ = "generateBezier(" + [e, n, i, o] + ")"; | |
return C.toString = function() { | |
return $ | |
}, C | |
} | |
function u(e, t) { | |
var n = e; | |
return g.isString(e) ? y.Easings[e] || (n = !1) : n = g.isArray(e) && 1 === e.length ? r.apply(null, e) : g.isArray(e) && 2 === e.length ? _.apply(null, e.concat([t])) : !(!g.isArray(e) || 4 !== e.length) && l.apply(null, e), n === !1 && (n = y.Easings[y.defaults.easing] ? y.defaults.easing : b), n | |
} | |
function c(e) { | |
if (e) { | |
var t = y.timestamp && e !== !0 ? e : (new Date).getTime(), | |
n = y.State.calls.length; | |
n > 1e4 && (y.State.calls = o(y.State.calls), n = y.State.calls.length); | |
for (var s = 0; s < n; s++) | |
if (y.State.calls[s]) { | |
var r = y.State.calls[s], | |
l = r[0], | |
u = r[2], | |
f = r[3], | |
h = !!f, | |
m = null; | |
f || (f = y.State.calls[s][3] = t - 16); | |
for (var v = Math.min((t - f) / u.duration, 1), b = 0, _ = l.length; b < _; b++) { | |
var x = l[b], | |
S = x.element; | |
if (a(S)) { | |
var C = !1; | |
if (u.display !== i && null !== u.display && "none" !== u.display) { | |
if ("flex" === u.display) { | |
var $ = ["-webkit-box", "-moz-box", "-ms-flexbox", "-webkit-flex"]; | |
p.each($, function(e, t) { | |
w.setPropertyValue(S, "display", t) | |
}) | |
} | |
w.setPropertyValue(S, "display", u.display) | |
} | |
u.visibility !== i && "hidden" !== u.visibility && w.setPropertyValue(S, "visibility", u.visibility); | |
for (var k in x) | |
if (x.hasOwnProperty(k) && "element" !== k) { | |
var P, L = x[k], | |
N = g.isString(L.easing) ? y.Easings[L.easing] : L.easing; | |
if (g.isString(L.pattern)) { | |
var F = 1 === v ? function(e, t) { | |
return L.endValue[t] | |
} : function(e, t) { | |
var n = L.startValue[t], | |
i = L.endValue[t] - n; | |
return n + i * N(v, u, i) | |
}; | |
P = L.pattern.replace(/{(\d+)}/g, F) | |
} else if (1 === v) P = L.endValue; | |
else { | |
var I = L.endValue - L.startValue; | |
P = L.startValue + I * N(v, u, I) | |
} | |
if (!h && P === L.currentValue) continue; | |
if (L.currentValue = P, "tween" === k) m = P; | |
else { | |
var E; | |
if (w.Hooks.registered[k]) { | |
E = w.Hooks.getRoot(k); | |
var O = a(S).rootPropertyValueCache[E]; | |
O && (L.rootPropertyValue = O) | |
} | |
var D = w.setPropertyValue(S, k, L.currentValue + (0 === parseFloat(P) ? "" : L.unitType), L.rootPropertyValue, L.scrollData); | |
w.Hooks.registered[k] && (w.Normalizations.registered[E] ? a(S).rootPropertyValueCache[E] = w.Normalizations.registered[E]("extract", null, D[1]) : a(S).rootPropertyValueCache[E] = D[1]), "transform" === D[0] && (C = !0) | |
} | |
} | |
u.mobileHA && a(S).transformCache.translate3d === i && (a(S).transformCache.translate3d = "(0px, 0px, 0px)", C = !0), C && w.flushTransformCache(S) | |
} | |
} | |
u.display !== i && "none" !== u.display && (y.State.calls[s][2].display = !1), u.visibility !== i && "hidden" !== u.visibility && (y.State.calls[s][2].visibility = !1), u.progress && u.progress.call(r[1], r[1], v, Math.max(0, f + u.duration - t), f, m), 1 === v && d(s) | |
} | |
} | |
y.State.isTicking && T(c) | |
} | |
function d(e, t) { | |
if (!y.State.calls[e]) return !1; | |
for (var n = y.State.calls[e][0], o = y.State.calls[e][1], s = y.State.calls[e][2], r = y.State.calls[e][4], l = !1, u = 0, c = n.length; u < c; u++) { | |
var d = n[u].element; | |
t || s.loop || ("none" === s.display && w.setPropertyValue(d, "display", s.display), "hidden" === s.visibility && w.setPropertyValue(d, "visibility", s.visibility)); | |
var f = a(d); | |
if (s.loop !== !0 && (p.queue(d)[1] === i || !/\.velocityQueueEntryFlag/i.test(p.queue(d)[1])) && f) { | |
f.isAnimating = !1, f.rootPropertyValueCache = {}; | |
var h = !1; | |
p.each(w.Lists.transforms3D, function(e, t) { | |
var n = /^scale/.test(t) ? 1 : 0, | |
o = f.transformCache[t]; | |
f.transformCache[t] !== i && new RegExp("^\\(" + n + "[^.]").test(o) && (h = !0, delete f.transformCache[t]) | |
}), s.mobileHA && (h = !0, delete f.transformCache.translate3d), h && w.flushTransformCache(d), w.Values.removeClass(d, "velocity-animating") | |
} | |
if (!t && s.complete && !s.loop && u === c - 1) try { | |
s.complete.call(o, o) | |
} catch (e) { | |
setTimeout(function() { | |
throw e | |
}, 1) | |
} | |
r && s.loop !== !0 && r(o), f && s.loop === !0 && !t && (p.each(f.tweensContainer, function(e, t) { | |
if (/^rotate/.test(e) && (parseFloat(t.startValue) - parseFloat(t.endValue)) % 360 === 0) { | |
var n = t.startValue; | |
t.startValue = t.endValue, t.endValue = n | |
} | |
/^backgroundPosition/.test(e) && 100 === parseFloat(t.endValue) && "%" === t.unitType && (t.endValue = 0, t.startValue = 100) | |
}), y(d, "reverse", { | |
loop: !0, | |
delay: s.delay | |
})), s.queue !== !1 && p.dequeue(d, s.queue) | |
} | |
y.State.calls[e] = !1; | |
for (var g = 0, m = y.State.calls.length; g < m; g++) | |
if (y.State.calls[g] !== !1) { | |
l = !0; | |
break | |
} | |
l === !1 && (y.State.isTicking = !1, delete y.State.calls, y.State.calls = []) | |
} | |
var p, f = function() { | |
if (n.documentMode) return n.documentMode; | |
for (var e = 7; e > 4; e--) { | |
var t = n.createElement("div"); | |
if (t.innerHTML = "<!--[if IE " + e + "]><span></span><![endif]-->", t.getElementsByTagName("span").length) return t = null, e | |
} | |
return i | |
}(), | |
h = function() { | |
var e = 0; | |
return t.webkitRequestAnimationFrame || t.mozRequestAnimationFrame || function(t) { | |
var n, i = (new Date).getTime(); | |
return n = Math.max(0, 16 - (i - e)), e = i + n, setTimeout(function() { | |
t(i + n) | |
}, n) | |
} | |
}(), | |
g = { | |
isString: function(e) { | |
return "string" == typeof e | |
}, | |
isArray: Array.isArray || function(e) { | |
return "[object Array]" === Object.prototype.toString.call(e) | |
}, | |
isFunction: function(e) { | |
return "[object Function]" === Object.prototype.toString.call(e) | |
}, | |
isNode: function(e) { | |
return e && e.nodeType | |
}, | |
isNodeList: function(e) { | |
return "object" == typeof e && /^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(e)) && e.length !== i && (0 === e.length || "object" == typeof e[0] && e[0].nodeType > 0) | |
}, | |
isWrapped: function(e) { | |
return e && (e.jquery || t.Zepto && t.Zepto.zepto.isZ(e)) | |
}, | |
isSVG: function(e) { | |
return t.SVGElement && e instanceof t.SVGElement | |
}, | |
isEmptyObject: function(e) { | |
for (var t in e) | |
if (e.hasOwnProperty(t)) return !1; | |
return !0 | |
} | |
}, | |
m = !1; | |
if (e.fn && e.fn.jquery ? (p = e, m = !0) : p = t.Velocity.Utilities, f <= 8 && !m) throw new Error("Velocity: IE8 and below require jQuery to be loaded before Velocity."); | |
if (f <= 7) return void(jQuery.fn.velocity = jQuery.fn.animate); | |
var v = 400, | |
b = "swing", | |
y = { | |
State: { | |
isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), | |
isAndroid: /Android/i.test(navigator.userAgent), | |
isGingerbread: /Android 2\.3\.[3-7]/i.test(navigator.userAgent), | |
isChrome: t.chrome, | |
isFirefox: /Firefox/i.test(navigator.userAgent), | |
prefixElement: n.createElement("div"), | |
prefixMatches: {}, | |
scrollAnchor: null, | |
scrollPropertyLeft: null, | |
scrollPropertyTop: null, | |
isTicking: !1, | |
calls: [] | |
}, | |
CSS: {}, | |
Utilities: p, | |
Redirects: {}, | |
Easings: {}, | |
Promise: t.Promise, | |
defaults: { | |
queue: "", | |
duration: v, | |
easing: b, | |
begin: i, | |
complete: i, | |
progress: i, | |
display: i, | |
visibility: i, | |
loop: !1, | |
delay: !1, | |
mobileHA: !0, | |
_cacheValues: !0, | |
promiseRejectEmpty: !0 | |
}, | |
init: function(e) { | |
p.data(e, "velocity", { | |
isSVG: g.isSVG(e), | |
isAnimating: !1, | |
computedStyle: null, | |
tweensContainer: null, | |
rootPropertyValueCache: {}, | |
transformCache: {} | |
}) | |
}, | |
hook: null, | |
mock: !1, | |
version: { | |
major: 1, | |
minor: 3, | |
patch: 1 | |
}, | |
debug: !1, | |
timestamp: !0 | |
}; | |
t.pageYOffset !== i ? (y.State.scrollAnchor = t, y.State.scrollPropertyLeft = "pageXOffset", y.State.scrollPropertyTop = "pageYOffset") : (y.State.scrollAnchor = n.documentElement || n.body.parentNode || n.body, y.State.scrollPropertyLeft = "scrollLeft", y.State.scrollPropertyTop = "scrollTop"); | |
var _ = function() { | |
function e(e) { | |
return -e.tension * e.x - e.friction * e.v | |
} | |
function t(t, n, i) { | |
var o = { | |
x: t.x + i.dx * n, | |
v: t.v + i.dv * n, | |
tension: t.tension, | |
friction: t.friction | |
}; | |
return { | |
dx: o.v, | |
dv: e(o) | |
} | |
} | |
function n(n, i) { | |
var o = { | |
dx: n.v, | |
dv: e(n) | |
}, | |
s = t(n, .5 * i, o), | |
a = t(n, .5 * i, s), | |
r = t(n, i, a), | |
l = 1 / 6 * (o.dx + 2 * (s.dx + a.dx) + r.dx), | |
u = 1 / 6 * (o.dv + 2 * (s.dv + a.dv) + r.dv); | |
return n.x = n.x + l * i, n.v = n.v + u * i, n | |
} | |
return function e(t, i, o) { | |
var s, a, r, l = { | |
x: -1, | |
v: 0, | |
tension: null, | |
friction: null | |
}, | |
u = [0], | |
c = 0, | |
d = 1e-4, | |
p = .016; | |
for (t = parseFloat(t) || 500, i = parseFloat(i) || 20, o = o || null, l.tension = t, l.friction = i, s = null !== o, s ? (c = e(t, i), a = c / o * p) : a = p; r = n(r || l, a), u.push(1 + r.x), c += 16, Math.abs(r.x) > d && Math.abs(r.v) > d;); | |
return s ? function(e) { | |
return u[e * (u.length - 1) | 0] | |
} : c | |
} | |
}(); | |
y.Easings = { | |
linear: function(e) { | |
return e | |
}, | |
swing: function(e) { | |
return .5 - Math.cos(e * Math.PI) / 2 | |
}, | |
spring: function(e) { | |
return 1 - Math.cos(4.5 * e * Math.PI) * Math.exp(6 * -e) | |
} | |
}, p.each([ | |
["ease", [.25, .1, .25, 1]], | |
["ease-in", [.42, 0, 1, 1]], | |
["ease-out", [0, 0, .58, 1]], | |
["ease-in-out", [.42, 0, .58, 1]], | |
["easeInSine", [.47, 0, .745, .715]], | |
["easeOutSine", [.39, .575, .565, 1]], | |
["easeInOutSine", [.445, .05, .55, .95]], | |
["easeInQuad", [.55, .085, .68, .53]], | |
["easeOutQuad", [.25, .46, .45, .94]], | |
["easeInOutQuad", [.455, .03, .515, .955]], | |
["easeInCubic", [.55, .055, .675, .19]], | |
["easeOutCubic", [.215, .61, .355, 1]], | |
["easeInOutCubic", [.645, .045, .355, 1]], | |
["easeInQuart", [.895, .03, .685, .22]], | |
["easeOutQuart", [.165, .84, .44, 1]], | |
["easeInOutQuart", [.77, 0, .175, 1]], | |
["easeInQuint", [.755, .05, .855, .06]], | |
["easeOutQuint", [.23, 1, .32, 1]], | |
["easeInOutQuint", [.86, 0, .07, 1]], | |
["easeInExpo", [.95, .05, .795, .035]], | |
["easeOutExpo", [.19, 1, .22, 1]], | |
["easeInOutExpo", [1, 0, 0, 1]], | |
["easeInCirc", [.6, .04, .98, .335]], | |
["easeOutCirc", [.075, .82, .165, 1]], | |
["easeInOutCirc", [.785, .135, .15, .86]] | |
], function(e, t) { | |
y.Easings[t[0]] = l.apply(null, t[1]) | |
}); | |
var w = y.CSS = { | |
RegEx: { | |
isHex: /^#([A-f\d]{3}){1,2}$/i, | |
valueUnwrap: /^[A-z]+\((.*)\)$/i, | |
wrappedValueAlreadyExtracted: /[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/, | |
valueSplit: /([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/gi | |
}, | |
Lists: { | |
colors: ["fill", "stroke", "stopColor", "color", "backgroundColor", "borderColor", "borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor", "outlineColor"], | |
transformsBase: ["translateX", "translateY", "scale", "scaleX", "scaleY", "skewX", "skewY", "rotateZ"], | |
transforms3D: ["transformPerspective", "translateZ", "scaleZ", "rotateX", "rotateY"] | |
}, | |
Hooks: { | |
templates: { | |
textShadow: ["Color X Y Blur", "black 0px 0px 0px"], | |
boxShadow: ["Color X Y Blur Spread", "black 0px 0px 0px 0px"], | |
clip: ["Top Right Bottom Left", "0px 0px 0px 0px"], | |
backgroundPosition: ["X Y", "0% 0%"], | |
transformOrigin: ["X Y Z", "50% 50% 0px"], | |
perspectiveOrigin: ["X Y", "50% 50%"] | |
}, | |
registered: {}, | |
register: function() { | |
for (var e = 0; e < w.Lists.colors.length; e++) { | |
var t = "color" === w.Lists.colors[e] ? "0 0 0 1" : "255 255 255 1"; | |
w.Hooks.templates[w.Lists.colors[e]] = ["Red Green Blue Alpha", t] | |
} | |
var n, i, o; | |
if (f) | |
for (n in w.Hooks.templates) | |
if (w.Hooks.templates.hasOwnProperty(n)) { | |
i = w.Hooks.templates[n], o = i[0].split(" "); | |
var s = i[1].match(w.RegEx.valueSplit); | |
"Color" === o[0] && (o.push(o.shift()), s.push(s.shift()), w.Hooks.templates[n] = [o.join(" "), s.join(" ")]) | |
} | |
for (n in w.Hooks.templates) | |
if (w.Hooks.templates.hasOwnProperty(n)) { | |
i = w.Hooks.templates[n], o = i[0].split(" "); | |
for (var a in o) | |
if (o.hasOwnProperty(a)) { | |
var r = n + o[a], | |
l = a; | |
w.Hooks.registered[r] = [n, l] | |
} | |
} | |
}, | |
getRoot: function(e) { | |
var t = w.Hooks.registered[e]; | |
return t ? t[0] : e | |
}, | |
cleanRootPropertyValue: function(e, t) { | |
return w.RegEx.valueUnwrap.test(t) && (t = t.match(w.RegEx.valueUnwrap)[1]), w.Values.isCSSNullValue(t) && (t = w.Hooks.templates[e][1]), t | |
}, | |
extractValue: function(e, t) { | |
var n = w.Hooks.registered[e]; | |
if (n) { | |
var i = n[0], | |
o = n[1]; | |
return t = w.Hooks.cleanRootPropertyValue(i, t), t.toString().match(w.RegEx.valueSplit)[o] | |
} | |
return t | |
}, | |
injectValue: function(e, t, n) { | |
var i = w.Hooks.registered[e]; | |
if (i) { | |
var o, s, a = i[0], | |
r = i[1]; | |
return n = w.Hooks.cleanRootPropertyValue(a, n), o = n.toString().match(w.RegEx.valueSplit), o[r] = t, s = o.join(" ") | |
} | |
return n | |
} | |
}, | |
Normalizations: { | |
registered: { | |
clip: function(e, t, n) { | |
switch (e) { | |
case "name": | |
return "clip"; | |
case "extract": | |
var i; | |
return w.RegEx.wrappedValueAlreadyExtracted.test(n) ? i = n : (i = n.toString().match(w.RegEx.valueUnwrap), i = i ? i[1].replace(/,(\s+)?/g, " ") : n), i; | |
case "inject": | |
return "rect(" + n + ")" | |
} | |
}, | |
blur: function(e, t, n) { | |
switch (e) { | |
case "name": | |
return y.State.isFirefox ? "filter" : "-webkit-filter"; | |
case "extract": | |
var i = parseFloat(n); | |
if (!i && 0 !== i) { | |
var o = n.toString().match(/blur\(([0-9]+[A-z]+)\)/i); | |
i = o ? o[1] : 0 | |
} | |
return i; | |
case "inject": | |
return parseFloat(n) ? "blur(" + n + ")" : "none" | |
} | |
}, | |
opacity: function(e, t, n) { | |
if (f <= 8) switch (e) { | |
case "name": | |
return "filter"; | |
case "extract": | |
var i = n.toString().match(/alpha\(opacity=(.*)\)/i); | |
return n = i ? i[1] / 100 : 1; | |
case "inject": | |
return t.style.zoom = 1, parseFloat(n) >= 1 ? "" : "alpha(opacity=" + parseInt(100 * parseFloat(n), 10) + ")" | |
} else switch (e) { | |
case "name": | |
return "opacity"; | |
case "extract": | |
return n; | |
case "inject": | |
return n | |
} | |
} | |
}, | |
register: function() { | |
function e(e, t, n) { | |
var i = "border-box" === w.getPropertyValue(t, "boxSizing").toString().toLowerCase(); | |
if (i === (n || !1)) { | |
var o, s, a = 0, | |
r = "width" === e ? ["Left", "Right"] : ["Top", "Bottom"], | |
l = ["padding" + r[0], "padding" + r[1], "border" + r[0] + "Width", "border" + r[1] + "Width"]; | |
for (o = 0; o < l.length; o++) s = parseFloat(w.getPropertyValue(t, l[o])), isNaN(s) || (a += s); | |
return n ? -a : a | |
} | |
return 0 | |
} | |
function t(t, n) { | |
return function(i, o, s) { | |
switch (i) { | |
case "name": | |
return t; | |
case "extract": | |
return parseFloat(s) + e(t, o, n); | |
case "inject": | |
return parseFloat(s) - e(t, o, n) + "px" | |
} | |
} | |
} | |
f && !(f > 9) || y.State.isGingerbread || (w.Lists.transformsBase = w.Lists.transformsBase.concat(w.Lists.transforms3D)); | |
for (var n = 0; n < w.Lists.transformsBase.length; n++) ! function() { | |
var e = w.Lists.transformsBase[n]; | |
w.Normalizations.registered[e] = function(t, n, o) { | |
switch (t) { | |
case "name": | |
return "transform"; | |
case "extract": | |
return a(n) === i || a(n).transformCache[e] === i ? /^scale/i.test(e) ? 1 : 0 : a(n).transformCache[e].replace(/[()]/g, ""); | |
case "inject": | |
var s = !1; | |
switch (e.substr(0, e.length - 1)) { | |
case "translate": | |
s = !/(%|px|em|rem|vw|vh|\d)$/i.test(o); | |
break; | |
case "scal": | |
case "scale": | |
y.State.isAndroid && a(n).transformCache[e] === i && o < 1 && (o = 1), s = !/(\d)$/i.test(o); | |
break; | |
case "skew": | |
s = !/(deg|\d)$/i.test(o); | |
break; | |
case "rotate": | |
s = !/(deg|\d)$/i.test(o) | |
} | |
return s || (a(n).transformCache[e] = "(" + o + ")"), a(n).transformCache[e] | |
} | |
} | |
}(); | |
for (var o = 0; o < w.Lists.colors.length; o++) ! function() { | |
var e = w.Lists.colors[o]; | |
w.Normalizations.registered[e] = function(t, n, o) { | |
switch (t) { | |
case "name": | |
return e; | |
case "extract": | |
var s; | |
if (w.RegEx.wrappedValueAlreadyExtracted.test(o)) s = o; | |
else { | |
var a, r = { | |
black: "rgb(0, 0, 0)", | |
blue: "rgb(0, 0, 255)", | |
gray: "rgb(128, 128, 128)", | |
green: "rgb(0, 128, 0)", | |
red: "rgb(255, 0, 0)", | |
white: "rgb(255, 255, 255)" | |
}; | |
/^[A-z]+$/i.test(o) ? a = r[o] !== i ? r[o] : r.black : w.RegEx.isHex.test(o) ? a = "rgb(" + w.Values.hexToRgb(o).join(" ") + ")" : /^rgba?\(/i.test(o) || (a = r.black), s = (a || o).toString().match(w.RegEx.valueUnwrap)[1].replace(/,(\s+)?/g, " ") | |
} | |
return (!f || f > 8) && 3 === s.split(" ").length && (s += " 1"), s; | |
case "inject": | |
return /^rgb/.test(o) ? o : (f <= 8 ? 4 === o.split(" ").length && (o = o.split(/\s+/).slice(0, 3).join(" ")) : 3 === o.split(" ").length && (o += " 1"), (f <= 8 ? "rgb" : "rgba") + "(" + o.replace(/\s+/g, ",").replace(/\.(\d)+(?=,)/g, "") + ")") | |
} | |
} | |
}(); | |
w.Normalizations.registered.innerWidth = t("width", !0), w.Normalizations.registered.innerHeight = t("height", !0), w.Normalizations.registered.outerWidth = t("width"), w.Normalizations.registered.outerHeight = t("height") | |
} | |
}, | |
Names: { | |
camelCase: function(e) { | |
return e.replace(/-(\w)/g, function(e, t) { | |
return t.toUpperCase() | |
}) | |
}, | |
SVGAttribute: function(e) { | |
var t = "width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2"; | |
return (f || y.State.isAndroid && !y.State.isChrome) && (t += "|transform"), new RegExp("^(" + t + ")$", "i").test(e) | |
}, | |
prefixCheck: function(e) { | |
if (y.State.prefixMatches[e]) return [y.State.prefixMatches[e], !0]; | |
for (var t = ["", "Webkit", "Moz", "ms", "O"], n = 0, i = t.length; n < i; n++) { | |
var o; | |
if (o = 0 === n ? e : t[n] + e.replace(/^\w/, function(e) { | |
return e.toUpperCase() | |
}), g.isString(y.State.prefixElement.style[o])) return y.State.prefixMatches[e] = o, [o, !0] | |
} | |
return [e, !1] | |
} | |
}, | |
Values: { | |
hexToRgb: function(e) { | |
var t, n = /^#?([a-f\d])([a-f\d])([a-f\d])$/i, | |
i = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i; | |
return e = e.replace(n, function(e, t, n, i) { | |
return t + t + n + n + i + i | |
}), t = i.exec(e), t ? [parseInt(t[1], 16), parseInt(t[2], 16), parseInt(t[3], 16)] : [0, 0, 0] | |
}, | |
isCSSNullValue: function(e) { | |
return !e || /^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(e) | |
}, | |
getUnitType: function(e) { | |
return /^(rotate|skew)/i.test(e) ? "deg" : /(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(e) ? "" : "px" | |
}, | |
getDisplayType: function(e) { | |
var t = e && e.tagName.toString().toLowerCase(); | |
return /^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(t) ? "inline" : /^(li)$/i.test(t) ? "list-item" : /^(tr)$/i.test(t) ? "table-row" : /^(table)$/i.test(t) ? "table" : /^(tbody)$/i.test(t) ? "table-row-group" : "block" | |
}, | |
addClass: function(e, t) { | |
e.classList ? e.classList.add(t) : e.className += (e.className.length ? " " : "") + t | |
}, | |
removeClass: function(e, t) { | |
e.classList ? e.classList.remove(t) : e.className = e.className.toString().replace(new RegExp("(^|\\s)" + t.split(" ").join("|") + "(\\s|$)", "gi"), " ") | |
} | |
}, | |
getPropertyValue: function(e, n, o, s) { | |
function r(e, n) { | |
var o = 0; | |
if (f <= 8) o = p.css(e, n); | |
else { | |
var l = !1; | |
/^(width|height)$/.test(n) && 0 === w.getPropertyValue(e, "display") && (l = !0, w.setPropertyValue(e, "display", w.Values.getDisplayType(e))); | |
var u = function() { | |
l && w.setPropertyValue(e, "display", "none") | |
}; | |
if (!s) { | |
if ("height" === n && "border-box" !== w.getPropertyValue(e, "boxSizing").toString().toLowerCase()) { | |
var c = e.offsetHeight - (parseFloat(w.getPropertyValue(e, "borderTopWidth")) || 0) - (parseFloat(w.getPropertyValue(e, "borderBottomWidth")) || 0) - (parseFloat(w.getPropertyValue(e, "paddingTop")) || 0) - (parseFloat(w.getPropertyValue(e, "paddingBottom")) || 0); | |
return u(), c | |
} | |
if ("width" === n && "border-box" !== w.getPropertyValue(e, "boxSizing").toString().toLowerCase()) { | |
var d = e.offsetWidth - (parseFloat(w.getPropertyValue(e, "borderLeftWidth")) || 0) - (parseFloat(w.getPropertyValue(e, "borderRightWidth")) || 0) - (parseFloat(w.getPropertyValue(e, "paddingLeft")) || 0) - (parseFloat(w.getPropertyValue(e, "paddingRight")) || 0); | |
return u(), d | |
} | |
} | |
var h; | |
h = a(e) === i ? t.getComputedStyle(e, null) : a(e).computedStyle ? a(e).computedStyle : a(e).computedStyle = t.getComputedStyle(e, null), "borderColor" === n && (n = "borderTopColor"), o = 9 === f && "filter" === n ? h.getPropertyValue(n) : h[n], "" !== o && null !== o || (o = e.style[n]), u() | |
} | |
if ("auto" === o && /^(top|right|bottom|left)$/i.test(n)) { | |
var g = r(e, "position"); | |
("fixed" === g || "absolute" === g && /top|left/i.test(n)) && (o = p(e).position()[n] + "px") | |
} | |
return o | |
} | |
var l; | |
if (w.Hooks.registered[n]) { | |
var u = n, | |
c = w.Hooks.getRoot(u); | |
o === i && (o = w.getPropertyValue(e, w.Names.prefixCheck(c)[0])), w.Normalizations.registered[c] && (o = w.Normalizations.registered[c]("extract", e, o)), l = w.Hooks.extractValue(u, o) | |
} else if (w.Normalizations.registered[n]) { | |
var d, h; | |
d = w.Normalizations.registered[n]("name", e), "transform" !== d && (h = r(e, w.Names.prefixCheck(d)[0]), w.Values.isCSSNullValue(h) && w.Hooks.templates[n] && (h = w.Hooks.templates[n][1])), l = w.Normalizations.registered[n]("extract", e, h) | |
} | |
if (!/^[\d-]/.test(l)) { | |
var g = a(e); | |
if (g && g.isSVG && w.Names.SVGAttribute(n)) | |
if (/^(height|width)$/i.test(n)) try { | |
l = e.getBBox()[n] | |
} catch (e) { | |
l = 0 | |
} else l = e.getAttribute(n); | |
else l = r(e, w.Names.prefixCheck(n)[0]) | |
} | |
return w.Values.isCSSNullValue(l) && (l = 0), y.debug >= 2 && console.log("Get " + n + ": " + l), l | |
}, | |
setPropertyValue: function(e, n, i, o, s) { | |
var r = n; | |
if ("scroll" === n) s.container ? s.container["scroll" + s.direction] = i : "Left" === s.direction ? t.scrollTo(i, s.alternateValue) : t.scrollTo(s.alternateValue, i); | |
else if (w.Normalizations.registered[n] && "transform" === w.Normalizations.registered[n]("name", e)) w.Normalizations.registered[n]("inject", e, i), r = "transform", i = a(e).transformCache[n]; | |
else { | |
if (w.Hooks.registered[n]) { | |
var l = n, | |
u = w.Hooks.getRoot(n); | |
o = o || w.getPropertyValue(e, u), i = w.Hooks.injectValue(l, i, o), n = u | |
} | |
if (w.Normalizations.registered[n] && (i = w.Normalizations.registered[n]("inject", e, i), n = w.Normalizations.registered[n]("name", e)), r = w.Names.prefixCheck(n)[0], f <= 8) try { | |
e.style[r] = i | |
} catch (e) { | |
y.debug && console.log("Browser does not support [" + i + "] for [" + r + "]") | |
} else { | |
var c = a(e); | |
c && c.isSVG && w.Names.SVGAttribute(n) ? e.setAttribute(n, i) : e.style[r] = i | |
} | |
y.debug >= 2 && console.log("Set " + n + " (" + r + "): " + i) | |
} | |
return [r, i] | |
}, | |
flushTransformCache: function(e) { | |
var t = "", | |
n = a(e); | |
if ((f || y.State.isAndroid && !y.State.isChrome) && n && n.isSVG) { | |
var i = function(t) { | |
return parseFloat(w.getPropertyValue(e, t)) | |
}, | |
o = { | |
translate: [i("translateX"), i("translateY")], | |
skewX: [i("skewX")], | |
skewY: [i("skewY")], | |
scale: 1 !== i("scale") ? [i("scale"), i("scale")] : [i("scaleX"), i("scaleY")], | |
rotate: [i("rotateZ"), 0, 0] | |
}; | |
p.each(a(e).transformCache, function(e) { | |
/^translate/i.test(e) ? e = "translate" : /^scale/i.test(e) ? e = "scale" : /^rotate/i.test(e) && (e = "rotate"), o[e] && (t += e + "(" + o[e].join(" ") + ") ", delete o[e]) | |
}) | |
} else { | |
var s, r; | |
p.each(a(e).transformCache, function(n) { | |
return s = a(e).transformCache[n], "transformPerspective" === n ? (r = s, !0) : (9 === f && "rotateZ" === n && (n = "rotate"), void(t += n + s + " ")) | |
}), r && (t = "perspective" + r + " " + t) | |
} | |
w.setPropertyValue(e, "transform", t) | |
} | |
}; | |
w.Hooks.register(), w.Normalizations.register(), y.hook = function(e, t, n) { | |
var o; | |
return e = s(e), p.each(e, function(e, s) { | |
if (a(s) === i && y.init(s), n === i) o === i && (o = w.getPropertyValue(s, t)); | |
else { | |
var r = w.setPropertyValue(s, t, n); | |
"transform" === r[0] && y.CSS.flushTransformCache(s), o = r | |
} | |
}), o | |
}; | |
var x = function() { | |
function e() { | |
return l ? S.promise || null : f | |
} | |
function o(e, o) { | |
function s() { | |
var s, f; | |
if (l.begin && 0 === $) try { | |
l.begin.call(m, m) | |
} catch (e) { | |
setTimeout(function() { | |
throw e | |
}, 1) | |
} | |
if ("scroll" === L) { | |
var h, v, x, T = /^x$/i.test(l.axis) ? "Left" : "Top", | |
k = parseFloat(l.offset) || 0; | |
l.container ? g.isWrapped(l.container) || g.isNode(l.container) ? (l.container = l.container[0] || l.container, h = l.container["scroll" + T], x = h + p(e).position()[T.toLowerCase()] + k) : l.container = null : (h = y.State.scrollAnchor[y.State["scrollProperty" + T]], v = y.State.scrollAnchor[y.State["scrollProperty" + ("Left" === T ? "Top" : "Left")]], x = p(e).offset()[T.toLowerCase()] + k), d = { | |
scroll: { | |
rootPropertyValue: !1, | |
startValue: h, | |
currentValue: h, | |
endValue: x, | |
unitType: "", | |
easing: l.easing, | |
scrollData: { | |
container: l.container, | |
direction: T, | |
alternateValue: v | |
} | |
}, | |
element: e | |
}, y.debug && console.log("tweensContainer (scroll): ", d.scroll, e) | |
} else if ("reverse" === L) { | |
if (s = a(e), !s) return; | |
if (!s.tweensContainer) return void p.dequeue(e, l.queue); | |
"none" === s.opts.display && (s.opts.display = "auto"), "hidden" === s.opts.visibility && (s.opts.visibility = "visible"), s.opts.loop = !1, s.opts.begin = null, s.opts.complete = null, _.easing || delete l.easing, _.duration || delete l.duration, l = p.extend({}, s.opts, l), f = p.extend(!0, {}, s ? s.tweensContainer : null); | |
for (var P in f) | |
if (f.hasOwnProperty(P) && "element" !== P) { | |
var N = f[P].startValue; | |
f[P].startValue = f[P].currentValue = f[P].endValue, f[P].endValue = N, g.isEmptyObject(_) || (f[P].easing = l.easing), y.debug && console.log("reverse tweensContainer (" + P + "): " + JSON.stringify(f[P]), e) | |
} | |
d = f | |
} else if ("start" === L) { | |
s = a(e), s && s.tweensContainer && s.isAnimating === !0 && (f = s.tweensContainer); | |
var F = function(t, n) { | |
var i, s, a; | |
return g.isFunction(t) && (t = t.call(e, o, C)), g.isArray(t) ? (i = t[0], !g.isArray(t[1]) && /^[\d-]/.test(t[1]) || g.isFunction(t[1]) || w.RegEx.isHex.test(t[1]) ? a = t[1] : g.isString(t[1]) && !w.RegEx.isHex.test(t[1]) && y.Easings[t[1]] || g.isArray(t[1]) ? (s = n ? t[1] : u(t[1], l.duration), a = t[2]) : a = t[1] || t[2]) : i = t, n || (s = s || l.easing), g.isFunction(i) && (i = i.call(e, o, C)), g.isFunction(a) && (a = a.call(e, o, C)), [i || 0, s, a] | |
}, | |
I = function(o, a) { | |
var u, c = w.Hooks.getRoot(o), | |
h = !1, | |
m = a[0], | |
v = a[1], | |
b = a[2]; | |
if (!(s && s.isSVG || "tween" === c || w.Names.prefixCheck(c)[1] !== !1 || w.Normalizations.registered[c] !== i)) return void(y.debug && console.log("Skipping [" + c + "] due to a lack of browser support.")); | |
(l.display !== i && null !== l.display && "none" !== l.display || l.visibility !== i && "hidden" !== l.visibility) && /opacity|filter/.test(o) && !b && 0 !== m && (b = 0), l._cacheValues && f && f[o] ? (b === i && (b = f[o].endValue + f[o].unitType), h = s.rootPropertyValueCache[c]) : w.Hooks.registered[o] ? b === i ? (h = w.getPropertyValue(e, c), b = w.getPropertyValue(e, o, h)) : h = w.Hooks.templates[c][1] : b === i && (b = w.getPropertyValue(e, o)); | |
var _, x, T, S = !1, | |
C = function(e, t) { | |
var n, i; | |
return i = (t || "0").toString().toLowerCase().replace(/[%A-z]+$/, function(e) { | |
return n = e, "" | |
}), n || (n = w.Values.getUnitType(e)), [i, n] | |
}; | |
if (g.isString(b) && g.isString(m)) { | |
u = ""; | |
for (var $ = 0, k = 0, P = [], L = []; $ < b.length && k < m.length;) { | |
var N = b[$], | |
F = m[k]; | |
if (/[\d\.]/.test(N) && /[\d\.]/.test(F)) { | |
for (var I = N, E = F, D = ".", A = "."; ++$ < b.length;) { | |
if (N = b[$], N === D) D = ".."; | |
else if (!/\d/.test(N)) break; | |
I += N | |
} | |
for (; ++k < m.length;) { | |
if (F = m[k], F === A) A = ".."; | |
else if (!/\d/.test(F)) break; | |
E += F | |
} | |
I === E ? u += I : (u += "{" + P.length + "}", P.push(parseFloat(I)), L.push(parseFloat(E))) | |
} else { | |
if (N !== F) break; | |
u += N, $++, k++ | |
} | |
} | |
$ === b.length && k === m.length || (y.debug && console.error('Trying to pattern match mis-matched strings ["' + m + '", "' + b + '"]'), u = i), u && (P.length ? (y.debug && console.log('Pattern found "' + u + '" -> ', P, L, b, m), b = P, m = L, x = T = "") : u = i) | |
} | |
u || (_ = C(o, b), b = _[0], T = _[1], _ = C(o, m), m = _[0].replace(/^([+-\/*])=/, function(e, t) { | |
return S = t, "" | |
}), x = _[1], b = parseFloat(b) || 0, m = parseFloat(m) || 0, "%" === x && (/^(fontSize|lineHeight)$/.test(o) ? (m /= 100, x = "em") : /^scale/.test(o) ? (m /= 100, x = "") : /(Red|Green|Blue)$/i.test(o) && (m = m / 100 * 255, x = ""))); | |
var M = function() { | |
var i = { | |
myParent: e.parentNode || n.body, | |
position: w.getPropertyValue(e, "position"), | |
fontSize: w.getPropertyValue(e, "fontSize") | |
}, | |
o = i.position === O.lastPosition && i.myParent === O.lastParent, | |
a = i.fontSize === O.lastFontSize; | |
O.lastParent = i.myParent, O.lastPosition = i.position, O.lastFontSize = i.fontSize; | |
var r = 100, | |
l = {}; | |
if (a && o) l.emToPx = O.lastEmToPx, l.percentToPxWidth = O.lastPercentToPxWidth, l.percentToPxHeight = O.lastPercentToPxHeight; | |
else { | |
var u = s && s.isSVG ? n.createElementNS("http://www.w3.org/2000/svg", "rect") : n.createElement("div"); | |
y.init(u), i.myParent.appendChild(u), p.each(["overflow", "overflowX", "overflowY"], function(e, t) { | |
y.CSS.setPropertyValue(u, t, "hidden") | |
}), y.CSS.setPropertyValue(u, "position", i.position), y.CSS.setPropertyValue(u, "fontSize", i.fontSize), y.CSS.setPropertyValue(u, "boxSizing", "content-box"), p.each(["minWidth", "maxWidth", "width", "minHeight", "maxHeight", "height"], function(e, t) { | |
y.CSS.setPropertyValue(u, t, r + "%") | |
}), y.CSS.setPropertyValue(u, "paddingLeft", r + "em"), l.percentToPxWidth = O.lastPercentToPxWidth = (parseFloat(w.getPropertyValue(u, "width", null, !0)) || 1) / r, l.percentToPxHeight = O.lastPercentToPxHeight = (parseFloat(w.getPropertyValue(u, "height", null, !0)) || 1) / r, l.emToPx = O.lastEmToPx = (parseFloat(w.getPropertyValue(u, "paddingLeft")) || 1) / r, i.myParent.removeChild(u) | |
} | |
return null === O.remToPx && (O.remToPx = parseFloat(w.getPropertyValue(n.body, "fontSize")) || 16), null === O.vwToPx && (O.vwToPx = parseFloat(t.innerWidth) / 100, O.vhToPx = parseFloat(t.innerHeight) / 100), l.remToPx = O.remToPx, l.vwToPx = O.vwToPx, l.vhToPx = O.vhToPx, y.debug >= 1 && console.log("Unit ratios: " + JSON.stringify(l), e), l | |
}; | |
if (/[\/*]/.test(S)) x = T; | |
else if (T !== x && 0 !== b) | |
if (0 === m) x = T; | |
else { | |
r = r || M(); | |
var B = /margin|padding|left|right|width|text|word|letter/i.test(o) || /X$/.test(o) || "x" === o ? "x" : "y"; | |
switch (T) { | |
case "%": | |
b *= "x" === B ? r.percentToPxWidth : r.percentToPxHeight; | |
break; | |
case "px": | |
break; | |
default: | |
b *= r[T + "ToPx"] | |
} | |
switch (x) { | |
case "%": | |
b *= 1 / ("x" === B ? r.percentToPxWidth : r.percentToPxHeight); | |
break; | |
case "px": | |
break; | |
default: | |
b *= 1 / r[x + "ToPx"] | |
} | |
} | |
switch (S) { | |
case "+": | |
m = b + m; | |
break; | |
case "-": | |
m = b - m; | |
break; | |
case "*": | |
m = b * m; | |
break; | |
case "/": | |
m = b / m | |
} | |
d[o] = { | |
rootPropertyValue: h, | |
startValue: b, | |
currentValue: b, | |
endValue: m, | |
unitType: x, | |
easing: v | |
}, u && (d[o].pattern = u), y.debug && console.log("tweensContainer (" + o + "): " + JSON.stringify(d[o]), e) | |
}; | |
for (var E in b) | |
if (b.hasOwnProperty(E)) { | |
var A = w.Names.camelCase(E), | |
M = F(b[E]); | |
if (w.Lists.colors.indexOf(A) >= 0) { | |
var B = M[0], | |
U = M[1], | |
H = M[2]; | |
if (w.RegEx.isHex.test(B)) { | |
for (var R = ["Red", "Green", "Blue"], j = w.Values.hexToRgb(B), V = H ? w.Values.hexToRgb(H) : i, q = 0; q < R.length; q++) { | |
var z = [j[q]]; | |
U && z.push(U), V !== i && z.push(V[q]), I(A + R[q], z) | |
} | |
continue | |
} | |
} | |
I(A, M) | |
} | |
d.element = e | |
} | |
d.element && (w.Values.addClass(e, "velocity-animating"), D.push(d), s = a(e), s && ("" === l.queue && (s.tweensContainer = d, s.opts = l), s.isAnimating = !0), $ === C - 1 ? (y.State.calls.push([D, m, l, null, S.resolver]), y.State.isTicking === !1 && (y.State.isTicking = !0, c())) : $++) | |
} | |
var r, l = p.extend({}, y.defaults, _), | |
d = {}; | |
switch (a(e) === i && y.init(e), parseFloat(l.delay) && l.queue !== !1 && p.queue(e, l.queue, function(t) { | |
y.velocityQueueEntryFlag = !0, a(e).delayTimer = { | |
setTimeout: setTimeout(t, parseFloat(l.delay)), | |
next: t | |
} | |
}), l.duration.toString().toLowerCase()) { | |
case "fast": | |
l.duration = 200; | |
break; | |
case "normal": | |
l.duration = v; | |
break; | |
case "slow": | |
l.duration = 600; | |
break; | |
default: | |
l.duration = parseFloat(l.duration) || 1 | |
} | |
y.mock !== !1 && (y.mock === !0 ? l.duration = l.delay = 1 : (l.duration *= parseFloat(y.mock) || 1, l.delay *= parseFloat(y.mock) || 1)), l.easing = u(l.easing, l.duration), l.begin && !g.isFunction(l.begin) && (l.begin = null), l.progress && !g.isFunction(l.progress) && (l.progress = null), l.complete && !g.isFunction(l.complete) && (l.complete = null), l.display !== i && null !== l.display && (l.display = l.display.toString().toLowerCase(), "auto" === l.display && (l.display = y.CSS.Values.getDisplayType(e))), l.visibility !== i && null !== l.visibility && (l.visibility = l.visibility.toString().toLowerCase()), l.mobileHA = l.mobileHA && y.State.isMobile && !y.State.isGingerbread, l.queue === !1 ? l.delay ? setTimeout(s, l.delay) : s() : p.queue(e, l.queue, function(e, t) { | |
return t === !0 ? (S.promise && S.resolver(m), !0) : (y.velocityQueueEntryFlag = !0, void s(e)) | |
}), "" !== l.queue && "fx" !== l.queue || "inprogress" === p.queue(e)[0] || p.dequeue(e) | |
} | |
var r, l, f, h, m, b, _, T = arguments[0] && (arguments[0].p || p.isPlainObject(arguments[0].properties) && !arguments[0].properties.names || g.isString(arguments[0].properties)); | |
g.isWrapped(this) ? (l = !1, h = 0, m = this, f = this) : (l = !0, h = 1, m = T ? arguments[0].elements || arguments[0].e : arguments[0]); | |
var S = { | |
promise: null, | |
resolver: null, | |
rejecter: null | |
}; | |
if (l && y.Promise && (S.promise = new y.Promise(function(e, t) { | |
S.resolver = e, S.rejecter = t | |
})), T ? (b = arguments[0].properties || arguments[0].p, _ = arguments[0].options || arguments[0].o) : (b = arguments[h], _ = arguments[h + 1]), m = s(m), !m) return void(S.promise && (b && _ && _.promiseRejectEmpty === !1 ? S.resolver() : S.rejecter())); | |
var C = m.length, | |
$ = 0; | |
if (!/^(stop|finish|finishAll)$/i.test(b) && !p.isPlainObject(_)) { | |
var k = h + 1; | |
_ = {}; | |
for (var P = k; P < arguments.length; P++) g.isArray(arguments[P]) || !/^(fast|normal|slow)$/i.test(arguments[P]) && !/^\d/.test(arguments[P]) ? g.isString(arguments[P]) || g.isArray(arguments[P]) ? _.easing = arguments[P] : g.isFunction(arguments[P]) && (_.complete = arguments[P]) : _.duration = arguments[P] | |
} | |
var L; | |
switch (b) { | |
case "scroll": | |
L = "scroll"; | |
break; | |
case "reverse": | |
L = "reverse"; | |
break; | |
case "finish": | |
case "finishAll": | |
case "stop": | |
p.each(m, function(e, t) { | |
a(t) && a(t).delayTimer && (clearTimeout(a(t).delayTimer.setTimeout), a(t).delayTimer.next && a(t).delayTimer.next(), delete a(t).delayTimer), "finishAll" !== b || _ !== !0 && !g.isString(_) || (p.each(p.queue(t, g.isString(_) ? _ : ""), function(e, t) { | |
g.isFunction(t) && t() | |
}), p.queue(t, g.isString(_) ? _ : "", [])) | |
}); | |
var N = []; | |
return p.each(y.State.calls, function(e, t) { | |
t && p.each(t[1], function(n, o) { | |
var s = _ === i ? "" : _; | |
return s !== !0 && t[2].queue !== s && (_ !== i || t[2].queue !== !1) || void p.each(m, function(n, i) { | |
if (i === o) | |
if ((_ === !0 || g.isString(_)) && (p.each(p.queue(i, g.isString(_) ? _ : ""), function(e, t) { | |
g.isFunction(t) && t(null, !0) | |
}), p.queue(i, g.isString(_) ? _ : "", [])), "stop" === b) { | |
var r = a(i); | |
r && r.tweensContainer && s !== !1 && p.each(r.tweensContainer, function(e, t) { | |
t.endValue = t.currentValue | |
}), N.push(e) | |
} else "finish" !== b && "finishAll" !== b || (t[2].duration = 1) | |
}) | |
}) | |
}), "stop" === b && (p.each(N, function(e, t) { | |
d(t, !0) | |
}), S.promise && S.resolver(m)), e(); | |
default: | |
if (!p.isPlainObject(b) || g.isEmptyObject(b)) { | |
if (g.isString(b) && y.Redirects[b]) { | |
r = p.extend({}, _); | |
var F = r.duration, | |
I = r.delay || 0; | |
return r.backwards === !0 && (m = p.extend(!0, [], m).reverse()), p.each(m, function(e, t) { | |
parseFloat(r.stagger) ? r.delay = I + parseFloat(r.stagger) * e : g.isFunction(r.stagger) && (r.delay = I + r.stagger.call(t, e, C)), r.drag && (r.duration = parseFloat(F) || (/^(callout|transition)/.test(b) ? 1e3 : v), r.duration = Math.max(r.duration * (r.backwards ? 1 - e / C : (e + 1) / C), .75 * r.duration, 200)), y.Redirects[b].call(t, t, r || {}, e, C, m, S.promise ? S : i) | |
}), e() | |
} | |
var E = "Velocity: First argument (" + b + ") was not a property map, a known action, or a registered redirect. Aborting."; | |
return S.promise ? S.rejecter(new Error(E)) : console.log(E), e() | |
} | |
L = "start" | |
} | |
var O = { | |
lastParent: null, | |
lastPosition: null, | |
lastFontSize: null, | |
lastPercentToPxWidth: null, | |
lastPercentToPxHeight: null, | |
lastEmToPx: null, | |
remToPx: null, | |
vwToPx: null, | |
vhToPx: null | |
}, | |
D = []; | |
p.each(m, function(e, t) { | |
g.isNode(t) && o(t, e) | |
}), r = p.extend({}, y.defaults, _), r.loop = parseInt(r.loop, 10); | |
var A = 2 * r.loop - 1; | |
if (r.loop) | |
for (var M = 0; M < A; M++) { | |
var B = { | |
delay: r.delay, | |
progress: r.progress | |
}; | |
M === A - 1 && (B.display = r.display, B.visibility = r.visibility, B.complete = r.complete), x(m, "reverse", B) | |
} | |
return e() | |
}; | |
y = p.extend(x, y), y.animate = x; | |
var T = t.requestAnimationFrame || h; | |
return y.State.isMobile || n.hidden === i || n.addEventListener("visibilitychange", function() { | |
n.hidden ? (T = function(e) { | |
return setTimeout(function() { | |
e(!0) | |
}, 16) | |
}, c()) : T = t.requestAnimationFrame || h | |
}), e.Velocity = y, e !== t && (e.fn.velocity = x, e.fn.velocity.defaults = y.defaults), p.each(["Down", "Up"], function(e, t) { | |
y.Redirects["slide" + t] = function(e, n, o, s, a, r) { | |
var l = p.extend({}, n), | |
u = l.begin, | |
c = l.complete, | |
d = {}, | |
f = { | |
height: "", | |
marginTop: "", | |
marginBottom: "", | |
paddingTop: "", | |
paddingBottom: "" | |
}; | |
l.display === i && (l.display = "Down" === t ? "inline" === y.CSS.Values.getDisplayType(e) ? "inline-block" : "block" : "none"), l.begin = function() { | |
0 === o && u && u.call(a, a); | |
for (var n in f) | |
if (f.hasOwnProperty(n)) { | |
d[n] = e.style[n]; | |
var i = w.getPropertyValue(e, n); | |
f[n] = "Down" === t ? [i, 0] : [0, i] | |
} | |
d.overflow = e.style.overflow, e.style.overflow = "hidden" | |
}, l.complete = function() { | |
for (var t in d) d.hasOwnProperty(t) && (e.style[t] = d[t]); | |
o === s - 1 && (c && c.call(a, a), r && r.resolver(a)) | |
}, y(e, f, l) | |
} | |
}), p.each(["In", "Out"], function(e, t) { | |
y.Redirects["fade" + t] = function(e, n, o, s, a, r) { | |
var l = p.extend({}, n), | |
u = l.complete, | |
c = { | |
opacity: "In" === t ? 1 : 0 | |
}; | |
0 !== o && (l.begin = null), o !== s - 1 ? l.complete = null : l.complete = function() { | |
u && u.call(a, a), r && r.resolver(a) | |
}, l.display === i && (l.display = "In" === t ? "auto" : "none"), y(this, c, l) | |
} | |
}), y | |
}(window.jQuery || window.Zepto || window, window, document) | |
}), | |
function() { | |
function e() { | |
return t | |
} | |
function t(e) { | |
if (!(this instanceof t)) return new t(e); | |
var i = "undefined" == typeof window ? {} : window; | |
if (i.AudioContext || (i.AudioContext = i.webkitAudioContext), e || (console.log("tuna.js: Missing audio context! Creating a new context for you."), e = i.AudioContext && new i.AudioContext), !e) throw new Error("Tuna cannot initialize because this environment does not support web audio."); | |
n(e), c = e, d = this | |
} | |
function n(e) { | |
function t() { | |
var e = arguments[0]; | |
return arguments[0] = f.isPrototypeOf ? f.isPrototypeOf(e) ? e.input : e : e.input || e, o.apply(this, arguments), e | |
} | |
if (e.__connectified__ !== !0) { | |
var n = e.createGain(), | |
i = Object.getPrototypeOf(Object.getPrototypeOf(n)), | |
o = i.connect; | |
i.connect = t, e.__connectified__ = !0 | |
} | |
} | |
function i(e) { | |
return Math.max(0, Math.round(100 * Math.pow(2, e / 6)) / 100) | |
} | |
function o(e) { | |
return 2 * e / 10 | |
} | |
function s() { | |
var e = window.chrome, | |
t = window.navigator.vendor, | |
n = window.navigator.userAgent.indexOf("OPR") > -1, | |
i = window.navigator.userAgent.indexOf("Edge") > -1; | |
return null !== e && void 0 !== e && "Google Inc." === t && 0 == n && 0 == i | |
} | |
function a(e, t) { | |
var n, i, o = 0, | |
s = 0, | |
a = 0, | |
r = 0; | |
return n = e.toExponential().match(/^.\.?(.*)e(.+)$/), o = parseInt(n[2], 10) - (n[1] + "").length, n = t.toExponential().match(/^.\.?(.*)e(.+)$/), s = parseInt(n[2], 10) - (n[1] + "").length, s > o && (o = s), i = e % t, o < -100 || o > 20 ? (a = Math.round(Math.log(i) / Math.log(10)), r = Math.pow(10, a), (i / r).toFixed(a - o) * r) : parseFloat(i.toFixed(-o)) | |
} | |
function r(e) { | |
return 0 === e ? 1 : Math.abs(e) / e | |
} | |
function l(e) { | |
return (Math.exp(e) - Math.exp(-e)) / (Math.exp(e) + Math.exp(-e)) | |
} | |
function u(e, t) { | |
return void 0 === e ? t : e | |
} | |
var c, d, p = function(e, t) { | |
e.value = t | |
}, | |
f = Object.create(null, { | |
activate: { | |
writable: !0, | |
value: function(e) { | |
e ? (this.input.disconnect(), this.input.connect(this.activateNode), this.activateCallback && this.activateCallback(e)) : (this.input.disconnect(), this.input.connect(this.output)) | |
} | |
}, | |
bypass: { | |
get: function() { | |
return this._bypass | |
}, | |
set: function(e) { | |
this._lastBypassValue !== e && (this._bypass = e, this.activate(!e), this._lastBypassValue = e) | |
} | |
}, | |
connect: { | |
value: function(e) { | |
this.output.connect(e) | |
} | |
}, | |
disconnect: { | |
value: function(e) { | |
this.output.disconnect(e) | |
} | |
}, | |
connectInOrder: { | |
value: function(e) { | |
for (var t = e.length - 1; t--;) { | |
if (!e[t].connect) return console.error("AudioNode.connectInOrder: TypeError: Not an AudioNode.", e[t]); | |
e[t + 1].input ? e[t].connect(e[t + 1].input) : e[t].connect(e[t + 1]) | |
} | |
} | |
}, | |
getDefaults: { | |
value: function() { | |
var e = {}; | |
for (var t in this.defaults) e[t] = this.defaults[t].value; | |
return e | |
} | |
}, | |
automate: { | |
value: function(e, t, n, i) { | |
var o, s = i ? ~~(i / 1e3) : c.currentTime, | |
a = n ? ~~(n / 1e3) : 0, | |
r = this.defaults[e], | |
l = this[e]; | |
l ? r.automatable ? (n ? (o = "linearRampToValueAtTime", l.cancelScheduledValues(s), l.setValueAtTime(l.value, s)) : o = "setValueAtTime", l[o](t, a + s)) : l = t : console.error("Invalid Property for " + this.name) | |
} | |
} | |
}), | |
h = "float", | |
g = "boolean", | |
m = "string", | |
v = "int"; | |
"undefined" != typeof module && module.exports ? module.exports = t : "function" == typeof define ? window.define("Tuna", e) : window.Tuna = t, t.prototype.Bitcrusher = function(e) { | |
e || (e = this.getDefaults()), this.bufferSize = e.bufferSize || this.defaults.bufferSize.value, this.input = c.createGain(), this.activateNode = c.createGain(), this.processor = c.createScriptProcessor(this.bufferSize, 1, 1), this.output = c.createGain(), this.activateNode.connect(this.processor), this.processor.connect(this.output); | |
var t, n, i, o, s, a = 0, | |
r = 0; | |
this.processor.onaudioprocess = function(e) { | |
for (t = e.inputBuffer.getChannelData(0), n = e.outputBuffer.getChannelData(0), i = Math.pow(.5, this.bits), s = t.length, o = 0; o < s; o++) a += this.normfreq, a >= 1 && (a -= 1, r = i * Math.floor(t[o] / i + .5)), n[o] = r | |
}, this.bits = e.bits || this.defaults.bits.value, this.normfreq = u(e.normfreq, this.defaults.normfreq.value), this.bypass = e.bypass || !1 | |
}, t.prototype.Bitcrusher.prototype = Object.create(f, { | |
name: { | |
value: "Bitcrusher" | |
}, | |
defaults: { | |
writable: !0, | |
value: { | |
bits: { | |
value: 4, | |
min: 1, | |
max: 16, | |
automatable: !1, | |
type: v | |
}, | |
bufferSize: { | |
value: 4096, | |
min: 256, | |
max: 16384, | |
automatable: !1, | |
type: v | |
}, | |
bypass: { | |
value: !1, | |
automatable: !1, | |
type: g | |
}, | |
normfreq: { | |
value: .1, | |
min: 1e-4, | |
max: 1, | |
automatable: !1, | |
type: h | |
} | |
} | |
}, | |
bits: { | |
enumerable: !0, | |
get: function() { | |
return this.processor.bits | |
}, | |
set: function(e) { | |
this.processor.bits = e | |
} | |
}, | |
normfreq: { | |
enumerable: !0, | |
get: function() { | |
return this.processor.normfreq | |
}, | |
set: function(e) { | |
this.processor.normfreq = e | |
} | |
} | |
}), t.prototype.Cabinet = function(e) { | |
e || (e = this.getDefaults()), this.input = c.createGain(), this.activateNode = c.createGain(), this.convolver = this.newConvolver(e.impulsePath || "../impulses/impulse_guitar.wav"), this.makeupNode = c.createGain(), this.output = c.createGain(), this.activateNode.connect(this.convolver.input), this.convolver.output.connect(this.makeupNode), this.makeupNode.connect(this.output), this.makeupGain = u(e.makeupGain, this.defaults.makeupGain), this.bypass = e.bypass || !1 | |
}, t.prototype.Cabinet.prototype = Object.create(f, { | |
name: { | |
value: "Cabinet" | |
}, | |
defaults: { | |
writable: !0, | |
value: { | |
makeupGain: { | |
value: 1, | |
min: 0, | |
max: 20, | |
automatable: !0, | |
type: h | |
}, | |
bypass: { | |
value: !1, | |
automatable: !1, | |
type: g | |
} | |
} | |
}, | |
makeupGain: { | |
enumerable: !0, | |
get: function() { | |
return this.makeupNode.gain | |
}, | |
set: function(e) { | |
this.makeupNode.gain.value = e | |
} | |
}, | |
newConvolver: { | |
value: function(e) { | |
return new d.Convolver({ | |
impulse: e, | |
dryLevel: 0, | |
wetLevel: 1 | |
}) | |
} | |
} | |
}), t.prototype.Chorus = function(e) { | |
e || (e = this.getDefaults()), this.input = c.createGain(), this.attenuator = this.activateNode = c.createGain(), this.splitter = c.createChannelSplitter(2), this.delayL = c.createDelay(), this.delayR = c.createDelay(), this.feedbackGainNodeLR = c.createGain(), this.feedbackGainNodeRL = c.createGain(), this.merger = c.createChannelMerger(2), this.output = c.createGain(), this.lfoL = new d.LFO({ | |
target: this.delayL.delayTime, | |
callback: p | |
}), this.lfoR = new d.LFO({ | |
target: this.delayR.delayTime, | |
callback: p | |
}), this.input.connect(this.attenuator), this.attenuator.connect(this.output), this.attenuator.connect(this.splitter), this.splitter.connect(this.delayL, 0), this.splitter.connect(this.delayR, 1), this.delayL.connect(this.feedbackGainNodeLR), this.delayR.connect(this.feedbackGainNodeRL), this.feedbackGainNodeLR.connect(this.delayR), this.feedbackGainNodeRL.connect(this.delayL), this.delayL.connect(this.merger, 0, 0), this.delayR.connect(this.merger, 0, 1), this.merger.connect(this.output), this.feedback = u(e.feedback, this.defaults.feedback.value), this.rate = u(e.rate, this.defaults.rate.value), this.delay = u(e.delay, this.defaults.delay.value), this.depth = u(e.depth, this.defaults.depth.value), this.lfoR.phase = Math.PI / 2, this.attenuator.gain.value = .6934, this.lfoL.activate(!0), this.lfoR.activate(!0), this.bypass = e.bypass || !1 | |
}, t.prototype.Chorus.prototype = Object.create(f, { | |
name: { | |
value: "Chorus" | |
}, | |
defaults: { | |
writable: !0, | |
value: { | |
feedback: { | |
value: .4, | |
min: 0, | |
max: .95, | |
automatable: !1, | |
type: h | |
}, | |
delay: { | |
value: .0045, | |
min: 0, | |
max: 1, | |
automatable: !1, | |
type: h | |
}, | |
depth: { | |
value: .7, | |
min: 0, | |
max: 1, | |
automatable: !1, | |
type: h | |
}, | |
rate: { | |
value: 1.5, | |
min: 0, | |
max: 8, | |
automatable: !1, | |
type: h | |
}, | |
bypass: { | |
value: !1, | |
automatable: !1, | |
type: g | |
} | |
} | |
}, | |
delay: { | |
enumerable: !0, | |
get: function() { | |
return this._delay | |
}, | |
set: function(e) { | |
this._delay = 2e-4 * (2 * Math.pow(10, e)), this.lfoL.offset = this._delay, this.lfoR.offset = this._delay, this._depth = this._depth | |
} | |
}, | |
depth: { | |
enumerable: !0, | |
get: function() { | |
return this._depth | |
}, | |
set: function(e) { | |
this._depth = e, this.lfoL.oscillation = this._depth * this._delay, this.lfoR.oscillation = this._depth * this._delay | |
} | |
}, | |
feedback: { | |
enumerable: !0, | |
get: function() { | |
return this._feedback | |
}, | |
set: function(e) { | |
this._feedback = e, this.feedbackGainNodeLR.gain.value = this._feedback, this.feedbackGainNodeRL.gain.value = this._feedback | |
} | |
}, | |
rate: { | |
enumerable: !0, | |
get: function() { | |
return this._rate | |
}, | |
set: function(e) { | |
this._rate = e, this.lfoL.frequency = this._rate, this.lfoR.frequency = this._rate | |
} | |
} | |
}), t.prototype.Compressor = function(e) { | |
e || (e = this.getDefaults()), this.input = c.createGain(), this.compNode = this.activateNode = c.createDynamicsCompressor(), this.makeupNode = c.createGain(), this.output = c.createGain(), this.compNode.connect(this.makeupNode), this.makeupNode.connect(this.output), this.automakeup = u(e.automakeup, this.defaults.automakeup.value), this.makeupGain = u(e.makeupGain, this.defaults.makeupGain.value), this.threshold = u(e.threshold, this.defaults.threshold.value), this.release = u(e.release, this.defaults.release.value), this.attack = u(e.attack, this.defaults.attack.value), this.ratio = e.ratio || this.defaults.ratio.value, this.knee = u(e.knee, this.defaults.knee.value), this.bypass = e.bypass || !1 | |
}, t.prototype.Compressor.prototype = Object.create(f, { | |
name: { | |
value: "Compressor" | |
}, | |
defaults: { | |
writable: !0, | |
value: { | |
threshold: { | |
value: -20, | |
min: -60, | |
max: 0, | |
automatable: !0, | |
type: h | |
}, | |
release: { | |
value: 250, | |
min: 10, | |
max: 2e3, | |
automatable: !0, | |
type: h | |
}, | |
makeupGain: { | |
value: 1, | |
min: 1, | |
max: 100, | |
automatable: !0, | |
type: h | |
}, | |
attack: { | |
value: 1, | |
min: 0, | |
max: 1e3, | |
automatable: !0, | |
type: h | |
}, | |
ratio: { | |
value: 4, | |
min: 1, | |
max: 50, | |
automatable: !0, | |
type: h | |
}, | |
knee: { | |
value: 5, | |
min: 0, | |
max: 40, | |
automatable: !0, | |
type: h | |
}, | |
automakeup: { | |
value: !1, | |
automatable: !1, | |
type: g | |
}, | |
bypass: { | |
value: !1, | |
automatable: !1, | |
type: g | |
} | |
} | |
}, | |
computeMakeup: { | |
value: function() { | |
var e = 4, | |
t = this.compNode; | |
return -(t.threshold.value - t.threshold.value / t.ratio.value) / e | |
} | |
}, | |
automakeup: { | |
enumerable: !0, | |
get: function() { | |
return this._automakeup | |
}, | |
set: function(e) { | |
this._automakeup = e, this._automakeup && (this.makeupGain = this.computeMakeup()) | |
} | |
}, | |
threshold: { | |
enumerable: !0, | |
get: function() { | |
return this.compNode.threshold | |
}, | |
set: function(e) { | |
this.compNode.threshold.value = e, this._automakeup && (this.makeupGain = this.computeMakeup()) | |
} | |
}, | |
ratio: { | |
enumerable: !0, | |
get: function() { | |
return this.compNode.ratio | |
}, | |
set: function(e) { | |
this.compNode.ratio.value = e, this._automakeup && (this.makeupGain = this.computeMakeup()) | |
} | |
}, | |
knee: { | |
enumerable: !0, | |
get: function() { | |
return this.compNode.knee | |
}, | |
set: function(e) { | |
this.compNode.knee.value = e, this._automakeup && (this.makeupGain = this.computeMakeup()) | |
} | |
}, | |
attack: { | |
enumerable: !0, | |
get: function() { | |
return this.compNode.attack | |
}, | |
set: function(e) { | |
this.compNode.attack.value = e / 1e3 | |
} | |
}, | |
release: { | |
enumerable: !0, | |
get: function() { | |
return this.compNode.release | |
}, | |
set: function(e) { | |
this.compNode.release.value = e / 1e3 | |
} | |
}, | |
makeupGain: { | |
enumerable: !0, | |
get: function() { | |
return this.makeupNode.gain | |
}, | |
set: function(e) { | |
this.makeupNode.gain.value = i(e) | |
} | |
} | |
}), t.prototype.Filter = function(e) { | |
e || (e = this.getDefaults()), this.input = c.createGain(), this.activateNode = c.createGain(), this.filter = c.createBiquadFilter(), this.output = c.createGain(), this.activateNode.connect(this.filter), this.filter.connect(this.output), this.frequency = e.frequency || this.defaults.frequency.value, this.Q = e.resonance || this.defaults.Q.value, this.filterType = u(e.filterType, this.defaults.filterType.value), this.gain = u(e.gain, this.defaults.gain.value), this.bypass = e.bypass || !1 | |
}, t.prototype.Filter.prototype = Object.create(f, { | |
name: { | |
value: "Filter" | |
}, | |
defaults: { | |
writable: !0, | |
value: { | |
frequency: { | |
value: 800, | |
min: 20, | |
max: 22050, | |
automatable: !0, | |
type: h | |
}, | |
Q: { | |
value: 1, | |
min: .001, | |
max: 100, | |
automatable: !0, | |
type: h | |
}, | |
gain: { | |
value: 0, | |
min: -40, | |
max: 40, | |
automatable: !0, | |
type: h | |
}, | |
bypass: { | |
value: !1, | |
automatable: !1, | |
type: g | |
}, | |
filterType: { | |
value: "lowpass", | |
automatable: !1, | |
type: m | |
} | |
} | |
}, | |
filterType: { | |
enumerable: !0, | |
get: function() { | |
return this.filter.type | |
}, | |
set: function(e) { | |
this.filter.type = e | |
} | |
}, | |
Q: { | |
enumerable: !0, | |
get: function() { | |
return this.filter.Q | |
}, | |
set: function(e) { | |
this.filter.Q.value = e | |
} | |
}, | |
gain: { | |
enumerable: !0, | |
get: function() { | |
return this.filter.gain | |
}, | |
set: function(e) { | |
this.filter.gain.value = e | |
} | |
}, | |
frequency: { | |
enumerable: !0, | |
get: function() { | |
return this.filter.frequency | |
}, | |
set: function(e) { | |
this.filter.frequency.value = e | |
} | |
} | |
}), t.prototype.Gain = function(e) { | |
e || (e = this.getDefaults()), this.input = c.createGain(), this.activateNode = c.createGain(), this.gainNode = c.createGain(), this.output = c.createGain(), this.activateNode.connect(this.gainNode), this.gainNode.connect(this.output), this.gain = u(e.gain, this.defaults.gain.value), this.bypass = e.bypass || !1 | |
}, t.prototype.Gain.prototype = Object.create(f, { | |
name: { | |
value: "Gain" | |
}, | |
defaults: { | |
writable: !0, | |
value: { | |
bypass: { | |
value: !1, | |
automatable: !1, | |
type: g | |
}, | |
gain: { | |
value: 1, | |
automatable: !0, | |
type: h | |
} | |
} | |
}, | |
gain: { | |
enumerable: !0, | |
get: function() { | |
return this.gainNode.gain | |
}, | |
set: function(e) { | |
this.gainNode.gain.value = e | |
} | |
} | |
}), t.prototype.MoogFilter = function(e) { | |
e || (e = this.getDefaults()), this.bufferSize = e.bufferSize || this.defaults.bufferSize.value, this.input = c.createGain(), this.activateNode = c.createGain(), this.processor = c.createScriptProcessor(this.bufferSize, 1, 1), this.output = c.createGain(), this.activateNode.connect(this.processor), this.processor.connect(this.output); | |
var t, n, i, o, s, a, r, l; | |
t = n = i = o = s = a = r = l = 0; | |
var d, p, f, h, g, m, v; | |
this.processor.onaudioprocess = function(e) { | |
for (d = e.inputBuffer.getChannelData(0), p = e.outputBuffer.getChannelData(0), f = 1.16 * this.cutoff, v = .35013 * (f * f) * (f * f), h = this.resonance * (1 - .15 * f * f), m = d.length, g = 0; g < m; g++) d[g] -= l * h, d[g] *= v, s = d[g] + .3 * t + (1 - f) * s, t = d[g], a = s + .3 * n + (1 - f) * a, n = s, r = a + .3 * i + (1 - f) * r, i = a, l = r + .3 * o + (1 - f) * l, o = r, p[g] = l | |
}, this.cutoff = u(e.cutoff, this.defaults.cutoff.value), this.resonance = u(e.resonance, this.defaults.resonance.value), this.bypass = e.bypass || !1 | |
}, t.prototype.MoogFilter.prototype = Object.create(f, { | |
name: { | |
value: "MoogFilter" | |
}, | |
defaults: { | |
writable: !0, | |
value: { | |
bufferSize: { | |
value: 4096, | |
min: 256, | |
max: 16384, | |
automatable: !1, | |
type: v | |
}, | |
bypass: { | |
value: !1, | |
automatable: !1, | |
type: g | |
}, | |
cutoff: { | |
value: .065, | |
min: 1e-4, | |
max: 1, | |
automatable: !1, | |
type: h | |
}, | |
resonance: { | |
value: 3.5, | |
min: 0, | |
max: 4, | |
automatable: !1, | |
type: h | |
} | |
} | |
}, | |
cutoff: { | |
enumerable: !0, | |
get: function() { | |
return this.processor.cutoff | |
}, | |
set: function(e) { | |
this.processor.cutoff = e | |
} | |
}, | |
resonance: { | |
enumerable: !0, | |
get: function() { | |
return this.processor.resonance | |
}, | |
set: function(e) { | |
this.processor.resonance = e | |
} | |
} | |
}), t.prototype.Overdrive = function(e) { | |
e || (e = this.getDefaults()), this.input = c.createGain(), this.activateNode = c.createGain(), this.inputDrive = c.createGain(), this.waveshaper = c.createWaveShaper(), this.outputDrive = c.createGain(), this.output = c.createGain(), this.activateNode.connect(this.inputDrive), this.inputDrive.connect(this.waveshaper), this.waveshaper.connect(this.outputDrive), this.outputDrive.connect(this.output), this.ws_table = new Float32Array(this.k_nSamples), this.drive = u(e.drive, this.defaults.drive.value), this.outputGain = u(e.outputGain, this.defaults.outputGain.value), this.curveAmount = u(e.curveAmount, this.defaults.curveAmount.value), this.algorithmIndex = u(e.algorithmIndex, this.defaults.algorithmIndex.value), this.bypass = e.bypass || !1 | |
}, t.prototype.Overdrive.prototype = Object.create(f, { | |
name: { | |
value: "Overdrive" | |
}, | |
defaults: { | |
writable: !0, | |
value: { | |
drive: { | |
value: 1, | |
min: 0, | |
max: 1, | |
automatable: !0, | |
type: h, | |
scaled: !0 | |
}, | |
outputGain: { | |
value: 1, | |
min: 0, | |
max: 1, | |
automatable: !0, | |
type: h, | |
scaled: !0 | |
}, | |
curveAmount: { | |
value: .725, | |
min: 0, | |
max: 1, | |
automatable: !1, | |
type: h | |
}, | |
algorithmIndex: { | |
value: 0, | |
min: 0, | |
max: 5, | |
automatable: !1, | |
type: v | |
} | |
} | |
}, | |
k_nSamples: { | |
value: 8192 | |
}, | |
drive: { | |
get: function() { | |
return this.inputDrive.gain | |
}, | |
set: function(e) { | |
this._drive = e | |
} | |
}, | |
curveAmount: { | |
get: function() { | |
return this._curveAmount | |
}, | |
set: function(e) { | |
this._curveAmount = e, void 0 === this._algorithmIndex && (this._algorithmIndex = 0), this.waveshaperAlgorithms[this._algorithmIndex](this._curveAmount, this.k_nSamples, this.ws_table), this.waveshaper.curve = this.ws_table | |
} | |
}, | |
outputGain: { | |
get: function() { | |
return this.outputDrive.gain | |
}, | |
set: function(e) { | |
this._outputGain = i(e) | |
} | |
}, | |
algorithmIndex: { | |
get: function() { | |
return this._algorithmIndex | |
}, | |
set: function(e) { | |
this._algorithmIndex = e, this.curveAmount = this._curveAmount | |
} | |
}, | |
waveshaperAlgorithms: { | |
value: [function(e, t, n) { | |
e = Math.min(e, .9999); | |
var i, o, s = 2 * e / (1 - e); | |
for (i = 0; i < t; i++) o = 2 * i / t - 1, n[i] = (1 + s) * o / (1 + s * Math.abs(o)) | |
}, function(e, t, n) { | |
var i, o, s; | |
for (i = 0; i < t; i++) o = 2 * i / t - 1, s = (.5 * Math.pow(o + 1.4, 2) - 1) * s >= 0 ? 5.8 : 1.2, n[i] = l(s) | |
}, function(e, t, n) { | |
var i, o, s, a = 1 - e; | |
for (i = 0; i < t; i++) o = 2 * i / t - 1, s = o < 0 ? -Math.pow(Math.abs(o), a + .04) : Math.pow(o, a), n[i] = l(2 * s) | |
}, function(e, t, n) { | |
var i, o, s, a, l = 1 - e > .99 ? .99 : 1 - e; | |
for (i = 0; i < t; i++) o = 2 * i / t - 1, a = Math.abs(o), a < l ? s = a : a > l ? s = l + (a - l) / (1 + Math.pow((a - l) / (1 - l), 2)) : a > 1 && (s = a), n[i] = r(o) * s * (1 / ((l + 1) / 2)) | |
}, function(e, t, n) { | |
var i, o; | |
for (i = 0; i < t; i++) o = 2 * i / t - 1, o < -.08905 ? n[i] = -.75 * (1 - Math.pow(1 - (Math.abs(o) - .032857), 12) + 1 / 3 * (Math.abs(o) - .032847)) + .01 : o >= -.08905 && o < .320018 ? n[i] = -6.153 * (o * o) + 3.9375 * o : n[i] = .630035 | |
}, function(e, t, n) { | |
var i, o, s = 2 + Math.round(14 * e), | |
a = Math.round(Math.pow(2, s - 1)); | |
for (i = 0; i < t; i++) o = 2 * i / t - 1, n[i] = Math.round(o * a) / a | |
}] | |
} | |
}), t.prototype.Panner = function(e) { | |
e || (e = this.getDefaults()), this.input = c.createGain(), this.activateNode = c.createGain(), this.panner = c.createStereoPanner(), this.output = c.createGain(), this.activateNode.connect(this.panner), this.panner.connect(this.output), this.pan = u(e.pan, this.defaults.pan.value), this.bypass = e.bypass || !1 | |
}, t.prototype.Panner.prototype = Object.create(f, { | |
name: { | |
value: "Panner" | |
}, | |
defaults: { | |
writable: !0, | |
value: { | |
bypass: { | |
value: !1, | |
automatable: !1, | |
type: g | |
}, | |
pan: { | |
value: 0, | |
min: -1, | |
max: 1, | |
automatable: !0, | |
type: h | |
} | |
} | |
}, | |
pan: { | |
enumerable: !0, | |
get: function() { | |
return this.panner.pan | |
}, | |
set: function(e) { | |
this.panner.pan.value = e | |
} | |
} | |
}), t.prototype.Phaser = function(e) { | |
e || (e = this.getDefaults()), this.input = c.createGain(), this.splitter = this.activateNode = c.createChannelSplitter(2), this.filtersL = [], this.filtersR = [], this.feedbackGainNodeL = c.createGain(), this.feedbackGainNodeR = c.createGain(), this.merger = c.createChannelMerger(2), this.filteredSignal = c.createGain(), this.output = c.createGain(), this.lfoL = new d.LFO({ | |
target: this.filtersL, | |
callback: this.callback | |
}), this.lfoR = new d.LFO({ | |
target: this.filtersR, | |
callback: this.callback | |
}); | |
for (var t = this.stage; t--;) this.filtersL[t] = c.createBiquadFilter(), this.filtersR[t] = c.createBiquadFilter(), this.filtersL[t].type = "allpass", this.filtersR[t].type = "allpass"; | |
this.input.connect(this.splitter), this.input.connect(this.output), this.splitter.connect(this.filtersL[0], 0, 0), this.splitter.connect(this.filtersR[0], 1, 0), this.connectInOrder(this.filtersL), this.connectInOrder(this.filtersR), this.filtersL[this.stage - 1].connect(this.feedbackGainNodeL), this.filtersL[this.stage - 1].connect(this.merger, 0, 0), this.filtersR[this.stage - 1].connect(this.feedbackGainNodeR), this.filtersR[this.stage - 1].connect(this.merger, 0, 1), this.feedbackGainNodeL.connect(this.filtersL[0]), this.feedbackGainNodeR.connect(this.filtersR[0]), this.merger.connect(this.output), this.rate = u(e.rate, this.defaults.rate.value), this.baseModulationFrequency = e.baseModulationFrequency || this.defaults.baseModulationFrequency.value, this.depth = u(e.depth, this.defaults.depth.value), this.feedback = u(e.feedback, this.defaults.feedback.value), this.stereoPhase = u(e.stereoPhase, this.defaults.stereoPhase.value), this.lfoL.activate(!0), this.lfoR.activate(!0), this.bypass = e.bypass || !1 | |
}, t.prototype.Phaser.prototype = Object.create(f, { | |
name: { | |
value: "Phaser" | |
}, | |
stage: { | |
value: 4 | |
}, | |
defaults: { | |
writable: !0, | |
value: { | |
rate: { | |
value: .1, | |
min: 0, | |
max: 8, | |
automatable: !1, | |
type: h | |
}, | |
depth: { | |
value: .6, | |
min: 0, | |
max: 1, | |
automatable: !1, | |
type: h | |
}, | |
feedback: { | |
value: .7, | |
min: 0, | |
max: 1, | |
automatable: !1, | |
type: h | |
}, | |
stereoPhase: { | |
value: 40, | |
min: 0, | |
max: 180, | |
automatable: !1, | |
type: h | |
}, | |
baseModulationFrequency: { | |
value: 700, | |
min: 500, | |
max: 1500, | |
automatable: !1, | |
type: h | |
} | |
} | |
}, | |
callback: { | |
value: function(e, t) { | |
for (var n = 0; n < 4; n++) e[n].frequency.value = t | |
} | |
}, | |
depth: { | |
get: function() { | |
return this._depth | |
}, | |
set: function(e) { | |
this._depth = e, this.lfoL.oscillation = this._baseModulationFrequency * this._depth, this.lfoR.oscillation = this._baseModulationFrequency * this._depth | |
} | |
}, | |
rate: { | |
get: function() { | |
return this._rate | |
}, | |
set: function(e) { | |
this._rate = e, this.lfoL.frequency = this._rate, this.lfoR.frequency = this._rate | |
} | |
}, | |
baseModulationFrequency: { | |
enumerable: !0, | |
get: function() { | |
return this._baseModulationFrequency | |
}, | |
set: function(e) { | |
this._baseModulationFrequency = e, this.lfoL.offset = this._baseModulationFrequency, this.lfoR.offset = this._baseModulationFrequency, this._depth = this._depth | |
} | |
}, | |
feedback: { | |
get: function() { | |
return this._feedback | |
}, | |
set: function(e) { | |
this._feedback = e, this.feedbackGainNodeL.gain.value = this._feedback, this.feedbackGainNodeR.gain.value = this._feedback | |
} | |
}, | |
stereoPhase: { | |
get: function() { | |
return this._stereoPhase | |
}, | |
set: function(e) { | |
this._stereoPhase = e; | |
var t = this.lfoL._phase + this._stereoPhase * Math.PI / 180; | |
t = a(t, 2 * Math.PI), this.lfoR._phase = t | |
} | |
} | |
}), t.prototype.Delay = function(e) { | |
e || (e = this.getDefaults()), this.input = c.createGain(), this.activateNode = c.createGain(), this.dry = c.createGain(), this.wet = c.createGain(), this.filter = c.createBiquadFilter(), this.delay = c.createDelay(6), this.feedbackNode = c.createGain(), this.output = c.createGain(), this.activateNode.connect(this.delay), this.delay.connect(this.feedbackNode), this.feedbackNode.connect(this.filter), this.filter.connect(this.delay), this.filter.connect(this.wet), this.wet.connect(this.output), this.activateNode.connect(this.dry), this.dry.connect(this.output), this.delayTime = e.delayTime || this.defaults.delayTime.value, this.feedback = u(e.feedback, this.defaults.feedback.value), this.wetLevel = u(e.wetLevel, this.defaults.wetLevel.value), this.dryLevel = u(e.dryLevel, this.defaults.dryLevel.value), this.lowCut = e.lowCut || this.defaults.lowCut.value, this.filter.type = "lowpass", this.bypass = e.bypass || !1 | |
}, t.prototype.Delay.prototype = Object.create(f, { | |
name: { | |
value: "Delay" | |
}, | |
defaults: { | |
writable: !0, | |
value: { | |
delayTime: { | |
value: 100, | |
min: 20, | |
max: 1e3, | |
automatable: !1, | |
type: h | |
}, | |
feedback: { | |
value: .45, | |
min: 0, | |
max: .9, | |
automatable: !0, | |
type: h | |
}, | |
lowCut: { | |
value: 22050, | |
min: 20, | |
max: 22050, | |
automatable: !0, | |
type: h | |
}, | |
wetLevel: { | |
value: .5, | |
min: 0, | |
max: 1, | |
automatable: !0, | |
type: h | |
}, | |
dryLevel: { | |
value: 1, | |
min: 0, | |
max: 1, | |
automatable: !0, | |
type: h | |
} | |
} | |
}, | |
delayTime: { | |
enumerable: !0, | |
get: function() { | |
return this.delay.delayTime | |
}, | |
set: function(e) { | |
this.delay.delayTime.value = e / 1e3 | |
} | |
}, | |
wetLevel: { | |
enumerable: !0, | |
get: function() { | |
return this.wet.gain | |
}, | |
set: function(e) { | |
this.wet.gain.value = e | |
} | |
}, | |
dryLevel: { | |
enumerable: !0, | |
get: function() { | |
return this.dry.gain | |
}, | |
set: function(e) { | |
this.dry.gain.value = e | |
} | |
}, | |
feedback: { | |
enumerable: !0, | |
get: function() { | |
return this.feedbackNode.gain | |
}, | |
set: function(e) { | |
this.feedbackNode.gain.value = e | |
} | |
}, | |
lowCut: { | |
enumerable: !0, | |
get: function() { | |
return this.filter.frequency | |
}, | |
set: function(e) { | |
this.filter.frequency.value = e | |
} | |
} | |
}), t.prototype.PingPongDelay = function(e) { | |
e || (e = this.getDefaults()), this.input = c.createGain(), this.wet = c.createGain(), this.dry = c.createGain(), this.stereoToMonoMix = c.createGain(), this.feedbackLevel = c.createGain(), this.output = c.createGain(), this.delayLeft = c.createDelay(6), this.delayRight = c.createDelay(6), this.filterLow = c.createBiquadFilter(), this.filterLow.type = "highpass", this.filterHigh = c.createBiquadFilter(), this.filterHigh.type = "lowpass", this.activateNode = c.createGain(), this.splitter = c.createChannelSplitter(2), this.merger = c.createChannelMerger(2), this.activateNode.connect(this.filterLow), this.filterLow.connect(this.filterHigh), this.filterHigh.connect(this.splitter), this.splitter.connect(this.stereoToMonoMix, 0, 0), this.splitter.connect(this.stereoToMonoMix, 1, 0), this.stereoToMonoMix.gain.value = s() ? .5 : 1, this.stereoToMonoMix.connect(this.wet), this.wet.connect(this.delayLeft), this.feedbackLevel.connect(this.delayLeft), this.delayLeft.connect(this.delayRight), this.delayRight.connect(this.feedbackLevel), this.delayLeft.connect(this.merger, 0, 0), this.delayRight.connect(this.merger, 0, 1), this.merger.connect(this.output), this.activateNode.connect(this.dry), this.dry.connect(this.output), this.delayTimeLeft = void 0 !== e.delayTimeLeft ? e.delayTimeLeft : this.defaults.delayTimeLeft.value, this.delayTimeRight = void 0 !== e.delayTimeRight ? e.delayTimeRight : this.defaults.delayTimeRight.value, this.feedbackLevel.gain.value = void 0 !== e.feedback ? e.feedback : this.defaults.feedback.value, this.wetLevel = u(e.wetLevel, this.defaults.wetLevel.value), this.dryLevel = u(e.dryLevel, this.defaults.dryLevel.value), this.lowCut = e.lowCut || this.defaults.lowCut.value, this.highCut = e.highCut || this.defaults.highCut.value, this.bypass = e.bypass || !1 | |
}, t.prototype.PingPongDelay.prototype = Object.create(f, { | |
name: { | |
value: "PingPongDelay" | |
}, | |
delayTimeLeft: { | |
enumerable: !0, | |
get: function() { | |
return this._delayTimeLeft | |
}, | |
set: function(e) { | |
this._delayTimeLeft = e, this.delayLeft.delayTime.cancelScheduledValues(c.currentTime), this.delayLeft.delayTime.setValueAtTime(e / 1e3, c.currentTime) | |
} | |
}, | |
delayTimeRight: { | |
enumerable: !0, | |
get: function() { | |
return this._delayTimeRight | |
}, | |
set: function(e) { | |
this._delayTimeRight = e, this.delayRight.delayTime.cancelScheduledValues(c.currentTime), this.delayRight.delayTime.setValueAtTime(e / 1e3, c.currentTime) | |
} | |
}, | |
feedback: { | |
enumerable: !0, | |
get: function() { | |
return this.feedbackLevel.gain | |
}, | |
set: function(e) { | |
this.feedbackLevel.gain.value = e | |
} | |
}, | |
lowCut: { | |
get: function() { | |
return this.filterLow.frequency | |
}, | |
set: function(e) { | |
this.filterLow.frequency.value = e | |
} | |
}, | |
highCut: { | |
get: function() { | |
return this.filterHigh.frequency | |
}, | |
set: function(e) { | |
this.filterHigh.frequency.value = e | |
} | |
}, | |
wetLevel: { | |
enumerable: !0, | |
get: function() { | |
return this.wet.gain | |
}, | |
set: function(e) { | |
this.wet.gain.setTargetAtTime(e, c.currentTime, o(.05)) | |
} | |
}, | |
dryLevel: { | |
enumerable: !0, | |
get: function() { | |
return this.dry.gain | |
}, | |
set: function(e) { | |
this.dry.gain.setTargetAtTime(e, c.currentTime, o(.05)) | |
} | |
}, | |
defaults: { | |
writable: !0, | |
value: { | |
lowCut: { | |
value: 22050, | |
min: 0, | |
max: 22050, | |
automatable: !0, | |
type: h | |
}, | |
highCut: { | |
value: 22050, | |
min: 20, | |
max: 22050, | |
automatable: !0, | |
type: h | |
}, | |
delayTimeLeft: { | |
value: 200, | |
min: 1, | |
max: 1e4, | |
automatable: !1, | |
type: v | |
}, | |
delayTimeRight: { | |
value: 400, | |
min: 1, | |
max: 1e4, | |
automatable: !1, | |
type: v | |
}, | |
feedback: { | |
value: .3, | |
min: 0, | |
max: 1, | |
automatable: !0, | |
type: h | |
}, | |
wetLevel: { | |
value: .5, | |
min: 0, | |
max: 1, | |
automatable: !0, | |
type: h | |
}, | |
dryLevel: { | |
value: 1, | |
min: 0, | |
max: 1, | |
automatable: !0, | |
type: h | |
} | |
} | |
} | |
}), t.prototype.Convolver = function(e) { | |
e || (e = this.getDefaults()), this.input = c.createGain(), this.activateNode = c.createGain(), this.convolver = c.createConvolver(), this.dry = c.createGain(), this.filterLow = c.createBiquadFilter(), this.filterHigh = c.createBiquadFilter(), this.wet = c.createGain(), this.output = c.createGain(), this.activateNode.connect(this.filterLow), this.filterLow.connect(this.filterHigh), this.filterHigh.connect(this.convolver), this.convolver.connect(this.wet), this.wet.connect(this.output), this.activateNode.connect(this.dry), this.dry.connect(this.output), this.dryLevel = u(e.dryLevel, this.defaults.dryLevel.value), this.wetLevel = u(e.wetLevel, this.defaults.wetLevel.value), this.highCut = e.highCut || this.defaults.highCut.value, this.buffer = e.impulse || "../impulses/ir_rev_short.wav", this.lowCut = e.lowCut || this.defaults.lowCut.value, this.level = u(e.level, this.defaults.level.value), this.filterHigh.type = "lowpass", this.filterLow.type = "highpass", this.bypass = e.bypass || !1 | |
}, t.prototype.Convolver.prototype = Object.create(f, { | |
name: { | |
value: "Convolver" | |
}, | |
defaults: { | |
writable: !0, | |
value: { | |
highCut: { | |
value: 22050, | |
min: 20, | |
max: 22050, | |
automatable: !0, | |
type: h | |
}, | |
lowCut: { | |
value: 20, | |
min: 20, | |
max: 22050, | |
automatable: !0, | |
type: h | |
}, | |
dryLevel: { | |
value: 1, | |
min: 0, | |
max: 1, | |
automatable: !0, | |
type: h | |
}, | |
wetLevel: { | |
value: 1, | |
min: 0, | |
max: 1, | |
automatable: !0, | |
type: h | |
}, | |
level: { | |
value: 1, | |
min: 0, | |
max: 1, | |
automatable: !0, | |
type: h | |
} | |
} | |
}, | |
lowCut: { | |
get: function() { | |
return this.filterLow.frequency | |
}, | |
set: function(e) { | |
this.filterLow.frequency.value = e | |
} | |
}, | |
highCut: { | |
get: function() { | |
return this.filterHigh.frequency | |
}, | |
set: function(e) { | |
this.filterHigh.frequency.value = e | |
} | |
}, | |
level: { | |
get: function() { | |
return this.output.gain | |
}, | |
set: function(e) { | |
this.output.gain.value = e | |
} | |
}, | |
dryLevel: { | |
get: function() { | |
return this.dry.gain | |
}, | |
set: function(e) { | |
this.dry.gain.setTargetAtTime(e, c.currentTime, o(.05)) | |
} | |
}, | |
wetLevel: { | |
get: function() { | |
return this.wet.gain | |
}, | |
set: function(e) { | |
this.wet.gain.setTargetAtTime(e, c.currentTime, o(.05)) | |
} | |
}, | |
buffer: { | |
enumerable: !1, | |
get: function() { | |
return this.convolver.buffer | |
}, | |
set: function(e) { | |
var t = this.convolver, | |
n = new XMLHttpRequest; | |
return e ? (n.open("GET", e, !0), n.responseType = "arraybuffer", n.onreadystatechange = function() { | |
4 === n.readyState && (n.status < 300 && n.status > 199 || 302 === n.status) && c.decodeAudioData(n.response, function(e) { | |
t.buffer = e | |
}, function(e) { | |
e && console.log("Tuna.Convolver.setBuffer: Error decoding data" + e) | |
}) | |
}, void n.send(null)) : void console.log("Tuna.Convolver.setBuffer: Missing impulse path!") | |
} | |
} | |
}), t.prototype.Tremolo = function(e) { | |
e || (e = this.getDefaults()), this.input = c.createGain(), this.splitter = this.activateNode = c.createChannelSplitter(2), this.amplitudeL = c.createGain(), this.amplitudeR = c.createGain(), this.merger = c.createChannelMerger(2), this.output = c.createGain(), this.lfoL = new d.LFO({ | |
target: this.amplitudeL.gain, | |
callback: p | |
}), this.lfoR = new d.LFO({ | |
target: this.amplitudeR.gain, | |
callback: p | |
}), this.input.connect(this.splitter), this.splitter.connect(this.amplitudeL, 0), this.splitter.connect(this.amplitudeR, 1), this.amplitudeL.connect(this.merger, 0, 0), this.amplitudeR.connect(this.merger, 0, 1), this.merger.connect(this.output), this.rate = e.rate || this.defaults.rate.value, this.intensity = u(e.intensity, this.defaults.intensity.value), this.stereoPhase = u(e.stereoPhase, this.defaults.stereoPhase.value), this.lfoL.offset = 1 - this.intensity / 2, this.lfoR.offset = 1 - this.intensity / 2, this.lfoL.phase = this.stereoPhase * Math.PI / 180, this.lfoL.activate(!0), this.lfoR.activate(!0), this.bypass = e.bypass || !1 | |
}, t.prototype.Tremolo.prototype = Object.create(f, { | |
name: { | |
value: "Tremolo" | |
}, | |
defaults: { | |
writable: !0, | |
value: { | |
intensity: { | |
value: .3, | |
min: 0, | |
max: 1, | |
automatable: !1, | |
type: h | |
}, | |
stereoPhase: { | |
value: 0, | |
min: 0, | |
max: 180, | |
automatable: !1, | |
type: h | |
}, | |
rate: { | |
value: 5, | |
min: .1, | |
max: 11, | |
automatable: !1, | |
type: h | |
} | |
} | |
}, | |
intensity: { | |
enumerable: !0, | |
get: function() { | |
return this._intensity | |
}, | |
set: function(e) { | |
this._intensity = e, this.lfoL.offset = 1 - this._intensity / 2, this.lfoR.offset = 1 - this._intensity / 2, this.lfoL.oscillation = this._intensity, this.lfoR.oscillation = this._intensity | |
} | |
}, | |
rate: { | |
enumerable: !0, | |
get: function() { | |
return this._rate | |
}, | |
set: function(e) { | |
this._rate = e, this.lfoL.frequency = this._rate, this.lfoR.frequency = this._rate | |
} | |
}, | |
stereoPhase: { | |
enumerable: !0, | |
get: function() { | |
return this._stereoPhase | |
}, | |
set: function(e) { | |
this._stereoPhase = e; | |
var t = this.lfoL._phase + this._stereoPhase * Math.PI / 180; | |
t = a(t, 2 * Math.PI), this.lfoR.phase = t | |
} | |
} | |
}), t.prototype.WahWah = function(e) { | |
e || (e = this.getDefaults()), this.input = c.createGain(), this.activateNode = c.createGain(), this.envelopeFollower = new d.EnvelopeFollower({ | |
target: this, | |
callback: function(e, t) { | |
e.sweep = t | |
} | |
}), this.filterBp = c.createBiquadFilter(), this.filterPeaking = c.createBiquadFilter(), this.output = c.createGain(), this.activateNode.connect(this.filterBp), this.filterBp.connect(this.filterPeaking), this.filterPeaking.connect(this.output), this.init(), this.automode = u(e.automode, this.defaults.automode.value), this.resonance = e.resonance || this.defaults.resonance.value, this.sensitivity = u(e.sensitivity, this.defaults.sensitivity.value), this.baseFrequency = u(e.baseFrequency, this.defaults.baseFrequency.value), this.excursionOctaves = e.excursionOctaves || this.defaults.excursionOctaves.value, this.sweep = u(e.sweep, this.defaults.sweep.value), this.activateNode.gain.value = 2, this.envelopeFollower.activate(!0), this.bypass = e.bypass || !1 | |
}, t.prototype.WahWah.prototype = Object.create(f, { | |
name: { | |
value: "WahWah" | |
}, | |
defaults: { | |
writable: !0, | |
value: { | |
automode: { | |
value: !0, | |
automatable: !1, | |
type: g | |
}, | |
baseFrequency: { | |
value: .5, | |
min: 0, | |
max: 1, | |
automatable: !1, | |
type: h | |
}, | |
excursionOctaves: { | |
value: 2, | |
min: 1, | |
max: 6, | |
automatable: !1, | |
type: h | |
}, | |
sweep: { | |
value: .2, | |
min: 0, | |
max: 1, | |
automatable: !1, | |
type: h | |
}, | |
resonance: { | |
value: 10, | |
min: 1, | |
max: 100, | |
automatable: !1, | |
type: h | |
}, | |
sensitivity: { | |
value: .5, | |
min: -1, | |
max: 1, | |
automatable: !1, | |
type: h | |
} | |
} | |
}, | |
automode: { | |
get: function() { | |
return this._automode | |
}, | |
set: function(e) { | |
this._automode = e, e ? (this.activateNode.connect(this.envelopeFollower.input), this.envelopeFollower.activate(!0)) : (this.envelopeFollower.activate(!1), this.activateNode.disconnect(), this.activateNode.connect(this.filterBp)) | |
} | |
}, | |
filterFreqTimeout: { | |
value: 0 | |
}, | |
setFilterFreq: { | |
value: function() { | |
try { | |
this.filterBp.frequency.value = Math.min(22050, this._baseFrequency + this._excursionFrequency * this._sweep), this.filterPeaking.frequency.value = Math.min(22050, this._baseFrequency + this._excursionFrequency * this._sweep) | |
} catch (e) { | |
clearTimeout(this.filterFreqTimeout), this.filterFreqTimeout = setTimeout(function() { | |
this.setFilterFreq() | |
}.bind(this), 0) | |
} | |
} | |
}, | |
sweep: { | |
enumerable: !0, | |
get: function() { | |
return this._sweep | |
}, | |
set: function(e) { | |
this._sweep = Math.pow(e > 1 ? 1 : e < 0 ? 0 : e, this._sensitivity), this.setFilterFreq() | |
} | |
}, | |
baseFrequency: { | |
enumerable: !0, | |
get: function() { | |
return this._baseFrequency | |
}, | |
set: function(e) { | |
this._baseFrequency = 50 * Math.pow(10, 2 * e), this._excursionFrequency = Math.min(c.sampleRate / 2, this.baseFrequency * Math.pow(2, this._excursionOctaves)), this.setFilterFreq() | |
} | |
}, | |
excursionOctaves: { | |
enumerable: !0, | |
get: function() { | |
return this._excursionOctaves | |
}, | |
set: function(e) { | |
this._excursionOctaves = e, this._excursionFrequency = Math.min(c.sampleRate / 2, this.baseFrequency * Math.pow(2, this._excursionOctaves)), this.setFilterFreq() | |
} | |
}, | |
sensitivity: { | |
enumerable: !0, | |
get: function() { | |
return this._sensitivity | |
}, | |
set: function(e) { | |
this._sensitivity = Math.pow(10, e) | |
} | |
}, | |
resonance: { | |
enumerable: !0, | |
get: function() { | |
return this._resonance | |
}, | |
set: function(e) { | |
this._resonance = e, this.filterPeaking.Q = this._resonance | |
} | |
}, | |
init: { | |
value: function() { | |
this.output.gain.value = 1, this.filterPeaking.type = "peaking", this.filterBp.type = "bandpass", this.filterPeaking.frequency.value = 100, this.filterPeaking.gain.value = 20, this.filterPeaking.Q.value = 5, this.filterBp.frequency.value = 100, this.filterBp.Q.value = 1 | |
} | |
} | |
}), t.prototype.EnvelopeFollower = function(e) { | |
e || (e = this.getDefaults()), this.input = c.createGain(), this.jsNode = this.output = c.createScriptProcessor(this.buffersize, 1, 1), this.input.connect(this.output), this.attackTime = u(e.attackTime, this.defaults.attackTime.value), this.releaseTime = u(e.releaseTime, this.defaults.releaseTime.value), this._envelope = 0, this.target = e.target || {}, this.callback = e.callback || function() {}, this.bypass = e.bypass || !1 | |
}, t.prototype.EnvelopeFollower.prototype = Object.create(f, { | |
name: { | |
value: "EnvelopeFollower" | |
}, | |
defaults: { | |
value: { | |
attackTime: { | |
value: .003, | |
min: 0, | |
max: .5, | |
automatable: !1, | |
type: h | |
}, | |
releaseTime: { | |
value: .5, | |
min: 0, | |
max: .5, | |
automatable: !1, | |
type: h | |
} | |
} | |
}, | |
buffersize: { | |
value: 256 | |
}, | |
envelope: { | |
value: 0 | |
}, | |
sampleRate: { | |
value: 44100 | |
}, | |
attackTime: { | |
enumerable: !0, | |
get: function() { | |
return this._attackTime | |
}, | |
set: function(e) { | |
this._attackTime = e, this._attackC = Math.exp(-1 / this._attackTime * this.sampleRate / this.buffersize) | |
} | |
}, | |
releaseTime: { | |
enumerable: !0, | |
get: function() { | |
return this._releaseTime | |
}, | |
set: function(e) { | |
this._releaseTime = e, this._releaseC = Math.exp(-1 / this._releaseTime * this.sampleRate / this.buffersize) | |
} | |
}, | |
callback: { | |
get: function() { | |
return this._callback | |
}, | |
set: function(e) { | |
"function" == typeof e ? this._callback = e : console.error("tuna.js: " + this.name + ": Callback must be a function!") | |
} | |
}, | |
target: { | |
get: function() { | |
return this._target | |
}, | |
set: function(e) { | |
this._target = e | |
} | |
}, | |
activate: { | |
value: function(e) { | |
this.activated = e, e ? (this.jsNode.connect(c.destination), this.jsNode.onaudioprocess = this.returnCompute(this)) : (this.jsNode.disconnect(), this.jsNode.onaudioprocess = null), this.activateCallback && this.activateCallback(e) | |
} | |
}, | |
returnCompute: { | |
value: function(e) { | |
return function(t) { | |
e.compute(t) | |
} | |
} | |
}, | |
compute: { | |
value: function(e) { | |
var t, n, i, o, s = e.inputBuffer.getChannelData(0).length, | |
a = e.inputBuffer.numberOfChannels; | |
if (n = i = o = 0, a > 1) | |
for (o = 0; o < s; ++o) | |
for (; n < a; ++n) t = e.inputBuffer.getChannelData(n)[o], i += t * t / a; | |
else | |
for (o = 0; o < s; ++o) t = e.inputBuffer.getChannelData(0)[o], i += t * t; | |
i = Math.sqrt(i), this._envelope < i ? (this._envelope *= this._attackC, this._envelope += (1 - this._attackC) * i) : (this._envelope *= this._releaseC, this._envelope += (1 - this._releaseC) * i), this._callback(this._target, this._envelope) | |
} | |
} | |
}), t.prototype.LFO = function(e) { | |
e || (e = this.getDefaults()), this.input = c.createGain(), this.output = c.createScriptProcessor(256, 1, 1), this.activateNode = c.destination, this.frequency = u(e.frequency, this.defaults.frequency.value), this.offset = u(e.offset, this.defaults.offset.value), this.oscillation = u(e.oscillation, this.defaults.oscillation.value), this.phase = u(e.phase, this.defaults.phase.value), this.target = e.target || {}, this.output.onaudioprocess = this.callback(e.callback || function() {}), this.bypass = e.bypass || !1 | |
}, t.prototype.LFO.prototype = Object.create(f, { | |
name: { | |
value: "LFO" | |
}, | |
bufferSize: { | |
value: 256 | |
}, | |
sampleRate: { | |
value: 44100 | |
}, | |
defaults: { | |
value: { | |
frequency: { | |
value: 1, | |
min: 0, | |
max: 20, | |
automatable: !1, | |
type: h | |
}, | |
offset: { | |
value: .85, | |
min: 0, | |
max: 22049, | |
automatable: !1, | |
type: h | |
}, | |
oscillation: { | |
value: .3, | |
min: -22050, | |
max: 22050, | |
automatable: !1, | |
type: h | |
}, | |
phase: { | |
value: 0, | |
min: 0, | |
max: 2 * Math.PI, | |
automatable: !1, | |
type: h | |
} | |
} | |
}, | |
frequency: { | |
get: function() { | |
return this._frequency | |
}, | |
set: function(e) { | |
this._frequency = e, this._phaseInc = 2 * Math.PI * this._frequency * this.bufferSize / this.sampleRate | |
} | |
}, | |
offset: { | |
get: function() { | |
return this._offset | |
}, | |
set: function(e) { | |
this._offset = e | |
} | |
}, | |
oscillation: { | |
get: function() { | |
return this._oscillation | |
}, | |
set: function(e) { | |
this._oscillation = e | |
} | |
}, | |
phase: { | |
get: function() { | |
return this._phase | |
}, | |
set: function(e) { | |
this._phase = e | |
} | |
}, | |
target: { | |
get: function() { | |
return this._target | |
}, | |
set: function(e) { | |
this._target = e | |
} | |
}, | |
activate: { | |
value: function(e) { | |
e ? (this.output.connect(c.destination), this.activateCallback && this.activateCallback(e)) : this.output.disconnect() | |
} | |
}, | |
callback: { | |
value: function(e) { | |
var t = this; | |
return function() { | |
t._phase += t._phaseInc, t._phase > 2 * Math.PI && (t._phase = 0), e(t._target, t._offset + t._oscillation * Math.sin(t._phase)) | |
} | |
} | |
} | |
}), t.toString = t.prototype.toString = function() { | |
return "Please visit https://github.com/Theodeus/tuna/wiki for instructions on how to use Tuna.js" | |
} | |
}(); | |
var defaultToneId = 1, | |
simulateNewUser = !1, | |
playing = !1, | |
focussed = !0, | |
currentUser = null, | |
audioContext = null, | |
mixer, master, master2, compressor, filter, filter2, delay, tremolo, tremoloGain, tuna, pingPongDelay, phaser, reverb, delayMixer, pingPongDelayMixer, noise = { | |
source: null, | |
mixer: null, | |
filterLow: null, | |
filterHigh: null | |
}, | |
oscilloscopeEnabled = !1, | |
spectrumEnabled = !0, | |
oscilloscope = null, | |
analyser = null, | |
timerWorker = null, | |
startTimeOffset = .05, | |
currentView = "create", | |
currentScrollTop = 0, | |
tempo = 120, | |
tempoMin = 10, | |
tempoMax = 160, | |
currentBar = 0, | |
currentTick = 0, | |
smoothTime = .1, | |
smoothTimeFilter = .15, | |
selectedLFO = 0, | |
selectedEnvelope = 0, | |
selectedEffect = 0, | |
selectedSoundSetting = "main", | |
barsTotal = 3, | |
barsMaximum = 8, | |
barSize = 50, | |
barMargin = 4, | |
barPadding = 19, | |
canvasSize = 100, | |
canvasPadding = 7, | |
canvasBack = null, | |
canvasFront = null, | |
canvasBackContext = null, | |
canvasFrontContext = null, | |
contentHeight = 0, | |
screenHeight = 0, | |
screenWidth = 0, | |
presets = [], | |
voices = [null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null], | |
animatingNotes = [], | |
animatingTicks = 150, | |
animatingEnlarge = 0, | |
animatingEnlargeBar = 0, | |
animatingExpand = 30, | |
animatingExpandBar = 10, | |
animatingExpandOpacity = .4, | |
repeatBar = !1, | |
waveformsList = ["sawtooth", "square", "sine", "triangle"], | |
waveformsList2 = ["sine", "triangle", "sawtooth", "square"], | |
pianoNotes = ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B"], | |
scaleStrings = ["Pentatonic Minor", "Pentatonic Major"], | |
scalesList = ["Major", "Natural Minor", "Harmonic Minor", "Pentatonic Major", "Pentatonic Minor", "Blues Major", "Blues Minor", "Whole-tone"], | |
delayTimeStrings = ["1/4.", "1/4", "1/4T", "1/8.", "1/8", "1/8T", "1/16.", "1/16", "1/16T", "1/32.", "1/32", "1/32T", "1/64.", "1/64"], | |
noteDurationStrings = ["128 bars", "64 bars", "32 bars", "16 bars", "8 bars", "4 bars", "3 bars", "2 bars", "1/1.", "1/1", "1/2.", "1/1T", "1/2", "1/4.", "1/2T", "1/4", "1/8.", "1/4T", "1/8", "1/16.", "1/8T", "1/16", "1/32.", "1/16T", "1/32", "1/64.", "1/32T", "1/64"], | |
colors = [{ | |
hue: 341, | |
name: "Red" | |
}, { | |
hue: 29, | |
name: "Orange" | |
}, { | |
hue: 38, | |
name: "Yellow" | |
}, { | |
hue: 219, | |
name: "Blue" | |
}, { | |
hue: 274, | |
name: "Violet" | |
}, { | |
hue: 285, | |
name: "Purple" | |
}, { | |
hue: 311, | |
name: "Pink" | |
}], | |
soundSettings = { | |
humanize: { | |
volume: 3, | |
detune: 1, | |
attack: 0 | |
} | |
}, | |
tone = null, | |
toneTemplate = { | |
id: 0, | |
title: "", | |
url_title: "", | |
date_timestamp: 0, | |
user_id: 0, | |
user: { | |
id: 0, | |
username: "Guest", | |
name: "", | |
avatar: "252,16,81" | |
}, | |
parent_id: null, | |
preset: { | |
id: 0, | |
title: "Default Preset", | |
version: 1, | |
settings: {} | |
}, | |
tempo: 105, | |
color: 3, | |
faved: !1, | |
plays_count: 0, | |
favorites_count: 0, | |
comments_count: 0, | |
version: 1, | |
format: 1, | |
edited: !1, | |
settings: { | |
volume: { | |
level: .8, | |
envelope: { | |
attack: .007, | |
decay: .8, | |
sustain: .27, | |
hold: 0, | |
release: .85 | |
} | |
}, | |
filter: { | |
rolloff: 0, | |
cutoff: .32, | |
resonance: 0, | |
envelope: { | |
attack: .008, | |
decay: 2.5, | |
sustain: 0, | |
hold: 0, | |
release: 0, | |
amount: .175, | |
invert: !1 | |
} | |
}, | |
pitch: { | |
envelope: { | |
attack: .003, | |
decay: .4, | |
sustain: 0, | |
hold: 0, | |
release: 0, | |
amount: 0, | |
invert: !1 | |
} | |
}, | |
drums: { | |
bd: .28, | |
sd: 0, | |
ch: 0 | |
}, | |
scaling: .1, | |
probability: 1, | |
oscillator: { | |
waveform: "sine" | |
}, | |
noise: { | |
level: 0, | |
lowcut: 0, | |
highcut: 1, | |
resonance: 0 | |
}, | |
lfo: { | |
volume: { | |
sync: !1, | |
duration: "1/8", | |
frequency: 6.4, | |
level: .48, | |
waveform: "sine" | |
}, | |
pitch: { | |
sync: !0, | |
duration: "1/8", | |
frequency: 6.4, | |
level: 0, | |
waveform: "sine" | |
}, | |
cutoff: { | |
sync: !0, | |
duration: "1/8", | |
frequency: 6.4, | |
level: 0, | |
waveform: "sine" | |
} | |
}, | |
delay: { | |
pingpong: !0, | |
duration: "1/8.", | |
feedback: .04, | |
level: .55, | |
lowcut: 0, | |
highcut: 1 | |
}, | |
reverb: { | |
level: .15, | |
lowcut: 0, | |
highcut: 1 | |
} | |
}, | |
bars: [{ | |
repeat: 4, | |
key: "G#", | |
scale: "Pentatonic Minor", | |
octave: 5, | |
drums: !1, | |
matrix: "0000000000000000,0000000000000000,0000000000000000,0000000000000000,0000000000000000,0000000000000000,0000000000000000,0000000000000000,0000000000000000,0000000000000000,0000000000000000,0000000000000000,0000000000000000,0000000000000000,0000000000000000,0000000000000000" | |
}] | |
}; | |
$(document).ready(function() { | |
startup() | |
}); | |
var loadingOverlayHidden = !1, | |
webAudioActivated = !1, | |
documentTouchStartX = -1, | |
documentTouchEndX = -1, | |
resizeTimer = null, | |
viewHistory = [], | |
currentUrl = "", | |
selectedHomeTab = 2, | |
homeLoading = !1, | |
selectedMessagesTab = 0, | |
messagesLoading = !1, | |
messageSending = !1, | |
messageDeleting = !1, | |
toneSaving = !1, | |
loadToneCache = [], | |
loadingToneId = 0, | |
loadToneConfirmId = 0, | |
currentToneCopy = null, | |
changeBarTo = null, | |
voiceUpdateNeeded = !1, | |
LFOs = [], | |
restartLFO = !1, | |
bdBuffer = null, | |
chBuffer = null, | |
sdBuffer = null, | |
drumsTimer = null, | |
tapTempoCount = 0, | |
tapTempoTimeFirst = 0, | |
tapTempoTimePrev = 0, | |
touchedCell = !1, | |
touchedCellActive = !1, | |
hoverGridX = -1, | |
hoverGridY = -1, | |
moveGridX = -1, | |
moveGridY = -1, | |
now, then = Date.now(), | |
delta, needleX = { | |
grid: 0, | |
bar: 0 | |
}, | |
drawAlt = !1, | |
barFrontContexts = [], | |
currentDragBarIndex = -1, | |
changeToBarOnBeat = -1; | |
Array.prototype.move = function(e, t) { | |
if (t >= this.length) | |
for (var n = t - this.length; n-- + 1;) this.push(void 0); | |
return this.splice(t, 0, this.splice(e, 1)[0]), this | |
}; | |
var hideMenuOnScroll = !0, | |
copiedNotes = [], | |
settingsOpenSection = "", | |
settingsTempoTimer = null, | |
changeTempoTo = null, | |
cachedDivs = [], | |
buttonTriggerTimer = null, | |
buttonRepeatTimer = null, | |
buttonRepeatAfter = 400, | |
buttonRepeatInterval = 40, | |
presetsLastId = 0, | |
unsavedPreset = { | |
title: "Unsaved Preset", | |
settings: null | |
}, | |
updatePresetEditedTimer = null, | |
setToneSettingsTimer = null, | |
showMenuTimer = null, | |
hideMenuTimer = null, | |
menuParent = null, | |
menuType = "tone", | |
menuOpen = !1, | |
menuTouched = !1, | |
editingTone = !1, | |
barSettingsIndex = -1, | |
changeColorTimer, shareUrl = "", | |
shareFacebookUrl = "", | |
shareTwitterUrl = "", | |
shareGoogleUrl = "", | |
sharePinterestUrl = "", | |
shareTumblrUrl = "", | |
shareEmailUrl = "", | |
shareToneId = 0, | |
reportPosting = !1, | |
commentPosting = !1, | |
selectedInfoTab = 0, | |
infoCommentsLoading = !1, | |
infoLikesLoading = !1, | |
infoRemixesLoading = !1, | |
selectedProfileTab = 0, | |
selectedEditColor = !1, | |
profileSaving = !1, | |
loadingProfileUsername = "", | |
profileCache = [], | |
profileTonesLoading = !1, | |
profileTonesCache = [], | |
profileTonesLastId = 0, | |
profileLikesLoading = !1, | |
profileCommentsLoading = !1, | |
profileFollowingLoading = !1, | |
profileFollowersLoading = !1, | |
playItemId = "0", | |
browseLoading = !1, | |
browseSection = "all", | |
browseLastId = 0, | |
browseKeepScrollPos = !1, | |
mainMenuOpen = !1, | |
showHideSettingsMenu = !1, | |
storeSettingsTimer = null, | |
storeToneTimer = null, | |
localStorageSupport = null, | |
DelayEffect = function() { | |
this.input = audioContext.createGain(), this.output = audioContext.createGain(), this.delay = audioContext.createDelay(6), this.feedback = audioContext.createGain(), this.dryLevel = audioContext.createGain(), this.wetLevel = audioContext.createGain(), this.filter = audioContext.createBiquadFilter(), this.filter.type = "lowpass", this.filter.frequency.value = 44e3, this.filter2 = audioContext.createBiquadFilter(), this.filter2.type = "highpass", this.filter2.frequency.value = 0, this.delay.delayTime.value = 0, this.feedback.gain.value = 0, this.dryLevel.gain.value = 1, this.wetLevel.gain.value = 0, this.input.connect(this.delay), this.delay.connect(this.feedback), this.feedback.connect(this.filter), this.filter.connect(this.filter2), this.filter2.connect(this.delay), this.filter2.connect(this.wetLevel), this.wetLevel.connect(this.output), this.input.connect(this.dryLevel), this.dryLevel.connect(this.output), this.connect = function(e) { | |
this.output.connect(e) | |
}, this.disconnect = function(e) { | |
this.output.disconnect(e) | |
} | |
}; | |
$.fn.extend({ | |
animateCss: function(e, t) { | |
var n = "webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend"; | |
return this.addClass("animated " + e).one(n, function() { | |
$(this).removeClass("animated " + e), t && t() | |
}), this | |
} | |
}), window.requestAnimFrame = function() { | |
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function(e) { | |
window.setTimeout(e, 1e3 / 60) | |
} | |
}(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment