mirror of
https://git.nadeko.net/Fijxu/invidious.git
synced 2025-12-22 02:48:51 +00:00
Added a previous_page_button preference option and made switching between the first page and previous page buttons possible
This commit is contained in:
@@ -3,7 +3,10 @@ require "uri"
|
||||
module Invidious::Frontend::Pagination
|
||||
extend self
|
||||
|
||||
private def first_page(str : String::Builder, locale : String?, url : String)
|
||||
private def first_page(str : String::Builder, locale : String?, url : String, previous_page_button : Bool)
|
||||
if previous_page_button
|
||||
str << %(<noscript>)
|
||||
end
|
||||
str << %(<a href=") << url << %(" class="pure-button pure-button-secondary">)
|
||||
|
||||
if locale_is_rtl?(locale)
|
||||
@@ -19,6 +22,9 @@ module Invidious::Frontend::Pagination
|
||||
end
|
||||
|
||||
str << "</a>"
|
||||
if previous_page_button
|
||||
str << "</noscript>"
|
||||
end
|
||||
end
|
||||
|
||||
private def previous_page(str : String::Builder, locale : String?, url : String)
|
||||
@@ -90,7 +96,7 @@ module Invidious::Frontend::Pagination
|
||||
end
|
||||
end
|
||||
|
||||
def nav_ctoken(locale : String?, *, base_url : String | URI, ctoken : String?, first_page : Bool)
|
||||
def nav_ctoken(locale : String?, *, base_url : String | URI, ctoken : String?, first_page : Bool, previous_page_button : Bool)
|
||||
return String.build do |str|
|
||||
str << %(<div class="h-box">\n)
|
||||
str << %(<div class="page-nav-container flexible">\n)
|
||||
@@ -98,7 +104,7 @@ module Invidious::Frontend::Pagination
|
||||
str << %(<div class="page-prev-container flex-left">)
|
||||
|
||||
if !first_page
|
||||
self.first_page(str, locale, base_url.to_s)
|
||||
self.first_page(str, locale, base_url.to_s, previous_page_button)
|
||||
end
|
||||
|
||||
str << %(</div>\n)
|
||||
|
||||
Reference in New Issue
Block a user