material 0.8.3 → 0.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +3 -3
- package/package.json +1 -1
- package/src/module/device.js +7 -19
package/index.js
CHANGED
|
@@ -30,12 +30,12 @@ import Textfield from './src/textfield'
|
|
|
30
30
|
import Toolbar from './src/toolbar'
|
|
31
31
|
import Tooltip from './src/tooltip'
|
|
32
32
|
import View from './src/view'
|
|
33
|
-
import events from './src/module/events'
|
|
34
33
|
import attributes from './src/module/attributes'
|
|
35
34
|
import build from './src/module/build'
|
|
36
35
|
import dataset from './src/module/dataset'
|
|
36
|
+
import device from './src/module/device'
|
|
37
37
|
import display from './src/mixin/display'
|
|
38
|
-
import events from './src/module/
|
|
38
|
+
import events from './src/module/events'
|
|
39
39
|
import emitter from './src/module/emitter'
|
|
40
40
|
import jsonToHTML from './src/module/jsontohtml'
|
|
41
41
|
import mediator from './src/module/mediator'
|
|
@@ -46,6 +46,6 @@ export {
|
|
|
46
46
|
AppBar, Button, Card, Checkbox, Component, DateHour, Dialog, Drawer, Element,
|
|
47
47
|
File, Form, Image, Layout, List, Loading, Menu, Navigation, Progress, Select,
|
|
48
48
|
Selecter, Slider, Snackbar, Switch, Switcher, Tabs, TabView, Text, Textfield, Toolbar, Tooltip,
|
|
49
|
-
View,
|
|
49
|
+
View, attributes, build, dataset, device, display, events, emitter, jsonToHTML, mediator,
|
|
50
50
|
observer, smoothscroll
|
|
51
51
|
}
|
package/package.json
CHANGED
package/src/module/device.js
CHANGED
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
const previousDevice = window.device
|
|
5
5
|
|
|
6
6
|
const device = {}
|
|
7
|
-
|
|
7
|
+
const os = ['ios', 'iphone', 'ipad', 'ipod', 'android', 'blackberry', 'macos', 'windows', 'fxos', 'meego', 'television']
|
|
8
|
+
const type = ['mobile', 'tablet', 'desktop']
|
|
8
9
|
const changeOrientationList = []
|
|
9
10
|
|
|
10
11
|
// Add device as a global object.
|
|
@@ -237,7 +238,7 @@ function removeClass (className) {
|
|
|
237
238
|
}
|
|
238
239
|
|
|
239
240
|
function cleanClasses () {
|
|
240
|
-
const classes = [
|
|
241
|
+
const classes = [...os, ...type]
|
|
241
242
|
for (let i = 0; i < classes.length; i++) {
|
|
242
243
|
removeClass(classes[i])
|
|
243
244
|
}
|
|
@@ -362,20 +363,8 @@ function findMatch (arr) {
|
|
|
362
363
|
return 'unknown'
|
|
363
364
|
}
|
|
364
365
|
|
|
365
|
-
device.type = findMatch(
|
|
366
|
-
device.os = findMatch(
|
|
367
|
-
'ios',
|
|
368
|
-
'iphone',
|
|
369
|
-
'ipad',
|
|
370
|
-
'ipod',
|
|
371
|
-
'android',
|
|
372
|
-
'blackberry',
|
|
373
|
-
'macos',
|
|
374
|
-
'windows',
|
|
375
|
-
'fxos',
|
|
376
|
-
'meego',
|
|
377
|
-
'television'
|
|
378
|
-
])
|
|
366
|
+
device.type = findMatch(type)
|
|
367
|
+
device.os = findMatch(os)
|
|
379
368
|
|
|
380
369
|
function setOrientationCache () {
|
|
381
370
|
device.orientation = findMatch(['portrait', 'landscape'])
|
|
@@ -388,9 +377,8 @@ device.onDeviceChange = null
|
|
|
388
377
|
|
|
389
378
|
function updateDeviceDetection () {
|
|
390
379
|
userAgent = window.navigator.userAgent.toLowerCase()
|
|
391
|
-
|
|
392
|
-
device.
|
|
393
|
-
device.os = findMatch(['ios', 'iphone', 'ipad', 'ipod', 'android', 'blackberry', 'macos', 'windows', 'fxos', 'meego', 'television'])
|
|
380
|
+
device.type = findMatch(type)
|
|
381
|
+
device.os = findMatch(os)
|
|
394
382
|
setOrientationCache()
|
|
395
383
|
applyClass()
|
|
396
384
|
checkAndHandleDeviceChange()
|