Changed the way you can download addons so mconnor is happy (potentially) :)

This commit is contained in:
bugzilla%micropipes.com 2006-03-30 03:43:13 +00:00
Родитель a2c55d1689
Коммит 042adeb5fd
5 изменённых файлов: 79 добавлений и 22 удалений

Просмотреть файл

@ -26,7 +26,6 @@ if (sizeof($addon->OsVersions) == 1) {
$multiDownloadLinks = true;
}
// Assign template variables.
$tpl->assign(
array( 'addon' => $addon,

Просмотреть файл

@ -89,6 +89,9 @@
.install-box {
width: 18em;
}
.key-point {
background-color:#bee6a1;
}
.install div {
background: url(../../images/install.png) no-repeat;

Просмотреть файл

@ -31,5 +31,5 @@ function readCookie(name)
/* Someone should make this a js builtin */
function htmlEntities(str)
{
return str.replace('&','&amp;').replace('<','&lt;').replace('>','&gt;').replace('"','&quot;');
return str.replace('&','&amp;').replace('<','&lt;').replace('>','&gt;').replace('"','&quot;').replace('+','&nbsp;');
}

Просмотреть файл

@ -1,3 +1,36 @@
var gPlatform = PLATFORM_WINDOWS;
var PLATFORM_OTHER = 0;
var PLATFORM_WINDOWS = 1;
var PLATFORM_LINUX = 2;
var PLATFORM_MACOSX = 3;
var PLATFORM_MAC = 4;
if (navigator.platform.indexOf("Win32") != -1)
gPlatform = PLATFORM_WINDOWS;
else if (navigator.platform.indexOf("Linux") != -1)
gPlatform = PLATFORM_LINUX;
else if (navigator.userAgent.indexOf("Mac OS X") != -1)
gPlatform = PLATFORM_MACOSX;
else if (navigator.userAgent.indexOf("MSIE 5.2") != -1)
gPlatform = PLATFORM_MACOSX;
else if (navigator.platform.indexOf("Mac") != -1)
gPlatform = PLATFORM_MAC;
else
gPlatform = PLATFORM_OTHER;
function getPlatformName()
{
aPlatform = gPlatform;
if (aPlatform == PLATFORM_WINDOWS)
return "Windows";
if (aPlatform == PLATFORM_LINUX)
return "Linux";
if (aPlatform == PLATFORM_MACOSX)
return "MacOSX";
return "Unknown";
}
function install( aEvent, extName, iconURL) {
var p = new XMLHttpRequest();
p.open("GET", "/core/install.php?uri="+aEvent.target.href, false);

Просмотреть файл

@ -1,7 +1,5 @@
<h2><strong>{$addon->Name}</strong> &raquo; Overview</h2>
<script type="text/javascript" src="/js/auto.js"></script>
{if $addon->PreviewURI}
<p class="screenshot">
<a href="{$config.webpath}/{$app}/{$addon->ID}/previews/" title="See more {$addon->Name} previews.">
@ -36,27 +34,51 @@ Works with:
</table>
<div class="key-point install-box">
<div class="install">
{if $multiDownloadLinks}
<b>Install Now:</b><br />
{/if}
{section name=OsVersions loop=$addon->OsVersions}
{if $addon->OsVersions[OsVersions].URI}
<div>
<a href="{$addon->OsVersions[OsVersions].URI|escape}" onclick="return install(event,'{$addon->OsVersions[OsVersions].AppName|escape} {$addon->OsVersions[OsVersions].Version|escape}', '{$config.webpath}/images/default.png');" title="Install for {$addon->OsVersions[OsVersions].OSName|escape} {$addon->OsVersions[OsVersions].Version|escape} (Right-Click to Download)">
{if $multiDownloadLinks}
{$addon->OsVersions[OsVersions].OSName|escape}
{else}
Install Now
{/if}
</a> ({$addon->OsVersions[OsVersions].Size|escape} <abbr title="Kilobytes">KB</abbr>)
</div>
<script type="text/javascript">
//<![CDATA[
var installs = new Array(3);
/* If an install has a URI, it's available. Otherwise, you're
* out of luck. :-/ */
{foreach key=key item=item from=$addon->OsVersions}
installs["{$key|escape}"] = "{$item.URI|escape}";
{/foreach}
var platform = getPlatformName();
document.writeln("<div>");
if (installs[platform])
document.writeln("<a id=\"install-link\" href=\"" + installs[platform]+ "\" onclick=\"return install(event,'{$item.AppName|escape}', '{$config.webpath}/images/default.png');\" title=\"Install for " + platform + " (Right-Click to Download)\">Install Now for " + platform + "</a> ({$item.Size|escape} <abbr title=\"Kilobytes\">KB</abbr>)");
else if ("{$key|escape}" == "ALL")
document.writeln("<a id=\"install-link\" href=\"{$item.URI|escape}\" onclick=\"return install(event,'{$item.AppName|escape}', '{$config.webpath}/images/default.png');\" title=\"Install for " + platform + " (Right-Click to Download)\">Install Now for " + platform + "</a> ({$item.Size|escape} <abbr title=\"Kilobytes\">KB</abbr>)");
else
document.writeln("<strong>{$addon->Name|escape}</strong> is not available for " + platform + ".");
document.writeln("</div>");
//]]>
</script>
<noscript>
{if $multiDownloadLinks}
<b>Install Now:</b><br />
{/if}
{/section}
{foreach key=key item=item from=$addon->OsVersions}
{if $item.URI}
<div>
<a href="{$item.URI|escape}" onclick="return install(event,'{$item.AppName|escape} {$item.Version|escape}', '{$config.webpath}/images/default.png');" title="Install for {$item.OSName|escape} {$item.Version|escape} (Right-Click to Download)">
{if $multiDownloadLinks}
{$item.OSName|escape}
{else}
Install Now
{/if}
</a> ({$item.Size|escape} <abbr title="Kilobytes">KB</abbr>)
</div>
{/if}
{/foreach}
</noscript>
</div>
</div>
<!--
</noscript>
-->
<div class="install-other">
<a href="{$config.webpath}/{$app}/{$addon->ID}/history">Other Versions</a>
</div>