From dc7f39707277f10986f4709d9d8948e8993b9aca Mon Sep 17 00:00:00 2001 From: ClemDee Date: Wed, 5 Jun 2019 15:08:24 +0200 Subject: [PATCH] Add language overview on hover --- www/common/sframe-common-codemirror.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/www/common/sframe-common-codemirror.js b/www/common/sframe-common-codemirror.js index a88059edc..3636e5b6c 100644 --- a/www/common/sframe-common-codemirror.js +++ b/www/common/sframe-common-codemirror.js @@ -231,7 +231,20 @@ define([ }; var $block = exp.$language = UIElements.createDropdown(dropdownConfig); $block.find('button').attr('title', Messages.languageButtonTitle); - $block.find('a').click(function () { + + var isHovering = false; + var $aLanguages = $block.find('a'); + $aLanguages.mouseenter(function () { + isHovering = true; + setMode($(this).attr('data-value')); + }); + $aLanguages.mouseleave(function () { + if (isHovering) { + setMode($block.find(".cp-dropdown-element-active").attr('data-value')); + } + }); + $aLanguages.click(function () { + isHovering = false; setMode($(this).attr('data-value'), onModeChanged); onLocal(); });