master
Aevann1 2021-11-30 19:55:33 +02:00
parent 17758ca0f8
commit 1a9997f6e3
25 changed files with 129 additions and 18 deletions

View File

@ -12,6 +12,7 @@
{% block fixedMobileBarJS %}
<script>
window.addEventListener('DOMContentLoaded', function() {
var prevScrollpos = window.pageYOffset;
window.onscroll = function () {
var currentScrollPos = window.pageYOffset;
@ -31,6 +32,8 @@
}
prevScrollpos = currentScrollPos;
}
});
</script>
{% endblock %}

View File

@ -40,6 +40,7 @@
{% block fixedMobileBarJS %}
<script>
window.addEventListener('DOMContentLoaded', function() {
var prevScrollpos = window.pageYOffset;
window.onscroll = function () {
var currentScrollPos = window.pageYOffset;
@ -59,6 +60,8 @@
}
prevScrollpos = currentScrollPos;
}
});
</script>
{% endblock %}

View File

@ -1,5 +1,6 @@
<script>
window.addEventListener('DOMContentLoaded', function() {
const banModal = function(link, id, name) {
document.getElementById("banModalTitle").innerHTML = `Ban @${name}`;
document.getElementById("ban-modal-link").value = link;
@ -22,6 +23,8 @@
xhr.send(fd);
}
};
});
</script>
<div class="modal fade" id="banModal" tabindex="-1" role="dialog" aria-labelledby="banModalTitle" aria-hidden="true">

View File

@ -28,15 +28,19 @@
{% if p and not (v and v.id==c.author_id) and (not v or v.highlightcomments) %}
<script>
window.addEventListener('DOMContentLoaded', function() {
comments = JSON.parse(localStorage.getItem("comment-counts")) || {}
lastCount = comments['{{p.id}}']
if (lastCount && {{c.created_utc*1000}} > lastCount.t) {
document.getElementById("reddot-{{c.id}}").innerHTML = '<i style="color:red !important" class="text-admin fas fa-circle" data-bs-toggle="tooltip" data-bs-placement="bottom" title="" data-bs-original-title="Unread"></i>'
}
</script>
});
</script>
{% endif %}
<script>
window.addEventListener('DOMContentLoaded', function() {
(() => {
const date = new Date({{c.created_utc*1000}});
document.getElementById('timestamp-{{c.id}}').title = date.toString();
@ -50,6 +54,8 @@
{%endif%}
{%endif%}
})()
});
</script>
<div style="display:none" id="popover-{{c.id}}">
@ -791,6 +797,7 @@
{% endif %}
<script>
window.addEventListener('DOMContentLoaded', function() {
function collapse_comment(comment_id) {
const comment = "comment-" + comment_id
const element = document.getElementById(comment)
@ -808,12 +815,15 @@
var myToast = new bootstrap.Toast(document.getElementById('toast-success'));
myToast.show();
});
});
</script>
{% include "expanded_image_modal.html" %}
<script>
window.addEventListener('DOMContentLoaded', function() {
function poll_vote(cid, parentid) {
{% if v %}
for(let el of document.getElementsByClassName('presult-'+parentid)) {
@ -845,6 +855,8 @@
html: true,
});
})
});
</script>
</body>

View File

@ -290,12 +290,16 @@
<script src="/assets/js/lozad.js?v=53"></script>
<script>
window.addEventListener('DOMContentLoaded', function() {
const observer = lozad();
observer.observe();
});
</script>
{% if v and v.agendaposter %}
<script>
window.addEventListener('DOMContentLoaded', function() {
var BugDispatch={options:{minDelay:500,maxDelay:1E4,minBugs:2,maxBugs:20,minSpeed:5,maxSpeed:10,maxLargeTurnDeg:150,maxSmallTurnDeg:10,maxWiggleDeg:5,imageSprite:"fly-sprite.webp",bugWidth:13,bugHeight:14,num_frames:5,zoom:10,canFly:!0,canDie:!0,numDeathTypes:3,monitorMouseMovement:!1,eventDistanceToBug:40,minTimeBetweenMultipy:1E3,mouseOver:"random"},initialize:function(a){this.options=mergeOptions(this.options,a);this.options.minBugs>this.options.maxBugs&&(this.options.minBugs=this.options.maxBugs);
this.modes=["multiply","nothing"];this.options.canFly&&this.modes.push("fly","flyoff");this.options.canDie&&this.modes.push("die");-1==this.modes.indexOf(this.options.mouseOver)&&(this.options.mouseOver="random");this.transform=null;this.transforms={Moz:function(a){this.bug.style.MozTransform=a},webkit:function(a){this.bug.style.webkitTransform=a},O:function(a){this.bug.style.OTransform=a},ms:function(a){this.bug.style.msTransform=a},Khtml:function(a){this.bug.style.KhtmlTransform=a},w3c:function(a){this.bug.style.transform=
a}};if("transform"in document.documentElement.style)this.transform=this.transforms.w3c;else{var b=["Moz","webkit","O","ms","Khtml"],c=0;for(c=0;c<b.length;c++)if(b[c]+"Transform"in document.documentElement.style){this.transform=this.transforms[b[c]];break}}if(this.transform){this.bugs=[];b="multiply"===this.options.mouseOver?this.options.minBugs:this.random(this.options.minBugs,this.options.maxBugs,!0);c=0;var d=this;for(c=0;c<b;c++){a=JSON.parse(JSON.stringify(this.options));var e=SpawnBug();a.wingsOpen=
@ -343,7 +347,9 @@
maxBugs: 1,
mouseOver: "fly"
});
</script>
});
</script>
<noscript>
<style>
body {
@ -357,7 +363,9 @@
{% endif %}
{% if v %}
<script>function formkey() {return '{{v.formkey}}';}</script>
<script>
function formkey() {return '{{v.formkey}}';}
</script>
<script src="/assets/js/default.js?v=55"></script>
{% endif %}

View File

@ -2,5 +2,8 @@
<script src="/assets/js/twitter.js" charset="utf-8">
</script>
<script>
window.addEventListener('DOMContentLoaded', function() {
document.getElementById('twitter-widget-0').setAttribute('sandbox','')
});
</script>

View File

@ -2,5 +2,8 @@
<script src="https://platform.twitter.com/widgets.js" charset="utf-8">
</script>
<script>
window.addEventListener('DOMContentLoaded', function() {
document.getElementById('twitter-widget-0').setAttribute('sandbox','')
});
</script>

View File

@ -1,10 +1,13 @@
<script>
window.addEventListener('DOMContentLoaded', function() {
function expandDesktopImage(image) {
document.getElementById("desktop-expanded-image").src = image.replace("200w_d.webp", "giphy.webp");
document.getElementById("desktop-expanded-image-link").href = image;
document.getElementById("desktop-expanded-image-wrap-link").href=image;
};
});
</script>

View File

@ -1,11 +1,14 @@
{% extends "default.html" %}
{% block content %}
<script>
window.addEventListener('DOMContentLoaded', function() {
function removeFollower(event, username) {
post_toast('/remove_follow/' + username);
let table = document.getElementById("followers-table");
table.removeChild(event.target.parentElement.parentElement);
}
});
</script>
<pre>

View File

@ -1,11 +1,14 @@
{% extends "default.html" %}
{% block content %}
<script>
window.addEventListener('DOMContentLoaded', function() {
function removeFollower(event, username) {
post_toast('/unfollow/' + username);
let table = document.getElementById("followers-table");
table.removeChild(event.target.parentElement.parentElement);
}
});
</script>
<pre>

View File

@ -213,7 +213,11 @@
</div>
</nav>
{% if v %}<script>function formkey() {return '{{v.formkey}}';}</script>{% endif %}
{% if v %}
<script>
function formkey() {return '{{v.formkey}}';}
</script>
{% endif %}
<script src="/assets/js/header.js?v=54"></script>
<style>

View File

@ -9,6 +9,7 @@
{% if not v.fp %}
<script>
window.addEventListener('DOMContentLoaded', function() {
function fp(fp) {
var xhr = new XMLHttpRequest();
xhr.open("POST", '{{request.host_url}}fp/'+fp, true);
@ -31,7 +32,9 @@
fpPromise
.then(fp => fp.get())
.then(result => {if (result.visitorId != '{{v.fp}}') fp(result.visitorId);})
</script>
});
</script>
{% endif %}
{% endif %}
@ -171,6 +174,7 @@
</div>
<script>
window.addEventListener('DOMContentLoaded', function() {
if (!("standalone" in window.navigator) && window.navigator.standalone) {
if (window.innerWidth <= 737) {
document.getElementById('mobile-prompt').show()
@ -183,12 +187,15 @@
}
}
}
</script>
});
</script>
{% endif %}
{% if v %}
<script src="https://js.pusher.com/beams/1.0/push-notifications-cdn.js"></script>
<script>
window.addEventListener('DOMContentLoaded', function() {
const beamsClient = new PusherPushNotifications.Client({
instanceId: '02ddcc80-b8db-42be-9022-44c546b4dce6',
});
@ -197,7 +204,9 @@
.then(() => beamsClient.addDeviceInterest('{{v.strid}}'))
.then(() => beamsClient.getDeviceInterests())
.catch(console.error);
</script>
});
</script>
{% endif %}
{% endblock %}

View File

@ -125,11 +125,14 @@
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.8/dist/clipboard.min.js"></script>
<script>
window.addEventListener('DOMContentLoaded', function() {
var clipboard = new ClipboardJS('.copy-link');
clipboard.on('success', function(e) {
var myToast = new bootstrap.Toast(document.getElementById('toast-success'));
myToast.show();
});
});
</script>
{% endblock %}

View File

@ -240,6 +240,9 @@
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.8/dist/clipboard.min.js"></script>
<script>
function formkey() {return '{{v.formkey}}';}
window.addEventListener('DOMContentLoaded', function() {
var clipboard = new ClipboardJS('.copy-link');
clipboard.on('success', function(e) {
var myToast = new bootstrap.Toast(document.getElementById('toast-success'));
@ -249,8 +252,7 @@
function emailVerifyText() {
document.getElementById("email-verify-text").innerHTML = "Verification email sent! Please check your inbox.";
}
function formkey() {return '{{v.formkey}}';}
});
</script>
<style>

View File

@ -170,8 +170,9 @@
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/js/bootstrap.bundle.min.js"></script>
<script>function formkey() {return '{{v.formkey}}';}</script>
<script>
function formkey() {return '{{v.formkey}}';}
</script>
</body>

View File

@ -6,6 +6,7 @@
<script>
window.addEventListener('DOMContentLoaded', function() {
block_user=function() {
var exileForm = document.getElementById("exile-form");
@ -39,6 +40,8 @@
xhr.send(f)
}
}
});
</script>
<div class="row">

View File

@ -38,12 +38,15 @@
</div>
{% if v.agendaposter %}
<script>
window.addEventListener('DOMContentLoaded', function() {
const flip = (e) => {
e.preventDefault();
document.getElementsByTagName("body")[0].setAttribute("style", "-moz-transform: scale(-1, -1);-o-transform: scale(-1, -1);-webkit-transform: scale(-1, -1);transform: scale(-1, -1);");
};
document.getElementById("submit-btn").onclick = flip;
});
</script>
{% endif %}
</div>

View File

@ -685,6 +685,7 @@
<script src="/assets/js/settings_profile.js?v=58"></script>
<script>
window.addEventListener('DOMContentLoaded', function() {
document.onpaste = function(event) {
var focused = document.activeElement;
if (focused.id == 'bio-text') {
@ -698,6 +699,8 @@
}
}
}
});
</script>
{% include "emoji_modal.html" %}

View File

@ -5,11 +5,14 @@
{% block content %}
<script>
window.addEventListener('DOMContentLoaded', function() {
document.getElementById('new_email').addEventListener('input', function () {
document.getElementById("email-password").classList.remove("d-none");
document.getElementById("email-password-label").classList.remove("d-none");
document.getElementById("emailpasswordRequired").classList.remove("d-none");
});
});
</script>
<div class="row">

View File

@ -806,6 +806,7 @@
</div>
<script>
window.addEventListener('DOMContentLoaded', function() {
(() => {
const date = new Date({{p.created_utc*1000}});
document.getElementById('timestamp').title = date.toString();
@ -834,6 +835,8 @@
{%endif%}
{%endif%}
})()
});
</script>
{% if v and v.id==p.author_id %}
@ -849,7 +852,8 @@
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.8/dist/clipboard.min.js"></script>
{% if v and (v.id == p.author_id or v.admin_level > 1 and v.admin_level > 2) %}
<script>
<script>
window.addEventListener('DOMContentLoaded', function() {
togglePostEdit=function(id){
body=document.getElementById("post-body");
@ -862,12 +866,15 @@
form.classList.toggle("d-none");
autoExpand(box);
};
</script>
});
</script>
{% endif %}
{% if not p.comment_count %}
<script>
window.addEventListener('DOMContentLoaded', function() {
function poll_vote(cid) {
{% if v %}
for(let el of document.getElementsByClassName('presult')) {
@ -885,7 +892,9 @@
document.getElementById('toast-post-error-text').innerText = "Only logged-in users can vote!";
{% endif %}
}
</script>
});
</script>
{% if v %}
<script src="/assets/js/comments_v.js?v=73"></script>
@ -904,6 +913,7 @@
{% set minbugs = 10*p.award_count("shit") if p.award_count("shit") < 3 else 20 %}
{% set maxbugs = 20*p.award_count("shit") if p.award_count("shit") < 3 else 40 %}
<script>
window.addEventListener('DOMContentLoaded', function() {
new BugController({
imageSprite: "/assets/images/fly-sprite.webp",
canDie: false,
@ -911,7 +921,9 @@
maxBugs: {{maxbugs}},
mouseOver: "multiply"
});
</script>
});
</script>
{% endif %}
@ -920,6 +932,7 @@
{% set minbugs = 10*p.award_count("fireflies") if p.award_count("fireflies") < 3 else 20 %}
{% set maxbugs = 20*p.award_count("fireflies") if p.award_count("fireflies") < 3 else 40 %}
<script>
window.addEventListener('DOMContentLoaded', function() {
new BugController({
imageSprite: "/assets/images/fireflies.webp",
canDie: false,
@ -927,7 +940,9 @@
maxBugs: {{maxbugs}},
mouseOver: "multiply"
});
</script>
});
</script>
{% endif %}

View File

@ -54,6 +54,7 @@
</div>
<script>
window.addEventListener('DOMContentLoaded', function() {
(() => {
const date = new Date({{p.created_utc*1000}});
document.getElementById('timestamp-{{p.id}}').title = date.toString();
@ -75,6 +76,8 @@
{%endif%}
{%endif%}
})()
});
</script>
{% set ups=p.upvotes %}
@ -659,6 +662,7 @@
<script src="/assets/js/popover.js?v=2"></script>
<script>
window.addEventListener('DOMContentLoaded', function() {
function expandText(id) {
document.getElementById('post-text-'+id).classList.toggle('d-none');
document.getElementsByClassName('text-expand-icon-'+id)[0].classList.toggle('fa-expand-alt');
@ -681,6 +685,8 @@
html: true,
});
})
});
</script>
{% if v %}

View File

@ -35,6 +35,7 @@
{% if v %}
<script>
window.addEventListener('DOMContentLoaded', function() {
const TRANSFER_TAX = {% if v.patron or u.patron %}0{% else %}0.03{% endif %};
function updateTax(mobile=false) {
@ -66,11 +67,14 @@
setTimeout(_ => t.disabled = false, 2000);
}
</script>
});
</script>
{% endif %}
{% if u.song %}
<script>
window.addEventListener('DOMContentLoaded', function() {
var audio = new Audio('/songs/{{u.id}}');
audio.loop=true;
@ -99,7 +103,9 @@
}, {once : true});
});
</script>
});
</script>
{% endif %}
<div class="row d-none d-md-block">

View File

@ -4,6 +4,7 @@
{% block fixedMobileBarJS %}
<script>
window.addEventListener('DOMContentLoaded', function() {
var prevScrollpos = window.pageYOffset;
window.onscroll = function () {
var currentScrollPos = window.pageYOffset;
@ -23,6 +24,8 @@
}
prevScrollpos = currentScrollPos;
}
});
</script>
{% endblock %}

View File

@ -4,6 +4,7 @@
{% block fixedMobileBarJS %}
<script>
window.addEventListener('DOMContentLoaded', function() {
var prevScrollpos = window.pageYOffset;
window.onscroll = function () {
var currentScrollPos = window.pageYOffset;
@ -23,6 +24,8 @@
}
prevScrollpos = currentScrollPos;
}
});
</script>
{% endblock %}

View File

@ -4,6 +4,7 @@
{% block fixedMobileBarJS %}
<script>
window.addEventListener('DOMContentLoaded', function() {
var prevScrollpos = window.pageYOffset;
window.onscroll = function () {
var currentScrollPos = window.pageYOffset;
@ -23,6 +24,8 @@
}
prevScrollpos = currentScrollPos;
}
});
</script>
{% endblock %}