diff options
| -rw-r--r-- | lib/utils.coffee | 2 | ||||
| -rw-r--r-- | pages/options.coffee | 23 | ||||
| -rw-r--r-- | pages/popup.html | 26 | 
3 files changed, 26 insertions, 25 deletions
| diff --git a/lib/utils.coffee b/lib/utils.coffee index 8ee948b0..81b0fb49 100644 --- a/lib/utils.coffee +++ b/lib/utils.coffee @@ -26,7 +26,7 @@ Utils =      -> id += 1    hasChromePrefix: do -> -    chromePrefixes = [ "about:", "view-source:", "extension:", "chrome://", "chrome-extension:", "data:" ] +    chromePrefixes = [ "about:", "view-source:", "extension:", "chrome-extension:", "data:" ]      (url) ->        if 0 < url.indexOf ":"          for prefix in chromePrefixes diff --git a/pages/options.coffee b/pages/options.coffee index eefac48b..249677be 100644 --- a/pages/options.coffee +++ b/pages/options.coffee @@ -254,23 +254,17 @@ initOptionsPage = ->  initPopupPage = ->    chrome.tabs.getSelected null, (tab) ->      exclusions = null -    console.log tab.url -    hasChromePrefix = bgUtils.hasChromePrefix tab.url      document.getElementById("optionsLink").setAttribute "href", chrome.runtime.getURL("pages/options.html")      updateState = -> -      rules = exclusions.readValueFromElement() -      isEnabled = bgExclusions.getRule tab.url, rules -      console.log hasChromePrefix -      $("state").innerHTML = -        if hasChromePrefix -          "Vimium cannot run on this page." -        else if isEnabled and isEnabled.passKeys -          "Excluded: <strong class='code'>#{isEnabled.passKeys}</strong>" -        else if isEnabled -          "Disabled" +      rule = bgExclusions.getRule tab.url, exclusions.readValueFromElement() +      $("state").innerHTML = "Vimium will " + +        if rule and rule.passKeys +          "exclude <span class='code'>#{rule.passKeys}</span>" +        else if rule +          "be disabled"          else -          "Enabled" +          "be enabled"      onUpdated = ->        $("helpText").innerHTML = "Type <strong>Ctrl-Enter</strong> to save and close." @@ -280,8 +274,7 @@ initPopupPage = ->      saveOptions = ->        Option.saveOptions() -      $("helpText").innerHTML = "Rules saved." -      $("saveOptions").innerHTML = "No Changes" +      $("saveOptions").innerHTML = "Saved"        $("saveOptions").disabled = true        chrome.tabs.query { windowId: chrome.windows.WINDOW_ID_CURRENT, active: true }, (tabs) ->          chrome.extension.getBackgroundPage().updateActiveState(tabs[0].id) diff --git a/pages/popup.html b/pages/popup.html index dcf123a9..53a75495 100644 --- a/pages/popup.html +++ b/pages/popup.html @@ -12,18 +12,26 @@          font-size: 12px;        } -      #helpText, #stateLine { color: #979ca0; } +      #helpText, #stateLine, #state { color: #979ca0; }        #exclusionAddButton { width: 80px; }        #saveOptions { -        margin-top: 5px; /* Match exclusionAddButton */ +        margin-top: 5px; /* Match #exclusionAddButton */          margin-left: 5px;          float: right;        } +      #state { +        padding-left: 5px; +        background: #f5f5f5; +        width: 100%; +        border-bottom: 1px solid #979ca0; +        margin: 0px; +      } +        /* These are overridden from options.css. */ -      #endSpace, #footerWrapper { width: 450px; } +      #endSpace, #footerWrapper { width: 500px; }        #footerWrapper { margin-left: 0px; }        /* Make exclusionScrollBox smaller than on the options page, because there are likely to be fewer @@ -35,14 +43,16 @@        }        #endSpace { /* Leave space for the fixed footer. */ -        min-height: 46px; -        max-height: 46px; +        min-height: 40px; +        max-height: 40px;        }      </style>      <script src="options.js"></script>    </head>    <body> +    <div id="state"></div> +      <!-- Copied (almost) directly from options.html - start -->      <!-- The only difference is the column headers. -->      <div id="exclusionScrollBox"> @@ -71,11 +81,9 @@          <table>            <tr>              <td id="stateLine" style="width: 99%"> -              <span id="state"></span> -              <br/> -              <span id="helpText">These are the matching rules for this page.</span> +              <span id="helpText">These are rules matching this page.</span>                <br/> -              <a id="optionsLink" target="_blank">Options</a> +              <a id="optionsLink" target="_blank" tabindex="99999">Options</a>              </td>              <td valign="top">                <button id="exclusionAddButton">Add Rule</button> | 
