kone
소미소프트
소미소프트

유틸] 중복 라우팅 방지 방지

일반
1,944 views · 4 points

나는 키보드에 손 갖다대기 귀찮아서 전체글 버튼을 클릭해서 게시판 새로고침 효과를 얻는 사람인데,

코네 서브는 전체글 클릭했을때 현재 주소와 목적 라우팅 주소가 같을때 중복 라우팅을 방지하게끔 해놔서 아무런 동작도 하지 않음

쉽게 말해 새로고침 효과를 낼수 없단 뜻이지

tampermonkey나 greasemonkey, vilolentmonkey를 사용중이라면 요걸 피할수 있는 스크립트를 찍어봤음


무슨소린지 못알아듣겠다면 그냥 무시하시고



// ==UserScript==
// @name         Prevent duplicate navigation prevention
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Forces reload even when clicking a button that navigates to current location
// @match        https://kone.gg/s/*
// @grant        none
// ==/UserScript==

(function () {
  'use strict';

  document.addEventListener('click', (e) => {
    const target = e.target.closest('a[href] > button');

    if (!target) return;

    const anchor = target.parentElement;
    const href = anchor.getAttribute('href');
    const currentPath = location.pathname + location.search;

    if (href === currentPath || href === decodeURIComponent(currentPath)) {
      e.preventDefault();
      e.stopImmediatePropagation();
      location.reload();
    }
  });
})();
4
7 comments
이거 은근 불편했는데 고맙다
컨트롤 엔터 누르면 댓글 달리는 기능도 가능?
새글쓸게
(edited )

Deleted comment.

(edited )

Deleted comment.

(edited )

Deleted comment.

(edited )
스크립트 복붙만 하면되는거야? 오 된다 ㄳ
All
Title
Body