Skip to content

About

Search Slash a simple chrome extension

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SearchSlash

Type slash commands in Google Search and expand them into advanced search operators instantly.

/site github.com becomes site:github.com
/pdf becomes filetype:pdf
/title algorithm becomes intitle:algorithm

SearchSlash is a small Chrome extension built with plain JavaScript and Manifest V3. It works directly inside Google's search box and keeps the workflow keyboard-first.

Why This Exists

Google search operators are powerful, but most people do not remember the syntax when they need it.

SearchSlash reduces that friction. Instead of typing:

site:github.com filetype:pdf intitle:algorithm

you can type:

/site github.com /pdf /title algorithm

and the extension rewrites the query inline.

Features

  • real-time slash operator expansion
  • stack multiple operators in one query
  • lightweight popup with examples
  • no presets, no storage, no heavy UI
  • works directly in Google's existing search field

Supported Operators

With Values

Shortcut Expands To Example
/site site: /site github.com -> site:github.com
/title intitle: /title algorithm -> intitle:algorithm
/url inurl: /url python -> inurl:python
/after after: /after 2024-01-01 -> after:2024-01-01
/before before: /before 2024-12-31 -> before:2024-12-31
/exclude - /exclude tutorial -> -tutorial
/exact " /exact machine learning -> "machine learning"
/related related: /related example.com -> related:example.com
/link link: /link example.com -> link:example.com
/define define: /define recursion -> define:recursion
/cache cache: /cache example.com -> cache:example.com
/author author: /author john -> author:john
/source source: /source bbc -> source:bbc

Without Values

Shortcut Expands To
/pdf filetype:pdf
/doc filetype:doc
/xlsx filetype:xlsx

Example Usage

Single operator:

/site github.com

Result:

site:github.com

Multiple operators:

/site github.com /pdf /title algorithm

Result:

site:github.com filetype:pdf intitle:algorithm

Exact phrase:

/exact machine learning

Result:

"machine learning"

How It Works

The extension injects a content script into supported Google domains. That script:

  1. detects the main search field
  2. listens for typing
  3. finds supported slash shortcuts
  4. rewrites them into Google operator syntax
  5. preserves the cursor position while updating the field

There is no backend, no build system, and no storage dependency for the main feature.

Project Structure

SearchSlash/
├── manifest.json
├── README.md
├── agents.md
├── src/
│   └── content-script.js
├── ui/
│   └── settings.html
└── icons/
    ├── icon-16.png
    ├── icon-48.png
    ├── icon-128.png
    └── searchslash-variant3-source.png

Key Files

manifest.json

Defines the extension metadata, content script injection, popup file, and icons.

src/content-script.js

This is the core logic. It handles:

  • operator maps
  • regex-based replacements
  • /exact quote handling
  • cursor preservation after rewriting the input

ui/settings.html

A simple popup that explains what the extension does and shows supported examples.

Installation

  1. Open chrome://extensions/
  2. Turn on Developer mode
  3. Click Load unpacked
  4. Select this project folder
  5. Open Google and start typing slash commands in the search box

Manual Testing

Test these flows after loading the extension:

  1. /site github.com
  2. /pdf
  3. /title algorithm
  4. /site github.com /pdf /title algorithm
  5. python /exclude tutorial
  6. /exact machine learning
  7. press Enter and verify the final query is correct

Current Limitations

  • only runs on supported Google domains in manifest.json
  • does not validate whether a domain, date, or URL is valid
  • assumes the user already understands what each Google operator means
  • currently focused on Google Search, not other search engines

For Beginners: What To Know Before Building a Chrome Extension

If you are new to Chrome extensions, understand these things first.

1. manifest.json is the entry point

Every Chrome extension starts with manifest.json.

It tells Chrome:

  • the extension name
  • version
  • permissions
  • which scripts run
  • which pages the extension can access
  • what popup or icons to use

If your manifest is wrong, the extension usually does not load.

2. Content scripts run inside web pages

A content script is JavaScript that runs on matched websites.

In this project, the content script runs on Google pages and changes the search input directly through the DOM.

Use a content script when you need to:

  • read page content
  • listen to page events
  • modify the page UI

3. Manifest V3 is the current extension model

Chrome extensions now use Manifest V3. The main difference beginners notice is that background pages are replaced by service workers.

For a small extension like this, you may not need a background service worker at all.

4. Match patterns matter

Extensions do not run everywhere by default.

You must explicitly define where the script runs, for example:

"matches": ["https://*.google.com/*"]

If your pattern is too narrow, the extension seems broken.
If it is too broad, you create unnecessary risk and complexity.

5. DOM work is the real runtime behavior

Most beginner extensions are not complicated because of Chrome APIs. They are complicated because of page behavior.

You need to think about:

  • how the target site structures its DOM
  • whether inputs are replaced dynamically
  • where events actually fire
  • how to preserve cursor position
  • what happens when the page rerenders

6. Keep permissions minimal

Do not ask for permissions you do not need.

Small extensions are easier to reason about, easier to debug, and easier for users to trust.

7. Start with one small behavior

A lot of beginner extensions fail because they try to become a full product too early.

A better approach:

  1. make one thing work
  2. test it on the real site
  3. handle edge cases
  4. only then add more features

SearchSlash followed that path after removing unnecessary preset and dropdown logic.

8. Debugging basics

For Chrome extensions, you usually debug in three places:

  • the extension errors shown on chrome://extensions/
  • the browser DevTools console on the target page
  • the popup DevTools if your popup has logic

If the extension loads but does nothing, check:

  • whether the content script was injected
  • whether the matches pattern is correct
  • whether your target DOM selector still exists

Good Beginner Docs To Read

Before building any extension, spend time with:

  • Chrome Extensions overview
  • Manifest V3 basics
  • content scripts
  • match patterns
  • permissions
  • messaging
  • storage
  • service workers

Read the official Chrome extension docs first. Then use MDN when you need JavaScript and DOM details.

Design Approach

SearchSlash intentionally stays narrow:

  • one problem
  • one input surface
  • minimal UI
  • no setup after install

That keeps the extension easier to maintain and easier to understand.

Status

MVP working.

License

Apache-2.0

About

Search Slash a simple chrome extension

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages