scratch – Blame information for rev 75
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
75 | office | 1 | Cross Browser Zoom and Pixel Ratio Detector |
2 | ====== |
||
3 | ------ |
||
4 | |||
5 | ### Known issues: |
||
6 | * In Firefox on retina displays (Macbook Pros), the base zoom level is always 2.0. I'm aware of it and looking for a solution. |
||
7 | * In some multi-monitor enviroments where each monitor has a different 'pixel aspect ratio' windows that span accross both monitors might return false pixelAspectRatio values. |
||
8 | |||
9 | What is this for? |
||
10 | ------ |
||
11 | Detecting the browser zoom level and device pixel ratio relative to the zoom level. |
||
12 | |||
13 | It can be used to show higher-resolution `canvas` or `img` when necessary, |
||
14 | to warn users that your site's layout will be broken in their current zoom level, |
||
15 | and much more. |
||
16 | Personally I'm maintaining it to use Detect-zoom in [Wix.com](http://wix.com)'s editor to warn users |
||
17 | that their browser is in zoom mode before saving important changes to their website. |
||
18 | |||
19 | What happend to @yonran? |
||
20 | ------ |
||
21 | Don't worry, he is well. |
||
22 | As of January 2013 [@yonran](https://github.com/yonran) stopped maintaining his source of detect-zoom, and transferred the repository to me. |
||
23 | If you are looking to update previous versions note that there were some breaking changes |
||
24 | |||
25 | * **Major Changes from the latest yonran version:** |
||
26 | * `DetectZoom` object name changed to `detectZoom` |
||
27 | * `DetectZoom.ratio()` is no longer publicly accessible |
||
28 | * Supported browsers: IE8+, FF4+, modern Webkit, mobile Webkit, Opera 11.1+ |
||
29 | * *IE6, IE7, FF 3.6 and Opera 10.x are no longer supported* |
||
30 | * Added support to be loaded as an AMD and CommonJS module |
||
31 | |||
32 | Live Example |
||
33 | ------ |
||
34 | See the Live Example section in |
||
35 | http://tombigel.github.com/detect-zoom/ |
||
36 | |||
37 | Usage |
||
38 | ------ |
||
39 | **Detect-zoom has only two public functions:** |
||
40 | * `zoom()` Returns the zoom level of the user's browser using Javascript. |
||
41 | * `device()` Returns the device pixel ratio multiplied by the zoom level (Read [more about devicePixelRatio](http://www.quirksmode.org/blog/archives/2012/07/more_about_devi.html) at QuirksMode) |
||
42 | |||
43 | ```html |
||
44 | <script src="detect-zoom.js"></script> |
||
45 | <script> |
||
46 | var zoom = detectZoom.zoom(); |
||
47 | var device = detectZoom.device(); |
||
48 | |||
49 | console.log(zoom, device); |
||
50 | </script> |
||
51 | ``` |
||
52 | |||
53 | **AMD Usage** |
||
54 | |||
55 | ```javascript |
||
56 | require(['detect-zoom'], function(detectZoom){ |
||
57 | var zoom = detectZoom.zoom(); |
||
58 | }); |
||
59 | ``` |
||
60 | |||
61 | **Installing with NPM** |
||
62 | |||
63 | ```bash |
||
64 | > npm install detect-zoom |
||
65 | ``` |
||
66 | |||
67 | Changelog |
||
68 | ------ |
||
69 | |||
70 | 2013/4/01 |
||
71 | * Changed WebKit detection from deprecated webkitTextSizeAdjust to webkitMarquee |
||
72 | * Changed WebKitMobile detection from unreliable 'ontouchstart' event (can be triggered on desktops too) to 'orientation' property that is hopefully more reliable |
||
73 | * Minor version bump to 1.0.4 |
||
74 | |||
75 | 2013/3/29 |
||
76 | * Added package.json (thanks [@TCampaigne](https://github.com/TCampaigne)) |
||
77 | * Some documentation fixes |
||
78 | * Added detect-zoom to npm package manager (again, thanks [@TCampaigne](https://github.com/TCampaigne)) |
||
79 | |||
80 | 2013/2/25 |
||
81 | * Fixed a missing 'else' between ie8 and ie10 detection |
||
82 | * Minor version bump to 1.0.2 |
||
83 | |||
84 | 2013/2/15 |
||
85 | * Added a fix for IE10 Metro (or whatever MS calls it these days..) by [@stefanvanburen](https://github.com/stefanvanburen) |
||
86 | * Minor version bump to 1.0.1 |
||
87 | * Added minimized version |
||
88 | |||
89 | 2013/2/05 |
||
90 | * Merged a pull request that fixed zoom on IE being returned X100 (thanks [@kreymerman](https://github.com/kreymerman)) |
||
91 | * Refactored the code some more, changed some function names |
||
92 | * Browser dependent main function is created only on initialization (thanks [@jsmaker](https://github.com/jsmaker)) |
||
93 | * _Open Issue: Firefox returns `zoom` and `devicePixelRatio` the same. Still looking for a solution here._ |
||
94 | * Started versioning - this is version 1.0.0 |
||
95 | |||
96 | 2013/1/27 |
||
97 | * Added a fix to Mozilla's (Broken as I see it - https://bugzilla.mozilla.org/show_bug.cgi?id=809788) |
||
98 | implementation of window.devicePixel starting Firefox 18 |
||
99 | |||
100 | 2013/1/26 |
||
101 | * Repository moved here |
||
102 | * Refactored most of the code |
||
103 | * Removed support for older browsers |
||
104 | * Added support for AMD and CommonJS |
||
105 | |||
106 | |||
107 | Help Needed |
||
108 | ------ |
||
109 | |||
110 | ***Detect-zoom is not complete, many parts of the code are 6 to 12 months old and I'm still reviewing them |
||
111 | I need help testing different browsers, finding better ways to measure zoom on problematic browsers (ahm.. Firefox.. ahm) |
||
112 | patches are more than welcome.*** |
||
113 | |||
114 | |||
115 | License |
||
116 | ------ |
||
117 | |||
118 | Detect-zoom is dual-licensed under the [WTFPL](http://www.wtfpl.net/about/) and [MIT](http://opensource.org/licenses/MIT) license, at the recipient's choice. |