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 @@ |
2 | 2 | /** |
| 3 | +* |
3 | 4 | * Core "loader.js" for mwEmbed |
4 | 5 | * |
5 | 6 | * This loader along with all the enabled module loaders is combined with mwEmbed.js |
— | — | @@ -19,7 +20,8 @@ |
20 | 21 | */ |
21 | 22 | var mwCoreComponentList = [ |
22 | 23 | 'mw.Parser', |
23 | | - 'mw.Language' |
| 24 | + 'mw.Language', |
| 25 | + 'mw.Api' |
24 | 26 | ]; |
25 | 27 | |
26 | 28 | |
— | — | @@ -57,26 +59,7 @@ |
58 | 60 | 'enabledModules' : mwEnabledModuleList, |
59 | 61 | |
60 | 62 | // 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', |
81 | 64 | |
82 | 65 | // The mediaWiki path of mwEmbed |
83 | 66 | 'mediaWikiEmbedPath' : 'js/mwEmbed/', |
— | — | @@ -125,11 +108,12 @@ |
126 | 109 | "mwEmbed" : "mwEmbed.js", |
127 | 110 | "window.jQuery" : "libraries/jquery/jquery-1.4.2.js", |
128 | 111 | |
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", |
131 | 117 | |
132 | | - "JSON" : "libraries/json/json2.js", |
133 | | - |
134 | 118 | "$j.replaceText.js" : "libraries/jquery/plugins/jquery.replaceText.js", |
135 | 119 | |
136 | 120 | "$j.fn.menu" : "libraries/jquery/plugins/jquery.menu/jquery.menu.js", |
— | — | @@ -143,16 +127,21 @@ |
144 | 128 | "$j.fn.datePicker" : "libraries/jquery/plugins/jquery.datePicker.js", |
145 | 129 | "$j.ui" : "libraries/jquery/jquery.ui/ui/ui.core.js", |
146 | 130 | |
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", |
150 | 138 | |
151 | 139 | "$j.cookie" : "libraries/jquery/plugins/jquery.cookie.js", |
152 | 140 | |
153 | 141 | "$j.contextMenu" : "libraries/jquery/plugins/jquery.contextMenu.js", |
154 | 142 | "$j.fn.suggestions" : "libraries/jquery/plugins/jquery.suggestions.js", |
155 | 143 | "$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", |
157 | 146 | |
158 | 147 | "$j.effects.blind" : "libraries/jquery/jquery.ui/ui/effects.blind.js", |
159 | 148 | "$j.effects.drop" : "libraries/jquery/jquery.ui/ui/effects.drop.js", |
— | — | @@ -172,7 +161,7 @@ |
173 | 162 | "$j.ui.dialog" : "libraries/jquery/jquery.ui/ui/ui.dialog.js", |
174 | 163 | "$j.ui.resizable" : "libraries/jquery/jquery.ui/ui/ui.resizable.js", |
175 | 164 | "$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", |
177 | 166 | "$j.effects.highlight" : "libraries/jquery/jquery.ui/ui/effects.highlight.js", |
178 | 167 | "$j.effects.slide" : "libraries/jquery/jquery.ui/ui/effects.slide.js", |
179 | 168 | "$j.ui.accordion" : "libraries/jquery/jquery.ui/ui/ui.accordion.js", |
— | — | @@ -181,8 +170,8 @@ |
182 | 171 | |
183 | 172 | } ); |
184 | 173 | |
185 | | -// Add a special css dependency for $j.ui |
| 174 | +// Add a special css dependency for $j.ui |
186 | 175 | mw.addStyleResourceDependency( { |
187 | | - '$j.ui' : ( 'mw.style.' + mw.getConfig( 'jQueryUISkin' ) ) |
| 176 | + '$j.ui' : ( 'mw.style.ui_' + mw.getConfig( 'jQueryUISkin' ) ) |
188 | 177 | } ); |
189 | 178 | |
Index: trunk/extensions/JS2Support/mwEmbed/ResourceLoader.php |
— | — | @@ -27,6 +27,7 @@ |
28 | 28 | $myResourceLoader->doResourceLoader(); |
29 | 29 | } |
30 | 30 | |
| 31 | + |
31 | 32 | class ResourceLoader { |
32 | 33 | |
33 | 34 | // The list of named javascript & css files |
— | — | @@ -101,7 +102,7 @@ |
102 | 103 | try { |
103 | 104 | NamedResourceLoader::loadResourcePaths(); |
104 | 105 | } catch( Exception $e ) { |
105 | | - $this->errorMsg .= $e->getMessage() ; |
| 106 | + $this->errorMsg .= "loadResourcePaths:" . $e->getMessage() ; |
106 | 107 | } |
107 | 108 | |
108 | 109 | // Reset the requestKey: |
— | — | @@ -182,7 +183,7 @@ |
183 | 184 | if ( $wgUseFileCache && !$this->debug ) { |
184 | 185 | $status = $this->sFileCache->saveToFileCache( $this->output ); |
185 | 186 | if ( $status !== true ) { |
186 | | - $this->errorMsg .= $status; |
| 187 | + $this->errorMsg .= "Could not save file to cache::" . $status; |
187 | 188 | } |
188 | 189 | } |
189 | 190 | |
— | — | @@ -190,7 +191,7 @@ |
191 | 192 | if ( $this->errorMsg != '' ) { |
192 | 193 | //just set the content type (don't send cache header) |
193 | 194 | 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 ::' . |
195 | 196 | str_replace( "\n", '\'+"\n"+' . "\n'", |
196 | 197 | xml::escapeJsString( $this->errorMsg ) |
197 | 198 | ) . '\');'."\n"; |
— | — | @@ -378,7 +379,7 @@ |
379 | 380 | if( $fileContents ){ |
380 | 381 | // Add the file name if debug is enabled |
381 | 382 | if ( $this->debug ){ |
382 | | - $output .= "\n/**\n* File: " . xml::escapeJsString( $filePath ) . "\n*/\n"; |
| 383 | + $output .= "\n\n/**\n* File: " . xml::escapeJsString( $filePath ) . "\n*/\n"; |
383 | 384 | } |
384 | 385 | // Transform the css output if the file is css |
385 | 386 | $output.= ( $ext == 'css' ) ? |
— | — | @@ -728,7 +729,7 @@ |
729 | 730 | try { |
730 | 731 | NamedResourceLoader::loadResourcePaths(); |
731 | 732 | } catch( Exception $e ) { |
732 | | - $this->errorMsg .= $e->getMessage() ; |
| 733 | + $this->errorMsg .= "getPathFromClass: " . $e->getMessage() ; |
733 | 734 | } |
734 | 735 | |
735 | 736 | if ( isset( $wgResourceLoaderNamedPaths[ $reqClass ] ) ) { |
— | — | @@ -811,7 +812,7 @@ |
812 | 813 | global $wgEnableScriptLocalization; |
813 | 814 | // Strip out mw.log debug lines (if not in debug mode) |
814 | 815 | if( !$this->debug ){ |
815 | | - $scriptText = preg_replace( '/\n\s*mw\.log\(([^\)]*\))*\s*[\;\n]/U', "\n", $scriptText ); |
| 816 | + $scriptText = $this->removeLogStatements( $scriptText ); |
816 | 817 | } |
817 | 818 | |
818 | 819 | // Do language swap by index: |
— | — | @@ -854,6 +855,71 @@ |
855 | 856 | // Return the javascript str unmodified if we did not transform with the localisation |
856 | 857 | return $scriptText; |
857 | 858 | } |
| 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 | + } |
858 | 924 | /* simple function to return addMessageJs without preg_replace back reference substitution */ |
859 | 925 | private static function preg_addMessageJs(){ |
860 | 926 | 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 |
1 | 183 | + native |
Added: svn:executable |
2 | 184 | + * |
Index: trunk/extensions/JS2Support/mwEmbed/mwEmbed.js |
— | — | @@ -16,18 +16,18 @@ |
17 | 17 | */ |
18 | 18 | |
19 | 19 | /** |
20 | | -* Setup the "mw" global: |
21 | | -*/ |
| 20 | + * Setup the "mw" global: |
| 21 | + */ |
22 | 22 | if ( typeof window.mw == 'undefined' ) { |
23 | 23 | window.mw = { }; |
24 | 24 | } |
25 | 25 | |
26 | 26 | /** |
27 | | -* Set the mwEmbedVersion |
28 | | -*/ |
| 27 | + * Set the mwEmbedVersion |
| 28 | + */ |
29 | 29 | var MW_EMBED_VERSION = '1.1g'; |
30 | 30 | |
31 | | -// Globals to pre-set ready functions in dynamic loading of mwEmbed |
| 31 | +// Globals to pre-set ready functions in dynamic loading of mwEmbed |
32 | 32 | if( typeof preMwEmbedReady == 'undefined'){ |
33 | 33 | var preMwEmbedReady = []; |
34 | 34 | } |
— | — | @@ -37,8 +37,8 @@ |
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
41 | | -* The global mw object: |
42 | | -*/ |
| 41 | + * The global mw object: |
| 42 | + */ |
43 | 43 | ( function( mw ) { |
44 | 44 | // The version of mwEmbed |
45 | 45 | mw.version = MW_EMBED_VERSION |
— | — | @@ -46,31 +46,32 @@ |
47 | 47 | // List valid skins here: |
48 | 48 | mw.validSkins = [ 'mvpcf', 'kskin' ]; |
49 | 49 | |
50 | | - // Storage variable for loaded style sheet keys |
| 50 | + // Storage variable for loaded style sheet keys |
51 | 51 | mw.style = { }; |
52 | 52 | |
53 | 53 | /** |
54 | | - * Configuration System: |
55 | | - */ |
| 54 | + * Configuration System: |
| 55 | + */ |
56 | 56 | |
57 | 57 | // Local scope configuration var: |
58 | 58 | if( !mwConfig ){ |
59 | 59 | var mwConfig = { }; |
60 | 60 | } |
61 | 61 | |
62 | | - // Local scope mwUserConfig var. Stores user configuration |
| 62 | + // Local scope mwUserConfig var. Stores user configuration |
63 | 63 | var mwUserConfig = { }; |
64 | 64 | |
65 | 65 | /** |
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 | + */ |
75 | 76 | mw.setConfig = function ( name, value ) { |
76 | 77 | if( typeof name == 'object' ) { |
77 | 78 | for( var i in name ) { |
— | — | @@ -89,12 +90,14 @@ |
90 | 91 | } |
91 | 92 | |
92 | 93 | /** |
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 | + */ |
99 | 102 | mw.setDefaultConfig = function( name, value ) { |
100 | 103 | if( typeof name == 'object' ) { |
101 | 104 | for( var i in name ) { |
— | — | @@ -102,19 +105,21 @@ |
103 | 106 | } |
104 | 107 | return ; |
105 | 108 | } |
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 ) |
107 | 111 | if( typeof mwConfig[ name ] == 'undefined') { |
108 | 112 | mwConfig[ name ] = value; |
109 | 113 | } |
110 | 114 | } |
111 | 115 | |
112 | 116 | /** |
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 | + */ |
119 | 124 | mw.getConfig = function ( name ) { |
120 | 125 | if( mwConfig[ name ] ) |
121 | 126 | return mwConfig[ name ]; |
— | — | @@ -122,19 +127,20 @@ |
123 | 128 | } |
124 | 129 | |
125 | 130 | /** |
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 | + */ |
139 | 145 | var setupUserConfigFlag = false; |
140 | 146 | mw.setupUserConfig = function( callback ) { |
141 | 147 | if( setupUserConfigFlag ) { |
— | — | @@ -143,7 +149,7 @@ |
144 | 150 | } |
145 | 151 | return ; |
146 | 152 | } |
147 | | - // Do Setup user config: |
| 153 | + // Do Setup user config: |
148 | 154 | mw.load( [ '$j.cookie', 'JSON' ], function() { |
149 | 155 | if( $j.cookie( 'mwUserConfig' ) ) { |
150 | 156 | mwUserConfig = JSON.parse( $j.cookie( 'mwUserConfig' ) ); |
— | — | @@ -156,12 +162,14 @@ |
157 | 163 | } |
158 | 164 | |
159 | 165 | /** |
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 | + */ |
166 | 174 | mw.setUserConfig = function ( name, value, cookieOptions ) { |
167 | 175 | if( ! setupUserConfigFlag ) { |
168 | 176 | mw.log( "Error: userConfig not setup" ); |
— | — | @@ -170,18 +178,18 @@ |
171 | 179 | // Update local value |
172 | 180 | mwUserConfig[ name ] = value; |
173 | 181 | |
174 | | - // Update the cookie ( '$j.cookie' & 'JSON' should already be loaded ) |
| 182 | + // Update the cookie ( '$j.cookie' & 'JSON' should already be loaded ) |
175 | 183 | $j.cookie( 'mwUserConfig', JSON.stringify( mwUserConfig ) ); |
176 | 184 | } |
177 | 185 | |
178 | 186 | /** |
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 | + */ |
186 | 194 | mw.getUserConfig = function ( name ) { |
187 | 195 | if( mwUserConfig[ name ] ) |
188 | 196 | return mwUserConfig[ name ]; |
— | — | @@ -189,25 +197,28 @@ |
190 | 198 | } |
191 | 199 | |
192 | 200 | /** |
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 | + */ |
199 | 208 | mw.addHookSystem = function( targetObj ) { |
200 | 209 | |
201 | 210 | // Setup the target object hook holder: |
202 | 211 | targetObj[ 'hooks' ] = { }; |
203 | 212 | |
204 | 213 | /** |
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 | + */ |
212 | 223 | targetObj.addHook = function( hookName, hookFunction ) { |
213 | 224 | if( ! this.hooks[ hookName ] ) { |
214 | 225 | this.hooks[ hookName ] = [ ]; |
— | — | @@ -216,15 +227,15 @@ |
217 | 228 | } |
218 | 229 | |
219 | 230 | /** |
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 | + */ |
229 | 240 | targetObj.runHook = function( hookName, options ) { |
230 | 241 | if( this.hooks[ hookName ] ) { |
231 | 242 | for( var i =0; i < this.hooks[ hookName ].length; i ++ ) { |
— | — | @@ -244,104 +255,113 @@ |
245 | 256 | |
246 | 257 | |
247 | 258 | /** |
248 | | - * Top level loader prototype: |
249 | | - */ |
| 259 | + * Top level loader prototype: |
| 260 | + */ |
250 | 261 | mw.loader = { |
251 | 262 | /** |
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 | + */ |
256 | 268 | moduleLoaders : [], |
257 | 269 | |
258 | 270 | /** |
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 | + */ |
265 | 277 | moduleLoadQueue: { }, |
266 | 278 | |
267 | 279 | /** |
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 | + */ |
272 | 285 | resourcePaths : { }, |
273 | 286 | |
274 | 287 | /** |
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 | + */ |
279 | 293 | resourceStyleDependency: { }, |
280 | 294 | |
281 | 295 | /** |
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 |
315 | 333 | var callback = function(){ |
316 | | - //mw.log( 'instanceCallback::running callback: ' + instanceCallback ); |
| 334 | + // mw.log( 'instanceCallback::running callback: ' + |
| 335 | + // instanceCallback ); |
317 | 336 | 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 ) |
320 | 340 | instanceCallback( loadRequest ); |
321 | 341 | instanceCallback = null; |
322 | 342 | } |
323 | | - } |
324 | | - |
325 | | - // Check for empty loadRequest ( directly return the callback ) |
| 343 | + } |
| 344 | + |
| 345 | + // Check for empty loadRequest ( directly return the callback ) |
326 | 346 | if( mw.isEmpty( loadRequest ) ) { |
327 | | - mw.log( 'Empty load request: ' + loadRequest ); |
| 347 | + mw.log( 'Empty load request: ( ' + loadRequest + ' ) ' ); |
328 | 348 | callback( loadRequest ); |
329 | 349 | return ; |
330 | 350 | } |
331 | 351 | |
332 | 352 | |
333 | | - // Check if its a multi-part request: |
| 353 | + // Check if its a multi-part request: |
334 | 354 | if( typeof loadRequest == 'object' ) { |
335 | 355 | if( loadRequest.length > 1 ) { |
336 | 356 | this.loadMany ( loadRequest, callback ); |
337 | 357 | return ; |
338 | 358 | }else{ |
339 | | - // If an array of length 1 set as first element |
| 359 | + // If an array of length 1 set as first element |
340 | 360 | loadRequest = loadRequest[0]; |
341 | 361 | } |
342 | 362 | } |
343 | 363 | |
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 ] ) { |
346 | 366 | var resourceSet = this.getModuleResourceSet( loadRequest ); |
347 | 367 | if( !resourceSet ){ |
348 | 368 | mw.log( "mw.load:: Error with module loader: " + loadRequest + ' ( no resource set defined )' ); |
— | — | @@ -349,9 +369,10 @@ |
350 | 370 | } |
351 | 371 | |
352 | 372 | // 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: |
354 | 374 | 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 |
356 | 377 | this.load( resourceSet, callback ); |
357 | 378 | } else { |
358 | 379 | this.addToModuleLoaderQueue( |
— | — | @@ -363,9 +384,8 @@ |
364 | 385 | return ; |
365 | 386 | } |
366 | 387 | |
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 ) ) { |
370 | 390 | this.loadResource( loadRequest, callback ); |
371 | 391 | return ; |
372 | 392 | } |
— | — | @@ -379,7 +399,7 @@ |
380 | 400 | return ; |
381 | 401 | } |
382 | 402 | |
383 | | - // Possible error? |
| 403 | + // Possible error? |
384 | 404 | mw.log( "Error could not handle load request: " + loadRequest ); |
385 | 405 | }, |
386 | 406 | |
— | — | @@ -389,38 +409,60 @@ |
390 | 410 | // Add the result of the module loader function |
391 | 411 | return this.moduleLoaders[ moduleName ](); |
392 | 412 | } else if( typeof ( this.moduleLoaders[ moduleName ] ) == 'object' ){ |
393 | | - // set resourceSet directly |
| 413 | + // set resourceSet directly |
394 | 414 | return this.moduleLoaders[ moduleName ]; |
395 | 415 | } |
396 | 416 | return false; |
397 | 417 | }, |
398 | | - |
| 418 | + |
399 | 419 | /** |
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 | + */ |
406 | 446 | loadMany: function( loadSet, callback ) { |
407 | 447 | var _this = this; |
408 | | - // Setup up the local "loadStates" |
| 448 | + // Setup up the local "loadStates" |
409 | 449 | var loadStates = { }; |
410 | 450 | |
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 ) |
412 | 453 | if( mw.getResourceLoaderPath() ) { |
413 | | - // Get the grouped loadStates variable |
| 454 | + // Get the grouped loadStates variable |
414 | 455 | loadStates = this.getGroupLoadState( loadSet ); |
415 | 456 | if( mw.isEmpty( loadStates ) ) { |
416 | | - //mw.log( 'loadMany:all resources already loaded'); |
| 457 | + // mw.log( 'loadMany:all resources already loaded'); |
417 | 458 | callback(); |
418 | 459 | return ; |
419 | 460 | } |
420 | 461 | }else{ |
421 | | - // Check if its a dependency set ( nested objects ) |
| 462 | + // Check if its a dependency set ( nested objects ) |
422 | 463 | if( typeof loadSet [ 0 ] == 'object' ) { |
423 | 464 | _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 ) |
425 | 467 | _this.loadDependencyChain( loadSet, callback ); |
426 | 468 | return ; |
427 | 469 | } |
— | — | @@ -433,27 +475,27 @@ |
434 | 476 | } |
435 | 477 | |
436 | 478 | // 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" |
440 | 483 | for( var loadName in loadStates ) { |
441 | | - //mw.log("loadMany: load: " + loadName ); |
| 484 | + // mw.log("loadMany: load: " + loadName ); |
442 | 485 | this.load( loadName, function ( loadName ) { |
443 | 486 | loadStates[ loadName ] = 1; |
444 | 487 | |
445 | 488 | /* |
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 | + */ |
450 | 492 | |
451 | | - //Check if all load request states are set 1 |
| 493 | + // Check if all load request states are set 1 |
452 | 494 | var loadDone = true; |
453 | 495 | for( var j in loadStates ) { |
454 | 496 | if( loadStates[ j ] === 0 ) |
455 | 497 | loadDone = false; |
456 | 498 | } |
457 | | - // Run the parent scope callback for "loadMany" |
| 499 | + // Run the parent scope callback for "loadMany" |
458 | 500 | if( loadDone ) { |
459 | 501 | callback( loadName ); |
460 | 502 | } |
— | — | @@ -462,16 +504,16 @@ |
463 | 505 | }, |
464 | 506 | |
465 | 507 | /** |
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 | + */ |
476 | 518 | getGroupLoadState: function( loadSet ) { |
477 | 519 | var groupedLoadSet = []; |
478 | 520 | var loadStates = { }; |
— | — | @@ -479,12 +521,12 @@ |
480 | 522 | if( typeof loadSet[0] == 'object' ) { |
481 | 523 | for( var i = 0; i < loadSet.length ; i++ ) { |
482 | 524 | 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: |
484 | 526 | groupedLoadSet.push( loadSet[i][j] ); |
485 | 527 | } |
486 | 528 | } |
487 | 529 | } else { |
488 | | - // Use the loadSet directly: |
| 530 | + // Use the loadSet directly: |
489 | 531 | groupedLoadSet = loadSet; |
490 | 532 | } |
491 | 533 | |
— | — | @@ -496,7 +538,7 @@ |
497 | 539 | |
498 | 540 | |
499 | 541 | if( this.getResourcePath( loadName ) ) { |
500 | | - // Only add to group request if not already set: |
| 542 | + // Only add to group request if not already set: |
501 | 543 | if ( !mw.isset( loadName ) ) { |
502 | 544 | groupClassKey += coma + loadName |
503 | 545 | coma = ','; |
— | — | @@ -508,7 +550,8 @@ |
509 | 551 | } |
510 | 552 | } else if ( this.moduleLoaders[ loadName ] ) { |
511 | 553 | |
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 ) |
513 | 556 | if( groupClassKey != '' ) { |
514 | 557 | loadStates[ groupClassKey ] = 0; |
515 | 558 | groupClassKey = coma = ''; |
— | — | @@ -518,7 +561,7 @@ |
519 | 562 | } |
520 | 563 | } |
521 | 564 | |
522 | | - // Add groupClassKey if set: |
| 565 | + // Add groupClassKey if set: |
523 | 566 | if( groupClassKey != '' ) { |
524 | 567 | loadStates [ groupClassKey ] = 0; |
525 | 568 | } |
— | — | @@ -526,16 +569,17 @@ |
527 | 570 | return loadStates; |
528 | 571 | }, |
529 | 572 | |
530 | | - // Array to register that a callback has been called |
| 573 | + // Array to register that a callback has been called |
531 | 574 | dependencyChainCallFlag: { }, |
532 | 575 | |
533 | 576 | /** |
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 | + */ |
540 | 584 | loadDependencyChain: function( loadChain, callback ) { |
541 | 585 | var _this = this; |
542 | 586 | // Load with dependency checks |
— | — | @@ -544,8 +588,8 @@ |
545 | 589 | if ( loadChain.length != 0 ) { |
546 | 590 | _this.loadDependencyChain( loadChain, callback ); |
547 | 591 | } 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 |
550 | 594 | if( _this.dependencyChainCallFlag[ callSet ] == callback ) { |
551 | 595 | mw.log("... already called this callback for " + callSet ); |
552 | 596 | return ; |
— | — | @@ -557,12 +601,12 @@ |
558 | 602 | }, |
559 | 603 | |
560 | 604 | /** |
561 | | - * Add to the module loader queue |
562 | | - */ |
| 605 | + * Add to the module loader queue |
| 606 | + */ |
563 | 607 | addToModuleLoaderQueue: function( moduleName, resourceSet, callback ) { |
564 | 608 | mw.log(" addToModuleLoaderQueue:: " + moduleName + ' resourceSet: ' + resourceSet ); |
565 | 609 | 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: |
567 | 611 | this.moduleLoadQueue[ moduleName ].functionQueue.push( callback ); |
568 | 612 | } else { |
569 | 613 | // create the moduleLoadQueue item |
— | — | @@ -575,13 +619,14 @@ |
576 | 620 | }, |
577 | 621 | |
578 | 622 | /** |
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 | + */ |
581 | 626 | runModuleLoadQueue: function(){ |
582 | 627 | 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 |
586 | 631 | for( var moduleName in _this.moduleLoadQueue ){ |
587 | 632 | while( _this.moduleLoadQueue[moduleName].functionQueue.length ) { |
588 | 633 | _this.moduleLoadQueue[moduleName].functionQueue.shift()(); |
— | — | @@ -589,10 +634,11 @@ |
590 | 635 | } |
591 | 636 | } |
592 | 637 | |
593 | | - // Check for single request or javascript debug based loading: |
| 638 | + // Check for single request or javascript debug based loading: |
594 | 639 | 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 ) |
597 | 643 | var fullResourceList = []; |
598 | 644 | for( var moduleName in this.moduleLoadQueue ) { |
599 | 645 | var resourceSet = this.moduleLoadQueue[ moduleName ].resourceSet; |
— | — | @@ -604,19 +650,23 @@ |
605 | 651 | }); |
606 | 652 | return ; |
607 | 653 | } |
| 654 | + |
608 | 655 | // Else do per module group loading |
609 | 656 | if( mw.getConfig( 'loader.groupStrategy' ) == 'module' ) { |
610 | 657 | var fullResourceList = []; |
611 | 658 | var sharedResourceList = []; |
612 | 659 | |
613 | 660 | 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 ) |
616 | 665 | 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++ ){ |
619 | 668 | 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. |
621 | 671 | if( fullResourceList[ moduleResource ] ){ |
622 | 672 | if( $j.inArray( moduleResource, sharedResourceList ) == -1 ){ |
623 | 673 | sharedResourceList.push( moduleResource ); |
— | — | @@ -627,14 +677,15 @@ |
628 | 678 | } |
629 | 679 | } |
630 | 680 | |
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 = {}; |
633 | 684 | |
634 | 685 | // Only add non-shared to respective modules load requests |
635 | 686 | for( var moduleName in this.moduleLoadQueue ) { |
636 | 687 | moduleRequestSet[ moduleName ] = []; |
637 | 688 | var moduleResourceList = this.getFlatModuleResourceList( moduleName ); |
638 | | - for( var i in moduleResourceList ){ |
| 689 | + for( var i =0; i < moduleResourceList.length; i++ ){ |
639 | 690 | var moduleResource = moduleResourceList[i]; |
640 | 691 | if( $j.inArray( moduleResource, sharedResourceList ) == -1 ){ |
641 | 692 | moduleRequestSet[ moduleName ].push( moduleResource ); |
— | — | @@ -654,7 +705,8 @@ |
655 | 706 | } |
656 | 707 | runModuleFunctionQueue(); |
657 | 708 | } |
658 | | - // Local instance of load requests to retain resourceSet context: |
| 709 | + // Local instance of load requests to retain resourceSet |
| 710 | + // context: |
659 | 711 | var localLoadCallInstance = function( moduleName, resourceSet ){ |
660 | 712 | mw.load( resourceSet, function(){ |
661 | 713 | _this.moduleLoadQueue[ moduleName ].loaded = true; |
— | — | @@ -662,25 +714,26 @@ |
663 | 715 | }); |
664 | 716 | } |
665 | 717 | |
666 | | - // Load the shared resources |
| 718 | + // Load the shared resources |
667 | 719 | 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" |
670 | 723 | sharedResourceLoadDone = true; |
671 | 724 | checkModulesDone(); |
672 | | - }); |
673 | | - // Load all module Request Set |
| 725 | + }); |
| 726 | + // Load all module Request Set |
674 | 727 | for( var moduleName in moduleRequestSet ){ |
675 | 728 | localLoadCallInstance( moduleName, moduleRequestSet[ moduleName ] ); |
676 | 729 | } |
677 | 730 | } |
678 | | - // xxx Here we could also do some "intelligent" grouping |
| 731 | + // xxx Here we could also do some "intelligent" grouping |
679 | 732 | }, |
680 | 733 | |
681 | 734 | getFlatModuleResourceList: function( moduleName ){ |
682 | 735 | var moduleList = []; |
683 | 736 | 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: |
685 | 738 | if( typeof this.moduleLoadQueue[moduleName].resourceSet[j] == 'object' ){ |
686 | 739 | moduleList = $j.merge( moduleList, this.moduleLoadQueue[moduleName].resourceSet[j] ); |
687 | 740 | } else { |
— | — | @@ -690,40 +743,45 @@ |
691 | 744 | return moduleList; |
692 | 745 | }, |
693 | 746 | /** |
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 |
702 | 759 | if( this.resourceStyleDependency[ resourceName ] ) { |
703 | 760 | 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. |
707 | 764 | _this.loadResource( resourceName, callback ); |
708 | 765 | }); |
709 | 766 | return ; |
710 | 767 | } |
711 | | - } |
712 | | - |
| 768 | + } |
| 769 | + |
713 | 770 | // Make sure the resource is not already defined: |
714 | 771 | if ( mw.isset( resourceName ) ) { |
715 | | - //mw.log( 'Class ( ' + resourceName + ' ) already defined ' ); |
| 772 | + // mw.log( 'Class ( ' + resourceName + ' ) already defined ' ); |
716 | 773 | callback( resourceName ); |
717 | 774 | return ; |
718 | 775 | } |
719 | 776 | |
720 | | - // Setup the Script Request var: |
| 777 | + // Setup the Script Request var: |
721 | 778 | var scriptRequest = null; |
722 | 779 | |
723 | 780 | |
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: |
725 | 783 | if( mw.getResourceLoaderPath() ) { |
726 | 784 | scriptRequest = resourceName; |
727 | | - }else{ |
| 785 | + }else{ |
728 | 786 | // Get the resource url: |
729 | 787 | var baseClassPath = this.getResourcePath( resourceName ); |
730 | 788 | // Add the mwEmbed path if not a root path or a full url |
— | — | @@ -736,17 +794,16 @@ |
737 | 795 | if( ! scriptRequest ) { |
738 | 796 | mw.log( "Error Could not get url for resource " + resourceName ); |
739 | 797 | return false; |
740 | | - } |
| 798 | + } |
741 | 799 | } |
742 | 800 | // Include resource defined check for older browsers |
743 | 801 | var resourceDone = false; |
744 | 802 | |
745 | | - // Set the loadDone callback per the provided resourceName |
| 803 | + // Set the loadDone callback per the provided resourceName |
746 | 804 | 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 ) { |
751 | 808 | // If its a "style sheet" manually set its resource to true |
752 | 809 | var ext = scriptRequest.substr( scriptRequest.split('?')[0].lastIndexOf( '.' ), 4 ).toLowerCase(); |
753 | 810 | if( ext == '.css' && resourceName.substr(0,8) == 'mw.style' ){ |
— | — | @@ -760,53 +817,58 @@ |
761 | 818 | + _this.getResourcePath( resourceName ) ); |
762 | 819 | } |
763 | 820 | |
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 |
766 | 824 | if( mw.currentClassMissingMessages ) { |
767 | 825 | mw.log( " resourceName " + resourceName + " is missing messages" ); |
768 | 826 | // Reset the currentClassMissingMessages flag |
769 | 827 | mw.currentClassMissingMessages = false; |
770 | 828 | |
771 | | - // Load msgs for this resource: |
| 829 | + // Load msgs for this resource: |
772 | 830 | mw.loadResourceMessages( resourceName, function() { |
773 | | - // Run the onDone callback |
| 831 | + // Run the onDone callback |
774 | 832 | mw.loadDone( resourceName ); |
775 | 833 | } ); |
776 | 834 | } 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 |
778 | 837 | if( !mw.getResourceLoaderPath() ) { |
779 | 838 | mw.waitForObject( resourceName, function( resourceName ) { |
780 | | - // Once object is ready run loadDone |
| 839 | + // Once object is ready run loadDone |
781 | 840 | mw.loadDone( resourceName ); |
782 | 841 | } ); |
783 | 842 | } 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 ); |
786 | 846 | } |
787 | 847 | } |
788 | 848 | } ); |
789 | 849 | }, |
790 | 850 | |
791 | 851 | /** |
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 | + */ |
798 | 859 | addModuleLoader: function( name, moduleLoader ) { |
799 | 860 | this.moduleLoaders [ name ] = moduleLoader; |
800 | 861 | }, |
801 | 862 | |
802 | 863 | /** |
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 | + */ |
811 | 873 | addResourcePaths: function( resourceSet ) { |
812 | 874 | var prefix = ( mw.getConfig( 'loaderContext' ) )? |
813 | 875 | mw.getConfig( 'loaderContext' ): ''; |
— | — | @@ -817,11 +879,11 @@ |
818 | 880 | }, |
819 | 881 | |
820 | 882 | /* |
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 | + */ |
826 | 888 | addStyleResourceDependency: function( resourceSet ){ |
827 | 889 | for( var i in resourceSet ){ |
828 | 890 | this.resourceStyleDependency[ i ] = resourceSet[i]; |
— | — | @@ -829,9 +891,9 @@ |
830 | 892 | }, |
831 | 893 | |
832 | 894 | /** |
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 | + */ |
836 | 898 | getResourcePath: function( resourceName ) { |
837 | 899 | if( this.resourcePaths[ resourceName ] ) |
838 | 900 | return this.resourcePaths[ resourceName ] |
— | — | @@ -840,15 +902,17 @@ |
841 | 903 | } |
842 | 904 | |
843 | 905 | /** |
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 | + */ |
847 | 911 | mw.loadDone = function( requestName ) { |
848 | 912 | if( !mwLoadDoneCB[ requestName ] ) { |
849 | 913 | return true; |
850 | 914 | } |
851 | 915 | while( mwLoadDoneCB[ requestName ].length ) { |
852 | | - // check if mwLoadDoneCB is already "done" |
| 916 | + // check if mwLoadDoneCB is already "done" |
853 | 917 | // the function list is not an object |
854 | 918 | if( typeof mwLoadDoneCB[ requestName ] != 'object' ) |
855 | 919 | { |
— | — | @@ -856,7 +920,8 @@ |
857 | 921 | } |
858 | 922 | var func = mwLoadDoneCB[ requestName ].pop(); |
859 | 923 | if( typeof func == 'function' ) { |
860 | | - //mw.log( "LoadDone: " + requestName + ' run callback::' + func); |
| 924 | + // mw.log( "LoadDone: " + requestName + ' run callback::' + |
| 925 | + // func); |
861 | 926 | func( requestName ); |
862 | 927 | }else{ |
863 | 928 | mw.log('mwLoadDoneCB: Error non callback function on stack'); |
— | — | @@ -867,10 +932,13 @@ |
868 | 933 | }; |
869 | 934 | |
870 | 935 | /** |
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 | + */ |
875 | 943 | mw.setLoadDoneCB = function( requestName, callback ) { |
876 | 944 | // If the requestName is already done loading just callback |
877 | 945 | if( mwLoadDoneCB[ requestName ] == 'done' ) { |
— | — | @@ -884,31 +952,29 @@ |
885 | 953 | }; |
886 | 954 | |
887 | 955 | /** |
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 | + */ |
895 | 961 | |
896 | 962 | /** |
897 | | - * Load Object entry point: Loads a requested set of javascript |
898 | | - */ |
| 963 | + * Load Object entry point: Loads a requested set of javascript |
| 964 | + */ |
899 | 965 | mw.load = function( loadRequest, callback ) { |
900 | 966 | return mw.loader.load( loadRequest, callback ); |
901 | 967 | } |
902 | 968 | |
903 | 969 | /** |
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 | + */ |
906 | 972 | mw.addModuleLoader = function ( name, loaderFunction ) { |
907 | 973 | return mw.loader.addModuleLoader( name, loaderFunction ); |
908 | 974 | } |
909 | 975 | |
910 | 976 | /** |
911 | | - * Add Class File Paths entry point: |
912 | | - */ |
| 977 | + * Add Class File Paths entry point: |
| 978 | + */ |
913 | 979 | mw.addResourcePaths = function ( resourceSet ) { |
914 | 980 | return mw.loader.addResourcePaths( resourceSet ); |
915 | 981 | } |
— | — | @@ -918,368 +984,31 @@ |
919 | 985 | } |
920 | 986 | |
921 | 987 | /** |
922 | | - * Get Class File Path entry point: |
923 | | - */ |
| 988 | + * Get Class File Path entry point: |
| 989 | + */ |
924 | 990 | mw.getResourcePath = function( resourceName ) { |
925 | 991 | return mw.loader.getResourcePath( resourceName ); |
926 | 992 | } |
927 | 993 | |
928 | 994 | |
929 | 995 | /** |
930 | | - * API Helper functions |
931 | | - */ |
| 996 | + * Utility Functions |
| 997 | + */ |
932 | 998 | |
933 | 999 | /** |
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 |
1183 | 1004 | */ |
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 | | - */ |
1278 | 1005 | mw.addLoaderDialog = function( dialogHtml ) { |
1279 | | - $dialog = mw.addDialog( dialogHtml, dialogHtml + '<br>' + |
| 1006 | + $dialog = mw.addDialog( { |
| 1007 | + 'title' : dialogHtml, |
| 1008 | + 'content' : dialogHtml + '<br>' + |
1280 | 1009 | $j('<div />') |
1281 | 1010 | .loadingSpinner() |
1282 | 1011 | .html() |
1283 | | - ); |
| 1012 | + }); |
1284 | 1013 | return $dialog; |
1285 | 1014 | } |
1286 | 1015 | |
— | — | @@ -1302,52 +1031,75 @@ |
1303 | 1032 | } |
1304 | 1033 | |
1305 | 1034 | /** |
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(); |
1314 | 1047 | |
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: |
1316 | 1066 | $j( 'body' ).append( |
1317 | 1067 | $j('<div />') |
1318 | 1068 | .attr( { |
1319 | 1069 | 'id' : "mwTempLoaderDialog", |
1320 | | - 'title' : title |
| 1070 | + 'title' : options.title |
1321 | 1071 | }) |
1322 | | - .css('display', 'none') |
1323 | | - .html( dialogHtml ) |
| 1072 | + .css({ |
| 1073 | + 'display': 'none' |
| 1074 | + }) |
| 1075 | + .append( options.content ) |
1324 | 1076 | ); |
| 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 | + } |
1325 | 1086 | |
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; |
1329 | 1090 | buttons = { }; |
1330 | | - buttons[ buttonMsg ] = function() { |
1331 | | - $j( '#mwTempLoaderDialog' ).dialog( 'close' ); |
| 1091 | + options.buttons[ buttonMsg ] = function() { |
| 1092 | + $j( this ).dialog( 'close' ); |
1332 | 1093 | } |
1333 | | - } |
| 1094 | + } |
1334 | 1095 | |
1335 | 1096 | // Load the dialog resources |
1336 | 1097 | mw.load([ |
1337 | 1098 | [ |
1338 | 1099 | '$j.ui' |
1339 | 1100 | ], |
1340 | | - [ |
1341 | | - '$j.ui.dialog' |
1342 | | - ] |
| 1101 | + uiRequest |
1343 | 1102 | ], 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 ); |
1352 | 1104 | } ); |
1353 | 1105 | return $j( '#mwTempLoaderDialog' ); |
1354 | 1106 | } |
— | — | @@ -1365,14 +1117,14 @@ |
1366 | 1118 | |
1367 | 1119 | |
1368 | 1120 | /** |
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 | + */ |
1377 | 1129 | mw.isset = function( objectPath ) { |
1378 | 1130 | if ( !objectPath ) { |
1379 | 1131 | return false; |
— | — | @@ -1391,18 +1143,21 @@ |
1392 | 1144 | } |
1393 | 1145 | |
1394 | 1146 | /** |
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 |
1403 | 1158 | mw.waitForObject = function( objectName, callback, _callNumber) { |
1404 | | - //mw.log( 'waitForObject: ' + objectName + ' cn: ' + _callNumber); |
| 1159 | + // mw.log( 'waitForObject: ' + objectName + ' cn: ' + _callNumber); |
1405 | 1160 | |
1406 | | - // Increment callNumber: |
| 1161 | + // Increment callNumber: |
1407 | 1162 | if( !_callNumber ) { |
1408 | 1163 | _callNumber = 1; |
1409 | 1164 | } else { |
— | — | @@ -1426,14 +1181,15 @@ |
1427 | 1182 | } |
1428 | 1183 | |
1429 | 1184 | /** |
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 | + */ |
1434 | 1190 | mw.isEmpty = function( object ) { |
1435 | 1191 | if( typeof object == 'string' ) { |
1436 | 1192 | if( object == '' ) return true; |
1437 | | - // Non empty string: |
| 1193 | + // Non empty string: |
1438 | 1194 | return false; |
1439 | 1195 | } |
1440 | 1196 | |
— | — | @@ -1443,7 +1199,7 @@ |
1444 | 1200 | return true; |
1445 | 1201 | } |
1446 | 1202 | |
1447 | | - // Else check as an object: |
| 1203 | + // Else check as an object: |
1448 | 1204 | for( var i in object ) { return false; } |
1449 | 1205 | |
1450 | 1206 | // Else object is empty: |
— | — | @@ -1451,16 +1207,16 @@ |
1452 | 1208 | } |
1453 | 1209 | |
1454 | 1210 | /** |
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 | + */ |
1462 | 1219 | mw.log = function( string ) { |
1463 | | - |
1464 | | - // Add any prepend debug strings if necessary |
| 1220 | + // Add any prepend debug strings if necessary |
1465 | 1221 | if ( mw.getConfig( 'pre-append-log' ) ){ |
1466 | 1222 | string = mw.getConfig( 'pre-append-log' ) + string; |
1467 | 1223 | } |
— | — | @@ -1469,43 +1225,40 @@ |
1470 | 1226 | window.console.log( string ); |
1471 | 1227 | } else { |
1472 | 1228 | /** |
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>'; |
1484 | 1237 | } |
| 1238 | + var log_elm = document.getElementById('mv_js_log'); |
1485 | 1239 | if(log_elm) { |
1486 | | - log_elm.value+=string+"\n"; |
1487 | | - } |
1488 | | - */ |
1489 | | - |
| 1240 | + log_elm.value+=string+"\n"; |
| 1241 | + }*/ |
1490 | 1242 | } |
1491 | 1243 | } |
1492 | 1244 | |
1493 | | - //Setup the local mwOnLoadFunctions array: |
| 1245 | + // Setup the local mwOnLoadFunctions array: |
1494 | 1246 | var mwOnLoadFunctions = []; |
1495 | 1247 | |
1496 | | - //mw Ready flag ( set once mwEmbed is ready ) |
| 1248 | + // mw Ready flag ( set once mwEmbed is ready ) |
1497 | 1249 | var mwReadyFlag = false; |
1498 | 1250 | |
1499 | 1251 | /** |
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 | + */ |
1510 | 1263 | mw.ready = function( callback ) { |
1511 | 1264 | if( mwReadyFlag === false ) { |
1512 | 1265 | // Add the callbcak to the onLoad function stack |
— | — | @@ -1517,51 +1270,54 @@ |
1518 | 1271 | } |
1519 | 1272 | |
1520 | 1273 | /** |
1521 | | - * Runs all the queued functions |
1522 | | - * called by mwEmbedSetup |
1523 | | - */ |
| 1274 | + * Runs all the queued functions called by mwEmbedSetup |
| 1275 | + */ |
1524 | 1276 | 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 |
1527 | 1279 | while( preMwEmbedReady.length ){ |
1528 | 1280 | preMwEmbedReady.shift()(); |
1529 | | - } |
1530 | | - |
1531 | | - // Run all the queued functions: |
| 1281 | + } |
| 1282 | + // Run all the queued functions: |
1532 | 1283 | while( mwOnLoadFunctions.length ) { |
1533 | 1284 | mwOnLoadFunctions.shift()(); |
1534 | | - } |
1535 | | - |
1536 | | - // Once we have run all the queued functions |
1537 | | - mw.loader.runModuleLoadQueue(); |
| 1285 | + } |
1538 | 1286 | |
1539 | 1287 | // Sets mwReadyFlag to true so that future mw.ready run the |
1540 | 1288 | // callback directly |
1541 | 1289 | mwReadyFlag = true; |
1542 | 1290 | |
| 1291 | + // Once we have run all the queued functions |
| 1292 | + mw.loader.runModuleLoadQueue(); |
| 1293 | + |
1543 | 1294 | } |
1544 | 1295 | |
1545 | 1296 | |
1546 | 1297 | /** |
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 | + */ |
1554 | 1307 | 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 |
1556 | 1310 | var myCallback = function(){ |
1557 | 1311 | if( callback ) { |
1558 | 1312 | callback( scriptRequest ); |
1559 | 1313 | } |
1560 | 1314 | } |
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: |
1563 | 1318 | var scriptLoaderPath = mw.getResourceLoaderPath(); |
1564 | 1319 | |
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 :// |
1566 | 1322 | var isResourceName = ( scriptRequest.indexOf('://') == -1 && scriptRequest.indexOf('/') !== 0 )? true : false; |
1567 | 1323 | |
1568 | 1324 | var ext = scriptRequest.substr( scriptRequest.lastIndexOf( '.' ), 4 ).toLowerCase(); |
— | — | @@ -1584,8 +1340,8 @@ |
1585 | 1341 | mw.log( 'mw.getScript: ' + url ); |
1586 | 1342 | } |
1587 | 1343 | |
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 ) |
1590 | 1346 | if( mw.isset( 'window.jQuery' ) |
1591 | 1347 | && mw.getConfig( 'debug' ) === false |
1592 | 1348 | && typeof $j != 'undefined' |
— | — | @@ -1596,14 +1352,9 @@ |
1597 | 1353 | } |
1598 | 1354 | |
1599 | 1355 | /** |
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 | + */ |
1608 | 1359 | |
1609 | 1360 | // load style sheet directly if requested loading css |
1610 | 1361 | if( isCssFile ){ |
— | — | @@ -1611,28 +1362,31 @@ |
1612 | 1363 | return ; |
1613 | 1364 | } |
1614 | 1365 | |
1615 | | - // Load and bind manually: ( copied from jQuery ajax function ) |
| 1366 | + // Load and bind manually: ( copied from jQuery ajax function ) |
1616 | 1367 | var head = document.getElementsByTagName("head")[ 0 ]; |
1617 | 1368 | var script = document.createElement("script"); |
1618 | 1369 | script.setAttribute( 'src', url ); |
1619 | 1370 | |
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 ) |
1621 | 1373 | script.onload = script.onreadystatechange = function() { |
1622 | 1374 | if (!this.readyState || this.readyState == "loaded" || this.readyState == "complete") { |
1623 | 1375 | myCallback(); |
1624 | 1376 | } |
1625 | 1377 | }; |
1626 | | - //mw.log(" append script: " + script.src ); |
| 1378 | + // mw.log(" append script: " + script.src ); |
1627 | 1379 | // Append the script to the DOM: |
1628 | 1380 | head.appendChild( script ); |
1629 | 1381 | }; |
1630 | 1382 | |
1631 | 1383 | /** |
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 | + */ |
1637 | 1391 | mw.addStyleString = function( cssResourceName, cssString ) { |
1638 | 1392 | if( mw.style[ cssResourceName ] ) { |
1639 | 1393 | mw.log(" Style: ( " + cssResourceName + ' ) already set' ); |
— | — | @@ -1640,11 +1394,12 @@ |
1641 | 1395 | } |
1642 | 1396 | // Set the style to true ( to not request it again ) |
1643 | 1397 | 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 ) |
1645 | 1400 | mw.log( 'Adding style:' + cssResourceName + " to dom " ); |
1646 | 1401 | var styleNode = document.createElement('style'); |
1647 | 1402 | styleNode.type = "text/css"; |
1648 | | - // Use cssText or createTextNode depending on browser: |
| 1403 | + // Use cssText or createTextNode depending on browser: |
1649 | 1404 | if( ( window.attachEvent && !window.opera ) ) { |
1650 | 1405 | styleNode.styleSheet.cssText = cssString; |
1651 | 1406 | } else { |
— | — | @@ -1656,12 +1411,12 @@ |
1657 | 1412 | }; |
1658 | 1413 | |
1659 | 1414 | /** |
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 | + */ |
1666 | 1421 | mw.getStyleSheet = function( url , callback) { |
1667 | 1422 | // Add URL params ( if not already included ) |
1668 | 1423 | if ( url.indexOf( '?' ) == -1 ) { |
— | — | @@ -1674,9 +1429,9 @@ |
1675 | 1430 | var currentSheet = $j( this) .attr( 'href' ); |
1676 | 1431 | var sheetParts = currentSheet.split('?'); |
1677 | 1432 | var urlParts = url.split('?'); |
1678 | | - //if the base url's match check the parameters: |
| 1433 | + // if the base url's match check the parameters: |
1679 | 1434 | 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 ) |
1681 | 1436 | if( sheetParts[1].split( '&' ).sort().join('') == |
1682 | 1437 | urlParts[1].split('&').sort().join('') ) { |
1683 | 1438 | foundSheet = true; |
— | — | @@ -1699,45 +1454,21 @@ |
1700 | 1455 | 'href' : url |
1701 | 1456 | } ) |
1702 | 1457 | ); |
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. |
1705 | 1461 | if( callback ) { |
1706 | 1462 | callback(); |
1707 | 1463 | } |
1708 | 1464 | }; |
1709 | 1465 | |
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 | | - }; |
1722 | 1466 | |
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 | | - |
1736 | 1467 | // Local mwEmbedPath variable ( for cache of mw.getMwEmbedPath ) |
1737 | 1468 | var mwEmbedPath = null; |
1738 | 1469 | |
1739 | 1470 | /** |
1740 | | - * Get the path to the mwEmbed folder |
1741 | | - */ |
| 1471 | + * Get the path to the mwEmbed folder |
| 1472 | + */ |
1742 | 1473 | mw.getMwEmbedPath = function() { |
1743 | 1474 | if ( mwEmbedPath ) { |
1744 | 1475 | return mwEmbedPath; |
— | — | @@ -1752,9 +1483,10 @@ |
1753 | 1484 | mwpath = src.substr( 0, src.indexOf( 'mwEmbed.js' ) ); |
1754 | 1485 | } |
1755 | 1486 | |
1756 | | - // Check for scriptLoader include of mwEmbed: |
| 1487 | + // Check for scriptLoader include of mwEmbed: |
1757 | 1488 | 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: |
1759 | 1491 | mwpath = src.substr( 0, src.indexOf( 'mwResourceLoader.php' ) ) + mw.getConfig( 'mediaWikiEmbedPath' ); |
1760 | 1492 | } |
1761 | 1493 | |
— | — | @@ -1774,18 +1506,17 @@ |
1775 | 1507 | return ; |
1776 | 1508 | } |
1777 | 1509 | |
1778 | | - // Update the cached var with the absolute path: |
| 1510 | + // Update the cached var with the absolute path: |
1779 | 1511 | mwEmbedPath = mw.absoluteUrl( mwpath ) ; |
1780 | 1512 | return mwEmbedPath; |
1781 | 1513 | } |
1782 | 1514 | |
1783 | 1515 | /** |
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 | + */ |
1790 | 1521 | mw.getResourceLoaderPath = function( ) { |
1791 | 1522 | var src = mw.getMwEmbedSrc(); |
1792 | 1523 | if ( src.indexOf( 'mwResourceLoader.php' ) !== -1 || |
— | — | @@ -1798,12 +1529,14 @@ |
1799 | 1530 | } |
1800 | 1531 | |
1801 | 1532 | /** |
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 |
1808 | 1541 | */ |
1809 | 1542 | mw.seconds2npt = function( sec, show_ms ) { |
1810 | 1543 | if ( isNaN( sec ) ) { |
— | — | @@ -1813,23 +1546,32 @@ |
1814 | 1547 | |
1815 | 1548 | var tm = mw.seconds2Measurements( sec ) |
1816 | 1549 | |
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 |
1818 | 1552 | if ( show_ms ) { |
1819 | 1553 | tm.seconds = Math.round( tm.seconds * 1000 ) / 1000; |
1820 | 1554 | } else { |
1821 | 1555 | tm.seconds = Math.round( tm.seconds ); |
1822 | 1556 | } |
1823 | | - if ( tm.seconds < 10 ) |
| 1557 | + if ( tm.seconds < 10 ){ |
1824 | 1558 | 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; |
1829 | 1569 | } |
1830 | 1570 | |
1831 | 1571 | /** |
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 |
1834 | 1576 | */ |
1835 | 1577 | mw.seconds2Measurements = function ( sec ){ |
1836 | 1578 | var tm = {}; |
— | — | @@ -1841,17 +1583,18 @@ |
1842 | 1584 | } |
1843 | 1585 | |
1844 | 1586 | /** |
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 | + */ |
1850 | 1593 | mw.npt2seconds = function ( npt_str ) { |
1851 | 1594 | if ( !npt_str ) { |
1852 | 1595 | // mw.log('npt2seconds:not valid ntp:'+ntp); |
1853 | 1596 | return false; |
1854 | 1597 | } |
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 |
1856 | 1599 | npt_str = npt_str.replace( /npt:|s/g, '' ); |
1857 | 1600 | |
1858 | 1601 | var hour = 0; |
— | — | @@ -1879,8 +1622,8 @@ |
1880 | 1623 | var mwEmbedSrc = null; |
1881 | 1624 | |
1882 | 1625 | /** |
1883 | | - * Gets the mwEmbed script src attribute |
1884 | | - */ |
| 1626 | + * Gets the mwEmbed script src attribute |
| 1627 | + */ |
1885 | 1628 | mw.getMwEmbedSrc = function() { |
1886 | 1629 | if ( mwEmbedSrc ) { |
1887 | 1630 | return mwEmbedSrc; |
— | — | @@ -1892,9 +1635,9 @@ |
1893 | 1636 | // Check for mwEmbed.js and/or script loader |
1894 | 1637 | var src = js_elements[i].getAttribute( "src" ); |
1895 | 1638 | if ( src ) { |
1896 | | - if ( // Check for mwEmbed.js ( debug mode ) |
| 1639 | + if ( // Check for mwEmbed.js ( debug mode ) |
1897 | 1640 | ( src.indexOf( 'mwEmbed.js' ) !== -1 && src.indexOf( 'MediaWiki:Gadget') == -1 ) |
1898 | | - || // Check for resource loader |
| 1641 | + || // Check for resource loader |
1899 | 1642 | ( |
1900 | 1643 | ( src.indexOf( 'mwResourceLoader.php' ) !== -1 || src.indexOf( 'ResourceLoader.php' ) !== -1 ) |
1901 | 1644 | && |
— | — | @@ -1916,11 +1659,12 @@ |
1917 | 1660 | var mwUrlParam = null; |
1918 | 1661 | |
1919 | 1662 | /** |
1920 | | - * Get URL Parameters per parameters in the host script include |
1921 | | - */ |
| 1663 | + * Get URL Parameters per parameters in the host script include |
| 1664 | + */ |
1922 | 1665 | mw.getUrlParam = function() { |
1923 | | - if ( mwUrlParam ) |
| 1666 | + if ( mwUrlParam ) { |
1924 | 1667 | return mwUrlParam; |
| 1668 | + } |
1925 | 1669 | |
1926 | 1670 | var mwEmbedSrc = mw.getMwEmbedSrc(); |
1927 | 1671 | var req_param = ''; |
— | — | @@ -1928,14 +1672,15 @@ |
1929 | 1673 | // If we already have a URI, add it to the param request: |
1930 | 1674 | var urid = mw.parseUri( mwEmbedSrc ).queryKey['urid'] |
1931 | 1675 | |
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 |
1933 | 1678 | if ( mw.parseUri( mwEmbedSrc ).queryKey['debug'] == 'true' ) { |
1934 | 1679 | mw.setConfig( 'debug', true ); |
1935 | 1680 | var d = new Date(); |
1936 | 1681 | req_param += 'urid=' + d.getTime() + '&debug=true'; |
1937 | 1682 | |
1938 | 1683 | } else if ( urid ) { |
1939 | | - // Just pass on the existing urid: |
| 1684 | + // Just pass on the existing urid: |
1940 | 1685 | req_param += 'urid=' + urid; |
1941 | 1686 | } else { |
1942 | 1687 | // Otherwise, Use the mwEmbed version |
— | — | @@ -1947,19 +1692,20 @@ |
1948 | 1693 | if ( langKey ) |
1949 | 1694 | req_param += '&uselang=' + langKey; |
1950 | 1695 | |
1951 | | - // Update the local cache and return the value |
| 1696 | + // Update the local cache and return the value |
1952 | 1697 | mwUrlParam = req_param; |
1953 | 1698 | return mwUrlParam; |
1954 | 1699 | } |
1955 | 1700 | |
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 | + */ |
1964 | 1710 | mw.replaceUrlParams = function( url, newParams ) { |
1965 | 1711 | var parsedUrl = mw.parseUri( url ); |
1966 | 1712 | |
— | — | @@ -1969,7 +1715,7 @@ |
1970 | 1716 | var new_url = parsedUrl.path + '?'; |
1971 | 1717 | } |
1972 | 1718 | |
1973 | | - // Merge new params: |
| 1719 | + // Merge new params: |
1974 | 1720 | for( var key in newParams ) { |
1975 | 1721 | parsedUrl.queryKey[ key ] = newParams[ key ]; |
1976 | 1722 | } |
— | — | @@ -1985,10 +1731,8 @@ |
1986 | 1732 | } |
1987 | 1733 | |
1988 | 1734 | /** |
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 | + */ |
1993 | 1737 | mw.parseUri = function (str) { |
1994 | 1738 | var o = mw.parseUri.options, |
1995 | 1739 | m = o.parser[o.strictMode ? "strict" : "loose"].exec(str), |
— | — | @@ -2006,11 +1750,11 @@ |
2007 | 1751 | }; |
2008 | 1752 | |
2009 | 1753 | /** |
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 | + */ |
2015 | 1759 | mw.parseUri.options = { |
2016 | 1760 | strictMode: false, |
2017 | 1761 | key: ["source", "protocol", "authority", "userInfo", "user", "password", "host", |
— | — | @@ -2026,11 +1770,13 @@ |
2027 | 1771 | }; |
2028 | 1772 | |
2029 | 1773 | /** |
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 | + */ |
2035 | 1781 | mw.absoluteUrl = function( src, contextUrl ) { |
2036 | 1782 | var parsedSrc = mw.parseUri( src ); |
2037 | 1783 | // Source is already absolute return: |
— | — | @@ -2038,14 +1784,14 @@ |
2039 | 1785 | return src; |
2040 | 1786 | } |
2041 | 1787 | |
2042 | | - // Get parent Url location the context URL |
| 1788 | + // Get parent Url location the context URL |
2043 | 1789 | if( contextUrl) { |
2044 | 1790 | var parsedUrl = mw.parseUri( contextUrl ); |
2045 | 1791 | } else { |
2046 | 1792 | var parsedUrl = mw.parseUri( document.URL ); |
2047 | 1793 | } |
2048 | 1794 | |
2049 | | - // Check for leading slash: |
| 1795 | + // Check for leading slash: |
2050 | 1796 | if( src.indexOf( '/' ) === 0 ) { |
2051 | 1797 | return parsedUrl.protocol + '://' + parsedUrl.authority + src; |
2052 | 1798 | }else{ |
— | — | @@ -2055,9 +1801,10 @@ |
2056 | 1802 | |
2057 | 1803 | /** |
2058 | 1804 | * 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 |
2062 | 1809 | */ |
2063 | 1810 | mw.escapeQuotes = function( text ) { |
2064 | 1811 | var re = new RegExp("'","g"); |
— | — | @@ -2069,53 +1816,54 @@ |
2070 | 1817 | |
2071 | 1818 | /** |
2072 | 1819 | * 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 |
2076 | 1824 | */ |
2077 | 1825 | mw.escapeQuotesHTML = function( text ) { |
2078 | | - var re = new RegExp('&',"g"); |
2079 | | - text = text.replace(re,"&"); |
2080 | | - re = new RegExp('"',"g"); |
2081 | | - text = text.replace(re,"""); |
2082 | | - re = new RegExp('<',"g"); |
2083 | | - text = text.replace(re,"<"); |
2084 | | - re = new RegExp('>',"g"); |
2085 | | - text = text.replace(re,">"); |
2086 | | - return text; |
| 1826 | + var replaceMap = { |
| 1827 | + "&" : "&", |
| 1828 | + '"' : """, |
| 1829 | + '<' : "<", |
| 1830 | + '>' : ">" |
| 1831 | + } |
| 1832 | + for( var i in replaceMap ){ |
| 1833 | + text = text.split(i).join( replaceMap[i]); |
| 1834 | + } |
| 1835 | + return text; |
2087 | 1836 | }; |
2088 | | - |
2089 | 1837 | |
2090 | 1838 | // Array of setup functions |
2091 | 1839 | var mwSetupFunctions = []; |
2092 | 1840 | |
2093 | 1841 | /** |
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 | + */ |
2102 | 1850 | mw.addSetupHook = function( callback ) { |
2103 | 1851 | mwSetupFunctions.push ( callback ) ; |
2104 | 1852 | }; |
2105 | 1853 | |
2106 | 1854 | /** |
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 | + */ |
2110 | 1858 | // Flag to ensure setup is only run once: |
2111 | 1859 | var mwSetupFlag = false; |
2112 | 1860 | mw.setupMwEmbed = function ( ) { |
2113 | | - // Only run the setup once: |
| 1861 | + // Only run the setup once: |
2114 | 1862 | if( mwSetupFlag ) { |
2115 | 1863 | return ; |
2116 | 1864 | } |
2117 | 1865 | mwSetupFlag = true; |
2118 | 1866 | |
2119 | | - // Apply any pre-setup config: |
| 1867 | + // Apply any pre-setup config: |
2120 | 1868 | mw.setConfig( preMwEmbedConfig ); |
2121 | 1869 | |
2122 | 1870 | |
— | — | @@ -2123,16 +1871,16 @@ |
2124 | 1872 | |
2125 | 1873 | // Check core mwEmbed loader.js file ( to get configuration and paths ) |
2126 | 1874 | mw.checkCoreLoaderFile( function(){ |
2127 | | - // Make sure we have jQuery |
| 1875 | + // Make sure we have jQuery |
2128 | 1876 | mw.load( 'window.jQuery', function() { |
2129 | 1877 | |
2130 | | - // Add jQuery to $j var. |
| 1878 | + // Add jQuery to $j var. |
2131 | 1879 | if ( ! window[ '$j' ] ) { |
2132 | 1880 | window[ '$j' ] = jQuery.noConflict(); |
2133 | 1881 | } |
2134 | 1882 | |
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 ) |
2137 | 1885 | mw.checkModuleLoaderFiles( function() { |
2138 | 1886 | |
2139 | 1887 | // Set the User language |
— | — | @@ -2146,7 +1894,7 @@ |
2147 | 1895 | } |
2148 | 1896 | } |
2149 | 1897 | |
2150 | | - // Update the image path |
| 1898 | + // Update the image path |
2151 | 1899 | mw.setConfig( 'imagesPath', mw.getMwEmbedPath() + 'skins/common/images/' ); |
2152 | 1900 | |
2153 | 1901 | // Set up AJAX to not send dynamic URLs for loading scripts |
— | — | @@ -2154,29 +1902,29 @@ |
2155 | 1903 | cache: true |
2156 | 1904 | } ); |
2157 | 1905 | |
2158 | | - // Update the magic keywords |
| 1906 | + // Update the magic keywords |
2159 | 1907 | mw.Language.magicSetup(); |
2160 | 1908 | |
2161 | 1909 | // Set up mvEmbed utility jQuery bindings |
2162 | 1910 | mw.dojQueryBindings(); |
2163 | 1911 | |
2164 | 1912 | |
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 |
2167 | 1916 | if( mw.hasJQueryUiCss() ){ |
2168 | | - mw.style[ mw.getConfig( 'jQueryUISkin' ) ] = true; |
2169 | | - } |
| 1917 | + mw.style[ 'ui_' + mw.getConfig( 'jQueryUISkin' ) ] = true; |
| 1918 | + } |
2170 | 1919 | |
2171 | 1920 | |
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 |
2178 | 1926 | // and must include a callback. |
2179 | 1927 | // |
2180 | | - // Once complete we can run .ready() queued functions |
| 1928 | + // Once complete we can run .ready() queued functions |
2181 | 1929 | function runSetupFunctions() { |
2182 | 1930 | if( mwSetupFunctions.length ) { |
2183 | 1931 | mwSetupFunctions.shift()( function() { |
— | — | @@ -2186,7 +1934,7 @@ |
2187 | 1935 | mw.runReadyFunctions(); |
2188 | 1936 | } |
2189 | 1937 | } |
2190 | | - runSetupFunctions(); |
| 1938 | + runSetupFunctions(); |
2191 | 1939 | } ); |
2192 | 1940 | |
2193 | 1941 | } ); |
— | — | @@ -2195,55 +1943,68 @@ |
2196 | 1944 | }; |
2197 | 1945 | |
2198 | 1946 | /** |
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 | + */ |
2205 | 1953 | mw.hasJQueryUiCss = function(){ |
2206 | | - var hasUiCss = false; |
| 1954 | + var hasUiCss = false; |
2207 | 1955 | // Load the jQuery ui skin if usability skin not set |
2208 | 1956 | $j( 'link' ).each( function( na, linkNode ){ |
2209 | 1957 | if( $j( linkNode ).attr( 'href' ).indexOf( 'jquery-ui-1.7.2.css' ) != -1 ) { |
2210 | 1958 | hasUiCss = true; |
2211 | | - return false; |
| 1959 | + return true; |
2212 | 1960 | } |
2213 | 1961 | } ); |
| 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 | + |
2214 | 1971 | return hasUiCss; |
2215 | 1972 | } |
2216 | 1973 | |
2217 | | - /** |
| 1974 | + /** |
2218 | 1975 | * 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 |
2224 | 1982 | */ |
2225 | 1983 | 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 ) |
2227 | 1986 | if( mw.getResourceLoaderPath() ) { |
2228 | 1987 | callback(); |
2229 | 1988 | return ; |
2230 | 1989 | } |
2231 | 1990 | |
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 ) |
2233 | 1993 | if( mw.isStaticPackge() ){ |
2234 | 1994 | callback(); |
2235 | 1995 | return ; |
2236 | 1996 | } |
2237 | 1997 | |
2238 | 1998 | // 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 |
2240 | 2000 | mw.load( 'loader.js', callback ); |
2241 | 2001 | } |
| 2002 | + |
2242 | 2003 | /** |
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 | + */ |
2248 | 2009 | mw.isStaticPackge = function(){ |
2249 | 2010 | var src = mw.getMwEmbedSrc(); |
2250 | 2011 | if( src.indexOf('-static') !== -1 ){ |
— | — | @@ -2253,26 +2014,28 @@ |
2254 | 2015 | } |
2255 | 2016 | |
2256 | 2017 | /** |
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 | + */ |
2262 | 2023 | mw.checkModuleLoaderFiles = function( callback ) { |
2263 | 2024 | mw.log( 'doLoaderCheck::' ); |
2264 | 2025 | |
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 | + // ) |
2267 | 2030 | if( mw.getResourceLoaderPath() || mw.isStaticPackge() ) { |
2268 | 2031 | callback(); |
2269 | 2032 | return ; |
2270 | 2033 | } |
2271 | 2034 | |
2272 | 2035 | // 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 |
2274 | 2037 | var loaderRequest = []; |
2275 | 2038 | |
2276 | | - //Load enabled components |
| 2039 | + // Load enabled components |
2277 | 2040 | var enabledComponents = mw.getConfig( 'coreComponents' ); |
2278 | 2041 | function loadEnabledComponents( enabledComponents ){ |
2279 | 2042 | if( ! enabledComponents.length ){ |
— | — | @@ -2291,7 +2054,7 @@ |
2292 | 2055 | loadEnabledComponents( enabledComponents ); |
2293 | 2056 | |
2294 | 2057 | |
2295 | | - // Set the loader context and get each loader individually |
| 2058 | + // Set the loader context and get each loader individually |
2296 | 2059 | function loadEnabledModules( enabledModules ){ |
2297 | 2060 | if( ! enabledModules.length ){ |
2298 | 2061 | // If no more modules left load the LanguageFile |
— | — | @@ -2312,7 +2075,7 @@ |
2313 | 2076 | if( mw.getConfig( 'userLanguage' ) ) { |
2314 | 2077 | var langCode = mw.getConfig( 'userLanguage' ); |
2315 | 2078 | |
2316 | | - // Load the language resource if not default 'en' |
| 2079 | + // Load the language resource if not default 'en' |
2317 | 2080 | var transformKey = mw.getLangTransformKey( langCode ); |
2318 | 2081 | if( transformKey != 'en' ){ |
2319 | 2082 | // Upper case the first letter: |
— | — | @@ -2339,21 +2102,20 @@ |
2340 | 2103 | } |
2341 | 2104 | |
2342 | 2105 | /** |
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 | + */ |
2356 | 2118 | mw.styleRuleExists = function ( styleRule ) { |
2357 | | - // Set up the skin paths configuration |
| 2119 | + // Set up the skin paths configuration |
2358 | 2120 | for( var i=0 ; i < document.styleSheets.length ; i++ ) { |
2359 | 2121 | var rules = null; |
2360 | 2122 | try{ |
— | — | @@ -2381,9 +2143,9 @@ |
2382 | 2144 | var mwModuleLoaderCheckFlag = false; |
2383 | 2145 | |
2384 | 2146 | /** |
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 | + */ |
2388 | 2150 | mw.domReady = function ( ) { |
2389 | 2151 | if( mwDomReadyFlag ) { |
2390 | 2152 | return ; |
— | — | @@ -2392,28 +2154,30 @@ |
2393 | 2155 | // Set the onDomReady Flag |
2394 | 2156 | mwDomReadyFlag = true; |
2395 | 2157 | |
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. |
2400 | 2163 | setTimeout(function(){ |
2401 | 2164 | mw.setupMwEmbed(); |
2402 | 2165 | },1); |
2403 | 2166 | } |
2404 | 2167 | |
2405 | 2168 | /** |
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 | + */ |
2418 | 2182 | mw.versionIsAtLeast = function( minVersion, clientVersion ) { |
2419 | 2183 | var minVersionParts = minVersion.split('.') |
2420 | 2184 | var clientVersionParts = clientVersion.split('.'); |
— | — | @@ -2432,20 +2196,23 @@ |
2433 | 2197 | /** |
2434 | 2198 | * Runs all the triggers on a given object with a single "callback" |
2435 | 2199 | * |
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. |
2438 | 2202 | * |
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. |
2441 | 2205 | * |
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 |
2445 | 2212 | * |
2446 | 2213 | */ |
2447 | | - mw.runTriggersCallback = function( targetObject, triggerName, callback ){ |
| 2214 | + mw.runTriggersCallback = function( targetObject, triggerName, callback ){ |
2448 | 2215 | mw.log( ' runTriggersCallback:: ' + triggerName ); |
2449 | | - // If events are not present directly run callback |
| 2216 | + // If events are not present directly run callback |
2450 | 2217 | if( ! $j( targetObject ).data( 'events' ) || |
2451 | 2218 | ! $j( targetObject ).data( 'events' )[ triggerName ] ) { |
2452 | 2219 | mw.log( ' trigger name not found: ' + triggerName ); |
— | — | @@ -2464,7 +2231,7 @@ |
2465 | 2232 | |
2466 | 2233 | mw.log(" runTriggersCallback:: " + callbackCount ); |
2467 | 2234 | var callInx = 0; |
2468 | | - $j( targetObject ).trigger( 'checkPlayerSourcesEvent', function() { |
| 2235 | + $j( targetObject ).trigger( triggerName, function() { |
2469 | 2236 | callInx++; |
2470 | 2237 | if( callInx == callbackCount ){ |
2471 | 2238 | // Run callback |
— | — | @@ -2473,29 +2240,71 @@ |
2474 | 2241 | } ); |
2475 | 2242 | } |
2476 | 2243 | /** |
2477 | | - * Utility jQuery bindings |
2478 | | - * Setup after jQuery is available ). |
| 2244 | + * Utility jQuery bindings Setup after jQuery is available ). |
2479 | 2245 | */ |
2480 | 2246 | mw.dojQueryBindings = function() { |
2481 | 2247 | mw.log( 'mw.dojQueryBindings' ); |
2482 | 2248 | ( function( $ ) { |
2483 | 2249 | |
2484 | 2250 | /** |
2485 | | - * Set a given selector html to the loading spinner: |
2486 | | - */ |
| 2251 | + * Set a given selector html to the loading spinner: |
| 2252 | + */ |
2487 | 2253 | $.fn.loadingSpinner = function( ) { |
2488 | 2254 | if ( this ) { |
2489 | 2255 | $j( this ).html( |
2490 | 2256 | $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 | + */ |
2494 | 2277 | return this; |
2495 | 2278 | } |
| 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 | + } |
2496 | 2305 | |
2497 | 2306 | /** |
2498 | | - * dragDrop file loader |
2499 | | - */ |
| 2307 | + * dragDrop file loader |
| 2308 | + */ |
2500 | 2309 | $.fn.dragFileUpload = function ( conf ) { |
2501 | 2310 | if ( this.selector ) { |
2502 | 2311 | var _this = this; |
— | — | @@ -2507,8 +2316,8 @@ |
2508 | 2317 | } |
2509 | 2318 | |
2510 | 2319 | /** |
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 |
2513 | 2322 | */ |
2514 | 2323 | $.btnHtml = function( msg, styleClass, iconId, opt ) { |
2515 | 2324 | if ( !opt ) |
— | — | @@ -2522,7 +2331,8 @@ |
2523 | 2332 | '<span class="btnText">' + msg + '</span></a>'; |
2524 | 2333 | }; |
2525 | 2334 | |
2526 | | - // Shortcut to jQuery button ( should replace all btnHtml with button ) |
| 2335 | + // Shortcut to jQuery button ( should replace all btnHtml with |
| 2336 | + // button ) |
2527 | 2337 | var mw_default_button_options = { |
2528 | 2338 | // The class name for the button link |
2529 | 2339 | 'class' : '', |
— | — | @@ -2540,11 +2350,11 @@ |
2541 | 2351 | $.button = function( options ) { |
2542 | 2352 | var options = $j.extend( mw_default_button_options, options); |
2543 | 2353 | |
2544 | | - // Button: |
| 2354 | + // Button: |
2545 | 2355 | var $btn = $j('<a />') |
2546 | 2356 | .attr('href', '#') |
2547 | 2357 | .addClass( 'ui-state-default ui-corner-all ui-icon_link' ); |
2548 | | - // Add css if set: |
| 2358 | + // Add css if set: |
2549 | 2359 | if( options.css ) { |
2550 | 2360 | $btn.css( options.css ) |
2551 | 2361 | } |
— | — | @@ -2553,12 +2363,14 @@ |
2554 | 2364 | $btn.addClass( options['class'] ) |
2555 | 2365 | } |
2556 | 2366 | |
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; |
2563 | 2375 | }; |
2564 | 2376 | |
2565 | 2377 | // Shortcut to bind hover state |
— | — | @@ -2575,9 +2387,11 @@ |
2576 | 2388 | }; |
2577 | 2389 | |
2578 | 2390 | /** |
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 | + */ |
2582 | 2396 | $.fn.dialogFitWindow = function( options ) { |
2583 | 2397 | var opt_default = { 'hspace':50, 'vspace':50 }; |
2584 | 2398 | if ( !options ) |
— | — | @@ -2586,7 +2400,8 @@ |
2587 | 2401 | $j( this.selector ).dialog( 'option', 'width', $j( window ).width() - options.hspace ); |
2588 | 2402 | $j( this.selector ).dialog( 'option', 'height', $j( window ).height() - options.vspace ); |
2589 | 2403 | $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 |
2591 | 2406 | $j( this.selector + '~ .ui-dialog-buttonpane' ).css( { |
2592 | 2407 | 'position':'absolute', |
2593 | 2408 | 'left':'0px', |
— | — | @@ -2602,13 +2417,11 @@ |
2603 | 2418 | |
2604 | 2419 | |
2605 | 2420 | /** |
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 | + */ |
2613 | 2426 | var mwDomIsReady = false; |
2614 | 2427 | function runMwDomReady(){ |
2615 | 2428 | mwDomIsReady = true; |
— | — | @@ -2616,7 +2429,7 @@ |
2617 | 2430 | mw.domReady() |
2618 | 2431 | } |
2619 | 2432 | } |
2620 | | -// Check if already ready: |
| 2433 | +// Check if already ready: |
2621 | 2434 | if ( document.readyState === "complete" ) { |
2622 | 2435 | runMwDomReady(); |
2623 | 2436 | } |
— | — | @@ -2630,7 +2443,8 @@ |
2631 | 2444 | |
2632 | 2445 | } else if ( document.attachEvent ) { |
2633 | 2446 | 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). |
2635 | 2449 | if ( document.readyState === "complete" ) { |
2636 | 2450 | document.detachEvent( "onreadystatechange", DOMContentLoaded ); |
2637 | 2451 | runMwDomReady(); |
— | — | @@ -2686,8 +2500,9 @@ |
2687 | 2501 | } |
2688 | 2502 | |
2689 | 2503 | |
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 ) |
2692 | 2507 | if( mw.getResourceLoaderPath() && !window.jQuery ) { |
2693 | 2508 | mw.log( 'Error: jQuery is required for mwEmbed, please update your resource loader request' ); |
2694 | 2509 | } |
— | — | @@ -2697,14 +2512,13 @@ |
2698 | 2513 | } |
2699 | 2514 | |
2700 | 2515 | /** |
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 |
2703 | 2518 | * |
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. |
2706 | 2521 | * |
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 |
2709 | 2523 | */ |
2710 | 2524 | |
2711 | 2525 | 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 |
1 | 309 | + native |
Added: svn:executable |
2 | 310 | + * |
Index: trunk/extensions/JS2Support/mwEmbed/README |
— | — | @@ -1,33 +1,68 @@ |
2 | | -# mwEmbed |
| 2 | +# Kaltura HTML5 Media Javascript Library |
3 | 3 | |
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 |
5 | 5 | |
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 |
7 | 8 | |
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. |
9 | 10 | |
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. |
11 | 13 | |
12 | | -## The jQuery of HTML5 media |
13 | 14 | |
14 | | -* __mwEmbed__ is built on [jQuery](http://jquery.com/) and [jQueryUI](http://jqueryui.com/) so it's easy to theme, customize and extend. |
15 | 15 | |
| 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. |
16 | 34 | * 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. |
20 | 37 | * supports emerging subtitles and timed text formats for future prof accessibility. |
21 | 38 | * 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 |
24 | 43 | |
25 | | -## Getting stated with the library |
| 44 | +## Basic Usage |
26 | 45 | |
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 |
28 | 47 | |
| 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) |
29 | 49 | |
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> |
31 | 60 | |
| 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 | + |
32 | 67 | <!DOCTYPE html> |
33 | 68 | <html> |
34 | 69 | <head> |
— | — | @@ -35,14 +70,11 @@ |
36 | 71 | </head> |
37 | 72 | <body> |
38 | 73 | <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" > |
47 | 79 | <track kind="subtitles" id="video_af" srclang="af" |
48 | 80 | src="media/elephants_dream/elephant.afrikaans.srt"></track> |
49 | 81 | <track kind="subtitles" id="video_en" srclang="en" |
— | — | @@ -52,34 +84,112 @@ |
53 | 85 | </html> |
54 | 86 | |
55 | 87 | * 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. |
57 | 89 | * 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. |
58 | 90 | |
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...) |
66 | 91 | |
67 | | -## Background |
| 92 | +## Advanced Examples |
68 | 93 | |
69 | | -This project started as a part of the MediaWiki HTML5 media functionality project. |
| 94 | +## MediaRSS Playlists |
70 | 95 | |
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 |
72 | 97 | |
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. |
74 | 99 | |
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. |
76 | 101 | |
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> |
78 | 124 | |
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 |
81 | 126 | |
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. |
83 | 128 | |
| 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 | + |
84 | 194 | 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). |
85 | 195 | |
86 | 196 | 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 @@ |
90 | 200 | * Add the following: `video/ogg ogg ogm ogv` |
91 | 201 | * Restart apache |
92 | 202 | |
93 | | -Or by adding the "AddType" configuration directive in httpd.conf - |
| 203 | +Or by adding the "AddType" configuration directive in httpd.conf - |
94 | 204 | |
95 | 205 | AddType video/ogg .ogm |
96 | 206 | AddType video/ogg .ogv |
97 | 207 | AddType video/ogg .ogg |
| 208 | + AddType video/mp4 .mp4 |
| 209 | + AddType video/webm .webm |
98 | 210 | |
99 | 211 | 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> |
100 | 213 | |
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. |
102 | 215 | |
| 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 | + |
103 | 224 | <p class="note">MwEmbed is released under the GPL2 and hosted by the wikimedia foundation.<br /> |
104 | 225 | You may check out a read-only working copy anonymously over HTTP:<br /> |
105 | 226 | <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> |
106 | 227 | <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> |
107 | 228 | </p> |
108 | 229 | |
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> |
111 | 231 | |
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 |
114 | 233 | |
115 | | -All mwEmbed code is Released under the GPL2 as |
116 | | -a stand alone component of mediaWiki |
117 | 234 | |
| 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 | + |
118 | 270 | Libraries used include their license info in their included path |
119 | 271 | |
120 | 272 | Copyright (C) 2007 - 2010 Kaltura, Wikimedia Foundation |
121 | 273 | |
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 |
124 | 275 | |
125 | | -Author Michael Dale <mdale@wikimedia.org>, |
126 | | -and many others. |
| 276 | +Author Michael Dale <mdale@wikimedia.org>, and many others. |
127 | 277 | |
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. |
132 | 279 | |
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. |
137 | 281 | |
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) |