Commit 59167854 authored by Simonas's avatar Simonas

in progress

parent 61cf7c14
{
"name": "biuro",
"version": "1.9.0",
"version": "1.10.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......
{
"name": "biuro",
"version": "1.9.0",
"version": "1.10.0",
"description": "Biuro WP theme",
"scripts": {
"dev": "gulp --require @babel/register --gulpfile tasks",
......
......@@ -6,6 +6,7 @@ rich design UI styling. Class names here are more specific. This layer usually h
c-: Signify that something is a Component. This is a concrete, implementation-specific piece of UI. All of the changes you make to its styles should be detectable in the context you’re currently looking at. Modifying these styles should be safe and have no side effects.
========================================================================== */
@import 'vendor/popup-bubble.css';
@import 'vendor/swiper.css';
@import '_component--404.css';
@import '_component--accordion.css';
......
.popup-bubble { position: absolute; background-color: white; padding: 5px 12px 4px; border-radius: 5px; font-size: 15px; max-height: 60px; font-weight: 500; box-shadow: 0px 2px 10px 1px rgba(0,0,0,0.5);
&:after { content: ''; position: absolute; width: 0; height: 0; }
&:hover {
z-index: 10;
}
}
.popup-bubble--top { top: 0; left: 0; transform: translate(-50%, -100%);
&:after { top: 100%; left: 50%; transform: translate(-50%, 0); border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 6px solid white; }
}
.popup-bubble--right { bottom: 0; left: 0; transform: translate(50%, -100%);
&:after { top: 100%; left: 50%; transform: translate(-50%, 0); border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 6px solid white; }
}
.popup-bubble-anchor {position: absolute; width: 1px; bottom: 6px; left: 0; }
.popup-container { cursor: auto; height: 0; position: absolute; width: 200px; }
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -70,11 +70,13 @@
<div class="c-jobs--inner-custom">
<h2 class="c-jobs--headline"><?php _e('Free transport to / from work in these cities', 'biuro'); ?></h2>
</div>
<div style="border: 1px solid #000; height: 495px;">
<div class="l-map" id="js-map--cities" data-source="plunge" style="position: relative; overflow: hidden; height: 495px">
</div>
</div>
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBQjPQnLGLeICbpTTu8kLjVRrLUYYCTS2M" async defer></script>
<br>
<?php
......
......@@ -154,7 +154,7 @@
<?php
endif;
?>
<script src="/wp-content/themes/biuro/js/main-44985e00.min.js" async></script>
<script src="/wp-content/themes/biuro/js/main.min.js" async></script>
<?php
// global $time_start;
......
......@@ -31,18 +31,18 @@
<link rel="preload" as="font" type="font/woff2" href="/wp-content/themes/biuro/fonts/roboto-v19-cyrillic_latin_cyrillic-ext_latin-ext-500.woff2" crossorigin="anonymous" >
<link rel="preload" as="font" type="font/woff2" href="/wp-content/themes/biuro/fonts/roboto-v19-cyrillic_latin_cyrillic-ext_latin-ext-regular.woff2" crossorigin="anonymous" >
<style><?php include 'css/core-9fc5a0a5d0.min.css'; ?></style>
<style><?php include 'css/core.min.css'; ?></style>
<link rel="preload" as="font" type="font/woff2" href="/wp-content/themes/biuro/fonts/roboto-v19-cyrillic_latin_cyrillic-ext_latin-ext-300.woff2" crossorigin="anonymous" >
<link rel="preload" as="font" type="font/woff2" href="/wp-content/themes/biuro/fonts/roboto-v19-cyrillic_latin_cyrillic-ext_latin-ext-700.woff2" crossorigin="anonymous" >
<link rel="preload" href="/wp-content/themes/biuro/css/main-1cb140d15a.min.css" as="style" onload="this.rel='stylesheet'">
<link rel="preload" href="/wp-content/themes/biuro/css/main.min.css" as="style" onload="this.rel='stylesheet'">
<link rel="preconnect" href="https://www.gstatic.com">
<link rel="preconnect" href="https://fonts.gstatic.com">
<noscript>
<link rel="stylesheet" href="/wp-content/themes/biuro/css/main-1cb140d15a.min.css">
<link rel="stylesheet" href="/wp-content/themes/biuro/css/main.min.css">
</noscript>
<?php wp_head(); ?>
......
......@@ -31,18 +31,18 @@
<link rel="preload" as="font" type="font/woff2" href="/wp-content/themes/biuro/fonts/roboto-v19-cyrillic_latin_cyrillic-ext_latin-ext-500.woff2" crossorigin="anonymous" >
<link rel="preload" as="font" type="font/woff2" href="/wp-content/themes/biuro/fonts/roboto-v19-cyrillic_latin_cyrillic-ext_latin-ext-regular.woff2" crossorigin="anonymous" >
<style><?php include 'css/core-9fc5a0a5d0.min.css'; ?></style>
<style><?php include 'css/core.min.css'; ?></style>
<link rel="preload" as="font" type="font/woff2" href="/wp-content/themes/biuro/fonts/roboto-v19-cyrillic_latin_cyrillic-ext_latin-ext-300.woff2" crossorigin="anonymous" >
<link rel="preload" as="font" type="font/woff2" href="/wp-content/themes/biuro/fonts/roboto-v19-cyrillic_latin_cyrillic-ext_latin-ext-700.woff2" crossorigin="anonymous" >
<link rel="preload" href="/wp-content/themes/biuro/css/main-1cb140d15a.min.css" as="style" onload="this.rel='stylesheet'">
<link rel="preload" href="/wp-content/themes/biuro/css/main.min.css" as="style" onload="this.rel='stylesheet'">
<link rel="preconnect" href="https://www.gstatic.com">
<link rel="preconnect" href="https://fonts.gstatic.com">
<noscript>
<link rel="stylesheet" href="/wp-content/themes/biuro/css/main-1cb140d15a.min.css">
<link rel="stylesheet" href="/wp-content/themes/biuro/css/main.min.css">
</noscript>
<?php wp_head(); ?>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -389,6 +389,21 @@ if (module.hot) {
});
})(window);
(global => {
const node = document.getElementById('js-map--cities');
if (!node) {
return;
}
fetch('/wp-content/themes/biuro/json/' + node.dataset.source + '.json')
.then((t) => t.json())
.then((data) => {
// initDivisionsMap(node, data);
initCitiesMap(node, data);
});
})(window);
(global => {
const node = document.querySelector('.c-nav--lang');
......@@ -428,8 +443,89 @@ if (module.hot) {
})(window);
// https://developers-dot-devsite-v2-prod.appspot.com/maps/documentation/javascript/examples/overlay-popup
function createPopupClass () {
function Popup (position, city, pos = 'top') {
this.position = position;
var content = document.createElement('div');
content.innerHTML = city || '';
content.classList.add('popup-bubble');
content.classList.add('popup-bubble--' + pos);
console.error('content.classList');
console.dir(content.classList);
// This zero-height div is positioned at the bottom of the bubble.
var bubbleAnchor = document.createElement('div');
bubbleAnchor.classList.add('popup-bubble-anchor');
bubbleAnchor.appendChild(content);
// This zero-height div is positioned at the bottom of the tip.
this.containerDiv = document.createElement('div');
this.containerDiv.classList.add('popup-container');
this.containerDiv.appendChild(bubbleAnchor);
// Optionally stop clicks, etc., from bubbling up to the map.
window.google.maps.OverlayView.preventMapHitsAndGesturesFrom(this.containerDiv);
}
// ES5 magic to extend google.maps.OverlayView.
Popup.prototype = Object.create(window.google.maps.OverlayView.prototype);
/** Called when the popup is added to the map. */
Popup.prototype.onAdd = function () {
this.getPanes().floatPane.appendChild(this.containerDiv);
};
/** Called when the popup is removed from the map. */
Popup.prototype.onRemove = function () {
if (this.containerDiv.parentElement) {
this.containerDiv.parentElement.removeChild(this.containerDiv);
}
};
/** Called each frame when the popup needs to draw itself. */
Popup.prototype.draw = function () {
var divPosition = this.getProjection().fromLatLngToDivPixel(this.position);
// Hide the popup when it is far out of view.
var display =
Math.abs(divPosition.x) < 4000 && Math.abs(divPosition.y) < 4000 ? 'block' : 'none';
if (display === 'block') {
this.containerDiv.style.left = divPosition.x + 'px';
this.containerDiv.style.top = divPosition.y + 'px';
}
if (this.containerDiv.style.display !== display) {
this.containerDiv.style.display = display;
}
};
return Popup;
}
var info;
function setCitiesMarkers (map, positions) {
const Popup = createPopupClass();
const bounds = new window.google.maps.LatLngBounds();
let popup;
for (var i = 0; i < positions.length; i++) {
const position = positions[i];
const pos = new window.google.maps.LatLng(position.lat, position.lng);
popup = new Popup(pos, position.title, position.pos);
popup.setMap(map);
bounds.extend(pos);
}
map.fitBounds(bounds);
}
function setMarkers (map, positions, focus) {
var bounds = new window.google.maps.LatLngBounds();
......@@ -510,6 +606,33 @@ function setGoogleMap (node) {
return map;
}
function initCitiesMap (node, cities) {
if (!window.google) {
setTimeout(() => { initCitiesMap(node, cities); }, 250);
return;
}
// console.error(cities);
var map = setGoogleMap(node);
// const cities = [
// { title: 'Skuodas', lat: 56.270161, lng: 21.530640 },
// { title: 'Mažeikiai', lat: 56.310871, lng: 22.348021 },
// { title: 'Akmenė', lat: 56.245010, lng: 22.750160 },
// { title: 'Venta', lat: 56.191240, lng: 22.687820 },
// { title: 'Papilė', lat: 56.152290, lng: 22.791190 },
// { title: 'Kuršėnai', lat: 56.002360, lng: 22.937360 },
// { title: 'Telšiai', lat: 55.983580, lng: 22.250810 },
// { title: 'Plungė', lat: 55.912470, lng: 21.846000 },
// { title: 'Varniai', lat: 55.742020, lng: 22.371730 },
// { title: 'Rietavas', lat: 55.723930, lng: 21.931480 },
// { title: 'Šilalė', lat: 55.491000, lng: 22.181270 }
// ];
setCitiesMarkers(map, cities);
}
function initRegionsMap (node) {
if (!window.google) {
setTimeout(() => { initRegionsMap(node); }, 250);
......
This diff is collapsed.
[
{ "title": "Skuodas", "lat": 56.270161, "lng": 21.530640 },
{ "title": "Mažeikiai", "lat": 56.310871, "lng": 22.348021 },
{ "title": "Akmenė", "lat": 56.245010, "lng": 22.750160, "pos": "right" },
{ "title": "Venta", "lat": 56.191240, "lng": 22.687820, "pos": "left" },
{ "title": "Papilė", "lat": 56.152290, "lng": 22.791190, "pos": "right" },
{ "title": "Kuršėnai", "lat": 56.002360, "lng": 22.937360 },
{ "title": "Telšiai", "lat": 55.983580, "lng": 22.250810 },
{ "title": "Plungė", "lat": 55.912470, "lng": 21.846000 },
{ "title": "Varniai", "lat": 55.742020, "lng": 22.371730 },
{ "title": "Rietavas", "lat": 55.723930, "lng": 21.931480 },
{ "title": "Šilalė", "lat": 55.491000, "lng": 22.181270 }
]
......@@ -3,6 +3,6 @@ Theme Name: Biuro
Author: Biuro
Author URI: https://www.biuro.lt/
Description: Biuro multiregion theme
Version: 1.9.0
Version: 1.10.0
Text Domain: biuro
*/
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