X
Πατήστε εδώ για μετάβαση στην έκδοση της ιστοσελίδας για κινητές συσκευές.

Φόρουμ υποστήριξης

Since 0 evaluates to false (1 is true) why in God's name did you make media autoplay options like media.autoplay.default = 0 [0=Allowed, 1=Blocked, 2=Prompt]?

Δημοσιεύτηκε

If someone could explain the developer/user/common sense logic behind this implementation?

If someone could explain the developer/user/common sense logic behind this implementation?

Επιπρόσθετες λεπτομέρειες συστήματος

Εφαρμογή

  • Πλατφόρμα χρήστη: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:65.0) Gecko/20100101 Firefox/65.0

Περισσότερες πληροφορίες

the-edmeister
  • Top 25 Contributor
  • Moderator
5395 λύσεις 40084 απαντήσεις
Δημοσιεύτηκε

Χρήσιμη απάντηση

True and False is a 'toggle' for a pref. When the value has more that 2 choices or settings "logic" goes out the window.

Also, many times when default is used by Mozilla in the preference name the value of 0 or 1 is a double negative. We have seen a half-dozen or more prefs set up in that manner over the years.

True and False is a 'toggle' for a pref. When the value has more that 2 choices or settings "logic" goes out the window. Also, many times when '''default''' is used by Mozilla in the preference name the value of 0 or 1 is a double negative. We have seen a half-dozen or more prefs set up in that manner over the years.
Δημοσιεύτηκε

Ιδιοκτήτης ερώτησης

Thanks for the answer but it still looks like some made-up excuse that leads to poor user experience, which requires you to search the state you need instead of just toggling it the way it's natural to be. It gets even worse when highly respected company like Mozilla polishing up things to make it look like it's right. A better solution could involve not using an integer f.ex. but rather some self-explanatory states like ['Allowed', 'Blocked', 'Prompt'] - there will not be that much people that will care what's exactly happening under the hood in this case.

Thanks for the answer but it still looks like some made-up excuse that leads to poor user experience, which requires you to search the state you need instead of just toggling it the way it's natural to be. It gets even worse when highly respected company like Mozilla polishing up things to make it look like it's right. A better solution could involve not using an integer f.ex. but rather some self-explanatory states like ['Allowed', 'Blocked', 'Prompt'] - there will not be that much people that will care what's exactly happening under the hood in this case.
cor-el
  • Top 10 Contributor
  • Moderator
17416 λύσεις 157342 απαντήσεις
Δημοσιεύτηκε

Χρήσιμη απάντηση

It is easier to check in code for a zero value. Such decisions are usually based on making coding this as easy as possible. In this case zero means a default that allows to play media and nothing is blocked. The not zero state means either block or prompt, so only for a not zero state you need to take further action.

It is easier to check in code for a zero value. Such decisions are usually based on making coding this as easy as possible. In this case zero means a default that allows to play media and nothing is blocked. The not zero state means either block or prompt, so only for a not zero state you need to take further action.
Δημοσιεύτηκε

Ιδιοκτήτης ερώτησης

OK, that's a valid statement since an integer comparison will be more efficient, comes with lower cost and applies perfectly for this programming case but then again my initial question was why an user app would implement something that misleading. Seriously the states could have been [0: 'Blocked', 1: 'Allowed', ...] and still the evaluation would be the same - 'if not 1 state...' with less ambiguity - just tweak it and go. Still thanks guys for your answers!

OK, that's a valid statement since an integer comparison will be more efficient, comes with lower cost and applies perfectly for this programming case but then again my initial question was why an user app would implement something that misleading. Seriously the states could have been [0: 'Blocked', 1: 'Allowed', ...] and still the evaluation would be the same - 'if not 1 state...' with less ambiguity - just tweak it and go. Still thanks guys for your answers!