mirror of
https://github.com/claradex/nativegallery.git
synced 2024-11-15 03:31:10 +03:00
579 lines
16 KiB
JavaScript
579 lines
16 KiB
JavaScript
|
var gal_cid = -1;
|
|||
|
var new_vehicle_idx = 0;
|
|||
|
var modified = false;
|
|||
|
|
|||
|
|
|||
|
$(document).ready(function()
|
|||
|
{
|
|||
|
$.ajaxSetup({cache: false});
|
|||
|
$('.progress-button').progressInitialize();
|
|||
|
|
|||
|
|
|||
|
// Выбор города
|
|||
|
|
|||
|
|
|||
|
|
|||
|
// События всплывающего списка результатов поиска
|
|||
|
$('#vlist').on('mouseenter mouseleave', '.found_vehicle', function()
|
|||
|
{
|
|||
|
var state = parseInt($(this).data('state'));
|
|||
|
$(this).toggleClass('s' + state + ' s' + (state+10));
|
|||
|
})
|
|||
|
.on('click', '.found_vehicle a', function(e)
|
|||
|
{
|
|||
|
e.stopPropagation();
|
|||
|
})
|
|||
|
.on('click', '.found_vehicle', function()
|
|||
|
{
|
|||
|
var nid = $(this).data('nid');
|
|||
|
var vid = $(this).data('vid');
|
|||
|
|
|||
|
if ($('#conn_veh tbody[data-vid="' + vid + '"]').length > 0)
|
|||
|
{
|
|||
|
alert(_text['UP_V_LINKED'] + '.');
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
var cid = $(this).data('cid');
|
|||
|
var cname = $('.cname', this).html();
|
|||
|
|
|||
|
var type = $(this).data('type');
|
|||
|
|
|||
|
var html = '<tbody data-nid="' + nid + '" data-vid="' + vid + '" data-twoside="' + $(this).data('twoside') + '" class="s' + $(this).data('state') + '">\n';
|
|||
|
|
|||
|
html += '<tr>\n';
|
|||
|
html += '<td style="padding:3px 10px 5px"><input type="hidden" name="nids[]" value="' + nid + '"><input type="hidden" name="cids[]" value="' + cid + '"><a href="' + (nid > 0 ? '/vehicle/' + vid + '/#n' + nid : '/lk/vehicles.php?action=edit&vid=' + (-nid)) + '" target="_blank" class="num pcnt">' + $('.num', this).html() + '</a></td>\n';
|
|||
|
html += '<td style="padding:3px 10px 6px">' + $('.mname', this).html() + '</td>\n';
|
|||
|
html += '<td style="padding:3px 0 6px 10px; color:#777" class="r">' + _text['UP_ROUTE'] + ':</td>\n';
|
|||
|
html += '<td style="padding:3px 7px" class="nw"><input type="text" class="route" name="route[' + nid + ']" style="width:40px; font-weight:bold; text-align:center" maxlength="7" value="">, <input type="text" class="notes" name="notes[' + nid + ']" style="width:170px" maxlength="100" value="" placeholder="' + _text['UP_NOTES'] + '"></td>\n';
|
|||
|
html += '<td class="r"><a href="#" class="delLink" style="font-size:16px">×</a></td>\n';
|
|||
|
html += '</tr>\n';
|
|||
|
|
|||
|
html += '<tr>\n';
|
|||
|
html += '<td style="padding:0 12px 7px" colspan="2"><a href="/city/' + cid + '/" target="_blank">' + cname + '</a></td>\n';
|
|||
|
html += '<td style="padding:0 0 7px; color:#777" class="r">' + _text['VIEW'] + ':</td>\n';
|
|||
|
html += '<td style="padding:0 7px 7px" colspan="2"><input type="hidden" class="view" name="view[' + nid + ']" value="0"><a href="#" class="view_link dot">' + views[0] + '</a></td>\n';
|
|||
|
html += '</tr>\n';
|
|||
|
|
|||
|
html += '<tr>\n';
|
|||
|
html += '<td colspan="2"></td>\n';
|
|||
|
html += '<td style="padding:0 0 7px; color:#777" class="r">' + _text['UP_BIND'] + ':</td>\n';
|
|||
|
html += '<td style="padding:0 7px 7px" colspan="2"><input type="hidden" name="pri[' + nid + ']" class="pri-value" value="1"><a class="pri-label dot" href="#">' + binds[0].label + '</a></td>\n';
|
|||
|
html += '</tr>\n';
|
|||
|
|
|||
|
html += '</tbody>\n';
|
|||
|
|
|||
|
var row = $(html);
|
|||
|
$('#conn_veh').append(row).show().tablesort('recountRows');
|
|||
|
$('.pri-label', row).selector2(binds);
|
|||
|
|
|||
|
$('.no-links').hide();
|
|||
|
|
|||
|
if (cid != $('#search_cid').val())
|
|||
|
{
|
|||
|
$('#search_cid').val(cid);
|
|||
|
$('#cname').val(cname);
|
|||
|
}
|
|||
|
|
|||
|
$('#search_type').val(type).trigger('change');
|
|||
|
|
|||
|
cnames[cid] = cname;
|
|||
|
|
|||
|
showDefaultCity();
|
|||
|
modify();
|
|||
|
|
|||
|
setTimeout(function() { $('#conn_veh tbody[data-nid="' + nid + '"] .view_link').click(); }, 100);
|
|||
|
});
|
|||
|
|
|||
|
|
|||
|
// Строка добавления нового ТС
|
|||
|
$('#vlist').on('mouseenter mouseleave', '#add_new_vehicle', function()
|
|||
|
{
|
|||
|
var state = parseInt($(this).data('state'));
|
|||
|
$(this).toggleClass('s' + state + ' s' + (state+10));
|
|||
|
})
|
|||
|
.on('click', '#add_new_vehicle', function()
|
|||
|
{
|
|||
|
new_vehicle_idx++;
|
|||
|
|
|||
|
var nid = -new_vehicle_idx;
|
|||
|
|
|||
|
var cid = $('#search_cid').val();
|
|||
|
var num = $('#search_num').val();
|
|||
|
var gos = $('#search_gos').val();
|
|||
|
var type = $('#search_type').val();
|
|||
|
var cname = $('#cname').val();
|
|||
|
var by_gos = ($(this).attr('bygos') == 1);
|
|||
|
|
|||
|
var html = '<tbody data-nid="' + nid + '" class="s1">\n';
|
|||
|
|
|||
|
html += '<tr>\n';
|
|||
|
html += '<td style="padding:3px 10px 5px"><input type="hidden" name="nids[]" value="' + nid + '"><input type="hidden" name="cids[]" value="' + cid + '"><span class="num">' + (by_gos ? gos : num) + '</span></td>\n';
|
|||
|
html += '<td style="padding:3px 10px 6px">' + $('#search_type option:selected').html() + '</td>\n';
|
|||
|
html += '<td style="padding:3px 0 6px 10px; color:#777" class="r">' + _text['UP_ROUTE'] + ':</td>\n';
|
|||
|
html += '<td style="padding:3px 7px" class="nw"><input type="text" class="route" name="route[' + nid + ']" style="width:40px; font-weight:bold; text-align:center" maxlength="7" value="">, <input type="text" class="notes" name="notes[' + nid + ']" style="width:170px" maxlength="100" value="" placeholder="' + _text['UP_NOTES'] + '"></td>\n';
|
|||
|
html += '<td class="r"><a href="#" class="delLink" style="font-size:16px">×</a></td>\n';
|
|||
|
html += '</tr>\n';
|
|||
|
|
|||
|
html += '<tr>\n';
|
|||
|
html += '<td style="padding:0 12px 7px" colspan="2"><a href="/city/' + cid + '/" target="_blank">' + cname + '</a></td>\n';
|
|||
|
html += '<td style="padding:0 0 7px; color:#777" class="r">' + _text['VIEW'] + ':</td>\n';
|
|||
|
html += '<td style="padding:0 7px 7px" colspan="2"><input type="hidden" class="view" name="view[' + nid + ']" value="0"><a href="#" class="view_link dot">' + views[0] + '</a></td>\n';
|
|||
|
html += '</tr>\n';
|
|||
|
|
|||
|
html += '<tr>\n';
|
|||
|
html += '<td colspan="2"></td>\n';
|
|||
|
html += '<td style="padding:0 0 7px; color:#777" class="r">' + _text['UP_BIND'] + ':</td>\n';
|
|||
|
html += '<td style="padding:0 7px 7px" colspan="2"><input type="hidden" name="pri[' + nid + ']" class="pri-value" value="1"><a class="pri-label dot" href="#">' + binds[0].label + '</a></td>\n';
|
|||
|
html += '</tr>\n';
|
|||
|
|
|||
|
html += '<tr>\n';
|
|||
|
html += '<td id="new_vehicle_' + new_vehicle_idx + '" style="padding:5px" colspan="6">' + _text['UP_LOADING'] + '</td>\n';
|
|||
|
html += '</tr>\n';
|
|||
|
|
|||
|
html += '</tbody>\n';
|
|||
|
|
|||
|
var row = $(html);
|
|||
|
$('#conn_veh').append(row).show().tablesort('recountRows');
|
|||
|
$('.pri-label', row).selector2(binds);
|
|||
|
|
|||
|
$('.no-links').hide();
|
|||
|
|
|||
|
cnames[cid] = cname;
|
|||
|
|
|||
|
|
|||
|
var form = $('.new_vehicle_template').clone(true).removeClass('new_vehicle_template').show();
|
|||
|
|
|||
|
$('select[name="nv_service[]"]', form).change();
|
|||
|
$('select[name="nv_state[]"]', form).change();
|
|||
|
|
|||
|
$('input[name="nv_cid[]"]', form).val(cid);
|
|||
|
$('input[name="nv_type[]"]', form).val(type);
|
|||
|
$('input[name="nv_num[]"]', form).val(num);
|
|||
|
$('input[name="nv_gos[]"]', form).val(gos);
|
|||
|
|
|||
|
if (by_gos)
|
|||
|
$('.tbody_nv_num', form).css('display', '');
|
|||
|
else $('.tbody_nv_gos', form).css('display', '');
|
|||
|
|
|||
|
$.get('/api.php', { action: 'get-depot-list', cid: cid }, function(data)
|
|||
|
{
|
|||
|
$('.did', form).html(data);
|
|||
|
$('.tbody_nv_did', form).css('display', (data != '') ? '' : 'none');
|
|||
|
|
|||
|
$('#new_vehicle_' + new_vehicle_idx).empty().append(form);
|
|||
|
|
|||
|
$('input[name="nv_mid[]"]', form).attr('id', 'mid_' + new_vehicle_idx);
|
|||
|
$('input[name="nv_chid[]"]', form).attr('id', 'chid_' + new_vehicle_idx);
|
|||
|
|
|||
|
var nv_type = $('input[name="nv_type[]"]', form);
|
|||
|
|
|||
|
$('.mname', form).autocompleteSelector('mid_' + new_vehicle_idx, '/api.php?action=get-models', {
|
|||
|
minLength: 1,
|
|||
|
paramsCallback: function(params) { params.type = nv_type.val(); },
|
|||
|
selectCallback: function(item) { form.closest('tbody').data('twoside', item.twoside); }
|
|||
|
});
|
|||
|
|
|||
|
$('.chname', form).autocompleteSelector('chid_' + new_vehicle_idx, '/api.php?action=get-chassis', {
|
|||
|
minLength: 1,
|
|||
|
paramsCallback: function(params) { params.type = nv_type.val(); }
|
|||
|
});
|
|||
|
|
|||
|
$('.did', form).select2();
|
|||
|
|
|||
|
showDefaultCity();
|
|||
|
})
|
|||
|
.fail(function(jx) { alert(jx.responseText); });
|
|||
|
|
|||
|
modify();
|
|||
|
});
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
$('#image').click(function()
|
|||
|
{
|
|||
|
$('#dateLoaded, #dateAbsent').hide();
|
|||
|
$('#map_frame').removeClass('s12').css('background-color', '#ccc');
|
|||
|
|
|||
|
$('#statusbox').html('');
|
|||
|
$('#errorsbox').hide();
|
|||
|
})
|
|||
|
.change(function(e)
|
|||
|
{
|
|||
|
$('#filename').html(this.files[0].name);
|
|||
|
|
|||
|
checkImageForUpload(e.target, true, no_exif ? null : function(input)
|
|||
|
{
|
|||
|
EXIF.getData(input.files[0], function()
|
|||
|
{
|
|||
|
var dt = EXIF.getTag(this, "DateTimeOriginal");
|
|||
|
if (dt)
|
|||
|
{
|
|||
|
dt = dt.split(' ')[0].split(':');
|
|||
|
setDate(parseInt(dt[2]), parseInt(dt[1]), parseInt(dt[0]));
|
|||
|
$('#dateLoaded').fadeIn('slow');
|
|||
|
}
|
|||
|
else $('#dateAbsent').fadeIn('slow');
|
|||
|
|
|||
|
var lt = EXIF.getTag(this, 'GPSLatitude');
|
|||
|
var ln = EXIF.getTag(this, 'GPSLongitude');
|
|||
|
if (lt && ln)
|
|||
|
{
|
|||
|
lt = parseCoord(lt, EXIF.getTag(this, 'GPSLatitudeRef'));
|
|||
|
ln = parseCoord(ln, EXIF.getTag(this, 'GPSLongitudeRef'));
|
|||
|
|
|||
|
$('#lat').val(lt);
|
|||
|
$('#lng').val(ln);
|
|||
|
|
|||
|
if (map)
|
|||
|
{
|
|||
|
var pos = [lt, ln];
|
|||
|
marker.setLatLng(pos);
|
|||
|
map.setView(pos);
|
|||
|
}
|
|||
|
|
|||
|
$('#map_frame').css('background-color', '').attr('class', 's12');
|
|||
|
}
|
|||
|
});
|
|||
|
});
|
|||
|
});
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
$('#day, #month, #year').on('change', function() { $('#dateAbsent').hide(); });
|
|||
|
|
|||
|
|
|||
|
$('#search_type').on('change', function() { changeColor(this); }).change();
|
|||
|
|
|||
|
|
|||
|
// Комментарий
|
|||
|
$('#up-comment-link').on('click', function() { $('#up-comment-row').toggle(); });
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
// Опции прямой публикации
|
|||
|
/*$('input[name="pub"]').on('click', function()
|
|||
|
{
|
|||
|
$('#temp_pub').css('display', $('#pub0').is(':checked') ? 'none' : 'block')
|
|||
|
});*/
|
|||
|
|
|||
|
|
|||
|
// Хак для IE
|
|||
|
$('label.button').on('click', function()
|
|||
|
{
|
|||
|
$(this).css('position', 'static');
|
|||
|
setTimeout(function() { $('label.button').css('position', 'relative'); }, 50);
|
|||
|
});
|
|||
|
|
|||
|
|
|||
|
// Опции даты
|
|||
|
$('.approx-aprx').css('font-weight', 'normal');
|
|||
|
|
|||
|
|
|||
|
// Временная публикация
|
|||
|
$('#cond').on('click', function() { if ($(this).is(':checked')) $('#tech').prop('checked', false); });
|
|||
|
$('#tech').on('click', function() { if ($(this).is(':checked')) $('#cond').prop('checked', false); });
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
// Закрытие селектора ракурса по Esc или Backspace
|
|||
|
$(document).on('keydown', function(e)
|
|||
|
{
|
|||
|
if ((e.which == 27 || e.which == 8) && $('#views-selector').is(':visible'))
|
|||
|
{
|
|||
|
e.preventDefault();
|
|||
|
$('#views-selector').hide();
|
|||
|
}
|
|||
|
});
|
|||
|
|
|||
|
|
|||
|
// Модификация формы (но не только здесь)
|
|||
|
$('#image, #day, #month, #year, #pdate_approx, #main-cid, #place, #notes, #naa, #nomap, #license, #comment, #notes_mod, #px').on('change', modify);
|
|||
|
$('#conn_veh').on('change', 'input:checkbox, input:text', modify);
|
|||
|
|
|||
|
|
|||
|
// Предотвращение случайного закрытия формы
|
|||
|
window.onbeforeunload = function() { if (modified) return false; }
|
|||
|
});
|
|||
|
|
|||
|
|
|||
|
|
|||
|
function modify()
|
|||
|
{
|
|||
|
modified = true;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
function parseCoord(val, ref)
|
|||
|
{
|
|||
|
var coord = parseFloat(val[0] + (val[1] / 60.0) + (val[2] / 3600.0));
|
|||
|
if (ref == 'W' || ref == 'S') coord = -coord;
|
|||
|
return coord;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
function searchVehicles(by_gos)
|
|||
|
{
|
|||
|
$('#search_cid, #search_type, #search_num, #search_gos').prop('disabled', true);
|
|||
|
$('#vlist').html('<div class="nw" style="padding:6px 10px">' + _text['UP_SEARCHING'] + '</div>').show();
|
|||
|
|
|||
|
var data = { cid: $('#search_cid').val(), type: $('#search_type').val(), pub_pid: pub_pid };
|
|||
|
if (!by_gos)
|
|||
|
data.num = $('#search_num').val().trim();
|
|||
|
else data.gos = $('#search_gos').val().trim();
|
|||
|
|
|||
|
$.get('/api.php?action=upload-search-vehicles', data, function (r)
|
|||
|
{
|
|||
|
$('#vlist').html(r);
|
|||
|
$('#search_cid, #search_type, #search_num, #search_gos').prop('disabled', false);
|
|||
|
});
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
function artClick()
|
|||
|
{
|
|||
|
var art = $('input[name="art"]:checked').val();
|
|||
|
if (art == 0)
|
|||
|
{
|
|||
|
$('.lnk-vehicle').show();
|
|||
|
$('.lnk-gallery').hide();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
$('.lnk-vehicle').hide();
|
|||
|
$('.lnk-gallery').show();
|
|||
|
|
|||
|
loadGalleries(art == 2 ? 0 : $('#search_cid').val());
|
|||
|
}
|
|||
|
|
|||
|
$('#lnk_cid_tr')[art == 2 ? 'hide' : 'show']();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
function loadGalleries(cid)
|
|||
|
{
|
|||
|
if (cid == gal_cid) return;
|
|||
|
gal_cid = cid;
|
|||
|
|
|||
|
var sel = $('#search_gid').prop('disabled', true).empty().append('<option value="0">' + _text['UP_LOADING'] + '</option>');
|
|||
|
$.get('/api.php', { action: 'get-galleries', cid: gal_cid }, function(data) { sel.html(data).prop('disabled', false); }, 'html');
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
function showDefaultCity()
|
|||
|
{
|
|||
|
var cids = $('#links input[name="cids[]"]');
|
|||
|
if (cids.length == 0)
|
|||
|
{
|
|||
|
cnames.length = 0;
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
var i, cid, new_cnames = {};
|
|||
|
for (i = 0; i < cids.length; i++)
|
|||
|
{
|
|||
|
cid = cids.eq(i).val();
|
|||
|
if (cid) new_cnames[cid] = cnames[cid];
|
|||
|
}
|
|||
|
|
|||
|
var keys = Object.keys(new_cnames);
|
|||
|
if (keys.length)
|
|||
|
{
|
|||
|
cnames = new_cnames;
|
|||
|
|
|||
|
cid = $('#main-cid').val();
|
|||
|
if (cnames[cid] == undefined)
|
|||
|
{
|
|||
|
keys = Object.keys(cnames);
|
|||
|
$('#main-cid').val(keys[0]);
|
|||
|
$('#main-cname').val(cnames[keys[0]]);
|
|||
|
selectCity(keys[0]);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
function checkForm()
|
|||
|
{
|
|||
|
var i, err = '';
|
|||
|
|
|||
|
function addError(txt) { err += '<li class="sm">' + txt + '.<br> '; }
|
|||
|
|
|||
|
var image = $('#image');
|
|||
|
if (!pid && image.val() == '')
|
|||
|
{
|
|||
|
$('#step1')[0].scrollIntoView();
|
|||
|
image.focus();
|
|||
|
alert(_text['UP_NOFILE'] + '.');
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
// Проверяем наличие привязок вообще
|
|||
|
if ($('#links input').length == 0)
|
|||
|
{
|
|||
|
$('#step2')[0].scrollIntoView();
|
|||
|
alert(_text['UP_NOLINKS'] + '.');
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
if ($('#conn_veh .pri-value[value="1"]').length == 0 &&
|
|||
|
$('#conn_veh .pri-value[value="2"]').length == 0 &&
|
|||
|
$('#conn_gid tr').length == 0)
|
|||
|
{
|
|||
|
$('#step2')[0].scrollIntoView();
|
|||
|
alert(_text['UP_NO_PRI']);
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
// Проверим, указаны ли ракурсы
|
|||
|
if ($('.view[value="0"]').length > 0)
|
|||
|
{
|
|||
|
$('#step2')[0].scrollIntoView();
|
|||
|
alert(_text['UP_NOVIEW']);
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
// Проверим корректность привязки творческой фотографии
|
|||
|
if ($('#creative').val() == 1 && ($('#conn_veh input[name="nids[]"]').length || $('#conn_gid input[name="gids[]"]').length > 1))
|
|||
|
{
|
|||
|
$('#step2')[0].scrollIntoView();
|
|||
|
alert(_text['UP_CREATIVE']);
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
// Проверяем наличие даты
|
|||
|
if ($('#year').val() == 0 && !confirm(_text['UP_NODATE'] + '.'))
|
|||
|
{
|
|||
|
$('#step1')[0].scrollIntoView();
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
// Проверяем разрешение на публикацию
|
|||
|
if ($('#naa_hint').is(':visible') && $('#naa_allow').val().trim() == '')
|
|||
|
{
|
|||
|
alert(_text['UP_NAA_ALLOW_NO']);
|
|||
|
$('#step1')[3].scrollIntoView();
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
// Уточняем, правильно ли, что выбрано "города нет в списке"
|
|||
|
var cid = $('#main-cid').val();
|
|||
|
if (pid == 0 && cid == 0 && !confirm(_text['UP_NOCITY'])) return false;
|
|||
|
|
|||
|
// Уточняем, если город не соответствует привязкам
|
|||
|
if (cid != 0 && cnames[cid] == undefined && !confirm(_text['UP_OTHERCITY'])) return false;
|
|||
|
|
|||
|
|
|||
|
// Проверяем наличие МС
|
|||
|
if ($('.view[value="9"], .view[value="10"], .view[value="11"], .view[value="12"]').length == 0 && $('#place').val().trim() == '' && !confirm(_text['UP_NOPLACE'] + '.'))
|
|||
|
{
|
|||
|
$('#step3')[0].scrollIntoView();
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
// Проверяем правильность указания координат
|
|||
|
if (!$('#nomap').prop('checked'))
|
|||
|
{
|
|||
|
if ($('#lat').val() == 0.0 || $('#lng').val() == 0.0)
|
|||
|
{
|
|||
|
$('#step4')[0].scrollIntoView();
|
|||
|
alert(_text['UP_NOCOORDS']);
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
if ($('#directions input:checked').length == 0)
|
|||
|
{
|
|||
|
$('#step4')[0].scrollIntoView();
|
|||
|
alert(_text['UP_NODIR']);
|
|||
|
return false;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
return true;
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
function setDate(d, m, y)
|
|||
|
{
|
|||
|
$('#day').val(d);
|
|||
|
$('#month').val(m);
|
|||
|
$('#year').val(y);
|
|||
|
$('#pdate_approx').val(0);
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
|
|||
|
document.onclick = function(e)
|
|||
|
{
|
|||
|
e = e || window.event;
|
|||
|
E = e.target || e.srcElement;
|
|||
|
if (E.id != 'phint' && E.parentNode.id != 'phint' && E != _getID('mform').place) $('#phint').slideUp();
|
|||
|
|
|||
|
if (E.className != 'searchVehiclesBtn' && E.id != 'vlist_table' && E.className != 'num' && $('#vlist').css('display') == 'block') $('#vlist').hide().html('');
|
|||
|
|
|||
|
if ($(E).closest('#views-selector').length == 0) $('#views-selector').hide();
|
|||
|
};
|
|||
|
|
|||
|
|
|||
|
|
|||
|
function showHint(id) { $('#'+id+'_hint').fadeIn() }
|
|||
|
function hideHint(id) { $('#'+id+'_hint').fadeOut() }
|
|||
|
|
|||
|
function changeColor(sel) { sel.className = sel.options[sel.selectedIndex].className }
|
|||
|
|
|||
|
|
|||
|
|
|||
|
function toggleNAA(wl)
|
|||
|
{
|
|||
|
if ($('#naa').prop('checked'))
|
|||
|
{
|
|||
|
$('#naa_hint').show();
|
|||
|
|
|||
|
if (!wl)
|
|||
|
{
|
|||
|
$('#pub1_label').hide();
|
|||
|
$('#pub0').prop('checked', true);
|
|||
|
}
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
$('#naa_hint').hide();
|
|||
|
$('#pub1_label').show();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
function checkSpecialViews()
|
|||
|
{
|
|||
|
var fields = $('.route, .notes');
|
|||
|
if (!moderator) fields.add('#place');
|
|||
|
|
|||
|
if ($('.view[value="9"], .view[value="10"], .view[value="11"], .view[value="12"]').length > 0)
|
|||
|
fields.prop('disabled', true).val('');
|
|||
|
else fields.prop('disabled', false);
|
|||
|
}
|