Index: trunk/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js |
— | — | @@ -259,6 +259,10 @@ |
260 | 260 | //@@todo for cleaner config we should set _this.opt to the provided options) |
261 | 261 | $j.extend( _this, default_remote_search_options, options); |
262 | 262 | |
| 263 | + //Quick fix for cases where people put ['all'] instead of 'all' for enabled_cps |
| 264 | + if( _this.enabled_cps.length == 1 && _this.enabled_cps[0] == 'all') |
| 265 | + _this.enabled_cps = 'all'; |
| 266 | + |
263 | 267 | //modify the content provider config based on options: |
264 | 268 | for(var i in this.content_providers){ |
265 | 269 | if( _this.enabled_cps == 'all' && !this.disp_item ){ |
— | — | @@ -266,7 +270,7 @@ |
267 | 271 | //end the for loop (no need to idorate if enabled_cps == 'all' |
268 | 272 | break; |
269 | 273 | }else{ |
270 | | - if( $j.inArray(i, _this.enabled_cps) != -1 ){ |
| 274 | + if( $j.inArray( i, _this.enabled_cps ) != -1 ){ |
271 | 275 | //if no default display set to first enabled cp: |
272 | 276 | if( !this.disp_item ) |
273 | 277 | this.disp_item = i; |
— | — | @@ -687,7 +691,7 @@ |
688 | 692 | }, |
689 | 693 | runSearch: function( restPage ){ |
690 | 694 | js_log("f:runSearch::" + this.disp_item); |
691 | | - //draw_direct_flag |
| 695 | + |
692 | 696 | var draw_direct_flag = true; |
693 | 697 | |
694 | 698 | //check if its the special upload tab case: |
— | — | @@ -711,7 +715,7 @@ |
712 | 716 | draw_direct_flag = false; |
713 | 717 | } |
714 | 718 | if( !draw_direct_flag ){ |
715 | | - //see if we should reset the pageing |
| 719 | + //see if we should reset the paging |
716 | 720 | if( restPage ){ |
717 | 721 | cp.sObj.offset = cp.offset = 0; |
718 | 722 | } |
— | — | @@ -719,22 +723,22 @@ |
720 | 724 | //set the content to loading while we do the search: |
721 | 725 | $j('#tab-' + this.disp_item).html( mv_get_loading_img() ); |
722 | 726 | |
723 | | - //make sure the search library is loaded and issue the search request |
| 727 | + // Make sure the search library is loaded and issue the search request |
724 | 728 | this.getLibSearchResults( cp ); |
725 | 729 | } |
726 | 730 | }, |
727 | | - //issue a api request & cache the result |
728 | | - //this check can be avoided by setting the this.import_url_mode = 'api' | 'form' | instead of 'autodetect' or 'none' |
| 731 | + // Issue a api request & cache the result |
| 732 | + // this check can be avoided by setting the this.import_url_mode = 'api' | 'form' | instead of 'autodetect' or 'none' |
729 | 733 | checkForCopyURLSupport:function ( callback ){ |
730 | 734 | var _this = this; |
731 | 735 | js_log('checkForCopyURLSupport:: '); |
732 | 736 | |
733 | | - //see if we already have the import mode: |
| 737 | + // See if we already have the import mode: |
734 | 738 | if( this.import_url_mode != 'autodetect'){ |
735 | 739 | js_log('import mode: ' + _this.import_url_mode); |
736 | 740 | callback(); |
737 | 741 | } |
738 | | - //if we don't have the local wiki api defined we can't auto-detect use "link" |
| 742 | + // If we don't have the local wiki api defined we can't auto-detect use "link" |
739 | 743 | if( ! _this.upload_api_target ){ |
740 | 744 | js_log('import mode: remote link (no import_wiki_api_url)'); |
741 | 745 | _this.import_url_mode = 'remote_link'; |
— | — | @@ -742,8 +746,11 @@ |
743 | 747 | } |
744 | 748 | if( this.import_url_mode == 'autodetect' ){ |
745 | 749 | do_api_req( { |
746 | | - 'data': { 'action':'paraminfo', 'modules':'upload' }, |
747 | | - 'url': _this.upload_api_target |
| 750 | + 'url': _this.upload_api_target, |
| 751 | + 'data': { |
| 752 | + 'action':'paraminfo', |
| 753 | + 'modules':'upload' |
| 754 | + } |
748 | 755 | }, function(data){ |
749 | 756 | //jump right into api checks: |
750 | 757 | for( var i in data.paraminfo.modules[0].parameters ){ |
— | — | @@ -812,7 +819,7 @@ |
813 | 820 | return false; |
814 | 821 | } |
815 | 822 | _this.loadSearchLib(cp, function(){ |
816 | | - //do search |
| 823 | + // Do the search |
817 | 824 | cp.sObj.getSearchResults(); |
818 | 825 | _this.checkResultsDone(); |
819 | 826 | }); |
Index: trunk/phase3/js2/mwEmbed/libClipEdit/mvClipEdit.js |
— | — | @@ -153,11 +153,12 @@ |
154 | 154 | //if media type is template we have to query to get its URI to get its parameters |
155 | 155 | if(_this.media_type == 'template' && !_this.rObj.tVars){ |
156 | 156 | mv_set_loading('#sub_cliplib_ic'); |
157 | | - var reqObj ={ 'action':'query', |
158 | | - 'prop':'revisions', |
159 | | - 'titles': _this.rObj.uri, |
160 | | - 'rvprop':'content' |
161 | | - }; |
| 157 | + var reqObj ={ |
| 158 | + 'action':'query', |
| 159 | + 'prop':'revisions', |
| 160 | + 'titles': _this.rObj.uri, |
| 161 | + 'rvprop':'content' |
| 162 | + }; |
162 | 163 | //get the interface uri from the plObject |
163 | 164 | var api_url = _this.p_seqObj.plObj.interface_url; |
164 | 165 | //first check |
— | — | @@ -175,32 +176,9 @@ |
176 | 177 | var template_rev = page['revisions'][0]['*']; |
177 | 178 | } |
178 | 179 | } |
179 | | - |
180 | | - //do a regular ex to get the ~likely~ template values |
181 | | - //(of course this sucks) |
182 | | - //but maybe this will make its way into the api sometime soon to support wysiwyg type editors |
183 | | - //idealy it would expose a good deal of info about the template params |
184 | | - js_log('matching against: ' + template_rev); |
185 | | - var tempVars = template_rev.match(/\{\{\{([^\}]*)\}\}\}/gi); |
186 | | - //clean up results: |
187 | | - _this.rObj.tVars = new Array(); |
188 | | - for(var i=0; i < tempVars.length; i++){ |
189 | | - var tvar = tempVars[i].replace('{{{','').replace('}}}',''); |
190 | | - //strip anything after a | |
191 | | - if(tvar.indexOf('|') != -1){ |
192 | | - tvar = tvar.substr(0, tvar.indexOf('|')); |
193 | | - } |
194 | | - //check for duplicates: |
195 | | - var do_add=true; |
196 | | - for(var j=0; j < _this.rObj.tVars.length; j++){ |
197 | | - js_log('checking: ' + _this.rObj.tVars[j] + ' against:' + tvar); |
198 | | - if( _this.rObj.tVars[j] == tvar) |
199 | | - do_add=false; |
200 | | - } |
201 | | - //add the template vars to the output obj |
202 | | - if(do_add) |
203 | | - _this.rObj.tVars.push( tvar ); |
204 | | - } |
| 180 | + var pObj = mw.parser.pNew( template_rev ); |
| 181 | + _this.rObj.tVars = pObj.getTemplateVars(); |
| 182 | + //run the editor now that we have updated the tVars: |
205 | 183 | _this.doEditOpts(target); |
206 | 184 | } |
207 | 185 | ); |
Index: trunk/phase3/js2/mwEmbed/mv_embed.js |
— | — | @@ -730,7 +730,33 @@ |
731 | 731 | this.pOut = recurse_magic_swap( this.pNode ); |
732 | 732 | |
733 | 733 | }, |
734 | | - |
| 734 | + /** |
| 735 | + * getTemplateVars special function to grab template paramaters |
| 736 | + * from template text |
| 737 | + * |
| 738 | + * @returns {Array} template vars names |
| 739 | + */ |
| 740 | + getTemplateVars:function(){ |
| 741 | + //do a regular ex to get the ~likely~ template values |
| 742 | + //(of course this sucks) |
| 743 | + //but maybe this will make its way into the api sometime soon to support wysiwyg type editors |
| 744 | + //ideally it would expose a good deal of info about the template params |
| 745 | + js_log('matching against: ' + this.wikiText); |
| 746 | + var tempVars = this.wikiText.match(/\{\{\{([^\}]*)\}\}\}/gi); |
| 747 | + //clean up results: |
| 748 | + var tVars = new Array(); |
| 749 | + for(var i=0; i < tempVars.length; i++){ |
| 750 | + var tvar = tempVars[i].replace('{{{','').replace('}}}',''); |
| 751 | + // Strip anything after a | |
| 752 | + if(tvar.indexOf('|') != -1){ |
| 753 | + tvar = tvar.substr(0, tvar.indexOf('|')); |
| 754 | + } |
| 755 | + // Add if not already there |
| 756 | + if( $j.inArray(tvar, tVars) == -1) |
| 757 | + tVars.push( tvar ); |
| 758 | + } |
| 759 | + return tVars; |
| 760 | + }, |
735 | 761 | /* |
736 | 762 | * parsed template api ~loosely based off of ~POM~ |
737 | 763 | * http://www.mediawiki.org/wiki/Extension:Page_Object_Model |
— | — | @@ -839,7 +865,7 @@ |
840 | 866 | } |
841 | 867 | |
842 | 868 | /** |
843 | | -* mvJsLoader class handles initialisation and js file loads |
| 869 | +* mvJsLoader class handles initialization and js file loads |
844 | 870 | */ |
845 | 871 | var mvJsLoader = { |
846 | 872 | libreq : {}, |
Index: trunk/phase3/js2/mwEmbed/libEmbedVideo/flowplayerEmbed.js |
— | — | @@ -1,5 +1,6 @@ |
2 | 2 | /** |
3 | 3 | * metavid: mv_flashEmbed builds off of flowplayer api (included first in this file) |
| 4 | + * THIS WILL BE DEPRECIATED SOON |
4 | 5 | */ |
5 | 6 | |
6 | 7 | /** |
Index: trunk/phase3/js2/mwEmbed/libEmbedVideo/htmlEmbed.js |
— | — | @@ -34,6 +34,7 @@ |
35 | 35 | this.monitor(); |
36 | 36 | }, |
37 | 37 | stop:function(){ |
| 38 | + this.currentTime = 0; |
38 | 39 | this.pause(); |
39 | 40 | //window.clearInterval( this.monitorTimerId ); |
40 | 41 | }, |
Index: trunk/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js |
— | — | @@ -2260,7 +2260,7 @@ |
2261 | 2261 | var eid = (this.pc)?this.pc.pp.id:this.id; |
2262 | 2262 | //update status: |
2263 | 2263 | $j('#' + eid + ' .time-disp').html(value); |
2264 | | - } |
| 2264 | + }, |
2265 | 2265 | /** |
2266 | 2266 | * Helper Functions for selected source |
2267 | 2267 | */ |
— | — | @@ -2273,7 +2273,7 @@ |
2274 | 2274 | supportsURLTimeEncoding: function(){ |
2275 | 2275 | //do head request if on the same domain |
2276 | 2276 | return this.media_element.selected_source.URLTimeEncoding; |
2277 | | - }, |
| 2277 | + } |
2278 | 2278 | } |
2279 | 2279 | |
2280 | 2280 | |
Index: trunk/phase3/js2/mwEmbed/jsScriptLoader.php |
— | — | @@ -58,7 +58,7 @@ |
59 | 59 | $this->sFileCache->getCacheFileName(); |
60 | 60 | |
61 | 61 | // Setup script loader header info |
62 | | - // @@todo we might want to put these into the $mw var per class request set |
| 62 | + // @@todo we might want to put these into the mw var per class request set |
63 | 63 | // and or include a callback to avoid pulling in old browsers that don't support |
64 | 64 | // the onLoad attribute for script elements. |
65 | 65 | $this->jsout .= 'var mwSlScript = "' . $_SERVER['SCRIPT_NAME'] . '";' . "\n"; |
Index: trunk/phase3/js2/mwEmbed/libTimedText/mvTimeTextEdit.js |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | /* |
3 | | - * JS2-style edit.js |
| 3 | + * JS2-style mvTimedTextEdit.js |
4 | 4 | */ |
5 | 5 | |
6 | 6 | // Setup configuration vars (if not set already) |