src/ztfy/myams/resources/js/myams-notify.js
changeset 38 173b951c6aef
parent 0 8a19e25e39e4
child 142 0201f1422bd7
equal deleted inserted replaced
37:c01096421ada 38:173b951c6aef
     1 /*
     1 /*
     2  * MyAMS extensions for notification messages
     2  * MyAMS extensions for notification messages
     3  * Version 0.1.0
     3  * Version 0.1.2
     4  * ©2014 Thierry Florac <tflorac@ulthar.net>
     4  * ©2014 Thierry Florac <tflorac@ulthar.net>
     5  */
     5  */
     6 
     6 
     7 
     7 
     8 (function ($) {
     8 (function ($) {
    14 	});
    14 	});
    15 
    15 
    16 
    16 
    17 	function SmartUnLoading() {
    17 	function SmartUnLoading() {
    18 		$(".divMessageBox").fadeOut(300, function () {
    18 		$(".divMessageBox").fadeOut(300, function () {
    19 			$(this).remove()
    19 			$(this).remove();
    20 		});
    20 		});
    21 		$(".LoadingBoxContainer").fadeOut(300, function () {
    21 		$(".LoadingBoxContainer").fadeOut(300, function () {
    22 			$(this).remove()
    22 			$(this).remove();
    23 		})
    23 		})
    24 	}
    24 	}
    25 
    25 
    26 	var ExistMsg = 0,
    26 	var ExistMsg = 0,
    27 		SmartMSGboxCount = 0,
    27 		SmartMSGboxCount = 0,
    70 			if (ExistMsg == 0) {
    70 			if (ExistMsg == 0) {
    71 				ExistMsg = 1;
    71 				ExistMsg = 1;
    72 				SmartMSG = "<div class='MessageBox animated fadeIn fast' id='MsgBoxBack'></div>";
    72 				SmartMSG = "<div class='MessageBox animated fadeIn fast' id='MsgBoxBack'></div>";
    73 				$("body").append(SmartMSG);
    73 				$("body").append(SmartMSG);
    74 				if (MyAMS.browser.isIE8orlower() == 1) {
    74 				if (MyAMS.browser.isIE8orlower() == 1) {
    75 					$("#MsgBoxBack").addClass("MessageIE")
    75 					$("#MsgBoxBack").addClass("MessageIE");
    76 				}
    76 				}
    77 			}
    77 			}
    78 			var InputType = "";
    78 			var InputType = "";
    79 			var HasInput = 0;
    79 			var HasInput = 0;
       
    80 			var Name = "";
       
    81 			var NumButtons = 0;
    80 			if (settings.input != undefined) {
    82 			if (settings.input != undefined) {
    81 				HasInput = 1;
    83 				HasInput = 1;
    82 				settings.input = settings.input.toLowerCase();
    84 				settings.input = settings.input.toLowerCase();
    83 				switch (settings.input) {
    85 				switch (settings.input) {
    84 				case "text":
    86 					case "text":
    85 					InputType = "<input class='form-control' type='" + settings.input + "' id='txt" + SmartMSGboxCount + "' placeholder='" + settings.placeholder + "'/><br/><br/>";
    87 						InputType = "<input class='form-control' type='" + settings.input + "' id='txt" + SmartMSGboxCount + "' placeholder='" + settings.placeholder + "'/><br/><br/>";
    86 					break;
    88 						break;
    87 				case "password":
    89 					case "password":
    88 					InputType = "<input class='form-control' type='" + settings.input + "' id='txt" + SmartMSGboxCount + "' placeholder='" + settings.placeholder + "'/><br/><br/>";
    90 						InputType = "<input class='form-control' type='" + settings.input + "' id='txt" + SmartMSGboxCount + "' placeholder='" + settings.placeholder + "'/><br/><br/>";
    89 					break;
    91 						break;
    90 				case "select":
    92 					case "select":
    91 					if (settings.options == undefined) {
    93 						if (settings.options == undefined) {
    92 						alert("For this type of input, the options parameter is required.")
    94 							alert("For this type of input, the options parameter is required.");
    93 					} else {
    95 						} else {
    94 						InputType = "<select class='form-control' id='txt" + SmartMSGboxCount + "'>";
    96 							InputType = "<select class='form-control' id='txt" + SmartMSGboxCount + "'>";
    95 						for (var i = 0; i <= settings.options.length - 1; i++) {
    97 							for (var i = 0; i <= settings.options.length - 1; i++) {
    96 							if (settings.options[i] == "[") {
    98 								if (settings.options[i] == "[") {
    97 								Name = ""
    99 									Name = "";
    98 							} else {
       
    99 								if (settings.options[i] == "]") {
       
   100 									NumBottons = NumBottons + 1;
       
   101 									Name = "<option>" + Name + "</option>";
       
   102 									InputType += Name
       
   103 								} else {
   100 								} else {
   104 									Name += settings.options[i]
   101 									if (settings.options[i] == "]") {
       
   102 										NumButtons = NumButtons + 1;
       
   103 										Name = "<option>" + Name + "</option>";
       
   104 										InputType += Name;
       
   105 									} else {
       
   106 										Name += settings.options[i];
       
   107 									}
   105 								}
   108 								}
   106 							}
   109 							}
       
   110 							InputType += "</select>";
   107 						}
   111 						}
   108 						InputType += "</select>"
   112 						break;
   109 					}
   113 					default:
   110 					break;
   114 						alert("That type of input is not handled yet");
   111 				default:
       
   112 					alert("That type of input is not handled yet")
       
   113 				}
   115 				}
   114 			}
   116 			}
   115 			Content = "<div class='MessageBoxContainer animated fadeIn fast' id='Msg" + SmartMSGboxCount + "'>";
   117 			Content = "<div class='MessageBoxContainer animated fadeIn fast' id='Msg" + SmartMSGboxCount + "'>";
   116 			Content += "<div class='MessageBoxMiddle'>";
   118 			Content += "<div class='MessageBoxMiddle'>";
   117 			Content += "<span class='MsgTitle'>" + settings.title + "</span class='MsgTitle'>";
   119 			Content += "<span class='MsgTitle'>" + settings.title + "</span class='MsgTitle'>";
   118 			Content += "<p class='pText'>" + settings.content + "</p>";
   120 			Content += "<p class='pText'>" + settings.content + "</p>";
   119 			Content += InputType;
   121 			Content += InputType;
   120 			Content += "<div class='MessageBoxButtonSection'>";
   122 			Content += "<div class='MessageBoxButtonSection'>";
   121 			if (settings.buttons == undefined) {
   123 			if (settings.buttons == undefined) {
   122 				settings.buttons = "[Accept]"
   124 				settings.buttons = "[Accept]";
   123 			}
   125 			}
   124 			settings.buttons = $.trim(settings.buttons);
   126 			settings.buttons = $.trim(settings.buttons);
   125 			settings.buttons = settings.buttons.split("");
   127 			settings.buttons = settings.buttons.split("");
   126 			var Name = "";
       
   127 			var NumBottons = 0;
       
   128 			if (settings.NormalButton == undefined) {
   128 			if (settings.NormalButton == undefined) {
   129 				settings.NormalButton = "#232323"
   129 				settings.NormalButton = "#232323";
   130 			}
   130 			}
   131 			if (settings.ActiveButton == undefined) {
   131 			if (settings.ActiveButton == undefined) {
   132 				settings.ActiveButton = "#ed145b"
   132 				settings.ActiveButton = "#ed145b";
   133 			}
   133 			}
   134 			for (var i = 0; i <= settings.buttons.length - 1; i++) {
   134 			for (var i = 0; i <= settings.buttons.length - 1; i++) {
   135 				if (settings.buttons[i] == "[") {
   135 				if (settings.buttons[i] == "[") {
   136 					Name = ""
   136 					Name = "";
   137 				} else {
   137 				} else {
   138 					if (settings.buttons[i] == "]") {
   138 					if (settings.buttons[i] == "]") {
   139 						NumBottons = NumBottons + 1;
   139 						NumButtons = NumButtons + 1;
   140 						Name = "<button id='bot" + NumBottons + "-Msg" + SmartMSGboxCount + "' class='btn btn-default btn-sm botTempo'> " + Name + "</button>";
   140 						Name = "<button id='bot" + NumButtons + "-Msg" + SmartMSGboxCount + "' class='btn btn-default btn-sm botTempo'> " + Name + "</button>";
   141 						Content += Name
   141 						Content += Name;
   142 					} else {
   142 					} else {
   143 						Name += settings.buttons[i]
   143 						Name += settings.buttons[i];
   144 					}
   144 					}
   145 				}
   145 				}
   146 			}
   146 			}
   147 			Content += "</div>";
   147 			Content += "</div>";
   148 			Content += "</div>";
   148 			Content += "</div>";
   149 			Content += "</div>";
   149 			Content += "</div>";
   150 			if (SmartMSGboxCount > 1) {
   150 			if (SmartMSGboxCount > 1) {
   151 				$(".MessageBoxContainer").hide();
   151 				$(".MessageBoxContainer").hide();
   152 				$(".MessageBoxContainer").css("z-index", 99999)
   152 				$(".MessageBoxContainer").css("z-index", 99999);
   153 			}
   153 			}
   154 			$(".MessageBox").append(Content);
   154 			$(".MessageBox").append(Content);
   155 			if (HasInput == 1) {
   155 			if (HasInput == 1) {
   156 				$("#txt" + SmartMSGboxCount).focus()
   156 				$("#txt" + SmartMSGboxCount).focus();
   157 			}
   157 			}
   158 			$(".botTempo").hover(function () {
   158 			$(".botTempo").hover(function () {
   159 				var ThisID = $(this).attr("id")
   159 				var ThisID = $(this).attr("id");
   160 			}, function () {
   160 			}, function () {
   161 				var ThisID = $(this).attr("id")
   161 				var ThisID = $(this).attr("id");
   162 			});
   162 			});
   163 			$(".botTempo").click(function () {
   163 			$(".botTempo").click(function () {
   164 				var ThisID = $(this).attr("id");
   164 				var ThisID = $(this).attr("id");
   165 				var MsgBoxID = ThisID.substr(ThisID.indexOf("-") + 1);
   165 				var MsgBoxID = ThisID.substr(ThisID.indexOf("-") + 1);
   166 				var Press = $.trim($(this).text());
   166 				var Press = $.trim($(this).text());
   167 				if (HasInput == 1) {
   167 				if (HasInput == 1) {
   168 					if (typeof callback == "function") {
   168 					if (typeof callback == "function") {
   169 						var IDNumber = MsgBoxID.replace("Msg", "");
   169 						var IDNumber = MsgBoxID.replace("Msg", "");
   170 						var Value = $("#txt" + IDNumber).val();
   170 						var Value = $("#txt" + IDNumber).val();
   171 						if (callback) {
   171 						if (callback) {
   172 							callback(Press, Value)
   172 							callback(Press, Value);
   173 						}
   173 						}
   174 					}
   174 					}
   175 				} else {
   175 				} else {
   176 					if (typeof callback == "function") {
   176 					if (typeof callback == "function") {
   177 						if (callback) {
   177 						if (callback) {
   178 							callback(Press)
   178 							callback(Press);
   179 						}
   179 						}
   180 					}
   180 					}
   181 				}
   181 				}
   182 				$("#" + MsgBoxID).addClass("animated fadeOut fast");
   182 				$("#" + MsgBoxID).addClass("animated fadeOut fast");
   183 				SmartMSGboxCount = SmartMSGboxCount - 1;
   183 				SmartMSGboxCount = SmartMSGboxCount - 1;
   184 				if (SmartMSGboxCount == 0) {
   184 				if (SmartMSGboxCount == 0) {
   185 					$("#MsgBoxBack").removeClass("fadeIn").addClass("fadeOut").delay(300).queue(function () {
   185 					$("#MsgBoxBack").removeClass("fadeIn").addClass("fadeOut").delay(300).queue(function () {
   186 						ExistMsg = 0;
   186 						ExistMsg = 0;
   187 						$(this).remove()
   187 						$(this).remove();
   188 					})
   188 					})
   189 				}
   189 				}
   190 			})
   190 			})
   191 		},
   191 		},
   192 
   192 
   205 			}, settings);
   205 			}, settings);
   206 			if (settings.sound === true) {
   206 			if (settings.sound === true) {
   207 				if (MyAMS.browser.isIE8orlower() == 0) {
   207 				if (MyAMS.browser.isIE8orlower() == 0) {
   208 					var audioElement = document.createElement("audio");
   208 					var audioElement = document.createElement("audio");
   209 					if (navigator.userAgent.match("Firefox/")) {
   209 					if (navigator.userAgent.match("Firefox/")) {
   210 						audioElement.setAttribute("src", MyAMS.baseURL + '../snd/bigbox.ogg')
   210 						audioElement.setAttribute("src", MyAMS.baseURL + '../snd/bigbox.ogg');
   211 					} else {
   211 					} else {
   212 						audioElement.setAttribute("src", MyAMS.baseURL + '../snd/bigbox.mp3')
   212 						audioElement.setAttribute("src", MyAMS.baseURL + '../snd/bigbox.mp3');
   213 					}
   213 					}
   214 					$.get();
   214 					$.get();
   215 					audioElement.addEventListener("load", function () {
   215 					audioElement.addEventListener("load", function () {
   216 						audioElement.play()
   216 						audioElement.play();
   217 					}, true);
   217 					}, true);
   218 					audioElement.pause();
   218 					audioElement.pause();
   219 					audioElement.play()
   219 					audioElement.play();
   220 				}
   220 				}
   221 			}
   221 			}
   222 			BigBoxes = BigBoxes + 1;
   222 			BigBoxes = BigBoxes + 1;
   223 			boxBig = "<div id='bigBox" + BigBoxes + "' class='BigBox animated fadeIn fast'><div id='bigBoxColor" + BigBoxes + "'><i class='btnClose fa fa-times' id='btnClose" + BigBoxes + "'></i>";
   223 			boxBig = "<div id='bigBox" + BigBoxes + "' class='BigBox animated fadeIn fast'><div id='bigBoxColor" + BigBoxes + "'><i class='btnClose fa fa-times' id='btnClose" + BigBoxes + "'></i>";
   224 			if (settings.icon == undefined) {
   224 			if (settings.icon == undefined) {
   225 				settings.icon = "fa fa-cloud"
   225 				settings.icon = "fa fa-cloud";
   226 			}
   226 			}
   227 			boxBig += "<span><i class='" + settings.icon + "'></i>&nbsp; " + settings.title + "</span>";
   227 			boxBig += "<span><i class='" + settings.icon + "'></i>&nbsp; " + settings.title + "</span>";
   228 			boxBig += "<p>" + settings.content + "</p>";
   228 			boxBig += "<p>" + settings.content + "</p>";
   229 			boxBig += "<div class='bigboxnumber'>";
   229 			boxBig += "<div class='bigboxnumber'>";
   230 			if (settings.number != undefined) {
   230 			if (settings.number != undefined) {
   231 				boxBig += settings.number
   231 				boxBig += settings.number;
   232 			}
   232 			}
   233 			boxBig += "</div></div>";
   233 			boxBig += "</div></div>";
   234 			boxBig += "</div>";
   234 			boxBig += "</div>";
   235 			$("#divBigBoxes").append(boxBig);
   235 			$("#divBigBoxes").append(boxBig);
   236 			if (settings.color == undefined) {
   236 			if (settings.color == undefined) {
   237 				settings.color = "#004d60"
   237 				settings.color = "#004d60";
   238 			}
   238 			}
   239 			$("#bigBox" + BigBoxes).css("background-color", settings.color);
   239 			$("#bigBox" + BigBoxes).css("background-color", settings.color);
   240 			$("#divMiniIcons").append("<div id='miniIcon" + BigBoxes + "' class='cajita animated fadeIn' style='background-color: " + settings.color + ";'><i class='" + settings.icon + "'/></i></div>");
   240 			$("#divMiniIcons").append("<div id='miniIcon" + BigBoxes + "' class='cajita animated fadeIn' style='background-color: " + settings.color + ";'><i class='" + settings.icon + "'/></i></div>");
   241 			$("#miniIcon" + BigBoxes).bind("click", function () {
   241 			$("#miniIcon" + BigBoxes).bind("click", function () {
   242 				var FrontBox = $(this).attr("id");
   242 				var FrontBox = $(this).attr("id");
   243 				var FrontBigBox = FrontBox.replace("miniIcon", "bigBox");
   243 				var FrontBigBox = FrontBox.replace("miniIcon", "bigBox");
   244 				var FronBigBoxColor = FrontBox.replace("miniIcon", "bigBoxColor");
   244 				var FronBigBoxColor = FrontBox.replace("miniIcon", "bigBoxColor");
   245 				$(".cajita").each(function (index) {
   245 				$(".cajita").each(function (index) {
   246 					var BackBox = $(this).attr("id");
   246 					var BackBox = $(this).attr("id");
   247 					var BigBoxID = BackBox.replace("miniIcon", "bigBox");
   247 					var BigBoxID = BackBox.replace("miniIcon", "bigBox");
   248 					$("#" + BigBoxID).css("z-index", 9998)
   248 					$("#" + BigBoxID).css("z-index", 9998);
   249 				});
   249 				});
   250 				$("#" + FrontBigBox).css("z-index", 9999);
   250 				$("#" + FrontBigBox).css("z-index", 9999);
   251 				$("#" + FronBigBoxColor).removeClass("animated fadeIn").delay(1).queue(function () {
   251 				$("#" + FronBigBoxColor).removeClass("animated fadeIn").delay(1).queue(function () {
   252 					$(this).show();
   252 					$(this).show();
   253 					$(this).addClass("animated fadeIn");
   253 					$(this).addClass("animated fadeIn");
   254 					$(this).clearQueue()
   254 					$(this).clearQueue();
   255 				})
   255 				})
   256 			});
   256 			});
   257 			var ThisBigBoxCloseCross = $("#btnClose" + BigBoxes);
   257 			var ThisBigBoxCloseCross = $("#btnClose" + BigBoxes);
   258 			var ThisBigBox = $("#bigBox" + BigBoxes);
   258 			var ThisBigBox = $("#bigBox" + BigBoxes);
   259 			var ThisMiniIcon = $("#miniIcon" + BigBoxes);
   259 			var ThisMiniIcon = $("#miniIcon" + BigBoxes);
   270 					});
   270 					});
   271 					ThisMiniIcon.animate({
   271 					ThisMiniIcon.animate({
   272 						backgroundColor: settings.colors[ColorIndex].color
   272 						backgroundColor: settings.colors[ColorIndex].color
   273 					});
   273 					});
   274 					if (ColorIndex < settings.colors.length - 1) {
   274 					if (ColorIndex < settings.colors.length - 1) {
   275 						ThisBigBoxCloseCross.attr("colorcount", ((ColorIndex * 1) + 1))
   275 						ThisBigBoxCloseCross.attr("colorcount", ((ColorIndex * 1) + 1));
   276 					} else {
   276 					} else {
   277 						ThisBigBoxCloseCross.attr("colorcount", 0)
   277 						ThisBigBoxCloseCross.attr("colorcount", 0);
   278 					}
   278 					}
   279 				}, settings.colortime)
   279 				}, settings.colortime);
   280 			}
   280 			}
   281 			ThisBigBoxCloseCross.bind("click", function () {
   281 			ThisBigBoxCloseCross.bind("click", function () {
   282 				clearInterval(ColorTimeInterval);
   282 				clearInterval(ColorTimeInterval);
   283 				if (typeof callback == "function") {
   283 				if (typeof callback == "function") {
   284 					if (callback) {
   284 					if (callback) {
   285 						callback()
   285 						callback();
   286 					}
   286 					}
   287 				}
   287 				}
   288 				var FrontBox = $(this).attr("id");
   288 				var FrontBox = $(this).attr("id");
   289 				var FrontBigBox = FrontBox.replace("btnClose", "bigBox");
   289 				var FrontBigBox = FrontBox.replace("btnClose", "bigBox");
   290 				var miniIcon = FrontBox.replace("btnClose", "miniIcon");
   290 				var miniIcon = FrontBox.replace("btnClose", "miniIcon");
   291 				$("#" + FrontBigBox).removeClass("fadeIn fast");
   291 				$("#" + FrontBigBox).removeClass("fadeIn fast");
   292 				$("#" + FrontBigBox).addClass("fadeOut fast").delay(300).queue(function () {
   292 				$("#" + FrontBigBox).addClass("fadeOut fast").delay(300).queue(function () {
   293 					$(this).clearQueue();
   293 					$(this).clearQueue();
   294 					$(this).remove()
   294 					$(this).remove();
   295 				});
   295 				});
   296 				$("#" + miniIcon).removeClass("fadeIn fast");
   296 				$("#" + miniIcon).removeClass("fadeIn fast");
   297 				$("#" + miniIcon).addClass("fadeOut fast").delay(300).queue(function () {
   297 				$("#" + miniIcon).addClass("fadeOut fast").delay(300).queue(function () {
   298 					$(this).clearQueue();
   298 					$(this).clearQueue();
   299 					$(this).remove()
   299 					$(this).remove();
   300 				})
   300 				})
   301 			});
   301 			});
   302 			if (settings.timeout != undefined) {
   302 			if (settings.timeout != undefined) {
   303 				var TimedID = BigBoxes;
   303 				var TimedID = BigBoxes;
   304 				setTimeout(function () {
   304 				setTimeout(function () {
   305 					clearInterval(ColorTimeInterval);
   305 					clearInterval(ColorTimeInterval);
   306 					$("#bigBox" + TimedID).removeClass("fadeIn fast");
   306 					var box = $("#bigBox" + TimedID);
   307 					$("#bigBox" + TimedID).addClass("fadeOut fast").delay(300).queue(function () {
   307 					box.removeClass("fadeIn fast");
       
   308 					box.addClass("fadeOut fast").delay(300).queue(function () {
   308 						$(this).clearQueue();
   309 						$(this).clearQueue();
   309 						$(this).remove()
   310 						$(this).remove();
   310 					});
   311 					});
   311 					$("#miniIcon" + TimedID).removeClass("fadeIn fast");
   312 					var icon = $("#miniIcon" + TimedID);
   312 					$("#miniIcon" + TimedID).addClass("fadeOut fast").delay(300).queue(function () {
   313 					icon.removeClass("fadeIn fast");
       
   314 					icon.addClass("fadeOut fast").delay(300).queue(function () {
   313 						$(this).clearQueue();
   315 						$(this).clearQueue();
   314 						$(this).remove()
   316 						$(this).remove();
   315 					})
   317 					})
   316 				}, settings.timeout)
   318 				}, settings.timeout);
   317 			}
   319 			}
   318 		},
   320 		},
   319 
   321 
   320 		smallBox: function (settings, callback) {
   322 		smallBox: function (settings, callback) {
   321 			var BoxSmall, content;
   323 			var BoxSmall, content;
   332 			}, settings);
   334 			}, settings);
   333 			if (settings.sound === true) {
   335 			if (settings.sound === true) {
   334 				if (MyAMS.browser.isIE8orlower() == 0) {
   336 				if (MyAMS.browser.isIE8orlower() == 0) {
   335 					var audioElement = document.createElement("audio");
   337 					var audioElement = document.createElement("audio");
   336 					if (navigator.userAgent.match("Firefox/")) {
   338 					if (navigator.userAgent.match("Firefox/")) {
   337 						audioElement.setAttribute("src", MyAMS.baseURL + '../snd/smallbox.ogg')
   339 						audioElement.setAttribute("src", MyAMS.baseURL + '../snd/smallbox.ogg');
   338 					} else {
   340 					} else {
   339 						audioElement.setAttribute("src", MyAMS.baseURL + '../snd/smallbox.mp3')
   341 						audioElement.setAttribute("src", MyAMS.baseURL + '../snd/smallbox.mp3');
   340 					}
   342 					}
   341 					$.get();
   343 					$.get();
   342 					audioElement.addEventListener("load", function () {
   344 					audioElement.addEventListener("load", function () {
   343 						audioElement.play()
   345 						audioElement.play();
   344 					}, true);
   346 					}, true);
   345 					audioElement.pause();
   347 					audioElement.pause();
   346 					audioElement.play()
   348 					audioElement.play();
   347 				}
   349 				}
   348 			}
   350 			}
   349 			SmallBoxes = SmallBoxes + 1;
   351 			SmallBoxes = SmallBoxes + 1;
   350 			BoxSmall = "";
   352 			BoxSmall = "";
   351 			var IconSection = "",
   353 			var IconSection = "",
   352 				CurrentIDSmallbox = "smallbox" + SmallBoxes;
   354 				CurrentIDSmallbox = "smallbox" + SmallBoxes;
   353 			if (settings.iconSmall == undefined) {
   355 			if (settings.iconSmall == undefined) {
   354 				IconSection = "<div class='miniIcon'></div>"
   356 				IconSection = "<div class='miniIcon'></div>";
   355 			} else {
   357 			} else {
   356 				IconSection = "<div class='miniIcon'><i class='miniPic " + settings.iconSmall + "'></i></div>"
   358 				IconSection = "<div class='miniIcon'><i class='miniPic " + settings.iconSmall + "'></i></div>";
   357 			} if (settings.icon == undefined) {
   359 			} if (settings.icon == undefined) {
   358 				BoxSmall = "<div id='smallbox" + SmallBoxes + "' class='SmallBox animated fadeInRight fast'><div class='textoFull'><span>" + settings.title + "</span><p>" + settings.content + "</p></div>" + IconSection + "</div>"
   360 				BoxSmall = "<div id='smallbox" + SmallBoxes + "' class='SmallBox animated fadeInRight fast'><div class='textoFull'><span>" + settings.title + "</span><p>" + settings.content + "</p></div>" + IconSection + "</div>";
   359 			} else {
   361 			} else {
   360 				BoxSmall = "<div id='smallbox" + SmallBoxes + "' class='SmallBox animated fadeInRight fast'><div class='foto'><i class='" + settings.icon + "'></i></div><div class='textoFoto'><span>" + settings.title + "</span><p>" + settings.content + "</p></div>" + IconSection + "</div>"
   362 				BoxSmall = "<div id='smallbox" + SmallBoxes + "' class='SmallBox animated fadeInRight fast'><div class='foto'><i class='" + settings.icon + "'></i></div><div class='textoFoto'><span>" + settings.title + "</span><p>" + settings.content + "</p></div>" + IconSection + "</div>";
   361 			} if (SmallBoxes == 1) {
   363 			} if (SmallBoxes == 1) {
   362 				$("#divSmallBoxes").append(BoxSmall);
   364 				$("#divSmallBoxes").append(BoxSmall);
   363 				SmallBoxesAnchos = $("#smallbox" + SmallBoxes).height() + 40
   365 				SmallBoxesAnchos = $("#smallbox" + SmallBoxes).height() + 40;
   364 			} else {
   366 			} else {
   365 				var SmartExist = $(".SmallBox").size();
   367 				var SmartExist = $(".SmallBox").size();
   366 				if (SmartExist == 0) {
   368 				if (SmartExist == 0) {
   367 					$("#divSmallBoxes").append(BoxSmall);
   369 					$("#divSmallBoxes").append(BoxSmall);
   368 					SmallBoxesAnchos = $("#smallbox" + SmallBoxes).height() + 40
   370 					SmallBoxesAnchos = $("#smallbox" + SmallBoxes).height() + 40;
   369 				} else {
   371 				} else {
   370 					$("#divSmallBoxes").append(BoxSmall);
   372 					$("#divSmallBoxes").append(BoxSmall);
   371 					$("#smallbox" + SmallBoxes).css("top", SmallBoxesAnchos);
   373 					$("#smallbox" + SmallBoxes).css("top", SmallBoxesAnchos);
   372 					SmallBoxesAnchos = SmallBoxesAnchos + $("#smallbox" + SmallBoxes).height() + 20;
   374 					SmallBoxesAnchos = SmallBoxesAnchos + $("#smallbox" + SmallBoxes).height() + 20;
   373 					$(".SmallBox").each(function (index) {
   375 					$(".SmallBox").each(function (index) {
   374 						if (index == 0) {
   376 						if (index == 0) {
   375 							$(this).css("top", 20);
   377 							$(this).css("top", 20);
   376 							heightPrev = $(this).height() + 40;
   378 							heightPrev = $(this).height() + 40;
   377 							SmallBoxesAnchos = $(this).height() + 40
   379 							SmallBoxesAnchos = $(this).height() + 40;
   378 						} else {
   380 						} else {
   379 							$(this).css("top", heightPrev);
   381 							$(this).css("top", heightPrev);
   380 							heightPrev = heightPrev + $(this).height() + 20;
   382 							heightPrev = heightPrev + $(this).height() + 20;
   381 							SmallBoxesAnchos = SmallBoxesAnchos + $(this).height() + 20
   383 							SmallBoxesAnchos = SmallBoxesAnchos + $(this).height() + 20;
   382 						}
   384 						}
   383 					})
   385 					})
   384 				}
   386 				}
   385 			}
   387 			}
   386 			var ThisSmallBox = $("#smallbox" + SmallBoxes);
   388 			var ThisSmallBox = $("#smallbox" + SmallBoxes);
   396 					var ColorIndex = ThisSmallBox.attr("colorcount");
   398 					var ColorIndex = ThisSmallBox.attr("colorcount");
   397 					ThisSmallBox.animate({
   399 					ThisSmallBox.animate({
   398 						backgroundColor: settings.colors[ColorIndex].color
   400 						backgroundColor: settings.colors[ColorIndex].color
   399 					});
   401 					});
   400 					if (ColorIndex < settings.colors.length - 1) {
   402 					if (ColorIndex < settings.colors.length - 1) {
   401 						ThisSmallBox.attr("colorcount", ((ColorIndex * 1) + 1))
   403 						ThisSmallBox.attr("colorcount", ((ColorIndex * 1) + 1));
   402 					} else {
   404 					} else {
   403 						ThisSmallBox.attr("colorcount", 0)
   405 						ThisSmallBox.attr("colorcount", 0);
   404 					}
   406 					}
   405 				}, settings.colortime)
   407 				}, settings.colortime);
   406 			}
   408 			}
   407 			if (settings.timeout != undefined) {
   409 			if (settings.timeout != undefined) {
   408 				setTimeout(function () {
   410 				setTimeout(function () {
   409 					clearInterval(ColorTimeInterval);
   411 					clearInterval(ColorTimeInterval);
   410 					var ThisHeight = $(this).height() + 20;
   412 					var ThisHeight = $(this).height() + 20;
   414 						$("#" + CurrentIDSmallbox).on("mouseleave", function () {
   416 						$("#" + CurrentIDSmallbox).on("mouseleave", function () {
   415 							SmallBoxesAnchos = SmallBoxesAnchos - ThisHeight;
   417 							SmallBoxesAnchos = SmallBoxesAnchos - ThisHeight;
   416 							$("#" + CurrentIDSmallbox).remove();
   418 							$("#" + CurrentIDSmallbox).remove();
   417 							if (typeof callback == "function") {
   419 							if (typeof callback == "function") {
   418 								if (callback) {
   420 								if (callback) {
   419 									callback()
   421 									callback();
   420 								}
   422 								}
   421 							}
   423 							}
   422 							var Primero = 1;
   424 							var Primero = 1;
   423 							var heightPrev = 0;
   425 							var heightPrev = 0;
   424 							$(".SmallBox").each(function (index) {
   426 							$(".SmallBox").each(function (index) {
   425 								if (index == 0) {
   427 								if (index == 0) {
   426 									$(this).animate({
   428 									$(this).animate({
   427 										top: 20
   429 										top: 20
   428 									}, 300);
   430 									}, 300);
   429 									heightPrev = $(this).height() + 40;
   431 									heightPrev = $(this).height() + 40;
   430 									SmallBoxesAnchos = $(this).height() + 40
   432 									SmallBoxesAnchos = $(this).height() + 40;
   431 								} else {
   433 								} else {
   432 									$(this).animate({
   434 									$(this).animate({
   433 										top: heightPrev
   435 										top: heightPrev
   434 									}, 350);
   436 									}, 350);
   435 									heightPrev = heightPrev + $(this).height() + 20;
   437 									heightPrev = heightPrev + $(this).height() + 20;
   436 									SmallBoxesAnchos = SmallBoxesAnchos + $(this).height() + 20
   438 									SmallBoxesAnchos = SmallBoxesAnchos + $(this).height() + 20;
   437 								}
   439 								}
   438 							})
   440 							})
   439 						})
   441 						})
   440 					} else {
   442 					} else {
   441 						clearInterval(ColorTimeInterval);
   443 						clearInterval(ColorTimeInterval);
   442 						SmallBoxesAnchos = SmallBoxesAnchos - ThisHeight;
   444 						SmallBoxesAnchos = SmallBoxesAnchos - ThisHeight;
   443 						if (typeof callback == "function") {
   445 						if (typeof callback == "function") {
   444 							if (callback) {
   446 							if (callback) {
   445 								callback()
   447 								callback();
   446 							}
   448 							}
   447 						}
   449 						}
   448 						$("#" + CurrentIDSmallbox).removeClass().addClass("SmallBox").animate({
   450 						$("#" + CurrentIDSmallbox).removeClass().addClass("SmallBox").animate({
   449 							opacity: 0
   451 							opacity: 0
   450 						}, 300, function () {
   452 						}, 300, function () {
   455 								if (index == 0) {
   457 								if (index == 0) {
   456 									$(this).animate({
   458 									$(this).animate({
   457 										top: 20
   459 										top: 20
   458 									}, 300);
   460 									}, 300);
   459 									heightPrev = $(this).height() + 40;
   461 									heightPrev = $(this).height() + 40;
   460 									SmallBoxesAnchos = $(this).height() + 40
   462 									SmallBoxesAnchos = $(this).height() + 40;
   461 								} else {
   463 								} else {
   462 									$(this).animate({
   464 									$(this).animate({
   463 										top: heightPrev
   465 										top: heightPrev
   464 									});
   466 									});
   465 									heightPrev = heightPrev + $(this).height() + 20;
   467 									heightPrev = heightPrev + $(this).height() + 20;
   466 									SmallBoxesAnchos = SmallBoxesAnchos + $(this).height() + 20
   468 									SmallBoxesAnchos = SmallBoxesAnchos + $(this).height() + 20;
   467 								}
   469 								}
   468 							})
   470 							})
   469 						})
   471 						});
   470 					}
   472 					}
   471 				}, settings.timeout)
   473 				}, settings.timeout)
   472 			}
   474 			}
   473 			$("#smallbox" + SmallBoxes).bind("click", function () {
   475 			$("#smallbox" + SmallBoxes).bind("click", function () {
   474 				clearInterval(ColorTimeInterval);
   476 				clearInterval(ColorTimeInterval);
   475 				if (typeof callback == "function") {
   477 				if (typeof callback == "function") {
   476 					if (callback) {
   478 					if (callback) {
   477 						callback()
   479 						callback();
   478 					}
   480 					}
   479 				}
   481 				}
   480 				var ThisHeight = $(this).height() + 20;
   482 				var ThisHeight = $(this).height() + 20;
   481 				var ID = $(this).attr("id");
   483 				var ID = $(this).attr("id");
   482 				var ThisTop = $(this).css("top");
   484 				var ThisTop = $(this).css("top");
   491 						if (index == 0) {
   493 						if (index == 0) {
   492 							$(this).animate({
   494 							$(this).animate({
   493 								top: 20
   495 								top: 20
   494 							}, 300);
   496 							}, 300);
   495 							heightPrev = $(this).height() + 40;
   497 							heightPrev = $(this).height() + 40;
   496 							SmallBoxesAnchos = $(this).height() + 40
   498 							SmallBoxesAnchos = $(this).height() + 40;
   497 						} else {
   499 						} else {
   498 							$(this).animate({
   500 							$(this).animate({
   499 								top: heightPrev
   501 								top: heightPrev
   500 							}, 350);
   502 							}, 350);
   501 							heightPrev = heightPrev + $(this).height() + 20;
   503 							heightPrev = heightPrev + $(this).height() + 20;
   502 							SmallBoxesAnchos = SmallBoxesAnchos + $(this).height() + 20
   504 							SmallBoxesAnchos = SmallBoxesAnchos + $(this).height() + 20;
   503 						}
   505 						}
   504 					})
   506 					});
   505 				})
   507 				});
   506 			})
   508 			});
   507 		}
   509 		}
   508 	}
   510 	}
   509 
   511 
   510 })(jQuery);
   512 })(jQuery);