Skip to content

Commit

Permalink
major refactor of kWidget
Browse files Browse the repository at this point in the history
* Eliminated all our jsCallback code and rewrote it to never restore
jsCallback. We proxy it as soon as possible and always call our proxy
from both HTML5 and flash this should eliminate issues around restore
timings and recursive calls.

* Moved scattered environmental checks to centralized
kWidget.checkEnviornment() method. 

* Re-factored out all our globals, generalized our deprecation methods,
and moved most things to kWidget.

* Fixed a long standing performance issue where we had different uris
for jQuery / mwEmbed on client side vs page side. Now they optimize
around repeatable cachable uris.

* This reduces mwEmbedLoader to only a few mw utilities and  startup
calls. ... this is closer to what it will do as a "startup" file in the
1.7 new resource loader.
  • Loading branch information
Michael Dale committed Apr 25, 2012
1 parent 7960a2f commit 23df7f3
Show file tree
Hide file tree
Showing 9 changed files with 672 additions and 542 deletions.
39 changes: 33 additions & 6 deletions kWidget.deprecatedGlobals.js
@@ -1,6 +1,8 @@
(function(mw, kWidget){

kWidget.deprecatedGlobals = function(){
// Note not all these were likely to be used externally,
// we can more aggressively remove in a later library version.
var globalFunctionMap = {
'kIsIOS': 'isIOS',
'kSupportsHTML5': 'supportsHTML5',
Expand All @@ -13,14 +15,39 @@
'kDirectDownloadFallback': 'outputDirectDownload',
'kGetKalturaEmbedSettings': 'getEmbedSetting',
'kGetKalturaPlayerList': 'getKalutaObjectList',
'kCheckAddScript': 'rewriteObjectTags'
'kCheckAddScript': 'rewriteObjectTags',
'kAddScript' : 'loadHTML5Lib',
'kPageHasAudioOrVideoTags' : 'pageHasAudioOrVideoTags',
'kLoadJsRequestSet' : 'loadRequestSet',
'kOverideJsFlashEmbed' : 'overrideFlashEmbedMethods',
'kDoIframeRewriteList' : 'embedFromObjects',
'kEmbedSettingsToUrl' : 'embedSettingsToUrl',
'kGetAdditionalTargetCss' : 'getAdditionalTargetCss',
'kAppendCssUrl' : 'appendCssUrl',
'kAppendScriptUrl' : 'appendScriptUrl',
'kFlashVars2Object' : 'flashVars2Object',
'kFlashVarsToUrl' : 'flashVarsToUrl',
'kServiceConfigToUrl' : 'serviceConfigToUrl',
// fully deprecated ( have no purpuse any more )
'restoreKalturaKDPCallback': false
}
for( var gName in globalFunctionMap ){
window[ gName ] = function(){
kWidget.log( gName + ' is deprecated. Please use kWidget.' + globalFunctionMap[ gName] );
var args = Array.prototype.slice.call( arguments, 0 );
return kWidget[ globalFunctionMap[ gName] ].apply(this, args );
}
(function( gName ){
window[ gName ] = function(){
// functions that have no server any purpose
if( globalFunctionMap[ gName] === false ){
kWidget.log( gName + ' is deprecated. This method no longer serves any purpose.' );
return ;
}
kWidget.log( gName + ' is deprecated. Please use kWidget.' + globalFunctionMap[ gName] );
var args = Array.prototype.slice.call( arguments, 0 );
if( typeof kWidget[ globalFunctionMap[ gName] ] != 'function' ){
kWidget.log( "Error kWidget missing method: " + globalFunctionMap[ gName] );
return ;
}
return kWidget[ globalFunctionMap[ gName] ].apply( kWidget, args );
}
})( gName );
}
}
// Add all the deprecated globals:
Expand Down

0 comments on commit 23df7f3

Please sign in to comment.