/** * Catlair JS Copyright (C) 2019 a@itserv.ru * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program. If not, see . * * DOM tools * * still@itserv.ru * * Расиширение функционала Element * ChildByTag * ParentByTag * ChildByID * ParentByID * ChildByClass * ParentByClass */ /* * Рекурсивный поиск первого ребенка по имени тэга */ Element.prototype.ChildByTag = function(ATagName) { var Result = null; if (this.tagName != ATagName) { for (var i=0; i0) r=r+""+p1; if (p2.length!=0) r=r+"-"+p2; if (p3.length!=0) r=r+"-"+p3; if (p4.length!=0) r=r+"-"+p4; if (p5.length!=0) r=r+"-"+p5; return r; } ); AEvent.target.value = St; } /* Вспомогательный фукнционал */ /* Element by id просто укороченная запись */ function EBI(AID) { return document.getElementById(AID); } /** Инвертировать видемость объекта по идентифиатору */ function clShowHideByID(AIDObject) { var obj=document.getElementById(AIDObject); if (obj) { if (obj.style.display=='none') { obj.style.display = null; } else { obj.style.display = 'none'; } } } /** * Преобразование контента DOM в объект * рекурсивно объходит переданную ноду формирует объект с своствами и методами */ function clDOMToObject(AStartNode, AStartObject) { function Recurs(ANode, AObject) { if (ANode.attributes) { var l=ANode.childNodes.length; var i=0; while (i