diff -r 00bfb7b29d9e -r 391ad752903e src/pyams_skin/resources/js/myams-notify.js --- a/src/pyams_skin/resources/js/myams-notify.js Mon Jan 18 18:41:23 2016 +0100 +++ b/src/pyams_skin/resources/js/myams-notify.js Mon Jan 18 18:45:59 2016 +0100 @@ -5,7 +5,9 @@ */ -(function ($) { +(function ($, globals) { + + 'use strict'; $(document).ready(function () { $("body").append("
") @@ -20,18 +22,19 @@ }); $(".LoadingBoxContainer").fadeOut(300, function () { $(this).remove(); - }) + }); } var ExistMsg = 0, SmartMSGboxCount = 0, - PrevTop = 0, + heightPrev, BigBoxes = 0, SmallBoxes = 0, - SmallCount = 0, SmallBoxesAnchos = 0; + var MyAMS = globals.MyAMS; + MyAMS.notify = { messageBox: function (options, callback) { @@ -49,10 +52,10 @@ placeholder: "", options: undefined, sound: undefined - } + }; var settings = $.extend({}, defaults, options); - if (settings.sound && (isIE8 == 0)) { + if (settings.sound && (isIE8 === 0)) { var audioElement = document.createElement("audio"); if (navigator.userAgent.match("Firefox/")) { audioElement.setAttribute("src", MyAMS.baseURL + '../sound/message.ogg'); @@ -61,25 +64,26 @@ } $.get(); audioElement.addEventListener("load", function () { - audioElement.play() + audioElement.play(); }, true); audioElement.pause(); audioElement.play(); } SmartMSGboxCount = SmartMSGboxCount + 1; - if (ExistMsg == 0) { + if (ExistMsg === 0) { ExistMsg = 1; SmartMSG = "
"; $("body").append(SmartMSG); - if (MyAMS.browser.isIE8orlower() == 1) { + if (MyAMS.browser.isIE8orlower() === 1) { $("#MsgBoxBack").addClass("MessageIE"); } } + var i; var InputType = ""; var HasInput = 0; var Name = ""; var NumButtons = 0; - if (settings.input != undefined) { + if (settings.input !== undefined) { HasInput = 1; settings.input = settings.input.toLowerCase(); switch (settings.input) { @@ -90,15 +94,17 @@ InputType = "

"; break; case "select": - if (settings.options == undefined) { - alert("For this type of input, the options parameter is required."); + if (settings.options === undefined) { + if (globals.alert) { + globals.alert("For this type of input, the options parameter is required."); + } } else { InputType = "