Jump to content

User talk:Js/preview2.js

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by He7d3r (talk | contribs) at 13:26, 30 January 2014 (Make it compatible with the CodeEditor: new section). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Fixes

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

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

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

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]