refacor: customCSS 코드 분리
This commit is contained in:
@@ -11,21 +11,17 @@ import { nl2br } from "@util/nl2br";
|
|||||||
import jQuery from "jquery";
|
import jQuery from "jquery";
|
||||||
|
|
||||||
import "@scss/common_legacy.scss";
|
import "@scss/common_legacy.scss";
|
||||||
|
import { insertCustomCSS } from "./util/customCSS";
|
||||||
|
import { htmlReady } from "./util/htmlReady";
|
||||||
|
|
||||||
exportWindow(jQuery, '$');
|
exportWindow(jQuery, '$');
|
||||||
exportWindow(jQuery, 'jQuery');
|
exportWindow(jQuery, 'jQuery');
|
||||||
|
|
||||||
jQuery(function ($) {
|
htmlReady(function(){
|
||||||
initTooltip();
|
initTooltip();
|
||||||
activateFlip();
|
activateFlip();
|
||||||
|
insertCustomCSS();
|
||||||
const customCSS = localStorage.getItem('sam_customCSS');
|
})
|
||||||
if (customCSS) {
|
|
||||||
const $style = $('<style type="text/css"></style>');
|
|
||||||
$style.text(customCSS);
|
|
||||||
$style.appendTo($('head'));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {0}, {1}, {2}형태로 포맷해주는 함수
|
* {0}, {1}, {2}형태로 포맷해주는 함수
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import { initTooltip } from './initTooltip';
|
|||||||
import { exportWindow } from '@/util/exportWindow';
|
import { exportWindow } from '@/util/exportWindow';
|
||||||
import { reloadWorldMap } from '@/map';
|
import { reloadWorldMap } from '@/map';
|
||||||
import { refreshMsg } from '@/msg';
|
import { refreshMsg } from '@/msg';
|
||||||
|
import { insertCustomCSS } from '@/util/customCSS';
|
||||||
|
|
||||||
exportWindow(jQuery, '$');
|
exportWindow(jQuery, '$');
|
||||||
|
|
||||||
@@ -50,12 +51,7 @@ htmlReady(() => {
|
|||||||
void refreshMsg();
|
void refreshMsg();
|
||||||
}, 5000);
|
}, 5000);
|
||||||
|
|
||||||
const customCSS = localStorage.getItem('sam_customCSS');
|
insertCustomCSS();
|
||||||
if (customCSS) {
|
|
||||||
const styleEl = document.createElement('style');
|
|
||||||
styleEl.innerHTML = customCSS;
|
|
||||||
document.head.appendChild(styleEl);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
(() => {
|
(() => {
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
export function insertCustomCSS(key = 'sam_customCSS'){
|
||||||
|
const customCSS = localStorage.getItem(key);
|
||||||
|
if (customCSS) {
|
||||||
|
const css = document.createElement('style');
|
||||||
|
css.innerHTML = customCSS;
|
||||||
|
console.log(css);
|
||||||
|
document.getElementsByTagName('head')[0].appendChild(css);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user