Improvements to dictionaries page, including some love from dalvay's CSS.

This commit is contained in:
shaver%mozilla.org 2006-10-22 10:38:03 +00:00
Родитель 4c81981b8b
Коммит 3bf68c6eab
4 изменённых файлов: 131 добавлений и 11 удалений

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

@ -441,3 +441,70 @@ p.install-button {
.clearfix {display: block;}
/* End hide from IE-mac */
table {
border-collapse: collapse;
border: none;
margin: 1em 0;
}
table.dalvay-table {
border-collapse: separate;
}
table.dalvay-table thead th {
background: none;
}
table.dalvay-table thead td,
table.dalvay-table thead th {
background: #f9fafa url(/img/dalvay/table/header.png) top repeat-x;
border: 0;
}
table.dalvay-table thead .top-left {
background: url(/img/dalvay/table/top-left.png) top left no-repeat;
}
table.dalvay-table thead .top-right {
background: url(/img/dalvay/table/top-right.png) top right no-repeat;
}
td.left { border-left: 1px solid #d7d7d7; }
td.right { border-right: 1px solid #d7d7d7; }
table.dalvay-table tfoot td {
background: #f9fafa url(/img/dalvay/table/footer.png) bottom repeat-x;
border: 0;
}
table.dalvay-table tfoot .bottom-left {
background: url(/img/dalvay/table/bottom-left.png) bottom left no-repeat;
}
table.dalvay-table tfoot .bottom-right {
background: url(/img/dalvay/table/bottom-right.png) bottom right no-repeat;
}
table.dalvay-table tfoot td { height: 12px; }
table.dalvay-table tr.odd td { background: #fff; }
table.dalvay-table tr.even td { background: #eee; }
table.dalvay-table tr:target td { background: yellow; }
table.dalvay-table td.curVersion { font-weight: bold; }
table.dalvay-table td.nya { text-align: center; }
table.dalvay-table td,
table.dalvay-table th {
margin: 0;
padding: 0.5em;
}
table.dalvay-table td.dl,
table.dalvay-table th.dl {
white-space: nowrap;
}
table.dalvay-table th {
text-align: left;
}

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

@ -1,6 +1,31 @@
function writeCurrentDictionary()
{
document.writeln("<div class='corner-box'>Man, there is so going to be a special link here!</div>");
var q = document.location.search.substring(1);
var paramStrings = q.split("&");
var params = { };
for (var i = 0; i < paramStrings.length; i++) {
var asunder = paramStrings[i].split("=");
params[asunder[0]] = asunder[1];
}
var lang = params.lang || 'en-US';
if (!(lang in allDictionaries)) {
// Try just the language without region.
lang = lang.replace(/-.*/, "");
if (!(lang in allDictionaries))
return; // alas, nothing to be done...
}
dict = allDictionaries[lang];
document.write("<div class='corner-box'>Install dictionary");
if (dict.size)
document.write(" (", dict.size, "KB)");
document.write("<div class='install-button'><a href='",
dict.link, "'><span>", dict.entry.name);
if (dict.entry.localName != dict.entry.name)
document.write(" / ", dict.entry.localName);
document.writeln("</span></a>");
document.writeln("</div></div>");
}
function regionForCode(code)
@ -34,6 +59,9 @@ function regionForCode(code)
return { name: code, localName: code };
}
var allDictionariesOrdered = [];
var allDictionaries = { };
function addDictionary(code, link, size)
{
// Sometimes, there is more than one code in the name, yay
@ -46,6 +74,25 @@ function addDictionary(code, link, size)
}
var region = regionForCode(code);
document.writeln("<tr id='", code, "'><td><a href='", link, "' title='", code, "'>", region.name, ' / ',
region.localName, "</td></tr>");
var dict = {code: code, link: link, size: size, entry: region};
allDictionariesOrdered.push(dict);
allDictionaries[code] = dict;
}
function writeAllDictionaries()
{
for (var i = 0; i < allDictionariesOrdered.length; i++) {
var dict = allDictionariesOrdered[i];
var alt = i % 2 ? "even" : "odd";
document.write("<tr class='", alt, "'>");
document.write("<td class='left'>", dict.entry.name, "</td>");
document.write("<td>", dict.entry.localName, "</td>");
document.write("<td class='right'><a href='", dict.link,
"'>Install</a> (", dict.size, " KB)</td></tr>");
/*
document.writeln("<tr id='", dict.code, "'><td><a href='", dict.link,
"' title='", dict.code, "'>", dict.entry.name, '<br>',
dict.entry.localName, "</a> </td><td>", dict.size, "KB</td></tr>");
*/
}
}

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

@ -1,25 +1,30 @@
<script src="https://www.stage.mozilla.com/js/download.js"></script>
<script src="https://www.mozilla.com/js/download.js"></script>
<script src="{$config.webpath}/js/dictionaries.js"></script>
<script>
{section name=d loop=$dicts step=1 start=1}
addDictionary("{$dicts[d].code}", "{$dicts[d].uri}", {$dicts[d].size});
{/section}
</script>
<div id="mBody">
<h1>Dictionaries</h1>
<p>These dictionaries are available for use with Firefox's built-in spell-checking.</p>
<p>These dictionaries work with the spell-checking feature in Firefox 2.</p>
<script>writeCurrentDictionary();</script>
<h2>All dictionaries</h2>
<script>
document.writeln("<table>");
{section name=d loop=$dicts step=1 start=1}
addDictionary("{$dicts[d].code}", "{$dicts[d].uri}");
{/section}
document.writeln("<table class='dalvay-table'>");
writeAllDictionaries();
document.writeln("</table>");
</script>
<noscript>
<ul>
{section name=d loop=$dicts step=1 start=0}
<li><a href="{$dicts[d].uri}">{$dicts[d].code}</a></li>
<li><a href="{$dicts[d].uri}">{$dicts[d].code}</a> ($dicts[d].size)KB)</li>
{/section}
</ul>
</noscript>

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

@ -515,7 +515,8 @@ class AMO_Object
$this->db->query("
SELECT
REPLACE(m.guid, '{$suffix}', '') as code,
v.uri
v.uri,
v.size
FROM
main m
INNER JOIN version v ON m.id = v.id