searchViz 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/searchViz/version.rb +1 -1
- data/vendor/assets/javascripts/searchViz.js +54 -61
- metadata +1 -1
data/lib/searchViz/version.rb
CHANGED
@@ -1,68 +1,62 @@
|
|
1
|
-
|
1
|
+
var AjaxGet, AjaxPut, HashDataLoad, OnHashDataLoad, hashUrlParse, searchViz, searchVizCookie, searchVizHashRemove;
|
2
2
|
|
3
|
-
function
|
4
|
-
|
3
|
+
searchVizHashRemove = function(urlrpeplaceH) {
|
4
|
+
window.location.hash = "";
|
5
5
|
};
|
6
6
|
|
7
|
-
function
|
7
|
+
searchVizCookie = function(urlrpeplaceRP, urlrpeplaceH, opt) {
|
8
8
|
try {
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
window.location.hash = urlrpeplaceH;
|
33
|
-
}
|
34
|
-
}
|
35
|
-
else {
|
36
|
-
window.location.href= urlrpeplaceRP;
|
37
|
-
}
|
38
|
-
}
|
39
|
-
catch(err) {
|
40
|
-
window.location.href= urlrpeplaceRP;
|
9
|
+
if (opt === "R") {
|
10
|
+
history.replaceState(null, document.title, urlrpeplaceRP);
|
11
|
+
} else if (opt === "P") {
|
12
|
+
history.pushState(null, document.title, urlrpeplaceRP);
|
13
|
+
} else if (opt === "H") {
|
14
|
+
window.location.hash = urlrpeplaceH;
|
15
|
+
} else if (opt === "RtH") {
|
16
|
+
try {
|
17
|
+
history.pushState(null, document.title, urlrpeplaceRP);
|
18
|
+
} catch (err) {
|
19
|
+
window.location.hash = urlrpeplaceH;
|
20
|
+
}
|
21
|
+
} else if (opt === "PtH") {
|
22
|
+
try {
|
23
|
+
history.replaceState(null, document.title, urlrpeplaceRP);
|
24
|
+
} catch (err) {
|
25
|
+
window.location.hash = urlrpeplaceH;
|
26
|
+
}
|
27
|
+
} else {
|
28
|
+
window.location.href = urlrpeplaceRP;
|
29
|
+
}
|
30
|
+
} catch (err) {
|
31
|
+
window.location.href = urlrpeplaceRP;
|
41
32
|
}
|
42
33
|
};
|
43
34
|
|
44
|
-
function
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
35
|
+
OnHashDataLoad = function(blk_id, path_call, ctrl_q, opt) {
|
36
|
+
var hash, path, url, urlh, urlrp;
|
37
|
+
if (opt === "H") {
|
38
|
+
hash = window.location.hash.substring(1);
|
39
|
+
path = window.location.pathname;
|
40
|
+
url = path_call + hash + "&trigger_call=svZ" + "&ctrl_q =" + ctrl_q;
|
41
|
+
urlrp = path + hash;
|
42
|
+
urlh = hash;
|
43
|
+
$.get(url, function(data, status, xhr) {
|
44
|
+
$("#" + blk_id).html(data);
|
45
|
+
return searchVizCookie(urlrp, urlh, "H");
|
46
|
+
});
|
47
|
+
}
|
55
48
|
};
|
56
49
|
|
57
|
-
function
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
50
|
+
HashDataLoad = function(path, hash_data, page_id, q, opt) {
|
51
|
+
var urlh, urlrp;
|
52
|
+
if (opt === "H") {
|
53
|
+
urlrp = path + "?q=" + q + "&page_id=" + page_id + hash_data;
|
54
|
+
urlh = "?q=" + q + "&page_id=" + page_id + hash_data;
|
55
|
+
return searchVizCookie(urlrp, urlh, "H");
|
56
|
+
}
|
63
57
|
};
|
64
58
|
|
65
|
-
function
|
59
|
+
hashUrlParse = function(args) {
|
66
60
|
var i, key, output;
|
67
61
|
output = {};
|
68
62
|
args = args.split("&");
|
@@ -83,8 +77,7 @@ function hashUrlParse(args) {
|
|
83
77
|
return output;
|
84
78
|
};
|
85
79
|
|
86
|
-
|
87
|
-
function searchViz(searchVizForm, e, opt, callback) {
|
80
|
+
searchViz = function(searchVizForm, e, opt, callback) {
|
88
81
|
var action, formData, urlGet, urlrpeplace;
|
89
82
|
e.preventDefault();
|
90
83
|
action = $(searchVizForm).attr("action");
|
@@ -92,7 +85,7 @@ function searchViz(searchVizForm, e, opt, callback) {
|
|
92
85
|
urlGet = action + "?" + formData;
|
93
86
|
urlrpeplace = "?" + formData;
|
94
87
|
searchVizCookie(urlGet, urlrpeplace, opt);
|
95
|
-
|
88
|
+
$.ajax("http://" + window.location.host + "/" + urlGet, {
|
96
89
|
type: "GET",
|
97
90
|
dataType: "json",
|
98
91
|
success: function(data) {
|
@@ -108,8 +101,8 @@ function searchViz(searchVizForm, e, opt, callback) {
|
|
108
101
|
});
|
109
102
|
};
|
110
103
|
|
111
|
-
function
|
112
|
-
|
104
|
+
AjaxPut = function(id, data, callback) {
|
105
|
+
$.ajax("http://" + window.location.host + id, {
|
113
106
|
type: "POST",
|
114
107
|
data: JSON.stringify(data),
|
115
108
|
contentType: "text/json",
|
@@ -126,8 +119,8 @@ function AjaxPut(id, data, callback) {
|
|
126
119
|
});
|
127
120
|
};
|
128
121
|
|
129
|
-
function
|
130
|
-
|
122
|
+
AjaxGet = function(id, callback) {
|
123
|
+
$.ajax("http://" + window.location.host + id, {
|
131
124
|
type: "GET",
|
132
125
|
dataType: "json",
|
133
126
|
success: function(data) {
|