This commit is contained in:
GitJournal 2024-01-10 07:39:35 +08:00
parent 26382832f2
commit 88fbe61b3e
2 changed files with 35 additions and 6 deletions

View File

@ -465,8 +465,12 @@
/* Provide spacing to accommodate the fixed header */
/* Ensure the section fills the remaining viewport height */
overflow-y: auto;
/* white-space: pre-wrap; */
/* Enable vertical scrolling if content exceeds viewport height */
}
code {
white-space: pre-wrap !important;
}
.container {
display: flex;
@ -512,7 +516,6 @@
html,
body {
margin-left: 5%;
margin-right: 5%;
}

View File

@ -107,6 +107,14 @@
</style>
<link href="https://cdn.jsdelivr.net/npm/prismjs@v1.x/themes/prism.css" rel="stylesheet" />
<style>
/* code {
white-space: pre-wrap !important;
} */
/* html, body{
max-width: 980px;
} */
#progress-overlay {
position: fixed;
top: 0;
@ -236,11 +244,20 @@
.search-container {
display: flex;
border: 1px solid #ccc;
/* justify-content: space-between; */
/* flex-direction: column; */
/* align-items: flex-start; */
}
.left-half {
flex: 1;
/* align-self: stretch; */
overflow-x: auto;
}
.left-half,
.right-half {
flex: 1;
/* align-self: stretch; */
overflow-x: auto;
}
@ -370,7 +387,8 @@
<body>
<div>
<!-- <div style="max-width: 980px; margin:0 auto;"> -->
<div id="progress-overlay">
<div id="progress-bar">
<div class="progress"></div>
@ -598,11 +616,14 @@
const pair_id = ((data_type === "code") ? id : (id - 1));
if (searchResultItems[file_id].pairs[pair_id] === undefined) {
// console.log(pair_id, pair_id+1, data_type, data[pair_id].location)
let mit = { "left": data[pair_id].content, "right": data[pair_id + 1].content, "location": data[pair_id].location }
let mit = { "left": data[pair_id].content, "right": data[pair_id + 1].content, "location": data[pair_id].location, "hit": [data_type] }
// let mit = { "left": data[pair_id].content, "right": data[pair_id - 1].content, "location": data[pair_id].location }
// console.log(mit)
searchResultItems[file_id].pairs[pair_id] = mit;
}
else {
searchResultItems[file_id].pairs[pair_id].hit.push(data_type)
}
}
// listItem.textContent = `[${field}][${data_type}] ${data[id][field]}`;
// searchResults.appendChild(listItem);
@ -652,7 +673,9 @@
code_location_p.setAttribute('onclick', `navigateToPage(${JSON.stringify(it.header.filepath)}, ${JSON.stringify(it.language_id)}, ${JSON.stringify(project_id)}, ${JSON.stringify(pair.location)})`)
pair_left.appendChild(code_location_p);
// const comment_p = document.createElement('pre');
const comment_p = document.createElement('p');
comment_p.setAttribute('style', 'white-space: pre-line;');
comment_p.innerHTML = (pair.right);
pair_left.appendChild(comment_p);
@ -670,7 +693,9 @@
pair_right.appendChild(code_pre);
pair_container.appendChild(pair_right);
pair_container.appendChild(pair_left);
pair_container.appendChild(pair_left); // comment
// if (pair.hit.indexOf("code") != -1) {
// }// code
//pair_container.setAttribute('onclick', `navigateToPage(${JSON.stringify(it.header.filepath)}, ${JSON.stringify(it.language_id)}, ${JSON.stringify(pair.location)})`)
item.appendChild(pair_container);
}
@ -768,7 +793,7 @@
const query_from_url = queryParams.q;
const file_path_from_url = queryParams.file;
isDebugMode = queryParams.debug == 'true';
if (isDebugMode){console.log("You are in debug mode.")}
if (isDebugMode) { console.log("You are in debug mode.") }
if (query_from_url != null || query_from_url != undefined) {
setTextAndTriggerInputEvent(query_from_url)
} else if (file_path_from_url != null || file_path_from_url != undefined) {
@ -783,6 +808,7 @@
}
async_main()
</script>
</div>
</body>