[00:00:13] 20 is out? [00:00:22] yes [00:00:22] 21 [00:00:26] dev is 21 ;) [00:00:26] need to update now, really [00:00:31] :) [00:00:32] sitting with 16 here [00:00:36] O_O [00:00:45] http://browsehappy.com/ [00:00:56] 1 month without the internet and that is bound to happen [00:00:57] (Powered by Wikipedia data) [00:01:27] anyways, u want me to just wrap the code in function() {...code...} ? [00:01:37] (function() { ... })(); [00:02:01] You could probably just shove `; false;` at the end [00:02:47] yup, either iether [00:02:49] still crashed [00:03:20] Sid-G: can you paste the full code in a bin? [00:03:24] (not in irc) [00:03:35] I'll try it on http://hi.wikipedia.org/wiki/%E0%A4%AE%E0%A5%81%E0%A4%AE%E0%A5%8D%E0%A4%AC%E0%A4%88 [00:03:40] k [00:07:25] http://pastebin.com/9deY5QXq [00:08:10] Krinkle: see and tell me if that can be in 1 regex [00:08:27] New patchset: Kaldari; "Adding a lot more comments and changing Foo RL module to a less abstract example" [mediawiki/extensions/examples] (master) - https://gerrit.wikimedia.org/r/14273 [00:09:39] Sid-G: Could be, but at least don't manipulate the dom 10 times [00:09:45] change the string then set one [00:09:55] once [00:10:01] use a var? [00:10:15] For example, or just use chaining on the string prototype [00:10:18] but only set v.nodeValue = once [00:10:30] that's going to save some computation I suppose [00:11:24] can .replace be chained into one line? [00:11:38] .replace().replace().replace().... ??? [00:11:42] Sid-G: Yes, but for clarity I'd recommend doing a line-break+tab after each [00:11:43] yes [00:11:50] Sid-G: .replace() is a string function [00:12:04] 'foo'.replace(/o/, 'a') === 'faa' [00:12:09] that you knew [00:12:15] but it also returns a string, naturally [00:12:24] so it makes sense that you can call replace again [00:12:43] Sid-G: As for the regex, you use use /[0-9/ and use a function as replacement value in which you return an object index [00:13:08] the replacement can be function? [00:13:11] Yep [00:13:21] .replace(,function(){})? [00:13:22] New patchset: Kaldari; "Refresh example extensions:" [mediawiki/extensions/examples] (master) - https://gerrit.wikimedia.org/r/13902 [00:13:41] https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/replace [00:13:59] but that would mean a 10-way switch for the return value, right? [00:14:28] var map = { '0': '०', '1': .. }; el.nodeValue = el.nodeValue.replace(/[0-9/g, function ( .. ) { return map[..]; }; [00:14:29] not a switch please [00:14:46] ooh, nice [00:14:50] a hash [00:15:48] yep [00:18:59] Krinkle, hey [00:19:07] I'm trying to do https://bugzilla.wikimedia.org/show_bug.cgi?id=38151 [00:19:15] New patchset: SPQRobin; "Change Incubator preference option" [mediawiki/extensions/WikimediaIncubator] (master) - https://gerrit.wikimedia.org/r/14274 [00:19:38] Krinkle:the func will be return map($1) ? [00:19:52] But var api = new mw.Api(); gives me TypeError: undefined is not a function [00:20:11] Sid-G: Try [00:20:19] It's fine on MediaWiki.org [00:20:20] ok [00:20:45] Krenair: The key is modularity [00:25:59] ok... [00:26:16] 04(REOPENED) Article Feedback - My Contributions - 10https://bugzilla.wikimedia.org/36773 +comment (10Fabrice Florin) [00:29:28] Krinkle: what's wrong in http://pastebin.com/n3LbyQGG ? it doesn't work [00:30:16] Sid-G: put the map outside the function, there is no need to initialize 10 object members every time [00:30:24] and map is not a function it is an object [00:30:54] yes, when did i make map a function? [00:31:09] Sid-G: You didn't, but you're calling it as a function [00:31:14] map(..) [00:31:21] I assume that throws an error [00:31:33] thats exactly what throws the error [00:31:39] a ={} [00:31:40] Object [00:31:41] a(123) [00:31:42] TypeError: object is not a function [00:31:45] exactly [00:31:50] yup [00:32:02] so, treat it like an object, not a function. [00:32:13] got it [00:32:46] Krenair: Did you get what I meant? [00:33:06] Yes but it wasn't relevant to the error [00:33:17] Krenair: Its not an error [00:33:24] 03(NEW) [SRF] 1.8 [patch]: SRF_Gallery.php add new slideshow option (using ResponsiveSlides.js plug-in) - 10https://bugzilla.wikimedia.org/38184 enhancement; MediaWiki extensions: SemanticResultFormats; (jamesin.hongkong.1) [00:33:52] Krenair: Modules are loaded if they are needed. Obviously on the mediawiki.org page you looked there was code that loaded mediawiki.Api because it needed it [00:34:07] Krinkle: It works :D [00:34:27] never rely on another module to load something for you, always declare dependencies. [00:35:04] Krenair: In the console that means mw.loader.load() [00:35:24] in a user script, mw.loader.using(), and in a module, set the 'dependencies' property [00:35:31] Oh I understand now [00:35:33] Krinkle: now all i need is a dropdown menu which passes an input to choose the appropriate mapping (this one or reversed) [00:36:01] Sid-G: Can you paste the code again, and tell me, is it faster? [00:36:30] 03(ASSIGNED) [SRF] 1.8 [patch]: SRF_Gallery.php add new slideshow option (using ResponsiveSlides.js plug-in) - 10https://bugzilla.wikimedia.org/38184 +comment (10MWJames) [00:37:44] Krinkle: well, it didn't crash this time [00:38:34] Krinkle: can it be made faster though? [00:38:47] Of course... [00:39:16] TreeWalker faling back to classic traversal tricks [00:39:18] ZombieDan: How? [00:39:32] Krinkle: http://pastebin.com/gvCQH7PD [00:40:33] ZombieDan: will that be cross-browser? [00:40:37] ZombieDan: That only speeds up the 1ms to get the elements. The main gain potential is in the giant loop and the regexes probably [00:41:11] Krinkle: btw, right now we're only working it on the article content [00:41:11] this way it doesn't walk the dom [00:41:31] Krinkle: we should also be including categories, skin etc [00:41:35] Sid-G: put map outside both loops [00:41:55] Sid-G: then change '#...' to document.body [00:42:02] Krinkle: No the difference to using jQuery for that vs. using a traversal tactic is pretty big [00:42:34] ZombieDan: Its marginal really. * gets all elements, then a loop of that directly. [00:42:37] Huge arrays of nodes. Piles of overhead. etc... there's a lot [00:42:54] ZombieDan: Compared to recursive walking the dom manually, not sure if theres much difference [00:43:00] I'd say put it on jsperf and find out [00:43:09] Krinkle: jsPerf is having some issues right now [00:43:24] yeah, I noticed lately in #jquery-dev some complaints [00:43:29] we use that a lot [00:43:41] But I managed to get one early test in before having issues [00:44:04] The jQuery trick was 99% slower than TreeWalker [00:44:12] It managed around 5x [00:44:23] While TreeWalker did 300+ [00:44:35] btw, we could set the css properties for the list items before this. That'd eliminate some numerals [00:44:39] ZombieDan: Are you talking about that improvised recurser or the one that we're actually working with now with find() [00:45:14] $(...).find('*').andSelf().contents().each(function(k, v) { [00:45:16] Sid-G: No, those are not in the dom [00:45:42] Krinkle: what? [00:45:49] dom=document object model [00:46:24] ohkay [00:46:29] Sid-G: List item styles are not nodes (not accessible nodes anyway, more shadowdom probably) [00:46:30] then we need to do those anyway [00:46:35] yep [00:47:34] Krinkle: the latest one's faster [00:47:41] but still manages to hang the console [00:48:24] ZombieDan: could you write the code for treewalker'ing this? :D [00:49:21] The non-TreeWalker if ( !document.createTreeWalker ) will be more complex than the treewalker code [00:50:36] Sid-G: http://pastie.org/4201795?2 [00:50:38] ZombieDan: ?!? [00:51:01] (raw) [00:51:24] Krinkle: what about the dropdown menu thingy though? [00:51:39] with two options? [00:51:43] Sid-G: Do you expect people to switch back and forth per-page? [00:51:49] You could just make 2 gadgets, as preferences [00:52:44] Krinkle: needs to be for logged out people too [00:52:54] The walker itself will just be something like http://pastie.org/4201803 [00:52:59] Krinkle: I actually had something more on my mind [00:53:15] http://pastie.org/pastes/4201795/text?3 [00:53:36] the pref for logged out ppl could be saved using a cookie maybe? (But that's secondary to actually having a menu ;) ) [00:54:24] Change merged: Kaldari; [mediawiki/core] (master) - https://gerrit.wikimedia.org/r/14150 [00:54:44] http://pastie.org/4201795?4 (optimized on the converter function, moved outside the loop) [00:54:54] so it isn't re-created [00:56:10] http://pastie.org/4201795?5 optimized regex [00:57:55] ok, treewalker is definitely faster [00:57:55] but nobody told me if it works cross-browser? and in ie6? [00:58:24] Change merged: Reedy; [mediawiki/core] (master) - https://gerrit.wikimedia.org/r/9806 [00:58:38] Sid-G: No, you'll need walktheDom as fallback [00:58:41] Or just use that only [01:01:34] Sid-G: http://pastie.org/4201795?8 [01:01:35] how many situations does the treewalker not work in? [01:01:46] That one will work cross-browser [01:02:34] http://pastie.org/pastes/4201795/text?9 [01:03:55] New patchset: Reedy; "Allow API meta=siteinfo to return list of know variable IDs" [mediawiki/core] (master) - https://gerrit.wikimedia.org/r/9866 [01:04:20] Change merged: Reedy; [mediawiki/core] (master) - https://gerrit.wikimedia.org/r/9866 [01:04:40] Krinkle: the last one's treewalker or walkthenodes ? [01:05:24] Krinkle: anyways, the menu pleeeez [01:05:29] Sid-G: treewalker is the same as walkthedom [01:05:46] except that treewalker is a built-in version of it in Chrome [01:06:00] 03(ASSIGNED) Add functions to get some user info - 10https://bugzilla.wikimedia.org/38151 +comment (10Krenair) [01:06:01] so it works only in chrome? [01:06:20] Sid-G: Don't take my word for it, try it! [01:06:36] Krinkle: will do. [01:06:57] Sid-G: treewalker is new, walkthedom has the same speed advantage (slightly less than treewalker since it is still user land) [01:06:58] The menu needs doing right now though [01:07:08] I'm not doing anything right now [01:07:18] pretty pleeez [01:08:12] Sid-G: You've come a long way, now it is time to take it all and learn from it. Making the many is going to be a lot more work. This is just the beginning. [01:08:21] Change abandoned: Kaldari; "superceeded" [mediawiki/extensions/examples] (master) - https://gerrit.wikimedia.org/r/14273 [01:08:44] Krinkle: You do know that I'm not into computers professionally [01:09:20] Sid-G: This may be too much for you at this moment in time, so perhaps post the logic you have (http://pastie.org/4201795) on wiki and ask someone in your community to make the gadget. [01:09:26] New patchset: Kaldari; "Adding a lot more comments and changing Foo RL module to a less abstract example" [mediawiki/extensions/examples] (master) - https://gerrit.wikimedia.org/r/14275 [01:09:58] e.g village pump [01:09:59] Krinkle: Have u seen anyone other than me from my community in here? [01:09:59] 03(mod) Render interlanguage links in SkinTemplate.php sidebar ucfirst per context language rules - 10https://bugzilla.wikimedia.org/37705 +comment (10Robin Pepermans (SPQRobin)) [01:10:02] or on meta-wiki [01:10:23] Sid-G: I don't know where people are from honestly [01:10:40] I know some people know hebrew though [01:10:47] I don't know who , but I know there here, somehwere [01:10:49] sometimes [01:11:34] somewhere, sometimes.... (sounds like "A long, long time ago... in a galaxy far, far away") [01:12:03] a bit yeah :P, but seriously there are hebrew people in this channel, but even if not. they don't have to be hebrew to help you (!) [01:12:21] now I'm going back to other thigns [01:12:26] ok [01:12:39] thanks a ton for the help [01:12:43] You're welcome :) [01:12:55] which wiki do u want a barnstar on? [01:13:24] If you insist, lets say Commons. [01:13:30] Thanks :) [01:13:35] okey-dokey, commons it is :D [01:15:36] btw, should i wait till a menu is created or just build this into two gadgets till then? [01:21:02] Krinkle: http://jsperf.com/textwalker [01:25:13] ZombieDan: got 55/2/4 here [01:25:21] Sid-G: 2 gadgets :) [01:26:04] :) [01:26:06] Sid-G: Note that you can also make it load for anonymous users (one of them at least). Have you decided on a default? [01:26:07] Chrome 19... [01:26:18] http://pastie.org/pastes/4201795/text?9 is the final one right? [01:26:37] Krinkle: ;) Looks like you have a faster laptop [01:26:38] Krinkle:There can't be a default without consensus [01:27:09] ZombieDan: you mean you have? Oh these bars are confusing [01:27:09] I see [01:27:33] I suppose I do. Or Chrome 19 has a magic optimization for this [01:27:44] lol... I doubt it [01:27:51] wait what? Why am I on 19 [01:27:56] lol [01:28:15] Krinkle:Thats why i wanted the cookie thing for anons. that way, we could track the statistics anonymously (like RTRC) to decide on a default. [01:28:17] In any case I'm only running on a MacBook Air [01:28:24] I'm on a Pro [01:28:26] literally [01:28:26] With piles of other stuff running at the same time [01:28:49] and lots of stuff (rendering hd at the moment and some shell execution) [01:28:49] Krinkle: Trying to crush it? [01:29:06] Krinkle: btw, what would happen if someone turns on both gadgets? [01:29:20] Sid-G: It would be the best ever [01:29:41] 50% chance [01:29:45] whichever gets last [01:30:18] Krinkle: http://pastie.org/pastes/4201795/text?9 is the final one right? [01:31:10] let me check [01:31:24] made it === for faster comparison http://pastie.org/pastes/4201795/text?10 [01:31:31] ZombieDan: Any suggestions? [01:32:41] For non-TreeWalker traversal tactics? [01:32:49] right [01:33:17] I suppose I could move the second argument to walk to a named function and pass it to walk or native walk respectively [01:33:20] Ditch the recursion entirely [01:33:24] ? [01:33:33] There are two other ways to do this... [01:33:51] Firstly the tactic of turning a recursive pattern into a linear queued loop [01:36:11] var queue = [document.body]; while( queue.length ) { var node = queue.shift(); if ( node.nodeType == 3 ) { node.nodeValue = 'x'; } else { for ( var i = 0, l = node.childNodes.length; i < l; i++ ) { queue.push( node.childNodes[i] ); } } [01:36:15] Something like that [01:36:30] But since this is a dom you can actually get away with ditching the queue entirely [01:37:35] Sid-G: This is from Roman to Devanagari, right ? [01:37:57] ZombieDan: hm.. [01:38:16] Basically you go n = n.firstChild -> n = n.firstChild -> ... until n.firstChild doesn't exist at which point you use n = n.nextSibbling and go back to firstChild. Once neither of those work you use parentNode and move on to the nextSibbling [01:38:37] queue.push.apply( queue, childNodes ) [01:38:38] :D [01:38:45] Heh... right, forgot [01:39:00] Though not sure, you might actually have to splice those [01:39:01] not sure if that works, but seems attractive [01:39:07] yeah, [01:39:08] slice* [01:39:40] That's a trick I use in a lot of cases where it looks like I'm going to be doing functional recursion for more than a few levels [01:40:01] ZombieDan: How is that different from walk the dom, in essense? [01:40:12] Which one? [01:40:16] the last one [01:40:33] It too would be done in a single loop [01:40:38] And it wouldn't have a queue [01:41:09] Memory wise it would be the O(1) way to do this. [01:41:11] ZombieDan: walkTheDOM doesn't appear queue-like? [01:41:30] Krinkle: It's a recursive function [01:41:47] right [01:41:55] yours would be a recursive loop [01:42:03] I'm saying that third tactic is a non-recursive linear loop with no recursive functions or queues [01:42:08] No... [01:42:09] instead of a loop inside a recursive function [01:42:15] I guess it's hard to convey without actual code. [01:42:28] *sigh* have to pause the work timer again [01:43:45] There may be a logical different, but in essence walking the dom top to bottom seems effectively the same as doing it linear. walking may be more efficient because it doesn't go back up to the same elements it was already in [01:44:28] could be better in performance though [01:44:29] i.e. no parentNode [01:44:47] Sid-G: This is from Roman to Devanagari, right ? [01:44:48] [03:37am] [01:44:50] * Sid-G waits [01:45:03] Krinkle: 7:14am [01:45:14] Krinkle: both ways is needed [01:45:26] Krinkle: so that the anons can choose [01:45:27] I know, but I want to give my file a name :) [01:45:37] this is roman to Devanagari, right? [01:45:37] arabic to nagari [01:45:48] these are arabic numerals: 123 [01:45:59] roman numerals are : I II III [01:46:06] oh, right [01:46:13] I tend to consider everything in europe to be roman :P [01:46:16] the other ones are nagari/devanagari [01:46:55] so u guys are coming up with a better performing code? [01:47:07] i should wait before putting up the gadgets? [01:48:45] ? [01:50:50] I'm integrating performance improvement for new browsers with createTreeWalker [01:50:57] should be enough for now [01:51:39] Krinkle: Conceptually this pattern is hell to think about... but here's some untested code that 'should' implement that pattern [01:51:42] http://p.defau.lt/?bnvrNEOWkYRKiY5SgIZppg [01:51:43] i'm sitting ready to add the gadgets, two blank gadget pages and gadgets-definition open :D [01:52:24] Sid-G: http://pastie.org/pastes/4201795/text?12 [01:52:46] Sid-G: This is a lot faster than the old version, only for modern browsers. It has a fallback to the other method for older browsers [01:52:48] best for both [01:53:01] ZombieDan: createTreeWalker is really fast! [01:53:20] Krinkle: Yup... it's a native api [01:53:38] Krinkle: why is it inside an anonymous function?' [01:53:38] Well... except for Firefox it appears, which could use some improvements to it's dom engine [01:53:51] Sid-G: Module pattern, to avoid scope leakage [01:54:12] Krinkle: that's supposed to be kept that way on-wiki? [01:54:28] Since we're talking gadgets now instead of little snippets, I thought it'd be appropiate to add a closure and a doc comment [01:54:28] Sid-G: yes [01:54:35] and: what in this gadget did i write? [01:55:04] i do need to add this: [01:55:05] $('ol:lang(hi) li, ol.references, li.references').css('list-style-type','devanagari !important'); [01:55:20] inside the function or outside? [01:55:38] don't use !important [01:55:55] Krinkle: its already specified as decimal in common.js [01:56:04] doesn't matter [01:56:08] k [01:56:13] this is style properties [01:56:17] those only have one value [01:56:25] any time it is set, it is overridden [01:56:32] btw, within the anon function or outside it? [01:56:35] outside the functions, but inside the closure [01:58:01] http://pastie.org/4202008 ? [01:59:18] Krinkle: ? [01:59:23] Sid-G: No, actually,don't out it in javasceipt [01:59:35] there is no need to manipulate the style property of each list [01:59:42] use a gadget css file [01:59:47] that's what its for [01:59:49] ok [02:00:03] one more page to create and maintain [02:00:06] though [02:00:23] its faster [02:00:27] ok [02:00:39] http://pastie.org/pastes/4201795/text?13 [02:01:56] so this is it then, or any revisions to do? [02:03:18] Krinkle: ? [02:03:22] yes, we can reduce the scope chain lookups [02:03:46] http://pastie.org/4201795?15 [02:04:07] remove my name from the authors next time btw [02:04:43] i haven't actually done anything in this (except asking you for help) [02:05:45] as you wish [02:05:49] http://pastie.org/pastes/4201795/text?16 [02:06:09] ZombieDan: very interesting model, got a jsperf for that? [02:06:29] No... didn't feel like perfecting that code [02:06:34] btw, just flipping the map will make the other gadget, right? [02:06:41] the lack of tail recursion optimization in js will probably make that linear one win even better [02:06:50] Sid-G: Pretty much, yes. [02:06:58] Sid-G: Eh, and the regex [02:07:05] oh yeah [02:07:08] You'll have to figure that out somehow [02:07:14] btw, no chance of combining them right now? [02:07:22] no, not right now [02:07:39] I know the regex, that's not a problem :P [02:07:59] okay [02:08:03] added a date: http://pastie.org/pastes/4201795/text?17 [02:08:16] ./(0|1|2|3|4|5|6|7|8|9)/ [02:08:21] without the . [02:08:33] uh? [02:08:45] that's going to mach Devanagari numerals? [02:08:47] regex, just change the numerals to devanagari [02:08:51] no [02:08:52] right [02:08:59] i have a non-unicode irc client [02:09:12] ? : thats a devanagari 0 [02:09:16] for arabic numerals 0-9 is nice though [02:09:23] yeah [02:10:05] can't we just create a simple html dropdown box, position it in the top bar, and bind event handlers to it; right now? [02:10:24] that'll get rid of the two gadget problem [02:11:35] ? [02:12:42] Krinkle: ? [02:12:57] Sid-G: I'll see what I can do [02:13:24] * Sid-G waits :D [02:19:37] any progress? [02:20:22] Krinkle:? [02:20:43] Sid-G: Come back tomorrow, this will take a while [02:21:01] ok, I'm not putting this up till then. :) [02:21:45] btw, u could lift the code from narayam or webfonts [02:23:03] https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/Narayam.git;a=blob;f=resources/ext.narayam.core/ext.narayam.core.js;h=ce0b0bfb6e21f83a545fa29f8ad8ac5659d56c12;hb=HEAD [02:23:33] the menu creator function is at the bottom [02:24:28] the portal bar next to username it too full [02:24:29] I'm going to put this somewhere else [02:24:41] ok [02:25:04] just keep in mind it should be easily visible for anons [02:25:08] sure [02:25:16] thanks [02:26:08] New patchset: Mwjames; "(bug 38094) add new tagformat parameter and sphere support - add parameter [excludetags] in order to filter tags that should not occur in the result set because it might their distort set content - clean up indentation" [mediawiki/extensions/SemanticResultFormats] (master) - https://gerrit.wikimedia.org/r/13637 [02:26:10] btw, would it be possible to store the anon ppl's prefs using a cookie or something? [02:26:42] Sid-G: yes [02:27:01] BIG LOOPHOPE: we forgot the editing pages and the editbox in the preview page [02:27:07] *LOOPHOLE [02:27:30] we dont want to be modifying the wiki text [02:27:31] Sid-G: Can you share the css for the other direction? [02:27:42] Sid-G: I'll skip input fields and textareas [02:27:49] ok [02:27:56] what css? [02:28:09] that one line? [02:28:16] change devanagari to decimal [02:29:39] ah, ok [02:33:02] oh, btw; if its going to be turned on for even anons; will there be a way for logged-in ppl to turn it off? [02:33:46] meaning not have the menu show up at all? [02:34:36] Sid-G: Yes [02:34:42] they can turn it off in Gadgets under preferences [02:34:54] Krinkle: Btw, for anons neither of the conversions should be enabled by default, just the menu should show up [02:35:02] k [02:35:05] ohkay [02:35:16] New patchset: Vlakoff; "Micro-optimizations in jquery.cookie.js" [mediawiki/core] (master) - https://gerrit.wikimedia.org/r/14276 [02:35:29] so adding default in the gadgets-definition enables it for anons too.... cool [02:36:18] anions have preferences too, they just can't change them [02:36:33] interesting [02:36:38] (uselang, table of contents, skin etc. those all have "something" as value) [02:36:46] I mean, they do see a skin [02:36:53] those are the default user preferences [02:36:55] hmm, good point [02:37:10] [default] makes the preference the default preference (checkbox enabled) [02:37:26] just learned that today [02:37:34] which automatically means anonymous users see it and everyone else can turn it off/on as they want [02:39:04] New review: Krinkle; "jquery.cookie is a third party library. Please submit these as pull request upstream (the url is in ..." [mediawiki/core] (master); V: 0 C: -1; - https://gerrit.wikimedia.org/r/14276 [02:39:34] btw, the css manipulation will have to be via the js now that we'll have a single gadget, right? [02:40:12] yes [02:40:22] Sid-G: But even in js one can add