jegtheme

php

Nov 1st, 2013
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. /** javascript **/
  2. (function () {
  3. "use strict";
  4. if (document.cookie.indexOf('device_pixel_ratio') === -1 && 'devicePixelRatio' in window && window.devicePixelRatio === 2) {
  5. var date = new Date();
  6. date.setTime(date.getTime() + 3600000);
  7. document.cookie = 'device_pixel_ratio=' + window.devicePixelRatio + ';' + ' expires=' + date.toUTCString() + '; path=/';
  8.  
  9. if (document.cookie.indexOf('device_pixel_ratio') !== -1) {
  10. window.location.reload();
  11. }
  12. }
  13. })();
  14.  
  15. /** php **/
  16.  
  17. /**
  18. * Detect retina device
  19. */
  20. function jeg_is_retina_device()
  21. {
  22. if(isset($_COOKIE["device_pixel_ratio"])) {
  23. return $_COOKIE["device_pixel_ratio"] > 1;
  24. } else {
  25. return false;
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment