noreferrer 0.7 → 0.8

Sign up to get free protection for your applications and to get access to all the features.
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.7
7
+ gem.version = 0.8
8
8
  gem.authors = ["Rodney Carvalho"]
9
9
  gem.email = ["rcarvalho@atlantistech.com"]
10
10
  gem.description = "Removes referrer information on an html link."
@@ -68,50 +68,23 @@
68
68
  },
69
69
  Link: {
70
70
  go: function(url, target){
71
+ var wnd = null;
72
+ if(target == '_blank'){
73
+ wnd = window.open();
74
+ }
75
+ else{
76
+ wnd = window;
77
+ }
78
+
71
79
  if(NoReferrer.Browser.browser['msie']){
72
- if(new RegExp(/\?/).test(url)){
73
- if(target == '_blank'){
74
- window.open(url + '&_='+Math.random());
75
- }
76
- else{
77
- location = url + '&_='+Math.random();
78
- }
79
- }
80
- else{
81
- if(target == '_blank'){
82
- window.open(url + '?_='+Math.random());
83
- }
84
- else{
85
- location = url + '?_='+Math.random();
86
- }
87
- }
80
+ wnd.location = url + ((new RegExp(/\?/).test(url)) ? '&_=' : '?_=') + Math.random();
88
81
  }
89
82
  else if(NoReferrer.Browser.browser['webkit']){
90
- if(new RegExp(/\?/).test(url)){
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
- }
97
- }
98
- else{
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
- }
105
- }
83
+ wnd.location = "data:text/html,<script>location='" + url + ((new RegExp(/\?/).test(url)) ? '&_=' : '?_=') + Math.random() + "'</scr"+"ipt>";
106
84
  return false;
107
85
  }
108
86
  else if(NoReferrer.Browser.browser['mozilla']){
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
- }
87
+ wnd.location = 'data:text/html,<html><meta http-equiv="refresh" content="0; url='+ url + '"></html>';
115
88
  }
116
89
  }
117
90
  }
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.7'
4
+ version: '0.8'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: