From a20266f2222461b9fb78d56737903d84eb94e19c Mon Sep 17 00:00:00 2001 From: Zankaria Date: Wed, 4 Sep 2024 11:31:14 +0200 Subject: [PATCH] post-hover.js: use camelCase --- js/post-hover.js | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/js/post-hover.js b/js/post-hover.js index 84cb9e92..dbe0d3b0 100644 --- a/js/post-hover.js +++ b/js/post-hover.js @@ -34,7 +34,7 @@ if ((active_page === 'thread' || active_page === 'index' || active_page === 'ukk } let dont_fetch_again = []; - init_hover = function() { + let initHover = function() { let link = $(this); let id; @@ -52,26 +52,26 @@ if ((active_page === 'thread' || active_page === 'index' || active_page === 'ukk while (board.data('board') === undefined) { board = board.parent(); } - let threadid; + let threadId; if (link.is('[data-thread]')) { - threadid = 0; + threadId = 0; } else { - threadid = board.attr('id').replace("thread_", ""); + threadId = board.attr('id').replace("thread_", ""); } board = board.data('board'); - let parentboard = board; + let parentBoard = board; if (link.is('[data-thread]')) { - parentboard = $('form[name="post"] input[name="board"]').val(); + parentBoard = $('form[name="post"] input[name="board"]').val(); } else if (matches[1] !== undefined) { board = matches[1]; } let post = false; let hovering = false; - let hovered_at; + let hoveredAt; let updatePreviewPosition = function(pageX, pageY, hoverPreview) { let scrollTop = $(window).scrollTop(); @@ -83,7 +83,7 @@ if ((active_page === 'thread' || active_page === 'index' || active_page === 'ukk epy -= $(window).scrollTop(); } - let top = (epy ? epy : hovered_at['y']) - 10; + let top = (epy ? epy : hoveredAt['y']) - 10; if (epy < scrollTop + 15) { top = scrollTop; @@ -91,7 +91,7 @@ if ((active_page === 'thread' || active_page === 'index' || active_page === 'ukk top = scrollTop + $(window).height() - hoverPreview.height() - 15; } - let hovery = pageY ? pageY : hovered_at['y']; + let hovery = pageY ? pageY : hoveredAt['y']; if ((hovery - top) > 20){ top = hovery; } @@ -100,7 +100,7 @@ if ((active_page === 'thread' || active_page === 'index' || active_page === 'ukk if (isScreenSmall) { previewX = 0; } else { - previewX = (pageX ? pageX : hovered_at['x']) + 1 + previewX = (pageX ? pageX : hoveredAt['x']) + 1 } hoverPreview.css('left', previewX).css('top', top); @@ -108,7 +108,7 @@ if ((active_page === 'thread' || active_page === 'index' || active_page === 'ukk link.hover(function(e) { hovering = true; - hovered_at = {'x': e.pageX, 'y': e.pageY}; + hoveredAt = {'x': e.pageX, 'y': e.pageY}; let start_hover = function(link) { if ($.contains(post[0], link[0])) { @@ -165,18 +165,18 @@ if ((active_page === 'thread' || active_page === 'index' || active_page === 'ukk url: url, context: document.body, success: function(data) { - var mythreadid = $(data).find('div[id^="thread_"]').attr('id').replace("thread_", ""); + let myThreadId = $(data).find('div[id^="thread_"]').attr('id').replace("thread_", ""); - if (mythreadid == threadid && parentboard == board) { + if (myThreadId == threadId && parentBoard == board) { $(data).find('div.post.reply').each(function() { if ($('[data-board="' + board + '"] #' + $(this).attr('id')).length === 0) { - $('[data-board="' + board + '"]#thread_' + threadid + " .post.reply:first").before($(this).hide().addClass('hidden')); + $('[data-board="' + board + '"]#thread_' + threadId + " .post.reply:first").before($(this).hide().addClass('hidden')); } }); - } else if ($('[data-board="' + board + '"]#thread_'+mythreadid).length > 0) { + } else if ($('[data-board="' + board + '"]#thread_' + myThreadId).length > 0) { $(data).find('div.post.reply').each(function() { if ($('[data-board="' + board + '"] #' + $(this).attr('id')).length === 0) { - $('[data-board="' + board + '"]#thread_' + mythreadid + " .post.reply:first").before($(this).hide().addClass('hidden')); + $('[data-board="' + board + '"]#thread_' + myThreadId + " .post.reply:first").before($(this).hide().addClass('hidden')); } }); } else { @@ -221,14 +221,14 @@ if ((active_page === 'thread' || active_page === 'index' || active_page === 'ukk }); }; - $('div.body a:not([rel="nofollow"])').each(init_hover); + $('div.body a:not([rel="nofollow"])').each(initHover); // allow to work with auto-reload.js, etc. $(document).on('new_post', function(e, post) { - $(post).find('div.body a:not([rel="nofollow"])').each(init_hover); + $(post).find('div.body a:not([rel="nofollow"])').each(initHover); }); // Must be available to `show-backlinks.js` and likely others... - window.init_hover = init_hover; + window.init_hover = initHover; }); }