Add Counter on the website

This commit is contained in:
stef-devs 2022-05-04 16:28:25 +00:00
parent 867bdb395e
commit 0f27d2e537
3 changed files with 230 additions and 0 deletions

73
counter/counter.html Normal file
View File

@ -0,0 +1,73 @@
<!DOCTYPE html>
<head>
<!-- Animazione pulsanti -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css">
<!-- File css -->
<link rel="stylesheet" href="/style.css" type="text/css" media="all" />
<!-- Per rendere la pagina responsive -->
<meta name="viewport" content="width=device-width" >
<!-- Icona nella barra del browser / Favicon -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css">
<link rel="apple-touch-icon" sizes="57x57" href="/Favicon/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="/Favicon/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="/Favicon/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="/Favicon/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="/Favicon/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="/Favicon/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="/Favicon/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="/Favicon/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="/Favicon/apple-icon-180x180.png">
<link rel="icon" type="image/png" sizes="192x192" href="/Favicon/android-icon-192x192.png">
<link rel="icon" type="image/png" sizes="32x32" href="/Favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="/Favicon/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="16x16" href="/Favicon/favicon-16x16.png">
<link rel="manifest" href="/Favicon/manifest.json">
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
<meta name="theme-color" content="#ffffff">
</head>
<body>
<header>
<!-- Titolo nella barra del browser -->
<title>1 Elci - Counter</title>
<!-- Tasto per tornare alla home -->
<a href="/index.html">Home</a>
<!-- Vari spazi -->
<br>
<br>
<br>
<br>
<br>
<br>
<!-- Widget fine scuola -->
<div id="contagiorni-309858">
<small style="float: right"><a id="contagiorni-309858-url" href="https://www.contagiorni.it/contatori/id/309858">Contatore offerto da <em>contagiorni.it</em></a></small>
</div>
<script src="https://www.contagiorni.it/widget/contatore/309858/show.js" type="text/javascript"></script>
<!-- Pulsante per switchare alla dark mode o light mode -->
<div class="container">
<input class="container_toggle" type="checkbox" id="switch" name="mode">
<label for="switch">Toggle</label>
<!-- Script per far funzionare l'animazione e per far funzionare lo switch light e dark -->
<script src="/function.js"></script>
</body>

154
finescuola.js Normal file
View File

@ -0,0 +1,154 @@
var $cgj;
function contagiorni_isVisible( elem ) {
if (!(elem instanceof Element)) throw Error('DomUtil: elem is not an element.');
const style = getComputedStyle(elem);
if (style.display === 'none') return false;
if (style.visibility !== 'visible') return false;
if (style.opacity < 0.1) return false;
if (elem.offsetWidth + elem.offsetHeight + elem.getBoundingClientRect().height +
elem.getBoundingClientRect().width === 0) {
return false;
}
const elemCenter = {
x: elem.getBoundingClientRect().left + elem.offsetWidth / 2,
y: elem.getBoundingClientRect().top + elem.offsetHeight / 2
};
if (elemCenter.x < 0) return false;
if (elemCenter.x > (document.documentElement.clientWidth || window.innerWidth)) return false;
if (elemCenter.y < 0) return false;
if (elemCenter.y > (document.documentElement.clientHeight || window.innerHeight)) return false;
let pointContainer = document.elementFromPoint(elemCenter.x, elemCenter.y);
do {
if (pointContainer === elem) return true;
} while (pointContainer = pointContainer.parentNode);
return false;
};
function contagiorni_createElementFromHTML(htmlString) {
var div = document.createElement('div');
div.innerHTML = htmlString.trim();
// Change this to div.childNodes to support multiple top-level nodes
return div.firstChild;
}
function timeCallback() {
$cgj = jQuery.noConflict(false);
loadScript("https://www.contagiorni.it/v1theme/js/timerStyles.js", function() {
$cgj(".cg_timer").TimeCircles({
"animation": "smooth",
"bg_width": 0.2,
"fg_width": 0.03,
"circle_bg_color": "#90989F",
"text_size": 0.09,
"time": {
"Days": {
"text": "Giorni",
"color": "#FFCC66",
"show": true
},
"Hours": {
"text": "Ore",
"color": "#99CCFF",
"show": true
},
"Minutes": {
"text": "Minuti",
"color": "#BBFFBB",
"show": true
},
"Seconds": {
"text": "Secondi",
"color": "#FF9999",
"show": true
}
}
});
$cgj(window).resize(function(){
if($cgj( window ).width() < 1024) {
$cgj('#cg_seconddiv').show();
$cgj('#cg_firstdiv').TimeCircles({
"time": { "Minutes": { "show": false }, "Seconds": { "show": false }}
});
} else {
$cgj('#cg_seconddiv').hide();
$cgj('#cg_firstdiv').TimeCircles({
"time": { "Minutes": { "show": true }, "Seconds": { "show": true }}
});
}
$cgj(".cg_timer").TimeCircles().rebuild();
});
});
}
if (contagiorni_conditions()) {
console.log("[CONTAGIORNI] Funzionante.");
var currcurr = document.getElementById("contagiorni-309858").innerHTML;
loadjscssfile("https://www.contagiorni.it/v1theme/css/timerstyles.css", "css");
loadScript("https://code.jquery.com/jquery-3.5.1.min.js", timeCallback);
document.getElementById("contagiorni-309858").innerHTML = `<div class="container_cg">
<div style="min-height: 170px">
<div class="cg_timer" id="cg_firstdiv" data-date="2022-06-08 00:00:00" data-options='{"time": { "Minutes": { "show": true }, "Seconds": { "show": true }}, "count_past_zero": false}' style="width: 100%;"></div>
<div class="cg_timer" id="cg_seconddiv" data-date="2022-06-08 00:00:00" data-options='{"time": { "Days": { "show": false }, "Hours": { "show": false }}, "count_past_zero": false}' style="width: 100%; display: none"></div>
</div>
</div>
<script>
$cgj(".cg_timer").TimeCircles({
"animation": "smooth",
"bg_width": 0.2,
"fg_width": 0.03,
"circle_bg_color": "#90989F",
"text_size": 0.09,
"time": {
"Days": {
"text": "Giorni",
"color": "#FFCC66",
"show": true
},
"Hours": {
"text": "Ore",
"color": "#99CCFF",
"show": true
},
"Minutes": {
"text": "Minuti",
"color": "#BBFFBB",
"show": true
},
"Seconds": {
"text": "Secondi",
"color": "#FF9999",
"show": true
}
}
});
$cgj(window).resize(function(){
if($cgj( window ).width() < 1024) {
$cgj('#cg_seconddiv').show();
$cgj('#cg_firstdiv').TimeCircles({
"time": { "Minutes": { "show": false }, "Seconds": { "show": false }}
});
} else {
$cgj('#cg_seconddiv').hide();
$cgj('#cg_firstdiv').TimeCircles({
"time": { "Minutes": { "show": true }, "Seconds": { "show": true }}
});
}
$cgj(".cg_timer").TimeCircles().rebuild();
});
</script>
<br>` + currcurr;
} else {
alert("[CONTAGIORNI] Lo script è incompleto. Verifica di aver copiato bene.");
}

View File

@ -43,13 +43,16 @@
<!-- Titolo centrale del sito -->
<center>
<div style="verdana";align='center'><h1>1 Elettrici | Engim Veneto SFP Turazza</h1></div>
<div align='center' style='padding:4px;'></div>
</center>
<!-- Immagine orario classe -->
<span style="border:2px; padding:4px; width:150px"><a href='https://1elci.it/orario/orario.html'>ORARIO</a></span>
<span style="padding:4px; width:150px"><a href='https://1elci.it/calendario/calendario.html'>CALENDARIO</a></span>
<span style="padding: 4px;" width:150px"><a href='counter/counter.html'>COUNTER</a></span>
</div>