Skip to content

Commit

Permalink
Merge pull request joomla#151 from emavro/feature-appstore-client
Browse files Browse the repository at this point in the history
Automatically load CSS & JS files
  • Loading branch information
drmmr763 committed Aug 30, 2013
2 parents e40628e + b210185 commit 1d46b99
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,24 @@

jQuery(document).ready(function() {
var link = jQuery('#myTabTabs a[href="#web"]').get(0);
var csshref1 = "<?php echo $appsBaseUrl . 'components/com_apps/views/dashboard/css/japps.css'; ?>";
var csshref2 = "<?php echo $appsBaseUrl . 'components/com_apps/views/dashboard/css/jquery.jscrollpane.css'; ?>";
var jshref = "<?php echo $appsBaseUrl . 'jedapps/js/client.js?jversion=' . JVERSION; ?>";
jQuery(link).closest('li').click(function (event){
if (typeof Joomla.apps == 'undefined') {
jQuery.ajax({
url: jshref,
url: "<?php echo $appsBaseUrl . 'jedapps/js/client.js?jversion=' . JVERSION; ?>",
dataType: 'script',
timeout: 20000,
success: function(response) {
var script=document.createElement('script');
script.type='text/javascript';
jQuery(script).html(response);
jQuery('head').append(script);
jQuery('<link rel="stylesheet" type="text/css" href="'+csshref1+'" />').appendTo("head");
jQuery('<link rel="stylesheet" type="text/css" href="'+csshref2+'" />').appendTo("head");
for (var i = 0; i < Joomla.apps.cssfiles.length; i++) {
jQuery('<link rel="stylesheet" type="text/css" href="<?php echo $appsBaseUrl; ?>'+Joomla.apps.cssfiles[i]+'" />').appendTo("head");
}
jQuery('<link rel="stylesheet" type="text/css" href="'+Joomla.apps.fonturl+'" />').appendTo("head");
for (var i = 0; i < Joomla.apps.jsfiles.length; i++) {
jQuery('<script type="text/javascript" src="<?php echo $appsBaseUrl; ?>'+Joomla.apps.jsfiles[i]+'" />').appendTo("head");
}
Joomla.apps.initialize();
},
fail: function() {
Expand Down

0 comments on commit 1d46b99

Please sign in to comment.