[10:14:16] mvolz, mobrovac: http://en.wikipedia.beta.wmflabs.org/w/index.php?title=User:Josve05a-beta/sandbox&redirect=noI get different results if I cite the doi (bad citation) or the doi.org-link to the doi (better citation). [10:15:21] what gives? [11:19:17] 10Citoid, 10VisualEditor: Citing doi vs link to doi.org gives different results - https://phabricator.wikimedia.org/T106975#1483238 (10Josve05a) 3NEW [14:14:20] 10VisualEditor-LanguageTool: Weekly Reports for LanguageTool Extension for VisualEditor - https://phabricator.wikimedia.org/T101695#1483347 (10NiharikaKohli) Hi @ankita-ks, keep the reports updated please. :) [14:23:57] 10VisualEditor-LanguageTool: Weekly Reports for LanguageTool Extension for VisualEditor - https://phabricator.wikimedia.org/T101695#1483363 (10Ankita-ks) @NiharikaKohli, on it now. :) [14:54:53] (03CR) 10Fomafix: "Looks good, but not deeply reviewed." [extensions/WikiEditor] - 10https://gerrit.wikimedia.org/r/226676 (https://phabricator.wikimedia.org/T25479) (owner: 10Gerrit Patch Uploader) [16:43:32] 10Citoid, 10VisualEditor, 5Patch-For-Review: Citing doi vs link to doi.org gives different results - https://phabricator.wikimedia.org/T106975#1483458 (10Mvolz) Caused by absent cookie while following redirect; there's a patch in for this already, I need to review it :) [17:20:13] 10Citoid, 10VisualEditor: Citing Reuters.com gives Reuters as a work, should be agency - https://phabricator.wikimedia.org/T106892#1483500 (10Mvolz) The metadata looks okay: http://citoid.wikimedia.org/api?format=mediawiki&search=http%3A%2F%2Fwww.reuters.com%2Farticle%2F2011%2F05%2F25%2Fglencore-hkdebut-idUSH... [17:22:43] 10Citoid, 10VisualEditor: Citing news on sv.wp gives work as title - https://phabricator.wikimedia.org/T106891#1483502 (10Mvolz) http://citoid.wikimedia.org/api?format=mediawiki&search=http%3A%2F%2Fquery.nytimes.com%2Fgst%2Ffullpage.html%3Fres%3D9C03E1D6113EF933A25752C1A962958260 http://citoid.wikimedia.org/a... [17:26:48] 10Citoid, 10VisualEditor: Citing Reuters.com gives Reuters as a work, should be agency - https://phabricator.wikimedia.org/T106892#1483505 (10Josve05a) The metadata says "publicationTitle":"Reuters". This may be true, but it should not be referred to as a "work" when citing on Wikipedia, but as an "agency" (Th... [17:49:06] we have a JS tool which edits wrong dictation word on a text. how can i run it on virtual editor environment? [17:51:46] We uses this JS code on edit and view and it works fine but also we want to have it on virtual editor. [17:53:32] reza1615_: You mean visual editor not virtual editor? :) [17:53:56] :) yes visual editor [17:55:50] reza1615_: Should it be automaticlly replaced by the script or after clicking on some button in toolbar? ( Strainu from Romanian Wikipedia created a script for automatic replacment on save) [17:56:24] now it asks "are you sure?" [17:56:45] but we can ignore this part of code and doing automatice edit [17:56:59] automatic* [17:58:13] reza1615_: take a look in https://ro.wikipedia.org/wiki/Utilizator:Strainu/ve.js [18:00:09] eranroz: thnaks :) [18:04:14] reza1615_: If you write a gadget/script for it for fawiki, please add it to https://www.mediawiki.org/wiki/VisualEditor_gadgets#Real_examples_for_gadgets.2Fscripts_that_interact_with_VE [18:04:39] We are trying to create a collections of scripts so powerusers will be able to reuse them [18:05:36] eranroz: sure I will add it to the list. (how did you know we want it for fawiki :) ) [18:05:59] just a guess :) [18:07:07] :) another question [18:07:42] for example I edit a text after pree save it should run a function [18:10:05] how can i get new text (changed text by user?). my function get text from api it by sure it will be before users edits (with visual editor) so using that text will undo user's change [18:12:42] reza1615_: I'm not sure I understand the question. Do you want to do the replacement when the user starts to edit? [18:13:38] no after user do the edit i want to edit whole text by automatic code. the code should get the last text to do functions on it [18:13:38] BTW: I strongly recommend to avoid presave hook - VE sends the data when you open the save dialog to server and commit the save when the user press save in the dialog. so if you need API call you will probably change the text after it already sent to server [18:14:38] at https://ro.wikipedia.org/wiki/Utilizator:Strainu/ve.js [18:14:46] where is the input text? [18:15:38] is fragment.getText()? [18:15:55] the documentModel contains the text. the document is built of many fragments [18:16:38] findText finds the relevant ranges of the query word to replace [18:17:11] if you want the whole input text, you can get it with data [18:17:52] I want whole text. [18:19:01] you can get it with ve.init.target.getSurface().getModel().getLinearFragment().getText() [18:19:28] warning: it isn't similar to wikitext - you loose all the annotations [18:19:43] if you want also the annoations you can get it with ve.init.target.getSurface().getModel().getDocument().getData() [18:21:16] ok after replace how can i put the result? [18:22:36] for changing the model, you should use transactions or fragments (the code sample I sent use fragment for changing text) [18:24:17] with transactions it should look like: model.change(ve.dm.Transaction.newFrom...) [18:27:42] i am confused :( we work on https://fa.wikipedia.org/wiki/%D9%85%D8%AF%DB%8C%D8%A7%D9%88%DB%8C%DA%A9%DB%8C:Gadget-VESuperTool.js [18:28:05] which uses مدیاویکی:Gadget-Extra-Editbuttons-persiantools.js [18:28:44] for example function normalizeZwnj(text) get and return a text [18:29:18] would you please write a simple code wich can work with a like normalizeZwnj(text) [18:29:42] a function like* [18:32:13] reza1615_: I'm also confused \: Unfortunately I don't think it is possible to get text from the document and operate on it directly. [18:32:29] :( [18:32:50] the VisualEditor team may suggest a way to do it, but it is sunday today [18:33:39] one option (a bit ugly) is to rewrite the code as replacements= [[from, to], [from2, to2]] [18:34:21] and operate on replacements. in wikitext you will : foreach replacement: text=text.replace(rep[0], rep[1]) [18:34:37] and in VE you will do similar code to search and replace dialog [18:35:32] it is much complex than it. we have many regexes and regex exception [18:35:33] see here: https://doc.wikimedia.org/VisualEditor/master/#!/api/ve.ui.FindAndReplaceDialog [18:36:05] you can place the mouse over ve.ui.FindAndReplaceDialog to see "View source" option [18:36:57] (but it basiclly does the same code as the Romanian script) [18:37:38] see https://fa.wikipedia.org/wiki/%D9%85%D8%AF%DB%8C%D8%A7%D9%88%DB%8C%DA%A9%DB%8C:Gadget-Extra-Editbuttons-persianwikitools.js [18:37:57] see var patterns [18:38:10] at these patterns the code doesn't edit [18:39:40] reza1615_: nice, you haev replaceExcept in JS similar function exist in pywikibot [18:39:58] :) ebraminio done it [18:40:15] did* :) [18:40:32] i thought Amir who is one of the pywikibot developers wrote it [18:42:00] no. most part of the JS code did by user:ebraminio [18:42:24] me and some other users added some functions to it [18:42:27] also amir [18:42:44] Anyway, to do it in VE is complex. You can use the getData() for getting annoations and avoid cite, files etc, but I dont know how to easily do it with arabicDigitsEnglishContext pattern [18:44:06] the main problem we don't know how can return the text [18:44:23] I suggest you can try to ask tommorow when the VE team will be online, and if they give you similar answers we should open a task in phabricator for having some easiser way to do manipulations on content in ve model [18:45:20] OK tomorrow i will ask. thank you for your time [18:59:34] eranroz: i didi it :) [18:59:55] https://fa.wikipedia.org/wiki/%DA%A9%D8%A7%D8%B1%D8%A8%D8%B1:Yamaha5/common.js [19:00:31] but i have other problem when i click on a text for eample [19:00:34] exmple [19:00:53] https://fa.wikipedia.org/wiki/%D8%AA%D8%B3%D8%AA%DB%B2%DB%B2 [19:01:32] it don't allow me to chang on the text and the function run [19:02:37] what do you mean it don't allow to change? [19:03:04] please check [19:03:33] when i click on the text box the function run and return the result [19:04:02] it don't allow to deselect the text and add some words [19:06:10] reza1615_: The loader bar doesn't end? [19:06:33] no [19:07:19] reza1615_: For me it doesn't work because of error: persianWikiTools is not defined [19:07:32] you probably use some gadget or script that loads it for you [19:08:35] the correct way to use resourceloader is mw.loader.using(['Extra-Editbuttons-persiantools', 'persianWikiTools'], function(){ .... }) and decalre on all the dependencies [19:09:08] https://fa.wikipedia.org/wiki/%DA%A9%D8%A7%D8%B1%D8%A8%D8%B1:Yamaha5/common.js [19:10:00] autoEd isn't defined [19:10:18] or at https://fa.wikipedia.org/wiki/ویژه:ترجیحات#mw-prefsection-gadgets [19:10:29] you can use privacy mode in your browser and test the code as anonymous [19:10:46] please active the first tool (دکمه‌های ویرایشی بیشتر (راهنما)) [19:10:46] this way you can be more sure you don't forget dependecies [19:12:14] ok i enabled rahanma and now the code autmaticly replace to persian letters [19:12:51] as you see it dont allow you to edit the text [19:12:58] https://fa.wikipedia.org/wiki/%D8%AA%D8%B3%D8%AA%DB%B2%DB%B2?veaction=edit [19:13:26] yes i think it use the wrong hook [19:13:33] (it is done too early) [19:16:30] reza1615_: If I call the function after load, it does work and i can change the text [19:18:03] not after load [19:18:07] after pree save [19:18:16] press [19:22:23] mw.hook('ve.activate').add(function () {setTimeout(function(){ YOURCODE}, 1000)}) [19:23:05] this works for me- so the timing of the replacement is important. [19:23:10] (1000 is just demo) [19:33:36] thanks that works [19:33:49] do you know how can i add a text which [19:34:31] but notice this is just demo. don't use setTimout with 1000 but diferent hook or add it as a user button [19:34:41] summary text= be+ automatic tool [19:34:52] 1000 is risky since VE may load slowly or the user may already save [19:35:07] hmm [19:35:16] i should use .then() [19:37:33] you can use target.initialEditSummary [19:38:54] i want to have automatice summary which user can not change it. it should add a extension text like (+Auto tool) to the end of the summary [19:39:46] the easiest way is to: ve.init.target.initialEditSummary='autotool' [19:40:34] a bit more complex option: https://en.wikipedia.org/wiki/MediaWiki:Gadget-defaultsummaries.js [19:40:43] (see the ve.saveDialog.stateChanged hook) [19:44:17] 10WikiEditor: Icons are missing on fast closing and opening the tabs - https://phabricator.wikimedia.org/T106993#1483607 (10Fomafix) 3NEW [19:57:49] 10WikiEditor: Icons are missing on fast closing and opening the tabs - https://phabricator.wikimedia.org/T106993#1483631 (10GOIII) **Confirmed**.-- Win8.1 & IE11 Was able to reproduce several times. - Leaving the //Advance// tab open in the previous editing session had no bearing on the behavior. - Only the "s... [20:00:26] eranroz: I couldn't solve the delay problem. how can i add a botton which use can run the code with click on it? [20:01:29] reza1615_: see for example https://he.wikipedia.org/wiki/%D7%9E%D7%93%D7%99%D7%94_%D7%95%D7%99%D7%A7%D7%99:Gadget-VeDirectionMarkTool.js [20:01:37] replace the onSelect with you code [20:02:44] (BTW, this gadget adds ‏ template which may be useful in general for RTL wikis) [20:06:32] 10WikiEditor: Icons are missing on fast closing and opening the tabs - https://phabricator.wikimedia.org/T106993#1483640 (10Fomafix) https://gerrit.wikimedia.org/r/226676/1 changes the behavior but does not solve the problem. [20:07:50] eranroz: we have this tool but i don't where it will show the icon! [20:08:30] https://fa.wikipedia.org/wiki/%D9%85%D8%AF%DB%8C%D8%A7%D9%88%DB%8C%DA%A9%DB%8C:Gadget-VeDirectionMarkTool.js [20:09:02] reza1615_: by default it is added to "Insert" menu [20:10:38] but you may override it with setting group = 'format' (or some other group) [20:28:56] eranroz: I updated the code and it is ok [20:28:57] https://fa.wikipedia.org/wiki/%D9%85%D8%AF%DB%8C%D8%A7%D9%88%DB%8C%DA%A9%DB%8C:Gadget-VeSuperTool.js [20:29:17] shows new too at top in bold text [20:29:43] it seems ok but when we have [[]] at text it will remove them! [20:30:01] for example check https://fa.wikipedia.org/wiki/%D8%AA%D8%B3%D8%AA%DB%B2%DB%B2 [20:31:26] https://fa.wikipedia.org/wiki/%D8%AA%D8%B3%D8%AA%DB%B2%DB%B2?veaction=edit&withJS=MediaWiki%3AGadget-VESuperTool.js [20:36:13] eranroz: This is our code https://fa.wikipedia.org/wiki/%D9%85%D8%AF%DB%8C%D8%A7%D9%88%DB%8C%DA%A9%DB%8C:Gadget-VeSuperTool.js [20:36:46] we are using addPortletLink button for now, but the question is how to how to fetch wiki code for fragments? [20:36:48] fragment.getText() [20:36:52] gives text [20:37:19] and when fragment.insertContent() it is removing all wiki links [20:38:26] The thing that would be prefect for us is having each text fragment with no wiki syntax separately [20:38:40] so we can apply our needed logic on it [20:39:33] we can deal with wiki syntax however we believe it is messy and want to avoid. but no problem if it the only option [20:41:17] (03Abandoned) 10Esanders: WIP Show recent uploads in MWMediaSearchWidget [extensions/VisualEditor] - 10https://gerrit.wikimedia.org/r/109670 (https://bugzilla.wikimedia.org/60398) (owner: 10Esanders) [20:41:34] 10WikiEditor: Icons are missing on fast closing and opening the tabs - https://phabricator.wikimedia.org/T106993#1483657 (10GOIII) Can we rule out the possibility this behavior was always present yet not revealed until now? I mean is it possible this might be more about the use of a single sprited multi-image... [20:42:27] ebraminio: you can see how the Find & Replace is working here: https://doc.wikimedia.org/VisualEditor/master/source/ve.ui.FindAndReplaceDialog.html#ve-ui-FindAndReplaceDialog [20:43:45] actually it is similar to what you are doing, so i'm not sure how to avoid removing of annotations [20:45:50] eranroz: :( [20:45:57] reza1615_: It seems it not possible [20:46:11] :( [20:46:43] we should add a bug on phabricator [20:50:25] eranroz: I am using documentModel.findText(new RegExp('.*'), true, true); [20:50:25] isn't possible to avoid annotations here? [20:51:43] If not I think that should be subject of the bug [21:06:20] ebraminio: I don't think it is possible [21:06:43] and editing model is indeed too complex I think [21:07:48] eranroz: If I iterate over each html object and replace its text with intended, would that work? [21:08:32] ebraminio: don't use HTML. you can use either LinearData or tree data (which may be more similar to DOM structure) [21:08:48] but for transactions I think it is usally done with linear fragments [21:09:42] ve.init.target.getSurface().getModel().getDocument().getData() will give you the linear data with all the annottations [21:12:08] eranroz: should use items originalDomElements[0].innerHTML? [21:12:40] 1969 items it has, it looks suspicious [21:12:59] how we can get leafs only? [21:13:38] 1969 for this page, https://fa.wikipedia.org/wiki/%D9%85%D8%B1%DA%A9%D8%B2_%D9%BE%DA%98%D9%88%D9%87%D8%B4%DB%8C_%D9%85%DB%8C%D8%B1%D8%A7%D8%AB_%D9%85%DA%A9%D8%AA%D9%88%D8%A8?veaction=edit [21:14:51] hmm, not possible for html of course, we can do replaceExcept of course. but still 1969 is weird [21:16:32] eranroz: Can you fill feature request for this if you know now what we try to do? It would be nice because we are not familiar with the project and its members so we can not explain to them we needed on the bug summary [21:17:15] Of course that would be very nice of you and that would be no issue if you don't like to do that [21:17:24] ebraminio: Yes I can fill bug summary. there are other ways to change the document BTW [21:17:29] with transactions [21:18:11] something like ve.init.target.getSurface().getModel().change( ve.dm.Transaction.newFrom...) [21:18:22] and there are various ways for creating transactions [21:19:10] (but anyway I think it is too complex to change the model. ) [21:19:14] Hard to understand :( Too many concepts binded to VE and OOjs, very hard to understand at first glance [21:19:55] We were too relax with wikitext :) [21:20:56] $('#wpTextbox1').val(process($('#wpTextbox1').val())) and all done :) [21:28:23] ebraminio: I'm writing a phabricator ticket [21:28:40] eranroz: Thank you very much :) [21:28:46] we would like to have simple api for manipuations on ve document [21:29:10] what are the requirements for it? i see that you have some cool replacement script that is context aware [21:29:31] (doesn't replace within specific template etc0 [21:31:26] eranroz: FYI we are using qunit for testing our codes https://fa.wikipedia.org/w/index.php?title=%D9%88%DB%8C%DA%A9%DB%8C%E2%80%8C%D9%BE%D8%AF%DB%8C%D8%A7:%D9%88%DB%8C%DA%A9%DB%8C%E2%80%8C%D9%BE%D8%B1%D9%88%DA%98%D9%87_%D8%A7%D8%A8%D8%B2%D8%A7%D8%B1%D9%87%D8%A7/%D8%A2%D8%B2%D9%85%D8%A7%DB%8C%D8%B4_%D9%88%D8%A7%D8%AD%D8%AF&withJS=MediaWiki%3AGadget-Extra-Editbuttons-tests.js [21:31:26] I guess qunit was not supposed to be used by wikis but I find out it can be used and used it :P [21:32:09] ebraminio: nice trick! I didn't know it is possible [21:32:43] eranroz: Simply if we could replace each text fragment with our intended function, that was very nice :) [21:33:25] *would be [21:34:09] for example for a this wikitext: [21:34:51] "ABC ABC ABC [[CCC|DDDD DDDD]] ABC CCD" [21:34:51] -> ["ABC ABC ABC ", "DDDD DDDD", " ABC CCD"] [21:36:18] ebraminio: I just wonder how you can implement context aware replacement (with the var patterns you have) [21:36:25] if it would support caption, file description, (selected, can be filtered set of) templates parameter [21:37:32] function replaceExcept(text, callback, excepts) { [21:37:32] on https://fa.wikipedia.org/wiki/%D9%85%D8%AF%DB%8C%D8%A7%D9%88%DB%8C%DA%A9%DB%8C:Gadget-Extra-Editbuttons-persianwikitools.js [21:37:51] not best and most efficient approach, but well [21:39:09] we do recursive replaces sometimes also [21:39:55] but very rare [21:52:57] 10VisualEditor: Provide easy interface for manipulating/replacements of ve Document - https://phabricator.wikimedia.org/T106996#1483687 (10eranroz) 3NEW [21:53:57] autocorrect fixed programticly to problematically :) i will keep it [21:59:19] 10VisualEditor: Useless nowiki tags added for regular single quotes - https://phabricator.wikimedia.org/T106997#1483694 (10NicoV) 3NEW [22:04:37] eranroz1: Great documentation and explaination, thank you very much :) [22:04:50] 10VisualEditor, 10Parsoid: Useless nowiki tags added for regular single quotes - https://phabricator.wikimedia.org/T106997#1483702 (10matmarex) Not entirely useless, there's a pair of single quotes inside the , in "qu''il", which would trigger italics from that point until end of the line otherwise. B... [22:08:36] 10VisualEditor, 10Parsoid: Useless nowiki tags added for regular single quotes - https://phabricator.wikimedia.org/T106997#1483704 (10NicoV) Thanks, I missed the 2 single quotes. But putting nowiki tags around a whole sentence for this is quite confusing. [22:13:02] 10VisualEditor, 10VisualEditor-MediaWiki-References: Make a better keyboard shortcut for adding a citation - https://phabricator.wikimedia.org/T99299#1483705 (10Whatamidoing-WMF) "Option" is the same thing as "Alt" on a Mac keyboard. [22:14:51] 10VisualEditor, 10VisualEditor-MediaWiki-References: Make a better keyboard shortcut for adding a citation - https://phabricator.wikimedia.org/T99299#1483707 (10matmarex) Oh, sorry, I have no idea how Macs handle this. The behavior I described is, as far as I know, specific to Windows.