r88597 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r88596‎ | r88597 | r88598 >
Date:19:44, 22 May 2011
Author:yaron
Status:deferred
Tags:
Comment:
Simplified addition of Javascript - it's now just handled via addScript(), since the JS has improved.
Modified paths:
  • /trunk/extensions/SemanticForms/specials/SF_FormEdit.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/specials/SF_FormEdit.php
@@ -351,21 +351,13 @@
352352 $text .= $form_text;
353353 }
354354 }
355 - // Instead of adding the Javascript using addScript(), which is
356 - // the standard approach, we add it using addHTML(), below the
357 - // form text - that's so the Javascript created for fields with
358 - // a 'show on select' parameter, if there are any, get placed
359 - // below the form HTML, so that they can affect (i.e., hide) the
360 - // relevant form fields. if there's a less hacky way to do this,
361 - // the code should switch to that.
362 - // if (! empty($javascript_text))
363 - // $wgOut->addScript(' <script type="text/javascript">' . "\n" . $javascript_text . '</script>' . "\n");
364 - $wgOut->addHTML( $text );
 355+
365356 SFUtils::addJavascriptAndCSS();
366357 if ( ! empty( $javascript_text ) ) {
367 - $wgOut->addHTML( ' <script type="text/javascript">' . "\n$javascript_text\n" . '</script>' . "\n" );
 358+ $wgOut->addScript( ' <script type="text/javascript">' . "\n$javascript_text\n" . '</script>' . "\n" );
368359 }
 360+ $wgOut->addHTML( $text );
 361+
369362 return null;
370363 }
371 -
372364 }