본문 바로가기

[IT/Programming]/HTML related

마지막이 ```/ 로 끝나면 error 나는거 해결합시다.

728x90
반응형
# 마지막이 ```/ 로 끝나면 error 나는거 해결합시다. 어랏 에러가 안나네. 뭐가 바뀐거지? =ㅂ=;;; ## PH
  • 2024-08-30 : First posting.
## TOC ## Codes printed ```[.scrollable.lang-js] window.m = window.k = {}; // window.m can be asigned another JSON or number/string and so on. But window.k must be kept. (function (m, $, undefined) { m.version0 = "2.12"; m.getUTF8Length = function (s) { let len = 0; for (let i = 0; i < s.length; i++) { let code = s.charCodeAt(i); if (code <= 0x7f) { len += 1; } else if (code <= 0x7ff) { len += 2; } else if (code >= 0xd800 && code <= 0xdfff) { // Surrogate pair: These take 4 bytes in UTF-8 and 2 chars in UCS-2 // (Assume next char is the other [valid] half and just skip it) len += 4; i++; } else if (code < 0xffff) { len += 3; } else { len += 4; } } return len; }; m.getSearchVars = function (searchStr) { let vars = []; if (searchStr !== null && searchStr !== undefined && searchStr.length) { if (searchStr.startsWith("?")) { searchStr = searchStr.substring(1); } let j = searchStr.indexOf("#"); if (j !== -1) { searchStr = searchStr.substring(0, j); } let splits = searchStr.replace(/&amp;/ig, "&").split("&"); for (let i = 0; i < splits.length; i++) { let key = splits[i]; let value = ""; let k = key.indexOf("="); if (k !== -1) { value = decodeURIComponent(key.substring(k + 1)); key = key.substring(0, k); } key = decodeURIComponent(key); vars[i] = vars[key] = { key: key, val: value }; } } return vars; }; ```/ ```[.scrollable] //////////////////////////////////////////////////// // Heap sort. //////////////////////////////////////////////////// m.heapify = function (arr, key, sorted, n, i) { let largest = i; let l = 2 * i + 1; let r = 2 * i + 2; if (l < n && arr[sorted[l]][key] > arr[sorted[largest]][key]) { largest = l; } if (r < n && arr[sorted[r]][key] > arr[sorted[largest]][key]) { largest = r; } if (largest != i) { let swap = sorted[i]; sorted[i] = sorted[largest]; sorted[largest] = swap; m.heapify(arr, key, sorted, n, largest); } }; m.heapsort = function (arr, key, sorted, upto) { let n = arr.length; for (let i = Math.floor(n / 2) - 1; i >= 0; i--) { m.heapify(arr, key, sorted, n, i); } if (upto) { upto = upto > n ? n : upto; } else { upto = n; } let until = n - upto; for (let i = n - 1; i >= until; i--) { let temp = sorted[0]; sorted[0] = sorted[i]; sorted[i] = temp; m.heapify(arr, key, sorted, i, 0); } return until; }; m.heapsortRest = function (arr, key, sorted, upto, n) { upto = upto > n ? n : upto; let until = n - upto; for (let i = n - 1; i >= until; i--) { let temp = sorted[0]; sorted[0] = sorted[i]; sorted[i] = temp; m.heapify(arr, key, sorted, i, 0); } return until; }; //////////////////////////////////////////////////// // URI rendering :: http link itself, videos, images, maps. //////////////////////////////////////////////////// m.ptnURI = []; m.ptnURL = /^https?:\/\/[^\s\t\n\r\"\'\`\<\>\{\}\[\]]+/i; m.ptnFILE = /^file:\/\/\/[^\s\t\n\r\"\'\`\<\>\{\}\[\]]+/i; m.ptnTag = /^<\w+[\s\S]+>/i; m.ptnVal = /^([0-9]+(?:\.[0-9]+)?)\/([0-9]+(?:\.[0-9]+)?)$/; m.uriToA = function (uri) { if (!uri || typeof uri !== "string") { uri = String(uri); } let exec = m.ptnURL.exec(uri); if (exec !== null) { return `<a target="_blank" href="${exec[0]}">${m.escapeOnlyTag(decodeURIComponent(uri).replace(/[\n\s\t\r]/g, " "))}</a>`; } else { exec = m.ptnFILE.exec(uri); if (exec !== null) { return `<a target="_blank" href="${exec[0]}">${m.escapeOnlyTag(decodeURIComponent(uri).replace(/[\n\s\t\r]/g, " "))}</a>`; } else { return m.escapeOnlyTag(uri); } } }; })(window.k, jQuery); ```/ ## RRA
  1. 에러 다시 생기게 만든건가?
728x90
반응형