diff --git a/package.json b/package.json index 60ff884..c02fd6b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "imgzoom-li", - "version": "0.9.0", + "version": "0.9.1", "description": "一个可以查看图片(可以缩放,拖拽)的JS插件", "main": "./src/imgZoom.min.js", "keywords": [ diff --git a/src/imgZoom.js b/src/imgZoom.js index 88769c9..edf7a5c 100644 --- a/src/imgZoom.js +++ b/src/imgZoom.js @@ -1,111 +1,79 @@ /*! - * imgZoom JavaScript Library v0.9.0 + * imgZoom JavaScript Library v0.9.1 * Author: lixianbin1 * GitHub: https://github.com/lixianbin1/imgZoom - * Date: 2024-03-04 16:55 + * Date: 2024-03-06 09:11 */ "use strict"; -const iconBase64="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIkAAAA4CAYAAADJstsZAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgBCAQ5svCZwXFAADwA3l4fnSwP/wBr28AAgBw1S4kEsfh/4O6UCZXACCRAOAiEucLAZBSAMguVMgUAMgYALBTs2QKAJQAAGx5fEIiAKoNAOz0ST4FANipk9wXANiiHKkIAI0BAJkoRyQCQLsAYFWBUiwCwMIAoKxAIi4EwK4BgFm2MkcCgL0FAHaOWJAPQGAAgJlCLMwAIDgCAEMeE80DIEwDoDDSv+CpX3CFuEgBAMDLlc2XS9IzFLiV0Bp38vDg4iHiwmyxQmEXKRBmCeQinJebIxNI5wNMzgwAABr50cH+OD+Q5+bk4eZm52zv9MWi/mvwbyI+IfHf/ryMAgQAEE7P79pf5eXWA3DHAbB1v2upWwDaVgBo3/ldM9sJoFoK0Hr5i3k4/EAenqFQyDwdHAoLC+0lYq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iVhr4fia7/nM1m9uEKwKLaJD3m6lNC55XQR/WF6jqWEkdHR971NALxNbB1KQIJLXkS+PWbUkGZ7XfTNLuGj+HHzCAiMLPdm5jyxNUUkayp/MZPUgKMmdE0za6Pn1VmCMATO5NUoUa7DPQdV6wLQpqfHEJ5aZ3+029Mbq3uKvwlUaivbOF+sUuMnYQqXc5pBeIrPUKySUiG47rERSilxBme0m/LB/xJAFCXFqGh+zk5heTr3zL77m+33svt9554/wF44BJKceVmLCK1T/LiIYCdrg91rbstkNfOfZKY6Mu1ECH8ckVsbPZK6ENT8qL81fG7ArBTlxKFJWQIoRzNxtkm19bLuiS5gdx2jqk53nV+AIhCfnSkuN/QfRKFikShIlGoSBQqEoWKRKEiUahIFAoViUJFolCRKFQkChWJQkWiUJEoVCQKhYpEoSJRqEgUKhKFNNTqgvuD97NPbxagVwx6BAAE/rGD9jMBX895v7XHnh4fLD8H/Vr+8ORscNDp8cGk/xYwNn9ObtL5HZ6cAevvSgvB6is6h4xM4eSpFsBcP6UN0vmFCISutbA2uEbLV6i4DjGyb8S2jkkVcal5xnDM4EPyq4icolqA1t8qEGJkDoH05x7iGTJGgohPjw8ogy+DX9FpZ5lqU4HkKkNj8+YujwWBxhVFcbfAJQhEUh/VzxKuY5kRzKUuRSChJU9SJjFNqRRx1GhxhYosgfBQRnG9bF58hJYC20+SAqwTSL/UrPUpL+jyWXQm8RmnoglvTAX6aiWjPKdvby947yMAnPP+d3vgxtvyAmusKLh6EsnN6wXvfbAyC9+KSBTxPZx0ofhOFvnsppQyZ3hKal5jhMIliiR0CzvBVne0iHMLu4J5Srey/b7sSyowWodWuMRyMxaR2ie50YLA3VMa9pw32Kef75x3NzHRl2shQvjlitjY7JXQhxR7/pKfAgATGAxaLTeSo7CEDCGUI29+Ybctv03kpYjabeeYmqN0fgGZZPT6/wMA5x4qQokdjOoAAAAASUVORK5CYII=" -class ImgZoomLi { - Version = "0.9.0" - Title = "imgzoon-li" - Author = "lixianbin1" - //私有属性 - #cache={} //缓存图片 - #size={} //图片大小 - #CurrentImage //当前焦点 - #title = "滚动缩放图片" //标题 - #width = "auto" - #top = "50%" - #left = "50%" - #theme = "day" //主题 day or night +var iconBase64="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIkAAAA4CAYAAADJstsZAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgBCAQ5svCZwXFAADwA3l4fnSwP/wBr28AAgBw1S4kEsfh/4O6UCZXACCRAOAiEucLAZBSAMguVMgUAMgYALBTs2QKAJQAAGx5fEIiAKoNAOz0ST4FANipk9wXANiiHKkIAI0BAJkoRyQCQLsAYFWBUiwCwMIAoKxAIi4EwK4BgFm2MkcCgL0FAHaOWJAPQGAAgJlCLMwAIDgCAEMeE80DIEwDoDDSv+CpX3CFuEgBAMDLlc2XS9IzFLiV0Bp38vDg4iHiwmyxQmEXKRBmCeQinJebIxNI5wNMzgwAABr50cH+OD+Q5+bk4eZm52zv9MWi/mvwbyI+IfHf/ryMAgQAEE7P79pf5eXWA3DHAbB1v2upWwDaVgBo3/ldM9sJoFoK0Hr5i3k4/EAenqFQyDwdHAoLC+0lYqG9MOOLPv8z4W/gi372/EAe/tt68ABxmkCZrcCjg/1xYW52rlKO58sEQjFu9+cj/seFf/2OKdHiNLFcLBWK8ViJuFAiTcd5uVKRRCHJleIS6X8y8R+W/QmTdw0ArIZPwE62B7XLbMB+7gECiw5Y0nYAQH7zLYwaC5EAEGc0Mnn3AACTv/mPQCsBAM2XpOMAALzoGFyolBdMxggAAESggSqwQQcMwRSswA6cwR28wBcCYQZEQAwkwDwQQgbkgBwKoRiWQRlUwDrYBLWwAxqgEZrhELTBM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fOfZKY6Mu1ECH8ckVsbPZK6ENT8qL81fG7ArBTlxKFJWQIoRzNxtkm19bLuiS5gdx2jqk53nV+AIhCfnSkuN/QfRKFikShIlGoSBQqEoWKRKEiUahIFAoViUJFolCRKFQkChWJQkWiUJEoVCQKhYpEoSJRqEgUKhKFNNTqgvuD97NPbxagVwx6BAAE/rGD9jMBX895v7XHnh4fLD8H/Vr+8ORscNDp8cGk/xYwNn9ObtL5HZ6cAevvSgvB6is6h4xM4eSpFsBcP6UN0vmFCISutbA2uEbLV6i4DjGyb8S2jkkVcal5xnDM4EPyq4icolqA1t8qEGJkDoH05x7iGTJGgohPjw8ogy+DX9FpZ5lqU4HkKkNj8+YujwWBxhVFcbfAJQhEUh/VzxKuY5kRzKUuRSChJU9SJjFNqRRx1GhxhYosgfBQRnG9bF58hJYC20+SAqwTSL/UrPUpL+jyWXQm8RmnoglvTAX6aiWjPKdvby947yMAnPP+d3vgxtvyAmusKLh6EsnN6wXvfbAyC9+KSBTxPZx0ofhOFvnsppQyZ3hKal5jhMIliiR0CzvBVne0iHMLu4J5Srey/b7sSyowWodWuMRyMxaR2ie50YLA3VMa9pw32Kef75x3NzHRl2shQvjlitjY7JXQhxR7/pKfAgATGAxaLTeSo7CEDCGUI29+Ybctv03kpYjabeeYmqN0fgGZZPT6/wMA5x4qQokdjOoAAAAASUVORK5CYII=" +var Version = "0.9.1", + Title = "imgzoon-li", + Author = "lixianbin1", + //私有属性 + _cache={}, //缓存图片 + _size={}, //图片大小 + _CurrentImage, //当前焦点 + _title = "滚动缩放图片", //标题 + _width = "auto", + _top = "50%", + _left = "50%", + _theme = "day" //主题 day or night - constructor() { - if (!ImgZoomLi.imgZoom) { - ImgZoomLi.imgZoom = this; - } - return ImgZoomLi.imgZoom; - } - //图片转base64并缓存 - #imageToBase64(imgUrl, callback) { - if(!this.#cache[imgUrl]){ - var image = new Image(); - image.crossOrigin = 'Anonymous'; - image.onload = () => { +//图片转base64并缓存 +function imageToBase64(imgUrl, callback){ + if(!_cache[imgUrl]){ + var image = new Image(); + image.crossOrigin = 'Anonymous'; + image.onload = () => { var canvas = document.createElement('canvas'); canvas.width = image.naturalWidth; canvas.height = image.naturalHeight; var ctx = canvas.getContext('2d'); ctx.drawImage(image, 0, 0); var dataURL = canvas.toDataURL('image/png'); - this.#cache[image.src] = dataURL; - this.#size[image.src] = { - width:image.naturalWidth, - height:image.naturalHeight, + _cache[image.src] = dataURL; + _size[image.src] = { + width:image.naturalWidth, + height:image.naturalHeight, }; callback ? callback(dataURL) : ""; - }; - image.src = imgUrl; - image.onerror = () => { + }; + image.src = imgUrl; + image.onerror = () => { callback ? callback('无法访问图片') : ""; - }; + }; } - } - //图片加载缓存 - #imgLoad=()=>{ +} + +//图片加载缓存 +function imgLoad(){ const images = document.querySelectorAll('img.imgZoom'); - if(!this.#CurrentImage){ - this.#CurrentImage = images[0] + if(!_CurrentImage){ + _CurrentImage = images[0] } images.forEach(img => { - const imgSrc= img.src - if (imgSrc) { - this.#imageToBase64(imgSrc) - } - const dataSrc = img.getAttribute('data-src'); - if (dataSrc) { - this.#imageToBase64(dataSrc) - const largeImage = new Image(); - largeImage.src = dataSrc; - largeImage.onload = () => { - img.src = largeImage.src; - }; - } - }); - } - - //初始化函数 - #start() { - this.#create() - this.#bing() - document.addEventListener('click',(event)=>{ - var even = event - var target = even.target - console.log(even) - if (target.nodeName == "IMG" && this.#inStr(target.className, 'imgZoom')) { - this.Open(target); - } - if (this.#inStr(target.className, 'imgzoom_shadow') || this.#inStr(target.className, 'imgzoom_close')) { - this.Close(); - } - if (this.#inStr(target.className, 'imgzoom_resize')) { - this.resize(event); - } - if (this.#inStr(target.className, 'imgzoom_check')) { - this.ThemeSwitch(null,event); - } - if (this.#inStr(target.className, 'imgzoom_imglink')) { - this.targetImg(event); - } + const imgSrc= img.src + if (imgSrc) { + imageToBase64(imgSrc) + } + const dataSrc = img.getAttribute('data-src'); + if (dataSrc) { + imageToBase64(dataSrc) + const largeImage = new Image(); + largeImage.src = dataSrc; + largeImage.onload = () => { + img.src = largeImage.src; + }; + } }); - } +} - //创建函数 - #create() { - var imgwidth = this.#width, - imgtitle = this.#title, - imgleft = this.#left, - imgtop = this.#top; +//创建函数 +function create(){ + var imgwidth = _width, + imgtitle = _title, + imgleft = _left, + imgtop = _top; if (imgwidth == "auto") { imgwidth = 1000; } @@ -140,268 +108,305 @@ class ImgZoomLi {
`; - } +} - //判断class字符串是否存在imgzoom - #inStr(str, string) { - var isin = false; - var arr = str.split(' '); - for (var i in arr) { - if (arr[i] == string) { - isin = true; +//前进后退 +function lastnext(type) { + let dom = document.getElementById('_imgzoom').getElementsByClassName(type)[0]; + dom.addEventListener('mousemove', function () { + dom.getElementsByTagName('p')[0].style.display = "block"; + }); + dom.addEventListener('mouseout', function () { + dom.getElementsByTagName('p')[0].style.display = "none"; + }); + dom.addEventListener('mousedown', function (event) { + event.stopPropagation(); + }); + dom.addEventListener('click',()=>{ + let newImg=undefined + let imgList = document.getElementsByClassName('imgZoom'); + for (let i = 0; i < imgList.length; i++) { + if (type == 'next') { + if(imgList[i]===_CurrentImage && i < imgList.length - 1){ + newImg=imgList[i+1] + }else if(imgList[i]===_CurrentImage && i === imgList.length - 1){ + newImg=imgList[0] + } + }else{ + if(imgList[i]===_CurrentImage && i > 0){ + newImg=imgList[i-1] + }else if(imgList[i]===_CurrentImage && i === 0){ + newImg=imgList[imgList.length - 1] + } } - } - return isin; - } - - //前进后退 - lastnext(type) { - let dom = document.getElementById('_imgzoom').getElementsByClassName(type)[0]; - dom.addEventListener('mousemove', function () { - dom.getElementsByTagName('p')[0].style.display = "block"; - }); - dom.addEventListener('mouseout', function () { - dom.getElementsByTagName('p')[0].style.display = "none"; - }); - dom.addEventListener('mousedown', function (event) { - event.stopPropagation(); - }); - dom.addEventListener('click',()=>{ - let newImg=undefined - let imgList = document.getElementsByClassName('imgZoom'); - for (let i = 0; i < imgList.length; i++) { - if (type == 'next') { - if(imgList[i]===this.#CurrentImage && i < imgList.length - 1){ - newImg=imgList[i+1] - }else if(imgList[i]===this.#CurrentImage && i === imgList.length - 1){ - newImg=imgList[0] - } + if (newImg) { + _CurrentImage = newImg + let imgTitle + if(_CurrentImage?.alt){ + imgTitle = _CurrentImage.alt }else{ - if(imgList[i]===this.#CurrentImage && i > 0){ - newImg=imgList[i-1] - }else if(imgList[i]===this.#CurrentImage && i === 0){ - newImg=imgList[imgList.length - 1] - } + imgTitle = _title } - if (newImg) { - this.#CurrentImage = newImg - let imgTitle - if(this.#CurrentImage?.alt){ - imgTitle = this.#CurrentImage.alt - }else{ - imgTitle = this.#title - } - let Base64 = this.#CurrentImage?.src - if(this.#cache[newImg.src]){ - Base64 = this.#cache[newImg.src] - } - document.getElementById('net').src = Base64; - this.SetTitle(imgTitle) - break; + let Base64 = _CurrentImage?.src + if(_cache[newImg.src]){ + Base64 = _cache[newImg.src] } + document.getElementById('net').src = Base64; + SetTitle(imgTitle) + break; } - }); - } + } + }); +} - //滚轮事件 - mouseWheel() { - var dom = document.getElementById('_imgzoom'); - dom.addEventListener('mousewheel',(event)=>{ - event.preventDefault(); - this.Detail(event, dom); - }); - dom.addEventListener('DOMMouseScroll',(event)=>{ - event.preventDefault(); - this.Detail(event, dom); - }); - } +//滚轮事件 +function mouseWheel() { + var dom = document.getElementById('_imgzoom'); + dom.addEventListener('mousewheel',(event)=>{ + event.preventDefault(); + Detail(event, dom); + }); + dom.addEventListener('DOMMouseScroll',(event)=>{ + event.preventDefault(); + Detail(event, dom); + }); +} - //放大缩小 - Detail(e, dom) { - e = e || window.event; - if (e.wheelDelta < 0) { - var w = Math.round(dom.offsetWidth * 0.9); - var h = Math.round(dom.offsetHeight * 0.9); - if (w > 360 || h > 270) { - dom.style.width = w + 'px'; - } - } else { - var _w = Math.round(dom.offsetWidth * 1.1); - var _h = Math.round(dom.offsetHeight * 1.1); - if (_w < 82500 || _h < 46500) { - dom.style.width = _w + 'px'; - } +//放大缩小 +function Detail(e, dom) { + e = e || window.event; + if (e.wheelDelta < 0) { + var w = Math.round(dom.offsetWidth * 0.9); + var h = Math.round(dom.offsetHeight * 0.9); + if (w > 360 || h > 270) { + dom.style.width = w + 'px'; } - } - - //移动事件 - imgMove() { - var dom = document.getElementById('_imgzoom'); - var screenX, screenY; - dom.addEventListener('mousedown', function (e) { - e.preventDefault(); - screenX = e.screenX; - screenY = e.screenY; - window.addEventListener('mousemove', position); - }); - window.addEventListener('mouseup', function () { - window.removeEventListener('mousemove', position); - }); - function position(e) { - var x = e.screenX - screenX; - var y = e.screenY - screenY; - screenX = e.screenX; - screenY = e.screenY; - var top = dom.offsetTop; - var left = dom.offsetLeft; - dom.style.top = top + y + 'px'; - dom.style.left = left + x + 'px'; + } else { + var _w = Math.round(dom.offsetWidth * 1.1); + var _h = Math.round(dom.offsetHeight * 1.1); + if (_w < 82500 || _h < 46500) { + dom.style.width = _w + 'px'; } } - //设置标题 - SetTitle(title){ - try{ - var p = document.querySelector("p._imgzoom_title") - p.firstChild.nodeValue=title - }catch(err){ - console.log(err) - } +} + +//移动事件 +function imgMove() { + var dom = document.getElementById('_imgzoom'); + var screenX, screenY; + dom.addEventListener('mousedown', function (e) { + e.preventDefault(); + screenX = e.screenX; + screenY = e.screenY; + window.addEventListener('mousemove', position); + }); + window.addEventListener('mouseup', function () { + window.removeEventListener('mousemove', position); + }); + function position(e) { + var x = e.screenX - screenX; + var y = e.screenY - screenY; + screenX = e.screenX; + screenY = e.screenY; + var top = dom.offsetTop; + var left = dom.offsetLeft; + dom.style.top = top + y + 'px'; + dom.style.left = left + x + 'px'; } - //绑定事件 - #bing() { - this.lastnext('last'); - this.lastnext('next'); - this.mouseWheel(); - this.imgMove(); - } - //打开窗口 - Open(event) { - let imgBox = document.getElementById('_imgzoom'); - let imgList = document.getElementsByClassName('imgZoom'); - this.#CurrentImage = event - let imgTitle - if(this.#CurrentImage?.alt){ - imgTitle = this.#CurrentImage.alt - }else{ - imgTitle = this.#title +} + +//绑定事件 +function bing(){ + lastnext('last'); + lastnext('next'); + mouseWheel(); + imgMove(); +} + +//判断class字符串是否存在imgzoom +function inStr(str, string) { + var isin = false; + var arr = str.split(' '); + for (var i in arr) { + if (arr[i] == string) { + isin = true; } - if (event && event.src) { - if (imgBox && imgList.length > 0) { - var img = document.getElementById('net'); - if(this.#cache[event.src]){ - img.src = this.#cache[event.src] - }else{ - img.src = event.src; - this.#imgLoad() - } + } + return isin; +} + +//打开窗口 +function Open(event) { + let imgBox = document.getElementById('_imgzoom'); + let imgList = document.getElementsByClassName('imgZoom'); + _CurrentImage = event + let imgTitle + if(_CurrentImage?.alt){ + imgTitle = _CurrentImage.alt + }else{ + imgTitle = _title + } + if (event && event.src) { + if (imgBox && imgList.length > 0) { + var img = document.getElementById('net'); + if(_cache[event.src]){ + img.src = _cache[event.src] + }else{ + img.src = event.src; + imgLoad() } - imgBox.style.top = this.#top; - imgBox.style.left = this.#left; - imgBox.style.width = this.#width + 'px'; - this.SetTitle(imgTitle) - this.resize(event) - imgBox.parentElement.style.display = "block"; - } else if(imgList.length > 0){ - this.Open(imgList[0]) - } else { - console.error('F02: Missing parameters "src"'); } - } + imgBox.style.top = _top; + imgBox.style.left = _left; + imgBox.style.width = _width + 'px'; + SetTitle(imgTitle) + Resize(event) + imgBox.parentElement.style.display = "block"; + } else if(imgList.length > 0){ + Open(imgList[0]) + } else { + console.error('F02: Missing parameters "src"'); + } +} + //关闭窗口 - Close() { - var _imgzoom = document.getElementById('_imgzoom'); - if (_imgzoom) { - _imgzoom.parentElement.style.display = "none"; - } +function Close() { + var _imgzoom = document.getElementById('_imgzoom'); + if (_imgzoom) { + _imgzoom.parentElement.style.display = "none"; } +} + //优化显示:调整大小 - resize(event) { - const size =(w,h)=>{ - let x = window.innerWidth / window.innerHeight; - let y = w / h; - if (x >= y) { - let num = (window.innerHeight - 350) * y; - dom.style.width = num + 'px'; - } else { - dom.style.width = window.innerWidth - 200 + 'px'; - } - } - if(event){ - event.preventDefault ? event.preventDefault() : event.returnValue = false; +function Resize(event) { + const size =(w,h)=>{ + let x = window.innerWidth / window.innerHeight; + let y = w / h; + if (x >= y) { + let num = (window.innerHeight - 350) * y; + dom.style.width = num + 'px'; + } else { + dom.style.width = window.innerWidth - 200 + 'px'; } - let url = document.getElementById('net').src; - let dom = document.getElementById('_imgzoom'); - let key = this.#CurrentImage.src - if(this.#size[key]){ - size(this.#size[key].width,this.#size[key].height); - }else{ - console.log(555) - let img = new Image(); - img.src = url; - if (img.complete) { + } + if(event){ + event.preventDefault ? event.preventDefault() : event.returnValue = false; + } + let url = document.getElementById('net').src; + let dom = document.getElementById('_imgzoom'); + let key = _CurrentImage.src + if(_size[key]){ + size(_size[key].width,_size[key].height); + }else{ + console.log(555) + let img = new Image(); + img.src = url; + if (img.complete) { + size(img.width,img.height); + } else { + img.onload = function () { size(img.width,img.height); - } else { - img.onload = function () { - size(img.width,img.height); - }; - } - } - } - - //切换主题 - ThemeSwitch(type,event){ - if(event){ - event.preventDefault ? event.preventDefault() : event.returnValue = false; - } - type?this.#theme = type:"" - Array.from(document.getElementsByClassName("_imgzoom_box")).forEach((box) => { - box.style.backgroundColor = this.#theme == "day" ? "black" : "white"; - }); - Array.from(document.getElementsByClassName("_imgzoom_title")).forEach((title) => { - title.style.color = this.#theme == "day" ? "white" : "black"; - }); - if(this.#theme == "night"){ - this.#theme = "day" - }else{ - this.#theme = "night" + }; } } +} - //打开图片 - targetImg=(event)=>{ - if(event){ - event.preventDefault ? event.preventDefault() : event.returnValue = false; - } - if(this.#CurrentImage){ - window.open(this.#CurrentImage?.src) - }else{ - console.error(`F01: Imgzoom is not initialized, please execute "imgZoom.init()"`) - } +//切换主题 +function ThemeSwitch(type,event){ + if(event){ + event.preventDefault ? event.preventDefault() : event.returnValue = false; } - SetOption(obj){ - obj?.width?this.#width=obj.width:""; - obj?.title?this.#title=obj.title:"" - obj?.top?this.#top=obj.top:"" - obj?.left?this.#left=obj.left:"" - obj?.theme?this.#theme=obj.theme:"" + type?_theme = type:"" + Array.from(document.getElementsByClassName("_imgzoom_box")).forEach((box) => { + box.style.backgroundColor = _theme == "day" ? "black" : "white"; + }); + Array.from(document.getElementsByClassName("_imgzoom_title")).forEach((title) => { + title.style.color = _theme == "day" ? "white" : "black"; + }); + if(_theme == "night"){ + _theme = "day" + }else{ + _theme = "night" } +} - //判断是否在手机模式 - isPE(){ - return /Android|webOS|iPhone|ipod|ipad|BlackBerry/i.test(navigator.userAgent); +//打开图片 +function targetImg(event){ + if(event){ + event.preventDefault ? event.preventDefault() : event.returnValue = false; + } + if(_CurrentImage){ + window.open(_CurrentImage?.src) + }else{ + console.error(`F01: Imgzoom is not initialized, please execute "imgZoom.init()"`) } +} - init(){ - this.#imgLoad() - this.#start(); - return Object.freeze({ - SetOption:(obj)=>{this.SetOption(obj)}, - SetTitle:(str)=>{this.SetTitle(str)}, - Open:(ele)=>{this.Open(ele)}, - Close:()=>{this.Close()}, - ThemeSwitch:(ele)=>{this.ThemeSwitch(ele)}, - }) +//设置配置 +function SetOption(obj){ + obj?.width?_width=obj.width:""; + obj?.title?_title=obj.title:"" + obj?.top?_top=obj.top:"" + obj?.left?_left=obj.left:"" + obj?.theme?_theme=obj.theme:"" +} + +//设置标题 +function SetTitle(title){ + try{ + var p = document.querySelector("p._imgzoom_title") + p.firstChild.nodeValue=title + }catch(err){ + console.log(err) } } -const imgZoom = new ImgZoomLi(); -export default imgZoom; \ No newline at end of file + +//判断是否在手机模式 +function isPE(){ + return /Android|webOS|iPhone|ipod|ipad|BlackBerry/i.test(navigator.userAgent); +} + +function start(){ + create() + bing() + document.addEventListener('click',(event)=>{ + var even = event + var target = even.target + if (target.nodeName == "IMG" && inStr(target.className, 'imgZoom')) { + Open(target); + } + if (inStr(target.className, 'imgzoom_shadow') || inStr(target.className, 'imgzoom_close')) { + Close(); + } + if (inStr(target.className, 'imgzoom_resize')) { + Resize(event); + } + if (inStr(target.className, 'imgzoom_check')) { + ThemeSwitch(null,event); + } + if (inStr(target.className, 'imgzoom_imglink')) { + targetImg(event); + } + }); + } + +var imgZoom = function(){ + return { + Version : "0.9.1", + Title : "imgzoon-li", + Author : "lixianbin1", + init: function(){ + imgLoad() + start() + return { + SetOption, + SetTitle, + Open, + Close, + ThemeSwitch, + }; + } + }; +}(); + +export default imgZoom \ No newline at end of file diff --git a/src/imgZoom.min.js b/src/imgZoom.min.js index 78f2d1f..97dca33 100644 --- a/src/imgZoom.min.js +++ b/src/imgZoom.min.js @@ -1,4 +1,4 @@ -"use strict";const iconBase64="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIkAAAA4CAYAAADJstsZAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgBCAQ5svCZwXFAADwA3l4fnSwP/wBr28AAgBw1S4kEsfh/4O6UCZXACCRAOAiEucLAZBSAMguVMgUAMgYALBTs2QKAJQAAGx5fEIiAKoNAOz0ST4FANipk9wXANiiHKkIAI0BAJkoRyQCQLsAYFWBUiwCwMIAoKxAIi4EwK4BgFm2MkcCgL0FAHaOWJAPQGAAgJlCLMwAIDgCAEMeE80DIEwDoDDSv+CpX3CFuEgBAMDLlc2XS9IzFLiV0Bp38vDg4iHiwmyxQmEXKRBmCeQinJebIxNI5wNMzgwAABr50cH+OD+Q5+bk4eZm52zv9MWi/mvwbyI+IfHf/ryMAgQAEE7P79pf5eXWA3DHAbB1v2upWwDaVgBo3/ldM9sJoFoK0Hr5i3k4/EAenqFQyDwdHAoLC+0lYqG9MOOLPv8z4W/gi372/EAe/tt68ABxmkCZrcCjg/1xYW52rlKO58sEQjFu9+cj/seFf/2OKdHiNLFcLBWK8ViJuFAiTcd5uVKRRCHJleIS6X8y8R+W/QmTdw0ArIZPwE62B7XLbMB+7gEC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PQdV6wLQpqfHEJ5aZ3+029Mbq3uKvwlUaivbOF+sUuMnYQqXc5pBeIrPUKySUiG47rERSilxBme0m/LB/xJAFCXFqGh+zk5heTr3zL77m+33svt9554/wF44BJKceVmLCK1T/LiIYCdrg91rbstkNfOfZKY6Mu1ECH8ckVsbPZK6ENT8qL81fG7ArBTlxKFJWQIoRzNxtkm19bLuiS5gdx2jqk53nV+AIhCfnSkuN/QfRKFikShIlGoSBQqEoWKRKEiUahIFAoViUJFolCRKFQkChWJQkWiUJEoVCQKhYpEoSJRqEgUKhKFNNTqgvuD97NPbxagVwx6BAAE/rGD9jMBX895v7XHnh4fLD8H/Vr+8ORscNDp8cGk/xYwNn9ObtL5HZ6cAevvSgvB6is6h4xM4eSpFsBcP6UN0vmFCISutbA2uEbLV6i4DjGyb8S2jkkVcal5xnDM4EPyq4icolqA1t8qEGJkDoH05x7iGTJGgohPjw8ogy+DX9FpZ5lqU4HkKkNj8+YujwWBxhVFcbfAJQhEUh/VzxKuY5kRzKUuRSChJU9SJjFNqRRx1GhxhYosgfBQRnG9bF58hJYC20+SAqwTSL/UrPUpL+jyWXQm8RmnoglvTAX6aiWjPKdvby947yMAnPP+d3vgxtvyAmusKLh6EsnN6wXvfbAyC9+KSBTxPZx0ofhOFvnsppQyZ3hKal5jhMIliiR0CzvBVne0iHMLu4J5Srey/b7sSyowWodWuMRyMxaR2ie50YLA3VMa9pw32Kef75x3NzHRl2shQvjlitjY7JXQhxR7/pKfAgATGAxaLTeSo7CEDCGUI29+Ybctv03kpYjabeeYmqN0fgGZZPT6/wMA5x4qQokdjOoAAAAASUVORK5CYII=";class ImgZoomLi{Version="0.9.0";Title="imgzoon-li";Author="lixianbin1";#cache={};#size={};#CurrentImage;#title="滚动缩放图片";#width="auto";#top="50%";#left="50%";#theme="day";constructor(){return ImgZoomLi.imgZoom||(ImgZoomLi.imgZoom=this),ImgZoomLi.imgZoom}#imageToBase64(e,t){var i;this.#cache[e]||((i=new Image).crossOrigin="Anonymous",i.onload=()=>{var e=document.createElement("canvas");e.width=i.naturalWidth,e.height=i.naturalHeight;e.getContext("2d").drawImage(i,0,0);e=e.toDataURL("image/png");this.#cache[i.src]=e,this.#size[i.src]={width:i.naturalWidth,height:i.naturalHeight},t&&t(e)},i.src=e,i.onerror=()=>{t&&t("无法访问图片")})}#imgLoad=()=>{var e=document.querySelectorAll("img.imgZoom");this.#CurrentImage||(this.#CurrentImage=e[0]),e.forEach(e=>{var t=e.src,t=(t&&this.#imageToBase64(t),e.getAttribute("data-src"));if(t){this.#imageToBase64(t);const i=new Image;i.src=t,i.onload=()=>{e.src=i.src}}})};#start(){this.#create(),this.#bing(),document.addEventListener("click",e=>{var t=e.target;console.log(e),"IMG"==t.nodeName&&this.#inStr(t.className,"imgZoom")&&this.Open(t),(this.#inStr(t.className,"imgzoom_shadow")||this.#inStr(t.className,"imgzoom_close"))&&this.Close(),this.#inStr(t.className,"imgzoom_resize")&&this.resize(e),this.#inStr(t.className,"imgzoom_check")&&this.ThemeSwitch(null,e),this.#inStr(t.className,"imgzoom_imglink")&&this.targetImg(e)})}#create(){var e=this.#width,t=this.#title,i=this.#left,o=this.#top,s=("auto"==e&&(e=1e3),document.getElementsByTagName("body")[0]),n=document.createElement("div");n.style.position="fixed",n.style.zIndex="9999",n.style.display="none",s.appendChild(n),n.innerHTML=` +"use strict";var _CurrentImage,iconBase64="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIkAAAA4CAYAAADJstsZAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgBCAQ5svCZwXFAADwA3l4fnSwP/wBr28AAgBw1S4kEsfh/4O6UCZXACCRAOAiEuc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58hJYC20+SAqwTSL/UrPUpL+jyWXQm8RmnoglvTAX6aiWjPKdvby947yMAnPP+d3vgxtvyAmusKLh6EsnN6wXvfbAyC9+KSBTxPZx0ofhOFvnsppQyZ3hKal5jhMIliiR0CzvBVne0iHMLu4J5Srey/b7sSyowWodWuMRyMxaR2ie50YLA3VMa9pw32Kef75x3NzHRl2shQvjlitjY7JXQhxR7/pKfAgATGAxaLTeSo7CEDCGUI29+Ybctv03kpYjabeeYmqN0fgGZZPT6/wMA5x4qQokdjOoAAAAASUVORK5CYII=",Version="0.9.1",Title="imgzoon-li",Author="lixianbin1",_cache={},_size={},_title="滚动缩放图片",_width="auto",_top="50%",_left="50%",_theme="day";function imageToBase64(e,t){var i;_cache[e]||((i=new Image).crossOrigin="Anonymous",i.onload=()=>{var e=document.createElement("canvas");e.width=i.naturalWidth,e.height=i.naturalHeight;e.getContext("2d").drawImage(i,0,0);e=e.toDataURL("image/png");_cache[i.src]=e,_size[i.src]={width:i.naturalWidth,height:i.naturalHeight},t&&t(e)},i.src=e,i.onerror=()=>{t&&t("无法访问图片")})}function imgLoad(){var e=document.querySelectorAll("img.imgZoom");_CurrentImage=_CurrentImage||e[0],e.forEach(e=>{var t=e.src,t=(t&&imageToBase64(t),e.getAttribute("data-src"));if(t){imageToBase64(t);const i=new Image;i.src=t,i.onload=()=>{e.src=i.src}}})}function create(){var e=_width,t=_title,i=_left,o=_top,n=("auto"==_width&&(e=1e3),document.getElementsByTagName("body")[0]),a=document.createElement("div");a.style.position="fixed",a.style.zIndex="9999",a.style.display="none",n.appendChild(a),a.innerHTML=`@@ -22,4 +22,4 @@