r56052 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r56051‎ | r56052 | r56053 >
Date:18:09, 8 September 2009
Author:werdna
Status:deferred
Tags:
Comment:
Load edit.js script and run mwSetupToolbar() when displaying an edit form, fixes edit toolbar for inline edit forms.

Also, fix display of AJAX throbber when loading edit form for replies.
Modified paths:
  • /trunk/extensions/LiquidThreads/lqt.js (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/lqt.js
@@ -51,33 +51,41 @@
5252 liquidThreads.cancelEdit( container );
5353
5454 var loadSpinner = $j('<div class="mw-ajax-loader"/>');
55 - container.before( loadSpinner );
 55+ $j(container).before( loadSpinner );
5656
57 - $j(container).load(wgServer+wgScript, 'title='+encodeURIComponent(wgPageName)+
58 - query+'&lqt_inline=1',
59 - function() {
60 - // Kill the loader.
61 - loadSpinner.remove();
62 -
63 - if (preload) {
64 - $j("textarea", container)[0].value = preload;
65 - }
66 -
67 - $j(container).slideDown('slow');
68 -
69 - var cancelButton = $j(container).find('#mw-editform-cancel');
70 - cancelButton.click( liquidThreads.cancelEdit );
71 -
72 - $j(container).find('#wpTextbox1')[0].rows = 10;
73 -
74 - // Scroll to the textbox
75 - var targetOffset = $j(container).find('#wpTextbox1').offset().top;
76 - // Buffer at the top, roughly enough to see the heading and one line
77 - targetOffset -= 100;
78 - $j('html,body').animate({scrollTop: targetOffset}, 'slow');
79 -
80 - $j(container).find('#wpTextbox1').focus();
81 - } );
 57+ var finishSetup = function() {
 58+ // Kill the loader.
 59+ loadSpinner.remove();
 60+
 61+ if (preload) {
 62+ $j("textarea", container)[0].value = preload;
 63+ }
 64+
 65+ $j(container).slideDown('slow');
 66+
 67+ var cancelButton = $j(container).find('#mw-editform-cancel');
 68+ cancelButton.click( liquidThreads.cancelEdit );
 69+
 70+ $j(container).find('#wpTextbox1')[0].rows = 10;
 71+
 72+ // Add toolbar
 73+ mwSetupToolbar();
 74+
 75+ // Scroll to the textbox
 76+ var targetOffset = $j(container).find('#wpTextbox1').offset().top;
 77+ // Buffer at the top, roughly enough to see the heading and one line
 78+ targetOffset -= 100;
 79+ $j('html,body').animate({scrollTop: targetOffset}, 'slow');
 80+
 81+ $j(container).find('#wpTextbox1').focus();
 82+ };
 83+
 84+ $j.getScript( stylepath+'/common/edit.js',
 85+ function() {
 86+ $j(container).load(wgServer+wgScript, 'title='+encodeURIComponent(wgPageName)+
 87+ query+'&lqt_inline=1', finishSetup );
 88+ } );
 89+
8290 },
8391
8492 //From http://clipmarks.com/clipmark/CEFC94CB-94D6-4495-A7AA-791B7355E284/

Status & tagging log