Google Searching Tags Box

OpenDec
2022-05-09T16:08:05Z

Make your searches easier by adding tags to your search queries with one click

Thank you for your support!

If you like this script you can buy me a coffee :)

What does this script do?

This script adds, just above the search field, a box to store the tags (keywords or snippets) you frequently use in your search queries. So you can reuse these tags with just one click and avoid typing them manually every time you need them.

…

Your tags are saved via the GM API and in a localStorage object, so they remain stored locally in your browser.

You can also use various features to save and transfer your tags as external files or text strings.

Usage

Once the script is installed, the tags box is available by accessing Google search pages.

…

go to "www.google.com" or your country Google page (eg "www.google.co.uk")

in the tags box, just above the search field, you will see the plus button (➕)

type something in the search field (you can highlight the desired text part)

click the (➕) to add and store the text as a tag

you can click (➕) again to change the color of the newly added tag (color is applied randomly)

the tag will be added as a clickable rounded element in the tag (you can add more)

then click on the tags when you want to insert them in your search queries

you can drag the tags inside the box to swap them

you can drag the tags out of the box to delete them

you can use the other context menu features to better manage your tags

Have a good search!

Context menu features

Right click on the tags box to open the context menu.

…

The following features are available to better manage your tags box:

🔠 Tag properties

These features act on the active item of the box.

✏️ Tag text

In the tag a text field is displayed to edit its text.

🏷️ Custom label

In the tag a text field is displayed to apply a custom label.

Custom labeled tags appear with a dashed line below the text.

🟩 Color

A color picker appears above the item (plus button or tag) to adjust its color.

🧰 Edit

↶ Undo, ↷ Redo

A history of the last 30 actions performed in the current session (for the same browser tab) is kept in memory.

You can then undo or redo an action you've performed.

This history is lost when you close the tab or browser.

📋 Copy Tags

Copy the tags to the clipboard as a string in a tags-packet format.

📌 Paste Tags

tags copied to the clipboard are merged with those in the box.

🗑️ Clear the Tags Box

Removes all tags from the box.

📂 Import Tags from txt

Import tags by selecting a text file.

💾 Export Tags as txt

Export tags to a text file via download.

The data in the file is saved in the tags-packet format.

📐 Tags width

Sets the width of the tag elements.

This configuration is stored and saved together with the tags data in the tags-packet format.

In case of importing external data, this setting is restored only if the box has been previously emptied.

Label case

Sets letter-case for text shown in tags.

This configuration is stored and saved together with the tags data in the tags-packet format.

In case of importing external data, this setting is restored only if the box has been previously emptied.

Data transfer features

You can move and manage your tags data using various features and formats

…

Copy-paste

You can copy the tags-packet by pressing Ctrl+C when nothing is selected on the page, or via the context menu.

A blue border flashing will appear around the box when the operation is successful.

By pressing Ctrl+V or via the context menu you can paste this data which will be added to the box.

A blue border flashing will appear around the box and around each added/edited tag.

Drag-and-drop

It is possible to directly drag data into the box.

It is allowed to drag a selected text or an external file.

The box will appear transparent with a blue dashed border around it when you drag something over it.

Supported formats

The data transferred in this way can have different formats.

The tags-packet format

The same used to store data locally in the browser or to export it.

eg:

:tags[A]:first tag#d05fb4RSCustom label::text tag#4678b9RSLabel::Another tag#6237a7

It consists of a prefix :tags:, which may contain configuration data (eg [A] means width "auto"), and a series of tags separated by a non-printable character (RS, Record Separator).

Each tag consists of a label (if defined) followed by ::, the text and the color (7-characters string in lowercase hex notation).

If the color is missing, a random one will be applied when tags are placed in the box.

The plain text format

Plain text is parsed as a list of "newline separated values".

eg:

first tag
text tag#4678b9
Label::Another tag#6237a7

Each line is treated as a tag, so single line text is treated as a single tag.

This way you can easily insert your own tags by selecting content from files or web pages and pasting or dragging it into the box.

Hint

Keep in mind that GM APIs ensures that data is stored permanently in the browser, but you can also save it to external files as a backup to make sure you can always recover it.