diff options
| author | Stephen Blott | 2014-09-05 10:59:20 +0100 |
|---|---|---|
| committer | Stephen Blott | 2014-09-06 12:28:40 +0100 |
| commit | 643e49aa3109b9a25b38ce5d6b59bb11bc6337b1 (patch) | |
| tree | fcbfa9c0fe1a2a9e598ff9735301c8eb6c2913ae /lib | |
| parent | 2f27d4590ba30f5a443aedff12d9611a83a4f771 (diff) | |
| download | vimium-643e49aa3109b9a25b38ce5d6b59bb11bc6337b1.tar.bz2 | |
Structured passkeys; changes following code review; major rewrite of options.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/exclusion_rule.coffee | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/lib/exclusion_rule.coffee b/lib/exclusion_rule.coffee deleted file mode 100644 index 0942e7cf..00000000 --- a/lib/exclusion_rule.coffee +++ /dev/null @@ -1,46 +0,0 @@ -root = exports ? window - -# Operations to build the DOM on the options page for a single exclusion rule. - -root.ExclusionRule = - - # Build a DOM table row (a "tr") for this rule. - buildRuleElement: (rule,enableSaveButton) -> - pattern = @buildInput(enableSaveButton,rule.pattern,"URL pattern","pattern") - passKeys = @buildInput(enableSaveButton,rule.passKeys,"Excluded keys","passKeys") - row = document.createElement("tr") - row.className = "exclusionRow" - remove = document.createElement("input") - remove.type = "button" - remove.value = "\u2716" # A cross. - remove.className = "exclusionRemoveButton" - remove.addEventListener "click", -> - row.parentNode.removeChild(row) - enableSaveButton() - row.appendChild(pattern) - row.appendChild(passKeys) - row.appendChild(remove) - # NOTE: Since the order of exclusions matters, it would be nice to have "Move Up" and "Move Down" buttons, - # too. But this option is pretty cluttered already. - row - - # Build DOM (a "td" containing an "input") for a single input element. - buildInput: (enableSaveButton,value,placeholder,cls) -> - input = document.createElement("input") - input.setAttribute("placeholder",placeholder) - input.type = "text" - input.value = value - input.className = cls - input.addEventListener "keyup", enableSaveButton, false - input.addEventListener "change", enableSaveButton, false - container = document.createElement("td") - container.appendChild(input) - container - - # Build a new exclusion rule from the given element. This is the reverse of the two methods above. - extractRule: (element) -> - patternElement = element.firstChild - passKeysElement = patternElement.nextSibling - pattern = patternElement.firstChild.value.trim() - passKeys = passKeysElement.firstChild.value.trim() - if pattern then { pattern: pattern, passKeys: passKeys } else null |
