Merge pull request #113 from meetqy/main

Fix: Login form not center aligned #90
This commit is contained in:
Nariman Jelveh 2024-03-16 12:09:27 -07:00 committed by GitHub
commit ca30d075da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 28 additions and 6 deletions

View File

@ -141,12 +141,6 @@ if (window.location !== window.parent.location) {
window.desktop_height = window.innerHeight - window.toolbar_height - window.taskbar_height; window.desktop_height = window.innerHeight - window.toolbar_height - window.taskbar_height;
window.desktop_width = window.innerWidth; window.desktop_width = window.innerWidth;
// recalculate desktop height and width on window resize
$( window ).on( "resize", function() {
window.desktop_height = window.innerHeight - window.toolbar_height - window.taskbar_height;
window.desktop_width = window.innerWidth;
});
// for now `active_element` is basically the last element that was clicked, // for now `active_element` is basically the last element that was clicked,
// later on though (todo) `active_element` will also be set by keyboard movements // later on though (todo) `active_element` will also be set by keyboard movements
// such as arrow keys, tab key, ... and when creating new windows... // such as arrow keys, tab key, ... and when creating new windows...

View File

@ -1976,4 +1976,32 @@ function requestOpenerOrigin() {
$(document).on('click', '.generic-close-window-button', function(e){ $(document).on('click', '.generic-close-window-button', function(e){
$(this).closest('.window').close(); $(this).closest('.window').close();
});
// Re-calculate desktop height and width on window resize and re-position the login and signup windows
$(window).on("resize", function () {
// If host env is popup, don't continue because the popup window has its own resize requirements.
if (window.embedded_in_popup)
return;
const ratio = window.desktop_width / window.innerWidth;
window.desktop_height = window.innerHeight - window.toolbar_height - window.taskbar_height;
window.desktop_width = window.innerWidth;
// Re-center the login window
const top = $(".window-login").position()?.top;
const width = $(".window-login").width();
$(".window-login").css({
left: (window.desktop_width - width) / 2,
top: top / ratio,
});
// Re-center the create account window
const top2 = $(".window-signup").position()?.top;
const width2 = $(".window-signup").width();
$(".window-signup").css({
left: (window.desktop_width - width2) / 2,
top: top2 / ratio,
});
}); });