Index: trunk/extensions/UsabilityInitiative/UsabilityInitiative.hooks.php |
— | — | @@ -70,18 +70,19 @@ |
71 | 71 | array( 'src' => 'js/plugins/jquery.namespaceSelect.js', 'version' => 1 ), |
72 | 72 | array( 'src' => 'js/plugins/jquery.suggestions.js', 'version' => 6 ), |
73 | 73 | array( 'src' => 'js/plugins/jquery.textSelection.js', 'version' => 20 ), |
74 | | - array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 20 ), |
| 74 | + array( 'src' => 'js/plugins/jquery.wikiEditor.js', 'version' => 21 ), |
75 | 75 | array( 'src' => 'js/plugins/jquery.wikiEditor.highlight.js', 'version' => 1 ), |
76 | 76 | array( 'src' => 'js/plugins/jquery.wikiEditor.toolbar.js', 'version' => 33 ), |
77 | 77 | array( 'src' => 'js/plugins/jquery.wikiEditor.dialogs.js', 'version' => 9 ), |
78 | 78 | array( 'src' => 'js/plugins/jquery.wikiEditor.toc.js', 'version' => 42 ), |
79 | 79 | array( 'src' => 'js/plugins/jquery.wikiEditor.preview.js', 'version' => 4 ), |
| 80 | + array( 'src' => 'js/plugins/jquery.wikiEditor.publish.js', 'version' => 0 ), |
80 | 81 | ), |
81 | 82 | 'combined' => array( |
82 | | - array( 'src' => 'js/plugins.combined.js', 'version' => 89 ), |
| 83 | + array( 'src' => 'js/plugins.combined.js', 'version' => 90 ), |
83 | 84 | ), |
84 | 85 | 'minified' => array( |
85 | | - array( 'src' => 'js/plugins.combined.min.js', 'version' => 89 ), |
| 86 | + array( 'src' => 'js/plugins.combined.min.js', 'version' => 90 ), |
86 | 87 | ), |
87 | 88 | ), |
88 | 89 | ); |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.js |
— | — | @@ -228,8 +228,12 @@ |
229 | 229 | context.fn = { |
230 | 230 | 'addButton': function( options ) { |
231 | 231 | // Ensure that buttons and tabs are visible |
232 | | - // TODO: Implement |
233 | 232 | context.$controls.show(); |
| 233 | + context.$buttons.show(); |
| 234 | + return $( '<button />' ) |
| 235 | + .text( $.wikiEditor.autoMsg( options, 'caption' ) ) |
| 236 | + .click( options.action ) |
| 237 | + .appendTo( context.$buttons ); |
234 | 238 | }, |
235 | 239 | 'addView': function( options ) { |
236 | 240 | // Adds a tab |
Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.publish.js |
— | — | @@ -17,144 +17,97 @@ |
18 | 18 | * @param config Configuration object to create module from |
19 | 19 | */ |
20 | 20 | create: function( context, config ) { |
21 | | - /* |
22 | | - * This code was moved here from the old version of the preview module - it needs more work to run on it's own, |
23 | | - * and many of the names of classes and messages need to be updated |
24 | | - * |
25 | | - mvJsLoader.doLoad( [ '$j.ui' ], function() { |
26 | | - // Build the dialog behind the Publish button |
27 | | - var dialogID = 'wikiEditor-' + context.instance + '-savedialog'; |
28 | | - $.wikiEditor.modules.dialogs.fn.create( |
29 | | - context, |
30 | | - { |
31 | | - previewsave: { |
32 | | - id: dialogID, |
33 | | - titleMsg: 'wikieditor-preview-savedialog-title', |
34 | | - html: '\ |
35 | | - <div class="wikiEditor-savedialog-copywarn"></div>\ |
36 | | - <div class="wikiEditor-savedialog-editoptions">\ |
37 | | - <form>\ |
38 | | - <label for="wikiEditor-' + context.instance + '-savedialog-summary"\ |
39 | | - rel="wikieditor-preview-savedialog-summary"></label>\ |
40 | | - <br />\ |
41 | | - <input type="text" id="wikiEditor-' + context.instance + '-savedialog-summary"\ |
42 | | - style="width: 100%;" />\ |
43 | | - <br />\ |
44 | | - <input type="checkbox"\ |
45 | | - id="wikiEditor-' + context.instance + '-savedialog-minor" />\ |
46 | | - <label for="wikiEditor-' + context.instance + '-savedialog-minor"\ |
47 | | - rel="wikieditor-preview-savedialog-minor"></label>\ |
48 | | - <br />\ |
49 | | - <input type="checkbox"\ |
50 | | - id="wikiEditor-' + context.instance + '-savedialog-watch" />\ |
51 | | - <label for="wikiEditor-' + context.instance + '-savedialog-watch"\ |
52 | | - rel="wikieditor-preview-savedialog-watch"></label>\ |
53 | | - </form>\ |
54 | | - </div>', |
55 | | - init: function() { |
56 | | - $(this).find( '[rel]' ).each( function() { |
57 | | - $(this).text( gM( $(this).attr( 'rel' ) ) ); |
58 | | - }); |
59 | | - $(this).find( '.wikiEditor-savedialog-copywarn' ) |
60 | | - .html( $( '#editpage-copywarn' ).html() ); |
61 | | - |
62 | | - if ( $( '#wpMinoredit' ).size() == 0 ) |
63 | | - $( '#wikiEditor-' + context.instance + '-savedialog-minor' ).hide(); |
64 | | - else if ( $( '#wpMinoredit' ).is( ':checked' ) ) |
65 | | - $( '#wikiEditor-' + context.instance + '-savedialog-minor' ) |
66 | | - .attr( 'checked', 'checked' ); |
67 | | - if ( $( '#wpWatchthis' ).size() == 0 ) |
68 | | - $( '#wikiEditor-' + context.instance + '-savedialog-watch' ).hide(); |
69 | | - else if ( $( '#wpWatchthis' ).is( ':checked' ) ) |
70 | | - $( '#wikiEditor-' + context.instance + '-savedialog-watch' ) |
71 | | - .attr( 'checked', 'checked' ); |
72 | | - |
73 | | - $(this).find( 'form' ).submit( function( e ) { |
74 | | - $(this).closest( '.ui-dialog' ).find( 'button:first' ).click(); |
75 | | - e.preventDefault(); |
76 | | - }); |
77 | | - }, |
78 | | - dialog: { |
79 | | - buttons: { |
80 | | - 'wikieditor-preview-savedialog-publish': function() { |
81 | | - var minorChecked = $( '#wikiEditor-' + context.instance + |
82 | | - '-savedialog-minor' ).is( ':checked' ) ? |
83 | | - 'checked' : ''; |
84 | | - var watchChecked = $( '#wikiEditor-' + context.instance + |
85 | | - '-savedialog-watch' ).is( ':checked' ) ? |
86 | | - 'checked' : ''; |
87 | | - $( '#wpMinoredit' ).attr( 'checked', minorChecked ); |
88 | | - $( '#wpWatchthis' ).attr( 'checked', watchChecked ); |
89 | | - $( '#wpSummary' ).val( $j( '#wikiEditor-' + context.instance + |
90 | | - '-savedialog-summary' ).val() ); |
91 | | - $( '#editform' ).submit(); |
92 | | - }, |
93 | | - 'wikieditor-preview-savedialog-goback': function() { |
94 | | - $(this).dialog( 'close' ); |
95 | | - } |
| 21 | + // Build the dialog behind the Publish button |
| 22 | + var dialogID = 'wikiEditor-' + context.instance + '-dialog'; |
| 23 | + $.wikiEditor.modules.dialogs.fn.create( |
| 24 | + context, |
| 25 | + { |
| 26 | + previewsave: { |
| 27 | + id: dialogID, |
| 28 | + titleMsg: 'wikieditor-publish-dialog-title', |
| 29 | + html: '\ |
| 30 | + <div class="wikiEditor-dialog-copywarn"></div>\ |
| 31 | + <div class="wikiEditor-dialog-editoptions">\ |
| 32 | + <form>\ |
| 33 | + <label for="wikiEditor-' + context.instance + '-dialog-summary"\ |
| 34 | + rel="wikieditor-publish-dialog-summary"></label>\ |
| 35 | + <br />\ |
| 36 | + <input type="text" id="wikiEditor-' + context.instance + '-dialog-summary"\ |
| 37 | + style="width: 100%;" />\ |
| 38 | + <br />\ |
| 39 | + <input type="checkbox"\ |
| 40 | + id="wikiEditor-' + context.instance + '-dialog-minor" />\ |
| 41 | + <label for="wikiEditor-' + context.instance + '-dialog-minor"\ |
| 42 | + rel="wikieditor-publish-dialog-minor"></label>\ |
| 43 | + <br />\ |
| 44 | + <input type="checkbox"\ |
| 45 | + id="wikiEditor-' + context.instance + '-dialog-watch" />\ |
| 46 | + <label for="wikiEditor-' + context.instance + '-dialog-watch"\ |
| 47 | + rel="wikieditor-publish-dialog-watch"></label>\ |
| 48 | + </form>\ |
| 49 | + </div>', |
| 50 | + init: function() { |
| 51 | + $(this).find( '[rel]' ).each( function() { |
| 52 | + $(this).text( gM( $(this).attr( 'rel' ) ) ); |
| 53 | + }); |
| 54 | + $(this).find( '.wikiEditor-dialog-copywarn' ) |
| 55 | + .html( $( '#editpage-copywarn' ).html() ); |
| 56 | + |
| 57 | + if ( $( '#wpMinoredit' ).size() == 0 ) |
| 58 | + $( '#wikiEditor-' + context.instance + '-dialog-minor' ).hide(); |
| 59 | + else if ( $( '#wpMinoredit' ).is( ':checked' ) ) |
| 60 | + $( '#wikiEditor-' + context.instance + '-dialog-minor' ) |
| 61 | + .attr( 'checked', 'checked' ); |
| 62 | + if ( $( '#wpWatchthis' ).size() == 0 ) |
| 63 | + $( '#wikiEditor-' + context.instance + '-dialog-watch' ).hide(); |
| 64 | + else if ( $( '#wpWatchthis' ).is( ':checked' ) ) |
| 65 | + $( '#wikiEditor-' + context.instance + '-dialog-watch' ) |
| 66 | + .attr( 'checked', 'checked' ); |
| 67 | + |
| 68 | + $(this).find( 'form' ).submit( function( e ) { |
| 69 | + $(this).closest( '.ui-dialog' ).find( 'button:first' ).click(); |
| 70 | + e.preventDefault(); |
| 71 | + }); |
| 72 | + }, |
| 73 | + dialog: { |
| 74 | + buttons: { |
| 75 | + 'wikieditor-publish-dialog-publish': function() { |
| 76 | + var minorChecked = $( '#wikiEditor-' + context.instance + |
| 77 | + '-dialog-minor' ).is( ':checked' ) ? |
| 78 | + 'checked' : ''; |
| 79 | + var watchChecked = $( '#wikiEditor-' + context.instance + |
| 80 | + '-dialog-watch' ).is( ':checked' ) ? |
| 81 | + 'checked' : ''; |
| 82 | + $( '#wpMinoredit' ).attr( 'checked', minorChecked ); |
| 83 | + $( '#wpWatchthis' ).attr( 'checked', watchChecked ); |
| 84 | + $( '#wpSummary' ).val( $j( '#wikiEditor-' + context.instance + |
| 85 | + '-dialog-summary' ).val() ); |
| 86 | + $( '#editform' ).submit(); |
96 | 87 | }, |
97 | | - open: function() { |
98 | | - $( '#wikiEditor-' + context.instance + '-savedialog-summary' ).focus(); |
99 | | - }, |
100 | | - width: 500 |
| 88 | + 'wikieditor-publish-dialog-goback': function() { |
| 89 | + $(this).dialog( 'close' ); |
| 90 | + } |
101 | 91 | }, |
102 | | - resizeme: false |
103 | | - } |
| 92 | + open: function() { |
| 93 | + $( '#wikiEditor-' + context.instance + '-dialog-summary' ).focus(); |
| 94 | + }, |
| 95 | + width: 500 |
| 96 | + }, |
| 97 | + resizeme: false |
104 | 98 | } |
105 | | - ); |
106 | | - // Paranoia: initialize context.modules before running |
107 | | - // tabs() and binding event handlers |
108 | | - context.modules.preview = { |
109 | | - 'editTab': editTab, |
110 | | - 'previewTab': previewTab, |
111 | | - 'tabList': tabList, |
112 | | - 'saveDialog': $( '#' + dialogID ), |
113 | | - 'prevText': null |
114 | | - }; |
115 | | - tabList |
116 | | - .append( $( '<ul />' ) |
117 | | - .append( $( '<li />' ) |
118 | | - .append( $( '<a />' ) |
119 | | - .attr( 'href', '#wikiEditor-' + context.instance + '-tab-edit' ) |
120 | | - .text( gM( 'wikieditor-preview-tab-edit' ) ) |
121 | | - ) |
122 | | - ) |
123 | | - .append( $( '<li />' ) |
124 | | - .append( $( '<a />' ) |
125 | | - .attr( 'href', '#wikiEditor-' + context.instance + '-tab-preview' ) |
126 | | - .text( gM( 'wikieditor-preview-tab-preview' ) ) |
127 | | - ) |
128 | | - ) |
129 | | - .append( $( '<button />' ) |
130 | | - .text( gM( 'wikieditor-preview-button-publish' ) ) |
131 | | - .click( function() { |
132 | | - context.modules.preview.saveDialog.dialog( 'open' ); |
133 | | - return false; |
134 | | - }) |
135 | | - ) |
136 | | - // These have to go in reverse because they're floated right |
137 | | - .append( $( '<button />' ) |
138 | | - .text( gM( 'wikieditor-preview-button-cancel' ) ) |
139 | | - ) |
140 | | - ) |
141 | | - .append( editTab ) |
142 | | - .append( previewTab ); |
143 | | - |
144 | | - tabList |
145 | | - .bind( 'tabsshow', function() { |
146 | | - if ( context.modules.preview.previewTab.is( ':visible' ) ) |
147 | | - $.wikiEditor.modules.preview.fn.showPreview( context ); |
148 | | - }) |
149 | | - .tabs(); |
150 | | - |
151 | | - // Remove the ui-widget class from the tabs div, |
152 | | - // causes NTOC mispositioning |
153 | | - // FIXME: Find out which CSS rule is causing this |
154 | | - // and override it |
155 | | - // FIXME: Don't use jQuery UI tabs, implement our own tabs |
156 | | - tabList.closest( '.ui-tabs' ).removeClass( 'ui-widget' ); |
| 99 | + } |
| 100 | + ); |
| 101 | + context.fn.addButton( { |
| 102 | + 'captionMsg': 'wikieditor-publish-button-publish', |
| 103 | + 'action': function() { |
| 104 | + $( '#' + dialogID ).dialog( 'open' ); |
| 105 | + return false; |
| 106 | + } |
157 | 107 | } ); |
158 | | - */ |
| 108 | + context.fn.addButton( { |
| 109 | + 'captionMsg': 'wikieditor-publish-button-cancel', |
| 110 | + 'action': function() { } |
| 111 | + } ); |
159 | 112 | } |
160 | 113 | } |
161 | 114 | |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.js |
— | — | @@ -1534,8 +1534,12 @@ |
1535 | 1535 | context.fn = { |
1536 | 1536 | 'addButton': function( options ) { |
1537 | 1537 | // Ensure that buttons and tabs are visible |
1538 | | - // TODO: Implement |
1539 | 1538 | context.$controls.show(); |
| 1539 | + context.$buttons.show(); |
| 1540 | + return $( '<button />' ) |
| 1541 | + .text( $.wikiEditor.autoMsg( options, 'caption' ) ) |
| 1542 | + .click( options.action ) |
| 1543 | + .appendTo( context.$buttons ); |
1540 | 1544 | }, |
1541 | 1545 | 'addView': function( options ) { |
1542 | 1546 | // Adds a tab |
— | — | @@ -2181,144 +2185,97 @@ |
2182 | 2186 | * @param config Configuration object to create module from |
2183 | 2187 | */ |
2184 | 2188 | create: function( context, config ) { |
2185 | | - /* |
2186 | | - * This code was moved here from the old version of the preview module - it needs more work to run on it's own, |
2187 | | - * and many of the names of classes and messages need to be updated |
2188 | | - * |
2189 | | - mvJsLoader.doLoad( [ '$j.ui' ], function() { |
2190 | | - // Build the dialog behind the Publish button |
2191 | | - var dialogID = 'wikiEditor-' + context.instance + '-savedialog'; |
2192 | | - $.wikiEditor.modules.dialogs.fn.create( |
2193 | | - context, |
2194 | | - { |
2195 | | - previewsave: { |
2196 | | - id: dialogID, |
2197 | | - titleMsg: 'wikieditor-preview-savedialog-title', |
2198 | | - html: '\ |
2199 | | - <div class="wikiEditor-savedialog-copywarn"></div>\ |
2200 | | - <div class="wikiEditor-savedialog-editoptions">\ |
2201 | | - <form>\ |
2202 | | - <label for="wikiEditor-' + context.instance + '-savedialog-summary"\ |
2203 | | - rel="wikieditor-preview-savedialog-summary"></label>\ |
2204 | | - <br />\ |
2205 | | - <input type="text" id="wikiEditor-' + context.instance + '-savedialog-summary"\ |
2206 | | - style="width: 100%;" />\ |
2207 | | - <br />\ |
2208 | | - <input type="checkbox"\ |
2209 | | - id="wikiEditor-' + context.instance + '-savedialog-minor" />\ |
2210 | | - <label for="wikiEditor-' + context.instance + '-savedialog-minor"\ |
2211 | | - rel="wikieditor-preview-savedialog-minor"></label>\ |
2212 | | - <br />\ |
2213 | | - <input type="checkbox"\ |
2214 | | - id="wikiEditor-' + context.instance + '-savedialog-watch" />\ |
2215 | | - <label for="wikiEditor-' + context.instance + '-savedialog-watch"\ |
2216 | | - rel="wikieditor-preview-savedialog-watch"></label>\ |
2217 | | - </form>\ |
2218 | | - </div>', |
2219 | | - init: function() { |
2220 | | - $(this).find( '[rel]' ).each( function() { |
2221 | | - $(this).text( gM( $(this).attr( 'rel' ) ) ); |
2222 | | - }); |
2223 | | - $(this).find( '.wikiEditor-savedialog-copywarn' ) |
2224 | | - .html( $( '#editpage-copywarn' ).html() ); |
2225 | | - |
2226 | | - if ( $( '#wpMinoredit' ).size() == 0 ) |
2227 | | - $( '#wikiEditor-' + context.instance + '-savedialog-minor' ).hide(); |
2228 | | - else if ( $( '#wpMinoredit' ).is( ':checked' ) ) |
2229 | | - $( '#wikiEditor-' + context.instance + '-savedialog-minor' ) |
2230 | | - .attr( 'checked', 'checked' ); |
2231 | | - if ( $( '#wpWatchthis' ).size() == 0 ) |
2232 | | - $( '#wikiEditor-' + context.instance + '-savedialog-watch' ).hide(); |
2233 | | - else if ( $( '#wpWatchthis' ).is( ':checked' ) ) |
2234 | | - $( '#wikiEditor-' + context.instance + '-savedialog-watch' ) |
2235 | | - .attr( 'checked', 'checked' ); |
2236 | | - |
2237 | | - $(this).find( 'form' ).submit( function( e ) { |
2238 | | - $(this).closest( '.ui-dialog' ).find( 'button:first' ).click(); |
2239 | | - e.preventDefault(); |
2240 | | - }); |
2241 | | - }, |
2242 | | - dialog: { |
2243 | | - buttons: { |
2244 | | - 'wikieditor-preview-savedialog-publish': function() { |
2245 | | - var minorChecked = $( '#wikiEditor-' + context.instance + |
2246 | | - '-savedialog-minor' ).is( ':checked' ) ? |
2247 | | - 'checked' : ''; |
2248 | | - var watchChecked = $( '#wikiEditor-' + context.instance + |
2249 | | - '-savedialog-watch' ).is( ':checked' ) ? |
2250 | | - 'checked' : ''; |
2251 | | - $( '#wpMinoredit' ).attr( 'checked', minorChecked ); |
2252 | | - $( '#wpWatchthis' ).attr( 'checked', watchChecked ); |
2253 | | - $( '#wpSummary' ).val( $j( '#wikiEditor-' + context.instance + |
2254 | | - '-savedialog-summary' ).val() ); |
2255 | | - $( '#editform' ).submit(); |
2256 | | - }, |
2257 | | - 'wikieditor-preview-savedialog-goback': function() { |
2258 | | - $(this).dialog( 'close' ); |
2259 | | - } |
| 2189 | + // Build the dialog behind the Publish button |
| 2190 | + var dialogID = 'wikiEditor-' + context.instance + '-savedialog'; |
| 2191 | + $.wikiEditor.modules.dialogs.fn.create( |
| 2192 | + context, |
| 2193 | + { |
| 2194 | + previewsave: { |
| 2195 | + id: dialogID, |
| 2196 | + titleMsg: 'wikieditor-publish-savedialog-title', |
| 2197 | + html: '\ |
| 2198 | + <div class="wikiEditor-savedialog-copywarn"></div>\ |
| 2199 | + <div class="wikiEditor-savedialog-editoptions">\ |
| 2200 | + <form>\ |
| 2201 | + <label for="wikiEditor-' + context.instance + '-savedialog-summary"\ |
| 2202 | + rel="wikieditor-publish-savedialog-summary"></label>\ |
| 2203 | + <br />\ |
| 2204 | + <input type="text" id="wikiEditor-' + context.instance + '-savedialog-summary"\ |
| 2205 | + style="width: 100%;" />\ |
| 2206 | + <br />\ |
| 2207 | + <input type="checkbox"\ |
| 2208 | + id="wikiEditor-' + context.instance + '-savedialog-minor" />\ |
| 2209 | + <label for="wikiEditor-' + context.instance + '-savedialog-minor"\ |
| 2210 | + rel="wikieditor-publish-savedialog-minor"></label>\ |
| 2211 | + <br />\ |
| 2212 | + <input type="checkbox"\ |
| 2213 | + id="wikiEditor-' + context.instance + '-savedialog-watch" />\ |
| 2214 | + <label for="wikiEditor-' + context.instance + '-savedialog-watch"\ |
| 2215 | + rel="wikieditor-publish-savedialog-watch"></label>\ |
| 2216 | + </form>\ |
| 2217 | + </div>', |
| 2218 | + init: function() { |
| 2219 | + $(this).find( '[rel]' ).each( function() { |
| 2220 | + $(this).text( gM( $(this).attr( 'rel' ) ) ); |
| 2221 | + }); |
| 2222 | + $(this).find( '.wikiEditor-savedialog-copywarn' ) |
| 2223 | + .html( $( '#editpage-copywarn' ).html() ); |
| 2224 | + |
| 2225 | + if ( $( '#wpMinoredit' ).size() == 0 ) |
| 2226 | + $( '#wikiEditor-' + context.instance + '-savedialog-minor' ).hide(); |
| 2227 | + else if ( $( '#wpMinoredit' ).is( ':checked' ) ) |
| 2228 | + $( '#wikiEditor-' + context.instance + '-savedialog-minor' ) |
| 2229 | + .attr( 'checked', 'checked' ); |
| 2230 | + if ( $( '#wpWatchthis' ).size() == 0 ) |
| 2231 | + $( '#wikiEditor-' + context.instance + '-savedialog-watch' ).hide(); |
| 2232 | + else if ( $( '#wpWatchthis' ).is( ':checked' ) ) |
| 2233 | + $( '#wikiEditor-' + context.instance + '-savedialog-watch' ) |
| 2234 | + .attr( 'checked', 'checked' ); |
| 2235 | + |
| 2236 | + $(this).find( 'form' ).submit( function( e ) { |
| 2237 | + $(this).closest( '.ui-dialog' ).find( 'button:first' ).click(); |
| 2238 | + e.preventDefault(); |
| 2239 | + }); |
| 2240 | + }, |
| 2241 | + dialog: { |
| 2242 | + buttons: { |
| 2243 | + 'wikieditor-publish-savedialog-publish': function() { |
| 2244 | + var minorChecked = $( '#wikiEditor-' + context.instance + |
| 2245 | + '-savedialog-minor' ).is( ':checked' ) ? |
| 2246 | + 'checked' : ''; |
| 2247 | + var watchChecked = $( '#wikiEditor-' + context.instance + |
| 2248 | + '-savedialog-watch' ).is( ':checked' ) ? |
| 2249 | + 'checked' : ''; |
| 2250 | + $( '#wpMinoredit' ).attr( 'checked', minorChecked ); |
| 2251 | + $( '#wpWatchthis' ).attr( 'checked', watchChecked ); |
| 2252 | + $( '#wpSummary' ).val( $j( '#wikiEditor-' + context.instance + |
| 2253 | + '-savedialog-summary' ).val() ); |
| 2254 | + $( '#editform' ).submit(); |
2260 | 2255 | }, |
2261 | | - open: function() { |
2262 | | - $( '#wikiEditor-' + context.instance + '-savedialog-summary' ).focus(); |
2263 | | - }, |
2264 | | - width: 500 |
| 2256 | + 'wikieditor-publish-savedialog-goback': function() { |
| 2257 | + $(this).dialog( 'close' ); |
| 2258 | + } |
2265 | 2259 | }, |
2266 | | - resizeme: false |
2267 | | - } |
| 2260 | + open: function() { |
| 2261 | + $( '#wikiEditor-' + context.instance + '-savedialog-summary' ).focus(); |
| 2262 | + }, |
| 2263 | + width: 500 |
| 2264 | + }, |
| 2265 | + resizeme: false |
2268 | 2266 | } |
2269 | | - ); |
2270 | | - // Paranoia: initialize context.modules before running |
2271 | | - // tabs() and binding event handlers |
2272 | | - context.modules.preview = { |
2273 | | - 'editTab': editTab, |
2274 | | - 'previewTab': previewTab, |
2275 | | - 'tabList': tabList, |
2276 | | - 'saveDialog': $( '#' + dialogID ), |
2277 | | - 'prevText': null |
2278 | | - }; |
2279 | | - tabList |
2280 | | - .append( $( '<ul />' ) |
2281 | | - .append( $( '<li />' ) |
2282 | | - .append( $( '<a />' ) |
2283 | | - .attr( 'href', '#wikiEditor-' + context.instance + '-tab-edit' ) |
2284 | | - .text( gM( 'wikieditor-preview-tab-edit' ) ) |
2285 | | - ) |
2286 | | - ) |
2287 | | - .append( $( '<li />' ) |
2288 | | - .append( $( '<a />' ) |
2289 | | - .attr( 'href', '#wikiEditor-' + context.instance + '-tab-preview' ) |
2290 | | - .text( gM( 'wikieditor-preview-tab-preview' ) ) |
2291 | | - ) |
2292 | | - ) |
2293 | | - .append( $( '<button />' ) |
2294 | | - .text( gM( 'wikieditor-preview-button-publish' ) ) |
2295 | | - .click( function() { |
2296 | | - context.modules.preview.saveDialog.dialog( 'open' ); |
2297 | | - return false; |
2298 | | - }) |
2299 | | - ) |
2300 | | - // These have to go in reverse because they're floated right |
2301 | | - .append( $( '<button />' ) |
2302 | | - .text( gM( 'wikieditor-preview-button-cancel' ) ) |
2303 | | - ) |
2304 | | - ) |
2305 | | - .append( editTab ) |
2306 | | - .append( previewTab ); |
2307 | | - |
2308 | | - tabList |
2309 | | - .bind( 'tabsshow', function() { |
2310 | | - if ( context.modules.preview.previewTab.is( ':visible' ) ) |
2311 | | - $.wikiEditor.modules.preview.fn.showPreview( context ); |
2312 | | - }) |
2313 | | - .tabs(); |
2314 | | - |
2315 | | - // Remove the ui-widget class from the tabs div, |
2316 | | - // causes NTOC mispositioning |
2317 | | - // FIXME: Find out which CSS rule is causing this |
2318 | | - // and override it |
2319 | | - // FIXME: Don't use jQuery UI tabs, implement our own tabs |
2320 | | - tabList.closest( '.ui-tabs' ).removeClass( 'ui-widget' ); |
| 2267 | + } |
| 2268 | + ); |
| 2269 | + context.fn.addButton( { |
| 2270 | + 'captionMsg': 'wikieditor-publish-button-publish', |
| 2271 | + 'action': function() { |
| 2272 | + $( '#' + dialogID ).dialog( 'open' ); |
| 2273 | + return false; |
| 2274 | + } |
2321 | 2275 | } ); |
2322 | | - */ |
| 2276 | + context.fn.addButton( { |
| 2277 | + 'captionMsg': 'wikieditor-publish-button-cancel', |
| 2278 | + 'action': function() { } |
| 2279 | + } ); |
2323 | 2280 | } |
2324 | 2281 | } |
2325 | 2282 | |
Index: trunk/extensions/UsabilityInitiative/js/plugins.combined.min.js |
— | — | @@ -89,7 +89,7 @@ |
90 | 90 | if(typeof data=='string'){callModuleApi(data,'create',{});}else if(typeof data=='object'){for(module in data){if(typeof module=='string'){callModuleApi(module,'create',data[module]);}}}}};for(module in $.wikiEditor.modules){if('api'in $.wikiEditor.modules[module]){for(call in $.wikiEditor.modules[module].api){if(!(call in context.api)){context.api[call]=$.wikiEditor.modules[module].api[call];}}}} |
91 | 91 | context.evt={'change':function(event){switch(event.type){case'keypress':if(false){}else{} |
92 | 92 | break;case'mousedown':if(false){}else{} |
93 | | -break;default:break;}}};context.fn={'addButton':function(options){context.$controls.show();},'addView':function(options){function addTab(options){context.$controls.show();context.$tabs.show();return $('<div></div>').attr('rel','wikiEditor-ui-view-'+options.name).addClass(context.view==options.name?'current':null).append($('<a></a>').attr('href','#').click(function(event){context.$ui.find('.wikiEditor-ui-view').hide();context.$ui.find('.'+$(this).parent().attr('rel')).show();context.$tabs.find('div').removeClass('current');$(this).parent().addClass('current');$(this).blur();if('init'in options&&typeof options.init=='function'){options.init(context);} |
| 93 | +break;default:break;}}};context.fn={'addButton':function(options){context.$controls.show();context.$buttons.show();return $('<button />').text($.wikiEditor.autoMsg(options,'caption')).click(options.action).appendTo(context.$buttons);},'addView':function(options){function addTab(options){context.$controls.show();context.$tabs.show();return $('<div></div>').attr('rel','wikiEditor-ui-view-'+options.name).addClass(context.view==options.name?'current':null).append($('<a></a>').attr('href','#').click(function(event){context.$ui.find('.wikiEditor-ui-view').hide();context.$ui.find('.'+$(this).parent().attr('rel')).show();context.$tabs.find('div').removeClass('current');$(this).parent().addClass('current');$(this).blur();if('init'in options&&typeof options.init=='function'){options.init(context);} |
94 | 94 | event.preventDefault();}).text($.wikiEditor.autoMsg(options,'title'))).appendTo(context.$tabs);} |
95 | 95 | if(!context.$tabs.children().size()){addTab({'name':'wikitext','titleMsg':'wikieditor-wikitext-tab'});} |
96 | 96 | addTab(options);return $('<div></div>').addClass('wikiEditor-ui-view wikiEditor-ui-view-'+options.name).hide().appendTo(context.$ui);},'setup':function(){context.$iframe[0].contentWindow.document.open();context.$iframe[0].contentWindow.document.write('<html><head><title>wikiEditor</title><script>var context = window.parent.jQuery.wikiEditor.instances['+context.instance+'].data( "wikiEditor-context" ); window.parent.jQuery( document ).bind( "keydown keypress keyup mousedown mouseup cut paste", { "context": context }, context.evt.change );</script></head><body style="margin:0;padding:0;width:100%;height:100%;white-space:pre-wrap;font-family:monospace"></body></html>');context.$iframe[0].contentWindow.document.close();context.$iframe[0].contentWindow.document.designMode='on';context.$content=$(context.$iframe[0].contentWindow.document.body);if($('body').is('.rtl')){context.$content.addClass('rtl').attr('dir','rtl');} |
— | — | @@ -115,7 +115,31 @@ |
116 | 116 | $(this).css('white-space',oldWS);oldHidden.each(function(){$(this).attr('style',$(this).data('oldstyle'));});}},modules:{},quickDialog:function(body,settings){$('<div />').text(body).appendTo($('body')).dialog($.extend({bgiframe:true,modal:true},settings)).dialog('open');}};})(jQuery);(function($){$.wikiEditor.modules.highlight={api:{},evt:{change:function(event){}},fn:{create:function(context,config){},divide:function(context){},isolate:function(context){return[];},strip:function(context,division){return $('<div />').html(division.html().replace(/\<br[^\>]*\>/g,"\n")).text();},scan:function(context,division){return[];},mark:function(context,division,tokens){}}};})(jQuery);(function($){$.wikiEditor.modules.preview={api:{},fn:{create:function(context,config){if('preview'in context.modules){return;} |
117 | 117 | context.modules.preview={'previousText':null};context.$preview=context.fn.addView({'name':'preview','titleMsg':'wikieditor-preview-tab','init':function(context){var wikitext=context.fn.getContents();if(context.modules.preview.previousText==wikitext){return;} |
118 | 118 | context.$preview.find('.wikiEditor-preview-contents').empty();context.$preview.find('.wikiEditor-preview-loading').show();$.post(wgScriptPath+'/api.php',{'action':'parse','title':wgPageName,'text':wikitext,'prop':'text','pst':'','format':'json'},function(data){if(data.parse==undefined||data.parse.text==undefined||data.parse.text['*']==undefined){return;} |
119 | | -context.modules.preview.previousText=wikitext;context.$preview.find('.wikiEditor-preview-loading').hide();context.$preview.find('.wikiEditor-preview-contents').html(data.parse.text['*']);},'json');}});var loadingMsg=gM('wikieditor-preview-loading');context.$preview.append($('<div />').addClass('wikiEditor-preview-loading').append($('<img />').addClass('wikiEditor-preview-spinner').attr({'src':$.wikiEditor.imgPath+'dialogs/loading.gif','valign':'absmiddle','alt':loadingMsg,'title':loadingMsg})).append($('<span></span>').text(loadingMsg))).append($('<div />').addClass('wikiEditor-preview-contents'));}}};})(jQuery);(function($){$.wikiEditor.modules.publish={api:{},fn:{create:function(context,config){}}};})(jQuery);(function($){$.wikiEditor.modules.toc={api:{},defaultWidth:'166px',minimumWidth:'70px',fn:{create:function(context,config){if('$toc'in context.modules){return;} |
| 119 | +context.modules.preview.previousText=wikitext;context.$preview.find('.wikiEditor-preview-loading').hide();context.$preview.find('.wikiEditor-preview-contents').html(data.parse.text['*']);},'json');}});var loadingMsg=gM('wikieditor-preview-loading');context.$preview.append($('<div />').addClass('wikiEditor-preview-loading').append($('<img />').addClass('wikiEditor-preview-spinner').attr({'src':$.wikiEditor.imgPath+'dialogs/loading.gif','valign':'absmiddle','alt':loadingMsg,'title':loadingMsg})).append($('<span></span>').text(loadingMsg))).append($('<div />').addClass('wikiEditor-preview-contents'));}}};})(jQuery);(function($){$.wikiEditor.modules.publish={api:{},fn:{create:function(context,config){var dialogID='wikiEditor-'+context.instance+'-savedialog';$.wikiEditor.modules.dialogs.fn.create(context,{previewsave:{id:dialogID,titleMsg:'wikieditor-publish-savedialog-title',html:'\ |
| 120 | + <div class="wikiEditor-savedialog-copywarn"></div>\ |
| 121 | + <div class="wikiEditor-savedialog-editoptions">\ |
| 122 | + <form>\ |
| 123 | + <label for="wikiEditor-'+context.instance+'-savedialog-summary"\ |
| 124 | + rel="wikieditor-publish-savedialog-summary"></label>\ |
| 125 | + <br />\ |
| 126 | + <input type="text" id="wikiEditor-'+context.instance+'-savedialog-summary"\ |
| 127 | + style="width: 100%;" />\ |
| 128 | + <br />\ |
| 129 | + <input type="checkbox"\ |
| 130 | + id="wikiEditor-'+context.instance+'-savedialog-minor" />\ |
| 131 | + <label for="wikiEditor-'+context.instance+'-savedialog-minor"\ |
| 132 | + rel="wikieditor-publish-savedialog-minor"></label>\ |
| 133 | + <br />\ |
| 134 | + <input type="checkbox"\ |
| 135 | + id="wikiEditor-'+context.instance+'-savedialog-watch" />\ |
| 136 | + <label for="wikiEditor-'+context.instance+'-savedialog-watch"\ |
| 137 | + rel="wikieditor-publish-savedialog-watch"></label>\ |
| 138 | + </form>\ |
| 139 | + </div>',init:function(){$(this).find('[rel]').each(function(){$(this).text(gM($(this).attr('rel')));});$(this).find('.wikiEditor-savedialog-copywarn').html($('#editpage-copywarn').html());if($('#wpMinoredit').size()==0) |
| 140 | +$('#wikiEditor-'+context.instance+'-savedialog-minor').hide();else if($('#wpMinoredit').is(':checked')) |
| 141 | +$('#wikiEditor-'+context.instance+'-savedialog-minor').attr('checked','checked');if($('#wpWatchthis').size()==0) |
| 142 | +$('#wikiEditor-'+context.instance+'-savedialog-watch').hide();else if($('#wpWatchthis').is(':checked')) |
| 143 | +$('#wikiEditor-'+context.instance+'-savedialog-watch').attr('checked','checked');$(this).find('form').submit(function(e){$(this).closest('.ui-dialog').find('button:first').click();e.preventDefault();});},dialog:{buttons:{'wikieditor-publish-savedialog-publish':function(){var minorChecked=$('#wikiEditor-'+context.instance+'-savedialog-minor').is(':checked')?'checked':'';var watchChecked=$('#wikiEditor-'+context.instance+'-savedialog-watch').is(':checked')?'checked':'';$('#wpMinoredit').attr('checked',minorChecked);$('#wpWatchthis').attr('checked',watchChecked);$('#wpSummary').val($j('#wikiEditor-'+context.instance+'-savedialog-summary').val());$('#editform').submit();},'wikieditor-publish-savedialog-goback':function(){$(this).dialog('close');}},open:function(){$('#wikiEditor-'+context.instance+'-savedialog-summary').focus();},width:500},resizeme:false}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-publish','action':function(){$('#'+dialogID).dialog('open');return false;}});context.fn.addButton({'captionMsg':'wikieditor-publish-button-cancel','action':function(){}});}}};})(jQuery);(function($){$.wikiEditor.modules.toc={api:{},defaultWidth:'166px',minimumWidth:'70px',fn:{create:function(context,config){if('$toc'in context.modules){return;} |
120 | 144 | var height=context.$ui.find('.wikiEditor-ui-left').height();context.modules.$toc=$('<div />').addClass('wikiEditor-ui-toc').data('context',context);context.$ui.find('.wikiEditor-ui-right').css('width',$.wikiEditor.modules.toc.defaultWidth).append(context.modules.$toc);context.modules.$toc.height(context.$ui.find('.wikiEditor-ui-left').height());context.$ui.find('.wikiEditor-ui-left').css('marginRight',"-"+$.wikiEditor.modules.toc.defaultWidth).children().css('marginRight',$.wikiEditor.modules.toc.defaultWidth);$.wikiEditor.modules.toc.fn.build(context,config);context.$content.parent().delayedBind(250,'mouseup scrollToTop keyup change',function(){$(this).eachAsync({bulk:0,loop:function(){$.wikiEditor.modules.toc.fn.build(context);$.wikiEditor.modules.toc.fn.update(context);}});}).blur(function(event){var context=event.data.context;context.$textarea.delayedBindCancel(250,'mouseup scrollToTop keyup change');$.wikiEditor.modules.toc.fn.unhighlight(context);});},unhighlight:function(context){context.modules.$toc.find('div').removeClass('current');},update:function(context){$.wikiEditor.modules.toc.fn.unhighlight(context);var position=context.$textarea.textSelection('getCaretPosition');var section=0;if(context.data.outline.length>0){if(!(position<context.data.outline[0].position-1)){while(section<context.data.outline.length&&context.data.outline[section].position-1<position){section++;} |
121 | 145 | section=Math.max(0,section);} |
122 | 146 | var sectionLink=context.modules.$toc.find('div.section-'+section);sectionLink.addClass('current');var relTop=sectionLink.offset().top-context.modules.$toc.offset().top;var scrollTop=context.modules.$toc.scrollTop();var divHeight=context.modules.$toc.height();var sectionHeight=sectionLink.height();if(relTop<0) |