Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

monkeys-sprockets

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

monkeys-sprockets

  • 0.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Monkeys-Sprockets

# config/initializers/monkeys.rb

# for example we will modify 'videojs-youtube' src file
# on the line 624 there a video quality changing attempt
# but it will not work, unless a video is stopped before quality change\

Monkeys::Changer.tap do | change |

  # first we find a file by a full sprockets path
  # path, that you currently use in a //= require directive
  # but with full extensions
  # in this case it's just '.js'

  # sprockets will throw an error, if it couldn't find the file

  change.file 'videojs-youtube/src/youtube.js' do | file |

    # then we get the 624 line
    # and checking that it has expected content
    # if not - error will be thrown
    # you can check content by string or regexp

    file.line 624, 'self.ytplayer.setPlaybackQuality(quality);' do | line |

      # block will receive line content
      # and returned value ( a string or an array )
      # will be used instead of this line

      [
        'var xy334 = self.paused();',
        'self.ytplayer.stopVideo();',
        line,
        'if ( ! xy334 ) self.ytplayer.playVideo();'
      ]

    end

  end

end

And append 'monkeys/' to your require directives for this file

//= require monkeys/videojs-youtube/src/youtube

By default all patched files will be stored in 'vendor/assets/monkeys'.

FAQs

Package last updated on 02 Mar 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc