All Downloads are FREE. Search and download functionalities are using the official Maven repository.

auto-code-ui.static.js.viewer.viewer.min.js Maven / Gradle / Ivy

There is a newer version: 1.0.8
Show newest version
/*!
 * Viewer.js v1.3.1
 * https://fengyuanchen.github.io/viewerjs
 *
 * Copyright 2015-present Chen Fengyuan
 * Released under the MIT license
 *
 * Date: 2018-12-09T07:48:29.436Z
 */
!function(t,i){"object"==typeof exports&&"undefined"!=typeof module?module.exports=i():"function"==typeof define&&define.amd?define(i):t.Viewer=i()}(this,function(){"use strict";function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function s(t,i){for(var e=0;e")}),i.innerHTML=h.join(""),this.items=i.getElementsByTagName("li"),nt(this.items,function(i){var t=i.firstElementChild;mt(t,"filled",!0),r.loading&&rt(i,v),vt(t,Y,function(t){r.loading&&ht(i,v),a.loadImage(t)},{once:!0})}),r.transition&&vt(t,V,function(){rt(i,E)},{once:!0})},renderList:function(t){var i=t||this.index,e=this.items[i].offsetWidth||30,n=e+1;at(this.list,st({width:n*this.length},wt({translateX:(this.viewerData.width-e)/2-n*i})))},resetList:function(){var t=this.list;t.innerHTML="",ht(t,E),at(t,wt({translateX:0}))},initImage:function(r){var t,h=this,l=this.options,i=this.image,e=this.viewerData,n=this.footer.offsetHeight,c=e.width,d=Math.max(e.height-n,n),u=this.imageData||{};this.imageInitializing={abort:function(){t.onload=null}},t=yt(i,function(t,i){var e=t/i,n=c,s=d;h.imageInitializing=!1,c=this.length||this.viewed&&t===this.index)return this;this.viewing&&this.viewing.abort();var i=this.element,n=this.options,s=this.title,o=this.canvas,a=this.items[t],r=a.querySelector("img"),h=ut(r,"originalUrl"),l=r.getAttribute("alt"),c=document.createElement("img");if(c.src=h,c.alt=l,et(n.view)&&vt(i,j,n.view,{once:!0}),!1===pt(i,j,{originalImage:this.images[t],index:t,image:c})||!this.isShown||this.hiding||this.played)return this;this.image=c,ht(this.items[this.index],m),rt(a,m),this.viewed=!1,this.index=t,this.imageData={},rt(c,z),n.loading&&rt(o,v),o.innerHTML="",o.appendChild(c),this.renderList(),s.innerHTML="";var d,u=function(){var t=e.imageData,i=Array.isArray(n.title)?n.title[1]:n.title;s.innerHTML=et(i)?i.call(e,c,t):"".concat(l," (").concat(t.naturalWidth," × ").concat(t.naturalHeight,")")};return vt(i,V,u,{once:!0}),this.viewing={abort:function(){gt(i,V,u),c.complete?this.imageRendering?this.imageRendering.abort():this.imageInitializing&&this.imageInitializing.abort():(gt(c,Y,d),this.timeout&&clearTimeout(this.timeout))}},c.complete?this.load():(vt(c,Y,d=this.load.bind(this),{once:!0}),this.timeout&&clearTimeout(this.timeout),this.timeout=setTimeout(function(){ht(c,z),e.timeout=!1},1e3)),this},prev:function(){var t=0Math.abs(r)&&(this.pointers={},1
';var n=e.querySelector(".".concat(p,"-container")),s=n.querySelector(".".concat(p,"-title")),o=n.querySelector(".".concat(p,"-toolbar")),a=n.querySelector(".".concat(p,"-navbar")),r=n.querySelector(".".concat(p,"-button")),l=n.querySelector(".".concat(p,"-canvas"));if(this.parent=i,this.viewer=n,this.title=s,this.toolbar=o,this.navbar=a,this.button=r,this.canvas=l,this.footer=n.querySelector(".".concat(p,"-footer")),this.tooltipBox=n.querySelector(".".concat(p,"-tooltip")),this.player=n.querySelector(".".concat(p,"-player")),this.list=n.querySelector(".".concat(p,"-list")),rt(s,h.title?xt(Array.isArray(h.title)?h.title[0]:h.title):k),rt(a,h.navbar?xt(h.navbar):k),lt(r,k,!h.button),h.backdrop&&(rt(n,"".concat(p,"-backdrop")),h.inline||"static"===h.backdrop||mt(l,K,"hide")),$(h.className)&&h.className&&h.className.split(U).forEach(function(t){rt(n,t)}),h.toolbar){var c=document.createElement("ul"),d=it(h.toolbar),u=Z.slice(0,3),m=Z.slice(7,9),f=Z.slice(9);d||rt(o,xt(h.toolbar)),nt(d?h.toolbar:Z,function(t,i){var e=d&&it(t),n=d?dt(i):t,s=e&&!J(t.show)?t.show:t;if(s&&(h.zoomable||-1===u.indexOf(n))&&(h.rotatable||-1===m.indexOf(n))&&(h.scalable||-1===f.indexOf(n))){var o=e&&!J(t.size)?t.size:t,a=e&&!J(t.click)?t.click:t,r=document.createElement("li");r.setAttribute("role","button"),rt(r,"".concat(p,"-").concat(n)),et(a)||mt(r,K,n),G(s)&&rt(r,xt(s)),-1!==["small","large"].indexOf(o)?rt(r,"".concat(p,"-").concat(o)):"play"===n&&rt(r,"".concat(p,"-large")),et(a)&&vt(r,S,a),c.appendChild(r)}}),o.appendChild(c)}else rt(o,k);if(!h.rotatable){var g=o.querySelectorAll('li[class*="rotate"]');rt(g,z),nt(g,function(t){o.appendChild(t)})}if(h.inline)rt(r,x),at(n,{zIndex:h.zIndexInline}),"static"===window.getComputedStyle(i).position&&at(i,{position:"relative"}),i.insertBefore(n,t.nextSibling);else{rt(r,w),rt(n,y),rt(n,b),rt(n,k),at(n,{zIndex:h.zIndex});var v=h.container;$(v)&&(v=t.ownerDocument.querySelector(v)),v||(v=this.body),v.appendChild(n)}h.inline&&(this.render(),this.bind(),this.isShown=!0),this.ready=!0,et(h.ready)&&vt(t,F,h.ready,{once:!0}),!1!==pt(t,F)?this.ready&&h.inline&&this.view(this.index):this.ready=!1}}}])&&s(t.prototype,i),n&&s(t,n),e}();return st(Ct.prototype,zt,Dt,Tt,It,Et),Ct});



© 2015 - 2024 Weber Informatics LLC | Privacy Policy