Wiki source code of Funding & Funder Requirements
Version 5.9 by Veronika Kocher on Thursday, 03 Sep 2026 9:34
Hide last authors
| author | version | line-number | content |
|---|---|---|---|
| |
2.1 | 1 | Identify funder requirements for data management, Open Science, documentation, preservation and eligible costs. |
| 2 | |||
| 3 | == Overview == | ||
| 4 | |||
| 5 | Add a concise explanation of this topic and why it matters for Art & Research projects. | ||
| 6 | |||
| 7 | == What you need to know == | ||
| 8 | |||
| 9 | * Key concepts | ||
| 10 | * Relevant requirements | ||
| 11 | * Important distinctions | ||
| 12 | |||
| 13 | == What you need to do == | ||
| 14 | |||
| 15 | 1. Identify what applies to your project. | ||
| 16 | 2. Document the relevant decisions. | ||
| 17 | 3. Use appropriate institutional services and support where needed. | ||
| 18 | |||
| 19 | == Key questions == | ||
| 20 | |||
| 21 | * What needs to be decided? | ||
| 22 | * Who is responsible? | ||
| 23 | * What needs to be documented? | ||
| 24 | * Are there legal, ethical or technical constraints? | ||
| 25 | * What needs to happen before the next project phase? | ||
| 26 | |||
| 27 | == Services & Tools == | ||
| 28 | |||
| 29 | Add links to relevant institutional services, infrastructure and tools. | ||
| 30 | |||
| 31 | == Info Sheets & Checklists == | ||
| 32 | |||
| 33 | Add links to related Info Sheets, checklists and templates. | ||
| 34 | |||
| 35 | == Tutorials == | ||
| 36 | |||
| |
5.6 | 37 | |
| 38 | {{html}}<span data-arsn-coming-soon="true" style="display:inline-block;margin:6px 0 8px 0;padding:4px 9px;border-radius:14px;background:#fff4ee;border:1px solid #efd9cc;color:#8a4d36;font-size:11px;font-weight:700;letter-spacing:.065em;line-height:1.2;">COMING SOON</span>{{/html}} | ||
| |
2.1 | 39 | Add links to step-by-step tutorials for this topic. |
| 40 | |||
| 41 | == Related Topics == | ||
| 42 | |||
| 43 | Add links to related pages in Enable, Work & Manage, and Publish & Share. | ||
| 44 | |||
| |
5.7 | 45 | == Who is responsible? == |
| |
2.1 | 46 | |
| |
5.7 | 47 | {{html}}<!-- ARSN_TOPIC_ROUTING_V1 -->{{/html}} |
| 48 | {{info title="Service routing"}} | ||
| 49 | **Primary specialist service(s):** Support Kunst und Forschung (SKF) for research funding landscape, call fit, proposal development, internal routing and funded-project coordination. | ||
| |
2.1 | 50 | |
| |
5.7 | 51 | **Role of Support Kunst und Forschung (SKF):** Lead / central project-and-funding hub for this topic; specialist units are involved when the call triggers legal, financial, HR, data, IT or other requirements. |
| 52 | {{/info}} | ||
| |
4.1 | 53 | |
| |
5.7 | 54 | If you are unsure which route applies, start with the service named above. For funded or project-based research where several units are involved, SKF can coordinate the project route. |
| 55 | |||
| |
4.1 | 56 | {{html}} |
| 57 | <!-- ARSN_SEARCH_TERMS_START --> | ||
| 58 | <details class="arsn-search-terms" style="margin-top:28px;padding-top:10px;border-top:1px solid #eee;"> | ||
| 59 | <summary style="cursor:pointer;color:#666;font-size:13px;">Search terms & related topics</summary> | ||
| 60 | <div style="margin-top:9px;color:#555;font-size:13px;"> | ||
| 61 | <p style="margin:0 0 8px 0;"> | ||
| |
5.2 | 62 | This topic can also be found through related terms, synonyms and common search queries. |
| 63 | Select a term to search the Art & Research Services Navigator. | ||
| |
4.1 | 64 | </p> |
| |
5.2 | 65 | <p style="margin:0;"><a href="https://xwiki.uni-ak.ac.at/bin/view/Service%20Navigator/Art%20%26%20Research%20Services%20Navigator/?q=art%20and%20research#arsn-search-input" class="arsn-search-term" data-search-term="art and research" style="display:inline-block;margin:3px 5px 3px 0;padding:3px 8px;border:1px solid #d7d7d7;border-radius:14px;background:#fff;color:#333;text-decoration:none;font-size:12px;">art and research</a><a href="https://xwiki.uni-ak.ac.at/bin/view/Service%20Navigator/Art%20%26%20Research%20Services%20Navigator/?q=enable#arsn-search-input" class="arsn-search-term" data-search-term="enable" style="display:inline-block;margin:3px 5px 3px 0;padding:3px 8px;border:1px solid #d7d7d7;border-radius:14px;background:#fff;color:#333;text-decoration:none;font-size:12px;">enable</a><a href="https://xwiki.uni-ak.ac.at/bin/view/Service%20Navigator/Art%20%26%20Research%20Services%20Navigator/?q=research%20funding#arsn-search-input" class="arsn-search-term" data-search-term="research funding" style="display:inline-block;margin:3px 5px 3px 0;padding:3px 8px;border:1px solid #d7d7d7;border-radius:14px;background:#fff;color:#333;text-decoration:none;font-size:12px;">research funding</a><a href="https://xwiki.uni-ak.ac.at/bin/view/Service%20Navigator/Art%20%26%20Research%20Services%20Navigator/?q=funder%20requirements#arsn-search-input" class="arsn-search-term" data-search-term="funder requirements" style="display:inline-block;margin:3px 5px 3px 0;padding:3px 8px;border:1px solid #d7d7d7;border-radius:14px;background:#fff;color:#333;text-decoration:none;font-size:12px;">funder requirements</a><a href="https://xwiki.uni-ak.ac.at/bin/view/Service%20Navigator/Art%20%26%20Research%20Services%20Navigator/?q=grant%20requirements#arsn-search-input" class="arsn-search-term" data-search-term="grant requirements" style="display:inline-block;margin:3px 5px 3px 0;padding:3px 8px;border:1px solid #d7d7d7;border-radius:14px;background:#fff;color:#333;text-decoration:none;font-size:12px;">grant requirements</a><a href="https://xwiki.uni-ak.ac.at/bin/view/Service%20Navigator/Art%20%26%20Research%20Services%20Navigator/?q=data%20management%20plan#arsn-search-input" class="arsn-search-term" data-search-term="data management plan" style="display:inline-block;margin:3px 5px 3px 0;padding:3px 8px;border:1px solid #d7d7d7;border-radius:14px;background:#fff;color:#333;text-decoration:none;font-size:12px;">data management plan</a><a href="https://xwiki.uni-ak.ac.at/bin/view/Service%20Navigator/Art%20%26%20Research%20Services%20Navigator/?q=open%20science%20requirements#arsn-search-input" class="arsn-search-term" data-search-term="open science requirements" style="display:inline-block;margin:3px 5px 3px 0;padding:3px 8px;border:1px solid #d7d7d7;border-radius:14px;background:#fff;color:#333;text-decoration:none;font-size:12px;">open science requirements</a><a href="https://xwiki.uni-ak.ac.at/bin/view/Service%20Navigator/Art%20%26%20Research%20Services%20Navigator/?q=eligible%20costs#arsn-search-input" class="arsn-search-term" data-search-term="eligible costs" style="display:inline-block;margin:3px 5px 3px 0;padding:3px 8px;border:1px solid #d7d7d7;border-radius:14px;background:#fff;color:#333;text-decoration:none;font-size:12px;">eligible costs</a><a href="https://xwiki.uni-ak.ac.at/bin/view/Service%20Navigator/Art%20%26%20Research%20Services%20Navigator/?q=funding#arsn-search-input" class="arsn-search-term" data-search-term="funding" style="display:inline-block;margin:3px 5px 3px 0;padding:3px 8px;border:1px solid #d7d7d7;border-radius:14px;background:#fff;color:#333;text-decoration:none;font-size:12px;">funding</a><a href="https://xwiki.uni-ak.ac.at/bin/view/Service%20Navigator/Art%20%26%20Research%20Services%20Navigator/?q=grant#arsn-search-input" class="arsn-search-term" data-search-term="grant" style="display:inline-block;margin:3px 5px 3px 0;padding:3px 8px;border:1px solid #d7d7d7;border-radius:14px;background:#fff;color:#333;text-decoration:none;font-size:12px;">grant</a><a href="https://xwiki.uni-ak.ac.at/bin/view/Service%20Navigator/Art%20%26%20Research%20Services%20Navigator/?q=grant%20application#arsn-search-input" class="arsn-search-term" data-search-term="grant application" style="display:inline-block;margin:3px 5px 3px 0;padding:3px 8px;border:1px solid #d7d7d7;border-radius:14px;background:#fff;color:#333;text-decoration:none;font-size:12px;">grant application</a><a href="https://xwiki.uni-ak.ac.at/bin/view/Service%20Navigator/Art%20%26%20Research%20Services%20Navigator/?q=funder#arsn-search-input" class="arsn-search-term" data-search-term="funder" style="display:inline-block;margin:3px 5px 3px 0;padding:3px 8px;border:1px solid #d7d7d7;border-radius:14px;background:#fff;color:#333;text-decoration:none;font-size:12px;">funder</a><a href="https://xwiki.uni-ak.ac.at/bin/view/Service%20Navigator/Art%20%26%20Research%20Services%20Navigator/?q=funding%20requirements#arsn-search-input" class="arsn-search-term" data-search-term="funding requirements" style="display:inline-block;margin:3px 5px 3px 0;padding:3px 8px;border:1px solid #d7d7d7;border-radius:14px;background:#fff;color:#333;text-decoration:none;font-size:12px;">funding requirements</a><a href="https://xwiki.uni-ak.ac.at/bin/view/Service%20Navigator/Art%20%26%20Research%20Services%20Navigator/?q=f%C3%B6rderung#arsn-search-input" class="arsn-search-term" data-search-term="förderung" style="display:inline-block;margin:3px 5px 3px 0;padding:3px 8px;border:1px solid #d7d7d7;border-radius:14px;background:#fff;color:#333;text-decoration:none;font-size:12px;">förderung</a><a href="https://xwiki.uni-ak.ac.at/bin/view/Service%20Navigator/Art%20%26%20Research%20Services%20Navigator/?q=f%C3%B6rdergeber#arsn-search-input" class="arsn-search-term" data-search-term="fördergeber" style="display:inline-block;margin:3px 5px 3px 0;padding:3px 8px;border:1px solid #d7d7d7;border-radius:14px;background:#fff;color:#333;text-decoration:none;font-size:12px;">fördergeber</a><a href="https://xwiki.uni-ak.ac.at/bin/view/Service%20Navigator/Art%20%26%20Research%20Services%20Navigator/?q=f%C3%B6rderbedingungen#arsn-search-input" class="arsn-search-term" data-search-term="förderbedingungen" style="display:inline-block;margin:3px 5px 3px 0;padding:3px 8px;border:1px solid #d7d7d7;border-radius:14px;background:#fff;color:#333;text-decoration:none;font-size:12px;">förderbedingungen</a></p> |
| |
4.1 | 66 | </div> |
| 67 | </details> | ||
| 68 | <!-- ARSN_SEARCH_TERMS_END --> | ||
| 69 | {{/html}} | ||
| |
5.8 | 70 | |
| 71 | {{html clean="false"}} | ||
| 72 | <!-- SN_HORIZONTAL_BOX_HARMONIZER_START --> | ||
| |
5.9 | 73 | <style data-sn-horizontal-box-harmonizer="4"> |
| 74 | [data-sn-equal-height-managed], | ||
| 75 | [data-sn-first-section-aligned]{ | ||
| 76 | box-sizing:border-box; | ||
| |
5.8 | 77 | } |
| 78 | </style> | ||
| |
5.9 | 79 | <script data-sn-horizontal-box-harmonizer="4"> |
| |
5.8 | 80 | (function(){ |
| 81 | "use strict"; | ||
| 82 | |||
| 83 | var MOBILE_MAX=767; | ||
| |
5.9 | 84 | var ROW_TOLERANCE=6; |
| |
5.8 | 85 | var MIN_W=150; |
| 86 | var MIN_H=36; | ||
| |
5.9 | 87 | var MAX_PARENT_CHILDREN=16; |
| 88 | var SEARCH_DEPTH=5; | ||
| |
5.8 | 89 | |
| 90 | var root= | ||
| 91 | document.getElementById("xwikicontent")|| | ||
| 92 | document.querySelector(".xwiki-rendering-content")|| | ||
| 93 | document.querySelector("main")|| | ||
| 94 | document.body; | ||
| 95 | |||
| 96 | if(!root)return; | ||
| 97 | |||
| |
5.9 | 98 | var heightManaged=new Set(); |
| 99 | var sectionManaged=new Set(); | ||
| 100 | var originalMinHeight=new WeakMap(); | ||
| 101 | var originalMarginTop=new WeakMap(); | ||
| |
5.8 | 102 | var raf=0; |
| 103 | |||
| 104 | function num(v){ | ||
| 105 | var n=parseFloat(v); | ||
| 106 | return Number.isFinite(n)?n:0; | ||
| 107 | } | ||
| 108 | |||
| |
5.9 | 109 | function visible(el,minW,minH){ |
| |
5.8 | 110 | if(!el||el.nodeType!==1)return false; |
| |
5.9 | 111 | |
| |
5.8 | 112 | var s=getComputedStyle(el); |
| |
5.9 | 113 | |
| 114 | if( | ||
| 115 | s.display==="none"|| | ||
| 116 | s.visibility==="hidden"|| | ||
| 117 | Number(s.opacity)===0 | ||
| 118 | ){ | ||
| 119 | return false; | ||
| 120 | } | ||
| 121 | |||
| |
5.8 | 122 | var r=el.getBoundingClientRect(); |
| |
5.9 | 123 | |
| 124 | return ( | ||
| 125 | r.width>=(minW||1)&& | ||
| 126 | r.height>=(minH||1) | ||
| 127 | ); | ||
| |
5.8 | 128 | } |
| 129 | |||
| 130 | function excluded(el){ | ||
| |
5.9 | 131 | return ( |
| 132 | !el.matches|| | ||
| 133 | el.matches( | ||
| 134 | "button,input,select,textarea,option,label,img,svg,canvas,table,thead,tbody,tfoot,tr,td,th,summary,script,style,noscript,template,.btn,.chip,[role=button]" | ||
| 135 | ) | ||
| |
5.8 | 136 | ); |
| 137 | } | ||
| 138 | |||
| 139 | function namedLikeBox(el){ | ||
| |
5.9 | 140 | var c= |
| 141 | typeof el.className==="string" | ||
| 142 | ? el.className | ||
| 143 | : ""; | ||
| 144 | |||
| 145 | return /(^|[s_-])(box|card|tile|panel|role|check|service|source|call|area|detail|resource|topic|warn|info)([s_-]|$)/i.test(c); | ||
| |
5.8 | 146 | } |
| 147 | |||
| 148 | function boxLike(el){ | ||
| |
5.9 | 149 | if(!visible(el,MIN_W,MIN_H)||excluded(el))return false; |
| 150 | |||
| |
5.8 | 151 | var s=getComputedStyle(el); |
| 152 | var r=el.getBoundingClientRect(); | ||
| |
5.9 | 153 | |
| |
5.8 | 154 | var border= |
| |
5.9 | 155 | num(s.borderTopWidth)+ |
| 156 | num(s.borderRightWidth)+ | ||
| 157 | num(s.borderBottomWidth)+ | ||
| 158 | num(s.borderLeftWidth); | ||
| 159 | |||
| |
5.8 | 160 | var radius=Math.max( |
| |
5.9 | 161 | num(s.borderTopLeftRadius), |
| 162 | num(s.borderTopRightRadius), | ||
| 163 | num(s.borderBottomLeftRadius), | ||
| 164 | num(s.borderBottomRightRadius) | ||
| |
5.8 | 165 | ); |
| |
5.9 | 166 | |
| 167 | var bg= | ||
| 168 | s.backgroundColor&& | ||
| 169 | s.backgroundColor!=="rgba(0, 0, 0, 0)"&& | ||
| 170 | s.backgroundColor!=="transparent"; | ||
| 171 | |||
| 172 | var shadow= | ||
| 173 | s.boxShadow&& | ||
| 174 | s.boxShadow!=="none"; | ||
| 175 | |||
| 176 | return ( | ||
| 177 | namedLikeBox(el)|| | ||
| 178 | border>=1|| | ||
| 179 | (bg&&radius>=3)|| | ||
| 180 | (shadow&&r.width>=180) | ||
| 181 | ); | ||
| |
5.8 | 182 | } |
| 183 | |||
| |
5.9 | 184 | function saveOriginal(el,map,property){ |
| 185 | if(map.has(el))return; | ||
| 186 | |||
| 187 | map.set(el,{ | ||
| 188 | value:el.style.getPropertyValue(property), | ||
| 189 | priority:el.style.getPropertyPriority(property) | ||
| 190 | }); | ||
| 191 | } | ||
| 192 | |||
| 193 | function restoreOriginal(el,map,property){ | ||
| 194 | var original=map.get(el); | ||
| 195 | |||
| 196 | if(original&&original.value){ | ||
| 197 | el.style.setProperty( | ||
| 198 | property, | ||
| 199 | original.value, | ||
| 200 | original.priority||"" | ||
| 201 | ); | ||
| 202 | }else{ | ||
| 203 | el.style.removeProperty(property); | ||
| 204 | } | ||
| 205 | } | ||
| 206 | |||
| 207 | function reset(){ | ||
| 208 | heightManaged.forEach(function(el){ | ||
| 209 | restoreOriginal( | ||
| 210 | el, | ||
| 211 | originalMinHeight, | ||
| 212 | "min-height" | ||
| 213 | ); | ||
| 214 | |||
| 215 | el.removeAttribute( | ||
| 216 | "data-sn-equal-height-managed" | ||
| 217 | ); | ||
| 218 | }); | ||
| 219 | |||
| 220 | sectionManaged.forEach(function(el){ | ||
| 221 | restoreOriginal( | ||
| 222 | el, | ||
| 223 | originalMarginTop, | ||
| 224 | "margin-top" | ||
| 225 | ); | ||
| 226 | |||
| 227 | el.removeAttribute( | ||
| 228 | "data-sn-first-section-aligned" | ||
| 229 | ); | ||
| 230 | }); | ||
| 231 | |||
| 232 | heightManaged.clear(); | ||
| 233 | sectionManaged.clear(); | ||
| 234 | } | ||
| 235 | |||
| |
5.8 | 236 | function pickTarget(child){ |
| |
5.9 | 237 | if(!visible(child,MIN_W,MIN_H))return null; |
| |
5.8 | 238 | |
| |
5.9 | 239 | if(boxLike(child)){ |
| 240 | return child; | ||
| 241 | } | ||
| 242 | |||
| |
5.8 | 243 | var cr=child.getBoundingClientRect(); |
| 244 | var q=[]; | ||
| |
5.9 | 245 | |
| |
5.8 | 246 | Array.from(child.children||[]).forEach(function(el){ |
| 247 | q.push({el:el,depth:1}); | ||
| 248 | }); | ||
| 249 | |||
| |
5.9 | 250 | var best=null; |
| 251 | var bestScore=-Infinity; | ||
| |
5.8 | 252 | |
| 253 | while(q.length){ | ||
| 254 | var item=q.shift(); | ||
| 255 | var el=item.el; | ||
| 256 | |||
| |
5.9 | 257 | if(!visible(el,MIN_W,MIN_H))continue; |
| 258 | |||
| |
5.8 | 259 | var r=el.getBoundingClientRect(); |
| 260 | |||
| |
5.9 | 261 | if( |
| 262 | r.width>=cr.width*.68&& | ||
| 263 | boxLike(el) | ||
| 264 | ){ | ||
| 265 | var widthFit= | ||
| 266 | 1-Math.min( | ||
| 267 | 1, | ||
| 268 | Math.abs(cr.width-r.width)/ | ||
| 269 | Math.max(1,cr.width) | ||
| 270 | ); | ||
| 271 | |||
| 272 | var topFit= | ||
| 273 | 1-Math.min( | ||
| 274 | 1, | ||
| 275 | Math.abs(cr.top-r.top)/100 | ||
| 276 | ); | ||
| 277 | |||
| 278 | var score= | ||
| 279 | widthFit*6+ | ||
| 280 | topFit*3+ | ||
| 281 | Math.min(r.height,900)/450+ | ||
| 282 | Math.min(r.width*r.height,900000)/900000; | ||
| 283 | |||
| |
5.8 | 284 | if(score>bestScore){ |
| 285 | best=el; | ||
| 286 | bestScore=score; | ||
| 287 | } | ||
| 288 | } | ||
| 289 | |||
| |
5.9 | 290 | if(item.depth<SEARCH_DEPTH){ |
| |
5.8 | 291 | Array.from(el.children||[]).forEach(function(next){ |
| |
5.9 | 292 | q.push({ |
| 293 | el:next, | ||
| 294 | depth:item.depth+1 | ||
| 295 | }); | ||
| |
5.8 | 296 | }); |
| 297 | } | ||
| 298 | } | ||
| 299 | |||
| 300 | return best; | ||
| 301 | } | ||
| 302 | |||
| |
5.9 | 303 | function groupsByVisualRow(entries){ |
| 304 | var groups=[]; | ||
| 305 | |||
| 306 | entries | ||
| 307 | .slice() | ||
| 308 | .sort(function(a,b){ | ||
| 309 | return ( | ||
| 310 | a.rect.top-b.rect.top|| | ||
| 311 | a.rect.left-b.rect.left | ||
| 312 | ); | ||
| 313 | }) | ||
| 314 | .forEach(function(entry){ | ||
| 315 | var group=null; | ||
| 316 | |||
| 317 | for(var i=0;i<groups.length;i++){ | ||
| 318 | if( | ||
| 319 | Math.abs( | ||
| 320 | groups[i].top- | ||
| 321 | entry.rect.top | ||
| 322 | )<=ROW_TOLERANCE | ||
| 323 | ){ | ||
| 324 | group=groups[i]; | ||
| 325 | break; | ||
| 326 | } | ||
| 327 | } | ||
| 328 | |||
| 329 | if(!group){ | ||
| 330 | group={ | ||
| 331 | top:entry.rect.top, | ||
| 332 | entries:[] | ||
| 333 | }; | ||
| 334 | groups.push(group); | ||
| 335 | } | ||
| 336 | |||
| 337 | group.entries.push(entry); | ||
| 338 | }); | ||
| 339 | |||
| 340 | return groups; | ||
| |
5.8 | 341 | } |
| 342 | |||
| |
5.9 | 343 | function validHorizontalGroup(group){ |
| 344 | if(group.entries.length<2)return false; | ||
| 345 | |||
| 346 | var lefts= | ||
| 347 | group.entries | ||
| 348 | .map(function(e){return e.rect.left;}) | ||
| 349 | .sort(function(a,b){return a-b;}); | ||
| 350 | |||
| 351 | if( | ||
| 352 | lefts[lefts.length-1]- | ||
| 353 | lefts[0]< | ||
| 354 | 80 | ||
| 355 | ){ | ||
| 356 | return false; | ||
| |
5.8 | 357 | } |
| |
5.9 | 358 | |
| 359 | var widths= | ||
| 360 | group.entries | ||
| 361 | .map(function(e){return e.rect.width;}) | ||
| 362 | .filter(function(w){return w>0;}); | ||
| 363 | |||
| 364 | if(widths.length<2)return false; | ||
| 365 | |||
| 366 | var minWidth=Math.min.apply(Math,widths); | ||
| 367 | var maxWidth=Math.max.apply(Math,widths); | ||
| 368 | |||
| 369 | return ( | ||
| 370 | maxWidth/ | ||
| 371 | Math.max(1,minWidth)<= | ||
| 372 | 1.9 | ||
| 373 | ); | ||
| |
5.8 | 374 | } |
| 375 | |||
| |
5.9 | 376 | function normalizeText(text){ |
| 377 | return String(text||"") | ||
| 378 | .replace(/s+/g," ") | ||
| 379 | .trim() | ||
| 380 | .toUpperCase(); | ||
| 381 | } | ||
| 382 | |||
| 383 | function exactKnownFirstSection(el){ | ||
| 384 | var text=normalizeText(el.textContent); | ||
| 385 | |||
| 386 | return ( | ||
| 387 | text==="HIER STARTEN"|| | ||
| 388 | text==="ORGANISIEREN & DOKUMENTIEREN"|| | ||
| 389 | text==="ENTSCHEIDEN"|| | ||
| 390 | text==="START HERE"|| | ||
| 391 | text==="GET STARTED"|| | ||
| 392 | text==="ORGANISE & DOCUMENT"|| | ||
| 393 | text==="ORGANIZE & DOCUMENT"|| | ||
| 394 | text==="DECIDE" | ||
| 395 | ); | ||
| 396 | } | ||
| 397 | |||
| 398 | function visuallyFirstSectionBar(card){ | ||
| 399 | var cardRect=card.getBoundingClientRect(); | ||
| 400 | var candidates=[]; | ||
| 401 | |||
| 402 | Array.from( | ||
| 403 | card.querySelectorAll( | ||
| 404 | "div,p,span,strong,h3,h4,h5,h6" | ||
| 405 | ) | ||
| 406 | ).forEach(function(el){ | ||
| 407 | if(!visible(el,20,6))return; | ||
| 408 | if(excluded(el))return; | ||
| 409 | |||
| 410 | var r=el.getBoundingClientRect(); | ||
| 411 | var relativeTop=r.top-cardRect.top; | ||
| 412 | |||
| 413 | if( | ||
| 414 | relativeTop<45|| | ||
| 415 | relativeTop>cardRect.height*.72 | ||
| 416 | ){ | ||
| 417 | return; | ||
| |
5.8 | 418 | } |
| |
5.9 | 419 | |
| 420 | var widthRatio= | ||
| 421 | r.width/ | ||
| 422 | Math.max(1,cardRect.width); | ||
| 423 | |||
| 424 | if( | ||
| 425 | widthRatio<.55|| | ||
| 426 | widthRatio>1.05|| | ||
| 427 | r.height>54 | ||
| 428 | ){ | ||
| 429 | return; | ||
| |
5.8 | 430 | } |
| |
5.9 | 431 | |
| 432 | var text=normalizeText(el.textContent); | ||
| 433 | |||
| 434 | if( | ||
| 435 | text.length<2|| | ||
| 436 | text.length>90 | ||
| 437 | ){ | ||
| 438 | return; | ||
| 439 | } | ||
| 440 | |||
| 441 | var style=getComputedStyle(el); | ||
| 442 | |||
| 443 | var bg= | ||
| 444 | style.backgroundColor&& | ||
| 445 | style.backgroundColor!=="rgba(0, 0, 0, 0)"&& | ||
| 446 | style.backgroundColor!=="transparent"; | ||
| 447 | |||
| 448 | var border= | ||
| 449 | num(style.borderTopWidth)+ | ||
| 450 | num(style.borderRightWidth)+ | ||
| 451 | num(style.borderBottomWidth)+ | ||
| 452 | num(style.borderLeftWidth); | ||
| 453 | |||
| 454 | var mostlyUpper= | ||
| 455 | text.length>=3&& | ||
| 456 | text===text.toUpperCase(); | ||
| 457 | |||
| 458 | var exact=exactKnownFirstSection(el); | ||
| 459 | |||
| 460 | var score= | ||
| 461 | (exact?20:0)+ | ||
| 462 | (bg?6:0)+ | ||
| 463 | (border>=1?2:0)+ | ||
| 464 | (mostlyUpper?4:0)+ | ||
| 465 | (num(style.fontWeight)>=600?1:0); | ||
| 466 | |||
| 467 | if(score>=7){ | ||
| 468 | candidates.push({ | ||
| 469 | el:el, | ||
| 470 | relativeTop:relativeTop, | ||
| 471 | width:r.width, | ||
| 472 | score:score | ||
| 473 | }); | ||
| 474 | } | ||
| |
5.8 | 475 | }); |
| |
5.9 | 476 | |
| 477 | if(!candidates.length)return null; | ||
| 478 | |||
| 479 | candidates.sort(function(a,b){ | ||
| 480 | if(a.score!==b.score)return b.score-a.score; | ||
| 481 | if(Math.abs(a.relativeTop-b.relativeTop)>3){ | ||
| 482 | return a.relativeTop-b.relativeTop; | ||
| 483 | } | ||
| 484 | return b.width-a.width; | ||
| 485 | }); | ||
| 486 | |||
| 487 | // For exact known labels always prefer the earliest exact match. | ||
| 488 | var exacts=candidates.filter(function(c){ | ||
| 489 | return exactKnownFirstSection(c.el); | ||
| 490 | }); | ||
| 491 | |||
| 492 | if(exacts.length){ | ||
| 493 | exacts.sort(function(a,b){ | ||
| 494 | return a.relativeTop-b.relativeTop||b.width-a.width; | ||
| 495 | }); | ||
| 496 | return exacts[0].el; | ||
| 497 | } | ||
| 498 | |||
| 499 | // Generic fallback: earliest high-confidence bar. | ||
| 500 | candidates.sort(function(a,b){ | ||
| 501 | return a.relativeTop-b.relativeTop||b.score-a.score||b.width-a.width; | ||
| 502 | }); | ||
| 503 | |||
| 504 | return candidates[0].el; | ||
| |
5.8 | 505 | } |
| 506 | |||
| |
5.9 | 507 | function alignFirstSections(cards){ |
| 508 | var rows= | ||
| 509 | cards.map(function(card){ | ||
| 510 | var bar= | ||
| 511 | visuallyFirstSectionBar(card); | ||
| 512 | |||
| 513 | if(!bar)return null; | ||
| 514 | |||
| 515 | var cardRect= | ||
| 516 | card.getBoundingClientRect(); | ||
| 517 | |||
| 518 | var barRect= | ||
| 519 | bar.getBoundingClientRect(); | ||
| 520 | |||
| 521 | return { | ||
| 522 | card:card, | ||
| 523 | bar:bar, | ||
| 524 | relativeTop: | ||
| 525 | barRect.top-cardRect.top, | ||
| 526 | label: | ||
| 527 | normalizeText(bar.textContent) | ||
| 528 | }; | ||
| 529 | }); | ||
| 530 | |||
| 531 | // Conservative: only align when every card in the horizontal row | ||
| 532 | // has a reliable first section bar. | ||
| 533 | if( | ||
| 534 | rows.some(function(row){ | ||
| 535 | return !row; | ||
| 536 | }) | ||
| 537 | ){ | ||
| 538 | return null; | ||
| 539 | } | ||
| 540 | |||
| 541 | var targetTop= | ||
| 542 | Math.max.apply( | ||
| 543 | Math, | ||
| 544 | rows.map(function(row){ | ||
| 545 | return row.relativeTop; | ||
| 546 | }) | ||
| 547 | ); | ||
| 548 | |||
| 549 | rows.forEach(function(row){ | ||
| 550 | var delta= | ||
| 551 | targetTop- | ||
| 552 | row.relativeTop; | ||
| 553 | |||
| 554 | if(delta<=1)return; | ||
| 555 | |||
| 556 | saveOriginal( | ||
| 557 | row.bar, | ||
| 558 | originalMarginTop, | ||
| 559 | "margin-top" | ||
| 560 | ); | ||
| 561 | |||
| 562 | var currentMargin= | ||
| 563 | num( | ||
| 564 | getComputedStyle( | ||
| 565 | row.bar | ||
| 566 | ).marginTop | ||
| 567 | ); | ||
| 568 | |||
| 569 | row.bar.style.setProperty( | ||
| 570 | "margin-top", | ||
| 571 | ( | ||
| 572 | currentMargin+ | ||
| 573 | delta | ||
| 574 | )+"px" | ||
| 575 | ); | ||
| 576 | |||
| 577 | row.bar.setAttribute( | ||
| 578 | "data-sn-first-section-aligned", | ||
| 579 | "4" | ||
| 580 | ); | ||
| 581 | |||
| 582 | sectionManaged.add(row.bar); | ||
| 583 | }); | ||
| 584 | |||
| 585 | return { | ||
| 586 | labels: | ||
| 587 | rows.map(function(row){ | ||
| 588 | return row.label; | ||
| 589 | }), | ||
| 590 | targetRelativeTop: | ||
| 591 | Math.round(targetTop) | ||
| 592 | }; | ||
| 593 | } | ||
| 594 | |||
| 595 | function applyGroup(group){ | ||
| 596 | if(!validHorizontalGroup(group)){ | ||
| 597 | return null; | ||
| 598 | } | ||
| 599 | |||
| 600 | var cards=[]; | ||
| 601 | var seen=new Set(); | ||
| 602 | |||
| 603 | group.entries.forEach(function(entry){ | ||
| 604 | if(!seen.has(entry.target)){ | ||
| 605 | seen.add(entry.target); | ||
| 606 | cards.push(entry.target); | ||
| 607 | } | ||
| 608 | }); | ||
| 609 | |||
| 610 | if(cards.length<2)return null; | ||
| 611 | |||
| 612 | var firstSection= | ||
| 613 | alignFirstSections(cards); | ||
| 614 | |||
| 615 | // The section alignment can change natural card heights. | ||
| 616 | // Measure only afterwards. | ||
| 617 | var maxHeight=0; | ||
| 618 | |||
| 619 | cards.forEach(function(card){ | ||
| 620 | maxHeight=Math.max( | ||
| 621 | maxHeight, | ||
| 622 | card.getBoundingClientRect().height | ||
| 623 | ); | ||
| 624 | }); | ||
| 625 | |||
| 626 | maxHeight=Math.ceil(maxHeight); | ||
| 627 | |||
| 628 | if(maxHeight<MIN_H)return null; | ||
| 629 | |||
| 630 | cards.forEach(function(card){ | ||
| 631 | saveOriginal( | ||
| 632 | card, | ||
| 633 | originalMinHeight, | ||
| 634 | "min-height" | ||
| 635 | ); | ||
| 636 | |||
| 637 | card.style.setProperty( | ||
| 638 | "min-height", | ||
| 639 | maxHeight+"px" | ||
| 640 | ); | ||
| 641 | |||
| 642 | card.setAttribute( | ||
| 643 | "data-sn-equal-height-managed", | ||
| 644 | "4" | ||
| 645 | ); | ||
| 646 | |||
| 647 | heightManaged.add(card); | ||
| 648 | }); | ||
| 649 | |||
| 650 | return { | ||
| 651 | cards:cards.length, | ||
| 652 | height:maxHeight, | ||
| 653 | firstSection:firstSection | ||
| 654 | }; | ||
| 655 | } | ||
| 656 | |||
| |
5.8 | 657 | function run(){ |
| 658 | reset(); | ||
| 659 | |||
| |
5.9 | 660 | if( |
| 661 | window.innerWidth<=MOBILE_MAX | ||
| 662 | ){ | ||
| 663 | return; | ||
| 664 | } | ||
| |
5.8 | 665 | |
| |
5.9 | 666 | var parents= |
| 667 | Array.from( | ||
| 668 | root.querySelectorAll("*") | ||
| 669 | ).filter(function(parent){ | ||
| 670 | return ( | ||
| 671 | visible(parent,MIN_W,MIN_H)&& | ||
| 672 | parent.children&& | ||
| 673 | parent.children.length>=2&& | ||
| 674 | parent.children.length<=MAX_PARENT_CHILDREN | ||
| 675 | ); | ||
| 676 | }); | ||
| |
5.8 | 677 | |
| |
5.9 | 678 | var touched=new Set(); |
| 679 | |||
| |
5.8 | 680 | parents.forEach(function(parent){ |
| 681 | var entries=[]; | ||
| 682 | |||
| 683 | Array.from(parent.children).forEach(function(child){ | ||
| |
5.9 | 684 | if(!visible(child,MIN_W,MIN_H))return; |
| 685 | |||
| |
5.8 | 686 | var target=pickTarget(child); |
| 687 | if(!target)return; | ||
| |
5.9 | 688 | |
| |
5.8 | 689 | entries.push({ |
| 690 | target:target, | ||
| 691 | rect:target.getBoundingClientRect() | ||
| 692 | }); | ||
| 693 | }); | ||
| 694 | |||
| 695 | if(entries.length<2)return; | ||
| 696 | |||
| |
5.9 | 697 | groupsByVisualRow(entries).forEach(function(group){ |
| 698 | if(!validHorizontalGroup(group))return; | ||
| |
5.8 | 699 | |
| |
5.9 | 700 | var signature= |
| 701 | group.entries.map(function(entry){ | ||
| 702 | return entry.target; | ||
| 703 | }); | ||
| |
5.8 | 704 | |
| |
5.9 | 705 | if( |
| 706 | !signature.some(function(el){ | ||
| 707 | return !touched.has(el); | ||
| 708 | }) | ||
| 709 | ){ | ||
| 710 | return; | ||
| 711 | } | ||
| |
5.8 | 712 | |
| |
5.9 | 713 | var applied= |
| 714 | applyGroup(group); | ||
| |
5.8 | 715 | |
| |
5.9 | 716 | if(applied){ |
| 717 | signature.forEach(function(el){ | ||
| 718 | touched.add(el); | ||
| 719 | }); | ||
| 720 | } | ||
| |
5.8 | 721 | }); |
| 722 | }); | ||
| 723 | } | ||
| 724 | |||
| 725 | function schedule(){ | ||
| 726 | if(raf)cancelAnimationFrame(raf); | ||
| |
5.9 | 727 | |
| |
5.8 | 728 | raf=requestAnimationFrame(function(){ |
| 729 | raf=requestAnimationFrame(function(){ | ||
| 730 | raf=0; | ||
| 731 | run(); | ||
| 732 | }); | ||
| 733 | }); | ||
| 734 | } | ||
| 735 | |||
| 736 | addEventListener("resize",schedule,{passive:true}); | ||
| 737 | addEventListener("load",schedule,{once:true}); | ||
| 738 | |||
| |
5.9 | 739 | root.addEventListener( |
| 740 | "click", | ||
| 741 | function(){ | ||
| 742 | setTimeout(schedule,0); | ||
| 743 | }, | ||
| 744 | true | ||
| 745 | ); | ||
| |
5.8 | 746 | |
| |
5.9 | 747 | Array.from(root.querySelectorAll("img")).forEach(function(img){ |
| 748 | if(!img.complete){ | ||
| 749 | img.addEventListener("load",schedule,{once:true}); | ||
| 750 | } | ||
| 751 | }); | ||
| 752 | |||
| |
5.8 | 753 | if(document.fonts&&document.fonts.ready){ |
| 754 | document.fonts.ready.then(schedule); | ||
| 755 | } | ||
| 756 | |||
| 757 | schedule(); | ||
| |
5.9 | 758 | setTimeout(schedule,200); |
| 759 | setTimeout(schedule,650); | ||
| 760 | setTimeout(schedule,1400); | ||
| |
5.8 | 761 | })(); |
| 762 | </script> | ||
| 763 | <!-- SN_HORIZONTAL_BOX_HARMONIZER_END --> | ||
| 764 | {{/html}} | ||
| 765 |