This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Получить процент из числа | |
*/ | |
getPercentage = ( value, max ) => ( value * 100 ) / max; | |
/** | |
* Возвращаем ближайшего числа в массиве | |
*/ | |
nearestNumberArray = ( arr, number ) => { | |
return arr.reduce( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const webpack = require('webpack'); | |
const path = require('path'); | |
const HTMLWebpackPlugin = require('html-webpack-plugin'); | |
const Visualizer = require('webpack-visualizer-plugin'); | |
const dependencies = require('../package.json').dependencies; | |
const __DEV__ = process.env.NODE_ENV === 'development'; | |
const __PROD__ = process.env.NODE_ENV === 'production'; | |
const __TEST__ = process.env.NODE_ENV === 'test'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
window.addEventListener('load', function () { | |
var test = function (bool) { | |
if(bool){ | |
var styles = document.querySelectorAll('link'); | |
var js = document.querySelectorAll('script'); | |
styles.forEach(function(item, i) { | |
if(/\?ver=/.test(item.href)) { | |
styles[i].href = item.href.replace(/(\?ver=).*/, '?ver=' + Math.ceil(parseFloat(Math.random() * (1000 - i) + i)).toFixed(0)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// тестовая работа | |
window.addEventListener('load', function () { | |
var test = function (bool) { | |
if(bool){ | |
var styles = document.querySelectorAll('link'); | |
var js = document.querySelectorAll('script'); | |
styles.forEach(function(item, i) { | |
if(!/\?v=/.test(item.href)){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const elements = document.querySelectorAll('#elem li'); <-- получаеш колекцию элементов. | |
const iteration = elem => console.log(elem); | |
elements.forEach(iteration); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$categorys = DB::table('category') | |
->orderBy('title', 'asc') | |
->get(); | |
$tree = array(); | |
foreach ($categorys as $row) { | |
$tree[(int)$row->parent_id][] = $row; | |
} | |
$traverse = function($tree, $prefix = '-', $pid=0) use (&$traverse) { | |
if (empty($tree[$pid])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(()=>{ | |
const filterForm = document.querySelector('#filterForm'); | |
function submitFunc(e) { | |
const field = [ | |
'region', 'towns', 'areas' | |
]; | |
let select = filterForm.querySelectorAll('select'); | |
let i = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Простая валидация проверяет пустоту полей | |
(()=>{ | |
const filterForm = document.querySelector('#filter-form'); | |
function submitFunc(e) { | |
let input = filterForm.querySelector('input'); | |
if(input.value === "") { | |
input.classList.add('uk-form-danger'); | |
e.preventDefault(); | |
} else { | |
return true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--upload--> | |
<div id="file" class="uk-margin registration-form__group--f"> | |
<label class="uk-form-label text-insert" | |
for="form-check-the-product">Фото <span> | |
(<psevdo id="counter">0</psevdo> из 15) | |
</span></label> | |
<div class="file-container"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( function () { | |
window.addEventListener('load', formChange); | |
function formChange() { | |
let formChange = document.querySelector('#formChange'); | |
let registerForm = document.querySelector('#registerForm'); | |
if(formChange){ | |
valid(formChange) |