| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
(function ($) { |
| 9 |
'use strict'; |
| 10 |
|
| 11 |
var browser = { |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
getPageXY: function (e) { |
| 19 |
|
| 20 |
var doc = document.documentElement, |
| 21 |
pageX = e.clientX + (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0), |
| 22 |
pageY = e.clientY + (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0); |
| 23 |
return { X: pageX, Y: pageY }; |
| 24 |
}, |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
getPixelRatio: function(context) { |
| 34 |
var devicePixelRatio = window.devicePixelRatio || 1, |
| 35 |
backingStoreRatio = |
| 36 |
context.webkitBackingStorePixelRatio || |
| 37 |
context.mozBackingStorePixelRatio || |
| 38 |
context.msBackingStorePixelRatio || |
| 39 |
context.oBackingStorePixelRatio || |
| 40 |
context.backingStorePixelRatio || 1; |
| 41 |
return devicePixelRatio / backingStoreRatio; |
| 42 |
}, |
| 43 |
|
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
isSafari: function() { |
| 51 |
|
| 52 |
|
| 53 |
return /constructor/i.test(window.top.HTMLElement) || (function (p) { return p.toString() === "[object SafariRemoteNotification]"; })(!window.top['safari'] || (typeof window.top.safari !== 'undefined' && window.top.safari.pushNotification)); |
| 54 |
}, |
| 55 |
|
| 56 |
isMobileSafari: function() { |
| 57 |
|
| 58 |
return navigator.userAgent.match(/(iPod|iPhone|iPad)/) && navigator.userAgent.match(/AppleWebKit/); |
| 59 |
}, |
| 60 |
|
| 61 |
isOpera: function() { |
| 62 |
|
| 63 |
|
| 64 |
return (!!window.opr && !!opr.addons) || !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0; |
| 65 |
}, |
| 66 |
|
| 67 |
isFirefox: function() { |
| 68 |
|
| 69 |
|
| 70 |
return typeof InstallTrigger !== 'undefined'; |
| 71 |
}, |
| 72 |
|
| 73 |
isIE: function() { |
| 74 |
|
| 75 |
|
| 76 |
return false || !!document.documentMode; |
| 77 |
}, |
| 78 |
|
| 79 |
isEdge: function() { |
| 80 |
|
| 81 |
|
| 82 |
return !browser.isIE() && !!window.StyleMedia; |
| 83 |
}, |
| 84 |
|
| 85 |
isChrome: function() { |
| 86 |
|
| 87 |
|
| 88 |
return !!window.chrome && !!window.chrome.webstore; |
| 89 |
}, |
| 90 |
|
| 91 |
isBlink: function() { |
| 92 |
|
| 93 |
return (browser.isChrome() || browser.isOpera()) && !!window.CSS; |
| 94 |
} |
| 95 |
}; |
| 96 |
|
| 97 |
$.plot.browser = browser; |
| 98 |
})(jQuery); |