MediaWiki:Gadget-AbsyFancyBoxy.js: различия между версиями

Нет описания правки
Нет описания правки
Строка 93: Строка 93:
                 link: link,
                 link: link,
                 src: fullSrc,
                 src: fullSrc,
                 caption: getCaption( link, img )
                 caption: getCaption( link, img ),
                fileHref: link.getAttribute( 'href' ) || ''
             } );
             } );
         } );
         } );
Строка 107: Строка 108:
     var nextBtn = null;
     var nextBtn = null;
     var closeBtn = null;
     var closeBtn = null;
    var fileLink = null;
     var hideTimer = null;
     var hideTimer = null;


Строка 161: Строка 163:
         } );
         } );
         overlay.appendChild( closeBtn );
         overlay.appendChild( closeBtn );
        fileLink = document.createElement( 'a' );
        fileLink.id = 'absyfancyboxy-filelink';
        fileLink.textContent = 'оригинал';
        fileLink.setAttribute( 'role', 'link' );
        fileLink.setAttribute( 'tabindex', '0' );
        fileLink.setAttribute( 'target', '_blank' );
        fileLink.setAttribute( 'rel', 'noopener noreferrer' );
        fileLink.addEventListener( 'click', function ( e ) {
            e.stopPropagation();
        } );
        overlay.appendChild( fileLink );


         prevBtn = makeArrow( 'prev', '‹' );
         prevBtn = makeArrow( 'prev', '‹' );
Строка 252: Строка 266:
         captionElement.textContent = item.caption || '';
         captionElement.textContent = item.caption || '';
         counterElement.textContent = ( currentIndex + 1 ) + ' / ' + gallery.length;
         counterElement.textContent = ( currentIndex + 1 ) + ' / ' + gallery.length;
        if ( item.fileHref ) {
            fileLink.href = item.fileHref;
            fileLink.style.display = 'block';
        } else {
            fileLink.removeAttribute( 'href' );
            fileLink.style.display = 'none';
        }


         var multiple = gallery.length > 1;
         var multiple = gallery.length > 1;
Строка 283: Строка 305:
         captionElement.textContent = '';
         captionElement.textContent = '';
         counterElement.textContent = '';
         counterElement.textContent = '';
        fileLink.removeAttribute( 'href' );
         gallery = [];
         gallery = [];
         currentIndex = 0;
         currentIndex = 0;