|
12 | 12 | document.body.style.position = "relative";
|
13 | 13 | var origtop = document.body.style.top;
|
14 | 14 | var toppx = 59;
|
15 |
| - var devices = [ |
| 15 | + var allDevices = [ |
16 | 16 | {
|
17 | 17 | type: "all",
|
18 | 18 | displayText: "All",
|
|
32 | 32 | maxWidth: 1024
|
33 | 33 | },
|
34 | 34 | {
|
35 |
| - type: "desktop", |
36 |
| - displayText: "Desktop", |
| 35 | + type: "desktop-1366", |
| 36 | + displayText: "Desktop - 1366", |
37 | 37 | minWidth: 1024,
|
38 |
| - maxWidth: 10240 |
| 38 | + maxWidth: 1366 |
| 39 | + }, |
| 40 | + { |
| 41 | + type: "desktop-1440", |
| 42 | + displayText: "Desktop - 1440", |
| 43 | + minWidth: 1366, |
| 44 | + maxWidth: 1440 |
| 45 | + }, |
| 46 | + { |
| 47 | + type: "desktop-1600", |
| 48 | + displayText: "Desktop - 1600", |
| 49 | + minWidth: 1440, |
| 50 | + maxWidth: 1600 |
| 51 | + }, |
| 52 | + { |
| 53 | + type: "desktop-1920", |
| 54 | + displayText: "Desktop - 1920", |
| 55 | + minWidth: 1600, |
| 56 | + maxWidth: 1920 |
39 | 57 | },
|
| 58 | + { |
| 59 | + type: "desktop-other", |
| 60 | + displayText: "Desktop - Other", |
| 61 | + minWidth: null, |
| 62 | + maxWidth: 10240 |
| 63 | + } |
40 | 64 | ];
|
41 | 65 |
|
| 66 | + var devices = []; |
| 67 | + |
42 | 68 | if (origtop) {
|
43 | 69 | toppx += parseInt(origtop);
|
44 | 70 | }
|
|
49 | 75 | topbar.setAttribute("id", "cly-heatmap-topbar");
|
50 | 76 | document.body.appendChild(topbar);
|
51 | 77 |
|
52 |
| - |
53 |
| - |
54 | 78 | if (currentDevice.length) {
|
55 | 79 | pageWidth = Countly._internals.getDocWidth();
|
56 | 80 | pageWidth = Math.min(currentDevice[0].maxWidth, pageWidth);
|
|
62 | 86 | else {
|
63 | 87 | pageWidth = Countly._internals.getDocWidth();
|
64 | 88 | pageHeight = Countly._internals.getDocHeight() - toppx;
|
| 89 | + } |
| 90 | + |
| 91 | + for (var i = 0; i < allDevices.length; i++) { |
| 92 | + if (allDevices[i].type == "all") { |
| 93 | + devices.push(allDevices[i]); |
| 94 | + } |
| 95 | + |
| 96 | + if (allDevices[i].maxWidth <= pageWidth) { |
| 97 | + devices.push(allDevices[i]); |
| 98 | + } |
| 99 | + |
| 100 | + if (allDevices[i].type === "desktop-other") { |
| 101 | + devices.push(allDevices[i]); |
| 102 | + devices[devices.length - 1].minWidth = devices[devices.length - 2].maxWidth; |
| 103 | + } |
| 104 | + } |
| 105 | + |
| 106 | + if (!currentDevice.length) { |
65 | 107 | currentDevice = devices.filter((deviceObj) => {
|
66 | 108 | return deviceObj.minWidth < pageWidth && deviceObj.maxWidth >= pageWidth && deviceObj.type != "all";
|
67 | 109 | });
|
|
205 | 247 | if (device.type == "all") {
|
206 | 248 | return deviceObj.type == "all";
|
207 | 249 | }
|
| 250 | + else if (device.type == "desktop-other") { |
| 251 | + return deviceObj.type == "desktop-other"; |
| 252 | + } |
208 | 253 | else {
|
209 | 254 | return deviceObj.minWidth < pageWidth && deviceObj.maxWidth >= pageWidth && deviceObj.type != "all";
|
210 | 255 | }
|
|
305 | 350 | if (currentDevice[0].type == "all") {
|
306 | 351 | return deviceObj.type == "all";
|
307 | 352 | }
|
| 353 | + else if (currentDevice[0].type == "desktop-other") { |
| 354 | + return deviceObj.type == "desktop-other"; |
| 355 | + } |
308 | 356 | else {
|
309 | 357 | return deviceObj.minWidth < pageWidth && deviceObj.maxWidth >= pageWidth && deviceObj.type != "all";
|
310 | 358 | }
|
|
473 | 521 | }
|
474 | 522 |
|
475 | 523 | function loadData() {
|
476 |
| - sendXmlHttpRequest({ app_key: Countly.app_key, view: Countly._internals.getLastView() || window.location.pathname, period: period, deviceType: currentDevice[0].type, actionType: actionType }, apiPath, function(err, clicks) { |
| 524 | + sendXmlHttpRequest({ app_key: Countly.app_key, view: Countly._internals.getLastView() || window.location.pathname, period: period, device: JSON.stringify(currentDevice[0]), actionType: actionType }, apiPath, function(err, clicks) { |
477 | 525 | if (!err) {
|
478 | 526 | dataCache[currentDevice[0].type] = clicks.data;
|
479 | 527 | drawData();
|
|
538 | 586 | }
|
539 | 587 |
|
540 | 588 | function loadData() {
|
541 |
| - sendXmlHttpRequest({ app_key: Countly.app_key, view: Countly._internals.getLastView() || window.location.pathname, period: period, deviceType: currentDevice[0].type, actionType: actionType }, apiPath, function(err, scrolls) { |
| 589 | + sendXmlHttpRequest({ app_key: Countly.app_key, view: Countly._internals.getLastView() || window.location.pathname, period: period, device: JSON.stringify(currentDevice[0]), actionType: actionType }, apiPath, function(err, scrolls) { |
542 | 590 | if (!err) {
|
543 | 591 | dataCache[currentDevice[0].type] = scrolls.data;
|
544 | 592 | drawData();
|
|
0 commit comments