Last active
November 12, 2024 07:09
-
-
Save webdevs-pro/02f332deccfbbeec71355cb218ba1f29 to your computer and use it in GitHub Desktop.
Ferdium Notion receipt webview.js
This file contains 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
function _interopRequireDefault(obj) { | |
return obj && obj.__esModule ? obj : { default: obj }; | |
} | |
const _path = _interopRequireDefault(require('path')); | |
module.exports = Ferdium => { | |
const getMessages = () => { | |
let direct = 0; | |
const badgeDiv = document.querySelector( | |
'.notion-sidebar-container .notion-sidebar span[style*="font-variant-numeric: lining-nums tabular-nums;"]', | |
); | |
if (badgeDiv) { | |
direct = Ferdium.safeParseInt(badgeDiv.textContent); | |
} | |
Ferdium.setBadge(direct); | |
}; | |
Ferdium.loop(getMessages); | |
Ferdium.injectCSS(_path.default.join(__dirname, 'service.css')); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment