This is a bit of an oddly specific question.
I'm writing a Greasemonkey script that will run across ten domains. The websites all have identical structures, but the domain name for each one is different. For example, the script will run on:
http://first-domain.com/
http://another-one.com/
http://you-get-the-point.com/
I also need it to run on other pages across the same domains, so the list for just one of these domains would be something like:
http://first-domain.com/admin/edit/*
http://first-domain.com/blog/*
http://first-domain.com/user/*/history
Obviously if I'm including these three paths for all ten domains, that's 30 URLs I need to list as @include
s.
So I'm wondering if there's a way to do something like:
// Obviously fake code:
var list_of_sites = ["first-domain", "another-one", "you-get-the-point"];
@include http:// + list_of_sites[any] + .com/admin/edit/*
@include http:// + list_of_sites[any] + .com/blog/*
@include http:// + list_of_sites[any] + .com/user/*/history
If something like this possible, it would cut the list of @include
s from 30 down to 3.
So is this possible, or am I dreaming?
P.S. I know I can just @include http://first-domain.com/*
and then use if
statements to run certain parts of the script on certain paths within that domain, but the number of pages that the script is intended to run on is only about 2% of the site, so it seems wasteful to include the script on every page of each website.