diff --git a/js/main.js b/js/main.js
index aac8408..cc30f71 100644
--- a/js/main.js
+++ b/js/main.js
@@ -27,7 +27,6 @@ function pressPost() {
window.onload = () => {
const code = document.querySelectorAll('.code')
- const codeBig = document.querySelectorAll('.codeBig')
const year = document.querySelector('.year')
const form = document.getElementById('form')
@@ -58,32 +57,29 @@ window.onload = () => {
if (localStorage.getItem(KEY) == 'light') toggleTheme()
// Highlight code
- const highlight = cde => {
- for (let i = 0; i < cde.length; i ++) {
- const box = cde[i]
- const lines = box.textContent.split('¬')
- let isGrayed = false
-
- for (let i = 0; i < lines.length; i ++) {
- if (isGrayed) lines[i] = '' + lines[i] + ''
- else {
- lines[i] = lines[i]
- .replace(/(\/\/.*)/g, '')
- .replace(/(\'.*\')/g, '$1')
- .replace(/(\b\d+\b|\.)/g, '$1')
- .replace(/(function)(.*)(\()/g, 'function$2(')
- .replace(/(requestAnimationFrame|confirm|alert)/g, '$1')
-
- lines[i] = lines[i]
- .replace(/\b(if|else|return|function|const|let|for|in|of|break|continue)\b/g,
- '$1')
- }
-
- isGrayed = !isGrayed
+ for (let i = 0; i < code.length; i ++) {
+ const box = code[i]
+ const lines = box.textContent.split('¬')
+ let isGrayed = false
+
+ for (let i = 0; i < lines.length; i ++) {
+ if (isGrayed) lines[i] = '' + lines[i] + ''
+ else {
+ lines[i] = lines[i]
+ .replace(/\$1')
+ .replace(/(\'.*\')/g, '$1')
+ .replace(/(\b\d+\b|\.)/g, '$1')
+ .replace(/(function)(.*)(\()/g, 'function$2(')
+ .replace(/(requestAnimationFrame|confirm|alert)/g, '$1')
+
+ lines[i] = lines[i]
+ .replace(/\b(if|else|return|function|const|let|for|in|of|break|continue)\b/g,
+ '$1')
}
- box.innerHTML = lines.join('')
+
+ isGrayed = !isGrayed
}
+ box.innerHTML = lines.join('')
}
- highlight(code)
- highlight(codeBig)
}