diff --git a/plugins/CoreHome/javascripts/uiControl.js b/plugins/CoreHome/javascripts/uiControl.js index 58d9662acbc2b08f778e018370c9644ecaa90f7d..454b7134ff3ceb0c640ea5eaf7242226803598c1 100644 --- a/plugins/CoreHome/javascripts/uiControl.js +++ b/plugins/CoreHome/javascripts/uiControl.js @@ -56,6 +56,15 @@ } }; + UIControl.initElements = function (klass, selector) { + $(selector).each(function () { + if (!$(this).attr('data-inited')) { + var control = new klass(this); + $(this).attr('data-inited', 1); + } + }); + }; + UIControl.prototype = { /** diff --git a/plugins/Live/API.php b/plugins/Live/API.php index 0fa645f0ffc5d978f0f1089e7b711ac657322bbe..c58aefbed0c1b6ff5b6fff6d3ebd3ba109e7d698 100644 --- a/plugins/Live/API.php +++ b/plugins/Live/API.php @@ -153,7 +153,8 @@ class API * @param bool $doNotFetchActions * @return DataTable */ - public function getLastVisitsDetails($idSite, $period, $date, $segment = false, $filter_limit = false, $filter_offset = false, $minTimestamp = false, $flat = false, $doNotFetchActions = false) + public function getLastVisitsDetails($idSite, $period = false, $date = false, $segment = false, $filter_limit = false, + $filter_offset = false, $minTimestamp = false, $flat = false, $doNotFetchActions = false) { if (empty($filter_limit)) { $filter_limit = 10; diff --git a/plugins/Live/javascripts/visitorProfile.js b/plugins/Live/javascripts/visitorProfile.js index 112f2c07819e9d420fd87047e32b57530d39ff69..7c1aa9a301c67b4405cb7fcc27ea32e37530f04a 100644 --- a/plugins/Live/javascripts/visitorProfile.js +++ b/plugins/Live/javascripts/visitorProfile.js @@ -31,14 +31,7 @@ * if the element has not already been initialized. */ VisitorProfileControl.initElements = function () { - $('.visitor-profile').each(function () { - if (!$(this).attr('data-inited')) { - var control = new VisitorProfileControl(this); - - $(this).data('uiControlObject', control); - $(this).attr('data-inited', 1); - } - }); + UIControl.initElements(this, '.visitor-profile'); }; /** diff --git a/plugins/UserCountryMap/javascripts/realtime-map.js b/plugins/UserCountryMap/javascripts/realtime-map.js index e4e4eef09f53356272a373d50e8f15ad038e5e42..2c35c56f259871c0fba45fec0bb7916ef47cd9c0 100644 --- a/plugins/UserCountryMap/javascripts/realtime-map.js +++ b/plugins/UserCountryMap/javascripts/realtime-map.js @@ -19,14 +19,7 @@ }; RealtimeMap.initElements = function () { - $('.RealTimeMap').each(function () { - if (!$(this).attr('data-inited')) { - var control = new RealtimeMap(this); - - $(this).data('uiControlObject', control); - $(this).attr('data-inited', 1); - } - }); + UIControl.initElements(this, '.RealTimeMap'); }; $.extend(RealtimeMap.prototype, UIControl.prototype, { diff --git a/plugins/UserCountryMap/templates/realtimeMap.twig b/plugins/UserCountryMap/templates/realtimeMap.twig index 8e7d90e51a00cd5c7eecf6c5813977e2015e3831..6881700d13f5f38218117fdaa145f4f1fefd9272 100644 --- a/plugins/UserCountryMap/templates/realtimeMap.twig +++ b/plugins/UserCountryMap/templates/realtimeMap.twig @@ -21,4 +21,4 @@ </div> </div> -<script type="text/javascript">UserCountryMap.RealtimeMap.initElements();</script> +<script type="text/javascript">UserCountryMap.RealtimeMap.initElements();</script> \ No newline at end of file