Skip to content

Commit fc7a4ca

Browse files
committed
Remove domain filter
1 parent 91cb6ec commit fc7a4ca

File tree

4 files changed

+22
-123
lines changed

4 files changed

+22
-123
lines changed

source/background.js

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab)
88
}
99

1010
// Prep some variables
11-
var sites = [],
12-
ideKey = "XDEBUG_ECLIPSE",
11+
var ideKey = "XDEBUG_ECLIPSE",
1312
match = true,
1413
traceTrigger = ideKey,
1514
profileTrigger = ideKey,
@@ -18,11 +17,6 @@ chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab)
1817
// Check if localStorage is available and get the settings out of it
1918
if (localStorage)
2019
{
21-
if (localStorage["sites"])
22-
{
23-
sites = JSON.parse(localStorage["sites"]);
24-
}
25-
2620
if (localStorage["xdebugIdeKey"])
2721
{
2822
ideKey = localStorage["xdebugIdeKey"];
@@ -39,32 +33,24 @@ chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab)
3933
}
4034
}
4135

42-
// Get the current domain out of the tab URL and check if it matches anything in the sites array
43-
domain = tab.url.match(/:\/\/(.[^\/]*)/)[1];
44-
match = isValueInArray(sites, domain);
45-
46-
// Check if we have a match or don't need to match at all
47-
if ( (domain != null && match) || sites.length === 0)
48-
{
49-
// Request the current status and update the icon accordingly
50-
chrome.tabs.sendMessage(
51-
tabId,
52-
{
53-
cmd: "getStatus",
54-
idekey: ideKey,
55-
traceTrigger: traceTrigger,
56-
profileTrigger: profileTrigger
57-
},
58-
function(response)
59-
{
60-
if (chrome.runtime.lastError) {
61-
console.log("Error: ", chrome.runtime.lastError);
62-
} else {
63-
updateIcon(response.status, tabId);
64-
}
36+
// Request the current status and update the icon accordingly
37+
chrome.tabs.sendMessage(
38+
tabId,
39+
{
40+
cmd: "getStatus",
41+
idekey: ideKey,
42+
traceTrigger: traceTrigger,
43+
profileTrigger: profileTrigger
44+
},
45+
function(response)
46+
{
47+
if (chrome.runtime.lastError) {
48+
console.log("Error: ", chrome.runtime.lastError);
49+
} else {
50+
updateIcon(response.status, tabId);
6551
}
66-
);
67-
}
52+
}
53+
);
6854
});
6955

7056
chrome.commands.onCommand.addListener(function(command)

source/options.css

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,6 @@ body {
4343
font-size: 0.95em;
4444
}
4545

46-
button {
47-
float: right;
48-
margin: 5px;
49-
font-size: 1.25em;
50-
color: rgba(27, 54, 23, 0.99);
51-
}
52-
5346
.contentTxt {
5447
margin-bottom: 5px;
5548
}
@@ -64,18 +57,6 @@ button {
6457
height: 16px;
6558
}
6659

67-
#addButton, #removeButton, #saveButton {
68-
vertical-align: middle;
69-
}
70-
71-
#siteBox {
72-
width: 205px;
73-
}
74-
75-
#newSite {
76-
width: 200px;
77-
}
78-
7960
#content, #footer {
8061
width: 400px;
8162
padding: 7px;

source/options.html

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,35 +40,24 @@ <h3>IDE key</h3>
4040
<option value="null">Other</option>
4141
</select>
4242
<span id="customkey"><input type="text" id="idekey" /> </span>
43+
<button class="button" class="save-button">Save</button>
4344
</p>
4445

4546
<h3>Trace Trigger Value</h3>
4647
<p class="note">If your xdebug is configured with a unique trace trigger key,
4748
set that value here. This value is blank by default.</p>
4849
<p>
4950
<input type="text" id="tracetrigger" value="">
51+
<button class="button" class="save-button">Save</button>
5052
</p>
5153

5254
<h3>Profile Trigger Value</h3>
5355
<p class="note">If your xdebug is configured with a unique profile trigger key,
5456
set that value here. This value is blank by default.</p>
5557
<p>
5658
<input type="text" id="profiletrigger" value="">
59+
<button class="button" class="save-button">Save</button>
5760
</p>
58-
59-
<h3>Domain filter</h3>
60-
<p class="note">By default we show the bug icon on all pages, but here you can whitelist domains where the icon should show up. Note that all filters are regular expressions.</p>
61-
<p><input type="text" value="" id="newSite">
62-
<a id='add-site'><img id="addButton" src="images/add.png" alt="Add" title="Add" /></a>
63-
<br/>
64-
<select id="siteBox" multiple size="5"></select>
65-
<a id='remove-site'><img id="removeButton" src="images/delete.png" alt="Remove selected" title="Remove selected" /></a>
66-
</p>
67-
68-
<p>
69-
<button class="button" id="save-options">Save Changes</button>
70-
</p>
71-
<p class="hint"><img class="inlineicon" src="images/lightbulb.png" alt="Tip!" title="Tip!" /> <a href="http://wrepblog.tumblr.com/post/31720573340/xdebug-helper-for-chrome-how-to-use-the-domain-filter" target="_blank">Need help? Read our <span>blogpost</span>!</a></p>
7261
</div>
7362

7463
<div id="footer">

source/options.js

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@ function save_options()
33
localStorage["xdebugIdeKey"] = document.getElementById("idekey").value;
44
localStorage["xdebugTraceTrigger"] = document.getElementById("tracetrigger").value;
55
localStorage["xdebugProfileTrigger"] = document.getElementById("profiletrigger").value;
6-
7-
siteBox = document.getElementById("siteBox");
8-
sites = [];
9-
for (i = 0; i < siteBox.length; i++)
10-
{
11-
sites.push(siteBox.options[i].value);
12-
}
13-
localStorage["sites"] = JSON.stringify(sites);
146
}
157

168
function restore_options()
@@ -49,51 +41,6 @@ function restore_options()
4941
} else {
5042
$("#profiletrigger").val(null);
5143
}
52-
53-
// Restore Sites
54-
sites = localStorage["sites"];
55-
if (sites)
56-
{
57-
sites = JSON.parse(sites);
58-
for(i = 0; i < sites.length; i++)
59-
{
60-
addItem("siteBox", sites[i]);
61-
}
62-
}
63-
}
64-
65-
function addSite()
66-
{
67-
siteText = document.getElementById("newSite").value.trim();
68-
69-
if (siteText.length > 0) {
70-
addItem("siteBox", siteText);
71-
save_options();
72-
document.getElementById("newSite").value = '';
73-
74-
save_options();
75-
}
76-
}
77-
78-
function removeSelectedSite()
79-
{
80-
siteBox = document.getElementById("siteBox");
81-
for (i = siteBox.length-1; i >= 0; i--) {
82-
if (siteBox.options[i].selected)
83-
{
84-
siteBox.remove(i);
85-
}
86-
}
87-
88-
save_options();
89-
}
90-
91-
function addItem(id, value)
92-
{
93-
opt = document.createElement("option");
94-
document.getElementById(id).options.add(opt);
95-
opt.value = value;
96-
opt.text = value;
9744
}
9845

9946
$(function()
@@ -114,12 +61,8 @@ $(function()
11461
});
11562

11663
$("#idekey").change(save_options);
117-
118-
$('#save-options').click(save_options);
119-
120-
$('#add-site').click(addSite);
12164

122-
$('#remove-site').click(removeSelectedSite);
65+
$('.save-button').click(save_options);
12366

12467
restore_options();
12568
});

0 commit comments

Comments
 (0)