Skip to content

Commit 191d5b8

Browse files
committed
Added chrome store detection and warning
1 parent 5965ebc commit 191d5b8

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

src/Log.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Log {
2-
var LOG_LEVEL: LogLevel = LogLevel.Error;
2+
var LOG_LEVEL: LogLevel = LogLevel.Info;
33
export enum LogLevel {
44
Error, Warning, Info, Debug
55
}

src/popup/popup.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@
7171
cursor: default;
7272
top:0px;
7373
}
74+
75+
#chrome-store-warning {
76+
color: red;
77+
display: none;
78+
}
7479
</style>
7580
</head>
7681
<body>
@@ -81,6 +86,8 @@
8186
<button class="button" id="next">Next</button>
8287
<br>
8388
Case Insensitive <input type="checkbox" id="case-insensitive">
89+
90+
<p id="chrome-store-warning">It looks like you're trying to use this extension on the Chrome store, but Google doesn't allow this. See <a target="_blank" href="https://stackoverflow.com/questions/11613371/chrome-extension-content-script-on-https-chrome-google-com-webstore">this link</a> for more details. If you believe you've received this message in error, please contact the developer.</p>
8491
</div>
8592
<script src="popup.js"></script>
8693
</div>

src/popup/popup.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ module Popup {
99
var queryInput = <HTMLInputElement> document.getElementById("query");
1010
var caseInsensitiveCheckbox = <HTMLInputElement> document.getElementById("case-insensitive");
1111

12+
var chromeStoreURL = "https://chrome.google.com/webstore/";
13+
1214
Utils.withActiveTab(function(tab: chrome.tabs.Tab) {
1315
var id = tab.id;
1416
var tabStates = BackgroundInterface.getTabStateManager();
@@ -27,6 +29,11 @@ module Popup {
2729

2830
setNextButtonState();
2931
setPrevButtonState(id, tabStates);
32+
33+
if (tab.url.indexOf(chromeStoreURL) == 0) {
34+
Log.info("Chrome store detected");
35+
document.getElementById("chrome-store-warning").style.display = "block";
36+
}
3037
});
3138

3239
function setNextButtonState() {

0 commit comments

Comments
 (0)