diff options
-rw-r--r-- | plugins/Overlay/javascripts/Piwik_Overlay.js | 16 | ||||
-rw-r--r-- | plugins/Overlay/lang/en.json | 3 | ||||
-rw-r--r-- | plugins/Overlay/stylesheets/overlay.css | 7 | ||||
-rw-r--r-- | plugins/Overlay/templates/index.twig | 4 |
4 files changed, 28 insertions, 2 deletions
diff --git a/plugins/Overlay/javascripts/Piwik_Overlay.js b/plugins/Overlay/javascripts/Piwik_Overlay.js index 3c9a0b4551..bccdd2aec5 100644 --- a/plugins/Overlay/javascripts/Piwik_Overlay.js +++ b/plugins/Overlay/javascripts/Piwik_Overlay.js @@ -149,11 +149,25 @@ var Piwik_Overlay = (function () { var m = location.match(ORIGIN_PARSE_REGEX); iframeOrigin = m ? m[0] : null; + var foundValidSiteUrl = false; + // unset iframe origin if it is not one of the site URLs var validSiteOrigins = Piwik_Overlay.siteUrls.map(function (url) { - return url.match(ORIGIN_PARSE_REGEX)[0].toLowerCase(); + if (typeof url === 'string' && url !== "") { + foundValidSiteUrl = true; + } + + var siteUrlMatch = url.match(ORIGIN_PARSE_REGEX); + if (!siteUrlMatch) { + return null; + } + return siteUrlMatch[0].toLowerCase(); }); + if (!foundValidSiteUrl) { + $('#overlayErrorNoSiteUrls').show(); + } + if (iframeOrigin && validSiteOrigins.indexOf(iframeOrigin.toLowerCase()) === -1) { try { console.log('Found invalid iframe origin in hash URL: ' + iframeOrigin); diff --git a/plugins/Overlay/lang/en.json b/plugins/Overlay/lang/en.json index c66e89ee10..383b6013c3 100644 --- a/plugins/Overlay/lang/en.json +++ b/plugins/Overlay/lang/en.json @@ -16,6 +16,7 @@ "PluginDescription": "See your analytics data as an Overlay on your actual website. View how many times your users have clicked on each link. Note: Requires the Transitions plugin enabled.", "RedirectUrlError": "You are attempting to open Page Overlay for the URL \"%1$s\". %2$s None of the domains from the Matomo settings matches the link.", "RedirectUrlErrorAdmin": "You can add the domain as an additional URL %1$sin the settings%2$s.", - "RedirectUrlErrorUser": "Ask your administrator to add the domain as an additional URL." + "RedirectUrlErrorUser": "Ask your administrator to add the domain as an additional URL.", + "ErrorNoSiteUrls": "WARNING: This website has no Site URLs defined in Matomo. This might cause Overlay and other features to break or behave strangely. To fix this, add a URL in the settings for this website in the Matomo Administration section." } }
\ No newline at end of file diff --git a/plugins/Overlay/stylesheets/overlay.css b/plugins/Overlay/stylesheets/overlay.css index 42585250b3..028fba76a8 100644 --- a/plugins/Overlay/stylesheets/overlay.css +++ b/plugins/Overlay/stylesheets/overlay.css @@ -150,6 +150,13 @@ body .ui-tooltip.overlayTooltip { padding: 3px 5px 3px 6px; } +#overlayErrorNoSiteUrls { + width: 190px; + margin: 20px 0 20px 5px; + font-size: 14px; + font-weight: bold; +} + #overlayNoFrame { padding: 20px 0 40px 2px; } diff --git a/plugins/Overlay/templates/index.twig b/plugins/Overlay/templates/index.twig index 42294e2ae4..e4a4c77441 100644 --- a/plugins/Overlay/templates/index.twig +++ b/plugins/Overlay/templates/index.twig @@ -25,6 +25,10 @@ </select> </div> + <div id="overlayErrorNoSiteUrls" style="display:none;"> + {{ 'Overlay_ErrorNoSiteUrls'|translate }} + </div> + <div id="overlayErrorNotLoading"> <p> <span>{{ 'Overlay_ErrorNotLoading'|translate }}</span> |