Commit 40dd394e authored by Simon's avatar Simon

Merge branch 'employers-map' into dev

parents 0a799634 8fa358a2
......@@ -4961,7 +4961,8 @@
"ansi-regex": {
"version": "2.1.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"aproba": {
"version": "1.2.0",
......@@ -4982,12 +4983,14 @@
"balanced-match": {
"version": "1.0.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"brace-expansion": {
"version": "1.1.11",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
......@@ -5002,17 +5005,20 @@
"code-point-at": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"concat-map": {
"version": "0.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"console-control-strings": {
"version": "1.1.0",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"core-util-is": {
"version": "1.0.2",
......@@ -5129,7 +5135,8 @@
"inherits": {
"version": "2.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"ini": {
"version": "1.3.5",
......@@ -5141,6 +5148,7 @@
"version": "1.0.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"number-is-nan": "^1.0.0"
}
......@@ -5155,6 +5163,7 @@
"version": "3.0.4",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"brace-expansion": "^1.1.7"
}
......@@ -5162,12 +5171,14 @@
"minimist": {
"version": "0.0.8",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"minipass": {
"version": "2.3.5",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
......@@ -5186,6 +5197,7 @@
"version": "0.5.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"minimist": "0.0.8"
}
......@@ -5266,7 +5278,8 @@
"number-is-nan": {
"version": "1.0.1",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"object-assign": {
"version": "4.1.1",
......@@ -5278,6 +5291,7 @@
"version": "1.4.0",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"wrappy": "1"
}
......@@ -5363,7 +5377,8 @@
"safe-buffer": {
"version": "5.1.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"safer-buffer": {
"version": "2.1.2",
......@@ -5399,6 +5414,7 @@
"version": "1.0.2",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0",
......@@ -5418,6 +5434,7 @@
"version": "3.0.1",
"bundled": true,
"dev": true,
"optional": true,
"requires": {
"ansi-regex": "^2.0.0"
}
......@@ -5461,12 +5478,14 @@
"wrappy": {
"version": "1.0.2",
"bundled": true,
"dev": true
"dev": true,
"optional": true
},
"yallist": {
"version": "3.0.3",
"bundled": true,
"dev": true
"dev": true,
"optional": true
}
}
},
......@@ -7955,79 +7974,6 @@
"lower-case": "^1.1.1"
}
},
"node-http2": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/node-http2/-/node-http2-4.0.1.tgz",
"integrity": "sha1-Fk/1O13SLITwrxQrh3xerraAmVk=",
"dev": true,
"requires": {
"assert": "1.4.1",
"events": "1.1.1",
"https-browserify": "0.0.1",
"setimmediate": "^1.0.5",
"stream-browserify": "2.0.1",
"timers-browserify": "2.0.2",
"url": "^0.11.0",
"websocket-stream": "^5.0.1"
},
"dependencies": {
"assert": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/assert/-/assert-1.4.1.tgz",
"integrity": "sha1-mZEtWRg2tab1s0XA8H7vwI/GXZE=",
"dev": true,
"requires": {
"util": "0.10.3"
}
},
"events": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz",
"integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=",
"dev": true
},
"https-browserify": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-0.0.1.tgz",
"integrity": "sha1-P5E2XKvmC3ftDruiS0VOPgnZWoI=",
"dev": true
},
"inherits": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz",
"integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=",
"dev": true
},
"stream-browserify": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.1.tgz",
"integrity": "sha1-ZiZu5fm9uZQKTkUUyvtDu3Hlyds=",
"dev": true,
"requires": {
"inherits": "~2.0.1",
"readable-stream": "^2.0.2"
}
},
"timers-browserify": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.2.tgz",
"integrity": "sha1-q0iDz1l9zVCvIRNJoA+8pWrIa4Y=",
"dev": true,
"requires": {
"setimmediate": "^1.0.4"
}
},
"util": {
"version": "0.10.3",
"resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz",
"integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=",
"dev": true,
"requires": {
"inherits": "2.0.1"
}
}
}
},
"node-libs-browser": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.2.1.tgz",
......@@ -16033,33 +15979,6 @@
"source-map": "~0.6.1"
}
},
"websocket-stream": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/websocket-stream/-/websocket-stream-5.5.0.tgz",
"integrity": "sha512-EXy/zXb9kNHI07TIMz1oIUIrPZxQRA8aeJ5XYg5ihV8K4kD1DuA+FY6R96HfdIHzlSzS8HiISAfrm+vVQkZBug==",
"dev": true,
"requires": {
"duplexify": "^3.5.1",
"inherits": "^2.0.1",
"readable-stream": "^2.3.3",
"safe-buffer": "^5.1.2",
"ws": "^3.2.0",
"xtend": "^4.0.0"
},
"dependencies": {
"ws": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/ws/-/ws-3.3.3.tgz",
"integrity": "sha512-nnWLa/NwZSt4KQJu51MYlCcSQ5g7INpOrOMt4XV8j4dqTXdmlUmSHQ8/oLC069ckre0fRsgfvsKwbTdtKLCDkA==",
"dev": true,
"requires": {
"async-limiter": "~1.0.0",
"safe-buffer": "~5.1.0",
"ultron": "~1.1.0"
}
}
}
},
"which": {
"version": "1.3.1",
"resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz",
......
......@@ -59,8 +59,6 @@ const lisp = (str) => {
return str;
};
// console.error(46);
const autocomplete = (str) => {
const node = document.getElementById(str);
const arrow = document.querySelector('.js-toggle--' + str);
......@@ -332,39 +330,6 @@ if (module.hot) {
})(window);
const mapStyles = [
{
featureType: 'all',
elementType: 'all',
stylers: [
{
saturation: -92
},
{
lightness: -8
},
{
hue: '#004ed4'
}
]
},
{
featureType: 'water',
elementType: 'all',
stylers: [
{
saturation: -95
},
{
lightness: -25
},
{
hue: '#004ed4'
}
]
}
];
var info;
function setMarkers (map, positions, focus) {
......@@ -391,7 +356,6 @@ function setMarkers (map, positions, focus) {
marker['content'] = position.content;
window.google.maps.event.addListener(marker, 'click', function () {
info = new window.google.maps.InfoWindow({
content: this.content
});
......@@ -417,17 +381,21 @@ function setMarkers (map, positions, focus) {
}
}
function initRegionsMap (node) {
if (!window.google) {
setTimeout(() => { initRegionsMap(node); }, 250);
return;
}
var options = {
mapTypeIds: [window.google.maps.MapTypeId.ROADMAP, window.google.maps.MapTypeId.HYBRID, 'biuro']
};
function setGoogleMap (node) {
const mapStyles = [
{
featureType: 'all',
elementType: 'all',
stylers: [{ saturation: -92 }, { lightness: -8 }, { hue: '#004ed4' }]
},
{
featureType: 'water',
elementType: 'all',
stylers: [{ saturation: -95 }, { lightness: -25 }, { hue: '#004ed4' }]
}
];
var map = new window.google.maps.Map(node, options);
var map = new window.google.maps.Map(node, {});
var biuroMap = new window.google.maps.StyledMapType(mapStyles, { name: 'Biuro' });
......@@ -441,6 +409,17 @@ function initRegionsMap (node) {
}
});
return map;
}
function initRegionsMap (node) {
if (!window.google) {
setTimeout(() => { initRegionsMap(node); }, 250);
return;
}
var map = setGoogleMap(node);
const regions = [
{ title: 'Vilnius', lat: 54.687157, lng: 25.279652 },
{ title: 'Rīga', lat: 56.946285, lng: 24.105078 },
......@@ -456,23 +435,7 @@ function initDivisionsMap (node, data) {
return;
}
var options = {
mapTypeIds: [window.google.maps.MapTypeId.ROADMAP, window.google.maps.MapTypeId.HYBRID, 'biuro']
};
var map = new window.google.maps.Map(node, options);
var biuroMap = new window.google.maps.StyledMapType(mapStyles, { name: 'Biuro' });
map.mapTypes.set('biuro', biuroMap);
map.setMapTypeId('biuro');
window.google.maps.event.addListenerOnce(map, 'bounds_changed', function () {
if (this.getZoom() > 15) {
this.setZoom(14);
}
});
var map = setGoogleMap(node);
let divisions = [];
......
......@@ -63,7 +63,7 @@
/******/
/******/ var hotApplyOnUpdate = true;
/******/ // eslint-disable-next-line no-unused-vars
/******/ var hotCurrentHash = "5a7a9e98fb74556872a9";
/******/ var hotCurrentHash = "0bbb4e1cd69f1d91c4f1";
/******/ var hotRequestTimeout = 10000;
/******/ var hotCurrentModuleData = {};
/******/ var hotCurrentChildModule;
......@@ -995,7 +995,7 @@ eval("var logLevel = \"info\";\n\nfunction dummy() {}\n\nfunction shouldLog(leve
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _vendor_awesomplete__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./vendor/awesomplete */ \"./wp-content/themes/biuro/js/vendor/awesomplete.js\");\n/* harmony import */ var _vendor_swiper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./vendor/swiper */ \"./wp-content/themes/biuro/js/vendor/swiper.js\");\n/* harmony import */ var _vendor_swiper__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_vendor_swiper__WEBPACK_IMPORTED_MODULE_1__);\n// https://github.com/webpack/webpack/issues/8656#issuecomment-456001556\n// import \"core-js/es\";\n// import(/* webpackChunkName: \"autocomplete\" */ './components/autocomplete');\n// import(/* webpackChunkName: \"feedbacks\" */ './components/feedbacks');\n\n\nvar swiper = new _vendor_swiper__WEBPACK_IMPORTED_MODULE_1___default.a('.c-feedbacks--inner', {\n speed: 900,\n autoplay: {\n delay: 6000,\n disableOnInteraction: false\n },\n grabCursor: true,\n loop: true,\n pagination: {\n el: '.swiper-pagination',\n clickable: true\n }\n});\n\nvar lisp = function lisp(str) {\n var symbols = {\n 'ą': 'a',\n 'č': 'c',\n 'ę': 'e',\n 'ė': 'e',\n 'į': 'i',\n 'š': 's',\n 'ų': 'u',\n 'ū': 'u',\n 'ž': 'z',\n 'ā': 'a',\n 'ē': 'e',\n 'ģ': 'g',\n 'ī': 'i',\n 'ķ': 'k',\n 'ļ': 'l',\n 'ņ': 'n',\n 'õ': 'o',\n 'ä': 'a',\n 'ö': 'o',\n 'ü': 'u'\n };\n str = str.trim();\n str = str.toLowerCase();\n str = str.replace(/[ąčęėįšųūžāēģīķļņõäöü]/g, function (s) {\n return symbols[s];\n });\n return str;\n}; // console.error(46);\n\n\nvar autocomplete = function autocomplete(str) {\n var node = document.getElementById(str);\n var arrow = document.querySelector('.js-toggle--' + str);\n var clear = document.querySelector('.js-clear--' + str);\n var isOpen = false;\n\n var toggle = function toggle(status) {\n var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n setTimeout(function () {\n isOpen = status;\n }, delay);\n\n if (arrow) {\n arrow.classList.toggle('is-open', status);\n }\n };\n\n if (!node) {\n return;\n }\n\n var box = new _vendor_awesomplete__WEBPACK_IMPORTED_MODULE_0__[\"default\"](node, {\n minChars: 0,\n maxItems: 1000,\n sort: false,\n filter: function filter(text, input) {\n return lisp(text).indexOf(lisp(input)) !== -1;\n }\n });\n node.addEventListener('input', function () {\n if (clear) {\n clear.classList.toggle('u-hidden', !node.value);\n }\n\n if (arrow) {\n arrow.classList.toggle('u-hidden', !!node.value);\n }\n });\n node.addEventListener('focus', function () {\n if (box.ul.childNodes.length === 0 || box.ul.hasAttribute('hidden')) {\n toggle(true);\n box.evaluate();\n } else {\n toggle(false);\n box.close();\n }\n });\n node.addEventListener('blur', function () {\n var suggestion = Array.isArray(box.suggestions) && box.suggestions.length === 1 ? box.suggestions[0] : null;\n\n if (!suggestion) {\n return;\n }\n\n if (lisp(node.value) === lisp(suggestion.value)) {\n node.value = suggestion.value;\n }\n });\n node.addEventListener('awesomplete-selectcomplete', function () {\n node.blur();\n\n if (clear) {\n clear.classList.remove('u-hidden');\n }\n\n if (arrow) {\n arrow.classList.add('u-hidden');\n }\n });\n node.addEventListener('awesomplete-close', function () {\n toggle(false, 150);\n });\n\n if (arrow) {\n arrow.addEventListener('click', function () {\n if (!isOpen) {\n node.focus();\n } else {\n box.close();\n }\n });\n }\n\n if (clear) {\n clear.addEventListener('click', function () {\n node.value = '';\n node.focus();\n\n if (clear) {\n clear.classList.add('u-hidden');\n }\n\n if (arrow) {\n arrow.classList.remove('u-hidden');\n }\n });\n }\n};\n\nautocomplete('search-city');\nautocomplete('search-query');\nvar search = document.getElementById('search');\nvar city = document.getElementById('search-city');\nvar query = document.getElementById('search-query');\n\nif (search) {\n search.addEventListener('submit', function (e) {\n if (city && !city.value && query && !query.value) {\n city.focus();\n e.preventDefault();\n }\n }, false);\n}\n\nvar node = document.getElementById('form-city');\nvar cityID = document.getElementById('form-city-id');\n\nif (node) {\n var nodeBox = new _vendor_awesomplete__WEBPACK_IMPORTED_MODULE_0__[\"default\"](node, {\n minChars: 0,\n maxItems: 1000,\n sort: false,\n filter: function filter(text, input) {\n return lisp(text).indexOf(lisp(input)) !== -1;\n },\n replace: function replace(suggestion) {\n this.input.value = suggestion.label;\n\n if (cityID) {\n cityID.value = suggestion.value;\n }\n }\n });\n node.addEventListener('focus', function () {\n nodeBox.evaluate();\n });\n node.addEventListener('blur', function () {\n var suggestion = Array.isArray(nodeBox.suggestions) && nodeBox.suggestions.length === 1 ? nodeBox.suggestions[0] : null;\n\n if (!suggestion) {\n return;\n }\n\n if (lisp(node.value) === lisp(suggestion.label)) {\n node.value = suggestion.label;\n\n if (cityID) {\n cityID.value = suggestion.value;\n }\n }\n });\n}\n\nif (window.NodeList && !NodeList.prototype.forEach) {\n NodeList.prototype.forEach = Array.prototype.forEach;\n}\n\n(function (arr) {\n arr.forEach(function (item) {\n if (item.hasOwnProperty('remove')) {\n return;\n }\n\n Object.defineProperty(item, 'remove', {\n configurable: true,\n enumerable: true,\n writable: true,\n value: function remove() {\n if (this.parentNode === null) {\n return;\n }\n\n this.parentNode.removeChild(this);\n }\n });\n });\n})([Element.prototype, CharacterData.prototype, DocumentType.prototype]);\n\n(function (global) {\n var container = document.getElementById('cookie-warning');\n var btnAgree = document.getElementById('cookie-agree');\n var btnClose = document.getElementById('cookie-close');\n var agreed = useLS() ? localStorage.getItem('biuro-agree') : false;\n\n function useLS() {\n var mod = 'a';\n\n try {\n localStorage.setItem(mod, mod);\n localStorage.removeItem(mod);\n return true;\n } catch (e) {\n return false;\n }\n }\n\n if (!container || !btnAgree || !btnClose || agreed) {\n return;\n }\n\n container.style.display = 'block';\n btnAgree.addEventListener('click', function () {\n if (useLS()) {\n localStorage.setItem('biuro-agree', 'true');\n }\n\n container.style.display = 'none';\n });\n btnClose.addEventListener('click', function () {\n container.style.display = 'none';\n });\n})(window);\n\nif (true) {\n module.hot.accept();\n}\n\n(function (global) {\n var node = document.getElementById('js-map--divisions');\n\n if (!node) {\n return;\n }\n\n fetch('/wp-json/api/v1/divisions?langID=' + node.dataset.id).then(function (t) {\n return t.json();\n }).then(function (data) {\n initDivisionsMap(node, data);\n });\n})(window);\n\n(function (global) {\n var node = document.querySelector('.c-nav--lang');\n\n if (!node) {\n return;\n }\n\n node.addEventListener('click', function (e) {\n e.currentTarget.classList.toggle('c-nav--lang--is-open');\n });\n})(window);\n\n(function (global) {\n var node = document.getElementById('js-map--regions');\n\n if (!node) {\n return;\n }\n\n initRegionsMap(node);\n})(window);\n\n(function (global) {\n document.querySelectorAll('.js-toggle--nav').forEach(function (node) {\n node.addEventListener('click', function (e) {\n e.preventDefault();\n document.body.classList.toggle('is-nav--open');\n });\n });\n document.querySelectorAll('.js-toggle--aside').forEach(function (node) {\n node.addEventListener('click', function (e) {\n e.preventDefault();\n document.body.classList.toggle('is-aside--open');\n });\n });\n})(window);\n\nvar mapStyles = [{\n featureType: 'all',\n elementType: 'all',\n stylers: [{\n saturation: -92\n }, {\n lightness: -8\n }, {\n hue: '#004ed4'\n }]\n}, {\n featureType: 'water',\n elementType: 'all',\n stylers: [{\n saturation: -95\n }, {\n lightness: -25\n }, {\n hue: '#004ed4'\n }]\n}];\nvar info;\n\nfunction setMarkers(map, positions, focus) {\n var bounds = new window.google.maps.LatLngBounds();\n\n for (var i = 0; i < positions.length; i++) {\n var position = positions[i];\n var pos = new window.google.maps.LatLng(position.lat, position.lng);\n var marker = new window.google.maps.Marker({\n position: pos,\n map: map,\n icon: '/wp-content/themes/biuro/i/ico--map-pin.svg',\n title: position.title || ''\n });\n\n if (info) {\n info.close();\n }\n\n bounds.extend(pos);\n\n if (position.content) {\n marker['content'] = position.content;\n window.google.maps.event.addListener(marker, 'click', function () {\n info = new window.google.maps.InfoWindow({\n content: this.content\n });\n info.open(map, this);\n });\n }\n\n if (focus) {\n if (window.innerWidth < 960) {\n window.scrollTo(0, 0);\n }\n\n new google.maps.event.trigger(marker, 'click');\n }\n }\n\n map.fitBounds(bounds);\n\n if (window.innerWidth > 1020) {\n map.panBy(250, 0);\n } else if (window.innerWidth > 959) {\n map.panBy(180, 0);\n }\n}\n\nfunction initRegionsMap(node) {\n if (!window.google) {\n setTimeout(function () {\n initRegionsMap(node);\n }, 250);\n return;\n }\n\n var options = {\n mapTypeIds: [window.google.maps.MapTypeId.ROADMAP, window.google.maps.MapTypeId.HYBRID, 'biuro']\n };\n var map = new window.google.maps.Map(node, options);\n var biuroMap = new window.google.maps.StyledMapType(mapStyles, {\n name: 'Biuro'\n });\n map.mapTypes.set('biuro', biuroMap);\n map.setMapTypeId('biuro');\n window.google.maps.event.addListenerOnce(map, 'bounds_changed', function () {\n if (this.getZoom() > 15) {\n this.setZoom(14);\n }\n });\n var regions = [{\n title: 'Vilnius',\n lat: 54.687157,\n lng: 25.279652\n }, {\n title: 'Rīga',\n lat: 56.946285,\n lng: 24.105078\n }, {\n title: 'Tallinn',\n lat: 59.436962,\n lng: 24.753574\n }];\n setMarkers(map, regions);\n}\n\nfunction initDivisionsMap(node, data) {\n if (!window.google) {\n setTimeout(function () {\n initDivisionsMap(node, data);\n }, 250);\n return;\n }\n\n var options = {\n mapTypeIds: [window.google.maps.MapTypeId.ROADMAP, window.google.maps.MapTypeId.HYBRID, 'biuro']\n };\n var map = new window.google.maps.Map(node, options);\n var biuroMap = new window.google.maps.StyledMapType(mapStyles, {\n name: 'Biuro'\n });\n map.mapTypes.set('biuro', biuroMap);\n map.setMapTypeId('biuro');\n window.google.maps.event.addListenerOnce(map, 'bounds_changed', function () {\n if (this.getZoom() > 15) {\n this.setZoom(14);\n }\n });\n var divisions = [];\n Object.keys(data).forEach(function (key) {\n var division = data[key];\n\n if (key.substr(0, 4) === 'city') {\n divisions = divisions.concat(division);\n }\n });\n document.querySelectorAll('.js-division').forEach(function (node) {\n node.addEventListener('click', function () {\n var ID = node && node.dataset.id ? node.dataset.id : '';\n\n if (data[ID]) {\n setMarkers(map, data[ID].filter(function (d) {\n return d.lat && d.lng;\n }), true);\n } else {\n setMarkers(map, divisions.filter(function (d) {\n return d.lat && d.lng;\n }));\n }\n });\n });\n setMarkers(map, divisions.filter(function (d) {\n return d.lat && d.lng;\n }));\n}\n\ndocument.querySelectorAll('.js-form--input-file').forEach(function (node) {\n node.addEventListener('change', function () {\n var parent = node.parentNode;\n var name = node.value.split(/\\\\|\\//).pop();\n var text = parent.querySelector('.js-form--input-file-text');\n\n if (text && name) {\n text.innerHTML = name;\n }\n });\n});\ndocument.querySelectorAll('.js-toggle--services').forEach(function (node) {\n node.addEventListener('click', function () {\n node.parentNode.classList.toggle('c-services--is-open');\n });\n});\ndocument.querySelectorAll('.js-toggle--sections').forEach(function (node) {\n node.addEventListener('click', function () {\n var parent = node.parentNode;\n\n if (parent.classList.contains('c-sections--is-open')) {\n parent.classList.toggle('c-sections--is-open');\n } else {\n document.querySelectorAll('.c-sections--is-open').forEach(function (node) {\n node.classList.remove('c-sections--is-open');\n });\n parent.classList.toggle('c-sections--is-open');\n }\n });\n});\ndocument.querySelectorAll('.js-expand-jobs-section').forEach(function (node) {\n node.addEventListener('click', function (e) {\n e.preventDefault();\n node.parentNode.classList.remove('c-jobs-section--is-closed');\n node.remove();\n });\n});\n\nvar initiatePositionForm = function initiatePositionForm() {\n var button = document.querySelector('[name=\"s\"][value=\"1\"]');\n\n if (button) {\n button.click();\n return;\n }\n\n var input = document.querySelector('[name=\"name\"]');\n\n if (input) {\n input.focus();\n }\n};\n\nif (document.querySelector('.js-inititate-position-form')) {\n document.querySelector('.js-inititate-position-form').addEventListener('click', initiatePositionForm);\n}\n\nif (document.querySelector('.js-focus-form')) {\n document.querySelector('.js-focus-form').addEventListener('click', function () {\n var input = document.querySelector('.c-form input:first-of-type');\n\n if (input) {\n input.focus();\n }\n });\n}\n\nif (document.querySelector('.js-modal--close')) {\n document.querySelector('.js-modal--close').addEventListener('click', function () {\n var modal = document.querySelector('.c-modal');\n\n if (modal) {\n modal.remove();\n }\n\n var node = document.querySelector('.c-form [autofocus]');\n\n if (node) {\n node.focus();\n }\n });\n}\n\nfunction fallbackCopyTextToClipboard(text) {\n var textArea = document.createElement('textarea');\n textArea.value = text;\n document.body.appendChild(textArea);\n textArea.focus();\n textArea.select();\n\n try {\n var successful = document.execCommand('copy');\n var msg = successful ? 'successful' : 'unsuccessful';\n console.log('Fallback: Copying text command was ' + msg);\n } catch (err) {\n console.error('Fallback: Oops, unable to copy', err);\n }\n\n document.body.removeChild(textArea);\n}\n\nfunction showCopyTooltip() {\n var tooltip = document.querySelector('#copy-tooltip');\n\n if (tooltip) {\n tooltip.style.opacity = 1;\n setTimeout(function () {\n tooltip.style.opacity = 0;\n }, 3000);\n }\n}\n\nfunction copyTextToClipboard(text) {\n if (!navigator.clipboard) {\n fallbackCopyTextToClipboard(text);\n showCopyTooltip();\n return;\n }\n\n navigator.clipboard.writeText(text).then(function () {\n showCopyTooltip();\n }, function (err) {\n console.error('Async: Could not copy text: ', err);\n });\n}\n\nif (document.querySelector('.js-copy-to-clipboard')) {\n document.querySelector('.js-copy-to-clipboard').addEventListener('click', function (e) {\n e.preventDefault();\n var sep = window.location.href.indexOf('?') === -1 ? '?' : '&';\n copyTextToClipboard(window.location.href + sep + 'utm_source=biuro&utm_medium=Share&utm_campaign=Copy');\n });\n}\n\n(function (global) {\n var node = document.querySelector('.c-form [autofocus]');\n\n if (node) {\n node.focus();\n }\n\n if (location.hash) {\n var error = document.querySelector('.c-form--input-wrap--error input') || document.querySelector('.c-form--checkbox--error');\n\n if (error) {\n error.focus();\n return;\n }\n\n var input = document.querySelector('.c-form [name=\"name\"]');\n\n if (input) {\n input.focus();\n }\n }\n})(window);\n\n(function (global) {\n document.querySelectorAll('.gtm-share-click').forEach(function (node) {\n node.addEventListener('click', function (e) {\n window.dataLayer = window.dataLayer || [];\n window.dataLayer.push({\n 'event': 'shareClick',\n 'shareLabel': node.dataset.label || ''\n });\n });\n });\n})(window); // async function autocomplete() {\n// // await import(/* webpackChunkName: \"autocomplete\" */ './components/autocomplete');\n// const aaaa = require('./components/autocomplete').default;\n// }\n// if (document.getElementById('search-city') || document.getElementById('search-query') || document.getElementById('form-city')) {\n// autocomplete();\n// }\n// async function feedbacks() {\n// await import(/* webpackChunkName: \"feedbacks\" */ './components/feedbacks');\n// };\n// if (document.querySelectorAll('.c-feedbacks--inner').length) {\n// feedbacks();\n// }\n\n\nvar submitContactsFrom = function submitContactsFrom(form) {\n if (form.querySelector('[type=\"submit\"]')) {\n form.querySelector('[type=\"submit\"]').classList.add('c-btn--disabled');\n }\n};\n\ndocument.querySelectorAll('[name=\"form-position\"], [name=\"form-employees\"], [name=\"form-employers\"]').forEach(function (form) {\n form.addEventListener('submit', function () {\n submitContactsFrom(form);\n });\n});\n\nvar collapseContent = function collapseContent(n) {\n var h = n.scrollHeight;\n var t = n.style.transition;\n n.style.transition = '';\n requestAnimationFrame(function () {\n n.style.height = h + 'px';\n n.style.transition = t;\n requestAnimationFrame(function () {\n n.style.height = 0 + 'px';\n });\n });\n};\n\nvar expandContent = function expandContent(n) {\n var h = n.scrollHeight;\n\n var done = function done(e) {\n n.removeEventListener('transitionend', done); // n.style.height = null;\n };\n\n n.style.height = h + 'px';\n n.addEventListener('transitionend', done);\n};\n\ndocument.querySelectorAll('.js-accordion--header').forEach(function (header) {\n header.addEventListener('click', function () {\n var node = header.nextElementSibling;\n\n if (!node || !node.classList.contains('c-accordion--content')) {\n return;\n }\n\n var isOpen = header.classList.contains('c-accordion--header--is-expanded');\n\n if (isOpen) {\n collapseContent(node);\n } else {\n expandContent(node);\n }\n\n header.classList.toggle('c-accordion--header--is-expanded', !isOpen);\n });\n});\ndocument.querySelectorAll('.c-accordion--content').forEach(function (content) {\n content.classList.add('c-accordion--content--is-collapsed');\n});\nvar isPageActive = true;\n\nwindow.onfocus = function () {\n isPageActive = true;\n};\n\nwindow.onblur = function () {\n isPageActive = false;\n};\n\nvar messenger = document.querySelector('.js-share-messenger');\n\nif (messenger) {\n messenger.addEventListener('click', function (e) {\n e.preventDefault();\n var sep = window.location.href.indexOf('?') === -1 ? '?' : '&';\n var target = e.currentTarget;\n window.location.href = 'fb-messenger://share/?link=' + encodeURIComponent(window.location.href + sep + 'utm_source=biuro&utm_medium=Share&utm_campaign=Messenger&app_id=' + target.dataset.id);\n setTimeout(function () {\n if (document.hidden || !isPageActive) {\n return;\n }\n\n window.location.href = target.href;\n }, 100);\n });\n}\n\nvar whatsapp = document.querySelector('.js-share-whatsapp');\n\nif (whatsapp) {\n whatsapp.addEventListener('click', function (e) {\n e.preventDefault();\n var target = e.currentTarget;\n window.location.href = 'whatsapp://send?text=' + encodeURIComponent(target.dataset.text);\n setTimeout(function () {\n if (document.hidden || !isPageActive) {\n return;\n }\n\n window.open(target.href, '_blank');\n }, 100);\n });\n}\n\n//# sourceURL=webpack:///./wp-content/themes/biuro/js/main.js?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _vendor_awesomplete__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./vendor/awesomplete */ \"./wp-content/themes/biuro/js/vendor/awesomplete.js\");\n/* harmony import */ var _vendor_swiper__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./vendor/swiper */ \"./wp-content/themes/biuro/js/vendor/swiper.js\");\n/* harmony import */ var _vendor_swiper__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_vendor_swiper__WEBPACK_IMPORTED_MODULE_1__);\n// https://github.com/webpack/webpack/issues/8656#issuecomment-456001556\n// import \"core-js/es\";\n// import(/* webpackChunkName: \"autocomplete\" */ './components/autocomplete');\n// import(/* webpackChunkName: \"feedbacks\" */ './components/feedbacks');\n\n\nvar swiper = new _vendor_swiper__WEBPACK_IMPORTED_MODULE_1___default.a('.c-feedbacks--inner', {\n speed: 900,\n autoplay: {\n delay: 6000,\n disableOnInteraction: false\n },\n grabCursor: true,\n loop: true,\n pagination: {\n el: '.swiper-pagination',\n clickable: true\n }\n});\n\nvar lisp = function lisp(str) {\n var symbols = {\n 'ą': 'a',\n 'č': 'c',\n 'ę': 'e',\n 'ė': 'e',\n 'į': 'i',\n 'š': 's',\n 'ų': 'u',\n 'ū': 'u',\n 'ž': 'z',\n 'ā': 'a',\n 'ē': 'e',\n 'ģ': 'g',\n 'ī': 'i',\n 'ķ': 'k',\n 'ļ': 'l',\n 'ņ': 'n',\n 'õ': 'o',\n 'ä': 'a',\n 'ö': 'o',\n 'ü': 'u'\n };\n str = str.trim();\n str = str.toLowerCase();\n str = str.replace(/[ąčęėįšųūžāēģīķļņõäöü]/g, function (s) {\n return symbols[s];\n });\n return str;\n};\n\nvar autocomplete = function autocomplete(str) {\n var node = document.getElementById(str);\n var arrow = document.querySelector('.js-toggle--' + str);\n var clear = document.querySelector('.js-clear--' + str);\n var isOpen = false;\n\n var toggle = function toggle(status) {\n var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n setTimeout(function () {\n isOpen = status;\n }, delay);\n\n if (arrow) {\n arrow.classList.toggle('is-open', status);\n }\n };\n\n if (!node) {\n return;\n }\n\n var box = new _vendor_awesomplete__WEBPACK_IMPORTED_MODULE_0__[\"default\"](node, {\n minChars: 0,\n maxItems: 1000,\n sort: false,\n filter: function filter(text, input) {\n return lisp(text).indexOf(lisp(input)) !== -1;\n }\n });\n node.addEventListener('input', function () {\n if (clear) {\n clear.classList.toggle('u-hidden', !node.value);\n }\n\n if (arrow) {\n arrow.classList.toggle('u-hidden', !!node.value);\n }\n });\n node.addEventListener('focus', function () {\n if (box.ul.childNodes.length === 0 || box.ul.hasAttribute('hidden')) {\n toggle(true);\n box.evaluate();\n } else {\n toggle(false);\n box.close();\n }\n });\n node.addEventListener('blur', function () {\n var suggestion = Array.isArray(box.suggestions) && box.suggestions.length === 1 ? box.suggestions[0] : null;\n\n if (!suggestion) {\n return;\n }\n\n if (lisp(node.value) === lisp(suggestion.value)) {\n node.value = suggestion.value;\n }\n });\n node.addEventListener('awesomplete-selectcomplete', function () {\n node.blur();\n\n if (clear) {\n clear.classList.remove('u-hidden');\n }\n\n if (arrow) {\n arrow.classList.add('u-hidden');\n }\n });\n node.addEventListener('awesomplete-close', function () {\n toggle(false, 150);\n });\n\n if (arrow) {\n arrow.addEventListener('click', function () {\n if (!isOpen) {\n node.focus();\n } else {\n box.close();\n }\n });\n }\n\n if (clear) {\n clear.addEventListener('click', function () {\n node.value = '';\n node.focus();\n\n if (clear) {\n clear.classList.add('u-hidden');\n }\n\n if (arrow) {\n arrow.classList.remove('u-hidden');\n }\n });\n }\n};\n\nautocomplete('search-city');\nautocomplete('search-query');\nvar search = document.getElementById('search');\nvar city = document.getElementById('search-city');\nvar query = document.getElementById('search-query');\n\nif (search) {\n search.addEventListener('submit', function (e) {\n if (city && !city.value && query && !query.value) {\n city.focus();\n e.preventDefault();\n }\n }, false);\n}\n\nvar node = document.getElementById('form-city');\nvar cityID = document.getElementById('form-city-id');\n\nif (node) {\n var nodeBox = new _vendor_awesomplete__WEBPACK_IMPORTED_MODULE_0__[\"default\"](node, {\n minChars: 0,\n maxItems: 1000,\n sort: false,\n filter: function filter(text, input) {\n return lisp(text).indexOf(lisp(input)) !== -1;\n },\n replace: function replace(suggestion) {\n this.input.value = suggestion.label;\n\n if (cityID) {\n cityID.value = suggestion.value;\n }\n }\n });\n node.addEventListener('focus', function () {\n nodeBox.evaluate();\n });\n node.addEventListener('blur', function () {\n var suggestion = Array.isArray(nodeBox.suggestions) && nodeBox.suggestions.length === 1 ? nodeBox.suggestions[0] : null;\n\n if (!suggestion) {\n return;\n }\n\n if (lisp(node.value) === lisp(suggestion.label)) {\n node.value = suggestion.label;\n\n if (cityID) {\n cityID.value = suggestion.value;\n }\n }\n });\n}\n\nif (window.NodeList && !NodeList.prototype.forEach) {\n NodeList.prototype.forEach = Array.prototype.forEach;\n}\n\n(function (arr) {\n arr.forEach(function (item) {\n if (item.hasOwnProperty('remove')) {\n return;\n }\n\n Object.defineProperty(item, 'remove', {\n configurable: true,\n enumerable: true,\n writable: true,\n value: function remove() {\n if (this.parentNode === null) {\n return;\n }\n\n this.parentNode.removeChild(this);\n }\n });\n });\n})([Element.prototype, CharacterData.prototype, DocumentType.prototype]);\n\n(function (global) {\n var container = document.getElementById('cookie-warning');\n var btnAgree = document.getElementById('cookie-agree');\n var btnClose = document.getElementById('cookie-close');\n var agreed = useLS() ? localStorage.getItem('biuro-agree') : false;\n\n function useLS() {\n var mod = 'a';\n\n try {\n localStorage.setItem(mod, mod);\n localStorage.removeItem(mod);\n return true;\n } catch (e) {\n return false;\n }\n }\n\n if (!container || !btnAgree || !btnClose || agreed) {\n return;\n }\n\n container.style.display = 'block';\n btnAgree.addEventListener('click', function () {\n if (useLS()) {\n localStorage.setItem('biuro-agree', 'true');\n }\n\n container.style.display = 'none';\n });\n btnClose.addEventListener('click', function () {\n container.style.display = 'none';\n });\n})(window);\n\nif (true) {\n module.hot.accept();\n}\n\n(function (global) {\n var node = document.getElementById('js-map--divisions');\n\n if (!node) {\n return;\n }\n\n fetch('/wp-json/api/v1/divisions?langID=' + node.dataset.id).then(function (t) {\n return t.json();\n }).then(function (data) {\n initDivisionsMap(node, data);\n });\n})(window);\n\n(function (global) {\n var node = document.querySelector('.c-nav--lang');\n\n if (!node) {\n return;\n }\n\n node.addEventListener('click', function (e) {\n e.currentTarget.classList.toggle('c-nav--lang--is-open');\n });\n})(window);\n\n(function (global) {\n var node = document.getElementById('js-map--regions');\n\n if (!node) {\n return;\n }\n\n initRegionsMap(node);\n})(window);\n\n(function (global) {\n document.querySelectorAll('.js-toggle--nav').forEach(function (node) {\n node.addEventListener('click', function (e) {\n e.preventDefault();\n document.body.classList.toggle('is-nav--open');\n });\n });\n document.querySelectorAll('.js-toggle--aside').forEach(function (node) {\n node.addEventListener('click', function (e) {\n e.preventDefault();\n document.body.classList.toggle('is-aside--open');\n });\n });\n})(window);\n\nvar info;\n\nfunction setMarkers(map, positions, focus) {\n var bounds = new window.google.maps.LatLngBounds();\n\n for (var i = 0; i < positions.length; i++) {\n var position = positions[i];\n var pos = new window.google.maps.LatLng(position.lat, position.lng);\n var marker = new window.google.maps.Marker({\n position: pos,\n map: map,\n icon: '/wp-content/themes/biuro/i/ico--map-pin.svg',\n title: position.title || ''\n });\n\n if (info) {\n info.close();\n }\n\n bounds.extend(pos);\n\n if (position.content) {\n marker['content'] = position.content;\n window.google.maps.event.addListener(marker, 'click', function () {\n info = new window.google.maps.InfoWindow({\n content: this.content\n });\n info.open(map, this);\n });\n }\n\n if (focus) {\n if (window.innerWidth < 960) {\n window.scrollTo(0, 0);\n }\n\n new google.maps.event.trigger(marker, 'click');\n }\n }\n\n map.fitBounds(bounds);\n\n if (window.innerWidth > 1020) {\n map.panBy(250, 0);\n } else if (window.innerWidth > 959) {\n map.panBy(180, 0);\n }\n}\n\nfunction setGoogleMap(node) {\n var mapStyles = [{\n featureType: 'all',\n elementType: 'all',\n stylers: [{\n saturation: -92\n }, {\n lightness: -8\n }, {\n hue: '#004ed4'\n }]\n }, {\n featureType: 'water',\n elementType: 'all',\n stylers: [{\n saturation: -95\n }, {\n lightness: -25\n }, {\n hue: '#004ed4'\n }]\n }];\n var map = new window.google.maps.Map(node, {});\n var biuroMap = new window.google.maps.StyledMapType(mapStyles, {\n name: 'Biuro'\n });\n map.mapTypes.set('biuro', biuroMap);\n map.setMapTypeId('biuro');\n window.google.maps.event.addListenerOnce(map, 'bounds_changed', function () {\n if (this.getZoom() > 15) {\n this.setZoom(14);\n }\n });\n return map;\n}\n\nfunction initRegionsMap(node) {\n if (!window.google) {\n setTimeout(function () {\n initRegionsMap(node);\n }, 250);\n return;\n }\n\n var map = setGoogleMap(node);\n var regions = [{\n title: 'Vilnius',\n lat: 54.687157,\n lng: 25.279652\n }, {\n title: 'Rīga',\n lat: 56.946285,\n lng: 24.105078\n }, {\n title: 'Tallinn',\n lat: 59.436962,\n lng: 24.753574\n }];\n setMarkers(map, regions);\n}\n\nfunction initDivisionsMap(node, data) {\n if (!window.google) {\n setTimeout(function () {\n initDivisionsMap(node, data);\n }, 250);\n return;\n }\n\n var map = setGoogleMap(node);\n var divisions = [];\n Object.keys(data).forEach(function (key) {\n var division = data[key];\n\n if (key.substr(0, 4) === 'city') {\n divisions = divisions.concat(division);\n }\n });\n document.querySelectorAll('.js-division').forEach(function (node) {\n node.addEventListener('click', function () {\n var ID = node && node.dataset.id ? node.dataset.id : '';\n\n if (data[ID]) {\n setMarkers(map, data[ID].filter(function (d) {\n return d.lat && d.lng;\n }), true);\n } else {\n setMarkers(map, divisions.filter(function (d) {\n return d.lat && d.lng;\n }));\n }\n });\n });\n setMarkers(map, divisions.filter(function (d) {\n return d.lat && d.lng;\n }));\n}\n\ndocument.querySelectorAll('.js-form--input-file').forEach(function (node) {\n node.addEventListener('change', function () {\n var parent = node.parentNode;\n var name = node.value.split(/\\\\|\\//).pop();\n var text = parent.querySelector('.js-form--input-file-text');\n\n if (text && name) {\n text.innerHTML = name;\n }\n });\n});\ndocument.querySelectorAll('.js-toggle--services').forEach(function (node) {\n node.addEventListener('click', function () {\n node.parentNode.classList.toggle('c-services--is-open');\n });\n});\ndocument.querySelectorAll('.js-toggle--sections').forEach(function (node) {\n node.addEventListener('click', function () {\n var parent = node.parentNode;\n\n if (parent.classList.contains('c-sections--is-open')) {\n parent.classList.toggle('c-sections--is-open');\n } else {\n document.querySelectorAll('.c-sections--is-open').forEach(function (node) {\n node.classList.remove('c-sections--is-open');\n });\n parent.classList.toggle('c-sections--is-open');\n }\n });\n});\ndocument.querySelectorAll('.js-expand-jobs-section').forEach(function (node) {\n node.addEventListener('click', function (e) {\n e.preventDefault();\n node.parentNode.classList.remove('c-jobs-section--is-closed');\n node.remove();\n });\n});\n\nvar initiatePositionForm = function initiatePositionForm() {\n var button = document.querySelector('[name=\"s\"][value=\"1\"]');\n\n if (button) {\n button.click();\n return;\n }\n\n var input = document.querySelector('[name=\"name\"]');\n\n if (input) {\n input.focus();\n }\n};\n\nif (document.querySelector('.js-inititate-position-form')) {\n document.querySelector('.js-inititate-position-form').addEventListener('click', initiatePositionForm);\n}\n\nif (document.querySelector('.js-focus-form')) {\n document.querySelector('.js-focus-form').addEventListener('click', function () {\n var input = document.querySelector('.c-form input:first-of-type');\n\n if (input) {\n input.focus();\n }\n });\n}\n\nif (document.querySelector('.js-modal--close')) {\n document.querySelector('.js-modal--close').addEventListener('click', function () {\n var modal = document.querySelector('.c-modal');\n\n if (modal) {\n modal.remove();\n }\n\n var node = document.querySelector('.c-form [autofocus]');\n\n if (node) {\n node.focus();\n }\n });\n}\n\nfunction fallbackCopyTextToClipboard(text) {\n var textArea = document.createElement('textarea');\n textArea.value = text;\n document.body.appendChild(textArea);\n textArea.focus();\n textArea.select();\n\n try {\n var successful = document.execCommand('copy');\n var msg = successful ? 'successful' : 'unsuccessful';\n console.log('Fallback: Copying text command was ' + msg);\n } catch (err) {\n console.error('Fallback: Oops, unable to copy', err);\n }\n\n document.body.removeChild(textArea);\n}\n\nfunction showCopyTooltip() {\n var tooltip = document.querySelector('#copy-tooltip');\n\n if (tooltip) {\n tooltip.style.opacity = 1;\n setTimeout(function () {\n tooltip.style.opacity = 0;\n }, 3000);\n }\n}\n\nfunction copyTextToClipboard(text) {\n if (!navigator.clipboard) {\n fallbackCopyTextToClipboard(text);\n showCopyTooltip();\n return;\n }\n\n navigator.clipboard.writeText(text).then(function () {\n showCopyTooltip();\n }, function (err) {\n console.error('Async: Could not copy text: ', err);\n });\n}\n\nif (document.querySelector('.js-copy-to-clipboard')) {\n document.querySelector('.js-copy-to-clipboard').addEventListener('click', function (e) {\n e.preventDefault();\n var sep = window.location.href.indexOf('?') === -1 ? '?' : '&';\n copyTextToClipboard(window.location.href + sep + 'utm_source=biuro&utm_medium=Share&utm_campaign=Copy');\n });\n}\n\n(function (global) {\n var node = document.querySelector('.c-form [autofocus]');\n\n if (node) {\n node.focus();\n }\n\n if (location.hash) {\n var error = document.querySelector('.c-form--input-wrap--error input') || document.querySelector('.c-form--checkbox--error');\n\n if (error) {\n error.focus();\n return;\n }\n\n var input = document.querySelector('.c-form [name=\"name\"]');\n\n if (input) {\n input.focus();\n }\n }\n})(window);\n\n(function (global) {\n document.querySelectorAll('.gtm-share-click').forEach(function (node) {\n node.addEventListener('click', function (e) {\n window.dataLayer = window.dataLayer || [];\n window.dataLayer.push({\n 'event': 'shareClick',\n 'shareLabel': node.dataset.label || ''\n });\n });\n });\n})(window); // async function autocomplete() {\n// // await import(/* webpackChunkName: \"autocomplete\" */ './components/autocomplete');\n// const aaaa = require('./components/autocomplete').default;\n// }\n// if (document.getElementById('search-city') || document.getElementById('search-query') || document.getElementById('form-city')) {\n// autocomplete();\n// }\n// async function feedbacks() {\n// await import(/* webpackChunkName: \"feedbacks\" */ './components/feedbacks');\n// };\n// if (document.querySelectorAll('.c-feedbacks--inner').length) {\n// feedbacks();\n// }\n\n\nvar submitContactsFrom = function submitContactsFrom(form) {\n if (form.querySelector('[type=\"submit\"]')) {\n form.querySelector('[type=\"submit\"]').classList.add('c-btn--disabled');\n }\n};\n\ndocument.querySelectorAll('[name=\"form-position\"], [name=\"form-employees\"], [name=\"form-employers\"]').forEach(function (form) {\n form.addEventListener('submit', function () {\n submitContactsFrom(form);\n });\n});\n\nvar collapseContent = function collapseContent(n) {\n var h = n.scrollHeight;\n var t = n.style.transition;\n n.style.transition = '';\n requestAnimationFrame(function () {\n n.style.height = h + 'px';\n n.style.transition = t;\n requestAnimationFrame(function () {\n n.style.height = 0 + 'px';\n });\n });\n};\n\nvar expandContent = function expandContent(n) {\n var h = n.scrollHeight;\n\n var done = function done(e) {\n n.removeEventListener('transitionend', done); // n.style.height = null;\n };\n\n n.style.height = h + 'px';\n n.addEventListener('transitionend', done);\n};\n\ndocument.querySelectorAll('.js-accordion--header').forEach(function (header) {\n header.addEventListener('click', function () {\n var node = header.nextElementSibling;\n\n if (!node || !node.classList.contains('c-accordion--content')) {\n return;\n }\n\n var isOpen = header.classList.contains('c-accordion--header--is-expanded');\n\n if (isOpen) {\n collapseContent(node);\n } else {\n expandContent(node);\n }\n\n header.classList.toggle('c-accordion--header--is-expanded', !isOpen);\n });\n});\ndocument.querySelectorAll('.c-accordion--content').forEach(function (content) {\n content.classList.add('c-accordion--content--is-collapsed');\n});\nvar isPageActive = true;\n\nwindow.onfocus = function () {\n isPageActive = true;\n};\n\nwindow.onblur = function () {\n isPageActive = false;\n};\n\nvar messenger = document.querySelector('.js-share-messenger');\n\nif (messenger) {\n messenger.addEventListener('click', function (e) {\n e.preventDefault();\n var sep = window.location.href.indexOf('?') === -1 ? '?' : '&';\n var target = e.currentTarget;\n window.location.href = 'fb-messenger://share/?link=' + encodeURIComponent(window.location.href + sep + 'utm_source=biuro&utm_medium=Share&utm_campaign=Messenger&app_id=' + target.dataset.id);\n setTimeout(function () {\n if (document.hidden || !isPageActive) {\n return;\n }\n\n window.location.href = target.href;\n }, 100);\n });\n}\n\nvar whatsapp = document.querySelector('.js-share-whatsapp');\n\nif (whatsapp) {\n whatsapp.addEventListener('click', function (e) {\n e.preventDefault();\n var target = e.currentTarget;\n window.location.href = 'whatsapp://send?text=' + encodeURIComponent(target.dataset.text);\n setTimeout(function () {\n if (document.hidden || !isPageActive) {\n return;\n }\n\n window.open(target.href, '_blank');\n }, 100);\n });\n}\n\n//# sourceURL=webpack:///./wp-content/themes/biuro/js/main.js?");
/***/ }),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment