mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-04-11.git
synced 2024-08-15 00:43:26 +00:00
Add dark theme
This commit is contained in:
parent
6bbbfcb919
commit
4bf0e538e4
5 changed files with 73 additions and 14 deletions
26
assets/css/darktheme.css
Normal file
26
assets/css/darktheme.css
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
a:hover,
|
||||||
|
a:active {
|
||||||
|
color: #46aaf6;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #f0f0f0;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: #101010;
|
||||||
|
color: #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pure-form legend {
|
||||||
|
color: #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pure-menu-heading {
|
||||||
|
color: #f0f0f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pure-form > fieldset > input {
|
||||||
|
color: #101010;
|
||||||
|
}
|
|
@ -1,13 +1,3 @@
|
||||||
a {
|
|
||||||
color: #333;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
a:hover,
|
|
||||||
a:active {
|
|
||||||
color: #167ac6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.h-box {
|
.h-box {
|
||||||
padding-left: 1em;
|
padding-left: 1em;
|
||||||
padding-right: 1em;
|
padding-right: 1em;
|
9
assets/css/lighttheme.css
Normal file
9
assets/css/lighttheme.css
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
a:hover,
|
||||||
|
a:active {
|
||||||
|
color: #167ac6;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
color: #303030;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
|
@ -208,6 +208,10 @@ before_all do |env|
|
||||||
notifications ||= 0
|
notifications ||= 0
|
||||||
env.set "notifications", notifications
|
env.set "notifications", notifications
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if env.request.cookies.has_key?("darktheme") && env.request.cookies["darktheme"].value == "true"
|
||||||
|
env.set "darktheme", true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
get "/" do |env|
|
get "/" do |env|
|
||||||
|
@ -514,8 +518,10 @@ get "/signout" do |env|
|
||||||
referer ||= "/"
|
referer ||= "/"
|
||||||
|
|
||||||
env.request.cookies.each do |cookie|
|
env.request.cookies.each do |cookie|
|
||||||
|
if cookie.name != "darktheme"
|
||||||
cookie.expires = Time.new(1990, 1, 1)
|
cookie.expires = Time.new(1990, 1, 1)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
env.request.cookies.add_response_headers(env.response.headers)
|
env.request.cookies.add_response_headers(env.response.headers)
|
||||||
env.redirect referer
|
env.redirect referer
|
||||||
|
@ -770,6 +776,20 @@ get "/subscription_ajax" do |env|
|
||||||
env.redirect referer
|
env.redirect referer
|
||||||
end
|
end
|
||||||
|
|
||||||
|
get "/modify_theme" do |env|
|
||||||
|
referer = env.request.headers["referer"]?
|
||||||
|
referer ||= "/"
|
||||||
|
|
||||||
|
if env.params.query["dark"]?
|
||||||
|
env.response.cookies["darktheme"] = "true"
|
||||||
|
elsif env.params.query["light"]?
|
||||||
|
env.request.cookies["darktheme"].expires = Time.new(1990, 1, 1)
|
||||||
|
env.request.cookies.add_response_headers(env.response.headers)
|
||||||
|
end
|
||||||
|
|
||||||
|
env.redirect referer
|
||||||
|
end
|
||||||
|
|
||||||
error 404 do |env|
|
error 404 do |env|
|
||||||
error_message = "404 Page not found"
|
error_message = "404 Page not found"
|
||||||
templated "error"
|
templated "error"
|
||||||
|
|
|
@ -7,7 +7,12 @@
|
||||||
<link rel="stylesheet" href="https://unpkg.com/purecss@1.0.0/build/pure-min.css">
|
<link rel="stylesheet" href="https://unpkg.com/purecss@1.0.0/build/pure-min.css">
|
||||||
<link rel="stylesheet" href="https://unpkg.com/purecss@1.0.0/build/grids-responsive-min.css">
|
<link rel="stylesheet" href="https://unpkg.com/purecss@1.0.0/build/grids-responsive-min.css">
|
||||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.6/css/all.css">
|
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.6/css/all.css">
|
||||||
<link rel="stylesheet" href="/css/custom.css">
|
<link rel="stylesheet" href="/css/default.css">
|
||||||
|
<% if env.get? "darktheme" %>
|
||||||
|
<link rel="stylesheet" href="/css/darktheme.css">
|
||||||
|
<% else %>
|
||||||
|
<link rel="stylesheet" href="/css/lighttheme.css">
|
||||||
|
<% end %>
|
||||||
<%= yield_content "header" %>
|
<%= yield_content "header" %>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
@ -21,7 +26,9 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="pure-u-1 pure-u-md-3-5">
|
<div class="pure-u-1 pure-u-md-3-5">
|
||||||
<form class="pure-form" action="/search" method="get">
|
<form class="pure-form" action="/search" method="get">
|
||||||
|
<fieldset>
|
||||||
<input type="search" style="width:100%;" name="q" placeholder="search" value="<%= env.params.query["q"]? %>">
|
<input type="search" style="width:100%;" name="q" placeholder="search" value="<%= env.params.query["q"]? %>">
|
||||||
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="pure-u-1 pure-u-md-1-5">
|
<div class="pure-u-1 pure-u-md-1-5">
|
||||||
|
@ -47,6 +54,13 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<%= content %>
|
<%= content %>
|
||||||
|
<center class="h-box">
|
||||||
|
<% if env.get? "darktheme" %>
|
||||||
|
<a href="/modify_theme?light">Light theme</a>
|
||||||
|
<% else %>
|
||||||
|
<a href="/modify_theme?dark">Dark theme</a>
|
||||||
|
<% end %>
|
||||||
|
</center>
|
||||||
<center class="h-box">
|
<center class="h-box">
|
||||||
Released under AGPLv3 by <a href="https://github.com/omarroth">Omar Roth</a> -
|
Released under AGPLv3 by <a href="https://github.com/omarroth">Omar Roth</a> -
|
||||||
source available <a href="https://github.com/omarroth/invidious">here</a>
|
source available <a href="https://github.com/omarroth/invidious">here</a>
|
||||||
|
|
Loading…
Reference in a new issue