Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- key: "wrapMatchesAcrossElements",
- value: function wrapMatchesAcrossElements(regex, ignoreGroups, filterCb, eachCb, endCb) {
- var _this6 = this;
- var matchIdx = ignoreGroups === 0 ? 0 : ignoreGroups + 1;
- this.getTextNodes(function (dict) {
- var match = void 0;
- //while ((match = regex.exec(dict.value)) !== null && match[matchIdx] !== "") {
- while ((match = XRegExp.exec(dict.value, regex)) !== null && match[matchIdx] !== "") {
- var start = match.index;
- if (matchIdx !== 0) {
- for (var i = 1; i < matchIdx; i++) {
- start += match[i].length;
- }
- }
- var end = start + match[matchIdx].length;
- _this6.wrapRangeInMappedTextNode(dict, start, end, function (node) {
- return filterCb(match[matchIdx], node);
- }, function (node, lastIndex) {
- regex.lastIndex = lastIndex;
- //alert(regex);
- eachCb(node);
- });
- }
- endCb();
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement