Skip to content

Instantly share code, notes, and snippets.

View emilisto's full-sized avatar

Emil Stenqvist emilisto

View GitHub Profile
@emilisto
emilisto / injection-proxy.js
Created May 25, 2012 10:39
A content replacing proxy in node.js
//
// injection-proxy.js
// Emil Stenqvist <[email protected]>
//
// Free for all!
//
// A content-replacing proxy in node.js.
//
// I made this for debugging JavaScript on a live website.
//

Shootitlive Player

Getting started

First, you must

  1. install npm
  2. install grunt by running npm install -g grunt
  3. download dependencies, run npm install in . (i.e. SILP root directory), and in ./loader
// deparam
//
// Inverse of $.param()
//
// Taken from jquery-bbq by Ben Alman
// https://github.com/cowboy/jquery-bbq/blob/master/jquery.ba-bbq.js
var isArray = Array.isArray || function(obj) {
return Object.prototype.toString.call(obj) == '[object Array]';
};
(function(global) {
var silpUrl = '//s3-eu-west-1.amazonaws.com/silp.shootitlive.com/js/silp.min.js';
// Globals
if(!global.Silp) { global.Silp = {}; };
var Silp = global.Silp;
// To keep track of which embeds we have already processed
if(!Silp.foundEls) Silp.foundEls = [];
<div id="abc319dhaj"></div>
<script>
(function() {
var s = document.createElement('script');
s.src = '//s3-eu-west-1.amazonaws.com/silp.shootitlive.com/master/silp.js';
s.async = true;
window.silp_options = (window.silp_options || []).concat([ { project: 13, client: 'greenfield', element_id: 'abc319dhaj' }];
document.body.appendChild(s);
}());
</script>
<script>42</script>
<script src="//diu127fbe6pn6.cloudfront.net/shootitlive.load.v1.js?project=13&client=greenfield" async></script>
<script src="//awesome-service.com/init.js"></script>
<script>
awesomeInit({
// Parameters
project: 13, client: 'greenfield'
});
</script>
<script>
var s = document.createElement('script');
s.src = "//awesome-service.com/init.js";
s.async = true;
// This global is picked up by init.js whenever it loads
window.awesome_options = { project: 13, client: 'greenfield' };
document.body.appendChild(s);
</script>