Class: ICAPrb::Plugins::RemoveVisualRevenue
- Inherits:
-
Object
- Object
- ICAPrb::Plugins::RemoveVisualRevenue
- Defined in:
- lib/icaprb/filter/solution.rb
Overview
Plug in to remove the Visual Revenue Tracker
Constant Summary collapse
- PLUGIN_NAME =
class name
'remove_visual_revenue'- MODES =
Available mod modes
[:response_mod]
Instance Method Summary collapse
-
#initialize(_, _) ⇒ RemoveVisualRevenue
constructor
- Constructor
mode - resp or req mod
parameters -
All parameters given in the configuration file.
- resp or req mod
- Constructor
-
#plugin(data) ⇒ Object
execute the plug in removes all scripts where the source or the content matches.
Constructor Details
#initialize(_, _) ⇒ RemoveVisualRevenue
Constructor
mode-
resp or req mod
parameters-
All parameters given in the configuration file
928 929 |
# File 'lib/icaprb/filter/solution.rb', line 928 def initialize(_, _) end |
Instance Method Details
#plugin(data) ⇒ Object
execute the plug in removes all scripts where the source or the content matches
939 940 941 942 943 944 945 946 947 948 949 950 951 |
# File 'lib/icaprb/filter/solution.rb', line 939 def plugin(data) mod = false doc = Nokogiri::HTML(data[:http_response_body]) doc.search('script').each do |script| if script['src'].to_s.match(/visualrevenue\.com\/vrs\.js/i) || script.content.match(/visualrevenue\.com\/vrs\.js/i) script.remove mod = true end end data[:http_response_body] = doc.to_s if mod mod end |