searchViz 0.0.7 → 0.0.8
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 +27 -19
- metadata +1 -1
data/lib/searchViz/version.rb
CHANGED
@@ -1,46 +1,46 @@
|
|
1
1
|
// Copyright (c) 2012 Fms-shintomon
|
2
2
|
|
3
|
-
var AjaxGet, AjaxPut, searchViz, searchVizCookie, hashUrlParse, OnHashDataLoad;
|
3
|
+
var AjaxGet, AjaxPut, searchViz, searchVizCookie, hashUrlParse, OnHashDataLoad, HashDataLoad;
|
4
4
|
|
5
5
|
|
6
|
-
searchVizHashRemove = function(
|
6
|
+
searchVizHashRemove = function(urlrpeplaceH) {
|
7
7
|
window.location.hash = '';
|
8
8
|
};
|
9
9
|
|
10
|
-
searchVizCookie = function(
|
10
|
+
searchVizCookie = function(urlrpeplaceRP,urlrpeplaceH,opt) {
|
11
11
|
try {
|
12
12
|
if (opt=='R') {
|
13
|
-
history.replaceState(null, document.title,
|
13
|
+
history.replaceState(null, document.title, urlrpeplaceRP);
|
14
14
|
}
|
15
15
|
|
16
16
|
else if (opt=='P') {
|
17
|
-
history.pushState(null, document.title,
|
17
|
+
history.pushState(null, document.title, urlrpeplaceRP);
|
18
18
|
}
|
19
19
|
else if (opt=='H'){
|
20
|
-
window.location.hash =
|
20
|
+
window.location.hash = urlrpeplaceH;
|
21
21
|
}
|
22
22
|
else if (opt=='RtH') {
|
23
23
|
try {
|
24
|
-
history.pushState(null, document.title,
|
24
|
+
history.pushState(null, document.title, urlrpeplaceRP);
|
25
25
|
}
|
26
26
|
catch(err){
|
27
|
-
window.location.hash =
|
27
|
+
window.location.hash = urlrpeplaceH;
|
28
28
|
}
|
29
29
|
}
|
30
30
|
else if (opt=='PtH') {
|
31
31
|
try {
|
32
|
-
history.replaceState(null, document.title,
|
32
|
+
history.replaceState(null, document.title, urlrpeplaceRP);
|
33
33
|
}
|
34
34
|
catch(err){
|
35
|
-
window.location.hash =
|
35
|
+
window.location.hash = urlrpeplaceH;
|
36
36
|
}
|
37
37
|
}
|
38
38
|
else {
|
39
|
-
window.location.href=
|
39
|
+
window.location.href= urlrpeplaceRP;
|
40
40
|
}
|
41
41
|
}
|
42
42
|
catch(err) {
|
43
|
-
window.location.href=
|
43
|
+
window.location.href= urlrpeplaceRP;
|
44
44
|
}
|
45
45
|
};
|
46
46
|
|
@@ -48,16 +48,24 @@ OnHashDataLoad = function(blk_id, page_id, q, opt) {
|
|
48
48
|
if(opt=="H") {
|
49
49
|
hash = window.location.hash.substring(1);
|
50
50
|
path = window.location.pathname;
|
51
|
-
url = path +
|
52
|
-
|
53
|
-
urlh =
|
51
|
+
url = path + hash + "&trigger_call=svZ";
|
52
|
+
urlrp = path + hash;
|
53
|
+
urlh = hash;
|
54
54
|
$.get(url, function(data, status, xhr) {
|
55
55
|
$("#" + blk_id).html(data);
|
56
|
-
return searchVizCookie(
|
56
|
+
return searchVizCookie(urlrp, urlh, "H");
|
57
57
|
});
|
58
58
|
}
|
59
59
|
};
|
60
60
|
|
61
|
+
HashDataLoad = function(path, hash_data, blk_id, page_id, q, opt) {
|
62
|
+
if(opt=="H") {
|
63
|
+
urlrp = path + "?q=" + q + "&page_id=" + page_id + hash_data;
|
64
|
+
urlh = "?q=" + q + "&page_id=" + page_id + hash_data;
|
65
|
+
return searchVizCookie(urlrp, urlh, "H");
|
66
|
+
}
|
67
|
+
};
|
68
|
+
|
61
69
|
hashUrlParse = function(args) {
|
62
70
|
var i, key, output;
|
63
71
|
output = {};
|
@@ -81,13 +89,13 @@ hashUrlParse = function(args) {
|
|
81
89
|
|
82
90
|
|
83
91
|
searchViz = function(searchVizForm, e, callback) {
|
84
|
-
var action, formData, urlGet,
|
92
|
+
var action, formData, urlGet, urlrpeplace;
|
85
93
|
e.preventDefault();
|
86
94
|
action = $(searchVizForm).attr("action");
|
87
95
|
formData = $(searchVizForm).serialize();
|
88
96
|
urlGet = action + "?" + formData;
|
89
|
-
|
90
|
-
searchVizCookie(urlGet,
|
97
|
+
urlrpeplace = "?" + formData;
|
98
|
+
searchVizCookie(urlGet, urlrpeplace, 'B');
|
91
99
|
return $.ajax("http://" + window.location.host + "/" + urlGet, {
|
92
100
|
type: "GET",
|
93
101
|
dataType: "json",
|