diff options
author | Cheng-Han, Wu | 2016-03-15 10:45:02 +0800 |
---|---|---|
committer | Cheng-Han, Wu | 2016-03-15 10:45:02 +0800 |
commit | 526f5c7e2eeee21ef9d87bda8668903844e95f53 (patch) | |
tree | a6d78ff929f9424b33fcfb51a2a44b79f7bec4ac /public/js/extra.js | |
parent | 30d194bba4a49867acba9839a2f7a7c89240203b (diff) |
Improved update last info methods, only change DOM when necessary
Diffstat (limited to 'public/js/extra.js')
-rw-r--r-- | public/js/extra.js | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/public/js/extra.js b/public/js/extra.js index dc3eac3e..a72ca5e1 100644 --- a/public/js/extra.js +++ b/public/js/extra.js @@ -14,16 +14,20 @@ function updateLastChange() { } setInterval(updateLastChange, 60000); -function updateLastChangeUser(data) { - if (data.lastchangeuserprofile) { - var icon = lastchangeui.user.children('i'); - icon.attr('title', data.lastchangeuserprofile.name).tooltip('fixTitle'); - icon.attr('style', 'background-image:url(' + data.lastchangeuserprofile.photo + ')'); - lastchangeui.user.show(); - lastchangeui.nouser.hide(); - } else { - lastchangeui.user.hide(); - lastchangeui.nouser.show(); +var lastchangeuser = null; +var lastchangeuserprofile = null; +function updateLastChangeUser() { + if (lastchangeui) { + if (lastchangeuser && lastchangeuserprofile) { + var icon = lastchangeui.user.children('i'); + icon.attr('title', lastchangeuserprofile.name).tooltip('fixTitle'); + icon.attr('style', 'background-image:url(' + lastchangeuserprofile.photo + ')'); + lastchangeui.user.show(); + lastchangeui.nouser.hide(); + } else { + lastchangeui.user.hide(); + lastchangeui.nouser.show(); + } } } |