Skip to content

Commit

Permalink
Add debug feature: tab claiming (#748)
Browse files Browse the repository at this point in the history
  • Loading branch information
deanoemcke committed Dec 19, 2018
1 parent 3c6729d commit f1f1426
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/_locales/de/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
"html_about_twitter_title": { "message": "Twitter" },
"html_about_report_issues_prefix": { "message": "Wenn du Feedback hast oder einen Fehler melden möchtest, melde das auf der" },
"html_about_report_issues_suffix": { "message": ". Bitte prüfe vorab, ob deine Idee oder dein Fehler schon gemeldet wurde. Danke!" },
"html_about_debugging_prefix": { "message": "Um die Protokollierung zu aktivieren oder Debugging-Flags festzulegen, gehen Sie auf die " },
"html_about_debugging_suffix": { "message": "Debug-Seite." },
"html_about_the_github_issues_page": { "message": "GitHub Projektseite" },
"html_about_html2canvas": { "message": "html2canvas" },
"html_about_html2canvas_prefix": { "message": "Diese Erweiterung nutzt die" },
Expand Down
2 changes: 2 additions & 0 deletions src/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
"html_about_twitter_title": { "message": "Twitter" },
"html_about_report_issues_prefix": { "message": "If you have feedback or would like to report an issue, you can do so on the" },
"html_about_report_issues_suffix": { "message": ". Please check to see if your idea or issue already exists before creating a new one. Thanks!" },
"html_about_debugging_prefix": { "message": "To enable logging, or to set debugging flags, go to the " },
"html_about_debugging_suffix": { "message": "debug page." },
"html_about_the_github_issues_page": { "message": "GitHub issues page" },
"html_about_html2canvas": { "message": "html2canvas" },
"html_about_html2canvas_prefix": { "message": "This extension uses the" },
Expand Down
2 changes: 2 additions & 0 deletions src/_locales/ru/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
"html_about_twitter_title": { "message": "Twitter" },
"html_about_report_issues_prefix": { "message": "Связаться с нами или сообщить о баге можно на" },
"html_about_report_issues_suffix": { "message": ". Пожалуйста. убедитесь что ваша идея или предложение не опубликованы ранее. Спасибо!" },
"html_about_debugging_prefix": { "message": "Чтобы включить ведение журнала или установить флаги отладки, перейдите на " },
"html_about_debugging_suffix": { "message": "страницу отладки." },
"html_about_the_github_issues_page": { "message": "странице предложений GitHub" },
"html_about_html2canvas": { "message": "html2canvas" },
"html_about_html2canvas_prefix": { "message": "Это расширение использует" },
Expand Down
2 changes: 2 additions & 0 deletions src/_locales/zh_CN/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
"html_about_twitter_title": { "message": "Twitter" },
"html_about_report_issues_prefix": { "message": "如果您有反馈意见或想报告问题,可以在" },
"html_about_report_issues_suffix": { "message": ". 在创建新的想法或问题之前,请检查您的想法或问题是否存在。谢谢!" },
"html_about_debugging_prefix": { "message": "要启用日志记录或设置调试标志,请转至" },
"html_about_debugging_suffix": { "message": "调试页面。" },
"html_about_the_github_issues_page": { "message": "GitHub上进行" },
"html_about_html2canvas": { "message": "html2canvas" },
"html_about_html2canvas_prefix": { "message": "这个扩充元件使用 Niklas von Hertzen 撰写的" },
Expand Down
2 changes: 2 additions & 0 deletions src/_locales/zh_TW/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
"html_about_twitter_title": { "message": "Twitter" },
"html_about_report_issues_prefix": { "message": "如果您有建議或想回報問題,可以在" },
"html_about_report_issues_suffix": { "message": ". 在建立新的想法或問題之前,請檢查您的想法或問題是否存在。謝謝!" },
"html_about_debugging_prefix": { "message": "要啟用日誌記錄或設置調試標誌,請轉至" },
"html_about_debugging_suffix": { "message": "調試頁面。" },
"html_about_the_github_issues_page": { "message": "GitHub 上進行" },
"html_about_html2canvas": { "message": "html2canvas" },
"html_about_html2canvas_prefix": { "message": "這個擴充功能使用 Niklas von Hertzen 撰寫的" },
Expand Down
5 changes: 5 additions & 0 deletions src/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ <h1 data-i18n="__MSG_ext_extension_name__"></h1>
<span data-i18n="__MSG_html_about_report_issues_suffix__"></span>
</p>

<p>
<span data-i18n="__MSG_html_about_debugging_prefix__ "></span>
<a href="debug.html" target="_blank" data-i18n="__MSG_html_about_debugging_suffix__"></a>
</p>

<hr />
<div id='thankyous'>
<p>
Expand Down
3 changes: 2 additions & 1 deletion src/debug.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
<span>useAlternateScreenCaptureLib: </span>
<a id='toggleUseAlternateScreenCaptureLib' href='#'></a> &nbsp;|&nbsp;
<span>disableTabChecks: </span>
<a id='toggleDisableTabChecks' href='#'></a>
<a id='toggleDisableTabChecks' href='#'></a> &nbsp;|&nbsp;
<a id='claimSuspendedTabs' href='#'>claim all suspended tabs</a>
</div>
<br />
<div>
Expand Down
9 changes: 9 additions & 0 deletions src/js/debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@
gsStorage.setOptionAndSync(gsStorage.DISABLE_TAB_CHECKS, newVal);
}
);
document.getElementById('claimSuspendedTabs').onclick = async function(e) {
const tabs = await gsChrome.tabsQuery();
for (const tab of tabs) {
if (gsUtils.isSuspendedTab(tab, true) && tab.url.indexOf(chrome.runtime.id) < 0) {
const newUrl = tab.url.replace(gsUtils.getRootUrl(tab.url), chrome.runtime.id);
await gsChrome.tabsUpdate(tab.id, { url: newUrl});
}
}
};

var extensionsUrl = `chrome://extensions/?id=${chrome.runtime.id}`;
document
Expand Down

0 comments on commit f1f1426

Please sign in to comment.