summaryrefslogtreecommitdiff
path: root/skins/default/functions.js
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2012-03-09 13:23:24 +0000
committeralecpl <alec@alec.pl>2012-03-09 13:23:24 +0000
commit4be86f3a3779ef86be30e8451750130569d2cacd (patch)
tree9dc44ebaf3f064609bd92b5a1a7e0118c0cbdedc /skins/default/functions.js
parent84d6e279e339cacaea4d3eb61290d54af1c1009b (diff)
- Unified (single) spellchecker button
Diffstat (limited to 'skins/default/functions.js')
-rw-r--r--skins/default/functions.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/skins/default/functions.js b/skins/default/functions.js
index aab386b5e..fb7a05d4b 100644
--- a/skins/default/functions.js
+++ b/skins/default/functions.js
@@ -102,6 +102,7 @@ function rcube_mail_ui()
groupmenu: {id:'groupoptionsmenu', above:1},
mailboxmenu: {id:'mailboxoptionsmenu', above:1},
composemenu: {id:'composeoptionsmenu', editable:1, overlap:1},
+ spellmenu: {id:'spellmenu'},
// toggle: #1486823, #1486930
uploadmenu: {id:'attachment-form', editable:1, above:1, toggle:!bw.ie&&!bw.linux },
uploadform: {id:'upload-form', editable:1, toggle:!bw.ie&&!bw.linux }
@@ -351,6 +352,43 @@ save_listmenu: function()
rcmail.set_list_options(cols, sort, ord, thread == 'thread' ? 1 : 0);
},
+spellmenu: function(show)
+{
+ var link, li,
+ lang = rcmail.spellcheck_lang(),
+ menu = this.popups.spellmenu.obj,
+ ul = $('ul', menu);
+
+ if (!ul.length) {
+ ul = $('<ul>');
+
+ for (i in rcmail.env.spell_langs) {
+ li = $('<li>');
+ link = $('<a href="#">').text(rcmail.env.spell_langs[i])
+ .addClass('active').data('lang', i)
+ .click(function() {
+ rcmail.spellcheck_lang_set($(this).data('lang'));
+ });
+
+ link.appendTo(li);
+ li.appendTo(ul);
+ }
+
+ ul.appendTo(menu);
+ }
+
+ // select current language
+ $('li', ul).each(function() {
+ var el = $('a', this);
+ if (el.data('lang') == lang)
+ el.addClass('selected');
+ else if (el.hasClass('selected'))
+ el.removeClass('selected');
+ });
+
+ this.show_popupmenu('spellmenu', show);
+},
+
body_mouseup: function(evt, p)
{
var i, target = rcube_event.get_target(evt);