mirror of
https://github.com/webxoss/webxoss-core.git
synced 2024-11-20 06:49:53 +01:00
handle deckEditor
1. disable deckEditor's ·DONE 2. refresh page when add new deck
This commit is contained in:
parent
7242d310c7
commit
1d8fe4e4c6
1 changed files with 17 additions and 4 deletions
|
@ -237,7 +237,7 @@ function readDeckNames() {
|
|||
return JSON.parse(localStorage.getItem('deck_filenames')) || [];
|
||||
}
|
||||
|
||||
function initDeckSelect() {
|
||||
function updateDeckSelect() {
|
||||
deckNames = readDeckNames();
|
||||
var hostDeckSelect = $('host-decks');
|
||||
var guestDeckSelect = $('guest-decks');
|
||||
|
@ -259,10 +259,23 @@ function changeLanguage() {
|
|||
location.reload();
|
||||
}
|
||||
|
||||
function resizeIFrameToFitContent() {
|
||||
function handleDeckEditor() {
|
||||
var iFrame = $('deck-editor');
|
||||
|
||||
//resizeIFrameToFitContent
|
||||
iFrame.width = iFrame.contentWindow.document.body.scrollWidth;
|
||||
iFrame.height = iFrame.contentWindow.document.body.scrollHeight;
|
||||
|
||||
// disable deck-editor return
|
||||
iFrame.contentDocument
|
||||
.getElementById('link-back-to-webxoss').href = "#"
|
||||
|
||||
// auto update deck names when change in deckEditor
|
||||
window.addEventListener('storage', function(e) {
|
||||
if (e.key === 'deck_filenames') {
|
||||
updateDeckSelect();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function enableButtons() {
|
||||
|
@ -284,8 +297,8 @@ function disableButtons() {
|
|||
}
|
||||
window.onload = function() {
|
||||
$('select-language').value = localStorage.getItem('language');
|
||||
initDeckSelect();
|
||||
resizeIFrameToFitContent();
|
||||
updateDeckSelect();
|
||||
handleDeckEditor();
|
||||
disableButtons();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue