help3xsl/help.html |   36 +++++++++++++++++++++++++-----------
 1 file changed, 25 insertions(+), 11 deletions(-)

New commits:
commit 768af6e9bbadd50c99363d3e401a8d7f3d91bc70
Author:     Jan Holesovsky <[email protected]>
AuthorDate: Fri Aug 10 17:20:07 2018 +0200
Commit:     Andras Timar <[email protected]>
CommitDate: Fri Aug 10 21:36:29 2018 +0200

    Avoid several JS errors.
    
    Change-Id: If0b8b4f3e8c3464f4e7f812ba727a929330438f3
    Reviewed-on: https://gerrit.libreoffice.org/58858
    Reviewed-by: Andras Timar <[email protected]>
    Tested-by: Andras Timar <[email protected]>

diff --git a/help3xsl/help.html b/help3xsl/help.html
index 1dade67f0..a9a369ecc 100644
--- a/help3xsl/help.html
+++ b/help3xsl/help.html
@@ -8,23 +8,37 @@
 -->
 <html>
 <head>
-    <script type="text/javascript" src="latest/help.js"></script>
     <meta http-equiv="Content-Security-Policy" content="script-src 'self' 
'unsafe-inline' 'unsafe-eval' piwik.documentfoundation.org *.google.com 
*.googleapis.com"/>
 </head>
 <body>
 <script type="text/javascript">
+    function getParameterByName(name, url) {
+        if (!url) {
+            url = window.location.href;
+        }
+        name = name.replace(/[\[\]]/g, "\\$&");
+        var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)");
+        var results = regex.exec(url);
+        if (!results) {
+            return null;
+        }
+        if (!results[2]) {
+            return '';
+        }
+        return decodeURIComponent(results[2].replace(/\+/g, " "));
+    }
     var url = window.location.href;
     var n = url.indexOf('help.html?');
-    if (n != -1){
-    // the URL came from LibreOffice help (F1)
-    var version = getParameterByName("Version",url);
-    var rest = url.substr(n+12,url.length);
-    var newURL = version+'/index.html?'+rest;
-    window.open(newURL,'_self');
-    }else{
-    // URL came from elsewhere, direct access to webroot, we redirect to main 
Help page
-    var userLang = navigator.language || navigator.userLanguage;
-    
window.open('latest/'+userLang+'/text/shared/main0108.html?&DbPAR=WRITER&System=WIN','_self');
+    if (n != -1) {
+        // the URL came from LibreOffice help (F1)
+        var version = getParameterByName("Version", url);
+        var rest = url.substr(n + 12, url.length);
+        var newURL = version + '/index.html?' + rest;
+        window.open(newURL, '_self');
+    } else {
+        // URL came from elsewhere, direct access to webroot, we redirect to 
main Help page
+        var userLang = navigator.language || navigator.userLanguage;
+        window.open('latest/' + userLang + 
'/text/shared/main0108.html?&DbPAR=WRITER&System=WIN', '_self');
     }
 </script>
 </body>
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to