diff options
author | Dennis Eriksen <dennis.se@gmail.com> | 2013-04-24 22:06:38 +0200 |
---|---|---|
committer | Dennis Eriksen <dennis.se@gmail.com> | 2013-04-24 22:06:38 +0200 |
commit | 7c836b53051f7874cd3a5832a0beb047ea9cdb8a (patch) | |
tree | 8032e2cf89a0965a400118be279cd237e31c2fc8 | |
parent | margins corrected (diff) | |
download | Divid-7c836b53051f7874cd3a5832a0beb047ea9cdb8a.tar.gz |
added retinajs
-rw-r--r-- | public/css/retina.less | 12 | ||||
-rw-r--r-- | public/js/retina.js | 3 | ||||
-rw-r--r-- | views/footer.ejs | 1 |
3 files changed, 16 insertions, 0 deletions
diff --git a/public/css/retina.less b/public/css/retina.less new file mode 100644 index 0000000..5de0722 --- /dev/null +++ b/public/css/retina.less @@ -0,0 +1,12 @@ +// retina.less +// A helper mixin for applying high-resolution background images (http://www.retinajs.com) + +.at2x(@path, @w: auto, @h: auto) { + background-image: url(@path); + @at2x_path: ~`"@{path}".split('.').slice(0, "@{path}".split('.').length - 1).join(".") + "@2x" + "." + "@{path}".split('.')["@{path}".split('.').length - 1]`; + + @media all and (-webkit-min-device-pixel-ratio : 1.5) { + background-image: url(@at2x_path); + background-size: @w @h; + } +}
\ No newline at end of file diff --git a/public/js/retina.js b/public/js/retina.js new file mode 100644 index 0000000..a926142 --- /dev/null +++ b/public/js/retina.js @@ -0,0 +1,3 @@ +// retina.js, a high-resolution image swapper (http://retinajs.com), v0.0.2 + +(function(){function t(e){this.path=e;var t=this.path.split("."),n=t.slice(0,t.length-1).join("."),r=t[t.length-1];this.at_2x_path=n+"@2x."+r}function n(e){this.el=e,this.path=new t(this.el.getAttribute("src"));var n=this;this.path.check_2x_variant(function(e){e&&n.swap()})}var e=typeof exports=="undefined"?window:exports;e.RetinaImagePath=t,t.confirmed_paths=[],t.prototype.is_external=function(){return!!this.path.match(/^https?\:/i)&&!this.path.match("//"+document.domain)},t.prototype.check_2x_variant=function(e){var n,r=this;if(this.is_external())return e(!1);if(this.at_2x_path in t.confirmed_paths)return e(!0);n=new XMLHttpRequest,n.open("HEAD",this.at_2x_path),n.onreadystatechange=function(){return n.readyState!=4?e(!1):n.status>=200&&n.status<=399?(t.confirmed_paths.push(r.at_2x_path),e(!0)):e(!1)},n.send()},e.RetinaImage=n,n.prototype.swap=function(e){function n(){t.el.complete?(t.el.setAttribute("width",t.el.offsetWidth),t.el.setAttribute("height",t.el.offsetHeight),t.el.setAttribute("src",e)):setTimeout(n,5)}typeof e=="undefined"&&(e=this.path.at_2x_path);var t=this;n()},e.devicePixelRatio>1&&(window.onload=function(){var e=document.getElementsByTagName("img"),t=[],r,i;for(r=0;r<e.length;r++)i=e[r],t.push(new n(i))})})();
\ No newline at end of file diff --git a/views/footer.ejs b/views/footer.ejs index e480478..2421d82 100644 --- a/views/footer.ejs +++ b/views/footer.ejs @@ -9,6 +9,7 @@ <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="/js/jquery-1.9.0.min.js"><\/script>')</script> <script src="/js/bootstrap.min.js"></script> + <script src="/js/retina.js"></script> <script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), |