Skip to content

Instantly share code, notes, and snippets.

@A-gambit
Created May 18, 2014 17:04
Show Gist options
  • Save A-gambit/e04b8eacd6f09f8321a6 to your computer and use it in GitHub Desktop.
Save A-gambit/e04b8eacd6f09f8321a6 to your computer and use it in GitHub Desktop.
ДО
var childe = node.firstChild; //елемент перший син node
while(childe){
if (childe.tagName!==undefined){
if(!task){
//пошук доданих елементів
if(name===1){
if(childe.style.color==="blue" || childe.style.cssText==="border: 4px solid blue;"){
objFirst.element[objFirst.element.length]=childe;
}
}
//пошук видалених елементів
else if(name===2){
if(childe.style.color==="red" || childe.style.cssText==="border: 4px solid red;"){
objSecond.element[objSecond.element.length]=childe;
}
}
}
element(childe, task, name);
//перевірка на функцію маркерування
if(task){
if(childe.parentNode!==a && childe.parentNode!==b){
if(childe.style.color==="green" || childe.style.cssText==="border: 4px solid green;"){
childe.parentNode.style.color="green";
}
}
}
}
childe=childe.nextSibling;
}
После
var childe = node.firstChild;
while(childe){
checkEl(childe, task, name);
childe=childe.nextSibling;
}
function checkEl(childe, task, name){
var condition = childe.tagName===undefined;
if(condition) return;
else nextCheck(childe, task, name);
}
function nextCheck(childe, task, name){
if(!task) makeSome(childe, task, name);
element(childe, task, name);
if(task) makeTask(childe);
}
function makeSome(childe, task, name){
if(name===1) findNew(childe);
else findDeleat(childe);
}
function findNew(childe){
var condition=childe.style.color==="blue" || childe.style.cssText==="border: 4px solid blue;";
if(condition) objFirst.element[objFirst.element.length]=childe;
}
function findDeleat(childe){
var condition=childe.style.color==="red" || childe.style.cssText==="border: 4px solid red;";
if(condition) objSecond.element[objSecond.element.length]=childe;
}
function makeTask(childe){
var condition=childe.parentNode!==a && childe.parentNode!==b;
if(condition) nextMake(childe);
}
function nextMake(childe){
var condition=childe.style.color==="green" || childe.style.cssText==="border: 4px solid green;";
if(condition) childe.parentNode.style.color="green";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment