Skip to content

Instantly share code, notes, and snippets.

@MaksimAbramchuk
Created January 19, 2016 17:32
Show Gist options
  • Save MaksimAbramchuk/4c7f1ab4964d1ad98f1f to your computer and use it in GitHub Desktop.
Save MaksimAbramchuk/4c7f1ab4964d1ad98f1f to your computer and use it in GitHub Desktop.
var _document = document;
var token = ‘’;
getSecureInfo = function (html) {
matches = html.match(/name=”authenticity_token” type=”hidden” value=”(.*)”/);
token = matches[1];
document.getElementById(‘token’).value = token;
};
function $() {
return {
after: getSecureInfo
}
};
document.write(‘<script src=”http://example.com/users/maximabramchuk/books/new.js"> </script>');
document.addEventListener(‘DOMContentLoaded’, function () {
document.getElementById(‘token’).value = token;
}, false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment