Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent caching #718

Merged
merged 5 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Qodana
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
- dev

jobs:
qodana:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
checks: write
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit
fetch-depth: 0 # a full history is required for pull request analysis
- name: 'Qodana Scan'
uses: JetBrains/qodana-action@v2024.1
env:
QODANA_TOKEN: ${{ secrets.QODANA_TOKEN }}
11 changes: 11 additions & 0 deletions Update.json
Original file line number Diff line number Diff line change
Expand Up @@ -2464,6 +2464,17 @@
}
],
"Notes": "No release notes were provided for this release."
},
"1.2.59": {
"UpdateDate": 1724836147641,
"Prerelease": true,
"UpdateContents": [
{
"PR": 718,
"Description": "Prevent caching"
}
],
"Notes": "No release notes were provided for this release."
}
}
}
34 changes: 20 additions & 14 deletions XMOJ.user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name XMOJ
// @version 1.2.58
// @version 1.2.59
// @description XMOJ增强脚本
// @author @XMOJ-Script-dev, @langningchen and the community
// @namespace https://github/langningchen
Expand Down Expand Up @@ -416,7 +416,8 @@ let RequestAPI = (Action, Data, CallBack) => {
method: "POST",
url: (UtilityEnabled("SuperDebug") ? "http://127.0.0.1:8787/" : "https://api.xmoj-bbs.me/") + Action,
headers: {
"Content-Type": "application/json"
"Content-Type": "application/json",
"Cache-Control": "no-cache"
},
data: DataString,
onload: (Response) => {
Expand Down Expand Up @@ -598,9 +599,11 @@ class NavbarStyler {
}
}
}
function replaceMarkdownImages(text,string) {
return text.replace(/!\[.*?\]\(.*?\)/g,string);

function replaceMarkdownImages(text, string) {
return text.replace(/!\[.*?\]\(.*?\)/g, string);
}

async function main() {
try {
if (location.href.startsWith('http://')) {
Expand Down Expand Up @@ -880,15 +883,18 @@ async function main() {
}
if (UtilityEnabled("ResetType")) {
if (document.querySelector("#profile") != undefined && document.querySelector("#profile").innerHTML == "登录") {
let PopupUL = document.querySelector("#navbar > ul.nav.navbar-nav.navbar-right > li > ul");
PopupUL.innerHTML = `<li class="dropdown-item">登录</li>`;
PopupUL.children[0].addEventListener("click", () => {
location.href = "https://www.xmoj.tech/loginpage.php";
});
let parentLi = document.querySelector("#navbar > ul.nav.navbar-nav.navbar-right > li");
document.addEventListener("click", (event) => { if (!parentLi.contains(event.target) && PopupUL.style.display === 'block') {hideDropdownItems();}});
}
else if (document.querySelector("#navbar > ul.nav.navbar-nav.navbar-right > li > ul > li:nth-child(3) > a > span") != undefined && document.querySelector("#navbar > ul.nav.navbar-nav.navbar-right > li > ul > li:nth-child(3) > a > span").innerText != "个人中心") {
let PopupUL = document.querySelector("#navbar > ul.nav.navbar-nav.navbar-right > li > ul");
PopupUL.innerHTML = `<li class="dropdown-item">登录</li>`;
PopupUL.children[0].addEventListener("click", () => {
location.href = "https://www.xmoj.tech/loginpage.php";
});
let parentLi = document.querySelector("#navbar > ul.nav.navbar-nav.navbar-right > li");
document.addEventListener("click", (event) => {
if (!parentLi.contains(event.target) && PopupUL.style.display === 'block') {
hideDropdownItems();
}
});
} else if (document.querySelector("#navbar > ul.nav.navbar-nav.navbar-right > li > ul > li:nth-child(3) > a > span") != undefined && document.querySelector("#navbar > ul.nav.navbar-nav.navbar-right > li > ul > li:nth-child(3) > a > span").innerText != "个人中心") {
let PopupUL = document.querySelector("#navbar > ul.nav.navbar-nav.navbar-right > li > ul");
PopupUL.style.cursor = 'pointer';
PopupUL.innerHTML = `<li class="dropdown-item">修改帐号</li>
Expand Down Expand Up @@ -4149,7 +4155,7 @@ int main()
}
let LastsMessageCell = document.createElement("td");
Row.appendChild(LastsMessageCell);
LastsMessageCell.innerText = replaceMarkdownImages(Data[i].LastsMessage,'[image]');
LastsMessageCell.innerText = replaceMarkdownImages(Data[i].LastsMessage, '[image]');
let SendTimeCell = document.createElement("td");
Row.appendChild(SendTimeCell);
SendTimeCell.innerHTML = GetRelativeTime(Data[i].SendTime);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "xmoj-script",
"version": "1.2.58",
"version": "1.2.59",
"description": "an improvement script for xmoj.tech",
"main": "AddonScript.js",
"scripts": {
Expand Down