Thursday, April 20, 2006
Unhiding CSS Hidden Spam
Those of you that visit my HoneyPot wiki with a Mozilla or Konqueror based browser may notice a change in the display of the spam it collects. CSSHiddenSpam is not hidden anymore. An example can be seen here. Of course, I already have shown how to block CSS Hidden Spam but for those who for some reason don't want to prevent it in the first place (like me), we can at least make it visible for easy removal (or study).
To do it, add the following to the end of your MediaWiki default skin (probably Monobook) at least. For each skin you want to add this to, look in your MediaWiki directory under skins and edit the main.css in the skin's directory.
Update: I added handling of more hiding methods and fixed a bug the styles caused on the wiki Preferences page. Sadly, the bug fix means Konqueror (at least version 3.2) no longer displays the hidden spam.
In addition to adding the overflow handling, Halz pointed out that if allowed, wiki users can have their own sytles. See my exmple user style. By default this is not available, but if the site admin adds $wgAllowUserCss = true; to the wiki's LocalSettings.php, each user can customize the skin. See more about this in the MediaWiki documentation.
Let me know if you run into any other bugs or come up with improvements.
Update 2: Turns out the last bug fix makes this only works on regular wiki pages. I had limited the rule to ns-0, but there are 16 name spaces for pages that allow user content. Spam on pages like talk, help, help talk, user, user talk, catagory, etc. would have remained hidden. To unhide spam for all namespaces and not cause other problems, it requires a lot more selectors.
If the wikis you frequent don't allow user style pages, you can put these rules in your own browser. Check out UserContent.css for Firefox. You might also want to look into site specific styles, but likely these rules would be unusual enough not to trigger on non MediaWiki sites.
To do it, add the following to the end of your MediaWiki default skin (probably Monobook) at least. For each skin you want to add this to, look in your MediaWiki directory under skins and edit the main.css in the skin's directory.
/* Show CSSHiddenSpam so it can be easily removed - by JoeChongq */For those with other browsers, here is what it looks like in Firefox:
.ns-0 * #bodyContent *[style*="none"], .ns-0 * #bodyContent *[style*="auto"], .ns-0 * #bodyContent *[style*="hidden"],
.ns-1 * #bodyContent *[style*="none"], .ns-1 * #bodyContent *[style*="auto"], .ns-1 * #bodyContent *[style*="hidden"],
.ns-2 * #bodyContent *[style*="none"], .ns-2 * #bodyContent *[style*="auto"], .ns-2 * #bodyContent *[style*="hidden"],
.ns-3 * #bodyContent *[style*="none"], .ns-3 * #bodyContent *[style*="auto"], .ns-3 * #bodyContent *[style*="hidden"],
.ns-4 * #bodyContent *[style*="none"], .ns-4 * #bodyContent *[style*="auto"], .ns-4 * #bodyContent *[style*="hidden"],
.ns-5 * #bodyContent *[style*="none"], .ns-5 * #bodyContent *[style*="auto"], .ns-5 * #bodyContent *[style*="hidden"],
.ns-6 * #bodyContent *[style*="none"], .ns-6 * #bodyContent *[style*="auto"], .ns-6 * #bodyContent *[style*="hidden"],
.ns-7 * #bodyContent *[style*="none"], .ns-7 * #bodyContent *[style*="auto"], .ns-7 * #bodyContent *[style*="hidden"],
.ns-8 * #bodyContent *[style*="none"], .ns-8 * #bodyContent *[style*="auto"], .ns-8 * #bodyContent *[style*="hidden"],
.ns-9 * #bodyContent *[style*="none"], .ns-9 * #bodyContent *[style*="auto"], .ns-9 * #bodyContent *[style*="hidden"],
.ns-10 * #bodyContent *[style*="none"], .ns-10 * #bodyContent *[style*="auto"], .ns-10 * #bodyContent *[style*="hidden"],
.ns-11 * #bodyContent *[style*="none"], .ns-11 * #bodyContent *[style*="auto"], .ns-11 * #bodyContent *[style*="hidden"],
.ns-12 * #bodyContent *[style*="none"], .ns-12 * #bodyContent *[style*="auto"], .ns-12 * #bodyContent *[style*="hidden"],
.ns-13 * #bodyContent *[style*="none"], .ns-13 * #bodyContent *[style*="auto"], .ns-13 * #bodyContent *[style*="hidden"],
.ns-14 * #bodyContent *[style*="none"], .ns-14 * #bodyContent *[style*="auto"], .ns-14 * #bodyContent *[style*="hidden"],
.ns-15 * #bodyContent *[style*="none"], .ns-15 * #bodyContent *[style*="auto"], .ns-15 * #bodyContent *[style*="hidden"] {
display: block !important;
overflow: visible !important;
height: auto !important;
visibility: visible !important;
border: 3px solid red;
}
.ns-0 * #bodyContent *[style*="none"]:before, .ns-0 * #bodyContent *[style*="auto"]:before, .ns-0 * #bodyContent *[style*="hidden"]:before,
.ns-1 * #bodyContent *[style*="none"]:before, .ns-1 * #bodyContent *[style*="auto"]:before, .ns-1 * #bodyContent *[style*="hidden"]:before,
.ns-2 * #bodyContent *[style*="none"]:before, .ns-2 * #bodyContent *[style*="auto"]:before, .ns-2 * #bodyContent *[style*="hidden"]:before,
.ns-3 * #bodyContent *[style*="none"]:before, .ns-3 * #bodyContent *[style*="auto"]:before, .ns-3 * #bodyContent *[style*="hidden"]:before,
.ns-4 * #bodyContent *[style*="none"]:before, .ns-4 * #bodyContent *[style*="auto"]:before, .ns-4 * #bodyContent *[style*="hidden"]:before,
.ns-5 * #bodyContent *[style*="none"]:before, .ns-5 * #bodyContent *[style*="auto"]:before, .ns-5 * #bodyContent *[style*="hidden"]:before,
.ns-6 * #bodyContent *[style*="none"]:before, .ns-6 * #bodyContent *[style*="auto"]:before, .ns-6 * #bodyContent *[style*="hidden"]:before,
.ns-7 * #bodyContent *[style*="none"]:before, .ns-7 * #bodyContent *[style*="auto"]:before, .ns-7 * #bodyContent *[style*="hidden"]:before,
.ns-8 * #bodyContent *[style*="none"]:before, .ns-8 * #bodyContent *[style*="auto"]:before, .ns-8 * #bodyContent *[style*="hidden"]:before,
.ns-9 * #bodyContent *[style*="none"]:before, .ns-9 * #bodyContent *[style*="auto"]:before, .ns-9 * #bodyContent *[style*="hidden"]:before,
.ns-10 * #bodyContent *[style*="none"]:before, .ns-10 * #bodyContent *[style*="auto"]:before, .ns-10 * #bodyContent *[style*="hidden"]:before,
.ns-11 * #bodyContent *[style*="none"]:before, .ns-11 * #bodyContent *[style*="auto"]:before, .ns-11 * #bodyContent *[style*="hidden"]:before,
.ns-12 * #bodyContent *[style*="none"]:before, .ns-12 * #bodyContent *[style*="auto"]:before, .ns-12 * #bodyContent *[style*="hidden"]:before,
.ns-13 * #bodyContent *[style*="none"]:before, .ns-13 * #bodyContent *[style*="auto"]:before, .ns-13 * #bodyContent *[style*="hidden"]:before,
.ns-14 * #bodyContent *[style*="none"]:before, .ns-14 * #bodyContent *[style*="auto"]:before, .ns-14 * #bodyContent *[style*="hidden"]:before,
.ns-15 * #bodyContent *[style*="none"]:before, .ns-15 * #bodyContent *[style*="auto"]:before, .ns-15 * #bodyContent *[style*="hidden"]:before {
content:"This section may be spam.";
font-weight: bold;
color: black;
background: pink;
}
Update: I added handling of more hiding methods and fixed a bug the styles caused on the wiki Preferences page. Sadly, the bug fix means Konqueror (at least version 3.2) no longer displays the hidden spam.
In addition to adding the overflow handling, Halz pointed out that if allowed, wiki users can have their own sytles. See my exmple user style. By default this is not available, but if the site admin adds $wgAllowUserCss = true; to the wiki's LocalSettings.php, each user can customize the skin. See more about this in the MediaWiki documentation.
Let me know if you run into any other bugs or come up with improvements.
Update 2: Turns out the last bug fix makes this only works on regular wiki pages. I had limited the rule to ns-0, but there are 16 name spaces for pages that allow user content. Spam on pages like talk, help, help talk, user, user talk, catagory, etc. would have remained hidden. To unhide spam for all namespaces and not cause other problems, it requires a lot more selectors.
If the wikis you frequent don't allow user style pages, you can put these rules in your own browser. Check out UserContent.css for Firefox. You might also want to look into site specific styles, but likely these rules would be unusual enough not to trigger on non MediaWiki sites.
Comments:
<< Home
I'm going to be trying this out with FF plugin "stylish" which allows you to set user styles per URL, DOMAIN or globally.
I've not used it before so I' still just playing really.
Edit
I've not used it before so I' still just playing really.
Edit
Hi, i was looking at the wiki and there is still some spam that isnt visible. If you go to http://chongqed.info/wiki/Spam the spam isnt visible but you can see that something strange is going on.
Edit
Post a Comment
Edit
<< Home