--- title: টুলবার slug: Mozilla/Add-ons/Code_snippets/Toolbar tags: - NeedsReview translation_of: Archive/Add-ons/Code_snippets/Toolbar ---
এখানে দুইটি টিউটোরিয়াল রয়েছে :
একটি টিউটোরিয়াল এর জন্য একটি বিশেষ পদক্ষেপ রয়েছে: কাষ্টম টুলবার বাটন একটি টিউটোরিয়াল বর্ণনা করার জন্য ইতোমধ্যে আপনার উন্নয়ন বুনিয়াদি একটি টুলবার বাটন যুক্ত করা প্রয়োজন: টুলবার বাটন তৈরি করা
আপনি যখন আপনার এক্সটেনশন স্থাপন এবং একটি টুলবার বাটন অভেরলেইং দ্বারা যুক্ত করা হয়, এটি ডিফল্ট অবস্থায় পাওয়া যায় না । ব্যবহারকারীকে বাটনটি টুলবারে টেনে আনতে হয়। নিম্নলিখিত কোড টুলবারে আপনার বাটন স্থাপন করবে। This should only be done on the first run of your add-on after installation so that if the user decides to remove your button, it doesn't show up again every time they start the application.
/** * Installs the toolbar button with the given ID into the given * toolbar, if it is not already present in the document. * * @param {string} toolbarId The ID of the toolbar to install to. * @param {string} id The ID of the button to install. * @param {string} afterId The ID of the element to insert after. @optional */ function installButton(toolbarId, id, afterId) { if (!document.getElementById(id)) { var toolbar = document.getElementById(toolbarId); // If no afterId is given, then append the item to the toolbar var before = null; if (afterId) { let elem = document.getElementById(afterId); if (elem && elem.parentNode == toolbar) before = elem.nextElementSibling; } toolbar.insertItem(id, before); toolbar.setAttribute("currentset", toolbar.currentSet); document.persist(toolbar.id, "currentset"); if (toolbarId == "addon-bar") toolbar.collapsed = false; } } if (firstRun) { installButton("nav-bar", "my-extension-navbar-button"); // The "addon-bar" is available since Firefox 4 installButton("addon-bar", "my-extension-addon-bar-button"); }