searchViz 0.0.11 → 0.0.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module SearchViz
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  end
@@ -1,68 +1,62 @@
1
- // Copyright (c) 2012 Fms-shintomon
1
+ var AjaxGet, AjaxPut, HashDataLoad, OnHashDataLoad, hashUrlParse, searchViz, searchVizCookie, searchVizHashRemove;
2
2
 
3
- function searchVizHashRemove(urlrpeplaceH) {
4
- window.location.hash = '';
3
+ searchVizHashRemove = function(urlrpeplaceH) {
4
+ window.location.hash = "";
5
5
  };
6
6
 
7
- function searchVizCookie(urlrpeplaceRP,urlrpeplaceH,opt) {
7
+ searchVizCookie = function(urlrpeplaceRP, urlrpeplaceH, opt) {
8
8
  try {
9
- if (opt=='R') {
10
- history.replaceState(null, document.title, urlrpeplaceRP);
11
- }
12
-
13
- else if (opt=='P') {
14
- history.pushState(null, document.title, urlrpeplaceRP);
15
- }
16
- else if (opt=='H'){
17
- window.location.hash = urlrpeplaceH;
18
- }
19
- else if (opt=='RtH') {
20
- try {
21
- history.pushState(null, document.title, urlrpeplaceRP);
22
- }
23
- catch(err){
24
- window.location.hash = urlrpeplaceH;
25
- }
26
- }
27
- else if (opt=='PtH') {
28
- try {
29
- history.replaceState(null, document.title, urlrpeplaceRP);
30
- }
31
- catch(err){
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 OnHashDataLoad(blk_id, path_call, ctrl_q, opt) {
45
- if(opt=="H") {
46
- hash = window.location.hash.substring(1);
47
- path = window.location.pathname;
48
- url = path_call + hash + "&trigger_call=svZ" + "&ctrl_q =" + ctrl_q;
49
- urlrp = path + hash;
50
- urlh = hash;
51
- $.get(url, function(data, status, xhr) {
52
- $("#" + blk_id).html(data);
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 HashDataLoad(path, hash_data, page_id, q, opt) {
58
- if(opt=="H") {
59
- urlrp = path + "?q=" + q + "&page_id=" + page_id + hash_data;
60
- urlh = "?q=" + q + "&page_id=" + page_id + hash_data;
61
- searchVizCookie(urlrp, urlh, "H");
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 hashUrlParse(args) {
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
- return $.ajax("http://" + window.location.host + "/" + urlGet, {
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 AjaxPut(id, data, callback) {
112
- return $.ajax("http://" + window.location.host + id, {
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 AjaxGet(id, callback) {
130
- return $.ajax("http://" + window.location.host + id, {
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) {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: searchViz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: