This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "trello-hello-world", | |
"appName": "Hello World", | |
"version": "1.0", | |
"description": "A Power-Up to say hello.", | |
"scripts": { | |
"start": "webpack-dev-server --mode development", | |
"build": "node webpack --mode production" | |
}, | |
"dependencies": { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <reference path="../../types/trello.d.js" /> | |
import Common from "../common/common"; | |
export default class SettingsPage { | |
constructor() { } | |
/** | |
* Renders the settings page | |
* @param {TrelloObject} t | |
*/ | |
render = async (t) => { | |
/** @type {String} */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* global TrelloPowerUp */ | |
/// <reference path="../types/trello.d.js" /> | |
import SettingsPage from "./pages/settingsPage"; | |
/** @type {TrelloPowerUp} */ | |
const tpu = window.TrelloPowerUp; | |
/** @type {TrelloObject} Trello iframe object */ | |
const t = tpu.iframe(); | |
t.render(() => { | |
/** @type { "settings" } */ | |
const page = t.arg("page"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* global TrelloPowerUp */ | |
/// <reference path="../types/trello.d.js" /> | |
import Common from './common/common'; | |
/** @type {TrelloPowerUp} */ | |
const tpu = window.TrelloPowerUp; | |
tpu.initialize({ | |
'board-buttons': async (t) => await getBoardButton(t), | |
}); | |
/** | |
* Returns the board button |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const PACKAGE = require('../../package.json'); | |
/** | |
* CommonFunctions to be shared across all the project | |
*/ | |
export default class Common { | |
/** @type {String} */ | |
static APPNAME = PACKAGE.appName; | |
/** @type {String} */ | |
static VERSION = PACKAGE.version; | |
/** @type {String} */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en-us"> | |
<head> | |
<meta http-equiv="Cache-control" content="no-cache"/> | |
<meta http-equiv="pragma" content="no-cache"/> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<!-- if you want Trello sizeTo to work correctly, you need to keep this --> | |
<link crossorigin="anonymous" rel="stylesheet" href="https://p.trellocdn.com/power-up.min.css"> | |
<title>Power-Up</title> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Checks to see if we are running in Windows Outlook | |
* @returns {Boolean} | |
*/ | |
function isPC() { | |
try { | |
if (Office.context.platform === Office.PlatformType.PC || Office.context.platform === null) { | |
return true; | |
} else { | |
return false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Ensures the Office.js library is loaded. | |
*/ | |
Office.onReady((info) => { | |
/** | |
* Maps the event handler name specified in the manifest's LaunchEvent element to its JavaScript counterpart. | |
* This ensures support in Outlook on Windows. | |
*/ | |
if (Office.context.platform === Office.PlatformType.PC || Office.context.platform == null) { | |
Office.actions.associate("onMessageSendHandler", onMessageSendHandler); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Sanitizes the string for possible malicious values | |
* @param {String} string | |
* @returns {String} | |
*/ | |
static sanitizeString = (string) => { | |
try { | |
string = string.replace(/(javascript:|onerror)/gi, ""); | |
string = string.replace(/undefined/gi, ""); | |
string = string.replace(/<script/gi, "<script"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const myObj = new MyClassToCallTheServer(); | |
let someValue = await myObj.doSomegthingWithTheServerData(); |