Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Improve the feedback on when things are focused on the menu-icon.

When an element comes into focus a "focus" message is sent to the
background task. A 'blur' event listener then sends a "focus" message
with  a null id when the text area leaves focus. As a result a
slightly darker icon is used to indicate nothing in focus.
  • Loading branch information...
commit 0a8378bae275859cd7808afb46bc83c0ce56b9b0 1 parent 6e425be
@stsquad authored
View
1  NEWS
@@ -1,6 +1,7 @@
v1.8
* Added option to enable/disable visual edit boxes
+* Improved feedback as editable elements come in and out of focus
v1.7
View
BIN  emacs23-16x16-darker.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
11 textareas.js
@@ -235,7 +235,16 @@ function sendTextArea(text) {
};
setFocused = function(){
- focusedEdit = this;
+ focusedEdit = this;
+ // Update UI?
+ var id = this.getAttribute("edit_id");
+ if (id != undefined) {
+ port.postMessage( {msg: "focus", id: id} );
+ this.addEventListener('blur', function() {
+ port.postMessage( {msg: "focus", id: null} );
+ this.removeEventListener('blur',arguments.callee,false);
+ });
+ }
};
})();
View
8 xmlcomms.js
@@ -34,6 +34,8 @@ function updateUserFeedback(string, colour)
chrome.browserAction.setIcon({path:"emacs23-16x16-green.png"});
} else if (colour == "red") {
chrome.browserAction.setIcon({path:"emacs23-16x16-red.png"});
+ } else if (colour == "darkblue") {
+ chrome.browserAction.setIcon({path:"emacs23-16x16-darker.png"});
} else {
chrome.browserAction.setIcon({path:"emacs23-16x16.png"});
}
@@ -171,6 +173,12 @@ function localMessageHandler(port)
handleTestMessages(msg, port);
} else if (msg.msg == "error") {
updateUserFeedback(msg.text, "red");
+ } else if (msg.msg == "focus") {
+ if (msg.id === null) {
+ updateUserFeedback("Awaiting edit request: no focus", "darkblue");
+ } else {
+ updateUserFeedback("Awaiting edit request: in focus");
+ }
}
});
}
Please sign in to comment.
Something went wrong with that request. Please try again.