assets.yumpu.com Open in urlscan Pro
2600:9000:2250:fa00:6:3fb7:46c0:93a1  Public Scan

URL: http://assets.yumpu.com/release/CrBKRydHJ50WOzV/v5/js/modules/document/document.js?v=241
Submission: On September 23 via api from US — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

$(document).on('click', '.yp-mag-main-menu-btn-info', function () {
    $('.yp-mag-main-menu-btn-info').addClass('strong');
    $('.yp-mag-main-menu-btn-share').removeClass('strong');
    $('.yp-mag-info-container-inner').addClass('hidden');
    $('#yp-mag-info-container-info').removeClass('hidden');
    return false;
});

$(document).on('click', '.yp-mag-main-menu-btn-share', function () {
    $('.yp-mag-main-menu-btn-info').removeClass('strong');
    $('.yp-mag-main-menu-btn-share').addClass('strong');
    $('.yp-mag-info-container-inner').addClass('hidden');
    $('#yp-mag-info-container-share').removeClass('hidden');
    return false;
});

// $(document).on('click', '.yp-mag-info-share-menu-link-short', function () {
//     $('.yp-mag-info-share-menu').children('li').removeClass('active');
//     $(this).parent('li').addClass('active');
//     $('.yp-mag-info-share-input').addClass('hidden');
//     $('#yp-mag-info-share-link-short').removeClass('hidden');
//     return false;
// });

$(document).on('click', '.yp-mag-info-share-menu-link', function () {
    if(current_page_number <= total_page_number && current_page_number > 1) {
        $('input#yp-mag-info-share-radio-cover-page-input').prop('checked', false);
        $('input#yp-mag-info-share-link-radio-start-page').prop('checked', true);
        $('input#yp-mag-info-share-start-page-number').val(current_page_number);

        $('input#yp-mag-info-share-link-txt').val(current_url);
    }
    return false;
});

// $(document).on('click', '.yp-mag-info-share-menu-link-embed', function () {
//     $('.yp-mag-info-share-menu').children('li').removeClass('active');
//     $(this).parent('li').addClass('active');
//     $('.yp-mag-info-share-input').addClass('hidden');
//     $('#share-link-embed').removeClass('hidden');
//     return false;
// });

$(document).on('show.bs.collapse', '#yp-mag-info-collapse-text', function () {
    $(".yp-mag-info-collapse-text").removeClass("fa-caret-down").addClass("fa-caret-up");
});

$(document).on('hide.bs.collapse', '#yp-mag-info-collapse-text', function () {
    $(".yp-mag-info-collapse-text").removeClass("fa-caret-up").addClass("fa-caret-down");
});

$(document).on('click', '#document_password_verify', function () {
    verify_password();
    return false;
});

$(document).on('change', '#yp-mag-info-share-radio-cover-page-input', function () {
    if ($(this).is(":checked")) {
        $('input#yp-mag-info-share-link-start-page-txt').addClass('hidden');
        $('input#yp-mag-info-share-link-txt').removeClass('hidden');

        var current_url_last_segment = current_url.substr(current_url.lastIndexOf('/') + 1);
        if ($.isNumeric(current_url_last_segment) ) {
            var current_url_cover = current_url.substring(0, current_url.lastIndexOf("/"));
            $('input#yp-mag-info-share-link-txt').val(current_url_cover);

        } else {
            $('input#yp-mag-info-share-link-txt').val(current_url);
        }

    }
});

$(document).on('input','input#yp-mag-info-share-start-page-number',function() {
    var current_url_cover = current_url.replace(/\/$/, '');
    var current_url_last_segment = current_url.substr(current_url.lastIndexOf('/') + 1);

    if ($.isNumeric(current_url_last_segment) ) {
        current_url_cover = current_url.substring(0, current_url.lastIndexOf("/"));
        $('input#yp-mag-info-share-link-txt').val(current_url_cover);
    }
    var entered_data = parseInt($(this).val());
    if($.isNumeric(entered_data)){
        var checked_start = $('input#yp-mag-info-share-link-radio-start-page').is(":checked");

        if(entered_data <= total_page_number && entered_data > 1 && checked_start){

            var start_page_number = entered_data;
            var link_start_page = current_url_cover + '/'  + start_page_number;
            $('input#yp-mag-info-share-link-start-page-txt').val(link_start_page);
            $('input#yp-mag-info-share-link-start-page-txt').removeClass('hidden');
            $('input#yp-mag-info-share-link-txt').addClass('hidden');

        } else if(entered_data == 1 && checked_start) {

            $('input#yp-mag-info-share-link-txt').removeClass('hidden');
            $('input#yp-mag-info-share-link-start-page-txt').addClass('hidden');

        } else if((entered_data < 1 || entered_data > total_page_number) && checked_start) {

            $('input#yp-mag-info-share-start-page-number').val(total_page_number);
            var link_start_page = current_url_cover + '/'  + total_page_number;
            $('input#yp-mag-info-share-link-start-page-txt').val(link_start_page);
            $('input#yp-mag-info-share-link-start-page-txt').removeClass('hidden');
            $('input#yp-mag-info-share-link-txt').addClass('hidden');

        } else if(entered_data < 1 || entered_data >= total_page_number ) {

            $('#yp-mag-info-share-start-page-number').val(total_page_number);
            $('input#yp-mag-info-share-link-txt').removeClass('hidden');
            $('input#yp-mag-info-share-link-start-page-txt').addClass('hidden');

        }  else if(entered_data >= 1 && entered_data < total_page_number ) {

            $('input#yp-mag-info-share-link-txt').removeClass('hidden');
            $('input#yp-mag-info-share-link-start-page-txt').addClass('hidden');

        } else {

            $('#yp-mag-info-share-start-page-number').val(total_page_number );
            $('input#yp-mag-info-share-link-txt').removeClass('hidden');
            $('input#yp-mag-info-share-link-start-page-txt').addClass('hidden');

        }
    } else {

        $('#yp-mag-info-share-start-page-number').val('');
        $('input#yp-mag-info-share-link-txt').removeClass('hidden');
        $('input#yp-mag-info-share-link-start-page-txt').addClass('hidden');
    }
});
// more documents
$(document).ready(function () {
    var img = new Image();
    img.src = cover_url;

    result = document.querySelector('.yp-document--sub-container');
    img.addEventListener('load', function(){
        var p= getAverageRGB(img);
        result.style.backgroundColor =`rgb(${p.r} ${p.g} ${p.b})`;// rgbToHex(p['r'],p['g'],p['b']);

    },false);


    function getAverageRGB(imgEl) {

        var defaultRGB = {r:78,g:214,b:212}, // for non-supporting envs
            canvas = document.createElement('canvas'),
            context = canvas.getContext && canvas.getContext('2d'),
            data=[],
            rgb = {r:78,g:214,b:212};
        if (!context) {
            return defaultRGB;
        }

        canvas.height =  imgEl.height;
        canvas.width = imgEl.width;
        imgEl.crossOrigin = "anonymous";

        context.drawImage(imgEl, 0, 0, 4, 4);

        try {
            data = context.getImageData(0, 0, 1, 1).data;

        } catch(e) {
            /* security error, img on diff domain */
            return defaultRGB;
        }
        imgEl.crossOrigin = "";
        if(data.length>1){
            rgb.r = data[0];
            rgb.g = data[1];
            rgb.b = data[2];
        }
        return rgb
    }


    $('.yp-nav-embed-open').click(function () {
        $('#modalshare').modal('hide');
    });

    // Logic for "Show more" button in document description:
    toggleShowMoreButton();
    $('.yp-show-more').click(function () {
      $('#yp-js-group__text_less').addClass('d-none');
      $('#yp-js-group__text_full').removeClass('d-none');
      $('.yp-show-less').removeClass('d-none');
      $(this).addClass('d-none');
      toggleShowMoreButton();
    });
    $('.yp-show-less').click(function () {
      $('#yp-js-group__text_full').addClass('d-none');
      $('#yp-js-group__text_less').removeClass('d-none');
      $('.yp-show-more').removeClass('d-none');
      $(this).addClass('d-none');
      toggleShowMoreButton();
    });

    $(document).on('click', '.yp-inappropriate-link', function (e) {
        var target = $(this).attr("href");
        // load the url and show modal on success
        $("#modalinappropriate .modal-content").load(target, function () {
            $("#modalinappropriate").modal("show");
        });

        return false;
    });
    $(document).on('click', '.yp-email-share', function (e) {
        var target = $(this).attr("href");
        // load the url and show modal on success
        $("#modalforward .modal-content").load(target, function () {
            $("#modalforward").modal("show");
        });

        return false;
    });
});
document.addEventListener("DOMContentLoaded", function () {
    var imageObserver = new IntersectionObserver(function (entries, imgObserver) {
        entries.forEach(function (entry) {
            if (entry.isIntersecting) {
                var lazyImage = entry.target
                lazyImage.src = lazyImage.getAttribute('data-src')
                lazyImage.classList.remove("lzy_img");
                imgObserver.unobserve(lazyImage);
            }
        })
    });

    var arr = document.querySelectorAll('img.lzy_img');
    $.each(arr,function(v,img){
        imageObserver.observe(img);
    })
})

$(document).ready(function () {
    $(document).on('click','.yp-copy-link--box', function(e){
        var ypCpTemp = $("<input>");
        $("body").append(ypCpTemp);
        var copyElement = this.parentElement.querySelector('.yp-copy--element');
        copyElement.select();
        copyElement.setSelectionRange(0, 99999); /* For mobile devices */
        navigator.clipboard.writeText(copyElement.value);
        var notifier = $('.yp-get-notifier-success').html();
        $(notifier).appendTo('.yp-notification-block').addClass('yp-msg-copied').removeClass('d-none');
        $('.yp-msg-copied').find('.yp-success-msg').html(copy_text);
        hide_notifier();
    });
});

function hide_notifier(){
    setTimeout(function(){$(".yp-notifier-update:first").addClass('yp-notifier-update-hide'); },3200);
    setTimeout(function(){$(".yp-notifier-update:first").remove(); },3300);
}

$(window).resize(toggleShowMoreButton);

function toggleShowMoreButton() {
  if ($('#yp-js-group__text_less').outerHeight() < $('#yp-js-group__text_less')[0]?.scrollHeight) {
    $('.yp-show-more').removeClass('d-none');
  } else {
    $('.yp-show-more').addClass('d-none');
  }
}

window.onbeforeunload = function() {
  $(window).off('resize')
}