@@ -700,20 +700,29 @@ org.ekstep.pluginframework.resourceManager = new(Class.extend({
700700 }
701701 } ,
702702 loadResource : function ( url , dataType , callback , publishedTime ) {
703- url = url + "?" + ( org . ekstep . pluginframework . config ? org . ekstep . pluginframework . config . build_number : '' ) ;
703+ var cleanUrl = ( url || '' ) . replace ( '??' , '?' ) ;
704+ var buildNumber = ( org . ekstep . pluginframework . config ? org . ekstep . pluginframework . config . build_number : '' ) ;
705+ if ( buildNumber ) {
706+ cleanUrl = cleanUrl + ( cleanUrl . indexOf ( '?' ) !== - 1 ? '&' : '?' ) + buildNumber ;
707+ }
704708 if ( publishedTime ) {
705- url = url + "&" + publishedTime ;
709+ cleanUrl = cleanUrl + ( cleanUrl . indexOf ( '?' ) !== - 1 ? '&' : '?' ) + publishedTime ;
710+ }
711+ var finalDataType = dataType ;
712+ if ( finalDataType === 'script' && cleanUrl . indexOf ( ".html" ) !== - 1 ) {
713+ finalDataType = 'text' ;
706714 }
707715 org . ekstep . pluginframework . jQuery . ajax ( {
708716 async : false ,
709- url : url ,
710- dataType : dataType
717+ url : cleanUrl ,
718+ dataType : finalDataType ,
719+ cache : false ,
720+ crossDomain : true ,
721+ timeout : 30000
711722 } ) . done ( function ( data ) {
712723 callback ( null , data ) ;
713724 } ) . fail ( function ( jqXHR , textStatus , errorThrown ) {
714- if ( jqXHR . statusText === 'OK' ) {
715- console . log ( 'Unable to load resource:' , url , 'error:' , errorThrown ) ;
716- }
725+ console . log ( 'Unable to load resource:' , url , 'error:' , errorThrown ) ;
717726 callback ( errorThrown )
718727 } ) ;
719728 }
@@ -1869,4 +1878,4 @@ org.ekstep.pluginframework.publishedRepo = new(org.ekstep.pluginframework.iRepo.
18691878 return org . ekstep . pluginframework . config . pluginRepo + "/" + id + "-" + ver + "/" + resource ;
18701879 }
18711880} ) ) ;
1872- org . ekstep . pluginframework . resourceManager . addRepo ( org . ekstep . pluginframework . publishedRepo ) ;
1881+ org . ekstep . pluginframework . resourceManager . addRepo ( org . ekstep . pluginframework . publishedRepo ) ;
0 commit comments