Skip to content

Commit ccd7121

Browse files
author
zhenshuai
committed
-- New: wtRetina
1 parent 926ebe1 commit ccd7121

File tree

5 files changed

+76
-4
lines changed

5 files changed

+76
-4
lines changed

dist/angular-wt-genius-min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-wt-genius.js

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ angular.module('wt.genius', []);
55
* Version: 1.0.0 - 2015-08-25
66
* Anthor: zhenshuai
77
*/
8-
98
(function () {
109
'use strict';
1110
angular.module('wt.genius')
@@ -86,4 +85,41 @@ angular.module('wt.genius', []);
8685
}
8786
];
8887
}]);
88+
})();
89+
/**
90+
* $wtRetina
91+
*
92+
* Version: 1.0.0 - 2015-10-19
93+
* Anthor: zhenshuai
94+
*/
95+
(function () {
96+
'use strict';
97+
angular.module('wt.genius')
98+
.provider('$wtRetina', [function () {
99+
var defaults = {
100+
onchange: function () {
101+
//console.log('dpi 切换事件');
102+
}
103+
};
104+
var configOptions = {};
105+
this.config = function (value) {
106+
configOptions = value;
107+
};
108+
this.$get = [
109+
function () {
110+
var mediaQuery = "(min--moz-device-pixel-ratio: 1.5),\
111+
(-o-min-device-pixel-ratio: 3/2),\
112+
(-webkit-min-device-pixel-ratio: 1.5),\
113+
(min-device-pixel-ratio: 1.5),\
114+
(min-resolution: 144dpi),\
115+
(min-resolution: 1.5dppx)";
116+
117+
var matchObj = window.matchMedia(mediaQuery);
118+
return {
119+
isRetina: matchObj.matches,
120+
media : matchObj.media
121+
};
122+
}
123+
];
124+
}]);
89125
})();

gulpfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ gulp.task('style', function () {
2929
.pipe(gulp.dest('./dist/'));
3030
});
3131
gulp.task('js', function () {
32-
return gulp.src(['./src/main.js', './src/wt-notify/wt-notify.js'])
32+
return gulp.src(['./src/main.js', './src/*/*.js'])
3333
.pipe(plumber({errorHandler: error}))
3434
.pipe(concat('angular-wt-genius.js'))
3535
.pipe(gulp.dest('./dist/'));

src/wt-notify/wt-notify.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
* Version: 1.0.0 - 2015-08-25
55
* Anthor: zhenshuai
66
*/
7-
87
(function () {
98
'use strict';
109
angular.module('wt.genius')

src/wt-retina/wt-retina.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* $wtRetina
3+
*
4+
* Version: 1.0.0 - 2015-10-19
5+
* Anthor: zhenshuai
6+
*/
7+
(function () {
8+
'use strict';
9+
angular.module('wt.genius')
10+
.provider('$wtRetina', [function () {
11+
var defaults = {
12+
onchange: function () {
13+
//console.log('dpi 切换事件');
14+
}
15+
};
16+
var configOptions = {};
17+
this.config = function (value) {
18+
configOptions = value;
19+
};
20+
this.$get = [
21+
function () {
22+
var mediaQuery = "(min--moz-device-pixel-ratio: 1.5),\
23+
(-o-min-device-pixel-ratio: 3/2),\
24+
(-webkit-min-device-pixel-ratio: 1.5),\
25+
(min-device-pixel-ratio: 1.5),\
26+
(min-resolution: 144dpi),\
27+
(min-resolution: 1.5dppx)";
28+
29+
var matchObj = window.matchMedia(mediaQuery);
30+
return {
31+
isRetina: matchObj.matches,
32+
media : matchObj.media
33+
};
34+
}
35+
];
36+
}]);
37+
})();

0 commit comments

Comments
 (0)