1function replace_money_robot_text_with_links() { // dam replace la textul 'Money Robot' cu link (din 3 in 3 cuvinte) (textul trebuie sa fie pe paragraful P) 2 // Initialize a counter for occurrences, starting at 2 to replace the first occurrence (1st, 4th, 7th...) 3 let occurrenceCounter = 2; 4 5 // Traverse all the text nodes within #forum_div, filtering for those whose parent is a <p> tag 6 $('#forum_div *').contents().filter(function() { 7 return this.nodeType === 3 && this.parentNode.tagName === 'P'; // Node type 3 is a text node 8 }).each(function() { 9 // Check and replace occurrences in each text node 10 var newText = this.nodeValue.replace(/money robot/gi, function(match) { 11 occurrenceCounter++; // Increment for each match found 12 if (occurrenceCounter % 3 === 0) { // Replace first, then every third occurrence 13 // Return the replacement HTML string directly 14 return '<a href="https://www.moneyrobot.com/forums" target="_blank">' + match + '</a>'; 15 } else { 16 return match; // Not replacing this occurrence, return the original match 17 } 18 }); 19 20 // Only replace the node if changes were made 21 if (newText !== this.nodeValue) { 22 var wrapper = document.createElement('div'); 23 wrapper.innerHTML = newText; 24 var replacementHtml = wrapper.childNodes.length === 1 ? wrapper.firstChild : $(wrapper).contents(); 25 26 $(this).replaceWith(replacementHtml); 27 } 28 }); 29 30} 31 32$(document).ready(function() { 33 replace_money_robot_text_with_links(); // dam replace la textul 'Money Robot' cu link (din 3 in 3 cuvinte) (textul trebuie sa fie pe paragraful P) 34}); 35
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.