durl-rails 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c35976a924894217ab9f42710a3bdfda50c0a2a6
4
- data.tar.gz: ab0114a5ee3ec0738b44cf71cc4cf5453e6bac54
3
+ metadata.gz: 58a2b99266d6c01152bc1a1aa514a3d44fc42d83
4
+ data.tar.gz: a0e2672b679e6985f945f22aa532eb746ec83d5d
5
5
  SHA512:
6
- metadata.gz: eb96535badd1f389ccb451787bc6e89bfaabdc6534c0a6e00bbd7e3085c0082066da64ca9da936b6d841f3d3a97d64783dd35940a242113043b7cba96b72436e
7
- data.tar.gz: a4243ae9d30727c85047c2030c7a456e12f8a7e21f2b6eb143ec4888991d22c92728906ee055b112c2411ed21720f589d067598eb5d037f6b02dcbdb7ca41a21
6
+ metadata.gz: 94f0f6fedcf96c1cce2f0d520b82ea685e0f52a779eaf66d7c12ddafd64b30617972970c914941bfff29fab254b34e405981b39e009f7e27f8235b8cc1ddd072
7
+ data.tar.gz: 5bd5ede616cf00ad0b76d2c5f80355c93458188dc7dfd7c021bf7f062afae44b59ad76bbb7910b654dcc0ddc18864a2fe70410607d30929e00a74e2db15952e7
data/README.md CHANGED
@@ -50,7 +50,8 @@ You're done!
50
50
 
51
51
  ## Contributing
52
52
 
53
- Feel free to open an issue ticket if you find something that could be improved.
53
+ If the NPM DURL library changes, run rake update_durl and commit.
54
+ It will pull from source the latest version of DURL and will also bump the version of this gem.
54
55
 
55
56
  ## Acknowledgements
56
57
 
data/VERSIONS.md CHANGED
@@ -3,3 +3,4 @@
3
3
  | Gem | dURL |
4
4
  |--------|--------|
5
5
  | 1.0.0 | 1.0.5 |
6
+ | 1.0.1 | 1.0.6 |
@@ -1,6 +1,6 @@
1
1
  module Durl
2
2
  module Rails
3
- VERSION = "1.0.0"
4
- DURL_VERSION = "1.0.5"
3
+ VERSION = "1.0.1"
4
+ DURL_VERSION = "1.0.6"
5
5
  end
6
6
  end
@@ -1,6 +1,6 @@
1
1
  /*
2
2
  * File: durl.js
3
- * Version: 1.0.5
3
+ * Version: 1.0.6
4
4
  * Desc: DURL keeps your i-frame's Deep URL stored in the hash fragment of your parent page
5
5
  * Doc: https://github.com/tkasten/durl
6
6
  * Author: Tyler Kasten tyler.kasten@gmail.com
@@ -51,37 +51,37 @@ Durl.prototype.bootAsConsumer = function(){
51
51
  }
52
52
 
53
53
  Durl.prototype.matchDeepPath = function(path) {
54
- /**
55
- *
56
- * DURL will store its durl (deep url) in the consumer's hash fragment in the
57
- * form of `this.deep_url_var_name=url_encoded_url`
58
- *
59
- * But we don't know how the consumer is using their hash fragment so we try
60
- * to make safe, unobtrusive assumptions about how to integrate our data into
61
- * their fragment. Consider the following potential use cases on their end:
62
- *
63
- * TKK TODO - spec these cases (also need more cases/clean-up etc)...
64
- *
65
- * Hash Bang style followed with traditional path and url variables
66
- * www.example.com/page/path?var1=stuff#!/some/path?p1=v1&durl=value!&p2=v2z
67
- * www.example.com/page/path?var1=stuff#!/some/path?p1=v1&durl=value!
68
- *
69
- * Same as above case but no consumer variables mixed with durl
70
- * www.example.com/page/path?vars=stuff#!/some/path?durl=value!
71
- *
72
- * No Bang(!) just right into the variables
73
- * www.example.com/page/path#?p1=v2&durl=value!
74
- *
75
- * Same as above but no consumer variables mixed with durl
76
- * www.example.com/page/path#?durl=value!
77
- *
78
- */
79
-
80
54
  pattern = new RegExp("(\\?|&)" + this.deep_url_var_name + "=([^&\n]*)")
81
55
  return pattern.exec(this.vanillaHash()) || '' // [whole match, joiner, url]
82
56
  }
83
57
 
84
58
  Durl.prototype.setDURL = function(new_url) {
59
+ /**
60
+ *
61
+ * DURL will store its durl (deep url) in the consumer's hash fragment in the
62
+ * form of `this.deep_url_var_name=url_encoded_url`
63
+ *
64
+ * But we don't know how the consumer is using their hash fragment so we try
65
+ * to make safe, unobtrusive assumptions about how to integrate our data into
66
+ * their fragment. Consider the following potential use cases on their end:
67
+ *
68
+ * TKK TODO - spec these cases (also need more cases/clean-up etc)...
69
+ *
70
+ * Hash Bang style followed with traditional path and url variables
71
+ * www.example.com/page/path?var1=stuff#!/some/path?p1=v1&durl=value!&p2=v2z
72
+ * www.example.com/page/path?var1=stuff#!/some/path?p1=v1&durl=value!
73
+ *
74
+ * Same as above case but no consumer variables mixed with durl
75
+ * www.example.com/page/path?vars=stuff#!/some/path?durl=value!
76
+ *
77
+ * No Bang(!) just right into the variables
78
+ * www.example.com/page/path#?p1=v2&durl=value!
79
+ *
80
+ * Same as above but no consumer variables mixed with durl
81
+ * www.example.com/page/path#?durl=value!
82
+ *
83
+ */
84
+
85
85
  new_url = new_url || ''
86
86
  hash = this.vanillaHash()
87
87
 
@@ -97,9 +97,35 @@ Durl.prototype.setDURL = function(new_url) {
97
97
  hash += hash.indexOf('?') == -1 ? '?' : '&'
98
98
  hash += this.deep_url_var_name + "=" + new_url
99
99
  }
100
-
101
100
  this.log('replacing location: ' + hash)
102
- location.replace('#' + hash)
101
+ // the following would be ideal but `history` object isn't supported < IE11
102
+ // history.replaceState(undefined, undefined, "#hash_value")
103
+
104
+ // so I did this instead...
105
+
106
+ // location.replace('#' + hash)
107
+
108
+ // That worked great. No new history transaction or page navigation event.
109
+ // However if the document has a silly base tag in it like:
110
+
111
+ // <base href="http://example.com/">
112
+
113
+ // Then this approach behaves as if you said:
114
+
115
+ // location.replace('example.com/#hash_value_here')
116
+
117
+ // That's cool if you're actually sitting on example.com/, but if you at
118
+ // a path like example.com/some/page and you:
119
+
120
+ // location.replace('#' + hash)
121
+
122
+ // it navigate off to that base url plus the hash fragment.
123
+
124
+ // This seem obvious when you read it here, but is was a nasty gotcha
125
+ // if your consumer sets the damned 'base' tag.
126
+
127
+ // So anyways, here we just force it to stay local like this:
128
+ location.replace(window.location.pathname + '#' + hash)
103
129
  }
104
130
 
105
131
  Durl.prototype.getDeepPath = function() {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: durl-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Kasten
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-06 00:00:00.000000000 Z
11
+ date: 2017-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  version: 1.3.6
93
93
  requirements: []
94
94
  rubyforge_project: durl-rails
95
- rubygems_version: 2.4.6
95
+ rubygems_version: 2.5.2
96
96
  signing_key:
97
97
  specification_version: 4
98
98
  summary: Use dURL with Rails 3+