Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixes bad words and actually minifies it

  • Loading branch information...
commit e7f7d24180e23295e60493dc916fb09b4143da80 1 parent 46cfe3b
@screeley screeley authored
Showing with 21 additions and 2 deletions.
  1. +19 −0 README.rst
  2. +1 −1  jquery.embedly.js
  3. +1 −1  jquery.embedly.min.js
View
19 README.rst
@@ -51,6 +51,12 @@ Requires JQuery 1.3.1 or greater::
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
+And Embedly-jQuery. You can either download the file `here
+<https://raw.github.com/embedly/embedly-jquery/master/jquery.embedly.min.js>`
+or use Embedly's CDN like so::
+
+ <script type="text/javascript" src="http://scripts.embed.ly/jquery.embedly-2.1.6.js"></script>
+
Using Embedly-JQuery
--------------------
There are two ways to interact with this library. You can call Embedly directly
@@ -252,6 +258,19 @@ and still have access to the ``oembed`` data for customization.
The event handler gets the oembed object passed in as a parameter as well if
you don't want to use jQuery.data(); The two are equivalent.
+CDN
+---
+To get you going even faster, Embedly hosts all the files you need on
+scripts.embed.ly. The latest version is available here::
+
+ http://scripts.embed.ly/jquery.embedly-2.1.6.js
+ http://scripts.embed.ly/jquery.embedly-2.1.6.min.js
+
+The most current version of jQuery Preview will be available here::
+
+ http://scripts.embed.ly/jquery.embedly.js
+ http://scripts.embed.ly/jquery.embedly.min.js
+
Examples
--------
Examples can be found at - http://github.com/embedly/embedly-jquery/tree/master/examples/
View
2  jquery.embedly.js
@@ -205,7 +205,7 @@
$.embedly.defaults = {
endpoint: 'oembed', // default endpoint is oembed (preview and objectify available too)
chars: null, // Default number of characters in description
- words, null, // Default number of words in description
+ words: null, // Default number of words in description
maxWidth: null, // force a maxWidth on all returned media
maxHeight: null, // force a maxHeight on all returned media
secure: false, // use https endpoint vs http
View
2  jquery.embedly.min.js
@@ -1 +1 @@
-(function(a){window.embedlyURLre=/(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;a.embedly=a.embedly||{};if(a.embedly.version){return}a.embedly.version="2.1.1";a.extend({embedly:function(k,q,o){var b=[];var p="http://api.embed.ly/";var d={endpoint:"oembed",maxWidth:null,maxHeight:null,secure:false,wmode:"opaque",autoplay:null,width:null,method:"replace",addImageStyles:true,wrapElement:"div",className:"embed",urlRe:null,key:null,elems:[],success:null,error:null};var c;if(typeof q!="undefined"){c=a.extend(d,q)}else{c=d}if(!c.urlRe){c.urlRe=window.embedlyURLre}if(typeof k=="string"){k=new Array(k)}if(typeof o!="undefined"){c.success=o}if(c.secure){p="https://api.embed.ly/"}if(c.success==null){c.success=function(i,t){var r,s=a(t.node);if(!(i)){return null}if((r=c.method)==="replace"){return s.replaceWith(i.code)}else{if(r==="after"){return s.after(i.code)}else{if(r==="afterParent"){return s.parent().after(i.code)}else{if(r==="replaceParent"){return s.parent().replaceWith(i.code)}}}}}}if(c.error==null){c.error=function(i,r){}}var m=function(i){return c.urlRe.test(i)};var n=function(r){var i="urls="+r;if(c.maxWidth!=null){i+="&maxwidth="+c.maxWidth}else{if(typeof dimensions!="undefined"){i+="&maxwidth="+dimensions.width}}if(c.maxHeight!=null){i+="&maxheight="+c.maxHeight}i+="&wmode="+c.wmode;if(typeof c.key=="string"){i+="&key="+c.key}if(typeof c.autoplay=="string"||typeof c.autoplay=="boolean"){i+="&autoplay="+c.autoplay}if(c.width){i+="&width="+c.width}return i};var j=function(){if(typeof c.key=="string"){if(c.endpoint.search(/objectify/i)>=0){return p+"2/objectify"}else{if(c.endpoint.search(/preview/i)>=0){return p+"1/preview"}}}return p+"1/oembed"};var g=function(i,v){if(c.endpoint!="oembed"){return c.success(i,v)}var r,t,s,u;if((r=i.type)==="photo"){u=i.title||"";s=[];if(c.addImageStyles){if(c.maxWidth){units=isNaN(parseInt(c.maxWidth))?"":"px";s.push("max-width: "+(c.maxWidth)+units)}if(c.maxHeight){units=isNaN(parseInt(c.maxHeight))?"":"px";s.push("max-height: "+(c.maxHeight)+units)}}s=s.join(";");t="<a href='"+v.url+"' target='_blank'><img style='"+s+"' src='"+i.url+"' alt='"+u+"' /></a>"}else{if(r==="video"){t=i.html}else{if(r==="rich"){t=i.html}else{u=i.title||v.url;thumb=i.thumbnail_url?'<img src="'+i.thumbnail_url+'" class="thumb" />':"";description=i.description;provider=i.provider_name?'<a href="'+i.provider_url+'" class="provider">'+i.provider_name+"</a> - ":"";t=thumb+"<a href='"+v.url+"'>"+u+"</a>";t+=provider;t+=description}}}if(c.wrapElement&&c.wrapElement=="div"&&a.browser.msie&&a.browser.version<9){c.wrapElement="span"}if(c.wrapElement){t="<"+c.wrapElement+' class="'+c.className+'">'+t+"</"+c.wrapElement+">"}i.code=t;if(typeof v.node!="undefined"){a(v.node).data("oembed",i).trigger("embedly-oembed",[i])}return c.success(i,v)};var e=function(i){var s,u,t,r;t=a.map(i,function(w,v){if(v==0){if(w.node!==null){node=a(w.node);r={width:node.parent().width(),height:node.parent().height()}}}return encodeURIComponent(w.url)}).join(",");a.ajax({url:j(),dataType:"jsonp",data:n(t),success:function(v){return a.each(v,function(w,x){return x.type!="error"?g(x,i[w]):c.error(i[w].node,x)})}})};a.each(k,function(s,r){node=typeof c.elems!=="undefined"?c.elems[s]:null;if(typeof node!="undefined"&&!m(r)){a(node).data("oembed",false)}var t={url:r,error_code:400,error_message:"HTTP 400: Bad Request",type:"error"};return(r&&m(r))?b.push({url:r,node:node}):c.error(node,t)});var l=[];var h=b.length;for(var f=0;(0<=h?f<h:f>h);f+=20){l=l.concat(e(b.slice(f,f+20)))}if(c.elems){return c.elems}else{return this}}});a.fn.embedly=function(d,g){var e=typeof d!="undefined"?d:{};if(typeof g!="undefined"){d.success=g}var f=new Array();var c=new Array();this.each(function(){if(typeof a(this).attr("href")!="undefined"){f.push(a(this).attr("href"));c.push(a(this))}else{a(this).find("a").each(function(){f.push(a(this).attr("href"));c.push(a(this))})}e.elems=c});var b=a.embedly(f,e);return this}})(jQuery);
+(function(a){window.embedlyURLre=/(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/;a.embedly=a.embedly||{};if(a.embedly.version){return}a.extend({embedly:function(j,p,m){var b=[];var o="http://api.embed.ly/";var c;if(typeof p!="undefined"){c=a.extend(a.embedly.defaults,p)}else{c=a.embedly.defaults}if(!c.urlRe){c.urlRe=window.embedlyURLre}if(typeof j=="string"){j=new Array(j)}if(typeof m!="undefined"){c.success=m}if(c.secure){o="https://api.embed.ly/"}if(c.success==null){c.success=function(i,s){var q,r=a(s.node);if(!(i)){return null}if((q=c.method)==="replace"){return r.replaceWith(i.code)}else{if(q==="after"){return r.after(i.code)}else{if(q==="afterParent"){return r.parent().after(i.code)}else{if(q==="replaceParent"){return r.parent().replaceWith(i.code)}}}}}}if(c.error==null){c.error=function(i,q){}}var l=function(i){return c.urlRe.test(i)};var n=function(q){var i="urls="+q;if(c.maxWidth!=null){i+="&maxwidth="+c.maxWidth}else{if(typeof dimensions!="undefined"){i+="&maxwidth="+dimensions.width}}if(c.maxHeight!=null){i+="&maxheight="+c.maxHeight}if(c.chars!=null){i+="&chars="+c.chars}if(c.words!=null){i+="&words="+c.words}i+="&wmode="+c.wmode;if(typeof c.key=="string"){i+="&key="+c.key}if(typeof c.autoplay=="string"||typeof c.autoplay=="boolean"){i+="&autoplay="+c.autoplay}if(c.width){i+="&width="+c.width}return i};var h=function(){if(typeof c.key=="string"){if(c.endpoint.search(/objectify/i)>=0){return o+"2/objectify"}else{if(c.endpoint.search(/preview/i)>=0){return o+"1/preview"}}}return o+"1/oembed"};var f=function(i,u){if(c.endpoint!="oembed"){return c.success(i,u)}var q,s,r,t;if((q=i.type)==="photo"){t=i.title||"";r=[];if(c.addImageStyles){if(c.maxWidth){units=isNaN(parseInt(c.maxWidth))?"":"px";r.push("max-width: "+(c.maxWidth)+units)}if(c.maxHeight){units=isNaN(parseInt(c.maxHeight))?"":"px";r.push("max-height: "+(c.maxHeight)+units)}}r=r.join(";");s="<a href='"+u.url+"' target='_blank'><img style='"+r+"' src='"+i.url+"' alt='"+t+"' /></a>"}else{if(q==="video"){s=i.html}else{if(q==="rich"){s=i.html}else{t=i.title||u.url;thumb=i.thumbnail_url?'<img src="'+i.thumbnail_url+'" class="thumb" />':"";description=i.description?'<div class="description">'+i.description+"</div>":"";provider=i.provider_name?'<a href="'+i.provider_url+'" class="provider">'+i.provider_name+"</a>":"";s=thumb+"<a href='"+u.url+"'>"+t+"</a>";s+=provider;s+=description}}}if(c.wrapElement&&c.wrapElement=="div"&&a.browser.msie&&a.browser.version<9){c.wrapElement="span"}if(c.wrapElement){s="<"+c.wrapElement+' class="'+c.className+'">'+s+"</"+c.wrapElement+">"}i.code=s;if(typeof u.node!="undefined"){a(u.node).data("oembed",i).trigger("embedly-oembed",[i])}return c.success(i,u)};var d=function(i){var r,t,s,q;s=a.map(i,function(v,u){if(u==0){if(v.node!==null){node=a(v.node);q={width:node.parent().width(),height:node.parent().height()}}}return encodeURIComponent(v.url)}).join(",");a.ajax({url:h(),dataType:"jsonp",data:n(s),success:function(u){return a.each(u,function(v,w){return w.type!="error"?f(w,i[v]):c.error(i[v].node,w)})}})};a.each(j,function(r,q){node=typeof c.elems!=="undefined"?c.elems[r]:null;if(typeof node!="undefined"&&!l(q)){a(node).data("oembed",false)}var s={url:q,error_code:400,error_message:"HTTP 400: Bad Request",type:"error"};return(q&&l(q))?b.push({url:q,node:node}):c.error(node,s)});var k=[];var g=b.length;for(var e=0;(0<=g?e<g:e>g);e+=20){k=k.concat(d(b.slice(e,e+20)))}if(c.elems){return c.elems}else{return this}}});a.embedly.version="2.1.6";a.embedly.defaults={endpoint:"oembed",chars:null,words:null,maxWidth:null,maxHeight:null,secure:false,frame:false,wmode:"opaque",autoplay:null,width:null,method:"replace",addImageStyles:true,wrapElement:"div",className:"embed",urlRe:null,key:null,elems:[],success:null,error:null};a.fn.embedly=function(d,g){var e=typeof d!="undefined"?d:{};if(typeof g!="undefined"){d.success=g}var f=new Array();var c=new Array();this.each(function(){if(typeof a(this).attr("href")!="undefined"){f.push(a(this).attr("href"));c.push(a(this))}else{a(this).find("a").each(function(){f.push(a(this).attr("href"));c.push(a(this))})}e.elems=c});var b=a.embedly(f,e);return this}})(jQuery);
Please sign in to comment.
Something went wrong with that request. Please try again.