{ eventProperties.title = dmNode.dataset.analyticsFileEntryTitle; } Analytics.send('posted', 'Comment', eventProperties); } }; Liferay.on('messagePosted', onMessagePosted); })(); (function() {var $ = AUI.$;var _ = AUI._; var onVote = function (event) { if (window.Analytics) { let title = event.contentTitle; if (!title) { const dmNode = document.querySelector( '[data-analytics-file-entry-id="' + event.classPK + '"]' ); if (dmNode) { title = dmNode.dataset.analyticsFileEntryTitle; } } Analytics.send('VOTE', 'Ratings', { className: event.className, classPK: event.classPK, ratingType: event.ratingType, score: event.score, title, }); } }; var onDestroyPortlet = function () { Liferay.detach('ratings:vote', onVote); Liferay.detach('destroyPortlet', onDestroyPortlet); }; Liferay.on('ratings:vote', onVote); Liferay.on('destroyPortlet', onDestroyPortlet); })(); function getValueByAttribute(node, attr) { return ( node.dataset[attr] || (node.parentElement && node.parentElement.dataset[attr]) ); } function sendDocumentDownloadedAnalyticsEvent(anchor) { var fileEntryId = getValueByAttribute( anchor, 'analyticsFileEntryId' ); var title = getValueByAttribute( anchor, 'analyticsFileEntryTitle' ); var version = getValueByAttribute( anchor, 'analyticsFileEntryVersion' ); if (fileEntryId) { Analytics.send('documentDownloaded', 'Document', { groupId: themeDisplay.getScopeGroupId(), fileEntryId, preview: !!window._com_liferay_document_library_analytics_isViewFileEntry, title, version, }); } } function handleDownloadClick(event) { if (window.Analytics) { if (event.target.nodeName.toLowerCase() === 'a') { sendDocumentDownloadedAnalyticsEvent( event.target ); } else if ( event.target.parentNode && event.target.parentNode.nodeName.toLowerCase() === 'a' ) { sendDocumentDownloadedAnalyticsEvent( event.target.parentNode ); } else { var target = event.target; var matchTextContent = target.textContent && target.textContent.toLowerCase() === 'تحميل'; var matchTitle = target.title && target.title.toLowerCase() === 'download'; var matchAction = target.action === 'download'; var matchLexiconIcon = !!target.querySelector( '.lexicon-icon-download' ); var matchLexiconClassName = target.classList.contains( 'lexicon-icon-download' ); var matchParentTitle = target.parentNode && target.parentNode.title && target.parentNode.title.toLowerCase() === 'download'; var matchParentLexiconClassName = target.parentNode && target.parentNode.classList.contains('lexicon-icon-download'); if ( matchTextContent || matchTitle || matchParentTitle || matchAction || matchLexiconIcon || matchLexiconClassName || matchParentLexiconClassName ) { var selectedFiles = document.querySelectorAll( '.form .custom-control-input:checked' ); selectedFiles.forEach(({value}) => { var selectedFile = document.querySelector( '[data-analytics-file-entry-id="' + value + '"]' ); sendDocumentDownloadedAnalyticsEvent( selectedFile ); }); } } } } Liferay.once('destroyPortlet', () => { document.body.removeEventListener( 'click', haackPagesPortlet_INSTANCE_ffiq_pagesFeedbackForm]'); let s 1FF8 endButton = $('#sendButton'); let feedbackSection = $('#feedback-section'); let feedbackResponseSection = $('#feedback-response-section'); let feedbackBody = $('#feedbackBody'); let submitAgainBtn = $('#submit-again-btn') $('input[type="radio"][name="_com_digitallab_gastat_GastatFeedbackPagesPortlet_INSTANCE_ffiq_feedbackValue"]').change(function () { hideOrShowReasonInput($(this).val(), $(this).data('label-text')) }) sendButton.click(function () { if (form[0].checkValidity() === false) return; let feedbackReason = $("input[name=_com_digitallab_gastat_GastatFeedbackPagesPortlet_INSTANCE_ffiq_feedbackReason]").val(); let feedbackValue = $("input[name=_com_digitallab_gastat_GastatFeedbackPagesPortlet_INSTANCE_ffiq_feedbackValue]:checked").val(); $.ajax({ type: 'POST', url: 'https://stats.gov.sa/ar/news?p_p_id=com_digitallab_gastat_GastatFeedbackPagesPortlet_INSTANCE_ffiq&p_p_lifecycle=2&p_p_state=normal&p_p_mode=view&p_p_resource_id=%2Fsubmit_feedback_captcha&p_p_cacheability=cacheLevelPage', data: { _com_digitallab_gastat_GastatFeedbackPagesPortlet_INSTANCE_ffiq_feedbackReason: feedbackReason, _com_digitallab_gastat_GastatFeedbackPagesPortlet_INSTANCE_ffiq_feedbackValue: feedbackValue }, success: function (response) { if (response) switchViews(true, response === 'true') } }) }) submitAgainBtn.click(function () { switchViews(false,undefined) }) function switchViews(showSuccessSection, isSuccess) { if (showSuccessSection) { feedbackSection.hide() let body = isSuccess ? `

شكرًا.

شكرآ لك على ملاحظاتك!

` : `

خطأ

عذرًا، حدث شيء خاطئ

` feedbackBody.html(body.trim()); feedbackResponseSection.show() } else { feedbackSection.show() feedbackBody.html('') feedbackResponseSection.hide() } } const hideOrShowReasonInput = (value, labelText) => { let shouldShow = value > 3; label.html(labelText + reason + ' *') input.prop('required', shouldShow); $("input[name=_com_digitallab_gastat_GastatFeedbackPagesPortlet_INSTANCE_ffiq_feedbackReason]").val('') shouldShow ? unsatisfiedInputGroup.show() : unsatisfiedInputGroup.hide(); } }) 0 حدٍّ ما