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
|
$(function () {
function isActionsModule(params)
{
return params.module == 'Actions';
}
function isPageUrlReport(params) {
var action = params.action;
return isActionsModule(params) &&
(action == 'getPageUrls' || action == 'getEntryPageUrls' || action == 'getExitPageUrls' || action == 'getPageUrlsFollowingSiteSearch');
};
function isPageTitleReport(params) {
var action = params.action;
return isActionsModule(params) && (action == 'getPageTitles' || action == 'getPageTitlesFollowingSiteSearch');
};
function getLinkForTransitionAndOverlayPopover(tr)
{
tr = getRealRowIfComparisonRow(tr);
var link = tr.find('> td:first > a').attr('href');
link = $('<textarea>').html(link).val(); // remove html entities
return link;
}
if (window.DataTable_RowActions_Transitions) {
DataTable_RowActions_Transitions.registerReport({
isAvailableOnReport: function (dataTableParams) {
return isPageUrlReport(dataTableParams);
},
isAvailableOnRow: function (dataTableParams, tr) {
tr = getRealRowIfComparisonRow(tr);
return isPageUrlReport(dataTableParams) && tr.find('> td:first span.label').parent().is('a')
},
trigger: function (tr, e, subTableLabel, originalRow) {
var overrideParams = $.extend({}, $(originalRow || tr).data('param-override'));
if (typeof overrideParams !== 'object') {
overrideParams = {};
}
tr = getRealRowIfComparisonRow(tr);
var link = getLinkForTransitionAndOverlayPopover(tr);
var popoverUrl = 'url:' + link;
Object.keys(overrideParams).forEach(function (paramName) {
if (!overrideParams[paramName]) {
return;
}
popoverUrl += ':' + encodeURIComponent(paramName) + ':' + encodeURIComponent(overrideParams[paramName]);
});
this.openPopover(popoverUrl);
}
});
DataTable_RowActions_Transitions.registerReport({
isAvailableOnReport: function (dataTableParams) {
return isPageTitleReport(dataTableParams);
},
isAvailableOnRow: function (dataTableParams, tr) {
return isPageTitleReport(dataTableParams);
},
trigger: function (tr, e, subTableLabel) {
DataTable_RowAction.prototype.trigger.apply(this, [tr, e, subTableLabel]);
}
});
}
if (window.DataTable_RowActions_Overlay) {
DataTable_RowActions_Overlay.registerReport({
isAvailableOnReport: function (dataTableParams) {
return isPageUrlReport(dataTableParams);
},
onClick: function (actionA, tr, e) {
return {
link: getLinkForTransitionAndOverlayPopover(tr),
segment: null
}
}
});
}
function getRealRowIfComparisonRow(tr) {
if (tr.is('.comparisonRow')) {
var prevUntil = tr.prevUntil('.parentComparisonRow').prev();
return prevUntil.length ? prevUntil : tr.prev();
}
return tr;
}
});
|