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 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.14
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('data-url'), $(this).attr('data-target'));
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('data-url'))){
28
- NoReferrer.Link.go($(this).attr('data-url'), $(this).attr('data-target'));
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
  }
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.14'
4
+ version: '0.15'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: