Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2020
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 KB | None | 0 0
  1. <script type="text/javascript">
  2.  
  3. window.onresize = function(event) {
  4. $('.quick.box.emoticon .slider').css('max-width', $('.quick.box').outerWidth());
  5. };
  6.  
  7. $(document).on('ready', function() {
  8. $('.quick.box.emoticon .slider').css('max-width', $('.quick.box').outerWidth());
  9. $.getJSON("https://supporto.forumfree.it/api.php?emoticons=2")
  10. .then(function(data){
  11. if( data.emoticons !== 'undefined' ) {
  12.  
  13. $.each( data.emoticons, function(k,v) {
  14.  
  15. $("#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>');
  16.  
  17. });
  18.  
  19. $("#emoticonSlider").slick({
  20. dots: false,
  21. infinite: true,
  22. centerMode: false,
  23. slidesToShow: 5,
  24. slidesToScroll: 3,
  25. lazyLoad: 'ondemand',
  26. autoplay: false,
  27. autoplaySpeed: 3000,
  28. pauseOnHover: true,
  29. swipe: true,
  30. variableWidth: false,
  31. respondTo: 'min'
  32. });
  33. }
  34. });
  35.  
  36. });
  37.  
  38. $(document).on('click', '#emoticonSlider .slick-slide.slick-active', function() {
  39. emoticonClicked = $(this), img = $(this).find('.emoticon-append'), addr = img.attr('src'), type = img.attr('data-code');
  40.  
  41. if ( typeof img.attr('data-lazy') !== 'undefined' ) {
  42.  
  43. alert('Attendi il caricamento dell\'immagine!');
  44.  
  45. } else {
  46.  
  47. whereToAdd = false;
  48.  
  49. $.each($('#content .elenco li'), function() {
  50. elementHandle = $(this);
  51.  
  52. if( elementHandle.find('.bullet_delete').is(':hidden') || ( !elementHandle.find('.fs_remove') || elementHandle.find('.fs_remove').is(':hidden') ) ) {
  53.  
  54. whereToAdd = elementHandle;
  55. return false;
  56.  
  57. }
  58. });
  59.  
  60. if( whereToAdd === false ) {
  61. alert('Hai raggiunto il numero massimo di emoticon.');
  62. } else {
  63.  
  64. image = $(whereToAdd).find('input[name^="image"]');
  65. $(image).attr('value', addr);
  66. $(whereToAdd).find('input[name^="typed"]').attr('value', type);
  67. checkLink(image);
  68.  
  69. $([document.documentElement, document.body]).animate({
  70. scrollTop: $(whereToAdd).offset().top
  71. }, 0);
  72.  
  73. $('#content .elenco li').removeClass('added');
  74. $(whereToAdd).addClass('added');
  75.  
  76. }
  77.  
  78. }
  79. });
  80. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement