From 8362a4c497f600638304fc82022805a2ff9252cc Mon Sep 17 00:00:00 2001 From: Aevann Date: Fri, 30 Dec 2022 21:35:23 +0200 Subject: [PATCH] js fixes --- files/assets/event/js/neko.js | 35 -------------------- files/assets/js/casino/roulette_screen.js | 40 +++++++++++------------ files/assets/js/gif_modal.js | 4 +-- files/assets/js/settings_profile.js | 2 +- files/classes/comment.py | 4 +-- files/classes/submission.py | 8 ++--- files/helpers/sanitize.py | 2 +- files/templates/event/banner.html | 1 - 8 files changed, 30 insertions(+), 66 deletions(-) delete mode 100644 files/assets/event/js/neko.js diff --git a/files/assets/event/js/neko.js b/files/assets/event/js/neko.js deleted file mode 100644 index f0376f671..000000000 --- a/files/assets/event/js/neko.js +++ /dev/null @@ -1,35 +0,0 @@ -// NEKO FOR JAVASCRIPT -// THIS SCRIPT CODE IS (C) 2004 GREGORY BELL, ALL RIGHTS RESERVED. -// ANYONE IS GRANTED THE RIGHT TO EXECUTE THIS PROGRAM BY LINKING TO IT -// IN THEIR WEB PAGE. -// -// THIS RIGHT DOES NOT EXTEND TO TAKING THE CODE AND HOSTING IT ON A DIFFERENT -// SERVER. -// -// I WORKED HARD TO MAKE THIS AND WOULD LIKE TO KEEP IT, SO PLEASE HAVE FUN -// BUT DON'T STEAL IT! -// -// THANK YOU -// -//⠀⠀⠘⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡜⠀⠀⠀ -//⠀⠀⠀⠑⡀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡔⠁⠀⠀⠀ -//⠀⠀⠀⠀⠈⠢⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⠴⠊⠀⠀⠀⠀⠀ -//⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⢀⣀⣀⣀⣀⣀⡀⠤⠄⠒⠈⠀⠀⠀⠀⠀⠀⠀⠀ -//⠀⠀⠀⠀⠀⠀⠀⠘⣀⠄⠊⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ -//⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡠⠔⠒⠒⠒⠒⠒⠢⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ -//⠀⠀⠀⠀⠀⠀⠀⡰⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠑⢄⡀⠀⠀⠀⠀⠀⠀⠀ -//⠀⠀⠀⠀⠀⠀⡸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠀⠀⠀⠀⠙⠄⠀⠀⠀⠀⠀⠀ -//⠀⠀⠀⠀⠀⢀⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠃⠀⢠⠂⠀⠀⠘⡄⠀⠀⠀⠀⠀ -//⠀⠀⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠈⢤⡀⢂⠀⢨⠀⢀⡠⠈⢣⠀⠀⠀⠀⠀ -//⠀⠀⠀⠀⠀⢀⢀⡖⠒⠶⠤⠭⢽⣟⣗⠲⠖⠺⣖⣴⣆⡤⠤⠤⠼⡄⠀⠀⠀⠀ -//⠀⠀⠀⠀⠀⠘⡈⠃⠀⠀⠀⠘⣺⡟⢻⠻⡆⠀⡏⠀⡸⣿⢿⢞⠄⡇⠀⠀⠀⠀ -//⠀⠀⠀⠀⠀⠀⢣⡀⠤⡀⡀⡔⠉⣏⡿⠛⠓⠊⠁⠀⢎⠛⡗⡗⢳⡏⠀⠀⠀⠀ -//⠀⠀⠀⠀⠀⠀⠀⢱⠀⠨⡇⠃⠀⢻⠁⡔⢡⠒⢀⠀⠀⡅⢹⣿⢨⠇⠀⠀⠀⠀ -//⠀⠀⠀⠀⠀⠀⠀⢸⠀⠠⢼⠀⠀⡎⡜⠒⢀⠭⡖⡤⢭⣱⢸⢙⠆⠀⠀⠀⠀⠀ -//⠀⠀⠀⠀⠀⠀⠀⡸⠀⠀⠸⢁⡀⠿⠈⠂⣿⣿⣿⣿⣿⡏⡍⡏⠀⠀⠀⠀⠀⠀ -//⠀⠀⠀⠀⠀⠀⢀⠇⠀⠀⠀⠀⠸⢢⣫⢀⠘⣿⣿⡿⠏⣼⡏⠀⠀⠀⠀⠀⠀⠀ -//⠀⠀⠀⠀⣀⣠⠊⠀⣀⠎⠁⠀⠀⠀⠙⠳⢴⡦⡴⢶⣞⣁⣀⣀⡀⠀⠀⠀⠀⠀ -//⠀⠐⠒⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠠⠀⢀⠤⠀⠀⠀⠀⠀⠀⠀⠈⠉⠀⠀⠀ -// - -function gE(e,i){if(l){var o=(i=i||self).document.layers;if(o[e])return o[e];for(var s=0;s ',Y=d.createElement("DIV"),Y?(Y.innerHTML=X,d.body.appendChild(Y)):void 0!==d.body.insertAdjacentHTML&&d.body.insertAdjacentHTML("BeforeEnd",X))}function byName(e,t){for(var i=0;i";this.layer=createLayer(strLayer,x,y,32,32,strContent),this.layer.Neko=this,this.homeX=this.layer.myx,this.homeY=this.layer.myy,this.doc=this.layer.document,this.doc||(this.doc=document),this.image=byName(this.doc.images,strImage),this.image.Neko=this,window.delay&&window.delay>0?this.delay=window.delay+Math.floor(nDelayVariance*Math.random()-5):this.delay=250+Math.floor(nDelayVariance*Math.random()-5),this.delayMultiplier=1,window.stepsize&&window.stepsize>0?this.stepsize=window.stepsize:this.stepsize=16,active||(active=!1),this.active=active,this.SetBehavior("resting"),this.frame=nFirstRealFrame,this.direction="",this.looseDirection="",this.endx=0,this.endy,this.distx,this.disty,this.steps,this.caught=!0,this.dx,this.dy,this.boardX=-1,this.boardY=-1,this.eccX=Math.floor(checkerboardEccentricity*Math.random()-checkerboardEccentricity/2),this.eccY=Math.floor(checkerboardEccentricity*Math.random()-checkerboardEccentricity/2),this.Think()}function NekoMessage(){var e=this.caught?sNekoMessageCaught:sNekoMessage;window.status=e}function NekoTargetMouse(){var e=mouse.x+4,t=mouse.y-20;this.endx=e,this.endy=t,box.setBoard(this.whichNeko,this.endx,this.endy)}function NekoShow(){sE(this.layer)}function NekoHide(){hE(this.layer)}function NekoTargetHome(){this.endx=this.homeX,this.endy=this.homeY}function NekoCalculateDistance(){this.distx=this.endx-this.layer.myx,this.disty=this.endy-this.layer.myy,this.steps=Math.sqrt(Math.pow(this.distx,2)+Math.pow(this.disty,2))/this.stepsize,this.steps>=1?(this.caught&&eval(this.onUnCaught),this.caught=!1):(this.caught||eval(this.onCaught),this.caught=!0),this.dx=this.distx/this.steps,this.dy=this.disty/this.steps}function NekoSetBehavior(strNewBehavior){this.behavior=strNewBehavior,this.frame=nFirstRealFrame;var paImages=eval("aNekos["+this.whichNeko+"].a_"+this.behavior);this.onCaught=paImages[0],this.onUnCaught=paImages[1],this.onLoopEnd=paImages[2],this.loopTimes=paImages[3],this.delayMultiplier=paImages[4]}function NekoUpdateImage(){var paImages=eval("aNekos["+this.whichNeko+"].a_"+this.behavior);if(this.frame>=paImages.length)if(this.behaviorRepetition++,0!=this.loopTimes&&this.behaviorRepetition>=this.loopTimes){this.behaviorRepetition=0,eval(this.onLoopEnd);var paImages=eval("aNekos["+this.whichNeko+"].a_"+this.behavior)}else this.frame=nFirstRealFrame;if(this.aGifs[this.direction+paImages[this.frame]]){var strImage=this.aGifs[this.direction+paImages[this.frame]].src;this.image.src=strImage}else if(this.aGifs[paImages[this.frame]]){var strImage=this.aGifs[paImages[this.frame]].src;this.image.src=strImage}else if(this.looseDirection+this.aGifs[paImages[this.frame]]){var strImage=this.aGifs[this.looseDirection+paImages[this.frame]].src;this.image.src=strImage}else this.image.src=this.aGifs.alert.src;this.frame++}function NekoMoveAStep(){this.steps>=1?(this.layer.myx+=this.dx,this.layer.myy+=this.dy):(this.layer.myx=this.endx,this.layer.myy=this.endy),box.checkBoard(this.whichNeko,this.layer.myx,this.layer.myy)&&(this.layer.myx+=this.eccX,this.layer.myy+=this.eccY),sX(this.layer,this.layer.myx),sY(this.layer,this.layer.myy),box.setBoard(this.whichNeko,this.layer.myx,this.layer.myy)}function NekoFindDirection(){if(0!=t||0!=e){var e=-1*this.dy,t=this.dx,i=Math.abs(t),o="",s="",a=Math.abs(e)/i,r=a<.41421,h=a>2.4142;e>0?r||(o="n"):r||(o="s"),t>0?h||(s="e"):h||(s="w"),this.looseDirection=""!=s?s:o,this.direction=o+s}else this.direction=""}function NekoThink(){this.active?this.TargetMouse():this.TargetHome(),this.CalculateDistance(),this.FindDirection(),this.UpdateImage(),"chasing"==this.behavior&&this.MoveAStep();var e=Math.floor(this.delay*this.delayMultiplier);setTimeout("aNekos["+this.whichNeko+"].Think()",e)}function nekoChooseIdle(){var e=new Array("resting","yawning","itching","scratching"),t=Math.floor(Math.random()*e.length);this.SetBehavior(e[t])}function startANeko(){var e=0,t=0;window.startNekoX&&(e=window.startNekoX),window.startNekoY&&(t=window.startNekoY),parseInt(e)!=e&&(window.onresize=function(){for(var e=0;et&&(e=t),e}function boxBoundHeight(e){0==e||e||(e=this.height());var t=this.height()-12;return e<20&&(e=20),e>t&&(e=t),e}function boxSetBoard(e,t,i){var o=Math.floor(t/this.width()*checkerboardScale),s=Math.floor(i/this.height()*checkerboardScale);o<0&&(o=0),o>=checkerboardScale&&(o=checkerboardScale-1),s<0&&(s=0),s>=checkerboardScale&&(s=checkerboardScale-1);var a=aNekos[e];return a.boardX==o&&a.boardY==s||(-1!=a.boardX&&checkerboard[a.boardX][a.boardY]--,checkerboard[o][s]++,a.boardX=o,a.boardY=s),0==checkerboard[o][s]?0:checkerboard[o][s]-1}function boxCheckBoard(e,t,i){var o=Math.floor(t/this.width()*checkerboardScale),s=Math.floor(i/this.height()*checkerboardScale);o<0&&(o=0),o>=checkerboardScale&&(o=checkerboardScale-1),s<0&&(s=0),s>=checkerboardScale&&(s=checkerboardScale-1);var a=aNekos[e],r=0;return a.boardX==o&&a.boardY==s&&(r=1),checkerboard[o][s]-r}d=document,l=d.layers,op=-1!=navigator.userAgent.indexOf("Opera"),px="px",document.write('');var checkerboardEccentricity=10,checkerboardScale=20,nDelayVariance=20,nFirstRealFrame=5,sNekoMessage="Click Neko and he'll chase your mouse!",sNekoMessageCaught=sNekoMessage,aNekos=new Array;Neko.prototype.message=NekoMessage,Neko.prototype.TargetMouse=NekoTargetMouse,Neko.prototype.Show=NekoShow,Neko.prototype.Hide=NekoHide,Neko.prototype.TargetHome=NekoTargetHome,Neko.prototype.CalculateDistance=NekoCalculateDistance,Neko.prototype.SetBehavior=NekoSetBehavior,Neko.prototype.UpdateImage=NekoUpdateImage,Neko.prototype.MoveAStep=NekoMoveAStep,Neko.prototype.FindDirection=NekoFindDirection,Neko.prototype.Think=NekoThink,Neko.prototype.chooseIdle=nekoChooseIdle,window.onloadOriginal=new Function,window.onload&&(window.onloadOriginal=window.onload),window.NekoNoDefault||(window.onload=startANeko),mouse=new mouse,box.prototype.boundWidth=boxBoundWidth,box.prototype.boundHeight=boxBoundHeight,box.prototype.setBoard=boxSetBoard,box.prototype.checkBoard=boxCheckBoard,box=new box,document.onmousemove=function(e){var t=e?e.pageX:event.x+document.body.scrollLeft,i=e?e.pageY:event.y+document.body.scrollTop;mouse.x=box.boundWidth(t),mouse.y=box.boundHeight(i)},document.captureEvents&&document.captureEvents(Event.MOUSEMOVE);for(var checkerboard=new Array(checkerboardScale),i=0;i
-
Line 1
-
Line 2
-
Line 3
-
Line 4
-
Line 5
-
Line 6
+
Line 1
+
Line 2
+
Line 3
+
Line 4
+
Line 5
+
Line 6
`; // First Column html += "
"; - html += `
00
` + html += `
00
` for (let i = 1; i < 13; i++) { const correctNumber = CELL_TO_NUMBER_LOOKUP[i]; const isRed = reds.includes(correctNumber); @@ -79,7 +79,7 @@ function buildRouletteTable() {
`; } - html += `
Col 3
`; + html += `
Col 3
`; html += ""; // Second Column @@ -97,12 +97,12 @@ function buildRouletteTable() { `; } - html += `
Col 2
`; + html += `
Col 2
`; html += ""; // Third Column html += "
"; - html += `
0
` + html += `
0
` for (let i = 25; i < 37; i++) { const correctNumber = CELL_TO_NUMBER_LOOKUP[i]; const isRed = reds.includes(correctNumber); @@ -115,26 +115,26 @@ function buildRouletteTable() {
`; } - html += `
Col 1
`; + html += `
Col 1
`; html += ""; // Line Bets and 1:1 Bets html += `
-
1st12
-
2nd12
-
3rd12
+
1st12
+
2nd12
+
3rd12
-
1:18
-
EVEN
-
RED
-
BLACK
-
ODD
-
19:36
+
1:18
+
EVEN
+
RED
+
BLACK
+
ODD
+
19:36
`; diff --git a/files/assets/js/gif_modal.js b/files/assets/js/gif_modal.js index abe81a9a5..f2094afa4 100644 --- a/files/assets/js/gif_modal.js +++ b/files/assets/js/gif_modal.js @@ -133,9 +133,9 @@ async function searchGifs(searchTerm) { container.innerHTML = ''; - backBtn.innerHTML = ''; + backBtn.innerHTML = ``; - cancelBtn.innerHTML = ''; + cancelBtn.innerHTML = ``; let response = await fetch("/giphy?searchTerm=" + searchTerm + "&limit=48"); let data = await response.json() diff --git a/files/assets/js/settings_profile.js b/files/assets/js/settings_profile.js index 7b6d9fefb..6c29a5ad0 100644 --- a/files/assets/js/settings_profile.js +++ b/files/assets/js/settings_profile.js @@ -89,7 +89,7 @@ function updatebgselection(){ let bgsDir = backgrounds[bgselector.selectedIndex].folder; for (i=0; i < bgsToDisplay.length; i++) { let onclickPost = bgsDir + "/" + bgsToDisplay[i]; - str += ``; + str += ``; } bgContainer.innerHTML = str; } diff --git a/files/classes/comment.py b/files/classes/comment.py index fd6b5d339..aeb6afb8a 100644 --- a/files/classes/comment.py +++ b/files/classes/comment.py @@ -280,9 +280,9 @@ class Comment(Base): if v: sub = self.post.sub if sub in {'furry','vampire','racist','femboy'} and not v.house.lower().startswith(sub): body += ' disabled ' - body += f''' onchange="poll_vote_{o.exclusive}('{o.id}', '{self.id}', 'comment')"''' + body += f''' data-nonce="{{g.nonce}}" data-onclick="poll_vote_{o.exclusive}('{o.id}', '{self.id}', 'comment')"''' else: - body += f''' onchange="poll_vote_no_v()"''' + body += f''' data-nonce="{{g.nonce}}" data-onclick="poll_vote_no_v()"''' body += f'''>