/*
Enable link preview popup when force touch is appled to link elements

@return   bool
435876
function() {
                var deferred = $q.defer();

                this.isAvailable().then(function() {
                    window.ThreeDeeTouch.enableLinkPreview();
                        deferred.resolve(true);
                },
                function(err) {
                    deferred.reject(err);
                });

                return deferred.promise;
            }
248878
public function preview()
	{
		$strPreview = '<div class="clr widget" style="padding-top:10px;"><h3 style="margin: 0;"><label>' . $this->label . '</label></h3><div><div class="selector_container"><ul class="' . (($this->source == 'image') ? 'sgallery' : '') . '">';

		switch ($this->source)
		{
			case 'image':
				if ($this->multiSource)
				{
					$strPreview .= '<li><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mPY/B8AAmgBsyYNIzsAAAAASUVORK5CYII=" width="80" height="60" alt="" class="gimage"></li><li><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mPY/B8AAmgBsyYNIzsAAAAASUVORK5CYII=" width="80" height="60" alt="" class="gimage"></li><li><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mPY/B8AAmgBsyYNIzsAAAAASUVORK5CYII=" width="80" height="60" alt="" class="gimage"></li>';				
				}
				else
				{
					$strPreview .= '<li><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mPY/B8AAmgBsyYNIzsAAAAASUVORK5CYII=" width="80" height="60" alt="" class="gimage"></li>';
				}
				break;
				
			case 'video':
				$strPreview .= '<li><img src="assets/contao/images/iconVIDEO.svg" width="18" height="18" alt=""> <span class="dirname">files/folder/</span>videofile.mp4 <span class="tl_gray">(5.0 MiB)</span></li><li><img src="assets/contao/images/iconVIDEO.svg" width="18" height="18" alt=""> <span class="dirname">files/folder/</span>videofile.webm <span class="tl_gray">(4.9 MiB)</span></li><li><img src="assets/contao/images/iconVIDEO.svg" width="18" height="18" alt=""> <span class="dirname">files/folder/</span>videofile.ogv <span class="tl_gray">(5.4 MiB)</span></li>';				
				break;
				
			case 'audio':
				$strPreview .= '<li><img src="assets/contao/images/iconAUDIO.svg" width="18" height="18" alt=""> <span class="dirname">files/folder/</span>audiofile.mp3 <span class="tl_gray">(2.5 MiB)</span></li><li><img src="assets/contao/images/iconAUDIO.svg" width="18" height="18" alt=""> <span class="dirname">files/folder/</span>audiofile.wma <span class="tl_gray">(3.4 MiB)</span></li>';				
				break;
				
			case 'custom':
			default:
				if ($this->multiSource)
				{
					$strPreview .= '<li><img src="assets/contao/images/iconPLAIN.svg" width="18" height="18" alt=""> <span class="dirname">files/folder/</span>selectedfile1.ext <span class="tl_gray">(128.0 KiB)</span></li><li><img src="assets/contao/images/iconPLAIN.svg" width="18" height="18" alt=""> <span class="dirname">files/folder/</span>selectedfile2.ext <span class="tl_gray">(2.0 MiB)</span></li><li><img src="assets/contao/images/iconPLAIN.svg" width="18" height="18" alt=""> <span class="dirname">files/folder/</span>selectedfile3.ext <span class="tl_gray">(512.0 KiB)</span></li>';				
				}
				else
				{
					$strPreview .= '<li><img src="assets/contao/images/iconPLAIN.svg" width="18" height="18" alt=""> files/folder/selectedfile1.ext <span class="tl_gray">(2.5 MiB)</span></li>';				
				}
				break;				
		}
	
		$strPreview .= '</ul><p><a href="javascript:void(0);" class="tl_submit">Change selection</a></p></div></div><p title="" class="tl_help tl_tip">' . $this->description . '</p></div>';

		if ($this->source == 'image' && $this->canChangeSize)
		{
			$strPreview .= '<div class="w50 clr widget"><h3 style="margin: 0; padding-top: 14px;"><label>' . $GLOBALS['TL_LANG']['tl_content_pattern']['size'][0] . '</label></h3><div class="tl_image_size"><select class="tl_select_interval">';
	
			$imgSizes = $this->getImageSizeList();
			$size = \StringUtil::deserialize($this->size);

			foreach ($imgSizes as $k=>$v)
			{
				if (!is_array($v))
				{
					$selected = ((is_numeric($size[2])) ? $kk == $size[2] : $vv == $size[2]) ? ' selected' : '';
					$label = ($GLOBALS['TL_LANG']['MSC'][$v]) ? (is_array($GLOBALS['TL_LANG']['MSC'][$v])) ? $GLOBALS['TL_LANG']['MSC'][$v][0] : $GLOBALS['TL_LANG']['MSC'][$v] : $v;
					$strPreview .= '<option value="' . \StringUtil::specialchars($v) . '"' . $selected . '>' . $label . '</option>';
				}
				else
				{
					$label = ($GLOBALS['TL_LANG']['MSC'][$k]) ? (is_array($GLOBALS['TL_LANG']['MSC'][$k])) ? $GLOBALS['TL_LANG']['MSC'][$k][0] : $GLOBALS['TL_LANG']['MSC'][$k] : $k;
					$strPreview .= '<optgroup label="&nbsp;' . \StringUtil::specialchars($label) . '">';
					
					$bolAssoc = array_is_assoc($v);
					foreach ($v as $kk=>$vv)
					{
						$selected = ((is_numeric($size[2]) && $bolAssoc) ? $kk == $size[2] : $vv == $size[2]) ? ' selected' : '';
						$strPreview .= '<option value="' . \StringUtil::specialchars($vv) . '"' . $selected . '>' . (($GLOBALS['TL_LANG']['MSC'][$vv]) ? $GLOBALS['TL_LANG']['MSC'][$vv][0] : $vv) . '</option>';
					}

					$strPreview .= '</optgroup>';
				}
			}
		
			$strPreview .= '</select> <input class="tl_text_4 tl_imageSize_0" value="" type="text"> <input class="tl_text_4 tl_imageSize_1" value="" type="text"></div><p title="" class="tl_help tl_tip">' . $GLOBALS['TL_LANG']['tl_content_pattern']['size'][1] . '</p></div>';
		}

		return $strPreview;
	}
259116
function (el) {
            $el = $(el);
            $el.on('scroll', handleScroll);
            $el.on('touchstart', handleTouchstart);
            $el.on('touchmove', handleTouchmove);
            $el.on('touchend', handleTouchend);
        }
1317997
protected function checkBrowserEdge()
    {
        if (stripos($this->_agent, 'Edge/') !== false) {
            $aresult = explode('/', stristr($this->_agent, 'Edge'));
            if (isset($aresult[1])) {
                $aversion = explode(' ', $aresult[1]);
                $this->setVersion($aversion[0]);
                $this->setBrowser(self::BROWSER_EDGE);
                if (stripos($this->_agent, 'Windows Phone') !== false || stripos($this->_agent, 'Android') !== false) {
                    $this->setMobile(true);
                }
                return true;
            }
        }
        return false;
    }
1116174
public function preview()
	{
		$strPreview = '<div class="w50 widget" style="padding-top:10px;"><h3 style="margin: 0;"><label>' . $this->label . '</label></h3>';
		$strPreview .= '<select class="tl_select" style="width: 412px;">';

		if (is_array($arrOptions = \StringUtil::deserialize($this->options)))
		{
			foreach ($arrOptions as $arrOption)
			{
				if ($arrOption['group'])
				{
					if ($blnOpenGroup)
					{
						$strPreview .= '</optgroup>';
					}
					
					$strPreview .= '<optgroup label="&nbsp;' . StringUtil::specialchars($arrOption['label']) . '">';
					$blnOpenGroup = true;
					continue;
				}
						
				$strPreview .= '<option value="' . StringUtil::specialchars($arrOption['value']) . '"' . (($arrOption['default']) ? ' selected' : '') . '>' . StringUtil::specialchars($arrOption['label']) . '</option>';
			}
		}
			
		if ($blnOpenGroup)
		{
			$strPreview .= '</optgroup>';
		}

		$strPreview .= '</select><p title="" class="tl_help tl_tip">' . $this->description . '</p></div>';
		return $strPreview;	
	}
898029
public function mapLinks()
    {
        if (!is_array($this->get_field('widget_header_links')) || empty($this->get_field('widget_header_links'))) {
            return false;
        }

        $avalibleLinkTypes = array(
            'external_link' => array(
                'classes'       => 'c-nav__link',
                'attributes'    => '',
                'template'      => 'widget.header-links.partials.link'
            ),
            'internal_link' => array(
                'classes'       => 'c-nav__link',
                'attributes'    => '',
                'template'      => 'widget.header-links.partials.link'
            ),
            'search_trigger' => array(
                'classes'       => 'o-reset-button u-nowrap c-nav__link js-search-trigger pricon pricon-search toggle-search-top',
                'attributes'    => 'onclick="return false;"',
                'text'          => 'Search',
                'template'      => 'widget.header-links.partials.button'
            ),
            'menu_trigger' => array(
                'classes'       => 'u-nowrap hamburger hamburger--slider menu-trigger',
                'attributes'    => 'aria-controls="navigation" aria-expanded="true/false" onclick="jQuery(this).toggleClass(\'is-active\');" data-target="#mobile-menu"',
                'text'          => __("Menu", 'municipio'),
                'template'      =>  'widget.header-links.partials.burger'
            ),
            'translate_trigger' => array(
                'classes'       => 'c-nav__link js-translate-trigger',
                'attributes'    => '',
                'text'          => 'Translate',
                'url'           => '#translate'
            )
        );

        $avalibleLinkTypes = apply_filters('Municipio/Widget/Header/Links/MapLinks/avalibleLinkTypes', $avalibleLinkTypes, $this->data['args'], $this->data['instance']);

        $links = array();
        foreach ($this->get_field('widget_header_links') as $key => $link) {
            //Check if ACF layout key exists within $avalibleLinkTypes
            if (isset($avalibleLinkTypes[$link['acf_fc_layout']])) {
                $links[$key] = array_merge($link, $avalibleLinkTypes[$link['acf_fc_layout']]);

                //Add icon classes if icon exists
                if (isset($link['icon']) && $link['icon']) {
                    $links[$key]['classes'] .= ' u-nowrap c-navbar__item_link--icon pricon ' .  $link['icon'];
                }

                if (!isset($links[$key]['url'])) {
                    $links[$key]['url'] = '#';
                }
            }
        }

        $links = apply_filters('Municipio/Widget/Header/Links/MapLinks', $links, $this->data['args'], $this->data['instance']);
        return $links;
    }
1299225
function(nodes, url, options) {
        if (Toolkit.isTouch) {
            return; // Flyouts shouldn't be usable on touch devices
        }

        this.nodes = $(nodes);
        options = this.setOptions(options);
        this.createWrapper();

        if (options.mode === 'click') {
            this.addEvents([
                ['click', 'document', 'onShowToggle', '{selector}'],
                ['resize', 'window', $.debounce(this.onHide.bind(this))]
            ]);
        } else {
            this.addEvents([
                ['mouseenter', 'document', 'onShowToggle', '{selector}'],
                ['mouseenter', 'document', 'onEnter', '{selector}'],
                ['mouseleave', 'document', 'onLeave', '{selector}']
            ]);
        }

        this.initialize();

        // Load data from the URL
        if (url) {
            $.getJSON(url, function(response) {
                this.load(response);
            }.bind(this));
        }
    }
618701
protected boolean onItemClicked() {

        if (isEnabled()) {
            m_overlay.closeSubMenus();

            if (hasSubMenu()) {
                openSubMenu();
                return false;
            } else {
                if (m_rootComponent.isHideAutomatically()) {
                    closeContextMenu();
                    return true;
                }
                return false;
            }
        }

        return false;
    }
751054
function linkAreaSwitch(status)
			{
				// remove all pre-link attribute (mark as "link will be added")
				clearSetElement("["+setdatalink+"]:not([href])");
				jQTE.find("["+setdatalink+"][href]").removeAttr(setdatalink);
				
				if(status)
				{
					toolbar.data("linkOpened",true);
					linkform.show();
				}
				else
				{ 
					toolbar.data("linkOpened",false);
					linkform.hide();
				}
				
				linktypeSwitch();
			}
1368259
public function touch()
    {
        if (!$this->timestamps) {
            return false;
        }

        $this->setAttribute('updated_at', date('Y-m-d H:i:s'));

        return (bool) $this->save();
    }
1356731
function showDevice(device, isShowing) {
  $('#device-' + device).checked = isShowing;

  var rendered = $('#' + device);
  if(!rendered) {
    var template = $('#' + device + '-frame-template');
    var clone = document.importNode(template, true);
    $('preview').appendChild(clone.content);
    //check for extra params in location.url to pass on to iframes
    var params = document.location.href.split('?');
    if (params) {
      var newparams = params[params.length - 1];
      var oldsrc = $('preview .frame').getAttribute('src');
      $('preview .frame').setAttribute('src', oldsrc + '&' + newparams);
    }
  } else {
    rendered.style.display = isShowing ? '' : 'none';
  }
}
410292
protected function checkBrowseriPad()
    {
        if (stripos($this->_agent, 'iPad') !== false) {
            $this->setVersion(self::VERSION_UNKNOWN);
            $this->setBrowser(self::BROWSER_IPAD);
            $this->getSafariVersionOnIos();
            $this->getChromeVersionOnIos();
            $this->checkForFacebookIos();
            $this->setTablet(true);
            return true;
        }
        return false;
    }
401287
function(e) {
        var node = $(e.currentTarget),
            element,
            isNode = (this.node && this.node.is(node)),
            cid = node.data('toolkit.cid');

        // Set the current element based on the nodes composite ID
        if (cid && this.elements[cid]) {
            element = this.elements[cid];
        } else {
            element = this.element;
        }

        if (element && element.is(':shown')) {

            // Touch devices should pass through on second click
            if (Toolkit.isTouch) {
                if (!isNode || this.node.prop('tagName').toLowerCase() !== 'a') {
                    e.preventDefault();
                }

                // Non-touch devices
            } else {
                e.preventDefault();
            }

            if (isNode) {
                // Second click should close it
                if (this.options.mode === 'click') {
                    this.hide();
                }

                // Exit if the same node so it doesn't re-open
                return;
            }

        } else {
            e.preventDefault();
        }

        this.show(node);
    }
670401
function DetectKindle()
   {
      if (stripos($this->useragent, $this->deviceKindle) > -1 &&
          $this->DetectAndroid() == $this->false)
         return $this->true; 
      else
         return $this->false; 
   }
683771
public function enableCallback()
    {
        $this->cb_view = $this->add('View');
        $this->cb_view->stickyGet('__atk_m', $this->name);
        $this->cb = $this->cb_view->add('CallbackLater');

        $this->cb->set(function () {
            if ($this->cb->triggered() && $this->fx) {
                $this->fx[0]($this->cb_view);
            }
            $modalName = isset($_GET['__atk_m']) ? $_GET['__atk_m'] : null;
            if ($modalName === $this->name) {
                $this->app->terminate($this->cb_view->renderJSON());
            }
        });
    }
1347654
function showTooltipBind() {
              if(hasEnableExp && !scope.$eval(attrs[prefix+'Enable'])) {
                return;
              }
              if ( scope.tt_popupDelay ) {
                popupTimeout = $timeout( show, scope.tt_popupDelay, false );
                popupTimeout.then(function(reposition){reposition();});
              } else {
                show()();
              }
            }
718855
protected function doProcess()
    {
        $links = $this->links;

        foreach ($this->getTouchArray() as $touchIcon) {
            $links->add($touchIcon);
        }

        foreach (['icon', 'shortcut icon'] as $rel) {
            $links->add(
                [
                    'rel'  => $rel,
                    'href' => $this->getFavicon()
                ]
            );
        }

        return true;
    }