From 3bf68c6eabf19d9f68a5c320f1ec9ffcd557ca85 Mon Sep 17 00:00:00 2001 From: "shaver%mozilla.org" Date: Sun, 22 Oct 2006 10:38:03 +0000 Subject: [PATCH] Improvements to dictionaries page, including some love from dalvay's CSS. --- .../htdocs/css/rustico/addons-rustico.css | 67 +++++++++++++++++++ .../addons/public/htdocs/js/dictionaries.js | 53 ++++++++++++++- webtools/addons/public/tpl/dictionaries.tpl | 19 ++++-- webtools/addons/shared/lib/amo.class.php | 3 +- 4 files changed, 131 insertions(+), 11 deletions(-) diff --git a/webtools/addons/public/htdocs/css/rustico/addons-rustico.css b/webtools/addons/public/htdocs/css/rustico/addons-rustico.css index e06b0a837e4..0bc807778d2 100644 --- a/webtools/addons/public/htdocs/css/rustico/addons-rustico.css +++ b/webtools/addons/public/htdocs/css/rustico/addons-rustico.css @@ -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; +} diff --git a/webtools/addons/public/htdocs/js/dictionaries.js b/webtools/addons/public/htdocs/js/dictionaries.js index 3e632839b3b..3bc1c7ff775 100644 --- a/webtools/addons/public/htdocs/js/dictionaries.js +++ b/webtools/addons/public/htdocs/js/dictionaries.js @@ -1,6 +1,31 @@ function writeCurrentDictionary() { - document.writeln("
Man, there is so going to be a special link here!
"); + 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("
Install dictionary"); + if (dict.size) + document.write(" (", dict.size, "KB)"); + document.write("
"); } 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("", region.name, ' / ', - region.localName, ""); + 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(""); + document.write("", dict.entry.name, ""); + document.write("", dict.entry.localName, ""); + document.write("Install (", dict.size, " KB)"); +/* + document.writeln("", dict.entry.name, '
', + dict.entry.localName, "
", dict.size, "KB"); +*/ + } } \ No newline at end of file diff --git a/webtools/addons/public/tpl/dictionaries.tpl b/webtools/addons/public/tpl/dictionaries.tpl index bd935cc2ff6..db12081d4e7 100644 --- a/webtools/addons/public/tpl/dictionaries.tpl +++ b/webtools/addons/public/tpl/dictionaries.tpl @@ -1,25 +1,30 @@ - + +

Dictionaries

-

These dictionaries are available for use with Firefox's built-in spell-checking.

+

These dictionaries work with the spell-checking feature in Firefox 2.

+

All dictionaries

+ diff --git a/webtools/addons/shared/lib/amo.class.php b/webtools/addons/shared/lib/amo.class.php index c6662fc6a57..7adf09dc0e4 100644 --- a/webtools/addons/shared/lib/amo.class.php +++ b/webtools/addons/shared/lib/amo.class.php @@ -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