noreferrer 0.9 → 0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/noreferrer.rb CHANGED
@@ -1,4 +1,16 @@
1
+ module NoReferrerHelper
2
+ def link_no_referrer title, url, options={}
3
+ opts = options.map{|k,v| "#{k}='#{v}'"}.join(' ')
4
+ "<a data-url='#{url}' #{opts}>#{title}</a>".html_safe
5
+ end
6
+ end
7
+
1
8
  module Noreferrer
2
9
  class Engine < Rails::Engine
10
+ initializer :noreferrer do |config|
11
+ ActionView::RoutingUrlFor.module_eval do
12
+ include NoReferrerHelper
13
+ end
14
+ end
3
15
  end
4
16
  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.9
7
+ gem.version = 0.11
8
8
  gem.authors = ["Rodney Carvalho"]
9
9
  gem.email = ["rcarvalho@atlantistech.com"]
10
10
  gem.description = "Removes referrer information on an html link."
@@ -13,4 +13,4 @@ Gem::Specification.new do |gem|
13
13
 
14
14
  gem.files = `git ls-files`.split($/)
15
15
  gem.require_paths = ["lib"]
16
- end
16
+ end
@@ -20,16 +20,12 @@
20
20
  }
21
21
  $(document.body).on('click', selector, function(e){
22
22
  if(matches == undefined){
23
- NoReferrer.Link.go($(this).attr('href'), $(this).attr('target'));
24
- e.preventDefault();
25
- return false;
23
+ NoReferrer.Link.go($(this).attr('data-url'), $(this).attr('target'));
26
24
  }
27
25
  else{
28
26
  for(i=0;i<matches.length;i++){
29
- if(new RegExp(matches[i]).test($(this).attr('href'))){
30
- NoReferrer.Link.go($(this).attr('href'), $(this).attr('target'));
31
- e.preventDefault();
32
- return false;
27
+ if(new RegExp(matches[i]).test($(this).attr('data-url'))){
28
+ NoReferrer.Link.go($(this).attr('data-url'), $(this).attr('target'));
33
29
  }
34
30
  }
35
31
  }
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.9'
4
+ version: '0.11'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: