File size: 4,666 Bytes
da96562 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | /*!
* Matomo - free/libre analytics platform
*
* @link https://matomo.org
* @license https://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
(function ($) {
//
// 'check for updates' behavior
//
$(function () {
var initUpdateCheck = function() {
var COMPONENT_SELECTOR = 'div[vue-entry="CoreHome.VersionInfoHeaderMessage"]';
var headerComponentParent = $(COMPONENT_SELECTOR).parent();
// when 'check for updates...' link is clicked, force a check & display the result
headerComponentParent.one('click', '#header_message a.title:not([href])', function (e) {
var headerComponent = $(this)
.closest(COMPONENT_SELECTOR);
var headerMessage = headerComponent.find('#header_message');
var $titleElement = headerMessage.find('.title');
if ($titleElement.attr('target')) { // if this is an external link, internet access is not available on the server
return;
}
e.preventDefault();
var ajaxRequest = new ajaxHelper();
ajaxRequest.setLoadingElement('#header_message .loadingPiwik');
ajaxRequest.addParams({
module: 'CoreHome',
action: 'checkForUpdates'
}, 'get');
ajaxRequest.withTokenInUrl();
$titleElement.addClass('activityIndicator');
ajaxRequest.setCallback(function (response) {
headerMessage.fadeOut('slow', function () {
response = $(COMPONENT_SELECTOR, $('<div>' + response + '</div>'));
$titleElement.removeClass('activityIndicator');
if (response.length) {
headerComponent.replaceWith(response);
piwikHelper.compileVueDirectives(response);
piwikHelper.compileVueEntryComponents(response);
initUpdateCheck();
} else {
headerMessage.find('.title')
.html(_pk_translate('CoreHome_YouAreUsingTheLatestVersion'));
headerMessage.show();
setTimeout(function () {
headerMessage.fadeOut('slow', function () {
headerComponent.remove();
});
}, 4000);
}
});
});
ajaxRequest.setFormat('html');
ajaxRequest.send();
return false;
});
};
initTopControls();
initUpdateCheck();
});
}(jQuery));
$( document ).ready(function() {
$('.accessibility-skip-to-content').click(function(e){
$('a[name="main"]').attr('tabindex', -1).focus();
$(window).scrollTo($('a[name="main"]'));
});
$("#mobile-top-menu").sideNav({
closeOnClick: true,
edge: 'right'
});
$('.navbar.collapsible').collapsible();
$('select').not('.ui-datepicker select').material_select();
piwikHelper.registerShortcut('?', _pk_translate('CoreHome_ShortcutHelp') , function (event) {
// don't open if an modal is already shown
if (event.altKey || $('.modal.open').length) {
return;
}
if (event.preventDefault) {
event.preventDefault();
} else {
event.returnValue = false; // IE
}
var list = $('#shortcuthelp dl');
list.empty();
var keys = Object.keys(piwikHelper.shortcuts).sort();
jQuery.each(keys, function(i, key) {
if (piwikHelper.shortcuts.hasOwnProperty(key)) {
list.append($('<dt />').append($('<kbd />').text(key)));
list.append($('<dd />').text(piwikHelper.shortcuts[key]));
}
});
var isMac = navigator.userAgent.indexOf('Mac OS X') != -1;
list.append($('<dt />').append($('<kbd />').text(_pk_translate(isMac ? "CoreHome_MacPageUp" : "CoreHome_HomeShortcut"))));
list.append($('<dd />').text(_pk_translate('CoreHome_PageUpShortcutDescription')));
list.append($('<dt />').append($('<kbd />').text(_pk_translate(isMac ? "CoreHome_MacPageDown" : "CoreHome_EndShortcut"))));
list.append($('<dd />').text(_pk_translate('CoreHome_PageDownShortcutDescription')));
piwikHelper.modalConfirm('#shortcuthelp');
});
});
|