first commit

This commit is contained in:
2021-08-29 00:01:04 +08:00
commit 110ef3a578
60 changed files with 405 additions and 0 deletions

BIN
lightdm/dm_background.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

19
lightdm/index.css Normal file
View File

@@ -0,0 +1,19 @@
body {
background-size: cover;
background-color: #101010;
color: #ededed;
}
#input {
color: #ededed;
background-color: #101010;
border: none;
outline: none;
padding: 5px;
font-family: "Source Code Pro", monospace;
font-size: 16px;
text-align: right;
position: absolute;
bottom: 20px;
right: 20px;
}

13
lightdm/index.html Normal file
View File

@@ -0,0 +1,13 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="index.css">
<script src="../_vendor/js/jquery.min.js"></script>
</head>
<body>
<input type="text" id="input" placeholder="user" name="input">
<script src="main.js"></script>
</body>
</html>

58
lightdm/main.js Normal file
View File

@@ -0,0 +1,58 @@
var input = document.getElementById("input");
input.addEventListener("keydown", function (e) {
if (e.keyCode === 13) {
authenticate(e.target.value);
}
});
window.authentication_complete = function() {
if (lightdm.is_authenticated) {
console.log("Authenticated!");
$( 'body' ).fadeOut( 1000, () => {
lightdm.login(lightdm.authentication_user, null);
} );
} else {
getImg();
input.value = "";
input.placeholder = "user";
input.type = "text";
input.disabled = false;
input.focus();
input.select();
}
}
function pad(a, b) {
return (1e15 + a + "").slice(-b);
}
function getImg() {
index = Math.floor(Math.random() * 25);
console.log(pad(index,2));
document.getElementsByTagName('body')[0].style.backgroundImage =
"url(dm_background.png)";
//"url(wallpapers/" + pad(index, 2) + ".png)";
}
window.onload = function() {
getImg();
input.focus();
input.select();
input.value = lightdm.select_user_hint;
if(input.value) {
authenticate(input.value);
}
}
function authenticate(input_text) {
if(!lightdm.in_authentication || !lightdm.authentication_user) {
lightdm.authenticate(input_text);
input.value = "";
input.type = "password";
input.placeholder = "password";
input.disabled = false;
} else {
input.disabled = true;
lightdm.respond(input_text);
}
}