r70396 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70395‎ | r70396 | r70397 >
Date:18:37, 3 August 2010
Author:dale
Status:deferred
Tags:
Comment:
sync updates from resource loader updates from mwEmbedStandAlone
* resource loader updates
* improved removeLogStatements
Modified paths:
  • /trunk/extensions/JS2Support/mwEmbed/README (modified) (history)
  • /trunk/extensions/JS2Support/mwEmbed/ResourceLoader.php (modified) (history)
  • /trunk/extensions/JS2Support/mwEmbed/jsScriptLoader.php (deleted) (history)
  • /trunk/extensions/JS2Support/mwEmbed/libraries/jquery/plugins/modernizr.js (added) (history)
  • /trunk/extensions/JS2Support/mwEmbed/loader.js (modified) (history)
  • /trunk/extensions/JS2Support/mwEmbed/mwEmbed.js (modified) (history)
  • /trunk/extensions/JS2Support/mwEmbed/skins/common/common.css (deleted) (history)
  • /trunk/extensions/JS2Support/mwEmbed/skins/common/mw.style.mwCommon.css (added) (history)
  • /trunk/extensions/JS2Support/mwEmbed/tests (deleted) (history)

Diff [purge]

Index: trunk/extensions/JS2Support/mwEmbed/jsScriptLoader.php
@@ -1,3 +0,0 @@
2 -<?php
3 -// This file has been renamed to ResourceLoader
4 -require './ResourceLoader.php';
Index: trunk/extensions/JS2Support/mwEmbed/loader.js
@@ -1,4 +1,5 @@
22 /**
 3+*
34 * Core "loader.js" for mwEmbed
45 *
56 * This loader along with all the enabled module loaders is combined with mwEmbed.js
@@ -19,7 +20,8 @@
2021 */
2122 var mwCoreComponentList = [
2223 'mw.Parser',
23 - 'mw.Language'
 24+ 'mw.Language',
 25+ 'mw.Api'
2426 ];
2527
2628
@@ -57,26 +59,7 @@
5860 'enabledModules' : mwEnabledModuleList,
5961
6062 // Default jquery ui skin name
61 - 'jQueryUISkin' : 'jqueryUiRedmond',
62 -
63 - /**
64 - * If jQuery / mwEmbed should be loaded.
65 - *
66 - * This flag is automatically set to true if:
67 - * Any script calls mw.ready ( callback_function )
68 - * Page DOM includes any tags set in config.rewritePlayerTags at onDomReady
69 - * ( embedPlayer module )
70 - *
71 - * This flag increases page performance on pages that do not use mwEmbed
72 - * and don't already load jQuery
73 - *
74 - * For example when including the mwEmbed.js in your blog template
75 - * mwEmbed will only load extra js on blog posts that include the video tag.
76 - *
77 - * NOTE: Future architecture will probably do away with this flag and refactor it into
78 - * a smaller 'remotePageMwEmbed.js' script similar to ../remoteMwEmbed.js
79 - */
80 - 'runSetupMwEmbed' : false,
 63+ 'jQueryUISkin' : 'redmond',
8164
8265 // The mediaWiki path of mwEmbed
8366 'mediaWikiEmbedPath' : 'js/mwEmbed/',
@@ -125,11 +108,12 @@
126109 "mwEmbed" : "mwEmbed.js",
127110 "window.jQuery" : "libraries/jquery/jquery-1.4.2.js",
128111
129 - "mw.Language" : "languages/mw.Language.js",
130 - "mw.Parser" : "languages/mw.Parser.js",
 112+ "mw.Language" : "components/mw.Language.js",
 113+ "mw.Parser" : "components/mw.Parser.js",
 114+ "mw.Api" : "components/mw.Api.js",
 115+ "Modernizr" : "libraries/jquery/plugins/modernizr.js",
 116+ "JSON" : "libraries/json/json2.js",
131117
132 - "JSON" : "libraries/json/json2.js",
133 -
134118 "$j.replaceText.js" : "libraries/jquery/plugins/jquery.replaceText.js",
135119
136120 "$j.fn.menu" : "libraries/jquery/plugins/jquery.menu/jquery.menu.js",
@@ -143,16 +127,21 @@
144128 "$j.fn.datePicker" : "libraries/jquery/plugins/jquery.datePicker.js",
145129 "$j.ui" : "libraries/jquery/jquery.ui/ui/ui.core.js",
146130
147 - "mw.style.jqueryUiRedmond" : "libraries/jquery/jquery.ui/themes/redmond/jquery-ui-1.7.1.custom.css",
148 - "mw.style.jqueryUiSmoothness" : "libraries/jquery/jquery.ui/themes/smoothness/jquery-ui-1.7.1.custom.css",
149 - "mw.style.mwCommon" : "skins/common/common.css",
 131+ "mw.style.ui_redmond" : "skins/jquery.ui.themes/redmond/jquery-ui-1.7.2.css",
 132+ "mw.style.ui_darkness" : "skins/jquery.ui.themes/darkness/jquery-ui-1.7.2.css",
 133+ "mw.style.ui_le-frog" : "skins/jquery.ui.themes/le-frog/jquery-ui-1.7.2.css",
 134+ "mw.style.ui_start" : "skins/jquery.ui.themes/start/jquery-ui-1.7.2.css",
 135+ "mw.style.ui_sunny" : "skins/jquery.ui.themes/sunny/jquery-ui-1.7.2.css",
 136+
 137+ "mw.style.mwCommon" : "skins/common/mw.style.mwCommon.css",
150138
151139 "$j.cookie" : "libraries/jquery/plugins/jquery.cookie.js",
152140
153141 "$j.contextMenu" : "libraries/jquery/plugins/jquery.contextMenu.js",
154142 "$j.fn.suggestions" : "libraries/jquery/plugins/jquery.suggestions.js",
155143 "$j.fn.textSelection" : "libraries/jquery/plugins/jquery.textSelection.js",
156 - "$j.browserTest" : "libraries/jquery/plugins/jquery.browserTest.js",
 144+ "$j.browserTest" : "libraries/jquery/plugins/jquery.browserTest.js",
 145+ "$j.fn.jWizard" : "libraries/jquery/plugins/jquery.jWizard.js",
157146
158147 "$j.effects.blind" : "libraries/jquery/jquery.ui/ui/effects.blind.js",
159148 "$j.effects.drop" : "libraries/jquery/jquery.ui/ui/effects.drop.js",
@@ -172,7 +161,7 @@
173162 "$j.ui.dialog" : "libraries/jquery/jquery.ui/ui/ui.dialog.js",
174163 "$j.ui.resizable" : "libraries/jquery/jquery.ui/ui/ui.resizable.js",
175164 "$j.ui.tabs" : "libraries/jquery/jquery.ui/ui/ui.tabs.js",
176 - "$j.effects" : "libraries/jquery/jquery.ui/ui/effects.core.js",
 165+ "$j.effects" : "libraries/jquery/jquery.ui/ui/effects.core.js",
177166 "$j.effects.highlight" : "libraries/jquery/jquery.ui/ui/effects.highlight.js",
178167 "$j.effects.slide" : "libraries/jquery/jquery.ui/ui/effects.slide.js",
179168 "$j.ui.accordion" : "libraries/jquery/jquery.ui/ui/ui.accordion.js",
@@ -181,8 +170,8 @@
182171
183172 } );
184173
185 -// Add a special css dependency for $j.ui
 174+// Add a special css dependency for $j.ui
186175 mw.addStyleResourceDependency( {
187 - '$j.ui' : ( 'mw.style.' + mw.getConfig( 'jQueryUISkin' ) )
 176+ '$j.ui' : ( 'mw.style.ui_' + mw.getConfig( 'jQueryUISkin' ) )
188177 } );
189178
Index: trunk/extensions/JS2Support/mwEmbed/ResourceLoader.php
@@ -27,6 +27,7 @@
2828 $myResourceLoader->doResourceLoader();
2929 }
3030
 31+
3132 class ResourceLoader {
3233
3334 // The list of named javascript & css files
@@ -101,7 +102,7 @@
102103 try {
103104 NamedResourceLoader::loadResourcePaths();
104105 } catch( Exception $e ) {
105 - $this->errorMsg .= $e->getMessage() ;
 106+ $this->errorMsg .= "loadResourcePaths:" . $e->getMessage() ;
106107 }
107108
108109 // Reset the requestKey:
@@ -182,7 +183,7 @@
183184 if ( $wgUseFileCache && !$this->debug ) {
184185 $status = $this->sFileCache->saveToFileCache( $this->output );
185186 if ( $status !== true ) {
186 - $this->errorMsg .= $status;
 187+ $this->errorMsg .= "Could not save file to cache::" . $status;
187188 }
188189 }
189190
@@ -190,7 +191,7 @@
191192 if ( $this->errorMsg != '' ) {
192193 //just set the content type (don't send cache header)
193194 header( 'Content-Type: text/javascript' );
194 - echo 'if(console.log)console.log(\'Error With ScriptLoader ::' .
 195+ echo 'if(console.log)console.log(\'Error With ResourceLoader ::' .
195196 str_replace( "\n", '\'+"\n"+' . "\n'",
196197 xml::escapeJsString( $this->errorMsg )
197198 ) . '\');'."\n";
@@ -378,7 +379,7 @@
379380 if( $fileContents ){
380381 // Add the file name if debug is enabled
381382 if ( $this->debug ){
382 - $output .= "\n/**\n* File: " . xml::escapeJsString( $filePath ) . "\n*/\n";
 383+ $output .= "\n\n/**\n* File: " . xml::escapeJsString( $filePath ) . "\n*/\n";
383384 }
384385 // Transform the css output if the file is css
385386 $output.= ( $ext == 'css' ) ?
@@ -728,7 +729,7 @@
729730 try {
730731 NamedResourceLoader::loadResourcePaths();
731732 } catch( Exception $e ) {
732 - $this->errorMsg .= $e->getMessage() ;
 733+ $this->errorMsg .= "getPathFromClass: " . $e->getMessage() ;
733734 }
734735
735736 if ( isset( $wgResourceLoaderNamedPaths[ $reqClass ] ) ) {
@@ -811,7 +812,7 @@
812813 global $wgEnableScriptLocalization;
813814 // Strip out mw.log debug lines (if not in debug mode)
814815 if( !$this->debug ){
815 - $scriptText = preg_replace( '/\n\s*mw\.log\(([^\)]*\))*\s*[\;\n]/U', "\n", $scriptText );
 816+ $scriptText = $this->removeLogStatements( $scriptText );
816817 }
817818
818819 // Do language swap by index:
@@ -854,6 +855,71 @@
855856 // Return the javascript str unmodified if we did not transform with the localisation
856857 return $scriptText;
857858 }
 859+ /**
 860+ * Remove all occurances of mw.log( 'some js string or expresion' );
 861+ * @param {string} $jsString
 862+ */
 863+ static function removeLogStatements( $jsString ){
 864+ $outputJs = '';
 865+ for ( $i = 0; $i < strlen( $jsString ); $i++ ) {
 866+ // find next occurance of
 867+ preg_match( '/[\n;]\s*mw\.log\s*/', $jsString, $matches, PREG_OFFSET_CAPTURE, $i );
 868+ // check if any matches are left:
 869+ if( count( $matches ) == 0){
 870+ $outputJs .= substr( $jsString, $i );
 871+ break;
 872+ }
 873+ if( count( $matches ) > 0 ){
 874+ $startOfLogIndex = strlen( $matches[0][0] ) + $matches[0][1];
 875+ // append everytnig up to this point:
 876+ $outputJs .= substr( $jsString, $i, ( $startOfLogIndex - strlen( $matches[0][0] ) )-$i );
 877+
 878+ // Increment i to position of closing ) not inside quotes
 879+ $parenthesesDepth = 0;
 880+ $ignorenext = false;
 881+ $inquote = false;
 882+ $inSingleQuote = false;
 883+ for ( $i = $startOfLogIndex; $i < strlen( $jsString ); $i++ ) {
 884+ $char = $jsString[$i];
 885+ if ( $ignorenext ) {
 886+ $ignorenext = false;
 887+ } else {
 888+ // Search for a close ) that is not in quotes
 889+ switch( $char ) {
 890+ case '"':
 891+ if( !$inSingleQuote ){
 892+ $inquote = !$inquote;
 893+ }
 894+ break;
 895+ case '\'':
 896+ if( !$inquote ){
 897+ $inSingleQuote = !$inSingleQuote;
 898+ }
 899+ break;
 900+ case '(':
 901+ if( !$inquote && !$inSingleQuote ){
 902+ $parenthesesDepth++;
 903+ }
 904+ break;
 905+ case ')':
 906+ if( ! $inquote && !$inSingleQuote ){
 907+ $parenthesesDepth--;
 908+ }
 909+ break;
 910+ case '\\':
 911+ if ( $inquote ) $ignorenext = true;
 912+ break;
 913+ }
 914+ // Done with close parentheses search for next mw.log in outer loop:
 915+ if( $parenthesesDepth === 0 ){
 916+ break;
 917+ }
 918+ }
 919+ }
 920+ }
 921+ }
 922+ return $outputJs;
 923+ }
858924 /* simple function to return addMessageJs without preg_replace back reference substitution */
859925 private static function preg_addMessageJs(){
860926 return self::$addMessageJs;
Index: trunk/extensions/JS2Support/mwEmbed/skins/common/common.css
@@ -1,167 +0,0 @@
2 -
3 -.modal_editor {
4 - /*background:#AAA none repeat scroll 0 0;
5 - border:3px solid #666666;*/
6 - left:10px;
7 - top:10px;
8 - right:10px;
9 - bottom:10px;
10 - position:fixed;
11 - z-index:100;
12 -}
13 -.mv_track {
14 - margin-bottom:20px;
15 - position:relative;
16 -}
17 -
18 -
19 -
20 -.displayHTML a:visited {
21 - color:white;
22 -}
23 -.inputTrackerInput {
24 - height:20;
25 - width:30;
26 - font-family : Arial, Helvetica, sans-serif;
27 - font-size : 12px;
28 -}
29 -.mv_loading_icon {
30 - position:absolute;
31 - top:0px;
32 - right:0px;
33 - width:16px;
34 - height:16px;
35 -}
36 -.loadingSpinner{
37 - width:32px;
38 - height:32px;
39 - display:block;
40 - padding:0px;
41 - background-image: url('images/loading_ani.gif');
42 - margin-left: auto ;
43 - margin-right: auto ;
44 -}
45 -
46 -/* jquery.ui overides */
47 -
48 -.ui-icon_link {
49 - padding: .4em 1em .4em 20px;
50 - text-decoration: none;
51 - position: relative;
52 -}
53 -.ui-icon_link span.ui-icon {
54 - margin: 0 5px 0 0;
55 - position: absolute;
56 - left: 0.2em;
57 - right: auto;
58 - top: 50%;
59 - margin-top: -8px;
60 - zoom: 1;
61 -}
62 -.ui-icon_link span.ui-text {
63 - position: absolute;
64 - left: 0.2em;
65 - right: auto;
66 - margin-top: -3px;
67 - zoom: 1;
68 -}
69 -
70 -.ui-progressbar-value{
71 - background-image: url('images/pbar-ani.gif');
72 -}
73 -
74 -.ui-widget-overlay{
75 - background: url('images/ui-bg_diagonals-thick_20_666666_40x40.png') repeat scroll 50% 50% #666666;
76 - opacity:0.5;
77 -}
78 -
79 -.ui-widget-content input {
80 - padding: 5px;
81 -}
82 -.ui-widget-content a {
83 - color:#009;
84 -}
85 -
86 -ul.ui-provider-selection {
87 - list-style-type: none;
88 - margin: 0 0 0.6em 0;
89 - overflow: hidden;
90 - padding: 0;
91 - text-align: center;
92 -}
93 -
94 -ul.ui-provider-selection li {
95 - border-left: 1px solid black;
96 - float: left;
97 - line-height: 1.1em;
98 - margin: 0 0.5em 0 -0.5em;
99 - padding: 0 0.5em;
100 - color: blue;
101 - list-style-image:none;
102 - cursor:pointer;
103 -}
104 -
105 -ul.ui-provider-selection li .ui-selected {
106 - color: black;
107 - font-weight: bold;
108 -}
109 -
110 -ul.ui-provider-selection li a.ui-active {
111 - color: black;
112 - font-weight: bold;
113 -}
114 -
115 -ul.ui-provider-selection li a {
116 - color: blue;
117 - text-decoration: none;
118 -}
119 -
120 -/* Vertical Tabs
121 -.ui-dialog-buttonpane { padding:4px !important; }
122 -.ui-tabs-vertical { width: 100%; }
123 -.ui-tabs-vertical .ui-tabs-nav { padding: .2em .1em .2em .2em; float: left; width: 25%; }
124 -.ui-tabs-vertical .ui-tabs-nav li { clear: left; width: 100%; border-bottom-width: 1px !important; border-right-width: 0 !important; margin: 0 -1px .2em 0; }
125 -.ui-tabs-vertical .ui-tabs-nav li a { display:block; }
126 -.ui-tabs-vertical .ui-tabs-nav li.ui-tabs-selected { padding-bottom: 0; padding-right: .1em; border-right-width: 1px; border-right-width: 1px; }
127 -.ui-tabs-vertical .ui-tabs-panel { padding: 1em; float: right; width: 68%;}
128 -
129 -.ui-dialog .ui-dialog-buttonpane button { float: left !important; }
130 -*/
131 -
132 -
133 -.mw-imported-resource{
134 - border: thin solid black;
135 -}
136 -
137 -.kaltura-icon {
138 - background-image:url('images/kaltura_logo_sm_transparent.png') !important;
139 - background-repeat:no-repeat;
140 - display: block;
141 - height: 12px;
142 - width: 12px;
143 - margin-top: -6px !important;
144 - margin-left: 3px !important;
145 -}
146 -
147 -.mw-fullscreen-overlay {
148 - background: rgb(0, 0, 0) none repeat scroll 0% 0%;
149 - position: fixed;
150 - top: 0pt;
151 - left: 0pt;
152 - width: 100%;
153 - height: 100%;
154 - -moz-background-clip: border;
155 - -moz-background-origin: padding;
156 - -moz-background-inline-policy: continuous;
157 -}
158 -
159 -.fg-menu .ui-icon{
160 - position:relative;
161 - top:-1px;
162 -}
163 -
164 -.ui-dialog-buttonpane a{
165 - float: right;
166 - margin-right: 10px;
167 -}
Index: trunk/extensions/JS2Support/mwEmbed/skins/common/mw.style.mwCommon.css
@@ -0,0 +1,181 @@
 2+
 3+.modal_editor {
 4+ /*background:#AAA none repeat scroll 0 0;
 5+ border:3px solid #666666;*/
 6+ left:10px;
 7+ top:10px;
 8+ right:10px;
 9+ bottom:10px;
 10+ position:fixed;
 11+ z-index:100;
 12+}
 13+
 14+.displayHTML a:visited {
 15+ color:white;
 16+}
 17+
 18+.loadingSpinner{
 19+ width:32px;
 20+ height:32px;
 21+ display:block;
 22+ padding:0px;
 23+ background-image: url('images/loading_ani.gif');
 24+ margin: auto ;
 25+}
 26+.cssLoadingSpinner {
 27+ position:relative;
 28+ width:100px;
 29+ height:100px;
 30+ //margin:25px;
 31+ -moz-border-radius:100px;
 32+ float:left;
 33+ -moz-transform:scale(0.3);
 34+ -webkit-transform:scale(0.3);
 35+
 36+ /* not used right now: */
 37+ -webkit-animation-name: rotateThis;
 38+ -webkit-animation-duration:2s;
 39+ -webkit-animation-iteration-count:infinite;
 40+ -webkit-animation-timing-function:linear;
 41+}
 42+.cssLoadingSpinner div {
 43+ width:15px;
 44+ height:30px;
 45+ position:absolute;
 46+ top:35px;
 47+ left:45px;
 48+}
 49+.cssLoadingSpinner div {
 50+ -moz-border-radius:30px;
 51+ -webkit-border-radius:30px;
 52+ border-radius:30px;
 53+}
 54+/* uncomment this to use css animation in webkit browsers */
 55+ @-webkit-keyframes rotateThis {
 56+ from {-webkit-transform:scale(0.7) rotate(0deg);}
 57+ to {-webkit-transform:scale(0.7) rotate(360deg);}
 58+}
 59+
 60+/* jquery.ui overides */
 61+
 62+.ui-icon_link {
 63+ padding: .4em 1em .4em 20px;
 64+ text-decoration: none;
 65+ position: relative;
 66+}
 67+.ui-icon_link span.ui-icon {
 68+ margin: 0 5px 0 0;
 69+ position: absolute;
 70+ left: 0.2em;
 71+ right: auto;
 72+ top: 50%;
 73+ margin-top: -8px;
 74+ zoom: 1;
 75+}
 76+.ui-icon_link span.ui-text {
 77+ position: absolute;
 78+ left: 0.2em;
 79+ right: auto;
 80+ margin-top: -3px;
 81+ zoom: 1;
 82+}
 83+
 84+.ui-progressbar-value{
 85+ background-image: url('images/pbar-ani.gif');
 86+}
 87+
 88+.ui-widget-overlay{
 89+ background: url('images/ui-bg_diagonals-thick_20_666666_40x40.png') repeat scroll 50% 50% #666666;
 90+ opacity:0.5;
 91+}
 92+
 93+.ui-widget-content input {
 94+ padding: 5px;
 95+}
 96+.ui-widget-content a {
 97+ color:#009;
 98+}
 99+
 100+ul.ui-provider-selection {
 101+ list-style-type: none;
 102+ margin: 0 0 0.6em 0;
 103+ overflow: hidden;
 104+ padding: 0;
 105+ text-align: center;
 106+}
 107+
 108+ul.ui-provider-selection li {
 109+ border-left: 1px solid black;
 110+ float: left;
 111+ line-height: 1.1em;
 112+ margin: 0 0.5em 0 -0.5em;
 113+ padding: 0 0.5em;
 114+ color: blue;
 115+ list-style-image:none;
 116+ cursor:pointer;
 117+}
 118+
 119+ul.ui-provider-selection li .ui-selected {
 120+ color: black;
 121+ font-weight: bold;
 122+}
 123+
 124+ul.ui-provider-selection li a.ui-active {
 125+ color: black;
 126+ font-weight: bold;
 127+}
 128+
 129+ul.ui-provider-selection li a {
 130+ color: blue;
 131+ text-decoration: none;
 132+}
 133+
 134+/* Vertical Tabs
 135+----------------------------------
 136+.ui-dialog-buttonpane { padding:4px !important; }
 137+.ui-tabs-vertical { width: 100%; }
 138+.ui-tabs-vertical .ui-tabs-nav { padding: .2em .1em .2em .2em; float: left; width: 25%; }
 139+.ui-tabs-vertical .ui-tabs-nav li { clear: left; width: 100%; border-bottom-width: 1px !important; border-right-width: 0 !important; margin: 0 -1px .2em 0; }
 140+.ui-tabs-vertical .ui-tabs-nav li a { display:block; }
 141+.ui-tabs-vertical .ui-tabs-nav li.ui-tabs-selected { padding-bottom: 0; padding-right: .1em; border-right-width: 1px; border-right-width: 1px; }
 142+.ui-tabs-vertical .ui-tabs-panel { padding: 1em; float: right; width: 68%;}
 143+
 144+.ui-dialog .ui-dialog-buttonpane button { float: left !important; }
 145+*/
 146+
 147+
 148+.mw-imported-resource{
 149+ border: thin solid black;
 150+}
 151+
 152+.kaltura-icon {
 153+ background-image:url('images/kaltura_logo_sm_transparent.png') !important;
 154+ background-repeat:no-repeat;
 155+ display: block;
 156+ height: 12px;
 157+ width: 12px;
 158+ margin-top: -6px !important;
 159+ margin-left: 3px !important;
 160+}
 161+
 162+.mw-fullscreen-overlay {
 163+ background: rgb(0, 0, 0) none repeat scroll 0% 0%;
 164+ position: fixed;
 165+ top: 0pt;
 166+ left: 0pt;
 167+ width: 100%;
 168+ height: 100%;
 169+ -moz-background-clip: border;
 170+ -moz-background-origin: padding;
 171+ -moz-background-inline-policy: continuous;
 172+}
 173+
 174+.fg-menu .ui-icon{
 175+ position:relative;
 176+ top:-1px;
 177+}
 178+
 179+.ui-dialog-buttonpane a{
 180+ float: right;
 181+ margin-right: 10px;
 182+}
Property changes on: trunk/extensions/JS2Support/mwEmbed/skins/common/mw.style.mwCommon.css
___________________________________________________________________
Added: svn:eol-style
1183 + native
Added: svn:executable
2184 + *
Index: trunk/extensions/JS2Support/mwEmbed/mwEmbed.js
@@ -16,18 +16,18 @@
1717 */
1818
1919 /**
20 -* Setup the "mw" global:
21 -*/
 20+ * Setup the "mw" global:
 21+ */
2222 if ( typeof window.mw == 'undefined' ) {
2323 window.mw = { };
2424 }
2525
2626 /**
27 -* Set the mwEmbedVersion
28 -*/
 27+ * Set the mwEmbedVersion
 28+ */
2929 var MW_EMBED_VERSION = '1.1g';
3030
31 -// Globals to pre-set ready functions in dynamic loading of mwEmbed
 31+// Globals to pre-set ready functions in dynamic loading of mwEmbed
3232 if( typeof preMwEmbedReady == 'undefined'){
3333 var preMwEmbedReady = [];
3434 }
@@ -37,8 +37,8 @@
3838 }
3939
4040 /**
41 -* The global mw object:
42 -*/
 41+ * The global mw object:
 42+ */
4343 ( function( mw ) {
4444 // The version of mwEmbed
4545 mw.version = MW_EMBED_VERSION
@@ -46,31 +46,32 @@
4747 // List valid skins here:
4848 mw.validSkins = [ 'mvpcf', 'kskin' ];
4949
50 - // Storage variable for loaded style sheet keys
 50+ // Storage variable for loaded style sheet keys
5151 mw.style = { };
5252
5353 /**
54 - * Configuration System:
55 - */
 54+ * Configuration System:
 55+ */
5656
5757 // Local scope configuration var:
5858 if( !mwConfig ){
5959 var mwConfig = { };
6060 }
6161
62 - // Local scope mwUserConfig var. Stores user configuration
 62+ // Local scope mwUserConfig var. Stores user configuration
6363 var mwUserConfig = { };
6464
6565 /**
66 - * Setter for configuration values
67 - *
68 - * @param [Mixed] name Name of configuration value
69 - * {Object} Will iderate through each key and call setConfig
70 - * {String} Will set configuration by string name to value
71 - * @param
72 - * {String} value Value of configuration name
73 - * {Object} value Set of values to be merged
74 - */
 66+ * Setter for configuration values
 67+ *
 68+ * @param [Mixed]
 69+ * name Name of configuration value {Object} Will iderate through
 70+ * each key and call setConfig {String} Will set configuration by
 71+ * string name to value
 72+ * @param {String}
 73+ * value Value of configuration name {Object} value Set of values
 74+ * to be merged
 75+ */
7576 mw.setConfig = function ( name, value ) {
7677 if( typeof name == 'object' ) {
7778 for( var i in name ) {
@@ -89,12 +90,14 @@
9091 }
9192
9293 /**
93 - * Set a default config value
94 - * Will only update configuration if no value is present
95 - * @param [Mixed] value Set configuration name to value
96 - * {Object} Will iderate through each key and call setDefaultConfig
97 - * {String} Will set configuration by string name to value
98 - */
 94+ * Set a default config value Will only update configuration if no value is
 95+ * present
 96+ *
 97+ * @param [Mixed]
 98+ * value Set configuration name to value {Object} Will iderate
 99+ * through each key and call setDefaultConfig {String} Will set
 100+ * configuration by string name to value
 101+ */
99102 mw.setDefaultConfig = function( name, value ) {
100103 if( typeof name == 'object' ) {
101104 for( var i in name ) {
@@ -102,19 +105,21 @@
103106 }
104107 return ;
105108 }
106 - // Only update the controls if undefined ( ie don't override false properties )
 109+ // Only update the controls if undefined ( ie don't override false
 110+ // properties )
107111 if( typeof mwConfig[ name ] == 'undefined') {
108112 mwConfig[ name ] = value;
109113 }
110114 }
111115
112116 /**
113 - * Getter for configuration values
114 - *
115 - * @param {String} name of configuration value to get
116 - * @return {Mixed} value of configuration key
117 - * returns "false" if key not found
118 - */
 117+ * Getter for configuration values
 118+ *
 119+ * @param {String}
 120+ * name of configuration value to get
 121+ * @return {Mixed} value of configuration key returns "false" if key not
 122+ * found
 123+ */
119124 mw.getConfig = function ( name ) {
120125 if( mwConfig[ name ] )
121126 return mwConfig[ name ];
@@ -122,19 +127,20 @@
123128 }
124129
125130 /**
126 - * Loads the mwUserConfig from a cookie.
127 - *
128 - * Modules that want to use "User Config" should call
129 - * this setup function in their moduleLoader code.
130 - *
131 - * For performance interfaces using "user config"
132 - * should load '$j.cookie' & 'JSON' in their module loader
133 - *
134 - * By abstracting user preference we could eventually integrate
135 - * a persistent per-account preference system on the server.
136 - *
137 - * @parma {Function} callback Function to be called once userPrefrences are loaded
138 - */
 131+ * Loads the mwUserConfig from a cookie.
 132+ *
 133+ * Modules that want to use "User Config" should call this setup function in
 134+ * their moduleLoader code.
 135+ *
 136+ * For performance interfaces using "user config" should load '$j.cookie' &
 137+ * 'JSON' in their module loader
 138+ *
 139+ * By abstracting user preference we could eventually integrate a persistent
 140+ * per-account preference system on the server.
 141+ *
 142+ * @parma {Function} callback Function to be called once userPrefrences are
 143+ * loaded
 144+ */
139145 var setupUserConfigFlag = false;
140146 mw.setupUserConfig = function( callback ) {
141147 if( setupUserConfigFlag ) {
@@ -143,7 +149,7 @@
144150 }
145151 return ;
146152 }
147 - // Do Setup user config:
 153+ // Do Setup user config:
148154 mw.load( [ '$j.cookie', 'JSON' ], function() {
149155 if( $j.cookie( 'mwUserConfig' ) ) {
150156 mwUserConfig = JSON.parse( $j.cookie( 'mwUserConfig' ) );
@@ -156,12 +162,14 @@
157163 }
158164
159165 /**
160 - * Save a user configuration var to a cookie & local global variable
161 - * Loads the cookie plugin if not already loaded
162 - *
163 - * @param {String} name Name of user configuration value
164 - * @param {String} value Value of configuration name
165 - */
 166+ * Save a user configuration var to a cookie & local global variable Loads
 167+ * the cookie plugin if not already loaded
 168+ *
 169+ * @param {String}
 170+ * name Name of user configuration value
 171+ * @param {String}
 172+ * value Value of configuration name
 173+ */
166174 mw.setUserConfig = function ( name, value, cookieOptions ) {
167175 if( ! setupUserConfigFlag ) {
168176 mw.log( "Error: userConfig not setup" );
@@ -170,18 +178,18 @@
171179 // Update local value
172180 mwUserConfig[ name ] = value;
173181
174 - // Update the cookie ( '$j.cookie' & 'JSON' should already be loaded )
 182+ // Update the cookie ( '$j.cookie' & 'JSON' should already be loaded )
175183 $j.cookie( 'mwUserConfig', JSON.stringify( mwUserConfig ) );
176184 }
177185
178186 /**
179 - * Save a user configuration var to a cookie & local global variable
180 - *
181 - * @param {String} name Name of user configuration value
182 - * @return
183 - * value of the configuration name
184 - * false if the configuration name could not be found
185 - */
 187+ * Save a user configuration var to a cookie & local global variable
 188+ *
 189+ * @param {String}
 190+ * name Name of user configuration value
 191+ * @return value of the configuration name false if the configuration name
 192+ * could not be found
 193+ */
186194 mw.getUserConfig = function ( name ) {
187195 if( mwUserConfig[ name ] )
188196 return mwUserConfig[ name ];
@@ -189,25 +197,28 @@
190198 }
191199
192200 /**
193 - * Add a hook system for a target object / interface
194 - *
195 - * depricated you should instead use jQuery's bind and trigger
196 - *
197 - * @param {Object} targetObj Interface Object to add hook system to.
198 - */
 201+ * Add a hook system for a target object / interface
 202+ *
 203+ * depricated you should instead use jQuery's bind and trigger
 204+ *
 205+ * @param {Object}
 206+ * targetObj Interface Object to add hook system to.
 207+ */
199208 mw.addHookSystem = function( targetObj ) {
200209
201210 // Setup the target object hook holder:
202211 targetObj[ 'hooks' ] = { };
203212
204213 /**
205 - * Adds a hook to the target object
206 - *
207 - * Should be called by clients to setup named hooks
208 - *
209 - * @param {String} hookName Name of hook to be added
210 - * @param {Function} hookFunction Function to be called at hook time
211 - */
 214+ * Adds a hook to the target object
 215+ *
 216+ * Should be called by clients to setup named hooks
 217+ *
 218+ * @param {String}
 219+ * hookName Name of hook to be added
 220+ * @param {Function}
 221+ * hookFunction Function to be called at hook time
 222+ */
212223 targetObj.addHook = function( hookName, hookFunction ) {
213224 if( ! this.hooks[ hookName ] ) {
214225 this.hooks[ hookName ] = [ ];
@@ -216,15 +227,15 @@
217228 }
218229
219230 /**
220 - * Runs all the hooks by a given name with reference to the host object
221 - *
222 - * Should be called by the host object at named execution points
223 - *
224 - * @param {String} hookName Name of hook to be called
225 - * @return Value of hook result
226 - * true interface should continue function execution
227 - * false interface should stop or return from method
228 - */
 231+ * Runs all the hooks by a given name with reference to the host object
 232+ *
 233+ * Should be called by the host object at named execution points
 234+ *
 235+ * @param {String}
 236+ * hookName Name of hook to be called
 237+ * @return Value of hook result true interface should continue function
 238+ * execution false interface should stop or return from method
 239+ */
229240 targetObj.runHook = function( hookName, options ) {
230241 if( this.hooks[ hookName ] ) {
231242 for( var i =0; i < this.hooks[ hookName ].length; i ++ ) {
@@ -244,104 +255,113 @@
245256
246257
247258 /**
248 - * Top level loader prototype:
249 - */
 259+ * Top level loader prototype:
 260+ */
250261 mw.loader = {
251262 /**
252 - * Javascript Module Loader functions
253 - * @key Name of Module
254 - * @value function code to load module
255 - */
 263+ * Javascript Module Loader functions
 264+ *
 265+ * @key Name of Module
 266+ * @value function code to load module
 267+ */
256268 moduleLoaders : [],
257269
258270 /**
259 - * Module resource list queue.
260 - * @key Name of Module
261 - * @value
262 - * .resourceList list of resources to be loaded
263 - * .functionQueue list of functions to be run once module is ready
264 - */
 271+ * Module resource list queue.
 272+ *
 273+ * @key Name of Module
 274+ * @value .resourceList list of resources to be loaded .functionQueue
 275+ * list of functions to be run once module is ready
 276+ */
265277 moduleLoadQueue: { },
266278
267279 /**
268 - * Javascript Class Paths
269 - * @key Name of resource
270 - * @value Class file path
271 - */
 280+ * Javascript Class Paths
 281+ *
 282+ * @key Name of resource
 283+ * @value Class file path
 284+ */
272285 resourcePaths : { },
273286
274287 /**
275 - * javascript Resource Paths
276 - * @key Name of resource
277 - * @value Name of depenent style sheet
278 - */
 288+ * javascript Resource Paths
 289+ *
 290+ * @key Name of resource
 291+ * @value Name of depenent style sheet
 292+ */
279293 resourceStyleDependency: { },
280294
281295 /**
282 - * Core load function:
283 - *
284 - * @param {Mixed} loadRequest:
285 - *
286 - * {String} Name of a module to be loaded
287 - * Modules are added via addModuleLoader and can define custom
288 - * code needed to check config and return a list of resources
289 - * to be loaded
290 - *
291 - * {String} Name of a resource to loaded.
292 - * Resources are added via addResourcePaths function
293 - * Using defined resource names avoids loading the same resource
294 - * twice by first checking if the named resource is defined in
295 - * the global javascript scope variable
296 - *
297 - * {String} Absolute or relative to url path
298 - * The same file won't be loaded twice
299 - *
300 - * {Array} can be an array of any combination of the above strings.
301 - * Will be loaded in-order or in a single resource loader request
302 - * if scriptLoader is available.
303 - *
304 - * {Array} {Array} Can be a set of Arrays for loading.
305 - * Some browsers execute included scripts out of order.
306 - * This lets you chain sets of request for those browsers.
307 - * If using the server side resource loader order is preserved
308 - * in output and a single request will be used.
309 - *
310 - * @param {Function} callback Function called once loading is complete
311 - *
312 - */
313 - load: function( loadRequest, instanceCallback ) {
314 - // Ensure the callback is only called once per load instance
 296+ * Core load function:
 297+ *
 298+ * @param {Mixed}
 299+ * loadRequest:
 300+ *
 301+ * {String} Name of a module to be loaded Modules are added via
 302+ * addModuleLoader and can define custom code needed to check config and
 303+ * return a list of resources to be loaded
 304+ *
 305+ * {String} Name of a resource to loaded. Resources are added via
 306+ * addResourcePaths function Using defined resource names avoids loading
 307+ * the same resource twice by first checking if the named resource is
 308+ * defined in the global javascript scope variable
 309+ *
 310+ * {String} Absolute or relative to url path The same file won't be
 311+ * loaded twice
 312+ *
 313+ * {Array} can be an array of any combination of the above strings. Will
 314+ * be loaded in-order or in a single resource loader request if
 315+ * scriptLoader is available.
 316+ *
 317+ * {Array} {Array} Can be a set of Arrays for loading. Some browsers
 318+ * execute included scripts out of order. This lets you chain sets of
 319+ * request for those browsers. If using the server side resource loader
 320+ * order is preserved in output and a single request will be used.
 321+ *
 322+ * @param {Function}
 323+ * callback Function called once loading is complete
 324+ *
 325+ */
 326+ load: function( loadRequest, instanceCallback ) {
 327+ // mw.log("mw.load:: " + loadRequest );
 328+
 329+ // Throw out any loadRequests that are not strings
 330+ loadRequest = this.cleanLoadRequest( loadRequest );
 331+
 332+ // Ensure the callback is only called once per load instance
315333 var callback = function(){
316 - //mw.log( 'instanceCallback::running callback: ' + instanceCallback );
 334+ // mw.log( 'instanceCallback::running callback: ' +
 335+ // instanceCallback );
317336 if( instanceCallback ){
318 - // We pass the loadRequest back to the callback for easy debuging of concurrency issues.
319 - // ( normally its not used )
 337+ // We pass the loadRequest back to the callback for easy
 338+ // debugging of concurrency issues.
 339+ // ( normally its not used )
320340 instanceCallback( loadRequest );
321341 instanceCallback = null;
322342 }
323 - }
324 -
325 - // Check for empty loadRequest ( directly return the callback )
 343+ }
 344+
 345+ // Check for empty loadRequest ( directly return the callback )
326346 if( mw.isEmpty( loadRequest ) ) {
327 - mw.log( 'Empty load request: ' + loadRequest );
 347+ mw.log( 'Empty load request: ( ' + loadRequest + ' ) ' );
328348 callback( loadRequest );
329349 return ;
330350 }
331351
332352
333 - // Check if its a multi-part request:
 353+ // Check if its a multi-part request:
334354 if( typeof loadRequest == 'object' ) {
335355 if( loadRequest.length > 1 ) {
336356 this.loadMany ( loadRequest, callback );
337357 return ;
338358 }else{
339 - // If an array of length 1 set as first element
 359+ // If an array of length 1 set as first element
340360 loadRequest = loadRequest[0];
341361 }
342362 }
343363
344 - // Check for the module name loader function
345 - if( this.moduleLoaders[ loadRequest ] ) {
 364+ // Check for the module name loader function
 365+ if( this.moduleLoaders[ loadRequest ] ) {
346366 var resourceSet = this.getModuleResourceSet( loadRequest );
347367 if( !resourceSet ){
348368 mw.log( "mw.load:: Error with module loader: " + loadRequest + ' ( no resource set defined )' );
@@ -349,9 +369,10 @@
350370 }
351371
352372 // xxx should use refactor "ready" stuff into a "domReady" class
353 - // So we would not have local scope globals like this:
 373+ // So we would not have local scope globals like this:
354374 if ( mwReadyFlag ) {
355 - // Load the module directly if load request is after mw.ready has run
 375+ // Load the module directly if load request is after
 376+ // mw.ready has run
356377 this.load( resourceSet, callback );
357378 } else {
358379 this.addToModuleLoaderQueue(
@@ -363,9 +384,8 @@
364385 return ;
365386 }
366387
367 - // Check for javascript resource
368 - if( this.getResourcePath( loadRequest ) ) {
369 - //mw.log('mw.load: loadResource: ' + loadRequest );
 388+ // Check for javascript resource
 389+ if( this.getResourcePath( loadRequest ) ) {
370390 this.loadResource( loadRequest, callback );
371391 return ;
372392 }
@@ -379,7 +399,7 @@
380400 return ;
381401 }
382402
383 - // Possible error?
 403+ // Possible error?
384404 mw.log( "Error could not handle load request: " + loadRequest );
385405 },
386406
@@ -389,38 +409,60 @@
390410 // Add the result of the module loader function
391411 return this.moduleLoaders[ moduleName ]();
392412 } else if( typeof ( this.moduleLoaders[ moduleName ] ) == 'object' ){
393 - // set resourceSet directly
 413+ // set resourceSet directly
394414 return this.moduleLoaders[ moduleName ];
395415 }
396416 return false;
397417 },
398 -
 418+
399419 /**
400 - * Load a set of scripts.
401 - * Will issue many load requests or package the request for the resource loader
402 - *
403 - * @param {Object} loadSet Set of scripts to be loaded
404 - * @param {Function} callback Function to call once all scripts are loaded.
405 - */
 420+ * Clean the loadRequest ( throw out any non-string items )
 421+ */
 422+ cleanLoadRequest: function( loadRequest ){
 423+ var cleanRequest = [];
 424+ if( typeof loadRequest == 'string' )
 425+ return loadRequest;
 426+ for( var i =0;i < loadRequest.length; i++ ){
 427+ if( typeof loadRequest[i] == 'object' ) {
 428+ cleanRequest[i] = this.cleanLoadRequest( loadRequest[i] );
 429+ } else if( typeof loadRequest[i] == 'string' ){
 430+ cleanRequest[i] = $j.trim( loadRequest[i] );
 431+ } else{
 432+ // bad request type skip
 433+ }
 434+ }
 435+ return cleanRequest;
 436+ },
 437+ /**
 438+ * Load a set of scripts. Will issue many load requests or package the
 439+ * request for the resource loader
 440+ *
 441+ * @param {Object}
 442+ * loadSet Set of scripts to be loaded
 443+ * @param {Function}
 444+ * callback Function to call once all scripts are loaded.
 445+ */
406446 loadMany: function( loadSet, callback ) {
407447 var _this = this;
408 - // Setup up the local "loadStates"
 448+ // Setup up the local "loadStates"
409449 var loadStates = { };
410450
411 - // Check if we can load via the "resource loader" ( mwEmbed was included via scriptLoader )
 451+ // Check if we can load via the "resource loader" ( mwEmbed was
 452+ // included via scriptLoader )
412453 if( mw.getResourceLoaderPath() ) {
413 - // Get the grouped loadStates variable
 454+ // Get the grouped loadStates variable
414455 loadStates = this.getGroupLoadState( loadSet );
415456 if( mw.isEmpty( loadStates ) ) {
416 - //mw.log( 'loadMany:all resources already loaded');
 457+ // mw.log( 'loadMany:all resources already loaded');
417458 callback();
418459 return ;
419460 }
420461 }else{
421 - // Check if its a dependency set ( nested objects )
 462+ // Check if its a dependency set ( nested objects )
422463 if( typeof loadSet [ 0 ] == 'object' ) {
423464 _this.dependencyChainCallFlag[ loadSet ] = false;
424 - //Load sets of resources ( to preserver order for some browsers )
 465+ // Load sets of resources ( to preserver order for some
 466+ // browsers )
425467 _this.loadDependencyChain( loadSet, callback );
426468 return ;
427469 }
@@ -433,27 +475,27 @@
434476 }
435477
436478 // We are infact loading many:
437 - //mw.log("mw.load: LoadMany:: " + loadSet );
438 -
439 - // Issue the load request check check loadStates to see if we are "done"
 479+ mw.log("mw.load: LoadMany:: " + loadSet );
 480+
 481+ // Issue the load request check check loadStates to see if we are
 482+ // "done"
440483 for( var loadName in loadStates ) {
441 - //mw.log("loadMany: load: " + loadName );
 484+ // mw.log("loadMany: load: " + loadName );
442485 this.load( loadName, function ( loadName ) {
443486 loadStates[ loadName ] = 1;
444487
445488 /*
446 - for( var i in loadStates ) {
447 - mw.log( loadName + ' finished of: ' + i + ' : ' + loadStates[i] );
448 - }
449 - */
 489+ * for( var i in loadStates ) { mw.log( loadName + '
 490+ * finished of: ' + i + ' : ' + loadStates[i] ); }
 491+ */
450492
451 - //Check if all load request states are set 1
 493+ // Check if all load request states are set 1
452494 var loadDone = true;
453495 for( var j in loadStates ) {
454496 if( loadStates[ j ] === 0 )
455497 loadDone = false;
456498 }
457 - // Run the parent scope callback for "loadMany"
 499+ // Run the parent scope callback for "loadMany"
458500 if( loadDone ) {
459501 callback( loadName );
460502 }
@@ -462,16 +504,16 @@
463505 },
464506
465507 /**
466 - * Get grouped load state for script loader
467 - *
468 - * Groups the scriptRequest where possible:
469 - * Modules include "loader code" so they are separated
470 - * into pre-condition code to be run for subsequent requests
471 - *
472 - * @param {Object} loadSet Loadset to return grouped
473 - * @return {Object}
474 - * grouped loadSet
475 - */
 508+ * Get grouped load state for script loader
 509+ *
 510+ * Groups the scriptRequest where possible: Modules include "loader
 511+ * code" so they are separated into pre-condition code to be run for
 512+ * subsequent requests
 513+ *
 514+ * @param {Object}
 515+ * loadSet Loadset to return grouped
 516+ * @return {Object} grouped loadSet
 517+ */
476518 getGroupLoadState: function( loadSet ) {
477519 var groupedLoadSet = [];
478520 var loadStates = { };
@@ -479,12 +521,12 @@
480522 if( typeof loadSet[0] == 'object' ) {
481523 for( var i = 0; i < loadSet.length ; i++ ) {
482524 for( var j = 0; j < loadSet[i].length ; j++ ) {
483 - // Make sure we have not already included it:
 525+ // Make sure we have not already included it:
484526 groupedLoadSet.push( loadSet[i][j] );
485527 }
486528 }
487529 } else {
488 - // Use the loadSet directly:
 530+ // Use the loadSet directly:
489531 groupedLoadSet = loadSet;
490532 }
491533
@@ -496,7 +538,7 @@
497539
498540
499541 if( this.getResourcePath( loadName ) ) {
500 - // Only add to group request if not already set:
 542+ // Only add to group request if not already set:
501543 if ( !mw.isset( loadName ) ) {
502544 groupClassKey += coma + loadName
503545 coma = ',';
@@ -508,7 +550,8 @@
509551 }
510552 } else if ( this.moduleLoaders[ loadName ] ) {
511553
512 - // Module loaders break up grouped script requests ( add the current groupClassKey )
 554+ // Module loaders break up grouped script requests ( add the
 555+ // current groupClassKey )
513556 if( groupClassKey != '' ) {
514557 loadStates[ groupClassKey ] = 0;
515558 groupClassKey = coma = '';
@@ -518,7 +561,7 @@
519562 }
520563 }
521564
522 - // Add groupClassKey if set:
 565+ // Add groupClassKey if set:
523566 if( groupClassKey != '' ) {
524567 loadStates [ groupClassKey ] = 0;
525568 }
@@ -526,16 +569,17 @@
527570 return loadStates;
528571 },
529572
530 - // Array to register that a callback has been called
 573+ // Array to register that a callback has been called
531574 dependencyChainCallFlag: { },
532575
533576 /**
534 - * Load a sets of scripts satisfy dependency order for browsers that execute
535 - * dynamically included scripts out of order
536 - *
537 - * @param {Object} loadChain A set of javascript arrays to be loaded.
538 - * Sets are requested in array order.
539 - */
 577+ * Load a sets of scripts satisfy dependency order for browsers that
 578+ * execute dynamically included scripts out of order
 579+ *
 580+ * @param {Object}
 581+ * loadChain A set of javascript arrays to be loaded. Sets
 582+ * are requested in array order.
 583+ */
540584 loadDependencyChain: function( loadChain, callback ) {
541585 var _this = this;
542586 // Load with dependency checks
@@ -544,8 +588,8 @@
545589 if ( loadChain.length != 0 ) {
546590 _this.loadDependencyChain( loadChain, callback );
547591 } else {
548 - // NOTE: IE gets called twice so we have check the
549 - // dependencyChainCallFlag before calling the callback
 592+ // NOTE: IE gets called twice so we have check the
 593+ // dependencyChainCallFlag before calling the callback
550594 if( _this.dependencyChainCallFlag[ callSet ] == callback ) {
551595 mw.log("... already called this callback for " + callSet );
552596 return ;
@@ -557,12 +601,12 @@
558602 },
559603
560604 /**
561 - * Add to the module loader queue
562 - */
 605+ * Add to the module loader queue
 606+ */
563607 addToModuleLoaderQueue: function( moduleName, resourceSet, callback ) {
564608 mw.log(" addToModuleLoaderQueue:: " + moduleName + ' resourceSet: ' + resourceSet );
565609 if( this.moduleLoadQueue[ moduleName ] ){
566 - // If the module is already in the queue just add its callback:
 610+ // If the module is already in the queue just add its callback:
567611 this.moduleLoadQueue[ moduleName ].functionQueue.push( callback );
568612 } else {
569613 // create the moduleLoadQueue item
@@ -575,13 +619,14 @@
576620 },
577621
578622 /**
579 - * Loops over all modules in queue, builds request sets based on config request type
580 - */
 623+ * Loops over all modules in queue, builds request sets based on config
 624+ * request type
 625+ */
581626 runModuleLoadQueue: function(){
582627 var _this = this;
583 -
584 - var runModuleFunctionQueue = function(){
585 - // Run all the callbacks
 628+ mw.log( "mw.runModuleLoadQueue:: " );
 629+ var runModuleFunctionQueue = function(){
 630+ // Run all the callbacks
586631 for( var moduleName in _this.moduleLoadQueue ){
587632 while( _this.moduleLoadQueue[moduleName].functionQueue.length ) {
588633 _this.moduleLoadQueue[moduleName].functionQueue.shift()();
@@ -589,10 +634,11 @@
590635 }
591636 }
592637
593 - // Check for single request or javascript debug based loading:
 638+ // Check for single request or javascript debug based loading:
594639 if( !mw.getResourceLoaderPath() || mw.getConfig( 'loader.groupStrategy' ) == 'single' ){
595 - // if not using the resource load just do a normal array merge
596 - // ( for browsers like IE that don't follow first append first execute rule )
 640+ // if not using the resource load just do a normal array merge
 641+ // ( for browsers like IE that don't follow first append first
 642+ // execute rule )
597643 var fullResourceList = [];
598644 for( var moduleName in this.moduleLoadQueue ) {
599645 var resourceSet = this.moduleLoadQueue[ moduleName ].resourceSet;
@@ -604,19 +650,23 @@
605651 });
606652 return ;
607653 }
 654+
608655 // Else do per module group loading
609656 if( mw.getConfig( 'loader.groupStrategy' ) == 'module' ) {
610657 var fullResourceList = [];
611658 var sharedResourceList = [];
612659
613660 for( var moduleName in this.moduleLoadQueue ) {
614 - // Build a shared dependencies list and load that separately "first"
615 - // ( in IE we have to wait until its "ready" since it does not follow dom order )
 661+ // Build a shared dependencies list and load that separately
 662+ // "first"
 663+ // ( in IE we have to wait until its "ready" since it does
 664+ // not follow dom order )
616665 var moduleResourceList = this.getFlatModuleResourceList( moduleName );
617 - // Build the sharedResourceList
618 - for( var i in moduleResourceList ){
 666+ // Build the sharedResourceList
 667+ for( var i=0; i < moduleResourceList.length; i++ ){
619668 var moduleResource = moduleResourceList[i];
620 - // Check if already in the full resource list if so add to shared.
 669+ // Check if already in the full resource list if so add
 670+ // to shared.
621671 if( fullResourceList[ moduleResource ] ){
622672 if( $j.inArray( moduleResource, sharedResourceList ) == -1 ){
623673 sharedResourceList.push( moduleResource );
@@ -627,14 +677,15 @@
628678 }
629679 }
630680
631 - // Local module request set ( stores the actual request we will make after grouping shared resources
632 - var moduleRequestSet = [];
 681+ // Local module request set ( stores the actual request we will
 682+ // make after grouping shared resources
 683+ var moduleRequestSet = {};
633684
634685 // Only add non-shared to respective modules load requests
635686 for( var moduleName in this.moduleLoadQueue ) {
636687 moduleRequestSet[ moduleName ] = [];
637688 var moduleResourceList = this.getFlatModuleResourceList( moduleName );
638 - for( var i in moduleResourceList ){
 689+ for( var i =0; i < moduleResourceList.length; i++ ){
639690 var moduleResource = moduleResourceList[i];
640691 if( $j.inArray( moduleResource, sharedResourceList ) == -1 ){
641692 moduleRequestSet[ moduleName ].push( moduleResource );
@@ -654,7 +705,8 @@
655706 }
656707 runModuleFunctionQueue();
657708 }
658 - // Local instance of load requests to retain resourceSet context:
 709+ // Local instance of load requests to retain resourceSet
 710+ // context:
659711 var localLoadCallInstance = function( moduleName, resourceSet ){
660712 mw.load( resourceSet, function(){
661713 _this.moduleLoadQueue[ moduleName ].loaded = true;
@@ -662,25 +714,26 @@
663715 });
664716 }
665717
666 - // Load the shared resources
 718+ // Load the shared resources
667719 mw.load( sharedResourceList, function(){
668 - mw.log("Shared Resources loaded");
669 - // xxx check if we are in "IE" and dependencies need to be loaded "first"
 720+ // mw.log("Shared Resources loaded");
 721+ // xxx check if we are in "IE" and dependencies need to be
 722+ // loaded "first"
670723 sharedResourceLoadDone = true;
671724 checkModulesDone();
672 - });
673 - // Load all module Request Set
 725+ });
 726+ // Load all module Request Set
674727 for( var moduleName in moduleRequestSet ){
675728 localLoadCallInstance( moduleName, moduleRequestSet[ moduleName ] );
676729 }
677730 }
678 - // xxx Here we could also do some "intelligent" grouping
 731+ // xxx Here we could also do some "intelligent" grouping
679732 },
680733
681734 getFlatModuleResourceList: function( moduleName ){
682735 var moduleList = [];
683736 for( var j in this.moduleLoadQueue[moduleName].resourceSet ){
684 - // Check if we have a multi-set array:
 737+ // Check if we have a multi-set array:
685738 if( typeof this.moduleLoadQueue[moduleName].resourceSet[j] == 'object' ){
686739 moduleList = $j.merge( moduleList, this.moduleLoadQueue[moduleName].resourceSet[j] );
687740 } else {
@@ -690,40 +743,45 @@
691744 return moduleList;
692745 },
693746 /**
694 - * Loads javascript associated with a resourceName
695 - *
696 - * @param {String} resourceName Name of resource to load
697 - * @param {Function} callback Function to run once resource is loaded
698 - */
699 - loadResource: function( resourceName , callback) {
700 - var _this = this;
701 - // Check for css dependency on resource name
 747+ * Loads javascript or css associated with a resourceName
 748+ *
 749+ * @param {String}
 750+ * resourceName Name of resource to load
 751+ * @param {Function}
 752+ * callback Function to run once resource is loaded
 753+ */
 754+ loadResource: function( resourceName , callback) {
 755+ // mw.log("LoadResource:" + resourceName );
 756+ var _this = this;
 757+
 758+ // Check for css dependency on resource name
702759 if( this.resourceStyleDependency[ resourceName ] ) {
703760 if( ! mw.isset( this.resourceStyleDependency[ resourceName ] )){
704 - mw.log(" load dependent css resource: " + this.resourceStyleDependency[ resourceName ] );
705 - _this.loadResource( this.resourceStyleDependency[ resourceName ] , function(){
706 - // Continue the original loadResource request.
 761+ mw.log("loadResource:: dependent css resource: " + this.resourceStyleDependency[ resourceName ] );
 762+ _this.loadResource( this.resourceStyleDependency[ resourceName ] , function() {
 763+ // Continue the original loadResource request.
707764 _this.loadResource( resourceName, callback );
708765 });
709766 return ;
710767 }
711 - }
712 -
 768+ }
 769+
713770 // Make sure the resource is not already defined:
714771 if ( mw.isset( resourceName ) ) {
715 - //mw.log( 'Class ( ' + resourceName + ' ) already defined ' );
 772+ // mw.log( 'Class ( ' + resourceName + ' ) already defined ' );
716773 callback( resourceName );
717774 return ;
718775 }
719776
720 - // Setup the Script Request var:
 777+ // Setup the Script Request var:
721778 var scriptRequest = null;
722779
723780
724 - // If the scriptloader is enabled use the resourceName as the scriptRequest:
 781+ // If the scriptloader is enabled use the resourceName as the
 782+ // scriptRequest:
725783 if( mw.getResourceLoaderPath() ) {
726784 scriptRequest = resourceName;
727 - }else{
 785+ }else{
728786 // Get the resource url:
729787 var baseClassPath = this.getResourcePath( resourceName );
730788 // Add the mwEmbed path if not a root path or a full url
@@ -736,17 +794,16 @@
737795 if( ! scriptRequest ) {
738796 mw.log( "Error Could not get url for resource " + resourceName );
739797 return false;
740 - }
 798+ }
741799 }
742800 // Include resource defined check for older browsers
743801 var resourceDone = false;
744802
745 - // Set the loadDone callback per the provided resourceName
 803+ // Set the loadDone callback per the provided resourceName
746804 mw.setLoadDoneCB( resourceName, callback );
747 -
748 - // Issue the request to load the resource (include resource name in result callback:
749 - mw.getScript( scriptRequest, function( scriptRequest ) {
750 -
 805+ // Issue the request to load the resource (include resource name in
 806+ // result callback:
 807+ mw.getScript( scriptRequest, function( scriptRequest ) {
751808 // If its a "style sheet" manually set its resource to true
752809 var ext = scriptRequest.substr( scriptRequest.split('?')[0].lastIndexOf( '.' ), 4 ).toLowerCase();
753810 if( ext == '.css' && resourceName.substr(0,8) == 'mw.style' ){
@@ -760,53 +817,58 @@
761818 + _this.getResourcePath( resourceName ) );
762819 }
763820
764 - // If ( debug mode ) and the script include is missing resource messages
765 - // do a separate request to retrieve the msgs
 821+ // If ( debug mode ) and the script include is missing resource
 822+ // messages
 823+ // do a separate request to retrieve the msgs
766824 if( mw.currentClassMissingMessages ) {
767825 mw.log( " resourceName " + resourceName + " is missing messages" );
768826 // Reset the currentClassMissingMessages flag
769827 mw.currentClassMissingMessages = false;
770828
771 - // Load msgs for this resource:
 829+ // Load msgs for this resource:
772830 mw.loadResourceMessages( resourceName, function() {
773 - // Run the onDone callback
 831+ // Run the onDone callback
774832 mw.loadDone( resourceName );
775833 } );
776834 } else {
777 - // If not using the resource loader make sure the resourceName is available before firing the loadDone
 835+ // If not using the resource loader make sure the
 836+ // resourceName is available before firing the loadDone
778837 if( !mw.getResourceLoaderPath() ) {
779838 mw.waitForObject( resourceName, function( resourceName ) {
780 - // Once object is ready run loadDone
 839+ // Once object is ready run loadDone
781840 mw.loadDone( resourceName );
782841 } );
783842 } else {
784 - // loadDone should be appended to the bottom of the resource loader response
785 - //mw.loadDone( resourceName );
 843+ // loadDone should be appended to the bottom of the
 844+ // resource loader response
 845+ // mw.loadDone( resourceName );
786846 }
787847 }
788848 } );
789849 },
790850
791851 /**
792 - * Adds a module to the mwLoader object
793 - *
794 - * @param {String} name Name of module
795 - * @param {Function} moduleLoader Function that
796 - * loads dependencies for a module
797 - */
 852+ * Adds a module to the mwLoader object
 853+ *
 854+ * @param {String}
 855+ * name Name of module
 856+ * @param {Function}
 857+ * moduleLoader Function that loads dependencies for a module
 858+ */
798859 addModuleLoader: function( name, moduleLoader ) {
799860 this.moduleLoaders [ name ] = moduleLoader;
800861 },
801862
802863 /**
803 - * Adds resource file path key value pairs
804 - *
805 - * @param {Object} resourceSet JSON formated list of
806 - * resource name file path pairs.
807 - *
808 - * resourceSet must be strict JSON to allow the
809 - * php scriptLoader to parse the file paths.
810 - */
 864+ * Adds resource file path key value pairs
 865+ *
 866+ * @param {Object}
 867+ * resourceSet JSON formated list of resource name file path
 868+ * pairs.
 869+ *
 870+ * resourceSet must be strict JSON to allow the php scriptLoader to
 871+ * parse the file paths.
 872+ */
811873 addResourcePaths: function( resourceSet ) {
812874 var prefix = ( mw.getConfig( 'loaderContext' ) )?
813875 mw.getConfig( 'loaderContext' ): '';
@@ -817,11 +879,11 @@
818880 },
819881
820882 /*
821 - * Adds a named style sheet dependency to a named resource
822 - *
823 - * @parma {Object} resourceSet JSON formated list of resource names
824 - * and associated style sheet names
825 - */
 883+ * Adds a named style sheet dependency to a named resource
 884+ *
 885+ * @parma {Object} resourceSet JSON formated list of resource names and
 886+ * associated style sheet names
 887+ */
826888 addStyleResourceDependency: function( resourceSet ){
827889 for( var i in resourceSet ){
828890 this.resourceStyleDependency[ i ] = resourceSet[i];
@@ -829,9 +891,9 @@
830892 },
831893
832894 /**
833 - * Get a resource path from a resourceName
834 - * if no resource found return false
835 - */
 895+ * Get a resource path from a resourceName if no resource found return
 896+ * false
 897+ */
836898 getResourcePath: function( resourceName ) {
837899 if( this.resourcePaths[ resourceName ] )
838900 return this.resourcePaths[ resourceName ]
@@ -840,15 +902,17 @@
841903 }
842904
843905 /**
844 - * Load done callback for script loader
845 - * @param {String} requestName Name of the load request
846 - */
 906+ * Load done callback for script loader
 907+ *
 908+ * @param {String}
 909+ * requestName Name of the load request
 910+ */
847911 mw.loadDone = function( requestName ) {
848912 if( !mwLoadDoneCB[ requestName ] ) {
849913 return true;
850914 }
851915 while( mwLoadDoneCB[ requestName ].length ) {
852 - // check if mwLoadDoneCB is already "done"
 916+ // check if mwLoadDoneCB is already "done"
853917 // the function list is not an object
854918 if( typeof mwLoadDoneCB[ requestName ] != 'object' )
855919 {
@@ -856,7 +920,8 @@
857921 }
858922 var func = mwLoadDoneCB[ requestName ].pop();
859923 if( typeof func == 'function' ) {
860 - //mw.log( "LoadDone: " + requestName + ' run callback::' + func);
 924+ // mw.log( "LoadDone: " + requestName + ' run callback::' +
 925+ // func);
861926 func( requestName );
862927 }else{
863928 mw.log('mwLoadDoneCB: Error non callback function on stack');
@@ -867,10 +932,13 @@
868933 };
869934
870935 /**
871 - * Set a load done callback
872 - * @param {String} requestName Name of resource or request set
873 - * @param {Function} callback Function called once requestName is ready
874 - */
 936+ * Set a load done callback
 937+ *
 938+ * @param {String}
 939+ * requestName Name of resource or request set
 940+ * @param {Function}
 941+ * callback Function called once requestName is ready
 942+ */
875943 mw.setLoadDoneCB = function( requestName, callback ) {
876944 // If the requestName is already done loading just callback
877945 if( mwLoadDoneCB[ requestName ] == 'done' ) {
@@ -884,31 +952,29 @@
885953 };
886954
887955 /**
888 - * Shortcut entry points / convenience functions:
889 - * Lets you write mw.load() instead of mw.loader.load()
890 - * only these entry points should be used.
891 - *
892 - * future closure optimizations could minify internal
893 - * function names
894 - */
 956+ * Shortcut entry points / convenience functions: Lets you write mw.load()
 957+ * instead of mw.loader.load() only these entry points should be used.
 958+ *
 959+ * future closure optimizations could minify internal function names
 960+ */
895961
896962 /**
897 - * Load Object entry point: Loads a requested set of javascript
898 - */
 963+ * Load Object entry point: Loads a requested set of javascript
 964+ */
899965 mw.load = function( loadRequest, callback ) {
900966 return mw.loader.load( loadRequest, callback );
901967 }
902968
903969 /**
904 - * Add module entry point: Adds a module to the mwLoader object
905 - */
 970+ * Add module entry point: Adds a module to the mwLoader object
 971+ */
906972 mw.addModuleLoader = function ( name, loaderFunction ) {
907973 return mw.loader.addModuleLoader( name, loaderFunction );
908974 }
909975
910976 /**
911 - * Add Class File Paths entry point:
912 - */
 977+ * Add Class File Paths entry point:
 978+ */
913979 mw.addResourcePaths = function ( resourceSet ) {
914980 return mw.loader.addResourcePaths( resourceSet );
915981 }
@@ -918,368 +984,31 @@
919985 }
920986
921987 /**
922 - * Get Class File Path entry point:
923 - */
 988+ * Get Class File Path entry point:
 989+ */
924990 mw.getResourcePath = function( resourceName ) {
925991 return mw.loader.getResourcePath( resourceName );
926992 }
927993
928994
929995 /**
930 - * API Helper functions
931 - */
 996+ * Utility Functions
 997+ */
932998
933999 /**
934 - *
935 - * Helper function to get revision text for a given title
936 - *
937 - * Assumes "follow redirects"
938 - *
939 - * $j.getTitleText( [apiUrl], title, callback )
940 - *
941 - * @param {String} url or title key
942 - * @parma {Mixed} title or callback function
943 - * @param {Function} callback Function or NULL
944 - *
945 - * @return callback is called with:
946 - * {Boolean} false if no page found
947 - * {String} text of wiki page
948 - */
949 - mw.getTitleText = function( apiUrl, title, callback ) {
950 - // Check if optional apiURL was not included
951 - if( !callback ) {
952 - title = apiUrl;
953 - callback = title;
954 - apiUrl = mw.getLocalApiUrl();
955 - }
956 - var request = {
957 - // Normalize the File NS (ie sometimes its present in apiTitleKey other times not
958 - 'titles' : title,
959 - 'prop' : 'revisions',
960 - 'rvprop' : 'content'
961 - };
962 -
963 - mw.getJSON( apiUrl , request, function( data ) {
964 - if( !data || !data.query || !data.query.pages ) {
965 - callback( false );
966 - }
967 - var pages = data.query.pages;
968 - for(var i in pages) {
969 - page = pages[ i ];
970 - if( page[ 'revisions' ] && page[ 'revisions' ][0]['*'] ) {
971 - callback( page[ 'revisions' ][0]['*'] );
972 - }
973 - }
974 - } );
975 - }
976 -
977 - /**
978 - * Issues the wikitext parse call
979 - *
980 - * @param {String} wikitext Wiki Text to be parsed by mediaWiki api call
981 - * @param {String} title Context title of the content to be parsed
982 - * @param {Function} callback Function called with api parser output
983 - */
984 - mw.parseWikiText = function( wikitext, title, callback ) {
985 - mw.log("mw.parseWikiText text length: " + wikitext.length + ' title context: ' + title );
986 - mw.load( 'JSON', function(){
987 - $j.ajax({
988 - type: 'POST',
989 - url: mw.getLocalApiUrl(),
990 - // Give the wiki 60 seconds to parse the wiki-text
991 - timeout : 60000,
992 - data: {
993 - 'action': 'parse',
994 - 'format': 'json',
995 - 'title' : title,
996 - 'text': wikitext
997 - },
998 - dataType: 'text',
999 - success: function( data ) {
1000 - var jsonData = JSON.parse( data ) ;
1001 - // xxx should handle other failures
1002 - callback( jsonData.parse.text['*'] );
1003 - },
1004 - error: function( XMLHttpRequest, textStatus, errorThrown ){
1005 - // xxx should better handle failures
1006 - mw.log( "Error: mw.parseWikiText:" + textStatus );
1007 - callback( "Error: failed to parse wikitext " );
1008 - }
1009 - });
1010 - });
1011 - }
1012 -
1013 - /**
1014 - * mediaWiki JSON a wrapper for jQuery getJSON:
1015 - * ( could also be named mw.apiRequest )
1016 - *
1017 - * The mwEmbed version lets you skip the url part
1018 - * mw.getJSON( [url], data, callback, [timeoutCallback] );
1019 - *
1020 - * Lets you assume:
1021 - * url is optional
1022 - * ( If the first argument is not a string we assume a local mediaWiki api request )
1023 - * callback parameter is not needed for the request data
1024 - * url param 'action'=>'query' is assumed ( if not set to something else in the "data" param
1025 - * format is set to "json" automatically
1026 - * automatically issues request over "POST" if the request api post type
1027 - * automatically will setup apiProxy where request is cross domain
1028 - *
1029 - * @param {Mixed} url or data request
1030 - * @param {Mixed} data or callback
1031 - * @param {Function} callbcak function called on success
1032 - * @param {Function} callbackTimeout - optional function called on timeout
1033 - * Setting timeout callback also avoids default timed-out dialog for proxy requests
1034 - */
1035 - mw.getJSON = function() {
1036 - // Proccess the arguments:
1037 -
1038 - // Set up the url
1039 - var url = false;
1040 - url = ( typeof arguments[0] == 'string' ) ? arguments[0] : mw.getLocalApiUrl();
1041 -
1042 - // Set up the data:
1043 - var data = null;
1044 - data = ( typeof arguments[0] == 'object' ) ? arguments[0] : null;
1045 - if( !data && typeof arguments[1] == 'object' ) {
1046 - data = arguments[1];
1047 - }
1048 -
1049 - // Setup the callback
1050 - var callback = false;
1051 - callback = ( typeof arguments[1] == 'function') ? arguments[1] : false;
1052 - var cbinx = 1;
1053 - if( ! callback && ( typeof arguments[2] == 'function') ) {
1054 - callback = arguments[2];
1055 - cbinx = 2;
1056 - }
1057 -
1058 - // Setup the timeoutCallback ( function after callback index )
1059 - var timeoutCallback = false;
1060 - timeoutCallback = ( typeof arguments[ cbinx + 1 ] == 'function' ) ? arguments[ cbinx + 1 ] : false;
1061 -
1062 - // Make sure we got a url:
1063 - if( !url ) {
1064 - mw.log( 'Error: no api url for api request' );
1065 - return false;
1066 - }
1067 -
1068 - // Add default action if unset:
1069 - if( !data['action'] ) {
1070 - data['action'] = 'query';
1071 - }
1072 -
1073 - // Add default format if not set:
1074 - if( !data['format'] ) {
1075 - data['format'] = 'json';
1076 - }
1077 -
1078 - // Setup callback wrapper for timeout
1079 - var requestTimeOutFlag = false;
1080 - var ranCallback = false;
1081 -
1082 - /**
1083 - * local callback function to control timeout
1084 - * @param {Object} data Result data
1085 - */
1086 - var myCallback = function( data ){
1087 - if( ! requestTimeOutFlag ){
1088 - ranCallback = true;
1089 - callback( data );
1090 - }
1091 - }
1092 - // Set the local timeout call based on defaultRequestTimeout
1093 - setTimeout( function( ) {
1094 - if( ! ranCallback ) {
1095 - requestTimeOutFlag = true;
1096 - mw.log( "Error:: request timed out: " + url );
1097 - if( timeoutCallback ){
1098 - timeoutCallback();
1099 - }
1100 - }
1101 - }, mw.getConfig( 'defaultRequestTimeout' ) * 1000 );
1102 -
1103 - mw.log("run getJSON: " + mw.replaceUrlParams( url, data ) );
1104 -
1105 - // Check if the request requires a "post"
1106 - if( mw.checkRequestPost( data ) ) {
1107 -
1108 - // Check if we need to setup a proxy
1109 - if( ! mw.isLocalDomain( url ) ) {
1110 -
1111 - //Set local scope ranCallback to true
1112 - // ( ApiProxy handles timeouts internally )
1113 - ranCallback = true;
1114 -
1115 - // Load the proxy and issue the request
1116 - mw.load( 'ApiProxy', function( ) {
1117 - mw.ApiProxy.doRequest( url, data, callback, timeoutCallback);
1118 - } );
1119 -
1120 - } else {
1121 -
1122 - // Do the request an ajax post
1123 - $j.post( url, data, myCallback, 'json');
1124 - }
1125 - return ;
1126 - }
1127 -
1128 - // If cross domain setup a callback:
1129 - if( ! mw.isLocalDomain( url ) ) {
1130 - if( url.indexOf( 'callback=' ) == -1 || data[ 'callback' ] == -1 ) {
1131 - // jQuery specific jsonp format: ( second ? is replaced with the callback )
1132 - url += ( url.indexOf('?') == -1 ) ? '?callback=?' : '&callback=?';
1133 - }
1134 - }
1135 - // Pass off the jQuery getJSON request:
1136 - $j.getJSON( url, data, myCallback );
1137 - }
1138 -
1139 - /**
1140 - * Checks if a mw request data requires a post request or not
1141 - * @param {Object}
1142 - * @return {Boolean}
1143 - * true if the request requires a post request
1144 - * false if the request does not
1145 - */
1146 - mw.checkRequestPost = function ( data ) {
1147 - if( $j.inArray( data['action'], mw.getConfig( 'apiPostActions' ) ) != -1 ) {
1148 - return true;
1149 - }
1150 - if( data['prop'] == 'info' && data['intoken'] ) {
1151 - return true;
1152 - }
1153 - if( data['meta'] == 'userinfo' ) {
1154 - return true;
1155 - }
1156 - return false;
1157 - }
1158 -
1159 - /**
1160 - * Check if the url is a request for the local domain
1161 - * relative paths are "local" domain
1162 - * @param {String} url Url for local domain
1163 - * @return {Boolean}
1164 - * true if url domain is local or relative
1165 - * false if the domain is
1166 - */
1167 - mw.isLocalDomain = function( url ) {
1168 - if( mw.parseUri( document.URL ).host == mw.parseUri( url ).host
1169 - || url.indexOf( '://' ) == -1 )
1170 - {
1171 - return true;
1172 - }
1173 - return false;
1174 - }
1175 -
1176 - /**
1177 - * Api helper to grab an edit token
1178 - *
1179 - * @param {String} [apiUrl] Optional target API URL (uses default local api if unset)
1180 - * @param {String} title The wiki page title you want to edit
1181 - * @param {callback} callback Function to pass the token to.
1182 - * issues callback with "false" if token not retrieved
 1000+ * addLoaderDialog small helper for displaying a loading dialog
 1001+ *
 1002+ * @param {String}
 1003+ * dialogHtml text Html of the loader msg
11831004 */
1184 - mw.getToken = function( apiUrl, title, callback ) {
1185 - // Make the apiUrl be optional:
1186 - if( typeof title == 'function' ) {
1187 - callback = title;
1188 - title = apiUrl;
1189 - apiUrl = mw.getLocalApiUrl();
1190 - }
1191 -
1192 - mw.log( 'mw:getToken' );
1193 -
1194 - var request = {
1195 - 'prop': 'info',
1196 - 'intoken': 'edit',
1197 - 'titles': title
1198 - };
1199 - mw.getJSON( apiUrl, request, function( data ) {
1200 - for ( var i in data.query.pages ) {
1201 - if ( data.query.pages[i]['edittoken'] ) {
1202 - callback ( data.query.pages[i]['edittoken'] );
1203 - return ;
1204 - }
1205 - }
1206 - // No token found:
1207 - callback ( false );
1208 - } );
1209 - }
1210 -
1211 - /**
1212 - * Api helper to grab the username
1213 - * @param {String} [apiUrl] Optional target API url (uses default local api if unset)
1214 - * @param {Function} callback Function to callback with username or false if not found
1215 - * @param {Boolean} fresh A fresh check is issued.
1216 - */
1217 - // Stub feature apiUserNameCache to avoid multiple calls
1218 - // ( a more general api framework should be developed )
1219 - var apiUserNameCache = {};
1220 - mw.getUserName = function( apiUrl, callback, fresh ){
1221 - if( typeof apiUrl == 'function' ){
1222 - var callback = apiUrl;
1223 - var apiUrl = mw.getLocalApiUrl();
1224 - }
1225 -
1226 - // If apiUrl is local check wgUserName global
1227 - // before issuing the api request.
1228 - if( mw.isLocalDomain( apiUrl ) ){
1229 - if( typeof wgUserName != 'undefined' && wgUserName !== null ) {
1230 - callback( wgUserName )
1231 - // In case someone called this function without a callback
1232 - return wgUserName;
1233 - }
1234 - }
1235 - if( ! fresh && apiUserNameCache[ apiUrl ] ) {
1236 - callback( apiUserNameCache[ apiUrl ] );
1237 - return ;
1238 - }
1239 -
1240 - // Setup the api request
1241 - var request = {
1242 - 'action':'query',
1243 - 'meta':'userinfo'
1244 - }
1245 -
1246 - // Do request
1247 - mw.getJSON( apiUrl, request, function( data ) {
1248 - if( !data || !data.query || !data.query.userinfo || !data.query.userinfo.name ){
1249 - // Could not get user name user is not-logged in
1250 - mw.log( " No userName in response " );
1251 - callback( false );
1252 - return ;
1253 - }
1254 - // Check for "not logged in" id == 0
1255 - if( data.query.userinfo.id == 0 ){
1256 - callback( false );
1257 - return ;
1258 - }
1259 - apiUserNameCache[ apiUrl ] = data.query.userinfo.name;
1260 - // Else return the username:
1261 - callback( data.query.userinfo.name );
1262 - }, function(){
1263 - // Timeout also results in callback( false ) ( no user found)
1264 - callback( false );
1265 - } );
1266 - }
1267 -
1268 - /**
1269 - * Utility Functions
1270 - */
1271 -
1272 - /**
1273 - * addLoaderDialog
1274 - * small helper for displaying a loading dialog
1275 - *
1276 - * @param {String} dialogHtml text Html of the loader msg
1277 - */
12781005 mw.addLoaderDialog = function( dialogHtml ) {
1279 - $dialog = mw.addDialog( dialogHtml, dialogHtml + '<br>' +
 1006+ $dialog = mw.addDialog( {
 1007+ 'title' : dialogHtml,
 1008+ 'content' : dialogHtml + '<br>' +
12801009 $j('<div />')
12811010 .loadingSpinner()
12821011 .html()
1283 - );
 1012+ });
12841013 return $dialog;
12851014 }
12861015
@@ -1302,52 +1031,75 @@
13031032 }
13041033
13051034 /**
1306 - * Add a (temporary) dialog window:
1307 - * @param {String} title Title string for the dialog
1308 - * @param {String} dialogHtml String to be inserted in msg box
1309 - * @param {Mixed} buttonOption A button object for the dialog
1310 - * Can be a string for the close buton
1311 - */
1312 - mw.addDialog = function ( title, dialogHtml, buttons ) {
1313 - $j( '#mwTempLoaderDialog' ).remove();
 1035+ * Add a (temporary) dialog window:
 1036+ *
 1037+ * @param {Object} with following keys:
 1038+ * title: {String} Title string for the dialog
 1039+ * content: {String} to be inserted in msg box
 1040+ * buttons: {Object} A button object for the dialog Can be a string
 1041+ * for the close button
 1042+ * any jquery.ui.dialog option
 1043+ */
 1044+ mw.addDialog = function ( options ) {
 1045+ // Remove any other dialog
 1046+ $j( '#mwTempLoaderDialog' ).remove();
13141047
1315 - // Append the style free loader ontop:
 1048+ if( !options){
 1049+ options = {};
 1050+ }
 1051+
 1052+ // Extend the default options with provided options
 1053+ var options = $j.extend({
 1054+ 'bgiframe': true,
 1055+ 'draggable': true,
 1056+ 'resizable': false,
 1057+ 'modal': true
 1058+ }, options );
 1059+
 1060+ if( ! options.title || ! options.content ){
 1061+ mw.log("Error: mwEmbed addDialog missing required options ( title, content ) ")
 1062+ return ;
 1063+ }
 1064+
 1065+ // Append the dialog div on top:
13161066 $j( 'body' ).append(
13171067 $j('<div />')
13181068 .attr( {
13191069 'id' : "mwTempLoaderDialog",
1320 - 'title' : title
 1070+ 'title' : options.title
13211071 })
1322 - .css('display', 'none')
1323 - .html( dialogHtml )
 1072+ .css({
 1073+ 'display': 'none'
 1074+ })
 1075+ .append( options.content )
13241076 );
 1077+
 1078+ // Build the uiRequest
 1079+ var uiRequest = [ '$j.ui.dialog' ];
 1080+ if( options.draggable ){
 1081+ uiRequest.push( '$j.ui.draggable' )
 1082+ }
 1083+ if( options.resizable ){
 1084+ uiRequest.push( '$j.ui.resizable' );
 1085+ }
13251086
1326 - // Special buttons == ok gives empty give a single "oky" -> "close"
1327 - if ( typeof buttons == 'string' ) {
1328 - var buttonMsg = buttons;
 1087+ // Special button string
 1088+ if ( typeof options.buttons == 'string' ) {
 1089+ var buttonMsg = options.buttons;
13291090 buttons = { };
1330 - buttons[ buttonMsg ] = function() {
1331 - $j( '#mwTempLoaderDialog' ).dialog( 'close' );
 1091+ options.buttons[ buttonMsg ] = function() {
 1092+ $j( this ).dialog( 'close' );
13321093 }
1333 - }
 1094+ }
13341095
13351096 // Load the dialog resources
13361097 mw.load([
13371098 [
13381099 '$j.ui'
13391100 ],
1340 - [
1341 - '$j.ui.dialog'
1342 - ]
 1101+ uiRequest
13431102 ], function() {
1344 - $j( '#mwTempLoaderDialog' ).dialog( {
1345 - 'bgiframe': true,
1346 - 'draggable': false,
1347 - 'resizable': false,
1348 - 'modal': true,
1349 - 'width':400,
1350 - 'buttons': buttons
1351 - } );
 1103+ $j( '#mwTempLoaderDialog' ).dialog( options );
13521104 } );
13531105 return $j( '#mwTempLoaderDialog' );
13541106 }
@@ -1365,14 +1117,14 @@
13661118
13671119
13681120 /**
1369 - * Similar to php isset function checks if the variable exists.
1370 - * Does a safe check of a descendant method or variable
1371 - *
1372 - * @param {String} objectPath
1373 - * @return {Boolean}
1374 - * true if objectPath exists
1375 - * false if objectPath is undefined
1376 - */
 1121+ * Similar to php isset function checks if the variable exists. Does a safe
 1122+ * check of a descendant method or variable
 1123+ *
 1124+ * @param {String}
 1125+ * objectPath
 1126+ * @return {Boolean} true if objectPath exists false if objectPath is
 1127+ * undefined
 1128+ */
13771129 mw.isset = function( objectPath ) {
13781130 if ( !objectPath ) {
13791131 return false;
@@ -1391,18 +1143,21 @@
13921144 }
13931145
13941146 /**
1395 - * Wait for a object to be defined and the call the callback
1396 - *
1397 - * @param {Object} objectName Name of object to be defined
1398 - * @param {Function} callback Function to call once object is defined
1399 - * @param {Null} callNumber Used internally to keep track of
1400 - * number of times waitForObject has been called
1401 - */
1402 - var waitTime = 1200; // About 30 seconds
 1147+ * Wait for a object to be defined and the call the callback
 1148+ *
 1149+ * @param {Object}
 1150+ * objectName Name of object to be defined
 1151+ * @param {Function}
 1152+ * callback Function to call once object is defined
 1153+ * @param {Null}
 1154+ * callNumber Used internally to keep track of number of times
 1155+ * waitForObject has been called
 1156+ */
 1157+ var waitTime = 1200; // About 30 seconds
14031158 mw.waitForObject = function( objectName, callback, _callNumber) {
1404 - //mw.log( 'waitForObject: ' + objectName + ' cn: ' + _callNumber);
 1159+ // mw.log( 'waitForObject: ' + objectName + ' cn: ' + _callNumber);
14051160
1406 - // Increment callNumber:
 1161+ // Increment callNumber:
14071162 if( !_callNumber ) {
14081163 _callNumber = 1;
14091164 } else {
@@ -1426,14 +1181,15 @@
14271182 }
14281183
14291184 /**
1430 - * Check if an object is empty or if its an empty string.
1431 - *
1432 - * @param {Object} object Object to be checked
1433 - */
 1185+ * Check if an object is empty or if its an empty string.
 1186+ *
 1187+ * @param {Object}
 1188+ * object Object to be checked
 1189+ */
14341190 mw.isEmpty = function( object ) {
14351191 if( typeof object == 'string' ) {
14361192 if( object == '' ) return true;
1437 - // Non empty string:
 1193+ // Non empty string:
14381194 return false;
14391195 }
14401196
@@ -1443,7 +1199,7 @@
14441200 return true;
14451201 }
14461202
1447 - // Else check as an object:
 1203+ // Else check as an object:
14481204 for( var i in object ) { return false; }
14491205
14501206 // Else object is empty:
@@ -1451,16 +1207,16 @@
14521208 }
14531209
14541210 /**
1455 - * Log a string msg to the console
1456 - *
1457 - * all mw.log statements will be removed on minification so
1458 - * lots of mw.log calls will not impact performance in non debug mode
1459 - *
1460 - * @param {String} string String to output to console
1461 - */
 1211+ * Log a string msg to the console
 1212+ *
 1213+ * all mw.log statements will be removed on minification so lots of mw.log
 1214+ * calls will not impact performance in non debug mode
 1215+ *
 1216+ * @param {String}
 1217+ * string String to output to console
 1218+ */
14621219 mw.log = function( string ) {
1463 -
1464 - // Add any prepend debug strings if necessary
 1220+ // Add any prepend debug strings if necessary
14651221 if ( mw.getConfig( 'pre-append-log' ) ){
14661222 string = mw.getConfig( 'pre-append-log' ) + string;
14671223 }
@@ -1469,43 +1225,40 @@
14701226 window.console.log( string );
14711227 } else {
14721228 /**
1473 - * Old IE and non-Firebug debug: ( commented out for now )
1474 - */
1475 - /*
1476 - var log_elm = document.getElementById('mv_js_log');
1477 - if(!log_elm) {
1478 - document.getElementsByTagName("body")[0].innerHTML = document.getElementsByTagName("body")[0].innerHTML +
1479 - '<div style="position:absolute;z-index:500;bottom:0px;left:0px;right:0px;height:200px;">'+
1480 - '<textarea id="mv_js_log" cols="120" rows="12"></textarea>'+
1481 - '</div>';
1482 -
1483 - var log_elm = document.getElementById('mv_js_log');
 1229+ * Old IE and non-Firebug debug: ( commented out for now )
 1230+ */
 1231+ /*var log_elm = document.getElementById('mv_js_log');
 1232+ if(!log_elm) {
 1233+ document.getElementsByTagName("body")[0].innerHTML += '<div ' +
 1234+ 'style="position:absolute;z-index:500;bottom:0px;left:0px;right:0px;height:200px;">' +
 1235+ '<textarea id="mv_js_log" cols="120" rows="12"></textarea>' +
 1236+ '</div>';
14841237 }
 1238+ var log_elm = document.getElementById('mv_js_log');
14851239 if(log_elm) {
1486 - log_elm.value+=string+"\n";
1487 - }
1488 - */
1489 -
 1240+ log_elm.value+=string+"\n";
 1241+ }*/
14901242 }
14911243 }
14921244
1493 - //Setup the local mwOnLoadFunctions array:
 1245+ // Setup the local mwOnLoadFunctions array:
14941246 var mwOnLoadFunctions = [];
14951247
1496 - //mw Ready flag ( set once mwEmbed is ready )
 1248+ // mw Ready flag ( set once mwEmbed is ready )
14971249 var mwReadyFlag = false;
14981250
14991251 /**
1500 - * Enables load hooks to run once mwEmbeed is "ready"
1501 - * Will ensure jQuery is available, is in the $j namespace
1502 - * and mw interfaces and configuration has been loaded and applied
1503 - *
1504 - * This is different from jQuery(document).ready()
1505 - * ( jQuery ready is not friendly with dynamic includes
1506 - * and not friendly with core interface asynchronous build out. )
1507 - *
1508 - * @param {Function} callback Function to run once DOM and jQuery are ready
1509 - */
 1252+ * Enables load hooks to run once mwEmbeed is "ready" Will ensure jQuery is
 1253+ * available, is in the $j namespace and mw interfaces and configuration has
 1254+ * been loaded and applied
 1255+ *
 1256+ * This is different from jQuery(document).ready() ( jQuery ready is not
 1257+ * friendly with dynamic includes and not friendly with core interface
 1258+ * asynchronous build out. )
 1259+ *
 1260+ * @param {Function}
 1261+ * callback Function to run once DOM and jQuery are ready
 1262+ */
15101263 mw.ready = function( callback ) {
15111264 if( mwReadyFlag === false ) {
15121265 // Add the callbcak to the onLoad function stack
@@ -1517,51 +1270,54 @@
15181271 }
15191272
15201273 /**
1521 - * Runs all the queued functions
1522 - * called by mwEmbedSetup
1523 - */
 1274+ * Runs all the queued functions called by mwEmbedSetup
 1275+ */
15241276 mw.runReadyFunctions = function ( ) {
1525 - mw.log('mw.runReadyFunctions');
1526 - // Run any pre-setup ready functions
 1277+ mw.log('mw.runReadyFunctions: ' + mwOnLoadFunctions.length );
 1278+ // Run any pre-setup ready functions
15271279 while( preMwEmbedReady.length ){
15281280 preMwEmbedReady.shift()();
1529 - }
1530 -
1531 - // Run all the queued functions:
 1281+ }
 1282+ // Run all the queued functions:
15321283 while( mwOnLoadFunctions.length ) {
15331284 mwOnLoadFunctions.shift()();
1534 - }
1535 -
1536 - // Once we have run all the queued functions
1537 - mw.loader.runModuleLoadQueue();
 1285+ }
15381286
15391287 // Sets mwReadyFlag to true so that future mw.ready run the
15401288 // callback directly
15411289 mwReadyFlag = true;
15421290
 1291+ // Once we have run all the queued functions
 1292+ mw.loader.runModuleLoadQueue();
 1293+
15431294 }
15441295
15451296
15461297 /**
1547 - * Wrapper for jQuery getScript,
1548 - * Uses the scriptLoader if enabled
1549 - *
1550 - *
1551 - * @param {String} scriptRequest The requested path or resourceNames for the scriptLoader
1552 - * @param {Function} callback Function to call once script is loaded
1553 - */
 1298+ * Wrapper for jQuery getScript, Uses the scriptLoader if enabled
 1299+ *
 1300+ *
 1301+ * @param {String}
 1302+ * scriptRequest The requested path or resourceNames for the
 1303+ * scriptLoader
 1304+ * @param {Function}
 1305+ * callback Function to call once script is loaded
 1306+ */
15541307 mw.getScript = function( scriptRequest, callback ) {
1555 - // Setup the local scope callback instace
 1308+ // mw.log( "mw.getScript::" + scriptRequest );
 1309+ // Setup the local scope callback instace
15561310 var myCallback = function(){
15571311 if( callback ) {
15581312 callback( scriptRequest );
15591313 }
15601314 }
1561 - // Set the base url based scriptLoader availability & type of scriptRequest
1562 - // ( presently script loader only handles "classes" not relative urls:
 1315+ // Set the base url based scriptLoader availability & type of
 1316+ // scriptRequest
 1317+ // ( presently script loader only handles "classes" not relative urls:
15631318 var scriptLoaderPath = mw.getResourceLoaderPath();
15641319
1565 - // Check if its a resource name, ( ie does not start with "/" and does not include ://
 1320+ // Check if its a resource name, ( ie does not start with "/" and does
 1321+ // not include ://
15661322 var isResourceName = ( scriptRequest.indexOf('://') == -1 && scriptRequest.indexOf('/') !== 0 )? true : false;
15671323
15681324 var ext = scriptRequest.substr( scriptRequest.lastIndexOf( '.' ), 4 ).toLowerCase();
@@ -1584,8 +1340,8 @@
15851341 mw.log( 'mw.getScript: ' + url );
15861342 }
15871343
1588 - // If jQuery is available and debug is off load the scirpt via jQuery
1589 - //( will use XHR if on same domain )
 1344+ // If jQuery is available and debug is off load the scirpt via jQuery
 1345+ // ( will use XHR if on same domain )
15901346 if( mw.isset( 'window.jQuery' )
15911347 && mw.getConfig( 'debug' ) === false
15921348 && typeof $j != 'undefined'
@@ -1596,14 +1352,9 @@
15971353 }
15981354
15991355 /**
1600 - * No jQuery
1601 - * OR
1602 - * In debug mode
1603 - * OR
1604 - * Is css file
1605 - *
1606 - * :: inject the script instead of doing an XHR eval
1607 - */
 1356+ * No jQuery OR In debug mode OR Is css file
 1357+ * :: inject the script instead of doing an XHR eval
 1358+ */
16081359
16091360 // load style sheet directly if requested loading css
16101361 if( isCssFile ){
@@ -1611,28 +1362,31 @@
16121363 return ;
16131364 }
16141365
1615 - // Load and bind manually: ( copied from jQuery ajax function )
 1366+ // Load and bind manually: ( copied from jQuery ajax function )
16161367 var head = document.getElementsByTagName("head")[ 0 ];
16171368 var script = document.createElement("script");
16181369 script.setAttribute( 'src', url );
16191370
1620 - // Attach handlers ( if using script loader it issues onDone callback as well )
 1371+ // Attach handlers ( if using script loader it issues onDone callback as
 1372+ // well )
16211373 script.onload = script.onreadystatechange = function() {
16221374 if (!this.readyState || this.readyState == "loaded" || this.readyState == "complete") {
16231375 myCallback();
16241376 }
16251377 };
1626 - //mw.log(" append script: " + script.src );
 1378+ // mw.log(" append script: " + script.src );
16271379 // Append the script to the DOM:
16281380 head.appendChild( script );
16291381 };
16301382
16311383 /**
1632 - * Add a style sheet string to the document head
1633 - *
1634 - * @param {String} cssResourceName Name of style sheet that has been defined
1635 - * @param {String} cssString Css Payload to be added to head of document
1636 - */
 1384+ * Add a style sheet string to the document head
 1385+ *
 1386+ * @param {String}
 1387+ * cssResourceName Name of style sheet that has been defined
 1388+ * @param {String}
 1389+ * cssString Css Payload to be added to head of document
 1390+ */
16371391 mw.addStyleString = function( cssResourceName, cssString ) {
16381392 if( mw.style[ cssResourceName ] ) {
16391393 mw.log(" Style: ( " + cssResourceName + ' ) already set' );
@@ -1640,11 +1394,12 @@
16411395 }
16421396 // Set the style to true ( to not request it again )
16431397 mw.style[ cssResourceName ] = true;
1644 - // Add the spinner directly ( without jQuery in case we have to dynamically load jQuery )
 1398+ // Add the spinner directly ( without jQuery in case we have to
 1399+ // dynamically load jQuery )
16451400 mw.log( 'Adding style:' + cssResourceName + " to dom " );
16461401 var styleNode = document.createElement('style');
16471402 styleNode.type = "text/css";
1648 - // Use cssText or createTextNode depending on browser:
 1403+ // Use cssText or createTextNode depending on browser:
16491404 if( ( window.attachEvent && !window.opera ) ) {
16501405 styleNode.styleSheet.cssText = cssString;
16511406 } else {
@@ -1656,12 +1411,12 @@
16571412 };
16581413
16591414 /**
1660 - * Get a style sheet and append the style sheet to the DOM
1661 - *
1662 - * @param {Mixed}
1663 - * {String} url Url of the style sheet to be loaded
1664 - * {Function} callback Function called once sheet is ready
1665 - */
 1415+ * Get a style sheet and append the style sheet to the DOM
 1416+ *
 1417+ * @param {Mixed}
 1418+ * {String} url Url of the style sheet to be loaded {Function}
 1419+ * callback Function called once sheet is ready
 1420+ */
16661421 mw.getStyleSheet = function( url , callback) {
16671422 // Add URL params ( if not already included )
16681423 if ( url.indexOf( '?' ) == -1 ) {
@@ -1674,9 +1429,9 @@
16751430 var currentSheet = $j( this) .attr( 'href' );
16761431 var sheetParts = currentSheet.split('?');
16771432 var urlParts = url.split('?');
1678 - //if the base url's match check the parameters:
 1433+ // if the base url's match check the parameters:
16791434 if( sheetParts[0] == urlParts[0] && sheetParts[1]) {
1680 - //Check if url params match ( sort to do string compare )
 1435+ // Check if url params match ( sort to do string compare )
16811436 if( sheetParts[1].split( '&' ).sort().join('') ==
16821437 urlParts[1].split('&').sort().join('') ) {
16831438 foundSheet = true;
@@ -1699,45 +1454,21 @@
17001455 'href' : url
17011456 } )
17021457 );
1703 - // No easy way to check css "onLoad" attribute
1704 - // In production sheets are loaded via resource loader and fire the onDone function call.
 1458+ // No easy way to check css "onLoad" attribute
 1459+ // In production sheets are loaded via resource loader and fire the
 1460+ // onDone function call.
17051461 if( callback ) {
17061462 callback();
17071463 }
17081464 };
17091465
1710 - /**
1711 - * Get the api url for a given content provider key
1712 - * @return {Mixed}
1713 - * url for the provider
1714 - * local wiki api if no apiProvider is set
1715 - */
1716 - mw.getApiProviderURL = function( providerId ) {
1717 - if( mw.getConfig( providerId + '_apiurl') ) {
1718 - return mw.getConfig( providerId + '_apiurl');
1719 - }
1720 - return mw.getLocalApiUrl();
1721 - };
17221466
1723 - /**
1724 - * Get Api URL from mediaWiki page defined variables
1725 - * @return {Mixed}
1726 - * api url
1727 - * false
1728 - */
1729 - mw.getLocalApiUrl = function() {
1730 - if ( typeof wgServer != 'undefined' && typeof wgScriptPath != 'undefined' ) {
1731 - return wgServer + wgScriptPath + '/api.php';
1732 - }
1733 - return false;
1734 - };
1735 -
17361467 // Local mwEmbedPath variable ( for cache of mw.getMwEmbedPath )
17371468 var mwEmbedPath = null;
17381469
17391470 /**
1740 - * Get the path to the mwEmbed folder
1741 - */
 1471+ * Get the path to the mwEmbed folder
 1472+ */
17421473 mw.getMwEmbedPath = function() {
17431474 if ( mwEmbedPath ) {
17441475 return mwEmbedPath;
@@ -1752,9 +1483,10 @@
17531484 mwpath = src.substr( 0, src.indexOf( 'mwEmbed.js' ) );
17541485 }
17551486
1756 - // Check for scriptLoader include of mwEmbed:
 1487+ // Check for scriptLoader include of mwEmbed:
17571488 if ( src.indexOf( 'mwResourceLoader.php' ) !== -1 ) {
1758 - // Script loader is in the root of MediaWiki, Include the default mwEmbed extension path:
 1489+ // Script loader is in the root of MediaWiki, Include the default
 1490+ // mwEmbed extension path:
17591491 mwpath = src.substr( 0, src.indexOf( 'mwResourceLoader.php' ) ) + mw.getConfig( 'mediaWikiEmbedPath' );
17601492 }
17611493
@@ -1774,18 +1506,17 @@
17751507 return ;
17761508 }
17771509
1778 - // Update the cached var with the absolute path:
 1510+ // Update the cached var with the absolute path:
17791511 mwEmbedPath = mw.absoluteUrl( mwpath ) ;
17801512 return mwEmbedPath;
17811513 }
17821514
17831515 /**
1784 - * Get Script loader path
1785 - *
1786 - * @returns {String}|{Boolean}
1787 - * Url of the scriptLodaer
1788 - * false if the scriptLoader is not used
1789 - */
 1516+ * Get Script loader path
 1517+ *
 1518+ * @returns {String}|{Boolean} Url of the scriptLodaer false if the
 1519+ * scriptLoader is not used
 1520+ */
17901521 mw.getResourceLoaderPath = function( ) {
17911522 var src = mw.getMwEmbedSrc();
17921523 if ( src.indexOf( 'mwResourceLoader.php' ) !== -1 ||
@@ -1798,12 +1529,14 @@
17991530 }
18001531
18011532 /**
1802 - * Given a float number of seconds, returns npt format response.
1803 - * ( ignore days for now )
1804 - *
1805 - * @param {Float} sec Seconds
1806 - * @param {Boolean} show_ms If milliseconds should be displayed.
1807 - * @return {Float} String npt format
 1533+ * Given a float number of seconds, returns npt format response. ( ignore
 1534+ * days for now )
 1535+ *
 1536+ * @param {Float}
 1537+ * sec Seconds
 1538+ * @param {Boolean}
 1539+ * show_ms If milliseconds should be displayed.
 1540+ * @return {Float} String npt format
18081541 */
18091542 mw.seconds2npt = function( sec, show_ms ) {
18101543 if ( isNaN( sec ) ) {
@@ -1813,23 +1546,32 @@
18141547
18151548 var tm = mw.seconds2Measurements( sec )
18161549
1817 - // Round the number of seconds to the required number of significant digits
 1550+ // Round the number of seconds to the required number of significant
 1551+ // digits
18181552 if ( show_ms ) {
18191553 tm.seconds = Math.round( tm.seconds * 1000 ) / 1000;
18201554 } else {
18211555 tm.seconds = Math.round( tm.seconds );
18221556 }
1823 - if ( tm.seconds < 10 )
 1557+ if ( tm.seconds < 10 ){
18241558 tm.seconds = '0' + tm.seconds;
1825 - if ( tm.minutes < 10 )
1826 - tm.minutes = '0' + tm.minutes;
1827 -
1828 - return tm.hours + ":" + tm.minutes + ":" + tm.seconds;
 1559+ }
 1560+ if( tm.hours == 0 ){
 1561+ hoursStr = ''
 1562+ } else {
 1563+ if ( tm.minutes < 10 )
 1564+ tm.minutes = '0' + tm.minutes;
 1565+
 1566+ hoursStr = tm.hours + ":";
 1567+ }
 1568+ return hoursStr + tm.minutes + ":" + tm.seconds;
18291569 }
18301570
18311571 /**
1832 - * Given seconds return array with 'days', 'hours', 'min', 'seconds'
1833 - * @param {float} sec Seconds to be converted into time measurements
 1572+ * Given seconds return array with 'days', 'hours', 'min', 'seconds'
 1573+ *
 1574+ * @param {float}
 1575+ * sec Seconds to be converted into time measurements
18341576 */
18351577 mw.seconds2Measurements = function ( sec ){
18361578 var tm = {};
@@ -1841,17 +1583,18 @@
18421584 }
18431585
18441586 /**
1845 - * Take hh:mm:ss,ms or hh:mm:ss.ms input, return the number of seconds
1846 - *
1847 - * @param {String} npt_str NPT time string
1848 - * @return {Float} Number of seconds
1849 - */
 1587+ * Take hh:mm:ss,ms or hh:mm:ss.ms input, return the number of seconds
 1588+ *
 1589+ * @param {String}
 1590+ * npt_str NPT time string
 1591+ * @return {Float} Number of seconds
 1592+ */
18501593 mw.npt2seconds = function ( npt_str ) {
18511594 if ( !npt_str ) {
18521595 // mw.log('npt2seconds:not valid ntp:'+ntp);
18531596 return false;
18541597 }
1855 - // Strip {npt:}01:02:20 or 32{s} from time if present
 1598+ // Strip {npt:}01:02:20 or 32{s} from time if present
18561599 npt_str = npt_str.replace( /npt:|s/g, '' );
18571600
18581601 var hour = 0;
@@ -1879,8 +1622,8 @@
18801623 var mwEmbedSrc = null;
18811624
18821625 /**
1883 - * Gets the mwEmbed script src attribute
1884 - */
 1626+ * Gets the mwEmbed script src attribute
 1627+ */
18851628 mw.getMwEmbedSrc = function() {
18861629 if ( mwEmbedSrc ) {
18871630 return mwEmbedSrc;
@@ -1892,9 +1635,9 @@
18931636 // Check for mwEmbed.js and/or script loader
18941637 var src = js_elements[i].getAttribute( "src" );
18951638 if ( src ) {
1896 - if ( // Check for mwEmbed.js ( debug mode )
 1639+ if ( // Check for mwEmbed.js ( debug mode )
18971640 ( src.indexOf( 'mwEmbed.js' ) !== -1 && src.indexOf( 'MediaWiki:Gadget') == -1 )
1898 - || // Check for resource loader
 1641+ || // Check for resource loader
18991642 (
19001643 ( src.indexOf( 'mwResourceLoader.php' ) !== -1 || src.indexOf( 'ResourceLoader.php' ) !== -1 )
19011644 &&
@@ -1916,11 +1659,12 @@
19171660 var mwUrlParam = null;
19181661
19191662 /**
1920 - * Get URL Parameters per parameters in the host script include
1921 - */
 1663+ * Get URL Parameters per parameters in the host script include
 1664+ */
19221665 mw.getUrlParam = function() {
1923 - if ( mwUrlParam )
 1666+ if ( mwUrlParam ) {
19241667 return mwUrlParam;
 1668+ }
19251669
19261670 var mwEmbedSrc = mw.getMwEmbedSrc();
19271671 var req_param = '';
@@ -1928,14 +1672,15 @@
19291673 // If we already have a URI, add it to the param request:
19301674 var urid = mw.parseUri( mwEmbedSrc ).queryKey['urid']
19311675
1932 - // If we're in debug mode, get a fresh unique request key and pass on "debug" param
 1676+ // If we're in debug mode, get a fresh unique request key and pass on
 1677+ // "debug" param
19331678 if ( mw.parseUri( mwEmbedSrc ).queryKey['debug'] == 'true' ) {
19341679 mw.setConfig( 'debug', true );
19351680 var d = new Date();
19361681 req_param += 'urid=' + d.getTime() + '&debug=true';
19371682
19381683 } else if ( urid ) {
1939 - // Just pass on the existing urid:
 1684+ // Just pass on the existing urid:
19401685 req_param += 'urid=' + urid;
19411686 } else {
19421687 // Otherwise, Use the mwEmbed version
@@ -1947,19 +1692,20 @@
19481693 if ( langKey )
19491694 req_param += '&uselang=' + langKey;
19501695
1951 - // Update the local cache and return the value
 1696+ // Update the local cache and return the value
19521697 mwUrlParam = req_param;
19531698 return mwUrlParam;
19541699 }
19551700
1956 - /**
1957 - * Replace url parameters via newParams key value pairs
1958 - *
1959 - * @param {String} url Source url to be updated
1960 - * @param {Object} newParams key, value paris to swap in
1961 - * @return {String}
1962 - * the updated url
1963 - */
 1701+ /**
 1702+ * Replace url parameters via newParams key value pairs
 1703+ *
 1704+ * @param {String}
 1705+ * url Source url to be updated
 1706+ * @param {Object}
 1707+ * newParams key, value paris to swap in
 1708+ * @return {String} the updated url
 1709+ */
19641710 mw.replaceUrlParams = function( url, newParams ) {
19651711 var parsedUrl = mw.parseUri( url );
19661712
@@ -1969,7 +1715,7 @@
19701716 var new_url = parsedUrl.path + '?';
19711717 }
19721718
1973 - // Merge new params:
 1719+ // Merge new params:
19741720 for( var key in newParams ) {
19751721 parsedUrl.queryKey[ key ] = newParams[ key ];
19761722 }
@@ -1985,10 +1731,8 @@
19861732 }
19871733
19881734 /**
1989 - * parseUri 1.2.2
1990 - * (c) Steven Levithan <stevenlevithan.com>
1991 - * MIT License
1992 - */
 1735+ * parseUri 1.2.2 (c) Steven Levithan <stevenlevithan.com> MIT License
 1736+ */
19931737 mw.parseUri = function (str) {
19941738 var o = mw.parseUri.options,
19951739 m = o.parser[o.strictMode ? "strict" : "loose"].exec(str),
@@ -2006,11 +1750,11 @@
20071751 };
20081752
20091753 /**
2010 - * Parse URI function
2011 - *
2012 - * For documentation on its usage see:
2013 - * http://stevenlevithan.com/demo/parseuri/js/
2014 - */
 1754+ * Parse URI function
 1755+ *
 1756+ * For documentation on its usage see:
 1757+ * http://stevenlevithan.com/demo/parseuri/js/
 1758+ */
20151759 mw.parseUri.options = {
20161760 strictMode: false,
20171761 key: ["source", "protocol", "authority", "userInfo", "user", "password", "host",
@@ -2026,11 +1770,13 @@
20271771 };
20281772
20291773 /**
2030 - * getAbsoluteUrl takes a src and returns the absolute location given the document.URL
2031 - *
2032 - * @param {String} src path or url
2033 - * @return {String} absolute url
2034 - */
 1774+ * getAbsoluteUrl takes a src and returns the absolute location given the
 1775+ * document.URL
 1776+ *
 1777+ * @param {String}
 1778+ * src path or url
 1779+ * @return {String} absolute url
 1780+ */
20351781 mw.absoluteUrl = function( src, contextUrl ) {
20361782 var parsedSrc = mw.parseUri( src );
20371783 // Source is already absolute return:
@@ -2038,14 +1784,14 @@
20391785 return src;
20401786 }
20411787
2042 - // Get parent Url location the context URL
 1788+ // Get parent Url location the context URL
20431789 if( contextUrl) {
20441790 var parsedUrl = mw.parseUri( contextUrl );
20451791 } else {
20461792 var parsedUrl = mw.parseUri( document.URL );
20471793 }
20481794
2049 - // Check for leading slash:
 1795+ // Check for leading slash:
20501796 if( src.indexOf( '/' ) === 0 ) {
20511797 return parsedUrl.protocol + '://' + parsedUrl.authority + src;
20521798 }else{
@@ -2055,9 +1801,10 @@
20561802
20571803 /**
20581804 * Escape quotes in a text string
2059 - * @param {String} text String to be escaped
2060 - * @return {string}
2061 - * escaped text string
 1805+ *
 1806+ * @param {String}
 1807+ * text String to be escaped
 1808+ * @return {string} escaped text string
20621809 */
20631810 mw.escapeQuotes = function( text ) {
20641811 var re = new RegExp("'","g");
@@ -2069,53 +1816,54 @@
20701817
20711818 /**
20721819 * Escape an HTML text string
2073 - * @param {String} text String to be escaped
2074 - * @return {string}
2075 - * escaped text html string
 1820+ *
 1821+ * @param {String}
 1822+ * text String to be escaped
 1823+ * @return {string} escaped text html string
20761824 */
20771825 mw.escapeQuotesHTML = function( text ) {
2078 - var re = new RegExp('&',"g");
2079 - text = text.replace(re,"&amp;");
2080 - re = new RegExp('"',"g");
2081 - text = text.replace(re,"&quot;");
2082 - re = new RegExp('<',"g");
2083 - text = text.replace(re,"&lt;");
2084 - re = new RegExp('>',"g");
2085 - text = text.replace(re,"&gt;");
2086 - return text;
 1826+ var replaceMap = {
 1827+ "&" : "&amp;",
 1828+ '"' : "&quot;",
 1829+ '<' : "&lt;",
 1830+ '>' : "&gt;"
 1831+ }
 1832+ for( var i in replaceMap ){
 1833+ text = text.split(i).join( replaceMap[i]);
 1834+ }
 1835+ return text;
20871836 };
2088 -
20891837
20901838 // Array of setup functions
20911839 var mwSetupFunctions = [];
20921840
20931841 /**
2094 - * Add a function to be run during setup ( prior to mw.ready)
2095 - * this is useful for building out interfaces that
2096 - * should be ready before mw.ready is called.
2097 - *
2098 - * @param {callback} Function Callback function must
2099 - * accept a ready function callback to be called once
2100 - * setup is done
2101 - */
 1842+ * Add a function to be run during setup ( prior to mw.ready) this is useful
 1843+ * for building out interfaces that should be ready before mw.ready is
 1844+ * called.
 1845+ *
 1846+ * @param {callback}
 1847+ * Function Callback function must accept a ready function
 1848+ * callback to be called once setup is done
 1849+ */
21021850 mw.addSetupHook = function( callback ) {
21031851 mwSetupFunctions.push ( callback ) ;
21041852 };
21051853
21061854 /**
2107 - * One time "setup" for mwEmbed
2108 - * run onDomReady ( so calls to setConfg apply to setup )
2109 - */
 1855+ * One time "setup" for mwEmbed run onDomReady ( so calls to setConfg apply
 1856+ * to setup )
 1857+ */
21101858 // Flag to ensure setup is only run once:
21111859 var mwSetupFlag = false;
21121860 mw.setupMwEmbed = function ( ) {
2113 - // Only run the setup once:
 1861+ // Only run the setup once:
21141862 if( mwSetupFlag ) {
21151863 return ;
21161864 }
21171865 mwSetupFlag = true;
21181866
2119 - // Apply any pre-setup config:
 1867+ // Apply any pre-setup config:
21201868 mw.setConfig( preMwEmbedConfig );
21211869
21221870
@@ -2123,16 +1871,16 @@
21241872
21251873 // Check core mwEmbed loader.js file ( to get configuration and paths )
21261874 mw.checkCoreLoaderFile( function(){
2127 - // Make sure we have jQuery
 1875+ // Make sure we have jQuery
21281876 mw.load( 'window.jQuery', function() {
21291877
2130 - // Add jQuery to $j var.
 1878+ // Add jQuery to $j var.
21311879 if ( ! window[ '$j' ] ) {
21321880 window[ '$j' ] = jQuery.noConflict();
21331881 }
21341882
2135 - // Get module loader.js, and language files
2136 - // ( will hit callback directly if set via resource loader )
 1883+ // Get module loader.js, and language files
 1884+ // ( will hit callback directly if set via resource loader )
21371885 mw.checkModuleLoaderFiles( function() {
21381886
21391887 // Set the User language
@@ -2146,7 +1894,7 @@
21471895 }
21481896 }
21491897
2150 - // Update the image path
 1898+ // Update the image path
21511899 mw.setConfig( 'imagesPath', mw.getMwEmbedPath() + 'skins/common/images/' );
21521900
21531901 // Set up AJAX to not send dynamic URLs for loading scripts
@@ -2154,29 +1902,29 @@
21551903 cache: true
21561904 } );
21571905
2158 - // Update the magic keywords
 1906+ // Update the magic keywords
21591907 mw.Language.magicSetup();
21601908
21611909 // Set up mvEmbed utility jQuery bindings
21621910 mw.dojQueryBindings();
21631911
21641912
2165 - // Special Hack for conditional jquery ui inclusion ( once Usability extension
2166 - // registers the jquery.ui skin in mw.style this won't be needed:
 1913+ // Special Hack for conditional jquery ui inclusion ( once
 1914+ // Usability extension
 1915+ // registers the jquery.ui skin in mw.style
21671916 if( mw.hasJQueryUiCss() ){
2168 - mw.style[ mw.getConfig( 'jQueryUISkin' ) ] = true;
2169 - }
 1917+ mw.style[ 'ui_' + mw.getConfig( 'jQueryUISkin' ) ] = true;
 1918+ }
21701919
21711920
2172 - // Make sure style sheets are loaded:
2173 - mw.load( ['mw.style.mwCommon'] , function(){
2174 -
2175 -
2176 - // Run all the setup function hooks
2177 - // NOTE: setup functions are added via addSetupHook calls
 1921+ // Make sure style sheets are loaded:
 1922+ mw.load( ['mw.style.mwCommon'] , function(){
 1923+ // Run all the setup function hooks
 1924+ // NOTE: setup functions are added via addSetupHook
 1925+ // calls
21781926 // and must include a callback.
21791927 //
2180 - // Once complete we can run .ready() queued functions
 1928+ // Once complete we can run .ready() queued functions
21811929 function runSetupFunctions() {
21821930 if( mwSetupFunctions.length ) {
21831931 mwSetupFunctions.shift()( function() {
@@ -2186,7 +1934,7 @@
21871935 mw.runReadyFunctions();
21881936 }
21891937 }
2190 - runSetupFunctions();
 1938+ runSetupFunctions();
21911939 } );
21921940
21931941 } );
@@ -2195,55 +1943,68 @@
21961944 };
21971945
21981946 /**
2199 - * Checks for jquery ui css by name jquery-ui-1.7.2.css
2200 - * NOTE: this is a hack for usability jquery-ui
2201 - * in the future usability should register a resource in mw.skin
2202 - *
2203 - * @return true if found, return false if not found
2204 - */
 1947+ * Checks for jquery ui css by name jquery-ui-1.7.2.css NOTE: this is a hack
 1948+ * for usability jquery-ui in the future usability should register a
 1949+ * resource in mw.skin
 1950+ *
 1951+ * @return true if found, return false if not found
 1952+ */
22051953 mw.hasJQueryUiCss = function(){
2206 - var hasUiCss = false;
 1954+ var hasUiCss = false;
22071955 // Load the jQuery ui skin if usability skin not set
22081956 $j( 'link' ).each( function( na, linkNode ){
22091957 if( $j( linkNode ).attr( 'href' ).indexOf( 'jquery-ui-1.7.2.css' ) != -1 ) {
22101958 hasUiCss = true;
2211 - return false;
 1959+ return true;
22121960 }
22131961 } );
 1962+ // Check all the "style" nodes for @import of jquery-ui-1.7.2.css
 1963+ // xxx Note: we could do this a bit cleaner with regEx
 1964+ $j( 'style' ).each( function( na, styleNode ){
 1965+ if( $j( styleNode ).text().indexOf( '@import' ) != -1
 1966+ && $j( styleNode ).text().indexOf( 'jquery-ui-1.7.2.css' ) != -1 ){
 1967+ hasUiCss=true;
 1968+ }
 1969+ });
 1970+
22141971 return hasUiCss;
22151972 }
22161973
2217 - /**
 1974+ /**
22181975 * Loads the core mwEmbed "loader.js" file config
2219 - *
2220 - * NOTE: if using the ScriptLoader all the loaders and localization converters
2221 - * are included automatically
2222 - *
2223 - * @param {Function} callback Function called once core loader file is loaded
 1976+ *
 1977+ * NOTE: if using the ScriptLoader all the loaders and localization
 1978+ * converters are included automatically
 1979+ *
 1980+ * @param {Function}
 1981+ * callback Function called once core loader file is loaded
22241982 */
22251983 mw.checkCoreLoaderFile = function( callback ) {
2226 - // Check if we are using scriptloader ( handles loader include automatically )
 1984+ // Check if we are using scriptloader ( handles loader include
 1985+ // automatically )
22271986 if( mw.getResourceLoaderPath() ) {
22281987 callback();
22291988 return ;
22301989 }
22311990
2232 - // Check if we are using a static package ( mwEmbed path includes -static )
 1991+ // Check if we are using a static package ( mwEmbed path includes
 1992+ // -static )
22331993 if( mw.isStaticPackge() ){
22341994 callback();
22351995 return ;
22361996 }
22371997
22381998 // Add the Core loader to the request
2239 - // The follow code is ONLY RUN in debug / raw file mode
 1999+ // The follow code is ONLY RUN in debug / raw file mode
22402000 mw.load( 'loader.js', callback );
22412001 }
 2002+
22422003 /**
2243 - * Checks if the javascript is a static package ( not using resource loader )
2244 - * @return {boolean}
2245 - * true the included script is static
2246 - * false the included script
2247 - */
 2004+ * Checks if the javascript is a static package ( not using resource loader )
 2005+ *
 2006+ * @return {boolean} true the included script is static false the included
 2007+ * script
 2008+ */
22482009 mw.isStaticPackge = function(){
22492010 var src = mw.getMwEmbedSrc();
22502011 if( src.indexOf('-static') !== -1 ){
@@ -2253,26 +2014,28 @@
22542015 }
22552016
22562017 /**
2257 - * Check for resource loader module loaders, and localization files
2258 - *
2259 - * NOTE: if using the ScriptLoader all the loaders and localization converters
2260 - * are included automatically.
2261 - */
 2018+ * Check for resource loader module loaders, and localization files
 2019+ *
 2020+ * NOTE: if using the ScriptLoader all the loaders and localization
 2021+ * converters are included automatically.
 2022+ */
22622023 mw.checkModuleLoaderFiles = function( callback ) {
22632024 mw.log( 'doLoaderCheck::' );
22642025
2265 - // Check if we are using scriptloader ( handles loader include automatically )
2266 - // Or if mwEmbed is a static package ( all resources are already loaded )
 2026+ // Check if we are using scriptloader ( handles loader include
 2027+ // automatically )
 2028+ // Or if mwEmbed is a static package ( all resources are already loaded
 2029+ // )
22672030 if( mw.getResourceLoaderPath() || mw.isStaticPackge() ) {
22682031 callback();
22692032 return ;
22702033 }
22712034
22722035 // Load the configured modules / components
2273 - // The follow code is ONLY RUN in debug / raw file mode
 2036+ // The follow code is ONLY RUN in debug / raw file mode
22742037 var loaderRequest = [];
22752038
2276 - //Load enabled components
 2039+ // Load enabled components
22772040 var enabledComponents = mw.getConfig( 'coreComponents' );
22782041 function loadEnabledComponents( enabledComponents ){
22792042 if( ! enabledComponents.length ){
@@ -2291,7 +2054,7 @@
22922055 loadEnabledComponents( enabledComponents );
22932056
22942057
2295 - // Set the loader context and get each loader individually
 2058+ // Set the loader context and get each loader individually
22962059 function loadEnabledModules( enabledModules ){
22972060 if( ! enabledModules.length ){
22982061 // If no more modules left load the LanguageFile
@@ -2312,7 +2075,7 @@
23132076 if( mw.getConfig( 'userLanguage' ) ) {
23142077 var langCode = mw.getConfig( 'userLanguage' );
23152078
2316 - // Load the language resource if not default 'en'
 2079+ // Load the language resource if not default 'en'
23172080 var transformKey = mw.getLangTransformKey( langCode );
23182081 if( transformKey != 'en' ){
23192082 // Upper case the first letter:
@@ -2339,21 +2102,20 @@
23402103 }
23412104
23422105 /**
2343 - * Checks if a css style rule exists
2344 - *
2345 - * On a page with lots of rules it can take some time
2346 - * so avoid calling this function where possible and
2347 - * cache its result
2348 - *
2349 - * NOTE: this only works for style sheets on the same domain :(
2350 - *
2351 - * @param {String} styleRule Style rule name to check
2352 - * @return {Boolean}
2353 - * true if the rule exists
2354 - * false if the rule does not exist
2355 - */
 2106+ * Checks if a css style rule exists
 2107+ *
 2108+ * On a page with lots of rules it can take some time so avoid calling this
 2109+ * function where possible and cache its result
 2110+ *
 2111+ * NOTE: this only works for style sheets on the same domain :(
 2112+ *
 2113+ * @param {String}
 2114+ * styleRule Style rule name to check
 2115+ * @return {Boolean} true if the rule exists false if the rule does not
 2116+ * exist
 2117+ */
23562118 mw.styleRuleExists = function ( styleRule ) {
2357 - // Set up the skin paths configuration
 2119+ // Set up the skin paths configuration
23582120 for( var i=0 ; i < document.styleSheets.length ; i++ ) {
23592121 var rules = null;
23602122 try{
@@ -2381,9 +2143,9 @@
23822144 var mwModuleLoaderCheckFlag = false;
23832145
23842146 /**
2385 - * This will get called when the DOM is ready
2386 - * Will check configuration and issue a mw.setupMwEmbed call if needed
2387 - */
 2147+ * This will get called when the DOM is ready Will check configuration and
 2148+ * issue a mw.setupMwEmbed call if needed
 2149+ */
23882150 mw.domReady = function ( ) {
23892151 if( mwDomReadyFlag ) {
23902152 return ;
@@ -2392,28 +2154,30 @@
23932155 // Set the onDomReady Flag
23942156 mwDomReadyFlag = true;
23952157
2396 - // Give us a chance to get to the bottom of the script.
2397 - // When loading mwEmbed asynchronously the dom ready gets called
2398 - // directly and in some browsers beets the $j = jQuery.noConflict(); call
2399 - // and causes symbol undefined errors.
 2158+ // Give us a chance to get to the bottom of the script.
 2159+ // When loading mwEmbed asynchronously the dom ready gets called
 2160+ // directly and in some browsers beets the $j = jQuery.noConflict();
 2161+ // call
 2162+ // and causes symbol undefined errors.
24002163 setTimeout(function(){
24012164 mw.setupMwEmbed();
24022165 },1);
24032166 }
24042167
24052168 /**
2406 - * A version comparison utility function
2407 - * Handles version of types {Major}.{MinorN}.{Patch}
2408 - *
2409 - * Note this just handles version numbers not patch letters.
2410 - *
2411 - * @param {String} minVersion Minnium version needed
2412 - * @param {String} clientVersion Client version to be checked
2413 -
2414 - * @return
2415 - * true if the version is at least of minVersion
2416 - * false if the version is less than minVersion
2417 - */
 2169+ * A version comparison utility function Handles version of types
 2170+ * {Major}.{MinorN}.{Patch}
 2171+ *
 2172+ * Note this just handles version numbers not patch letters.
 2173+ *
 2174+ * @param {String}
 2175+ * minVersion Minnium version needed
 2176+ * @param {String}
 2177+ * clientVersion Client version to be checked
 2178+ *
 2179+ * @return true if the version is at least of minVersion false if the
 2180+ * version is less than minVersion
 2181+ */
24182182 mw.versionIsAtLeast = function( minVersion, clientVersion ) {
24192183 var minVersionParts = minVersion.split('.')
24202184 var clientVersionParts = clientVersion.split('.');
@@ -2432,20 +2196,23 @@
24332197 /**
24342198 * Runs all the triggers on a given object with a single "callback"
24352199 *
2436 - * Normal tirgger calls will run the callback directly multiple times
2437 - * for every binded function.
 2200+ * Normal tirgger calls will run the callback directly multiple times for
 2201+ * every binded function.
24382202 *
2439 - * With runTriggersCallback() callback is not called until all the
2440 - * binded events have been run.
 2203+ * With runTriggersCallback() callback is not called until all the binded
 2204+ * events have been run.
24412205 *
2442 - * @param {object} targetObject Target object to run triggers on
2443 - * @param {string} triggerName Name of trigger to be run
2444 - * @param {function} callback Function called once all triggers have been run
 2206+ * @param {object}
 2207+ * targetObject Target object to run triggers on
 2208+ * @param {string}
 2209+ * triggerName Name of trigger to be run
 2210+ * @param {function}
 2211+ * callback Function called once all triggers have been run
24452212 *
24462213 */
2447 - mw.runTriggersCallback = function( targetObject, triggerName, callback ){
 2214+ mw.runTriggersCallback = function( targetObject, triggerName, callback ){
24482215 mw.log( ' runTriggersCallback:: ' + triggerName );
2449 - // If events are not present directly run callback
 2216+ // If events are not present directly run callback
24502217 if( ! $j( targetObject ).data( 'events' ) ||
24512218 ! $j( targetObject ).data( 'events' )[ triggerName ] ) {
24522219 mw.log( ' trigger name not found: ' + triggerName );
@@ -2464,7 +2231,7 @@
24652232
24662233 mw.log(" runTriggersCallback:: " + callbackCount );
24672234 var callInx = 0;
2468 - $j( targetObject ).trigger( 'checkPlayerSourcesEvent', function() {
 2235+ $j( targetObject ).trigger( triggerName, function() {
24692236 callInx++;
24702237 if( callInx == callbackCount ){
24712238 // Run callback
@@ -2473,29 +2240,71 @@
24742241 } );
24752242 }
24762243 /**
2477 - * Utility jQuery bindings
2478 - * Setup after jQuery is available ).
 2244+ * Utility jQuery bindings Setup after jQuery is available ).
24792245 */
24802246 mw.dojQueryBindings = function() {
24812247 mw.log( 'mw.dojQueryBindings' );
24822248 ( function( $ ) {
24832249
24842250 /**
2485 - * Set a given selector html to the loading spinner:
2486 - */
 2251+ * Set a given selector html to the loading spinner:
 2252+ */
24872253 $.fn.loadingSpinner = function( ) {
24882254 if ( this ) {
24892255 $j( this ).html(
24902256 $j( '<div />' )
2491 - .addClass( "loadingSpinner" )
2492 - );
2493 - }
 2257+ .addClass( "loadingSpinner" )
 2258+ );
 2259+ }
 2260+ /*
 2261+ * //var csstransforms = false; if ( Modernizr.csstransforms ) {
 2262+ * var barNumber = 7; var barContent = ''; var barSpacingDegrees =
 2263+ * 360 / barNumber; var barOpacityDelta = 1 / (barNumber); for
 2264+ * (i = 1; i < barNumber+1; i++) { barContent += '<div
 2265+ * class="bar' + i + '" style="-moz-transform:rotate(' + (i-1) *
 2266+ * barSpacingDegrees + 'deg) translate(0,
 2267+ * -40px);-webkit-transform:rotate(' + (i-1) * barSpacingDegrees +
 2268+ * 'deg) translate(0, -40px);opacity:' + (i) * barOpacityDelta + ';
 2269+ * background:#000"/>'; } $j( this ).html( $j( '<div />' )
 2270+ * .addClass( "cssLoadingSpinner" ) .html( barContent ) ); var
 2271+ * rotations = 0; setInterval( function ( ) {
 2272+ * $j('.cssLoadingSpinner')
 2273+ * .css('-moz-transform','rotate('+rotations+'deg)')
 2274+ * .css('-webkit-transform','rotate('+rotations+'deg)'); if(
 2275+ * rotations == 360 ) { rotations = 0; } rotations += 5; }, 25); }
 2276+ */
24942277 return this;
24952278 }
 2279+ /**
 2280+ * Add an absolute overlay spinner useful for cases where the
 2281+ * element does not display child elements, ( images, video )
 2282+ */
 2283+ $.fn.getAbsoluteOverlaySpinner = function(){
 2284+ var pos = $j( this ).offset();
 2285+ var posLeft = ( $j( this ).width() ) ?
 2286+ parseInt( pos.left + ( .4 * $j( this ).width() ) ) :
 2287+ pos.left + 30;
 2288+
 2289+ var posTop = ( $j( this ).height() ) ?
 2290+ parseInt( pos.top + ( .4 * $j( this ).height() ) ) :
 2291+ pos.top + 30;
 2292+
 2293+ var $spinner = $j('<div />')
 2294+ .loadingSpinner()
 2295+ .css({
 2296+ 'width' : 32,
 2297+ 'height' : 32,
 2298+ 'position': 'absolute',
 2299+ 'top' : posTop + 'px',
 2300+ 'left' : posLeft + 'px'
 2301+ });
 2302+ $j('body').append( $spinner );
 2303+ return $spinner;
 2304+ }
24962305
24972306 /**
2498 - * dragDrop file loader
2499 - */
 2307+ * dragDrop file loader
 2308+ */
25002309 $.fn.dragFileUpload = function ( conf ) {
25012310 if ( this.selector ) {
25022311 var _this = this;
@@ -2507,8 +2316,8 @@
25082317 }
25092318
25102319 /**
2511 - * Shortcut to a themed button
2512 - * Should be depreciated for $.button bellow
 2320+ * Shortcut to a themed button Should be depreciated for $.button
 2321+ * bellow
25132322 */
25142323 $.btnHtml = function( msg, styleClass, iconId, opt ) {
25152324 if ( !opt )
@@ -2522,7 +2331,8 @@
25232332 '<span class="btnText">' + msg + '</span></a>';
25242333 };
25252334
2526 - // Shortcut to jQuery button ( should replace all btnHtml with button )
 2335+ // Shortcut to jQuery button ( should replace all btnHtml with
 2336+ // button )
25272337 var mw_default_button_options = {
25282338 // The class name for the button link
25292339 'class' : '',
@@ -2540,11 +2350,11 @@
25412351 $.button = function( options ) {
25422352 var options = $j.extend( mw_default_button_options, options);
25432353
2544 - // Button:
 2354+ // Button:
25452355 var $btn = $j('<a />')
25462356 .attr('href', '#')
25472357 .addClass( 'ui-state-default ui-corner-all ui-icon_link' );
2548 - // Add css if set:
 2358+ // Add css if set:
25492359 if( options.css ) {
25502360 $btn.css( options.css )
25512361 }
@@ -2553,12 +2363,14 @@
25542364 $btn.addClass( options['class'] )
25552365 }
25562366
2557 - $btn.append(
2558 - $j('<span />').addClass( 'ui-icon ui-icon-' + options.icon_id ),
2559 - $j('<span />').addClass( 'btnText' )
2560 - .text( options.text )
2561 - );
2562 - return $btn;
 2367+
 2368+ // return the button:
 2369+ return $btn.append(
 2370+ $j('<span />').addClass( 'ui-icon ui-icon-' + options.icon_id ),
 2371+ $j('<span />').addClass( 'btnText' )
 2372+ .text( options.text )
 2373+ )
 2374+ .buttonHover(); // add buttonHover binding;
25632375 };
25642376
25652377 // Shortcut to bind hover state
@@ -2575,9 +2387,11 @@
25762388 };
25772389
25782390 /**
2579 - * Resize a dialog to fit the window
2580 - * @param {Object} options horizontal and vertical space ( default 50 )
2581 - */
 2391+ * Resize a dialog to fit the window
 2392+ *
 2393+ * @param {Object}
 2394+ * options horizontal and vertical space ( default 50 )
 2395+ */
25822396 $.fn.dialogFitWindow = function( options ) {
25832397 var opt_default = { 'hspace':50, 'vspace':50 };
25842398 if ( !options )
@@ -2586,7 +2400,8 @@
25872401 $j( this.selector ).dialog( 'option', 'width', $j( window ).width() - options.hspace );
25882402 $j( this.selector ).dialog( 'option', 'height', $j( window ).height() - options.vspace );
25892403 $j( this.selector ).dialog( 'option', 'position', 'center' );
2590 - // update the child position: (some of this should be pushed up-stream via dialog config options
 2404+ // update the child position: (some of this should be pushed
 2405+ // up-stream via dialog config options
25912406 $j( this.selector + '~ .ui-dialog-buttonpane' ).css( {
25922407 'position':'absolute',
25932408 'left':'0px',
@@ -2602,13 +2417,11 @@
26032418
26042419
26052420 /**
2606 -* Set DOM-ready call
2607 -* We copy jQuery( document ).ready here since sometimes
2608 -* mwEmbed.js is included without jQuery
2609 -* and we need our own "ready" system so that
2610 -* mwEmbed interfaces can support async built out
2611 -* and the inclution of jQuery.
2612 -*/
 2421+ * Set DOM-ready call We copy jQuery( document ).ready here since sometimes
 2422+ * mwEmbed.js is included without jQuery and we need our own "ready" system so
 2423+ * that mwEmbed interfaces can support async built out and the include of
 2424+ * jQuery.
 2425+ */
26132426 var mwDomIsReady = false;
26142427 function runMwDomReady(){
26152428 mwDomIsReady = true;
@@ -2616,7 +2429,7 @@
26172430 mw.domReady()
26182431 }
26192432 }
2620 -// Check if already ready:
 2433+// Check if already ready:
26212434 if ( document.readyState === "complete" ) {
26222435 runMwDomReady();
26232436 }
@@ -2630,7 +2443,8 @@
26312444
26322445 } else if ( document.attachEvent ) {
26332446 DOMContentLoaded = function() {
2634 - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443).
 2447+ // Make sure body exists, at least, in case IE gets a little overzealous
 2448+ // (ticket #5443).
26352449 if ( document.readyState === "complete" ) {
26362450 document.detachEvent( "onreadystatechange", DOMContentLoaded );
26372451 runMwDomReady();
@@ -2686,8 +2500,9 @@
26872501 }
26882502
26892503
2690 -// If using the resource loader and jQuery has not been set give a warning to the user:
2691 -// (this is needed because packaged loader.js files could refrence jQuery )
 2504+// If using the resource loader and jQuery has not been set give a warning to
 2505+// the user:
 2506+// (this is needed because packaged loader.js files could refrence jQuery )
26922507 if( mw.getResourceLoaderPath() && !window.jQuery ) {
26932508 mw.log( 'Error: jQuery is required for mwEmbed, please update your resource loader request' );
26942509 }
@@ -2697,14 +2512,13 @@
26982513 }
26992514
27002515 /**
2701 - * Hack to keep jQuery in $ when its
2702 - * already there, but also use noConflict to get $j = jQuery
 2516+ * Hack to keep jQuery in $ when its already there, but also use noConflict to
 2517+ * get $j = jQuery
27032518 *
2704 - * This way sites that use $ for jQuery continue to work after
2705 - * including mwEmbed javascript.
 2519+ * This way sites that use $ for jQuery continue to work after including mwEmbed
 2520+ * javascript.
27062521 *
2707 - * Also if jQuery is included prior to mwEmbed we ensure
2708 - * $j is set
 2522+ * Also if jQuery is included prior to mwEmbed we ensure $j is set
27092523 */
27102524
27112525 if( window.jQuery ){
Index: trunk/extensions/JS2Support/mwEmbed/libraries/jquery/plugins/modernizr.js
@@ -0,0 +1,307 @@
 2+/*!
 3+ * Modernizr JavaScript library 1.2pre
 4+ * http://modernizr.com/
 5+ *
 6+ * Copyright (c) 2009-2010 Faruk Ates - http://farukat.es/
 7+ * Licensed under the MIT license.
 8+ * http://modernizr.com/license/
 9+ *
 10+ * Featuring major contributions by
 11+ * Paul Irish - http://paulirish.com
 12+ */
 13+/*
 14+ * Modernizr is a script that will detect native CSS3 and HTML5 features
 15+ * available in the current UA and provide an object containing all
 16+ * features with a true/false value, depending on whether the UA has
 17+ * native support for it or not.
 18+ *
 19+ * In addition to that, Modernizr will add classes to the <html>
 20+ * element of the page, one for each cutting-edge feature. If the UA
 21+ * supports it, a class like "cssgradients" will be added. If not,
 22+ * the class name will be "no-cssgradients". This allows for simple
 23+ * if-conditionals in CSS styling, making it easily to have fine
 24+ * control over the look and feel of your website.
 25+ *
 26+ * @author Faruk Ates
 27+ * @copyright (2009-2010) Faruk Ates.
 28+ *
 29+ * @contributor Paul Irish
 30+ * @contributor Ben Alman
 31+ */
 32+
 33+window.Modernizr = (function(window,doc,undefined){
 34+
 35+ var version = '1.2pre',
 36+
 37+ ret = {},
 38+
 39+ /**
 40+ * enableHTML5 is a private property for advanced use only. If enabled,
 41+ * it will make Modernizr.init() run through a brief while() loop in
 42+ * which it will create all HTML5 elements in the DOM to allow for
 43+ * styling them in Internet Explorer, which does not recognize any
 44+ * non-HTML4 elements unless created in the DOM this way.
 45+ *
 46+ * enableHTML5 is ON by default.
 47+ */
 48+ enableHTML5 = true,
 49+
 50+
 51+ /**
 52+ * fontfaceCheckDelay is the ms delay before the @font-face test is
 53+ * checked a second time. This is neccessary because both Gecko and
 54+ * WebKit do not load data: URI font data synchronously.
 55+ * https://bugzilla.mozilla.org/show_bug.cgi?id=512566
 56+ * The check will be done again at fontfaceCheckDelay*2 and then
 57+ * a fourth time at window's load event.
 58+ * If you need to query for @font-face support, send a callback to:
 59+ * Modernizr._fontfaceready(fn);
 60+ * The callback is passed the boolean value of Modernizr.fontface
 61+ */
 62+ fontfaceCheckDelay = 75,
 63+
 64+
 65+ docElement = doc.documentElement,
 66+
 67+ /**
 68+ * Create our "modernizr" element that we do most feature tests on.
 69+ */
 70+ mod = 'modernizr'
 71+ m = doc.createElement( mod ),
 72+ m_style = m.style,
 73+
 74+ /**
 75+ * Create the input element for various Web Forms feature tests.
 76+ */
 77+ f = doc.createElement( 'input' ),
 78+
 79+ // Reused strings.
 80+
 81+ canvas = 'canvas',
 82+ canvastext = 'canvastext',
 83+ webgl = 'webgl',
 84+ rgba = 'rgba',
 85+ hsla = 'hsla',
 86+ multiplebgs = 'multiplebgs',
 87+ borderimage = 'borderimage',
 88+ borderradius = 'borderradius',
 89+ boxshadow = 'boxshadow',
 90+ opacity = 'opacity',
 91+ cssanimations = 'cssanimations',
 92+ csscolumns = 'csscolumns',
 93+ cssgradients = 'cssgradients',
 94+ cssreflections = 'cssreflections',
 95+ csstransforms = 'csstransforms',
 96+ csstransforms3d = 'csstransforms3d',
 97+ csstransitions = 'csstransitions',
 98+ fontface = 'fontface',
 99+ geolocation = 'geolocation',
 100+ video = 'video',
 101+ audio = 'audio',
 102+ input = 'input',
 103+ inputtypes = input + 'types',
 104+ // inputtypes is an object of its own containing individual tests for
 105+ // various new input types, such as search, range, datetime, etc.
 106+
 107+ svg = 'svg',
 108+ smil = 'smil',
 109+ svgclippaths = svg+'clippaths',
 110+
 111+ background = 'background',
 112+ backgroundColor = background + 'Color',
 113+ canPlayType = 'canPlayType',
 114+
 115+ // FF gets really angry if you name local variables as these, but camelCased.
 116+ localstorage = 'localStorage',
 117+ sessionstorage = 'sessionStorage',
 118+ applicationcache = 'applicationCache',
 119+
 120+ webWorkers = 'webworkers',
 121+ hashchange = 'hashchange',
 122+ crosswindowmessaging = 'crosswindowmessaging',
 123+ historymanagement = 'historymanagement',
 124+ draganddrop = 'draganddrop',
 125+ websqldatabase = 'websqldatabase',
 126+ websocket = 'websocket',
 127+ flash = 'flash',
 128+ smile = ':)',
 129+ touch = 'touch',
 130+
 131+ toString = Object.prototype.toString,
 132+
 133+ // list of property values to set for css tests. see ticket #21
 134+ setProperties = ' -o- -moz- -ms- -webkit- -khtml- '.split(' '),
 135+
 136+ tests = {},
 137+ inputs = {},
 138+ attrs = {},
 139+
 140+ classes = [],
 141+
 142+ /**
 143+ * isEventSupported determines if a given element supports the given event
 144+ * function from http://yura.thinkweb2.com/isEventSupported/
 145+ */
 146+ isEventSupported = (function(){
 147+
 148+ var TAGNAMES = {
 149+ 'select':'input','change':'input',
 150+ 'submit':'form','reset':'form',
 151+ 'error':'img','load':'img','abort':'img'
 152+ },
 153+ cache = { };
 154+
 155+ function isEventSupported(eventName, element) {
 156+ var canCache = (arguments.length == 1);
 157+
 158+ // only return cached result when no element is given
 159+ if (canCache && cache[eventName]) {
 160+ return cache[eventName];
 161+ }
 162+
 163+ element = element || document.createElement(TAGNAMES[eventName] || 'div');
 164+ eventName = 'on' + eventName;
 165+
 166+ // When using `setAttribute`, IE skips "unload", WebKit skips "unload" and "resize"
 167+ // `in` "catches" those
 168+ var isSupported = (eventName in element);
 169+
 170+ if (!isSupported && element.setAttribute) {
 171+ element.setAttribute(eventName, 'return;');
 172+ isSupported = typeof element[eventName] == 'function';
 173+ }
 174+
 175+ element = null;
 176+ return canCache ? (cache[eventName] = isSupported) : isSupported;
 177+ }
 178+
 179+ return isEventSupported;
 180+ })();
 181+
 182+
 183+ /**
 184+ * set_css applies given styles to the Modernizr DOM node.
 185+ */
 186+ function set_css( str ) {
 187+ m_style.cssText = str;
 188+ }
 189+
 190+ /**
 191+ * set_css_all extrapolates all vendor-specific css strings.
 192+ */
 193+ function set_css_all( str1, str2 ) {
 194+ return set_css(setProperties.join(str1 + ';') + ( str2 || '' ));
 195+ }
 196+
 197+ /**
 198+ * contains returns a boolean for if substr is found within str.
 199+ */
 200+ function contains( str, substr ) {
 201+ return (''+str).indexOf( substr ) !== -1;
 202+ }
 203+
 204+ /**
 205+ * test_props is a generic CSS / DOM property test; if a browser supports
 206+ * a certain property, it won't return undefined for it.
 207+ * A supported CSS property returns empty string when its not yet set.
 208+ */
 209+ function test_props( props, callback ) {
 210+ for ( var i in props ) {
 211+ if ( m_style[ props[i] ] !== undefined && ( !callback || callback( props[i] ) ) ) {
 212+ return true;
 213+ }
 214+ }
 215+ }
 216+
 217+ /**
 218+ * test_props_all tests a list of DOM properties we want to check against.
 219+ * We specify literally ALL possible (known and/or likely) properties on
 220+ * the element including the non-vendor prefixed one, for forward-
 221+ * compatibility.
 222+ */
 223+ function test_props_all( prop, callback ) {
 224+ var uc_prop = prop.charAt(0).toUpperCase() + prop.substr(1),
 225+ props = [
 226+ prop,
 227+ 'Webkit' + uc_prop,
 228+ 'Moz' + uc_prop,
 229+ 'O' + uc_prop,
 230+ 'ms' + uc_prop,
 231+ 'Khtml' + uc_prop
 232+ ];
 233+
 234+ return !!test_props( props, callback );
 235+ }
 236+
 237+ // Tests
 238+
 239+ tests[csstransforms] = function() {
 240+ // set_css_all( 'transform:rotate(3deg)' );
 241+ return !!test_props([ 'transformProperty', 'WebkitTransform', 'MozTransform', 'OTransform', 'msTransform' ]);
 242+ };
 243+
 244+ // end of tests.
 245+
 246+
 247+
 248+ // Run through all tests and detect their support in the current UA.
 249+ // todo: hypothetically we could be doing an array of tests and use a basic loop here.
 250+ for ( var feature in tests ) {
 251+ if ( tests.hasOwnProperty( feature ) ) {
 252+ // run the test, then based on the boolean, define an appropriate className
 253+ classes.push( ( !( ret[ feature ] = tests[ feature ]() ) ? 'no-' : '' ) + feature );
 254+ }
 255+ }
 256+
 257+ // input tests need to run.
 258+// if (!ret[input]) webforms();
 259+
 260+
 261+
 262+
 263+
 264+
 265+ /**
 266+ * Addtest allows the user to define their own feature tests
 267+ * the result will be added onto the Modernizr object,
 268+ * as well as an appropriate className set on the html element
 269+ *
 270+ * @param feature - String naming the feature
 271+ * @param test - Function returning true if feature is supported, false if not
 272+ */
 273+ ret.addTest = function (feature, test) {
 274+ if (ret[ feature ]) {
 275+ return; // quit if you're trying to overwrite an existing test
 276+ }
 277+ feature = feature.toLowerCase();
 278+ test = !!(test());
 279+ docElement.className += ' ' + (!test ? 'no-' : '') + feature;
 280+ ret[ feature ] = test;
 281+ return ret; // allow chaining.
 282+ };
 283+
 284+ /**
 285+ * Reset m.style.cssText to nothing to reduce memory footprint.
 286+ */
 287+ set_css( '' );
 288+ m = f = null;
 289+
 290+ // Enable HTML 5 elements for styling in IE.
 291+ if ( enableHTML5 && !(!/*@cc_on@if(@_jscript_version<9)!@end@*/0) ) {
 292+ // iepp v1.5.1 MIT @jon_neal http://code.google.com/p/ie-print-protector/
 293+ (function(p,e){function q(a,b){if(g[a])g[a].styleSheet.cssText+=b;else{var c=r[l],d=e[j]("style");d.media=a;c.insertBefore(d,c[l]);g[a]=d;q(a,b)}}function s(a,b){for(var c=new RegExp("\\b("+m+")\\b(?!.*[;}])","gi"),d=function(k){return".iepp_"+k},h=-1;++h<a.length;){b=a[h].media||b;s(a[h].imports,b);q(b,a[h].cssText.replace(c,d))}}function t(){for(var a,b=e.getElementsByTagName("*"),c,d,h=new RegExp("^"+m+"$","i"),k=-1;++k<b.length;)if((a=b[k])&&(d=a.nodeName.match(h))){c=new RegExp("^\\s*<"+d+"(.*)\\/"+d+">\\s*$","i");i.innerHTML=a.outerHTML.replace(/\r|\n/g," ").replace(c,a.currentStyle.display=="block"?"<div$1/div>":"<span$1/span>");c=i.childNodes[0];c.className+=" iepp_"+d;c=f[f.length]=[a,c];a.parentNode.replaceChild(c[1],c[0])}s(e.styleSheets,"all")}function u(){for(var a=-1,b;++a<f.length;)f[a][1].parentNode.replaceChild(f[a][0],f[a][1]);for(b in g)r[l].removeChild(g[b]);g={};f=[]}for(var r=e.documentElement,i=e.createDocumentFragment(),g={},m="abbr|article|aside|audio|canvas|command|datalist|details|figure|figcaption|footer|header|hgroup|keygen|mark|meter|nav|output|progress|section|source|summary|time|video",n=m.split("|"),f=[],o=-1,l="firstChild",j="createElement";++o<n.length;){e[j](n[o]);i[j](n[o])}i=i.appendChild(e[j]("div"));p.attachEvent("onbeforeprint",t);p.attachEvent("onafterprint",u)})(this,doc);
 294+ }
 295+
 296+ // Assign private properties to the return object with prefix
 297+ ret._enableHTML5 = enableHTML5;
 298+ ret._version = version;
 299+
 300+ // Remove "no-js" class from <html> element, if it exists:
 301+ docElement.className=docElement.className.replace(/\bno-js\b/,'js');
 302+
 303+ // Add the new classes to the <html> element.
 304+ docElement.className += ' ' + classes.join( ' ' );
 305+
 306+ return ret;
 307+
 308+})(this,this.document);
Property changes on: trunk/extensions/JS2Support/mwEmbed/libraries/jquery/plugins/modernizr.js
___________________________________________________________________
Added: svn:eol-style
1309 + native
Added: svn:executable
2310 + *
Index: trunk/extensions/JS2Support/mwEmbed/README
@@ -1,33 +1,68 @@
2 -# mwEmbed
 2+# Kaltura HTML5 Media Javascript Library
33
4 -This javascript library enables you to take advantage of the [html5 `<video>` and `<audio>` tags](https://developer.mozilla.org/En/Using_audio_and_video_in_FireFox) today with a consistent player interface across all major browsers including Internet Explorer.
 4+## Library Overview
55
6 -The library supports a seamless fallback with Flash based playback (using Kaltura’s media player – KDP3) or Java Cortado for browsers that don’t yet feature HTML5 video & audio support. Upon detection of the client browser, the Kaltura HTML5 library chooses the right codec to use (specified in the source attributes) and the right player to display. So whether you’re using flash, h264, ogg-theora, or WebM – Kaltura’s library will make sure it is played on all browsers with the same html based UI.
 6+[html5]: https://developer.mozilla.org/En/Using_audio_and_video_in_FireFox
 7+[KDP3]: http://www.kaltura.org/project/Video_Player_Playlist_Widget
78
8 -While support for HTML5 video is growing, there is large percentage of the web browser market that is presently best served by the Adobe Flash plugin and an associated player. A base component of the Kaltura HTML5 javascript library bridges this gap, by cascading to an underlining Flash player in browsers that do not support the native HTML5 video player. In addition, Kaltura’s player maintains a unified look & feel across formats and browsers. Kalturas platform provides automatic transcoding into all supported formats (OGG, H.264, MOV, FLV etc.)
 9+__Kaltura's HTML5 Media Library__ enables you to take advantage of the [html5 `<video>` and `<audio>` tags][html5] today with a consistent player interface across all major browsers including Internet Explorer.
910
10 -**Coming soon!** Kaltura’s HTML5 video player will soon support all advanced video management capabilities, including analytics and monetization, making it commercially viable on devices, such as the Apple iPhone, that do not support Flash.
 11+The library supports a seamless fallback with Flash based playback using [Kaltura's Flash player][KDP3] or Java Cortado for browsers that don't yet feature HTML5 video & audio support. Upon detection of the client browser, the __Kaltura HTML5 Media Library__ chooses the right codec to use (specified in the source attributes, or available from a Kaltura server) and the right player to display. So whether you're using flash, h264, ogg-theora, or WebM -- Kaltura's library will make sure it is played on all browsers with the same UI.
 12+While support for HTML5 video is growing, there is large percentage of the web browser market that is presently best served by the Adobe Flash plugin and an associated player. A base component of the Kaltura HTML5 javascript library bridges this gap, by cascading to an underlining Flash player in browsers that do not support the native HTML5 video player. In addition, Kaltura's player maintains a unified look & feel across formats and browsers.
1113
12 -## The jQuery of HTML5 media
1314
14 -* __mwEmbed__ is built on [jQuery](http://jquery.com/) and [jQueryUI](http://jqueryui.com/) so it's easy to theme, customize and extend.
1515
 16+
 17+## Library Features
 18+
 19+* <a title="HTML5 Video Player with jQueryUI theme support" href="http://www.kaltura.org/apis/html5lib/kplayer-examples/Player_Fallback.html" rel="lightframe[|width:550px; height:650px; scrolling: auto;]">Video Player</a>
 20+* <a title="HTML5 Audio Player with jQueryUI theme support" href="http://www.kaltura.org/apis/html5lib/mwEmbed/tests/Player_Audio.html" rel="lightframe[|width:500px; height:500px; scrolling: auto;]">Audio Player</a>
 21+* __Cross browser & Format compatibility__
 22+ * Will work on all major browsers, and with any online supported video format.
 23+ * Gracefully identifys the best playback engine (Native HTML5, Flash, VLC or Java Cortado) for your settings and video format.
 24+* __Easy to skin__ <a title="HTML5 Video Player with jQueryUI theme support" target="_blank" href="http://www.kaltura.org/apis/html5lib/kplayer-examples/Player_Themable.html">see live demo</a>]
 25+ * Based on HTML, CSS and jQuery, skinning is amazingly easy and flexible. No need external or compiled resources (like Flash), or complicated development environments.
 26+ * Skin and Theme are consistent through all UI and playback engines. Built in support for for the jquery Theme Roller for easy theming.
 27+* __Easy to Extend, Javascript modules__ - Quick, clean and easy way of extending. Write once and the code will be compatible with all browsers and all playback engines.
 28+* __Javascript libraries for web applications__ that allow much more then simple playback. Create a full featured web-video experience i
 29+ * <a title="HTML5 with jQueryUI content ingestion wizard" href="http://www.kaltura.org/apis/html5lib/kplayer-examples/Add_Media_Wizard.html" rel="lightframe[|width:850px; height:500px; scrolling: auto;]">Import and upload wizard</a>
 30+ * <a title="HTML5 with jQueryUI online video editor" href="http://www.kaltura.org/apis/html5lib/mwEmbed/tests/Sequence_Editor.html" rel="lightframe[|width:900px; height:700px; scrolling: auto;]">Video Editor</a>
 31+ * <a title="FireOgg integration - Client Side Transcoding" href="http://www.kaltura.org/apis/html5lib/mwEmbed/example_usage/Firefogg_Make_Advanced.html" rel="lightframe[|width:550px; height:650px; scrolling: auto;]">Client Side Encoding (FireOgg)</a>
 32+* __Easy to integrate__ - Integrate to any existing web CMS, pre-integrated into Media Wiki (powering Wikipedia, MetaVid).
 33+* __Kaltura's HTML5 Media Library__ is built on [jQuery](http://jquery.com/) and [jQueryUI](http://jqueryui.com/) so it's easy to theme, customize and extend.
1634 * supports the royalty free, patent unencumbered open media formats [ogg theora/vorbis](http://xiph.org/).
17 -> This enables websites to distribute video without [future content distribution costs](http://mpegla.com/news/n_03-11-17_avc.html) associated with the h.264 codec. With theora sporting [similar qualities](http://people.xiph.org/%7Egreg/video/ytcompare/comparison.html) at web bitrates its a win win to start adoption ogg!
18 ->
19 ->If your already distributing h.264 formats, __mwEmbed__ supports a smooth transition with fallback to h.264 sources with the same html/css interface player skin as the ogg content.
 35+ * This enables websites to distribute video without [future content distribution costs](http://mpegla.com/news/n_03-11-17_avc.html) associated with the h.264 codec. With theora sporting [similar qualities](http://people.xiph.org/%7Egreg/video/ytcompare/comparison.html) at web bitrates its a win win to start adoption ogg!
 36+ * If your already distributing h.264 formats, __mwEmbed__ supports a smooth transition with fallback to h.264 sources with the same html/css interface player skin as the ogg content.
2037 * supports emerging subtitles and timed text formats for future prof accessibility.
2138 * includes an easy to integrate free license asset search system for grabbing free content from repositories such as the [Internet Archive](http://www.archive.org/index.php), [Wikimedia Commons](http://commons.wikimedia.org/wiki/Main_Page), and [Flickr](http://www.flickr.com/). This lets you integrate quick access to freely reusable illustrative image or short web clip for your web app.
22 -* includes components for flexible client side transcoding of assets via the [Firefogg](http://firefogg.org/) browser extension.
23 -> Firefogg integration lets video sites avoid intermediary transcode formats for user contributed media, distribute transcode costs, and lets the website provide specific transcoding settings directly to the client at the point of upload.
 39+* includes components for flexible client side transcoding of assets via the [Firefogg](http://firefogg.org/) browser extension. Firefogg integration lets video sites avoid intermediary transcode formats for user contributed media, distribute transcode costs, and lets the website provide specific transcoding settings directly to the client at the point of upload.
 40+* Integrated into Kaltura Video Platform based on the Kaltura JS Client library
 41+ * Analytics Support
 42+ * Advertisement Support
2443
25 -## Getting stated with the library
 44+## Basic Usage
2645
27 -Using __mwEmbed__ in your own applications is as simple as adding a script include of the library javascript `http://html5.kaltura.org/js` and then using the normal html5 video tag. ie `<video src="myOgg.ogg">`
 46+## Using Kaltura SaaS for Video Transcoding
2847
 48+To use html5 video flavors from your Kaltura account, you need only to include a `kentryid` attribute in yout `<video>` tag. The library will automatically select the appropriate video flavors for your visitors devices (make sure you have contacted support and requested that [html5 video flavors](#codecs) be added to your account)
2949
30 -### Putting it all together your embed page should look something like this:
 50+ <!DOCTYPE html>
 51+ <html>
 52+ <head>
 53+ <script type="text/javascript" src="http://html5.kaltura.org/js" > </script>
 54+ </head>
 55+ <body>
 56+ <video kentryid="0_swup5zao"
 57+ kwidgetid="_243342"></video>
 58+ </body>
 59+ </html>
3160
 61+## Hosting Your Own Video Transcodes
 62+
 63+Using __Kaltura's HTML5 Media Library__ in your own applications is as simple as adding a script include of the library javascript, `http://html5.kaltura.org/js` and then using the normal html5 video tag, ie `<video src="myOgg.ogg">`.
 64+
 65+Putting it all together your embed page should look something like this:
 66+
3267 <!DOCTYPE html>
3368 <html>
3469 <head>
@@ -35,14 +70,11 @@
3671 </head>
3772 <body>
3873 <video id="video" style="width:544px;height:304px;"
39 - poster="http://upload.wikimedia.org/wikipedia/commons/thumb/b/bd/Elephants_Dream.ogg/seek%3D13-Elephants_Dream.ogg.jpg"
40 - duration="10:53"
41 - linkback="http://www.elephantsdream.org/" >
42 - <source type="video/ogg" src="http://ia311040.us.archive.org/3/items/ElephantsDream/ed_1024.ogv" >
43 - <source type="video/h264" src="http://ia311040.us.archive.org/3/items/ElephantsDream/ed_hd_512kb.mp4" >
44 -
45 - <!-- Subtitles -->
46 -
 74+ poster="http://upload.wikimedia.org/wikipedia/commons/thumb/b/bd/Elephants_Dream.ogg/seek%3D13-Elephants_Dream.ogg.jpg"
 75+ duration="10:53"
 76+ linkback="http://www.elephantsdream.org/" >
 77+ <source type="video/ogg" src="http://ia311040.us.archive.org/3/items/ElephantsDream/ed_1024.ogv" >
 78+ <source type="video/h264" src="http://ia311040.us.archive.org/3/items/ElephantsDream/ed_hd_512kb.mp4" >
4779 <track kind="subtitles" id="video_af" srclang="af"
4880 src="media/elephants_dream/elephant.afrikaans.srt"></track>
4981 <track kind="subtitles" id="video_en" srclang="en"
@@ -52,34 +84,112 @@
5385 </html>
5486
5587 * For best compatibility: we include the poster, durationHint, width and height attributes. This way browsers such as IE can display the player interface with poster image at the correct resolution with a duration in the user interface.
56 -* If you would like to support html5 with h.264 ( safari, IE9, google chrome) and support a flash fallback for older versions of IE you include an h.264 source. For best compatibility your mp4 source should ideally use a h.264 profile compatible with mobile devices such as the iPhone. <a href="http://corp.kaltura.com/">Kaltura hosted Solutions</a> include iPhone support. Desktop video encoding software such as <a href="http://handbrake.fr/">handbreak</a> also includes iPhone profiles.
 88+* If you would like to support html5 with h.264 ( safari, IE9, google chrome) and support a flash fallback for older versions of IE you include an h.264 source. For best compatibility your mp4 source should ideally use a h.264 profile compatible with mobile devices such as the iPhone. <a href="http://corp.kaltura.com/">Kaltura hosted Solutions</a> include iPhone support. Desktop video encoding software such as <a href="http://handbrake.fr/">handbrake</a> also includes iPhone profiles.
5789 * If you would like to change the theme you can change the class attribute `<video class="kskin">` more info about custom theming is on the way.
5890
59 -## Library features and showcase
60 -* __Cross browser & Format compatibility__ \[see live demo: <a title="HTML5 Video Player with jQueryUI theme support" href="http://www.kaltura.org/apis/html5lib/kplayer-examples/Player_Fallback.html" rel="lightframe[|width:550px; height:650px; scrolling: auto;]">Video Player</a>, <a title="HTML5 Audio Player with jQueryUI theme support" href="http://www.kaltura.org/apis/html5lib/mwEmbed/tests/Player_Audio.html" rel="lightframe[|width:500px; height:500px; scrolling: auto;]">Audio Player</a>\] - Will work on all major browsers, and with any online supported video format. Gracefully identifys the best playback engine (Native HTML5, Flash, VLC or Java Cortado) for your settings and video format.
61 -* __Easy to skin__ \[<a title="HTML5 Video Player with jQueryUI theme support" target="_blank" href="http://www.kaltura.org/apis/html5lib/kplayer-examples/Player_Themable.html">see live demo</a>\] - Based on HTML, CSS and jQuery, skinning is amazingly easy and flexible. No need external or compiled resources (like Flash), or complicated development environments. Skin and Theme will be consistent through all UI and playback engines. Built in support for for the jquery Theme Roller for easy theming.
62 -* __Easy to Extend, Javascript modules__ - Quick, clean and easy way of extending. Write once and the code will be compatible with all browsers and all playback engines.
63 -* __Javascript libraries for web applications__ that allow much more then simple playback. Create a full featured web-video experience - <a title="HTML5 with jQueryUI content ingestion wizard" href="http://www.kaltura.org/apis/html5lib/kplayer-examples/Add_Media_Wizard.html" rel="lightframe[|width:850px; height:500px; scrolling: auto;]">Import and upload wizard</a>, <a title="HTML5 with jQueryUI online video editor" href="http://www.kaltura.org/apis/html5lib/mwEmbed/tests/Sequence_Editor.html" rel="lightframe[|width:900px; height:700px; scrolling: auto;]">Video Editor</a> ( not fully functional in stand alone mode yet ), <a title="FireOgg integration - Client Side Transcoding" href="http://www.kaltura.org/apis/html5lib/mwEmbed/example_usage/Firefogg_Make_Advanced.html" rel="lightframe[|width:550px; height:650px; scrolling: auto;]">Client Side Encoding (FireOgg)</a>.
64 -* __Easy to integrate__ - Integrate to any existing web CMS, pre-integrated into Media Wiki (powering Wikipedia, MetaVid).
65 -* Integrated into Kaltura Video Platform based on the Kaltura JS Client library (Coming soon...)
6691
67 -## Background
 92+## Advanced Examples
6893
69 -This project started as a part of the MediaWiki HTML5 media functionality project.
 94+## MediaRSS Playlists
7095
71 -__mwEmbed__ provides the basis for other MediaWiki media functionality. For more info see <a href="http://www.mediawiki.org/wiki/Media_Projects_Overview">the projects overview on MediaWiki</a> and the associated integration (currently called <a href="http://www.mediawiki.org/wiki/JS2_Overview">js2</a>)
 96+## Fall Forward from Flash to html5 for iOS and Android Support
7297
73 -## More...
 98+__Kaltura's HTML5 Video Library__ may be installed in conjunction with existing flash video integrations to provide fall forward from flash to html5 to enable video embedding for iPhone and iPad.
7499
75 -There are many other options (like thumbnail, poster, size, inline transcript display etc.) provided with this library.
 100+Installing html5 support to an existing Kaltura integration is as simple as adding a javascript tag to include `http://html5.kaltura.org/js`. The library will automatically replace your Flash embed with an html5 `<video>` element on browsers capable of parsing the tag.
76101
77 -The general goal of this project is to fully support the html5 video spec and provide a rich interface for creating online rich-media experiences based on html5 video and audio.
 102+ <!DOCTYPE html>
 103+ <html>
 104+ <head>
 105+ <title>Fall forward from Flash to html5</title>
 106+ <script type="text/javascript" src="http://html5.kaltura.org/js"></script>
 107+ </head>
 108+ <body>
 109+ <h2>Fall forward from Flash to html5</h2>
 110+ <object id="kaltura_player" name="kaltura_player"
 111+ type="application/x-shockwave-flash"
 112+ allowFullScreen="true" allowNetworking="all"
 113+ allowScriptAccess="always" height="330" width="400"
 114+ data="http://www.kaltura.com/index.php/kwidget/cache_st/1274763304/wid/_243342/uiconf_id/48501/entry_id/0_swup5zao">
 115+ <param name="allowFullScreen" value="true" />
 116+ <param name="allowNetworking" value="all" />
 117+ <param name="allowScriptAccess" value="always" />
 118+ <param name="bgcolor" value="#000000" />
 119+ <param name="flashVars" value="&" />
 120+ <param name="movie" value="http://www.kaltura.com/index.php/kwidget/cache_st/1274763304/wid/_243342/uiconf_id/48501/entry_id/0_swup5zao" />
 121+ </object>
 122+ </body>
 123+ </html>
78124
79 -This site, [metavid.org](http://metavid.org/), makes heavy use of the library. Remote embedding of metavid content also uses the library.
80 -If your site uses this library, please let us know and share your experience, feature requests and bugs on the bug tracker and forums.
 125+## Themeing with jQuery-UI
81126
82 -## HTML5 `<video>` MIME type>
 127+You can add a custom jquery ui theme by using the theme wizard: [http://www.kaltura.org/apis/html5lib/kplayer-examples/Player_Themable.html](http://www.kaltura.org/apis/html5lib/kplayer-examples/Player_Themable.html). Note that although the themeroller only works in Firefox, the temes you create with it will work in multiple browsers.
83128
 129+
 130+## Skinning and Themeing
 131+
 132+[Theme Wizard]: http://www.kaltura.org/apis/html5lib/kplayer-examples/Player_Themable.html
 133+
 134+You can add a custom jquery ui theme by using the [Theme Wizard][]. Downloading that theme and adding a reference to jquery-ui-.custom.css after the mwEmbed-player-static.css file.
 135+
 136+A few sample jquery ui skins are included in the skins/jquery.ui.themes folder of the [HTML5 Video Player][].
 137+
 138+You can remove the kaltura attribution for the player by adding the following javascript:
 139+
 140+ <script type="text/javascript">mw.setConfig('EmbedPlayer.kalturaAttribution', false );</script>
 141+
 142+You can remove the kaltura attribution for the player by adding the following javascript:
 143+
 144+ <script type="text/javascript">mw.setConfig('EmbedPlayer.kalturaAttribution', false );</script>
 145+
 146+## Analytics
 147+
 148+## Subtitles
 149+
 150+
 151+## Basic Usage of MIT Licensed Static Compiled HTML5 Video Player
 152+
 153+[HTML5 Media Library]: http://www.kaltura.org/project/HTML5_Video_Media_JavaScript_Library
 154+[HTML5 Video Player]: http://www.kaltura.org/project/HTML5_Video_Player
 155+
 156+### Notes on Optimization
 157+
 158+mwEmbed is designed to be used with a script-loader and this static package sacrifices transport size and packages in code every client won't use, in order to be a single static file. You can learn more about using mwEmbed with a script-loader on the project home page.
 159+
 160+To use the load optimized [HTML5 Media Library][] replace your mwEmbed script include line of `<head>` with:
 161+
 162+ <script type="text/javascript" src="http://html5.kaltura.org/js" ></script>
 163+
 164+For full un-minified source see [HTML5 Video Player][]
 165+
 166+### Basic Usage
 167+
 168+In the `<head>` of your page you will need jQuery and the mwEmbed-player package:
 169+
 170+ <!-- If your page already includes jQuery you can skip this step -->
 171+ <script type="text/javascript" src="kaltura-html5player-widget/jquery-1.4.2.min.js" ></scirpt>
 172+
 173+ <!-- Include the css and javascript -->
 174+ <link rel="stylesheet" href="kaltura-html5player-widget/skins/jquery.ui.themes/jquery-ui-1.7.2.custom.css"></link>
 175+ <link rel="stylesheet" href="kaltura-html5player-widget/mwEmbed-player-static.css"></link>
 176+ <script type="text/javascript" src="kaltura-html5player-widget/mwEmbed-player-static.js"></scirpt>
 177+
 178+Now in your HTML you can use the video tag and it will be given a user interface ie:
 179+
 180+ <video poster="myPoster.jpg" style="width:400px;height:300px" durationHint="32.2" >
 181+ <source src="myH.264.mp4" />
 182+ <source src="myOgg.ogg" />
 183+ </video>
 184+<h1 id="troubleshooting">Troubleshooting</h1>
 185+
 186+<h2 id="codecs">Video Codecs</h2>
 187+
 188+You will need to encode your video files into multiple codec formats to provide video for device platforms like iPhone, iPad, Android, and Blackberry. [Dive into HTML5](http://diveintohtml5.org/video.html#firefogg) provides an excellent reference for encoding these multiple video formats with [Firefogg](http://firefogg.org/) , FFmpeg, and Handbrake.
 189+
 190+If you would prefer to not have to deal with encoding your videos into multiple formats, you should obtain a trial account with [Kaltura](http://corp.kaltura.com/) and request a support technician setup your account to provide html5 flavored video codecs.
 191+
 192+<h2 id="mime">HTML5 video MIME type</h2>
 193+
84194 Note that if the MIME types for Theora video are not set on the server, the video may not show or show a gray box containing an X (if JavaScript is enabled).
85195
86196 You can fix this problem for the Apache Web Server by adding the extension used by Theora video files (".ogm", ".ogv", or ".ogg" are the common types) to the MIME type "video/ogg" via the "mime.types" file:
@@ -89,52 +199,85 @@
90200 * Add the following: `video/ogg ogg ogm ogv`
91201 * Restart apache
92202
93 -Or by adding the "AddType" configuration directive in httpd.conf -
 203+Or by adding the "AddType" configuration directive in httpd.conf -
94204
95205 AddType video/ogg .ogm
96206 AddType video/ogg .ogv
97207 AddType video/ogg .ogg
 208+ AddType video/mp4 .mp4
 209+ AddType video/webm .webm
98210
99211 Your web host may provide an easy interface to MIME type configuration changes for new technologies until a global update naturally occurs.
 212+<h1 id="background">Background</h1>
100213
101 -## Get Project Source Code
 214+This project started as a part of the MediaWiki HTML5 media functionality project. *mwEmbed* is another name by which *Kaltura's HTML5 Media Library* is known at Wikimedia, where it provides Wikipedia's upcoming video editing functionality.
102215
 216+*mwEmbed* provides the basis for other MediaWiki media functionality. For more info see <a href="http://www.mediawiki.org/wiki/Media_Projects_Overview">the projects overview on MediaWiki</a> and the associated integration (currently called <a href="http://www.mediawiki.org/wiki/JS2_Overview">js2</a>)
 217+
 218+<h1 id="dev">Become a Developer</h1>
 219+
 220+If you find this software useful, stop by #kaltura in FreeNode.
 221+
 222+<h2 id="source">Get Project Source Code</h2>
 223+
103224 <p class="note">MwEmbed is released under the GPL2 and hosted by the wikimedia foundation.<br />
104225 You may check out a read-only working copy anonymously over HTTP:<br />
105226 <span style="padding: 3px 0px 0px 30px; color:#555555;font-weight: bold;">svn checkout <a href="http://www.kaltura.org/kalorg/html5video/trunk/mwEmbed/" title="Kaltura Project Code - HTML5 and JS Media Library" target="_blank">http://www.kaltura.org/kalorg/html5video/trunk/mwEmbed/</a></span>
106227 <span style="padding: 0px 0px 5px 0px; color:#885555;">If you'd like commit access, please submit a request to <a href="../join-project?lightframe" rel="lightframe[|width:570px; height:650px; scrolling: auto;]">join this project.</a>.</span>
107228 </p>
108229
109 -For an overview of all mwEmbed files see:
110 -http://www.mediawiki.org/wiki/MwEmbed
 230+<h2 id="compile_docs">Compile Developer Docs</h2>
111231
112 -For stand alone usage see:
113 -http://kaltura.org/project/HTML5_Media_JavaScript_Library
 232+ java -jar jsrun.jar app/run.js /home/papyromancer/src/mwEmbed/loader.js /home/papyromancer/src/mwEmbed/mwEmbed.js /home/papyromancer/src/mwEmbed/mwEmbedLoader.js /home/papyromancer/src/mwEmbed/modules/**/*/*.js -t=templates/jsdoc
114233
115 -All mwEmbed code is Released under the GPL2 as
116 -a stand alone component of mediaWiki
117234
 235+ cat overview.markdown features.markdown basic_usage.markdown advanced_examples.markdown mit.markdown troubleshooting.markdown showcase.markdown license.markdown > README
 236+ cat overview.markdown features.markdown basic_usage.markdown mit.markdown troubleshooting.markdown showcase.markdown > README.mit
 237+ bluecloth README > docs/README.html
 238+
 239+<h2 id="additionally">Additional Resources</h2>
 240+
 241+For an overview of all mwEmbed files see: [http://www.mediawiki.org/wiki/MwEmbed](http://www.mediawiki.org/wiki/MwEmbed)
 242+
 243+For stand alone usage see [http://kaltura.org/project/HTML5_Media_JavaScript_Library](http://kaltura.org/project/HTML5_Media_JavaScript_Library)
 244+
 245+
 246+## Library Showcase
 247+
 248+* <a title="HTML5 Video Player with jQueryUI theme support" href="http://www.kaltura.org/apis/html5lib/kplayer-examples/Player_Themeable.html" rel="lightframe[|width:550px; height:650px; scrolling: auto;]">Video Player Theme Wizard</a>
 249+* <a title="HTML5 Video Player with jQueryUI theme support" href="http://www.kaltura.org/apis/html5lib/kplayer-examples/Add_Media_Wizard.html" rel="lightframe[|width:550px; height:650px; scrolling: auto;]">Add Media Wizard</a>
 250+* <a title="HTML5 Video Player with jQueryUI theme support" href="http://www.kaltura.org/apis/html5lib/kplayer-examples/Player_ApiDemo.html" rel="lightframe[|width:550px; height:650px; scrolling: auto;]">Player API Demo</a>
 251+* <a title="HTML5 Video Player with jQueryUI theme support" href="http://www.kaltura.org/apis/html5lib/kplayer-examples/Player_Audio.html" rel="lightframe[|width:550px; height:650px; scrolling: auto;]">Audio Player</a>
 252+* <a title="HTML5 Video Player with jQueryUI theme support" href="http://www.kaltura.org/apis/html5lib/kplayer-examples/Player_DynamicEmbed.html" rel="lightframe[|width:550px; height:650px; scrolling: auto;]">Dynamic Embed</a>
 253+* <a title="HTML5 Video Player with jQueryUI theme support" href="http://www.kaltura.org/apis/html5lib/kplayer-examples/Player_Fallback.html" rel="lightframe[|width:550px; height:650px; scrolling: auto;]">Flash Fallback Player</a>
 254+* <a title="HTML5 Video Player with jQueryUI theme support" href="http://www.kaltura.org/apis/html5lib/kplayer-examples/Player_FallForward.html" rel="lightframe[|width:550px; height:650px; scrolling: auto;]">Fall Forward from Flash to HTML5</a>
 255+* <a title="HTML5 Video Player with jQueryUI theme support" href="http://www.kaltura.org/apis/html5lib/kplayer-examples/Player_IpadHTMLControls.html" rel="lightframe[|width:550px; height:650px; scrolling: auto;]">iPad Video Player</a>
 256+* <a title="HTML5 Video Player with jQueryUI theme support" href="http://www.kaltura.org/apis/html5lib/kplayer-examples/Player_Fallback.html" rel="lightframe[|width:550px; height:650px; scrolling: auto;]">iPad Video Player With Native Controls</a>
 257+* <a title="HTML5 Video Player with jQueryUI theme support" href="http://www.kaltura.org/apis/html5lib/kplayer-examples/Player_IpadTouchMashup.html" rel="lightframe[|width:550px; height:650px; scrolling: auto;]">Using iPad Touch Interface</a>
 258+* <a title="HTML5 Video Player with jQueryUI theme support" href="http://www.kaltura.org/apis/html5lib/kplayer-examples/Player_kEntryId.html" rel="lightframe[|width:550px; height:650px; scrolling: auto;]">Video Player from Kaltura EntryID</a>
 259+* <a title="HTML5 Video Player with jQueryUI theme support" href="http://www.kaltura.org/apis/html5lib/kplayer-examples/Player_MultipleFallForwardEmbeds.html" rel="lightframe[|width:550px; height:650px; scrolling: auto;]">Multiple Fall Forward Embeds</a>
 260+* <a title="HTML5 Video Player with jQueryUI theme support" href="http://www.kaltura.org/apis/html5lib/kplayer-examples/Player_NativeControls.html" rel="lightframe[|width:550px; height:650px; scrolling: auto;]">Native HTML5 Video Controls</a>
 261+* <a title="HTML5 Video Player with jQueryUI theme support" href="http://www.kaltura.org/apis/html5lib/kplayer-examples/Player_SwfObjectEmbed.html" rel="lightframe[|width:550px; height:650px; scrolling: auto;]">Video Player Embed of SWF Animation</a>
 262+* Unemplimented
 263+ * <a title="HTML5 Video Player with jQueryUI theme support" href="http://www.kaltura.org/apis/html5lib/kplayer-examples/Player_PlaylistFallForward.html" rel="lightframe[|width:550px; height:650px; scrolling: auto;]">Playlist Fall Forward</a>
 264+ * <a title="HTML5 Video Player with jQueryUI theme support" href="http://www.kaltura.org/apis/html5lib/kplayer-examples/Player_Fallback.html" rel="lightframe[|width:550px; height:650px; scrolling: auto;]">Video Player from Swarm Hosted Media</a>
 265+
 266+<h1 id="license">License and Copyright Information</h1>
 267+
 268+All mwEmbed code is Released under the GPL2 as a stand alone component of mediaWiki
 269+
118270 Libraries used include their license info in their included path
119271
120272 Copyright (C) 2007 - 2010 Kaltura, Wikimedia Foundation
121273
122 -Sub modules and libraries carry specific copyright while the
123 -the entire package is always releasable under the GPL 2
 274+Sub modules and libraries carry specific copyright while the the entire package is always releasable under the GPL 2
124275
125 -Author Michael Dale <mdale@wikimedia.org>,
126 -and many others.
 276+Author Michael Dale <mdale@wikimedia.org>, and many others.
127277
128 -This program is free software; you can redistribute it and/or modify
129 -it under the terms of the GNU General Public License as published by
130 -the Free Software Foundation; either version 2 of the License, or
131 -(at your option) any later version.
 278+This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
132279
133 -This program is distributed in the hope that it will be useful,
134 -but WITHOUT ANY WARRANTY; without even the implied warranty of
135 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
136 -GNU General Public License for more details.
 280+This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
137281
138 -You should have received a copy of the GNU General Public License along
139 -with this program; if not, write to the Free Software Foundation, Inc.,
140 -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
141 -http://www.gnu.org/copyleft/gpl.html
 282+You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 283+
 284+[http://www.gnu.org/copyleft/gpl.html](http://www.gnu.org/copyleft/gpl.html)

Status & tagging log