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
5b3b4f46
Commit
5b3b4f46
authored
Dec 20, 2019
by
Simonas
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'small-bugs' into dev
parents
777ca6be
7b32190d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
7 deletions
+9
-7
_layout--aside.css
wp-content/themes/biuro/css/05-layout/_layout--aside.css
+1
-1
core.min.css
wp-content/themes/biuro/css/core.min.css
+2
-2
autocomplete.min.js
wp-content/themes/biuro/js/components/autocomplete.min.js
+1
-1
autocomplete.js
...t/themes/biuro/js/components/autocomplete/autocomplete.js
+4
-2
main.min.js
wp-content/themes/biuro/js/main.min.js
+1
-1
No files found.
wp-content/themes/biuro/css/05-layout/_layout--aside.css
View file @
5b3b4f46
...
...
@@ -12,7 +12,7 @@
padding-bottom
:
50px
;
}
@media
(
--min--medium
)
{
flex
:
0
0
400px
;
padding
:
70px
40px
;
flex
:
0
0
400px
;
padding
:
70px
40px
;
max-width
:
400px
;
}
}
...
...
wp-content/themes/biuro/css/core.min.css
View file @
5b3b4f46
This source diff could not be displayed because it is too large. You can
view the blob
instead.
wp-content/themes/biuro/js/components/autocomplete.min.js
View file @
5b3b4f46
...
...
@@ -19,7 +19,7 @@ eval("module.exports = function(originalModule) {\n\tif (!originalModule.webpack
/***/
(
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/components/autocomplete/vendor/awesomplete.js
\"
);
\n\n\n
const 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, s => {
\n
return symbols[s];
\n
});
\n
return str;
\n
};
\n\n
const autocomplete = str => {
\n
const node = document.getElementById(str);
\n
const arrow = document.querySelector('.js-toggle--' + str);
\n
const clear = document.querySelector('.js-clear--' + str);
\n
let isOpen = false;
\n
\n
const update = (langID, target, str, hidden) => {
\n
const type = target.id === 'search-city' ? 'query' : 'city';
\n
fetch('/wp-json/api/v1/options?langID=' + langID + '&str=' + str + '&type=' + type).then(t => t.json()).then(data => {
\n
if (!data || !data.length) {
\n
return;
\n
}
\n\n
const list = data.map(option => {
\n
return {
\n
label: option.name + ' (' + option.total + ')',
\n
value: option.name
\n
};
\n
});
\n
target.box.list = list;
\n\n
if (hidden) {
\n
target.box.evaluate();
\n
target.box.close();
\n
} else {
\n
target.focus();
\n
target.box.evaluate();
\n
}
\n
});
\n
};
\n\n
const updateOptions = node => {
\n
const target = node.id === 'search-city' ? document.getElementById('search-query') : document.getElementById('search-city');
\n\n
if (!target || target.value && node.value) {
\n
return;
\n
}
\n\n
if (!target.value && node.value) {
\n
update(node.dataset.id, target, node.value, true);
\n
} else if (!node.value) {
\n
update(node.dataset.id, node, target.value);
\n\n
if (!target.value) {
\n
update(node.dataset.id, target, target.value, true);
\n
}
\n
}
\n
};
\n\n
const toggle = (status, delay = 0) => {
\n
setTimeout(() => {
\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
const box = new _vendor_awesomplete__WEBPACK_IMPORTED_MODULE_0__[
\"
default
\"
](node, {
\n
minChars: 0,
\n
maxItems: 1000,
\n
sort: false,
\n
filter: function (text, input) {
\n
return lisp(text).indexOf(lisp(input)) !== -1;
\n
}
\n
});
\n
node.addEventListener('input', () => {
\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', () => {
\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', () => {
\n
const 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', () => {
\n
node.blur();
\n
updateOptions(node);
\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', () => {
\n
toggle(false, 150);
\n
});
\n\n
if (arrow) {
\n
arrow.addEventListener('click', ()
=> {
\n
if (!isOpen) {
\n
node.focus();
\n
} else {
\n
box.close();
\n
}
\n
});
\n
}
\n\n
if (clear) {
\n
clear.addEventListener('click', () => {
\n
node.value = '';
\n
updateOptions(node);
\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
node.box = box;
\n
};
\n\n
const setCityAwesomplete = (node, cityID) => {
\n
if (!node || !cityID) {
\n
return;
\n
}
\n\n
const nodeBox = new _vendor_awesomplete__WEBPACK_IMPORTED_MODULE_0__[
\"
default
\"
](node, {
\n
minChars: 0,
\n
maxItems: 1000,
\n
sort: false,
\n
filter: function (text, input) {
\n
return lisp(text).indexOf(lisp(input)) !== -1;
\n
},
\n
replace: function (suggestion) {
\n
this.input.value = suggestion.label;
\n\n
if (cityID) {
\n
cityID.value = suggestion.value;
\n
}
\n
}
\n
});
\n
node.addEventListener('focus', () => {
\n
nodeBox.evaluate();
\n
});
\n
node.addEventListener('blur', () => {
\n
const 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\n
const setCityAwesompletes = () => {
\n
setCityAwesomplete(document.getElementById('form-city'), document.getElementById('form-city-id'));
\n
setCityAwesomplete(document.getElementById('recommend-form-city'), document.getElementById('recommend-form-city-id'));
\n
};
\n\n
const inititateAutocomplete = () => {
\n
const search = document.getElementById('search');
\n
const city = document.getElementById('search-city');
\n
const query = document.getElementById('search-query');
\n\n
if (city) {
\n
autocomplete('search-city');
\n
}
\n\n
if (query) {
\n
autocomplete('search-query');
\n
}
\n\n
if (search && city && query) {
\n
search.addEventListener('submit', e => {
\n
if (!city.value && !query.value) {
\n
city.focus();
\n
e.preventDefault();
\n
}
\n
}, false);
\n
}
\n\n
setCityAwesompletes();
\n
};
\n\n
/* harmony default export */ __webpack_exports__[
\"
default
\"
] = (inititateAutocomplete);
\n\n
//# sourceURL=webpack:///./wp-content/themes/biuro/js/components/autocomplete/autocomplete.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/components/autocomplete/vendor/awesomplete.js
\"
);
\n\n\n
const 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, s => {
\n
return symbols[s];
\n
});
\n
return str;
\n
};
\n\n
const autocomplete = str => {
\n
const node = document.getElementById(str);
\n
const arrow = document.querySelector('.js-toggle--' + str);
\n
const clear = document.querySelector('.js-clear--' + str);
\n
let isOpen = false;
\n
let isClosed = false;
\n\n
const update = (langID, target, str, hidden) => {
\n
const type = target.id === 'search-city' ? 'query' : 'city';
\n
fetch('/wp-json/api/v1/options?langID=' + langID + '&str=' + str + '&type=' + type).then(t => t.json()).then(data => {
\n
if (!data || !data.length) {
\n
return;
\n
}
\n\n
const list = data.map(option => {
\n
return {
\n
label: option.name + ' (' + option.total + ')',
\n
value: option.name
\n
};
\n
});
\n
target.box.list = list;
\n\n
if (hidden) {
\n
target.box.evaluate();
\n
target.box.close();
\n
} else {
\n
target.focus();
\n
target.box.evaluate();
\n
}
\n
});
\n
};
\n\n
const updateOptions = node => {
\n
const target = node.id === 'search-city' ? document.getElementById('search-query') : document.getElementById('search-city');
\n\n
if (!target || target.value && node.value) {
\n
return;
\n
}
\n\n
if (!target.value && node.value) {
\n
update(node.dataset.id, target, node.value, true);
\n
} else if (!node.value) {
\n
update(node.dataset.id, node, target.value);
\n\n
if (!target.value) {
\n
update(node.dataset.id, target, target.value, true);
\n
}
\n
}
\n
};
\n\n
const toggle = (status, delay = 0) => {
\n
setTimeout(() => {
\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
const box = new _vendor_awesomplete__WEBPACK_IMPORTED_MODULE_0__[
\"
default
\"
](node, {
\n
minChars: 0,
\n
maxItems: 1000,
\n
sort: false,
\n
filter: function (text, input) {
\n
return lisp(text).indexOf(lisp(input)) !== -1;
\n
}
\n
});
\n
node.addEventListener('input', () => {
\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', () => {
\n
if (!isOpen && (box.ul.childNodes.length === 0 || box.ul.hasAttribute('hidden'))) {
\n
toggle(true);
\n
box.evaluate();
\n
} else {
\n
toggle(false);
\n
box.close();
\n
node.blur();
\n
}
\n
});
\n
node.addEventListener('blur', () => {
\n
const 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', () => {
\n
node.blur();
\n
updateOptions(node);
\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', () => {
\n
toggle(false, 150);
\n
});
\n\n
if (arrow) {
\n
arrow.addEventListener('click', e
=> {
\n
if (!isOpen) {
\n
node.focus();
\n
} else {
\n
box.close();
\n
}
\n
});
\n
}
\n\n
if (clear) {
\n
clear.addEventListener('click', () => {
\n
node.value = '';
\n
updateOptions(node);
\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
node.box = box;
\n
};
\n\n
const setCityAwesomplete = (node, cityID) => {
\n
if (!node || !cityID) {
\n
return;
\n
}
\n\n
const nodeBox = new _vendor_awesomplete__WEBPACK_IMPORTED_MODULE_0__[
\"
default
\"
](node, {
\n
minChars: 0,
\n
maxItems: 1000,
\n
sort: false,
\n
filter: function (text, input) {
\n
return lisp(text).indexOf(lisp(input)) !== -1;
\n
},
\n
replace: function (suggestion) {
\n
this.input.value = suggestion.label;
\n\n
if (cityID) {
\n
cityID.value = suggestion.value;
\n
}
\n
}
\n
});
\n
node.addEventListener('focus', () => {
\n
nodeBox.evaluate();
\n
});
\n
node.addEventListener('blur', () => {
\n
const 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\n
const setCityAwesompletes = () => {
\n
setCityAwesomplete(document.getElementById('form-city'), document.getElementById('form-city-id'));
\n
setCityAwesomplete(document.getElementById('recommend-form-city'), document.getElementById('recommend-form-city-id'));
\n
};
\n\n
const inititateAutocomplete = () => {
\n
const search = document.getElementById('search');
\n
const city = document.getElementById('search-city');
\n
const query = document.getElementById('search-query');
\n\n
if (city) {
\n
autocomplete('search-city');
\n
}
\n\n
if (query) {
\n
autocomplete('search-query');
\n
}
\n\n
if (search && city && query) {
\n
search.addEventListener('submit', e => {
\n
if (!city.value && !query.value) {
\n
city.focus();
\n
e.preventDefault();
\n
}
\n
}, false);
\n
}
\n\n
setCityAwesompletes();
\n
};
\n\n
/* harmony default export */ __webpack_exports__[
\"
default
\"
] = (inititateAutocomplete);
\n\n
//# sourceURL=webpack:///./wp-content/themes/biuro/js/components/autocomplete/autocomplete.js?"
);
/***/
}),
...
...
wp-content/themes/biuro/js/components/autocomplete/autocomplete.js
View file @
5b3b4f46
...
...
@@ -19,6 +19,7 @@ const autocomplete = (str) => {
const
clear
=
document
.
querySelector
(
'.js-clear--'
+
str
);
let
isOpen
=
false
;
let
isClosed
=
false
;
const
update
=
(
langID
,
target
,
str
,
hidden
)
=>
{
const
type
=
(
target
.
id
===
'search-city'
)
?
'query'
:
'city'
;
...
...
@@ -97,12 +98,13 @@ const autocomplete = (str) => {
});
node
.
addEventListener
(
'focus'
,
()
=>
{
if
(
box
.
ul
.
childNodes
.
length
===
0
||
box
.
ul
.
hasAttribute
(
'hidden'
))
{
if
(
!
isOpen
&&
(
box
.
ul
.
childNodes
.
length
===
0
||
box
.
ul
.
hasAttribute
(
'hidden'
)
))
{
toggle
(
true
);
box
.
evaluate
();
}
else
{
toggle
(
false
);
box
.
close
();
node
.
blur
();
}
});
...
...
@@ -136,7 +138,7 @@ const autocomplete = (str) => {
});
if
(
arrow
)
{
arrow
.
addEventListener
(
'click'
,
()
=>
{
arrow
.
addEventListener
(
'click'
,
(
e
)
=>
{
if
(
!
isOpen
)
{
node
.
focus
();
}
else
{
...
...
wp-content/themes/biuro/js/main.min.js
View file @
5b3b4f46
...
...
@@ -92,7 +92,7 @@
/******/
/******/
var
hotApplyOnUpdate
=
true
;
/******/
// eslint-disable-next-line no-unused-vars
/******/
var
hotCurrentHash
=
"
297196b8612ef6440284
"
;
/******/
var
hotCurrentHash
=
"
0115a90eb0eff9676988
"
;
/******/
var
hotRequestTimeout
=
10000
;
/******/
var
hotCurrentModuleData
=
{};
/******/
var
hotCurrentChildModule
;
...
...
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