Commit 93309f1
committed
behaviors: optionally collect outlinks while looping
This solves one of the existing limitations of our outlink gathering
system: we run it once, after all behaviours have completed. For
some interactive pages, particularly single-page apps with paginated
data, it means that we'll completely miss that content since it won't
be in the DOM anymore by the time we get around to it.
In a previous PR, #433, I made the outlink gathering logic reusable
by ensuring it's possible for us to dynamically call the outlink
gathering function at any time. In addition, in #429, I made it
possible for behaviours to return outlinks to Brozzler; if the
behaviour chooses to return outlinks, then Brozzler will add them to
the set it extracts after behavours complete.
This branch uses both of those by introducing new functionality in
behaviours. We always inject the outlink gathering code before running
behaviours, so they can now run it at will. It also introduces two new
behaviour parameters:
* `extractOutlinks` - If set to `true`, then the behaviour script will
call the outlink gathering logic and return any outlinks it harvested
to Brozzler. Defaults to `false`.
* `extractOutlinksInLoop` - If set to `true`, then the behaviour script
will gather outlinks every iteration of the loop. This combines great
with `repeatSameElement`, since it means the behaviour script can
click a `next` pagination button and then immediately gather whatever
new outlinks have appeared on the page. Defaults to `false`.1 parent 00edb56 commit 93309f1
2 files changed
+32
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
769 | 769 | | |
770 | 770 | | |
771 | 771 | | |
772 | | - | |
773 | | - | |
| 772 | + | |
774 | 773 | | |
775 | 774 | | |
776 | 775 | | |
| |||
782 | 781 | | |
783 | 782 | | |
784 | 783 | | |
785 | | - | |
786 | 784 | | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
787 | 792 | | |
788 | 793 | | |
789 | 794 | | |
| |||
879 | 884 | | |
880 | 885 | | |
881 | 886 | | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
882 | 890 | | |
883 | 891 | | |
884 | 892 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
43 | 44 | | |
44 | 45 | | |
45 | 46 | | |
| 47 | + | |
| 48 | + | |
46 | 49 | | |
47 | 50 | | |
48 | 51 | | |
| |||
121 | 124 | | |
122 | 125 | | |
123 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
124 | 133 | | |
125 | 134 | | |
126 | 135 | | |
| |||
136 | 145 | | |
137 | 146 | | |
138 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
139 | 154 | | |
140 | 155 | | |
141 | 156 | | |
| |||
221 | 236 | | |
222 | 237 | | |
223 | 238 | | |
224 | | - | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
225 | 245 | | |
226 | 246 | | |
227 | 247 | | |
0 commit comments