let buttonsOperations = document.querySelectorAll('input[type=radio]:checked');
if(buttonsOperations.length > 0) {
calculatorOperator(buttonsOperations[0].getAttribute('data-operation'));
} else {
output.innerHTML = '<strong>Ошибка!</strong> Арифметическая операция не выбрана.';
}
<button type="submit" name="submit"
$('#form').on('submit', function () {
var form_data = $(this).serialize();
window.myObject = {
urls: ['http://site1.com', 'http://site2.com'],
sum: '',
indx: 0,
add: function(str) {
this.sum += str;
if(++this.indx < this.urls.length) {
this.run();
} else {
alert('Result is ' + this.sum);
}
},
run: function() {
let xhr = new XMLHttpRequest();
xhr.open('GET', this.urls[this.indx]);
xhr.send();
xhr.onload = function() { window.myObject.add(xhr.result[0]); }
}
};
window.myObject.run();
#!/bin/bash
mkdir -p $1/img
exts=('sass' 'js' 'pug')
for ext in ${exts[@]}
do
touch $1/$(basename $1).$ext
done
$(document).ready(function() {
var hash = window.location.hash;
if(hash) {
switchTab(hash);
}
$('a.local').click(function() {
switchTab(this.href.replace(/.*#/, '#'));
return false;
});
});
function switchTab(link)
{
$($('a[href="' + link + '"]')[0]).trigger('click');
}
function getHumanTime($seconds) {
$sign = '';
if($seconds < 0) {
$sign = '-';
$seconds = -$seconds;
}
$hours = floor($seconds / 3600);
$seconds -= 3600 * $hours;
$minutes = floor($seconds / 60);
$seconds -= 60 * $minutes;
return $sign . $hours . ':'
. (($minutes < 10)? '0' : '') . $minutes . ':'
. (($seconds < 10)? '0' : '') . (int) $seconds;
}
1. получаем баланс пользователя из базы
2. проверяем хватает ли средств для перевода по полученному балансу в пункте 1
3. обновляем значения у одного пользователя и другого в базе
$css = "
div.abs {
position: absolute;
line-height: " . $font_size * 3 . "mm;
text-align: center;
}
div.main {
top: " . $prizer_box[1] . "mm;
left: " . $prizer_box[0] . "mm;
width: " . $prizer_box[2] . "mm;
}
div.year {
top: " . $year_box[1] . "mm;
left: " . $year_box[0] . "mm;
width: " . $year_box[2] . "mm;
}
p.main {
font-size: " . $font_size . "mm;
font-family: romul;
text-transform: uppercase;
}
p.user {
font-size: " . $font_size * 2 . "mm;
line-height: " . $font_size * 3 . "mm;
font-family: heinrichscript;
margin: 0 0 " . $font_size * 3 . "mm 0;
}
";
$html_text = "<div class='abs main'>";
$html_text .= "<p class='main'>Награждается</p>";
$html_text .= "<p class='user'>$name<br />$surname</p>";
$html_text .= "<p class='main'>$award_title<br />$event_title</p>";
$html_text .= "</div>";
$html_text .= "<div class='abs year'><p class='main'>$year</p></div>";
$image_path = $_SERVER['DOCUMENT_ROOT'] . '/images/diploma/';
require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/vendor/mpdf60/mpdf.php';
$mpdf = new mPDF();
$mpdf->img_dpi = 300;
$mpdf->SetImportUse();
$mpdf->SetSourceFile($image_path . 'Diplom_' . $diploma . '.pdf');
$tmpl = $mpdf->ImportPage();
$mpdf->UseTemplate($tmpl);
$mpdf->charset_in = 'cp1251';
$mpdf->WriteHTML($css, 1);
$mpdf->WriteHTML($html_text, 2);
$mpdf->facsimile = file_get_contents($image_path . 'facsimile_600.png');
$mpdf->Image('var: facsimile', $fac_x, $fac_y, '50%', '50%');
$mpdf->Output('diploma.pdf', 'I');