put js files not made by us in a folder

master
Aevann1 2022-11-18 21:16:40 +02:00
parent 2075311901
commit ce24c24e1d
30 changed files with 171 additions and 2790 deletions

View File

@ -0,0 +1,126 @@
marked.use({
extensions: [
{
name: 'mention',
level: 'inline',
start: function(src){
const match = src.match(/@[a-zA-Z0-9_\-]+/);
return match != null ? match.index : -1;
},
tokenizer: function(src) {
const rule = /^@[a-zA-Z0-9_\-]+/;
const match = rule.exec(src);
if(match){
return {
type: 'mention',
raw: match[0],
text: match[0].trim().slice(1),
tokens: []
};
}
},
renderer(token) {
const u = token.raw;
return `<a href="/${u}"><img src="/${u}/pic" class="pp20"> ${u}</a>`;
}
}
]
});
const reDisableBeforeUnload = /^\/submit|^\/h\/[a-zA-Z0-9_\-]{3,20}\/submit/;
function markdown(t) {
let input = t.value;
if (!reDisableBeforeUnload.test(location.pathname))
{
if (!window.onbeforeunload)
{
window.onbeforeunload = function (e) {
e = e || window.event;
if (e) {
e.returnValue = 'Any string';
}
return 'Any string';
};
}
else if (!input) {
window.onbeforeunload = null
}
}
if (!input.includes('```') && !input.includes('<pre>'))
input = input.replace(/\n/g, '\n\n')
input = input.replace(/\|\|(.*?)\|\|/g, '<spoiler>$1</spoiler>')
input = input.replace(/(\n|^)>([^ >][^\n]*)/g, '$1<g>\>$2</g>')
var emojis = Array.from(input.matchAll(/:([a-z0-9_\-!#@]{1,36}):(?!\/)/gi))
if(emojis != null){
for(i = 0; i < emojis.length; i++){
var old = emojis[i][0];
if (old.includes('marseyrandom')) continue
var emoji = old.replace(/[:!@#]/g,'').toLowerCase();
var mirroredClass = old.indexOf('!') == -1 ? '' : 'mirrored';
var emojiClass = old.indexOf('#') == -1 ? 'emoji' : 'emoji-lg';
if (emoji.endsWith('pat') && emoji != 'marseyunpettablepat') {
emoji = emoji.substr(0, emoji.length - 3);
var url = old.indexOf('@') != -1 ? `/@${emoji}/pic` : `/e/${emoji}.webp`;
input = input.replace(old, `<span class="pat-preview ${mirroredClass}" data-bs-toggle="tooltip"><img src="/i/hand.webp"><img class="${emojiClass}" src="${url}"></span>`);
} else {
input = input.replace(old, `<img class="${emojiClass} ${mirroredClass}" src="/e/${emoji}.webp">`);
}
}
}
let options = Array.from(input.matchAll(/\s*\$\$([^\$\n]+)\$\$\s*/gi))
if(options != null){
for(i = 0; i < options.length; i++){
var option = options[i][0];
var option2 = option.replace(/\$\$/g, '').replace(/\n/g, '')
input = input.replace(option, '');
input += `<div class="custom-control"><input type="checkbox" class="custom-control-input" id="option-${i}"><label class="custom-control-label" for="option-${i}">${option2} - <a>0 votes</a></label></div>`;
}
}
options = Array.from(input.matchAll(/\s*&&([^\$\n]+)&&\s*/gi))
if(options != null){
for(i = 0; i < options.length; i++){
var option = options[i][0];
var option2 = option.replace(/&&/g, '').replace(/\n/g, '')
input = input.replace(option, '');
input += `<div class="custom-control"><input type="radio" name="choice" class="custom-control-input" id="option-${i}"><label class="custom-control-label" for="option-${i}">${option2} - <a>0 votes</a></label></div>`;
}
}
input = marked(input)
input = input.replace(/\n\n/g, '<br>')
document.getElementById(t.dataset.preview).innerHTML = input
}
function charLimit(form, text) {
var input = document.getElementById(form);
var text = document.getElementById(text);
var length = input.value.length;
var maxLength = input.getAttribute("maxlength");
if (length >= maxLength) {
text.style.color = "#E53E3E";
}
else if (length >= maxLength * .72){
text.style.color = "#FFC107";
}
else {
text.style.color = "#A0AEC0";
}
text.innerText = length + ' / ' + maxLength;
}
function remove_dialog() {
window.onbeforeunload = null;
}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1 @@
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.lozad=e()}(this,function(){"use strict";var g="undefined"!=typeof document&&document.documentMode,f={rootMargin:"0px",threshold:0,load:function(t){if("picture"===t.nodeName.toLowerCase()){var e=t.querySelector("img"),r=!1;null===e&&(e=document.createElement("img"),r=!0),g&&t.getAttribute("data-iesrc")&&(e.src=t.getAttribute("data-iesrc")),t.getAttribute("data-alt")&&(e.alt=t.getAttribute("data-alt")),r&&t.append(e)}if("video"===t.nodeName.toLowerCase()&&!t.getAttribute("data-src")&&t.children){for(var a=t.children,o=void 0,i=0;i<=a.length-1;i++)(o=a[i].getAttribute("data-src"))&&(a[i].src=o);t.load()}t.getAttribute("data-poster")&&(t.poster=t.getAttribute("data-poster")),t.getAttribute("data-src")&&(t.src=t.getAttribute("data-src")),t.getAttribute("data-srcset")&&t.setAttribute("srcset",t.getAttribute("data-srcset"));var n=",";if(t.getAttribute("data-background-delimiter")&&(n=t.getAttribute("data-background-delimiter")),t.getAttribute("data-background-image"))t.style.backgroundImage="url('"+t.getAttribute("data-background-image").split(n).join("'),url('")+"')";else if(t.getAttribute("data-background-image-set")){var d=t.getAttribute("data-background-image-set").split(n),u=d[0].substr(0,d[0].indexOf(" "))||d[0];u=-1===u.indexOf("url(")?"url("+u+")":u,1===d.length?t.style.backgroundImage=u:t.setAttribute("style",(t.getAttribute("style")||"")+"background-image: "+u+"; background-image: -webkit-image-set("+d+"); background-image: image-set("+d+")")}t.getAttribute("data-toggle-class")&&t.classList.toggle(t.getAttribute("data-toggle-class"))},loaded:function(){}};function A(t){t.setAttribute("data-loaded",!0)}var m=function(t){return"true"===t.getAttribute("data-loaded")},v=function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:document;return t instanceof Element?[t]:t instanceof NodeList?t:e.querySelectorAll(t)};return function(){var r,a,o=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"[data-src]",t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},e=Object.assign({},f,t),i=e.root,n=e.rootMargin,d=e.threshold,u=e.load,g=e.loaded,s=void 0;"undefined"!=typeof window&&window.IntersectionObserver&&(s=new IntersectionObserver((r=u,a=g,function(t,e){t.forEach(function(t){(0<t.intersectionRatio||t.isIntersecting)&&(e.unobserve(t.target),m(t.target)||(r(t.target),A(t.target),a(t.target)))})}),{root:i,rootMargin:n,threshold:d}));for(var c,l=v(o,i),b=0;b<l.length;b++)(c=l[b]).getAttribute("data-placeholder-background")&&(c.style.background=c.getAttribute("data-placeholder-background"));return{observe:function(){for(var t=v(o,i),e=0;e<t.length;e++)m(t[e])||(s?s.observe(t[e]):(u(t[e]),A(t[e]),g(t[e])))},triggerLoad:function(t){m(t)||(u(t),A(t),g(t))},observer:s}}});
const observer = lozad();
observer.observe();
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.lozad=e()}(this,function(){"use strict";var g="undefined"!=typeof document&&document.documentMode,f={rootMargin:"0px",threshold:0,load:function(t){if("picture"===t.nodeName.toLowerCase()){var e=t.querySelector("img"),r=!1;null===e&&(e=document.createElement("img"),r=!0),g&&t.getAttribute("data-iesrc")&&(e.src=t.getAttribute("data-iesrc")),t.getAttribute("data-alt")&&(e.alt=t.getAttribute("data-alt")),r&&t.append(e)}if("video"===t.nodeName.toLowerCase()&&!t.getAttribute("data-src")&&t.children){for(var a=t.children,o=void 0,i=0;i<=a.length-1;i++)(o=a[i].getAttribute("data-src"))&&(a[i].src=o);t.load()}t.getAttribute("data-poster")&&(t.poster=t.getAttribute("data-poster")),t.getAttribute("data-src")&&(t.src=t.getAttribute("data-src")),t.getAttribute("data-srcset")&&t.setAttribute("srcset",t.getAttribute("data-srcset"));var n=",";if(t.getAttribute("data-background-delimiter")&&(n=t.getAttribute("data-background-delimiter")),t.getAttribute("data-background-image"))t.style.backgroundImage="url('"+t.getAttribute("data-background-image").split(n).join("'),url('")+"')";else if(t.getAttribute("data-background-image-set")){var d=t.getAttribute("data-background-image-set").split(n),u=d[0].substr(0,d[0].indexOf(" "))||d[0];u=-1===u.indexOf("url(")?"url("+u+")":u,1===d.length?t.style.backgroundImage=u:t.setAttribute("style",(t.getAttribute("style")||"")+"background-image: "+u+"; background-image: -webkit-image-set("+d+"); background-image: image-set("+d+")")}t.getAttribute("data-toggle-class")&&t.classList.toggle(t.getAttribute("data-toggle-class"))},loaded:function(){}};function A(t){t.setAttribute("data-loaded",!0)}var m=function(t){return"true"===t.getAttribute("data-loaded")},v=function(t){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:document;return t instanceof Element?[t]:t instanceof NodeList?t:e.querySelectorAll(t)};return function(){var r,a,o=0<arguments.length&&void 0!==arguments[0]?arguments[0]:"[data-src]",t=1<arguments.length&&void 0!==arguments[1]?arguments[1]:{},e=Object.assign({},f,t),i=e.root,n=e.rootMargin,d=e.threshold,u=e.load,g=e.loaded,s=void 0;"undefined"!=typeof window&&window.IntersectionObserver&&(s=new IntersectionObserver((r=u,a=g,function(t,e){t.forEach(function(t){(0<t.intersectionRatio||t.isIntersecting)&&(e.unobserve(t.target),m(t.target)||(r(t.target),A(t.target),a(t.target)))})}),{root:i,rootMargin:n,threshold:d}));for(var c,l=v(o,i),b=0;b<l.length;b++)(c=l[b]).getAttribute("data-placeholder-background")&&(c.style.background=c.getAttribute("data-placeholder-background"));return{observe:function(){for(var t=v(o,i),e=0;e<t.length;e++)m(t[e])||(s?s.observe(t[e]):(u(t[e]),A(t[e]),g(t[e])))},triggerLoad:function(t){m(t)||(u(t),A(t),g(t))},observer:s}}});lozad().observe()

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -85,12 +85,12 @@
{% endif %}
{% if p.award_count("shit", v) %}
<script defer src="{{'js/critters.js' | asset}}"></script>
<script defer src="{{'js/vendor/critters.js' | asset}}"></script>
<script defer src="{{'js/bugs.js' | asset}}"></script>
{% endif %}
{% if p.award_count("fireflies", v) %}
<script defer src="{{'js/critters.js' | asset}}"></script>
<script defer src="{{'js/vendor/critters.js' | asset}}"></script>
<script defer src="{{'js/fireflies.js' | asset}}"></script>
{% endif %}

View File

@ -31,6 +31,6 @@
{% else %}
<script defer src="{{'js/chat_done.js' | asset}}"></script>
{% endif %}
<script defer src="{{'js/lozad.js' | asset}}"></script>
<script defer src="{{'js/lite-youtube.js' | asset}}"></script>
<script defer src="{{'js/vendor/lozad.js' | asset}}"></script>
<script defer src="{{'js/vendor/lite-youtube.js' | asset}}"></script>
</body>

View File

@ -804,11 +804,12 @@
{% endif %}
{% if v %}
<script defer src="{{'js/marked.js' | asset}}"></script>
<script defer src="{{'js/vendor/marked.js' | asset}}"></script>
<script defer src="{{'js/markdown.js' | asset}}"></script>
<script defer src="{{'js/comments_v.js' | asset}}"></script>
{% endif %}
<script defer src="{{'js/clipboard.js' | asset}}"></script>
<script defer src="{{'js/vendor/clipboard.js' | asset}}"></script>
{% if v and v.admin_level >= PERMS['POST_COMMENT_MODERATION_TOOLS_VISIBLE'] %}
<script defer src="{{'js/comments_admin.js' | asset}}"></script>

View File

@ -103,12 +103,12 @@
</div>
</div>
<script defer src="{{'js/lozad.js' | asset}}"></script>
<script defer src="{{'js/vendor/lozad.js' | asset}}"></script>
<script defer src="{{'js/lite-youtube.js' | asset}}"></script>
<script defer src="{{'js/vendor/lite-youtube.js' | asset}}"></script>
{% if v and v.spider %}
<script defer src="{{'js/critters.js' | asset}}"></script>
<script defer src="{{'js/vendor/critters.js' | asset}}"></script>
<script defer src="{{'js/spider.js' | asset}}"></script>
{% endif %}
</body>

View File

@ -177,6 +177,7 @@
<div class="d-none" id="strid">{{SITE}}{{v.id}}</div>
<div class="d-none" id="pusherid">{{PUSHER_ID}}</div>
<script defer src="{{'js/pusher.js' | asset}}"></script>
<script defer src="{{'js/vendor/pusher.js' | asset}}"></script>
<script>
if (typeof Android != 'undefined') {
Android.Subscribe('{{SITE}}{{v.id}}');
@ -243,7 +244,7 @@
script.onload = resolve;
script.onerror = reject;
script.async = true;
script.src = "{{'js/fp.js' | asset}}";
script.src = "{{'js/vendor/fp.js' | asset}}";
document.head.appendChild(script);
})
.then(() => FingerprintJS.load({token: '{{FP}}'}));

View File

@ -21,7 +21,7 @@
{% endmacro %}
{% macro javascript() %}
<script defer src="{{'js/bootstrap.js' | asset}}"></script>
<script defer src="{{'js/vendor/bootstrap.js' | asset}}"></script>
<script defer src="{{'js/core.js' | asset}}"></script>
{% endmacro %}

View File

@ -129,5 +129,5 @@
<i class="fas fa-check-circle text-success mr-2"></i>Link copied to clipboard
</div>
</div>
<script defer src="{{'js/clipboard.js' | asset}}"></script>
<script defer src="{{'js/vendor/clipboard.js' | asset}}"></script>
{% endblock %}

View File

@ -111,7 +111,7 @@
</div>
</div>
<script defer src="{{'js/clipboard.js' | asset}}"></script>
<script defer src="{{'js/vendor/clipboard.js' | asset}}"></script>
{% else %}
{% with comments=notifications %}
{% include "comments.html" %}

View File

@ -154,6 +154,6 @@
</div>
</div>
{% block onload %}{% endblock %}
<script defer src="{{'js/clipboard.js' | asset}}"></script>
<script defer src="{{'js/vendor/clipboard.js' | asset}}"></script>
</body>
</html>

View File

@ -208,9 +208,9 @@
{% if p.domain == "twitter.com" %}
{{p.embed_url | safe}}
{% if v and v.theme.split("_")[0] in ["light", "coffee", "4chan"] %}
<script defer src="{{'js/twitterlight.js' | asset}}"></script>
<script defer src="{{'js/vendor/twitterlight.js' | asset}}"></script>
{% else %}
<script defer src="{{'js/twitter.js' | asset}}"></script>
<script defer src="{{'js/vendor/twitter.js' | asset}}"></script>
{% endif %}
{% elif p.domain in ['youtu.be','youtube.com'] and p.embed_url and p.embed_url.startswith('<lite-youtube') %}
{{p.embed_url | safe}}
@ -562,7 +562,7 @@
<script defer src="{{'js/pinpost.js' | asset}}"></script>
{% endif %}
<script defer src="{{'js/clipboard.js' | asset}}"></script>
<script defer src="{{'js/vendor/clipboard.js' | asset}}"></script>
{% if not p.replies %}
{% include "comments.html" %}

View File

@ -422,7 +422,7 @@
{% endif %}
{% endif %}
<script defer src="{{'js/clipboard.js' | asset}}"></script>
<script defer src="{{'js/vendor/clipboard.js' | asset}}"></script>
<script defer src="{{'js/comments+submission_listing.js' | asset}}"></script>
<script defer src="{{'js/submission_listing.js' | asset}}"></script>
{% if v and v.admin_level >= PERMS['POST_COMMENT_MODERATION'] %}

View File

@ -152,7 +152,8 @@
</script>
{% endif %}
<script defer src="{{'js/marked.js' | asset}}"></script>
<script defer src="{{'js/vendor/marked.js' | asset}}"></script>
<script defer src="{{'js/markdown.js' | asset}}"></script>
<script defer src="{{'js/submit.js' | asset}}"></script>
{% include "modals/emoji.html" %}
{% include "modals/gif.html" %}

View File

@ -43,5 +43,5 @@
</div>
</div>
<script defer src="{{'js/clipboard.js' | asset}}"></script>
<script defer src="{{'js/vendor/clipboard.js' | asset}}"></script>
{% endblock %}

View File

@ -598,7 +598,8 @@
{% endif %}
{% if not request.path.endswith('/comments') %}
<script defer src="{{'js/marked.js' | asset}}"></script>
<script defer src="{{'js/vendor/marked.js' | asset}}"></script>
<script defer src="{{'js/markdown.js' | asset}}"></script>
{% endif %}
{% if v and v.id != u.id and '/comments' not in request.path %}