Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="pt-BR">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Incorporação de Documento Google Drive</title>
- <style>
- body {
- font-family: Arial, sans-serif;
- background-color: #f4f4f4;
- margin: 0;
- padding: 0;
- display: flex;
- justify-content: center;
- align-items: center;
- height: 100vh;
- }
- .container {
- background-color: #fff;
- box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
- padding: 20px;
- max-width: 800px;
- width: 100%;
- border-radius: 8px;
- }
- h1 {
- text-align: center;
- color: #333;
- }
- iframe {
- width: 100%;
- height: 500px;
- border: 2px solid #ddd;
- border-radius: 8px;
- margin-top: 20px;
- }
- .input-container {
- display: flex;
- flex-direction: column;
- margin-bottom: 20px;
- }
- input[type="text"] {
- padding: 10px;
- border: 1px solid #ccc;
- border-radius: 4px;
- font-size: 16px;
- }
- textarea {
- width: 100%;
- height: 100px;
- margin-top: 20px;
- padding: 10px;
- border-radius: 4px;
- border: 1px solid #ccc;
- font-size: 14px;
- resize: none;
- }
- button {
- padding: 10px;
- background-color: #007bff;
- color: white;
- border: none;
- border-radius: 4px;
- cursor: pointer;
- font-size: 16px;
- }
- button:hover {
- background-color: #0056b3;
- }
- </style>
- </head>
- <body>
- <div class="container">
- <h1>Incorporação de Documento Google Drive</h1>
- <div class="input-container">
- <label for="driveUrl">Insira a URL do Google Drive:</label>
- <input type="text" id="driveUrl" placeholder="https://drive.google.com/file/d/shjsdfghfhgfdgh/view?usp=sharing" required>
- <button onclick="generateIframe()">Gerar Iframe e Copiar HTML</button>
- </div>
- <div id="iframeContainer">
- <!-- O iframe será inserido aqui -->
- </div>
- <textarea id="generatedHtml" readonly></textarea>
- </div>
- <script>
- function generateIframe() {
- const urlInput = document.getElementById('driveUrl').value;
- // Verifica se o campo de URL está vazio
- if (urlInput === '') {
- alert('Campo necessário. Por favor, insira uma URL.');
- return; // Não continua se o campo estiver vazio
- }
- const previewUrl = urlInput.replace('/view?usp=sharing', '/preview');
- const iframeCode = `<p><iframe height="500" src="${previewUrl}" width="100%"></iframe></p>`;
- // Exibir o iframe na página
- document.getElementById('iframeContainer').innerHTML = iframeCode;
- // Inserir o HTML gerado na textarea
- const textarea = document.getElementById('generatedHtml');
- textarea.value = iframeCode;
- // Copiar o HTML para a área de transferência
- textarea.select();
- document.execCommand('copy');
- alert('HTML gerado e copiado para a área de transferência!');
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement