(function(){
'use strict';
const nggDribbbleThumbEffect=(typeof nggDribbbleLinks!=='undefined'&&nggDribbbleLinks.thumbEffect)
? nggDribbbleLinks.thumbEffect
: '';
function updateDribbbleLinks(){
const selectors=[
'a[data-dribbble-link]',
'.ngg-gallery-thumbnail a[data-dribbble-link]',
'.ngg-gallery a[data-dribbble-link]',
'.nextgen-gallery a[data-dribbble-link]'
];
const links=document.querySelectorAll(selectors.join(', '));
links.forEach((link)=> {
const dribbbleLink=link.getAttribute('data-dribbble-link');
const dribbbleTarget=link.getAttribute('data-dribbble-target');
if(dribbbleLink){
link.href=dribbbleLink;
if(dribbbleTarget==='_blank'){
link.target='_blank';
link.rel='noopener noreferrer';
}else{
link.removeAttribute('target');
link.removeAttribute('rel');
}
link.classList.remove('ngg-fancybox', 'ngg-simplelightbox', 'nextgen_pro_lightbox', 'shutter', 'shutterset');
link.removeAttribute('data-fancybox');
link.removeAttribute('data-lightbox');
link.removeAttribute('data-nplmodal');
link.removeAttribute('rel');
link.setAttribute('data-dribbble-direct', 'true');
if(!link.hasAttribute('data-dribbble-click-bound')){
link.setAttribute('data-dribbble-click-bound', 'true');
link.addEventListener('click', (e)=> {
e.stopPropagation();
if(link.target!=='_blank'){
e.preventDefault();
window.location.href=link.href;
}}, true);
}}
});
const noTitleLinks=document.querySelectorAll('a[data-ngg-dribbble="1"][data-dribbble-no-title="1"]');
noTitleLinks.forEach((a)=> {
a.removeAttribute('title');
const imgs=a.querySelectorAll('img');
imgs.forEach((img)=> {
img.removeAttribute('title');
});
});
const lightboxIsNone=(nggDribbbleThumbEffect==='none'||nggDribbbleThumbEffect==='');
const dribbbleAnchors=document.querySelectorAll('a[data-ngg-dribbble="1"]');
dribbbleAnchors.forEach((a)=> {
if(lightboxIsNone&&a.hasAttribute('data-dribbble-no-link')){
a.removeAttribute('href');
a.style.cursor='default';
if(!a.hasAttribute('data-dribbble-nolink-bound')){
a.setAttribute('data-dribbble-nolink-bound', 'true');
a.addEventListener('click', (e)=> {
e.preventDefault();
e.stopPropagation();
}, true);
}
return;
}
const href=a.getAttribute('href');
if(href&&href!=='#'&&href!==''){
return;
}
if(lightboxIsNone&&!a.classList.contains('use_imagebrowser_effect')){
return;
}
if(a.classList.contains('use_imagebrowser_effect')){
const stubUrl=a.getAttribute('data-imagebrowser-url');
if(stubUrl){
const stubId=a.getAttribute('data-image-slug')||a.getAttribute('data-image-id');
if(stubId){
a.setAttribute('href', stubUrl.replace('%STUB%', stubId));
return;
}}
}
const dataSrc=a.getAttribute('data-src');
if(dataSrc){
a.setAttribute('href', dataSrc);
}});
}
if(typeof jQuery!=='undefined'){
jQuery(document).ready(($)=> {
updateDribbbleLinks();
jQuery(document).on('refreshed', updateDribbbleLinks);
jQuery(document).on('ngg_lightbox_ready', updateDribbbleLinks);
jQuery(window).on('ngg.mosaic.complete', updateDribbbleLinks);
});
document.addEventListener('nextgen_page_refreshed', updateDribbbleLinks);
}else{
if(document.readyState==='loading'){
document.addEventListener('DOMContentLoaded', updateDribbbleLinks);
}else{
updateDribbbleLinks();
}
document.addEventListener('nextgen_page_refreshed', updateDribbbleLinks);
}})();