Attachment #693268: part-1-about-plugins-v2.patch for bug #757726

View | Details | Raw Unified | Return to bug 757726
Collapse All | Expand All

(-)a/toolkit/content/plugins.html (-63 / +152 lines)
Line     Link Here 
 Lines 2-29    Link Here 
2
2
3
<!-- This Source Code Form is subject to the terms of the Mozilla Public
3
<!-- This Source Code Form is subject to the terms of the Mozilla Public
4
   - License, v. 2.0. If a copy of the MPL was not distributed with this
4
   - License, v. 2.0. If a copy of the MPL was not distributed with this
5
   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
5
   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
6
6
7
<html>
7
<html>
8
<head>
8
<head>
9
<script type="application/javascript">
9
<script type="application/javascript">
10
  "use strict";
11
12
  Components.utils.import("resource://gre/modules/AddonManager.jsm");
13
10
  var strBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Components.interfaces.nsIStringBundleService);
14
  var strBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Components.interfaces.nsIStringBundleService);
11
  var pluginsbundle = strBundleService.createBundle("chrome://global/locale/plugins.properties");
15
  var pluginsbundle = strBundleService.createBundle("chrome://global/locale/plugins.properties");
12
  var regionbundle = strBundleService.createBundle("chrome://global-region/locale/region.properties");
16
  var regionbundle = strBundleService.createBundle("chrome://global-region/locale/region.properties");
13
17
14
  document.writeln("<title>" + pluginsbundle.GetStringFromName("title_label") + "<\/title>");
18
  document.writeln("<title>" + pluginsbundle.GetStringFromName("title_label") + "<\/title>");
15
</script>
19
</script>
16
<link rel="stylesheet" type="text/css" href="chrome://global/content/plugins.css">
20
<link rel="stylesheet" type="text/css" href="chrome://global/content/plugins.css">
17
<link rel="stylesheet" type="text/css" href="chrome://global/skin/plugins.css">
21
<link rel="stylesheet" type="text/css" href="chrome://global/skin/plugins.css">
18
</head>
22
</head>
19
<body>
23
<body>
20
<div id="outside">
24
<div id="outside">
21
<script type="application/javascript">
25
<script type="application/javascript">
26
  "use strict";
22
27
23
  function setDirection() {
28
  function setDirection() {
24
    var frame = document.getElementById("directionDetector");
29
    var frame = document.getElementById("directionDetector");
25
    var direction = frame.contentDocument
30
    var direction = frame.contentDocument
26
                         .defaultView
31
                         .defaultView
27
                         .window
32
                         .window
28
                         .getComputedStyle(frame.contentDocument.getElementById("target"), "")
33
                         .getComputedStyle(frame.contentDocument.getElementById("target"), "")
29
                         .getPropertyValue("direction");
34
                         .getPropertyValue("direction");
 Lines 47-124    Link Here 
47
52
48
   * First, refresh plugins in case anything has been changed recently in
53
   * First, refresh plugins in case anything has been changed recently in
49
   * prefs: (The "false" argument tells refresh not to reload or activate
54
   * prefs: (The "false" argument tells refresh not to reload or activate
50
   * any plug-ins that would be active otherwise.  In contrast, one would
55
   * any plug-ins that would be active otherwise.  In contrast, one would
51
   * use "true" in the case of ASD instead of restarting)
56
   * use "true" in the case of ASD instead of restarting)
52
   */
57
   */
53
  navigator.plugins.refresh(false);
58
  navigator.plugins.refresh(false);
54
59
55
60
  AddonManager.getAddonsByTypes(["plugin"], function (aPlugins) {
56
  var numPlugins = navigator.plugins.length;
61
    var fragment = document.createDocumentFragment();
57
62
58
  if (numPlugins > 0)
63
    // "Enabled plugins"
59
    document.writeln("<h1 id=\"plugs\">" + pluginsbundle.GetStringFromName("enabledplugins_label") + "<\/h1>");
64
    var id, label;
60
  else
65
    if (aPlugins.length > 0) {
61
    document.writeln("<h1 id=\"noplugs\">" + pluginsbundle.GetStringFromName("nopluginsareenabled_label") + "<\/h1>");
66
      id = "plugs";
62
67
      label = "enabledplugins_label";
63
  document.writeln("<div id=\"findmore\">" + pluginsbundle.GetStringFromName("findmore_label") + " ");
68
    } else {
64
  document.writeln("<a href=\"" + regionbundle.GetStringFromName("more_plugins_url") + "\">" + regionbundle.GetStringFromName("more_plugins_label") + "<\/a>.");
69
      id = "noplugs";
65
  document.writeln("<\/div>");
70
      label = "nopluginsareenabled_label";
66
71
    }
67
  document.writeln("<div id=\"findpluginupdates\">" + pluginsbundle.GetStringFromName("findpluginupdates_label") + " ");
72
    var enabledplugins = document.createElement("h1");
68
  document.writeln("<a href=\"" + regionbundle.GetStringFromName("pluginupdates_url") + "\">" + regionbundle.GetStringFromName("pluginupdates_label") + "<\/a>.");
73
    enabledplugins.setAttribute("id", id);
69
  document.writeln("<\/div>");
74
    enabledplugins.appendChild(document.createTextNode(pluginsbundle.GetStringFromName(label)));
70
75
    fragment.appendChild(enabledplugins);
71
  document.writeln("<div id=\"installhelp\">" + pluginsbundle.GetStringFromName("installhelp_label") + " ");
76
72
  document.writeln("<a href=\"" + regionbundle.GetStringFromName("plugindoc_url") + "\">" + regionbundle.GetStringFromName("plugindoc_label") + "<\/a>.");
77
    // "Find more information about browser plugins at " ...
73
  document.writeln("<\/div><hr>");
78
    var findmore = document.createElement("div");
74
79
    findmore.setAttribute("id", "findmore");
75
  for (var i = 0; i < numPlugins; i++)
80
    findmore.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("findmore_label") + " "));
76
  {
81
    fragment.appendChild(findmore);
77
    var plugin = navigator.plugins[i];
82
78
83
    // ... "mozilla.org"
79
    if (plugin)
84
    var moreplugins = document.createElement("a");
80
    {
85
    moreplugins.setAttribute("href", regionbundle.GetStringFromName("more_plugins_url"));
81
      document.write("<h2 class=\"plugname\">");
86
    moreplugins.appendChild(document.createTextNode(regionbundle.GetStringFromName("more_plugins_label")));
82
      document.write(plugin.name);
87
    findmore.appendChild(moreplugins);
83
      document.writeln("<\/h2>");
88
84
89
    // "Find updates for installed plugins at " ...
85
      document.writeln("<dl><dd><span class=\"label\">" + pluginsbundle.GetStringFromName("file_label") + "<\/span> ");
90
    var findpluginupdates = document.createElement("div");
86
      document.write(plugin.filename);
91
    findpluginupdates.setAttribute("id", "findpluginupdates");
87
      document.writeln("<\/dd><dd><span class=\"label\">" + pluginsbundle.GetStringFromName("version_label") + "<\/span> ");
92
    findpluginupdates.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("findpluginupdates_label") + " "));
88
      document.write(plugin.version);
93
    fragment.appendChild(findpluginupdates);
89
      document.writeln("<\/dd><dd>");
94
90
      document.write(plugin.description);
95
    // ... "mozilla.com/plugincheck"
91
      document.writeln("<\/dd><\/dl>");
96
    var pluginupdates = document.createElement("a");
92
97
    pluginupdates.setAttribute("href", regionbundle.GetStringFromName("pluginupdates_url"));
93
      document.writeln("<table border=\"1\" class=\"contenttable\">");
98
    pluginupdates.appendChild(document.createTextNode(regionbundle.GetStringFromName("pluginupdates_label")));
94
      document.writeln("<thead>");
99
    findpluginupdates.appendChild(pluginupdates);
95
      document.writeln("<tr><th class=\"type\">" + pluginsbundle.GetStringFromName("mimetype_label") + "<\/th>");
100
96
      document.writeln("<th class=\"desc\">" + pluginsbundle.GetStringFromName("description_label") + "<\/th>");
101
    // "Help for installing plugins is available from " ...
97
      document.writeln("<th class=\"suff\">" + pluginsbundle.GetStringFromName("suffixes_label") + "<\/th>");
102
    var installhelp = document.createElement("div");
98
      document.writeln("<\/tr><\/thead>");
103
    installhelp.setAttribute("id", "installhelp");
99
      document.writeln("<tbody>");
104
    installhelp.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("installhelp_label") + " "));
100
105
    fragment.appendChild(installhelp);
101
      var numTypes = plugin.length;
106
102
      var mimetype;
107
    // ... "plugindoc.mozdev.org"
103
      for (var j = 0; j < numTypes; j++)
108
    var plugindoc = document.createElement("a");
104
      {
109
    plugindoc.setAttribute("href", regionbundle.GetStringFromName("plugindoc_url"));
105
        mimetype = plugin[j];
110
    plugindoc.appendChild(document.createTextNode(regionbundle.GetStringFromName("plugindoc_label")));
106
111
    installhelp.appendChild(plugindoc);
107
        if (mimetype)
112
108
        {
113
    fragment.appendChild(document.createElement("hr"));
109
          document.writeln("<tr>");
114
110
          document.writeln("<td>" + mimetype.type + "<\/td>");
115
    for (var i = 0; i < aPlugins.length; i++) {
111
          document.writeln("<td>" + mimetype.description + "<\/td>");
116
      var plugin = aPlugins[i];
112
          document.writeln("<td>" + mimetype.suffixes + "<\/td>");
117
      if (plugin) {
113
          document.writeln("<\/tr>");
118
        // "Shockwave Flash"
119
        var plugname = document.createElement("h2");
120
        plugname.setAttribute("class", "plugname");
121
        plugname.appendChild(document.createTextNode(plugin.name));
122
        fragment.appendChild(plugname);
123
124
        var dl = document.createElement("dl");
125
        fragment.appendChild(dl);
126
127
        // "File: Flash Player.plugin"
128
        var fileDd = document.createElement("dd");
129
        var file = document.createElement("span");
130
        file.setAttribute("class", "label");
131
        file.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("file_label") + " "));
132
        fileDd.appendChild(file);
133
        fileDd.appendChild(document.createTextNode(plugin.pluginLibraries));
134
        dl.appendChild(fileDd);
135
136
        // "Version: "
137
        var versionDd = document.createElement("dd");
138
        var version = document.createElement("span");
139
        version.setAttribute("class", "label");
140
        version.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("version_label") + " "));
141
        versionDd.appendChild(version);
142
        versionDd.appendChild(document.createTextNode(plugin.version));
143
        dl.appendChild(versionDd);
144
145
        // Plugin Description
146
        var descDd = document.createElement("dd");
147
        descDd.appendChild(document.createTextNode(plugin.description));
148
        dl.appendChild(descDd);
149
150
        // MIME Type table
151
        var mimetypeTable = document.createElement("table");
152
        mimetypeTable.setAttribute("border", "1");
153
        mimetypeTable.setAttribute("class", "contenttable");
154
        fragment.appendChild(mimetypeTable);
155
156
        var thead = document.createElement("thead");
157
        mimetypeTable.appendChild(thead);
158
        var tr = document.createElement("tr");
159
        thead.appendChild(tr);
160
161
        // "MIME Type" column header
162
        var typeTh = document.createElement("th");
163
        typeTh.setAttribute("class", "type");
164
        typeTh.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("mimetype_label")));
165
        tr.appendChild(typeTh);
166
167
        // "Description" column header
168
        var descTh = document.createElement("th");
169
        descTh.setAttribute("class", "desc");
170
        descTh.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("description_label")));
171
        tr.appendChild(descTh);
172
173
        // "Suffixes" column header
174
        var suffixesTh = document.createElement("th");
175
        suffixesTh.setAttribute("class", "suff");
176
        suffixesTh.appendChild(document.createTextNode(pluginsbundle.GetStringFromName("suffixes_label")));
177
        tr.appendChild(suffixesTh);
178
179
        var tbody = document.createElement("tbody");
180
        mimetypeTable.appendChild(tbody);
181
182
        var mimeTypes = plugin.pluginMimeTypes;
183
        for (var j = 0; j < mimeTypes.length; j++) {
184
          var mimetype = mimeTypes[j];
185
          if (mimetype) {
186
            var mimetypeRow = document.createElement("tr");
187
            tbody.appendChild(mimetypeRow);
188
189
            // "application/x-shockwave-flash"
190
            var typename = document.createElement("td");
191
            typename.appendChild(document.createTextNode(mimetype.type));
192
            mimetypeRow.appendChild(typename);
193
194
            // "Shockwave Flash"
195
            var description = document.createElement("td");
196
            description.appendChild(document.createTextNode(mimetype.description));
197
            mimetypeRow.appendChild(description);
198
199
            // "swf"
200
            var suffixes = document.createElement("td");
201
            suffixes.appendChild(document.createTextNode(mimetype.suffixes));
202
            mimetypeRow.appendChild(suffixes);
203
          }
114
        }
204
        }
115
      }
205
      }
116
117
      document.write("<\/tbody>");
118
      document.write("<\/table>");
119
    }
206
    }
120
  }
207
208
    document.getElementById("outside").appendChild(fragment);
209
  });
121
</script>
210
</script>
122
</div>
211
</div>
123
</body>
212
</body>
124
</html>
213
</html>

Return to bug 757726