~ubuntu-branches/ubuntu/lucid/flashblock/lucid-proposed

« back to all changes in this revision

Viewing changes to content/flashblock/flashblock-prefs.js

  • Committer: Bazaar Package Importer
  • Author(s): Philippe Coval
  • Date: 2009-04-03 16:49:15 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20090403164915-oqcwx6g70d26nnzj
Tags: 1.3.12~a1+snapshot20090326-0ubuntu1
* New upstream release (LP: #309390)
  - Set the same version : from install.js to install.rdf
* debian/rules:
  - Read install.rdf instead of install.js to guess upstream version
* debian/control:
  - Added ${misc:Depends}, as lintian suggested and prefer FF-3.5
  - enhances flashplugin-nonfree

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/// PREFS FUNCTIONS
2
 
 
3
 
// Returns the value of the flashblock.enabled pref
4
 
function isEnabled() {
5
 
    var prefs = Components.classes["@mozilla.org/preferences-service;1"]
6
 
                          .getService(Components.interfaces.nsIPrefBranch);
7
 
 
8
 
    if(prefs.getPrefType("flashblock.enabled") == prefs.PREF_BOOL)
9
 
        return prefs.getBoolPref("flashblock.enabled");
10
 
    else {
11
 
        prefs.setBoolPref("flashblock.enabled", true);
12
 
        return true;
13
 
    }
14
 
}
15
 
 
16
 
// Returns the value of the flashblock.blockLocal pref
17
 
function isLocalBlocked() {
18
 
    var prefs = Components.classes["@mozilla.org/preferences-service;1"]
19
 
                          .getService(Components.interfaces.nsIPrefBranch);
20
 
 
21
 
    if(prefs.getPrefType("flashblock.blockLocal") == prefs.PREF_BOOL)
22
 
        return prefs.getBoolPref("flashblock.blockLocal");
23
 
    else {
24
 
        return false;
25
 
    }
26
 
}
27
 
 
28
 
// Returns the value of the javascript.enabled pref
29
 
function isJavascriptEnabled() {
30
 
    var prefs = Components.classes["@mozilla.org/preferences-service;1"]
31
 
                          .getService(Components.interfaces.nsIPrefBranch);
32
 
 
33
 
    return prefs.getBoolPref("javascript.enabled");
34
 
}
35
 
 
36
 
// Returns the value of the browser.toolbars.showbutton.flashblockMozToggle pref
37
 
function isButtonEnabled() {
38
 
    var prefs = Components.classes["@mozilla.org/preferences-service;1"]
39
 
                          .getService(Components.interfaces.nsIPrefBranch);
40
 
 
41
 
    if(prefs.getPrefType("browser.toolbars.showbutton.flashblockMozToggle") == prefs.PREF_BOOL)
42
 
        return prefs.getBoolPref("browser.toolbars.showbutton.flashblockMozToggle");
43
 
    else {
44
 
        prefs.setBoolPref("browser.toolbars.showbutton.flashblockMozToggle", true);
45
 
        return true;
46
 
    }
47
 
}
48
 
 
49
 
 
50
 
// Sets the flashblock.enabled pref to the given boolean value
51
 
function setEnabled(enabled) {
52
 
    var prefs = Components.classes["@mozilla.org/preferences-service;1"]
53
 
                          .getService(Components.interfaces.nsIPrefBranch);
54
 
 
55
 
    return prefs.setBoolPref("flashblock.enabled", enabled);
56
 
}
57
 
 
58
 
// Returns the value of the flashblock.whitelist pref
59
 
function getWhitelistPref() {
60
 
    var prefs = Components.classes["@mozilla.org/preferences-service;1"]
61
 
                          .getService(Components.interfaces.nsIPrefBranch);
62
 
 
63
 
    if(prefs.getPrefType("flashblock.whitelist") == prefs.PREF_STRING)
64
 
            return prefs.getCharPref("flashblock.whitelist");
 
1
var FBlockUtils = {
 
2
 
 
3
  /// PREFS FUNCTIONS
 
4
 
 
5
  prefs: Components.classes["@mozilla.org/preferences-service;1"]
 
6
         .getService(Components.interfaces.nsIPrefBranch)
 
7
         .QueryInterface(Components.interfaces.nsIPrefBranchInternal),
 
8
 
 
9
  // Returns the value of the flashblock.enabled pref
 
10
  isEnabled: function() {
 
11
    if(this.prefs.getPrefType("flashblock.enabled") == this.prefs.PREF_BOOL)
 
12
      return this.prefs.getBoolPref("flashblock.enabled");
 
13
    else {
 
14
      this.prefs.setBoolPref("flashblock.enabled", true);
 
15
      return true;
 
16
    }
 
17
  },
 
18
 
 
19
  // Returns the value of the flashblock.blockLocal pref
 
20
  isLocalBlocked: function() {
 
21
    if(this.prefs.getPrefType("flashblock.blockLocal") == this.prefs.PREF_BOOL)
 
22
      return this.prefs.getBoolPref("flashblock.blockLocal");
 
23
    else {
 
24
      return false;
 
25
    }
 
26
  },
 
27
 
 
28
  // Returns the value of the javascript.enabled pref
 
29
  isJavascriptEnabled:function() {
 
30
    return this.prefs.getBoolPref("javascript.enabled");
 
31
  },
 
32
 
 
33
  // Returns the value of the browser.toolbars.showbutton.flashblockMozToggle pref
 
34
  isButtonEnabled: function() {
 
35
        var buttonpref = "browser.toolbars.showbutton.flashblockMozToggle";
 
36
    if(this.prefs.getPrefType(buttonpref) == this.prefs.PREF_BOOL)
 
37
        return this.prefs.getBoolPref(buttonpref);
 
38
    else {
 
39
        this.prefs.setBoolPref(buttonpref, true);
 
40
        return true;
 
41
    }
 
42
  },
 
43
 
 
44
  // Sets the flashblock.enabled pref to the given boolean value
 
45
  setEnabled: function(enabled) {
 
46
    return this.prefs.setBoolPref("flashblock.enabled", enabled);
 
47
  },
 
48
 
 
49
  // Returns the value of the flashblock.whitelist pref
 
50
  getWhitelist: function() {
 
51
    if(this.prefs.getPrefType("flashblock.whitelist") == this.prefs.PREF_STRING)
 
52
            return this.prefs.getCharPref("flashblock.whitelist");
65
53
        else
66
 
                return undefined;
67
 
}
68
 
 
69
 
// Set the flashblock.whitelist pref to the given string
70
 
function setWhitelistPref(prefStr) {
71
 
    var prefs = Components.classes["@mozilla.org/preferences-service;1"]
72
 
                          .getService(Components.interfaces.nsIPrefBranch);
73
 
 
74
 
    prefs.setCharPref("flashblock.whitelist", prefStr);
 
54
                return "";
 
55
  },
 
56
 
 
57
  // Set the flashblock.whitelist pref to the given string
 
58
  setWhitelist: function(prefStr) {
 
59
    this.prefs.setCharPref("flashblock.whitelist", prefStr);
 
60
  }
75
61
}