Skip to content

Commit

Permalink
Remove S.ISSUE35 (#307)
Browse files Browse the repository at this point in the history
Now that #35 has been merged, we don't need the global condition on
whether is is active.
  • Loading branch information
cxw42 committed Jul 23, 2023
1 parent 88e629a commit 660bc30
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 28 deletions.
8 changes: 0 additions & 8 deletions app/common/setting-definitions.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
// setting-definitions.js: The TabFern settings, and setting-access functions

// Fixed configuration
let ISSUE35 = true; // Set to true to enable #35 functions, false to disable
// TODO remove this flag once #35 is closed and #35 functions are
// always enabled.

// Names of settings, and their defaults // {{{1

// Boolean settings start with CFG_. Non-boolean settings start with
Expand Down Expand Up @@ -311,9 +306,6 @@ let me = {
set: setSetting,
setIfNonexistent: setSettingIfNonexistent,
getThemeName,

// fixed configuration
ISSUE35,
};

// Each of the names is a property directly on the export object,
Expand Down
12 changes: 5 additions & 7 deletions app/settings/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ vote at ${issue(125,true)}.

]; //setting_definitions

if(S.ISSUE35) setting_definitions.push(
setting_definitions.push(
{
'tab': future_i18n('Behaviour'),
'group': future_i18n('Partly-open windows'),
Expand Down Expand Up @@ -308,7 +308,7 @@ bar (it will start with "file://")</li>
},
);

if(S.ISSUE35) setting_definitions.push(
setting_definitions.push(
{
'tab': future_i18n('Appearance'),
'group': future_i18n('Action-button order for windows'),
Expand Down Expand Up @@ -514,9 +514,8 @@ setting_definitions.push(
'group_html':true,
"type": "description",
"text": (
`<ul>` +
(!S.ISSUE35 ? '' :
`<li class="gold-star">Opening one tab at a time! Yes, the wait is over! ${issue(35)}
`<ul>
<li class="gold-star">Opening one tab at a time! Yes, the wait is over! ${issue(35)}
<ul>
<li>Click on a tab in a closed window to open only that tab.</li>
<li>Click the "close and save" icon (${icon('fff-picture-delete')})
Expand All @@ -528,8 +527,7 @@ setting_definitions.push(
<p>Please note that if Chrome crashes while you have only some tabs open, the
recovered window will show up in TabFern as a separate, unsaved window
(related to ${issue(41, true)}).</p>
</li>
`) +
</li>` +
'</ul>' +
`
<h4>Help TabFern!</h4>
Expand Down
23 changes: 10 additions & 13 deletions app/win/main_tl.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,6 @@ function local_init()
ASQ = Modules.ASQ;
ASQH = Modules.ASQH;
S = Modules.S;
console.log(`Issue #35 support: ${S.ISSUE35 ? 'enabled' : 'disabled'}`);
} //init()

/// Copy properties named #property_names from #source to #dest.
Expand Down Expand Up @@ -894,7 +893,6 @@ function actionDeleteWindow(win_node_id, win_node, unused_action_id,
/// @param win_node {object} the window's node
function actionOpenRestOfTabs(win_node_id, win_node, unused_action_id, unused_action_el)
{
if(!S.ISSUE35) return;
if(!win_node_id || !win_node) return;
let win_val = D.windows.by_node_id(win_node_id);
if(!win_val) return;
Expand Down Expand Up @@ -1158,7 +1156,6 @@ function actionDeleteTab(node_id, node, unused_action_id, unused_action_el,
/// Close the tab and save
function actionCloseTabAndSave(tab_node_id, tab_node, unused_action_id, unused_action_el)
{
if(!S.ISSUE35) return;
let tab_val = D.tabs.by_node_id(tab_node_id);
if(!tab_val || tab_val.tab_id === K.NONE) return; //already closed => nop
let window_node_id = tab_node.parent;
Expand Down Expand Up @@ -1215,17 +1212,17 @@ function addTabNodeActions(tab_node_id)
// Add the buttons in the layout chosen by the user (#152).
let order = S.getString(S.S_WIN_ACTION_ORDER);
if(order === 'ced') {
if(S.ISSUE35) addTabCloseAction(tab_node_id);
addTabCloseAction(tab_node_id);
addTabEditAction(tab_node_id);
addTabDeleteAction(tab_node_id);
} else if(order === 'ecd') {
addTabEditAction(tab_node_id);
if(S.ISSUE35) addTabCloseAction(tab_node_id);
addTabCloseAction(tab_node_id);
addTabDeleteAction(tab_node_id);
} else if(order === 'edc') {
addTabEditAction(tab_node_id);
addTabDeleteAction(tab_node_id);
if(S.ISSUE35) addTabCloseAction(tab_node_id);
addTabCloseAction(tab_node_id);
} else {
//don't add any buttons, but don't crash.
log.error(`Unknown tab-button order ${order}`);
Expand Down Expand Up @@ -1957,7 +1954,7 @@ function onTreeSelect(evt_unused, evt_data, options={})
if(win_val.isOpen) {
if(is_win) { // clicked on an open window

if( S.ISSUE35 && M.isWinPartlyOpen(win_node) &&
if( M.isWinPartlyOpen(win_node) &&
(S.getString(S.S_OPEN_REST_ON_CLICK) === S.OROC_DO)
) {
action = ActionTy.open_rest;
Expand All @@ -1966,7 +1963,7 @@ function onTreeSelect(evt_unused, evt_data, options={})
}

} else { // clicked on a tab in an open window
action = (tab_val.isOpen || !S.ISSUE35) ? ActionTy.activate_tab
action = tab_val.isOpen ? ActionTy.activate_tab
: ActionTy.open_tab_in_win;
}
} else { // window is closed
Expand Down Expand Up @@ -2006,7 +2003,7 @@ function onTreeSelect(evt_unused, evt_data, options={})
} else if(action === ActionTy.activate_win) {
win_id_to_highlight_and_raise = node_val.win_id;

} else if(S.ISSUE35 && action === ActionTy.open_rest) {
} else if(action === ActionTy.open_rest) {
win_id_to_highlight_and_raise = win_val.win_id;
actionOpenRestOfTabs(win_node.id, win_node, null, null);

Expand All @@ -2020,7 +2017,7 @@ function onTreeSelect(evt_unused, evt_data, options={})
let urls=[];
let tab_node_ids;

if(!S.ISSUE35 || action === ActionTy.open_win) { // Open all tabs
if(action === ActionTy.open_win) { // Open all tabs
for(let child_id of win_node.children) {
let child_val = D.tabs.by_node_id(child_id);
urls.push(child_val.raw_url);
Expand Down Expand Up @@ -2103,7 +2100,7 @@ function onTreeSelect(evt_unused, evt_data, options={})
return;
}

} else if(S.ISSUE35 && action === ActionTy.open_tab_in_win) {
} else if(action === ActionTy.open_tab_in_win) {
// add tab to existing win

// Figure out where to put it
Expand Down Expand Up @@ -3184,7 +3181,7 @@ function getMainContextMenuItems(node, _unused_proxyfunc, e)
},
};

if(S.ISSUE35 && val.isOpen) {
if(val.isOpen) {
tabItems.closeItem = {
label: 'Close and remember',
icon: 'fff-picture-delete',
Expand Down Expand Up @@ -3240,7 +3237,7 @@ function getMainContextMenuItems(node, _unused_proxyfunc, e)
};
}

if( S.ISSUE35 && M.isWinPartlyOpen(node) &&
if( M.isWinPartlyOpen(node) &&
(S.getString(S.S_OPEN_REST_ON_CLICK) === S.OROC_DO_NOT)
) {
winItems.openAllItem = {
Expand Down

0 comments on commit 660bc30

Please sign in to comment.