-
-
Save GodSaveEarth/bfb495e597e88425e52a06a172f2705a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="//cdn.jsdelivr.net/gh/ilyabirman/Likely/release/likely.js"></script> | |
<link rel="stylesheet" href="//cdn.jsdelivr.net/gh/ilyabirman/Likely/release/likely.css"> | |
<style> | |
.t746__imgwrapper { | |
/* спиннер на время загрузки */ | |
background: url(//cdnjs.cloudflare.com/ajax/libs/design-system/2.9.4/images/spinners/slds_spinner_brand.gif) no-repeat center; | |
} | |
.t-slds__caption__container { | |
text-align: center; /* центрует соцкнопки */ | |
} | |
.t-slds__arrow_container { | |
display:none; | |
} | |
.refresh_slide { | |
padding-bottom:10px; | |
text-align:center; | |
} | |
.refresh_slide>a { | |
text-decoration: underline!important; | |
background-color: white; | |
padding: 5px; | |
height:inherit; | |
} | |
.download_slide { | |
margin-right:30px; | |
background-color:hsla(0,0%,93%,.16); | |
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAABmJLR0QA/wD/AP+gvaeTAAAAmklEQVRIie3VMQrCMBhA4dRbdHJwcXDQxcXjl15CsIODoCAe4XNQNNKiaW0HsW8N/3tL8ieEvwGlJ0XqXNYi4GUwy5JmJ6mBroyBMTBgAFX0sDScx+xal7HG2Wcu2LQO3CMrnN7Ij1h2kkeROfYN8gMWX8mjyBTbSF5h1os8iuRuG7VE3qt8JIQQAoqEO5/K48cbalXUXv7vcgVrxBk4qc/QFAAAAABJRU5ErkJggg=='); | |
background-repeat: no-repeat; | |
background-position: center; | |
line-height: 28px; | |
font-size: 18px; | |
border-radius: 4px; | |
height: 32px; | |
} | |
.download_slide>a { | |
padding:0 14px; | |
} | |
</style> | |
<script> | |
function randSlide(recid){ | |
e = $('#rec' + recid) | |
l = e.find('.t-slds__item').length-1 | |
rnd = Math.floor(Math.random() * l) + 1 | |
// set random slide | |
t_slds_ActiveSlide(recid, rnd) | |
t_slds_UpdateImages(recid, rnd) | |
// for mobiles | |
e.find(".t-slds__items-wrapper").attr("data-slider-pos", rnd) | |
t_slds_updateSlider(recid) | |
// process lazy | |
'y' == window.lazy && t_lazyload_update() | |
// update likely link | |
meta = e.find('.t-slds__item[data-slide-index="' + rnd + '"]').find("meta") | |
url = meta.attr("content") | |
likely.initiate({url: url}) | |
$(".download_slide>a").attr("href", url) | |
} | |
// called one time before popup show | |
t_sldsInit_o = t_sldsInit | |
t_sldsInit = function(recid) { | |
t_sldsInit_o(recid) | |
$(".t-slds__caption__container").html('<div class="likely likely-light likely-big" data-title="Wow, look what i found!"><div class="download_slide"><a href="" target="_new"> </a></div><div class="facebook"></div><div class="vkontakte"></div><div class="twitter"></div><div class="telegram"></div></div>') | |
if ($(".refresh_slide").length === 0) { | |
$('<div class="refresh_slide"><a class="t-btn" href="#">Еще совет?</a></div>').insertBefore( ".t-slds__container" ) | |
.find("a").on("click", function(e){ | |
e.preventDefault(); | |
randSlide(recid); | |
}); | |
} | |
randSlide(recid) | |
} | |
// disable swipe | |
t_slds_initSliderSwipe = function(){} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment