OSDN Git Service

loading LoginManager config works, add dynamic plugins for LoginManager, splashscreen...
[alterlinux/lightdm-webkit2-theme-alter.git] / index.html
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <link rel="stylesheet" href="css/materialize.min.css">
5     <style>
6   #splash-screen {
7                 width: 100%;
8                 height: 100%;
9                 position: absolute;
10                 z-index: 999;
11                 overflow: hidden;
12     background:-webkit-radial-gradient(center, ellipse cover,
13       #9e9e9e 0%, #757575  100%);
14         }
15         .clock {
16                 display: none;
17         }
18         #splash-screen-content {
19                 position: absolute;
20                 width: 100%;
21                 height: 100%;
22                 top: 0;
23         }
24         .SplashScreen-screen-img {
25 /*              height: 100%;
26                 width: 100%; */
27                 /* border: 8px solid red; */
28         }
29         .filter{
30                 filter: blur(15px) contrast(127%) brightness(80%);
31         }
32         .vignette {
33                 width: 100%;
34                 height: 100%;
35                 position: absolute;
36                 top: 0;
37                 box-shadow: inset 0 0 100px black;
38                 z-index: 2;
39         }
40
41  body {
42           display: flex;
43     min-height: 100vh;
44     flex-direction: column;
45     background-color: #37474f;
46     background:-webkit-radial-gradient(center, ellipse cover,
47       rgba(55,71,79,1) 0%, rgba(38,50,56,1) 100%);
48     color: white;
49     overflow: hidden;
50  }
51   main {
52           flex: 1 0 auto;
53   }
54   input {
55     color: white;
56   }
57   .caret {
58     fill: grey !important;
59   }
60   .power-button {
61     fill: white;
62   }
63   .power-button:hover {
64     fill: #01579b;
65   }
66   .power-button:active {
67     fill: #4dd0e1;
68   }
69
70   div#console {
71     z-index: 9999;
72     position: absolute;
73     top: 10px;
74   }
75   div#console .terminal {
76     overflow-y: scroll;
77     background-color: rgba(0,0,0,0.8);
78     font-size: 14pt;
79     color: white;
80     height: 30vh;
81     width: 85vw;
82     resize: both;
83   }
84   div#console .terminal text {
85     display: block;
86     padding: 0;
87     margin: 0;
88   }
89
90     </style>
91 </head>
92 <script src="js/jquery-3.4.1.min.js"></script>
93 <script src="js/moment-with-locales.js"></script>
94 <script src="js/jquery-ui.min.js"></script>
95 <script src="js/materialize.min.js"></script>
96 <!-- <script src="js/lightdm-sample.js"></script> -->
97 <!--  Load Plugins -->
98 <script src="js/splashscreen.js"></script>
99 <!-- Load main theme -->
100 <script src="js/theme.js"></script>
101
102 <body>
103   <div id="splash-screen">
104     <!--TODO autogenerate this content -->
105     <img class="splash-screen-img" src="images/splash-screen.jpg">
106     <div class="vignette"></div>
107     <div id="splash-screen-content">
108       <!--Content will be generated here -->
109     </div>
110   </div>
111
112   <header></header>
113         <main>
114                 <div class="container">
115       <div class="row" style="margin-top: 35vh;"></div>
116                         <div class="row ">
117                                 <!-- User Select -->
118                                 <div class="row">
119                                         <div class="input-field col s4 offset-s4">
120                                                 <select id="selectUser"></select>
121                                                 <label>User</label>
122                                         </div>
123                                 </div>
124
125                                 <!-- Password field -->
126                                 <div class="row">
127                                         <div class="input-field col s4 offset-s4">
128                                                 <input id="inputPassword" type="password">
129                                                 <label for="inputPassword">Password</label>
130                                         </div>
131                                 </div>
132         <!-- End Password field -->
133
134       </div>
135                 </div>
136
137
138         </main>
139
140
141   <footer class="">
142
143     <div class="row">
144
145       <!-- Window Manager Select -->
146       <div class="input-field col s2 offset-s1">
147         <select id="selectSession"></select>
148         <label>Select Session</label>
149       </div>
150       <!-- End Window Manager Select -->
151
152       <div class="col right">
153           <div class="row">
154             <!-- Hibernate Button -->
155             <div  id="buttonHibernate" class="col S4">
156               <svg viewBox="0 0 297.613 297.613" width="40px" height="40px" class="power-button">
157                 <g>
158                   <path d="M148.807,50.869c-4.971,0-9,4.029-9,9v46.438c0,4.971,4.029,9,9,9s9-4.029,9-9V59.869
159                     C157.807,54.898,153.777,50.869,148.807,50.869z"/>
160                   <path d="M178.859,127.754c2.303,0,4.606-0.879,6.364-2.636L212.17,98.17c3.515-3.515,3.515-9.213,0-12.728
161                   c-3.515-3.515-9.213-3.515-12.728,0l-26.948,26.948c-3.515,3.515-3.515,9.213,0,12.728
162                   C174.252,126.875,176.556,127.754,178.859,127.754z"/>
163                   <path d="M237.744,139.807h-46.438c-4.971,0-9,4.029-9,9s4.029,9,9,9h46.438c4.971,0,9-4.029,9-9S242.715,139.807,237.744,139.807z"
164                   />
165                   <path d="M185.22,172.493c-3.515-3.515-9.213-3.515-12.728,0c-3.515,3.515-3.515,9.213,0,12.728l26.95,26.95
166                   c1.757,1.757,4.061,2.636,6.364,2.636s4.606-0.879,6.364-2.636c3.515-3.515,3.515-9.213,0-12.728L185.22,172.493z"/>
167                   <path d="M148.807,182.307c-4.971,0-9,4.029-9,9v46.438c0,4.971,4.029,9,9,9s9-4.029,9-9v-46.438
168                   C157.807,186.336,153.777,182.307,148.807,182.307z"/>
169                   <path d="M112.391,172.495l-26.948,26.948c-3.515,3.515-3.515,9.213,0,12.728c1.757,1.757,4.061,2.636,6.364,2.636
170                   s4.606-0.879,6.364-2.636l26.948-26.948c3.515-3.515,3.515-9.213,0-12.728C121.604,168.98,115.905,168.98,112.391,172.495z"/>
171                   <path d="M115.307,148.807c0-4.971-4.029-9-9-9H59.869c-4.971,0-9,4.029-9,9s4.029,9,9,9h46.438
172                   C111.277,157.807,115.307,153.777,115.307,148.807z"/>
173                   <path d="M98.17,85.443c-3.515-3.515-9.213-3.515-12.728,0c-3.515,3.515-3.515,9.213,0,12.728l26.95,26.95
174                   c1.757,1.757,4.061,2.636,6.364,2.636s4.606-0.879,6.364-2.636c3.515-3.515,3.515-9.213,0-12.728L98.17,85.443z"/>
175                   <path d="M148.807,0C66.754,0,0,66.754,0,148.807s66.754,148.807,148.807,148.807s148.807-66.754,148.807-148.807
176                   S230.859,0,148.807,0z M148.807,279.613C76.68,279.613,18,220.934,18,148.807S76.68,18,148.807,18s130.807,58.68,130.807,130.807
177                   S220.934,279.613,148.807,279.613z"/>
178                 </g>
179               </svg>
180                 <!-- <img id="buttonHibernate" class="right power-button" src="images/hibernate.svg" width="40px" height="40px"> -->
181             </div>
182             <!-- End Hibernate Button -->
183             <!-- Restart Button -->
184             <div id="buttonRestart" class="col s4">
185               <svg class="power-button"  height="40px" width="40px" viewBox="0 0 1000 1000" >
186                 <g>
187                   <path d="M506,984.1c-98.1,0-192.5-29.2-273.1-84.4C154.1,845.9,93.6,770.9,
188                     57.6,682.9c-9.9-24.3-17.9-49.6-23.7-75.2c-3.2-13.9,5.5-27.7,
189                     19.4-30.9c13.9-3.2,27.7,5.5,30.9,19.4c5.2,22.8,12.3,45.4,21.2,67.1C137.5,
190                     742,191.6,809,262,857.2c72,49.3,156.4,75.3,244,75.3c238.5,0,432.5-194,
191                     432.5-432.5c0-238.5-194-432.5-432.5-432.5c-87.6,0-172,26-244,75.3C191.7,191,
192                     137.5,257.9,105.4,336.5C100,349.7,85,356,71.8,
193                     350.7c-13.2-5.4-19.5-20.4-14.1-33.6c35.9-88,96.5-162.9,
194                     175.2-216.8c80.6-55.2,175-84.3,273.1-84.3c129.3,0,250.8,50.4,
195                     342.3,141.8C939.6,249.1,990,370.7,990,500c0,129.3-50.4,250.9-141.8,
196                     342.3C756.8,933.7,635.2,984.1,506,984.1z"/>
197                     <path d="M82.3,352.6c-10.5,0-20.3-6.5-24.1-16.8L11.6,211.6c-5-13.3,1.8-28.2,
198                       15.1-33.2c13.3-5,28.2,1.8,33.2,15.1l38.5,102.8l106.2-26.1c13.8-3.4,27.8,
199                       5.1,31.2,18.9c3.4,13.8-5.1,27.8-18.9,31.2L88.4,351.8C86.4,352.3,84.3,
200                       352.6,82.3,352.6z"/>
201                   </g>
202               </svg>
203
204                 <!-- <img id="buttonRestart" class="power-button" src="images/restart.svg" width="40px" height="40px"> -->
205             </div>
206             <!-- End Restart Button -->
207             <!-- Shutdown Button -->
208             <div id="buttonShutdown" class="col s4">
209
210               <svg class="power-button"  height="40px" width="40px" viewBox="0 0 56 56">
211               <g>
212                 <path d="M35.31,5.042c-0.532-0.155-1.085,0.15-1.24,0.68s0.149,
213                   1.085,0.68,1.24C44.906,9.932,52,19.405,52,30c0,13.233-10.767,
214                   24-24,24S4,43.233,4,30C4,19.392,11.105,9.915,21.279,
215                   6.953c0.53-0.154,0.835-0.709,0.681-1.239
216                         c-0.153-0.53-0.708-0.839-1.239-0.681C9.698,8.241,2,18.508,2,
217                   30c0,14.337,
218                         11.663,26,26,26s26-11.663,26-26
219                         C54,18.522,46.314,8.26,35.31,5.042z"/>
220                 <path d="M28,27c0.553,0,1-0.447,1-1V1c0-0.553-0.447-1-1-1s-1,
221                   0.447-1,1v25C27,
222                         26.553,27.447,27,28,27z"/>
223               </g>
224               </svg>
225                 <!-- <img id="buttonShutdown" class="power-button" src="images/shutdown.svg" width="40px" height="40px"> -->
226             </div>
227             <!-- End Shutdown Button -->
228           </div>
229       </div>
230
231     </div>
232   </footer>
233 <script>
234
235 // hide enverything until fully loaded
236 $("body").append(`<div id="block" style="position: absolute;background-color: black;
237 width: 100%; height: 100vh; z-index:9999;"></div>`);
238
239 // pass true to show logger output
240 const log = new logger(true);
241
242 // create singleton
243 const greeter = new LoginManager();
244
245 // called after greeter and lightdm are initialized
246 $(greeter).on("ready", function(e) {
247
248   let $user = $("#selectUser");
249   let $session = $("#selectSession");
250   let $password = $("#inputPassword");
251
252   greeter.fillUserSelect($user);
253   greeter.fillSessionSelect($session);
254
255
256   /* Bind shutdown, restart hibernate and suspend to the
257       appropriate buttons */
258   $("#buttonPoweroff").click(function() {
259       greeter.shutdown();
260   });
261   $("#buttonRestart").click(function() {
262       greeter.restart();
263   });
264   $("#hibernate").click(function() {
265       greeter.hibernate();
266   });
267
268
269   $password.keypress((e) => {
270     // user has typed, remove placeholder and invalid class
271     $password.prop("placeholder", "").removeClass("invalid");
272
273     /* attempt authentication, 'grant' event will be emitted on sucecss
274     and 'deny' will be emitted on failure */
275     if (e.keyCode == 13) {
276       let username = $user.children("option:selected").val();
277       let pass = $password.val();
278       log.debug("attempt authenticate with: " + username + " " + pass);
279       greeter.auth(username, pass);
280     }
281
282   });
283
284
285   // when the user is authenticated do transitions and login
286         $(greeter).on("grant", () => {
287     let session_key = $session.children("option:selected").val();
288     greeter.login(session_key);
289         })
290   .on("deny", () => {
291     // inform the user that the credentials are invalid
292     $password.removeClass("valid").addClass("invalid");
293     $password.val("").prop("placeholder", "Incorrect Password");
294   });
295
296         $(greeter.plugins.SplashScreen).on("active", function() {
297                 $(".active-appear").fadeIn();
298         }).on("inactive", function() {
299                 $(".active-appear").fadeOut();
300         });
301
302   setTimeout(() => $("#block").remove(), 100);
303 });
304
305
306 </script>
307 <script>
308   /*
309          * Define this fuction so lightdm doesnt crash, gets resassigned
310    * in login manager
311          */
312         window.authentication_complete = function() {
313
314         };
315
316
317 </script>
318 </body>
319 </html>