Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> ระบบเครือข่าย >> อินเทอร์เน็ต

โอน Firefox Personas ระหว่างอุปกรณ์และโปรไฟล์

หัวข้อแปลกนิดหน่อย สมมติคุณมีหลายอุปกรณ์รัน Firefox โดยไม่มี sign-in หรือ sync enabled มีหลายโปรไฟล์ แตคุณยังคงมีความชอบ และใช้หลาย personas หรือ lightweight themes ในเบราว์เซอร์ บางตัวไม่ download ได้แล้ว แต่อยาก migrate ระหว่างโปรไฟล์ต่างๆ

ลอง copy ส่วนของ profile contents เช่น extensions ไป ไม่ได้ full profile clone จะทำได้ แต่นั่นไม่ใช่สิ่งที่อยาก แค่อยาก theme เฉพาะตัว ดูครั้งแรกไม่มีทางทำ สิ่งนี้?

โอน Firefox Personas ระหว่างอุปกรณ์และโปรไฟล์

รายละเอียดปัญหา

หลายสัปดาห์ก่อน ผมใช้เวลาทดสอบ Firefox ใน Australis mode ด้วย Firefox 54 แทน ESR (ก่อน release Firefox 57) พยายามเข้าใจ upcoming WebExtensions fiasco ว่า foobary ตามคาดไหม ไม่ใช่จุด แค่ intro

ระหว่างทดสอบ ลอง themes ใหม่ๆ รวมถึง Mozilla's own Compact Light และ Compact Dark nod toward classic usage model - มี disadvantages ยังคงอยู่ รวมถึง location ของ Bookmarks Toolbar ใต้ tab controls และใกล้ main view area มาก visual clutter แล้วลอง theme ชื่อ Space Fantasy ดู kind of neat

โอน Firefox Personas ระหว่างอุปกรณ์และโปรไฟล์

โอน Firefox Personas ระหว่างอุปกรณ์และโปรไฟล์

โอน Firefox Personas ระหว่างอุปกรณ์และโปรไฟล์

โอน Firefox Personas ระหว่างอุปกรณ์และโปรไฟล์

บนอุปกรณ์อื่น Space Fantasy ไม่ทำงาน จึงลบ มันหายจาก shortlist available themes ใน Firefox และหาไม่เจอบน Mozilla add-ons site! ควรอยู่แตไม่มี คำถาม porting จากโปรไฟล์อื่นบนระบบอื่นขึ้น

โอน Firefox Personas ระหว่างอุปกรณ์และโปรไฟล์

วิธีย้าย personas ระหว่างโปรไฟล์

เน้นที่ tricks นี้: how to get personas - IF พวกมัน not available elsewhere คำขอ simple หากติดตั้ง theme อยากหาใน Firefox profile จะแสดงวิธี ทำความเข้าใจความแตกต่างระหว่าง full themes และ light themes (Personas) ก่อน หัวข้อที่พูดไปแล้ว

Full themes อยู่ใน extensions sub-directory ของ profile folder ตำแหน่ง profile ขึ้นกับ OS ใน Windows:

C:\Users\<user>\AppData\Roaming\Mozilla\Firefox\Profiles\<profile>

ใน Linux:

/home/<user>/.mozilla/firefox/<profile>

สมมติ defaults

โอน Firefox Personas ระหว่างอุปกรณ์และโปรไฟล์

Personas อยู่เป็น declarations ใน prefs.js file อีกครั้ง ใน profile folder ตามภาพข้างต้น มาดู section เฉพาะของไฟล์นี้:

โอน Firefox Personas ระหว่างอุปกรณ์และโปรไฟล์

...
user_pref("lightweightThemes.selectedThemeID", "recommended-2");
user_pref("lightweightThemes.usedThemes", "[{\"id\":\"recommended-2\",\"name\":\"Space Fantasy\",
\"headerURL\":\"resource:///chrome/browser/content/
browser/defaultthemes/2.header.jpg\",
\"footerURL\":\"resource:///chrome/browser/content/
browser/defaultthemes/2.footer.jpg\",
\"textcolor\":\"#ffffff\",\"accentcolor\":\"#d9d9d9\",
\"iconURL\":\"resource:///chrome/browser/content/
browser/defaultthemes/2.icon.jpg\",
\"previewURL\":\"resource:///chrome/browser/content/
browser/defaultthemes/2.preview.jpg\",
\"author\":\"fx5800p\",\"description\":\"Space Fantasy is (C) fx5800p. Available under CC-BY-SA. No warranty.\",
\"homepageURL\":\"https://addons.mozilla.org/
firefox/addon/space-fantasy/\",
\"version\":\"1.0\"},
{\"id\":\"recommended-4\",\"name\":\"Pastel Gradient\",
\"headerURL\":\"resource:///chrome/browser/content/
browser/defaultthemes/4.header.png\",
\"footerURL\":\"resource:///chrome/browser/content/
browser/defaultthemes/4.footer.png\",
\"textcolor\":\"#000000\",\"accentcolor\":\"#000000\",
\"iconURL\":\"resource:///chrome/browser/content/
browser/defaultthemes/4.icon.png\",
\"previewURL\":\"resource:///chrome/browser/content/
browser/defaultthemes/4.preview.png\",
\"author\":\"darrinhenein\",\"description\":\"Pastel Gradient is (C) darrinhenein. Available under CC-BY. No warranty.\",
\"homepageURL\":\"https://addons.mozilla.org/firefox/
addon/pastel-gradient/\",
\"version\":\"1.0\",\"updateDate\":1499641520955,
\"installDate\":1499641520955}]");
...

ดูซับซ้อนและ醜 - โปรดสังเกต ผมขึ้นบรรทัดใหม่เพื่อความชัดเจนโดยเจตนา! แต่เข้าใจว่ามีอะไร: user_pref หลายตัว ตัวแรก lightweightThemes.selectedThemeID กำหนดว่า active อันไหน simple

ตัวที่สอง lightweightThemes.usedThemes เป็น comma-delimited list ของ themes ที่มีอยู่ - เช็คได้ที่ Tools > Addons > Appearance list เป็น JSON-like format 醜 แตไม่ต้องกังวล

โอน Firefox Personas ระหว่างอุปกรณ์และโปรไฟล์

ถ้าอยาก migrate personas จากโปรไฟล์หนึ่งไปอีกอัน copy ส่วนของ declaration นี้ paste ใน target profile ที่เกี่ยวข้อง โดยเฉพาะ copy Space Fantasy persona แต่ละ theme defined by curly brackets แยกจากอื่นด้วย comma นี่คือ section ที่ sanitized แล้ว:

{\"id\":\"recommended-2\",
\"name\":\"Space Fantasy\",
\"headerURL\":\"resource:///chrome/browser/content/browser/->
-> defaultthemes/2.header.jpg\",
\"footerURL\":\"resource:///chrome/browser/content/browser/->
-> defaultthemes/2.footer.jpg\",
\"textcolor\":\"#ffffff\",
\"accentcolor\":\"#d9d9d9\",
\"iconURL\":\"resource:///chrome/browser/content/browser/->
-> defaultthemes/2.icon.jpg\",
\"previewURL\":\"resource:///chrome/browser/content/browser/->
-> defaultthemes/2.preview.jpg\",
\"author\":\"fx5800p\",
\"description\":\"Space Fantasy is (C) fx5800p. Available ->
-> under CC-BY-SA. No warranty.\",
\"homepageURL\":\"https://addons.mozilla.org/firefox/addon/->
-> space-fantasy/\",
\"version\":\"1.0\"}

P.S. Desktop users: -> characters เป็นของผม บ่งชี้ directive ไหลไปบรรทัดถัดไป FYI แค่ list of key:value pairs คั่นด้วย commas special characters declared explicitly (quotation marks " กลายเป็น \") Ugly และ nerdy

ตอนนี้ เปิด source Firefox profile เปิด prefs.js ไปที่ lightweightThemes.usedThemes section หา theme ที่อยาก migrate บันทึก section นี้ใน text file ที่ไหนสักที่ section ที่จำเป็นจะเริ่มด้วย curly bracket จบด้วยหนึ่ง และมี fields ต่างๆ ตามข้างต้น ใน one smooth flowing line ไม่เหมือนตัวอย่างผมที่บรรทัดหลายบรรทัด จะเป็น one very long line ระวังเรื่องนั้น

ใน target profile เปิด prefs.js ไปที่ lightweightThemes.usedThemes section insert snippet ข้อความต้นหรือท้ายบรรทัด ให้ syntax ถูกต้อง สังเกต position และ presence ของ opening/closing square และ curly brackets และ commas

Launch Firefox ตอนนี้ควรมี missing personas ใน target profile และ apply ได้ตามต้องการ trick นี้ useful เมื่อ lightweight themes หายไปหรือหาไม่เจอออนไลน์

สรุป

บทความ nerdy นี้ prefs.js คือ source ของ joy, pain และ wonder สำหรับ Firefox และถ้ามี inkling ของ HTML และ CSS คล้าย desktop themes ใน Linux เริ่ม hack browser ให้ลุคและพฤติกรรมตามใจ ฟัง crazy แตเป็น modern world JSON คือ modern purgatory

philosophical deliberation aside หวังว่าบทความนี้ useful บางครั้ง personas อาจมาและไปหรือหาย และทำให้คุณบ้าที่ไม่ใช้ได้อีก โดยเฉพาะ Firefox ไม่อย่างง่าย migrate และ import themes ระหว่างโปรไฟล์ต่างๆ หวัง guide นี้ให้ workaround ที่ต้องการ ไม่ใช่ easiest หรือ prettiest แตได้ job done เจอกันใหม่

Cheers.