Giter Site home page Giter Site logo

sanderronde / customrightclickmenu Goto Github PK

View Code? Open in Web Editor NEW
207.0 22.0 33.0 28.25 MB

A browser extension to add links and run scripts/stylesheets all from your right-click menu

Home Page: https://chrome.google.com/webstore/detail/custom-right-click-menu/onnbmgmepodkilcbdodhfepllfmafmlj

License: MIT License

CSS 3.51% HTML 7.94% JavaScript 13.48% Shell 0.30% TypeScript 74.78%
chrome-extension userscripts userstyles context-menu javascript css chrome

customrightclickmenu's Introduction

Custom Right-Click Menu - Create your own context menu

Create your own entry in the right-click menu. Add custom scripts, links, sub-menus or custom CSS in your right-click menu and do anything you want all from your right-click menu. Featuring full GreaseMonkey compatibility for userscripts and Stylish compatibility for userstyles.

Chrome Web Store Mozilla Add-on

Tested with BrowserStack

Demo

A demo can be found over here. This demo does of course not offer full functionality as it has no access to your actual browser APIs, but it does give a good view of the interface, a little bit of a context menu demo on-page and access to settings.

example

About

Custom CSS

Apply custom CSS styles on the current page based on the page you're visiting. Make them always apply or only when you toggle them on. Create comprehensive changes using a CSS editor with lots of features in the application or simply use your editor by using the CRM External App (source, app (chrome only)). If you want you can also download userstyles from userstyles.org and you can even export your stylesheets as userstyles.

Custom Javascript

Run your own javascript scripts on the current page or simply use ones that someone else wrote by sharing them. You can also write the javascript in the extension itself or use your own editor with the external editor app (source, app (chrome only)). You can also write TypeScript, which is compiled in the extension. Apart from using standard javascript APIs, you can also access the Custom Right-Click Menu's own APIs. These allow you to extend the menu through your own code, which simplifies creating self-contained scripts or sub-menus. Of course featuring a permissions system for any external scripts to make sure they don't spam your menu with copies or run unauthorized scripts. Next to this you can access almost every single browser API without having to go through the hassle of creating a browser extension specifically for it. This allows you to easily increase your productivity by for example automatically creating bookmarks, managing your tabs or even setting alarms. If you're using chromeOS this becomes even better since then you can even change things like your wallpaper and things about the system itself. Apart from creating your own scripts you can use other people's scripts and share your own. Using a very secure system that allows you to manage a script's permissions no harm can be done.

Custom Menus

Create your own menus that are relevant for their own situations. For example, create a menu that lists all frequently used search engines and allows you to add one using a javascript snippet. Making menus and changing where they are visible allows you to make a specific right-click menu for every page and re-use other menus, even being able to show different menu items based on the content you clicked on (page, link, selection, image, video or audio).

Installing

Installing from your browser's web store

2.2.14 is the current latest version on Chrome. 2.2.8 is the current latest version on other platforms.

  • Chrome Webstore - On 2.2.14
  • Firefox Add-on - On 2.2.8
  • Edge Extension - On 2.2.8 certification in progress
  • Opera extension - Under certification for initial release (no changes in review status since submission in may 2018)

Note: 2.2.9 and onwards are downgrades of 2.2.8 to comply with Google's mysterious web store policies, I wouldn't recommend upgrading from 2.2.8 to later versions if you have the choice since some functionality is removed (such as access to browser APIs) and some bugs may appear.

Installing from repo

Clone the repo, run yarn --ignore-engines to install dependencies and run yarn build to build. Load the dist that matches your browser from dist/{browser}.

Developing Scripts

You can develop scripts inside the extension and outside of it. Editing inside the extension features code completion in the Monaco Editor on both the CRM API and regular browser functions. You can edit outside of the extension using your favorite editor while still having type hinting by using the type definition file. You can build these typescript definitions file by cloning the repo, installing all dependencies and running gulp genDefs. The file will then be in /dist/defs/. Alternatively, you can find the documentation for the CRM API online.

The CRM API allows you to edit the current state of the context menu right from a running script. This allows you to do things like create an "add website to menu" button, removing or adding subsections in a menu or even communicating with other running scripts. By also using a background script (which runs at all times and uses the same permissions/API), you can do pretty much everything a browser extension could. The CRM API also features full compatibility with the GreaseMonkey API, so you can use all userscripts. By using the CRM API you can do anything a regular browser extension also can. You can even run this extension in itself (given a fast enough browser).

Entering fullscreen mode brings up a hamburger menu on the left (see the image below) that allows access to the tools ribbon, containing features like using the external editor, adding (your own) libraries, easy search script generation or JSLint.

fullscreen editor

Contributing

If you want to contribute but don't know how to code, you can become a beta tester. If you want to join, send me an email at [email protected]. To install the extension for contributing, simply clone this repo, run yarn --ignore-engines && gulp prepareForHotReload. This allows you to hot reload any changes by reloading the extension in your browser. Load the extension into your browser from the "app/" folder and you're done. Note that the background page uses modules and as such will only work in chrome >= 66 when hot reloading. Run the gulp defs && tsc -w -p app/tsconfig.json command in order to compile any typescript files in the app/ directory as they are changed. You should be able to have your changes in the app folder be reflected to live instantly by hitting ctrl/cmd + r on the options page or clicking "reload" on your browser's extension page.

Tests can be built by running the yarn pretest command. yarn test will fail generally because by default, browser tests are done remotely on Browserstack which requires an access key. To do the browser tests locally, run a Selenium driver instance of the browser you want to test and run yarn test-local. You can run the unit tests (not in a browser environment) locally without a selenium instance by running yarn test:global.

Building isn't really necessary as long as you don't need to export the files as it basically only minifies and removes unnecessary files.

License

The MIT License (MIT)

Copyright (c) 2015 Sander Ronde

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

customrightclickmenu's People

Contributors

beckbusch avatar dependabot[bot] avatar sanderronde avatar tjulises avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

customrightclickmenu's Issues

Extension removed from chrome web store

On the 1st of august, google decided to remove the extension from the chrome web store for being "malicious", along with my developer account. There is absolutely nothing malicious happening in the extension, which is why I am very much surprised by this happening. It seems like some automated system took it down, seeing as it's happened before to another app of mine and ever since every single update I make is under review, with no explanation except for copy-pasted text.

I have sent an email trying to get it reinstated, but seeing as this far talking to them has been like talking to a brick wall, I am very worried about getting it reinstated. I'll try to keep everyone who is confused about the extension suddenly disappearing updated in this thread.

Cannot Import anything

It hasn't been functioning for me at all. It worked before, but it randomly stopped. Reinstalling the extension doesn't work either.

I paste my code, click "Import" (overwrite option selected), and I don't get a message saying the code has been imported. When I access the custom menu, I only see "options".

Options fail to load - Firefox 61.0b11

Hitting F12 shows two errors:

TypeError: menuBrowserAPI is undefined ... options.js:162:9592
TypeError: browserAPI is undefined ... options.ja:154:1734

Logo Proporsal

Hi @SanderRonde

My name is Ulises or TJ if you like,
i'm a graphic designer and I contribute to cool projects (open source) like this one!
if this is something that you're looking forward to, I'll gladly upload some logo proposals

I'll look forward for your reply, cheers!

TJ.

How to use 'instead of http:// use yourscheme:// as a link.'

Hi, I generate a URI pair with clicking the generate button and get a text file downloaded.

Then I change it to .reg file and run it.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\BandicamPortable]
@="URL:BandicamPortable Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\BandicamPortable\shell]

[HKEY_CLASSES_ROOT\BandicamPortable\shell\open]

[HKEY_CLASSES_ROOT\BandicamPortable\shell\open\command]
@="\"D:\\greensoft\\BandicamPortable\\BandicamPortable.exe\""

What should I do now?

To add a link to the CustomRightClickMenu plugin?

qq 20170509233112

But the Chrome just download this .exe file when I right click it, instead of running the program.

How to store data?

Hello, I cant find any tutorial to use CRM.

If I already get data that i want via getSelection() and then where we can store the data? So we can use it later.

Disabling handling of userscript installs

Can I disable it handling the installation of Greasy Fork userscript installs? I tried the global excludes section but it doesn't even keep the setting. On refresh it's gone.

About right click and get anchor href send to context menu variable.

Hello I'm fresh to use this Chrome extension.

I try to write script for some function I want to specify on a site search query.

var query = window.getSelection();
if (query != '') {
var url = "http://sci.abc/??check=true&request=%s";
window.open(url.replace(/%s/g,query), '_blank');
}
else {
window.open("http://sci.abc/", '_blank');
}

But I don't know how to detect the href of the anchor link if I try to select the text with link inside. I want to send the href to query if the mouse is over or right click on the text with <a>

Could you help? Thanks!

Crash while configuring menu

The "config page(?)" crashes while I'm trying to configure it. I managed to add one menu with 3 items, When I try to add more than that the page crashes & I have to reload the page. This has happened several times. I haven't installed it yet, & that makes me have second thoughts about installing it. On top of that it's very unclear exactly how to use it. For example how to add something to a secondary menu vs the main menu. Is that going to continue if I install it, because if so I'll be uninstalling it immediately & giving it a bad review. I don't mean to be harsh, but when I haven't even installed & I'm already seeing crashes It doesn't instill to much confidence that it won't be even worse if I install it.

URI parameters

Can we parse parameters to URI's?
In general the use of parameters ( for example link context menu etc ) is unclear.
You use %s in your presets for search engines.

Question: Possible to use the context menu to execute a keyboard shortcut?

Is it possible to use the context menu to execute a keyboard shortcut? Because I'm using an external (VoIP) application where I can select a phone number and then start calling through pushing a keyboard shortcut. I'd like to map this keyboard shortcut to the context menu for ease of access for myself and others.

Is this extension support url like file:///

Hi,

I'm using the extension and it works well for images on internet, but there seems no effect on local images? I need the file path for local images like "file:///path/to/image.jpg" #

Stylesheets for select sites not working

I went ahead & installed it & it worked until I tried to add a stylesheet for an individual site. I had 3 stylesheets, a black theme, a white theme, & a grey theme. Once I added the custom style (for duckduckgo) it only shows the black theme. I tried just deleting that entry but it didn't fix it. fortunately I had exported the config before adding the site style so I imported that & the other scripts came back.

Unable to select nodes

To export / delete nodes we need to select a series of nodes currently unable to do so

How do you delete a menu item?

Hey man,

Nice project, very handy!

I've got an annoying little problem. I cannot find out how to delete a menu item. How can you delete a menu item?

Thanks brother

Screen Shot 2019-09-15 at 22 22 07

How can I use Greasemonkey functions to copy some modified from the selected text?

image

I try to do this way but failed.

What I wanna to is select text such as

we have recently completed depicting the #COVID2019 #Coronavirus at the centre of the

from the webpage, and CopyMine will le me get a clipboard content of

we have recently completed depicting the COVID2019 Coronavirus at the centre of the

just remove some characters I don't want!.

Newly created Menues

Hello Sander,

thank you very much for the new version 2.2.6. Drag & Drag works now almost perfect. However, I found 2 Issues:

  1. Can't select newly created menus in oder to move items into them.
  2. In some case the menus appears twice. Trying to remove one, removes also the other.

Best
Thomas

The window.getSelection() is not working for the selected text in webpage for searching.

I test this code but the window.getSelection() is not working for the selected text in webpage for searching. How to fix it?

I check out that /*execute locally*/ only makes query = linkurl works but window.getSelection() not.
Thanks.

/*execute locally*/
var query = linkurl || window.getSelection() ;
if (query != '') {
var url = "http://sci.abc/??check=true&request=%s";
  window.open(url.replace(/%s/g,query), '_blank');
}
else {
  window.open("http://sci.abc/", '_blank');
}

How to get highlighted text?

Hi I add 'script' menu only when text is highlighted. then how do we get that highlisgted text via javascript?

Question: how to add script to menu item name

Brand new to the extension. It appears to work with the Install Chrome Extensions Addon for Opera. But, don't get hung up on that. Don't worry about the fact that I'm doing this in Opera.

What I'm trying to do is duplicate Chrome's native "Go to %s" where %s is selected text that's not hyperlinked.

EDIT:
Nevermind Go to %s worked. I need to learn more about the code.

Here's my duplicate of the Chrome function

var query;
var url = "%s";
if (crmAPI.getSelection()) {
	query = crmAPI.getSelection();
} else {
	query = window.prompt('Please select some text');
}
if (query) {
	window.open(url.replace(/%s/g,query), '_blank');
}

crmapi storage cant work on different script?

I have 2 script:

//Script 1: Copy
var value = getSelection().toString();
crmAPI.storage.set("textSelection", value);
//console.log( crmAPI.storage.get("textSelection") ); //it shows the data!

//Script 2: Paste
console.log( crmAPI.storage.get("textSelection") ); //it shows "undefined"

Why crmAPI.storage.get doesnt work cross script? if i put crmAPI.storage.get in the same script as crmAPI.storage.set , it will work

GM_xmlhttpRequest not working

My script worked well couple weeks ago.
But today I got this error

Uncaught TypeError: Cannot read property '_setupRequestEvent' of undefined

on GM_xmlhttpRequest sending a request

Cannot click hold to move items

New user here, thanks for working on this

When I followed the instruction "Click and hold the three stripes () to drag the nodes", it highlighted the current node, but it won't move.

"Also somehow related, is it possible to create / move a node to root? Same level as "Custom Menu"

Unclear how to share code in scripts

Hi Sander,

I want to share a function between scripts. For example in the image below, I want all context menu options to share and run the addLink function. Currently I'm resorting to localStorage to keep the addLink function as string, and eval it to declare.

custom-context

Thanks for the extension!
Robin

Templates for inputs

Greetings!

Is there any way to create some kind of short templates for answer?

For example, i have some chat in facebook and instead of writing answers for my collocutor's questions i'll click on some prepared answers and your extention will append it to the focused textarea?

Thanks for your extension!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.