-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathFlagFilter.user.js
More file actions
62 lines (53 loc) · 2.08 KB
/
FlagFilter.user.js
File metadata and controls
62 lines (53 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// ==UserScript==
// @name FlagFilter
// @namespace http://rubberduck.echoreply.us/
// @version 2.4
// @include http*://stackoverflow.com/*
// @include http*://meta.stackoverflow.com/*
// @include http*://dev.stackoverflow.com/*
// @include http*://askubuntu.com/*
// @include http*://meta.askubuntu.com/*
// @include http*://superuser.com/*
// @include http*://meta.superuser.com/*
// @include http*://serverfault.com/*
// @include http*://meta.serverfault.com/*
// @include http*://mathoverflow.net/*
// @include http*://meta.mathoverflow.net/*
// @include http*://*.stackexchange.com/*
// ==/UserScript==
// this serves only to avoid embarassing mistakes caused by inadvertently loading this script onto a page that isn't a Stack Exchange page
var isSEsite = false;
for (var s of document.querySelectorAll("script")) isSEsite = isSEsite||/StackExchange\.ready\(/.test(s.textContent);
// don't bother running this if the user isn't a moderator on the current site
if (!isSEsite || typeof StackExchange === "undefined" || !StackExchange.options.user.isModerator)
{
return;
}
var baseUrl = "https://shog9.github.io/flagfilter/";
var defScript = document.createElement("script");
defScript.type = "text/javascript";
defScript.textContent = "(" + defines.toString() + ")(jQuery,'" + baseUrl + "')";
document.body.appendChild(defScript);
function defines(jQuery, baseUrl)
{
window.FlagFilter = {
baseUrl: baseUrl,
version: 2
};
}
var scripts = ['doT', 'flagTemplates', 'flagfilter'];
for (var i=0; i<scripts.length; ++i)
{
var script = document.createElement("script");
script.type = "text/javascript";
script.src = baseUrl + scripts[i] + ".js?" + Date.now();
document.body.appendChild(script);
}
function reqListener () {
console.log(this.responseText);
}
var styles = document.createElement("link");
styles.type = "text/css";
styles.rel = "stylesheet";
styles.href = baseUrl + "styles.css?" + Date.now();
document.head.appendChild(styles);