-
Notifications
You must be signed in to change notification settings - Fork 2
/
individual message.html
38 lines (32 loc) · 1.82 KB
/
individual message.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
29
30
31
32
33
34
35
36
37
38
<!-- Individual Message v.2.2 - Copyright (C) 2021, TRMSC - https://trmsc1.wordpress.com/ -->
<!-- GNU General Public Licence 3.0 - http://www.gnu.de/documents/gpl-3.0.en.html -->
<!-- THIS CODE SHOWS AN INDIVIDUAL TEXT FOR USERS ON BASIS OF THEIR NAMES -->
<script>
window.addEventListener( 'load', function( event ) {
let jquery_load_check_interval = setInterval( function() {
if ( window.jQuery ) {
console.log( 'Individual Message: jQuery v.' + $.fn.jquery + ' loaded' );
console.log( 'Individual Message: v.2.2' );
createMessage();
clearInterval( jquery_load_check_interval );
} else {
console.log( 'Individual Message: new try to load jquery...' );
}
}, 150);
function createMessage() {
var fstName = $('span.usertext.mr-1').text().split(/\s+/)[1]; /*IF THE LASTNAME WILL BE DISPLAYED TRY [0} INSTEAD OF [1] IN THIS LINE */
var lstName = $('span.usertext.mr-1').text().split(/\s+/)[0]; /*IF THE FIRSTNAME WILL BE DISPLAYED TRY [1} INSTEAD OF [0] IN THIS LINE */
var userMessage;
if (fstName == "Max")
userMessage = "Text für Max";
if (fstName == "Mia")
userMessage = "Text für Mia";
/* COPY THE TWO RESPECTIVELY LINES ABOVE FOR MORE INDIVIDUAL TEXTS */
/* USE lstName INSTEAD OF fstName IF YOU WANT TO CHOOSE THE LASTNAME */
document.getElementById("msgOutput").innerHTML = userMessage;
console.log( 'Individual Message: create messages' );
}
}, false );
</script>
<p>Deine persönliche Nachricht ist: <strong><span id="msgOutput"></span></strong></p>
<!-- THE <span id="msgOutput"></span>-PART IS THE INDIVIDUAL MESSAGE -->