diff --git a/customize.dist/about.html b/customize.dist/about.html index e0b37a651..7c54eb7a7 100644 --- a/customize.dist/about.html +++ b/customize.dist/about.html @@ -20,13 +20,7 @@ - - - - +
diff --git a/customize.dist/index.html b/customize.dist/index.html index 44e26831d..1b7d66184 100644 --- a/customize.dist/index.html +++ b/customize.dist/index.html @@ -20,13 +20,7 @@ - - - - +
diff --git a/customize.dist/main.js b/customize.dist/main.js index f2fe9a91e..a03e0922a 100644 --- a/customize.dist/main.js +++ b/customize.dist/main.js @@ -39,25 +39,11 @@ define([ // Language selector var $sel = $('#language-selector'); - var $innerblock = $sel.find(".dropdown-bar-content"); - var $button = $sel.find('button'); - var languages = Messages._languages; - for (var l in languages) { - $('', { - 'class': 'languageValue', - 'data-value': l, - 'href': '#', - }).text(languages[l]).appendTo($innerblock); - } - $button.click(function (e) { - e.stopPropagation(); - $innerblock.toggle(); - }); - LS.main($sel); - Messages._applyTranslation(); + Cryptpad.createLanguageSelector(undefined, $sel); $sel.show(); + $(window).click(function () { - $innerblock.hide(); + $sel.find('.cryptpad-dropdown').hide(); }); var makeRecentPadsTable = function (recentPads) { diff --git a/customize.dist/privacy.html b/customize.dist/privacy.html index 4315340f3..f985948b2 100644 --- a/customize.dist/privacy.html +++ b/customize.dist/privacy.html @@ -20,13 +20,7 @@ - - - - +
diff --git a/customize.dist/src/template.html b/customize.dist/src/template.html index e31fd9104..48ad32103 100644 --- a/customize.dist/src/template.html +++ b/customize.dist/src/template.html @@ -17,13 +17,7 @@ {{fork}} - - - - +
{{logo}} diff --git a/customize.dist/terms.html b/customize.dist/terms.html index 4cc2c4b1b..e4e4e1e2a 100644 --- a/customize.dist/terms.html +++ b/customize.dist/terms.html @@ -20,13 +20,7 @@ - - - - +
diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 87b039e4d..6dffadb97 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -923,6 +923,88 @@ define([ return button; }; + // Create a button with a dropdown menu + // input is a config object with parameters: + // - container (optional): the dropdown container (span) + // - text (optional): the button text value + // - options: array of {tag: "", attributes: {}, content: "string"} + // + // allowed options tags: ['a', 'hr', 'p'] + var createDropdown = common.createDropdown = function (config) { + if (typeof config !== "object" || !isArray(config.options)) { return; } + + var allowedTags = ['a', 'p', 'hr']; + var isValidOption = function (o) { + if (typeof o !== "object") { return false; } + if (!o.tag || allowedTags.indexOf(o.tag) === -1) { return false; } + return true; + }; + + // Container + var $container = $(config.container); + if (!config.container) { + $container = $('', { + 'class': 'dropdown-bar' + }); + } + + // Button + var $button = $('