Skip to content

Commit

Permalink
add MOD: widget saying
Browse files Browse the repository at this point in the history
  • Loading branch information
Cp0204 committed Jun 11, 2024
1 parent 0a6ba23 commit 1b4a37a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ In addition, you can access the files in the `/DATA/AppData/casamod/icon` direct

| Name | Description | Author |
| ---- | ----------- | ------ |
| add-widget-saying | Merger of hello and quotable 👋 | ChishFoxcat |
| dont-change-my-icon | Disable auto-matching icons when editing image 🚫 | Cp0204 |
| add-hostname-to-title | Add hostname to title ➕ | Cp0204 |
| small-app-icon | Smaller app icons 🤏 | Cp0204 |
Expand Down
1 change: 1 addition & 0 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@

| 名称 | 功能描述 | 作者 |
| --- | -------- | ---- |
| add-widget-saying | 头像和一言融合版本 👋 | ChishFoxcat |
| dont-change-my-icon | 禁止编辑镜像地址时自动匹配图标 🚫 | Cp0204 |
| add-hostname-to-title | 添加主机名到网页标题 ➕ | Cp0204 |
| small-app-icon | 更小的应用图标 🤏 | Cp0204 |
Expand Down
12 changes: 6 additions & 6 deletions app/mod/one-saying/mod.js → app/mod/add-widget-saying/mod.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

userImage = "/v1/users/avatar?token=" + localStorage.getItem('access_token');
userName = JSON.parse(localStorage.getItem('user')).username;
saying = "你好!一言加载中..."
saying = localStorage.getItem('lang') === "zh_cn" ? "你好!一言加载中..." : "Hi, Saying is loading...";

newElement.innerHTML = `
<div class="widget has-text-white is-relative">
Expand All @@ -17,12 +17,12 @@
<div class="column is-full pb-0">
<div class="is-flex is-align-items-center">
<div class="header-icon">
<img src="`+ userImage + `" loading="lazy" style="border-radius: 50%;" width="64">
<img src="${userImage}" loading="lazy" style="border-radius: 50%;" width="64">
</div>
<div class="ml-4 style="width:13rem">
<h3 class="has-text-left" style="font-size: 1.1rem; margin-top: -0.8rem;margin-bottom: 0.5rem;">`+ userName + `</h3>
<p class="has-text-left is-size-14px"style="color: hsl(208, 16%, 85%);">
<p id="saying" style="cursor: pointer;font-size:12px;">${saying}</p>
<h3 class="has-text-left" style="font-size: 1.1rem; margin-top: -0.8rem;margin-bottom: 0.5rem;">${userName}</h3>
<p class="has-text-left" id="saying" style="cursor: pointer;font-size:12px;">
${saying}
</p>
</div>
</div>
Expand Down Expand Up @@ -69,7 +69,7 @@
}

document.querySelector('#saying').innerHTML = await cacheSaying();
document.querySelector('#saying').addEventListener('click', async function() {
document.querySelector('#saying').addEventListener('click', async function () {
document.querySelector('#saying').innerHTML = await cacheSaying(true);
});
}
Expand Down

0 comments on commit 1b4a37a

Please sign in to comment.