<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>webpreview UI Component</title><link>https://community.telligent.com/community/13/w/api-documentation/75834/webpreview-ui-component</link><description>&lt;p&gt;&lt;span&gt;Developing on Verint Community? Use the API documentation as a reference for all supported interactions with Verint Community.&lt;/span&gt;&lt;/p&gt;</description><dc:language>en-US</dc:language><generator>14.0.0.586 14</generator><item><title>webpreview UI Component</title><link>https://community.telligent.com/community/13/w/api-documentation/75834/webpreview-ui-component</link><pubDate>Fri, 08 Mar 2024 17:52:24 GMT</pubDate><guid isPermaLink="false">b34bb207-f87f-4746-b4fb-ca0445bad3a6</guid><dc:creator>Ben Tiedt</dc:creator><comments>https://community.telligent.com/community/13/w/api-documentation/75834/webpreview-ui-component#comments</comments><description>Current Revision posted to API Documentation by Ben Tiedt on 03/08/2024 17:52:24&lt;br /&gt;
&lt;hr class="generated-documentation-start" style="border-width:0;" /&gt;&lt;h3&gt;jQuery.telligent.evolution.ui.components.webpreview&lt;/h3&gt;
&lt;p&gt;[[ui JavaScript API Module|UI Component]] which handles automatic asynchronous loading and presentation of [[web previews]] within other content. Decorates &lt;code&gt;&amp;lt;span class=&amp;quot;ui-webpreview&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;&lt;/code&gt; elements to present Ajax-loaded web previews. [[ui JavaScript API Module|Overrides can be provided]] at the theme level to present web previews differently. This enables content to be loaded quickly without waiting for remote web content to be scraped and processed.&lt;/p&gt;
&lt;h3&gt;Options&lt;/h3&gt;
&lt;p&gt;Data made available to instances of the component:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;configuration&lt;/code&gt;: Object of all query string encoded keys and values embedded in the &lt;code&gt;data-configuration&lt;/code&gt; attribute
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;url&lt;/code&gt;: URL to preview&lt;/li&gt;
&lt;li&gt;&lt;code&gt;maximagewidth&lt;/code&gt;: optional max image width requested&lt;/li&gt;
&lt;li&gt;&lt;code&gt;maximageheight&lt;/code&gt;: optional max image height requested&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;Example:&lt;/h3&gt;
&lt;p&gt;Given the markup...&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;span class=&amp;quot;ui-webpreview&amp;quot; data-configuration=&amp;quot;url=http%3A%2F%2Ftelligent.com&amp;quot;&amp;gt;
    &amp;lt;a target=&amp;quot;_new&amp;quot; rel=&amp;quot;nofollow&amp;quot; href=&amp;quot;http://telligent.com&amp;quot;&amp;gt;Telligent&amp;lt;/a&amp;gt;
&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;After being rendered within the DOM, it will be automatically replaced with an asynchronously-loaded web preview of the target URL (in this http://telligent.com).&lt;/p&gt;
&lt;h3&gt;Default Implementation&lt;/h3&gt;
&lt;p&gt;For reference purposes or as the basis for an override:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;(function($){

var getWebPreviewData = function(options) {
        $.telligent.evolution.preview.load(options.url, {
            maxImageWidth: options.maxImageWidth,
            maxImageHeight: options.maxImageHeight,
            success: options.success
        });
    },
    renderWebPreview = function(elm, preview) {
        return $.telligent.evolution.preview.render(preview, {
            template: $.telligent.evolution.preview.defaults.template
        });
    };

$.telligent.evolution.ui.components.webpreview = {
    setup: function() { },
    add: function(elm, options) {
        var isPreview = elm.hasClass(&amp;#39;preview&amp;#39;);

        var previewOptions = {
            url: options.configuration.url,
            success: function (preview) {
                if (isPreview) {
                    elm.html(preview.previewImageHtml || &amp;#39;&amp;#39;);
                } else if (preview &amp;amp;&amp;amp; (preview.excerpt || preview.imageUrl)) {
                    var templatedPreview = renderWebPreview(elm, preview);
                    if (typeof templatedPreview !== &amp;#39;undefined&amp;#39; &amp;amp;&amp;amp; templatedPreview !== null &amp;amp;&amp;amp; templatedPreview.length &amp;gt; 0) {
                        elm.html(templatedPreview);
                    }
                }
            }
        };
        if (typeof options.configuration.maximagewidth !== &amp;#39;undefined&amp;#39;) {
            previewOptions.maxImageWidth = options.configuration.maximagewidth;
        }
        if (typeof options.configuration.maximageheight !== &amp;#39;undefined&amp;#39;) {
            previewOptions.maxImageHeight = options.configuration.maximageheight;
        }
        if (!isPreview) {
            elm.parents(&amp;#39;.ui-theater&amp;#39;).data(&amp;#39;disabletheater&amp;#39;, true);
            if (options.configuration.url.indexOf($.telligent.evolution.site.getBaseUrl(true)) &amp;lt; 0) {
                elm.parents(&amp;#39;.ui-theater&amp;#39;).attr(&amp;#39;target&amp;#39;, &amp;#39;_blank&amp;#39;);
            }
        }
        getWebPreviewData(previewOptions);
    }
};

}(jQuery));
&lt;/code&gt;&lt;/pre&gt;

&lt;hr class="generated-documentation-end" style="border-width:0;" /&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;
</description></item></channel></rss>