urb 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzJiYWI3MDljMDJkMzIwMzk0ZWYxY2I1NzQxNTk2MWU4MWU2MWQwYQ==
4
+ NGY2ZWJiMDJhNGI0ZGU5MDA5OGM1NmJkNjg0NjAxNTk0YjZjZmUwMA==
5
5
  data.tar.gz: !binary |-
6
- ZmRiMDA1MTlmNGFmODU2YTlmY2UyNWMxNjRmMGEzNTgyZGM5ZjQzMA==
6
+ YmVkMzNjMjcxOTZmZGFmNWU1NWE4ZjRlNWNlMDYwMTVmNDkwMDViOQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ODc0Zjc0ZjY0OTU3OTBjODU2N2NmNWEzNTA3NTcxNGY5MmJlMWY1MTYxMjRj
10
- OTA1YjI5MjdmOGFhNTJkMTFiNjMyYmUwMWIyNzZmMzA2ZjI1YzU4MDJiOWI5
11
- ZTY1NmFlYWE4ZDAyZDcxNzhjOTA4YTJmNTYxMDA2M2IyNzdjYmY=
9
+ NTE1ZGYxM2Q3YjU2YWY5YTJmZjFkMjRhNGVkYmQ3OTY5NjA4YWM5MjNjOTIy
10
+ MTBmYzRmMTgzZWQ4ZWE2OTFjNzM0NWU4Y2FjZTdiM2IwNGM3NjZjMjhlM2Ni
11
+ MzM1OGQ3MGY5MjExMjZkMjk3MWU0ODRjYjU1MmQ5NWU4YzJlMWQ=
12
12
  data.tar.gz: !binary |-
13
- ZmQyMmQyMWE5ZDg4ZTc3MzJlODFjY2RhMzY1NDA1OTMyZmMxNzg1ODk3OWUy
14
- Y2JkNWNkMTZkZGZiMjc4MDg1YjE1NTliN2FlZjI4NjJhNTA0Y2I1NWQ5YzEw
15
- MWYyOTQ1Mzg0MTQ3ZmI3Mjc4YmIwOTI5Y2IxYTAyOTdkZDFhOWY=
13
+ YmFhMTZlOWY1NTg1YzUzNzI4MmM1NWE4ZmI0OThmNTJmMjYwODZmNTIwODEy
14
+ OWEwNjEzYmJlNmJlNzk4ZjJiOWIxMjNhMGQ0MjBkYTJjZTYzYzg3ZTU4NTc0
15
+ YzRjMGE0YzA5NWYwYjA1N2Q4MTE2MGU3ODIxZWYzOGJjZWRhZjM=
data/CHANGELOG.rdoc CHANGED
@@ -1,5 +1,9 @@
1
1
  = URB CHANGELOG
2
2
 
3
+ == Version 0.1.1 (July 8, 2014)
4
+
5
+ * Only opening link when having used the left click button. Opening in new tab when also having pressed CTRL or Meta (Windows / Command) key
6
+
3
7
  == Version 0.1.0 (April 2, 2014)
4
8
 
5
9
  * Initial release
data/README.rdoc CHANGED
@@ -16,6 +16,8 @@ Run the following in your console to install with Bundler:
16
16
 
17
17
  === Usage
18
18
 
19
+ ==== Include urb.js
20
+
19
21
  Invoke the view helper method <tt>urb</tt> within your template:
20
22
 
21
23
  <!DOCTYPE html>
@@ -28,6 +30,18 @@ Invoke the view helper method <tt>urb</tt> within your template:
28
30
  <%= urb %>
29
31
  </head>
30
32
 
33
+ ==== Add urb.js to the precompiled Rails assets
34
+
35
+ You will need to add <tt>urb.js</tt> to the additional precompiled assets in the production and staging environment.
36
+
37
+ (e.g. in config/environments/production.rb)
38
+
39
+ # Precompile additional assets.
40
+ # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
41
+ config.assets.precompile += %w(urb.js)
42
+
43
+ ==== Start opening URLs
44
+
31
45
  Click on links within your webpage or call the Javascript function <tt>URB.open()</tt>.
32
46
 
33
47
  <script>
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -7,7 +7,7 @@ if (typeof(URB) == 'undefined') {
7
7
  // * Except otherwise noted, URB is licensed under
8
8
  // * http://creativecommons.org/licenses/by/3.0
9
9
  // *
10
- // * $Date: 2014-02-06 23:30:51 $
10
+ // * $Date: 2014-07-08 10:56:53 $
11
11
  // *
12
12
 
13
13
  URB = (function() {
@@ -18,29 +18,31 @@ URB = (function() {
18
18
  on: function(e,t,f,r){if(e.attachEvent?(r?e.detachEvent('on'+t,e[t+f]):1):(r?e.removeEventListener(t,f,0):e.addEventListener(t,f,0))){e['e'+t+f]=f;e[t+f]=function(){e['e'+t+f](window.event);};e.attachEvent('on'+t,e[t+f]);}},
19
19
  hasClass: function(e,c){return $.indexOf(c,e.className.split(' '))>=0;},
20
20
  indexOf: function(v,a,i){for(i=a.length;i--&&a[i]!=v;);return i;},
21
- request: function(d,e,f){f=f||'post';var c=document.createElement('form');c.setAttribute('method',f);c.setAttribute('action',d);for(var b in e){if(e.hasOwnProperty(b)){var a=document.createElement('input');a.setAttribute('type','hidden');a.setAttribute('name',b);a.setAttribute('value',e[b]);c.appendChild(a)}}document.body.appendChild(c);c.submit()}
21
+ request: function(d,e,f,t){f=f||'post';var c=document.createElement('form');c.setAttribute('method',f);c.setAttribute('action',d);c.setAttribute('target',t);for(var b in e){if(e.hasOwnProperty(b)){var a=document.createElement('input');a.setAttribute('type','hidden');a.setAttribute('name',b);a.setAttribute('value',e[b]);c.appendChild(a)}}document.body.appendChild(c);c.submit()}
22
22
  },
23
23
 
24
24
  init = function() {
25
25
  $.on(document, 'click', function(event) {
26
- var target = event.target || event.srcElement || window.event.target || window.event.srcElement, css = URB.css || '';
27
- if (target.tagName.toLowerCase() == 'a' && ((css == '') || $.hasClass(target, css))) {
28
- event.preventDefault();
29
- open(target.getAttribute('href'));
26
+ var target = event.target || event.srcElement || window.event.target || window.event.srcElement, css = URB.css || '', leftClick = (event.which || event.button) == 1;
27
+ if (leftClick) {
28
+ if (target.tagName.toLowerCase() == 'a' && ((css == '') || $.hasClass(target, css))) {
29
+ event.preventDefault();
30
+ open(target.getAttribute('href'), ((event.ctrlKey || event.metaKey) ? '_blank' : '_self'));
31
+ }
30
32
  }
31
33
  });
32
34
  },
33
35
 
34
- open = function(url) {
36
+ open = function(url, target) {
35
37
  var location = document.createElement('a'), path;
36
38
  location.href = url;
37
39
  if (location.host == '') {
38
40
  location.href = location.href;
39
41
  }
40
42
  if ((location.host == window.location.host) && (path = location.pathname + location.search).length > maxlength) {
41
- $.request(urb_path, {path: path});
43
+ $.request(urb_path, {path: path}, undefined, target);
42
44
  } else {
43
- window.location = url;
45
+ window.open(url, target);
44
46
  }
45
47
  };
46
48
 
data/lib/urb/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module URB
2
2
  MAJOR = 0
3
3
  MINOR = 1
4
- TINY = 0
4
+ TINY = 1
5
5
 
6
6
  VERSION = [MAJOR, MINOR, TINY].join(".")
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: urb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Engel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-02 00:00:00.000000000 Z
11
+ date: 2014-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: moneta