User talk:Js/ajaxPreview

From Wikipedia, the free encyclopedia
Jump to: navigation, search

Error: tOld is null[edit]

Hi again! I was using the script at pt.wb and I got the following error right after moving the page "User:Heldergeovane" to "User:Heldergeovane/test":

Erro: tOld is null
Linha: 8 = 'none'

I'm using vector skin and Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-BR; rv: Gecko/2008120122 Firefox/3.0.5. Helder (talk) 18:22, 26 September 2009 (UTC)

The "pagemove" part was the key. Should be fixed now, thank you for the report. — AlexSm 03:38, 27 September 2009 (UTC)


Hi, just wanted to report a bug with previewing redirects. It doesn't seem to code them properly.
#REDIRECT [[User talk:Js/ajaxPreview]]
Is displayed as:
1. REDIRECT User talk:Js/ajaxPreview
Instead of
User talk:Js/ajaxPreview
Not sure what you can do to correct, but thought you ought to know. JonEastham (talk) 09:57, 25 May 2010 (UTC)

That is actually how the redirect looks in preview. MC10 (TCGBL) 05:11, 17 September 2010 (UTC)

Help me a bit...[edit]

I have included WikEd from the Preferences and am now testing the Preview callback functionality. But it turns out that ajaxPreviewFinish() never gets called! I can manually invoke the function by entering it into the browser's address bar (javascript:ajaxPreviewFinish(...)) and it works fine, but it doesn't get called automatically. Comments?

Thanks, Nageh (talk) 10:23, 23 November 2010 (UTC)

Never mind, I was misguided in thinking this script was part of WikEd. Nageh (talk) 11:30, 23 November 2010 (UTC)


There's a typo in the code: emptydiff: 'No chages' should be emptydiff: 'No changes'. mc10 (t/c) 05:06, 28 August 2011 (UTC)

Fixed, thank you. — AlexSm 18:50, 29 August 2011 (UTC)

Error: sortables_init is not defined[edit]

I am receiving the error sortables_init is not defined from the file User:Js/preview2.js, line 143. Any way to fix this? mc10 (t/c) 00:00, 9 October 2011 (UTC)

Removing the line should fix the problem; the error likely results from the change in sortable tables resulting from the 1.18 upgrade. mc10 (t/c) 00:53, 9 October 2011 (UTC)
I removed this line. — AlexSm 03:33, 9 October 2011 (UTC)

HTTPS error[edit]

Importing preview2.js is resulting in a partially-encrypted HTTPS page. On User:Js/ajaxPreview.js, please replace




Note the removal of "http:". Cheers, mc10 (t/c) 00:43, 9 October 2011 (UTC)

In addition, please replace (on User:Js/preview2.js)
if (!cssLang) cssLang = importStylesheetURI(''+ext[1]+'.css&action=raw&ctype=text/css&nocache=1')
if (!cssLang) cssLang = importStylesheetURI('//'+ext[1]+'.css&action=raw&ctype=text/css&nocache=1');
Cheers, mc10 (t/c) 00:51, 9 October 2011 (UTC)
Fixed, thank you. — AlexSm 03:33, 9 October 2011 (UTC)

Change link to documentation[edit]

Since this script can be used on external wikis, it should be the case that links work properly. So on User:Js/ajaxPreview.js,

<a href=/wiki/user:js/ajaxPreview#preview target=_blank>more</a>

should be

<a href="//" target="_blank">more</a>

so that it links to Cheers, mc10 (t/c) 05:35, 18 October 2011 (UTC)

Done. — AlexSm 16:17, 18 October 2011 (UTC)

Uncaught TypeError on protected pages[edit]

I'm getting

Uncaught TypeError: Cannot call method 'lastIndexOf' of undefined

from line

var name = btnOld.val(); var i = name.lastIndexOf(' ') + 1

if I open a protected page such as this (which I can't edit since I'm not an admin there). I tested this on Google Chrome. Helder 20:51, 30 January 2012 (UTC)

Fixed (hopefully), thank you. — AlexSm 21:45, 30 January 2012 (UTC)


Of course, the ideal solution is to fetch all the references and then only display the ones that are actually used in the section that is being previewed. This would also support (and possibly encourage) the use of list-defined references. Would be great if this could be integrated. Thanks for the script, btw! Nageh (talk) 21:01, 19 April 2012 (UTC)

Other quickpreviews[edit]

See Wikipedia:Village pump (proposals)/Archive 93#Previewing an edit using Javascript instead of the servers - I just wanted to post that, before I lose it again. –Quiddity (talk) 05:00, 19 September 2013 (UTC)

Bug expanding preview and changes buttons[edit]

Thank you for making the script and allowing others to use it. It is quite helpful.

I have configured the script with the following options:

var ajaxPreviewPos = 'bottom';
window.ajaxPreviewExec = function(previewArea) {
  mw.loader.using( [
  ], function(){
    $( 'table.sortable' ).tablesorter();
    $( '#wikiPreview .collapsible' ).makeCollapsible();
  } );

In using the script, I always experience an issue where the "Show Preview" and/or "Show changes" button increases in horizontal size immediately upon being clicked. Only the button clicked increases in size. I am not aware of a time that I have used this and not had this issue occur. From a programming perspective, it appears that the label assigned to the button is expanded by a bit of whitespace upon each click. The addition of a .trim() prior to actually assigning the name to the button would probably solve the issue. — Makyen (talk) 19:09, 3 June 2014 (UTC)