1 //= require ohauth/ohauth
3 $(document).ready(function () {
4 var application_data = $("head").data();
6 function makeAbsolute(url) {
7 var a = document.createElement("a");
12 if (application_data.token) {
13 var headerGenerator = window.ohauth.headerGenerator({
14 consumer_key: application_data.consumerKey,
15 consumer_secret: application_data.consumerSecret,
16 token: application_data.token,
17 token_secret: application_data.tokenSecret
20 $.ajaxPrefilter(function (options, jqxhr) {
22 options.headers = options.headers || {};
23 options.headers.Authorization = headerGenerator(options.type, makeAbsolute(options.url), jqxhr.data);