-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathicm_test.js
More file actions
100 lines (93 loc) · 3.87 KB
/
icm_test.js
File metadata and controls
100 lines (93 loc) · 3.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
jQuery.getScript("https://rawgit.com/eligrey/FileSaver.js/master/FileSaver.js")
//---//
alert("Eingefügt")
patchInterval=setInterval(function(){Object.keys(window).forEach( function(element){
if(element.indexOf("tracking3_route")>-1)
{
if(window[element].patched === true)
{ clearInterval(patchInterval); return}
console.log("tracking_route gefunden. Patchen...");
/* FÜR ROUTENEXPORT
(function(patch_ParseRoute){
window[element].patched = true
window[element].ParseRoute = function(){
pxbutton = $("#GPXExportBtn").remove()
if(jQuery.isArray(arguments[0]) && arguments[0].length > 2)
{
gpxData.Data = arguments[0];
gpxbutton = $("#views div:first-child").clone()
gpxbutton.attr("data-qtitle","GPX Export")
gpxbutton.attr("ID","GPXExportBtn")
gpxbutton.attr("title","GPX Export")
gpxbutton.find("img").attr("src","https://cdn3.iconfinder.com/data/icons/line/36/box_expand-64.png")
gpxbutton.append(document.createElement("a"))
gpxbutton.find("a").attr("download", "export.gpx");
gpxbutton.appendTo($("#views"))
gpxbutton.find("a").append(gpxbutton.find("img").detach())
gpxbutton.click(function(){gpxData.getGPXString();gpxbutton.remove()})
}
patch_ParseRoute.call(this, arguments);
};
}(window[element].ParseRoute))*/
(function(patch_DrawSpecials){
window[element].patched = true
window[element].DrawRouteSpecials = function(){
/* var H = $("*[data-day][class~=checked]", k).attr("data-day");
var J = $("*[data-day][class~=checked]", k).attr("data-userid");
var K = $("*[data-day][class~=checked]", k).attr("data-vehicleid");
var G = $("*[data-day][class~=checked]", k).attr("data-boxid");
var I = i.GetTimeFilter(H);
f5.Query({
query: "Tracking3/RouteSpecials",
post_data: {
day: H,
userId: J,
timeFilterFrom: I.from,
timeFilterTo: I.to
},
callback: function(L) {
myvar = JSON.parse(L).qData;
console.log(myvar)
}
})*/
patch_DrawSpecials.call();
console.log(y)
};
}(window[element].DrawRouteSpecials))
console.log("Patch beendet");
}
})}, 3000)
gpxData = {
Data : "",
GPXString : "",
getGPXString : function (){
console.log("gpxstring start")
var date = new Date();
loadingID = f5.ShowLoading()
loadingdialog = $("#loading_inner_"+loadingID).find("span")
this.GPXString='<?xml version="1.0" encoding="UTF-8" standalone="no" ?>\r\n<gpx version="1.1" creator="ICM TEST">\r\n<metadata>\r\n<name>ICM TEST</name>\r\n</metadata>\r\n';
var len = this.Data.length
console.log(len);
for(var i = 0; i<len ; i++){
var curE = this.Data[i]
//curE.TIMESTAMP.split(".")
var timestamp = "" + curE.TIMESTAMP.substr(6,4) + "-" + curE.TIMESTAMP.substr(3,2) + "-" + curE.TIMESTAMP.substr(0,2) + "T" + curE.TIMESTAMP.substr(11) + ".000Z";
//console.log(timestamp)
//YYYY-MM-DDTHH:mm:ss.sssZ 01.02.2010
//timestamp = timestamp.//toISOString(); Funktioniert nicht wirklich immer.
var posx = curE.POS_X.replace(",",".")
var posy = curE.POS_Y.replace(",",".")
this.GPXString += '<wpt lat="' + posx + '" lon="'+ posy +'">\r\n<time>' + timestamp + '</time>\r\n</wpt>\r\n';
}
this.GPXString += '</gpx>\r\n';
f5.HideLoading(loadingID)
curDate = new Date();
console.log(curDate-date)
var date = new Date();
console.log("gpxstring end")
var blob = new Blob([this.GPXString], {type: "text/plain;charset=utf-8"});
saveAs(blob, "export.gxp");
//gpxbutton.find("a").attr("href","data:text/plain;charset=utf8,"+encodeURIComponent(this.GPXString));
}
}
//void(jQuery.getScript("https://rawgit.com/kkrell2016/d95a99ac80e4da6b724d48364faeda40/raw/ea2280f9906bb6a1c7233754b319353fd6a05ea6/icm.js"))