Skip to content

Commit

Permalink
Restore options popup
Browse files Browse the repository at this point in the history
  • Loading branch information
Mottie committed Mar 12, 2020
1 parent 67e886b commit 2fd08cb
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions manage/manage-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -513,3 +513,38 @@ function lazyLoad() {
});
}, 500);
}

function embedOptions() {
let options = $('#stylus-embedded-options');
if (!options) {
options = document.createElement('iframe');
options.id = 'stylus-embedded-options';
options.src = '/options.html';
document.documentElement.appendChild(options);
}
options.focus();
}

function unembedOptions() {
const options = $('#stylus-embedded-options');
if (options) {
options.contentWindow.document.body.classList.add('scaleout');
options.classList.add('fadeout');
animateElement(options, {
className: 'fadeout',
onComplete: () => options.remove(),
});
}
}

router.watch({hash: '#stylus-options'}, state => {
if (state) {
embedOptions();
} else {
unembedOptions();
}
});

window.addEventListener('closeOptions', () => {
router.updateHash('');
});

0 comments on commit 2fd08cb

Please sign in to comment.