// MW_OVERLAY (function($){ $.fn.mw_overlay_load = function() { var url = $(this).attr('href'); if (url == null) { return false; } $('.mw-sys-overlay').remove(); $('.mw-sys-dialog').remove(); $('.mw-sys-loader').remove(); $('body').append('
'); overlay = $('.mw-sys-overlay'); overlay.addClass('mw-cust-overlay'); overlay.click(function() { return $().mw_overlay_unload(); }); $('body').append('') var dialog = $('.mw-sys-dialog'); dialog.addClass('mw-cust-dialog'); $('body').append(''); var loader = $('.mw-sys-loader'); loader.addClass('mw-cust-loader'); showCentered(loader); dialog.load(url, function() { $('.mw-overlay-closelink').click(function() { return $().mw_overlay_unload() }); loader.fadeOut(function() { showCentered(dialog); $(document).trigger('mw-overlay-loaded'); }); } ); function showCentered(element) { element.css('top', (($(window).height() - element.outerHeight()) / 2) + $(window).scrollTop()); element.css('left', (($(window).width() - element.outerWidth()) / 2) + $(window).scrollLeft()); element.fadeIn(); } } $.fn.mw_overlay_unload = function() { var overlay = $('.mw-sys-overlay'); var dialog = $('.mw-sys-dialog'); var loader = $('.mw-sys-loader'); loader.fadeOut(function() { loader.remove(); }); dialog.fadeOut(function() { dialog.remove(); }); overlay.fadeOut(function() { overlay.remove(); }); return false; } })(jQuery); $(function() { $(".mw-overlay").click(function() { $(this).mw_overlay_load(); return false; }); }); $(document).bind('mw-overlay-loaded', function() { $(".mw-overlay").unbind("click").click(function() { $(this).mw_overlay_load(); return false; }); }); // MW_TOGGLEOVERFLOW (function($){ $.fn.mw_toggleOverflow = function(options) { var defaults = { lines: null, duration: 600, ellipsis: '...', moreText: 'more', lessText: 'less', containerclass: 'mw-toggleoverflow-container', linkclass: 'mw-toggleoverflow-link' }; var options = $.extend(defaults, options); return this.each(function() { var current = $(this); // Set height by lines if (options.lines != null) { var lineHeight = parseInt(current.css('line-height')); if (isFinite(options.lines) && isFinite(lineHeight)) { current.height(2 + (options.lines * lineHeight)); } else { options.lines == null; } } // Check overflow current.css('overflow', 'hidden'); if (current.height() >= current[0].scrollHeight) { // no overflow current.css('overflow', 'visible'); return; } // Create container div and move current element to container var containerdiv = $(''); containerdiv.addClass(options.containerclass); current.before(containerdiv); containerdiv.append(current); // Add link element var link = $('' + options.moreText + ''); link.addClass(options.linkclass); containerdiv.append(link); if (options.lines == null) { // Adjust height to cater for link element current.height(current.height() - link.height()) } // Store data on current element current.ellipsis = options.ellipsis + '