Permalink
Browse files

remove #result_ before traversing SERP DOM

  • Loading branch information...
1 parent e4d4fdb commit af865afb318f212b28e952d14808d0804e068504 @dslatten dslatten committed Jan 18, 2012
Showing with 9 additions and 3 deletions.
  1. +3 −1 snippet.js
  2. +3 −1 title.js
  3. +3 −1 url.js
View
@@ -29,6 +29,9 @@ javascript:void(function(){
if(mofoListItems[i].getElementsByTagName('cite').length!=0){
if(mofoListItems[i].getElementsByTagName('h3')[0].getElementsByTagName('a')[0].href.indexOf('q=related')==-1){
r += 1;
+ if(document.getElementById('result_' + r)){
+ document.getElementById('result_' + r).parentNode.removeChild(document.getElementById('result_' + r));
+ }
blueLink = mofoListItems[i].getElementsByTagName('h3')[0].getElementsByTagName('a')[0];
divsInVSC = mofoListItems[i].firstChild.getElementsByTagName('div');
linkURL = blueLink.href;
@@ -70,7 +73,6 @@ javascript:void(function(){
message += '<tr><td align="center" bgcolor="' + bgColor + '" title="Jump to this SERP listing"><a href="#result_' + r + '" style="text-decoration:none;font-size:medium;font-weight:bold;display:block;width:33px;height:33px;line-height:33px">&#x21d0;</a></td><td align="right" bgcolor="' + bgColor + '" title="SERP position">' + r + '</td><td bgcolor="' + bgColor + '" title="' + linkURL + '" style="color:#222">' + spanST.innerHTML + '</td><td align="right" bgcolor="' + bgColor + '" title="number of characters">' + snip.length + '</td><td align="right" bgcolor="' + bgColor + '" title="width in pixels">' + spanST.offsetWidth + '</td></tr>';
- if(document.getElementById('result_' + r)){document.getElementById('result_' + r).parentNode.removeChild(document.getElementById('result_' + r));}
jumpLink = document.createElement('div');
jumpLink.id = 'result_' + r;
mofoListItems[i].insertBefore(jumpLink,mofoListItems[i].firstChild);
View
@@ -29,6 +29,9 @@ javascript:void(function(){
if(mofoListItems[i].getElementsByTagName('cite').length!=0){
if(mofoListItems[i].getElementsByTagName('h3')[0].getElementsByTagName('a')[0].href.indexOf('q=related')==-1){
r += 1;
+ if(document.getElementById('result_' + r)){
+ document.getElementById('result_' + r).parentNode.removeChild(document.getElementById('result_' + r));
+ }
blueLink = mofoListItems[i].getElementsByTagName('h3')[0].getElementsByTagName('a')[0];
linkURL = blueLink.href;
linkText = clean(blueLink.innerHTML);
@@ -59,7 +62,6 @@ javascript:void(function(){
message += '<tr><td align="center" bgcolor="' + bgColor + '" title="Jump to this SERP listing"><a href="#result_' + r + '" style="text-decoration:none;font-size:medium;font-weight:bold;display:block;width:33px;height:33px;line-height:33px">&#x21d0;</a></td><td align="right" bgcolor="' + bgColor + '" title="SERP position">' + r + '</td><td bgcolor="' + bgColor + '" title="' + linkURL + '"><div style="color:#12c;font-size:medium;text-decoration:underline;white-space:nowrap;width:512px;overflow:hidden;text-overflow:ellipsis">' + blueLink.innerHTML + '</div></td><td align="right" bgcolor="' + bgColor + '" title="number of characters">' + linkText.length + '</td><td align="right" bgcolor="' + bgColor + '" title="width in pixels">' + blueLink.offsetWidth + '</td></tr>';
- if(document.getElementById('result_' + r)){document.getElementById('result_' + r).parentNode.removeChild(document.getElementById('result_' + r));}
jumpLink = document.createElement('div');
jumpLink.id = 'result_' + r;
mofoListItems[i].insertBefore(jumpLink,mofoListItems[i].firstChild);
View
4 url.js
@@ -29,6 +29,9 @@ javascript:void(function(){
if(mofoListItems[i].getElementsByTagName('cite').length!=0){
if(mofoListItems[i].getElementsByTagName('h3')[0].getElementsByTagName('a')[0].href.indexOf('q=related')==-1){
r += 1;
+ if(document.getElementById('result_' + r)){
+ document.getElementById('result_' + r).parentNode.removeChild(document.getElementById('result_' + r));
+ }
blueLink = mofoListItems[i].getElementsByTagName('h3')[0].getElementsByTagName('a')[0];
divsInVSC = mofoListItems[i].firstChild.getElementsByTagName('div');
linkURL = blueLink.href;
@@ -65,7 +68,6 @@ javascript:void(function(){
message += '<tr><td align="center" bgcolor="' + bgColor + '" title="Jump to this SERP listing"><a href="#result_' + r + '" style="text-decoration:none;font-size:medium;font-weight:bold;display:block;width:33px;height:33px;line-height:33px">&#x21d0;</a></td><td align="right" bgcolor="' + bgColor + '" title="SERP position">' + r + '</td><td bgcolor="' + bgColor + '" title="' + linkURL + '" style="color:#093">' + citation.innerHTML + '</td><td align="right" bgcolor="' + bgColor + '" title="number of characters">' + displayURL.length + '</td><td align="right" bgcolor="' + bgColor + '" title="width in pixels">' + citation.offsetWidth + '</td></tr>';
- if(document.getElementById('result_' + r)){document.getElementById('result_' + r).parentNode.removeChild(document.getElementById('result_' + r));}
jumpLink = document.createElement('div');
jumpLink.id = 'result_' + r;
mofoListItems[i].insertBefore(jumpLink,mofoListItems[i].firstChild);

0 comments on commit af865af

Please sign in to comment.