שמות למספרי משנה
-
בסייתא דשמיא כתבתי קוד לתוסף tampermonkey שאתה מקליד ערך שקשור לבחירת זיהוי הוא מציג לך את רשימת המספרים שלך אם שמות
את הרשימה צריך ליצור בקובץ CallerIdMap.ini בשלוחה ראשית
מספר=שם
הקוד הוא// ==UserScript== // @name Yemot Config Helper - Final Fix // @match https://*.call2all.co.il/* // @grant GM_xmlhttpRequest // @connect self // @connect *.call2all.co.il // ==/UserScript== (function () { 'use strict'; let callerIdMap = new Map(); const keysToWatch = [ "invitation_join_campaign_say_did_number=", "queue_caller_id=", "send_sms_from=", "send_tzintuk_from=", "tzintuk_your_id=", "out_id=", "tzintuk_invitation_join_to_list_caller_id=", "out=" ]; const box = document.createElement("div"); box.style.cssText = "position: absolute; background: white; border: 1px solid #aaa; box-shadow: 2px 2px 10px rgba(0,0,0,0.2); padding: 5px; display: none; z-index: 10000; max-height: 250px; overflow-y: auto; min-width: 180px; font-family: Arial, sans-serif; direction: rtl; text-align: right; border-radius: 4px;"; document.body.appendChild(box); function fetchCallerIdMap() { // תיקון: שימוש בדומיין הדינמי הנוכחי const apiUrl = window.location.origin + '/ym/ws.php?ws=YDDownloadIniFile&what=ivr2://CallerIdMap.ini'; GM_xmlhttpRequest({ method: "GET", url: apiUrl, headers: { 'Accept': 'application/json' }, onload: function(response) { try { const jsonData = JSON.parse(response.responseText); if (jsonData.responseStatus === "OK" && jsonData.contents) { parseIniContent(jsonData.contents); console.log("Yemot Helper: Map loaded successfully"); } else { console.warn("Yemot Helper: File is empty or not found on server"); } } catch (e) { console.error("Yemot Helper: Failed to parse response", e); } } }); } function parseIniContent(content) { callerIdMap.clear(); const lines = content.split(/\r?\n/); for (const line of lines) { const parts = line.split('='); if (parts.length >= 2) { const number = parts[0].trim(); const name = parts[1].trim(); if (number && name) { callerIdMap.set(name, number); } } } } function showBox(textarea) { box.innerHTML = "<div style='font-weight:bold; border-bottom:1px solid #ccc; margin-bottom:5px; padding-bottom:3px; font-size:12px;'>בחר מזהה:</div>"; if (callerIdMap.size === 0) { box.innerHTML += "<div style='padding:5px; color:red; font-size:11px;'>לא נטענו נתונים מ-CallerIdMap.ini</div>"; } else { callerIdMap.forEach((number, name) => { const item = document.createElement("div"); item.textContent = `${name} (${number})`; item.style.cssText = "cursor: pointer; padding: 4px; border-bottom: 1px solid #eee; font-size: 13px;"; item.onmouseover = () => item.style.backgroundColor = "#f0f0f0"; item.onmouseout = () => item.style.backgroundColor = "transparent"; // תיקון: שימוש ב-onmousedown וביטול איבוד הפוקוס item.onmousedown = (e) => { e.preventDefault(); insert(textarea, number); box.style.display = "none"; }; box.appendChild(item); }); } const rect = textarea.getBoundingClientRect(); box.style.top = (rect.top + window.scrollY + 20) + "px"; box.style.left = (rect.left + window.scrollX) + "px"; box.style.display = "block"; } function insert(textarea, value) { const start = textarea.selectionStart; const end = textarea.selectionEnd; const currentVal = textarea.value; textarea.value = currentVal.substring(0, start) + value + currentVal.substring(end); const newPos = start + value.length; textarea.setSelectionRange(newPos, newPos); textarea.dispatchEvent(new Event('input', { bubbles: true })); textarea.focus(); } fetchCallerIdMap(); document.addEventListener("input", (e) => { if (e.target.tagName === "TEXTAREA") { const cursor = e.target.selectionStart; const textBefore = e.target.value.substring(0, cursor); const found = keysToWatch.some(key => textBefore.endsWith(key)); if (found) { showBox(e.target); } else { box.style.display = "none"; } } }); // תיקון: שינוי ל-mousedown בהתאמה לאייטמים כדי לא להתנגש בתיבת הטקסט document.addEventListener("mousedown", (e) => { if (!box.contains(e.target) && e.target.tagName !== "TEXTAREA") { box.style.display = "none"; } }); })();אם יש מישהו שיכול לעשות שזה יהיה אוטמטי רק להתקין תוסף כמו זה זה יביא תועלת להרבה משתמשים וכן אם יש עוד הגדרות שקשורות לזיהוי להוסיף
קרדיט @cubase לקחתי את הבסיס של הקוד של התוסף שלו ושיניתי על ידי בינה
@מוזר -
B BEN ZION התייחס לנושא זה
-
-
@CUBASE אצלי זה אוטומטי התכונתי להעלות לאיזה שרת או משהו שכל מי שירצה את התוסף יוכל להתקין אותו כמו המוזמנים לרשימת צינתוקים
-
@BEN-ZION אני מדבר על זה שצריך ליצור קובץ עם הזיהויים, תבקש מהבינה את מה שכתבתי בפוסט קודם ואז זה יהיה אוטומטי על פי הזיהוים המאושרים במערכת ולא יהיה צורך להקליד את הזיהויים בקובץ
-
@CUBASE אבל איפא אני יכתוב להם שמות?
-
@BEN-ZION למה צריך שמות?
הרעיון בזה הוא שנפתח לך רשימה ואתה בוחר את אחד המספרים, לא?
האמת שלא בדקתי את זה אבל כך הבנתי
-
@CUBASE אני לא זוכר לפי המספרים יש לי 10 מס' אני לא זוכר למה כל אחד משמש ככה כל מס' חדש אני רושם לאיזה קו הוא ושאני עורך הגדרות של הקו מופיע לי השם ליד המס'
-
@BEN-ZION אז אולי תעשה את זה משולב, כי עם קריאה לשירות שציינתי לעיל אתה מקבל את רשימת המספרים המאושרים לשיחות והמאושרים לסמס, כך שאם אתה מקליד לדוג׳
send_sms_from=אז מופיעים לך רק המספרים המאושרים לסמס