Skip to content

Commit

Permalink
Issue ticket poohsen#3
Browse files Browse the repository at this point in the history
Hide the unused strings and only show the configured menuitems.
  • Loading branch information
Piroli YUKARINOMIYA committed May 11, 2014
1 parent f512277 commit 999a88d
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions chrome/thunderlink/content/thunderlink.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ var ThunderLinkChromeNS = {
OnTlMenuLoad: function()
{
function createCstrMenuItem(cstrnum) {
var label = ThunderLinkChromeNS.GetCustomTlStringTitle( cstrnum );
// Skip when title is not configured or temporary unused
if( !label.length || label.match( /^\./ ))
return null;

const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
var item = window.document.createElementNS(XUL_NS, "menuitem"); // create a new XUL menuitem
item.setAttribute("label", ThunderLinkChromeNS.GetCustomTlStringTitle(cstrnum));
Expand All @@ -154,15 +159,13 @@ var ThunderLinkChromeNS = {
popup.removeChild(popup.firstChild);
}
}
popup.appendChild(createCstrMenuItem(1));
popup.appendChild(createCstrMenuItem(2));
popup.appendChild(createCstrMenuItem(3));
popup.appendChild(createCstrMenuItem(4));
popup.appendChild(createCstrMenuItem(5));
popup.appendChild(createCstrMenuItem(6));
popup.appendChild(createCstrMenuItem(7));
popup.appendChild(createCstrMenuItem(8));

// Add only valid menuitems
for( var i = 1; i <= 8; i++ ) {
var menuitem = createCstrMenuItem( i );
if( menuitem )
popup.appendChild( menuitem );
}
},

dumpln: function(msg)
Expand Down

0 comments on commit 999a88d

Please sign in to comment.