Index: trunk/extensions/LiquidThreads/lqt.js |
— | — | @@ -51,33 +51,41 @@ |
52 | 52 | liquidThreads.cancelEdit( container ); |
53 | 53 | |
54 | 54 | var loadSpinner = $j('<div class="mw-ajax-loader"/>'); |
55 | | - container.before( loadSpinner ); |
| 55 | + $j(container).before( loadSpinner ); |
56 | 56 | |
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 | + |
82 | 90 | }, |
83 | 91 | |
84 | 92 | //From http://clipmarks.com/clipmark/CEFC94CB-94D6-4495-A7AA-791B7355E284/ |