From ea9f52797889740c465f1bcaef1283642cc2ef27 Mon Sep 17 00:00:00 2001 From: Vijay Aravamudhan Date: Sun, 12 Sep 2021 08:36:16 +0530 Subject: New recipe: 'dingtalk' (fixes #416) (#686) --- all.json | 9 +++++++++ docs/configuration.md | 2 +- recipes/dingtalk/icon.svg | 6 ++++++ recipes/dingtalk/index.js | 1 + recipes/dingtalk/package.json | 11 +++++++++++ recipes/dingtalk/style.css | 9 +++++++++ recipes/dingtalk/webview.js | 36 ++++++++++++++++++++++++++++++++++++ 7 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 recipes/dingtalk/icon.svg create mode 100644 recipes/dingtalk/index.js create mode 100644 recipes/dingtalk/package.json create mode 100644 recipes/dingtalk/style.css create mode 100644 recipes/dingtalk/webview.js diff --git a/all.json b/all.json index 733d0a9..d275068 100644 --- a/all.json +++ b/all.json @@ -248,6 +248,15 @@ "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/devdocs/icon.svg" } }, + { + "featured": false, + "id": "dingtalk", + "name": "Dingtalk", + "version": "1.0.24", + "icons": { + "svg": "https://cdn.jsdelivr.net/gh/getferdi/recipes/recipes/dingtalk/icon.svg" + } + }, { "featured": true, "id": "discord", diff --git a/docs/configuration.md b/docs/configuration.md index fa5d4d9..ee44081 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -76,7 +76,7 @@ Some services have direct 1x1 messages e.g. a mention or message to every user i Services like Slack or HipChat have direct messages e.g. a mention or message to every user in a channel (@channel) and indirect messages e.g. general discussion in a channel. If this flag is set to `true`, the user can enable/disable if there should be a badge for indirect messages. * `string` **message**
Info message that will be displayed in the add/edit service preferences screen. -* `string` **disablewebsecurity**
+* `boolean` **disablewebsecurity** _default: false_
Some services like hangoutschat need the web security disabled. ## Example diff --git a/recipes/dingtalk/icon.svg b/recipes/dingtalk/icon.svg new file mode 100644 index 0000000..b71eedb --- /dev/null +++ b/recipes/dingtalk/icon.svg @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/recipes/dingtalk/index.js b/recipes/dingtalk/index.js new file mode 100644 index 0000000..23607bd --- /dev/null +++ b/recipes/dingtalk/index.js @@ -0,0 +1 @@ +module.exports = Ferdi => Ferdi; diff --git a/recipes/dingtalk/package.json b/recipes/dingtalk/package.json new file mode 100644 index 0000000..2cf0474 --- /dev/null +++ b/recipes/dingtalk/package.json @@ -0,0 +1,11 @@ +{ + "id": "dingtalk", + "name": "Dingtalk", + "version": "1.0.24", + "license": "MIT", + "config": { + "serviceURL": "https://im.dingtalk.com/", + "hasNotificationSound": true, + "disablewebsecurity": true + } +} diff --git a/recipes/dingtalk/style.css b/recipes/dingtalk/style.css new file mode 100644 index 0000000..230ac01 --- /dev/null +++ b/recipes/dingtalk/style.css @@ -0,0 +1,9 @@ +#layout-container { + justify-content: unset +} + +#layout-container #layout-main { + width: 100%; + flex: 0 1 1500px; +} + diff --git a/recipes/dingtalk/webview.js b/recipes/dingtalk/webview.js new file mode 100644 index 0000000..68de1b6 --- /dev/null +++ b/recipes/dingtalk/webview.js @@ -0,0 +1,36 @@ +const _path = _interopRequireDefault(require('path')); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +module.exports = (Ferdi) => { + let checkIsRun = false; + checkHeightAction = () => { + checkIsRun = true; + let checkHeight = setInterval(() => { + let menuPanel = document.getElementById('menu-pannel') + if (!menuPanel) { + return + } + menuPanel.parentElement.setAttribute('style', 'height:' + (window.outerHeight - 60) + 'px'); + clearInterval(checkHeight); + checkIsRun = false + }, 1000) + } + + checkHeightAction(); + + window.addEventListener('resize', () => { + if (!checkIsRun) { + checkHeightAction(); + } + }); + + const getMessages = function getMessages() { + const x = document.querySelectorAll('.unread-num em.ng-binding') + Ferdi.setBadge(x.length > 0 ? x[0].innerHTML : 0); + }; + + Ferdi.loop(getMessages); + + Ferdi.injectCSS(_path.default.join(__dirname, 'style.css')); +}; -- cgit v1.2.3-70-g09d2