Changes between Version 11 and Version 12 of TestWebSwing2


Ignore:
Timestamp:
11/15/18 16:28:38 (6 years ago)
Author:
Bart Vastenhouw
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • TestWebSwing2

    v11 v12  
    11{{{
    22#!html
    3 <div class="webswing-element" data-webswing-instance="webswingInstance0">
    4     <div id="loading" class="ws-modal-container">
    5         <div class="ws-login">
    6                 <div  class="ws-login-content">
    7 <div class="ws-spinner"><div class="ws-spinner-dot-1"></div> <div class="ws-spinner-dot-2"></div></div></div>
    8                 </div>
    9             </div>
    10         </div>
     3<div
     4 style="height:500px;"
     5 data-webswing-instance="webswing"
     6 data-webswing-options="{autoStart:true,  anonym:true,  args:'foo',  applicationName:'bart', connectionUrl:'https://webswing.ewi.tudelft.nl/bart/'}">
     7</div>
     8
    119<script>
    12     var webswingInstance0 = {
    13         options: {
    14             autoStart: true,
    15                         connectionUrl:'https://webswing.ewi.tudelft.nl/bart/',
    16             args: getParam('args'),
    17             recording: getParam('recording'),
    18             binarySocket: getParam('binarySocket'),
    19             debugPort: getParam('debugPort'),
    20             recordingPlayback: getParam('recordingPlayback'),
    21             securityToken: getParam('securityToken'),
    22             realm: getParam('realm'),
    23             debugLog: getParam('debugLog')
     10    (function (window, document) {
     11      var loader = function () {
     12        //fix for ie
     13        if (!window.location.origin) {
     14            window.location.origin = window.location.protocol + "//" + window.location.hostname
     15                    + (window.location.port ? ':' + window.location.port : '');
    2416        }
    25     }
    26 
    27     function getParam(name) {
    28         name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
    29         var results = new RegExp("[\\?&]" + name + "=([^&#]*)").exec(location.href);
    30         return results == null ? null : decodeURIComponent(results[1]);
    31     }
    32 </script>
    33 
    34 <script data-webswing-global-var="webswing">
    35     (function (window, document) {
    36         var loader = function () {
    37             //fix for ie
    38             if (!window.location.origin) {
    39                 window.location.origin = window.location.protocol + "//" + window.location.hostname + (window.location.port ? ':' + window.location.port : '');
     17        var xmlhttp = new XMLHttpRequest();
     18        xmlhttp.onreadystatechange = function() {
     19            if (xmlhttp.readyState == XMLHttpRequest.DONE ) {
     20                var version = xmlhttp.status == 200 ? xmlhttp.responseText : "undefined";
     21                var script = document.createElement("script"), tag = document.getElementsByTagName("script")[0];
     22                script.src =  document.location.origin + document.location.pathname + "javascript/webswing-embed.js?version="+version;
     23                tag.parentNode.insertBefore(script, tag);
    4024            }
    41                         var baseUrl = 'https://webswing.ewi.tudelft.nl/bart/';
    42             baseUrl = baseUrl.indexOf("/", baseUrl.length - 1) !== -1 ? baseUrl : (baseUrl + "/");
    43             var xmlhttp = new XMLHttpRequest();
    44             xmlhttp.onreadystatechange = function () {
    45                 if (xmlhttp.readyState == XMLHttpRequest.DONE) {
    46                     var version = xmlhttp.status == 200 ? xmlhttp.responseText : "undefined";
    47                     var script = document.createElement("script"),
    48                         tag = document.getElementsByTagName("script")[0];
    49                     script.src = baseUrl + "javascript/webswing-embed.js?version=" + version;
    50                     tag.parentNode.insertBefore(script, tag);
    51                 }
    52             };
    53             xmlhttp.open("GET", baseUrl + "rest/version", true);
    54             xmlhttp.send();
    5525        };
    56         window.addEventListener ? window.addEventListener("load", loader, false) : window.attachEvent("onload", loader);
     26        xmlhttp.open("GET", document.location.origin + document.location.pathname +"rest/webswing/version", true);
     27        xmlhttp.send();
     28      };
     29      window.addEventListener ? window.addEventListener("load", loader, false) : window.attachEvent("onload", loader);
    5730    })(window, document);
    5831</script>