Created
May 17, 2014 16:09
-
-
Save A-gambit/76fe0857a9586ce6de4e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(var i=0;i<aTag.length;i++){ | |
var someTag=aTag[i].tagName===el.tagName; | |
if(someTag) | |
if(checkSrc(aTag[i], i)) | |
return last(aTag[i], i); | |
function checkSrc(element, index){ | |
if(element.src!==undefined) return tagTrue(element, index); | |
else return tagFalse(element, index); | |
} | |
function tagTrue(element, index){ | |
console.log(el.innerHTML===element.innerHTML); | |
var condition=(element.style.cssText!=="border: 4px solid green;" && el.src===element.src && mark[index]); | |
return condition; | |
} | |
function tagFalse(element, index){ | |
console.log(el.innerHTML===element.innerHTML+" "+element.innerHTML+" "+el.innerHTML); | |
var condition=(element.style.color!=="green" && el.innerHTML===element.innerHTML && mark[index]); | |
return condition; | |
} | |
function last(element, index){ | |
mark[index]=false; | |
var pos = (index>cur) | |
cur= pos ? index : cur; | |
//flag=pos; | |
//console.log(cur); | |
return pos; | |
} | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(var i=0;i<aTag.length;i++){ | |
if(aTag[i].tagName===el.tagName){ | |
if(aTag[i].src!==undefined){ | |
if(aTag[i].style.cssText!=="border: 4px solid green;" && el.src===aTag[i].src && mark[i]){ | |
mark[i]=false; | |
//перевірка чи поточний знайдений елемент має правильне розташування | |
if(i>cur){ | |
cur=i; | |
return true; | |
} | |
else | |
return false; | |
} | |
} | |
else{ | |
if(aTag[i].style.color!="green" && el.innerHTML===aTag[i].innerHTML && mark[i]){ | |
mark[i]=false; | |
//перевірка чи поточний знайдений елмент має правильне розташування | |
if(i>cur){ | |
cur=i; | |
return true; | |
} | |
else | |
return false; | |
} | |
} | |
} | |
} | |
for(var i=0;i<aTag.length;i++){ | |
var sameTag = aTag[i].tagName == el.tagName | |
if(sameTag) return checkSame(aTag[i], i) | |
else return checkDifferent(aTag[i], i) | |
function checkSame(elem, index) { | |
if(typeof elem.src == 'undefined') return false | |
var condition = elem.style.cssText !== "border: 4px solid green;" && el.src === elem.src && mark[index] | |
return some(condition, index) | |
} | |
function checkDifferent(elem, index) { | |
var condition = elem.style.color!="green" && el.innerHTML===elem.innerHTML && mark[index] | |
return some(condition, index) | |
} | |
function some(condition, index) { | |
if(!condition) return false | |
return checkPos(index) | |
} | |
function checkPos(index) { | |
mark[index]=false | |
//перевірка чи поточний знайдений елемент має правильне розташування | |
var pos = (index > cur) | |
cur = pos ? index : cur | |
return pos | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment