Sha256: b7bcfd944e12796b5f670718debd2506c87104dddcb4f16f37c6e5dd64ed05b3
Contents?: true
Size: 1.06 KB
Versions: 98
Compression:
Stored size: 1.06 KB
Contents
var storage = require("lalala/modules/storage"), $chooser; exports.init = function(){ $chooser = $('.locale_chooser select').first(); if ($chooser.length > 0) { setup(); } }; function setup() { var locale = storage.locale, default_locale; if (!locale) { locale = "__EMPTY__"; } if ($chooser.find('option[value='+locale+']').length === 0) { locale = "__EMPTY__"; } if (locale == "__EMPTY__") { default_locale = $chooser.find('option[data-default]').first(); if (default_locale.length === 0) { default_locale = $chooser.find('option').first(); } locale = default_locale.attr('value'); } switch_locale(locale); $chooser.val(locale); $chooser.on('change', on_switch_locale); } function on_switch_locale(e) { switch_locale($(this).val()); } function switch_locale(locale) { var translated = $(".translated[data-locale]"), current = translated.filter("*[data-locale="+locale+"]"), other = translated.not(current); other.hide(); current.show(); storage.locale = locale; }
Version data entries
98 entries across 98 versions & 1 rubygems