[O] Localize js files

This commit is contained in:
Hykilpikonna
2021-11-25 13:56:41 -05:00
parent 73c1947ed8
commit 1cc3ac21fe
8 changed files with 1329 additions and 85 deletions
+1 -1
View File
@@ -126,4 +126,4 @@ dmypy.json
config.json5
data/
report/
/report/
+12 -2
View File
@@ -48,7 +48,6 @@ def generate_report() -> str:
lines = [lines[ln] for ln in range(len(lines)) if ln in args]
md[i] = '\n'.join(lines)
return '\n'.join(md)
@@ -75,7 +74,7 @@ def serve_report() -> None:
@app.route('/<path:path>')
def res(path: str) -> Response:
"""
Resources endpoint
Resources endpoint. This maps report queries to the report directory
:param path: Path of the resource
:return: File resource or 404
@@ -83,6 +82,17 @@ def serve_report() -> None:
path = os.path.join(REPORT_DIR, path)
return send_from_directory(Path(path).absolute().parent, Path(path).name)
@app.route('/resources/<path:path>')
def js_res(path: str) -> Response:
"""
JS Resource endpoint. This maps JS and CSS queries to the resources directory
:param path: Path of the resource
:return: File resource or 404
"""
path = os.path.join(src_dir, 'resources', path)
return send_from_directory(Path(path).absolute().parent, Path(path).name)
# Run app
webbrowser.open("http://localhost:5000")
app.run()
+4 -4
View File
@@ -38,15 +38,15 @@ So, we removed the outliers using the method proposed by Boris Iglewicz and Davi
As expected, the distributions looks right-skewed, with most people posting not very much. One interesting distinction is that, even though the distributions follow similar shapes, the x-axis ticks of `eng-news` is actually ten times larger than the other two, which means that `eng-news` post a lot more about COVID-19 on average than the other two samples. We can calculate some statistics of the samples to further verify this:
@include `/freq/stats.md`
@include-lines `/freq/stats.md` 0 1 4 5
Since there are many outliers, medians will more accurately represent the
Since there are many outliers, medians and IQR will more accurately represent the center and spread of this distribution. As these numbers show, `eng-news` do post much more (6.1% more post3, or a 1220% increase) than the other two samples. Again, this can be explained by the news channels' obligation to report news related to COVID-19 or to promote methods to slow the spread of the pandemic.
## COVID-19 Popularity Ratios
To prevent division by zero, we ignored people who didn't post about COVID or didn't post at all.
Then, we analyzed the popularity ratio of COVID-related posts for our three samples. The popularity of a post defines how much other people are interested in the post, measured by the total number of user interactions (likes and comments) on that post. From that data, the relative popularity ratio for COVID-related posts calculates how popular are COVID-related posts compared to all other posts, calculated by the equation, which is a ratio of the average popularity of both: \[(∑Popularity of COVID-posts / # of COVID-posts) / (∑Popularity of all posts / # of posts total)]
Test Include:
To prevent division by zero, we ignored people who didn't post about COVID or didn't post at all.
@include `/pop/stats.md`
+4 -78
View File
@@ -3,89 +3,15 @@
<head>
<meta charset="UTF-8">
<title>CSC110 Report</title>
<style>
#content {
margin: auto;
padding: 0 20px;
max-width: 800px;
text-align: justify;
text-justify: inter-word;
font-family: "Microsoft YaHei UI", Avenir, Helvetica, Arial, sans-serif;
color: #5b3300;
}
h1, h2 {
border-bottom: 1px solid #5b3300;
font-size: 2em;
margin-top: 1em;
}
h2 {
font-size: 1.5em;
}
code {
padding: 1px 5px;
background-color: beige;
}
a {
color: coral;
text-decoration: none;
}
table {
border-collapse: collapse;
border: 2px solid #5b3300;
width: 100%;
margin-top: 10px;
margin-bottom: 10px;
}
th, td {
border: 1px solid #5b3300;
text-align: center;
}
.image-row {
display: flex;
flex-direction: row;
width: 100%;
}
.image-row div {
flex: 33.33%;
}
.image-row img {
width: 100%;
}
img {
user-select: none;
-webkit-user-drag: none;
}
img.clickable {
cursor: pointer;
}
#modal {
transition: all 0.25s ease;
}
#modal.zoom {
background-size: contain !important;
}
</style>
<link rel="stylesheet" href="resources/style.css">
</head>
<body>
<div id="content">
</div>
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="resources/marked.min.js"></script>
<script src="resources/jquery.min.js"></script>
<script src="resources/LaTeXMathML.js"></script>
<script>
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+75
View File
@@ -0,0 +1,75 @@
#content {
margin: auto;
padding: 0 20px;
max-width: 800px;
text-align: justify;
text-justify: inter-word;
font-family: "Microsoft YaHei UI", Avenir, Helvetica, Arial, sans-serif;
color: #5b3300;
}
h1, h2 {
border-bottom: 1px solid #5b3300;
font-size: 2em;
margin-top: 1em;
}
h2 {
font-size: 1.5em;
}
code {
padding: 1px 5px;
background-color: beige;
}
a {
color: coral;
text-decoration: none;
}
table {
border-collapse: collapse;
border: 2px solid #5b3300;
width: 100%;
margin-top: 10px;
margin-bottom: 10px;
}
th, td {
border: 1px solid #5b3300;
text-align: center;
}
.image-row {
display: flex;
flex-direction: row;
width: 100%;
}
.image-row div {
flex: 33.33%;
}
.image-row img {
width: 100%;
}
img {
user-select: none;
-webkit-user-drag: none;
}
img.clickable {
cursor: pointer;
}
#modal {
transition: all 0.25s ease;
}
#modal.zoom {
background-size: contain !important;
}