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 requeset: 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

Projects
None yet
2 participants
@LionelMarbot

LionelMarbot commented Jan 23, 2015

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

This comment has been minimized.

Show comment
Hide comment
@jaakkytt

jaakkytt Jan 25, 2015

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();
        }
    }
};
Owner

jaakkytt commented Jan 25, 2015

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

This comment has been minimized.

Show comment
Hide comment
@jaakkytt

jaakkytt Oct 16, 2015

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.

Owner

jaakkytt commented Oct 16, 2015

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment