var fontSize = 0;
var fontName = "";
var language = navigator.userLanguage || navigator.language;
function geoip(json) {
if (typeof json !== "undefined") {
language = "es-CO";
var cCode = json.country_code;
if (cCode === "CO")
language = "es-CO";
else
if (cCode === "AR")
language = "es-AR";
getPersonalization(language);
}
}
function getPersonalization(language) {
if (localStorage.getItem('lsTPersonalization') === dActual) {
let dataP = localStorage.getItem('lsPersonalization');
if (dataP !== null && dataP !== "") {
dataP = JSON.parse(dataP);
setPersonalization(JSON.parse(dataP.personalization),
JSON.parse(dataP.personalizationImages),
JSON.parse(dataP.personalizationMessages));
return;
}
}
var data = { "language": language === null ? "es-CO" : language };
var fn = "getPersonalization";
var pagePath = window.location.protocol + '//' + window.location.host + "/GeneralArea/Account";
$.ajax({
type: 'POST',
url: pagePath + "/" + fn,
data: data
}).done(function (dataResult, ur, vr, sr) {
localStorage.setItem('lsTPersonalization', dActual);
localStorage.setItem('lsPersonalization', JSON.stringify(dataResult));
setPersonalization(JSON.parse(dataResult.personalization),
JSON.parse(dataResult.personalizationImages),
JSON.parse(dataResult.personalizationMessages));
}).fail(function (jqXHR, textStatus, errorThrown) {
console.error("Error:", textStatus, errorThrown?.toString() || "");
});
}
function getIP() {
///
/// Función que obtiene la dirección IP que posee el usuario en ese momento
///
$.getJSON("https://jsonip.com?callback=?", function (data) {
$("#ip").val(data.ip);
}).fail(function () {
$.get("https://ipinfo.io", function (response) {
$("#ip").val(response.ip);
}, "jsonp")
.fail(function () {
$("#ip").val("127.0.0.1");
});
});
}
function setPersonalization(personalization, personalizationImages, personalizationMessages) {
if (personalization.length > 0) {
if (personalization[0].fontUrl !== null && personalization[0].fontUrl !== "")
$("#dvLinkFonts").attr("href", personalization[0].fontUrl);
if (personalization[0].fontName !== null && personalization[0].fontName !== "") {
fontName = personalization[0].fontName;
$("#pStartImage").css("font-family", personalization[0].fontName);
}
if (personalization[0].fontSize > 0)
fontSize = personalization[0].fontSize;
if (personalization[0].effect === "snow") {
$.getScript("../../js/scriptsAreas/snowstorm-min.js", function () {
snowStorm.flakesMaxActive = 48; // show more snow on screen at once
snowStorm.useTwinkleEffect = true; // let the snow flicker in and out of view
snowStorm.snowStick = true;
snowStorm.followMouse = true;
snowStorm.animationInterval = 50;
snowStorm.randomizeWind();
});
}
}
var colorOwl = "";
if (personalizationImages.length > 0) {
let idImage = Math.floor(Math.random() * personalizationImages.length);
$("#dvStartImage").css("background", "url(" + personalizationImages[idImage].urlImage + ")");
if (personalizationImages[idImage].colorHex !== null) {
colorOwl = personalizationImages[idImage].colorHex;
$("#pStartImage").css("color", "#" + colorOwl);
}
}
else
$("#dvStartImage").css("background", "url(https://gocdn.blob.core.windows.net/goimages/backgroundHome.jpg)");
if (personalizationMessages.length > 0)
for (var i = 0; i < personalizationMessages.length; i++)
$("#owl-demo").append("
0 || colorOwl !== "" ? "style='" + (fontName !== "" ? "font-family: " + fontName + ";" : "") + (fontSize > 0 ? "font-size:" + fontSize + "px;" : "") + (colorOwl !== "" ? "color: #" + colorOwl + ";" : "") + "'" : "") + " >" + personalizationMessages[i].text + "
");
$(function () {
var owl = $("#owl-demo");
owl.owlCarousel({
items: 1,
loop: true,
autoPlay: 12000,
nav: true,
goToFirstSpeed: 1000,
margin: 10
});
});
if (((new Date()).getMonth() + 1 == 12 || ((new Date()).getMonth() + 1 == 1 && (new Date()).getDate() <= 3)) && personalization.length > 0) {
if (personalization[0].effect !== "snow") {
if ($.isFunction($('body').flurry)) {
var characterList = ["❅", "❄", "❆", "☼", "☀", "⛄", "☃"];
var character = "";
var colors = ["white"];
if (((new Date()).getMonth() + 1 === 12 && (new Date()).getDate() + 1 >= 29) || ((new Date()).getMonth() + 1 === 1 && (new Date()).getDate() <= 3)) {
colors = ["white", "red", "yellow"];
character = "~-🎊";
}
else
if ((new Date()).getDate() + 1 === 24)
character = characterList.toString();
else {
var randomnumber = Math.floor(Math.random() * 7);
character = characterList[randomnumber];
}
let wind = Math.floor(Math.random() * 200);
let speed = Math.floor(Math.random() * 1500 + 1500);
$('body').flurry({
character: character,
color: colors,
frequency: 100,
height: 400,
speed: speed,
small: 4,
large: 50,
wind: wind,
windVariance: 20,
rotation: 90,
rotationVariance: 180,
startOpacity: 1,
endOpacity: 0,
opacityEasing: "cubic-bezier(1,.3,.6,.74)",
blur: true,
overflow: "hidden",
zIndex: 9999
});
}
}
try {
document.getElementById("GomedisysImage").style.background = "url(../../img/iconos/logo_login_navidad.png)";
document.getElementById("GomedisysImage").style.width = "315px";
document.getElementById("GomedisysImage").style.height = "80px";
} catch (errorLogin) {
}
}
}
function sortJSON(data, key, way) {
///
/// Sorts the json.
///
/// The data.
/// The key.
/// The way.
return data.sort(function (a, b) {
var x = a[key]; var y = b[key];
if (way === '123') { return ((x < y) ? -1 : ((x > y) ? 1 : 0)); }
if (way === '321') { return ((x > y) ? -1 : ((x < y) ? 1 : 0)); }
});
}