Skip to content

Instantly share code, notes, and snippets.

View ChaiyachetU's full-sized avatar

Chaiyachet Ukham ChaiyachetU

View GitHub Profile
@import url("https://fonts.googleapis.com/css2?family=Mitr&display=swap");
* {
margin: 0;
padding: 0;
font-family: "Mitr", sans-serif;
box-sizing: border-box;
}
body {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Thailand Address Search</title>
<link rel="stylesheet" href="style.css" />
const searchInput = document.getElementById("search");
const results = document.getElementById("results");
const lists = document.querySelectorAll("li");
let searchTerm = "";
let thailandAddress;
async function fetchAddress() {
const url =
"<YOUR API Link URL>?sheet=address";
function doGet(e) {
const ssURL = "ํYour Google Sheet URL";
const ss = SpreadsheetApp.openByUrl(ssURL);
let response = [];
const sheetName = e.parameter.sheet;
if (sheetName === "address") {
// send email message to line notify
function sendMessageToLineNotify(message, accesssToken) {
const lineNotifyEndPoint = "https://notify-api.line.me/api/notify";
const options = {
"method": "POST",
"headers": {
"Authorization": "Bearer " + accesssToken,
"Content-Type": " application/x-www-form-urlencoded"
},
// get priority unread emails
function getPriorityUnreadEmails() {
let priorityUnreadEmails = [];
// priority inbox unread emails
const priorityInboxUnread = GmailApp.getPriorityInboxUnreadCount();
Logger.log("Priority inbox unread : " + priorityInboxUnread);
// new priority inbox emails
if (priorityInboxUnread) {
function main() {
// get unread emails from priority contact list
const priorityUnreadEmails = getPriorityUnreadEmails();
// if priority unread emails is not empty send emails message to line notify
if (priorityUnreadEmails.length !== 0) {
priorityUnreadEmails.forEach(unreadEmail => sendMessageToLineNotify(unreadEmail, lineNotifyToken));
}
}
// google drive attachments folder id
const attachmentFolderId = "Your Google Drive Attachments folder ID";
// line notify access token
const lineNotifyToken = "Your LINE Notify Access Token";
// bitly token
const bitlyToken = "Your Bitly Token";
// priority contact list emails
pdfMake.fonts = {
THSarabunNew: {
normal: "THSarabunNew.ttf",
bold: "THSarabunNew Bold.ttf",
italics: "THSarabunNew Italic.ttf",
bolditalics: "THSarabunNew BoldItalic.ttf",
},
Roboto: {
normal: "Roboto-Regular.ttf",
bold: "Roboto-Medium.ttf",