Update code.js

This commit is contained in:
DoctorDizzyspin 2025-03-10 00:32:46 +00:00
parent 719239ddb1
commit f08639e5a5

16
code.js
View File

@ -1,9 +1,7 @@
javascript: (function() {
var stringGet = document.getElementById('embed_code');
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(/(<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');
var newString = string.replace(/^(Fandom|Rating|Chapters|Word Count|Warnings|Relationships|Characters|Additional Tags|Summary|Series):/gm, '**$1**\:');
stringGet.innerHTML = newString
})()
var stringGet = document.getElementById('embed_code');
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(/(<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,');
var newString = string.replace(/^(Fandom|Rating|Chapters|Word Count|Warnings|Relationships|Characters|Additional Tags|Summary|Series):/gm, '**$1**\:');
stringGet.innerHTML = newString