From c2c71ca06de159f018dde51c11c2573c32ac1c07 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Fri, 27 May 2016 15:30:36 +0200 Subject: [PATCH] Improved pasting images on retina devices. --- app/assets/javascripts/application.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js index 8bb82de7d..6a168d270 100644 --- a/app/assets/javascripts/application.js +++ b/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();