function parse(input) {
const result = []
let i = 0;
while (true) {
let j
if (input[i] === '"') {
j = input.indexOf('"', i + 1) + 1
} else {
j = input.indexOf(';', i)
}
if (j === -1) {
result.push(input.slice(i))
break
}
result.push(input.slice(i, j))
i = j + 1
}
return result.map(s => s[0] === '"' ? s.slice(1, -1) : s)
}
const input = 'aaaaaa;bbbbb;;;ccccc;"dddd;eeee";ffff;"gggg;;hhhh";jjjj'
console.log(parse(input))
<div class="wrap">
<input type="text" id="name-user">
<label for="name-uzer">ФИО</label>
<span>С больших букв</span>
</div>
input {
display: block;
width: 200px;
border: none;
font-size: 15px;
border-bottom: 2px solid black;
}
.wrap {
padding: 30px;
position: relative;
margin: 50px;
}
label {
position: absolute;
top: 30px;
left: 30px;
font-size: 20px;
}
input:focus ~ label {
font-size: 10px;
top: 10px;
}
var elementIndex = 0
function addElement() {
if($('#box').find('span').length() === 8) {
$('#box').find('span').first().remove();
}
$("#box").append("<span class='label label_" + elementIndex + "'>test</span>");
elementIndex = (elementIndex + 1) % 8;
}
element.getBoundingClientRect().bottom
openInfoWindow(someWindow, someContent, someMarker)();
При добавлении слушателя событий — без изменений.google.maps.event.addListener(marker, 'click', function() {
openWindow(someWindow, someContent, someMarker);
});
const normalizeData = (startDate, endDate, rawData) => {
const keys = ['Imp', 'Click', 'Ctr']
const days = []
let currentDate = new Date(startDate)
const end = new Date(endDate)
while (currentDate.getTime() < end.getTime()) {
const dd = currentDate.getDate()
const mm = currentDate.getMonth() + 1
const yyyy = currentDate.getFullYear()
days.push(`${dd < 10 ? '0' + dd : dd}.${mm < 10 ? '0' + mm : mm}.${yyyy}`)
currentDate = new Date(yyyy, mm - 1, dd + 1)
}
const arrId = rawData.map(o => o.Id)
const result = {}
arrId.forEach(id => {
result[id] = days.map(date => {
const target = {date}
keys.forEach(k => target[k] = 0)
return target
})
})
arrId.forEach((id, index) => {
rawData[index].Stats.forEach(event => {
const eventData = new Date(+event.CreateDate.match(/[0-9]+/));
if (eventData.getTime() < startDate || eventData.getTime() > endDate) return null
const dd = eventData.getDate()
const mm = eventData.getMonth() + 1
const yyyy = eventData.getFullYear()
const str = `${dd < 10 ? '0' + dd : dd}.${mm < 10 ? '0' + mm : mm}.${yyyy}`
const i = days.indexOf(str);
result[id][i][event.Type] += event.Count
})
})
return result
}
</div>
и <div>
.