<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>preview JavaScript API Module</title><link>https://community.telligent.com/community/11/w/api-documentation/65558/preview-javascript-api-module</link><description /><dc:language>en-US</dc:language><generator>14.0.0.586 14</generator><item><title>preview JavaScript API Module</title><link>https://community.telligent.com/community/11/w/api-documentation/65558/preview-javascript-api-module</link><pubDate>Thu, 13 Jun 2019 19:54:40 GMT</pubDate><guid isPermaLink="false">b032fe7d-f927-4718-a639-5feff1b0897e</guid><dc:creator>Ben Tiedt</dc:creator><comments>https://community.telligent.com/community/11/w/api-documentation/65558/preview-javascript-api-module#comments</comments><description>Current Revision posted to API Documentation by Ben Tiedt on 06/13/2019 19:54:40&lt;br /&gt;
&lt;hr class="generated-documentation-start" style="border-width:0;" /&gt;
&lt;h3&gt;&lt;a id="jQuery_telligent_evolution_preview" name="jQuery_telligent_evolution_preview"&gt;&lt;/a&gt;jQuery.telligent.evolution.preview&lt;/h3&gt;
&lt;p&gt;The preview module enables client-side loading of scraped web previews of remote URLs.&lt;/p&gt;
&lt;p&gt;Preview content is scraped from the remote URL, parsed in a way that prefers &lt;a href="http://ogp.me/"&gt;Open Graph Protocol metadata&lt;/a&gt;, and temporarily cached in Evolution.&lt;/p&gt;
&lt;h3&gt;&lt;a id="Methods" name="Methods"&gt;&lt;/a&gt;Methods&lt;/h3&gt;
&lt;h4&gt;&lt;a id="load" name="load"&gt;&lt;/a&gt;load&lt;/h4&gt;
&lt;p&gt;Returns a Web preview JSON object for a remote URL and an options object.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$.telligent.evolution.preview.load(url, options)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;em&gt;options&lt;/em&gt;:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;maxImageWidth&lt;/code&gt;: maximum preview image width&lt;/li&gt;
&lt;li&gt;&lt;code&gt;maxImageHeight&lt;/code&gt;: maximum preview image height&lt;/li&gt;
&lt;li&gt;&lt;code&gt;success&lt;/code&gt;: callback function invoked when the preview is returned. passed the preview data&lt;/li&gt;
&lt;li&gt;&lt;code&gt;error&lt;/code&gt;: callback function invoked when the preview cannot be generated&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Passes the success callback a preview object with the keys:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;url&lt;/code&gt;: Remote URL&lt;/li&gt;
&lt;li&gt;&lt;code&gt;statusCode&lt;/code&gt;: HTTP response code&lt;/li&gt;
&lt;li&gt;&lt;code&gt;title&lt;/code&gt;: Scraped title&lt;/li&gt;
&lt;li&gt;&lt;code&gt;excerpt&lt;/code&gt;: Scraped excerpt&lt;/li&gt;
&lt;li&gt;&lt;code&gt;imageUrl&lt;/code&gt;: Scraped image URL&lt;/li&gt;
&lt;li&gt;&lt;code&gt;resizedImageHtml&lt;/code&gt;: HTML representing the resized scraped image URL&lt;/li&gt;
&lt;li&gt;&lt;code&gt;siteName&lt;/code&gt;: Scraped site name&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;&lt;a id="render" name="render"&gt;&lt;/a&gt;render&lt;/h4&gt;
&lt;p&gt;Renders a web preview object to an HTML fragment. Uses an internally-defined HTML template, but can optionally be passed a separate one.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;$.telligent.evolution.preview.render(preview, options)
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;&lt;em&gt;Options&lt;/em&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;template&lt;/code&gt;: [[template JavaScript API Module|client template]] string&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;em&gt;Default Template&lt;/em&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;div class=&amp;quot;abbreviated-post-header shared-link&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;div class=&amp;quot;abbreviated-post shared-link &amp;lt;% if(imageUrl !== null &amp;amp;&amp;amp; imageUrl.length &amp;gt; 0){ %&amp;gt; with-image &amp;lt;% } %&amp;gt;&amp;quot;&amp;gt;
    &amp;lt;h4 class=&amp;quot;post-name&amp;quot;&amp;gt;
        &amp;lt;a href=&amp;quot;&amp;lt;%: url %&amp;gt;&amp;quot; class=&amp;quot;external-link&amp;quot; target=&amp;quot;_new&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;
            &amp;lt;%= title %&amp;gt;
        &amp;lt;/a&amp;gt;
    &amp;lt;/h4&amp;gt;
    &amp;lt;% if(siteName !== null &amp;amp;&amp;amp; siteName.length &amp;gt; 0){ %&amp;gt;
        &amp;lt;div class=&amp;quot;post-application&amp;quot;&amp;gt;
            &amp;lt;span class=&amp;quot;label&amp;quot;&amp;gt;&amp;lt;/span&amp;gt;
            &amp;lt;span class=&amp;quot;value&amp;quot;&amp;gt;
                &amp;lt;a href=&amp;quot;&amp;lt;%: url %&amp;gt;&amp;quot; class=&amp;quot;external-link&amp;quot; target=&amp;quot;_new&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;
                    &amp;lt;%= siteName %&amp;gt;
                &amp;lt;/a&amp;gt;
            &amp;lt;/span&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;% } %&amp;gt;
    &amp;lt;% if(imageUrl !== null &amp;amp;&amp;amp; imageUrl.length &amp;gt; 0){ %&amp;gt;
        &amp;lt;div class=&amp;quot;post-thumbnail&amp;quot;&amp;gt;
            &amp;lt;a href=&amp;quot;&amp;lt;%: url %&amp;gt;&amp;quot; class=&amp;quot;external-link&amp;quot; target=&amp;quot;_new&amp;quot; rel=&amp;quot;nofollow&amp;quot;&amp;gt;
                &amp;lt;%= resizedImageHtml %&amp;gt;
            &amp;lt;/a&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;% } %&amp;gt;
    &amp;lt;% if(excerpt !== null &amp;amp;&amp;amp; excerpt.length &amp;gt; 0){ %&amp;gt;
        &amp;lt;div class=&amp;quot;post-summary&amp;quot;&amp;gt;
            &amp;lt;%= excerpt %&amp;gt;
        &amp;lt;/div&amp;gt;
    &amp;lt;% } %&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;div class=&amp;quot;abbreviated-post-footer shared-link&amp;quot;&amp;gt;&amp;lt;/div&amp;gt;
&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>