Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Option to define in which website code shall be run (instead of everywhere) #1

Open
LionelMarbot opened this issue Jan 23, 2015 · 2 comments

Comments

@LionelMarbot
Copy link

Hi,

Thank you for your plugin! It would be great if one could define where the code shall be run automatically, instead of everywhere.

Best would be to be able to define the URL (also using regular expression) per code snippet that is store in the extension.

Thank you!

Best,
Lionel

@jaakkytt
Copy link
Owner

Hi and thanks for the feedback,

I'll consider adding the following script to be available in the global scope but currently didn't want to make that URL testing part of the UI since the use cases I ran into usually lead me to testing for different locations in one script block several times (related addresses on the same website).

What I'm currently running with is a separate code block for self defined helper and background scripts among of which is:

testLocation = function (pattern, callback) {
    if (new RegExp(pattern).test(window.location.href)) {
        if (arguments.length > 2) {
            callback.apply(null, Array.prototype.slice.call(arguments, 2));
        } else {
            callback();
        }
    }
};

@jaakkytt
Copy link
Owner

Currently have some partial code to provide the functionality to define regular expression URL match as a first line of the code block as in the example below. Any better ideas?

#url google.com
document.body.style.background = 'blue';

Sadly lacking the time in the near feature to finish this.

@LionelMarbot LionelMarbot changed the title Feature requeset: Option to define in which website code shall be run (instead of everywhere) Feature request: Option to define in which website code shall be run (instead of everywhere) Jan 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants