User talk:Mike.lifeguard/removeSpam.js

Latest comment: 9 years ago by Technical 13 in topic Legacy JavaScript
mw.loader.load('//meta.wikimedia.org/w/index.php?title=User:Mike.lifeguard/remote.js&action=raw&ctype=text/javascript');
  • 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.


removespam.js edit

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.

Vanilla edit

  1. Do a search for the domain
  2. 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
  3. Use filter to remove out non-mainspace links
  4. Click remove external links and give it some settings. Normally, the default is fine (so just hit enter for each of 3 dialog boxes).
  5. Then you see the links turn green - click the articles where you want to remove the domain in a new tab/window.
  6. It will automatically open edit view, find the domain and remove it.
  7. 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.
  8. 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.

Using Erwin's tool edit

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.

some regexp hints edit

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)Reply

Please test them and get back to me (preferably ping my talk page)  — Mike.lifeguard | @en.wb 20:31, 4 March 2010 (UTC)Reply

Translations edit

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!

If you are adding a new line, please complete the first two columns as per the example, and add NEW to the third column and that will allow the updating administrator see more easily what needs updating. See the row labelled 'example'.

Language Message Updated?
Default Removing external link: __LINK__ -- per __REPORT__. Translate this summary.
example Removing external link: __LINK__ — as per this__REPORT__. Example of new summary. NEW text 2013-05-16
ar إزالة وصلة خارجية: __LINK__ -- بسبب __REPORT__.
bg Премахване на външна препратка: __LINK__ съгласно __REPORT__.
bn বহিঃসংযোগ অপসারণ করা হয়েছে: __LINK__ -- দেখুন __REPORT__.
bs (1) Uklanjanje eksternog linka: __LINK__ -- prema __REPORT__.
bs (2) Uklonjen vanjski link: __LINK__ -- po osnovi __REPORT__.
ca Llevant l'enllaç extern: __LINK__ -- per __REPORT__.
ckb سڕینەوەی بەستەری دەرەکی: __LINK__ بەپێی __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__.
et Välislink eemaldatud: __LINK__. Põhjus: __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__.
he מסיר קישור חיצוני: __LINK__ -- לפי __REPORT__.
hu Külső link eltávolítása (__LINK__) -- indoklás: __REPORT__.
id Membuang pranala luar: __LINK__ -- per __REPORT__.
it Rimuovo collegamento esterno: __LINK__ -- vedi __REPORT__.
ja 掲載すべきでない外部リンク「__LINK__」を除去) (理由:__REPORT__).
ko 외부 링크 __LINK__ 제거 (이유:__REPORT__).
min Hapuih pautan lua: __LINK__ -- sasuai jo __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__.
pl Usuwanie linku zewnętrznego sprzecznego z Wikipedia:Zasady wstawiania linków zewnętrznych: __LINK__ -- na podstawie __REPORT__.
pt Removendo ligação externa __LINK__ por __REPORT__.
ro Legătura externă __LINK__ a fost ștearsă cu motivul: __REPORT__.
ru Удалена внешняя ссылка __LINK__ согласно __REPORT__.
sh Uklanjanje eksternog linka: __LINK__ -- prema __REPORT__.
sk Odstránenie externého odkazu __LINK__ -- na základe __REPORT__.
sl Odstranjena zunanja povezava __LINK__ -- v skladu z __REPORT__.
sq Largimi i lidhjes së jashtme: __LINK__ -- për __REPORT__.
sr Уклањам спољашњу везу __LINK__ на основу __REPORT__.
sv Tar bort den externa länken: __LINK__ -- enligt __REPORT__.
th ลบลิงก์ภายนอก: __LINK__ -- ตาม __REPORT__.
tr __REPORT__ 'a göre __LINK__ dış bağlantısını kaldırıyor.
uk Вилучена зовнішня посилання __LINK__ згідно __REPORT__.
vi Xóa liên kết ngoài: __LINK__ -- theo __REPORT__.
zh 移除外部链接: __LINK__,根据__REPORT__。
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)Reply
  Fixed -- Dferg ☎ talk 12:51, 29 January 2011 (UTC)Reply
pl translation is ignored Bulwersator 18:36, 20 September 2011 (UTC)Reply
Same for 'bg'. LuchesarT/C 12:47, 21 September 2011 (UTC)Reply
That could be an error on my side. I'll keep an eye on this. EdBever 11:02, 15 October 2011 (UTC)Reply

  Comment I updated all of both here and here. Please tell us if there are errors in the list (of which I hope there aren't). Trijnsteltalk 15:54, 6 November 2012 (UTC)Reply

Yep, and I already found two fixes. ;) Now it should work just fine. Trijnsteltalk 15:59, 6 November 2012 (UTC)Reply

'ko' was added above

  Done updated. — billinghurst sDrewth 06:10, 1 February 2013 (UTC)Reply

'min' was added above. Thanks!

  Done updated. — billinghurst sDrewth 16:20, 16 May 2013 (UTC)Reply

'br', 'sr', 'vi'

  Done updated. and we need a better way to see what needs doing. — billinghurst sDrewth 16:25, 16 May 2013 (UTC)Reply

User note edit

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)Reply

Legacy JavaScript edit

Hello! This script has been detected as using deprecated parameters that need to be replaced with the updated version. Examples include addOnloadHook() needs to be replaced with $(); all wgGlobalVariables need to be properly gotten with mw.config.get( 'wgGlobalVariable' ); and addPortletLink needs to be called with mw.util.addPortletLink. Please see MW:ResourceLoader/Legacy JavaScript for details. Thank you. {{U|Technical 13}} (etc) 16:56, 18 January 2015 (UTC)Reply

Return to the user page of "Mike.lifeguard/removeSpam.js".