Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ...
- <tr>
- <th scope="row">322</th>
- <td>OK</td>
- <td><pre>Текст id:6774076|PRODUCT|123_D текст
- текст текст текст текст текст текст
- текст текст текст текст текст текст
- текст текст текст
- текст id:224076|CATEGORY|123_D
- </pre>
- </td>
- </tr>
- ...
- $(document).ready(function () {
- $(document).find('body').each(function () {
- let old_html = $(this).html();
- let regexp = /id:(w+)|(w+)|(w+)/gm;
- let to_replace = [];
- match = regexp.exec(old_html);
- while (match != null) {
- let id= match[1];
- let obj= match[2];
- let element= match[3];
- if (obj=== 'CATEGORY') {
- to_replace.push({
- 'from': match[0],
- 'to': 'id:<a href="/category?id=' + id + '&element=' + element+ '">' + id + '</a>|' + obj + '|' + element
- })
- }
- match = regexp.exec(old_html);
- }
- for (var i = 0; i < to_replace.length; i++) {
- old_html.replace(to_replace[i].from,to_replace[i].to)
- }
- });
- $(this).html(old_html)
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement