
(function($){jQuery.fn.exists=function(){return this.length>0;};})(jQuery);(function($){jQuery.fn.onebox=function(){if($(this).exists()){$(this).each(function(){var $this=$(this),url=$(this).children().eq(0).attr("href"),title="",description="";if($(this).data("title"))title=$(this).data("title");if($(this).data("description"))description=$(this).data("description");var requesturl=OneboxParams.renderURL
+(OneboxParams.renderURL.indexOf('?')!=-1?"&onebox_url=":"?onebox_url=")+encodeURIComponent(url)
+"&onebox_title="+encodeURIComponent(title)
+"&onebox_description="+encodeURIComponent(description);$.getJSON(requesturl,function(data){if(data.data){if(data.data.displayurl)url=data.data.displayurl;else url=data.data.url;var template=OneboxParams.template;if(OneboxParams.flat)data.classes+=' flat';if(OneboxParams.dark)data.classes+=' dark';template=template.replace(/{url}/g,url);template=template.replace(/{class}/g,data.classes);if(data.data.favicon)template=template.replace(/{favicon}/g,'<img src="'+data.data.favicon+'" class="onebox-favicon"/>');else template=template.replace(/{favicon}/g,'');template=template.replace(/{sitename}/g,data.data.sitename);if(data.data.image)template=template.replace(/{image}/g,'<img src="'+data.data.image+'" class="onebox-thumbnail"/>');else template=template.replace(/{image}/g,'');template=template.replace(/{title}/g,data.data.title);template=template.replace(/{description}/g,data.data.description);template=template.replace(/{additional}/g,data.data.additional);template=template.replace(/{footer}/g,data.data.footer);template=template.replace(/{title-button}/g,data.data.titlebutton);template=template.replace(/{footer-button}/g,data.data.footerbutton);$this.html(template);$this.find('.onebox-stars').oneboxstars();}});});}
return this;};})(jQuery);(function($){jQuery.fn.oneboxstars=function(){if($(this).exists()){return $(this).each(function(){var val=parseFloat($(this).html());var size=Math.max(0,(Math.min(5,val)))*16;var $span=$('<span />').width(size);$(this).html($span);});}
return this;};})(jQuery);jQuery(document).ready(function(){if(OneboxParams.selector)jQuery(OneboxParams.selector).onebox();});

(function($){jQuery.fn.exists=function(){return this.length>0;};})(jQuery);(function($){jQuery.fn.onebox=function(){if($(this).exists()){return this.each(function(){var $this=$(this),url=$(this).children().eq(0).attr("href"),title="",description="";if($(this).data("title"))title=$(this).data("title");if($(this).data("description"))description=$(this).data("description");var requesturl=OneboxParams.renderURL
+(OneboxParams.renderURL.indexOf('?')!=-1?"&onebox_url=":"?onebox_url=")+encodeURIComponent(url)
+"&onebox_title="+encodeURIComponent(title)
+"&onebox_description="+encodeURIComponent(description);$.getJSON(requesturl,function(data){if(data.data){if(data.data.displayurl)url=data.data.displayurl;else url=data.data.url;var template=OneboxParams.template;if(OneboxParams.flat)data.classes+=' flat';if(OneboxParams.dark)data.classes+=' dark';template=template.replace(/{url}/g,url);template=template.replace(/{class}/g,data.classes);if(data.data.favicon)template=template.replace(/{favicon}/g,'<img src="'+data.data.favicon+'" class="onebox-favicon"/>');else template=template.replace(/{favicon}/g,'');template=template.replace(/{sitename}/g,data.data.sitename);if(data.data.image)template=template.replace(/{image}/g,'<img src="'+data.data.image+'" class="onebox-thumbnail"/>');else template=template.replace(/{image}/g,'');template=template.replace(/{title}/g,data.data.title);template=template.replace(/{description}/g,data.data.description);template=template.replace(/{additional}/g,data.data.additional);template=template.replace(/{footer}/g,data.data.footer);template=template.replace(/{title-button}/g,data.data.titlebutton);template=template.replace(/{footer-button}/g,data.data.footerbutton);$this.html(template);$this.find('.onebox-stars').oneboxstars();}});});}};})(jQuery);(function($){jQuery.fn.oneboxstars=function(){if($(this).exists()){return this.each(function(){var val=parseFloat($(this).html());var size=Math.max(0,(Math.min(5,val)))*16;var $span=$('<span />').width(size);$(this).html($span);});}};})(jQuery);jQuery(document).ready(function(){if(OneboxParams.selector)jQuery(OneboxParams.selector).onebox();});
make plugin chainable