1
/* ***** BEGIN LICENSE BLOCK *****
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/
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
14
* The Original Code is Adblock Plus Element Hiding Helper.
16
* The Initial Developer of the Original Code is
18
* Portions created by the Initial Developer are Copyright (C) 2006-2007
19
* the Initial Developer. All Rights Reserved.
23
* ***** END LICENSE BLOCK ***** */
25
window.addEventListener("load", ehhInit, false);
28
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
29
.getService(Components.interfaces.nsIPrefService);
30
var branch = prefService.getBranch("extensions.adblockplus.");
32
// Check whether ABP is installed and has at least the required version
33
var requiredVersion = "0.7.5";
34
var installedVersion = "0";
36
var abp = Components.classes["@mozilla.org/adblockplus;1"]
37
.createInstance().wrappedJSObject;
38
installedVersion = abp.getInstalledVersion();
41
var parts1 = requiredVersion.split(".");
42
var parts2 = installedVersion.split(".");
43
var mustUpdate = false;
44
for (var i = 0; i < parts1.length; i++) {
45
if (parts2.length <= i || parseInt(parts1[i]) > parseInt(parts2[i])) {
49
if (parseInt(parts1[i]) < parseInt(parts2[i]))
53
// Show warning about required ABP update if necessary
55
var noWarning = {value: false};
57
noWarning.value = branch.getBoolPref("ehh.norequirementswarning");
60
if (!noWarning.value) {
61
// Make sure we don't show the warning twice
62
var hiddenWnd = Components.classes["@mozilla.org/appshell/appShellService;1"]
63
.getService(Components.interfaces.nsIAppShellService)
65
if ("ehhNoRequirementsWarning" in hiddenWnd)
66
noWarning.value = true;
68
hiddenWnd.ehhNoRequirementsWarning = true;
71
if (!noWarning.value) {
72
setTimeout(function() {
73
var stringService = Components.classes["@mozilla.org/intl/stringbundle;1"]
74
.getService(Components.interfaces.nsIStringBundleService);
75
var strings = stringService.createBundle("chrome://elemhidehelper/locale/global.properties");
76
var promptService = Components.classes['@mozilla.org/embedcomp/prompt-service;1']
77
.getService(Components.interfaces.nsIPromptService);
78
promptService.alertCheck(window,
79
strings.GetStringFromName("noabp_warning_title"),
80
strings.formatStringFromName("noabp_warning_text", [requiredVersion], 1),
81
strings.GetStringFromName("noabp_warning_disable"),
84
if (noWarning.value) {
86
branch.setBoolPref("ehh.norequirementswarning", true);
b'\\ No newline at end of file'