User talk:Js/preview2.js

Latest comment: 6 years ago by MSGJ in topic Update module name

Fixes edit

Could someone apply this bug fix to the script? Currently it does not works on Translatewiki, because $wgLegacyJavaScriptGlobals seems to be set to false there (and will be false here as well in the future). Helder 22:54, 25 October 2012 (UTC)Reply

frm.wpSummary is undefined edit

I got

Uncaught TypeError: Cannot read property 'value' of undefined

from the following line when trying to do a preview in a new topic on Wikidata:

data = { title: mw.config.get('wgPageName'), text: txt, summary: frm.wpSummary.value}

Helder 17:18, 12 November 2012 (UTC)Reply

Add MathJax compatibility edit

Could you replace

 if (window.ajaxPreviewExec) ajaxPreviewExec(wkPreview[0])

by something like

  if ( $( '.tex' ).length ){
    mw.loader.using( 'ext.math.mathjax.enabler', function () {
      $('#wikiPreview').renderTex();
    } );
  }
  if (window.ajaxPreviewExec) ajaxPreviewExec(wkPreview[0])

to make the script work with the mathjax code from mw:Extension:Math? See gerrit:61183 for details. Helder 17:01, 1 June 2013 (UTC)Reply

  Not done for now: The {{editprotected}} template should only be used when there is "a complete and specific description of the request, so that an editor unfamiliar with the subject matter could complete the requested edit immediately". The phrase "by something like" implies that the above request is not specific. --Redrose64 (talk) 20:59, 2 June 2013 (UTC)Reply
@Helder.wiki: Done, with an additional check on actually having mathjax mode selected in your preferences. —TheDJ (talkcontribs) 21:28, 2 June 2013 (UTC)Reply
Thank you! I think it is necessary to move around the code which loads module "user.options" at User:Js/ajaxPreview.js, and made a request for this at User talk:Js/ajaxPreview.js#Fix dependencies. Helder 14:47, 3 June 2013 (UTC)Reply

Make it compatible with the CodeEditor edit

Currently, if I make some changes in a JS or CSS page, and try to use the "Changes" button from this script, it compares the old text with itself. The button only works if I disable the CodeEditor (using the button /*). Helder 15:39, 25 September 2013 (UTC)Reply

Could someone apply this change to the code?
I tested it on Module:Bananas, Special:MyPage/common.js and Special:MyPage/common.css Helder 13:26, 30 January 2014 (UTC)Reply
  • Are you using wikEd Helder? If so, you need to disable it in the top right corner of the screen before loading the .js or .css you want to edit. It doesn't get along with CodeEditor and there is already a ticket on Bugzilla. Technical 13 (talk) 13:46, 30 January 2014 (UTC)Reply
Nope. I think you are refering to bugzilla:53914, but that is not the case here since I do not use WikEd. I'm using ajaxPreview, and when I'm on JS/CSS/Lua pages, I like to use the features from mw:Extension:CodeEditor, but then the ajax diff doesn't work unless I make a fork of this script with the changes above. Helder 16:22, 30 January 2014 (UTC)Reply
  • This means there are multiple gadgets and scripts that are not working with codeEditor. This tells me the codeEditor is not backwards compatible and needs to be fixed, not all of the gadgets and scripts that conflict with it. I'll see what I can do. In the mean time, do you have a proposed fix for this script? I'm guessing it is going to be hard to find and administrator that will try to debug it and figure it out on their own. Let's ping TheDJ who is the only one who has made any edits to this script in the last two years since I'm not sure js is still around. Also, disabling the {{Editprotected}} because I don't think it will help here. Technical 13 (talk) 15:28, 1 February 2014 (UTC)Reply
But I provided the fix in the second comment above, after debugging it myself. Helder 12:23, 2 February 2014 (UTC)Reply
  implemented. Let me know of any problems, please. — Martin (MSGJ · talk) 20:38, 4 February 2014 (UTC)Reply

Fix for Uncaught ReferenceError edit

Hello!

Some wikis (e.g.: wmbr:MediaWiki:Common.js) defines "createCollapseButtons" (from WP:Collapsible tables) but not "createNavigationBarToggleButton" (from WP:NavFrame), so the script needs to check for each function individually to avoid errors such as "Uncaught ReferenceError: createNavigationBarToggleButton is not defined ".

Could someone apply this update to the script?

Thanks! Helder.wiki 19:58, 14 February 2014 (UTC)

  Done Ruslik_Zero 18:54, 19 February 2014 (UTC)Reply

The script causes error in JS console in ruwiki edit

Hello! This script has some ruwiki-specific code:

  if (window.collapsibleDivs){ //ruwiki
    collapsibleDivs()
  }
  
  if (window.collapsibleTables){ //ruwiki
     collapsibleTables()
  }

But it isn't executed properly (these functions need jQuery object with content element as parameter) and causes error in JavaScript console: «Uncaught TypeError: Cannot read property 'find' of undefined». Also, this code is not even needed, since 'wikipage.content' event is fired and collapsibleDivs() and collapsibleTables() are executed anyway. So I suggest to remove the code. Thank you. Jack who built the house (talk) 03:12, 1 November 2016 (UTC)Reply

Update module name edit

Hi! Could someone change "mediawiki.action.history.diff" to "mediawiki.diff.styles"? The old module was removed (see Wikipedia:Village pump (technical)#mediawiki.action.history.diff). Helder 19:57, 23 January 2018 (UTC)Reply

  Done — Martin (MSGJ · talk) 11:56, 24 January 2018 (UTC)Reply