noreferrer 0.6 → 0.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -7,7 +7,7 @@ Gem for a Rails project that removes referrer information on an html link
7
7
  Include this in your application.js file:
8
8
  //= require jquery.noreferrer.js
9
9
 
10
- $('a').noreferrer(<array of strings to be regex matched with link hrefs>)
10
+ $('a').noreferrer([css selector],[array of strings to be regex matched with link hrefs])
11
11
 
12
12
  Example:
13
13
  The following exmaple will intercept and remove the referrer information to any links that link to google.
data/noreferrer.gemspec CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = "noreferrer"
7
- gem.version = 0.6
7
+ gem.version = 0.7
8
8
  gem.authors = ["Rodney Carvalho"]
9
9
  gem.email = ["rcarvalho@atlantistech.com"]
10
10
  gem.description = "Removes referrer information on an html link."
@@ -20,13 +20,13 @@
20
20
  }
21
21
  $(document.body).on('click', selector, function(e){
22
22
  if(matches == undefined){
23
- NoReferrer.Link.go($(this).attr('href'));
23
+ NoReferrer.Link.go($(this).attr('href'), $(this).attr('target'));
24
24
  return false;
25
25
  }
26
26
  else{
27
27
  for(i=0;i<matches.length;i++){
28
28
  if(new RegExp(matches[i]).test($(this).attr('href'))){
29
- NoReferrer.Link.go($(this).attr('href'));
29
+ NoReferrer.Link.go($(this).attr('href'), $(this).attr('target'));
30
30
  return false;
31
31
  }
32
32
  }
@@ -67,26 +67,51 @@
67
67
  }
68
68
  },
69
69
  Link: {
70
- go: function(url){
70
+ go: function(url, target){
71
71
  if(NoReferrer.Browser.browser['msie']){
72
72
  if(new RegExp(/\?/).test(url)){
73
- window.open(url + '&_='+Math.random());
73
+ if(target == '_blank'){
74
+ window.open(url + '&_='+Math.random());
75
+ }
76
+ else{
77
+ location = url + '&_='+Math.random();
78
+ }
74
79
  }
75
80
  else{
76
- window.open(url + '?_='+Math.random());
81
+ if(target == '_blank'){
82
+ window.open(url + '?_='+Math.random());
83
+ }
84
+ else{
85
+ location = url + '?_='+Math.random();
86
+ }
77
87
  }
78
88
  }
79
89
  else if(NoReferrer.Browser.browser['webkit']){
80
90
  if(new RegExp(/\?/).test(url)){
81
- location = "data:text/html,<script>location='" + url + '&_=' + Math.random() + "'</scr"+"ipt>";
91
+ if(target == '_blank'){
92
+ window.open("data:text/html,<script>location='" + url + '&_=' + Math.random() + "'</scr"+"ipt>");
93
+ }
94
+ else{
95
+ location = "data:text/html,<script>location='" + url + '&_=' + Math.random() + "'</scr"+"ipt>";
96
+ }
82
97
  }
83
98
  else{
84
- location = "data:text/html,<script>location='" + url + '?_=' + Math.random() + "'</scr"+"ipt>";
99
+ if(target == '_blank'){
100
+ window.open("data:text/html,<script>location='" + url + '?_=' + Math.random() + "'</scr"+"ipt>");
101
+ }
102
+ else{
103
+ location = "data:text/html,<script>location='" + url + '?_=' + Math.random() + "'</scr"+"ipt>";
104
+ }
85
105
  }
86
106
  return false;
87
107
  }
88
108
  else if(NoReferrer.Browser.browser['mozilla']){
89
- location = 'data:text/html,<html><meta http-equiv="refresh" content="0; url='+ url + '"></html>';
109
+ if(target == '_blank'){
110
+ window.open('data:text/html,<html><meta http-equiv="refresh" content="0; url='+ url + '"></html>');
111
+ }
112
+ else{
113
+ location = 'data:text/html,<html><meta http-equiv="refresh" content="0; url='+ url + '"></html>';
114
+ }
90
115
  }
91
116
  }
92
117
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: noreferrer
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.6'
4
+ version: '0.7'
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: 2014-02-28 00:00:00.000000000 Z
12
+ date: 2014-03-05 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Removes referrer information on an html link.
15
15
  email: