@@ -72,7 +72,7 @@ const loadWebhooks = async () => {
7272
7373 const labelSpan = document . createElement ( "span" ) ;
7474 labelSpan . classList . add ( "label" ) ;
75- labelSpan . textContent = webhook . label ;
75+ labelSpan . textContent = ` ${ webhook . emoji ? webhook . emoji + ' ' : '' } ${ webhook . label } ` ;
7676
7777 const urlSpan = document . createElement ( "span" ) ;
7878 urlSpan . classList . add ( "url" ) ;
@@ -130,7 +130,7 @@ const loadWebhooks = async () => {
130130
131131 const labelSpan = document . createElement ( "span" ) ;
132132 labelSpan . classList . add ( "label" ) ;
133- labelSpan . textContent = webhook . label ;
133+ labelSpan . textContent = ` ${ webhook . emoji ? webhook . emoji + ' ' : '' } ${ webhook . label } ` ;
134134
135135 const urlSpan = document . createElement ( "span" ) ;
136136 urlSpan . classList . add ( "url" ) ;
@@ -374,6 +374,7 @@ const labelInput = document.getElementById("webhook-label");
374374const urlInput = document . getElementById ( "webhook-url" ) ;
375375const methodSelect = document . getElementById ( "webhook-method" ) ;
376376const identifierInput = document . getElementById ( "webhook-identifier" ) ;
377+ const emojiInput = document . getElementById ( "webhook-emoji" ) ;
377378const headersListDiv = document . getElementById ( "headers-list" ) ;
378379const headerKeyInput = document . getElementById ( "header-key" ) ;
379380const headerValueInput = document . getElementById ( "header-value" ) ;
@@ -405,6 +406,11 @@ const closeManageGroups = document.querySelector("#manage-groups-modal .close-ma
405406const closeManageAppearanceBtn = document . getElementById ( "close-manage-appearance-btn" ) ;
406407const closeManageAppearance = document . querySelector ( "#manage-appearance-modal .close-manage-appearance" ) ;
407408const themeSelect = document . getElementById ( "theme-select" ) ;
409+ // Emoji picker elements
410+ const openEmojiPickerBtn = document . getElementById ( 'open-emoji-picker-btn' ) ;
411+ const clearEmojiBtn = document . getElementById ( 'clear-emoji-btn' ) ;
412+ const emojiPicker = document . getElementById ( 'emoji-picker' ) ;
413+ const emojiGrid = document . getElementById ( 'emoji-grid' ) ;
408414let headers = [ ] ;
409415
410416async function exportWebhooks ( ) {
@@ -428,7 +434,9 @@ async function handleImport(event) {
428434 const data = JSON . parse ( text ) ;
429435 const hooks = Array . isArray ( data ) ? data : data . webhooks ;
430436 if ( Array . isArray ( hooks ) ) {
431- await saveWebhooks ( hooks ) ;
437+ // Backward compatibility: ensure emoji field exists
438+ const normalized = hooks . map ( h => ( { ...h , emoji : h . emoji || "" } ) ) ;
439+ await saveWebhooks ( normalized ) ;
432440 loadWebhooks ( ) ;
433441 }
434442 } catch ( e ) {
@@ -461,8 +469,10 @@ const importData = async (file) => {
461469 reader . onload = async ( event ) => {
462470 try {
463471 const data = JSON . parse ( event . target . result ) ;
464- const webhooks = Array . isArray ( data . webhooks ) ? data . webhooks : [ ] ;
472+ let webhooks = Array . isArray ( data . webhooks ) ? data . webhooks : [ ] ;
465473 const groups = Array . isArray ( data . groups ) ? data . groups : [ ] ;
474+ // Ensure emoji field exists
475+ webhooks = webhooks . map ( h => ( { ...h , emoji : h . emoji || "" } ) ) ;
466476 await browser . storage . sync . set ( { webhooks, groups } ) ;
467477 await loadWebhooks ( ) ;
468478 if ( typeof renderGroups === 'function' ) await renderGroups ( ) ;
@@ -501,8 +511,10 @@ if (importWebhooksBtn && importWebhooksInput) {
501511 reader . onload = async ( event ) => {
502512 try {
503513 const data = JSON . parse ( event . target . result ) ;
504- const webhooks = Array . isArray ( data . webhooks ) ? data . webhooks : [ ] ;
514+ let webhooks = Array . isArray ( data . webhooks ) ? data . webhooks : [ ] ;
505515 const groups = Array . isArray ( data . groups ) ? data . groups : [ ] ;
516+ // Ensure emoji field exists
517+ webhooks = webhooks . map ( h => ( { ...h , emoji : h . emoji || "" } ) ) ;
506518 await browser . storage . sync . set ( { webhooks, groups } ) ;
507519 await loadWebhooks ( ) ;
508520 if ( typeof renderGroups === 'function' ) await renderGroups ( ) ;
@@ -782,6 +794,7 @@ form.addEventListener("submit", async (e) => {
782794 const url = urlInput . value . trim ( ) ;
783795 const method = methodSelect . value ;
784796 const identifier = identifierInput . value . trim ( ) ;
797+ const emoji = emojiInput ? emojiInput . value . trim ( ) : "" ;
785798 const urlFilter = urlFilterInput . value . trim ( ) ;
786799 const customPayload = customPayloadInput . value . trim ( ) ;
787800 const groupId = groupSelect . value || null ;
@@ -799,7 +812,8 @@ form.addEventListener("submit", async (e) => {
799812 identifier,
800813 customPayload : customPayload || null ,
801814 urlFilter : urlFilter || "" ,
802- groupId
815+ groupId,
816+ emoji : emoji || ""
803817 } : wh
804818 ) ;
805819 editWebhookId = null ;
@@ -815,7 +829,8 @@ form.addEventListener("submit", async (e) => {
815829 identifier,
816830 customPayload : customPayload || null ,
817831 urlFilter : urlFilter || "" ,
818- groupId
832+ groupId,
833+ emoji : emoji || ""
819834 } ;
820835 webhooks . push ( newWebhook ) ;
821836 }
@@ -825,6 +840,7 @@ form.addEventListener("submit", async (e) => {
825840 urlInput . value = "" ;
826841 methodSelect . value = "POST" ;
827842 identifierInput . value = "" ;
843+ if ( emojiInput ) emojiInput . value = "" ;
828844 urlFilterInput . value = "" ;
829845 customPayloadInput . value = "" ;
830846 headerKeyInput . value = "" ;
@@ -923,6 +939,7 @@ webhookList.addEventListener("click", async (e) => {
923939 urlFilterInput . value = webhook . urlFilter || "" ;
924940 customPayloadInput . value = webhook . customPayload || "" ;
925941 groupSelect . value = webhook . groupId || "" ;
942+ if ( emojiInput ) emojiInput . value = webhook . emoji || "" ;
926943 headers = Array . isArray ( webhook . headers ) ? [ ...webhook . headers ] : [ ] ;
927944 renderHeaders ( ) ;
928945 cancelEditBtn . classList . remove ( "hidden" ) ;
@@ -949,6 +966,7 @@ webhookList.addEventListener("click", async (e) => {
949966 urlFilterInput . value = webhook . urlFilter || "" ;
950967 customPayloadInput . value = webhook . customPayload || "" ;
951968 groupSelect . value = webhook . groupId || "" ;
969+ if ( emojiInput ) emojiInput . value = webhook . emoji || "" ;
952970 headers = Array . isArray ( webhook . headers ) ? [ ...webhook . headers ] : [ ] ;
953971 renderHeaders ( ) ;
954972 cancelEditBtn . classList . remove ( "hidden" ) ;
@@ -975,6 +993,7 @@ cancelEditBtn.addEventListener("click", () => {
975993 headerKeyInput . value = "" ;
976994 headerValueInput . value = "" ;
977995 groupSelect . value = "" ;
996+ if ( emojiInput ) emojiInput . value = "" ;
978997 headers = [ ] ;
979998 renderHeaders ( ) ;
980999 cancelEditBtn . classList . add ( "hidden" ) ;
@@ -1116,6 +1135,46 @@ document.addEventListener("DOMContentLoaded", () => {
11161135 browser . storage . sync . set ( { theme : value } ) ;
11171136 } ) ;
11181137 }
1138+
1139+ // Initialize emoji picker if present
1140+ if ( openEmojiPickerBtn && emojiPicker && emojiGrid && emojiInput ) {
1141+ const EMOJIS = [
1142+ '🔔' , '✅' , '🚀' , '⚠️' , '❗' , 'ℹ️' , '⭐' , '🔥' , '🛠️' , '🧪' , '📦' , '📣' , '📝' , '🧰' , '💡' , '🖥️' , '📱' , '🌐' , '🔒' , '🔑' , '🛡️' , '💾' , '📤' , '📥' , '🔄' , '⏱️' , '🕒' , '🧭' , '📊' , '📈' , '🧹' , '🧼' , '🧯' , '🧩' , '🧠' , '🛎️' , '🚨' , '🎉' , '🧵' , '🔍' , '🧰' , '🔗' , '✉️' , '📫' , '📬' , '🛰️' , '🌟' , '🎯' , '🪄' , '🧲' , '🧪' , '🧱' , '🪵'
1143+ ] ;
1144+
1145+ function renderEmojiGrid ( ) {
1146+ emojiGrid . textContent = '' ;
1147+ EMOJIS . forEach ( e => {
1148+ const btn = document . createElement ( 'button' ) ;
1149+ btn . type = 'button' ;
1150+ btn . className = 'emoji-item' ;
1151+ btn . textContent = e ;
1152+ btn . addEventListener ( 'click' , ( ) => {
1153+ emojiInput . value = e ;
1154+ emojiPicker . classList . add ( 'hidden' ) ;
1155+ emojiInput . focus ( ) ;
1156+ } ) ;
1157+ emojiGrid . appendChild ( btn ) ;
1158+ } ) ;
1159+ }
1160+
1161+ openEmojiPickerBtn . addEventListener ( 'click' , ( ) => {
1162+ if ( emojiPicker . classList . contains ( 'hidden' ) ) {
1163+ renderEmojiGrid ( ) ;
1164+ emojiPicker . classList . remove ( 'hidden' ) ;
1165+ } else {
1166+ emojiPicker . classList . add ( 'hidden' ) ;
1167+ }
1168+ } ) ;
1169+
1170+ if ( clearEmojiBtn ) {
1171+ clearEmojiBtn . addEventListener ( 'click' , ( ) => {
1172+ emojiInput . value = '' ;
1173+ emojiInput . focus ( ) ;
1174+ } ) ;
1175+ }
1176+
1177+ }
11191178} ) ;
11201179
11211180// Export functions for testing in Node environment
0 commit comments