TaoLer/public/view/common/blog/js/view-image.min.js

1 line
1.9 KiB
JavaScript
Raw Normal View History

2023-07-03 12:50:57 +08:00
(function(eFfDfMeTaEf){eFfDfMeTaEf.extend({viewImage:function(CcedBbRbVaO){var badZbHbJeAb=eFfDfMeTaEf.extend({target:".view-image img",exclude:"",delay:300},CcedBbRbVaO);eFfDfMeTaEf(badZbHbJeAb.exclude).attr("view-image",!1);eFfDfMeTaEf(badZbHbJeAb.target).off().on("click",function(CcedBbRbVaO){var LfffVfjhagb=CcedBbRbVaO.currentTarget.src,dgeCbMaG=CcedBbRbVaO.currentTarget.href,eFfDfMeTaEfeFfDfMeTaEf=".vi-"+Math.random().toString(36).substr(2);if(!eFfDfMeTaEf(this).attr("view-image")&&!eFfDfMeTaEf(this).is(badZbHbJeAb.exclude)&&(LfffVfjhagb||dgeCbMaG&&dgeCbMaG.match(/.+\.(jpg|jpeg|webp|gif|png)/gi)))return eFfDfMeTaEf("body").append("<style class='view-image-css'>.view-img{position:fixed;background:#fff;background:rgba(255,255,255,.92);width:100%;height:100%;top:0;left:0;text-align:center;padding:2%;z-index:999;cursor: zoom-out}.view-img img,.view-img span{max-width:100%;max-height:100%;position:relative;top:50%;transform: translateY(-50%);}.view-img img{animation:view-img-show .8s -0.1s ease-in-out}.view-img span{height:2em;color:#AAB2BD;overflow:hidden;position:absolute;top:50%;left:0;right:0;width:120px;text-align:center;margin:-1em auto;}.view-img span:after{content:'';position:absolute;bottom:0;left:0;transform: translateX(-100%);width:100%;height:2px;background:#3274ff;animation:view-img-load .8s -0.1s ease-in-out infinite;}@keyframes view-img-load{0%{transform: translateX(-100%);}100%{transform: translateX(100%);}}@keyframes view-img-show{0%{opacity:0;}100%{opacity:1;}}</style><div class='view-img'><span>loading...</span></div>"),setTimeout(function(){var CcedBbRbVaO=new Image;CcedBbRbVaO.src=LfffVfjhagb||dgeCbMaG;CcedBbRbVaO.onload=function(){eFfDfMeTaEf(".view-img").html('<img src="'+CcedBbRbVaO.src+'" alt="ViewImage">')};eFfDfMeTaEf(".view-img").off().on("click",function(){eFfDfMeTaEf(".view-image-css").remove();eFfDfMeTaEf(this).remove()});eFfDfMeTaEf(eFfDfMeTaEfeFfDfMeTaEf).html()},badZbHbJeAb.delay),!1})}})})(jQuery);