diff options
Diffstat (limited to 'plugins')
20 files changed, 189 insertions, 177 deletions
diff --git a/plugins/Annotations/javascripts/annotations.js b/plugins/Annotations/javascripts/annotations.js index b6d08e9856..0556b6027f 100755 --- a/plugins/Annotations/javascripts/annotations.js +++ b/plugins/Annotations/javascripts/annotations.js @@ -28,7 +28,7 @@ ajaxRequest.addParams(ajaxParams, 'get'); ajaxRequest.setCallback(callback); ajaxRequest.setFormat('html'); - ajaxRequest.send(false); + ajaxRequest.send(); }, // calls Annotations.addAnnotation @@ -49,7 +49,7 @@ ajaxRequest.withTokenInUrl(); ajaxRequest.setCallback(callback); ajaxRequest.setFormat('html'); - ajaxRequest.send(false); + ajaxRequest.send(); }, // calls Annotations.saveAnnotation @@ -72,7 +72,7 @@ ajaxRequest.withTokenInUrl(); ajaxRequest.setCallback(callback); ajaxRequest.setFormat('html'); - ajaxRequest.send(false); + ajaxRequest.send(); }, // calls Annotations.deleteAnnotation @@ -92,7 +92,7 @@ ajaxRequest.withTokenInUrl(); ajaxRequest.setCallback(callback); ajaxRequest.setFormat('html'); - ajaxRequest.send(false); + ajaxRequest.send(); }, // calls Annotations.getEvolutionIcons @@ -114,7 +114,7 @@ ajaxRequest.addParams(ajaxParams, 'get'); ajaxRequest.setFormat('html'); ajaxRequest.setCallback(callback); - ajaxRequest.send(false); + ajaxRequest.send(); } }; diff --git a/plugins/CoreHome/javascripts/corehome.js b/plugins/CoreHome/javascripts/corehome.js index b50296bfaa..c84c80959e 100755 --- a/plugins/CoreHome/javascripts/corehome.js +++ b/plugins/CoreHome/javascripts/corehome.js @@ -58,7 +58,7 @@ }); }); ajaxRequest.setFormat('html'); - ajaxRequest.send(false); + ajaxRequest.send(); return false; }); diff --git a/plugins/CoreHome/javascripts/dataTable.js b/plugins/CoreHome/javascripts/dataTable.js index ccc6bf00a1..a5f3906a0b 100644 --- a/plugins/CoreHome/javascripts/dataTable.js +++ b/plugins/CoreHome/javascripts/dataTable.js @@ -275,7 +275,7 @@ $.extend(DataTable.prototype, UIControl.prototype, { }); ajaxRequest.setFormat('html'); - ajaxRequest.send(false); + ajaxRequest.send(); }, // Function called when the AJAX request is successful @@ -1361,7 +1361,7 @@ $.extend(DataTable.prototype, UIControl.prototype, { }, 'post'); ajaxRequest.setCallback(function () {}); ajaxRequest.setFormat('html'); - ajaxRequest.send(false); + ajaxRequest.send(); } }, diff --git a/plugins/CoreHome/javascripts/dataTable_rowactions.js b/plugins/CoreHome/javascripts/dataTable_rowactions.js index d357a5e594..b937979cdf 100644 --- a/plugins/CoreHome/javascripts/dataTable_rowactions.js +++ b/plugins/CoreHome/javascripts/dataTable_rowactions.js @@ -426,5 +426,5 @@ DataTable_RowActions_RowEvolution.prototype.showRowEvolution = function (apiMeth ajaxRequest.addParams(requestParams, 'get'); ajaxRequest.setCallback(callback); ajaxRequest.setFormat('html'); - ajaxRequest.send(false); + ajaxRequest.send(); }; diff --git a/plugins/CoreHome/javascripts/popover.js b/plugins/CoreHome/javascripts/popover.js index 5bf316991c..61308b22cf 100644 --- a/plugins/CoreHome/javascripts/popover.js +++ b/plugins/CoreHome/javascripts/popover.js @@ -295,7 +295,7 @@ var Piwik_Popover = (function () { ajaxRequest.addParams(piwikHelper.getArrayFromQueryString(url), 'get'); ajaxRequest.setCallback(callback); ajaxRequest.setFormat('html'); - ajaxRequest.send(false); + ajaxRequest.send(); } }; })(); diff --git a/plugins/DBStats/templates/index.twig b/plugins/DBStats/templates/index.twig index a3f9e80897..fde84f2bfa 100755 --- a/plugins/DBStats/templates/index.twig +++ b/plugins/DBStats/templates/index.twig @@ -89,7 +89,7 @@ piwikHelper.compileAngularComponents(self); }); ajaxRequest.setFormat('html'); - ajaxRequest.send(false); + ajaxRequest.send(); }); }); })(jQuery); diff --git a/plugins/Dashboard/javascripts/dashboard.js b/plugins/Dashboard/javascripts/dashboard.js index 22e07e38e0..86faf58b52 100644 --- a/plugins/Dashboard/javascripts/dashboard.js +++ b/plugins/Dashboard/javascripts/dashboard.js @@ -37,7 +37,7 @@ function createDashboard() { }); } ); - ajaxRequest.send(true); + ajaxRequest.send(); }}); } @@ -120,7 +120,7 @@ function copyDashboardToUser() { }); } ); - ajaxRequest.send(true); + ajaxRequest.send(); piwikHelper.modalConfirm(makeSelectorLastId('copyDashboardToUserConfirm'), { yes: function () { @@ -145,7 +145,7 @@ function copyDashboardToUser() { } ); ajaxRequest.withTokenInUrl(); - ajaxRequest.send(true); + ajaxRequest.send(); } }); } @@ -199,10 +199,11 @@ function copyDashboardToUser() { return self.isWidgetAvailable(widgetUniqueId); }, onSelect: function (widgetUniqueId) { - var widget = widgetsHelper.getWidgetObjectFromUniqueId(widgetUniqueId); - self.$element.removeClass('expanded'); + widgetsHelper.getWidgetObjectFromUniqueId(widgetUniqueId, function(widget){ + self.$element.removeClass('expanded'); + self.widgetSelected(widget); + }); - self.widgetSelected(widget); }, resetOnSelect: true }); diff --git a/plugins/Dashboard/javascripts/dashboardObject.js b/plugins/Dashboard/javascripts/dashboardObject.js index 6af7a1ec05..c72f53a8c9 100644 --- a/plugins/Dashboard/javascripts/dashboardObject.js +++ b/plugins/Dashboard/javascripts/dashboardObject.js @@ -182,7 +182,7 @@ ); ajaxRequest.setLoadingElement(); ajaxRequest.setFormat('html'); - ajaxRequest.send(true); + ajaxRequest.send(); }, rebuildMenu: rebuildMenu, @@ -211,7 +211,7 @@ ); ajaxRequest.withTokenInUrl(); ajaxRequest.setFormat('html'); - ajaxRequest.send(true); + ajaxRequest.send(); }, /** @@ -647,7 +647,7 @@ ajaxRequest.withTokenInUrl(); ajaxRequest.setFormat('html'); - ajaxRequest.send(false); + ajaxRequest.send(); } } diff --git a/plugins/Dashboard/javascripts/dashboardWidget.js b/plugins/Dashboard/javascripts/dashboardWidget.js index ce88cf1c8f..6756b1d291 100755 --- a/plugins/Dashboard/javascripts/dashboardWidget.js +++ b/plugins/Dashboard/javascripts/dashboardWidget.js @@ -204,81 +204,83 @@ */ _createDashboardWidget: function (uniqueId) { - var widgetName = widgetsHelper.getWidgetNameFromUniqueId(uniqueId); - if (!widgetName) { - widgetName = _pk_translate('Dashboard_WidgetNotFound'); - } + var self = this; - var title = this.options.title === null ? $('<span/>').text(widgetName) : this.options.title; - var emptyWidgetContent = require('piwik/UI/Dashboard').WidgetFactory.make(uniqueId, title); - this.element.html(emptyWidgetContent); + widgetsHelper.getWidgetNameFromUniqueId(uniqueId, function(widgetName) { + if (!widgetName) { + widgetName = _pk_translate('Dashboard_WidgetNotFound'); + } - var widgetElement = $('[id="' + uniqueId + '"]', this.element); - var self = this; - widgetElement - .on('mouseenter.dashboardWidget', function () { - if (!self.isMaximised) { - $(this).addClass('widgetHover'); - $('.widgetTop', this).addClass('widgetTopHover'); - } - }) - .on('mouseleave.dashboardWidget', function () { - if (!self.isMaximised) { - $(this).removeClass('widgetHover'); - $('.widgetTop', this).removeClass('widgetTopHover'); - } - }); - - if (this.options.isHidden) { - $('.widgetContent', widgetElement).toggleClass('hidden').closest('.widget').toggleClass('hiddenContent'); - } + var title = self.options.title === null ? $('<span/>').text(widgetName) : self.options.title; + var emptyWidgetContent = require('piwik/UI/Dashboard').WidgetFactory.make(uniqueId, title); + self.element.html(emptyWidgetContent); - $('.button#close', widgetElement) - .on('click.dashboardWidget', function (ev) { - piwikHelper.modalConfirm('#confirm', {yes: function () { - if (self.options.onRemove) { - self.options.onRemove(self.element); + var widgetElement = $('[id="' + uniqueId + '"]', self.element); + widgetElement + .on('mouseenter.dashboardWidget', function () { + if (!self.isMaximised) { + $(this).addClass('widgetHover'); + $('.widgetTop', this).addClass('widgetTopHover'); + } + }) + .on('mouseleave.dashboardWidget', function () { + if (!self.isMaximised) { + $(this).removeClass('widgetHover'); + $('.widgetTop', this).removeClass('widgetTopHover'); + } + }); + + if (self.options.isHidden) { + $('.widgetContent', widgetElement).toggleClass('hidden').closest('.widget').toggleClass('hiddenContent'); + } + + $('.button#close', widgetElement) + .on('click.dashboardWidget', function (ev) { + piwikHelper.modalConfirm('#confirm', {yes: function () { + if (self.options.onRemove) { + self.options.onRemove(self.element); + } else { + self.element.remove(); + self.options.onChange(); + } + }}); + }); + + $('.button#maximise', widgetElement) + .on('click.dashboardWidget', function (ev) { + if (self.options.onMaximise) { + self.options.onMaximise(self.element); } else { - self.element.remove(); - self.options.onChange(); + if ($('.widgetContent', $(this).parents('.widget')).hasClass('hidden')) { + self.showContent(); + } else { + self.maximise(); + } } - }}); - }); - - $('.button#maximise', widgetElement) - .on('click.dashboardWidget', function (ev) { - if (self.options.onMaximise) { - self.options.onMaximise(self.element); - } else { - if ($('.widgetContent', $(this).parents('.widget')).hasClass('hidden')) { - self.showContent(); + }); + + $('.button#minimise', widgetElement) + .on('click.dashboardWidget', function (ev) { + if (self.options.onMinimise) { + self.options.onMinimise(self.element); } else { - self.maximise(); + if (!self.isMaximised) { + self.hideContent(); + } else { + self.element.dialog("close"); + } } - } - }); - - $('.button#minimise', widgetElement) - .on('click.dashboardWidget', function (ev) { - if (self.options.onMinimise) { - self.options.onMinimise(self.element); - } else { - if (!self.isMaximised) { - self.hideContent(); + }); + + $('.button#refresh', widgetElement) + .on('click.dashboardWidget', function (ev) { + if (self.options.onRefresh) { + self.options.onRefresh(self.element); } else { - self.element.dialog("close"); + self.reload(false, true); } - } - }); - - $('.button#refresh', widgetElement) - .on('click.dashboardWidget', function (ev) { - if (self.options.onRefresh) { - self.options.onRefresh(self.element); - } else { - self.reload(false, true); - } - }); + }); + }); }, /** @@ -350,8 +352,7 @@ */ detachWidget: function () { this.element.before('<div id="' + this.uniqueId + '-placeholder" class="widgetPlaceholder widget"> </div>'); - var placeholder = $('[id="' + self.uniqueId + '-placeholder"]') - + var placeholder = $('[id="' + self.uniqueId + '-placeholder"]'); $('#' + this.uniqueId + '-placeholder').height(this.element.height()); $('#' + this.uniqueId + '-placeholder').width(this.element.width() - 16); diff --git a/plugins/Dashboard/javascripts/widgetMenu.js b/plugins/Dashboard/javascripts/widgetMenu.js index 55eef4ab09..465e8001f5 100644 --- a/plugins/Dashboard/javascripts/widgetMenu.js +++ b/plugins/Dashboard/javascripts/widgetMenu.js @@ -89,47 +89,50 @@ widgetsHelper.getAvailableWidgets = function (callback) { } $('#loadingError').show(); }); - ajaxRequest.send(true); + ajaxRequest.send(); + return; } if (callback) { callback(widgetsHelper.availableWidgets); } - - return widgetsHelper.availableWidgets; }; /** - * Returns the complete widget object by its unique id + * Determines the complete widget object by its unique id and sends it to callback method * * @param {string} uniqueId - * @return {object} widget object + * @param {function} callback */ -widgetsHelper.getWidgetObjectFromUniqueId = function (uniqueId) { - var widgets = widgetsHelper.getAvailableWidgets(); - for (var widgetCategory in widgets) { - var widgetInCategory = widgets[widgetCategory]; - for (var i in widgetInCategory) { - if (widgetInCategory[i]["uniqueId"] == uniqueId) { - return widgetInCategory[i]; +widgetsHelper.getWidgetObjectFromUniqueId = function (uniqueId, callback) { + widgetsHelper.getAvailableWidgets(function(widgets){ + for (var widgetCategory in widgets) { + var widgetInCategory = widgets[widgetCategory]; + for (var i in widgetInCategory) { + if (widgetInCategory[i]["uniqueId"] == uniqueId) { + callback(widgetInCategory[i]); + return; + } } } - } - return false; + callback(false); + }); }; /** - * Returns the name of a widget by its unique id + * Determines the name of a widget by its unique id and sends it to the callback * * @param {string} uniqueId unique id of the widget + * @param {function} callback * @return {string} */ -widgetsHelper.getWidgetNameFromUniqueId = function (uniqueId) { - var widget = this.getWidgetObjectFromUniqueId(uniqueId); - if (widget == false) { - return false; - } - return widget["name"]; +widgetsHelper.getWidgetNameFromUniqueId = function (uniqueId, callback) { + this.getWidgetObjectFromUniqueId(uniqueId, function(widget) { + if (widget == false) { + callback(false); + } + callback(widget["name"]); + }); }; /** @@ -155,7 +158,7 @@ widgetsHelper.loadWidgetAjax = function (widgetUniqueId, widgetParameters, onWid ajaxRequest.setErrorCallback(onWidgetErrorCallback); } ajaxRequest.setFormat('html'); - ajaxRequest.send(false); + ajaxRequest.send(); return ajaxRequest; }; @@ -389,6 +392,7 @@ widgetsHelper.loadWidgetAjax = function (widgetUniqueId, widgetParameters, onWid * Show widget with the given uniqueId in preview * * @param {string} widgetUniqueId unique id of widget to display + * @param widgetPreview * @return {void} */ function showPreview(widgetUniqueId, widgetPreview) { @@ -399,39 +403,40 @@ widgetsHelper.loadWidgetAjax = function (widgetUniqueId, widgetParameters, onWid var previewElement = createPreviewElement(widgetPreview); - var widget = widgetsHelper.getWidgetObjectFromUniqueId(widgetUniqueId); - var widgetParameters = widget['parameters']; - - var emptyWidgetHtml = require('piwik/UI/Dashboard').WidgetFactory.make( - widgetUniqueId, - $('<div/>') - .attr('title', _pk_translate("Dashboard_AddPreviewedWidget")) - .text(_pk_translate('Dashboard_WidgetPreview')) - ); - previewElement.html(emptyWidgetHtml); - - var onWidgetLoadedCallback = function (response) { - var widgetElement = $(document.getElementById(widgetUniqueId)); - // document.getElementById needed for widgets with uniqueid like widgetOpens+Contact+Form - $('.widgetContent', widgetElement).html($(response)); - $('.widgetContent', widgetElement).trigger('widget:create'); - settings.onPreviewLoaded(widgetUniqueId, widgetElement); - $('.' + settings.widgetpreviewClass + ' .widgetTop', widgetPreview).on('click', function () { - settings.onSelect(widgetUniqueId); - $(widgetPreview).closest('.dashboard-manager').removeClass('expanded'); - if (settings.resetOnSelect) { - resetWidgetPreview(widgetPreview); - } - return false; - }); - }; - - // abort previous sent request - if (widgetPreview.widgetAjaxRequest) { - widgetPreview.widgetAjaxRequest.abort(); - } + widgetsHelper.getWidgetObjectFromUniqueId(widgetUniqueId, function(widget) { + var widgetParameters = widget['parameters']; + + var emptyWidgetHtml = require('piwik/UI/Dashboard').WidgetFactory.make( + widgetUniqueId, + $('<div/>') + .attr('title', _pk_translate("Dashboard_AddPreviewedWidget")) + .text(_pk_translate('Dashboard_WidgetPreview')) + ); + previewElement.html(emptyWidgetHtml); + + var onWidgetLoadedCallback = function (response) { + var widgetElement = $(document.getElementById(widgetUniqueId)); + // document.getElementById needed for widgets with uniqueid like widgetOpens+Contact+Form + $('.widgetContent', widgetElement).html($(response)); + $('.widgetContent', widgetElement).trigger('widget:create'); + settings.onPreviewLoaded(widgetUniqueId, widgetElement); + $('.' + settings.widgetpreviewClass + ' .widgetTop', widgetPreview).on('click', function () { + settings.onSelect(widgetUniqueId); + $(widgetPreview).closest('.dashboard-manager').removeClass('expanded'); + if (settings.resetOnSelect) { + resetWidgetPreview(widgetPreview); + } + return false; + }); + }; + + // abort previous sent request + if (widgetPreview.widgetAjaxRequest) { + widgetPreview.widgetAjaxRequest.abort(); + } - widgetPreview.widgetAjaxRequest = widgetsHelper.loadWidgetAjax(widgetUniqueId, widgetParameters, onWidgetLoadedCallback); + widgetPreview.widgetAjaxRequest = widgetsHelper.loadWidgetAjax(widgetUniqueId, widgetParameters, onWidgetLoadedCallback); + }); } /** diff --git a/plugins/Dashboard/templates/embeddedIndex.twig b/plugins/Dashboard/templates/embeddedIndex.twig index 92fc263a63..30afedc709 100644 --- a/plugins/Dashboard/templates/embeddedIndex.twig +++ b/plugins/Dashboard/templates/embeddedIndex.twig @@ -64,7 +64,8 @@ </div> <div class="row"> <div class="col s12 m6"><label for="copyDashboardUser">{{ 'General_Username'|translate }} </label></div> - <div class="col s12 m6"><select class="browser-default" name="copyDashboardUser" id="copyDashboardUser"></select></div> + <div class="col s12 m6"><select class="browser-default" name="copyDashboardUser" id="copyDashboardUser"> + <option>{{ 'General_LoadingData'|translate }}</option></select></div> </div> </div> diff --git a/plugins/Live/javascripts/SegmentedVisitorLog.js b/plugins/Live/javascripts/SegmentedVisitorLog.js index 4f80e3ddc7..6cc61ffdaa 100644 --- a/plugins/Live/javascripts/SegmentedVisitorLog.js +++ b/plugins/Live/javascripts/SegmentedVisitorLog.js @@ -131,7 +131,7 @@ var SegmentedVisitorLog = function() { ajaxRequest.addParams(requestParams, 'get'); ajaxRequest.setCallback(callback); ajaxRequest.setFormat('html'); - ajaxRequest.send(false); + ajaxRequest.send(); } return { diff --git a/plugins/Live/javascripts/live.js b/plugins/Live/javascripts/live.js index 15076b1f66..83c27081d7 100644 --- a/plugins/Live/javascripts/live.js +++ b/plugins/Live/javascripts/live.js @@ -94,7 +94,7 @@ } } }); - ajaxRequest.send(false); + ajaxRequest.send(); }, /** diff --git a/plugins/Live/templates/index.twig b/plugins/Live/templates/index.twig index 5112c85d10..a908f77434 100644 --- a/plugins/Live/templates/index.twig +++ b/plugins/Live/templates/index.twig @@ -19,7 +19,7 @@ ajaxRequest.setCallback(function (r) { $("#visitsTotal").html(r); }); - ajaxRequest.send(false); + ajaxRequest.send(); }, maxRows: 10, fadeInSpeed: 600, diff --git a/plugins/Morpheus/javascripts/ajaxHelper.js b/plugins/Morpheus/javascripts/ajaxHelper.js index e93c7a82e7..5360a35326 100644 --- a/plugins/Morpheus/javascripts/ajaxHelper.js +++ b/plugins/Morpheus/javascripts/ajaxHelper.js @@ -357,6 +357,9 @@ function ajaxHelper() { /** * Send the request + * + * Note: Sending synchronous requests will be removed in Matomo 4 + * * @param {Boolean} [sync] indicates if the request should be synchronous (defaults to false) * @return {void} */ diff --git a/plugins/Overlay/javascripts/Piwik_Overlay.js b/plugins/Overlay/javascripts/Piwik_Overlay.js index 2b18578147..e0be6ce5c9 100644 --- a/plugins/Overlay/javascripts/Piwik_Overlay.js +++ b/plugins/Overlay/javascripts/Piwik_Overlay.js @@ -87,7 +87,7 @@ var Piwik_Overlay = (function () { $errorNotLoading.show(); }); ajaxRequest.setFormat('html'); - ajaxRequest.send(false); + ajaxRequest.send(); } /** Adjust the dimensions of the iframe */ diff --git a/plugins/SEO/javascripts/rank.js b/plugins/SEO/javascripts/rank.js index 1b5cdb91d2..ef92aa8c3b 100644 --- a/plugins/SEO/javascripts/rank.js +++ b/plugins/SEO/javascripts/rank.js @@ -20,7 +20,7 @@ $(document).ready(function () { } ); ajaxRequest.setFormat('html'); - ajaxRequest.send(false); + ajaxRequest.send(); } // click on Rank button diff --git a/plugins/SegmentEditor/javascripts/Segmentation.js b/plugins/SegmentEditor/javascripts/Segmentation.js index fb52e12548..df5cf288d1 100644 --- a/plugins/SegmentEditor/javascripts/Segmentation.js +++ b/plugins/SegmentEditor/javascripts/Segmentation.js @@ -671,7 +671,7 @@ Segmentation = (function($) { ajaxHandler.setCallback(function (response) { self.updateMethod(params); }); - ajaxHandler.send(true); + ajaxHandler.send(); } else { self.updateMethod(params); } diff --git a/plugins/Transitions/javascripts/transitions.js b/plugins/Transitions/javascripts/transitions.js index 1bb6b1043b..8e6a03ad79 100644 --- a/plugins/Transitions/javascripts/transitions.js +++ b/plugins/Transitions/javascripts/transitions.js @@ -1471,7 +1471,7 @@ Piwik_Transitions_Ajax.prototype.callTransitionsController = function (action, c }, 'get'); ajaxRequest.setCallback(callback); ajaxRequest.setFormat('html'); - ajaxRequest.send(false); + ajaxRequest.send(); }; Piwik_Transitions_Ajax.prototype.callApi = function (method, params, callback) { @@ -1529,7 +1529,7 @@ Piwik_Transitions_Ajax.prototype.callApi = function (method, params, callback) { } } ); - ajaxRequest.send(false); + ajaxRequest.send(); }; // -------------------------------------- diff --git a/plugins/Widgetize/angularjs/widget-preview/widget-preview.directive.js b/plugins/Widgetize/angularjs/widget-preview/widget-preview.directive.js index 6694b15fae..eb9961548b 100644 --- a/plugins/Widgetize/angularjs/widget-preview/widget-preview.directive.js +++ b/plugins/Widgetize/angularjs/widget-preview/widget-preview.directive.js @@ -52,37 +52,38 @@ }; this.callbackAddExportButtonsUnderWidget = function (widgetUniqueId, loadedWidgetElement) { - var widget = widgetsHelper.getWidgetObjectFromUniqueId(widgetUniqueId); - var widgetParameters = widget['parameters']; + widgetsHelper.getWidgetObjectFromUniqueId(widgetUniqueId, function(widget) { + var widgetParameters = widget['parameters']; - var exportButtonsElement = $('<span id="exportButtons">'); + var exportButtonsElement = $('<span id="exportButtons">'); - var urlIframe = getEmbedUrl(widgetParameters, "iframe"); - // We first build the HTML code that will load the widget in an IFRAME - var widgetIframeHtml = '<div id="widgetIframe">' + - '<iframe width="100%" height="350" src="' + urlIframe + '" scrolling="no" frameborder="0" marginheight="0" marginwidth="0">' + - '</iframe>' + - '</div>'; + var urlIframe = getEmbedUrl(widgetParameters, "iframe"); + // We first build the HTML code that will load the widget in an IFRAME + var widgetIframeHtml = '<div id="widgetIframe">' + + '<iframe width="100%" height="350" src="' + urlIframe + '" scrolling="no" frameborder="0" marginheight="0" marginwidth="0">' + + '</iframe>' + + '</div>'; - // Add the input field containing the widget in an Iframe - $(exportButtonsElement).append( - '<div id="embedThisWidgetIframe">' + - '<label for="embedThisWidgetIframeInput">› Embed Iframe</label>' + - '<div id="embedThisWidgetIframeInput">' + - self.getInputFormWithHtml('iframeEmbed', widgetIframeHtml) + - '</div>' + - '</div>' + - '<div> <label for="embedThisWidgetDirectLink">› Direct Link</label>' + - '<div id="embedThisWidgetDirectLink"> ' + self.getInputFormWithHtml('directLinkEmbed', urlIframe) + ' - <a href="' + urlIframe + '" rel="noreferrer" target="_blank">' + _pk_translate('Widgetize_OpenInNewWindow') + '</a></div>' - + '</div>' - ); + // Add the input field containing the widget in an Iframe + $(exportButtonsElement).append( + '<div id="embedThisWidgetIframe">' + + '<label for="embedThisWidgetIframeInput">› Embed Iframe</label>' + + '<div id="embedThisWidgetIframeInput">' + + self.getInputFormWithHtml('iframeEmbed', widgetIframeHtml) + + '</div>' + + '</div>' + + '<div> <label for="embedThisWidgetDirectLink">› Direct Link</label>' + + '<div id="embedThisWidgetDirectLink"> ' + self.getInputFormWithHtml('directLinkEmbed', urlIframe) + ' - <a href="' + urlIframe + '" rel="noreferrer" target="_blank">' + _pk_translate('Widgetize_OpenInNewWindow') + '</a></div>' + + '</div>' + ); - // Finally we append the content to the parent widget DIV - $(loadedWidgetElement) - .parent() - .append(exportButtonsElement); + // Finally we append the content to the parent widget DIV + $(loadedWidgetElement) + .parent() + .append(exportButtonsElement); - piwik.helper.compileAngularComponents(exportButtonsElement); + piwik.helper.compileAngularComponents(exportButtonsElement); + }); } }, compile: function (element, attrs) { |