noreferrer 0.14 → 0.15
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/noreferrer.rb +0 -13
- data/noreferrer.gemspec +1 -1
- data/vendor/assets/javascripts/jquery.noreferrer.js +5 -3
- metadata +1 -1
data/lib/noreferrer.rb
CHANGED
@@ -1,17 +1,4 @@
|
|
1
|
-
module NoReferrerHelper
|
2
|
-
def link_no_referrer title, url, options={}
|
3
|
-
proc = Proc.new{|key| key == :target ? 'data-target' : key}
|
4
|
-
opts = options.map{|k,v| "#{proc.call(k)}='#{v}'"}.join(' ')
|
5
|
-
"<a data-url='#{url}' #{opts}>#{title}</a>".html_safe
|
6
|
-
end
|
7
|
-
end
|
8
|
-
|
9
1
|
module Noreferrer
|
10
2
|
class Engine < Rails::Engine
|
11
|
-
initializer :noreferrer do |config|
|
12
|
-
ActionView::RoutingUrlFor.module_eval do
|
13
|
-
include NoReferrerHelper
|
14
|
-
end
|
15
|
-
end
|
16
3
|
end
|
17
4
|
end
|
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
|
+
gem.version = 0.15
|
8
8
|
gem.authors = ["Rodney Carvalho"]
|
9
9
|
gem.email = ["rcarvalho@atlantistech.com"]
|
10
10
|
gem.description = "Removes referrer information on an html link."
|
@@ -19,13 +19,15 @@
|
|
19
19
|
}
|
20
20
|
}
|
21
21
|
$(document.body).on('click', selector, function(e){
|
22
|
+
e.stopPropagation();
|
23
|
+
e.preventDefault();
|
22
24
|
if(matches == undefined){
|
23
|
-
NoReferrer.Link.go($(this).attr('
|
25
|
+
NoReferrer.Link.go($(this).attr('href'), $(this).attr('target'));
|
24
26
|
}
|
25
27
|
else{
|
26
28
|
for(i=0;i<matches.length;i++){
|
27
|
-
if(new RegExp(matches[i]).test($(this).attr('
|
28
|
-
NoReferrer.Link.go($(this).attr('
|
29
|
+
if(new RegExp(matches[i]).test($(this).attr('href'))){
|
30
|
+
NoReferrer.Link.go($(this).attr('href'), $(this).attr('target'));
|
29
31
|
}
|
30
32
|
}
|
31
33
|
}
|