* Wire up button disabling in the new UI; user feedback during synchronous API calls.
Cette révision appartient à :
Parent
2d0422d5bb
révision
b46d54453b
2 fichiers modifiés avec 27 ajouts et 18 suppressions
|
@ -6,6 +6,7 @@
|
|||
|
||||
<dialog id="resurrect-select-mirror"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="&resurrect.title;"
|
||||
buttons="cancel"
|
||||
persist="width height screenX screenY"
|
||||
|
@ -23,31 +24,31 @@
|
|||
|
||||
<label value='&resurrect.fromMirror;' />
|
||||
<vbox id='resurrect' onclick='resurrect.clickedXul(event);'>
|
||||
<button
|
||||
<xul:button
|
||||
value='coralcdn' label=' &resurrect.coralcdn;'
|
||||
image='chrome://resurrect/skin/cacheicons/coralcdn.png'
|
||||
/>
|
||||
<button
|
||||
<xul:button
|
||||
value='google' label=' &resurrect.google;'
|
||||
image='chrome://resurrect/skin/cacheicons/google.png'
|
||||
/>
|
||||
<button
|
||||
<xul:button
|
||||
value='googletext' label=' &resurrect.google;&resurrect.textonly;'
|
||||
image='chrome://resurrect/skin/cacheicons/google.png'
|
||||
/>
|
||||
<button
|
||||
<xul:button
|
||||
value='yahoo' label=' &resurrect.yahoo;'
|
||||
image='chrome://resurrect/skin/cacheicons/yahoo.png'
|
||||
/>
|
||||
<button
|
||||
<xul:button
|
||||
value='archive' label=' &resurrect.archive;'
|
||||
image='chrome://resurrect/skin/cacheicons/archive.png'
|
||||
/>
|
||||
<button
|
||||
<xul:button
|
||||
value='msn' label=' &resurrect.msn;'
|
||||
image='chrome://resurrect/skin/cacheicons/msn.png'
|
||||
/>
|
||||
<button
|
||||
<xul:button
|
||||
value='gigablast' label=' &resurrect.gigablast;'
|
||||
image='chrome://resurrect/skin/cacheicons/gigablast.png'
|
||||
/>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
var resurrect={
|
||||
|
||||
originalDoc:null,
|
||||
disabled:false,
|
||||
|
||||
// // // // // // // // // // // // // // // // // // // // // // // // // // //
|
||||
|
||||
|
@ -31,9 +30,9 @@ var resurrect={
|
|||
},
|
||||
|
||||
attachClickEvent:function(event) {
|
||||
resurrect.disabled=false;
|
||||
|
||||
var contentDoc=event.target;
|
||||
var contentWin=contentDoc.defaultView;
|
||||
|
||||
if (contentDoc.documentURI.match(/^about:neterror/)) {
|
||||
contentDoc.getElementById('resurrect').addEventListener(
|
||||
'click', resurrect.clickedHtml, false
|
||||
|
@ -41,6 +40,14 @@ var resurrect={
|
|||
}
|
||||
},
|
||||
|
||||
disableButtons:function(doc) {
|
||||
var bs=doc.getElementById('resurrect')
|
||||
.getElementsByTagName('xul:button');
|
||||
for (var i=0, b=null; b=bs[i]; i++) {
|
||||
b.setAttribute('disabled', 'true');
|
||||
}
|
||||
},
|
||||
|
||||
// // // // // // // // // // // // // // // // // // // // // // // // // // //
|
||||
|
||||
page:function(event) {
|
||||
|
@ -85,10 +92,13 @@ var resurrect={
|
|||
},
|
||||
|
||||
clickedHtml:function(event) {
|
||||
if ('true'==event.target.getAttribute('disabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
return resurrect.clickHandler(
|
||||
event,
|
||||
event.target.ownerDocument,
|
||||
event.target.ownerDocument,
|
||||
event.target.ownerDocument.location.href
|
||||
);
|
||||
},
|
||||
|
@ -96,20 +106,20 @@ var resurrect={
|
|||
clickedXul:function(event) {
|
||||
return resurrect.clickHandler(
|
||||
event,
|
||||
event.target.ownerDocument,
|
||||
window.arguments[0],
|
||||
window.arguments[1]
|
||||
);
|
||||
},
|
||||
|
||||
clickHandler:function(event, ownerDoc, contentDoc, rawUrl) {
|
||||
if (resurrect.disabled) return;
|
||||
resurrect.disabled=true;
|
||||
clickHandler:function(event, contentDoc, rawUrl) {
|
||||
resurrect.disableButtons(event.target.ownerDocument);
|
||||
|
||||
// Run the actual code. After timeout for UI repaint.
|
||||
setTimeout(
|
||||
resurrect.selectMirror, 1,
|
||||
event.target.getAttribute('value'), ownerDoc, contentDoc, rawUrl
|
||||
event.target.getAttribute('value'),
|
||||
event.target.ownerDocument,
|
||||
contentDoc, rawUrl
|
||||
);
|
||||
},
|
||||
|
||||
|
@ -217,8 +227,6 @@ var resurrect={
|
|||
// setTimeout avoids errors because the window is gone
|
||||
setTimeout(window.close, 0);
|
||||
}
|
||||
} else {
|
||||
resurrect.disabled=false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Chargement…
Référencer dans un nouveau ticket