blocks
4 years ago
admin.js
2 weeks ago
asset_manager_core_js.js
6 days ago
iframeResizer.contentWindow.min.js
2 years ago
iframeResizer.min.js
2 years ago
marketplace_setup_wizard.js
1 month ago
optout.js
1 year ago
settings.js
1 year ago
admin.js
112 lines
| 1 | /** |
| 2 | * Matomo - free/libre analytics platform |
| 3 | * |
| 4 | * @link https://matomo.org |
| 5 | * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later |
| 6 | * @package matomo |
| 7 | */ |
| 8 | |
| 9 | window.matomoAdminJsLoaded = true; |
| 10 | |
| 11 | window.jQuery(document).ready(function ($) { |
| 12 | // hide in case it was displayed while this file was loading |
| 13 | $('#matomo-adblocker-notice').removeClass('adblocker-found'); |
| 14 | |
| 15 | // referral notice dismiss |
| 16 | if (typeof mtmReferralDismissNoticeAjax !== 'undefined' && mtmReferralDismissNoticeAjax.ajax_url) { |
| 17 | $(document).on( 'click', '#matomo-referral .notice-dismiss', function () { |
| 18 | $.post(mtmReferralDismissNoticeAjax.ajax_url, { |
| 19 | _ajax_nonce: mtmReferralDismissNoticeAjax.nonce, |
| 20 | action: 'matomo_referral_dismiss_admin_notice', |
| 21 | }); |
| 22 | }); |
| 23 | |
| 24 | $(document).on( 'click', '#matomo-referral .matomo-dismiss-forever', function () { |
| 25 | $.post(mtmReferralDismissNoticeAjax.ajax_url, { |
| 26 | _ajax_nonce: mtmReferralDismissNoticeAjax.nonce, |
| 27 | action: 'matomo_referral_dismiss_admin_notice', |
| 28 | forever: '1', |
| 29 | }); |
| 30 | }); |
| 31 | } |
| 32 | |
| 33 | // system report error dismiss |
| 34 | if (typeof mtmSystemReportErrorNoticeAjax !== 'undefined' && mtmSystemReportErrorNoticeAjax.ajax_url) { |
| 35 | $(document).on( 'click', '#matomo-systemreporterrors .notice-dismiss', function () { |
| 36 | $.post(mtmSystemReportErrorNoticeAjax.ajax_url, { |
| 37 | _ajax_nonce: mtmSystemReportErrorNoticeAjax.nonce, |
| 38 | action: 'matomo_system_report_error_dismissed', |
| 39 | }); |
| 40 | }); |
| 41 | } |
| 42 | |
| 43 | // minimum requirements notice dismiss |
| 44 | if (typeof mtmMinimumRequirementsNoticeAjax !== 'undefined' && mtmMinimumRequirementsNoticeAjax.ajax_url) { |
| 45 | $(document).on( 'click', '#matomo-minimumrequirements .notice-dismiss', function () { |
| 46 | $.post(mtmMinimumRequirementsNoticeAjax.ajax_url, { |
| 47 | _ajax_nonce: mtmMinimumRequirementsNoticeAjax.nonce, |
| 48 | action: 'matomo_minimum_requirements_notice_dismissed', |
| 49 | }); |
| 50 | }); |
| 51 | } |
| 52 | |
| 53 | // scheduled task error dismiss |
| 54 | if (typeof mtmScheduledTaskErrorAjax !== 'undefined' && mtmScheduledTaskErrorAjax.ajax_url) { |
| 55 | $('body').on('click', '.matomo-cron-error .notice-dismiss', function (e) { |
| 56 | $.post(mtmScheduledTaskErrorAjax.ajax_url, { |
| 57 | _ajax_nonce: mtmScheduledTaskErrorAjax.nonce, |
| 58 | action: 'mtm_remove_cron_error', |
| 59 | matomo_job_id: $(e.target).closest('.matomo-cron-error').data('job') |
| 60 | }); |
| 61 | }); |
| 62 | } |
| 63 | |
| 64 | // whats new notice dismiss |
| 65 | if (typeof mtmWhatsNewNotificationAjax !== 'undefined' && mtmWhatsNewNotificationAjax.ajax_url) { |
| 66 | $('body').on('click', '.matomo-whats-new .notice-dismiss', function (e) { |
| 67 | $.post(mtmWhatsNewNotificationAjax.ajax_url, { |
| 68 | _ajax_nonce: mtmWhatsNewNotificationAjax.nonce, |
| 69 | action: 'mtm_dismiss_whats_new', |
| 70 | matomo_notification: $(e.target).closest('.matomo-whats-new').data('notification-id'), |
| 71 | }); |
| 72 | }); |
| 73 | } |
| 74 | |
| 75 | // add a notification dot to menu items that need it (see WhatsNewNotification.php) |
| 76 | if (typeof mtmUnseenWhatsNewNotifications !== 'undefined' && mtmUnseenWhatsNewNotifications.length) { |
| 77 | $('#toplevel_page_matomo a').each(function () { |
| 78 | var href = $(this).attr('href'); |
| 79 | |
| 80 | var m = href.match(/\?page=(.*?)$/); |
| 81 | var page = m && m[1]; |
| 82 | if (!page) { |
| 83 | return; |
| 84 | } |
| 85 | |
| 86 | if (!mtmUnseenWhatsNewNotifications.includes(page)) { |
| 87 | return; |
| 88 | } |
| 89 | |
| 90 | $(this).addClass('matomo-notification-dot'); |
| 91 | }); |
| 92 | } |
| 93 | |
| 94 | // suggestion dismiss |
| 95 | if (typeof mtmDismissSuggestionAjax !== 'undefined' && mtmDismissSuggestionAjax.ajax_url) { |
| 96 | $('body').on('click', '.matomo-dismiss-suggestion', function (e) { |
| 97 | $.post(mtmDismissSuggestionAjax.ajax_url, { |
| 98 | _ajax_nonce: mtmDismissSuggestionAjax.nonce, |
| 99 | action: 'matomo_dismiss_suggestion', |
| 100 | suggestion: $(e.target).data('suggestion') |
| 101 | }); |
| 102 | |
| 103 | $(e.target).closest('.matomo-plugin-suggestion').remove(); |
| 104 | }); |
| 105 | } |
| 106 | |
| 107 | // force external matomo menu links to load in a new tab |
| 108 | $('#toplevel_page_matomo span.dashicons-external').each(function () { |
| 109 | $(this).closest('a').attr('target', '_blank'); |
| 110 | }); |
| 111 | }); |
| 112 |