-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f4d63dc
Showing
9 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
package-lock.json | ||
dist |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
.top-bar #luogu_popwindow_setting { | ||
margin-right: 8pt; | ||
} | ||
|
||
#luogu_popwindow_setting:not(.top-bar *) { | ||
margin-right: 5pt; | ||
} | ||
#luogu_popwindow_setting:not(.top-bar *,.link-container + .user-nav *) { | ||
color: inherit; | ||
} | ||
.top-bar .user-nav > #luogu_popwindow_setting:hover { | ||
background-color: rgba(0, 0, 0, .05); | ||
padding: 3pt 3pt 3pt 3pt; | ||
margin-right: 5pt; | ||
border-radius: 3px | ||
} | ||
|
||
#luogu_popwindow_setting:hover > svg > path { | ||
fill: #0366d6; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "Luogu_Popwindow", | ||
"version": "1.0.2", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [], | ||
"author": "sxl701817", | ||
"license": "MIT", | ||
"description": "洛谷弹窗", | ||
"dependencies": { | ||
"css-loader": "^7.1.2", | ||
"path": "^0.12.7", | ||
"style-loader": "^4.0.0", | ||
"webpack": "^5.97.1", | ||
"webpack-cil": "^0.0.1-security" | ||
}, | ||
"devDependencies": { | ||
"jquery": "^3.7.1", | ||
"sweetalert2": "^11.15.0", | ||
"webpack-cli": "^5.1.4" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// ==UserScript== | ||
// @name Luogu Popwindow | ||
// @namespace http://tampermonkey.net/ | ||
// @version 1.0.2 | ||
// @description 洛谷弹窗 | ||
// @author sxl701817 | ||
// @match https://www.luogu.com.cn/* | ||
// @icon https://s21.ax1x.com/2024/12/14/pAqEr9S.png | ||
// @resource sweetcss https://cdnjs.cloudflare.com/ajax/libs/sweetalert2/11.14.5/sweetalert2.min.css | ||
// @require https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js | ||
// @require https://cdnjs.cloudflare.com/ajax/libs/sweetalert2/11.14.5/sweetalert2.min.js | ||
// @grant GM_getValue | ||
// @grant GM_setValue | ||
// @grant GM_getResourceText | ||
// @grant GM_addStyle | ||
// @license MIT | ||
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
let obs = new MutationObserver((muts,obs)=>{ | ||
muts.forEach((ele)=>{ | ||
if($('[currenttemplate="RecordShow"] section div .info-rows:last-child div:nth-child(2) span:last-child span').text().trim() === 'Accepted') { | ||
swal.fire({ | ||
icon:"info", | ||
title:"你通过了此题!", | ||
html:GM_getValue('message','') | ||
}) | ||
obs.disconnect() | ||
} | ||
}) | ||
}); | ||
export function startListen() { | ||
let dom = document.querySelector('[currenttemplate="RecordShow"] section div .info-rows:last-child div:nth-child(2) span:last-child span') | ||
obs.observe(dom,{characterData:true,attributes:true}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import './../assets/style.css' | ||
import $ from 'jquery' | ||
import { startListen } from './listener' | ||
import { makeAlert } from './settings' | ||
let oldhref = 'kkkfc0114514' | ||
let css = GM_getResourceText('sweetcss') | ||
GM_addStyle(css) | ||
setInterval(() => { | ||
$(()=>{ | ||
if(window.location.href.search("https://www.luogu.com.cn/record/") === 0 && window.location.href !== oldhref) { | ||
startListen() | ||
} | ||
if($('#luogu_popwindow_setting').length === 0) { | ||
makeAlert() | ||
} | ||
oldhref = window.location.href | ||
}) | ||
},200) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import $ from 'jquery' | ||
import swal from 'sweetalert2' | ||
import icon from './../assets/message.svg' | ||
export function makeAlert() { | ||
let dom = `<a id="luogu_popwindow_setting" class="icon color-none">${icon}</a>` | ||
$('.user-nav nav').prepend(dom) | ||
$('.user-nav:has(> a)').prepend(dom) | ||
$('#luogu_popwindow_setting').on('click',() => { | ||
swal.fire({ | ||
icon:"question", | ||
title:"请输入提示信息", | ||
html:`<input type="text" value="${GM_getValue('message','')}" id="lgp_text" style="height:1.5em;width:21em;"></input>`, | ||
showCancelButton: true | ||
}).then((result)=>{ | ||
if(result.value) { | ||
GM_setValue('message',$('#lgp_text').val()) | ||
swal.fire({ | ||
icon:"success", | ||
title:"修改成功", | ||
timer:1000, | ||
showConfirmButton: false | ||
}) | ||
} | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const path = require('path') | ||
const webpack = require('webpack') | ||
const fs = require('fs') | ||
const header = fs.readFileSync('src/header.js').toString() | ||
module.exports = { | ||
entry:'./src/main.js', | ||
module: { | ||
rules:[ | ||
{ | ||
test: /\.css$/, | ||
use: ['style-loader','css-loader'] | ||
}, | ||
{ | ||
test: /\.svg$/, | ||
type: 'asset/source' | ||
} | ||
] | ||
}, | ||
output: { | ||
filename:'index.js', | ||
path:path.resolve(__dirname,'dist') | ||
}, | ||
optimization: { | ||
minimize: false | ||
}, | ||
externals: { | ||
jquery:'jQuery', | ||
sweetalert2:'Sweetalert2' | ||
}, | ||
plugins:[new webpack.BannerPlugin({banner:header,raw:true})] | ||
} |