Search
Other Sourcerer questions
Forum

Javascript stripped with Sourcerer pro

Miles Reid's Avatar Miles Reid
Hi I am using Sourcerer 9.4 pro with Joomla 3 and having difficulty getting the following code to be available on the web page:
<a class="addGroup" href="#"><i data-isicon="true" class="icon-plus fabrikTip tip-small" data-role="fabrik_duplicate_group" [b]opts="{"trigger": "hover"}"[/b] title="Add New Hazard for Control and Mitigation" data-original-title="Add&nbsp;group"></i>

The code that I am having trouble with is opts="{"trigger": "hover"}"

I have tried escaping with &_ but to no avail
Any help gratefully received!

Miles
Peter van Westen's Avatar Peter van Westen ADMIN
What is the exact issue you are having?
What is the full {source} code you are placing?
Does that stay the same after saving the item?
And what is the resulting HTML code in the frontend (view HTML source)?
Please post a rating at the Joomla! Extensions Directory
Miles Reid's Avatar Miles Reid
The HTML from an existing form (using browser inspector) is:
<i data-isicon="true" class="icon-plus fabrikTip tip-small" data-role="fabrik_duplicate_group" opts="{"trigger": "hover"}" title="" data-original-title="Add&nbsp;group"></i>
I want to use this elsewhere as part of a link

What happens with the code is that the code
opts="{"trigger": "hover"}"
turns out as
opts=""

Since writing the original post yesterday, I now find that the code renders well if placed in an article with Sourcerer tags. When inserted into an HTML footer within a 3rd party extension (fabrik) the code is stripped as described above. This would indicate that Fabrik is stripping the code, but I am hoping that Sourcerer can help prevent this.

The original PHP code within the Fabrik extension is:
<?php echo  FabrikHelperHTML::icon('icon-plus fabrikTip tip-small', '', 'data-role="fabrik_duplicate_group" opts=\'{"trigger": "hover"}\' title="' . FText::_('COM_FABRIK_ADD_GROUP'). '"');?>
I hope that this makes sense
Miles
Peter van Westen's Avatar Peter van Westen ADMIN
The Joomla editor will probably strip that, as it tries to correct the HTML syntax.

You should either use:
opts="{'trigger': 'hover'}"
Or:
opts='{"trigger": "hover"}'
Please post a rating at the Joomla! Extensions Directory
Miles Reid's Avatar Miles Reid
Many thanks Peter - this was very helpful, and I have now got it to work!
Kind regards
Miles
Martin Vlasák's Avatar Martin Vlasák
{source}<?php
$document->getWebAssetManager()->addInlineStyle('
body {
background: #55a3db;
display: flex;
text-align: center;
/* Rozestup písmen */
Letter-spacing:3px;
/* Mezera mezi řádky*/
line-height: 50px
}

/* Kontrola písma na WEB 1 */
a { text-shadow:1px 1px 0 #fff, 2px 2px 0 #000; }

/* Kontrola písma na WEB 2 */
b { color:#000; text-shadow:1px 1px 0 red, 2px 2px 0 orange, 3px 3px 0 yellow, 4px 4px 0 green, 5px 5px 0 blue, 6px 6px 0 indigo, 7px 7px 0 violet; }

/* Kontrola písma na WEB 3 */
c { color:#fff; text-shadow:2px 2px 2px #000; }

/* Kontrola písma na WEB 4 */
d { color:#fff; text-shadow:0 0 5px #000; }

/* Kontrola písma na WEB 5 */
e { text-shadow:2px 2px 0 #aaa; }

/* Kontrola písma na WEB 6 */
f { text-shadow:30px 10px 0 #aaa; }

/* Kontrola písma na WEB 7 */
g { color:#fff; text-shadow:-1px -1px 0 #000,-1px 1px 0 #000,1px -1px 0 #000,1px 1px 0 #000; }

/* Kontrola písma na WEB 8 */
h { color:rgba(0,0,0,0.5); text-shadow:3px 3px 0 #aaa; }
');
?>
<h1><a>Kontrola písma na WEB 1 </a><b>Kontrola písma na WEB 2 </b><c>Kontrola písma na WEB 3</c><h1>
<h1><d>Kontrola písma na WEB 4 </d><e>Kontrola písma na WEB 5 </e> <f>Kontrola písma na WEB 6</f><h1>
<h1><g>Kontrola písma na WEB 7 </g><h>Kontrola písma na WEB 8 </h><h1>
{/source}
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription