diff --git a/Web/static/js/al_comments.js b/Web/static/js/al_comments.js index ad398637f..f4b13e387 100644 --- a/Web/static/js/al_comments.js +++ b/Web/static/js/al_comments.js @@ -9,7 +9,7 @@ u(document).on("click", ".comment-reply", function(e) { // Substitute pervious mention if present, prepend otherwise inputbox.nodes.forEach(node => { - node.value = node.value.replace(/(^\[([A-Za-z0-9]+)\|([\p{L} 0-9@]+)\], |^)/u, mention); + node.value = node.value.replace(/(^\[([A-Za-z0-9]+)\|([A-Za-zА-Яа-яЁё0-9 @]+)\], |^)/, mention); }) inputbox.trigger("focusin"); }); diff --git a/Web/static/js/al_feed.js b/Web/static/js/al_feed.js index d96779ca3..4ee350c43 100644 --- a/Web/static/js/al_feed.js +++ b/Web/static/js/al_feed.js @@ -127,10 +127,10 @@ u(document).on('click', '#__feed_settings_link', (e) => { switch(current_tab) { case 'main': const __temp_url = new URL(location.href) - const PAGES_COUNT = Number(e.target.dataset.pagescount ?? '10') - const CURRENT_PERPAGE = Number(__temp_url.searchParams.get('posts') ?? 10) - const CURRENT_PAGE = Number(__temp_url.searchParams.get('p') ?? 1) - const CURRENT_RETURN_BANNED = Number(__temp_url.searchParams.get('return_banned') ?? 0) + const PAGES_COUNT = Number(e.target.dataset.pagescount || '10') + const CURRENT_PERPAGE = Number(__temp_url.searchParams.get('posts') || 10) + const CURRENT_PAGE = Number(__temp_url.searchParams.get('p') || 1) + const CURRENT_RETURN_BANNED = Number(__temp_url.searchParams.get('return_banned') || 0) const COUNT = [1, 5, 10, 20, 30, 40, 50] u('#_feed_settings_container #__content').html(`
|
${!is_attached ? tr("attach") : tr("detach")}
@@ -2440,7 +2440,7 @@ async function __processPaginatorNextPage(page)
const showMoreObserver = new IntersectionObserver(entries => {
entries.forEach(async x => {
if(x.isIntersecting) {
- if(Number(localStorage.getItem('ux.auto_scroll') ?? 1) == 0) {
+ if(Number(localStorage.getItem('ux.auto_scroll') || 1) == 0) {
return
}
@@ -2521,7 +2521,7 @@ u(document).on('click', '#__sourceAttacher', (e) => {
const nearest_textarea = _u_target.closest('#write')
const source_output = nearest_textarea.find(`input[name='source']`)
const source_input = u(`#source_flex_kunteynir input[type='text']`)
- const source_value = source_input.nodes[0].value ?? ''
+ const source_value = source_input.nodes[0].value || ''
if(source_value.length < 1) {
return
}
@@ -2755,7 +2755,11 @@ u(document).on('click', "#__geoAttacher", async (e) => {
console.log(e.geocode.properties)
const lat = e.geocode.properties.lat
const lng = e.geocode.properties.lon
- const name = e.geocode.properties?.display_name ? short_geo_name(e.geocode.properties?.address) : tr('geotag')
+ const name = e.geocode &&
+ e.geocode.properties &&
+ e.geocode.properties.display_name
+ ? short_geo_name(e.geocode.properties.address)
+ : tr('geotag')
if(currentMarker) map.removeLayer(currentMarker)
@@ -2818,7 +2822,7 @@ function openGeo(data, owner_id, virtual_id) {
map.setView(target, 15);
let marker = L.marker(target).addTo(map);
- marker.bindPopup(escapeHtml(data.name ?? tr("geotag"))).openPopup();
+ marker.bindPopup(escapeHtml(data.name || tr("geotag"))).openPopup();
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© OpenStreetMap contributors'
@@ -3018,7 +3022,7 @@ u(document).on("submit", "#additional_fields_form", (e) => {
})
})
-if(Number(localStorage.getItem('ux.gif_autoplay') ?? 0) == 1) {
+if(Number(localStorage.getItem('ux.gif_autoplay') || 0) == 1) {
const showMoreObserver = new IntersectionObserver(entries => {
entries.forEach(async x => {
doc_item = x.target.closest(".docGalleryItem")
diff --git a/Web/static/js/messagebox.js b/Web/static/js/messagebox.js
index 7f07715ff..dd7172d50 100644
--- a/Web/static/js/messagebox.js
+++ b/Web/static/js/messagebox.js
@@ -2,14 +2,14 @@ Function.noop = () => {};
class CMessageBox {
constructor(options = {}) {
- const title = options.title ?? 'Untitled'
- const body = options.body ?? ' ' - const buttons = options.buttons ?? [] - const callbacks = options.callbacks ?? [] - const close_on_buttons = options.close_on_buttons ?? true - const unique_name = options.unique_name ?? null - const warn_on_exit = options.warn_on_exit ?? false - const custom_template = options.custom_template ?? null + const title = options.title || 'Untitled' + const body = options.body || ' ' + const buttons = options.buttons || [] + const callbacks = options.callbacks || [] + const close_on_buttons = options.close_on_buttons || true + const unique_name = options.unique_name || null + const warn_on_exit = options.warn_on_exit || false + const custom_template = options.custom_template || null if(unique_name && window.messagebox_stack.find(item => item.unique_name == unique_name) != null) { return } diff --git a/Web/static/js/options.js b/Web/static/js/options.js index 2e9e85df7..237fbaca2 100644 --- a/Web/static/js/options.js +++ b/Web/static/js/options.js @@ -262,7 +262,7 @@ window.tweaks = [ u(".post").nodes.forEach(item => { const post = u(item) if (post.hasClass("hidden_because_of_word")) {return} - (window.hidden_words ?? []).forEach(word => { + (window.hidden_words || []).forEach(word => { highlightText(word, '.scroll_container', [".post-author a", ".post:not(.comment) > tbody > tr > td > .post-content > .text .really_text"]) }) if (post.find(".highlight").length > 0) {post.addClass("hidden_because_of_word")} diff --git a/Web/static/js/router.js b/Web/static/js/router.js index ae94cc2e5..8be5c8ee6 100644 --- a/Web/static/js/router.js +++ b/Web/static/js/router.js @@ -135,7 +135,7 @@ window.router = new class { async __integratePage(scrolling = null) { window.temp_y_scroll = null u('.toTop').removeClass('has_down') - window.scrollTo(0, scrolling ?? 0) + window.scrollTo(0, scrolling || 0) bsdnHydrate() if(u('.paginator:not(.paginator-at-top)').length > 0) { @@ -174,7 +174,7 @@ window.router = new class { return false } - if((localStorage.getItem('ux.disable_ajax_routing') ?? 0) == 1 || window.openvk.current_id == 0) { + if((localStorage.getItem('ux.disable_ajax_routing') || 0) == 1 || window.openvk.current_id == 0) { return false } @@ -218,7 +218,7 @@ window.router = new class { url = location.origin + url } - if((localStorage.getItem('ux.disable_ajax_routing') ?? 0) == 1 || window.openvk.current_id == 0) { + if((localStorage.getItem('ux.disable_ajax_routing') || 0) == 1 || window.openvk.current_id == 0) { window.location.assign(url) return } @@ -227,7 +227,7 @@ window.router = new class { this.prev_page_html = null } - const push_url = params.push_state ?? true + const push_url = params.push_state || true const next_page_url = new URL(url) if(push_url) { history.pushState({'from_router': 1}, '', url) @@ -346,14 +346,14 @@ u(document).on('submit', 'form', async (e) => { collect_attachments_node(target) } - if((localStorage.getItem('ux.disable_ajax_routing') ?? 0) == 1 || window.openvk.current_id == 0) { + if((localStorage.getItem('ux.disable_ajax_routing') || 0) == 1 || window.openvk.current_id == 0) { return false } u('#ajloader').addClass('shown') const form = e.target - const method = form.method ?? 'get' + const method = form.method || 'get' const url = form.action if(form.onsubmit || url.indexOf('/settings?act=interface') != -1) { u('#ajloader').removeClass('shown') |