In Chrome 61.0.3161+ NTP can't be styled anymore
This commit is contained in:
parent
b37b2c5246
commit
3b49d83616
|
@ -576,10 +576,6 @@
|
||||||
"message": "Разширението не работи на такива страници.",
|
"message": "Разширението не работи на такива страници.",
|
||||||
"description": "Note in the toolbar pop-up when on a URL Stylus can't affect"
|
"description": "Note in the toolbar pop-up when on a URL Stylus can't affect"
|
||||||
},
|
},
|
||||||
"stylusUnavailableForURLdetails": {
|
|
||||||
"message": "Като предпазна мярка, четецът забранява на разширенията да влияят на вградените страници (например chrome://version или about:addons), както и на страниците на други разширения. Достъпът до магазина с добавки също е ограничен.",
|
|
||||||
"description": "Sub-note in the toolbar pop-up when on a URL Stylus can't affect"
|
|
||||||
},
|
|
||||||
"toggleStyle": {
|
"toggleStyle": {
|
||||||
"message": "Превключване на стила",
|
"message": "Превключване на стила",
|
||||||
"description": "Label for the checkbox to enable/disable a style"
|
"description": "Label for the checkbox to enable/disable a style"
|
||||||
|
|
|
@ -568,10 +568,6 @@
|
||||||
"message": "Automatické dokončování během psaní",
|
"message": "Automatické dokončování během psaní",
|
||||||
"description": "Label for the checkbox in the style editor."
|
"description": "Label for the checkbox in the style editor."
|
||||||
},
|
},
|
||||||
"stylusUnavailableForURLdetails": {
|
|
||||||
"message": "Jako bezpečností opatření, prohlížeč brání rozšířením v ovlivnění vestavěných stránek (např. chrome://version nebo about:addons) a stránek dalších rozšíření. Každý prohlížeč také omezuje přístup do vlastního obchodu s rozšířeními (např. Chrome Web Store nebo AMO).",
|
|
||||||
"description": "Sub-note in the toolbar pop-up when on a URL Stylus can't affect"
|
|
||||||
},
|
|
||||||
"cm_matchHighlightSelection": {
|
"cm_matchHighlightSelection": {
|
||||||
"message": "Pouze výběr",
|
"message": "Pouze výběr",
|
||||||
"description": "Style editor's 'highglight' drop-down list option: highlight the occurrences of currently selected text"
|
"description": "Style editor's 'highglight' drop-down list option: highlight the occurrences of currently selected text"
|
||||||
|
|
|
@ -548,10 +548,6 @@
|
||||||
"message": "Autovervollständigen bei Eingabe",
|
"message": "Autovervollständigen bei Eingabe",
|
||||||
"description": "Label for the checkbox in the style editor."
|
"description": "Label for the checkbox in the style editor."
|
||||||
},
|
},
|
||||||
"stylusUnavailableForURLdetails": {
|
|
||||||
"message": "Der Browser verbietet als Sicherheitsvorkehrung den Zugriff der Erweiterung auf interne Seiten (wie z.B. chrome://version oder about:addons) sowie andere Erweiterungsseiten. Jeder Browser begrenzt den Zugriff auf eigene Erweiterungs-Galerien (wie z.B. den Chrome Web Store oder addons.mozilla.org).",
|
|
||||||
"description": "Sub-note in the toolbar pop-up when on a URL Stylus can't affect"
|
|
||||||
},
|
|
||||||
"cm_matchHighlightSelection": {
|
"cm_matchHighlightSelection": {
|
||||||
"message": "Nur die Auswahl",
|
"message": "Nur die Auswahl",
|
||||||
"description": "Style editor's 'highglight' drop-down list option: highlight the occurrences of currently selected text"
|
"description": "Style editor's 'highglight' drop-down list option: highlight the occurrences of currently selected text"
|
||||||
|
|
|
@ -577,7 +577,7 @@
|
||||||
"description": "Note in the toolbar pop-up when on a URL Stylus can't affect"
|
"description": "Note in the toolbar pop-up when on a URL Stylus can't affect"
|
||||||
},
|
},
|
||||||
"stylusUnavailableForURLdetails": {
|
"stylusUnavailableForURLdetails": {
|
||||||
"message": "As a security precaution, the browser prohibits extensions from affecting its built-in pages (like chrome://version or about:addons) as well as other extensions' pages. Each browser also restricts access to its own extensions gallery (like Chrome Web Store or AMO).",
|
"message": "As a security precaution, the browser prohibits extensions from affecting its built-in pages (like chrome://version, the standard new tab page as of Chrome 61, about:addons, and so on) as well as other extensions' pages. Each browser also restricts access to its own extensions gallery (like Chrome Web Store or AMO).",
|
||||||
"description": "Sub-note in the toolbar pop-up when on a URL Stylus can't affect"
|
"description": "Sub-note in the toolbar pop-up when on a URL Stylus can't affect"
|
||||||
},
|
},
|
||||||
"toggleStyle": {
|
"toggleStyle": {
|
||||||
|
|
|
@ -572,10 +572,6 @@
|
||||||
"message": "Autocompletar al escribir",
|
"message": "Autocompletar al escribir",
|
||||||
"description": "Label for the checkbox in the style editor."
|
"description": "Label for the checkbox in the style editor."
|
||||||
},
|
},
|
||||||
"stylusUnavailableForURLdetails": {
|
|
||||||
"message": "Como medida de precaución, el navegador prohíbe que las extensiones afecten a sus páginas internas (como chrome://version o about:addons) además de las páginas internas de otras extensiones. Cada navegador además restringe el acceso a su propia galería de extensiones (como Chrome Web Store o AMO).",
|
|
||||||
"description": "Sub-note in the toolbar pop-up when on a URL Stylus can't affect"
|
|
||||||
},
|
|
||||||
"cm_matchHighlightSelection": {
|
"cm_matchHighlightSelection": {
|
||||||
"message": "Sólo selección",
|
"message": "Sólo selección",
|
||||||
"description": "Style editor's 'highglight' drop-down list option: highlight the occurrences of currently selected text"
|
"description": "Style editor's 'highglight' drop-down list option: highlight the occurrences of currently selected text"
|
||||||
|
|
|
@ -468,10 +468,6 @@
|
||||||
"message": "削除",
|
"message": "削除",
|
||||||
"description": "Label for the context menu item in the editor to delete selected text"
|
"description": "Label for the context menu item in the editor to delete selected text"
|
||||||
},
|
},
|
||||||
"stylusUnavailableForURLdetails": {
|
|
||||||
"message": "セキュリティ上の予防措置として、ブラウザは拡張機能が他の拡張機能のページと同様に、内蔵のページ(chrome://versionやabout:addonsなど)に影響を及ぼさないようにします。各ブラウザは、独自の拡張機能ギャラリー(ChromeウェブストアやAMOなど)へのアクセスも制限しています。",
|
|
||||||
"description": "Sub-note in the toolbar pop-up when on a URL Stylus can't affect"
|
|
||||||
},
|
|
||||||
"cm_matchHighlightSelection": {
|
"cm_matchHighlightSelection": {
|
||||||
"message": "選択した単語のみ",
|
"message": "選択した単語のみ",
|
||||||
"description": "Style editor's 'highglight' drop-down list option: highlight the occurrences of currently selected text"
|
"description": "Style editor's 'highglight' drop-down list option: highlight the occurrences of currently selected text"
|
||||||
|
|
|
@ -572,10 +572,6 @@
|
||||||
"message": "Подсказки при наборе кода",
|
"message": "Подсказки при наборе кода",
|
||||||
"description": "Label for the checkbox in the style editor."
|
"description": "Label for the checkbox in the style editor."
|
||||||
},
|
},
|
||||||
"stylusUnavailableForURLdetails": {
|
|
||||||
"message": "В целях обеспечения безопасности браузер запрещает расширениям изменять встроенные страницы (например, chrome://version, about:addons), страницы других расширений и \"магазин\" расширений (Chrome Web Store в chromium-браузерах, AMO в Firefox и т.д.)",
|
|
||||||
"description": "Sub-note in the toolbar pop-up when on a URL Stylus can't affect"
|
|
||||||
},
|
|
||||||
"cm_matchHighlightSelection": {
|
"cm_matchHighlightSelection": {
|
||||||
"message": "Выделенный текст",
|
"message": "Выделенный текст",
|
||||||
"description": "Style editor's 'highglight' drop-down list option: highlight the occurrences of currently selected text"
|
"description": "Style editor's 'highglight' drop-down list option: highlight the occurrences of currently selected text"
|
||||||
|
|
|
@ -572,10 +572,6 @@
|
||||||
"message": "输入时自动完成",
|
"message": "输入时自动完成",
|
||||||
"description": "Label for the checkbox in the style editor."
|
"description": "Label for the checkbox in the style editor."
|
||||||
},
|
},
|
||||||
"stylusUnavailableForURLdetails": {
|
|
||||||
"message": "出于安全原因,浏览器禁止扩展影响内置页面(例如 chrome://version 或 about:addons)以及其他扩展的页面。各浏览器同时也限制介入自己的扩展网站(如 Chrome 网上应用店、Firefox 附加组件)。",
|
|
||||||
"description": "Sub-note in the toolbar pop-up when on a URL Stylus can't affect"
|
|
||||||
},
|
|
||||||
"cm_matchHighlightSelection": {
|
"cm_matchHighlightSelection": {
|
||||||
"message": "选择区域",
|
"message": "选择区域",
|
||||||
"description": "Style editor's 'highglight' drop-down list option: highlight the occurrences of currently selected text"
|
"description": "Style editor's 'highglight' drop-down list option: highlight the occurrences of currently selected text"
|
||||||
|
|
|
@ -572,10 +572,6 @@
|
||||||
"message": "在輸入時自動完成",
|
"message": "在輸入時自動完成",
|
||||||
"description": "Label for the checkbox in the style editor."
|
"description": "Label for the checkbox in the style editor."
|
||||||
},
|
},
|
||||||
"stylusUnavailableForURLdetails": {
|
|
||||||
"message": "做為安全措施,瀏覽器禁止擴充功能影響其內建頁面(像是 chrome://version 或是 about:addons)與其他擴充功能頁面。每個瀏覽器都會限制只能在其擴充功能商店上安裝擴充功能(如 Chrome 線上應用程式商店或 AMO)。",
|
|
||||||
"description": "Sub-note in the toolbar pop-up when on a URL Stylus can't affect"
|
|
||||||
},
|
|
||||||
"cm_matchHighlightSelection": {
|
"cm_matchHighlightSelection": {
|
||||||
"message": "僅段",
|
"message": "僅段",
|
||||||
"description": "Style editor's 'highglight' drop-down list option: highlight the occurrences of currently selected text"
|
"description": "Style editor's 'highglight' drop-down list option: highlight the occurrences of currently selected text"
|
||||||
|
|
|
@ -129,9 +129,12 @@ function filterStyles({
|
||||||
exposeIframes: prefs.get('exposeIframes'),
|
exposeIframes: prefs.get('exposeIframes'),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (matchUrl && matchUrl.startsWith(URLS.chromeWebStore)) {
|
if (matchUrl && (
|
||||||
// CWS cannot be scripted in chromium, see ChromeExtensionsClient::IsScriptableURL
|
// Web Store doesn't run content scripts
|
||||||
// https://cs.chromium.org/chromium/src/chrome/common/extensions/chrome_extensions_client.cc
|
matchUrl.startsWith(URLS.browserWebStore) ||
|
||||||
|
// Chrome 61.0.3161+ doesn't run content scripts on NTP
|
||||||
|
URLS.chromeProtectsNTP && matchUrl.startsWith('chrome://newtab/')
|
||||||
|
)) {
|
||||||
return asHash ? {} : [];
|
return asHash ? {} : [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,18 +21,30 @@ const URLS = {
|
||||||
|
|
||||||
// CWS cannot be scripted in chromium, see ChromeExtensionsClient::IsScriptableURL
|
// CWS cannot be scripted in chromium, see ChromeExtensionsClient::IsScriptableURL
|
||||||
// https://cs.chromium.org/chromium/src/chrome/common/extensions/chrome_extensions_client.cc
|
// https://cs.chromium.org/chromium/src/chrome/common/extensions/chrome_extensions_client.cc
|
||||||
chromeWebStore: FIREFOX ? 'https://addons.mozilla.org/' : (
|
browserWebStore:
|
||||||
OPERA ? 'https://addons.opera.com/' : 'https://chrome.google.com/webstore/'
|
FIREFOX ? 'https://addons.mozilla.org/' :
|
||||||
),
|
OPERA ? 'https://addons.opera.com/' :
|
||||||
|
'https://chrome.google.com/webstore/',
|
||||||
|
|
||||||
supported: new RegExp(
|
// Chrome 61.0.3161+ doesn't run content scripts on NTP https://crrev.com/2978953002/
|
||||||
'^(file|ftps?|http)://|' +
|
// TODO: remove when "minimum_chrome_version": "61" or higher
|
||||||
`^https://${FIREFOX ? '(?!addons\\.mozilla\\.org)' : (
|
chromeProtectsNTP:
|
||||||
OPERA ? '(?!addons\\.opera\\.com)' : '(?!chrome\\.google\\.com/webstore)'
|
parseInt(navigator.userAgent.match(/Chrom\w+\/(?:\d+\.){2}(\d+)|$/)[1]) >= 3161,
|
||||||
)}|` +
|
|
||||||
'^' + chrome.runtime.getURL('')),
|
supported: null,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
URLS.supported = new RegExp(
|
||||||
|
'^(file|ftps?|http)://|' +
|
||||||
|
`^https://(?!${
|
||||||
|
URLS.browserWebStore.split('://')[1].replace(/\./g, '\\.')
|
||||||
|
})|` +
|
||||||
|
(URLS.chromeProtectsNTP
|
||||||
|
? '^chrome://(?!newtab)/|'
|
||||||
|
: '') +
|
||||||
|
'^' + chrome.runtime.getURL('')
|
||||||
|
);
|
||||||
|
|
||||||
let BG = chrome.extension.getBackgroundPage();
|
let BG = chrome.extension.getBackgroundPage();
|
||||||
|
|
||||||
if (!BG || BG !== window) {
|
if (!BG || BG !== window) {
|
||||||
|
@ -134,7 +146,7 @@ function getActiveTabRealURL() {
|
||||||
|
|
||||||
function getTabRealURL(tab) {
|
function getTabRealURL(tab) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
if (tab.url !== 'chrome://newtab/') {
|
if (tab.url !== 'chrome://newtab/' || URLS.chromeProtectsNTP) {
|
||||||
resolve(tab.url);
|
resolve(tab.url);
|
||||||
} else {
|
} else {
|
||||||
chrome.webNavigation.getFrame({tabId: tab.id, frameId: 0, processId: -1}, frame => {
|
chrome.webNavigation.getFrame({tabId: tab.id, frameId: 0, processId: -1}, frame => {
|
||||||
|
@ -191,7 +203,7 @@ function activateTab(tab) {
|
||||||
|
|
||||||
|
|
||||||
function stringAsRegExp(s, flags) {
|
function stringAsRegExp(s, flags) {
|
||||||
return new RegExp(s.replace(/[{}()[\]/\\.+?^$:=*!|]/g, '\\$&'), flags);
|
return new RegExp(s.replace(/[{}()[\]\\.+*?^$|]/g, '\\$&'), flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user