r81693 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81692‎ | r81693 | r81694 >
Date:06:56, 8 February 2011
Author:dale
Status:deferred
Tags:
Comment:
check for versions of jQuery ui and optionally override ( 1_17 includes jquery ui 1.8.4 )
Modified paths:
  • /branches/MwEmbedStandAlone/remotes/mediaWiki.js (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/remotes/mediaWiki.js
@@ -674,34 +674,7 @@
675675 }
676676 return rurl;
677677 }
678 -
679678 /**
680 - * Similar to php isset function checks if the variable exists. Does a safe
681 - * check of a descendant method or variable
682 - *
683 - * @param {String}
684 - * objectPath
685 - * @return {Boolean} true if objectPath exists false if objectPath is
686 - * undefined
687 - */
688 -window.mwIsset = function( objectPath ) {
689 - if ( !objectPath || typeof objectPath != 'string') {
690 - return false;
691 - }
692 - var pathSet = objectPath.split( '.' );
693 - var cur_path = '';
694 -
695 - for ( var p = 0; p < pathSet.length; p++ ) {
696 - cur_path = ( cur_path == '' ) ? cur_path + pathSet[p] : cur_path + '.' + pathSet[p];
697 - eval( 'var ptest = typeof ( ' + cur_path + ' ); ' );
698 - if ( ptest == 'undefined' ) {
699 - return false;
700 - }
701 - }
702 - return true;
703 -};
704 -
705 -/**
706679 * Load the mwEmbed library:
707680 *
708681 * @param {mixed} function or classSet to preload
@@ -728,6 +701,33 @@
729702 });
730703 return ;
731704 }
 705+
 706+ /**
 707+ * Similar to php isset function checks if the variable exists. Does a safe
 708+ * check of a descendant method or variable
 709+ *
 710+ * @param {String}
 711+ * objectPath
 712+ * @return {Boolean} true if objectPath exists false if objectPath is
 713+ * undefined
 714+ */
 715+ var mwIsset = function( objectPath ) {
 716+ if ( !objectPath || typeof objectPath != 'string') {
 717+ return false;
 718+ }
 719+ var pathSet = objectPath.split( '.' );
 720+ var cur_path = '';
 721+
 722+ for ( var p = 0; p < pathSet.length; p++ ) {
 723+ cur_path = ( cur_path == '' ) ? cur_path + pathSet[p] : cur_path + '.' + pathSet[p];
 724+ eval( 'var ptest = typeof ( ' + cur_path + ' ); ' );
 725+ if ( ptest == 'undefined' ) {
 726+ return false;
 727+ }
 728+ }
 729+ return true;
 730+ };
 731+
732732 var doLoadMwEmbed = function(){
733733 // Inject mwEmbed
734734 var rurl = mwEmbedHostPath + '/ResourceLoader.php?class=';
@@ -748,8 +748,8 @@
749749 classRequest += coma + 'mwEmbed,mw.style.mwCommon';
750750 coma = ',';
751751 }
752 - // Force any ui components:
753 - if( !mwAlreadyRequestedUi){
 752+ // Force any ui components if jQuery ui version '1.7.1' ( mediaWiki 1.16 )
 753+ if( !mwAlreadyRequestedUi && jQuery.ui && jQuery.ui.version == '1.7.1' ){
754754 classRequest += coma + mwForceUiComponents;
755755 mwAlreadyRequestedUi = true;
756756 }
@@ -757,8 +757,8 @@
758758 // Add requested classSet to scriptLoader request
759759 for( var i=0; i < classSet.length; i++ ){
760760 var cName = classSet[i];
761 - // don't load ui compoents force loaded above
762 - if(! mwIsset( cName ) && cName.indexOf( '$j.ui') == -1 ){
 761+ // don't load ui components force loaded above
 762+ if(! mwIsset( cName ) ){
763763 classRequest += ',' + cName;
764764 }
765765 }

Status & tagging log