Latest version and MOTD in osx launcher.

This commit is contained in:
Paul Chote
2010-12-23 12:47:26 +13:00
parent 14ad5099a0
commit fcdb3b536d
4 changed files with 33 additions and 26 deletions

View File

@@ -44,6 +44,7 @@ static JSBridge *SharedInstance;
@"log", NSStringFromSelector(@selector(log:)),
@"existsInMod", NSStringFromSelector(@selector(fileExists:inMod:)),
@"metadata", NSStringFromSelector(@selector(metadata:forMod:)),
@"httpRequest", NSStringFromSelector(@selector(httpRequest:)),
// File downloading
@"registerDownload", NSStringFromSelector(@selector(registerDownload:withURL:filename:)),
@@ -232,4 +233,12 @@ static JSBridge *SharedInstance;
return @"";
}
- (NSString *)httpRequest:(NSString *)url
{
NSLog(@"Requesting url %@",url);
NSString *response = [NSString stringWithContentsOfURL:[NSURL URLWithString:url] encoding:NSASCIIStringEncoding error:NULL];
NSLog(@"Response %@",response);
return response;
}
@end

View File

@@ -44,6 +44,7 @@
{
text-align: justify;
padding-left:50px;
padding-right:50px;
overflow:hidden;
}
@@ -125,7 +126,12 @@
function onLoad()
{
refreshSections();
document.getElementById("versionstring").innerHTML = window.external.metadata("VERSION", "cnc");
var version = window.external.metadata("VERSION", "cnc");
document.getElementById("installedversion").innerHTML = version;
document.getElementById("latestversion").innerHTML = window.external.httpRequest("http://master.open-ra.org/VERSION");
motd = window.external.httpRequest("http://master.open-ra.org/motd.php?v="+version);
if (motd != undefined)
document.getElementById("motd").innerHTML = motd.substring(3);
}
function refreshSections()
@@ -212,21 +218,14 @@
<body onload="onLoad();">
<div id="header" class="bar">
<h1>Command&nbsp;&amp;&nbsp;Conquer</h1>
<p id="versionstring">XXX</p>
<p id="installedversion">XXX</p>
</div>
<div id="main">
<!-- div id="content">
<h2>Latest News</h2>
<div>
<h3>Version XXYYZZ Available</h3>
<ul>
<li>Cool feature one</li>
<li>Cool feature two</li>
<li>Bugfixes!!!</li>
</ul>
</div>
</div -->
<div id="content">
<p>Latest version: <span id="latestversion">Unknown</span></p>
<p id="motd"></p>
</div>
<div id="buttons-install" class="buttons" style="display:none">
<div class="desc">The original game data is required before you can play this mod.<br />
Installing from web will install the minimal files required to play.

View File

@@ -44,6 +44,7 @@
{
text-align: justify;
padding-left:50px;
padding-right:50px;
overflow:hidden;
}
@@ -125,7 +126,12 @@
function onLoad()
{
refreshSections();
document.getElementById("versionstring").innerHTML = window.external.metadata("VERSION", "ra");
var version = window.external.metadata("VERSION", "ra");
document.getElementById("installedversion").innerHTML = version;
document.getElementById("latestversion").innerHTML = window.external.httpRequest("http://master.open-ra.org/VERSION");
motd = window.external.httpRequest("http://master.open-ra.org/motd.php?v="+version);
if (motd != undefined)
document.getElementById("motd").innerHTML = motd.substring(3);
}
function refreshSections()
@@ -212,21 +218,14 @@
<body onload="onLoad();">
<div id="header" class="bar">
<h1>Red Alert</h1>
<p id="versionstring">XXX</p>
<p id="installedversion">XXX</p>
</div>
<div id="main">
<!-- div id="content">
<h2>Latest News</h2>
<div>
<h3>Version XXYYZZ Available</h3>
<ul>
<li>Cool feature one</li>
<li>Cool feature two</li>
<li>Bugfixes!!!</li>
</ul>
</div>
</div -->
<div id="content">
<p>Latest version: <span id="latestversion">Unknown</span></p>
<p id="motd"></p>
</div>
<div id="buttons-install" class="buttons" style="display:none">
<div class="desc">The original game data is required before you can play this mod.<br />
Installing from web will install the minimal files required to play.