diff options
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | index.html | 6 | ||||
-rw-r--r-- | petrichor.js | 29 |
3 files changed, 25 insertions, 12 deletions
@@ -1,6 +1,6 @@ PREFIX=/usr/ DESTDIR= -VERSION=1.0 +VERSION=2.0 THEME_FILES=\ index.html \ @@ -2,11 +2,8 @@ <head> <link rel="stylesheet" type="text/css" href="petrichor.css" /> <script src="petrichor.js" type="text/javascript"></script> - <script type="text/javascript"> - start(); - </script> </head> - <body onclick="reset();" onload="load();"> + <body onclick="reset();"> <div id="date-container"> <div id="date"></div> <div id="time"></div> @@ -45,6 +42,7 @@ </li> </ul> </div> + <div id="users"></div> <select id="session-list" class="ease-opacity"></select> <img id="shutdown" class="ease-opacity" src="image/iec5009.svg" onclick="show_element('power-confirm');show_element('mask');" /> </body> diff --git a/petrichor.js b/petrichor.js index 695b48f..b4dc768 100644 --- a/petrichor.js +++ b/petrichor.js @@ -1,6 +1,6 @@ password_prompt = false; selected_user = null; -time_remaining = 0 +time_remaining = 0; function show_element(id) { @@ -145,7 +145,7 @@ function update_time() function start() { - document.write('<div id="users">'); + var html = ""; for (i in lightdm.users) { user = lightdm.users[i]; @@ -155,15 +155,16 @@ function start() else image = user.image; - document.write('<a href="#" class="user" id="user-' + user.name +'" onclick="start_authentication(\'' + user.name + '\')">'); - document.write('<img class="avatar" src="file:///' + image + '" /><span class="name">'+user.display_name+'</span>'); + html += '<a href="#" class="user" id="user-' + user.name +'" onclick="start_authentication(\'' + user.name + '\')">'; + html += '<img class="avatar" src="file:///' + image + '" /><span class="name">'+user.display_name+'</span>'; if (user.name == lightdm.autologin_user && lightdm.autologin_timeout > 0) - document.write('<span id="countdown-label"></span>'); + html += '<span id="countdown-label"></span>'; - document.write('</a>'); + html += '</a>'; } - document.write('</div>'); + + document.getElementById('users').innerHTML = html; time_remaining = lightdm.autologin_timeout; if (time_remaining > 0) @@ -174,4 +175,18 @@ function load() { update_time(); build_session_list(); + start(); } + +/* Temporary hack until webkit greeter 3. + * The fact this is needed frankly makes me shudder. */ +function try_load() +{ + if (typeof lightdm !== 'undefined') { + load(); + } else { + setTimeout(try_load, 500); + } +} + +window.onload = try_load; |