瀏覽代碼

Make clicking on news show a new piece of news

tags/v0.1.0
Fen Dweller 5 年之前
父節點
當前提交
174f61c7d8
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: E80B35A6F11C3656
共有 2 個檔案被更改,包括 15 行新增3 行删除
  1. +0
    -1
      gorge.css
  2. +15
    -2
      gorge.js

+ 0
- 1
gorge.css 查看文件

@@ -526,7 +526,6 @@ div::-webkit-scrollbar-corner {
} }


.news-text { .news-text {
pointer-events: none;
text-align: center; text-align: center;
position: fixed; position: fixed;
top: 98vh; top: 98vh;


+ 15
- 2
gorge.js 查看文件

@@ -28,6 +28,7 @@ const clickPowers = {
clickVictim: "micro" clickVictim: "micro"
} }



let clickBonus = 0; let clickBonus = 0;
let clickVictim = "micro"; let clickVictim = "micro";


@@ -38,6 +39,11 @@ let shiftHeld = false;


let mouseTarget = undefined; let mouseTarget = undefined;


let newsShowTimer;
let newsRemoveTimer;

const newsDelay = 8000;

const state = { const state = {
ownedUpgrades: ownedUpgrades, ownedUpgrades: ownedUpgrades,
resources: resources, resources: resources,
@@ -1067,7 +1073,7 @@ function doNews() {


showNews(options[choice](state)); showNews(options[choice](state));


setTimeout(() => {
newsShowTimer = setTimeout(() => {
doNews(); doNews();
}, 8000); }, 8000);
} }
@@ -1078,11 +1084,18 @@ function showNews(text) {


div.classList.add("news-text"); div.classList.add("news-text");


div.addEventListener("click", () => {
clearTimeout(newsShowTimer);
clearTimeout(newsRemoveTimer);
body.removeChild(div);
doNews();
});

const body = document.querySelector("body"); const body = document.querySelector("body");


body.appendChild(div); body.appendChild(div);


setTimeout(() => {
newsRemoveTimer = setTimeout(() => {
body.removeChild(div); body.removeChild(div);
}, 8000); }, 8000);
} }


Loading…
取消
儲存