-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathurlobject.js
More file actions
82 lines (71 loc) · 1.77 KB
/
urlobject.js
File metadata and controls
82 lines (71 loc) · 1.77 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
//url DATA////////////////////////////////
function urlData()
{
this.pathgen = false;
this.urlread = false;
this.cleanurl = true;
this.getUrlVar= function(variable)
{
var urlsobj ={};
var full = window.location.href;
var qstring = full.split("?");
if(qstring[1])
{
var vars = qstring[1].split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
urlsobj[pair[0]]=pair[1];
if(pair[0] == variable){return pair[1];}
}
return(false);
this.urlread = true;
}//end if qssting
//this.urlsobj = urlsobj;
// return urlsobj;
}
this.runUrl=function(calllback)
{
console.log("<--------- start url read --------->");
var start = this.getUrlVar("start");
var starttype = this.getUrlVar("stype");
var target = this.getUrlVar("target");
var targettype = this.getUrlVar("ttype");
var searchterm = this.getUrlVar("find");
var searchscope = this.getUrlVar("scope");
var searchaction = this.getUrlVar("action");
if(start)
{
console.log("- url start found:"+ start);
if(starttype)
{
this.cleanurl = false;
this.setStart(start,starttype);
console.log("- url start type found:"+ starttype);
}
else
{
console.error("url error: no start type found");
}
}
if(target)
{
console.log("- target found:"+ target);
if(targettype)
{
this.cleanurl = false;
console.log("- target type found:"+ targettype);
this.setTarget(target,targettype);
}
else
{
console.error("url error: not vaild target type");
}
}
if(this.astarcore.foundstart && this.astarcore.foundtarget)
{
this.astarcore.runAstar();
this.astarcore.genPath();
this.pathgen = true}
console.log("<--------- end url read --------->");
}//runUrl
}//END OF Url DATA///////////////////////