diff --git a/js/common.js b/js/common.js index a69da7962..03f6f2506 100644 --- a/js/common.js +++ b/js/common.js @@ -160,10 +160,10 @@ $.fn.extend( })); }, - enableSysMenu: function() - { - return(this.on("contextmenu",function(e) { e.stopImmediatePropagation(); }). - on("selectstart",function(e) { e.stopImmediatePropagation(); return(true); })); + enableSysMenu: function() { + return this + .on("contextmenu", (e) => e.stopImmediatePropagation()) + .on("selectstart", (e) => {e.stopImmediatePropagation(); return true;}); }, setCursorPosition: function(pos) @@ -246,16 +246,19 @@ function escapeHTML(str) return( String(str).split('&').join('&').split('<').join('<').split('>').join('>') ); } -function askYesNo( title, content, funcYesName ) -{ - $("#yesnoDlg-header").html(title); - $("#yesnoDlg-content").html(content); - $("#yesnoOK").off('click'); - $("#yesnoOK").on('click', function() - { - typeof(funcYesName)==="function" ? funcYesName() : eval(funcYesName); +/** + * Confirm again before taking action. + * @param {string} title Title of the dialog. + * @param {string} content Hint of the action to be confirmed. + * @param {Function | string} funcYesName Function to be executed if confirmed. + */ +function askYesNo(title, content, funcYesName) { + $("#yesnoDlg-header").text(title); + $("#yesnoDlg-content").text(content); + $("#yesnoOK").off('click').on('click', () => { + $type(funcYesName) === "function" ? funcYesName() : eval(funcYesName); theDialogManager.hide("yesnoDlg"); - return(false); + return false; }); theDialogManager.show("yesnoDlg"); } diff --git a/js/objects.js b/js/objects.js index df1993d10..5729b0a4f 100644 --- a/js/objects.js +++ b/js/objects.js @@ -337,8 +337,7 @@ var theContextMenu = }); return(ret); }, - add: function() - { + add: function() { var args = new Array(); $.each(arguments, function(ndx,val) { args.push(val); }); var aft = null; @@ -355,55 +354,61 @@ var theContextMenu = args.splice(0, 1); } var self = this; - $.each(args, function(ndx,val) - { - if($type(val)) - { - var li = $("
  • ").addClass("menuitem"); - if(val[0] == CMENU_SEP) + $.each(args, function(ndx,val) { + if ($type(val)) { + const li = $("
  • ").addClass("menuitem"); + if (val[0] == CMENU_SEP) li.append($("
    ").addClass("menu-line")); - else - if(val[0] == CMENU_CHILD) - { - li.append( $("").addClass("exp").text(val[1]) ); + else if(val[0] == CMENU_CHILD) { + li.append( $("").addClass("exp").text(val[1]) ); var ul = $("