Skip to content

Commit

Permalink
Add button to disable autoscroll because it's really annoying
Browse files Browse the repository at this point in the history
  • Loading branch information
Dpeta committed May 29, 2024
1 parent 1e29eda commit 948e45f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion index-src.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ <h1 class='no-centertxt no-pixelated'>
<p>An online Pesterchum client! Not to be confused with the previous pco(s) which shut down. This isn't a fully-fledged replacement for <a href="https://github.com/Dpeta/pesterchum-alt-servers/releases">the desktop client</a>, mostly just to be an alternate way to still chat with people on it :3</p>
<p>Now up on <a href="https://github.com/Dpeta/PesterchumOnlineButSilly">GitHub</a> and under the <a href="agpl-3.0-standalone.html">AGPL</a>,</p>
<p class="pixelated"> woo yeah woo yeah <img src="smilies/3_big.gif"> </p>
<footer class='centertxt'>Last update: 2023-03-11</footer>
<footer class='centertxt'>Last update: 2024-05-29</footer>
<div id="notice"><!--<a href="javascript.html" rel="jslicense">JavaScript license information</a> --><img src="img/agplv3-155x51.png"></div>
</div>
<div class='centered border-radius-effect'>
Expand Down
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
<!-- When hosting on an actual web server the CSP should be more restrictive. (hash for script-src) -->

<link rel="preload" href="style.css" integrity="sha256-zAk62ZPjXKXNFeeDtF0CnMNh2RJ60HP8r4LgYzyK6tY=" as="style">
<link rel="preload" href="dist/pesterchum.js" integrity="sha256-v5atVtKkJxSHiCK+YwuTyQUiye7rKgAnqbUFJrnDLms=" as="script"> <!-- integrity hash without babel :3 -->
<link rel="preload" href="dist/pesterchum.js" integrity="sha256-wHQ6a48c9belrRTvTkbT3qqsAVv/3SoHwOfWKCG3n3w=" as="script"> <!-- integrity hash without babel :3 -->

<link rel="icon" href="favicon.ico">
<link rel="canonical" href="https://pesterchum.online">
<link rel="stylesheet" integrity="sha256-zAk62ZPjXKXNFeeDtF0CnMNh2RJ60HP8r4LgYzyK6tY=" href="style.css">
<script src="dist/pesterchum.js" integrity="sha256-v5atVtKkJxSHiCK+YwuTyQUiye7rKgAnqbUFJrnDLms=" defer></script>
<script src="dist/pesterchum.js" integrity="sha256-wHQ6a48c9belrRTvTkbT3qqsAVv/3SoHwOfWKCG3n3w=" defer></script>

<title>Pesterchum Online</title>
</head>
Expand Down
22 changes: 21 additions & 1 deletion src/pesterchum.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ const _userPrefix = /^(@|&#38;|~|&|\+)+/
const _honk = /honk/gi
const _smilies = /:rancorous:|:apple:|:bathearst:|:cathearst:|:woeful:|:sorrow:|:pleasant:|:blueghost:|:slimer:|:candycorn:|:cheer:|:duhjohn:|:datrump:|:facepalm:|:bonk:|:mspa:|:gun:|:cal:|:amazedfirman:|:amazed:|:chummy:|:cool:|:smooth:|:distraughtfirman|:distraught:|:insolent:|:bemused:|:3:|:mystified:|:pranky:|:tense:|:record:|:squiddle:|:tab:|:beetip:|:flipout:|:befuddled:|:pumpkin:|:trollcool:|:jadecry:|:ecstatic:|:relaxed:|:discontent:|:devious:|:sleek:|:detestful:|:mirthful:|:manipulative:|:vigorous:|:perky:|:acceptant:|:olliesouty:|:billiards:|:billiardslarge:|:whatdidyoudo:|:brocool:|:trollbro:|:playagame:|:trollc00l:|:suckers:|:scorpio:|:shades:|:honk:/g

// other stuff..?
let autoscroll = true

// Audio
let alarmMemo
let alarmDm
Expand Down Expand Up @@ -1228,7 +1231,9 @@ class PesterchumOnlineClient {
this.tabs[n].textfield.hidden = true
}
}
this.textarea.scrollTop = this.textarea.scrollHeight // Scroll to bottom
if (autoscroll) {
this.textarea.scrollTop = this.textarea.scrollHeight // Scroll to bottom
}
}

addText (source, target, msg) {
Expand Down Expand Up @@ -1356,6 +1361,7 @@ class PesterchumOnlineClient {
'<div class="action-button-wrapper">' +
'<button class="menu-button">Audio</button>' +
'<button class="menu-button">Edit theme</button>' +
'<button class="menu-button" id="autoscroll_button">Disable autoscroll</button>' +
'</div>' +
'</div>' +
'<button class=\'hidebutton\' id=\'hideMemoUsers\'>&#8594;</button>' + // -->
Expand Down Expand Up @@ -1502,6 +1508,20 @@ let dmAudio=true
}
}
)

// Gently puts my silly button event here...
// idk where anything goes anymore LOL
const autoscrollButton = document.getElementById('autoscroll_button')
autoscrollButton.addEventListener('click', function (event) {
if (event.currentTarget.innerHTML === 'Disable autoscroll') {
event.currentTarget.innerHTML = 'Enable autoscroll'
autoscroll = false
} else {
event.currentTarget.innerHTML = 'Disable autoscroll'
autoscroll = true
}
}
)
}

clear () {
Expand Down

0 comments on commit 948e45f

Please sign in to comment.