~ubuntu-branches/ubuntu/maverick/ubufox/maverick-proposed

« back to all changes in this revision

Viewing changes to .pc/05_translations_answers_links.patch/content/overlay.js

  • Committer: Bazaar Package Importer
  • Author(s): Micah Gersten, Nobuto Murata, Micah Gersten
  • Date: 2010-10-27 00:37:31 UTC
  • Revision ID: james.westby@ubuntu.com-20101027003731-ma9arjxfn0ci5c6h
Tags: 0.9~rc2-0ubuntu5.1
[ Nobuto Murata <nobuto@nobuto-murata.org> ]
* Change release notes target to 10.10 (LP: #664651)
  - add debian/patches/04_maverick_release_notes_links.patch
  - update debian/patches/series

[ Micah Gersten <micahg@ubuntu.com> ]
* Change translations and answers links to Maverick (LP: #664274)
  - add debian/patches/05_translations_answers_links.patch
  - update debian/patches/series

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* ***** BEGIN LICENSE BLOCK *****
 
2
 *   Version: MPL 1.1/GPL 2.0/LGPL 2.1
 
3
 *
 
4
 * The contents of this file are subject to the Mozilla Public License Version
 
5
 * 1.1 (the "License"); you may not use this file except in compliance with
 
6
 * the License. You may obtain a copy of the License at
 
7
 * http://www.mozilla.org/MPL/
 
8
 * 
 
9
 * Software distributed under the License is distributed on an "AS IS" basis,
 
10
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 
11
 * for the specific language governing rights and limitations under the
 
12
 * License.
 
13
 *
 
14
 * The Original Code is distro-mods.
 
15
 *
 
16
 * The Initial Developer of the Original Code is
 
17
 * Canonical Ltd.
 
18
 * Portions created by the Initial Developer are Copyright (C) 2007
 
19
 * the Initial Developer. All Rights Reserved.
 
20
 *
 
21
 * Contributor(s):
 
22
 *
 
23
 * Alternatively, the contents of this file may be used under the terms of
 
24
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 
25
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 
26
 * in which case the provisions of the GPL or the LGPL are applicable instead
 
27
 * of those above. If you wish to allow use of your version of this file only
 
28
 * under the terms of either the GPL or the LGPL, and not to allow others to
 
29
 * use your version of this file under the terms of the MPL, indicate your
 
30
 * decision by deleting the provisions above and replace them with the notice
 
31
 * and other provisions required by the GPL or the LGPL. If you do not delete
 
32
 * the provisions above, a recipient may use your version of this file under
 
33
 * the terms of any one of the MPL, the GPL or the LGPL.
 
34
 * 
 
35
 * ***** END LICENSE BLOCK ***** */
 
36
 
 
37
function getAppVersion ()
 
38
{
 
39
  var versionString = null;
 
40
  try {
 
41
    versionString = Components.classes["@mozilla.org/fuel/application;1"].getService(Components.interfaces.extIApplication).version;
 
42
  } catch (e) {
 
43
  }
 
44
 
 
45
  if (versionString == null)
 
46
    return null;
 
47
 
 
48
  if (String_startsWith (versionString, "3.0"))
 
49
    versionString = "3.0";
 
50
  else if (String_startsWith (versionString, "3.5"))
 
51
    versionString = "3.5";
 
52
  else // Return null for > 3.6 as firefox is unversioned now
 
53
    versionString = null;
 
54
 
 
55
  return versionString;
 
56
}
 
57
 
 
58
function getSourcePackageName ()
 
59
{
 
60
  var sourcePackageName = "firefox";
 
61
  var versionString = getAppVersion();
 
62
  if (versionString)
 
63
    sourcePackageName = sourcePackageName + "-" + versionString;
 
64
 
 
65
  return sourcePackageName;
 
66
}
 
67
 
 
68
var ubufox = {
 
69
  onAddonsLoad: function () {
 
70
    this.isffox3 = false;
 
71
    var labelGetUbuntu = document.getElementById("getUbuntu"); // ffox 2
 
72
    var extensions = document.getElementById("extensions-view");
 
73
    this.strings = document.getElementById("ubufox-strings");
 
74
 
 
75
    if (!labelGetUbuntu) {
 
76
      labelGetUbuntu = document.getElementById("getUbuntu3");
 
77
      this.isffox3 = true;
 
78
    }
 
79
    this.initialized = true;
 
80
 
 
81
    if (!ubufoxCheckExecutable("/usr/bin/gnome-app-install"))
 
82
      labelGetUbuntu.setAttribute("hidden", "true");
 
83
    else if (!this.isffox3) {
 
84
      // this is ffox2 only because ffox3 uses a distinct overlay anchor
 
85
      if (extensions.getAttribute("selected") != "true") {
 
86
        labelGetUbuntu.setAttribute("hidden", "true");
 
87
      }
 
88
      if (extensions.getAttribute("selected") == "true") {
 
89
        labelGetUbuntu.setAttribute("hidden", "false");
 
90
      }
 
91
      extensions.addEventListener("DOMAttrModified", function (e) { ubufox.onAttrModified(e); }, false);
 
92
    }
 
93
  },
 
94
  onMenuItemCommand: function(e) {
 
95
    var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
 
96
                                  .getService(Components.interfaces.nsIPromptService);
 
97
    promptService.alert(window, this.strings.getString("helloMessageTitle"),
 
98
                                this.strings.getString("helloMessage"));
 
99
  },
 
100
  onAttrModified: function(e) {
 
101
    var labelGetUbuntu = document.getElementById("getUbuntu");
 
102
    var extensions = document.getElementById("extensions-view");
 
103
 
 
104
    if (!ubufoxCheckExecutable("/usr/bin/gnome-app-install")) {
 
105
      labelGetUbuntu.setAttribute("hidden", "true");
 
106
      return;
 
107
    }
 
108
    if (extensions.getAttribute("selected") != "true") {
 
109
      labelGetUbuntu.setAttribute("hidden", "true");
 
110
    }
 
111
    if (extensions.getAttribute("selected") == "true") {
 
112
      labelGetUbuntu.setAttribute("hidden", "false");
 
113
    }
 
114
  },
 
115
};
 
116
window.addEventListener("load", function(e) { ubufox.onAddonsLoad(e); }, false);
 
117
 
 
118
function startUbuntuAddonsWizard(ev)
 
119
{
 
120
  var executable =
 
121
      Components.classes['@mozilla.org/file/local;1']
 
122
      .createInstance(Components.interfaces.nsILocalFile);
 
123
 
 
124
  executable.initWithPath("/usr/bin/gnome-app-install");
 
125
 
 
126
  if(!executable.exists() || !executable.isExecutable())
 
127
         alert('Unexpected error!');
 
128
 
 
129
  var procUtil =
 
130
      Components.classes['@mozilla.org/process/util;1']
 
131
      .createInstance(Components.interfaces.nsIProcess);
 
132
 
 
133
  var nsFile = executable.QueryInterface(Components.interfaces.nsIFile);
 
134
 
 
135
  procUtil.init(executable);
 
136
 
 
137
  var args = new Array("--xul-extensions=firefox");
 
138
  // we care for firefox 2 and use a special mime type to document
 
139
  // compatibility of extensions with it
 
140
  if (!ubufox.isffox3) {
 
141
    args = new Array("--xul-extensions=firefox-2");
 
142
  }
 
143
  var res = procUtil.run(false, args, args.length);
 
144
 
 
145
  return true;
 
146
}
 
147
 
 
148
function ubufoxReportBug(event) {
 
149
 
 
150
  var executable =
 
151
      Components.classes['@mozilla.org/file/local;1']
 
152
      .createInstance(Components.interfaces.nsILocalFile);
 
153
 
 
154
  executable.initWithPath("/usr/bin/ubuntu-bug");
 
155
 
 
156
  if(!executable.exists () || !executable.isExecutable())
 
157
         alert('Unexpected error!');
 
158
 
 
159
  var procUtil =
 
160
      Components.classes['@mozilla.org/process/util;1']
 
161
      .createInstance(Components.interfaces.nsIProcess);
 
162
 
 
163
  var nsFile = executable.QueryInterface(Components.interfaces.nsIFile);
 
164
 
 
165
  procUtil.init(executable);
 
166
 
 
167
  var args = null;
 
168
  args = new Array("-p", getSourcePackageName());
 
169
 
 
170
  var res = procUtil.run(false, args, args.length);
 
171
}
 
172
 
 
173
 
 
174
function ubufoxGetHelpOnline(event)
 
175
{
 
176
  var getHelpUrl = "https://launchpad.net/distros/ubuntu/lucid/+sources/" + getSourcePackageName() + "/+gethelp";
 
177
  openUILink(getHelpUrl, event, false, true);
 
178
}
 
179
 
 
180
function ubufoxHelpTranslateLaunchpad(event)
 
181
{
 
182
  var translateUrl = "https://launchpad.net/distros/ubuntu/lucid/+sources/" + getSourcePackageName() + "/+translate";
 
183
  openUILink(translateUrl, event, false, true);
 
184
}
 
185
 
 
186
function ubufoxCheckExecutable(filename)
 
187
{
 
188
  var executable =
 
189
      Components.classes['@mozilla.org/file/local;1']
 
190
      .createInstance(Components.interfaces.nsILocalFile);
 
191
 
 
192
  executable.initWithPath(filename);
 
193
  return executable.exists();
 
194
}
 
195