This commit is contained in:
Erik Rose 2011-05-19 11:31:15 -07:00
Родитель 39236532ec
Коммит 7db0a5f7b5
2 изменённых файлов: 15 добавлений и 8 удалений

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

@ -50,12 +50,18 @@ CATEGORIES = (
# FF versions used to filter article searches, power {for} tags, etc.:
#
# Iterables of (ID, name, abbreviation for {for} tags, max version this version
# group encompasses) grouped into optgroups. To add the ability to sniff a new
# version of an existing browser (assuming it doesn't change the user agent
# string too radically), you should need only to add a line here; no JS
# required. Just be wary of inexact floating point comparisons when setting
# max_version, which should be read as "From the next smaller max_version up to
# but not including version x.y".
# group encompasses, and whether-this-version-should-show-in-the-menu) grouped
# into optgroups by platform. To add the ability to sniff a new version of an
# existing browser (assuming it doesn't change the user agent string too
# radically), you should need only to add a line here; no JS required. Just be
# wary of inexact floating point comparisons when setting max_version, which
# should be read as "From the next smaller max_version up to but not including
# version x.y".
#
# The first browser in each platform group will be considered the default one.
# When a wiki page is being viewed in a desktop browser, the {for} sections for
# the default mobile browser still show. The reverse is true when a page is
# being viewed in a mobile browser.
VersionMetadata = namedtuple('VersionMetadata',
'id, name, long, slug, max_version, show_in_ui')
GROUPED_FIREFOX_VERSIONS = (

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

@ -158,8 +158,9 @@ var ShowFor = {
// undefined behavior.
// TODO: Implement with a generic any() instead--maybe underscore's.
function meetsAnyOfConditions(slug, conditions) {
// Return whether a slug (like 'fx4' or 'fx35') meets a condition like {comparator: '>' product: 'm', version: 4.9999}.
function meets(slug, condition) { // 'fx4' is matched by {comparator: '=', product: 'fx', version: 3.9999}?
// Return whether a slug (like 'fx4' or 'fx35') meets a condition like
// {comparator: '>' product: 'm', version: 4.9999}.
function meets(slug, condition) {
var browser = BROWSERS[slug];
if (browser.product != condition.product) {
return false;