From f6365047c0a82ace7595cf5d9ff26448af601990 Mon Sep 17 00:00:00 2001 From: Simon Heimler Date: Mon, 2 Sep 2024 21:55:40 +0200 Subject: [PATCH] Move Tips to markdown page and just link it (#142) * Move Tips to markdown page and just link it * Add link to Tips and Tricks from main Readme * Added changelog * Remove test --------- Co-authored-by: Simon Heimler --- CHANGELOG.md | 1 + README.md | 4 +- Tips.md | 71 +++++++++++++++++++++++++++++++ cypress/e2e/search.cy.js | 5 --- popup/css/style.css | 6 +-- popup/index.html | 10 +++-- popup/js/initSearch.js | 6 +-- popup/js/search/defaultEntries.js | 56 ------------------------ popup/options.html | 10 +++-- 9 files changed, 93 insertions(+), 76 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b2c13c36..d64e8809 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ## [v1.10.1] - **FIXED**: Bookmark tagging autocomplete was partly broken. Fixed update of dependency. +- **CHANGED**: Moved the tips & tricks to markdown file and just link it, instead of random tips on startup. ## [v1.10.0] diff --git a/README.md b/README.md index f5027b69..d29745b4 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,9 @@ The tags are considered when searching and can be used for navigation. The extension is very customizable (see [user options](#user-configuration)) and has a dark / light theme that is selected based on your system settings (see [prefers-color-scheme](https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme)). It's also very lightweight (< 150kb JavaScript, including dependencies). -For a list of recent changes, see [CHANGELOG.md](./CHANGELOG.md). +> 💡 Have a look at the [Tips & Tricks](./Tips.md) collection. + +> 🗎 For a list of recent changes, see [CHANGELOG.md](./CHANGELOG.md). ## Screenshots & Demo diff --git a/Tips.md b/Tips.md index e69de29b..150644f1 100644 --- a/Tips.md +++ b/Tips.md @@ -0,0 +1,71 @@ +# Tips & Tricks + +Customization: This extension can be customized via options in many ways. Please refer to the Documentation (link bottom right). + +
+ +Tips on startup: Disable via option: enableHelp: false + +
+ +Search Strategies: Switch between PRECISE (faster, exact) and FUZZY (slower, more results, fuzzy).

+This can be done via clicking on the top-right corner of the popup or by setting it in the options like: searchStrategy: precise + +
+ +Keyboard Shortcut: Trigger the extension via keyboard.
+The default is CTRL + Shift + ..

+This can be customized in the browsers extensions settings. + +
+ +History Size & History: By default the number of history items to load are limited. +Consider increasing or decreasing this, depending on your performance situation and personal preferences:

+Add / adjust option: historyMaxItems: 1024
+Add / adjust option: historyDaysAgo: 14 + +
+ +Open selected results: By default, the extension will open the selected result in a new tab or switch to an existing tab if fitting.

+Hold Shift or Alt to open the result in the current tab.
+Hold Ctrl to open the result without closing the popup.
+Press Right Click to copy URL of result into clipboard without closing the popup. + +
+ +Custom Bonus Scores: Append + [whole number] to your bookmark title (before tags).

+Example: Another Bookmark +10 #tag1 + +
+ +Custom Bonus Scores: Append + [whole number] to your bookmark title (before tags).

+Example: Another Bookmark +10 #tag1 + +
+ +Copy to Clipboard: Right click a result item to copy its URL to the clipboard. + +
+ +Search Modes: Use search modes to be more selective.

+Start your search query with a search mode prefix: + + + +
+ +Special Browser Pages: You can add special browser pages to your bookmarks, like +chrome://downloads. + +
+ +Keyboard Navigation: You can navigate result entries also in Emacs / Vim style:

+Ctrl+N and Ctrl+J to navigate search results up.
+Ctrl+P and Ctrl+K to navigate search results down. diff --git a/cypress/e2e/search.cy.js b/cypress/e2e/search.cy.js index 309505ff..f924146b 100644 --- a/cypress/e2e/search.cy.js +++ b/cypress/e2e/search.cy.js @@ -10,11 +10,6 @@ describe('Search View', () => { it('completes the initializing phase without errors', () => { cy.get('#results-loading').should('not.exist').checkNoErrors() }) - it('starts with no results, but a random tip', () => { - cy.get('#result-list').find('li.tip') - cy.get('#result-list') - .should('have.length', 1) - }) }) describe('Result Navigation', () => { diff --git a/popup/css/style.css b/popup/css/style.css index 09251d75..31f4a512 100644 --- a/popup/css/style.css +++ b/popup/css/style.css @@ -259,7 +259,8 @@ code { font-size: 14px; } #links a { - color: #888; + color: #87aaca; + text-decoration: underline; } #links #result-counter { float: right; @@ -459,9 +460,6 @@ li.tip { #options .help { background: #000; } - #tips .tip { - background: #000; - } .input, .input:active, .input:focus, diff --git a/popup/index.html b/popup/index.html index 49001b6d..832052f1 100644 --- a/popup/index.html +++ b/popup/index.html @@ -48,10 +48,14 @@ diff --git a/popup/js/initSearch.js b/popup/js/initSearch.js index 7d380494..3589db54 100644 --- a/popup/js/initSearch.js +++ b/popup/js/initSearch.js @@ -3,7 +3,7 @@ import { extensionNamespace as ext } from './model/namespace.js' import { getEffectiveOptions } from './model/options.js' import { getSearchData } from './model/searchData.js' import { search } from './search/common.js' -import { addDefaultEntries, addHelp } from './search/defaultEntries.js' +import { addDefaultEntries } from './search/defaultEntries.js' import { editBookmark, updateBookmark } from './view/editBookmarkView.js' import { loadFoldersOverview } from './view/foldersView.js' import { @@ -68,9 +68,7 @@ export async function initExtension() { await addDefaultEntries() renderSearchResults(ext.model.result) if (!window.location.hash || window.location.hash === '/') { - if (ext.opts.enableHelp) { - addHelp() - } + // Placeholder. We could add help-text here. } else { hashRouter() } diff --git a/popup/js/search/defaultEntries.js b/popup/js/search/defaultEntries.js index f4e88210..69f76ed2 100644 --- a/popup/js/search/defaultEntries.js +++ b/popup/js/search/defaultEntries.js @@ -62,59 +62,3 @@ export async function addDefaultEntries() { ext.model.result = results return results } - -export function addHelp() { - const parser = new DOMParser() - var html = helpTexts[(Math.random() * helpTexts.length) | 0] - const doc = parser.parseFromString(`
  • ${html}
  • `, 'text/html') - document.getElementById('result-list').appendChild(doc.body.firstChild) -} - -export const helpTexts = [ - `Customization: This extension can be customized via options in many ways. Please refer to the Documentation (link bottom right).`, - - `Tips on startup: Disable via option: enableHelp: false`, - - `Search Strategies: Switch between PRECISE (faster, exact) and FUZZY (slower, more results, fuzzy).

    - This can be done via clicking on the top-right corner of the popup or by setting it in the options like: searchStrategy: precise`, - - `Keyboard Shortcut: Trigger the extension via keyboard.
    - The default is CTRL + Shift + ..

    - This can be customized in the browsers extensions settings.`, - - `History Size & History: By default the number of history items to load are limited. - Consider increasing or decreasing this, depending on your performance situation and personal preferences:

    - Add / adjust option: historyMaxItems: 1024
    - Add / adjust option: historyDaysAgo: 14`, - - `Open selected results: By default, the extension will open the selected result in a new tab or switch to an existing tab if fitting.

    - Hold Shift or Alt to open the result in the current tab.
    - Hold Ctrl to open the result without closing the popup.
    - Press Right Click to copy URL of result into clipboard without closing the popup.`, - - `Custom Bonus Scores: Append + [whole number] to your bookmark title (before tags).

    - Example: Another Bookmark +10 #tag1`, - - `Custom Bonus Scores: Append + [whole number] to your bookmark title (before tags).

    - Example: Another Bookmark +10 #tag1`, - - `Copy to Clipboard: Right click a result item to copy its URL to the clipboard.`, - - `Search Modes: Use search modes to be more selective.

    - Start your search query with a search mode prefix: - `, - - `Special Browser Pages: You can add special browser pages to your bookmarks, like - chrome://downloads.`, - - `Keyboard Navigation: You can navigate result entries Emacs / Vim Style:

    - Ctrl+N and Ctrl+J to navigate search results up.
    - Ctrl+P and Ctrl+K to navigate search results down.`, -] diff --git a/popup/options.html b/popup/options.html index 2e9c54a8..62edb3b1 100644 --- a/popup/options.html +++ b/popup/options.html @@ -56,10 +56,14 @@