/home/techb158/trello-import.abdallabala.com/public/js
Edit: /home/techb158/trello-import.abdallabala.com/public/js/settings.js (1919B)
(function () {
"use strict";
var config = window.TRELLO_IMPORT_CONFIG || {};
var options = {
appKey: config.appKey || "REPLACE_WITH_YOUR_TRELLO_POWERUP_API_KEY",
appName: config.appName || "Import JSON/CSV",
appAuthor: config.appAuthor || "Your Name or Company"
};
var t;
function $(id) {
return document.getElementById(id);
}
function setStatus(message, type) {
var el = $("settingsStatus");
el.className = "status " + (type || "info");
el.textContent = message;
}
function errorMessage(error) {
return error && error.message ? error.message : String(error || "Unknown error");
}
async function refresh() {
try {
var client = await t.getRestApi();
var authorized = await client.isAuthorized();
setStatus(authorized ? "Authorized for Trello REST API access." : "Not authorized yet.", authorized ? "success" : "warning");
} catch (error) {
setStatus("Could not check authorization: " + errorMessage(error), "error");
}
}
async function authorize() {
try {
var client = await t.getRestApi();
await client.authorize({ scope: "read,write", expiration: "never" });
await refresh();
} catch (error) {
setStatus("Authorization was not completed: " + errorMessage(error), "error");
}
}
async function clearAuth() {
try {
var client = await t.getRestApi();
await client.clearToken();
await refresh();
} catch (error) {
setStatus("Could not clear authorization: " + errorMessage(error), "error");
}
}
document.addEventListener("DOMContentLoaded", function () {
t = window.TrelloPowerUp.iframe(options);
$("authorizeButton").addEventListener("click", authorize);
$("clearButton").addEventListener("click", clearAuth);
$("closeButton").addEventListener("click", function () { t.closeModal(); });
t.render(refresh);
});
})();