Skip to content

Commit

Permalink
321 as-1
Browse files Browse the repository at this point in the history
  • Loading branch information
eniac00 committed Sep 25, 2023
1 parent bc37981 commit 6e28145
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 16 deletions.
45 changes: 30 additions & 15 deletions CSE321/as-1/as-1.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ <h2>Lab Assignment-01</h2>
<iframe src="https://docs.google.com/viewer?url=https://eniac00.github.io/bracu/CSE321/as-1/as-1.pdf&embedded=true" ></iframe>

<div class="button-container">
<button type="button" class="btn btn-primary" onclick="loadFile('problem1')">problem-1</button>
<button type="button" class="btn btn-primary" onclick="loadFile('problem2')">problem-2</button>
<button type="button" class="btn btn-primary" onclick="loadFile('problem3')">problem-3</button>
<button type="button" class="btn btn-primary" onclick="loadFile('problem4')">problem-4</button>
<button type="button" class="btn btn-primary" onclick="loadFile('problem5')">problem-5</button>
<button type="button" class="btn btn-primary" onclick="loadFile('1_shell_commands')">task-1</button>
<button type="button" class="btn btn-primary" onclick="loadFile('2_a')">task-2(a)</button>
<button type="button" class="btn btn-primary" onclick="loadFile('2_b')">task-2(b)</button>
<button type="button" class="btn btn-primary" onclick="loadFile('2_c')">task-2(c)</button>
<button type="button" class="btn btn-primary" onclick="loadFile('2_d')">task-2(d)</button>
<button type="button" class="btn btn-primary" onclick="loadFile('2_e')">task-2(e)</button>
</div>

<div id="sub-title"></div>
Expand All @@ -37,25 +38,30 @@ <h2>Lab Assignment-01</h2>
document.getElementById('sub-title').innerHTML = "";
document.getElementById('sub-title').innerHTML = `${button_name}`;

if (button_name === "problem2") {

document.getElementById('code-wrapper').innerHTML = "";
document.getElementById('code-wrapper').innerHTML = "<iframe src='https://docs.google.com/viewer?url=https://eniac00.github.io/bracu/CSE221/as-1/lab-01/explanations.pdf&embedded=true'></iframe>";

} else if (button_name === "problem5") {
if (button_name === "1_shell_commands") {
fetch(`./code01/${button_name}.txt`)
.then(function(response) {
return response.text();
})
.then(function(data) {
document.getElementById('code-wrapper').innerHTML = "";
document.getElementById('code-wrapper').innerHTML = `<pre><code class='language-txt'>${data}</code></pre>`;
hljs.highlightAll();
})
.catch(function(error) {
console.log(error);
});

document.getElementById('code-wrapper').innerHTML = "";
document.getElementById('code-wrapper').innerHTML = "<iframe src='https://docs.google.com/viewer?url=https://eniac00.github.io/bracu/CSE221/as-1/lab-01/explanations.pdf&embedded=true'></iframe>";

} else {

fetch(`./lab-01/${button_name}.py`)
fetch(`./code01/${button_name}.c`)
.then(function(response) {
return response.text();
})
.then(function(data) {
document.getElementById('code-wrapper').innerHTML = "";
document.getElementById('code-wrapper').innerHTML = `<pre><code class='language-python'>${data}</code></pre>`;
document.getElementById('code-wrapper').innerHTML = `<pre><code class='language-cpp'>${htmlencode(data)}</code></pre>`;
hljs.highlightAll();
})
.catch(function(error) {
Expand All @@ -65,6 +71,15 @@ <h2>Lab Assignment-01</h2>
}
}

function htmlencode(text) {
return (
text
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
);
}

</script>
</body>
</html>
85 changes: 85 additions & 0 deletions CSE321/as-2/as-2.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CSE321/as-1</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-iYQeCzEYFbKjA/T2uDLTpkwGzCiq6soy8tYaI1GyVh/UjpbCx/TYkiZhlZB6+fzT" crossorigin="anonymous">
<link rel="stylesheet" href="../../assets/themes/stackoverflow-dark.min.css">
<link rel="stylesheet" href="../../assets/style.css">
</head>
<body>
<div class="title">
<h2>Lab Assignment-02</h2>
</div>

<iframe src="https://docs.google.com/viewer?url=https://eniac00.github.io/bracu/CSE321/as-2/as-2.pdf&embedded=true" ></iframe>

<div class="button-container">
<button type="button" class="btn btn-primary" onclick="loadFile('1_shell_commands')">task-1</button>
<button type="button" class="btn btn-primary" onclick="loadFile('2_a')">task-2(a)</button>
<button type="button" class="btn btn-primary" onclick="loadFile('2_b')">task-2(b)</button>
<button type="button" class="btn btn-primary" onclick="loadFile('2_c')">task-2(c)</button>
<button type="button" class="btn btn-primary" onclick="loadFile('2_d')">task-2(d)</button>
<button type="button" class="btn btn-primary" onclick="loadFile('2_e')">task-2(e)</button>
</div>

<div id="sub-title"></div>


<div id="code-wrapper"></div>

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-u1OknCvxWvY5kfmNBILK2hRnQC3Pr17a+RTT6rIHI7NnikvbZlHgTPOOmMi466C8" crossorigin="anonymous"></script>
<script src="../../assets/highlight.min.js"></script>
<script>
function loadFile(button_name) {

document.getElementById('sub-title').innerHTML = "";
document.getElementById('sub-title').innerHTML = `${button_name}`;

if (button_name === "1_shell_commands") {
fetch(`./code01/${button_name}.txt`)
.then(function(response) {
return response.text();
})
.then(function(data) {
document.getElementById('code-wrapper').innerHTML = "";
document.getElementById('code-wrapper').innerHTML = `<pre><code class='language-txt'>${data}</code></pre>`;
hljs.highlightAll();
})
.catch(function(error) {
console.log(error);
});


} else {

fetch(`./code01/${button_name}.c`)
.then(function(response) {
return response.text();
})
.then(function(data) {
document.getElementById('code-wrapper').innerHTML = "";
document.getElementById('code-wrapper').innerHTML = `<pre><code class='language-cpp'>${htmlencode(data)}</code></pre>`;
hljs.highlightAll();
})
.catch(function(error) {
console.log(error);
});

}
}

function htmlencode(text) {
return (
text
.replace(/&/g, '&amp;')
.replace(/</g, '&lt;')
.replace(/>/g, '&gt;')
);
}

</script>
</body>
</html>
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ <h2 class="accordion-header" id="headingFive">
<div class="accordion-body">
<div class="container btn-group-vertical">
<a class="btn btn-info mt-2" href="./CSE321/as-1/as-1.html" role="button">Assignment 1</a>
<a class="btn btn-info mt-2" href="" role="button">Assignment 2</a>
<a class="btn btn-info mt-2" href="./CSE321/as-2/as-2.html" role="button">Assignment 2</a>
<a class="btn btn-info mt-2" href="" role="button">Assignment 3</a>
<a class="btn btn-info mt-2" href="" role="button">Assignment 4</a>
<a class="btn btn-info mt-2" href="" role="button">Assignment 5</a>
Expand Down

0 comments on commit 6e28145

Please sign in to comment.