Addon Manager List Generator

Addon Manager List Generator

Postby srazzano » Sun Apr 01, 2012 2:36 am

Image Addon List Gen
Updated: August 13, 2013

Generates a selectable/editable category view of all extensions, plugins, themes, scripts and userstyles for copying to clipboard or generating a time stamped text file to preclude the overwriting of files. Changes button icon on the fly and displays pertinent data information in the header.

Image
Last edited by srazzano on Sat Apr 15, 2017 5:12 am, edited 228 times in total.
srazzano
 
Posts: 1508
Joined: Sat Mar 31, 2012 6:42 pm
Location: Las Vegas, Nevada

Re: Addon Manager List Generator

Postby makondo » Sun Apr 01, 2012 3:53 pm

AWESOME!

srazzano, i think it might be good to add the total/enabled/disabled count line (the one from the AM ext.).

And also, if possible, make the button generate a combined list when clicked despite AM being open or not. Maybe use Mclick for that (if it's at all possible, of course).
So, to sum it up:

Lclick - nothing happens if AM is not opened (it's good 'cause who wants a list generated by a mistaken Lclick anyway? it will remind to open AM or Mclick)
Lclick when AM is opened - generates a list for the selected category
Mclick - generates a combined list of all addons, total/disabled/enabled count, UA regardles of AM being open or not
Rclick - opens AM

What do you think?
Last edited by makondo on Mon Apr 02, 2012 10:16 pm, edited 1 time in total.
makondo
 
Posts: 1636
Joined: Sun Dec 25, 2011 7:17 pm

Re: Addon Manager List Generator

Postby mrbunnylamakins » Sun Apr 01, 2012 10:25 pm

Hmm I never thought of copying it to text. Might be nice record in case you need to check it.


Extension List | custombuttons
http://custombuttons.mozdev.org/drupal/content/extension-list
mrbunnylamakins
 
Posts: 253
Joined: Tue Dec 27, 2011 2:24 am

Re: Addon Manager List Generator

Postby makondo » Mon Apr 02, 2012 2:26 am

The brilliance of this button is that it generates list of whatever category tab you're viewing in AM. That is, if you're in Styles category, it will create a list of your styles, etc. Maybe the older buttons will save srazzano time and help to make it work w/out AM being open, like i posted in my request above. If he'll be willing, of course.

Oh, another thing i remembered about LI was it was possible to set it so that it would include links to those exts. when links were available (i'd imagine most are on AMO).
srazzano, do you think you can do this? BTW, i have the latest Local Install xpi, i can send it to you if you'd like to take a look or else get it here.
makondo
 
Posts: 1636
Joined: Sun Dec 25, 2011 7:17 pm

Re: Addon Manager List Generator

Postby morat » Mon Apr 02, 2012 8:57 pm

Here is a similar button I wrote a while back that opens all addon types in new tabs.

Code: Select all
/*Code*/
function caseInsensitive(a, b) {
  a = a.toLowerCase();
  b = b.toLowerCase();
  if (a < b) return -1;
  if (a > b) return 1;
  return 0;
}
function openTab(aType) {
  AddonManager.getAddonsByTypes([aType], function(aAddons) {
    var list = new Array();
    aAddons.forEach(function(aAddon) {
      list.push(aAddon);
    });
    // if (list.length == 0) return;
    var out = new Array();
    for (var i = 0; i < list.length; i++) {
      out.push("* " + list[i].name + " " + list[i].version);
    }
    out.sort(caseInsensitive);
    out.unshift(aType.toUpperCase() + " (" + list.length + ")", "");
    out.unshift(appInfo.name + " " + appInfo.version + " Gecko " + appInfo.platformVersion, "");
    var converter = Components.classes["@mozilla.org/intl/scriptableunicodeconverter"].
      createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
    converter.charset = "UTF-8";
    for (var i = 0; i < out.length; i++) {
      out[i] = converter.ConvertFromUnicode(out[i]);
      out[i] = out[i].replace(/&/g, "&amp;");
      out[i] = out[i].replace(/>/g, "&gt;");
      out[i] = out[i].replace(/</g, "&lt;");
      out[i] = out[i].replace(/"/g, "&quot;");
      out[i] = out[i].replace(/'/g, "&apos;");
    }
    var data = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">';
    data += "<html><head><title>" + aType + "</title>";
    data += '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">';
    data += "</head><body><pre>" + out.join("\n") + "</pre></body></html>";
    if (appInfo.name == "Firefox" || appInfo.name == "SeaMonkey") {
      gBrowser.addTab("data:text/html;charset=utf-8;base64," + btoa(data));
    }
    if (appInfo.name == "Thunderbird") {
      var tabmail = document.getElementById("tabmail");
      if (!tabmail) {
        var win = Components.classes["@mozilla.org/appshell/window-mediator;1"].
          getService(Components.interfaces.nsIWindowMediator).
          getMostRecentWindow("mail:3pane");
        if (win) {
          tabmail = win.document.getElementById("tabmail");
          win.focus();
        }
      }
      if (tabmail) {
        tabmail.openTab("contentTab", {
          contentPage: "data:text/html;charset=utf-8;base64," + btoa(data),
          background: true});
      }
    }
  });
}
Components.utils.import("resource://gre/modules/AddonManager.jsm");
var appInfo = Components.classes["@mozilla.org/xre/app-info;1"].
  getService(Components.interfaces.nsIXULAppInfo);
// ["extension", "theme", "plugin"].forEach(openTab);
for (var type in AddonManager.addonTypes) openTab(type);

@srazzano

I would replace the "\u2003" characters before the copy to clipboard operation. I would also select or open the addons tab if the current tab is not the addons tab.

Code: Select all
var appInfo = Components.classes["@mozilla.org/xre/app-info;1"].
  getService(Components.interfaces.nsIXULAppInfo);
if (appInfo.name == "Firefox" || appInfo.name == "SeaMonkey") {
  for (var i = 0, addTab = true; i < gBrowser.tabContainer.childNodes.length; i++) {
    if (gBrowser.tabContainer.childNodes[i].linkedBrowser.currentURI.spec == "about:addons") {
      gBrowser.selectedTab = gBrowser.tabContainer.childNodes[i];
      addTab = false;
      break;
    }
  }
  if (addTab) gBrowser.selectedTab = gBrowser.addTab("about:addons");
}
if (appInfo.name == "Thunderbird") openContentTab("about:addons");

@makondo

Try the version by Anton.

http://forum.mozilla-russia.org/viewtop ... 46#p488446
morat
 
Posts: 945
Joined: Wed Dec 28, 2011 2:38 pm

Re: Addon Manager List Generator

Postby makondo » Mon Apr 02, 2012 10:18 pm

Thanks, i know (and have it saved locally) another button like this but i don't need it. I use Extension Options Menu ext. which opens AM on Rclick. Just thought it'd be logical to have the option (Rclick>AM) in this button as well (not for me necessarily but for those who don't have other AM exts./buttons, for instance).
makondo
 
Posts: 1636
Joined: Sun Dec 25, 2011 7:17 pm

Re: Addon Manager List Generator

Postby srazzano » Tue Apr 03, 2012 12:34 am

Updated button so on left click will switch to the Addon Manager and load the list. If Addon Manager not opened, will open a new tab to display it and another left click to load the list. Did not want it on right click because of the needed context menu.
Thanks morat for the info and eliminated the \u2003 and \u2007 from copy function.
srazzano
 
Posts: 1508
Joined: Sat Mar 31, 2012 6:42 pm
Location: Las Vegas, Nevada

Re: Addon Manager List Generator

Postby makondo » Tue Apr 03, 2012 1:01 am

CB had context menus on Shift+ click which allowed using Rclick for clicks.
After the first Lclick, the AM opened focused and an empty (i think) frame of the list flashed for a second and disappeared.
So, is there a way to make a list of all addons, not categorized?

Thanks for the update!

EDIT: i asked that before in us.o thread. why the list box looks like my style for buttons? I can't seem to style it. This doesn't seem to have any effect:

#listBox
{ background: rgba(150,150,150, .6) !important;
font-weight: bold !important;
color: black !important;
text-shadow: 0px 0px 6px #999 !important; }
makondo
 
Posts: 1636
Joined: Sun Dec 25, 2011 7:17 pm

Re: Addon Manager List Generator

Postby srazzano » Tue Apr 03, 2012 2:52 am

OK, updated button again. When I overhauled the code, did not convert the #textbox to #listBox. It is now #listBox so your code above will work. Also added code so you can apply your code (normal css format) into the "Help" tab while in the button edit mode.
srazzano
 
Posts: 1508
Joined: Sat Mar 31, 2012 6:42 pm
Location: Las Vegas, Nevada

Re: Addon Manager List Generator

Postby mrbunnylamakins » Tue Apr 03, 2012 3:41 am

ok it needs some more revision I Clicked the button and blank page opened with prompt "The URL is not valid and cannot be loaded." I click Ok ,then the list open blanks showing nothing.
mrbunnylamakins
 
Posts: 253
Joined: Tue Dec 27, 2011 2:24 am

Next

Return to Buttons made by forum users