mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-08 01:45:32 +00:00
chore(developer): refactoring - minor
This commit is contained in:
parent
05cefaf9f8
commit
896b922865
3 changed files with 73 additions and 90 deletions
|
|
@ -50,14 +50,6 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<!--
|
||||
<span id='model-link' class='install-link' onclick=''>Models</span>
|
||||
<div id='model-list'>
|
||||
<div id='model-list-inner'>
|
||||
<span id='model-list-empty'>No models are currently loaded.</span>
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
<a href='/packages.html' class='install-link' id='install-link-packages'>Install packages</a>
|
||||
</div>
|
||||
|
||||
|
|
@ -75,11 +67,9 @@
|
|||
<div id='input-area'>
|
||||
<textarea id='ta1' class='test'></textarea><br/>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<script src='test.js'></script>
|
||||
|
||||
<!-- The following dynamic script will register each of the additional keyboards -->
|
||||
<script src="/inc/keyboards.js" type="text/javascript"></script>
|
||||
<script src='test.js'></script>
|
||||
<script src="/inc/keyboards.js" type="text/javascript"></script> <!-- This dynamic script registers each of the keyboards -->
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -11,15 +11,9 @@
|
|||
<meta name="viewport" content="width=device-width,user-scalable=no" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
|
||||
<!-- Enable IE9 Standards mode -->
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
|
||||
<title>Keyman Developer Package Installation</title>
|
||||
|
||||
<style type='text/css'>
|
||||
@import url('test.css');
|
||||
|
||||
</style>
|
||||
<link href='test.css' type="text/css" rel="stylesheet" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
@ -48,76 +42,6 @@
|
|||
[Test Online].</p>
|
||||
|
||||
</div>
|
||||
<script>
|
||||
// The following dynamic script will register each of the additional packages
|
||||
var packagesJSON = '';
|
||||
|
||||
function ajaxRequest(){
|
||||
var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"] //activeX versions to check for in IE
|
||||
if (window.ActiveXObject) { //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
|
||||
for (var i=0; i<activexmodes.length; i++) {
|
||||
try {
|
||||
return new ActiveXObject(activexmodes[i]);
|
||||
} catch(e) {
|
||||
//suppress error
|
||||
}
|
||||
}
|
||||
} else if (window.XMLHttpRequest) { // if Mozilla, Safari etc
|
||||
return new XMLHttpRequest();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function updatePackages(data) {
|
||||
var dataJSON = JSON.stringify(data);
|
||||
if(packagesJSON !== dataJSON) {
|
||||
packagesJSON = dataJSON;
|
||||
|
||||
if(data.urls) {
|
||||
document.getElementById('install-link-ios').href = data.urls.installLinkIos;
|
||||
document.getElementById('install-link-android').href = data.urls.installLinkAndroid;
|
||||
}
|
||||
|
||||
if(!data.packages) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var ul = document.getElementById('packages');
|
||||
ul.innerHTML = '';
|
||||
if(data.packages.length == 0) {
|
||||
var li = document.createElement('li');
|
||||
li.innerText = 'No packages available.';
|
||||
ul.appendChild(li);
|
||||
return true;
|
||||
}
|
||||
|
||||
for(var i = 0; i < data.packages.length; i++) {
|
||||
var li = document.createElement('li');
|
||||
var a = document.createElement('a');
|
||||
a.href = '/package/'+data.packages[i].id;
|
||||
a.innerText = data.packages[i].name;
|
||||
li.appendChild(a);
|
||||
ul.appendChild(li);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkPackages() {
|
||||
var req=new ajaxRequest();
|
||||
req.onreadystatechange = function() {
|
||||
if (req.readyState==4) {
|
||||
if (req.status==200) {
|
||||
updatePackages(JSON.parse(req.responseText));
|
||||
}
|
||||
}
|
||||
}
|
||||
req.open("GET", "/inc/packages.json", true);
|
||||
req.send(null);
|
||||
}
|
||||
|
||||
checkPackages();
|
||||
|
||||
window.setInterval(checkPackages, 2000);
|
||||
</script>
|
||||
<script src='packages.js'></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
69
windows/src/developer/TIKE/xml/kmw/packages.js
Normal file
69
windows/src/developer/TIKE/xml/kmw/packages.js
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
// The following dynamic script will register each of the additional packages
|
||||
var packagesJSON = '';
|
||||
|
||||
function ajaxRequest(){
|
||||
var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"] //activeX versions to check for in IE
|
||||
if (window.ActiveXObject) { //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
|
||||
for (var i=0; i<activexmodes.length; i++) {
|
||||
try {
|
||||
return new ActiveXObject(activexmodes[i]);
|
||||
} catch(e) {
|
||||
//suppress error
|
||||
}
|
||||
}
|
||||
} else if (window.XMLHttpRequest) { // if Mozilla, Safari etc
|
||||
return new XMLHttpRequest();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function updatePackages(data) {
|
||||
var dataJSON = JSON.stringify(data);
|
||||
if(packagesJSON !== dataJSON) {
|
||||
packagesJSON = dataJSON;
|
||||
|
||||
if(data.urls) {
|
||||
document.getElementById('install-link-ios').href = data.urls.installLinkIos;
|
||||
document.getElementById('install-link-android').href = data.urls.installLinkAndroid;
|
||||
}
|
||||
|
||||
if(!data.packages) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var ul = document.getElementById('packages');
|
||||
ul.innerHTML = '';
|
||||
if(data.packages.length == 0) {
|
||||
var li = document.createElement('li');
|
||||
li.innerText = 'No packages available.';
|
||||
ul.appendChild(li);
|
||||
return true;
|
||||
}
|
||||
|
||||
for(var i = 0; i < data.packages.length; i++) {
|
||||
var li = document.createElement('li');
|
||||
var a = document.createElement('a');
|
||||
a.href = '/package/'+data.packages[i].id;
|
||||
a.innerText = data.packages[i].name;
|
||||
li.appendChild(a);
|
||||
ul.appendChild(li);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkPackages() {
|
||||
var req=new ajaxRequest();
|
||||
req.onreadystatechange = function() {
|
||||
if (req.readyState==4) {
|
||||
if (req.status==200) {
|
||||
updatePackages(JSON.parse(req.responseText));
|
||||
}
|
||||
}
|
||||
}
|
||||
req.open("GET", "/inc/packages.json", true);
|
||||
req.send(null);
|
||||
}
|
||||
|
||||
checkPackages();
|
||||
|
||||
window.setInterval(checkPackages, 2000);
|
||||
Loading…
Add table
Reference in a new issue