Skip to content

Instantly share code, notes, and snippets.

@nemorize
Last active November 26, 2023 21:18
Show Gist options
  • Save nemorize/f32cde902b68aeeeeccd8c707b14328b to your computer and use it in GitHub Desktop.
Save nemorize/f32cde902b68aeeeeccd8c707b14328b to your computer and use it in GitHub Desktop.
라이믹스 메뉴 편집 도우미. 라이믹스 메뉴 편집 시의 절차를 간소화합니다.
// ==UserScript==
// @name 라이믹스 메뉴 편집 도우미
// @namespace https://github.com/rx-apps
// @version 0.1
// @description 라이믹스 메뉴 편집 시의 절차를 간소화합니다.
// @author rxApps
// @match *://*/*?module=admin&act=dispMenuAdminSiteMap*
// @icon https://avatars.githubusercontent.com/u/112455239?s=200&v=4
// @grant none
// ==/UserScript==
(function() {
'use strict';
// jQuery 로드
const $ = window.jQuery;
// 라이믹스 여부 확인
if ($('meta[name="generator"]').attr('content') !== 'Rhymix') {
return;
}
// 바로가기 추가 시 URL 링크가 비어있다면 자동으로 # 추가
(() => {
const addHashToLinkUrl = () => {
const $linkUrl = $('#add_menu ._linkUrl');
if (!$linkUrl.length) {
return;
}
const type = $('#add_menu .typeUrl .x_active a').attr('href');
if (type === '#add_linkUrl') {
if ($linkUrl.val().trim() === '') {
$linkUrl.val('#');
}
}
};
$(document).on('mousedown', '#add_menu ._save', () => {
addHashToLinkUrl();
});
$(document).on('keydown', '#add_menu input', (e) => {
if (e.keyCode === 13) {
addHashToLinkUrl();
$('.x_modal._type_alert .x_btn._ok').trigger('click');
$('#add_menu ._save').trigger('click');
}
});
}) ();
// 메뉴 삭제 시 경고 알림 체크박스 자동 체크
(() => {
$(document).on('click', '#properties ._deleteMenu', () => {
const $modal = $('.x_modal');
$modal.find('input[type="checkbox"]').prop('checked', true);
$modal.find('.x_btn.x_disabled').removeClass('x_disabled');
});
}) ();
}) ();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment