forked from rDrama/rDrama
if( -> if (
parent
a0c0f2af64
commit
d72df0cd6e
|
@ -3,7 +3,7 @@ function pinPost(t, id) {
|
|||
{
|
||||
},
|
||||
(xhr) => {
|
||||
if(xhr.status == 201) {
|
||||
if (xhr.status == 201) {
|
||||
t.innerHTML = t.innerHTML.replace(t.textContent, 'Pin for 1 hour');
|
||||
t.classList.add('d-none');
|
||||
} else {
|
||||
|
|
|
@ -2,10 +2,10 @@ const reason_comment = document.getElementById("reason_comment")
|
|||
const reportCommentButton = document.getElementById("reportCommentButton");
|
||||
|
||||
reason_comment.addEventListener('keydown', (e) => {
|
||||
if(!((e.ctrlKey || e.metaKey) && e.key === "Enter")) return;
|
||||
if (!((e.ctrlKey || e.metaKey) && e.key === "Enter")) return;
|
||||
|
||||
const targetDOM = document.activeElement;
|
||||
if(!(targetDOM instanceof HTMLInputElement)) return;
|
||||
if (!(targetDOM instanceof HTMLInputElement)) return;
|
||||
|
||||
reportCommentButton.click()
|
||||
bootstrap.Modal.getOrCreateInstance(document.getElementById('reportCommentModal')).hide()
|
||||
|
|
|
@ -44,7 +44,7 @@ function postToast(t, url, data, extraActionsOnSuccess, method="POST") {
|
|||
}
|
||||
|
||||
let form = new FormData();
|
||||
if(typeof data === 'object' && data !== null) {
|
||||
if (typeof data === 'object' && data !== null) {
|
||||
for(let k of Object.keys(data)) {
|
||||
form.append(k, data[k]);
|
||||
}
|
||||
|
@ -111,10 +111,10 @@ function postToastSwitch(t, url, button1, button2, cls, extraActionsOnSuccess, m
|
|||
if (!location.pathname.endsWith('/submit'))
|
||||
{
|
||||
document.addEventListener('keydown', (e) => {
|
||||
if(!((e.ctrlKey || e.metaKey) && e.key === "Enter")) return;
|
||||
if (!((e.ctrlKey || e.metaKey) && e.key === "Enter")) return;
|
||||
|
||||
const targetDOM = document.activeElement;
|
||||
if(!(targetDOM instanceof HTMLTextAreaElement || targetDOM instanceof HTMLInputElement)) return;
|
||||
if (!(targetDOM instanceof HTMLTextAreaElement || targetDOM instanceof HTMLInputElement)) return;
|
||||
|
||||
const formDOM = targetDOM.parentElement;
|
||||
|
||||
|
@ -124,7 +124,7 @@ if (!location.pathname.endsWith('/submit'))
|
|||
}
|
||||
|
||||
const submitButtonDOMs = formDOM.querySelectorAll('input[type=submit], .btn-primary');
|
||||
if(submitButtonDOMs.length === 0)
|
||||
if (submitButtonDOMs.length === 0)
|
||||
throw new TypeError("I am unable to find the submit button :(. Contact the head custodian immediately.")
|
||||
|
||||
const btn = submitButtonDOMs[0]
|
||||
|
@ -181,7 +181,7 @@ const expandImageModal = document.getElementById('expandImageModal')
|
|||
|
||||
function expandImage(url) {
|
||||
const e = this.event
|
||||
if(e.ctrlKey || e.metaKey || e.shiftKey || e.altKey)
|
||||
if (e.ctrlKey || e.metaKey || e.shiftKey || e.altKey)
|
||||
return;
|
||||
e.preventDefault();
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ window.marseykoInterval = setInterval(frame, 100);
|
|||
document.addEventListener('click', (event) => {
|
||||
cursormarseyEl.style.removeProperty("pointer-events");
|
||||
let elementClicked = document.elementFromPoint(event.clientX,event.clientY);
|
||||
if(elementClicked.id === cursormarseyEl.id) {
|
||||
if (elementClicked.id === cursormarseyEl.id) {
|
||||
heartEl.classList.remove("d-none");
|
||||
setTimeout(() => {
|
||||
heartEl.classList.add("d-none");
|
||||
|
|
|
@ -17,5 +17,5 @@ function togglePostEdit(id){
|
|||
};
|
||||
|
||||
document.getElementById('post-edit-title').addEventListener('keydown', (e) => {
|
||||
if(e.key === "Enter") e.preventDefault();
|
||||
if (e.key === "Enter") e.preventDefault();
|
||||
})
|
||||
|
|
|
@ -54,7 +54,7 @@ let emojiSearcher = {
|
|||
addQuery: function(query)
|
||||
{
|
||||
this.queries.push(query);
|
||||
if(!this.working)
|
||||
if (!this.working)
|
||||
this.work();
|
||||
},
|
||||
|
||||
|
@ -70,7 +70,7 @@ let emojiSearcher = {
|
|||
this.queries = [];
|
||||
|
||||
// To improve perf we avoid showing all emojis at the same time.
|
||||
if(query === "")
|
||||
if (query === "")
|
||||
{
|
||||
await classesSelectorDOM.children[0].children[0].click();
|
||||
classesSelectorDOM.children[0].children[0].classList.add("active");
|
||||
|
@ -87,7 +87,7 @@ let emojiSearcher = {
|
|||
emojiNotFoundDOM.hidden = resultSet.size !== 0;
|
||||
|
||||
let sleepTime = EMOIJ_SEARCH_ENGINE_MIN_INTERVAL - (Date.now() - startTime);
|
||||
if(sleepTime > 0)
|
||||
if (sleepTime > 0)
|
||||
await new Promise(r => setTimeout(r, sleepTime));
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ const emojisSearchDictionary = {
|
|||
dict: [],
|
||||
|
||||
updateTag: function(tag, emojiName) {
|
||||
if(tag === undefined || emojiName === undefined)
|
||||
if (tag === undefined || emojiName === undefined)
|
||||
return;
|
||||
|
||||
let low = 0;
|
||||
|
@ -122,7 +122,7 @@ const emojisSearchDictionary = {
|
|||
}
|
||||
|
||||
let target = low;
|
||||
if(this.dict[target] !== undefined && this.dict[target].tag === tag)
|
||||
if (this.dict[target] !== undefined && this.dict[target].tag === tag)
|
||||
this.dict[target].emojiNames.push(emojiName);
|
||||
else
|
||||
this.dict.splice(target ,0,new EmoijsDictNode(tag, emojiName));
|
||||
|
@ -138,9 +138,9 @@ const emojisSearchDictionary = {
|
|||
const result = new Set();
|
||||
|
||||
for(let i = 0; i < this.dict.length; i++)
|
||||
if(this.dict[i].tag.startsWith('@'))
|
||||
if (this.dict[i].tag.startsWith('@'))
|
||||
{
|
||||
if(this.dict[i].tag == query)
|
||||
if (this.dict[i].tag == query)
|
||||
for(let j = 0; j < this.dict[i].emojiNames.length; j++)
|
||||
result.add(this.dict[i].emojiNames[j])
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ function fetchEmojis() {
|
|||
})
|
||||
.then(res => res.json())
|
||||
.then(emojis => {
|
||||
if(! (emojis instanceof Array ))
|
||||
if (! (emojis instanceof Array ))
|
||||
throw new TypeError("[EMOJI DIALOG] rDrama's server should have sent a JSON-coded Array!");
|
||||
|
||||
globalEmojis = emojis.map(({name, author, count}) => ({name, author, count}));
|
||||
|
@ -175,16 +175,16 @@ function fetchEmojis() {
|
|||
|
||||
emojisSearchDictionary.updateTag(emoji.name, emoji.name);
|
||||
|
||||
if(emoji.author_username !== undefined && emoji.author_username !== null)
|
||||
if (emoji.author_username !== undefined && emoji.author_username !== null)
|
||||
emojisSearchDictionary.updateTag(`@${emoji.author_username.toLowerCase()}`, emoji.name);
|
||||
|
||||
if(emoji.author_original_username !== undefined && emoji.author_original_username !== null)
|
||||
if (emoji.author_original_username !== undefined && emoji.author_original_username !== null)
|
||||
emojisSearchDictionary.updateTag(`@${emoji.author_original_username.toLowerCase()}`, emoji.name);
|
||||
|
||||
if(emoji.author_prelock_username !== undefined && emoji.author_prelock_username !== null)
|
||||
if (emoji.author_prelock_username !== undefined && emoji.author_prelock_username !== null)
|
||||
emojisSearchDictionary.updateTag(`@${emoji.author_prelock_username.toLowerCase()}`, emoji.name);
|
||||
|
||||
if(emoji.tags instanceof Array)
|
||||
if (emoji.tags instanceof Array)
|
||||
for(let i = 0; i < emoji.tags.length; i++)
|
||||
emojisSearchDictionary.updateTag(emoji.tags[i], emoji.name);
|
||||
|
||||
|
@ -192,9 +192,9 @@ function fetchEmojis() {
|
|||
const emojiDOM = document.importNode(emojiButtonTemplateDOM.content, true).children[0];
|
||||
|
||||
emojiDOM.title = emoji.name
|
||||
if(emoji.author_username !== undefined && emoji.author_username !== null)
|
||||
if (emoji.author_username !== undefined && emoji.author_username !== null)
|
||||
emojiDOM.title += "\nauthor\t" + emoji.author_username
|
||||
if(emoji.count !== undefined)
|
||||
if (emoji.count !== undefined)
|
||||
emojiDOM.title += "\nused\t" + emoji.count;
|
||||
emojiDOM.dataset.className = emoji.kind;
|
||||
emojiDOM.dataset.emojiName = emoji.name;
|
||||
|
@ -260,7 +260,7 @@ function switchEmojiTab(e)
|
|||
emojiNotFoundDOM.hidden = true;
|
||||
|
||||
// Special case: favorites
|
||||
if(className === "favorite")
|
||||
if (className === "favorite")
|
||||
{
|
||||
for(const emojiDOM of Object.values(emojiDOMs))
|
||||
emojiDOM.hidden = true;
|
||||
|
@ -270,7 +270,7 @@ function switchEmojiTab(e)
|
|||
)).slice(0, 25);
|
||||
|
||||
for (const emoji of favs)
|
||||
if(emojiDOMs[emoji] instanceof HTMLElement)
|
||||
if (emojiDOMs[emoji] instanceof HTMLElement)
|
||||
emojiDOMs[emoji].hidden = false;
|
||||
|
||||
return;
|
||||
|
@ -299,17 +299,17 @@ async function start_search() {
|
|||
function emojiAddToInput(event)
|
||||
{
|
||||
// This should not happen if used properly but whatever
|
||||
if(!(emojiInputTargetDOM instanceof HTMLTextAreaElement) && !(emojiInputTargetDOM instanceof HTMLInputElement))
|
||||
if (!(emojiInputTargetDOM instanceof HTMLTextAreaElement) && !(emojiInputTargetDOM instanceof HTMLInputElement))
|
||||
return;
|
||||
|
||||
let strToInsert = event.currentTarget.dataset.emojiName;
|
||||
|
||||
for(let i = 0; i < emojiSelectPostfixDOMs.length; i++)
|
||||
if(emojiSelectPostfixDOMs[i].checked)
|
||||
if (emojiSelectPostfixDOMs[i].checked)
|
||||
strToInsert = strToInsert + emojiSelectPostfixDOMs[i].value;
|
||||
|
||||
for(let i = 0; i < emojiSelectSuffixDOMs.length; i++)
|
||||
if(emojiSelectSuffixDOMs[i].checked)
|
||||
if (emojiSelectSuffixDOMs[i].checked)
|
||||
strToInsert = emojiSelectSuffixDOMs[i].value + strToInsert;
|
||||
|
||||
strToInsert = ":" + strToInsert + ":"
|
||||
|
@ -405,10 +405,10 @@ function populate_speed_emoji_modal(results, textbox)
|
|||
|
||||
emoji_option_text.title = name;
|
||||
|
||||
if(emoji.author_username !== undefined && emoji.author_username !== null)
|
||||
if (emoji.author_username !== undefined && emoji.author_username !== null)
|
||||
emoji_option_text.title += "\nauthor\t" + emoji.author_username
|
||||
|
||||
if(emoji.count !== undefined)
|
||||
if (emoji.count !== undefined)
|
||||
emoji_option_text.title += "\nused\t" + emoji.count;
|
||||
|
||||
emoji_option_text.innerText = name;
|
||||
|
|
|
@ -6,7 +6,7 @@ function addFormattingCopyButtons() {
|
|||
|
||||
for (let table = 0; table < allTablesGenerateCopyButtons.length; table++) {
|
||||
|
||||
if(allTablesGenerateCopyButtons[table].tagName != 'TABLE') {
|
||||
if (allTablesGenerateCopyButtons[table].tagName != 'TABLE') {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
function equip_hat(t, hat_id, hat_name) {
|
||||
const profile_pic_hat = document.getElementById("profile-pic-35-hat");
|
||||
function extra_actions(xhr) {
|
||||
if(xhr.status == 200) {
|
||||
if (xhr.status == 200) {
|
||||
profile_pic_hat.src = `/i/hats/${hat_name}.webp?x=6`
|
||||
profile_pic_hat.classList.remove('d-none')
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ marked.use({
|
|||
tokenizer: function(src) {
|
||||
const rule = /^@[a-zA-Z0-9_\-]+/;
|
||||
const match = rule.exec(src);
|
||||
if(match){
|
||||
if (match){
|
||||
return {
|
||||
type: 'mention',
|
||||
raw: match[0],
|
||||
|
@ -34,7 +34,7 @@ marked.use({
|
|||
tokenizer: function(src) {
|
||||
const rule = /^![a-zA-Z0-9_\-]+/;
|
||||
const match = rule.exec(src);
|
||||
if(match){
|
||||
if (match){
|
||||
return {
|
||||
type: 'group_mention',
|
||||
raw: match[0],
|
||||
|
@ -101,7 +101,7 @@ function markdown(t) {
|
|||
input = input.replace(/((\s|^)[0-9]+)\. /g, '$1\\. ')
|
||||
|
||||
const emojis = Array.from(input.matchAll(/:([a-z0-9_\-!#@]{1,36}):(?![^`]*`)/gi))
|
||||
if(emojis != null){
|
||||
if (emojis != null){
|
||||
for(i = 0; i < emojis.length; i++){
|
||||
const old = emojis[i][0];
|
||||
if (old.includes('marseyrandom')) continue;
|
||||
|
@ -111,35 +111,35 @@ function markdown(t) {
|
|||
const modifiers = new Set();
|
||||
|
||||
let length = emoji.length
|
||||
if(emoji.includes('!!')) modifiers.add(MODIFIERS.REVERSED_MODIFIER);
|
||||
if (emoji.includes('!!')) modifiers.add(MODIFIERS.REVERSED_MODIFIER);
|
||||
emoji = emoji.replaceAll('!', '');
|
||||
if(length !== emoji.length) {
|
||||
if (length !== emoji.length) {
|
||||
modifiers.add(MODIFIERS.REVERSED);
|
||||
length = emoji.length;
|
||||
}
|
||||
emoji = emoji.replaceAll('#', '');
|
||||
if(length !== emoji.length) {
|
||||
if (length !== emoji.length) {
|
||||
modifiers.add(MODIFIERS.LARGE);
|
||||
}
|
||||
const isTalkingFirst = !(emoji.endsWith('pat') && emoji.slice(0, -3).endsWith('talking'));
|
||||
if(emoji.endsWith('talking') || (emoji.endsWith('pat') && emoji.slice(0, -3).endsWith('talking'))) {
|
||||
if (emoji.endsWith('talking') || (emoji.endsWith('pat') && emoji.slice(0, -3).endsWith('talking'))) {
|
||||
modifiers.add(MODIFIERS.TALKING);
|
||||
emoji = emoji.endsWith('pat') ? [emoji.slice(0, -10), emoji.slice(-3)].join('') : emoji.slice(0, -7);
|
||||
}
|
||||
if(emoji.endsWith('pat')) {
|
||||
if (emoji.endsWith('pat')) {
|
||||
modifiers.add(MODIFIERS.PAT);
|
||||
emoji = emoji.slice(0, -3);
|
||||
}
|
||||
|
||||
if(emoji.startsWith('@')) {
|
||||
if (emoji.startsWith('@')) {
|
||||
emoji = emoji.slice(1);
|
||||
modifiers.add(MODIFIERS.USER);
|
||||
}
|
||||
|
||||
|
||||
if(emoji === 'marseyunpettable') {
|
||||
if (emoji === 'marseyunpettable') {
|
||||
modifiers.delete(MODIFIERS.PAT);
|
||||
if(!isTalkingFirst) {
|
||||
if (!isTalkingFirst) {
|
||||
modifiers.delete(MODIFIERS.TALKING);
|
||||
}
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ function markdown(t) {
|
|||
}
|
||||
|
||||
let options = Array.from(input.matchAll(/\$\$([^\$\n]+)\$\$(?![^`]*`)/gi))
|
||||
if(options != null){
|
||||
if (options != null){
|
||||
for(i = 0; i < options.length; i++){
|
||||
const option = options[i][0];
|
||||
const option2 = option.replace(/\$\$/g, '').replace(/\n/g, '')
|
||||
|
@ -173,7 +173,7 @@ function markdown(t) {
|
|||
}
|
||||
|
||||
options = Array.from(input.matchAll(/&&([^&\n]+)&&(?![^`]*`)/gi))
|
||||
if(options != null){
|
||||
if (options != null){
|
||||
for(i = 0; i < options.length; i++){
|
||||
const option = options[i][0];
|
||||
const option2 = option.replace(/&&/g, '').replace(/\n/g, '')
|
||||
|
|
|
@ -9,7 +9,7 @@ function expandText(id) {
|
|||
|
||||
function togglevideo(pid) {
|
||||
const e = this.event
|
||||
if(e.ctrlKey || e.metaKey || e.shiftKey || e.altKey)
|
||||
if (e.ctrlKey || e.metaKey || e.shiftKey || e.altKey)
|
||||
return;
|
||||
e.preventDefault();
|
||||
let vid = document.getElementById(`video-${pid}`).classList
|
||||
|
@ -21,7 +21,7 @@ function togglevideo(pid) {
|
|||
|
||||
function toggleyoutube(pid) {
|
||||
const e = this.event
|
||||
if(e.ctrlKey || e.metaKey || e.shiftKey || e.altKey)
|
||||
if (e.ctrlKey || e.metaKey || e.shiftKey || e.altKey)
|
||||
return;
|
||||
e.preventDefault();
|
||||
const el = document.getElementById(`video-${pid}`)
|
||||
|
|
|
@ -2,10 +2,10 @@ const reason_post = document.getElementById("reason_post")
|
|||
const reportPostButton = document.getElementById("reportPostButton");
|
||||
|
||||
reason_post.addEventListener('keydown', (e) => {
|
||||
if(!((e.ctrlKey || e.metaKey) && e.key === "Enter")) return;
|
||||
if (!((e.ctrlKey || e.metaKey) && e.key === "Enter")) return;
|
||||
|
||||
const targetDOM = document.activeElement;
|
||||
if(!(targetDOM instanceof HTMLInputElement)) return;
|
||||
if (!(targetDOM instanceof HTMLInputElement)) return;
|
||||
|
||||
reportPostButton.click()
|
||||
bootstrap.Modal.getOrCreateInstance(document.getElementById('reportPostModal')).hide()
|
||||
|
|
|
@ -149,14 +149,14 @@ function checkRepost() {
|
|||
}
|
||||
|
||||
document.addEventListener('keydown', (e) => {
|
||||
if(!((e.ctrlKey || e.metaKey) && e.key === "Enter"))
|
||||
if (!((e.ctrlKey || e.metaKey) && e.key === "Enter"))
|
||||
return;
|
||||
|
||||
submitButton.click();
|
||||
});
|
||||
|
||||
document.getElementById('post-title').addEventListener('keydown', (e) => {
|
||||
if(e.key === "Enter") e.preventDefault();
|
||||
if (e.key === "Enter") e.preventDefault();
|
||||
})
|
||||
|
||||
checkRepost();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
function toggleElement(id, id2) {
|
||||
for(let el of document.getElementsByClassName('toggleable')) {
|
||||
if(el.id != id) {
|
||||
if (el.id != id) {
|
||||
el.classList.add('d-none');
|
||||
}
|
||||
}
|
||||
|
@ -14,13 +14,13 @@ let TRANSFER_TAX = document.getElementById('tax').innerHTML
|
|||
function updateTax(mobile=false) {
|
||||
let suf = mobile ? "-mobile" : "";
|
||||
let amount = parseInt(document.getElementById("coin-transfer-amount" + suf).value);
|
||||
if(amount > 0) document.getElementById("coins-transfer-taxed" + suf).innerText = amount - Math.ceil(amount*TRANSFER_TAX);
|
||||
if (amount > 0) document.getElementById("coins-transfer-taxed" + suf).innerText = amount - Math.ceil(amount*TRANSFER_TAX);
|
||||
}
|
||||
|
||||
function updateBux(mobile=false) {
|
||||
let suf = mobile ? "-mobile" : "";
|
||||
let amount = parseInt(document.getElementById("bux-transfer-amount" + suf).value);
|
||||
if(amount > 0) document.getElementById("bux-transfer-taxed" + suf).innerText = amount;
|
||||
if (amount > 0) document.getElementById("bux-transfer-taxed" + suf).innerText = amount;
|
||||
}
|
||||
|
||||
function transferCoins(t, mobile=false) {
|
||||
|
|
Loading…
Reference in New Issue