mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-22 02:12:44 +01:00
Preferences button for Safari
Brings back the possibility to click a checkbox which opens the extension settings from Safari's Preferences/Extensions.
This commit is contained in:
parent
e36c7022cf
commit
6f2e449e61
@ -16,7 +16,10 @@
|
||||
},
|
||||
"safariextz": {
|
||||
"app_id": "net.gorhill.uBlock",
|
||||
"manifest": "Info.plist",
|
||||
"manifest": {
|
||||
"Info": "Info.plist",
|
||||
"Settings": "Settings.plist"
|
||||
},
|
||||
"file_ext": ".safariextz",
|
||||
"developer_identifier": "",
|
||||
"cert_dir": "../meta/safariextz/certs/",
|
||||
|
22
meta/safariextz/Settings.plist
Normal file
22
meta/safariextz/Settings.plist
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<array>
|
||||
<dict>
|
||||
<key>DefaultValue</key>
|
||||
<false/>
|
||||
<key>FalseValue</key>
|
||||
<false/>
|
||||
<key>Key</key>
|
||||
<string>open_prefs</string>
|
||||
<key>Secure</key>
|
||||
<false/>
|
||||
<key>Title</key>
|
||||
<string>Click to see the Preferences</string>
|
||||
<key>TrueValue</key>
|
||||
<true/>
|
||||
<key>Type</key>
|
||||
<string>CheckBox</string>
|
||||
</dict>
|
||||
</array>
|
||||
</plist>
|
@ -15,7 +15,7 @@
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.7.0.9</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1455205</string>
|
||||
<string>1455425</string>
|
||||
<key>Chrome</key>
|
||||
<dict>
|
||||
<key>Database Quota</key>
|
||||
|
22
src/Settings.plist
Normal file
22
src/Settings.plist
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<array>
|
||||
<dict>
|
||||
<key>DefaultValue</key>
|
||||
<false/>
|
||||
<key>FalseValue</key>
|
||||
<false/>
|
||||
<key>Key</key>
|
||||
<string>open_prefs</string>
|
||||
<key>Secure</key>
|
||||
<false/>
|
||||
<key>Title</key>
|
||||
<string>Click to see the Preferences</string>
|
||||
<key>TrueValue</key>
|
||||
<true/>
|
||||
<key>Type</key>
|
||||
<string>CheckBox</string>
|
||||
</dict>
|
||||
</array>
|
||||
</plist>
|
@ -287,6 +287,12 @@ if (self.chrome) {
|
||||
]
|
||||
);
|
||||
|
||||
safari.extension.settings.addEventListener('change', function(e) {
|
||||
if (e.key === 'open_prefs') {
|
||||
vAPI.tabs.open({url: 'dashboard.html', active: true});
|
||||
}
|
||||
}, false);
|
||||
|
||||
|
||||
vAPI.storage = {
|
||||
_storage: safari.extension.settings,
|
||||
|
@ -56,10 +56,10 @@ if (self.chrome) {
|
||||
vAPI.chrome = true;
|
||||
vAPI.messaging = {
|
||||
port: null,
|
||||
channels: {},
|
||||
listeners: {},
|
||||
requestId: 0,
|
||||
connectorId: uniqueId(),
|
||||
listeners: {},
|
||||
channels: {},
|
||||
connector: messagingConnector,
|
||||
setup: function() {
|
||||
this.port = chrome.runtime.connect({name: this.connectorId});
|
||||
@ -111,10 +111,10 @@ if (self.chrome) {
|
||||
// relevant?
|
||||
// https://developer.apple.com/library/safari/documentation/Tools/Conceptual/SafariExtensionGuide/MessagesandProxies/MessagesandProxies.html#//apple_ref/doc/uid/TP40009977-CH14-SW12
|
||||
vAPI.messaging = {
|
||||
connectorId: uniqueId(),
|
||||
requestId: 0,
|
||||
listeners: {},
|
||||
channels: {},
|
||||
listeners: {},
|
||||
requestId: 0,
|
||||
connectorId: uniqueId(),
|
||||
connector: messagingConnector,
|
||||
setup: function() {
|
||||
this._connector = function(msg) {
|
||||
|
@ -5,7 +5,7 @@ import re
|
||||
import json
|
||||
from time import strftime
|
||||
from datetime import datetime
|
||||
from shutil import rmtree as rmt
|
||||
from shutil import rmtree as rmt, copy
|
||||
from collections import OrderedDict
|
||||
from xml.sax.saxutils import escape
|
||||
|
||||
@ -99,11 +99,13 @@ with open(pj(src_dir, vendors['crx']['manifest']), 'wt', encoding='utf-8', newli
|
||||
)
|
||||
|
||||
|
||||
with open(pj(src_dir, vendors['safariextz']['manifest']), 'wt', encoding='utf-8', newline='\n') as f:
|
||||
with open(pj(src_dir, vendors['safariextz']['manifest']['Info']), 'wt', encoding='utf-8', newline='\n') as f:
|
||||
config['app_id'] = vendors['safariextz']['app_id']
|
||||
config['description'] = descriptions[config['def_lang']]
|
||||
|
||||
with open(pj(meta_dir, 'safariextz', vendors['safariextz']['manifest']), 'r') as cf:
|
||||
with open(pj(meta_dir, 'safariextz', vendors['safariextz']['manifest']['Info']), 'r') as cf:
|
||||
cf_content = cf.read()
|
||||
|
||||
f.write(cf_content.format(**config))
|
||||
|
||||
copy(pj(meta_dir, 'safariextz', vendors['safariextz']['manifest']['Settings']), pj(src_dir, vendors['safariextz']['manifest']['Settings']))
|
||||
|
Loading…
Reference in New Issue
Block a user