<!--
  ~ Copyright (C) 2023 Xibo Signage Ltd
  ~
  ~ Xibo - Digital Signage - https://xibosignage.com
  ~
  ~ This file is part of Xibo.
  ~
  ~ Xibo is free software: you can redistribute it and/or modify
  ~ it under the terms of the GNU Affero General Public License as published by
  ~ the Free Software Foundation, either version 3 of the License, or
  ~ any later version.
  ~
  ~ Xibo is distributed in the hope that it will be useful,
  ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
  ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  ~ GNU Affero General Public License for more details.
  ~
  ~ You should have received a copy of the GNU Affero General Public License
  ~ along with Xibo.  If not, see <http://www.gnu.org/licenses/>.
  -->
<module>
    <id>core-embedded</id>
    <name>Embedded</name>
    <author>Core</author>
    <description>Embed HTML and JavaScript</description>
    <icon>fa fa-code</icon>
    <class></class>
    <type>embedded</type>
    <dataType></dataType>
    <schemaVersion>1</schemaVersion>
    <assignable>1</assignable>
    <regionSpecific>1</regionSpecific>
    <renderAs>html</renderAs>
    <defaultDuration>60</defaultDuration>
    <startWidth>400</startWidth>
    <startHeight>600</startHeight>
    <settings></settings>
    <properties>
        <property id="transparency" type="checkbox">
            <title>Background transparent?</title>
            <helpText>Should the Widget be shown with a transparent background? Also requires the embedded content to have a transparent background.</helpText>
            <default>1</default>
        </property>
        <property id="scaleContent" type="checkbox">
            <title>Scale Content?</title>
            <helpText>Should the embedded content be scaled along with the layout?</helpText>
            <default>1</default>
            <playerCompatibility windows="v2 R253+"></playerCompatibility>
        </property>
        <property id="isPreNavigate" type="checkbox">
            <title>Preload?</title>
            <helpText>Should this Widget be loaded entirely off-screen so that it is ready when shown? Dynamic content will start running off screen.</helpText>
            <default>1</default>
        </property>
        <property id="embedHtml" type="code" allowLibraryRefs="true" variant="html">
            <title>HTML to embed</title>
            <helpText>Enter text or HTML in the box below.</helpText>
        </property>
        <property id="embedStyle" type="code" allowLibraryRefs="true" variant="css">
            <title>Custom Style Sheets</title>
        </property>
        <property id="embedScript" type="code" variant="javascript">
            <title>HEAD content to embed</title>
            <helpText>Please include script tags.</helpText>
        </property>
    </properties>
    <preview></preview>
    <stencil>
        <twig><![CDATA[
            {{embedHtml|raw}}
            <script type="text/javascript">
                {{embedScript|raw}}
            </script>
            <style>
                {{embedStyle}}
            </style>
        ]]></twig>
    </stencil>
    <onInitialize><![CDATA[
// id: The id of the widget
// target: The target element to render
// properties: The properties for the widget
// -------------------------------------------
if(typeof EmbedInit === 'function') {
    EmbedInit();
}

if(properties.scaleContent) {
    window.scaleContent = true;
    $('body').xiboLayoutScaler(globalOptions);
}
    ]]></onInitialize>
</module>