ASCU_ALL/Site/js/menu.js

105 lines
2.5 KiB
JavaScript
Raw Normal View History

2024-09-22 04:27:05 +05:00
var menu_pasport_button = $('#menu_pasport_button');
var menu_analog_button = $('#menu_analog_button');
var menu_descret_button = $('#menu_descret_button');
var menu_tech_cycle_button = $('#menu_tech_cycle_button');
var menu_protect_button = $('#menu_protect_button');
menu_pasport_button.click(
function () {
create_redirect(0);
}
);
menu_analog_button.click(
function () {
create_redirect(1);
}
);
menu_descret_button.click(
function () {
create_redirect(2);
}
);
menu_tech_cycle_button.click(
function () {
create_redirect(3);
}
);
menu_protect_button.click(
function () {
create_redirect(4);
}
);
function create_redirect(id) {
var url = 'https://' + document.URL.split("/")[2];
if (id === undefined || id == 0) {
url += '/index.html';
} else if (id == 1) {
url += '/analog.html';
} else if (id == 2) {
url += '/discret.html';
} else if (id == 3) {
url += '/tech_cycle.html';
} else if (id == 4) {
url += '/protect.html';
}
urlSP = new URL(url);
if (
pasport_data.hasOwnProperty('search_date') &&
pasport_data.hasOwnProperty('search_name')
) {
urlSP.searchParams.set('pasport_date', pasport_data.search_date);
urlSP.searchParams.set('pasport_name', pasport_data.search_name);
} else {
urlSP.searchParams.set('vdp', pasport_data.numVDP);
urlSP.searchParams.set('dstart', pasport_data.dStart);
urlSP.searchParams.set('dend', pasport_data.dEnd);
}
document.location.href = urlSP;
}
async function get_url_params() {
var url = new URL(document.URL);
var url_pasport_date = url.searchParams.get('pasport_date');
var url_pasport_name = url.searchParams.get('pasport_name');
if (
url_pasport_date != null &&
url_pasport_name != null
) {
return await pasport_load(url_pasport_date, url_pasport_name);
}
var url_vdp = url.searchParams.get('vdp');
var url_dstart = url.searchParams.get('dstart');
var url_dend = url.searchParams.get('dend');
if (
url_vdp != null &&
url_dstart != null &&
url_dend != null
)
{
pasport_custom_set(
url_vdp,
url_dstart,
url_dend
);
return true;
}
return false;
}
var load_line = $('#load_line');
function show_load() {
load_line.removeAttr('hidden');
}
function hide_load() {
load_line.attr('hidden', true);
}
var manipulate_buttons = $('#manipulate_buttons');
function show_menu() {
manipulate_buttons.removeAttr('hidden');
}
function hide_menu() {
manipulate_buttons.attr('hidden', true);
}