Skip to content
Extraits de code Groupes Projets
Valider 77dfed20 rédigé par Thomas Steur's avatar Thomas Steur
Parcourir les fichiers

refs #4996 on hover display an image in case it starts with https?:// and ends...

refs #4996 on hover display an image in case it starts with https?:// and ends with jpg, gif, png or svg
parent e127384e
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -432,7 +432,6 @@ Nothing special here I think. We would probably automatically detect the type of
* Would content impressions be tracked in overlay session?
* Overlay session should not trigger a content impression
* Cache allowed site urls for redirects
* Show images on hover in report
* When a user clicks on an interaction, we should check whether we have already tracked the impression as the content is visible now. If not tracked before, we should track the impression as well
* There can be a scroll or timer event that detects the same content became visible as well. This would not be a problem since we do not track same content block twice
* Maybe v2
......
......@@ -16,7 +16,8 @@ class Contents extends \Piwik\Plugin
public function getListHooksRegistered()
{
return array(
'Metrics.getDefaultMetricTranslations' => 'addMetricTranslations'
'Metrics.getDefaultMetricTranslations' => 'addMetricTranslations',
'AssetManager.getJavaScriptFiles' => 'getJsFiles',
);
}
......@@ -27,4 +28,9 @@ class Contents extends \Piwik\Plugin
$translations['interaction_rate'] = 'Contents_InteractionRate';
}
public function getJsFiles(&$jsFiles)
{
$jsFiles[] = "plugins/Contents/javascripts/contentsDataTable.js";
}
}
......@@ -30,6 +30,8 @@ abstract class Base extends Report
*/
public function configureView(ViewDataTable $view)
{
$view->config->datatable_js_type = 'ContentsDataTable';
if (!empty($this->dimension)) {
$view->config->addTranslations(array('label' => $this->dimension->getName()));
}
......
/*!
* Piwik - free/libre analytics platform
*
* @link http://piwik.org
* @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
*/
(function ($, require) {
var exports = require('piwik/UI'),
DataTable = exports.DataTable,
dataTablePrototype = DataTable.prototype;
/**
* UI control that handles extra functionality for Actions datatables.
*
* @constructor
*/
exports.ContentsDataTable = function (element) {
DataTable.call(this, element);
};
$.extend(exports.ContentsDataTable.prototype, dataTablePrototype, {
//see dataTable::bindEventsAndApplyStyle
_init: function (domElem) {
domElem.find('table > tbody > tr').each(function (index, tr) {
var $tr = $(tr);
var $td = $tr.find('.label .value');
var text = $td.text().trim();
if (text.search('^https?:\/\/[^\/]+') !== -1) {
if (text.match(/(.jpg|.gif|.png|.svg)$/)) {
$td.tooltip({
track: true,
items: 'span',
content: '<p><img style="max-width: 150px;max-height:150px;" src="' + text + '"/></p>',
tooltipClass: 'rowActionTooltip',
show: true,
hide: false
});
}
}
});
}
});
})(jQuery, require);
\ No newline at end of file
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter