Skip to content

Commit

Permalink
Regularize event handlers to start with "on"
Browse files Browse the repository at this point in the history
Rename winOnFoo() -> onWinFoo() throughout, and likewise for tab and tree.
  • Loading branch information
cxw42 committed Dec 18, 2020
1 parent 508a464 commit ce7a077
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 89 deletions.
152 changes: 76 additions & 76 deletions app/win/main_tl.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions app/win/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -677,14 +677,14 @@ me.del_subtype = function(vorny, ...tys) {
// The model stores ctab indices, and each tree node has an index under
// its parent. These functions map between those indices.
//
// Mapping is used in: treeOnSelect(), tabOnCreated(), tabOnMoved(),
// tabOnAttached(), treeCheckCallback():move_open_tab_in_window(), and
// Mapping is used in: onTreeSelect(), onTabCreated(), onTabMoved(),
// onTabAttached(), treeCheckCallback():move_open_tab_in_window(), and
// treeCheckCallback():open_tab_within_window().
//
// Refreshing tree indices is used in: actionOpenRestOfTabs(),
// actionCloseTabAndSave(), connectChromeWindowToTreeWindowItem(),
// treeOnSelect(), tabOnCreated():tab_on_created_inner(),
// tabOnMoved(), tabOnRemoved(), tabOnDetached(), tabOnAttached(),
// onTreeSelect(), onTabCreated():tab_on_created_inner(),
// onTabMoved(), onTabRemoved(), onTabDetached(), onTabAttached(),
// treeCheckCallback():move_open_tab_in_window(), and
// treeCheckCallback():open_tab_within_window(),

Expand Down
11 changes: 6 additions & 5 deletions lib/hamburger.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// hamburger.js: Hamburger menu for jstree.
// Uses jquery, jstree, loglevel, all of which must be loaded beforehand.
// Copyright (c) 2018--2020 Chris White

(function (root, factory) {
if (typeof define === 'function' && define.amd) {
Expand All @@ -12,7 +13,7 @@
// Browser globals (root is window)
root.HamburgerMenuMaker = factory(root.jQuery, root.log, root.jQuery.jstree);
}
}(this, function ($, log) {
}(this, function ($, log /* , jstree */ ) {

/// The prototype for a hamburger-menu object
let Proto = {};
Expand All @@ -23,7 +24,7 @@
/// Replace left clicks with right clicks.
/// - There is only one item, so whenever it is selected, deselect it.
/// - Also, make left click trigger a context menu.
Proto.hamOnSelect = function(evt, evt_data)
Proto.onSelect = function onHamSelect(evt, evt_data)
{
this.treeobj.deselect_all(true); // `this` is the Hamburger object
//console.log(evt_data);
Expand All @@ -38,7 +39,7 @@
// reselect the node. If it did, it would trigger an
// infinite loop.
}, 100);
} //Proto.hamOnSelect
} //Proto.onSelect

//////////////////////////////////////////////////////////////////////////
// INIT //
Expand Down Expand Up @@ -69,7 +70,7 @@
}
, 'contextmenu': {
items: getMenuItems
, select_node: false // required for hamOnSelect to work
, select_node: false // required for onSelect to work
}
};

Expand All @@ -90,7 +91,7 @@
, state: { 'opened': false }
});

$(selector).on('changed.jstree', retval.hamOnSelect.bind(retval));
$(selector).on('changed.jstree', retval.onSelect.bind(retval));

return retval; // Not sealed, to give the caller flexibility.
} //ctor
Expand Down
2 changes: 1 addition & 1 deletion static/_locales/de/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@
}
, "errCouldNotCreateWindow": {
"message": "Fehler: I couldn't create the window: $ERR$"
,"description":"Error message from treeOnSelect()"
,"description":"Error message from onTreeSelect()"
,"placeholders":{
"err": {
"content": "$1"
Expand Down
2 changes: 1 addition & 1 deletion static/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
}
, "errCouldNotCreateWindow": {
"message": "I couldn't create the window: $ERR$"
,"description":"Error message from treeOnSelect()"
,"description":"Error message from onTreeSelect()"
,"placeholders":{
"err": {
"content": "$1"
Expand Down
2 changes: 1 addition & 1 deletion static/_locales/fr/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@
}
, "errCouldNotCreateWindow": {
"message": "Je n'ai pas pu créer la fenêtre: $ERR$"
,"description":"Error message from treeOnSelect()"
,"description":"Error message from onTreeSelect()"
,"placeholders":{
"err": {
"content": "$1"
Expand Down
2 changes: 1 addition & 1 deletion static/_locales/ru/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@
}
, "errCouldNotCreateWindow": {
"message": "Не удалось создать окно: $ERR$"
,"description":"Error message from treeOnSelect()"
,"description":"Error message from onTreeSelect()"
,"placeholders":{
"err": {
"content": "$1"
Expand Down

0 comments on commit ce7a077

Please sign in to comment.