X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/3c0e373447323b5e33b273859e790a2054771afa..0a637ce4b427eb7376f3902ab0e51cf274a8b1da:/src/wolnelektury/static/js/base.js diff --git a/src/wolnelektury/static/js/base.js b/src/wolnelektury/static/js/base.js index 1dde3221c..2d0ebbf64 100644 --- a/src/wolnelektury/static/js/base.js +++ b/src/wolnelektury/static/js/base.js @@ -57,6 +57,22 @@ }) }); + $('.more-expand').each(function () { + $(this).shorten({ + showChars: 150, + moreText: "więcej", + lessText: "mniej" + }); + }); + + + $('.carousel').on('cycle-before', function(event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag) { + $("iframe", outgoingSlideEl).attr("src", ''); + $("iframe", incomingSlideEl).attr("src", $("iframe", incomingSlideEl).attr('data-src')); + }); + $('.carousel section').first().each(function() { + $("iframe", this).attr("src", $("iframe", this).attr('data-src')); + }); (function() { @@ -229,6 +245,31 @@ }); } }); + + /* global tlite */ + tlite(function (el) { + return $(el).hasClass('tlite-tooltip'); + }); + + /* more/less switch from https://codepen.io/JoshBlackwood/pen/pEwHe */ + // Hide the extra content initially, using JS so that if JS is disabled, no problemo: + $('.read-more-content').addClass('hide'); + $('.read-more-show, .read-more-hide').removeClass('hide'); + + // Set up the toggle effect: + $('.read-more-show').on('click', function(e) { + $(this).next('.read-more-content').removeClass('hide'); + $(this).addClass('hide'); + e.preventDefault(); + }); + + // Changes contributed by @diego-rzg + $('.read-more-hide').on('click', function(e) { + var p = $(this).parent('.read-more-content'); + p.addClass('hide'); + p.prev('.read-more-show').removeClass('hide'); // Hide only the preceding "Read More" + e.preventDefault(); + }); }); })(jQuery);