Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
yangyang0507 committed May 28, 2024
1 parent 666f918 commit d7cb596
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
password: ${{ secrets.ECS_PASSWORD }}
source: './dist/*'
target: '/var/www/mybatis-plus-doc/'
rm: true
# rm: true
30 changes: 27 additions & 3 deletions src/components/CheckAdBlocked.svelte
Original file line number Diff line number Diff line change
@@ -1,20 +1,44 @@
<script>
import { onMount } from "svelte";
import store from "store2";
let adBlockDetected = false;
let session = store.session;
const key = "adBlockNoticeClosed";
function checkAdBlocker() {
if (window._AdBlockInit === undefined) {
adBlockDetected = true;
let adBlockNoticeClosed = session.get(key) ?? false;
if (adBlockNoticeClosed) {
return;
}
// check ad block init
// if (window._AdBlockInit === undefined) {
// adBlockDetected = true;
// }
// check script banned
checkAdScriptBanned('https://cdn.wwads.cn/js/makemoney.js');
}
function checkAdScriptBanned(scriptUrl) {
fetch(scriptUrl)
.then(response => {
if (!response.ok) {
adBlockDetected = true;
}
})
.catch(() => {
adBlockDetected = true;
});
}
function closeNotice() {
adBlockDetected = false;
}
onMount(() => {
const interval = setInterval(checkAdBlocker, 3000);
const interval = setInterval(checkAdBlocker, 5000);
return () => clearInterval(interval);
});
</script>
Expand Down

0 comments on commit d7cb596

Please sign in to comment.