r82699 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82698‎ | r82699 | r82700 >
Date:20:54, 23 February 2011
Author:catrope
Status:ok (Comments)
Tags:
Comment:
(bug 27625) WikiEditor dialogs broken in LiquidThreads. This adds more hacks on top of hacks, I really gotta clean this mess up soon
Modified paths:
  • /trunk/extensions/LiquidThreads/LiquidThreads.php (modified) (history)
  • /trunk/extensions/LiquidThreads/js/lqt.toolbar.js (modified) (history)
  • /trunk/extensions/LiquidThreads/lqt.dialogs.css (added) (history)
  • /trunk/extensions/LiquidThreads/lqt.js (modified) (history)

Diff [purge]

Index: trunk/extensions/LiquidThreads/LiquidThreads.php
@@ -69,7 +69,7 @@
7070 );
7171
7272 $wgResourceModules['ext.liquidThreads'] = $lqtResourceTemplate + array(
73 - 'styles' => array( 'lqt.css', 'jquery/jquery.thread_collapse.css' ),
 73+ 'styles' => array( 'lqt.css', 'jquery/jquery.thread_collapse.css', 'lqt.dialogs.css' ),
7474 'scripts' => array( 'lqt.js', 'js/lqt.toolbar.js', 'jquery/jquery.thread_collapse.js', 'jquery/jquery.autogrow.js' ),
7575 'dependencies' => array( 'jquery.ui.dialog' ),
7676 'messages' => $lqtMessages
Index: trunk/extensions/LiquidThreads/lqt.dialogs.css
@@ -0,0 +1,207 @@
 2+/*
 3+ * CSS for WikiEditor Dialogs
 4+ */
 5+
 6+/* Table Dialog */
 7+#wikieditor-toolbar-table-dialog fieldset {
 8+ width: 218px;
 9+ padding: 0;
 10+ float: left;
 11+}
 12+body.rtl #wikieditor-toolbar-table-dialog fieldset {
 13+ float: right;
 14+}
 15+#wikieditor-toolbar-table-dialog .wikieditor-toolbar-table-preview-wrapper {
 16+ width: 330px;
 17+ padding: 0;
 18+ float: right;
 19+}
 20+body.rtl #wikieditor-toolbar-table-dialog .wikieditor-toolbar-table-preview-wrapper {
 21+ float: left;
 22+}
 23+body.rtl .wikiEditor-toolbar-dialog .wikieditor-toolbar-table-preview-wrapper table {
 24+ margin-left: 1em;
 25+ margin-right: 0;
 26+}
 27+.wikieditor-toolbar-table-preview-content * {
 28+ cursor: default;
 29+}
 30+.wikiEditor-toolbar-dialog .wikieditor-toolbar-table-preview-wrapper table {
 31+ width: 100% !important;
 32+}
 33+.wikiEditor-toolbar-dialog .wikieditor-toolbar-table-preview-content table td {
 34+ padding: 10px 4px !important;
 35+ height: auto !important;
 36+}
 37+.wikiEditor-toolbar-dialog .wikieditor-toolbar-table-preview-content table th {
 38+ padding: 7px 3px !important;
 39+}
 40+.wikieditor-toolbar-table-dimension-fields .wikieditor-toolbar-field-wrapper {
 41+ float: left;
 42+ margin-right: 20px;
 43+ vertical-align: bottom;
 44+}
 45+body.rtl .wikieditor-toolbar-table-dimension-fields .wikieditor-toolbar-field-wrapper {
 46+ float: right;
 47+ margin-right: 0px;
 48+ margin-left: 20px;
 49+}
 50+.wikiEditor-toolbar-dialog .ui-dialog-content {
 51+ padding: 30px 20px 0 !important;
 52+}
 53+.wikieditor-toolbar-dialog-wrapper {
 54+ width: 100%;
 55+}
 56+/* Insert Link Dialog */
 57+#wikieditor-toolbar-link-int-target-status {
 58+ float: right;
 59+}
 60+#wikieditor-toolbar-link-int-target,
 61+#wikieditor-toolbar-link-int-text {
 62+ width: 100%;
 63+}
 64+#wikieditor-toolbar-tool-link-int-target-label {
 65+ float: left;
 66+ line-height: 1.7em;
 67+}
 68+#wikieditor-toolbar-link-int-target-status-loading {
 69+ line-height: 1.7em;
 70+}
 71+#wikieditor-toolbar-link-int-target-status-exists,
 72+#wikieditor-toolbar-link-int-target-status-notexists,
 73+#wikieditor-toolbar-link-int-target-status-invalid,
 74+#wikieditor-toolbar-link-int-target-status-external {
 75+ padding-left: 30px;
 76+ background-position: 0 50%;
 77+ background-repeat: no-repeat;
 78+}
 79+#wikieditor-toolbar-link-int-target-status-exists {
 80+ /* @embed */
 81+ background-image: url(images/dialogs/insert-link-exists.png);
 82+}
 83+#wikieditor-toolbar-link-int-target-status-notexists {
 84+ /* @embed */
 85+ background-image: url(images/dialogs/insert-link-notexists.png);
 86+}
 87+#wikieditor-toolbar-link-int-target-status-invalid {
 88+ /* @embed */
 89+ background-image: url(images/dialogs/insert-link-invalid.png);
 90+}
 91+#wikieditor-toolbar-link-int-target-status-external {
 92+ /* @embed */
 93+ background-image: url(images/dialogs/insert-link-external.png);
 94+}
 95+/* Reference Dialog */
 96+#wikieditor-toolbar-reference-dialog label {
 97+ float: left;
 98+ line-height: 1.7em;
 99+}
 100+#wikieditor-toolbar-reference-text {
 101+ width: 100%;
 102+}
 103+/* RTL Changes */
 104+body.rtl .wikiEditor-toolbar-dialog .ui-dialog-buttonpane button {
 105+ float: left;
 106+ margin: 0.5em 0.4em 0.5em 0 !important;
 107+}
 108+body.rtl .wikiEditor-toolbar-dialog .ui-dialog-titlebar-close {
 109+ left: 0.9em;
 110+ right: auto;
 111+}
 112+body.rtl .wikiEditor-toolbar-dialog .ui-dialog-title {
 113+ float:right;
 114+}
 115+body.rtl #wikieditor-toolbar-link-int-target-status {
 116+ float: left;
 117+}
 118+body.rtl #wikieditor-toolbar-tool-link-int-target-label {
 119+ float: right;
 120+}
 121+body.rtl .wikieditor-toolbar-floated-field-wrapper {
 122+ float: right;
 123+ margin-right: 0;
 124+ margin-left: 2em;
 125+}
 126+body.rtl #wikieditor-toolbar-link-int-target-status-exists,
 127+body.rtl #wikieditor-toolbar-link-int-target-status-notexists,
 128+body.rtl #wikieditor-toolbar-link-int-target-status-invalid,
 129+body.rtl #wikieditor-toolbar-link-int-target-status-external {
 130+ padding-left: 0;
 131+ padding-right: 30px;
 132+ background-position: 100% 50%;
 133+}
 134+body.rtl #wikieditor-toolbar-link-int-target-status-external {
 135+ /* @embed */
 136+ background-image: url(images/dialogs/insert-link-external-rtl.png);
 137+}
 138+body.rtl #wikieditor-toolbar-reference-dialog label {
 139+ float: right;
 140+}
 141+/* Template Editor Dialogs */
 142+.wikiEditor-template-dialog-fields label {
 143+ text-transform: capitalize;
 144+ float: left;
 145+ width: 25%;
 146+ line-height: 2.25em;
 147+}
 148+.wikiEditor-template-dialog-fields textarea {
 149+ float: right;
 150+ width: 70%;
 151+ line-height: 1.5em;
 152+ height: 1.5em;
 153+}
 154+.wikiEditor-template-dialog-fields .wikiEditor-template-dialog-field-wrapper {
 155+ padding: 0.75em 0.33em;
 156+ border-bottom: dashed 1px silver;
 157+ clear: both;
 158+}
 159+.wikiEditor-template-dialog-fields .wikiEditor-template-dialog-field-wrapper:first-child {
 160+ padding-top: 0;
 161+}
 162+.wikiEditor-template-dialog-fields .wikiEditor-template-dialog-field-wrapper:last-child {
 163+ border-bottom: none;
 164+}
 165+/* Self Clearing Floats */
 166+.wikieditor-toolbar-table-dimension-fields:after,
 167+.wikieditor-toolbar-dialog-wrapper:after {
 168+ visibility: hidden;
 169+ display: block;
 170+ font-size: 0;
 171+ content: " ";
 172+ clear: both;
 173+ height: 0;
 174+}
 175+.wikieditor-toolbar-table-dimension-fields,
 176+.wikieditor-toolbar-dialog-wrapper {
 177+ display: inline-table;
 178+}
 179+/* Hides from IE-mac \*/
 180+* html .wikieditor-toolbar-table-dimension-fields,
 181+* html .wikieditor-toolbar-dialog-wrapper {
 182+ height: 1%;
 183+}
 184+.wikieditor-toolbar-table-dimension-fields,
 185+.wikieditor-toolbar-dialog-wrapper {
 186+ display: block;
 187+}
 188+/* End hide from IE-mac */
 189+.wikiEditor-toolbar-dialog .ui-dialog-buttonpane {
 190+ border-top: 1px solid #cccccc !important;
 191+}
 192+.wikiEditor-toolbar-dialog .ui-dialog-content {
 193+ padding-bottom: 1em !important;
 194+}
 195+/* Edit dialog */
 196+.wikiEditor-dialog-editoptions {
 197+ margin-top: 15px;
 198+}
 199+/* Publish dialog */
 200+.wikiEditor-publish-dialog-copywarn {
 201+ margin-top: 0.5em;
 202+}
 203+.wikiEditor-publish-dialog-summary {
 204+ margin-top: 1.5em;
 205+}
 206+.wikiEditor-publish-dialog-options {
 207+ margin-top: 1.5em;
 208+}
Property changes on: trunk/extensions/LiquidThreads/lqt.dialogs.css
___________________________________________________________________
Added: svn:eol-style
1209 + native
Index: trunk/extensions/LiquidThreads/lqt.js
@@ -193,7 +193,7 @@
194194 if ( typeof wgWikiEditorPreferences != 'undefined' ) {
195195 useDialogs = wgWikiEditorPreferences.toolbar.dialogs;
196196 } else {
197 - useDialogs = mediaWiki.user.options['usebetatoolbar-cgd'];
 197+ useDialogs = mediaWiki.user.options.get( 'usebetatoolbar-cgd' );
198198 }
199199
200200 if ( useDialogs && $j.wikiEditor.isSupported( $j.wikiEditor.modules.dialogs ) ) {
@@ -202,13 +202,14 @@
203203
204204 // Add wikiEditor toolbar
205205 $j( '#wpTextbox1' ).wikiEditor( 'addModule', { 'toolbar': liquidThreads.toolbar.config, 'dialogs': liquidThreads.toolbar.dialogs } );
 206+
206207
207208 // cleanup unnecessary things from the old toolbar
208209 $j( '#editpage-specialchars' ).remove();
209 - $j( '#wpTextbox1' ).focus()
 210+ $j( '#wpTextbox1' ).focus();
210211 } else {
211212 // Add old toolbar
212 - mwSetupToolbar()
 213+ mwSetupToolbar();
213214 }
214215 currentFocused = $j(container).find('#wpTextbox1');
215216 $j(container).find('#wpTextbox1,#wpSummary').focus(
@@ -229,7 +230,7 @@
230231 if ( typeof mediaWiki.loader != 'undefined' && mediaWiki.loader ) {
231232 mediaWiki.loader.using(
232233 [ 'ext.wikiEditor', 'ext.wikiEditor.toolbar.i18n',
233 - 'jquery.wikiEditor.toolbar',
 234+ 'jquery.wikiEditor.toolbar', 'jquery.wikiEditor.dialogs',
234235 'jquery.async', 'jquery.cookie' ],
235236 finishSetup );
236237 } else {
Index: trunk/extensions/LiquidThreads/js/lqt.toolbar.js
@@ -1059,20 +1059,19 @@
10601060 updateExistence( true );
10611061 });
10621062 // Set labels of tabs based on rel values
1063 - var u = mw.usability;
10641063 $j(this).find( '[rel]' ).each( function() {
1065 - $j(this).text( u.getMsg( $j(this).attr( 'rel' ) ) );
 1064+ $j(this).text( mediaWiki.msg( $j(this).attr( 'rel' ) ) );
10661065 });
10671066 // Set tabindexes on form fields
10681067 $j.wikiEditor.modules.dialogs.fn.setTabindexes( $j(this).find( 'input' ).not( '[tabindex]' ) );
10691068 // Setup the tooltips in the textboxes
10701069 $j( '#wikieditor-toolbar-link-int-target' )
1071 - .data( 'tooltip', u.getMsg( 'wikieditor-toolbar-tool-link-int-target-tooltip' ) );
 1070+ .data( 'tooltip', mediaWiki.msg( 'wikieditor-toolbar-tool-link-int-target-tooltip' ) );
10721071 $j( '#wikieditor-toolbar-link-int-text' )
1073 - .data( 'tooltip', u.getMsg( 'wikieditor-toolbar-tool-link-int-text-tooltip' ) );
 1072+ .data( 'tooltip', mediaWiki.msg( 'wikieditor-toolbar-tool-link-int-text-tooltip' ) );
10741073 $j( '#wikieditor-toolbar-link-int-target, #wikieditor-toolbar-link-int-text' )
10751074 .each( function() {
1076 - var tooltip = u.getMsg( $j( this ).attr( 'id' ) + '-tooltip' );
 1075+ var tooltip = mediaWiki.msg( $j( this ).attr( 'id' ) + '-tooltip' );
10771076 if ( $j( this ).val() == '' )
10781077 $j( this )
10791078 .addClass( 'wikieditor-toolbar-dialog-hint' )
@@ -1142,11 +1141,11 @@
11431142 });
11441143 // Add images to the page existence widget, which will be shown mutually exclusively to communicate if the
11451144 // page exists, does not exist or the title is invalid (like if it contains a | character)
1146 - var existsMsg = u.getMsg( 'wikieditor-toolbar-tool-link-int-target-status-exists' );
1147 - var notexistsMsg = u.getMsg( 'wikieditor-toolbar-tool-link-int-target-status-notexists' );
1148 - var invalidMsg = u.getMsg( 'wikieditor-toolbar-tool-link-int-target-status-invalid' );
1149 - var externalMsg = u.getMsg( 'wikieditor-toolbar-tool-link-int-target-status-external' );
1150 - var loadingMsg = u.getMsg( 'wikieditor-toolbar-tool-link-int-target-status-loading' );
 1145+ var existsMsg = mediaWiki.msg( 'wikieditor-toolbar-tool-link-int-target-status-exists' );
 1146+ var notexistsMsg = mediaWiki.msg( 'wikieditor-toolbar-tool-link-int-target-status-notexists' );
 1147+ var invalidMsg = mediaWiki.msg( 'wikieditor-toolbar-tool-link-int-target-status-invalid' );
 1148+ var externalMsg = mediaWiki.msg( 'wikieditor-toolbar-tool-link-int-target-status-external' );
 1149+ var loadingMsg = mediaWiki.msg( 'wikieditor-toolbar-tool-link-int-target-status-loading' );
11511150 $j( '#wikieditor-toolbar-link-int-target-status' )
11521151 .append( $j( '<div />' )
11531152 .attr( 'id', 'wikieditor-toolbar-link-int-target-status-exists' )
@@ -1263,9 +1262,8 @@
12641263 target = "";
12651264 if ( $j( '#wikieditor-toolbar-link-int-text' ).data( 'tooltip-mode' ) )
12661265 text = "";
1267 - var u = mw.usability;
12681266 if ( target == '' ) {
1269 - alert( u.getMsg( 'wikieditor-toolbar-tool-link-empty' ) );
 1267+ alert( mediaWiki.msg( 'wikieditor-toolbar-tool-link-empty' ) );
12701268 return;
12711269 }
12721270 if ( $j.trim( text ) == '' ) {
@@ -1277,7 +1275,7 @@
12781276 // FIXME: Exactly how fragile is this?
12791277 if ( $j( '#wikieditor-toolbar-link-int-target-status-invalid' ).is( ':visible' ) ) {
12801278 // Refuse to add links to invalid titles
1281 - alert( u.getMsg( 'wikieditor-toolbar-tool-link-int-invalid' ) );
 1279+ alert( mediaWiki.msg( 'wikieditor-toolbar-tool-link-int-invalid' ) );
12821280 return;
12831281 }
12841282
@@ -1295,18 +1293,18 @@
12961294 if ( match && !$j(this).data( 'ignoreLooksInternal' ) ) {
12971295 var buttons = { };
12981296 var that = this;
1299 - buttons[ u.getMsg( 'wikieditor-toolbar-tool-link-lookslikeinternal-int' ) ] = function() {
 1297+ buttons[ mediaWiki.msg( 'wikieditor-toolbar-tool-link-lookslikeinternal-int' ) ] = function() {
13001298 $j( '#wikieditor-toolbar-link-int-target' ).val( match[1] ).change();
13011299 $j(this).dialog( 'close' );
13021300 };
1303 - buttons[ u.getMsg( 'wikieditor-toolbar-tool-link-lookslikeinternal-ext' ) ] = function() {
 1301+ buttons[ mediaWiki.msg( 'wikieditor-toolbar-tool-link-lookslikeinternal-ext' ) ] = function() {
13041302 $j(that).data( 'ignoreLooksInternal', true );
13051303 $j(that).closest( '.ui-dialog' ).find( 'button:first' ).click();
13061304 $j(that).data( 'ignoreLooksInternal', false );
13071305 $j(this).dialog( 'close' );
13081306 };
13091307 $j.wikiEditor.modules.dialogs.quickDialog(
1310 - u.getMsg( 'wikieditor-toolbar-tool-link-lookslikeinternal', match[1] ),
 1308+ mediaWiki.msg( 'wikieditor-toolbar-tool-link-lookslikeinternal', match[1] ),
13111309 { buttons: buttons }
13121310 );
13131311 return;
@@ -1346,7 +1344,7 @@
13471345 open: function() {
13481346 // Cache the articlepath regex
13491347 $j(this).data( 'articlePathRegex', new RegExp(
1350 - '^' + RegExp.escape( wgServer + wgArticlePath )
 1348+ '^' + $.escapeRE( wgServer + wgArticlePath )
13511349 .replace( /\\\$1/g, '(.*)' ) + '$'
13521350 ) );
13531351 // Pre-fill the text fields based on the current selection
@@ -1454,7 +1452,7 @@
14551453 init: function() {
14561454 // Insert translated strings into labels
14571455 $j( this ).find( '[rel]' ).each( function() {
1458 - $j( this ).text( mw.usability.getMsg( $j( this ).attr( 'rel' ) ) );
 1456+ $j( this ).text( mediaWiki.msg( $j( this ).attr( 'rel' ) ) );
14591457 } );
14601458
14611459 },
@@ -1600,7 +1598,7 @@
16011599 </div></div>',
16021600 init: function() {
16031601 $j(this).find( '[rel]' ).each( function() {
1604 - $j(this).text( mw.usability.getMsg( $j(this).attr( 'rel' ) ) );
 1602+ $j(this).text( mediaWiki.msg( $j(this).attr( 'rel' ) ) );
16051603 });
16061604 // Set tabindexes on form fields
16071605 $j.wikiEditor.modules.dialogs.fn.setTabindexes( $j(this).find( 'input' ).not( '[tabindex]' ) );
@@ -1661,21 +1659,20 @@
16621660 var rows = parseInt( rowsVal, 10 );
16631661 var cols = parseInt( colsVal, 10 );
16641662 var header = $j( '#wikieditor-toolbar-table-dimensions-header' ).is( ':checked' ) ? 1 : 0;
1665 - var u = mw.usability;
16661663 if ( isNaN( rows ) || isNaN( cols ) || rows != rowsVal || cols != colsVal ) {
1667 - alert( u.getMsg( 'wikieditor-toolbar-tool-table-invalidnumber' ) );
 1664+ alert( mediaWiki.msg( 'wikieditor-toolbar-tool-table-invalidnumber' ) );
16681665 return;
16691666 }
16701667 if ( rows + header == 0 || cols == 0 ) {
1671 - alert( u.getMsg( 'wikieditor-toolbar-tool-table-zero' ) );
 1668+ alert( mediaWiki.msg( 'wikieditor-toolbar-tool-table-zero' ) );
16721669 return;
16731670 }
16741671 if ( rows * cols > 1000 ) {
1675 - alert( u.getMsg( 'wikieditor-toolbar-tool-table-toomany', 1000 ) );
 1672+ alert( mediaWiki.msg( 'wikieditor-toolbar-tool-table-toomany', 1000 ) );
16761673 return;
16771674 }
1678 - var headerText = u.getMsg( 'wikieditor-toolbar-tool-table-example-header' );
1679 - var normalText = u.getMsg( 'wikieditor-toolbar-tool-table-example' );
 1675+ var headerText = mediaWiki.msg( 'wikieditor-toolbar-tool-table-example-header' );
 1676+ var normalText = mediaWiki.msg( 'wikieditor-toolbar-tool-table-example' );
16801677 var table = "";
16811678 for ( var r = 0; r < rows + header; r++ ) {
16821679 table += "|-\n";
@@ -1799,9 +1796,8 @@
18001797 </div>\
18011798 </fieldset>',
18021799 init: function() {
1803 - var u = mw.usability;
18041800 $j(this).find( '[rel]' ).each( function() {
1805 - $j(this).text( u.getMsg( $j(this).attr( 'rel' ) ) );
 1801+ $j(this).text( mediaWiki.msg( $j(this).attr( 'rel' ) ) );
18061802 });
18071803 // Set tabindexes on form fields
18081804 $j.wikiEditor.modules.dialogs.fn.setTabindexes( $j(this).find( 'input' ).not( '[tabindex]' ) );
@@ -1825,13 +1821,13 @@
18261822 flags += 'g';
18271823 }
18281824 if ( !isRegex ) {
1829 - searchStr = RegExp.escape( searchStr );
 1825+ searchStr = $.escapeRE( searchStr );
18301826 }
18311827 try {
18321828 var regex = new RegExp( searchStr, flags );
18331829 } catch( e ) {
18341830 $j( '#wikieditor-toolbar-replace-invalidregex' )
1835 - .text( u.getMsg( 'wikieditor-toolbar-tool-replace-invalidregex',
 1831+ .text( mediaWiki.msg( 'wikieditor-toolbar-tool-replace-invalidregex',
18361832 e.message ) )
18371833 .show();
18381834 return;
@@ -1880,7 +1876,7 @@
18811877 offset = newEnd;
18821878 }
18831879 $j( '#wikieditor-toolbar-replace-success' )
1884 - .text( u.getMsg( 'wikieditor-toolbar-tool-replace-success', match.length ) )
 1880+ .text( mediaWiki.msg( 'wikieditor-toolbar-tool-replace-success', match.length ) )
18851881 .show();
18861882 $j(this).data( 'offset', 0 );
18871883 } else {

Follow-up revisions

RevisionCommit summaryAuthorDate
r827001.17wmf1: MFT r82698, r82699catrope21:01, 23 February 2011

Comments

#Comment by 😂 (talk | contribs)   18:50, 30 March 2011

This would not merge cleanly to 1.17.

Status & tagging log