[18:45:50] Is there a way to block Editing certain namespaces on English Wikipedia? [18:46:56] MediaWiki has namespace-level editing protections yes. [18:47:11] So if the English Wikipedia community asked nicely, maybe... [18:47:19] Also partial blocks at one point was going to be per namespace [18:50:48] Krenair, Bawolff, That was badly explained. I mean me personally self restrict by a script or something to certain namespaces. [18:51:20] I mean, sure, its possible to write a script to kill the edit button on certain namespaces [18:51:20] Your user scripts wouldn't be able to stop you editing via the API. [18:51:36] but then you could easily just remove the script [18:55:00] The aim is it to provide some restriction. I wouldn't plan on editing via API. Would you know how to write that script. [18:56:59] $( function () { if ( mw.config.get( 'wgNamespaceNumber' ) === 1 ) { $( '#ca-edit' ).remove(); } } ); [18:57:03] would do it for talk pages [18:57:19] You could still directly modify the url, but that would kill the main edit button [18:57:24] although not section edit links [18:58:05] I wouldn't advise removing that element from the DOM. [18:58:08] You may break stuff. [18:58:15] you can probably get away with hiding it [18:58:35] $( function () { if ( mw.config.get( 'wgNamespaceNumber' ) === 0 ) { $( '#ca-edit, .mw-editsection' ).remove(); } } ); is a bit better [18:58:49] replace the 0 or 1 with whatever namespace you want [18:59:33] Krenair has a good point, using hide() instead of remove() is probably better [19:00:01] Bawolff, for multiple namespaces would you do === 0 OR 1 e.g. or another method [19:00:47] RhinosF1: Do `[ 0, 1, 2, 3, 4].includes( mw.config.get( 'wgNamespaceNumber' ) )` instead. [19:01:44] Thanks, I was despearately trying to remember the syntax for that and typing random things into the js console :) [19:02:17] bawolff: That's the problem with you ivory tower PHP devs. ;-) [19:02:24] i know, right [19:02:28] is includes new? [19:02:32] * Krenair remembers indexOf [19:02:52] Yeah indexOf sounds familar from back in my JS days [19:03:00] when we had to be compatible with IE6 [19:03:04] and nothing worked ;) [19:03:04] Krenair: ES2016. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes [19:03:24] so yes [19:03:28] I'm assuming that RhinosF1 has a browser made in the past couple of years. [19:03:39] should be fine in user scripts [19:03:50] But not in our client-side code, sadly. [19:04:01] I assume we have a polyfill in case someone tries to add that to site-wide JS? [19:04:02] oh :/ [19:04:05] Chrome OS --> Google Chrome and Chrome on iOS (all latest versions) [19:04:06] * James_F would love Babel integration in RL. :-) [19:04:21] Krenair: No, we have linting rules that scream blue murder if you try to write that, instead. [19:04:31] RhinosF1: Yeah, that'll be totally fine then. [19:04:39] If you want full compat do [ 0, 1, 2, 3, 4].indexOf( mw.config.get( 'wgNamespaceNumber' ) ) !== -1 [19:04:43] i guess [19:04:53] Yes. [19:04:58] https://pastebin.com/wcXbKzut - Would this work? [19:06:04] Krenair: Specifically, for that we have https://github.com/wikimedia/eslint-config-wikimedia/blob/master/language/not-es2015.json [19:06:06] And pastebin goes down [19:06:09] pastebin seems broken [19:06:25] you can use https://phabricator.wikimedia.org/paste/ [19:06:28] I've noticed [19:06:39] or just write the script in your user js and link it [19:07:03] James_F, does that got run against stuff like MediaWiki:common.js though? [19:07:17] I've got WikiBreak enforcer enabled for a bit [19:07:27] oh it loaded now [19:07:30] Krenair: No, it's for real code, not the random hacks community members write. :-( [19:07:38] :\ [19:07:46] you're missing some parenthises [19:07:47] Krenair: Theoretically interface-admins are meant to know what they're doing. [19:07:59] James_F: good joke. Tell another one [19:08:19] (tbf, mostly refering to the obscure language case. enwiki iadmins know what they are doing) [19:08:25] bawolff: OK. MediaWiki has a great, scalable, and dependable security model. ;-) [19:08:34] Bawolff, Where? [19:08:44] James_F: you're on fire today! [19:09:00] RhinosF1: `$( function () { if ( [ 0, 1, 2, 3, 4].includes( mw.config.get( 'wgNamespaceNumber' ) === 0 ) ) { $( '#ca-edit, .mw-editsection' ).hide(); } } )` [19:09:05] :D [19:09:24] RhinosF1: Also, you should probably not do that as an immediately-executed script, as it'll have a race condition on other things. [19:09:35] Its not [19:09:42] $ means onload :P [19:09:48] James_F - That means very little [19:09:51] ondomready i mean [19:10:46] RhinosF1: It means, if the script runs before the page load, then it won't work because it can't hide something that isn't loaded yet. Wrapping the entire thing in a $( .. ) is supposed to fix that by telling your browser to only run it after the page is loaded [19:11:42] Bawolff, It's in a $(..) anyway [19:12:24] yep [19:12:28] So it should be fine [19:26:10] Alternatively, you could just redirect to main page or something if you end up at a certain namespace [19:26:42] Seems more efficient/less funny business [19:28:53] (or just take the wikibreak anyway) [19:30:47] McJill, This is post-wikibreak for longer so I can browse logged in. I'm going to take a WMF wide wiki break until the 11th of Next Month then a namespace restriction on en wiki and try out the other projects.