Added minify of JS to the compiler area, also improved the infusion area to make more use of the getCustomScriptBuilder method

This commit is contained in:
2018-04-18 21:11:14 +02:00
parent 98448b24b7
commit 48a3a49d6f
12 changed files with 165 additions and 171 deletions

View File

@ -186,6 +186,32 @@ class ComponentbuilderViewCompiler extends JViewLegacy
// add to form
$form[] = $debuglinenr;
// get the minify radio field
$minify = JFormHelper::loadFieldType('radio',true);
// start minify xml
$minifyXML = new SimpleXMLElement('<field/>');
// minify attributes
$minifyAttributes = array(
'type' => 'radio',
'name' => 'minify',
'label' => 'COM_COMPONENTBUILDER_MINIFY_JAVASCRIPT',
'class' => 'btn-group btn-group-yesno',
'description' => 'COM_COMPONENTBUILDER_SHOULD_THE_JAVASCRIPT_BE_MINIFIED_IN_THE_COMPONENT',
'default' => '2');
// load the minify attributes
ComponentbuilderHelper::xmlAddAttributes($minifyXML, $minifyAttributes);
// start the minify options
$minifyOptions = array(
'2' => 'COM_COMPONENTBUILDER_GLOBAL',
'1' => 'COM_COMPONENTBUILDER_YES',
'0' => 'COM_COMPONENTBUILDER_NO');
// load the minify options
ComponentbuilderHelper::xmlAddOptions($minifyXML, $minifyOptions);
// setup the minify radio field
$minify->setup($minifyXML,2);
// add to form
$form[] = $minify;
// get the component list field
$component = JFormHelper::loadFieldType('list',true);
// start component xml

View File

@ -98,7 +98,7 @@ if ($this->saveOrder)
<?php echo JHtml::_('form.token'); ?>
</form>
<script type="text/javascript">
// joomla_components footer script
// waiting spinner
var outerDiv = jQuery('body');
jQuery('<div id="loading"></div>')

View File

@ -96,4 +96,27 @@ if ($this->saveOrder)
<?php endif; ?>
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</form>
</form>
<script type="text/javascript">
// language_translations footer script
// waiting spinner
var outerDiv = jQuery('body');
jQuery('<div id="loading"></div>')
.css("background", "rgba(255, 255, 255, .8) url('components/com_componentbuilder/assets/images/import.gif') 50% 15% no-repeat")
.css("top", outerDiv.position().top - jQuery(window).scrollTop())
.css("left", outerDiv.position().left - jQuery(window).scrollLeft())
.css("width", outerDiv.width())
.css("height", outerDiv.height())
.css("position", "fixed")
.css("opacity", "0.80")
.css("-ms-filter", "progid:DXImageTransform.Microsoft.Alpha(Opacity = 80)")
.css("filter", "alpha(opacity = 80)")
.css("display", "none")
.appendTo(outerDiv);
// when the export button is clicked
jQuery('#toolbar').on('click',"button.button-download", function(e){
jQuery('#loading').show();
});
</script>

View File

@ -96,4 +96,27 @@ if ($this->saveOrder)
<?php endif; ?>
<input type="hidden" name="task" value="" />
<?php echo JHtml::_('form.token'); ?>
</form>
</form>
<script type="text/javascript">
// languages footer script
// waiting spinner
var outerDiv = jQuery('body');
jQuery('<div id="loading"></div>')
.css("background", "rgba(255, 255, 255, .8) url('components/com_componentbuilder/assets/images/import.gif') 50% 15% no-repeat")
.css("top", outerDiv.position().top - jQuery(window).scrollTop())
.css("left", outerDiv.position().left - jQuery(window).scrollLeft())
.css("width", outerDiv.width())
.css("height", outerDiv.height())
.css("position", "fixed")
.css("opacity", "0.80")
.css("-ms-filter", "progid:DXImageTransform.Microsoft.Alpha(Opacity = 80)")
.css("filter", "alpha(opacity = 80)")
.css("display", "none")
.appendTo(outerDiv);
// when the build button is clicked
jQuery('#toolbar').on('click',"button.button-joomla", function(e){
jQuery('#loading').show();
});
</script>