From 5037bd25f167cad7d7fb97b344919814e6e7cd53 Mon Sep 17 00:00:00 2001 From: Brajan Aldana Date: Wed, 8 Oct 2025 11:24:30 -0500 Subject: [PATCH] Init --- _locales/es/messages.json | 10 ++ background.js | 38 +++++ content.js | 313 ++++++++++++++++++++++++++++++++++++++ images/icon-green.png | Bin 0 -> 572 bytes images/icon128.png | Bin 0 -> 4339 bytes images/icon16.png | Bin 0 -> 655 bytes images/icon48.png | Bin 0 -> 1145 bytes manifest.json | 31 ++++ popup.html | 19 +++ popup.js | 51 +++++++ styles.css | 64 ++++++++ 11 files changed, 526 insertions(+) create mode 100644 _locales/es/messages.json create mode 100644 background.js create mode 100644 content.js create mode 100644 images/icon-green.png create mode 100644 images/icon128.png create mode 100644 images/icon16.png create mode 100644 images/icon48.png create mode 100644 manifest.json create mode 100644 popup.html create mode 100644 popup.js create mode 100644 styles.css diff --git a/_locales/es/messages.json b/_locales/es/messages.json new file mode 100644 index 0000000..7ccc9f0 --- /dev/null +++ b/_locales/es/messages.json @@ -0,0 +1,10 @@ +{ + "appName": { + "message": "SMCC", + "description": "SMCC" + }, + "appDescription": { + "message": "Automatización SMCC", + "description": "Automatización SMCC" + } +} \ No newline at end of file diff --git a/background.js b/background.js new file mode 100644 index 0000000..3adeadc --- /dev/null +++ b/background.js @@ -0,0 +1,38 @@ +// Listener para escuchar cambios en las pestañas +chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => { + const targetUrl = "https://apps.okan.tools/login?token="; + if (changeInfo.url && changeInfo.url.startsWith(targetUrl)) { + const url = new URL(changeInfo.url); + const token = url.searchParams.get('token'); + if (token) { + chrome.storage.local.set({ 'okanToken': token }, () => { + console.log('Token de Okan guardado:', token); + }); + } + } +}); + +async function checkHistoryForOkanToken() { + if (chrome.history) { + // Búsqueda de URL de Okan Tools con token + chrome.history.search({ text: 'https://apps.okan.tools/login?token=', startTime: 0, maxResults: 1 }, (results) => { + if (results.length > 0) { + const result = results[0]; + const url = new URL(result.url); + const token = url.searchParams.get('token'); + if (token) { + chrome.storage.local.set({ 'okanToken': token }, async () => { + console.log('Token de Okan encontrado en el historial y guardado:', token); + const data = await chrome.storage.local.get("okanToken"); + }); + // No se usa 'return' aquí para permitir que la segunda búsqueda se ejecute si es necesario. + } + } + }); + } else { + console.error("chrome.history API no está disponible. Asegúrate de que el permiso 'history' esté en manifest.json y la extensión haya sido recargada."); + } +} + +// Ejecutar la función al inicio de la extensión +checkHistoryForOkanToken(); \ No newline at end of file diff --git a/content.js b/content.js new file mode 100644 index 0000000..634d5da --- /dev/null +++ b/content.js @@ -0,0 +1,313 @@ +const defaultMessages = [ + '😊 ¡Hola! Qué gusto saludarte. Soy xxxxxxxx, asesor de Claro, y es un placer para mí ser la persona que le dé solución a tu solicitud. ¿Me confirmas por favor tu nombre completo, número de cédula y cómo puedo ayudarte hoy🌤️? 📄', + '👋 ¡Hola! Bienvenido(a) al canal de atención de Claro. Mi nombre es xxxxxxxx y con gusto me encargaré de tu solicitud🤩 haré todo lo que esté a mi alcance para encontrar solución a cualquier novedad que estés presentando. Para comenzar, ¿puedes indicarme tu nombre y número de documento? 📝', + '🤗 ¡Hola! Gracias por contactarnos. Soy xxxxxxxx, me complace mucho poder ayudarte el día de hoy;🌈🌸 Me comprometo a hacer todo lo que esté en mis manos para encontrar una solución a cualquier percance que tengas hoy. Cuéntame con qué puedo ayudarte, y por favor compárteme tu nombre completo, cédula y el número de la línea si es posible. 📱', + '🌟 ¡Hola! Espero que estés muy bien. Mi nombre es xxxxxxxx y con gusto te acompañaré con tu solicitud para poder darle solución a cualquier inquietud que presentes. ¿Podrías confirmarme tus datos: nombre, cédula y si es un servicio hogar o móvil? 💬', + '✨ ¡Hola! Un gusto saludarte 😊 Soy xxxxxxxx, asesor de Claro, con gusto atenderé tu solicitud, recuerda permanecer en el chat para agilizar la atención. Para empezar, ¿me puedes compartir tu nombre completo, cédula y contarme cómo puedo ayudarte?❤️ ' +]; + +const secondMessages = [ + 'Te invitamos a registrarte en la App Mi Claro de manera sencilla y rápida, para que puedas consultar y gestionar tus servicios desde un solo lugar. Solo necesitas hacer clic en el siguiente enlace: https://f63y8.app.goo.gl/gen_registro_wt. Recuerda que a través de la app Mi Claro puedes gestionar la factura de tus servicios Claro, cambiar las claves de Wi-Fi, añadir elegidos de familia y amigos, re-agendar visitas técnicas y calificar la atención de nuestros técnicos.', + '¡Recuerda gestionar tus servicios Claro de manera fácil y rápida! 📱✨ Descarga la app Mi Claro y accede a tus facturas, consulta tu consumo y realiza pagos en segundos. 💳💡 ¡Descárgala hoy mismo y disfruta de todas sus ventajas! 🎉🔗 https://f63y8.app.goo.gl/miclaro', + 'Te invitamos a hacer uso de Mi Claro App, desde aquí podrás: administrar tus productos, ver el detalle de tu plan o cuenta hogar, pagar tus facturas, personalizar tu red wifi, realizar compras de paquetes prepago y postpago; realizar seguimiento de tus visitas técnicas programadas, agendar turnos en oficinas, acceder a los beneficios que tienes por ser cliente Claro al descargar los cupones de Claro Club, realizar compras de productos y muchas cosas más en un solo lugar.', + 'Deseamos recordarle que como usuario, cuenta con acceso a la App Mi Claro📲, en donde puede realizar múltiples acciones de manera fácil y rápida✅: pagar su factura, recargar su línea, consultar servicios de móvil y hogar, y gestionar su clave Wifi y el registro de IMEI. También puede legalizar líneas, comprar en plataformas de streaming y acceder a Claro Club. Adicionalmente, tiene la posibilidad de revisar el estado de sus consumos y aumentar la capacidad de su plan aprovechando diferentes ofertas💗 https://www.claro.com.co/personas/autogestion/app-mi-claro/', + 'Recuerda hacer uso de nuestra app mi Claro 📲 ya que puedes autogestionar diferentes procesos como compra de paquetes, realizar pagos de tus servicios, consumos del servicio, personificación de nombre y contraseña de red wifi, entre muchas más funciones.🎉', + '📌Recuerda que contamos con la maravillosa App Mi Claro, la cual puedes utilizar para todo tipo de trámites 📫, como por ejemplo consultas sobre sus facturas 📃, consumos 📈, soporte hogar 🛠️, cambio de contraseñas wifi ⚙️, consulta de cuotas 📱, pagos y mucho más 💸✅', + 'Mientras estés en la línea, recuerda que puedes aprovechar esta oportunidad para gestionar tu uso de la plata de forma fácil y rápida. Con la plataforma Clave Mi Claro, puedes validar todo tipo de gestiones: desde tu facturación hasta la contratación de servicios como Netflix, HBO y Amazon Prime. 📺 Además, puedes agendar visitas técnicas y obtener información sobre ellas. ¡Disfruta de todas estas facilidades! 🌟', + 'Acá estaré cuando estés listo para responder, por ahora, recuerda que estoy acá pendiente para ayudarte. Mientras estamos en gestión te recordamos que puedes ¡Optimizar el servicio de internet en tu hogar con Ultra Wifi de Claro! 📶 Disfruta de una experiencia superior de conexión en línea con tu familia. Con Ultra Wifi, recibirás dos unidades repetidoras de señal que asegurará una conexión estable y sin interrupciones, incluso en las áreas más alejadas de tu hogar.Además de mejorar la cobertura, Ultra Wifi te ofrece pago flexibles: Adquiere Ultra Wifi por solo $10,900 mensuales y difiere el pago hasta en 36 cuotas, facilitando tu presupuesto familiar. ¿Listo para mejorar tu experiencia de internet en casa? ¿Te gustaría activarlo ahora mismo? 🌐', + 'Recuerda que para gestionar la información de tu visita, como lo son los datos del técnico (su nombre, documento, credencial, etc.),🛠️ realizar el re-agendamiento de la misma, su cancelación, llevar a cabo un seguimiento en tiempo de real de su realización y calificar al técnico,✅ puedes hacerlo por medio de la App Mi Claro 🛠️.', + 'Mientras le doy solución recuerda que con Claro, puede financiar fácilmente la tecnología que más le guste, ya sea televisores, celulares o consolas📺️📱. Si me permite un momento, voy generar un reporte y mi compañero se comunicara con usted para brindará toda la información . ¡No deje pasar esta oportunidad!.', + 'Sabías que puedes gestionar todos tus servicios, como validar la factura o pagarla; gestionar tu red wifi; calificar las visitas técnicas programadas; conocer las ofertas que tenemos en el momento desde la App mi claro.😀😀 https://www.claro.com.co/personas/autogestion/app-mi-claro/' +]; + +// Variable para controlar si hay un procesamiento en curso +let procesandoCasos = false; + +// Función asíncrona para procesar los elementos de WhatsApp +async function procesarElementosWhatsapp() { + // Si ya hay un procesamiento en curso, no iniciamos otro + if (procesandoCasos) { + console.log('Ya hay un procesamiento en curso. Esperando a que termine...'); + return; + } + + // Marcamos que estamos iniciando un procesamiento + procesandoCasos = true; + let allWhatsappElements = Array.from(document.querySelectorAll('.navigation-whatsapp')).filter( + el => !el.classList.contains('caso-gestionado') + ); + + console.log('Elementos de WhatsApp para procesar:', allWhatsappElements.length); + + if (allWhatsappElements.length > 0) { + const nameElement = document.querySelector('p.name'); + const capitalizedName = nameElement?.textContent + ? nameElement.textContent + .split(' ') + .map(word => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()) + .join(' ') + : 'Asesor'; + console.log('Nombre de usuario obtenido: ' + capitalizedName); + const overlay = document.createElement('div'); + overlay.id = `robotOverlay`; + + overlay.style.position = 'fixed'; + overlay.style.top = '0'; + overlay.style.left = '0'; + overlay.style.width = '100%'; + overlay.style.height = '100%'; + overlay.style.backgroundColor = 'rgba(255, 255, 255, 0.5)'; + overlay.style.zIndex = '9999'; + overlay.style.display = 'flex'; + overlay.style.justifyContent = 'center'; + overlay.style.alignItems = 'center'; + + const container = document.createElement('div'); + container.style.display = 'flex'; + container.style.flexDirection = 'column'; + container.style.alignItems = 'center'; + + const text = document.createElement('h1'); + text.textContent = 'TRABAJANDO...'; + text.style.color = 'black'; + text.style.fontFamily = 'Arial, sans-serif'; + + container.appendChild(text); + overlay.appendChild(container); + document.body.appendChild(overlay); + + console.log('Procesando elementos de WhatsApp...'); + // Usamos for...of en lugar de forEach para poder usar await correctamente + for (let index = 0; index < allWhatsappElements.length; index++) { + const element = allWhatsappElements[index]; + console.log('________________________________________________'); + console.log(`Procesando elemento ${index + 1} de ${allWhatsappElements.length}`); + await new Promise(resolve => setTimeout(resolve, 1500)); + + if (element.classList.contains('new-case')) { + console.log('Elemento es un new-case'); + element.click(); + await new Promise(resolve => setTimeout(resolve, 1200)); + const headerText = document.querySelector('.social-case-conversation-header span')?.textContent || ''; + console.log('Nuevo caso: ' + headerText); + const textarea = document.querySelector('.selected-message-container-all-case textarea#textareaActAsChat'); + if (textarea && textarea.offsetHeight > 0 && textarea.offsetWidth > 0 && getComputedStyle(textarea).display !== 'none' && getComputedStyle(textarea).visibility !== 'hidden') { + console.log('El textarea está visible.'); + + // Capturar TODOS los mensajes en orden cronológico + const conversationItems = document.querySelectorAll( + '.case-conversation-item.client, .case-conversation-item.agent, .case-conversation-item.system' + ); + + const allMessages = []; + conversationItems.forEach(item => { + if (item.classList.contains("client")) { + const spans = item.querySelectorAll("span.body-text"); + spans.forEach(span => { + if (span.textContent.trim() !== "") { + allMessages.push({ + id: Math.random().toString(36).substring(2, 15), + role: "user", + content: span.textContent.trim() + }); + } + }); + } else if (item.classList.contains("agent") || item.classList.contains("system")) { + const texts = item.querySelectorAll(".sm-whatsapp .text, span.body-text"); + texts.forEach(t => { + if (t.innerText.trim() !== "") { + allMessages.push({ + id: Math.random().toString(36).substring(2, 15), + role: "assistant", + content: t.innerText.trim() + }); + } + }); + } + }); + + console.log("Conversación en orden:", allMessages); + + const data = await chrome.storage.local.get("okanToken"); + const okanToken = data.okanToken; + let mensaje; + + if (okanToken) { + console.log('Token obtenido: ' + okanToken); + const options = { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Accept': '*/*', + 'Authorization': `Bearer ${okanToken}` + }, + body: JSON.stringify({ + "datos": { "tema": "", "extraContext": "" }, + "history": allMessages + }) + }; + + try { + const response = await fetch('https://io.linguogpt.ai/api/assistant/7cb1a048-8e67-44fe-a71e-ccacf19ef944', { ...options, timeout: 15000 }); + if (response.status === 200) { + const data = await response.json(); + if (data.suggestions && data.suggestions.length > 0) { + mensaje = data.suggestions[0].text; + console.log('Mensaje obtenido del endpoint:', mensaje); + } + } else if (response.status === 401) { + alert("Debes iniciar sesión en Okan"); + console.warn('Authentication error: User needs to login to Okan'); + } else { + console.error('Error en respuesta de linguo:', response.status); + } + } catch (error) { + console.error('Error en la petición a linguo:', error); + } + } + + const overlay_hide = document.getElementById(`robotOverlay`); + if (overlay_hide) overlay_hide.remove(); + + if (mensaje) { + textarea.value = mensaje; + textarea.dispatchEvent(new Event('input', { bubbles: true })); + console.log('Mensaje escrito en caso:', mensaje); + + await new Promise(resolve => setTimeout(resolve, 1200)); + const sendButton = document.querySelector('a.social-case-reply-as-chat-send'); + if (sendButton && sendButton.offsetParent !== null) { + sendButton.click(); + console.log('Mensaje enviado'); + } + } else { + console.log("No se obtuvo mensaje de Linguo, caso se marca como gestionado igualmente."); + } + + element.classList.add('caso-gestionado'); + console.log('Caso gestionado: ' + headerText); + } + } else if (element.classList.contains('unread') && !element.classList.contains('new-case')) { + console.log('Element classes:', element.classList.toString()); + element.click(); + await new Promise(resolve => setTimeout(resolve, 1200)); + const headerText = document.querySelector('.social-case-conversation-header span')?.textContent || ''; + console.log('Caso unread: ' + headerText); + const textarea = document.querySelector('.selected-message-container-all-case textarea#textareaActAsChat'); + if (textarea && textarea.offsetHeight > 0 && textarea.offsetWidth > 0 && getComputedStyle(textarea).display !== 'none' && getComputedStyle(textarea).visibility !== 'hidden') { + console.log('El textarea está visible.'); + + // Capturar TODOS los mensajes en orden cronológico + const conversationItems = document.querySelectorAll( + '.case-conversation-item.client, .case-conversation-item.agent, .case-conversation-item.system' + ); + + const allMessages = []; + conversationItems.forEach(item => { + if (item.classList.contains("client")) { + const spans = item.querySelectorAll("span.body-text"); + spans.forEach(span => { + if (span.textContent.trim() !== "") { + allMessages.push({ + id: Math.random().toString(36).substring(2, 15), + role: "user", + content: span.textContent.trim() + }); + } + }); + } else if (item.classList.contains("agent") || item.classList.contains("system")) { + const texts = item.querySelectorAll(".sm-whatsapp .text, span.body-text"); + texts.forEach(t => { + if (t.innerText.trim() !== "") { + allMessages.push({ + id: Math.random().toString(36).substring(2, 15), + role: "assistant", + content: t.innerText.trim() + }); + } + }); + } + }); + + console.log("Conversación en orden:", allMessages); + + const data = await chrome.storage.local.get("okanToken"); + const okanToken = data.okanToken; + let mensaje; + + if (okanToken) { + console.log('Token obtenido: ' + okanToken); + const options = { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Accept': '*/*', + 'Authorization': `Bearer ${okanToken}` + }, + body: JSON.stringify({ + "datos": { "tema": "", "extraContext": "" }, + "history": allMessages + }) + }; + + try { + const response = await fetch('https://io.linguogpt.ai/api/assistant/7cb1a048-8e67-44fe-a71e-ccacf19ef944', { ...options, timeout: 15000 }); + if (response.status === 200) { + const data = await response.json(); + if (data.suggestions && data.suggestions.length > 0) { + mensaje = data.suggestions[0].text; + console.log('Mensaje obtenido del endpoint:', mensaje); + } + } else if (response.status === 401) { + alert("Debes iniciar sesión en Okan"); + console.warn('Authentication error: User needs to login to Okan'); + } else { + console.error('Error en respuesta de linguo:', response.status); + } + } catch (error) { + console.error('Error en la petición a linguo:', error); + } + } + + const overlay_hide = document.getElementById(`robotOverlay`); + if (overlay_hide) overlay_hide.remove(); + + if (mensaje) { + textarea.value = mensaje; + textarea.dispatchEvent(new Event('input', { bubbles: true })); + console.log('Mensaje escrito en caso:', mensaje); + + await new Promise(resolve => setTimeout(resolve, 1200)); + const sendButton = document.querySelector('a.social-case-reply-as-chat-send'); + if (sendButton && sendButton.offsetParent !== null) { + sendButton.click(); + console.log('Mensaje enviado'); + } + } else { + console.log("No se obtuvo mensaje de Linguo, caso se marca como gestionado igualmente."); + } + + element.classList.add('caso-gestionado'); + console.log('Caso gestionado: ' + headerText); + } + } else { + continue; + } + console.log('________________________________________________'); + } + + + const overlay_hide = document.getElementById(`robotOverlay`); + if (overlay_hide) { + overlay.remove(); + } + + } + + // Marcamos que hemos terminado el procesamiento + console.log('Procesamiento de casos completado.'); + procesandoCasos = false; +} + +// Ejecutar la función cada 3 segundos +setInterval(procesarElementosWhatsapp, 7000); \ No newline at end of file diff --git a/images/icon-green.png b/images/icon-green.png new file mode 100644 index 0000000000000000000000000000000000000000..3694c6fde5d3be4e698040b90cf9b3386ddf8edd GIT binary patch literal 572 zcmV-C0>k}@P)pF8FWQhbW?9;ba!ELWdL_~cP?peYja~^aAhuUa%Y?FJQ@H10m(^3 zK~y-6m6I`RlTj3gpL4#XA&a!)tUn4(EC9yBy(A%I*4;n%+jZ0#f)jwOtWj zgg|3^=E?iveK~lGfTkENB0c~RtQe3R0t*-ojdDw!N^|f>5T~`=NMD~B zjG4Ea-3w254mSfBe|LRcRUez_*C@)@I+f-?0kVDWd)%06Z|*1mNZ{*N4LAOkVO6mg$m5T8^KS%?w8rvY0>t$tF0 z$JGtDuHYJ&TPP({<>SI}=i;Q`=P_vr!1?Wo2Lf{$3A0H#`SwpZjZc{yc@4b!II(qC z0rEkYOv0CaW22Cij%*Tl;>qBm4I_LW?d6wY=$I;<%1B>-tQgz@R>iC(ND5$B(S$n4 zykQSd_ePgDFK_PuB^dgp;?ymQNEImj9`9nT`HX+GSKQkg-v0^ii^;ZG&`DPS0000< KMNUMnLSTX;Jo-HV literal 0 HcmV?d00001 diff --git a/images/icon128.png b/images/icon128.png new file mode 100644 index 0000000000000000000000000000000000000000..997ed3ae76077b26f0c55a3bef96d46dccbfac2a GIT binary patch literal 4339 zcmY*dc{J4D8~)4~jD0L+n~)_c*~3`Jl0mYsiN;Q3Uj~CQgpp9$8bd^-R47?Owk%(a zUAC-QvTs?&`qQ7k=bY!h=e_^j`<(l{?|IK97#pIP=y~V?0ASM7)iynkxPOGwoUhGl z4xQ%#5}>JP4m}4J>YQ+%)A{P!1ONb4**}7IW7hP}H@O3ESqGZ=xCVwe_`3ihAt4eT z-kt$Y4!$lDKK^dm>nc0|0Q1$;)-cDA)^copIfh@foxQC=6};%vbr<0sYP_r3-3wWCtb|S7Tt;3%`>MdMr-Dv(+kn7LIxlZ|egN<mz$4%}3mwZkiq$C@4!ChXa(vaJ#PfM^$|-G#b6FVnjNWTB`GE$Z1~P zO_QlcuPd>D<`9Ji%B@vHP!4?g^til@d29yEj%ab#Y_DN^Z42)Smdk$N4%Q6^wOg#O zkwmL5z!^4bOu-bLi|#3QH&E)-p-KT}M@J^Sq1kQMPZ77f_`+U{#G(-P2iIl}7-2X) zHeqSVf9g;_cNm%xpaJ#kG<4(2_CJT;+gL-?i*k5pd)xr-W`50_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9W2IrA;O};V8lryjrcA7j>02 ztVd)wc7{cr_6hM_0crpY>~?C^ILcVxB^ZPIUUS%3pZzeGb>Z1xFwn#adfgy7X~U5E z=Uc=rTMV$v0{8QX#3gbL z<=^agJ^~VV8Gm`jh(DltypHz|)L1KvdC4sSqcwGfay|L!YkXw2)-3uE|6vIWh+W%s z9FJphU@w1(`+{iZbye&rVJSw!b@f2NvY`9!yhnzuNtng}MTp}9X3KYpnyi9#%_=cM zTVJ$~9(n#545ZzHy$UAFbm~iRe~KFY)k$2sSJfy2{w?~TjgWQ`kg|txjP3s!P-!(1 z>kF@@W^Ib77Wo2!F|4zJq&Kch=OFwc8dm})@g9O6mw^ThDevR;Vc(pGYQICx(#u%^ zUt5UM;Qc|BRWE}{gvsc0`oeS|$#~otztD}Hz@AHHt%C{;W%+_(B7DkwABQ*^bp>>v zk?-Hul{dY{;dRlDO5%8Rt*!LcDma5&hjpu%nk6@H^|%#OQz6(V|AP@sR`}Y6Ph$r_^z09{7+*YfrxO2v d^k<$?5es(0z{%6H=N}Y+-YrAzPnu}_{{XNT`mX>0 literal 0 HcmV?d00001 diff --git a/images/icon16.png b/images/icon16.png new file mode 100644 index 0000000000000000000000000000000000000000..d17c2afa140dda8fa4445e72068f5da205da50aa GIT binary patch literal 655 zcmV;A0&x9_P)dJHcTa_oK-xcUAH?*?!=)-hlehb6 zP8q;RY(7fHW0R_o+SV(`8JpQQ*e-;C;T!i!eJRVBDRH3q+G;4@jebc0m{X3G*)`8z zkksy9My3?ZMc0avRGJDwvJ<@A?KF#wKBY8y0adzyzlQwrk>va0DnvQ}Q~^js!CY{K z)4FJ~w`&Up0RZx&y_!rq5MFmy-W)zhGUGu19+j!hjpJN5oaKLM;{+rgm;<8J@}002ovPDHLkV1iFb9}NHi literal 0 HcmV?d00001 diff --git a/images/icon48.png b/images/icon48.png new file mode 100644 index 0000000000000000000000000000000000000000..a675692418493340a116c9faaa333e0d54510347 GIT binary patch literal 1145 zcmV-<1cv*GP)P42jaRL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+eWF{z00000 LNkvXXu0mjfV#p&7 literal 0 HcmV?d00001 diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..27362a0 --- /dev/null +++ b/manifest.json @@ -0,0 +1,31 @@ +{ + "manifest_version": 3, + "name": "SMCC", + "version": "2.0", + "default_locale": "es", + "description": "Automatización SMCC", + "permissions": ["tabs", "storage", "history"], + "host_permissions": ["https://claro-co.ysocial.net/*", "https://apps.okan.tools/*"], + "background": { + "service_worker": "background.js" + }, + "content_scripts": [ + { + "matches": ["https://claro-co.ysocial.net/*", "http://claro-co.ysocial.net/*"], + "js": ["content.js"] + } + ], + "action": { + "default_popup": "popup.html", + "default_icon": { + "16": "images/icon16.png", + "48": "images/icon48.png", + "128": "images/icon128.png" + } + }, + "icons": { + "16": "images/icon16.png", + "48": "images/icon48.png", + "128": "images/icon128.png" + } +} \ No newline at end of file diff --git a/popup.html b/popup.html new file mode 100644 index 0000000..0ae784e --- /dev/null +++ b/popup.html @@ -0,0 +1,19 @@ + + + + + SMCC + + + +
+

URL actual:

+
+ + +

+
+
+ + + \ No newline at end of file diff --git a/popup.js b/popup.js new file mode 100644 index 0000000..63b8d1f --- /dev/null +++ b/popup.js @@ -0,0 +1,51 @@ +// Esperar a que el DOM esté completamente cargado +document.addEventListener('DOMContentLoaded', function() { + // Obtener referencia al elemento que mostrará la URL + const currentUrlElement = document.getElementById('currentUrl'); + + // Obtener la URL de la pestaña activa y mostrarla + chrome.tabs.query({active: true, currentWindow: true}, function(tabs) { + const activeTab = tabs[0]; + currentUrlElement.textContent = 'URL actual: ' + activeTab.url; + + // Cargar mensaje guardado para esta URL si existe + chrome.storage.local.get(['mensaje'], function(result) { + if (result.mensaje) { + document.getElementById('savedMessage').textContent = 'Mensaje guardado: ' + result.mensaje; + document.getElementById('userMessage').value = result.mensaje; + } + }); + }); + + // Actualizar la URL cuando cambie la pestaña activa + chrome.tabs.onActivated.addListener(function(activeInfo) { + chrome.tabs.get(activeInfo.tabId, function(tab) { + currentUrlElement.textContent = 'URL actual: ' + tab.url; + + // Cargar mensaje guardado para esta URL si existe + chrome.storage.local.get(['mensaje'], function(result) { + if (result.mensaje) { + document.getElementById('savedMessage').textContent = 'Mensaje guardado: ' + result.mensaje; + document.getElementById('userMessage').value = result.mensaje; + } else { + document.getElementById('savedMessage').textContent = ''; + document.getElementById('userMessage').value = ''; + } + }); + }); + }); + + // Configurar el botón para guardar mensajes + document.getElementById('saveMessage').addEventListener('click', function() { + chrome.tabs.query({active: true, currentWindow: true}, function(tabs) { + const activeTab = tabs[0]; + const message = document.getElementById('userMessage').value; + + // Guardar el mensaje en chrome.storage usando la URL como clave + chrome.storage.local.set({mensaje: message}, function() { + document.getElementById('savedMessage').textContent = 'Mensaje guardado: ' + message; + console.log('Mensaje guardado en chrome.storage: ' + message); + }); + }); + }); +}); \ No newline at end of file diff --git a/styles.css b/styles.css new file mode 100644 index 0000000..6db3e50 --- /dev/null +++ b/styles.css @@ -0,0 +1,64 @@ +body { + font-family: Arial, sans-serif; + width: 300px; + padding: 10px; + transition: background-color 0.3s ease; +} + +.container { + text-align: center; +} + +h1 { + font-size: 18px; + color: #333; + margin-bottom: 10px; +} + +p { + font-size: 14px; + color: #666; + margin-bottom: 15px; +} + +button { + background-color: #4285f4; + color: white; + border: none; + padding: 8px 16px; + border-radius: 4px; + cursor: pointer; + font-size: 14px; + transition: background-color 0.3s; +} + +button:hover { + background-color: #3367d6; +} + +#currentUrl { + margin-top: 15px; + font-style: italic; + word-break: break-all; +} + +.message-container { + margin-top: 15px; +} + +#userMessage { + width: 100%; + height: 60px; + padding: 8px; + margin-bottom: 10px; + border: 1px solid #ccc; + border-radius: 4px; + resize: none; + font-family: Arial, sans-serif; +} + +.saved-message { + margin-top: 10px; + color: #4285f4; + font-weight: bold; +} \ No newline at end of file