searchViz 0.0.1 → 0.0.2

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.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1,10 +1,47 @@
1
1
  // Copyright (c) 2012 Fms-shintomon
2
2
 
3
- var AjaxGet, AjaxPut, searchViz, searchVizHistory;
3
+ var AjaxGet, AjaxPut, searchViz, searchVizHistory, searchVizHash, searchVizCookie;
4
4
 
5
- searchVizHistory = function(urlReplace) {
6
- if (navigator.appName !== "Microsoft Internet Explorer") {
7
- return history.replaceState(null, document.title, urlReplace);
5
+ searchVizHistory = function(urlReplaceR) {
6
+ if (history.pushState) {
7
+ return history.pushState(null, document.title, urlReplaceR);
8
+ }
9
+ };
10
+
11
+ searchVizHash = function(urlReplaceH) {
12
+ if (window.location.hash) {
13
+ window.location.hash = urlReplaceH;
14
+ }
15
+ };
16
+
17
+ searchVizHashRemove = function(urlReplaceH) {
18
+ if (window.location.hash) {
19
+ window.location.hash = '';
20
+ }
21
+ };
22
+
23
+ searchVizCookie = function(urlReplaceR,urlReplaceH,opt) {
24
+ try {
25
+ if (opt='R') {
26
+ searchVizHistory(urlReplaceR)
27
+ }
28
+ else if (opt='H'){
29
+ searchVizHash(urlReplaceH)
30
+ }
31
+ else if (opt='B') {
32
+ try {
33
+ searchVizHistory(urlReplaceR)
34
+ }
35
+ catch(err){
36
+ searchVizHash(urlReplaceH)
37
+ }
38
+ }
39
+ else {
40
+ window.location.href= urlReplaceR;
41
+ }
42
+ }
43
+ catch(err) {
44
+ window.location.href= urlReplaceR;
8
45
  }
9
46
  };
10
47
 
@@ -13,9 +50,9 @@ searchViz = function(searchVizForm, e, callback) {
13
50
  e.preventDefault();
14
51
  action = $(searchVizForm).attr("action");
15
52
  formData = $(searchVizForm).serialize();
16
- urlGet = action + ".json?" + formData;
17
- urlReplace = action + "?" + formData;
18
- searchVizHistory(urlReplace);
53
+ urlGet = action + "?" + formData;
54
+ urlReplace = "?" + formData;
55
+ searchVizCookie(urlGet, urlReplace, 'B');
19
56
  return $.ajax("http://" + window.location.host + "/" + urlGet, {
20
57
  type: "GET",
21
58
  dataType: "json",
@@ -33,7 +70,7 @@ searchViz = function(searchVizForm, e, callback) {
33
70
  };
34
71
 
35
72
  AjaxPut = function(id, data, callback) {
36
- return $.ajax("http://" + window.location.host + "/" + id, {
73
+ return $.ajax("http://" + window.location.host + id, {
37
74
  type: "POST",
38
75
  data: JSON.stringify(data),
39
76
  contentType: "text/json",
@@ -51,7 +88,7 @@ AjaxPut = function(id, data, callback) {
51
88
  };
52
89
 
53
90
  AjaxGet = function(id, callback) {
54
- return $.ajax("http://" + window.location.host + "/" + id, {
91
+ return $.ajax("http://" + window.location.host + id, {
55
92
  type: "GET",
56
93
  dataType: "json",
57
94
  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.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-26 00:00:00.000000000 Z
12
+ date: 2013-01-14 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Write a gem description
15
15
  email: