-
Notifications
You must be signed in to change notification settings - Fork 2
/
individual greeting.html
28 lines (25 loc) · 1.4 KB
/
individual greeting.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<!-- Individual Greeting v.2.1.2 - Copyright (C) 2022, TRMSC - https://trmsc1.wordpress.com/ -->
<!-- GNU General Public Licence 3.0 - http://www.gnu.de/documents/gpl-3.0.en.html -->
<!-- THIS CODE SHOWS A TEXT BEFORE AND AFTER THE INDIVIDUAL USERNAME ON TOP OF THE COURSE-->
<script>
window.addEventListener( 'load', function( event ) {
let jquery_load_check_interval = setInterval( function() {
if ( window.jQuery ) {
console.log( 'Individual Greeting: jQuery v.' + $.fn.jquery + ' loaded' );
console.log( 'Individual Greeting: v.2.1.1' );
setGreeting();
clearInterval( jquery_load_check_interval );
} else {
console.log( 'Individual Greeting: new try to load jquery...' );
}
}, 150);
function setGreeting() {
var fstName = $('.logininfo a:first-of-type').text().split(/\s+/)[1]; /*IF THE LASTNAME WILL BE DISPLAYED TRY [0} INSTEAD OF [1] IN THIS LINE */
var textBefore = 'Hallo '; /* THE TEXT DISPLAYED BEFORE THE USERNAME */
var textAfter = '! Schön, dass du da bist!'; /* THE TEXT DISPLAYED AFTER THE USERNAME */
var fullText = textBefore + fstName + textAfter;
console.log('Individual Greeting: ' + fullText);
$('div[role=main]').prepend('<h2>' + fullText + '</h2>');
}
}, false );
</script>