mirror of https://github.com/kiwix/libkiwix.git
Merge pull request #474 from MananJethwani/issue/473
injecting root link directly and renamed head_part to head_taskbar
This commit is contained in:
commit
d061697de7
|
@ -202,7 +202,7 @@ void ContentResponse::introduce_taskbar()
|
|||
data.set("hascontent", !m_bookName.empty());
|
||||
data.set("title", m_bookTitle);
|
||||
data.set("withlibrarybutton", m_withLibraryButton);
|
||||
auto head_content = render_template(RESOURCE::templates::head_part_html, data);
|
||||
auto head_content = render_template(RESOURCE::templates::head_taskbar_html, data);
|
||||
m_content = prependToFirstOccurence(
|
||||
m_content,
|
||||
"</head[ \\t]*>",
|
||||
|
@ -227,6 +227,13 @@ void ContentResponse::inject_externallinks_blocker()
|
|||
script_tag);
|
||||
}
|
||||
|
||||
void ContentResponse::inject_root_link(){
|
||||
m_content = prependToFirstOccurence(
|
||||
m_content,
|
||||
"<head[ \\t]*>",
|
||||
"<link type=\"root\" href=\"" + m_root + "\">");
|
||||
}
|
||||
|
||||
bool
|
||||
ContentResponse::can_compress(const RequestContext& request) const
|
||||
{
|
||||
|
@ -252,6 +259,8 @@ Response::create_mhd_response(const RequestContext& request)
|
|||
MHD_Response*
|
||||
ContentResponse::create_mhd_response(const RequestContext& request)
|
||||
{
|
||||
inject_root_link();
|
||||
|
||||
if (contentDecorationAllowed()) {
|
||||
if (m_withTaskbar) {
|
||||
introduce_taskbar();
|
||||
|
|
|
@ -89,6 +89,7 @@ class ContentResponse : public Response {
|
|||
|
||||
void introduce_taskbar();
|
||||
void inject_externallinks_blocker();
|
||||
void inject_root_link();
|
||||
bool can_compress(const RequestContext& request) const;
|
||||
bool contentDecorationAllowed() const;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ templates/404.html
|
|||
templates/500.html
|
||||
templates/index.html
|
||||
templates/suggestion.json
|
||||
templates/head_part.html
|
||||
templates/head_taskbar.html
|
||||
templates/taskbar_part.html
|
||||
templates/external_blocker_part.html
|
||||
templates/captured_external.html
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
<link type="text/css" href="{{root}}/skin/jquery-ui/jquery-ui.min.css" rel="Stylesheet" />
|
||||
<link type="text/css" href="{{root}}/skin/jquery-ui/jquery-ui.theme.min.css" rel="Stylesheet" />
|
||||
<link type="text/css" href="{{root}}/skin/taskbar.css" rel="Stylesheet" />
|
||||
<link type="root" href="{{root}}">
|
||||
<script type="text/javascript" src="{{root}}/skin/jquery-ui/external/jquery/jquery.js"></script>
|
||||
<script type="text/javascript" src="{{root}}/skin/jquery-ui/jquery-ui.min.js"></script>
|
||||
<script type="text/javascript" src="{{root}}/skin/taskbar.js" async></script>
|
Loading…
Reference in New Issue