User talk:Mike.lifeguard/removeSpam.js
function importAnyScript(lang,family,script) { //use importScriptURI with the full-qualified source, else importScript(); runs in the context of the remote wiki, finding nothing. importScriptURI('http://' + encodeURIComponent(lang) + '.' + encodeURIComponent(family) + '.org/w/index.php?title=' + encodeURIComponent(script) + '&action=raw&ctype=text/javascript'); } importAnyScript('meta','wikimedia','User:Mike.lifeguard/remote.js');
- Installation of the script at your local wiki add the line
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Mike.lifeguard/removeSpam.js&action=raw&ctype=text/javascript'); to Special:MyPage/monobook.js on each of the wikis where you will be editing.
Contents |
[edit] removespam.js
OK, so on Special:Linksearch you get a tabs for remove external links and filter
- filter will filter out non-mainspace items in the list
- remove external links lets you semiautomagically remove spam.
[edit] Vanilla
- Do a search for the domain
- Take a look at where else it's linked
- If it's linked from IP talk pages, that may indicate spamminess
- If it's linked from article talk pages, that may indicate usefulness
- Use filter to remove out non-mainspace links
- Click remove external links and give it some settings. Normally, the default is fine (so just hit enter for each of 3 dialog boxes).
- Then you see the links turn green - click the articles where you want to remove the domain in a new tab/window.
- It will automatically open edit view, find the domain and remove it.
- It will then load the diff of the edit - verify it as it will make errors in certain situations
- For example if you have the syntax [http://www.domain.com link text] then it will sometimes leave behind "link text" -- this is because it thinks you want the text to remain behind in cases like "Then I went to BestBuy..." so you don't end up breaking the sentence when removing the link. So that is correct sometimes, but sometimes not; you just have to check.
- Make any changes you need to and hit save.
If it ever gives you a diff where nothing changed, then it is because the link is (probably) there, but in plaintext, which it sometimes doesn't find, so you have to do a CTRL-F search for the domain name and remove it by hand. By and large, the script catches most stuff properly, and is certainly very useful.
[edit] Using Erwin's tool
When using ~erwin85/xwiki.php, the rem links will open a new window which runs removespam.js on it. This removes steps 1-5 above. All you have to do is verify the diff, and hit save.
[edit] some regexp hints
Hi!
Maybe you can make some of those regexps more readable/efficient. My (untested) suggestions are:
lines:
old: newtext.replace(new RegExp('^\\s*\\*.*?\\[?https?\\://'+reg+'/?.+?(?:\\s+(.+?)\\]|.*?)$', 'igm'), '');
new: newtext.replace(new RegExp('^\\s*\\*.*?\\[?https?\\://'+reg+'.+?$', 'igm'), ''); // does the same as above, except handling of newlines in a link title
and
citeweb:
old: newtext.replace(new RegExp('(?:<ref(?:\\s*name=["\'].*?["\'])?>\\s*)?\\{\\{\\s*cite[_ ]web\\s*\\|(?:.*?\\|)*\\s*url\\s*=\\s*https?\\://'+reg+'/?.*?\\s*(?:\\|.*?)?\\}\\}(?:\\s*<\/ref>)?', 'ig'), '');
new: newtext.replace(new RegExp('(?:<ref(?:\\s*name=(?:"[^"]+"|\'[^\']+\'|[^ "\']+))?>\\s*)?\\{\\{\\s*cite[_ ]web(?:\\s*\\|\\s*.*?)+url\\s*=\\s*https?\\://'+reg+'(?:.|\\n)*?\\}\\}\\s*</ref>', 'ig'), '');
-- seth 21:33, 4 October 2009 (UTC)
- Please test them and get back to me (preferably ping my talk page) — Mike.lifeguard | @en.wb 20:31, 4 March 2010 (UTC)
[edit] Translations
Note: untranslated edit summaries include a link to RemSpam which redirects to this section.
Please help translate the default edit summary to your language. You can just add it to the table below and we will make sure to update the script. Thank you!
| Language | Message |
|---|---|
| Default | Removing external link: __LINK__ -- per __REPORT__. Translate this summary. |
| bs | Uklanjanje eksternog linka: __LINK__ -- prema __REPORT__. |
| ca | Llevant l'enllaç extern: __LINK__ -- per __REPORT__. |
| cs | Odstranění externího odkazu __LINK__ -- na základě __REPORT__. |
| da | Fjerner ekstern henvisning __LINK__ jf. __REPORT__. |
| de | Externer Link __LINK__ gemäß __REPORT__ entfernt. |
| el | Αφαίρεση εξ. συνδ.: __LINK__ -- κατά το __REPORT__. |
| en | Removing external link: __LINK__ -- per __REPORT__. |
| es | Eliminando enlace externo __LINK__ por __REPORT__. |
| eu | __LINK__ kanpo lotura kendu da arrazoi honegatik: __REPORT__. |
| fa | حذف پیوند به بیرون: __LINK__ بر طبق __REPORT__. |
| fi | Poistetaan aiheesta muualla -linkki: __LINK__ -- per __REPORT__. |
| fr | Lien externe __LINK__ enlevé par __REPORT__. |
| fy | Keppeling om utens __LINK__ fuorthelle oerienkomstich __REPORT__. |
| hu | Külső link eltávolítása (__LINK__) -- indoklás: __REPORT__. |
| it | Rimuovo collegamento esterno: __LINK__ -- vedi __REPORT__. |
| ja | 掲載すべきでない外部リンク「__LINK__」を除去) (理由:__REPORT__ |
| mk | Отстранета надворешна врска: __LINK__ согласно __REPORT__. |
| ms | Mengeluarkan pautan luar: __LINK__ -- per __REPORT__. |
| nb | Fjerner ekstern lenke __LINK__ per __REPORT__. |
| nl | Link naar __LINK__ verwijderd per __REPORT__. |
| nn | Fjernar utlenkja __LINK__ per __REPORT__. |
| no | Fjerner ekstern lenke __LINK__ per __REPORT__. |
| pt | Removendo ligação externa __LINK__ por __REPORT__. |
| ro | Legătura externă __LINK__ a fost ștearsă cu motivul: __REPORT__. |
| ru | Удалена внешняя ссылка __LINK__ согласно __REPORT__. |
| sk | Odstránenie externého odkazu __LINK__ -- na základe __REPORT__. |
| sv | Tar bort den externa länken: __LINK__ -- enligt __REPORT__. |
| uk | Вилучена зовнішня посилання __LINK__ згідно __REPORT__. |
| bs | Uklonjen vanjski link: __LINK__ -- po osnovi __REPORT__. |
| id | Membuang pranala luar: __LINK__ -- per __REPORT__. |
| he | מסיר קישור חיצוני: __LINK__ -- לפי __REPORT__. |
| it | Rimozione collegamento esterno: __LINK__ per __REPORT__. |
| ckb | سڕینەوەی بەستەری دەرەکی: __LINK__ بەپێی __REPORT__. |
| bg | Премахване на външна препратка: __LINK__ съгласно __REPORT__. |
| pl | Usuwanie linku zewnętrznego sprzecznego z Wikipedia:Zasady wstawiania linków zewnętrznych: __LINK__ -- na podstawie __REPORT__. |
| sq | Largimi i lidhjes së jashtme: __LINK__ -- për __REPORT__. |
| tr | __REPORT__ 'a göre __LINK__ dış bağlantısını kaldırıyor. |
- There's a bug in your script, the line
'de' : 'Externer Link __LINK_ gemäß __REPORT__ entfernt.',
- should be replaced by
'de' : 'Externer Link __LINK__ gemäß __REPORT__ entfernt.',
- Cheers axpdeHello! 11:36, 29 January 2011 (UTC)
- pl translation is ignored Bulwersator 18:36, 20 September 2011 (UTC)
[edit] User note
Just to annotate that I am using this (on many wikis), and apart from itWS working well, and if it is ever broken I will have to cry. ;-) billinghurst sDrewth 11:31, 17 December 2011 (UTC)