Serve the taskbar css as separated file.

For firefox, the file encoding must be specified in the first 1024 bytes.
If it is not, firefox will reload the page when it founds it.

By inserting the taskbar's css directly in the html, we are "moving" down
the encoding of the page, and the encoding is not inside the first 1024
bytes.

This also improve a bit the performance as the browser can cache the css
file and it's avoid us to send the css in earch html file.
This commit is contained in:
Matthieu Gautier 2017-08-15 15:15:26 -04:00
parent 3220ee1276
commit 63cb47247b
2 changed files with 6 additions and 9 deletions

View File

@ -129,15 +129,11 @@ void introduceTaskbar(string& content, const string& humanReadableBookId)
content,
"<head>",
replaceRegex(
RESOURCE::include_html_part, humanReadableBookId, "__CONTENT__"));
content = appendToFirstOccurence(
content,
"<head>",
"<style>" + RESOURCE::taskbar_css
+ (noLibraryButtonFlag
? " #kiwix_serve_taskbar_library_button { display: none }"
: "")
+ "</style>");
RESOURCE::include_html_part, humanReadableBookId, "__CONTENT__")
+ (noLibraryButtonFlag
? "<style>#kiwix_serve_taskbar_library_button { display: none }</style>"
: "")
);
if ( humanReadableBookId.empty() ) {
content = appendToFirstOccurence(
content,

View File

@ -1,5 +1,6 @@
<link type="text/css" href="/skin/jquery-ui/jquery-ui.min.css" rel="Stylesheet" />
<link type="text/css" href="/skin/jquery-ui/jquery-ui.theme.min.css" rel="Stylesheet" />
<link type="text/css" href="/skin/taskbar.css" rel="Stylesheet" />
<script type="text/javascript" src="/skin/jquery-ui/external/jquery/jquery.js"></script>
<script type="text/javascript" src="/skin/jquery-ui/jquery-ui.min.js"></script>
<script>