$new1 = parse_ini_file("admin/text/menu/1.txt");
$new2 = parse_ini_file("admin/text/menu/2.txt");
$new3 = parse_ini_file("admin/text/menu/3.txt");
$new4 = parse_ini_file("admin/text/menu/4.txt");
$new5 = parse_ini_file("admin/text/menu/5.txt");
$new6 = parse_ini_file("admin/text/contact/1ru.txt");
$new7 = parse_ini_file("admin/text/contact/2ru.txt");
$new8 = parse_ini_file("admin/text/contact/3ru.txt");
$new9 = parse_ini_file("admin/text/contact/4ru.txt");
$new10 = parse_ini_file("admin/text/contact/5ru.txt");
echo "
<div id=\"imgtext1\">$new1[text1]</div><img src=\"$new1[foto]\" id=\"imgout\"alt=\"Меню\">
<div id=\"imgtext2\">$new1[text2]</div>
<div id=\"imgtext3\" >$new1[text3]</div>";
echo "
<a id=\"$new1[id]\" href=\"$new1[pach]\" target=\"_blank\" onMouseOver=\"changeImage('$new1[foto]')\" onMouseOut=\"changeImage('$new1[foto]')\">$new1[link]</a>
<a id=\"$new2[id]\" href=\"$new2[pach]\" target=\"_blank\" onMouseOver=\"changeImage('$new2[foto]')\" onMouseOut=\"changeImage('$new2[foto]')\">$new2[link]</a>
<a id=\"$new3[id]\" href=\"$new3[pach]\" target=\"_blank\" onMouseOver=\"changeImage('$new3[foto]')\" onMouseOut=\"changeImage('$new3[foto]')\">$new3[link]</a>
<a id=\"$new4[id]\" href=\"$new4[pach]\" target=\"_blank\" onMouseOver=\"changeImage('$new4[foto]')\" onMouseOut=\"changeImage('$new4[foto]')\">$new4[link]</a>
<a id=\"$new5[id]\" href=\"$new5[pach]\" target=\"_blank\" onMouseOver=\"changeImage('$new5[foto]')\" onMouseOut=\"changeImage('$new5[foto]')\">$new5[link]</a>
";
echo "
<div id=\"imgtext4\">$new6[text1]</div><img src=\"$new6[foto2]\" id=\"imgout2\" alt=\"Меню\">
<div id=\"imgtext5\">$new6[text2]</div>
<div id=\"imgtext6\" >$new6[text3]</div>";
echo "
<a id=\"$new1[id]\" href=\"$new6[pach]\" target=\"_blank\" onMouseOver=\"changeImage2('$new6[foto2]')\" onMouseOut=\"changeImage2('$new6[foto2]')\">$new6[link]</a>
<a id=\"$new2[id]\" href=\"$new7[pach]\" target=\"_blank\" onMouseOver=\"changeImage2('$new7[foto2]')\" onMouseOut=\"changeImage2('$new7[foto2]')\">$new7[link]</a>
<a id=\"$new3[id]\" href=\"$new8[pach]\" target=\"_blank\" onMouseOver=\"changeImage2('$new8[foto2]')\" onMouseOut=\"changeImage2('$new8[foto2]')\">$new8[link]</a>
<a id=\"$new4[id]\" href=\"$new9[pach]\" target=\"_blank\" onMouseOver=\"changeImage2('$new9[foto2]')\" onMouseOut=\"changeImage2('$new4[foto2]')\">$new9[link]</a>
<a id=\"$new5[id]\" href=\"$new10[pach]\" target=\"_blank\" onMouseOver=\"changeImage2('$new10[foto2]')\" onMouseOut=\"changeImage2('$new10[foto2]')\">$new10[link]</a>
";
function readTextFile(file)
{
var rawFile = new XMLHttpRequest();
rawFile.open("GET", file, false);
rawFile.onreadystatechange = function ()
{
if(rawFile.readyState === 4)
{
if(rawFile.status === 200 || rawFile.status == 0)
{
var allText = rawFile.responseText;
let txt = allText;
txt = txt.split(/\n/).map(str => str.split("="));
txt = new Map(txt);
document.getElementById("imgtext1").innerHTML=txt.get("text1").slice(1,-2);
document.getElementById("imgtext2").innerHTML=txt.get("text2").slice(1,-2);
document.getElementById("imgtext3").innerHTML=txt.get("text3").slice(1,-2);
}
}
}
rawFile.send(null);
};
window.addEventListener('DOMContentLoaded', function()
{
document.onmouseover = function(e){
if(e.target.tagName == 'A'){
if(e.target.id == 'a1ru'){
html = readTextFile('admin/text/menu/1.txt');
}
if(e.target.id == 'a2ru'){
html = readTextFile('admin/text/menu/2.txt');
}
if(e.target.id == 'a3ru'){
html = readTextFile('admin/text/menu/3.txt');
}
if(e.target.id == 'a4ru'){
html = readTextFile('admin/text/menu/4.txt');
}
if(e.target.id == 'a5ru'){
html = readTextFile('admin/text/menu/5.txt');
}
}
}
readTextFile(html);
}
);
function changeImage(src)
{
document.getElementById('imgout').src = src;
}
function readTextFile2(file)
{
var rawFile = new XMLHttpRequest();
rawFile.open("GET", file, false);
rawFile.onreadystatechange = function ()
{
if(rawFile.readyState === 4)
{
if(rawFile.status === 200 || rawFile.status == 0)
{
var allText = rawFile.responseText;
let txt = allText;
txt = txt.split(/\n/).map(str => str.split("="));
txt = new Map(txt);
document.getElementById("imgtext4").innerHTML=txt.get("text4").slice(1,-2);
document.getElementById("imgtext5").innerHTML=txt.get("text5").slice(1,-2);
document.getElementById("imgtext6").innerHTML=txt.get("text6").slice(1,-2);
}
}
}
rawFile.send(null);
};
window.addEventListener('DOMContentLoaded', function()
{
document.onmouseover = function(f){
if(f.target.tagName == 'A'){
if(f.target.id == 'cont1ru'){
html2 = readTextFile2('admin/text/contact/1ru.txt');
}
if(f.target.id == 'cont2ru'){
html2 = readTextFile2('admin/text/contact/2ru.txt');
}
if(f.target.id == 'cont3ru'){
html2 = readTextFile2('admin/text/contact/3ru.txt');
}
if(f.target.id == 'cont4ru'){
html2 = readTextFile2('admin/text/contact/4ru.txt');
}
if(f.target.id == 'cont5ru'){
html2 = readTextFile2('admin/text/contact/5ru.txt');
}
}
}
readTextFile2(html2);
}
);
function changeImage2(src)
{
document.getElementById('imgout2').src = src;
}
в 44 строке html = ini данные берутся из текста
Код:
|
data="27/05/2021";
id="cont1ru";
pach="block1";
link="11111111111";
text4="222222222222222";
text5="33333333333333333333";
text6="4444444444444444444444444444";
foto2="admin/text/contact/1.webp"; |
каким то чудо природы = скорость загруски страниц от 0.004с. если убрать ini и кинуть все в одну страницу скорость 2,14с. по этому оставил так
уменьшил код