generated from hbstack/template-mod
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6828f2b
Showing
23 changed files
with
4,498 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
ko_fi: razonyang | ||
custom: | ||
- https://paypal.me/razonyang |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: lint | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16 | ||
- run: npm ci | ||
- run: npm run lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
name: release-please | ||
|
||
jobs: | ||
release-please: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: google-github-actions/release-please-action@v3 | ||
with: | ||
release-type: go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
public/ | ||
resources/ | ||
.hugo_build.lock | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
pull_request_rules: | ||
- name: Automatic merge for Renovate pull requests | ||
conditions: | ||
- author=renovate[bot] | ||
actions: | ||
merge: | ||
method: rebase | ||
|
||
- name: Automatic merge on approval | ||
conditions: | ||
- "#approved-reviews-by>=1" | ||
actions: | ||
merge: | ||
method: rebase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"bracketSameLine": true, | ||
"goTemplateBracketSpacing": true, | ||
"overrides": [ | ||
{ | ||
"files": [ | ||
"*.html" | ||
], | ||
"options": { | ||
"parser": "go-template", | ||
"bracketSameLine": true | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
**/*.tmpl.scss |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"extends": "stylelint-config-standard-scss", | ||
"rules": { | ||
"at-rule-no-unknown": null, | ||
"color-function-notation": null, | ||
"scss/at-rule-no-unknown": true, | ||
"scss/at-extend-no-missing-placeholder": null | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 HB Framework Authors | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# HB Inline Frame Module | ||
|
||
[![Used By](https://img.shields.io/badge/dynamic/json?color=success&label=used+by&query=repositories_humanize&logo=hugo&style=flat-square&url=https://api.razonyang.com/v1/github/dependents/hbstack/iframe)](https://github.com/hbstack/iframe/network/dependents) | ||
![Hugo Requirements](https://img.shields.io/badge/dynamic/json?color=important&label=requirements&query=requirements&logo=hugo&style=flat-square&url=https://api.razonyang.com/v1/hugo/modules/github.com/hbstack/iframe) | ||
[![License](https://img.shields.io/github/license/hbstack/iframe?style=flat-square)](https://github.com/hbstack/iframe/blob/main/LICENSE) | ||
[![Version](https://img.shields.io/github/v/tag/hbstack/iframe?label=version&style=flat-square)](https://github.com/hbstack/iframe/tags) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
(() => { | ||
document.querySelectorAll('.hb-iframe-load-btn').forEach((btn) => { | ||
btn.addEventListener('click', () => { | ||
const parent = btn.parentElement as HTMLElement | ||
const iframe = parent.nextElementSibling as HTMLIFrameElement | ||
const btnFullscreen = parent.querySelector('.hb-iframe-fullscreen') as HTMLButtonElement | ||
const loadInfo = parent.querySelector('.hb-iframe-load-info') as HTMLElement | ||
iframe.setAttribute('src', iframe.getAttribute('data-src') ?? '') | ||
iframe.removeAttribute('data-src') | ||
iframe.addEventListener('load', () => { | ||
// show the fullscreen button if present. | ||
if (btnFullscreen != null) { | ||
btnFullscreen.classList.remove('d-none') | ||
} | ||
}) | ||
// hide the load button. | ||
btn.classList.add('d-none') | ||
// hide the load information. | ||
loadInfo.classList.add('d-none') | ||
}) | ||
}) | ||
|
||
document.querySelectorAll('.hb-iframe-fullscreen').forEach((btn) => { | ||
btn.addEventListener('click', () => { | ||
const wrapper = btn.closest('.hb-iframe-wrapper') as HTMLElement | ||
const iframe = wrapper.querySelector('.hb-iframe') as HTMLIFrameElement | ||
iframe.requestFullscreen().catch((err: Error) => { | ||
throw new Error('unable to fullscreen: ' + err.message) | ||
}) | ||
}) | ||
}) | ||
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.hb-iframe-load-btn, | ||
.hb-iframe-load-info, | ||
.hb-iframe-panel-bottom { | ||
z-index: 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module github.com/hbstack/iframe | ||
|
||
go 1.19 | ||
|
||
require ( | ||
github.com/gohugoio/hugo-mod-jslibs-dist/popperjs/v2 v2.21100.20000 // indirect | ||
github.com/hbstack/hb v0.5.0 // indirect | ||
github.com/hugomods/icons/vendors/bootstrap v0.5.0 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
github.com/gohugoio/hugo-mod-jslibs-dist/popperjs/v2 v2.21100.20000 h1:GZxx4Hc+yb0/t3/rau1j8XlAxLE4CyXns2fqQbyqWfs= | ||
github.com/gohugoio/hugo-mod-jslibs-dist/popperjs/v2 v2.21100.20000/go.mod h1:mFberT6ZtcchrsDtfvJM7aAH2bDKLdOnruUHl0hlapI= | ||
github.com/hbstack/hb v0.5.0 h1:5KopgFbczqA1PKcWS1X8YWMjMq698MlasTF8FxH5E4U= | ||
github.com/hbstack/hb v0.5.0/go.mod h1:37E1uTMQx1Hix+VdwlWkW74fi3ct5+KlCCBywv9l3Ac= | ||
github.com/hugomods/icons v0.6.0 h1:G6RU93okhPPRDh/jqcew9gwkcYpSpg0rCBv4S6yUAFw= | ||
github.com/hugomods/icons/vendors/bootstrap v0.5.0 h1:CHEGk677heq2kJZa7XsGHRc3Hwizl9NFkmNw146OVm0= | ||
github.com/hugomods/icons/vendors/bootstrap v0.5.0/go.mod h1:kfC17VWV+tNi6PGF4AY7CJBBa1/HEgWxCYq2kNOdcdI= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# [module.hugoVersion] | ||
# min = "0.111.3" | ||
|
||
[[module.imports]] | ||
path = "github.com/hbstack/hb" | ||
|
||
[[module.imports]] | ||
path = "github.com/hugomods/icons/vendors/bootstrap" | ||
|
||
# [params.hb.iframe] | ||
|
||
# [params.hugopress.modules.hb-iframe.hooks.body-end] | ||
# cacheable = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[hb_iframe_load] | ||
other = "Load" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[hb_iframe_load] | ||
other = "加載" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[hb_iframe_load] | ||
other = "加载" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{{- $src := "" }} | ||
{{- $manual := false }} | ||
{{- $lazyLoading := true }} | ||
{{- $loadButtonText := "hb_iframe_load" | i18n }} | ||
{{- $fullscreen := true }} | ||
{{- $loadInfo := "" }} | ||
{{- if .IsNamedParams }} | ||
{{- $src = .Get "src" }} | ||
{{- with .Get "trigger" }}{{ $manual = eq "manual" . }}{{ end }} | ||
{{- with .Get "fullscreen" }}{{ $fullscreen = . }}{{ end }} | ||
{{- with .Get "loadInfo" }}{{ $loadInfo = . }}{{ end }} | ||
{{- with .Get "lazyLoading" }}{{ $lazyLoading = . }}{{ end }} | ||
{{- with .Get "loadButtonText" }}{{ $loadButtonText = . }}{{ end }} | ||
{{- else }} | ||
{{- $src = .Get 0 }} | ||
{{- end }} | ||
<div class="hb-iframe-wrapper ratio ratio-16x9 my-2"> | ||
<div | ||
class="hb-iframe-panel d-flex flex-column align-items-center justify-content-center"> | ||
{{- if $manual }} | ||
<button class="hb-iframe-load-btn btn btn-primary"> | ||
{{- partial "icons/icon" (dict | ||
"vendor" "bootstrap" | ||
"name" "play-circle" | ||
"className" "me-1") | ||
}} | ||
{{- $loadButtonText -}} | ||
</button> | ||
{{- end }} | ||
{{- with $loadInfo }} | ||
<p class="hb-iframe-load-info text-secondary mt-3 px-2 text-center mb-0"> | ||
{{ . | markdownify }} | ||
</p> | ||
{{- end }} | ||
{{- if $fullscreen }} | ||
<div | ||
class="hb-iframe-panel-bottom position-absolute bottom-0 end-0 bg-dark opacity-75"> | ||
<a | ||
role="button" | ||
class="hb-iframe-fullscreen px-2 py-1 text-white{{ cond $manual ` d-none` `` }}" | ||
title="{{ i18n `button_fullscreen` }}"> | ||
{{- partial "icons/icon" (dict | ||
"vendor" "bootstrap" | ||
"name" "arrows-fullscreen") | ||
}} | ||
</a> | ||
</div> | ||
{{- end }} | ||
</div> | ||
<iframe | ||
class="hb-iframe bg-dark" | ||
allowfullscreen | ||
scrolling="no" | ||
{{ if $lazyLoading }}loading="lazy"{{ end }} | ||
{{ if $manual }} | ||
data-src="{{ $src }}" src="about:blank" | ||
{{ else }} | ||
src="{{ $src }}" | ||
{{ end }}> | ||
</iframe> | ||
</div> |
Oops, something went wrong.