$this->sFileCache->getCacheFileName();
// Setup script loader header info
- // @@todo we might want to put these into the $mw var per class request set
+ // @@todo we might want to put these into the mw var per class request set
// and or include a callback to avoid pulling in old browsers that don't support
// the onLoad attribute for script elements.
$this->jsout .= 'var mwSlScript = "' . $_SERVER['SCRIPT_NAME'] . '";' . "\n";
//@@todo for cleaner config we should set _this.opt to the provided options)
$j.extend( _this, default_remote_search_options, options);
+ //Quick fix for cases where people put ['all'] instead of 'all' for enabled_cps
+ if( _this.enabled_cps.length == 1 && _this.enabled_cps[0] == 'all')
+ _this.enabled_cps = 'all';
+
//modify the content provider config based on options:
for(var i in this.content_providers){
if( _this.enabled_cps == 'all' && !this.disp_item ){
//end the for loop (no need to idorate if enabled_cps == 'all'
break;
}else{
- if( $j.inArray(i, _this.enabled_cps) != -1 ){
+ if( $j.inArray( i, _this.enabled_cps ) != -1 ){
//if no default display set to first enabled cp:
if( !this.disp_item )
this.disp_item = i;
},
runSearch: function( restPage ){
js_log("f:runSearch::" + this.disp_item);
- //draw_direct_flag
+
var draw_direct_flag = true;
//check if its the special upload tab case:
draw_direct_flag = false;
}
if( !draw_direct_flag ){
- //see if we should reset the pageing
+ //see if we should reset the paging
if( restPage ){
cp.sObj.offset = cp.offset = 0;
}
//set the content to loading while we do the search:
$j('#tab-' + this.disp_item).html( mv_get_loading_img() );
- //make sure the search library is loaded and issue the search request
+ // Make sure the search library is loaded and issue the search request
this.getLibSearchResults( cp );
}
},
- //issue a api request & cache the result
- //this check can be avoided by setting the this.import_url_mode = 'api' | 'form' | instead of 'autodetect' or 'none'
+ // Issue a api request & cache the result
+ // this check can be avoided by setting the this.import_url_mode = 'api' | 'form' | instead of 'autodetect' or 'none'
checkForCopyURLSupport:function ( callback ){
var _this = this;
js_log('checkForCopyURLSupport:: ');
- //see if we already have the import mode:
+ // See if we already have the import mode:
if( this.import_url_mode != 'autodetect'){
js_log('import mode: ' + _this.import_url_mode);
callback();
}
- //if we don't have the local wiki api defined we can't auto-detect use "link"
+ // If we don't have the local wiki api defined we can't auto-detect use "link"
if( ! _this.upload_api_target ){
js_log('import mode: remote link (no import_wiki_api_url)');
_this.import_url_mode = 'remote_link';
}
if( this.import_url_mode == 'autodetect' ){
do_api_req( {
- 'data': { 'action':'paraminfo', 'modules':'upload' },
- 'url': _this.upload_api_target
+ 'url': _this.upload_api_target,
+ 'data': {
+ 'action':'paraminfo',
+ 'modules':'upload'
+ }
}, function(data){
//jump right into api checks:
for( var i in data.paraminfo.modules[0].parameters ){
return false;
}
_this.loadSearchLib(cp, function(){
- //do search
+ // Do the search
cp.sObj.getSearchResults();
_this.checkResultsDone();
});
//if media type is template we have to query to get its URI to get its parameters
if(_this.media_type == 'template' && !_this.rObj.tVars){
mv_set_loading('#sub_cliplib_ic');
- var reqObj ={ 'action':'query',
- 'prop':'revisions',
- 'titles': _this.rObj.uri,
- 'rvprop':'content'
- };
+ var reqObj ={
+ 'action':'query',
+ 'prop':'revisions',
+ 'titles': _this.rObj.uri,
+ 'rvprop':'content'
+ };
//get the interface uri from the plObject
var api_url = _this.p_seqObj.plObj.interface_url;
//first check
var template_rev = page['revisions'][0]['*'];
}
}
-
- //do a regular ex to get the ~likely~ template values
- //(of course this sucks)
- //but maybe this will make its way into the api sometime soon to support wysiwyg type editors
- //idealy it would expose a good deal of info about the template params
- js_log('matching against: ' + template_rev);
- var tempVars = template_rev.match(/\{\{\{([^\}]*)\}\}\}/gi);
- //clean up results:
- _this.rObj.tVars = new Array();
- for(var i=0; i < tempVars.length; i++){
- var tvar = tempVars[i].replace('{{{','').replace('}}}','');
- //strip anything after a |
- if(tvar.indexOf('|') != -1){
- tvar = tvar.substr(0, tvar.indexOf('|'));
- }
- //check for duplicates:
- var do_add=true;
- for(var j=0; j < _this.rObj.tVars.length; j++){
- js_log('checking: ' + _this.rObj.tVars[j] + ' against:' + tvar);
- if( _this.rObj.tVars[j] == tvar)
- do_add=false;
- }
- //add the template vars to the output obj
- if(do_add)
- _this.rObj.tVars.push( tvar );
- }
+ var pObj = mw.parser.pNew( template_rev );
+ _this.rObj.tVars = pObj.getTemplateVars();
+ //run the editor now that we have updated the tVars:
_this.doEditOpts(target);
}
);
var eid = (this.pc)?this.pc.pp.id:this.id;
//update status:
$j('#' + eid + ' .time-disp').html(value);
- }
+ },
/**
* Helper Functions for selected source
*/
supportsURLTimeEncoding: function(){
//do head request if on the same domain
return this.media_element.selected_source.URLTimeEncoding;
- },
+ }
}
/**
* metavid: mv_flashEmbed builds off of flowplayer api (included first in this file)
+ * THIS WILL BE DEPRECIATED SOON
*/
/**
this.monitor();
},
stop:function(){
+ this.currentTime = 0;
this.pause();
//window.clearInterval( this.monitorTimerId );
},
/*
- * JS2-style edit.js
+ * JS2-style mvTimedTextEdit.js
*/
// Setup configuration vars (if not set already)
this.pOut = recurse_magic_swap( this.pNode );
},
-
+ /**
+ * getTemplateVars special function to grab template paramaters
+ * from template text
+ *
+ * @returns {Array} template vars names
+ */
+ getTemplateVars:function(){
+ //do a regular ex to get the ~likely~ template values
+ //(of course this sucks)
+ //but maybe this will make its way into the api sometime soon to support wysiwyg type editors
+ //ideally it would expose a good deal of info about the template params
+ js_log('matching against: ' + this.wikiText);
+ var tempVars = this.wikiText.match(/\{\{\{([^\}]*)\}\}\}/gi);
+ //clean up results:
+ var tVars = new Array();
+ for(var i=0; i < tempVars.length; i++){
+ var tvar = tempVars[i].replace('{{{','').replace('}}}','');
+ // Strip anything after a |
+ if(tvar.indexOf('|') != -1){
+ tvar = tvar.substr(0, tvar.indexOf('|'));
+ }
+ // Add if not already there
+ if( $j.inArray(tvar, tVars) == -1)
+ tVars.push( tvar );
+ }
+ return tVars;
+ },
/*
* parsed template api ~loosely based off of ~POM~
* http://www.mediawiki.org/wiki/Extension:Page_Object_Model
}
/**
-* mvJsLoader class handles initialisation and js file loads
+* mvJsLoader class handles initialization and js file loads
*/
var mvJsLoader = {
libreq : {},