Remove rests of .navigation class to hijack links rendered obsolete by 2c29b33

This commit is contained in:
Tissevert 2019-03-02 22:45:26 +01:00
parent f9a82cb088
commit 91bef62fbb
3 changed files with 7 additions and 12 deletions

View file

@ -56,7 +56,7 @@ function DomRenderer(modules) {
var div = getDiv(lines.slice(0, limit).join('\n')); var div = getDiv(lines.slice(0, limit).join('\n'));
return modules.dom.make('article', {}, [ return modules.dom.make('article', {}, [
modules.dom.make('header', {}, [ modules.dom.make('header', {}, [
modules.dom.make('a', {class: (limit != undefined ? 'navigation' : []), href: url}, [ modules.dom.make('a', {href: url}, [
modules.dom.make('h1', {innerText: blog.articles[key].title}) modules.dom.make('h1', {innerText: blog.articles[key].title})
]) ])
]), ]),
@ -83,7 +83,6 @@ function DomRenderer(modules) {
return [ return [
modules.dom.make('h2', {innerText: pageTitle(tag, all)}), modules.dom.make('h2', {innerText: pageTitle(tag, all)}),
modules.dom.make('a', { modules.dom.make('a', {
class: 'navigation',
innerText: all ? blog.wording.latestLink : blog.wording.allLink, innerText: all ? blog.wording.latestLink : blog.wording.allLink,
href: otherUrl(tag, all) href: otherUrl(tag, all)
}), }),

View file

@ -30,7 +30,7 @@ function Navigation(modules) {
for(var i = 0; i < links.length; i++) { for(var i = 0; i < links.length; i++) {
var a = links[i]; var a = links[i];
var href = a.getAttribute("href"); var href = a.getAttribute("href");
if(href[0] == "/" || href[0] == "#") { if((href[0] == "/" && href.slice(-3) != ".md") || href[0] == "#") {
a.addEventListener('click', visit(a.getAttribute("href"))); a.addEventListener('click', visit(a.getAttribute("href")));
} }
} }

View file

@ -47,7 +47,7 @@ instance Page ArticlesList where
content al@(ArticlesList {featured, full}) = do content al@(ArticlesList {featured, full}) = do
preview <- Article.preview <$> (Blog.get $skin.$previewLinesCount) preview <- Article.preview <$> (Blog.get $skin.$previewLinesCount)
h2_ . toHtml =<< pageTitle al h2_ . toHtml =<< pageTitle al
navigationA [href_ . pack $ otherUrl al] . toHtml =<< otherLink a_ [href_ . pack $ otherUrl al] . toHtml =<< otherLink
div_ [class_ "articles"] ( div_ [class_ "articles"] (
mapM_ (article False . preview) featured mapM_ (article False . preview) featured
) )
@ -59,12 +59,11 @@ article raw (Article {key, body, title}) = do
url <- absoluteLink . (</> key <.> extension) <$> (Blog.get $path.$articlesPath) url <- absoluteLink . (</> key <.> extension) <$> (Blog.get $path.$articlesPath)
article_ (do article_ (do
header_ (do header_ (do
aElem [href_ . pack $ url] . h1_ $ toHtml title a_ [href_ . pack $ url] . h1_ $ toHtml title
) )
pre_ . toHtml $ unlines body pre_ . toHtml $ unlines body
) )
where where extension = if raw then "md" else "html"
(aElem, extension) = if raw then (a_, "md") else (navigationA, "html")
makeCard :: String -> Text -> Maybe String -> HtmlGenerator () makeCard :: String -> Text -> Maybe String -> HtmlGenerator ()
makeCard title description image = do makeCard title description image = do
@ -76,16 +75,13 @@ makeCard title description image = do
og attribute value = meta_ [makeAttribute "property" $ "og:" <> attribute , content_ value] og attribute value = meta_ [makeAttribute "property" $ "og:" <> attribute , content_ value]
maybeImage = maybe (return ()) (og "image" . pack) maybeImage = maybe (return ()) (og "image" . pack)
navigationA :: Term arg result => arg -> result
navigationA = "a" `termWith` [class_ "navigation"]
tag :: String -> HtmlGenerator () tag :: String -> HtmlGenerator ()
tag tagName = li_ (navigationA [href_ . pack $ absoluteLink tagName] $ toHtml tagName) tag tagName = li_ (a_ [href_ . pack $ absoluteLink tagName] $ toHtml tagName)
defaultBanner :: HtmlGenerator () defaultBanner :: HtmlGenerator ()
defaultBanner = do defaultBanner = do
div_ [id_ "header"] ( div_ [id_ "header"] (
navigationA [href_ "/"] ( a_ [href_ "/"] (
h1_ . toHtml =<< Blog.get name h1_ . toHtml =<< Blog.get name
) )
) )