// The local wiki API URL:
'local_wiki_api_url': wgServer + wgScriptPath + '/api.php'
};
-js2AddOnloadHook( function() {
- mwEditPageHelper.init(
- $j.extend( true, defaultAddMediaConfig, mwAddMediaConfig )
- );
-});
var mwEditPageHelper = {
init: function( amwConf ) {
var _this = this;
// kind of tricky, it would be nice to use run on ready "loader" call here
if( typeof $j.wikiEditor != 'undefined' ) {
- setTimeout( function() {
+ setTimeout( function() {
$j( '.wikiEditor-ui [rel=file]' ).unbind().addMediaWiz(
amwConf
);
);*/
}
}
+
+js2AddOnloadHook( function() {
+ mwEditPageHelper.init(
+ $j.extend( true, defaultAddMediaConfig, mwAddMediaConfig )
+ );
+});
</script>
</head><body>
<div id="main">
- <h1>Make Ogg Video</h1>
+ <h1>
+<a href="http://firefogg.org/index.html">
+ <img alt="Firefogg" src="../skins/mvpcf/images/firefogg_logo.png"/>
+</a><br>
+Make Ogg Video</h1>
<br>
<br>
<div style="margin-right:auto;margin-left:auto;width:500px;" id="loadFogg">Loading firefogg<blink>...</blink></div>
if( event.button==0 && _this.action_done === false){
return _this.cancel_action();
}else{
- //click on button (dont do close action);
+ //click on button (don't do close action);
return true;
}
},
//confirm:
if( confirm( gM('mwe-cancel-confim') )){
//@@todo (cancel the encode / upload)
- $j(this).empty().dialog('close');
- return false;
- }else{
- return true;
+ $j(this).empty().dialog('close');
}
+ //dont' follow the link;
+ return false;
}
};
}else{
this.action_done = true;
this.fogg.cancel();
- $j(dlElm).empty().dialog('close');
- return false;
+ $j(dlElm).empty().dialog('close');
}
- } else{
- return false;
}
+ //dont' follow the link:
+ return false;
},
/**
* procPageResponse should be faded out in favor of the upload api soon..
*
* it take a msg key and array of replacement values of form
* $1, $2 and does relevant msgkey transformation returning
- * the usser msg.
+ * the user msg.
*
* @param string key The msg key as set by loadGm
* @param [mixed] args An array of replacement strings
//swap in the arg values
var ms = $.lang.gMsgSwap( key, args);
//a quick check to see if we need to send the msg via the 'parser'
- //(we can add more detailed check once we suport more wiki syntax)
+ //(we can add more detailed check once we support more wiki syntax)
if(ms.indexOf('{{')==-1)
return ms;
if(! gMsg[ key ])
return '<' + key + '>';// Missing key placeholder
//get the messege string:
- ms = gMsg[ key ];
+ var ms = gMsg[ key ];
//replace values
if( typeof args == 'object' || typeof args == 'array' ) {
for( var v in args ) {
// Message test replace arguments start at 1 instead of zero:
- var rep = '\$'+ ( parseInt(v) + 1 );
+ var rep = new RegExp('\\$'+ ( parseInt(v) + 1 ), 'g');
ms = ms.replace( rep, args[v] );
}
} else if( typeof args =='string' || typeof args =='number' ) {
/**
* Maps a given rule Index to template params:
*
+ * if index is out of range return last param
* @param
*/
- function getTempParamFromRuleInx( ruleInx ){
- //var naturalOrder = ['zero', 'one', 'two', 'few', 'many', 'other'];
- //js_log('getTempParamFromRuleInx: ruleInx: ' + ruleInx + ' tempParamLength ' + tObj.param.length );
+ function getTempParamFromRuleInx(tObj, ruleInx ){
+ //js_log('getTempParamFromRuleInx: ruleInx: ' + ruleInx + ' tempParamLength ' + tObj.param.length );
+ if( ruleInx >= tObj.param.length )
+ return tObj.param[ tObj.param.length -1 ];
+ //else return the requested index:
return tObj.param[ ruleInx ];
}
var rCount=0
- //run the acutal rule lookup:
+ //run the actual rule lookup:
for(var ruleInx in rs){
cRule = rs[ruleInx];
if( matchRuleTest( cRule, tObj.arg ) ){
js_log("matched rule: " + ruleInx );
- return getTempParamFromRuleInx( rCount );
+ return getTempParamFromRuleInx(tObj, rCount );
}
rCount ++;
}
var loadGM = $mw.lang.loadGM;
var gM = $mw.lang.gM;
+//if some no-js2 script defined and loaded gMsg in global space:
+if( _global['gMsg'] ){
+ loadGM( _global['gMsg'] );
+}
// All default messages in [English] should be overwritten by the CMS language message system.
$mw.lang.loadGM({
// Base lib flags
onReadyEvents: new Array(),
doneReadyEvents: false,
- jQueryCheckFlag: false,
+ jQuerySetupFlag: false,
// To keep consistency across threads
ptime: 0,
}
}
if( all_libs_loaded ) {
- js_log( 'All libraries already loaded, skipping load request' );
+ //js_log( 'Libraries ( ' + loadLibs + ') already loaded... skipping load request' );
callback();
return;
}
* checks for jQuery and adds the $j noConflict var
*/
jQueryCheck: function( callback ) {
+ //js_log( 'jQueryCheck::' );
// Skip stuff if $j is already loaded:
if( _global['$j'] && callback )
callback();
//only do the $j setup once:
if(!_global['$j']){
_global['$j'] = jQuery.noConflict();
-
+ }
+ if( _this.jQuerySetupFlag == false){
+ js_log('setup mv_embed jQuery bindings');
//setup our global settings using the (jQuery helper)
mwConfig = $j.extend( mwDefaultConfig, mwConfig);
js_log( 'jQuery loaded into $j' );
// Set up mvEmbed jQuery bindings and config based dependencies
mv_jqueryBindings();
+ _this.jQuerySetupFlag = true;
}
// Run the callback
if( callback ) {
},
embedVideoCheck:function( callback ) {
var _this = this;
- js_log( 'embedVideoCheck:' );
+ js_log( 'embedVideoCheck:' );
// Make sure we have jQuery
_this.jQueryCheck( function() {
//set class videonojs to hidden
// unless js2AddOnloadHook was used or there is video on the page.
runQueuedFunctions: function() {
var _this = this;
- this.doneReadyEvents = true;
- if( this.jQueryCheckFlag ) {
- this.jQueryCheck( function() {
- _this.runReadyEvents();
- });
- } else {
- this.runReadyEvents();
- }
+ this.doneReadyEvents = true;
+ this.jQueryCheck( function() {
+ _this.runReadyEvents();
+ });
},
runReadyEvents: function() {
js_log( "runReadyEvents" );
func();
});
} else {
- // If we are using js2AddOnloadHook we need to get jQuery into place (if it's not already included)
- mvJsLoader.jQueryCheckFlag = true;
mvJsLoader.addLoadEvent( func );
}
}
//set the dismissNativeWarn flag:
_global['dismissNativeWarn'] = false;
+/**
+* Msg text is inhereited from embedVideo (we should move it here (although can't load ctrlBuilder without parent EmbedVideo obj)
+/
/**
* base ctrlBuilder object
var langKey = 'en';
js2AddOnloadHook( function(){
//build table output:
- var o = '<table>';
- var msgTestSet = [ 'test_plural_msg', 'undelete_short', 'category-subcat-count' ];
- var testNumberSet = [ 0, 1, 2, 5, 21, 30 ];
+ var o = '<table>';
+ var msgTestSet = {
+ 'test_plural_msg':[ 0, 1, 2, 5, 21, 30 ],
+ 'undelete_short': [ 0, 1, 2, 5, 21, 30 ],
+ //category-subcat-count' has two params:
+ 'category-subcat-count' : [
+ [0,10],
+ [1,2],
+ [3,30] ]
+ };
+
var passTest=0;
var failTest=0;
var testCount=0;
//now for each langage msg:
- $j.each(msgTestSet, function(inx, mKey){
+ $j.each(msgTestSet, function(mKey, mTestSet){
//output table names:
o+='<tr>'+
'<td>$1:</td>'+
- '<td>Msg key</td>'+
- '<td>Msg text</td>'+
- '<td>Msg Transform JS</td>'+
- '<td>Msg Transform Mw</td>'+
+ '<td width="14%">Msg key</td>'+
+ '<td width="34%">Msg text</td>'+
+ '<td width="24%">Msg Transform JS</td>'+
+ '<td width="24%">Msg Transform Mw</td>'+
'</tr>';
//for each number value
- for(var i in testNumberSet){
- var numVal = testNumberSet[i];
+ for(var i in mTestSet){
+ var numVal = mTestSet[i];
+ var numKey = (typeof numVal== 'object')? numVal.join( '_' ) : numVal;
o+='<tr>'+
'<td>' + numVal + '</td>' +
'<td>' + mKey + '</td>' +
'<td>' + $mw.lang.gMsgNoTrans( mKey ) + '</td>' +
- '<td id="' + mKey + '_' + numVal + '_js">' + $mw.lang.gM( mKey, numVal ) + '</td>';
+ '<td id="' + mKey + '_' + numKey + '_js">' + $mw.lang.gM( mKey, numVal ) + '</td>';
//show mw col:
if( mKey.substr(0, 5) == 'test_' ){
o+='<td> (test msg) </td>';
}else{
- o+='<td id="' + mKey + '_' + numVal + '">loading<blink>...</blink></td>';
+ o+='<td id="' + mKey + '_' + numKey + '">loading<blink>...</blink></td>';
//get transform from mw (& compare and highlight)
- function doPopWmMsg(mKey, numVal){
+ function doPopWmMsg(mKey, numVal, numKey){
testCount++;
- $j('#score_card').html('Running Tests <span id="perc_done">0</sapn>% done');
+ $j('#score_card').html('Running Tests <span id="perc_done">0</sapn>% done');
do_api_req({
'data': {
'action':'parse',
'text': $mw.lang.gMsgSwap( mKey, numVal)
},
'url' : '../../../api.php'
- }, function( data ) {
- js_log("got data::" + data.parse.text['*']);
- var t = '#'+ mKey + '_'+ numVal;
+ }, function( data ) {
+ var t = '#'+ mKey + '_'+ numKey;
if(data.parse && data.parse.text && data.parse.text['*']){
$j(t).html( data.parse.text['*'] );
//just get the part in the <p> to compare with js version
});
};
//pop off an anonymous function call:
- doPopWmMsg(mKey, numVal);
+ doPopWmMsg(mKey, numVal, numKey);
}
o+='</tr>';
}