1
+ const ads = [
2
+ {
3
+ img : 'patreon.png' ,
4
+ href : 'https://patreon.com/structurizr' ,
5
+ expiry : new Date ( '2025-12-31' )
6
+ } ,
7
+ {
8
+ img : 'j-on-the-beach.png' ,
9
+ href : 'https://www.jonthebeach.com/workshops/visualising-software-architecture-with-the-C4-model/' ,
10
+ expiry : new Date ( '2025-05-13' )
11
+ } ,
12
+ {
13
+ img : 'trifork-nl.png' ,
14
+ href : 'https://trifork.nl/academy/our-courses/software-architecture-for-developers/' ,
15
+ expiry : new Date ( '2025-05-20' )
16
+ } ,
17
+ {
18
+ img : 'ddd-europe.png' ,
19
+ href : 'https://ddd.academy/visualising-software-architecture/' ,
20
+ expiry : new Date ( '2025-06-02' )
21
+ } ,
22
+ {
23
+ img : 'yow-melbourne.png' ,
24
+ href : 'https://yowcon.com/melbourne-2025/masterclasses/541/visualising-software-architecture-with-the-c4-model' ,
25
+ expiry : new Date ( '2025-12-02' )
26
+ } ,
27
+ {
28
+ img : 'yow-sydney.png' ,
29
+ href : 'https://yowcon.com/sydney-2025/masterclasses/542/visualising-software-architecture-with-the-c4-model' ,
30
+ expiry : new Date ( '2025-12-09' )
31
+ }
32
+ ] ;
33
+
34
+ function showAd ( id , baseUrl ) {
35
+ try {
36
+ if ( baseUrl === undefined ) {
37
+ baseUrl = '' ;
38
+ }
39
+
40
+ var ad ;
41
+ while ( ad === undefined || ad . expiry < new Date ( ) ) {
42
+ const randomNumber = Math . floor ( Math . random ( ) * ads . length ) ;
43
+ ad = ads [ randomNumber ] ;
44
+ }
45
+
46
+ const img = document . createElement ( 'img' ) ;
47
+ img . src = baseUrl + '/assets/ads/' + ad . img ;
48
+ img . style . width = '728px' ;
49
+ img . style . height = '90px' ;
50
+ img . style . borderRadius = '5px' ;
51
+ img . style . border = 'solid 1px black' ;
52
+
53
+ const a = document . createElement ( 'a' ) ;
54
+ a . href = ad . href ;
55
+ a . target = '_blank' ;
56
+ a . append ( img ) ;
57
+
58
+ const mainContentElement = document . getElementById ( id ) ;
59
+ mainContentElement . insertBefore ( a , mainContentElement . firstChild ) ;
60
+ } catch ( e ) {
61
+ log . warn ( e ) ;
62
+ }
63
+ }
0 commit comments