summaryrefslogtreecommitdiffstats
path: root/plugins/notes.lua
blob: 861ca64a1fccd93149b9d42b01dc187b55e658ea (plain)
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
notes = HTML.select_all_of(page, {".marginblock", ".sidenote"})

local index = 1
while notes[index] do
  local note = notes[index]

  HTML.add_class(note, "note")

  index = index + 1
end

ofs = 0
notes = HTML.select(page, ".note")
index = 1
while notes[index] do
  local note = notes[index]

  if (index + ofs) % 2 == 0 then
    HTML.add_class(note, "note-right")
  else
    HTML.add_class(note, "note-left")
  end

  index = index + 1

  -- the first margin note component (the avatar) takes a lot more space than
  -- the second one (update dates and tags), so it's interesting that the first
  -- note after these ones is also on the right.
  if index == 3 then
    ofs = 1
  end
end