mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
chore: add librarybot workflow for automated npm library updates (#726)
This commit is contained in:
@@ -23,11 +23,6 @@ jobs:
|
|||||||
comment_tag_name: HUGO_FIXIT_COMPONENTS
|
comment_tag_name: HUGO_FIXIT_COMPONENTS
|
||||||
readme_path: 'README.md,README.zh-cn.md'
|
readme_path: 'README.md,README.zh-cn.md'
|
||||||
template: "- [{$repo.name}]({$repo.html_url})\\\n {$repo.description}"
|
template: "- [{$repo.name}]({$repo.html_url})\\\n {$repo.description}"
|
||||||
# - name: Commit changes
|
|
||||||
# uses: stefanzweifel/git-auto-commit-action@v5
|
|
||||||
# with:
|
|
||||||
# commit_message: 'docs(readme): update hugo-fixit component list'
|
|
||||||
# commit_author: 'github-actions[bot] <github-actions[bot]@users.noreply.github.com>'
|
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
uses: peter-evans/create-pull-request@v8
|
uses: peter-evans/create-pull-request@v8
|
||||||
with:
|
with:
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
name: Update libraries from npm
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * 0'
|
||||||
|
workflow_dispatch:
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
jobs:
|
||||||
|
prepare:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
libraries: ${{ steps.list.outputs.libraries_json }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
- name: List libraries
|
||||||
|
id: list
|
||||||
|
uses: hugo-fixit/librarybot@v1
|
||||||
|
with:
|
||||||
|
mode: list
|
||||||
|
update:
|
||||||
|
needs: prepare
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
library: ${{ fromJson(needs.prepare.outputs.libraries) }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
- name: Update library
|
||||||
|
id: update
|
||||||
|
uses: hugo-fixit/librarybot@v1
|
||||||
|
with:
|
||||||
|
mode: update
|
||||||
|
library: ${{ matrix.library }}
|
||||||
|
- name: Create Pull Request
|
||||||
|
if: steps.update.outputs.changed == 'true'
|
||||||
|
uses: peter-evans/create-pull-request@v8
|
||||||
|
with:
|
||||||
|
title: 'chore(deps): bump ${{ steps.update.outputs.package }} from `${{ steps.update.outputs.from_version }}` to `${{ steps.update.outputs.to_version }}`'
|
||||||
|
commit-message: 'chore(deps): bump ${{ steps.update.outputs.package }} from `${{ steps.update.outputs.from_version }}` to `${{ steps.update.outputs.to_version }}`'
|
||||||
|
body: |
|
||||||
|
Automated update of `${{ steps.update.outputs.package }}` from `${{ steps.update.outputs.from_version }}` to `${{ steps.update.outputs.to_version }}`.
|
||||||
|
branch: ${{ steps.update.outputs.pr_branch }}
|
||||||
|
base: main
|
||||||
|
labels: dependencies
|
||||||
|
reviewers: Lruihao
|
||||||
@@ -21,8 +21,8 @@ libFiles:
|
|||||||
autocompleteJS: autocomplete.js@0.38.1/dist/autocomplete.min.js
|
autocompleteJS: autocomplete.js@0.38.1/dist/autocomplete.min.js
|
||||||
# cell-tooltip@0.3.1 https://github.com/Lruihao/cell-tooltip
|
# cell-tooltip@0.3.1 https://github.com/Lruihao/cell-tooltip
|
||||||
cellTooltipJS: cell-tooltip@0.3.1/dist/cell-tooltip.umd.js
|
cellTooltipJS: cell-tooltip@0.3.1/dist/cell-tooltip.umd.js
|
||||||
# cell-watermark@1.0.3 https://github.com/Lruihao/watermark
|
# cell-watermark@1.0.4 https://github.com/Lruihao/watermark
|
||||||
cellWatermarkJS: cell-watermark@1.0.3/src/watermark.min.js
|
cellWatermarkJS: cell-watermark@1.0.4/src/watermark.js
|
||||||
# cookieconsent@3.1.1 https://github.com/osano/cookieconsent
|
# cookieconsent@3.1.1 https://github.com/osano/cookieconsent
|
||||||
cookieconsentCSS: cookieconsent@3.1.1/build/cookieconsent.min.css
|
cookieconsentCSS: cookieconsent@3.1.1/build/cookieconsent.min.css
|
||||||
cookieconsentJS: cookieconsent@3.1.1/build/cookieconsent.min.js
|
cookieconsentJS: cookieconsent@3.1.1/build/cookieconsent.min.js
|
||||||
@@ -59,14 +59,14 @@ libFiles:
|
|||||||
metingJS: meting@2.0.1/dist/Meting.min.js
|
metingJS: meting@2.0.1/dist/Meting.min.js
|
||||||
# object-fit-images@3.2.4 https://github.com/fregante/object-fit-images
|
# object-fit-images@3.2.4 https://github.com/fregante/object-fit-images
|
||||||
objectFitImagesJS: object-fit-images@3.2.4/dist/ofi.min.js
|
objectFitImagesJS: object-fit-images@3.2.4/dist/ofi.min.js
|
||||||
# pangu.js@4.0.7 https://github.com/vinta/pangu.js
|
|
||||||
panguJS: pangu@4.0.7/dist/browser/pangu.min.js
|
|
||||||
# pace-js@1.2.4 https://github.com/CodeByZach/pace
|
# pace-js@1.2.4 https://github.com/CodeByZach/pace
|
||||||
paceJS: pace-js@1.2.4
|
paceJS: pace-js@1.2.4
|
||||||
|
# pangu.js@4.0.7 https://github.com/vinta/pangu.js
|
||||||
|
panguJS: pangu@4.0.7/dist/browser/pangu.min.js
|
||||||
# sharer.js@0.5.1 https://github.com/ellisonleao/sharer.js
|
# sharer.js@0.5.1 https://github.com/ellisonleao/sharer.js
|
||||||
sharerJS: sharer.js@0.5.1/sharer.min.js
|
sharerJS: sharer.js@0.5.1/sharer.min.js
|
||||||
# @github/tab-container-element@4.8.2 https://github.com/github/tab-container-element
|
# @github/tab-container-element@4.8.2 https://github.com/github/tab-container-element
|
||||||
tabContainerElementJS: '@github/tab-container-element@4.8.2/dist/index.min.js'
|
tabContainerElementJS: '@github/tab-container-element@4.8.2/dist/bundle.min.js'
|
||||||
# twemoji@14.0.2 https://github.com/twitter/twemoji
|
# twemoji@14.0.2 https://github.com/twitter/twemoji
|
||||||
twemojiJS: twemoji@14.0.2/dist/twemoji.min.js
|
twemojiJS: twemoji@14.0.2/dist/twemoji.min.js
|
||||||
# twikoo@1.7.3 https://github.com/imaegoo/twikoo
|
# twikoo@1.7.3 https://github.com/imaegoo/twikoo
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ libFiles:
|
|||||||
autocompleteJS: autocomplete.js@0.38.1/dist/autocomplete.min.js
|
autocompleteJS: autocomplete.js@0.38.1/dist/autocomplete.min.js
|
||||||
# cell-tooltip@0.3.1 https://github.com/Lruihao/cell-tooltip
|
# cell-tooltip@0.3.1 https://github.com/Lruihao/cell-tooltip
|
||||||
cellTooltipJS: cell-tooltip@0.3.1/dist/cell-tooltip.umd.js
|
cellTooltipJS: cell-tooltip@0.3.1/dist/cell-tooltip.umd.js
|
||||||
# cell-watermark@1.0.3 https://github.com/Lruihao/watermark
|
# cell-watermark@1.0.4 https://github.com/Lruihao/watermark
|
||||||
cellWatermarkJS: cell-watermark@1.0.3/src/watermark.min.js
|
cellWatermarkJS: cell-watermark@1.0.4/src/watermark.js
|
||||||
# cookieconsent@3.1.1 https://github.com/osano/cookieconsent
|
# cookieconsent@3.1.1 https://github.com/osano/cookieconsent
|
||||||
cookieconsentCSS: cookieconsent@3.1.1/build/cookieconsent.min.css
|
cookieconsentCSS: cookieconsent@3.1.1/build/cookieconsent.min.css
|
||||||
cookieconsentJS: cookieconsent@3.1.1/build/cookieconsent.min.js
|
cookieconsentJS: cookieconsent@3.1.1/build/cookieconsent.min.js
|
||||||
@@ -59,14 +59,14 @@ libFiles:
|
|||||||
metingJS: meting@2.0.1/dist/Meting.min.js
|
metingJS: meting@2.0.1/dist/Meting.min.js
|
||||||
# object-fit-images@3.2.4 https://github.com/fregante/object-fit-images
|
# object-fit-images@3.2.4 https://github.com/fregante/object-fit-images
|
||||||
objectFitImagesJS: object-fit-images@3.2.4/dist/ofi.min.js
|
objectFitImagesJS: object-fit-images@3.2.4/dist/ofi.min.js
|
||||||
# pangu.js@4.0.7 https://github.com/vinta/pangu.js
|
|
||||||
panguJS: pangu@4.0.7/dist/browser/pangu.min.js
|
|
||||||
# pace-js@1.2.4 https://github.com/CodeByZach/pace
|
# pace-js@1.2.4 https://github.com/CodeByZach/pace
|
||||||
paceJS: pace-js@1.2.4
|
paceJS: pace-js@1.2.4
|
||||||
|
# pangu.js@4.0.7 https://github.com/vinta/pangu.js
|
||||||
|
panguJS: pangu@4.0.7/dist/browser/pangu.min.js
|
||||||
# sharer.js@0.5.1 https://github.com/ellisonleao/sharer.js
|
# sharer.js@0.5.1 https://github.com/ellisonleao/sharer.js
|
||||||
sharerJS: sharer.js@0.5.1/sharer.min.js
|
sharerJS: sharer.js@0.5.1/sharer.min.js
|
||||||
# @github/tab-container-element@4.8.2 https://github.com/github/tab-container-element
|
# @github/tab-container-element@4.8.2 https://github.com/github/tab-container-element
|
||||||
tabContainerElementJS: '@github/tab-container-element@4.8.2/dist/index.js'
|
tabContainerElementJS: '@github/tab-container-element@4.8.2/dist/bundle.min.js'
|
||||||
# twemoji@14.0.2 https://github.com/twitter/twemoji
|
# twemoji@14.0.2 https://github.com/twitter/twemoji
|
||||||
twemojiJS: twemoji@14.0.2/dist/twemoji.min.js
|
twemojiJS: twemoji@14.0.2/dist/twemoji.min.js
|
||||||
# twikoo@1.7.3 https://github.com/imaegoo/twikoo
|
# twikoo@1.7.3 https://github.com/imaegoo/twikoo
|
||||||
|
|||||||
Vendored
-31
@@ -1,31 +0,0 @@
|
|||||||
algoliasearch@4.20.0 https://github.com/algolia/algoliasearch-client-javascript
|
|
||||||
animate.css@4.1.1 https://github.com/daneden/animate.css
|
|
||||||
aplayer@1.10.1 https://github.com/MoePlayer/APlayer
|
|
||||||
artalk@latest https://github.com/ArtalkJS/Artalk
|
|
||||||
autocomplete-js@0.38.1 https://github.com/algolia/autocomplete
|
|
||||||
cell-watermark@1.0.3 https://github.com/Lruihao/watermark
|
|
||||||
cookieconsent@3.1.1 https://github.com/osano/cookieconsent
|
|
||||||
crypto-js@4.2.0 https://github.com/brix/crypto-js
|
|
||||||
echarts@5.3.3 https://github.com/apache/echarts
|
|
||||||
TODO update emoji-data to 15.x
|
|
||||||
emoji-data@14.0.0 https://github.com/iamcal/emoji-data
|
|
||||||
fontawesome-free@6.7.1 https://github.com/FortAwesome/Font-Awesome
|
|
||||||
fusejs@6.6.2 https://github.com/krisk/fuse
|
|
||||||
gitalk@1.7.2 https://github.com/gitalk/gitalk
|
|
||||||
instant.page@5.2.0 https://github.com/instantpage/instant.page
|
|
||||||
katex@0.16.22 https://github.com/KaTeX/KaTeX
|
|
||||||
lightgallery@2.7.2 https://github.com/sachinchoolur/lightgallery
|
|
||||||
mapbox-gl@2.10.0 https://github.com/mapbox/mapbox-gl-js
|
|
||||||
meting@2.0.1 https://github.com/metowolf/MetingJS
|
|
||||||
normalize.css@8.0.1 https://github.com/necolas/normalize.css
|
|
||||||
object-fit-images@3.2.4 https://github.com/fregante/object-fit-images [archived]
|
|
||||||
pangu.js@4.0.7 https://github.com/vinta/pangu.js
|
|
||||||
sharer.js@0.5.1 https://github.com/ellisonleao/sharer.js
|
|
||||||
simple-icons@9.19.0 https://github.com/simple-icons/simple-icons
|
|
||||||
tab-container-element@4.8.2 https://github.com/github/tab-container-element
|
|
||||||
twemoji@14.0.2 https://github.com/twitter/twemoji
|
|
||||||
twikoo@1.7.3 https://github.com/imaegoo/twikoo
|
|
||||||
typeit@8.8.4 https://github.com/alexmacarthur/typeit
|
|
||||||
valine@1.5.2 https://github.com/xCss/Valine
|
|
||||||
waline@3.12.1 https://github.com/walinejs/waline
|
|
||||||
xxhash-wasm@1.0.2 https://github.com/jungomi/xxhash-wasm
|
|
||||||
+218
@@ -0,0 +1,218 @@
|
|||||||
|
/* global Watermark */
|
||||||
|
|
||||||
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
define([], () => factory());
|
||||||
|
} else if (typeof module === 'object' && module.exports) {
|
||||||
|
module.exports = factory();
|
||||||
|
} else {
|
||||||
|
root['Watermark'] = factory();
|
||||||
|
}
|
||||||
|
})(this, function () {
|
||||||
|
var _parentEle;
|
||||||
|
var _wmContainer;
|
||||||
|
var _wmObserver;
|
||||||
|
var _wmParentObserver;
|
||||||
|
var _resizeHandler;
|
||||||
|
var _windowsWidth = window.outerWidth;
|
||||||
|
var _windowsHeight = window.outerHeight;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create DOM of watermark's container
|
||||||
|
* @param {Watermark} watermark
|
||||||
|
*/
|
||||||
|
var _createContainer = function (watermark) {
|
||||||
|
watermark._container = document.createElement('div');
|
||||||
|
watermark._container.classList.add('cell-watermark-container');
|
||||||
|
watermark._container.style.cssText = 'display: block; pointer-events: none;';
|
||||||
|
watermark._container.setAttribute('aria-hidden', true);
|
||||||
|
_parentEle = document.querySelector(watermark.options.appendTo) || document.body;
|
||||||
|
_parentEle.appendChild(watermark._container);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create watermark's DOM
|
||||||
|
* @param {Watermark} watermark
|
||||||
|
* @param {Object} options
|
||||||
|
*/
|
||||||
|
var _createWatermark = function (watermark, options) {
|
||||||
|
options.rowSpacing = options.rowSpacing || 60;
|
||||||
|
options.colSpacing = options.colSpacing || 30;
|
||||||
|
options.width = options.width || 150;
|
||||||
|
options.height = options.height || 20;
|
||||||
|
let rows = parseInt(_windowsHeight / (options.height + options.rowSpacing));
|
||||||
|
let cols = parseInt(_windowsWidth / (options.width + options.colSpacing));
|
||||||
|
let offsetLeft = (_windowsWidth - options.width * cols - options.colSpacing * (cols - 1)) / 2;
|
||||||
|
let offsetTop = (_windowsHeight - options.height * rows - options.rowSpacing * (rows - 1)) / 2;
|
||||||
|
let watermarkBase = document.createElement('div');
|
||||||
|
watermarkBase.classList.add('cell-watermark');
|
||||||
|
watermarkBase.style.cssText =
|
||||||
|
'transform: rotate(15deg); opacity: 0.1; font-size: 0.85rem; text-align: center;' +
|
||||||
|
'position: fixed; user-select: none; word-break: break-all; overflow: hidden; z-index: 999999;';
|
||||||
|
for (let row = 0; row < rows; row++) {
|
||||||
|
let top = offsetTop + (options.rowSpacing + options.height) * row;
|
||||||
|
let tempCols = cols;
|
||||||
|
row % 2 !== 0 && tempCols++;
|
||||||
|
for (let col = 0; col < tempCols; col++) {
|
||||||
|
let left = offsetLeft + (options.colSpacing + options.width) * col;
|
||||||
|
tempCols !== cols && (left -= (options.colSpacing + options.width) / 2);
|
||||||
|
let watermarkEle = watermarkBase.cloneNode();
|
||||||
|
watermarkEle.style.cssText += `left: ${left}px; top: ${top}px; width: ${options.width}px; height: ${options.height}px`;
|
||||||
|
watermarkEle.style.transform = `rotate(${options.rotate}deg)`;
|
||||||
|
watermarkEle.style.opacity = options.opacity;
|
||||||
|
watermarkEle.style.fontSize = `${options.fontSize}rem`;
|
||||||
|
watermarkEle.style.fontFamily = options.fontFamily;
|
||||||
|
watermarkEle.innerHTML = options.content;
|
||||||
|
watermark._container.appendChild(watermarkEle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Backup for recover the watermark's container when the its DOM is removed
|
||||||
|
_wmContainer = watermark._container;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rerender watermark
|
||||||
|
* @param {Watermark} watermark
|
||||||
|
* @param {Object} options
|
||||||
|
*/
|
||||||
|
var _render = function (watermark, options) {
|
||||||
|
_wmObserver.disconnect();
|
||||||
|
watermark._container.innerHTML = '';
|
||||||
|
_createWatermark(watermark, options);
|
||||||
|
_wmObserver.observe(watermark._container, {
|
||||||
|
attributes: true,
|
||||||
|
childList: true,
|
||||||
|
characterData: true,
|
||||||
|
subtree: true
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Observe watermark and watermark's parentNode mutations
|
||||||
|
* @param {Watermark} watermark
|
||||||
|
*/
|
||||||
|
var _addObserve = function (watermark) {
|
||||||
|
// Observe watermark element and its child element
|
||||||
|
_wmObserver = new MutationObserver(function (mutations, observer) {
|
||||||
|
_render(watermark, watermark.options);
|
||||||
|
});
|
||||||
|
_wmObserver.observe(watermark._container, {
|
||||||
|
attributes: true,
|
||||||
|
childList: true,
|
||||||
|
characterData: true,
|
||||||
|
subtree: true
|
||||||
|
});
|
||||||
|
// Observe parent element, recreate if the element is deleted
|
||||||
|
_wmParentObserver = new MutationObserver(function (mutations) {
|
||||||
|
for (let m of mutations) {
|
||||||
|
if (
|
||||||
|
m.type === 'childList' &&
|
||||||
|
m.removedNodes.length > 0 &&
|
||||||
|
document.querySelectorAll('.cell-watermark-container').length === 0
|
||||||
|
) {
|
||||||
|
_parentEle.appendChild(_wmContainer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
_wmParentObserver.observe(watermark._container.parentNode, {
|
||||||
|
childList: true,
|
||||||
|
subtree: true
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Window's resize listener
|
||||||
|
* @param {Watermark} watermark
|
||||||
|
*/
|
||||||
|
var _addResizeListener = function (watermark) {
|
||||||
|
_resizeHandler = function () {
|
||||||
|
if (window.outerHeight !== _windowsHeight || window.outerWidth !== _windowsWidth) {
|
||||||
|
_windowsHeight = window.outerHeight;
|
||||||
|
_windowsWidth = window.outerWidth;
|
||||||
|
_render(watermark, watermark.options);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
window.addEventListener('resize', _resizeHandler);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor of Watermark
|
||||||
|
* @class Watermark
|
||||||
|
* @classdesc Create watermark for webpage and automatic adjust when windows resize.
|
||||||
|
* @param {Object} options
|
||||||
|
* @param {String} [options.content] watermark's text
|
||||||
|
* @param {String} [options.appendTo='body'] parent of watermark's container
|
||||||
|
* @param {Number} [options.width=150] watermark's width. unit: px
|
||||||
|
* @param {Number} [options.height=20] watermark's height. unit: px
|
||||||
|
* @param {Number} [options.rowSpacing=60] row spacing of watermarks. unit: px
|
||||||
|
* @param {Number} [options.colSpacing=30] col spacing of watermarks. unit: px
|
||||||
|
* @param {Number} [options.rotate=15] watermark's tangent angle. unit: deg
|
||||||
|
* @param {Number} [options.opacity=0.1] watermark's transparency
|
||||||
|
* @param {Number} [options.fontSize=0.85] watermark's fontSize. unit: rem
|
||||||
|
* @param {Number} [options.fontFamily='inherit'] watermark's fontFamily.
|
||||||
|
* @version 1.0.4
|
||||||
|
* @author Lruihao
|
||||||
|
*/
|
||||||
|
function Watermark(options = {}) {
|
||||||
|
var _proto = Watermark.prototype;
|
||||||
|
this.options = options;
|
||||||
|
_createContainer(this);
|
||||||
|
_createWatermark(this, this.options);
|
||||||
|
_addObserve(this);
|
||||||
|
_addResizeListener(this);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Upload watermark's text content
|
||||||
|
* @param {String} content watermark's text
|
||||||
|
* @name Watermark#upload
|
||||||
|
* @function
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
_proto.upload = function (content) {
|
||||||
|
if (!content) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_wmParentObserver.disconnect();
|
||||||
|
_wmObserver.disconnect();
|
||||||
|
this.options.content = content;
|
||||||
|
for (const watermark of this._container.querySelectorAll('.cell-watermark')) {
|
||||||
|
watermark.innerHTML = content;
|
||||||
|
}
|
||||||
|
_wmParentObserver.observe(this._container.parentNode, {
|
||||||
|
childList: true,
|
||||||
|
subtree: true
|
||||||
|
});
|
||||||
|
_wmObserver.observe(this._container, {
|
||||||
|
attributes: true,
|
||||||
|
childList: true,
|
||||||
|
characterData: true,
|
||||||
|
subtree: true
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Rerender watermark
|
||||||
|
* @param {Object} options see {@link Watermark|Constructor}
|
||||||
|
* @name Watermark#render
|
||||||
|
* @function
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
_proto.render = function (options = {}) {
|
||||||
|
_render(this, Object.assign(this.options, options));
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Force destroy watermark
|
||||||
|
* @name Watermark#destroy
|
||||||
|
* @function
|
||||||
|
* @since 1.0.0
|
||||||
|
*/
|
||||||
|
_proto.destroy = function () {
|
||||||
|
_wmObserver.disconnect();
|
||||||
|
_wmParentObserver.disconnect();
|
||||||
|
window.removeEventListener('resize', _resizeHandler);
|
||||||
|
this._container.parentNode.removeChild(this._container);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return Watermark;
|
||||||
|
});
|
||||||
-1
@@ -1 +0,0 @@
|
|||||||
(function(e,t){"function"==typeof define&&define.amd?define([],t()):"object"==typeof module&&module.exports?module.exports=t():e.Watermark=t()})(this,function(){function e(t={}){var n=e.prototype;this.options=t,s(this),d(this,this.options),h(this),p(this),n.upload=function(e){if(e){o.disconnect(),i.disconnect(),this.options.content=e;for(const t of this._container.querySelectorAll(".cell-watermark"))t.innerHTML=e;o.observe(this._container.parentNode,{childList:!0,subtree:!0}),i.observe(this._container,{attributes:!0,childList:!0,characterData:!0,subtree:!0})}},n.render=function(e={}){l(this,Object.assign(this.options,e))},n.destroy=function(){i.disconnect(),o.disconnect(),window.removeEventListener("resize",r),this._container.parentNode.removeChild(this._container)}}var t,n,i,o,r,c=window.outerWidth,a=window.outerHeight,s=function(e){e._container=document.createElement("div"),e._container.classList.add("cell-watermark-container"),e._container.style.cssText="display: block; pointer-events: none;",e._container.setAttribute("aria-hidden",!0),t=document.querySelector(e.options.appendTo)||document.body,t.appendChild(e._container)},d=function(e,t){t.rowSpacing=t.rowSpacing||60,t.colSpacing=t.colSpacing||30,t.width=t.width||150,t.height=t.height||20;let i=parseInt(a/(t.height+t.rowSpacing)),o=parseInt(c/(t.width+t.colSpacing)),r=(c-t.width*o-t.colSpacing*(o-1))/2,s=(a-t.height*i-t.rowSpacing*(i-1))/2,d=document.createElement("div");d.classList.add("cell-watermark"),d.style.cssText="transform: rotate(15deg); opacity: 0.1; font-size: 0.85rem; text-align: center;position: fixed; user-select: none; word-break: break-all; overflow: hidden; z-index: 999999;";for(let n=0;n<i;n++){let i=s+(t.rowSpacing+t.height)*n,c=o;n%2!=0&&c++;for(let n=0;n<c;n++){let a=r+(t.colSpacing+t.width)*n;c!==o&&(a-=(t.colSpacing+t.width)/2);let s=d.cloneNode();s.style.cssText+=`left: ${a}px; top: ${i}px; width: ${t.width}px; height: ${t.height}px`,s.style.transform=`rotate(${t.rotate}deg)`,s.style.opacity=t.opacity,s.style.fontSize=`${t.fontSize}rem`,s.style.fontFamily=t.fontFamily,s.innerHTML=t.content,e._container.appendChild(s)}}n=e._container},l=function(e,t){i.disconnect(),e._container.innerHTML="",d(e,t),i.observe(e._container,{attributes:!0,childList:!0,characterData:!0,subtree:!0})},h=function(e){i=new MutationObserver(function(t,n){l(e,e.options)}),i.observe(e._container,{attributes:!0,childList:!0,characterData:!0,subtree:!0}),o=new MutationObserver(function(e){for(let i of e)"childList"===i.type&&i.removedNodes.length>0&&0===document.querySelectorAll(".cell-watermark-container").length&&t.appendChild(n)}),o.observe(e._container.parentNode,{childList:!0,subtree:!0})},p=function(e){r=function(){window.outerHeight===a&&window.outerWidth===c||(a=window.outerHeight,c=window.outerWidth,l(e,e.options))},window.addEventListener("resize",r)};return e});
|
|
||||||
@@ -224,8 +224,8 @@ FixIt theme assets partial
|
|||||||
|
|
||||||
{{- /* Watermark */ -}}
|
{{- /* Watermark */ -}}
|
||||||
{{- if eq .Site.Params.watermark.enable true -}}
|
{{- if eq .Site.Params.watermark.enable true -}}
|
||||||
{{- $source := $cdn.cellWatermarkJS | default "lib/cell-watermark/watermark.min.js" -}}
|
{{- $source := $cdn.cellWatermarkJS | default "lib/cell-watermark/watermark.js" -}}
|
||||||
{{- dict "Source" $source "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
{{- dict "Source" $source "Minify" true "Fingerprint" $fingerprint "Defer" true | dict "Page" . "Data" | partial "store/script.html" -}}
|
||||||
{{- $watermarkConfig := .Site.Params.watermark | default dict -}}
|
{{- $watermarkConfig := .Site.Params.watermark | default dict -}}
|
||||||
{{- $watermarkConfig = dict
|
{{- $watermarkConfig = dict
|
||||||
"appendTo" ".widgets"
|
"appendTo" ".widgets"
|
||||||
|
|||||||
+191
@@ -0,0 +1,191 @@
|
|||||||
|
schemaVersion: 1
|
||||||
|
baseDir: assets/lib
|
||||||
|
libraries:
|
||||||
|
- npm: algoliasearch
|
||||||
|
version: 4.20.0
|
||||||
|
- npm: animate.css
|
||||||
|
version: 4.1.1
|
||||||
|
local:
|
||||||
|
items:
|
||||||
|
- from: animate.min.css
|
||||||
|
to: animate/animate.min.css
|
||||||
|
- npm: aplayer
|
||||||
|
version: 1.10.1
|
||||||
|
local:
|
||||||
|
items:
|
||||||
|
- from: dist/APlayer.min.css
|
||||||
|
to: aplayer/APlayer.min.css
|
||||||
|
- from: dist/APlayer.min.js
|
||||||
|
to: aplayer/APlayer.min.js
|
||||||
|
- npm: cell-tooltip
|
||||||
|
version: 0.3.1
|
||||||
|
local:
|
||||||
|
items:
|
||||||
|
- from: dist/cell-tooltip.umd.js
|
||||||
|
to: cell-tooltip/cell-tooltip.umd.js
|
||||||
|
- npm: cell-watermark
|
||||||
|
version: 1.0.4
|
||||||
|
local:
|
||||||
|
items:
|
||||||
|
- from: src/watermark.js
|
||||||
|
to: cell-watermark/watermark.js
|
||||||
|
- npm: cookieconsent
|
||||||
|
version: 3.1.1
|
||||||
|
local:
|
||||||
|
items:
|
||||||
|
- from: build/cookieconsent.min.css
|
||||||
|
to: cookieconsent/cookieconsent.min.css
|
||||||
|
- from: build/cookieconsent.min.js
|
||||||
|
to: cookieconsent/cookieconsent.min.js
|
||||||
|
- npm: crypto-js
|
||||||
|
version: 4.2.0
|
||||||
|
local:
|
||||||
|
items:
|
||||||
|
- from: core.js
|
||||||
|
to: crypto-js/core.js
|
||||||
|
- from: enc-base64.js
|
||||||
|
to: crypto-js/enc-base64.js
|
||||||
|
- from: sha256.js
|
||||||
|
to: crypto-js/sha256.js
|
||||||
|
- npm: echarts
|
||||||
|
version: 5.3.3
|
||||||
|
local:
|
||||||
|
items:
|
||||||
|
- from: dist/echarts.min.js
|
||||||
|
to: echarts/echarts.min.js
|
||||||
|
- npm: '@fortawesome/fontawesome-free'
|
||||||
|
version: 7.1.0
|
||||||
|
local:
|
||||||
|
items:
|
||||||
|
- from: css/all.min.css
|
||||||
|
to: fontawesome-free/all.min.css
|
||||||
|
- npm: fuse.js
|
||||||
|
version: 7.3.0
|
||||||
|
local:
|
||||||
|
items:
|
||||||
|
- from: dist/fuse.cjs
|
||||||
|
to: fuse/fuse.js
|
||||||
|
- npm: gitalk
|
||||||
|
version: 1.7.2
|
||||||
|
local:
|
||||||
|
items:
|
||||||
|
- from: dist/gitalk.css
|
||||||
|
to: gitalk/gitalk.css
|
||||||
|
- from: dist/gitalk.min.js
|
||||||
|
to: gitalk/gitalk.min.js
|
||||||
|
- npm: instant.page
|
||||||
|
version: 5.2.0
|
||||||
|
local:
|
||||||
|
items:
|
||||||
|
- from: instantpage.min.js
|
||||||
|
to: instant.page/instantpage.min.js
|
||||||
|
- npm: json-viewer-element
|
||||||
|
version: 1.0.4
|
||||||
|
local:
|
||||||
|
items:
|
||||||
|
- from: dist/json-viewer-element.umd.js
|
||||||
|
to: json-viewer-element/json-viewer-element.umd.js
|
||||||
|
- npm: katex
|
||||||
|
version: 0.16.22
|
||||||
|
local:
|
||||||
|
items:
|
||||||
|
- from: dist/contrib/copy-tex.min.js
|
||||||
|
to: katex/copy-tex.min.js
|
||||||
|
- from: dist/katex.min.css
|
||||||
|
to: katex/katex.min.css
|
||||||
|
- npm: lightgallery
|
||||||
|
version: 2.7.2
|
||||||
|
local:
|
||||||
|
items:
|
||||||
|
- from: css/lightgallery-bundle.min.css
|
||||||
|
to: lightgallery/css/lightgallery-bundle.min.css
|
||||||
|
- from: lightgallery.min.js
|
||||||
|
to: lightgallery/lightgallery.min.js
|
||||||
|
- from: plugins/thumbnail/lg-thumbnail.min.js
|
||||||
|
to: lightgallery/plugins/thumbnail/lg-thumbnail.min.js
|
||||||
|
- from: plugins/zoom/lg-zoom.min.js
|
||||||
|
to: lightgallery/lg-zoom.min.js
|
||||||
|
- npm: mapbox-gl
|
||||||
|
version: 2.10.0
|
||||||
|
local:
|
||||||
|
items:
|
||||||
|
- from: dist/mapbox-gl.css
|
||||||
|
to: mapbox-gl/mapbox-gl.css
|
||||||
|
- from: dist/mapbox-gl.js
|
||||||
|
to: mapbox-gl/mapbox-gl.js
|
||||||
|
- npm: meting
|
||||||
|
version: 2.0.1
|
||||||
|
local:
|
||||||
|
items:
|
||||||
|
- from: dist/Meting.min.js
|
||||||
|
to: meting/Meting.min.js
|
||||||
|
- npm: pace-js
|
||||||
|
version: 1.2.4
|
||||||
|
local:
|
||||||
|
items:
|
||||||
|
- from: pace.min.js
|
||||||
|
to: pace/pace.min.js
|
||||||
|
- npm: pangu
|
||||||
|
version: 4.0.7
|
||||||
|
local:
|
||||||
|
items:
|
||||||
|
- from: dist/browser/pangu.umd.js
|
||||||
|
to: pangu/pangu.umd.js
|
||||||
|
- npm: sharer.js
|
||||||
|
version: 0.5.1
|
||||||
|
local:
|
||||||
|
items:
|
||||||
|
- from: sharer.min.js
|
||||||
|
to: sharer/sharer.min.js
|
||||||
|
- npm: simple-icons
|
||||||
|
version: 9.19.0
|
||||||
|
local:
|
||||||
|
items:
|
||||||
|
- type: dir
|
||||||
|
from: icons
|
||||||
|
to: simple-icons/icons
|
||||||
|
clean: true
|
||||||
|
- npm: '@github/tab-container-element'
|
||||||
|
version: 4.8.2
|
||||||
|
local:
|
||||||
|
items:
|
||||||
|
- from: dist/bundle.min.js
|
||||||
|
to: tab-container-element/bundle.min.js
|
||||||
|
- npm: twemoji
|
||||||
|
version: 14.0.2
|
||||||
|
local:
|
||||||
|
items:
|
||||||
|
- from: dist/twemoji.min.js
|
||||||
|
to: twemoji/twemoji.min.js
|
||||||
|
- npm: twikoo
|
||||||
|
version: 1.7.3
|
||||||
|
local:
|
||||||
|
items:
|
||||||
|
- from: dist/twikoo.all.min.js
|
||||||
|
to: twikoo/twikoo.all.min.js
|
||||||
|
- npm: typeit
|
||||||
|
version: 8.8.4
|
||||||
|
local:
|
||||||
|
items:
|
||||||
|
- from: dist/index.umd.js
|
||||||
|
to: typeit/typeit.umd.js
|
||||||
|
- npm: valine
|
||||||
|
version: 1.5.2
|
||||||
|
local:
|
||||||
|
items:
|
||||||
|
- from: dist/Valine.min.js
|
||||||
|
to: valine/Valine.min.js
|
||||||
|
- npm: '@waline/client'
|
||||||
|
version: 3.12.1
|
||||||
|
local:
|
||||||
|
items:
|
||||||
|
- from: dist/waline.css
|
||||||
|
to: waline/waline.css
|
||||||
|
- from: dist/waline.umd.js
|
||||||
|
to: waline/waline.umd.js
|
||||||
|
- npm: xxhash-wasm
|
||||||
|
version: 1.0.2
|
||||||
|
local:
|
||||||
|
items:
|
||||||
|
- from: umd/xxhash-wasm.js
|
||||||
|
to: xxhash-wasm/xxhash-wasm.js
|
||||||
Reference in New Issue
Block a user