By Bastian (TeamAccount) on Monday, 06 March 2017
Posted in Technical Issues
Replies 9
Likes 0
Views 582
Votes 0
Which script section in Kommento 3.0.5 is creating the "javascript" outputs:


<script type="text/javascript">


... JS code here ...

</script>


The reason is that I´m working on a minified HTML template for my web side (SEO reasons). I would like to remove the two lines above the java script code and the additional one after the java script code bock. But it looks like if that isn´t yet possible to be changed via an template overwrite. So the input from the support would be great.
Perhaps you can provide us with your full Javascript code so we can able to find in Komento code and see which file generate this?
·
Tuesday, 07 March 2017 10:15
·
0 Likes
·
0 Votes
·
0 Comments
·
Its more a general question. For example i would like to minify the section for adding the ReCaptcha Java code. I CAN compress the *.js code but not the whole section. So the whole looks like:


<input type="hidden" value="" data-kt-recaptcha-response /><script type="text/javascript">


Komento.require().script("http://www.google.com/recaptcha/api.js?hl=en").done(function(a){Komento.Recaptcha=!0,window.recaptchaCallback=function(b){a("[data-kt-recaptcha-response]").val(b).trigger("change")}});

</script>
</div><div class="kt-form-submit">


But its not that optiomal and I would like to remove the empty lines here as well.
·
Tuesday, 07 March 2017 18:49
·
0 Likes
·
0 Votes
·
0 Comments
·
The file is located at
JoomlaFolder/components/com_komento/themes/wireframe/recaptcha/default.php
JoomlaFolder/components/com_komento/themes/wireframe/recaptcha/default.js


You can try override in this following template file location.
JoomlaFolder/templates/Yourtemplate/html/com_komento/recaptcha/default.php
JoomlaFolder/templates/Yourtemplate/html/com_komento/recaptcha/default.js
·
Tuesday, 07 March 2017 23:52
·
0 Likes
·
0 Votes
·
0 Comments
·
Yes, the content is generated here, but it didn´t allow me to remove the empty lines (3,4,6). That´s due to the reason that this isn´t part from the code. It looks like somewhere is some code like the following:


<script type="text/javascript">


<?php echo $theJScontent; ?>

</script>


I´m searching therefore the part in Komento which generated the <script> tags and not the java script it self.
·
Tuesday, 07 March 2017 23:59
·
0 Likes
·
0 Votes
·
0 Comments
·
You can modify on this file -> JoomlaFolder/media/com_komento/scripts/template.php
·
Wednesday, 08 March 2017 13:38
·
0 Likes
·
0 Votes
·
0 Comments
·
Ah great thanks this works. Can i purpose a change here for the next version. Instead of using:


defined('_JEXEC') or die('Unauthorized Access');
?>
<?php if ($scriptTag) { ?>
<script type="text/javascript">
<?php } ?>

<?php if ($cdata) { ?>
//<![CDATA[
<?php } ?>

<?php echo $script; ?>

<?php if ($cdata) { ?>
//]]>
<?php } ?>

<?php if ($scriptTag) { ?>
</script>
<?php } ?>


you can use the following:


defined('_JEXEC') or die('Unauthorized Access');

if ($scriptTag)
{
echo '<script type="text/javascript">';
}

if ($cdata)
{
echo "//<![CDATA[";
}

echo $script;

if ($cdata)
{
echo "//]]>";
}

if ($scriptTag)
{
echo '</script>';
}



Then we could use an template overwrite to build a minified Komento template or build an Komento templates which better fit the joomla templates we build.

For you this change above shouldn´t be a problem, but for us "users" the change would be a greate improvement.
·
Wednesday, 08 March 2017 19:53
·
0 Likes
·
0 Votes
·
0 Comments
·
Thanks for your input, we will consider it.
·
Thursday, 09 March 2017 11:18
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post