summaryrefslogtreecommitdiff
path: root/help3xsl/index2.html
diff options
context:
space:
mode:
authorIlmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>2019-03-22 12:06:44 +0200
committerOlivier Hallot <olivier.hallot@libreoffice.org>2019-03-27 09:42:01 +0100
commitca2a6bf2c3c59d106f1c6ad432eab21f696c23fc (patch)
tree3616969f889f8450502e4778d292417c355d85a2 /help3xsl/index2.html
parent9b776454d95f5c6bf13c0ca5508c0b2225aa4c1c (diff)
tdf#124245 Polyfills and fixes for IE11
The polyfills can be removed after we drop IE11 support. Other IE11 fixes: Change from document.URL to window.location.pathname because otherwise we get local Windows paths with backward slashes. Use clear: left; for google-donation element so it doesn't float on top of other elements. Don't use defer to load fuzzysort.js and prism.js. Change-Id: I6c0143eab555c8b1fbdbde8e749a24baed2f69c8 Reviewed-on: https://gerrit.libreoffice.org/69549 Tested-by: Jenkins Reviewed-by: himajin100000 <himajin100000@gmail.com> Reviewed-by: Olivier Hallot <olivier.hallot@libreoffice.org>
Diffstat (limited to 'help3xsl/index2.html')
-rw-r--r--help3xsl/index2.html100
1 files changed, 52 insertions, 48 deletions
diff --git a/help3xsl/index2.html b/help3xsl/index2.html
index 0321b7a390..3f761885fe 100644
--- a/help3xsl/index2.html
+++ b/help3xsl/index2.html
@@ -10,61 +10,65 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="Content-Security-Policy" content="script-src 'self' 'unsafe-inline' 'unsafe-eval' piwik.documentfoundation.org *.google.com *.googleapis.com"/>
- <script type="text/javascript" src="help2.js"></script>
+ <script type="text/javascript" src="polyfills.js"></script>
<script type="text/javascript" src="hid2file.js"></script>
<script type="text/javascript" src="languages.js"></script>
+ <script type="text/javascript" src="help2.js" defer></script>
</head>
<body>
<script type="text/javascript">
- var url = window.location.href;
- var n = url.indexOf('index.html?');
- if (n != -1) {
- // the URL came from LibreOffice help (F1)
- var target = getParameterByName("Target",url);
- var lang = existingLang(getParameterByName("Language", url));
- var system = getParameterByName("System", url);
- var module;
- var defaultFile;
- var smodule = target.substr(0, target.indexOf('/'));
- switch (smodule) {
- case "swriter": {defaultFile='text/swriter/main0000.html';module="WRITER";break;}
- case "scalc": {defaultFile='text/scalc/main0000.html';module="CALC";break;}
- case "schart": {defaultFile='text/schart/main0000.html';module="CHART";break;}
- case "simpress": {defaultFile='text/simpress/main0000.html';module="IMPRESS";break;}
- case "sdraw": {defaultFile='text/sdraw/main0000.html';module="DRAW";break;}
- case "smath": {defaultFile='text/smath/main0000.html';module="MATH";break;}
- case "sdatabase": {defaultFile='text/shared/explorer/database/main.html';module="BASE";break;}
- case "sbasic": {defaultFile='text/sbasic/shared/main0601.html';module="BASIC";break;}
- default: {defaultFile='text/shared/05/new_help.html';module="WRITER";break;}
- }
- //Special case of application F1 or menu Help -> LibreOffice Help
- if (target.indexOf('.uno:HelpIndex') != -1) {
- window.location.href = lang + '/' + defaultFile + '?System=' + system + '&DbPAR=' + module;
- }
- var bookmark = target.slice(target.indexOf('/') + 1, target.length);
- var file = hid2fileMap[bookmark];
- // check first if a root bookmark @@nowidget@@ can be used
- if (file === undefined) {
- var b2 = bookmark.substring(0, bookmark.lastIndexOf("/")) + '/@@nowidget@@';
- file = hid2fileMap[b2];
- }
- // rebuild URL
- if (file === undefined) {
- var newURL = lang + '/' + defaultFile + '?System=' + system + '&DbPAR=' + module;
+ // We have to wait until both the deferred help2.js and the document have loaded
+ window.addEventListener('DOMContentLoaded', function() {
+ var url = window.location.href;
+ var n = url.indexOf('index.html?');
+ if (n != -1) {
+ // the URL came from LibreOffice help (F1)
+ var target = getParameterByName("Target",url);
+ var lang = existingLang(getParameterByName("Language", url));
+ var system = getParameterByName("System", url);
+ var module;
+ var defaultFile;
+ var smodule = target.substr(0, target.indexOf('/'));
+ switch (smodule) {
+ case "swriter": {defaultFile='text/swriter/main0000.html';module="WRITER";break;}
+ case "scalc": {defaultFile='text/scalc/main0000.html';module="CALC";break;}
+ case "schart": {defaultFile='text/schart/main0000.html';module="CHART";break;}
+ case "simpress": {defaultFile='text/simpress/main0000.html';module="IMPRESS";break;}
+ case "sdraw": {defaultFile='text/sdraw/main0000.html';module="DRAW";break;}
+ case "smath": {defaultFile='text/smath/main0000.html';module="MATH";break;}
+ case "sdatabase": {defaultFile='text/shared/explorer/database/main.html';module="BASE";break;}
+ case "sbasic": {defaultFile='text/sbasic/shared/main0601.html';module="BASIC";break;}
+ default: {defaultFile='text/shared/05/new_help.html';module="WRITER";break;}
+ }
+ //Special case of application F1 or menu Help -> LibreOffice Help
+ if (target.indexOf('.uno:HelpIndex') != -1) {
+ window.location.href = lang + '/' + defaultFile + '?System=' + system + '&DbPAR=' + module;
+ }
+ var bookmark = target.slice(target.indexOf('/') + 1, target.length);
+ var file = hid2fileMap[bookmark];
+ // check first if a root bookmark @@nowidget@@ can be used
+ if (file === undefined) {
+ var b2 = bookmark.substring(0, bookmark.lastIndexOf("/")) + '/@@nowidget@@';
+ file = hid2fileMap[b2];
+ }
+ // rebuild URL
+ if (file === undefined) {
+ var newURL = lang + '/' + defaultFile + '?System=' + system + '&DbPAR=' + module;
+ } else {
+ var indx = file.indexOf('#');
+ var bm = file.substr(indx,file.length);
+ file = file.substr(0,indx);
+ var newURL = lang + '/' + file + '?System=' + system + '&DbPAR=' + module + '&HID=' + bookmark + bm;
+ }
+ window.location.href = newURL;
} else {
- var indx = file.indexOf('#');
- var bm = file.substr(indx,file.length);
- file = file.substr(0,indx);
- var newURL = lang + '/' + file + '?System=' + system + '&DbPAR=' + module + '&HID=' + bookmark + bm;
+ // URL came from elsewhere, direct access to webroot, we redirect to main Help page
+ var system = 'WIN';
+ if (navigator.userAgent.indexOf("Mac") != -1) system = 'MAC';
+ if (navigator.userAgent.indexOf("Linux") != -1) system = 'UNIX';
+ window.location.href = existingLang(navigator.language) + '/text/shared/05/new_help.html?&DbPAR=WRITER&System=' + system;
}
- window.location.href = newURL;
- } else {
- // URL came from elsewhere, direct access to webroot, we redirect to main Help page
- var system = 'WIN';
- if (navigator.userAgent.indexOf("Mac") != -1) system = 'MAC';
- if (navigator.userAgent.indexOf("Linux") != -1) system = 'UNIX';
- window.location.href = existingLang(navigator.language) + '/text/shared/05/new_help.html?&DbPAR=WRITER&System=' + system;
- }
+ });
</script>
</body>
</html>