diff options
| -rw-r--r-- | .github/workflows/upload-to-drive.yml | 42 | ||||
| -rw-r--r-- | config/webpack/plugins/create-rules-webpack-plugin.js | 6 | ||||
| -rw-r--r-- | src/scripts.json | 1 | ||||
| -rw-r--r-- | src/scripts/functionality/home-page-banner.ts | 11 | ||||
| -rw-r--r-- | src/scripts/functionality/mutation-application.ts | 13 |
5 files changed, 14 insertions, 59 deletions
diff --git a/.github/workflows/upload-to-drive.yml b/.github/workflows/upload-to-drive.yml deleted file mode 100644 index 86dd69d..0000000 --- a/.github/workflows/upload-to-drive.yml +++ /dev/null @@ -1,42 +0,0 @@ -name: Upload to drive - -on: - push: - branches: - - master - -jobs: - upload-to-drive: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Setup node.js - uses: actions/setup-node@v3 - with: - node-version: "16.x" - - - name: Run install - uses: borales/actions-yarn@v4 - with: - cmd: install - - - name: Build production bundle - uses: borales/actions-yarn@v4 - with: - cmd: build - - - name: Make zip - run: | - sudo apt-get update - sudo apt-get install zip - zip -r extension.zip dist/* - - - name: Upload to drive - uses: adityak74/google-drive-upload-git-action@main - with: - filename: extension.zip - name: extension.zip - folderId: ${{ secrets.folderId }} - credentials: ${{ secrets.credentials }} - overwrite: "true" diff --git a/config/webpack/plugins/create-rules-webpack-plugin.js b/config/webpack/plugins/create-rules-webpack-plugin.js index d02decd..0dd05d7 100644 --- a/config/webpack/plugins/create-rules-webpack-plugin.js +++ b/config/webpack/plugins/create-rules-webpack-plugin.js @@ -19,9 +19,9 @@ class CreateRulesPlugin { const rule = require(path.resolve(SOURCE_DIR, "rules", ruleFileName)); if (rule instanceof Array) { - for (const rule of rule) { - rule.id = ruleId++; - rules.push(rule); + for (const currentRule of rule) { + currentRule.id = ruleId++; + rules.push(currentRule); } } else { rule.id = ruleId++; diff --git a/src/scripts.json b/src/scripts.json index 7586176..04c9fd3 100644 --- a/src/scripts.json +++ b/src/scripts.json @@ -11,7 +11,6 @@ }, "loaded": { "captcha.ts": "*", - "functionality/home-page-banner.ts": "Home", "functionality/application-receipt.ts": "Apprecrep.action" } } diff --git a/src/scripts/functionality/home-page-banner.ts b/src/scripts/functionality/home-page-banner.ts deleted file mode 100644 index 7ac8fb5..0000000 --- a/src/scripts/functionality/home-page-banner.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { styles } from "@/shared/styling"; - -styles("#slider", { - overflow: "visible", - position: "initial" -}); - -styles("#slider > img", { - width: "100vw", - position: "initial" -}); diff --git a/src/scripts/functionality/mutation-application.ts b/src/scripts/functionality/mutation-application.ts index 3283089..afc133f 100644 --- a/src/scripts/functionality/mutation-application.ts +++ b/src/scripts/functionality/mutation-application.ts @@ -1,4 +1,4 @@ -import { PDFDocument } from "pdf-lib"; +import { PDFDocument, StandardFonts } from "pdf-lib"; import { observeDOM } from "@/shared/observe-dom"; const sanghaFacilitationCentreBannerUrl = chrome.runtime.getURL("/assets/sangha-facilitation-centre-banner.jpg"); @@ -25,11 +25,20 @@ document.addEventListener("DOMContentLoaded", () => { const lastPage = pages[pages.length - 1]; const { width, height } = lastPage.getSize(); const bannerImage = await pdfDoc.embedJpg(await fetch(sanghaFacilitationCentreBannerUrl).then(res => res.arrayBuffer())); + const bannerImageHeight = width * (bannerImage.height / bannerImage.width); + lastPage.drawImage(bannerImage, { x: 0, y: 0, width: width, - height: width * (bannerImage.height / bannerImage.width), + height: bannerImageHeight + }); + + lastPage.drawText(pdfDoc.getCreationDate()!.toLocaleString(), { + x: 10, + y: bannerImageHeight, + size: 12, + font: await pdfDoc.embedFont(StandardFonts.TimesRoman) }); const link = document.createElement("a"); |
