From: rabuzarus <> Date: Sat, 28 May 2016 11:07:24 +0000 (+0200) Subject: frio: open hovercard on click if device is a mobile device X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=9dc442056182b3a4b0c9010e12596582d022f51a;p=friendica.git frio: open hovercard on click if device is a mobile device --- diff --git a/view/theme/frio/js/hovercard.js b/view/theme/frio/js/hovercard.js index 93c87e7a88..a0def61eb5 100644 --- a/view/theme/frio/js/hovercard.js +++ b/view/theme/frio/js/hovercard.js @@ -47,6 +47,14 @@ $(document).ready(function(){ var title = targetElement.attr("title"); targetElement.attr({"data-orig-title": title, title: ""}); + // if the device is a mobile open the hover card by click and not by hover + if(typeof is_mobile != "undefined") { + targetElement[0].removeAttribute("href"); + var hctrigger = 'click'; + } else { + var hctrigger = 'manual'; + }; + // Timeoute until the hover-card does appear setTimeout(function(){ if(targetElement.is(":hover") && parseInt(targetElement.attr('data-awaiting-hover-card'),10) == timeNow) { @@ -69,7 +77,7 @@ $(document).ready(function(){ } return "top"; }, - trigger: 'manual', + trigger: hctrigger, template: '
', content: data }).popover('show'); @@ -90,8 +98,12 @@ $(document).ready(function(){ // hover cards should be removed very easily, e.g. when any of these events happen $('body').on("mouseleave touchstart scroll click dblclick mousedown mouseup submit keydown keypress keyup", function(e){ - var timeNow = new Date().getTime(); - removeAllhoverCards(e,timeNow); + // remove hover card only for desktiop user, since on mobile we openen the hovercards + // by click event insteadof hover + if(typeof is_mobile == "undefined") { + var timeNow = new Date().getTime(); + removeAllhoverCards(e,timeNow); + }; }); // if we're hovering a hover card, give it a class, so we don't remove it diff --git a/view/theme/frio/theme.php b/view/theme/frio/theme.php index c5c18d0aa2..a7c3b0c5dc 100644 --- a/view/theme/frio/theme.php +++ b/view/theme/frio/theme.php @@ -21,9 +21,16 @@ function frio_init(&$a) { $frio = "view/theme/frio"; global $frio; - - + // if the device is a mobile device set js is_mobile + // variable so the js scripts can use this information + if($a->is_mobile || $a->is_tablet) { + $a->page["htmlhead"] .= <<< EOT + +EOT; + } if ($style == "") $style = get_config('frio', 'style');