diff options
| author | Stephen Blott | 2014-12-21 12:47:47 +0000 | 
|---|---|---|
| committer | Stephen Blott | 2014-12-21 12:47:47 +0000 | 
| commit | a10945c770dc6c587f6130d45de29e2c98667b8f (patch) | |
| tree | fe56b37b32ad9e9f7a404ebdadc879e90a33aaa8 /pages | |
| parent | 020f587a9bece9453833eaa2f742e4123490d600 (diff) | |
| download | vimium-a10945c770dc6c587f6130d45de29e2c98667b8f.tar.bz2 | |
Exclusion; unique keys; update state on add/remove rule.
Diffstat (limited to 'pages')
| -rw-r--r-- | pages/options.coffee | 29 | ||||
| -rw-r--r-- | pages/popup.html | 3 | 
2 files changed, 17 insertions, 15 deletions
diff --git a/pages/options.coffee b/pages/options.coffee index bad4732b..13d51f72 100644 --- a/pages/options.coffee +++ b/pages/options.coffee @@ -251,13 +251,27 @@ initOptionsPage = ->      new type(name,enableSaveButton)  initPopupPage = -> +  exclusions = null    chrome.tabs.getSelected null, (tab) ->      document.getElementById("optionsLink").setAttribute "href", chrome.runtime.getURL("pages/options.html") +    updateState = -> +      rules = exclusions.readValueFromElement() +      isEnabled = bgExclusions.getRule tab.url, rules +      console.log isEnabled +      $("state").innerHTML = +        if isEnabled and isEnabled.passKeys +          "Excluded: #{isEnabled.passKeys}" +        else if isEnabled +          "Disabled" +        else +          "Enabled" +      onUpdated = ->        $("helpText").innerHTML = "Type <strong>Ctrl-Enter</strong> to save and close."        $("saveOptions").removeAttribute "disabled"        $("saveOptions").innerHTML = "Save Changes" +      updateState() if exclusions      saveOptions = ->        Option.saveOptions() @@ -277,21 +291,8 @@ initPopupPage = ->      # Populate options. Just one, here.      exclusions = new ExclusionRulesOption("exclusionRules", onUpdated, tab.url) -    updateState = -> -      rules = exclusions.readValueFromElement() -      isEnabled = bgExclusions.getRule tab.url, rules -      console.log isEnabled -      $("state").innerHTML = -        if isEnabled and isEnabled.passKeys -          "Excluded: #{isEnabled.passKeys}" -        else if isEnabled -          "Disabled" -        else -          "Enabled" -      updateState() -    for event in ["keyup", "DOMNodeInserted", "DOMNodeRemoved"] -      document.addEventListener event, updateState +    document.addEventListener "keyup", updateState  #  # Initialization. diff --git a/pages/popup.html b/pages/popup.html index 370751ff..dcf123a9 100644 --- a/pages/popup.html +++ b/pages/popup.html @@ -44,6 +44,7 @@    </head>    <body>      <!-- Copied (almost) directly from options.html - start --> +    <!-- The only difference is the column headers. -->      <div id="exclusionScrollBox">         <table id="exclusionRules">            <tr> @@ -74,7 +75,7 @@                <br/>                <span id="helpText">These are the matching rules for this page.</span>                <br/> -              <span> <a id="optionsLink" target="_blank">Options</a></span> +              <a id="optionsLink" target="_blank">Options</a>              </td>              <td valign="top">                <button id="exclusionAddButton">Add Rule</button>  | 
