Update code.js

fixed small bug
This commit is contained in:
DoctorDizzyspin 2025-03-11 20:26:32 +00:00
parent b27123672c
commit af6b09f28a

View File

@ -2,6 +2,6 @@ var stringGet = document.getElementById('embed_code');
var string = stringGet.innerHTML; var string = stringGet.innerHTML;
string = string.replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&amp;/g, '&').replace(/<p>&nbsp;<\/p>/g, '').replace(/&#39;/g, "'"); string = string.replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&amp;/g, '&').replace(/<p>&nbsp;<\/p>/g, '').replace(/&#39;/g, "'");
string = string.replace(/(<br \/>(?=Chapters|Summary)|<\/p><p>)/g, '\n\n').replace(/<\/?(i|em)>/g, '*').replace(/<\/?u>/g, '__').replace(/<hr \/>/g, '\n\n---\n').replace(/<a href="(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&\/\/=\*]*))"( rel="nofollow")>([^<]*)<\/a>/g, '[$5](<$1>)').replace(/<\/?(strong|b)>/g, '**').replace(/<\/?p>/g, '').replace(/<br \/>/g, ' \n'); string = string.replace(/(<br \/>(?=Chapters|Summary)|<\/p><p>)/g, '\n\n').replace(/<\/?(i|em)>/g, '*').replace(/<\/?u>/g, '__').replace(/<hr \/>/g, '\n\n---\n').replace(/<a href="(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&\/\/=\*]*))"( rel="nofollow")>([^<]*)<\/a>/g, '[$5](<$1>)').replace(/<\/?(strong|b)>/g, '**').replace(/<\/?p>/g, '').replace(/<br \/>/g, ' \n');
string = string.replace(/<a href="(https?:\/\/\w*\.org\/\w*\/\w*)">(\*\*)?([^<]*)\2<\/a>/g, '$2[$3](<$1>)$2').replace(/<a href="https?:\/\/\w*\.org\/tags\/[A-Za-z%0-9\(\)\*-]*">([^<]*)<\/a>/g, '$1').replace(/\((\d* words)\) (.*\n\n)(Chapters.*\n)(Fandom:.*\nRating.*\n)/g, '$2$4$3Word Count: $1 \n').replace(/(\d)(?=\d{3}(\d{3})*?\b)/gm, '$1,'); string = string.replace(/<a href="(https?:\/\/\w*\.org\/\w*\/\w*)">(\*\*)?([^<]*)\2<\/a>/g, '$2[$3](<$1>)$2').replace(/<a href="https?:\/\/\w*\.org\/tags\/[A-Za-z%0-9\(\)\*-]*">([^<]*)<\/a>/g, '$1').replace(/\((\d* words)\) (.*\n\n)(Chapters.*\n)(Fandom:.*\nRating.*\n)/g, '$2$4$3Word Count: $1 \n').replace(/(?<=Count: )(\d)(?=\d{3}(\d{3})*?\b)/gm, '$1,');
var newString = string.replace(/^(Fandom|Rating|Chapters|Word Count|Warnings|Relationships|Characters|Additional Tags|Summary|Series):/gm, '**$1**\:'); var newString = string.replace(/^(Fandom|Rating|Chapters|Word Count|Warnings|Relationships|Characters|Additional Tags|Summary|Series):/gm, '**$1**\:');
stringGet.innerHTML = newString stringGet.innerHTML = newString