What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 128 Stack Exchange communities.

What's the @include sequence that most accurately lists all the SE sites for greasemonkey/userscript hacking purposes?

share|improve this question
add comment

2 Answers 2

up vote 12 down vote accepted
// @include       http://stackoverflow.com/*
// @include       http://meta.stackoverflow.com/*
// @include       http://superuser.com/*
// @include       http://meta.superuser.com/*
// @include       http://serverfault.com/*
// @include       http://meta.serverfault.com/*
// @include       http://askubuntu.com/*
// @include       http://meta.askubuntu.com/*
// @include       http://answers.onstartups.com/*
// @include       http://meta.answers.onstartups.com/*
// @include       http://nothingtoinstall.com/*
// @include       http://meta.nothingtoinstall.com/*
// @include       http://seasonedadvice.com/*
// @include       http://meta.seasonedadvice.com/*
// @include       http://crossvalidated.com/*
// @include       http://meta.crossvalidated.com/*
// @include       http://askdifferent.com/*
// @include       http://meta.askdifferent.com/*
// @include       http://stackapps.com/*
// @include       http://*.stackexchange.com/*
// @exclude       http://chat.stackexchange.com/*
// @exclude       http://api.*.stackexchange.com/*
// @exclude       http://data.stackexchange.com/*
// @exclude       http://area51.stackexchange.com/*
// @exclude       http://*/reputation
share|improve this answer
1  
I'm attempting to be as future proof as possible by including upcoming sites :) –  badp Oct 16 '10 at 13:39
5  
*.stackexchange.com includes all the metas already (and the chats as well, for that matter). The asterisk doesn't care about dots. –  balpha Oct 16 '10 at 16:48
    
also, *.stackexchange.com will also include all future beta sites. –  alexanderpas Dec 12 '10 at 17:23
    
@alexanderpas And that's good, right? –  badp Dec 12 '10 at 17:27
1  
S[OFU], Ask ubuntu, Stackapps and OnStartups are the only Stack Exchange 2.0 sites with an own domain. The other sites are not found, or redirect to the stackexchange.com domain. If you still want to stich to @include rules, I recommend to exclude http://api.*.com/* and http://chat.*.com/*, so that non-SE domain sites are also excluded. –  Rob W Feb 27 '12 at 21:38
add comment

@match rules are preferred over @include, because Chrome will show "This script runs on all domains" when trying to install a User script in Chrome. This syntax is also compatible with Greasemonkey 0.9.8+.

The following rules match all Stack Exchange 2.0 Q&A websites:

// @match          http://stackoverflow.com/*
// @match          http://meta.stackoverflow.com/*
// @match          http://superuser.com/*
// @match          http://meta.superuser.com/*
// @match          http://serverfault.com/*
// @match          http://meta.serverfault.com/*
// @match          http://askubuntu.com/*
// @match          http://meta.askubuntu.com/*
// @match          http://mathoverflow.net/*
// @match          http://meta.mathoverflow.net/*
// @match          http://*.stackexchange.com/*
// @match          http://answers.onstartups.com/*
// @match          http://meta.answers.onstartups.com/*
// @match          http://stackapps.com/*

// @exclude        http://data.stackexchange.com/*
// @exclude        http://area51.stackexchange.com/*

Instead of adding more specific rules to disable the script for /reputation, http://api.*or http://chat.*, I recommend to use a simple check to filter these:

if ( !/^(api|chat)\./.test(location.host) && location.pathname.indexOf('/reputation') === -1) {
    // Actual code
}

If you want to only target questions, use /questions/* at the end of each @match rule. In this case, there's no need to check for api, chat, reputation, data or area51, because /questions/ does not exist on these subdomains.

share|improve this answer
    
Note: All Stack Exchange Q&A sites support the api. prefix. The only exception is OnStartups: The API for this site is available at http://api.onstartups.stackexchange.com/ –  Rob W Feb 27 '12 at 21:30
    
You should exclude the chat sites, right? –  Manishearth May 26 '12 at 20:20
    
@TimManishEarth Yes, see the bottom note. –  Rob W May 26 '12 at 20:21
    
whoops, did not read. :/ –  Manishearth May 26 '12 at 20:23
add comment

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .