Browse Source

Improved pasting images on retina devices.

Martin Edenhofer 8 years ago
parent
commit
c2c71ca06d
1 changed files with 7 additions and 0 deletions
  1. 7 0
      app/assets/javascripts/application.js

+ 7 - 0
app/assets/javascripts/application.js

@@ -165,6 +165,13 @@ function toCamelCase(str) {
     .replace(/^(.)/, function($1) { return $1.toUpperCase(); });
 };
 
+function isRetina(){
+  if (window.matchMedia) {
+    var mq = window.matchMedia("only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 2.6/2), only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen  and (min-device-pixel-ratio: 1.3), only screen and (min-resolution: 1.3dppx)");
+    return (mq && mq.matches || (window.devicePixelRatio > 1));
+  }
+}
+
 jQuery.event.special.remove = {
   remove: function(e) {
     if (e.handler) e.handler();