Skip to content

Commit

Permalink
Merge pull request #300 from cxw42/issue35rc
Browse files Browse the repository at this point in the history
Tab-at-a-time (v0.3.0)
  • Loading branch information
cxw42 authored Dec 10, 2022
2 parents cc2f6c4 + d067856 commit c132b68
Show file tree
Hide file tree
Showing 38 changed files with 2,074 additions and 1,318 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ core
tags
*.zip
foo.*
*.tdy

# Patch-related
*.orig
*.rej
*.patch

# Output directories
/public*
Expand Down
5 changes: 5 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ below for why. Developing on the `main` branch involves:
1. Create a new branch (e.g., `git checkout -b mybranch origin/main`)
1. Run `npm install`. This will download all the other packages TabFern and
its build process use.
* If this hangs, try the solution by [xiata](https://github.com/xiata)
[here](https://github.com/npm/cli/issues/1673#issue-678698649).
1. Run `npx brunch w`. This will build `app/` and the other directories in the
branch into `public/`. It will also leave `brunch` running. (To build but
not leave `brunch` running, say `npx brunch b`.)
Expand All @@ -62,6 +64,9 @@ below for why. Developing on the `main` branch involves:
or `app/bg`, you will probably need to reload the extension. In Chrome,
go to `chrome://extensions` and click the circular arrow in TabFern's box.

If you want to make a `.zip`, e.g., to try installing from a different folder,
say `npm run zip`. The output will be in `webstore-<VERSION>.zip`.

### Build notes

- A tweaked version of Brunch builds the plugin into public/.
Expand Down
4 changes: 3 additions & 1 deletion app/common/setting-definitions.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// setting-definitions.js: The TabFern settings, and setting-access functions

// Fixed configuration
let ISSUE35 = false; // Set to true to enable #35 functions, false to disable
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

Expand Down
65 changes: 44 additions & 21 deletions app/settings/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function brplain(text){return `<br/><span class="plain">${text}</span>`;}

function future_i18n(x) { return x; }

let ham = icon('fa fa-bars'); // hamburger-menu icon (three bars)
let ham = icon('fa fa-bars');
let gt = icon('fa fa-lg fa-caret-right');
var editImg = icon('fff-pencil tf-action-button');
var delImg = icon('fff-cross tf-action-button');
Expand Down Expand Up @@ -222,7 +222,7 @@ setting_definitions.push(
"tab": future_i18n("Appearance"),
"group": '',
"type": "description",
"text": future_i18n("Refresh the TabFern window to apply changes to these options. To refresh, click TabFern's title bar and hit F5 or Cmd+R."),
"text": future_i18n("Refresh the TabFern window to apply changes to these options. To refresh, click TabFern's title bar and hit F5."),
},
{
"tab": future_i18n("Appearance"),
Expand Down Expand Up @@ -401,7 +401,7 @@ setting_definitions.push(
"tab": future_i18n("Advanced"),
"group": '',
"type": "description",
"text": future_i18n("Refresh the TabFern window to apply changes to these options. To refresh, click TabFern's title bar and hit F5 or Cmd+R."),
"text": future_i18n("Refresh the TabFern window to apply changes to these options. To refresh, click TabFern's title bar and hit F5."),
},
{
"tab": future_i18n("Advanced"),
Expand Down Expand Up @@ -474,7 +474,7 @@ alphabetical order within each category.`
"type": "description",
"text":
`<ul>
<li><a href="https://github.com/bluikko/">bluikko</a></li>
<li><a href="https://github.com/bluikko">bluikko</a></li>
<li><a href="https://github.com/devinrhode2/">Devin Rhode</a></li>
<li><a href="https://github.com/philiprhoades/">Phil Rhoades</a></li>
</ul>`
Expand All @@ -485,22 +485,11 @@ alphabetical order within each category.`
setting_definitions.push(
{
"tab": future_i18n("What's new?"),
"group": `Version 0.2.2${brplain('2021-12-22')}`,
"group": `Version 0.3.0${brplain('2022-12-09')}`,
'group_html':true,
"type": "description",
"text": (
`<h1>Please back up!</h1>
<p>The next version of TabFern will introduce tab-at-a-time ${issue(35)}.
Please back up now (${ham} ${gt} Backup now) just in case of unexpected bugs!
Remember, TabFern carries <b>no warranty</b>.
</p>
<ul>
<li>Fixed a regression in the settings: it is now possible to set the
window action-button order again. ${issue(208)}</li>
<li>When running a development version of TF, the commit hash will be
listed in the title bar. This will make it easier to reference the
commit in bug reports. ${issue(210)}</li>` +

`<ul>` +
(!S.ISSUE35 ? '' :
`<li class="gold-star">Opening one tab at a time! Yes, the wait is over! ${issue(35)}
<ul>
Expand All @@ -514,9 +503,42 @@ commit in bug reports. ${issue(210)}</li>` +
<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>
<p>I need people to help me develop and test. Please volunteer or spread the
word! That is how TabFern will continue to advance :) . You can reach me
on <a href="https://github.com/cxw42/TabFern/discussions">GitHub</a> or
<a href="https://gitter.im/TabFern/Lobby">gitter</a>.</p>
<h4>Note about Manifest v3</h4>
<p>The <tt>chrome:extensions</tt> panel may show an error that
"Manifest version 2 is deprecated, and support will be removed in 2023."
Don't worry; I plan to have the update done in time. ${issue(275)}</p>
`
),

`<li>Icons of other extensions should now appear in the TF window. ${issue(202)}</li>
},
{
"tab": future_i18n("What's new?"),
"group": `Version 0.2.2${brplain('2021-12-22')}`,
'group_html':true,
"type": "description",
"text": (
`<h4>Please back up!</h4>
<p>The next version of TabFern will introduce tab-at-a-time ${issue(35)}.
Please back up now (${ham} ${gt} Backup now) just in case of unexpected bugs!
Remember, TabFern carries <b>no warranty</b>.
</p>
<ul>
<li>Fixed a regression in the settings: it is now possible to set the
window action-button order again. ${issue(208)}</li>
<li>When running a development version of TF, the commit hash will be
listed in the title bar. This will make it easier to reference the
commit in bug reports. ${issue(210)}</li>
<li>Icons of other extensions should now appear in the TF window. ${issue(202)}</li>
<li>Other fixes: ${issue(196,true)}, ${issue(224,true)} (thanks to bluikko),
${issue(233,true)}, ${issue(236,true)}, ${issue(237,true)}</li>
<li>Known issues: ${issue(276,true)}</li>
Expand All @@ -534,7 +556,8 @@ recovered window will show up in TabFern as a separate, unsaved window
`<li class="gold-star">Special thanks to Hacktoberfest 2019 participants!
ahonn and Procyon-b contributed code, Makemeloco contributed a translation,
and sarthakpranesh contributed a new website.</li>` +
`<li>The TabFern window should no longer appear off-screen (unless you have
`<li>TabFern will warn before closing a tab that is playing audio. ${issue(118)}</li>
<li>The TabFern window should no longer appear off-screen (unless you have
changed monitors recently). ${issue(189)}</li>
<li>Russian translation ${issue(194)}</li>
<li>Fix for a Chrome change that caused <tt>new_tab.html</tt> tabs to open.
Expand All @@ -559,7 +582,7 @@ recovered window will show up in TabFern as a separate, unsaved window
<a href="https://forum.vivaldi.net/topic/35531/chrome-extension-apis-intermittently-unavailable-on-2-3-1440-61-x86">bug</a>
that sometimes causes
TabFern not to load properly. If this happens, close the TF window and
click the TF toolbar button to reload, or hit F5 or Cmd+R. That will probably work!
click the TF toolbar button to reload, or hit F5. That will probably work!
${issue(171)}</p>
<ul>
<li>TabFern now opens in a small window in the upper-left corner of the
Expand Down
4 changes: 4 additions & 0 deletions app/settings/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ function loadSettingsFromObject(obj) {
continue; // not an error
}

if(key === S.SETTINGS_LOADED_OK) { // Not a real setting
continue;
}

// Get the value
let val;
try {
Expand Down
46 changes: 39 additions & 7 deletions app/win/item_details.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// nodes, and top borders on items, are kept in the tree.
//
// Copyright (c) 2017 Chris White, Jasmine Hegman.
// Copyright (c) 2018--2020 Chris White

// Boilerplate and require()s {{{1
(function (root, factory) {
Expand Down Expand Up @@ -33,11 +34,15 @@
/// The module we are creating
let module = {};

// == Data structures ====================================================

// Design decisions for both module.tabs and module.windows:
// - No fields named `parent` so I can distinguish jstree node
// records from multidex values.
// - No fields named `id` --- those exist in ctab and cwin records
// - All types of records have `raw_title` and `isOpen` fields.

/// Map between open-tab IDs and node IDs.
/// Design decisions:
/// - No fields named `parent` so I can distinguish jstree node
/// records from multidex values.
/// - All types of records have `raw_title` and `isOpen` fields.
module.tabs = multidex(
K.IT_TAB, //type
[ //keys
Expand Down Expand Up @@ -67,8 +72,7 @@
]);

/// Map between open-window IDs and node IDs.
/// Design decision: no fields named "parent" so I can distinguish
/// jstree node records from multidex values.
/// Design decisions: see above
module.windows = multidex(
K.IT_WIN, //type
[ //keys
Expand All @@ -93,6 +97,8 @@
// something done by the browser.
]);

// == Functions ==========================================================

/// Find a node's value in the model, regardless of type.
/// @param node_id {string} The node ID. This has to be a string, because
/// this module does not depend on item_tree.
Expand All @@ -111,7 +117,33 @@
if(val) return val;

return false; //not found
} //val_by_node_id
}; //val_by_node_id

/// Find a tab in the model by its Chrome idx
module.val_by_ctabid = function val_by_ctabid(ctabid)
{
return module.tabs.by_tab_id(ctabid);
};

/// Find a window in the model by its Chrome idx
module.val_by_cwinid = function val_by_cwinid(cwinid)
{
return module.windows.by_win_id(cwinid);
};

/// The above functions, indexed by ty
const finder_functions = {
[K.IT_TAB]: module.val_by_ctabid,
[K.IT_WIN]: module.val_by_cwinid,
};

/// Find an item in the model by its Chrome ID, indirected by type.
module.val_by_cid = function val_by_cid(cid, ty)
{
const finder = finder_functions[ty];
if(!finder) return false;
return finder(cid);
};

return module;
}));
Expand Down
Loading

0 comments on commit c132b68

Please sign in to comment.