mirror of
https://github.com/HeyPuter/puter
synced 2024-11-15 06:15:47 +00:00
Merge pull request #113 from meetqy/main
Fix: Login form not center aligned #90
This commit is contained in:
commit
ca30d075da
@ -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...
|
||||||
|
@ -1977,3 +1977,31 @@ 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,
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user