picturefill-rails 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ var Query=function(a){"use strict";var b=function(a){var b=[],c,d,e,f;if(typeof a=="undefined"||a===null||a==="")return b;a.indexOf("?")===0&&(a=a.substring(1)),d=a.toString().split(/[&;]/);for(c=0;c<d.length;c++)e=d[c],f=e.split("="),b.push([f[0],f[1]]);return b},c=b(a),d=function(){var a="",b,d;for(b=0;b<c.length;b++)d=c[b],a.length>0&&(a+="&"),a+=d.join("=");return a.length>0?"?"+a:a},e=function(a){return a=decodeURIComponent(a),a=a.replace("+"," "),a},f=function(a){var b,d;for(d=0;d<c.length;d++){b=c[d];if(e(a)===e(b[0]))return b[1]}},g=function(a){var b=[],d,f;for(d=0;d<c.length;d++)f=c[d],e(a)===e(f[0])&&b.push(f[1]);return b},h=function(a,b){var d=[],f,g,h,i;for(f=0;f<c.length;f++)g=c[f],h=e(g[0])===e(a),i=e(g[1])===e(b),(arguments.length===1&&!h||arguments.length===2&&!h&&!i)&&d.push(g);return c=d,this},i=function(a,b,d){return arguments.length===3&&d!==-1?(d=Math.min(d,c.length),c.splice(d,0,[a,b])):arguments.length>0&&c.push([a,b]),this},j=function(a,b,d){var f=-1,g,j;if(arguments.length===3){for(g=0;g<c.length;g++){j=c[g];if(e(j[0])===e(a)&&decodeURIComponent(j[1])===e(d)){f=g;break}}h(a,d).addParam(a,b,f)}else{for(g=0;g<c.length;g++){j=c[g];if(e(j[0])===e(a)){f=g;break}}h(a),i(a,b,f)}return this};return{getParamValue:f,getParamValues:g,deleteParam:h,addParam:i,replaceParam:j,toString:d}},Uri=function(a){"use strict";var b=!1,c=function(a){var c={strict:/^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,loose:/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/},d=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"],e={name:"queryKey",parser:/(?:^|&)([^&=]*)=?([^&]*)/g},f=c[b?"strict":"loose"].exec(a),g={},h=14;while(h--)g[d[h]]=f[h]||"";return g[e.name]={},g[d[12]].replace(e.parser,function(a,b,c){b&&(g[e.name][b]=c)}),g},d=c(a||""),e=new Query(d.query),f=function(a){return typeof a!="undefined"&&(d.protocol=a),d.protocol},g=null,h=function(a){return typeof a!="undefined"&&(g=a),g===null?d.source.indexOf("//")!==-1:g},i=function(a){return typeof a!="undefined"&&(d.userInfo=a),d.userInfo},j=function(a){return typeof a!="undefined"&&(d.host=a),d.host},k=function(a){return typeof a!="undefined"&&(d.port=a),d.port},l=function(a){return typeof a!="undefined"&&(d.path=a),d.path},m=function(a){return typeof a!="undefined"&&(e=new Query(a)),e},n=function(a){return typeof a!="undefined"&&(d.anchor=a),d.anchor},o=function(a){return f(a),this},p=function(a){return h(a),this},q=function(a){return i(a),this},r=function(a){return j(a),this},s=function(a){return k(a),this},t=function(a){return l(a),this},u=function(a){return m(a),this},v=function(a){return n(a),this},w=function(a){return m().getParamValue(a)},x=function(a){return m().getParamValues(a)},y=function(a,b){return arguments.length===2?m().deleteParam(a,b):m().deleteParam(a),this},z=function(a,b,c){return arguments.length===3?m().addParam(a,b,c):m().addParam(a,b),this},A=function(a,b,c){return arguments.length===3?m().replaceParam(a,b,c):m().replaceParam(a,b),this},B=function(){var a="",b=function(a){return a!==null&&a!==""};return b(f())?(a+=f(),f().indexOf(":")!==f().length-1&&(a+=":"),a+="//"):h()&&b(j())&&(a+="//"),b(i())&&b(j())&&(a+=i(),i().indexOf("@")!==i().length-1&&(a+="@")),b(j())&&(a+=j(),b(k())&&(a+=":"+k())),b(l())?a+=l():b(j())&&(b(m().toString())||b(n()))&&(a+="/"),b(m().toString())&&(m().toString().indexOf("?")!==0&&(a+="?"),a+=m().toString()),b(n())&&(n().indexOf("#")!==0&&(a+="#"),a+=n()),a},C=function(){return new Uri(B())};return{protocol:f,hasAuthorityPrefix:h,userInfo:i,host:j,port:k,path:l,query:m,anchor:n,setProtocol:o,setHasAuthorityPrefix:p,setUserInfo:q,setHost:r,setPort:s,setPath:t,setQuery:u,setAnchor:v,getQueryParamValue:w,getQueryParamValues:x,deleteQueryParam:y,addQueryParam:z,replaceQueryParam:A,toString:B,clone:C}},jsUri=Uri;(function(a){function h(a){this.imageCandidates=[],this.srcValue=a.src,this.srcsetValue=a.srcset,this.isValid=!0,this.error="",this._parse(this.srcsetValue),this.isValid||console.error("Error: "+this.error)}function i(a){this.src=a.src,this.w=a.w||Infinity,this.h=a.h||Infinity,this.x=a.x||1}var b="[-a-zA-Z0-9@:%_+.~#?&//=]*",c="\\s*("+b+")\\s*([0-9xwh.\\s]*)",d="("+c+",?)+",e=new RegExp(c),f=new RegExp(d),g=/^[0-9]+$/;h.prototype._parse=function(){var a=this.srcsetValue.split(",");for(var b=0;b<a.length;b++){var c=a[b],d=c.match(e),f=d[1],g=this._parseDescriptors(d[2]),h=new i({src:d[1],x:g.x,w:g.w,h:g.h});this._addCandidate(h)}this.srcValue&&this._addCandidate(new i({src:this.srcValue}))},h.prototype._addCandidate=function(a){for(var b=0;b<this.imageCandidates.length;b++){var c=this.imageCandidates[b];if(c.x==a.x&&c.w==a.w&&c.h==a.h)return}this.imageCandidates.push(a)},h.prototype._parseDescriptors=function(a){var b=a.split(/\s/),c={};for(var d=0;d<b.length;d++){var e=b[d];if(e.length>0){var f=e[e.length-1],h=e.substring(0,e.length-1),i=parseInt(h,10),j=parseFloat(h);h.match(g)&&f==="w"?c[f]=i:h.match(g)&&f=="h"?c[f]=i:!isNaN(j)&&f=="x"?c[f]=j:(this.error='Invalid srcset descriptor found in "'+e+'".',this.isValid=!1)}}return c},a.SrcsetInfo=h})(window),function(a){function b(){this.w=null,this.h=null,this.x=null}b.prototype.compute=function(){this.w=window.innerWidth,this.h=window.innerHeight,this.x=window.devicePixelRatio},b.prototype.setForTesting=function(a){this.w=a.w,this.h=a.h,this.x=a.x},b.prototype.getBestImage=function(a){var b=a.imageCandidates.slice(0),c=this._getBestCandidateIf(b,function(a,b){return a.w>b.w});this._removeCandidatesIf(b,function(a){return a.w<this.w}.bind(this)),b.length===0&&(b=[c]);var d=this._getBestCandidateIf(b,function(a,b){return a.h>b.h});this._removeCandidatesIf(b,function(a){return a.h<this.h}.bind(this)),b.length===0&&(b=[d]);var e=this._getBestCandidateIf(b,function(a,b){return a.x>b.x});this._removeCandidatesIf(b,function(a){return a.x<this.x}.bind(this)),b.length===0&&(b=[e]);var f=this._getBestCandidateIf(b,function(a,b){return a.w<b.w});this._removeCandidatesIf(b,function(a,b){return a.w>f.w});var g=this._getBestCandidateIf(b,function(a,b){return a.h<b.h});this._removeCandidatesIf(b,function(a,b){return a.h>f.h});var h=this._getBestCandidateIf(b,function(a,b){return a.x<b.x});return this._removeCandidatesIf(b,function(a,b){return a.x>h.x}),b[0]},b.prototype._getBestCandidateIf=function(a,b){var c=a[0];for(var d=0;d<a.length;d++){var e=a[d];b(e,c)&&(c=e)}return c},b.prototype._removeCandidatesIf=function(a,b){for(var c=a.length-1;c>=0;c--){var d=a[c];b(d)&&a.splice(c,1)}return a},b.prototype.getBestImage2=function(a){var b=null,c=a.imageCandidates;for(var d=0;d<c.length;d++){var e=c[d],f=b?b.x:0;if(f<=e.x&&e.x<=this.x){if(b===null){b=e;continue}this.w<=e.w&&e.w<=b.w&&(b=e)}}return b},a.ViewportInfo=b}(window),function(a){function b(){var a=new Image;return"srcset"in a}function c(){if(b())return;var a=new ViewportInfo;a.compute();var c=document.querySelectorAll("img");for(var d=0;d<c.length;d++){var e=c[d],f=e.attributes.srcset;if(f){var g=new SrcsetInfo({src:e.src,srcset:f.textContent}),h=a.getBestImage(g);e.src=h.src,e.style.webkitTransform="scale("+1/h.x+")",e.style.webkitTransformOrigin="0 0"}}}window.addEventListener("DOMContentLoaded",c)}(window)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: picturefill-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-16 00:00:00.000000000 Z
12
+ date: 2012-08-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -129,6 +129,20 @@ files:
129
129
  - picturefill-rails.gemspec
130
130
  - spec/picturefill/view_helper_spec.rb
131
131
  - spec/spec_helper.rb
132
+ - spec/srcset/banner-HD.jpeg
133
+ - spec/srcset/banner-phone-HD.jpeg
134
+ - spec/srcset/banner-phone.jpeg
135
+ - spec/srcset/banner.jpeg
136
+ - spec/srcset/index.html
137
+ - spec/srcset/tests/index.html
138
+ - spec/srcset/tests/srcset-tests.js
139
+ - spec/srcset/view_helper_spec.rb
140
+ - vendor/assets/javascripts/jquery-picture.js
141
+ - vendor/assets/javascripts/jquery-picture.min.js
142
+ - vendor/assets/javascripts/picturefill.js
143
+ - vendor/assets/javascripts/picturefill/matchmedia.js
144
+ - vendor/assets/javascripts/srcset.js
145
+ - vendor/assets/javascripts/srcset.min.js
132
146
  homepage: http://github.com/kristianmandrup/picturefill-rails
133
147
  licenses:
134
148
  - MIT
@@ -144,7 +158,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
144
158
  version: '0'
145
159
  segments:
146
160
  - 0
147
- hash: -1817757138162411960
161
+ hash: 3994874896437449825
148
162
  required_rubygems_version: !ruby/object:Gem::Requirement
149
163
  none: false
150
164
  requirements: