import named from 'vinyl-named';
import webpackStream from 'webpack-stream';
const webpack = webpackStream.webpack;
const webpackConfig = {
output: {
filename: '[name].js'
},
module: {
loaders: [
{
loader: 'babel'
}
]
},
watch: !production,
plugins: [
new webpack.NoErrorsPlugin()
],
devtool: production ? null : 'cheap-inline-module-source-map'
};
const production = process.env.NODE_ENV === 'production';
// Webpack
gulp.task('webpack', (cb) => {
let firstBuildReady = false;
const done = (err) => {
firstBuildReady = true;
if (err) {
return null;
}
};
if (production) {
webpackConfig.plugins.push(
new webpack.optimize.UglifyJsPlugin()
)
}
return combiner(
gulp.src('src/scripts/main.js'),
debug({ title: 'webpack' }),
named(),
webpackStream( webpackConfig, null, done ),
gulp.dest('public/scripts/')
.on('data', () => {
if (firstBuildReady) {
cb();
}
})
);
});
#location ~ /\. {deny all;}
@import url("style.css");
function load_style_script(){
wp_enqueue_style('b_bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css');
wp_enqueue_style('b_font-awesome', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css');
wp_enqueue_style('b_roboto-slab', 'https://fonts.googleapis.com/css?family=Roboto+Slab:400,300,700&subset=latin,cyrillic');
wp_enqueue_style('b_open-sans', 'https://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&subset=latin,cyrillic');
wp_enqueue_style('b_main', get_template_directory_uri() . '/css/main.css');
wp_enqueue_script('b_jquery', get_template_directory_uri() . '/js/jquery.min.js', array(), '',true);
wp_enqueue_script('b_bootstrap', get_template_directory_uri() . '/js/bootstrap.min.js', array(), '',true);
wp_enqueue_script('b_common', get_template_directory_uri() . '/js/common.js', array(), '',true);
}
add_action('wp_enqueue_scripts','load_style_script');
$(document).ready(function(){
/*Приходящие данные*/
var maps =[
{
'id' : 1,
'name' : 'addressMap1',
'center' : [50.443705, 30.530946],
'zoom' : 10,
'controls' : ['smallMapDefaultSet'],
'elemClicking' : 'address__list-item-name-title',
'points' : [
{
id: "235",
iconImageHref: "img/pin-blue.png",
iconLayout: "default#image",
iconImageSize: [30, 42],
center: [50.426472, 30.563022],
name: "м. Старая Деревня",
address: "бул. Трудящихся, д.18, к.1",
phone: "+7 (812) 748-27-52",
timeWork: "9:00–22:00",
location: "https://company.yandex.ru/",
power: "Откр. 0,5 Тл и закр. 1,5 Тл"
},
{
id: "236",
iconImageHref: "img/pin-blue.png",
iconLayout: "default#image",
iconImageSize: [30, 42],
center: [50.426472, 31.563022],
name: "м. Старая Деревня2",
address: "бул. Трудящихся, д.18, к.1",
phone: "+7 (815) 748-27-52",
timeWork: "9:00–20:00",
location: "https://company.yandex.ru/",
power: "Откр. 0,5 Тл и закр. 1,5 Тл"
}
]
},
{
'id' : 2,
'name' : 'addressMap2',
'center' : [50.443705, 30.530946],
'zoom' : 10,
'controls' : ['smallMapDefaultSet'],
'elemClicking' : 'address__list-item-name-title',
'points' : [
{
id: "237",
iconImageHref: "img/pin-blue.png",
iconLayout: "default#image",
iconImageSize: [30, 42],
center: [50.426472, 30.563022],
name: "м. Старая Деревня",
address: "бул. Трудящихся, д.18, к.1",
phone: "+7 (812) 748-27-52",
timeWork: "9:00–22:00",
location: "https://company.yandex.ru/",
power: "Откр. 0,5 Тл и закр. 1,5 Тл"
},
{
id: "238",
iconImageHref: "img/pin-blue.png",
iconLayout: "default#image",
iconImageSize: [30, 42],
center: [55.751574, 37.573856],
name: "м. Старая Деревня2",
address: "бул. Трудящихся, д.18, к.1",
phone: "+7 (815) 748-27-52",
timeWork: "9:00–20:00",
location: "https://company.yandex.ru/",
power: "Откр. 0,5 Тл и закр. 1,5 Тл"
}
]
}
] ;
var myMap=[];
var myMapWrap = [];
var placemarks =[];
/*Иницилизируем карты*/
ymaps.ready(init);
function init() {
for (var elem = 0, length = maps.length; elem < length; elem++) {
var points = maps[elem].points;
var collection = new ymaps.GeoObjectCollection();
myMap[elem] = new ymaps.Map(maps[elem].name, {
center: maps[elem].center,
zoom: maps[elem].zoom,
controls: maps[elem].controls
});
for (var i = 0, l = points.length; i < l; i++) {
/*Добавляем на карту колекцию геообъектов*/
myMap[elem].geoObjects.add(collection);
//Создаем балун по данным points
placemarks[points[i].id] = new ymaps.Placemark(
points[i].center,
{
balloonContent: [
'<address>',
'<strong>'+points[i].name+'</strong>',
'<br/>',
points[i].address,
'<br/>',
points[i].phone,
'<br/>',
points[i].timeWork,
'<br/>',
'<a href="'+points[i].timeWork+'">Схема проезда</a>',
'</address>'
].join('')
},
{
iconLayout: 'default#image',
iconImageHref: points[i].iconImageHref,
iconImageSize: points[i].iconImageSize,
iconImageOffset: points[i].iconImageOffset
}
);
/*Добавляем в колекцию наши балуны*/
collection.add(placemarks[points[i].id]);
}
myMapWrap[elem]=myMap[elem];
myMapWrap[elem].setBounds(myMapWrap[elem].geoObjects.getBounds());
}
}
$('.'+maps[0].elemClicking).click(function(){
var id = $(this).attr('balloon-id');
mapId = $(this).attr('map-id');
//Центруем карту
myMapWrap[mapId].panTo(placemarks[id].geometry.getCoordinates());
//Показываем балун как только отцентруется карта
setTimeout(function () {
placemarks[id].balloon.open();
}, 800);
});
});
<!--Сплитер для 3 плиток в ширину-->
<div class="news-list-hr-3">
<div class="news-list-hr-3__item">
<div></div>
</div>
<div class="news-list-hr-3__item">
<div></div>
</div>
<div class="news-list-hr-3__item">
<div></div>
</div>
</div>
<!--Сплитер для 2 плиток в ширину-->
<div class="news-list-hr-2">
<div class="news-list-hr-2__item">
<div></div>
</div>
<div class="news-list-hr-2__item">
<div></div>
</div>
</div>