DEV Community

Sem
Sem

Posted on • Originally published at semihcelikol.com

1 1

Firefox Add-Ons - Search on Twitter

Hi,
I develop Firefox Add-Ons(extension) tool, selected text > right click > search on twitter

Add-Ons Link: https://addons.mozilla.org/tr/firefox/addon/search-onn-twitter/

Github link: https://github.com/semihcelikol/searchOnTwitter

Manifest.json

    {
        "manifest_version": 2,
        "name":"Search on Twitter",
        "description": "Selected text Search on Twitter",
        "version": "1.0",
        "author": "Semih Çelikol",
        "homepage_url": "http://semihcelikol.com",
        "icons": {
            "48": "icons/icon48.png",
            "64": "icons/icon64.png",
            "96": "icons/icon96.png"
        },
        "permissions": ["contextMenus"],
        "background": {
            "scripts": [
                "background.js"
            ]
        }
    }
Enter fullscreen mode Exit fullscreen mode

background.js

    browser.contextMenus.create({
        id: "tts",
        title: "Search on Twitter",
        contexts: ["selection"]
    });

    browser.contextMenus.onClicked.addListener(contextMenuAction);

    function contextMenuAction(info, tab){
        const url = "https://twitter.com/search?q="+ info.selectionText+ "&src=typed_query";

        browser.tabs.create({url:url});
    }
Enter fullscreen mode Exit fullscreen mode

See more: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/user_interface/Context_menu_items

SurveyJS custom survey software

JavaScript UI Libraries for Surveys and Forms

SurveyJS lets you build a JSON-based form management system that integrates with any backend, giving you full control over your data and no user limits. Includes support for custom question types, skip logic, integrated CCS editor, PDF export, real-time analytics & more.

Learn more

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more