diff options
Diffstat (limited to 'petrichor.js')
-rw-r--r-- | petrichor.js | 29 |
1 files changed, 22 insertions, 7 deletions
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; |