-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
130 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,12 @@ | ||
{ | ||
"name": "plexstorm_chat", | ||
"main": "www/index.html", | ||
"version": "0.0.1", | ||
"window": { | ||
"title": "Plexstorm Chat", | ||
"toolbar": false, | ||
"width": 350, | ||
"height": 260 | ||
}, | ||
"chromium-args" : "--disable-gpu" | ||
} |
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,118 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Plexstorm Chat Room Capture</title> | ||
<style> | ||
html, body, webview { | ||
width: 100%; | ||
height: 100%; | ||
overflow:hidden; | ||
text-align: center; | ||
margin: 0 0 0 0; | ||
padding: 0 0 0 0; | ||
} | ||
|
||
</style> | ||
</head> | ||
<body> | ||
<h1 id ="infoText">PlexStorm Chat Room<br>Capture V0.0.1<br>by a161803398</h1> | ||
<button id="loadChatBtn"><h1>Start Capturing</h1></button> | ||
<h1 id ="indicator"></h1> | ||
</body> | ||
<script> | ||
|
||
const toInject = ()=> { | ||
const form = document.getElementsByTagName('form')[0]; | ||
if(typeof form != 'undefined'){ | ||
form.submit(); | ||
} | ||
|
||
const chatCol = document.getElementsByClassName('chat-column')[0]; | ||
if(typeof chatCol != 'undefined'){ | ||
document.removeChild(document.documentElement); | ||
const body = document.createElement("body"); | ||
|
||
document.appendChild(body); | ||
|
||
body.appendChild(chatCol); | ||
|
||
const chatSection = document.getElementsByClassName('chat')[0]; | ||
chatSection.style.height = "100%"; | ||
|
||
const sending = document.getElementsByClassName('sending-area')[0]; | ||
const ranking = document.getElementsByClassName('ranking')[0]; | ||
sending.parentElement.removeChild(sending); | ||
ranking.parentElement.removeChild(ranking); | ||
|
||
|
||
const style = document.createElement("style"); | ||
body.appendChild(style); | ||
style.sheet.insertRule("html, body {overflow:hidden;background-color: #000000;font-weight: bold;}"); | ||
style.sheet.insertRule("svg, .timestamp, .ps__scrollbar-x-rail, .ps__scrollbar-y-rail, .hint {display:none;}"); | ||
style.sheet.insertRule(".row p, .row div {display:inline;}"); | ||
style.sheet.insertRule(".row {color: #ffffff;font-size: 20px;}"); | ||
style.sheet.insertRule(".row.type-tip {color: #ffff00;}"); | ||
style.sheet.insertRule(".type-normal .color-male {color: #00ffff;}"); | ||
style.sheet.insertRule(".type-normal .color-female {color: #ff69b4;}"); | ||
style.sheet.insertRule(".type-normal .color-trans {color: #ff00ff;}"); | ||
style.sheet.insertRule(".type-normal.type-moderator .color-male {color: #ffff00;}"); | ||
style.sheet.insertRule(".type-normal.type-moderator .color-female {color: #ff4500;}"); | ||
style.sheet.insertRule(".type-normal.type-moderator .color-trans {color: #ffa07a}"); | ||
|
||
const msgArea = document.getElementsByClassName('message-area')[0]; | ||
const placehold = document.createElement("div"); | ||
placehold.classList.add("row"); | ||
placehold.innerHTML = "Connect to chat room successfully!!"; | ||
msgArea.appendChild(placehold); | ||
|
||
const observer = new MutationObserver((m)=>{ | ||
window.scrollBy(0,1000); | ||
}); | ||
|
||
observer.observe(chatCol, { | ||
childList: true, | ||
subtree: true | ||
}); | ||
} | ||
}; | ||
|
||
const webview = document.createElement('webview'); | ||
document.body.appendChild(webview); | ||
const indicator = document.getElementById('indicator'); | ||
|
||
webview.addEventListener('loadstart', (e) => { | ||
indicator.style.display = ''; | ||
indicator.innerText = 'Please Wait...'; | ||
}); | ||
|
||
webview.addEventListener('loadredirect', (e) => { | ||
if(e.newUrl === 'https://plexstorm.com/'){ | ||
alert('Cannot capture chat room, please make sure that the streaming is started!!'); | ||
indicator.style.display = 'none'; | ||
infoText.style.display = ''; | ||
loadChatBtn.style.display = ''; | ||
webview.src = 'about:blank'; | ||
} | ||
}); | ||
//webview.addEventListener('loadstop', (e) => { | ||
webview.addEventListener('loadcommit', (e) => { | ||
indicator.style.display = 'none'; | ||
webview.executeScript({ code: '(' + toInject.toString() + ')();' }); | ||
}); | ||
|
||
|
||
const loadChatBtn = document.getElementById('loadChatBtn'); | ||
const infoText = document.getElementById('infoText'); | ||
|
||
loadChatBtn.addEventListener('click', (e)=>{ | ||
const val = prompt("Please input your PlexStorm streaming url(Make sure that the streaming is started)", "https://plexstorm.com/stream/hornydragon"); | ||
if(val !== null){ | ||
infoText.style.display = 'none'; | ||
loadChatBtn.style.display = 'none'; | ||
webview.src = val; | ||
} | ||
}); | ||
|
||
</script> | ||
</html> |