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
39
40
41
42
43
44
45
46
|
$(document).ready(() => {
const SemanticUIColors = [
'red',
'orange',
'yellow',
'olive',
'green',
'teal',
'blue',
'violet',
'purple',
'pink',
'brown',
]
function getRandomInt(min, max) {
min = Math.ceil(min)
max = Math.floor(max)
return Math.floor(Math.random() * (max - min) + min) // The maximum is exclusive and the minimum is inclusive
}
function initTags() {
$('.dream-tags > .ui.label').each(function () {
$(this).addClass(SemanticUIColors[getRandomInt(0, SemanticUIColors.length)])
})
}
function initTagsDropdown() {
$('.ui.accordion').accordion({
selector: {
trigger: '.title .dropdown',
},
})
$('.tags-with-dropdown .dropdown').click(function () {
$(this).children(':first').toggleClass('rotated')
})
}
initTags()
if (window.maxTags) {
initTagsDropdown()
}
})
|