Skip to content

Instantly share code, notes, and snippets.

View johandanforth's full-sized avatar

Johan Danforth johandanforth

  • Stockholm, Sweden
View GitHub Profile
@johandanforth
johandanforth / index.cshtml
Created April 1, 2023 15:13
Sample browser-only use of vue.js version 3 page with vue-virtual-scroller
@page
@model PrivacyModel
@{
Layout = null;
}
<html>
<head>
<title>vue virtual scroller sample</title>
name: Visa workitem (bootstrap 4)
description: ''
host: OUTLOOK
api_set: {}
script:
content: "\"use strict\";\n\nvar itemId = null;\nvar item = null;\n\n(function() {\n Office.onReady(function() {\n // Office is ready\n $(document).ready(function() {\n enableTabs();\n run();\n });\n });\n})();\n\nfunction enableTabs() {}\n\n//TODO: get projects - show project name\n\nasync function updateView(workItem) {\n let d1 = loadData(item.subject);\n let d2 = loadData(item.start);\n let d3 = loadData(item.end);\n\n const [subject, start, end] = await Promise.all([d1, d2, d3]);\n\n if (workItem.Name === null || workItem.Name === \"\") {\n console.log(1);\n console.log(subject.toString());\n $(\"#Name\").val(subject.toString());\n } else $(\"#Name\").val(workItem.Name);\n $(\"#Comment\").text(workItem.Comment);\n $(\"#ProjectId\").text(workItem.ProjectId);\n $(\"#InvoiceTime\").attr(\"checked\", workItem.InvoiceTime === \"true\" ? \"checked\" : \"\");\n}\n\nfunction loadData(prop)
name: Get workitem (bootstrap 3)
description: ''
host: OUTLOOK
api_set: {}
script:
content: "\"use strict\";\n\nvar itemId = null;\nvar item = null;\n\n(function() {\n Office.onReady(function() {\n // Office is ready\n $(document).ready(function() {\n enableTabs();\n run();\n });\n });\n})();\n\nfunction enableTabs() {}\n\n//TODO: get projects - show project name\n\nasync function updateView(workItem) {\n let d1 = loadData(item.subject);\n let d2 = loadData(item.start);\n let d3 = loadData(item.end);\n\n const [subject, start, end] = await Promise.all([d1, d2, d3]);\n\n if (workItem.Name === null || workItem.Name === \"\") {\n console.log(1);\n console.log(subject.toString());\n $(\"#Name\").val(subject.toString());\n } else $(\"#Name\").val(workItem.Name);\n $(\"#Comment\").text(workItem.Comment);\n $(\"#ProjectId\").text(workItem.ProjectId);\n $(\"#InvoiceTime\").attr(\"checked\", workItem.InvoiceTime === \"true\" ? \"checked\" : \"\");\n}\n\nfunction loadData(prop)
name: bootstrap 3
description: ''
host: OUTLOOK
api_set: {}
script:
content: "var itemId = null;\nvar item = null;\n\n(function() {\n Office.onReady(function() {\n // Office is ready\n $(document).ready(function() {\n enableTabs();\n //run();\n });\n });\n})();\n\nfunction enableTabs() {\n var firstTabEl = document.querySelector(\"#myTab li:last-child a\");\n console.log(firstTabEl )\n //var firstTab = new bootstrap.Tab(firstTabEl);\n // console.log(firstTab)\n // firstTab.show()\n}\n\n//TODO: get projects - show project name\n\nasync function updateView(workItem) {\n let d1 = loadData(item.subject);\n let d2 = loadData(item.start);\n let d3 = loadData(item.end);\n\n const [subject, start, end] = await Promise.all([d1, d2, d3]);\n\n if (workItem.Name === null || workItem.Name === \"\") {\n console.log(1);\n console.log(subject.toString());\n $(\"#Name\").val(subject.toString());\n } else $(\"#Name\").val(workItem.Name);\n $(\"#Comment\").text(workItem.Comment);\n $
name: Get workitem
description: ''
host: OUTLOOK
api_set: {}
script:
content: "\"use strict\";\n\nvar itemId = null;\nvar item = null;\n\n(function() {\n Office.onReady(function() {\n // Office is ready\n $(document).ready(function() {\n enableTabs();\n run();\n });\n });\n})();\n\nfunction enableTabs() {\n\n\n \n}\n\n//TODO: get projects - show project name\n\nasync function updateView(workItem) {\n let d1 = loadData(item.subject);\n let d2 = loadData(item.start);\n let d3 = loadData(item.end);\n\n const [subject, start, end] = await Promise.all([d1, d2, d3]);\n\n if (workItem.Name === null || workItem.Name === \"\") {\n console.log(1);\n console.log(subject.toString());\n $(\"#Name\").val(subject.toString());\n } else $(\"#Name\").val(workItem.Name);\n $(\"#Comment\").text(workItem.Comment);\n $(\"#ProjectId\").text(workItem.ProjectId);\n $(\"#InvoiceTime\").attr(\"checked\", workItem.InvoiceTime === \"true\" ? \"checked\" : \"\");\n}\n\nfunction loadData(prop) {\n
name: Get attachment content
description: ''
host: OUTLOOK
api_set: {}
script:
content: "$(\"#read\").click(read);\n\nfunction read() {\n Office.context.mailbox.getCallbackTokenAsync({ isRest: true }, function(asyncResult) {\n getCurrentItem(asyncResult.value);\n });\n}\n\nfunction getItemRestId() {\n if (Office.context.mailbox.diagnostics.hostName === 'OutlookIOS') {\n // itemId is already REST-formatted.\n return Office.context.mailbox.item.itemId;\n } else {\n // Convert to an item ID for API v2.0.\n return Office.context.mailbox.convertToRestId(\n Office.context.mailbox.item.itemId,\n Office.MailboxEnums.RestVersion.v2_0\n );\n }\n}\n\nfunction getCurrentItem(accessToken) {\n // Get the item's REST ID.\n var itemId = getItemRestId();\n \n var getMessageUrl = Office.context.mailbox.restUrl + '/v2.0/me/events/' + itemId + '?expand=attachments';\n\n $.ajax({\n url: getMessageUrl,\n dataType: 'json',\n headers: { 'Authorization': 'Bearer ' + accessToken }\n })
name: Get attachment content
description: Gets the attachment content.
host: OUTLOOK
api_set: {}
script:
content: |
$("#read").click(read);
$("#write").click(write);
var serviceRequest = {
@johandanforth
johandanforth / Get attachment content.OUTLOOK.yaml
Created February 22, 2021 16:59
Gets the attachment content.
name: Get attachment content
description: Gets the attachment content.
host: OUTLOOK
api_set: {}
script:
content: |
$("#read").click(read);
$("#write").click(write);
var serviceRequest = {
@johandanforth
johandanforth / .block
Last active April 13, 2018 08:54 — forked from christianbriggs/.block
D3 v4 ES6 Class Force Layout Focus on Clicked Node
license: mit