mirror of
https://github.com/squidfunk/mkdocs-material.git
synced 2024-11-23 23:21:00 +01:00
Documentation
This commit is contained in:
parent
86d3729a62
commit
09f817d154
@ -86,6 +86,8 @@ future holds!
|
|||||||
|
|
||||||
[sponsoring tiers]: sponsoring-tiers.md#commercial-use
|
[sponsoring tiers]: sponsoring-tiers.md#commercial-use
|
||||||
|
|
||||||
|
<div data-mdx-component="sponsorship"></div>
|
||||||
|
|
||||||
## Funding <span class="mdx-sponsorship-total" data-mdx-component="sponsorship-total"></span>
|
## Funding <span class="mdx-sponsorship-total" data-mdx-component="sponsorship-total"></span>
|
||||||
|
|
||||||
### Goals
|
### Goals
|
||||||
|
18
material/overrides/assets/javascripts/custom.058c863c.min.js
vendored
Normal file
18
material/overrides/assets/javascripts/custom.058c863c.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -23,5 +23,5 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
<script src="{{ 'assets/javascripts/custom.b457887c.min.js' | url }}"></script>
|
<script src="{{ 'assets/javascripts/custom.058c863c.min.js' | url }}"></script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -20,13 +20,13 @@
|
|||||||
* IN THE SOFTWARE.
|
* IN THE SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Observable, map } from "rxjs"
|
import { Observable, from, map, switchMap, tap } from "rxjs"
|
||||||
|
|
||||||
import { getElement, requestJSON } from "~/browser"
|
import { getOptionalElement, requestJSON } from "~/browser"
|
||||||
|
|
||||||
import { renderPrivateSponsor, renderPublicSponsor } from "_/templates"
|
import { renderPrivateSponsor, renderPublicSponsor } from "_/templates"
|
||||||
|
|
||||||
import { Component, getComponentElement } from "../_"
|
import { Component, getComponentElements } from "../_"
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------------
|
/* ----------------------------------------------------------------------------
|
||||||
* Types
|
* Types
|
||||||
@ -113,35 +113,46 @@ export function mountSponsorship(
|
|||||||
)
|
)
|
||||||
|
|
||||||
/* Retrieve adjacent components */
|
/* Retrieve adjacent components */
|
||||||
const count = getComponentElement("sponsorship-count")
|
const count = getComponentElements("sponsorship-count")
|
||||||
const total = getComponentElement("sponsorship-total")
|
const total = getComponentElements("sponsorship-total")
|
||||||
|
|
||||||
/* Render sponsorship */
|
/* Render sponsorship count */
|
||||||
sponsorship$.subscribe(sponsorship => {
|
sponsorship$.pipe(
|
||||||
el.removeAttribute("hidden")
|
switchMap(sponsorship => from(count).pipe(
|
||||||
|
tap(child => child.innerText = `${sponsorship.sponsors.length}`)
|
||||||
/* Render public sponsors with avatar and links */
|
|
||||||
const list = getElement(":scope > :first-child", el)
|
|
||||||
for (const sponsor of sponsorship.sponsors)
|
|
||||||
if (sponsor.type === "public")
|
|
||||||
list.appendChild(renderPublicSponsor(sponsor.user))
|
|
||||||
|
|
||||||
/* Render combined private sponsors */
|
|
||||||
list.appendChild(renderPrivateSponsor(
|
|
||||||
sponsorship.sponsors.filter(({ type }) => (
|
|
||||||
type === "private"
|
|
||||||
)).length
|
|
||||||
))
|
))
|
||||||
|
)
|
||||||
|
.subscribe(() => el.removeAttribute("hidden"))
|
||||||
|
|
||||||
/* Render sponsorship count and total */
|
/* Render sponsorship total */
|
||||||
count.innerText = `${sponsorship.sponsors.length}`
|
sponsorship$.pipe(
|
||||||
total.innerText = `$ ${sponsorship.total
|
switchMap(sponsorship => from(total).pipe(
|
||||||
.toString()
|
tap(child => child.innerText = `$ ${sponsorship.total
|
||||||
.replace(/\B(?=(\d{3})+(?!\d))/g, ",")
|
.toString()
|
||||||
} a month`
|
.replace(/\B(?=(\d{3})+(?!\d))/g, ",")
|
||||||
})
|
} a month`)
|
||||||
|
))
|
||||||
|
)
|
||||||
|
.subscribe()
|
||||||
|
|
||||||
// /* Create and return component */
|
// Render sponsorship list
|
||||||
|
const list = getOptionalElement(":scope > .mdx-sponsorship__list", el)
|
||||||
|
if (list && count.length) {
|
||||||
|
sponsorship$.subscribe(sponsorship => {
|
||||||
|
for (const sponsor of sponsorship.sponsors)
|
||||||
|
if (sponsor.type === "public")
|
||||||
|
list.appendChild(renderPublicSponsor(sponsor.user))
|
||||||
|
|
||||||
|
/* Render combined private sponsors */
|
||||||
|
list.appendChild(renderPrivateSponsor(
|
||||||
|
sponsorship.sponsors.filter(({ type }) => (
|
||||||
|
type === "private"
|
||||||
|
)).length
|
||||||
|
))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Create and return component */
|
||||||
return sponsorship$
|
return sponsorship$
|
||||||
.pipe(
|
.pipe(
|
||||||
map(state => ({ ref: el, ...state }))
|
map(state => ({ ref: el, ...state }))
|
||||||
|
Loading…
Reference in New Issue
Block a user