From c40fde900a6b966752fb56eb8b23cf4c983fe349 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Mon, 6 Dec 2010 15:11:42 -0800 Subject: [PATCH] minify LinkPreview JS code --- plugins/LinkPreview/LinkPreviewPlugin.php | 2 +- plugins/LinkPreview/linkpreview.min.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 plugins/LinkPreview/linkpreview.min.js diff --git a/plugins/LinkPreview/LinkPreviewPlugin.php b/plugins/LinkPreview/LinkPreviewPlugin.php index 39d2c9bf39..65f896ca27 100644 --- a/plugins/LinkPreview/LinkPreviewPlugin.php +++ b/plugins/LinkPreview/LinkPreviewPlugin.php @@ -51,7 +51,7 @@ class LinkPreviewPlugin extends Plugin { $user = common_current_user(); if ($user && common_config('attachments', 'process_links')) { - $action->script('plugins/LinkPreview/linkpreview.js'); + $action->script('plugins/LinkPreview/linkpreview.min.js'); $data = json_encode(array( 'api' => common_local_url('oembedproxy'), 'width' => common_config('attachments', 'thumbwidth'), diff --git a/plugins/LinkPreview/linkpreview.min.js b/plugins/LinkPreview/linkpreview.min.js new file mode 100644 index 0000000000..a6fb9dba83 --- /dev/null +++ b/plugins/LinkPreview/linkpreview.min.js @@ -0,0 +1 @@ +(function(){var a={api:"http://oohembed.com/oohembed",width:100,height:75,cache:{},callbacks:{},lookup:function(c,d){if(typeof a.cache[c]=="object"){d(a.cache[c])}else{if(typeof a.callbacks[c]=="undefined"){a.callbacks[c]=[d];a.rawLookup(c,function(g){a.cache[c]=g;var f=a.callbacks[c];a.callbacks[c]=undefined;for(var e=0;e');h.find("a").attr("href",c).attr("target","_blank").last().find("img").attr("src",f).attr("width",g).attr("title",i.title||i.url||c);$("#"+e).empty();$("#"+e).append(h)}else{b.clearLink(d)}if(b.refresh[d]){b.prepLinkPreview(d)}else{b.markDone(d)}})},previewLinks:function(f){var e;var c=b.links;var d=b.findLinks(f);b.links=d;for(e=0;ec.length){for(e=c.length;ed.length){for(e=d.length;e')},clearLink:function(c){var d="link-preview-"+c;$("#"+d).html("")},markLoading:function(c){b.state[c]="loading";var d="link-preview-"+c;$("#"+d).attr("style","opacity: 0.5")},markDone:function(c){b.state[c]="done";var d="link-preview-"+c;$("#"+d).removeAttr("style")},clear:function(){b.links=[];$("#link-preview").empty()}};SN.Init.LinkPreview=function(c){if(c.api){a.api=c.api}if(c.width){a.width=c.width}if(c.height){a.height=c.height}$("#form_notice").append('').bind("reset",function(){b.clear()});var d=SN.U.Counter;SN.U.Counter=function(e){b.previewLinks($("#notice_data-text").val());return d(e)}}})(); \ No newline at end of file -- 2.39.5