mirror of
https://github.com/chinchang/web-maker.git
synced 2025-08-02 11:30:22 +02:00
modal refactor and some style fixes
This commit is contained in:
@@ -23,7 +23,7 @@
|
|||||||
</svg>Run
|
</svg>Run
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
<a id="js-add-library-btn" class="fleex-v-center hint--rounded hint--bottom-left" aria-label="Add a JS/CSS library">
|
<a id="js-add-library-btn" class="flex-v-center hint--rounded hint--bottom-left" aria-label="Add a JS/CSS library">
|
||||||
Add library <span id="js-external-lib-count" style="display:none;" class="count-label"></span>
|
Add library <span id="js-external-lib-count" style="display:none;" class="count-label"></span>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
@@ -985,7 +985,7 @@ runBtn, searchInput, consoleEl, consoleLogEl
|
|||||||
});
|
});
|
||||||
|
|
||||||
function openSettings() {
|
function openSettings() {
|
||||||
settingsModal.classList.toggle('is-modal-visible');
|
scope.toggleModal(settingsModal);
|
||||||
|
|
||||||
/* if (chrome.runtime.openOptionsPage) {
|
/* if (chrome.runtime.openOptionsPage) {
|
||||||
// New way to open options pages, if supported (Chrome 42+).
|
// New way to open options pages, if supported (Chrome 42+).
|
||||||
@@ -1289,6 +1289,14 @@ runBtn, searchInput, consoleEl, consoleLogEl
|
|||||||
trackEvent('ui', 'saveBtnClick', currentItem.id ? 'saved' : 'new');
|
trackEvent('ui', 'saveBtnClick', currentItem.id ? 'saved' : 'new');
|
||||||
saveItem();
|
saveItem();
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* Toggles a modal and logs an event.
|
||||||
|
* @param {Node} modal modal to be toggled
|
||||||
|
*/
|
||||||
|
scope.toggleModal = function (modal) {
|
||||||
|
modal.classList.toggle('is-modal-visible');
|
||||||
|
document.body.classList[modal.classList.contains('is-modal-visible') ? 'add' : 'remove']('overlay-visible');
|
||||||
|
};
|
||||||
scope.onSearchInputChange = function (e) {
|
scope.onSearchInputChange = function (e) {
|
||||||
const text = e.target.value;
|
const text = e.target.value;
|
||||||
let el;
|
let el;
|
||||||
@@ -1363,19 +1371,17 @@ runBtn, searchInput, consoleEl, consoleLogEl
|
|||||||
layoutBtn4.addEventListener('click', getToggleLayoutButtonListener(4));
|
layoutBtn4.addEventListener('click', getToggleLayoutButtonListener(4));
|
||||||
|
|
||||||
utils.onButtonClick(helpBtn, function () {
|
utils.onButtonClick(helpBtn, function () {
|
||||||
helpModal.classList.toggle('is-modal-visible');
|
scope.toggleModal(helpModal);
|
||||||
document.body.classList[helpModal.classList.contains('is-modal-visible') ? 'add' : 'remove']('overlay-visible');
|
|
||||||
trackEvent('ui', 'helpButtonClick');
|
trackEvent('ui', 'helpButtonClick');
|
||||||
});
|
});
|
||||||
utils.onButtonClick(addLibraryBtn, function () {
|
utils.onButtonClick(addLibraryBtn, function () {
|
||||||
addLibraryModal.classList.toggle('is-modal-visible');
|
scope.toggleModal(addLibraryModal);
|
||||||
document.body.classList[addLibraryModal.classList.contains('is-modal-visible') ? 'add' : 'remove']('overlay-visible');
|
|
||||||
trackEvent('ui', 'addLibraryButtonClick');
|
trackEvent('ui', 'addLibraryButtonClick');
|
||||||
});
|
});
|
||||||
|
|
||||||
notificationsBtn.addEventListener('click', function () {
|
notificationsBtn.addEventListener('click', function () {
|
||||||
notificationsModal.classList.toggle('is-modal-visible');
|
scope.toggleModal(notificationsModal);
|
||||||
document.body.classList[notificationsModal.classList.contains('is-modal-visible') ? 'add' : 'remove']('overlay-visible');
|
|
||||||
if (notificationsModal.classList.contains('is-modal-visible') && !hasSeenNotifications) {
|
if (notificationsModal.classList.contains('is-modal-visible') && !hasSeenNotifications) {
|
||||||
hasSeenNotifications = true;
|
hasSeenNotifications = true;
|
||||||
notificationsBtn.classList.remove('has-new');
|
notificationsBtn.classList.remove('has-new');
|
||||||
|
Reference in New Issue
Block a user