Skip to content

Commit

Permalink
Cleanup and fixes to startup script
Browse files Browse the repository at this point in the history
  • Loading branch information
George Marshall authored and admc committed Dec 17, 2010
1 parent f0c637c commit 64fba10
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 37 deletions.
55 changes: 35 additions & 20 deletions windmill/html/js/wm/wmexec.js
Expand Up @@ -16,28 +16,43 @@ Copyright 2006-2007, Open Source Applications Foundation

//Loader function
function Load() {
var load = document.createElement('div');
load.id = 'loading';
load.style.font = '14pt "Lucida Grande","Verdana",sans-serif';
load.style.position = 'absolute';
load.style.zIndex = '99999';
load.style.display = 'block';
load.style.color = 'white';
load.innerHTML = '<center><img src="img/wlogo.png"><br><br><img src="img/load_new.gif"></center>';
load.style.left = "40%";
load.style.top = "25%";
document.body.appendChild(load);
//fleegix.dom.center(load);

var remUrl = window.location.href.replace("start.html", "remote.html");
$(
'<div>' +
'<p><img src="img/wlogo.png" alt="Windmill" /></p>' +
'<p><img src="img/load_new.gif" alt="loading please wait" /></p>' +
'</div>'
)
.attr('id', 'loading')
.css({
'position': 'absolute',
'z-index': '1000',
'text-align': 'center',
'left': '40%',
'top': '25%'
})
.appendTo('body');

var remUrl = window.location.href.replace('start.html', 'remote.html');
var remote = window.open(remUrl, 'windmill_Remote', 'width=567,height=600,toolbar=no,' +
'location=no,directories=no,status=yes,menubar=no,scrollbars=yes,copyhistory=no,resizable=yes');


var message = 'We detected a popup blocker, please disable it while ' +
'you are using Windmill as we load the UI in a popup window. This requires a reload of the page.';
if (!remote) {
alert('We detected a popup blocker, please disable it while ' +
'you are using Windmill as we load the UI in a popup window. This requires a reload of the page.');
}
alert(message);
} else {
// Check to see if Chrome blocked the popup
// Reffrence: http://stackoverflow.com/questions/668286/detect-blocked-popup-in-chrome
remote.onload = function() {
setTimeout(function() {
if (remote.screenX === 0) {
alert(message);
}
}, 0);
};
}

var redirect = function() { window.location = urlSTR; }
setTimeout(redirect, 3000);
setTimeout(function() {
window.location = urlSTR;
}, 3000);
}
43 changes: 26 additions & 17 deletions windmill/html/start.html
@@ -1,3 +1,4 @@
<!DOCTYPE html>
<!--
Copyright 2006-2007, Open Source Applications Foundation
Expand All @@ -13,29 +14,37 @@
See the License for the specific language governing permissions and
limitations under the License.
-->

<html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="js/lib/fleegix_js/fleegix.js"></script>
<meta charset="UTF-8" />
<title>Loading Windmill Testing Framework</title>
<style type="text/css">
body {
background: #000;
color: #fff;
font: 14pt "Lucida Grande","Verdana",sans-serif;
}
</style>
<script type="text/javascript" src="js/lib/jquery/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/lib/json2.js"></script>
<script type="text/javascript" src="js/wm/wmexec.js"></script>
<script type="text/javascript">
var urlSTR = window.location.href.replace("/windmill-serv/start.html","");
//set the url
var jsonObject = {version:'1.1', method:'set_test_url', params:{url:urlSTR}};
var jsonString = JSON.stringify(jsonObject)
var urlSTR = window.location.href.replace('/windmill-serv/start.html', '');
//set the url
var jsonObject = {
version: '1.1',
method: 'set_test_url',
params: {url: urlSTR}
};

var resp = function(str) { return true; }
result = fleegix.xhr.doPost('/windmill-jsonrpc/', jsonString);
resp(result);
var jsonString = JSON.stringify(jsonObject);
$.ajax({type: 'POST', url: '/windmill-jsonrpc/', dataType: 'json', data: jsonString});

//Enabling the ability to start out out a page that requires query parameters
//By parsing the url they requested and opening it and storing that url
//Then when we open write the iframe src we can give it the correct starting src attrib
fleegix.event.listen(window, 'onload', Load);
// Enabling the ability to start out out a page that requires query parameters
// By parsing the url they requested and opening it and storing that url
// Then when we open write the iframe src we can give it the correct starting src attrib
$(document).ready(Load);
</script>
</head>
<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type">
<title>Loading Windmill Testing Framework</title>
<body topmargin="0" leftmargin="0" style="background:black;"/>
<body></body>
<html>

0 comments on commit 64fba10

Please sign in to comment.