Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dev.biuro
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Biuro
dev.biuro
Commits
88b5869d
Commit
88b5869d
authored
Jul 16, 2019
by
Simon
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'map-offset' into dev
parents
9b3fbec3
c4b6bd7c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
16 deletions
+30
-16
main.js
wp-content/themes/biuro/js/main.js
+28
-14
main.min.js
wp-content/themes/biuro/js/main.min.js
+2
-2
No files found.
wp-content/themes/biuro/js/main.js
View file @
88b5869d
...
...
@@ -266,28 +266,28 @@ const mapStyles = [
elementType
:
'all'
,
stylers
:
[
{
'saturation'
:
-
92
saturation
:
-
92
},
{
'lightness'
:
-
8
lightness
:
-
8
},
{
'hue'
:
'#0000ff
'
hue
:
'#004ed4
'
}
]
},
{
'featureType'
:
'water'
,
featureType
:
'water'
,
elementType
:
'all'
,
'stylers'
:
[
stylers
:
[
{
'saturation'
:
-
95
saturation
:
-
95
},
{
'lightness'
:
-
25
lightness
:
-
25
},
{
'hue'
:
'#0000ff
'
hue
:
'#004ed4
'
}
]
}
...
...
@@ -337,6 +337,12 @@ function setMarkers (map, positions, focus) {
}
map
.
fitBounds
(
bounds
);
if
(
window
.
innerWidth
>
1020
)
{
map
.
panBy
(
250
,
0
);
}
else
if
(
window
.
innerWidth
>
959
)
{
map
.
panBy
(
180
,
0
);
}
}
function
initRegionsMap
(
node
)
{
...
...
@@ -345,11 +351,15 @@ function initRegionsMap (node) {
return
;
}
const
map
=
new
window
.
google
.
maps
.
Map
(
node
,
{
var
options
=
{
mapTypeIds
:
[
window
.
google
.
maps
.
MapTypeId
.
ROADMAP
,
window
.
google
.
maps
.
MapTypeId
.
HYBRID
,
'biuro'
]
});
};
var
map
=
new
window
.
google
.
maps
.
Map
(
node
,
options
);
map
.
mapTypes
.
set
(
'biuro'
,
new
window
.
google
.
maps
.
StyledMapType
(
mapStyles
,
{
name
:
'Biuro'
}));
var
biuroMap
=
new
window
.
google
.
maps
.
StyledMapType
(
mapStyles
,
{
name
:
'Biuro'
});
map
.
mapTypes
.
set
(
'biuro'
,
biuroMap
);
map
.
setMapTypeId
(
'biuro'
);
...
...
@@ -374,11 +384,15 @@ function initDivisionsMap (node, data) {
return
;
}
const
map
=
new
window
.
google
.
maps
.
Map
(
node
,
{
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'
,
new
window
.
google
.
maps
.
StyledMapType
(
mapStyles
,
{
name
:
'Biuro'
})
);
map
.
mapTypes
.
set
(
'biuro'
,
biuroMap
);
map
.
setMapTypeId
(
'biuro'
);
...
...
wp-content/themes/biuro/js/main.min.js
View file @
88b5869d
...
...
@@ -63,7 +63,7 @@
/******/
/******/
var
hotApplyOnUpdate
=
true
;
/******/
// eslint-disable-next-line no-unused-vars
/******/
var
hotCurrentHash
=
"
e42fced1afc2fc45ba27
"
;
/******/
var
hotCurrentHash
=
"
0ffa4b37063c3345d341
"
;
/******/
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\n
var 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\n
var 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
});
\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('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\n
autocomplete('search-city');
\n
autocomplete('search-query');
\n
var search = document.getElementById('search');
\n
var city = document.getElementById('search-city');
\n
var query = document.getElementById('search-query');
\n\n
if (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\n
var node = document.getElementById('form-city');
\n
var cityID = document.getElementById('form-city-id');
\n\n
if (node) {
\n
var nodeBox = new _vendor_awesomplete__WEBPACK_IMPORTED_MODULE_0__[
\"
default
\"
](node, {
\n
minChars: 0,
\n
maxItems: 1000,
\n
sort: false,
\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
}
\n\n
if (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\n
if (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\n
var mapStyles = [{
\n
featureType: 'all',
\n
elementType: 'all',
\n
stylers: [{
\n
'saturation': -92
\n
}, {
\n
'lightness': -8
\n
}, {
\n
'hue': '#0000ff'
\n
}]
\n
}, {
\n
'featureType': 'water',
\n
elementType: 'all',
\n
'stylers': [{
\n
'saturation': -95
\n
}, {
\n
'lightness': -25
\n
}, {
\n
'hue': '#0000ff'
\n
}]
\n
}];
\n
var info;
\n\n
function 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\n
function initRegionsMap(node) {
\n
if (!window.google) {
\n
setTimeout(function () {
\n
initRegionsMap(node);
\n
}, 250);
\n
return;
\n
}
\n\n
var map = new window.google.maps.Map(node, {
\n
mapTypeIds: [window.google.maps.MapTypeId.ROADMAP, window.google.maps.MapTypeId.HYBRID, 'biuro']
\n
});
\n
map.mapTypes.set('biuro', new window.google.maps.StyledMapType(mapStyles, {
\n
name: 'Biuro'
\n
}));
\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\n
function initDivisionsMap(node, data) {
\n
if (!window.google) {
\n
setTimeout(function () {
\n
initDivisionsMap(node, data);
\n
}, 250);
\n
return;
\n
}
\n\n
var map = new window.google.maps.Map(node, {
\n
mapTypeIds: [window.google.maps.MapTypeId.ROADMAP, window.google.maps.MapTypeId.HYBRID, 'biuro']
\n
});
\n
map.mapTypes.set('biuro', new window.google.maps.StyledMapType(mapStyles, {
\n
name: 'Biuro'
\n
})
);
\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\n
document.querySelectorAll('.js-toggle--services').forEach(function (node) {
\n
node.addEventListener('click', function () {
\n
node.parentNode.classList.toggle('c-services--is-open');
\n
});
\n
});
\n
document.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
});
\n
document.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\n
var 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\n
if (document.querySelector('.js-inititate-position-form')) {
\n
document.querySelector('.js-inititate-position-form').addEventListener('click', initiatePositionForm);
\n
}
\n\n
if (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\n
if (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\n
function 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\n
function copyTextToClipboard(text) {
\n
if (!navigator.clipboard) {
\n
fallbackCopyTextToClipboard(text);
\n
return;
\n
}
\n\n
navigator.clipboard.writeText(text).then(function () {}, function (err) {
\n
console.error('Async: Could not copy text: ', err);
\n
});
\n
}
\n\n
if (document.querySelector('.js-copy-to-clipboard')) {
\n
document.querySelector('.js-copy-to-clipboard').addEventListener('click', function (e) {
\n
e.preventDefault();
\n
copyTextToClipboard(window.location);
\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\n
var submitContactsFrom = function submitContactsFrom(form) {
\n
if (form.querySelector('[type=
\"
submit
\"
]')) {
\n
form.querySelector('[type=
\"
submit
\"
]').classList.add('c-btn--disabled');
\n
}
\n
};
\n\n
document.querySelectorAll('[name=
\"
form-position
\"
], [name=
\"
form-employees
\"
], [name=
\"
form-employers
\"
]').forEach(function (form) {
\n
form.addEventListener('submit', function () {
\n
submitContactsFrom(form);
\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\n
var 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\n
var 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
});
\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('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\n
autocomplete('search-city');
\n
autocomplete('search-query');
\n
var search = document.getElementById('search');
\n
var city = document.getElementById('search-city');
\n
var query = document.getElementById('search-query');
\n\n
if (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\n
var node = document.getElementById('form-city');
\n
var cityID = document.getElementById('form-city-id');
\n\n
if (node) {
\n
var nodeBox = new _vendor_awesomplete__WEBPACK_IMPORTED_MODULE_0__[
\"
default
\"
](node, {
\n
minChars: 0,
\n
maxItems: 1000,
\n
sort: false,
\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
}
\n\n
if (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\n
if (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\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 info;
\n\n
function 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\n
function 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\n
function 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\n
document.querySelectorAll('.js-toggle--services').forEach(function (node) {
\n
node.addEventListener('click', function () {
\n
node.parentNode.classList.toggle('c-services--is-open');
\n
});
\n
});
\n
document.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
});
\n
document.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\n
var 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\n
if (document.querySelector('.js-inititate-position-form')) {
\n
document.querySelector('.js-inititate-position-form').addEventListener('click', initiatePositionForm);
\n
}
\n\n
if (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\n
if (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\n
function 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\n
function copyTextToClipboard(text) {
\n
if (!navigator.clipboard) {
\n
fallbackCopyTextToClipboard(text);
\n
return;
\n
}
\n\n
navigator.clipboard.writeText(text).then(function () {}, function (err) {
\n
console.error('Async: Could not copy text: ', err);
\n
});
\n
}
\n\n
if (document.querySelector('.js-copy-to-clipboard')) {
\n
document.querySelector('.js-copy-to-clipboard').addEventListener('click', function (e) {
\n
e.preventDefault();
\n
copyTextToClipboard(window.location);
\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\n
var submitContactsFrom = function submitContactsFrom(form) {
\n
if (form.querySelector('[type=
\"
submit
\"
]')) {
\n
form.querySelector('[type=
\"
submit
\"
]').classList.add('c-btn--disabled');
\n
}
\n
};
\n\n
document.querySelectorAll('[name=
\"
form-position
\"
], [name=
\"
form-employees
\"
], [name=
\"
form-employers
\"
]').forEach(function (form) {
\n
form.addEventListener('submit', function () {
\n
submitContactsFrom(form);
\n
});
\n
});
\n\n
//# sourceURL=webpack:///./wp-content/themes/biuro/js/main.js?"
);
/***/
}),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment