mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
First separation commit.
Added LICENSE, README.md, CONTRIBUTORS.md
This commit is contained in:
parent
09513af31b
commit
4678528d00
657 changed files with 422 additions and 0 deletions
57
src/scripts/wizarduserpage.js
Normal file
57
src/scripts/wizarduserpage.js
Normal file
|
@ -0,0 +1,57 @@
|
|||
define(["loading", "globalize", "dashboardcss", "emby-input", "emby-button", "emby-linkbutton"], function(loading, globalize) {
|
||||
"use strict";
|
||||
|
||||
function getApiClient() {
|
||||
return ApiClient
|
||||
}
|
||||
|
||||
function nextWizardPage() {
|
||||
Dashboard.navigate("wizardlibrary.html")
|
||||
}
|
||||
|
||||
function onUpdateUserComplete(result) {
|
||||
if (loading.hide(), result.UserLinkResult) {
|
||||
var msgKey = result.UserLinkResult.IsPending ? "MessagePendingEmbyAccountAdded" : "MessageEmbyAccountAdded";
|
||||
Dashboard.alert({
|
||||
message: globalize.translate(msgKey),
|
||||
title: globalize.translate("HeaderEmbyAccountAdded"),
|
||||
callback: nextWizardPage
|
||||
})
|
||||
} else nextWizardPage()
|
||||
}
|
||||
|
||||
function submit(form) {
|
||||
loading.show();
|
||||
var apiClient = getApiClient();
|
||||
apiClient.ajax({
|
||||
type: "POST",
|
||||
data: {
|
||||
Name: form.querySelector("#txtUsername").value
|
||||
},
|
||||
url: apiClient.getUrl("Startup/User"),
|
||||
dataType: "json"
|
||||
}).then(onUpdateUserComplete, function(response) {
|
||||
response && response.status;
|
||||
})
|
||||
}
|
||||
|
||||
function onSubmit(e) {
|
||||
return submit(this), e.preventDefault(), !1
|
||||
}
|
||||
|
||||
function onViewShow() {
|
||||
loading.show();
|
||||
var page = this,
|
||||
apiClient = getApiClient();
|
||||
apiClient.getJSON(apiClient.getUrl("Startup/User")).then(function(user) {
|
||||
page.querySelector("#txtUsername").value = user.Name || "", loading.hide()
|
||||
})
|
||||
}
|
||||
return function(view, params) {
|
||||
view.querySelector(".wizardUserForm").addEventListener("submit", onSubmit), view.addEventListener("viewshow", function() {
|
||||
document.querySelector(".skinHeader").classList.add("noHomeButtonHeader")
|
||||
}), view.addEventListener("viewhide", function() {
|
||||
document.querySelector(".skinHeader").classList.remove("noHomeButtonHeader")
|
||||
}), view.addEventListener("viewshow", onViewShow)
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue