<?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/11/w/api-documentation/67197/webpreview-ui-component</link><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/11/w/api-documentation/67197/webpreview-ui-component</link><pubDate>Tue, 19 Nov 2019 20:28:49 GMT</pubDate><guid isPermaLink="false">0a46ef79-f58f-4e9c-9aef-7b38de3d8160</guid><dc:creator>Ben Tiedt</dc:creator><comments>https://community.telligent.com/community/11/w/api-documentation/67197/webpreview-ui-component#comments</comments><description>Current Revision posted to API Documentation by Ben Tiedt on 11/19/2019 20:28:49&lt;br /&gt;
&lt;hr class="generated-documentation-start" style="border-width:0;" /&gt;&lt;h3&gt;&lt;a id="jQuery_telligent_evolution_ui_components_webpreview" name="jQuery_telligent_evolution_ui_components_webpreview"&gt;&lt;/a&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;&lt;a id="Options" name="Options"&gt;&lt;/a&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;&lt;a id="Example" name="Example"&gt;&lt;/a&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;&lt;a id="Default_Implementation" name="Default_Implementation"&gt;&lt;/a&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 previewOptions = {
            url: options.configuration.url,
            success: function(preview) {
                if(preview) {
                    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 (!elm.hasClass(&amp;#39;preview&amp;#39;)) {
            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>