diff --git a/content.js b/content.js
index 3ab9d8d..4fd1c95 100644
--- a/content.js
+++ b/content.js
@@ -638,6 +638,17 @@
`;
+ // Attach inline copy button listeners
+ if (tab === 'qa') {
+ pane.querySelectorAll('.lja-qa-copy-btn').forEach(btn => {
+ btn.addEventListener('click', function() {
+ navigator.clipboard.writeText(this.getAttribute('data-answer'));
+ this.textContent = '✅';
+ setTimeout(() => this.textContent = '📋', 1200);
+ });
+ });
+ }
+
copyBtn.style.display = 'block';
// Show auto-fill button for Q&A tab
@@ -810,12 +821,7 @@ Brief honest assessment of this opportunity for my profile`
❓ ${q}
`;
});
@@ -1056,7 +1062,12 @@ Brief honest assessment of this opportunity for my profile`
let results;
try {
- results = JSON.parse(resultText);
+ const match = resultText.match(/\[[\s\S]*\]/);
+ if (match) {
+ results = JSON.parse(match[0]);
+ } else {
+ results = JSON.parse(resultText);
+ }
} catch(e) {
console.error(resultText);
throw new Error('Failed to parse AI response');
diff --git a/prompts.js b/prompts.js
index 6902669..c152a37 100644
--- a/prompts.js
+++ b/prompts.js
@@ -2,10 +2,8 @@
// LANGUAGE RULES: Analysis = match job language. Everything else = ENGLISH ALWAYS.
function buildPromptV2(tab, job, userProfile, language) {
- // Only analysis follows job language; rest is always English
- const analysisLang = language === 'arabic' ? 'Respond entirely in Arabic.'
- : language === 'english' ? 'Respond entirely in English.'
- : 'Respond in the same language as the job posting.';
+ // Force Arabic for the analysis tab to ensure full comprehension
+ const analysisLang = 'Respond ENTIRELY in Arabic. All headings, explanations, and bullets MUST be in Arabic. and RTL';
const ctx = [
'Job Title: ' + (job.jobTitle || 'Not specified'),
@@ -113,7 +111,7 @@ Respond EXACTLY:
## NEW BULLET POINTS TO ADD
- [2-3 new achievement bullets ready to paste into CV — in English]`;
- const dynamicQuestions = job.questions && job.questions.length > 0
+ const dynamicQuestions = job.questions && job.questions.length > 0
? job.questions.map((q, i) => `${i + 1}. "${q.question}" [type: ${q.type}]`).join('\n')
: '1. "Why are you interested in this role?" [type: text]\n2. "What is your relevant experience?" [type: text]\n3. "What are your salary expectations?" [type: text]\n4. "When can you start?" [type: text]\n5. "Do you require visa sponsorship?" [type: text]';
@@ -139,10 +137,10 @@ ${ctx}
QUESTIONS TO ANSWER:
${dynamicQuestions}
-RESPOND WITH ONLY THIS FORMAT (raw JSON, no wrapping):
+RESPOND WITH ONLY THIS FORMAT (raw JSON, no wrapping, answering ONLY the questions listed above):
{
- "exact question text here": "concise answer",
- "another question": "answer"
+ "question 1 text here": "concise answer",
+ "question 2 text here": "concise answer"
}`;
P.benefits = `You are a career analyst specializing in tech compensation in MENA.