From a1e57841e71e442b1bf52e445e6c541f16ec066d Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 21 Feb 2018 02:53:34 +0900 Subject: wip --- src/web/app/common/mios.ts | 34 +++++++++++++++++++++++++++++ src/web/app/common/scripts/fuck-ad-block.ts | 21 ++++++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 src/web/app/common/scripts/fuck-ad-block.ts (limited to 'src/web/app/common') diff --git a/src/web/app/common/mios.ts b/src/web/app/common/mios.ts index a98df1bc03..c4208aa913 100644 --- a/src/web/app/common/mios.ts +++ b/src/web/app/common/mios.ts @@ -16,6 +16,38 @@ declare const _API_URL_: string; declare const _SW_PUBLICKEY_: string; //#endregion +export type API = { + chooseDriveFile: (opts: { + title?: string; + currentFolder?: any; + multiple?: boolean; + }) => Promise; + + chooseDriveFolder: (opts: { + title?: string; + currentFolder?: any; + }) => Promise; + + dialog: (opts: { + title: string; + text: string; + actions: Array<{ + text: string; + id?: string; + }>; + }) => Promise; + + input: (opts: { + title: string; + placeholder?: string; + default?: string; + }) => Promise; + + post: () => void; + + notify: (message: string) => void; +}; + /** * Misskey Operating System */ @@ -49,6 +81,8 @@ export default class MiOS extends EventEmitter { return localStorage.getItem('debug') == 'true'; } + public apis: API; + /** * A connection manager of home stream */ diff --git a/src/web/app/common/scripts/fuck-ad-block.ts b/src/web/app/common/scripts/fuck-ad-block.ts new file mode 100644 index 0000000000..9bcf7deeff --- /dev/null +++ b/src/web/app/common/scripts/fuck-ad-block.ts @@ -0,0 +1,21 @@ +require('fuckadblock'); + +declare const fuckAdBlock: any; + +export default (os) => { + function adBlockDetected() { + os.apis.dialog({ + title: '%fa:exclamation-triangle%広告ブロッカーを無効にしてください', + text: 'Misskeyは広告を掲載していませんが、広告をブロックする機能が有効だと一部の機能が利用できなかったり、不具合が発生する場合があります。', + actins: [{ + text: 'OK' + }] + }); + } + + if (fuckAdBlock === undefined) { + adBlockDetected(); + } else { + fuckAdBlock.onDetected(adBlockDetected); + } +}; -- cgit v1.2.3-freya