Adds animated sync icon -- not yet perfect
This commit is contained in:
parent
1bf13aaa1a
commit
50941734b8
5 changed files with 34 additions and 4 deletions
|
@ -304,10 +304,7 @@
|
|||
|
||||
<vbox id="zotero-item-pane" persist="width">
|
||||
<toolbar align="right">
|
||||
<toolbarbutton
|
||||
id="zotero-tb-sync"
|
||||
image="chrome://zotero/skin/arrow_refresh.png"
|
||||
tooltip="_child"
|
||||
<toolbarbutton id="zotero-tb-sync" tooltip="_child"
|
||||
oncommand="Zotero.Sync.Server.sync()">
|
||||
<tooltip
|
||||
onpopupshowing="this.firstChild.nextSibling.value = 'Last sync: ' + (Zotero.Sync.Server.lastLocalSyncTime ? new Date(Zotero.Sync.Server.lastLocalSyncTime * 1000).toLocaleString() : 'Not yet synced')"
|
||||
|
|
|
@ -378,6 +378,8 @@ Zotero.Sync.Server = new function () {
|
|||
this.logout = logout;
|
||||
this.setSyncTimeout = setSyncTimeout;
|
||||
this.clearSyncTimeout = clearSyncTimeout;
|
||||
this.startSyncAnimation = startSyncAnimation;
|
||||
this.stopSyncAnimation = stopSyncAnimation;
|
||||
|
||||
this.__defineGetter__('username', function () {
|
||||
return Zotero.Prefs.get('sync.server.username');
|
||||
|
@ -535,6 +537,7 @@ Zotero.Sync.Server = new function () {
|
|||
|
||||
function sync() {
|
||||
Zotero.Sync.Server.clearSyncTimeout();
|
||||
Zotero.Sync.Server.startSyncAnimation();
|
||||
|
||||
if (_attempts < 0) {
|
||||
_error('Too many attempts in Zotero.Sync.Server.sync()');
|
||||
|
@ -852,6 +855,8 @@ Zotero.Sync.Server = new function () {
|
|||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
|
||||
Zotero.Sync.Server.stopSyncAnimation();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -1016,6 +1021,22 @@ Zotero.Sync.Server = new function () {
|
|||
}
|
||||
|
||||
|
||||
function startSyncAnimation() {
|
||||
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
var win = wm.getMostRecentWindow('navigator:browser');
|
||||
win.document.getElementById('zotero-tb-sync').setAttribute('animate', 'true');
|
||||
}
|
||||
|
||||
|
||||
function stopSyncAnimation() {
|
||||
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
|
||||
.getService(Components.interfaces.nsIWindowMediator);
|
||||
var win = wm.getMostRecentWindow('navigator:browser');
|
||||
win.document.getElementById('zotero-tb-sync').removeAttribute('animate');
|
||||
}
|
||||
|
||||
|
||||
function _checkResponse(xmlhttp) {
|
||||
if (!xmlhttp.responseXML ||
|
||||
!xmlhttp.responseXML.childNodes[0] ||
|
||||
|
@ -1054,6 +1075,8 @@ Zotero.Sync.Server = new function () {
|
|||
Zotero.Sync.Server.unlock()
|
||||
}
|
||||
|
||||
Zotero.Sync.Server.stopSyncAnimation();
|
||||
|
||||
throw(e);
|
||||
}
|
||||
}
|
||||
|
|
BIN
chrome/skin/default/zotero/arrow_rotate_animated.png
Normal file
BIN
chrome/skin/default/zotero/arrow_rotate_animated.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
BIN
chrome/skin/default/zotero/arrow_rotate_static.png
Normal file
BIN
chrome/skin/default/zotero/arrow_rotate_static.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 746 B |
|
@ -191,6 +191,16 @@
|
|||
list-style-image: url('chrome://zotero/skin/toolbar-advanced-search.png');
|
||||
}
|
||||
|
||||
#zotero-tb-sync {
|
||||
margin-top: -2px;
|
||||
margin-left: -2px;
|
||||
list-style-image: url(chrome://zotero/skin/arrow_rotate_static.png);
|
||||
}
|
||||
|
||||
#zotero-tb-sync[animate=true] {
|
||||
list-style-image: url(chrome://zotero/skin/arrow_rotate_animated.png);
|
||||
}
|
||||
|
||||
#zotero-tb-sync #zotero-last-sync-time
|
||||
{
|
||||
color: gray;
|
||||
|
|
Loading…
Reference in a new issue