Jump to content

User talk:Js/ajaxPreview

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

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
Arquivo-fonte: http://en.wikipedia.org/w/index.php?title=User:Js/ajaxPreview.js&action=raw&ctype=text/javascript
Linha: 8
  tOld.style.clear = 'none'

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

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

Redirects

[edit]

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)[reply]

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

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)[reply]

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

Typo

[edit]

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

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

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)[reply]

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)[reply]
I removed this line. — AlexSm 03:33, 9 October 2011 (UTC)[reply]

HTTPS error

[edit]

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

importScriptURI('http://en.wikipedia.org/w/index.php?title=User:Js/preview2.js&action=raw&ctype=text/javascript')

with

importScriptURI('//en.wikipedia.org/w/index.php?title=User:Js/preview2.js&action=raw&ctype=text/javascript');

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

In addition, please replace (on User:Js/preview2.js)
if (!cssLang) cssLang = importStylesheetURI('http://en.wikipedia.org/w/index.php?title=user:js/ajaxPreview/'+ext[1]+'.css&action=raw&ctype=text/css&nocache=1')
with
if (!cssLang) cssLang = importStylesheetURI('//en.wikipedia.org/w/index.php?title=User:Js/ajaxPreview/'+ext[1]+'.css&action=raw&ctype=text/css&nocache=1');
Cheers, mc10 (t/c) 00:51, 9 October 2011 (UTC)[reply]
Fixed, thank you. — AlexSm 03:33, 9 October 2011 (UTC)[reply]
[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="//en.wikipedia.org/wiki/User:Js/ajaxPreview#Preview" target="_blank">more</a>

so that it links to en.wiki. Cheers, mc10 (t/c) 05:35, 18 October 2011 (UTC)[reply]

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

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)[reply]

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

References

[edit]

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)[reply]

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)[reply]

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( [
    'jquery.tablesorter',
    'jquery.makeCollapsible'
  ], 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)[reply]

Preferences

[edit]

Pretty sure you can do this on preferences. Hillelfrei• talk • 06:10, 30 April 2020 (UTC)[reply]