Event Filter
-
Please note: these advanced settings may make troubles (ex: let Firefox crash),
if you don't have interest to write custom code, directly pick items from Usage Examples would be a good idea. - Advanced users, or people like to play, please continue to read Setting Summary for more info.
Setting Summary
Usually we just fill topic or event type into the "event" field of Noise Edit window,
for example, dblclick
will capture double clicking events.
And what is called Event Filtering, is to append an &
with filter expression after the string,
then Noise will evaluate the result of the expression when events happen, and play sounds only if the result is true.
For example, dblclick&event['target'].tagName=='H1'
checks if the clicked target is a H1 element, if so, continue to play a sound.
In the inner implementation of Noise 1.0,
the mentioned &
with filter expression
will become a function named filtertFx
which will be called when events happen,
and parameters (event object, or subject and data objects) relevant to the event will be passed to it, and available for evaluating.
More detailed description:
If the event type is "Event topic - via addObserver" then the inner code of Noise 1.0 was:
observe: function(subject, topic, data) {
try {
if( filtertFx(subject,data) ) Noise.play( i['se'] );
} catch(e) { dump('Noise: '+e); }
}
Definion of "subject" and "data", see nsIObserver - MDC;
In fact they are widely varies in different topics, see Global Notifications and so on;
Parameters of Noise-Specific topics, see Noise-Specific Topics.
If the event type is "Browser event - via gBrowser.addEventListener" or "Window event - window.addEventListener" then the relevant codes were:
this.listeners[i['urn']] = function(event) {
try {
if( filtertFx(event) ) Noise.play( i['se'] );
} catch(e) { dump('Noise: '+e); }
}
Definition of "event" could be found in DOM-Level-2-Events.
Read event - MDC or Comparison of Event Targets for more information.
Noise-Specific Topics
Topic | Subject | Data | Summary |
---|---|---|---|
noise-TypeAheadFind.FIND_WRAPPED | null | aFindPrevious | aFindPrevious can be true or false, "true" means finding backward (find previous) |
noise-toggleSidebar | null | commandID | commandID is the id of the toggle command, ex: when open History sidebar, the value is viewHistorySidebar |
noise-alert-loaded | null | null | |
noise-WebProgress-start | aReq | aStatus | aReq is a nsIRequest object, see nsIWebProgressListener for more information |
noise-WebProgress-stop | aReq | aStatus | aReq is a nsIRequest object, see nsIWebProgressListener for more information |
noise-WebProgress-locationChange | aLocation | aLocation.spec | aLocation is a nsIURI object, see nsIWebProgressListener for more information |
noise-dl.addnew | dl | null | dl is the Download object, see onDownloadAdded of DownloadList#addView |
noise-dl.removenew | dl | null | dl is the Download object, see onDownloadRemoved of DownloadList#addView |
noise-dl.stopnew | dl | status | dl is the Download object, see onDownloadChanged of DownloadList#addView; data is the status of the download, with value set as one of 'succeeded', 'canceled' or 'stopped' |
noise-dl.errornew | dl | error | dl is the Download object, see onDownloadChanged of DownloadList#addView; data is the result property of error object, see DownloadError |
Usage Examples
Type: 1 = Event topic 2 = Browser Event 3 = Window Event
ps. example may not available on old versions of Noise.
Name | Event String | Type | Summary |
---|---|---|---|
404 page not found | noise-WebProgress-stop&subject.QueryInterface(Components.interfaces.nsIHttpChannel).responseStatus=='404' | 1 | when getting a 404 error page |
404 resource not found | http-on-examine-response&subject.QueryInterface(Components.interfaces.nsIHttpChannel).responseStatus=='404' | 1 | when everytime getting 404 response |
Address not found | noise-WebProgress-stop&data==0x804B001E | 1 | can't find a host server |
Failed to Connect | noise-WebProgress-stop&data==0x804B000D | 1 | though the site seems valid, connection failed |
Reported attack site! | noise-WebProgress-stop&data==0x805D001E | 1 | error: NS_ERROR_MALWARE_URI |
Private browsing | private-browsing&data=='enter' | 1 | replace 'enter' with 'exit' to capture exiting event. |
Edit Bookmark Panel | popupshowing&event.target.id=='editBookmarkPanel' | 3 | panel shows when adding new bookmark |
Specific URL Loaded | DOMContentLoaded&event.target.baseURI=='http://127.0.0.1/' | 2,3 | please replace the URL part as needed |
Specific info bar alert | AlertActive&event.originalTarget.value=='popup-blocked' | 2,3 | try also xpinstall, xpinstall-disabled, blocked-plugins, missing-plugins, refresh-blocked, offline-app-usage |
Add-on installed | em-action-requested&data=='item-installed' | 1 | try also item-uninstalled, item-enabled, item-disabled, item-upgraded, item-cancel-action |
Google Reader unread discovered | DOMAttrModified&event.target.id=='reading-list-unread-count'&&event.prevValue=='unread-count hidden' | 3 | with Google Reader opened, this fires when the count part of "All items (4)" appear |
Findbar wrapped back | noise-TypeAheadFind.FIND_WRAPPED&data=='false' | 1 | true when going back to first (not last) result |
Open bookmark sidebar | noise-toggleSidebar&data=='viewBookmarksSidebar' | 1 | |
Search plugin discovered | DOMLinkAdded&event.target.rel=='search'&&event.target.type=='application/opensearchdescription+xml' | 2,3 | happens even if you've already installed it |
SearchWP fast search menu | AlertActive&event.originalTarget.getAttribute('anonid')=='tokens-menu-popup' | 3 | |
Open FoxAge2ch sidebar | noise-toggleSidebar&data=='viewBookmarksSidebar' | 1 | |
FoxAge2ch error notify | foxage2ch-global&data=='error-notify' | 1 | |
FoxAge2ch finish checking | foxage2ch-global&data=='finish-checking' | 1 | |
FoxAge2ch subscribe done | foxage2ch-show-message&data=='(・∀・)完了' | 1 | |
dblclick close Find bar | dblclick&event.button=='2'&&!gFindBar.hidden&&(gFindBar.close()||true) | 2 | double click right mouse button (on Windows) to close Find bar. |