Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- window.onresize = function(event) {
- $('.quick.box.emoticon .slider').css('max-width', $('.quick.box').outerWidth());
- };
- $(document).on('ready', function() {
- $('.quick.box.emoticon .slider').css('max-width', $('.quick.box').outerWidth());
- $.getJSON("https://supporto.forumfree.it/api.php?emoticons=2")
- .then(function(data){
- if( data.emoticons !== 'undefined' ) {
- $.each( data.emoticons, function(k,v) {
- $("#emoticonSlider").append('<div><img class="emoticon-append" data-code="'+ data.emoticons[k].typed +'" data-lazy="'+ data.emoticons[k].image +'" src="https://img.forumfree.net/index_file/load.gif"></div>');
- });
- $("#emoticonSlider").slick({
- dots: false,
- infinite: true,
- centerMode: false,
- slidesToShow: 5,
- slidesToScroll: 3,
- lazyLoad: 'ondemand',
- autoplay: false,
- autoplaySpeed: 3000,
- pauseOnHover: true,
- swipe: true,
- variableWidth: false,
- respondTo: 'min'
- });
- }
- });
- });
- $(document).on('click', '#emoticonSlider .slick-slide.slick-active', function() {
- emoticonClicked = $(this), img = $(this).find('.emoticon-append'), addr = img.attr('src'), type = img.attr('data-code');
- if ( typeof img.attr('data-lazy') !== 'undefined' ) {
- alert('Attendi il caricamento dell\'immagine!');
- } else {
- whereToAdd = false;
- $.each($('#content .elenco li'), function() {
- elementHandle = $(this);
- if( elementHandle.find('.bullet_delete').is(':hidden') || ( !elementHandle.find('.fs_remove') || elementHandle.find('.fs_remove').is(':hidden') ) ) {
- whereToAdd = elementHandle;
- return false;
- }
- });
- if( whereToAdd === false ) {
- alert('Hai raggiunto il numero massimo di emoticon.');
- } else {
- image = $(whereToAdd).find('input[name^="image"]');
- $(image).attr('value', addr);
- $(whereToAdd).find('input[name^="typed"]').attr('value', type);
- checkLink(image);
- $([document.documentElement, document.body]).animate({
- scrollTop: $(whereToAdd).offset().top
- }, 0);
- $('#content .elenco li').removeClass('added');
- $(whereToAdd).addClass('added');
- }
- }
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement