Skip to content

Instantly share code, notes, and snippets.

@superstrong
Last active July 14, 2017 20:32
Show Gist options
  • Save superstrong/5a214c62b671135d039d1bc1a88ab65a to your computer and use it in GitHub Desktop.
Save superstrong/5a214c62b671135d039d1bc1a88ab65a to your computer and use it in GitHub Desktop.
A bookmarklet. Get the name and ID of every table in the Airtable base you are currently viewing.
javascript:(function() {
var refTable = location.pathname.split('/')[1];
var source = initData.lastTableIdsUsedByApplicationId;
var apps = Object.keys(source);
var tables = Object.values(source);
for (var i = 0; i < tables.length; i++) {
if (tables[i] === refTable) {
var j = i;
i = tables.length;
}
}
var app = {};
app.id = apps[j];
app.name = initData["rawApplications"][app.id]["name"];
var base = initData["rawApplications"][app.id]["visibleTableOrder"];
var tabs = {};
for (var i = 0; i < base.length; i++) {
var tableId = base[i];
var tableName = initData["rawTables"][tableId]["name"].toLowerCase();
tabs[tableName] = tableId;
}
tabs.app_id = app.id;
tabs.name = app.name;
var dump = "";
for (var [key, value] of Object.entries(tabs)) {
dump = dump + key + ": " + value + "\n";
}
console.log(dump);
var pretty = "<html>";
for (var [key, value] of Object.entries(tabs)) {
pretty = pretty + "<p>" + key + ": " + value + "</p>";
}
pretty = pretty + "</html>";
return pretty;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment