Library for creating custom image elements on Furaffinity
目前為
此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.cn-greasyfork.org/scripts/492931/1363921/Furaffinity-Submission-Image-Viewer.js
Library for creating image elements on Furaffinity. Also see this Script on Github as Furaffinity-Submission-Image-Viewer
@require this script
const baseElem = document.createElement("div");
const faImageViewer = new CustomImageViewer(imgSrc, prevSrc);
faImageViewer.load(baseElem);
faImageViewer.onImageLoad(() => doSomthing()); // occurs if the image is fully loaded
faImageViewer.onImageLoadStart(() => doSomthing()); // occurs if the image started loading
faImageViewer.onPreviewImageLoad(() => doSomthing()); // occurs if the preview image fully loaded
The CustomImageViewer class contains following Properties:
imageUrl - the image urlpreviewUrl - the preview image urlparentContainer - the parent container on which the image will be createdfaImage - the image elementfaImagePreview - the preview image elementonImageLoad - the callback for when the image is fully loadedonImageLoadStart - the callback for when the image starts loadingonPreviewImageLoad - the callback for when the preview image is fully loadedhasReset - if the image has been resetFunctions:
load() - starts loading the imagereset() - resets the image