Skip to content

Commit

Permalink
close userSettings when clicking on blank space
Browse files Browse the repository at this point in the history
  • Loading branch information
Belikhun committed Feb 26, 2020
1 parent f37110e commit e0a969d
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 13 deletions.
9 changes: 9 additions & 0 deletions assets/css/userSetting.css
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@
display: none;
}

#userSettings .sub > .underlay {
position: absolute;
display: block;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

#userSettings.show .sub {
display: block;
}
Expand Down
4 changes: 2 additions & 2 deletions assets/js/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ const account = {
let username = targetElement.dataset.editTarget;
let note = document.createElement("div");
note.classList.add("note", "warning");
note.innerHTML = `<span class="inner">Hành động này không thể hoàn tác một khi đã thực hiện!</span>`;
note.innerHTML = `<span class="inner">Hành động này <b>không thể hoàn tác</b> một khi đã thực hiện!</span>`;

let doIt = await popup.show({
level: "warning",
Expand All @@ -295,7 +295,7 @@ const account = {
description: `Bạn có chắc muốn xóa người dùng ${username} không?`,
additionalNode: note,
buttonList: {
delete: { text: "XÓA!", color: "red" },
delete: { text: "XÓA!!!", color: "red" },
cancel: { text: "Hủy Bỏ", color: "blue" }
}
});
Expand Down
26 changes: 17 additions & 9 deletions assets/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -1437,8 +1437,9 @@ const core = {
updateDelayText: $("#usett_udelay_text"),
toggler: $("#userSettingsToggler"),
container: $("#userSettings"),
adminConfig: $("#usett_adminConfig"),
panelContainer: $("#usett_panelContainer"),
panelUnderlay: $("#usett_panelUnderlay"),
adminConfig: $("#usett_adminConfig"),
publicFilesPanel: null,
publicFilesIframe: null,
aboutPanel: null,
Expand Down Expand Up @@ -1466,7 +1467,8 @@ const core = {
},

init(loggedIn = true) {
this.toggler.addEventListener("click", e => this.toggle(e), false);
this.toggler.addEventListener("mouseup", () => this.toggle(), false);
this.panelUnderlay.addEventListener("mouseup", () => this.toggle(), false);

this.aboutPanel = new this.panel($("#usett_aboutPanel"));
this.aboutPanel.toggler = $("#usett_aboutToggler");
Expand Down Expand Up @@ -2169,23 +2171,29 @@ const core = {
text: id + "."
}, "Waiting for confirmation");

let note = document.createElement("div");
note.classList.add("note", "warning");
note.innerHTML = `<span class="inner">Hành động này <b>không thể hoàn tác</b> một khi đã thực hiện!</span>`;

let confirm = await popup.show({
windowTitle: "Xác nhận",
title: `Xóa ${id}`,
description: `Bạn có chắc muốn xóa <i>${id}</i> không?<br>Hành động này <b>không thể hoàn tác</b> một khi đã thực hiện!`,
level: "warning",
windowTitle: "Problems Editor",
title: `Xóa \"${id}\"`,
message: `Xác nhận`,
description: `Bạn có chắc muốn xóa đề bài <i>${id}</i> không?`,
additionalNode: note,
buttonList: {
yes: { text: "XÓA!!!", color: "pink" },
no: { text:"Không", color: "blue" }
delete: { text: "XÓA!!!", color: "red" },
cancel: { text: "Hủy Bỏ", color: "blue" }
}
})

if (confirm !== "yes") {
if (confirm !== "delete") {
clog("info", "Cancelled deletion of", {
color: flatc("yellow"),
text: id + "."
});
return false;
return;
}

sounds.confirm(1);
Expand Down
6 changes: 4 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,10 @@
</div>

<div id="usett_panelContainer" class="sub">

<!-- ========= IMPORTANT: THIS ELEMENT NEED TO BE AT THE TOP OF THIS CONTAINER ========= -->
<div id="usett_panelUnderlay" class="underlay"></div>
<!-- ========= IMPORTANT: THIS ELEMENT NEED TO BE AT THE TOP OF THIS CONTAINER ========= -->

<div id="usett_publicFilesPanel" data-soundtoggle="show" class="panel large sound">
<div class="container">
<div class="btn-group">
Expand Down Expand Up @@ -716,7 +719,6 @@
</div>
</div>
</div>

</div>

</span>
Expand Down

0 comments on commit e0a969d

Please sign in to comment.