Skip to content
Snippets Groups Projects
Select Git revision
  • 9501d84bddc307dfa017cea9df396aff619f5065
  • master default
  • next_version
  • laurent-change.log
  • Documentation_homogeneisation
  • HEAD
  • 2021.02.02
  • 2021.02.01
  • 2021.02.00
  • 2021.01.00
  • 2020.02.02
  • 2020.02.01
  • 2020.02.00
  • 2020.01.05
  • 2020.01.04
  • 2020.01.03
  • 2020.01.02
  • 2020.01.01
  • 2020.01.00
  • 2019.03.00
  • 2019.02.07
  • 2019.02.06
  • 2019.02.05
  • 2019.02.04
  • 2019.02.03
  • 2019.02.02
26 results

index.html

Blame
  • ArmandBahi's avatar
    Armand Bahi authored
    9501d84b
    History
    index.html 8.01 KiB
    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="UTF-8">
            <meta http-equiv="X-UA-Compatible" content="IE=edge" />
            <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
            <title>Vitis</title>
            <script src="javascript/externs/jquery/jquery-1.11.3.min.js"></script>
            <script src="javascript/externs/mobile-detect/mobile-detect.min.js"></script>
            <script src="https://www.google.com/recaptcha/api.js" async defer></script>
        </head>
        <body data-app-init="">
            <div class=""></div>
            <div ng-include="getMainTemplateUrl()" class="container" id="container"></div>
            <script>
    
                /**
                 * Load a JS file with possibility to add a possible attribute
                 * @param {string} sJsFile File path
                 * @param {string|undefined} attr Attribute to add (can be undefined)
                 */
                var loadJSFile = function (sJsFile, attr) {
                    var oScriptElement = document.createElement('script');
                    if (typeof attr === 'undefined')
                        oScriptElement.src = sJsFile;
                    else
                        oScriptElement.src = sJsFile + '?_' + attr;
                    document.write(oScriptElement.outerHTML);
                };
    
                var isMobile = function () {
                    var propertieEnabled = false;
                    if (typeof window['oClientProperties'] != 'undefined') {
                        if (window['oClientProperties']['mobile_interface'] == "true") {
                            propertieEnabled = true;
                        }
                    }
                    if (new MobileDetect(window.navigator.userAgent).mobile() && propertieEnabled) {
                        return true;
                    } else {
                        return false;
                    }
                };
    
                /**
                 * Variable de session
                 */
                var sessionStorage = {};
    
                // Récupère la version de l'application
                // important: utilise jQuery pour faire une requête synchrone
                $.ajax({
                    url: 'conf/properties.json?_' + Date.now(),
                    async: false,
                    context: document.body
                }).done(function (data) {
    
                    // Version de l'application
                    sessionStorage['build'] = data['build'];
    
                    // Nom de l'application
                    sessionStorage['application'] = data['application'];
    
                    // Paramètre "environment"
                    sessionStorage['environment'] = data['environment'];
    
                    // Paramètre "web_server_name" dans les properties (protocol + hostname + port).
                    if (typeof (data["web_server_name"]) == "undefined" || data["web_server_name"] == "") {
                        data["web_server_name"] = window.location.protocol + "//" + window.location.host;
                    }
    
                    // Balises à remplace
                    for (var key in data) {
                        if (typeof data[key] === 'string') {
                            data[key] = data[key].replace(/\[hostname\]/, window.location.hostname);
                        }
                    }
    
                    // Sauve les properties du client.
                    window["oClientProperties"] = data;
                });
    
                // Enlève les majuscules et les "/" à la fin de web_server_name
                window['oClientProperties']['web_server_name'] = window['oClientProperties']['web_server_name'].replace(/\/+$/g, '').toLowerCase();
    
                // Enlève les ports par défaut de web_server_name
                if (window.location.protocol === 'https:') {
                    window['oClientProperties']['web_server_name'] = window['oClientProperties']['web_server_name'].replace(/:443/g, '');
                }
                if (window.location.protocol === 'http:') {
                    window['oClientProperties']['web_server_name'] = window['oClientProperties']['web_server_name'].replace(/:80/g, '');
                }
    
                /**
                 * Paramètres de l'url dans un objet
                 */
                var oUrlParams = {};
                location.search.replace("?", "").split("&").forEach(function (sUrlParams) {
                    var aUrlParams = sUrlParams.split("=");
                    oUrlParams[aUrlParams[0]] = aUrlParams[1];
                });
    
                /**
                 * Mode compiled/degug
                 */
                if (Object.keys(oUrlParams).indexOf("debug") !== -1) {
                    sessionStorage['debug'] = 'true';
                    window['oClientProperties']["debug_mode"] = true;
                } else {
                    sessionStorage['debug'] = 'false';
                    window['oClientProperties']["debug_mode"] = false;
                }
    
                /**
                 * Paramètre "environment" : Nom de l'application concaténé avec le paramètre "environment".
                 */
                if (sessionStorage['environment'] != "")
                    sessionStorage['appEnv'] = sessionStorage['application'] + "_" + sessionStorage['environment'];
                else
                    sessionStorage['appEnv'] = sessionStorage['application'];
    
                // Version mobile ?
                oClientProperties['is_mobile'] = isMobile();
    
                // Demande confirmation à l'utilisateur quand il clique sur le bouton "Arrière" du navigateur
                if (oClientProperties['is_mobile']) {
                    setTimeout(function () {
                        window.onbeforeunload = function () {
                            return "Your work will be lost.";
                        };
                    }, 10000);
                }
    
                /**
                 * Fichiers à charger
                 * @type Array
                 */
                var aJsFiles = [
                    'javascript/externs/less/less.min.js',
                    'javascript/externs/underscore-min.js',
                    'javascript/externs/jquery/plugins/bootstrap-datepicker/bootstrap-datepicker.js',
                    'javascript/externs/jquery/plugins/bootstrap-datepicker/locales/bootstrap-datepicker.fr.min.js',
                    'javascript/externs/jquery/plugins/bootstrap-colorpicker/bootstrap-colorpicker.min.js',
                    'javascript/externs/jquery/plugins/bootstrap-fileinput/fileinput.min.js',
                    'javascript/externs/jquery/plugins/bootstrap-fileinput/fileinput_locale_fr.js',
                    'javascript/externs/jquery/plugins/bootbox/bootbox.min.js',
                    'javascript/externs/angular/angular.min.js',
                    'javascript/externs/angular/modules/ui-grid/ui-grid.min.js',
                    'javascript/externs/angular/modules/ui-grid/plugins/draggable-rows.js',
                    'javascript/externs/angular/modules/angular-translate/angular-translate.min.js',
                    'javascript/externs/angular/modules/angular-translate/angular-translate-loader-partial.min.js',
                    'javascript/externs/angular/modules/sanitize/angular-sanitize.min.js',
                    'javascript/externs/angular-bind-notifier/bindNotifier.js',
                    'javascript/externs/bootstrap/bootstrap.min.js',
                    'javascript/externs/jquery/plugins/bootstrap-slider/bootstrap-slider.min.js',
                    'javascript/externs/jquery/plugins/malihu-custom-scrollbar/jquery.mCustomScrollbar.concat.min.js'
                ];
    
                // Fichier de chargement à lancer
                if (sessionStorage['debug'] === 'true') {
                    aJsFiles.push('conf/node_modules/google-closure-library/closure/goog/base.js');
                    aJsFiles.push('javascript/' + sessionStorage['application'] + '.deps.js');
                    aJsFiles.push('javascript/require/requireVitis.js');
                } else {
                    aJsFiles.push('javascript/' + sessionStorage['application'] + '.min.js');
                }
    
                // Inclut les fichiers JS
                aJsFiles.forEach(function (sJsFile) {
                    loadJSFile(sJsFile, sessionStorage['build']);
                });
            </script>
        </body>
    </html>