Support for Wikipedia and RationalWiki

This commit is contained in:
shinigami-eyes 2019-01-13 17:16:37 +01:00
parent 1895fec3cf
commit d68309363c
2 changed files with 18 additions and 1 deletions

View File

@ -82,7 +82,10 @@ function createContextMenu(text, id) {
"*://*.twitter.com/*",
"*://medium.com/*",
"*://disqus.com/*",
"*://*.tumblr.com/*"
"*://*.tumblr.com/*",
"*://*.wikipedia.org/*",
"*://*.rationalwiki.org/*",
"*://*.google.com/*",
]
});
}

View File

@ -50,6 +50,15 @@ function fixupSiteStyles() {
`;
document.head.appendChild(style);
}
if(hostname.indexOf('wiki') != -1){
var style = document.createElement('style');
style.textContent = `
.assigned-label-transphobic { outline: 1px solid #991515 !important; }
.assigned-label-t-friendly { outline: 1px solid #77B91E !important; }
`;
document.head.appendChild(style);
}
if (hostname == 'twitter.com') {
myself = document.querySelector('.DashUserDropdown-userInfo a');
@ -418,6 +427,11 @@ function getIdentifierInternal(urlstr) {
}
return null;
}
if (isHostedOn(host, 'wikipedia.org') || isHostedOn(host, 'rationalwiki.org')) {
if (url.hash) return null;
if (url.pathname.startsWith('/wiki/')) return 'wikipedia.org' + takeFirstPathComponents(url.pathname, 2);
else return null;
}
if (host.indexOf('.blogspot.') != -1) {
var m = captureRegex(host, /([a-zA-Z0-9\-]*)\.blogspot/);
if (m) return m.toLowerCase() + '.blogspot.com';