mymirror/WebContent/inc/js/jsMirror.js
2018-06-03 11:34:09 +02:00

242 lines
6.1 KiB
JavaScript

/* ------------------------ */
/* LOGO */
/* ------------------------ */
/* ------------------------ */
/* MESSAGE */
/* ------------------------ */
/* ------------------------ */
/* HORLOGE */
/* ------------------------ */
function displayHorloge(activate,div,aff,divHorloge,divDate){
if (activate != "false") {
varToCss(div, aff);
horloge(divHorloge);
date(divDate);
$(div).fadeIn(durationFadeIn);
};
};
function horloge(el) {
if (typeof el == "string") {
el = document.getElementById(el);
}
function actualiser() {
var date = new Date();
var str = date.getHours();
str += ':' + (date.getMinutes() < 10 ? '0' : '') + date.getMinutes();
el.innerHTML = str;
//str = '18:30';
//el.innerHTML = '18:30';
}
actualiser();
setInterval(actualiser, 1000);
};
/* ------------------------ */
/* LES FONDUS */
/* ------------------------ */
/*function fondu(id, opacity) {
opacity = (!opacity ? 0 : opacity) + 3;
var item = document.getElementById(id).style;
item.opacity = (opacity / 100);
item.filter = 'alpha(opacity=' + opacity + ')';
if (opacity < 100) {
var time = 150;
setTimeout('fondu(\'' + id + '\', ' + opacity + ')', time);
}
};*/
function fonduSound(id, sound) {
sound = (!sound ? 0 : sound) + 0.003;
var x = document.getElementById(id).style;
x.volume = sound;
alert(x.volume);
if (sound < 0.1) {
var time = 150;
setTimeout('fonduSound(\'' + id + '\', ' + sound + ')', time);
}
};
/*
function defondu(id, opacity) {
opacity = (!opacity ? 100 : opacity) - 2;
var item = document.getElementById(id).style;
item.opacity = (opacity / 100);
item.filter = 'alpha(opacity=' + opacity + ')';
if (opacity > 0) {
var time = 150;
setTimeout('defondu(\'' + id + '\', ' + opacity + ')', time);
}
};*/
/* ------------------------ */
/* LES VARIABLES */
/* ------------------------ */
var durationFadeIn = 5000;
/* ------------------------ */
/* LES COULEURS */
/* ------------------------ */
function colorWidget(color, div){
if (color == "blue") {
$(div).css("color", "aqua");
}
if (color == "green") {
$(div).css("color", "lime");
}
if (color == "pink") {
$(div).css("color", "fuchsia");
}
if (color == "orange") {
$(div).css("color", "orangered");
}
if (color == "white"
|| color == "red"
|| color == "yellow") {
$(div).css("color", color);
}
};
function colorWidgetSvg(color, div){
if (color == "blue") {
$(div).css("background-color", "aqua");
}
if (color == "green") {
$(div).css("background-color", "lime");
}
if (color == "pink") {
$(div).css("background-color", "fuchsia");
}
if (color == "orange") {
$(div).css("background-color", "orangered");
}
if (color == "white"
|| color == "red"
|| color == "yellow") {
$(div).css("background-color", color);
}
};
/* ------------------------ */
/* MODIF AFFICH ELMTS */
/* ------------------------ */
/*function displayDiv(){
if ("${sessionUtilisateur.widgetWelcome.widgetWelcomeActivate}" != "false") {
varToCss("#WelcomeDrawId", affWelcome);
$("#WelcomeDrawId").fadeIn(durationFadeIn);
};
if ("${sessionUtilisateur.widgetHour.widgetHourActivate}" != "false") {
alert("horloge = true");
varToCss("#HorlogeDrawId", affHorloge);
horloge('div_horloge');
date('div_date');
$("#HorlogeDrawId").fadeIn(durationFadeIn);
};
if ("${sessionUtilisateur.widgetWeather.widgetWeatherActivate}" != "false") {
varToCss("#WeatherDrawId", affWeather);
getInfoWeather('div_weather');
$("#WeatherDrawId").fadeIn(durationFadeIn);
};
if ("${sessionUtilisateur.widgetNews.widgetNewsActivate}" != "false") {
//coefSizeFct(affNews);
varToCss("#NewsDrawId", affNews);
getNews();
$("#NewsDrawId").fadeIn(durationFadeIn);
$(function(){
$("ul#ticker01").liScroll();
});
};
if ("${sessionUtilisateur.widgetAgenda.widgetAgendaActivate}" != "false") {
varToCss("#AgendaDrawId", affAgenda);
colorWidget(affAgenda.color, "#AgendaDrawId p");
$("#AgendaDrawId").fadeIn(durationFadeIn);
};
if ("${sessionUtilisateur.widgetTraffic.widgetTrafficActivate}" != "false") {
varToCss("#TrafficDrawId", affTraffic);
getTraffic();
$("#TrafficDrawId").fadeIn(durationFadeIn);
};
if ("${sessionUtilisateur.email}" != "jl@hotm"){
varToCss("#HealthDrawId", affHealth);
$("#HealthDrawId").fadeIn(durationFadeIn);
};
if ("${sessionUtilisateur.widgetRadio.widgetRadioActivate}" != "false") {
getRadio('RadioAudio');
$("#RadioLogoId").fadeIn(durationFadeIn);
};
if ("${sessionUtilisateur.widgetSmartHome.widgetSmartHomeActivate}" != "false"){
varToCss("#HouseDrawId", affHouse);
getTempHome();
$("#HouseDrawId").fadeIn(durationFadeIn);
};
if ("${sessionUtilisateur.widgetCrypto.widgetCryptoActivate}" != "false") {
varToCss("#CryptoDrawId", affCrypto);
getCrypto();
$("#percentage24HourBitcoin").css("color","green");
$("#percentage24HourEthereum").css("color","red");
$("#percentage24HourLitecoin").css("color","green");
$("#percentage24HourApple").css("color","green");
$("#CryptoDrawId").fadeIn(durationFadeIn);
};
};*/
/* ------------------------ */
/* MODIF CSS ELMTS */
/* ------------------------ */
function varToCss(cssDrawId, obj){
$(cssDrawId).css("width", obj.largeur);
$(cssDrawId).css("height", obj.hauteur);
$(cssDrawId).css("top", obj.coordY);
$(cssDrawId).css("left", obj.coordX);
$(cssDrawId).css("color", obj.color);
$(cssDrawId).css("font-family", obj.font);
resizeElmt(cssDrawId,obj);
//colorWidget(obj.color, cssDrawId);
//$(cssDrawId).css('transform', 'scale('+obj.coefSize+')');
};
function resizeElmt(cssDrawId, obj){
var coef = obj.largeur.replace('px','')/obj.defaultWidth;
//alert(cssDrawId + coef);
$(cssDrawId).children().css('transform-origin', 'center');
$(cssDrawId).children().css('transform', 'scale('+coef+')');
//transform-origin: top left;
};
/* ------------------------ */
/* COEF SIZE */
/* ------------------------ */
function coefSizeFct(elmt){
if (elmt.size=="Medium"){
elmt.coefSize=1;
};
if (elmt.size=="Big"){
elmt.coefSize=2;
};
if (elmt.size=="Small"){
elmt.coefSize=0.5;
};
//alert(elmt.size+' '+elmt.coefSize);
};