random-web-tools/src/views/PHPInfo.vue

55 lines
1.2 KiB
Vue
Raw Normal View History

2024-10-16 11:19:00 +03:00
<template>
<div v-html="toolResult"></div>
</template>
<script>
import axios from "axios";
export default {
data() {
return {
toolResult: "",
};
},
mounted() {
2024-11-04 16:55:31 +02:00
axios.post(`/api/php/phpinfo.php`, {}).then((response) => {
2024-10-16 11:19:00 +03:00
const phpinfoHTML = response.data;
// Create a temporary DOM element
const tempDiv = document.createElement("div");
tempDiv.innerHTML = phpinfoHTML;
// Select all <style> tags
const styleTags = tempDiv.querySelectorAll("style");
styleTags.forEach((styleTag) => {
// Get the CSS content
let cssContent = styleTag.innerHTML;
// Prepend "main " to each selector
cssContent = cssContent.replace(/([^{}]+){/g, "main $1 {");
// Update the <style> tag's content
styleTag.innerHTML = cssContent;
});
// Make <hr> full width
tempDiv.innerHTML += `
<style>
main hr {
width: 100% !important;
}
</style>
`;
// Extract the modified HTML content
this.toolResult = tempDiv.innerHTML;
Promise.resolve(response);
});
},
};
</script>
<style lang="scss"></style>