summaryrefslogtreecommitdiffstats
path: root/src/Pages
diff options
context:
space:
mode:
Diffstat (limited to 'src/Pages')
-rw-r--r--src/Pages/Index.cshtml6
-rw-r--r--src/Pages/Read.cshtml17
-rw-r--r--src/Pages/Read.cshtml.cs2
-rw-r--r--src/Pages/Shared/_Layout.cshtml1
4 files changed, 17 insertions, 9 deletions
diff --git a/src/Pages/Index.cshtml b/src/Pages/Index.cshtml
index d809043..f01b263 100644
--- a/src/Pages/Index.cshtml
+++ b/src/Pages/Index.cshtml
@@ -5,11 +5,11 @@
}
@foreach (var article in Model.Source.Articles) {
- <section style="margin-bottom: 8px;display: flex; flex-direction: column">
+ <section class="news-link">
<a href="/les/@Model.Source.Name?url=@article.Href">
- <h2 style="font-size: 18px">@Html.Raw(article.Title)</h2>
+ <h2>@Html.Raw(article.Title)</h2>
</a>
- <a href="@article.Href" style="font-size: 14px;display:flex;justify-content: end" rel="noreferrer">Les på nrk.no</a>
+ <a href="@article.Href" class="source-link" rel="noreferrer">Les på nrk.no</a>
</section>
}
<footer>
diff --git a/src/Pages/Read.cshtml b/src/Pages/Read.cshtml
index 63543aa..9cff853 100644
--- a/src/Pages/Read.cshtml
+++ b/src/Pages/Read.cshtml
@@ -11,9 +11,10 @@
</div>
</div>
-<div id="art-body">
+<article id="art-body">
@Html.Raw(Model.Source.Content)
-</div>
+</article>
+
<footer>
<p>
<div style="display: flex; flex-direction: column; flex-wrap: nowrap;">
@@ -33,9 +34,17 @@
}
<br/>
<small>
- <a href="@Model.Source.Href">Les på nrk.no</a>
+ <a href="@Model.Source.Href" no-interception>Les på nrk.no</a>
</small>
</div>
</div>
</p>
-</footer> \ No newline at end of file
+</footer>
+
+<script>
+document.addEventListener("DOMContentLoaded", () => {
+ document.querySelectorAll("a:not([no-interception])").forEach(el => {
+ if (el.href.indexOf("nrk.no") !== -1) el.href = "/les/nrk?url=" + el.href;
+ });
+})
+</script> \ No newline at end of file
diff --git a/src/Pages/Read.cshtml.cs b/src/Pages/Read.cshtml.cs
index 16a1055..1a13ec0 100644
--- a/src/Pages/Read.cshtml.cs
+++ b/src/Pages/Read.cshtml.cs
@@ -18,7 +18,7 @@ public class ReadModel : PageModel
"nrk" => await _grabber.GrabNrkArticleAsync(url),
_ => default
};
- if (Source == default) return Redirect("/");
+ if (Source == default) return Redirect(url);
return Page();
}
} \ No newline at end of file
diff --git a/src/Pages/Shared/_Layout.cshtml b/src/Pages/Shared/_Layout.cshtml
index 7831774..09babeb 100644
--- a/src/Pages/Shared/_Layout.cshtml
+++ b/src/Pages/Shared/_Layout.cshtml
@@ -3,7 +3,6 @@
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
- <link rel="stylesheet" href="/reset.css">
<link rel="stylesheet" href="/index.css">
<title>@ViewData["Title"] - Lettnytt</title>
</head>