/*
* @title Take Tokens for Twitter gem
* @description Take Twitter Consumer & Access Tokens for Twitter gem
* @include https://dev.twitter.com/apps/*
* @license MIT License
* @require
*/
$(function() {
var code, config_lines, extract, k, textarea, tokens, v, wrapper;
extract = function(table, row) {
return $("h2:contains(" + table + ")").nextAll("table").find("td:contains(" + row + ")").next().text();
};
tokens = {
consumer_key: extract("OAuth settings", "Consumer key"),
consumer_secret: extract("OAuth settings", "Consumer secret"),
oauth_token: extract("Your access token", "Access token"),
oauth_token_secret: extract("Your access token", "Access token secret")
};
config_lines = (function() {
var _results;
_results = [];
for (k in tokens) {
v = tokens[k];
_results.push(" config." + k + " = '" + v + "'");
}
return _results;
})();
code = "Twitter.configure do |config|\n" + (config_lines.join("\n")) + "\nend";
textarea = $("<textarea>").html(code);
textarea.css({
width: "100%",
height: "100px",
border: "none"
});
wrapper = $("<div>");
wrapper.append($('<h2>').html('for Twitter gem'));
wrapper.append(textarea);
return $("#content-main").append(wrapper);
});