aboutsummaryrefslogtreecommitdiffstats
path: root/pages
diff options
context:
space:
mode:
authorStephen Blott2014-12-21 16:07:29 +0000
committerStephen Blott2014-12-21 16:07:29 +0000
commit6f755c4cf456be3671936bd195bf56cf02f3e75f (patch)
tree510266fd8f90f61a46d82ec119f24652037a5e25 /pages
parent3aeb8517d0dd5f9a530e99db662a4945132cf436 (diff)
downloadvimium-6f755c4cf456be3671936bd195bf56cf02f3e75f.tar.bz2
Exclusion; move exclusion HTML to separate, shared page.
Diffstat (limited to 'pages')
-rw-r--r--pages/exclusions.html14
-rw-r--r--pages/options.coffee13
-rw-r--r--pages/options.html17
-rw-r--r--pages/popup.html18
4 files changed, 26 insertions, 36 deletions
diff --git a/pages/exclusions.html b/pages/exclusions.html
new file mode 100644
index 00000000..0a9e715b
--- /dev/null
+++ b/pages/exclusions.html
@@ -0,0 +1,14 @@
+<table id="exclusionRules">
+ <tr>
+ <td><span class="exclusionHeaderText">Patterns</span></td>
+ <td><span class="exclusionHeaderText">Keys</span></td>
+ </tr>
+</table>
+<template id="exclusionRuleTemplate">
+ <tr class="exclusionRuleTemplateInstance">
+ <td><input/ type="text" class="pattern" placeholder="URL pattern"></td>
+ <td class="exclusionRulePassKeys"><input/ type="text" class="passKeys" placeholder="Exclude keys"></td>
+ <td class="exclusionRemoveButton">
+ <input/ type="button" class="exclusionRemoveButtonButton" value="&#x2716;"></td>
+ </tr>
+</template>
diff --git a/pages/options.coffee b/pages/options.coffee
index def67fd7..abbf52c6 100644
--- a/pages/options.coffee
+++ b/pages/options.coffee
@@ -294,7 +294,14 @@ initPopupPage = ->
#
# Initialization.
document.addEventListener "DOMContentLoaded", ->
- switch location.pathname
- when "/pages/options.html" then initOptionsPage()
- when "/pages/popup.html" then initPopupPage()
+ xhr = new XMLHttpRequest()
+ xhr.open 'GET', chrome.extension.getURL('pages/exclusions.html'), true
+ xhr.onreadystatechange = ->
+ if xhr.readyState == 4
+ $("exclusionScrollBox").innerHTML = xhr.responseText
+ switch location.pathname
+ when "/pages/options.html" then initOptionsPage()
+ when "/pages/popup.html" then initPopupPage()
+
+ xhr.send()
diff --git a/pages/options.html b/pages/options.html
index 9a0368a3..e54d1c2f 100644
--- a/pages/options.html
+++ b/pages/options.html
@@ -23,23 +23,8 @@
</div>
</div>
<div>
- <!-- Warning: There is an almost exact copy of exclusionScrollBox in popup.html. Changes here
- may have to propagated to there too. -->
<div id="exclusionScrollBox">
- <table id="exclusionRules">
- <tr>
- <td><span class="exclusionHeaderText">Patterns</span></td>
- <td><span class="exclusionHeaderText">Keys</span></td>
- </tr>
- </table>
- <template id="exclusionRuleTemplate">
- <tr class="exclusionRuleTemplateInstance">
- <td><input/ type="text" class="pattern" placeholder="URL pattern"></td>
- <td class="exclusionRulePassKeys"><input/ type="text" class="passKeys" placeholder="Exclude keys"></td>
- <td class="exclusionRemoveButton">
- <input/ type="button" class="exclusionRemoveButtonButton" value="&#x2716;"></td>
- </tr>
- </template>
+ <!-- Populated by options.coffee. -->
</div>
<button id="exclusionAddButton">Add Rule</button>
</div>
diff --git a/pages/popup.html b/pages/popup.html
index b89e2f07..4f36cbfe 100644
--- a/pages/popup.html
+++ b/pages/popup.html
@@ -53,25 +53,9 @@
<body>
<div id="state"></div>
- <!-- Copied (almost) directly from options.html - start -->
- <!-- The only difference is the column headers. -->
<div id="exclusionScrollBox">
- <table id="exclusionRules">
- <tr>
- <td><span class="exclusionHeaderText">URL Patterns</span></td>
- <td><span class="exclusionHeaderText">Excluded Keys</span></td>
- </tr>
- </table>
- <template id="exclusionRuleTemplate">
- <tr class="exclusionRuleTemplateInstance">
- <td><input/ type="text" class="pattern" placeholder="URL pattern"></td>
- <td class="exclusionRulePassKeys"><input/ type="text" class="passKeys" placeholder="Excluded keys"></td>
- <td class="exclusionRemoveButton">
- <input/ type="button" class="exclusionRemoveButtonButton" value="&#x2716;"></td>
- </tr>
- </template>
+ <!-- Populated by options.coffee. -->
</div>
- <!-- Copied (almost) directly from options.html - end -->
<!-- Some extra space which is hidden underneath the footer. -->
<div id="endSpace"/>