[01:14:24] Can anybody tell me (a not-so-technical type) if there is some mechanism for conditionally loading a piece of Javascript,on only *some* Wikipedia pages? (i.e. where invoked by a template) [01:15:11] I ask because I'm trying to get http://enwp.org/Template:MTime to work -- it is currently working *for me* because I have the required JS in my vector.js file -- [01:16:12] but I'm looking for a way to publish a meeting time, such that each user would be able to easily see the local time per his/her browser's time zone setting. (Or MediaWiki preference's time zone setting, that would be OK too.) [01:34:04] ping Danny_B ^^ [01:34:18] ping greg-g [01:36:19] um [01:36:40] if ( mw.config.get('wgPageName') == 'PageName' ) { dosomejavascript; } [01:37:07] other than that, not really. [01:37:46] legoktm: thanks -- I don't know JS, so can't understand your answer -- can you explain a little? [01:38:27] do you know the page titles beforehand? [01:38:34] or do you want it to run on every page if loaded? [01:38:41] if the template is loaded* [01:38:48] was hoping to have it invokable by adding a template to a page. [01:39:28] Use case is" [01:39:34] so you can wrap the template in something like
template stuff
[01:40:06] I create a page in Wikipedia namespace for an event (say, WMF staff office hours) [01:40:07] then your javascript, you can just add if ( $('.mtime-template').length ) { whatever javascript you wanted here; } [01:40:49] I add {{Template:MTime|time}} to the page in a way that it displays, by default, as "9:30AM Pacific Time" [01:41:13] but when the user in New York hovers over it, they see a popup that says "12:30PM Eastern Time" [01:42:07] why not just link to a website like timeanddate.com? [01:42:33] that's what I've been doing -- it works, but is less than ideal for many reasons [01:43:11] it's working on wikieducator.org, but it relies on a widget -- and as I understand it widgets are disabled on enwp [01:43:39] use a gadget? I'm not sure what widgets are [01:44:29] widget, as I understand it, is conditional javascript loading only on certain pages. I think the problem with a gadget is that it requires a user to set the preference ahead of time -- which means that non-logged in users will not get the benefit [01:44:54] more authoritative info: https://www.mediawiki.org/wiki/Extension:Widgets [01:46:04] ah [01:46:08] you can enable a gadget by default [01:46:17] I think I get what you're saying, though -- it's to create a style sheet that contains the js, and only gets invoked if I use the
statement? [01:46:19] works for anon users too, and logged in users can disable if they choose to. [01:46:26] uh no, the js would go in a .js page [01:47:01] If done as a gadget, wouldn't that mean the JS gets loaded for every single Wikipedia page? Seems wasteful and unkind to those on dialup etc. [01:47:12] (Or am I misunderstanding how it works?) [01:47:57] yes that would be how it works [01:48:15] OK, so back to your suggestion above --
[01:48:27] where does the "mtime-template" class get defined? [01:48:53] in that line [01:49:38] And how does the .js page fit in? What would its title be? [01:49:53] MediaWiki:Gadget-name.js I think [01:50:09] You'd need to write some js that converted the time to the user's timezone [01:50:54] I think that part exists though -- see https://en.wikipedia.org/wiki/User:Peteforsyth/vector.js [01:51:33] Let me take this idea back to the guy who developed it on WikiEducator -- I bet he knows enough to act on your suggestion :) [01:51:46] and I think this is a nudge that it's about time I learned some JS.... [01:54:19] Just to recap and make sure I get it at a high level...the JS that is now in my vector.js file would instead live in a .js file specific to the gadget, and accessible to all users who have the gadget enabled -- which would include anonIP's if it were enabled by default [01:54:34] yes! [01:55:13] the part I still don't really get is now the
line fits in [01:55:55] does the javascript from the gadget only get loaded if there is a relevant
line on the page? [01:57:11] no [01:57:20] the div line is to check whether to load all the javascript [01:57:26]
is basically an identifier [01:57:35] (
with the class="blah") [01:57:59] the javascript ($('.blah').length part) looks for that identifer, if it finds it, it loads the rest [01:59:41] OK, I think I see. Thank you so much for the explanation! [02:00:23] It seems like it would be worthwhile to make it a gadget -- that way at least it would be possible to use with a known group of users, like in an online course. [02:00:46] Just make sure they all enable the gadget in their preferences, when they enroll for the course. [02:00:56] yeah [02:03:38] I'm assuming that having the "widget" extension turned off on enwp is an intentional choice -- having access to that would really be the ideal solution :) [10:01:07] I don't get the "Content-Length" header from ja.wikipedia (or any other WM wikis) - is this the normal behaviour? [10:11:41] for some things I still see it, e.g. [10:11:43] curl -i https://bits.wikimedia.org/ [10:17:22] last search results for "normal" stuff are around January http://www.gossamer-threads.com/lists/wiki/mediawiki/324923 https://www.mail-archive.com/wikibugs-l@lists.wikimedia.org/msg191499.html [10:38:45] Nemo_bis: hmm, https://bits.wikimedia.org/ serves a static content, that might make a difference [10:45:12] yep [11:24:02] whym: i have them.. [11:24:17] though not for some load.php requests. [11:30:50] thedj[work]: do you see the header for https://en.wikipedia.org/w/index.php?title=Main_Page too? [11:40:07] Content-Length18414 [11:40:18] uncached of course [11:42:49] whym: anonymous, i don't get content length, but that is logical [11:42:53] because you get: < Transfer-Encoding: chunked [11:46:43] if your system doesn't support chunked transfer encoding, then it should make an HTTP 1.0 request instead of an HTTP 1.1 request [12:44:49] thedj[work]: with "curl -0" (enforcing HTTP 1.0), as I understand, I should get Content-Length, but I don't. [12:46:21] curl -I -0 https://en.m.wikipedia.org/wiki/Main_Page\?action\=purge [12:46:27] gives http://snipt.org/BqF4 [13:02:45] whym: ah it seems that we don't support http 1.0 then [16:40:36] I did a checkuser on enwiki on a /20, asking for a user list. I got an "Our servers are currently experiencing a technical problem. This is probably temporary and should be fixed soon. Please try again in a few minutes." [16:40:36] Is it actually safe to try again, or did I just cause a timeout and trying again won't do much? [16:42:34] lfaraone: If it's just one request at a time I doubt you'll do that much damage, but I stop short of saying so definitively :) [16:45:18] here we go, completed this time [16:47:39] Yay! [16:47:57] * marktraceur glad his advice didn't have universe-shattering consequences [16:48:00] sadly the output didn't actually end up being useful. [16:48:07] Aw. [16:48:21] "if your request causes timeouts, its likely to be more data than you'll be able to process as a human" [16:48:44] Or it's doing loads of joins, I guess [17:37:05] lfaraone: just keep refreshing, don't worry [17:37:18] Keep Calm and F5 On [17:37:29] * marktraceur is just gonna go ahead and make that shirt now [17:37:32] there are some bugs filed about checkuser slowness [17:37:38] :) [17:38:17] Ahhhh it exists already [17:38:26] too bad [17:41:14] hah [17:41:51] marktraceur: you know https://commons.wikimedia.org/wiki/File:Keep-calm-and-click-edit.svg ? [17:42:12] Heh, awesome [17:42:31] *edit source [17:42:35] The F5 t-shirt I found is imperfect [17:42:40] Nemo_bis: edit(beta)* [17:43:50] I love that I get to [[Project:Criteria for speedy deletion]] by going through mindspillage's parody of "Like a G6" [17:44:05] It an endless source of awesomeness [17:44:49] "Keep Calm and G5 On" might be interesting [17:44:54] https://en.wikipedia.org/wiki/Wikipedia:Criteria_for_speedy_deletion#G5._Creations_by_banned_or_blocked_users [19:29:15] Nemo_bis: "keep calm and resubmit" [19:30:55] :)