This allows us to drop the external chrome-bootstrap project.
+++ /dev/null
-[submodule "chrome-bootstrap"]
- path = chrome-bootstrap
- url = https://github.com/roykolak/chrome-bootstrap.git
- branch = tags/v1.2.1
+++ /dev/null
-Subproject commit 419698ec6fe922487d2fe3f11c92fd1c8ffbd8a6
-chrome-bootstrap/chrome-bootstrap.css
images/outlet-128x128.png
images/outlet-19x19.png
images/outlet-38x38.png
-images/outlet.svg
common.js
options.html
options.js
{
"manifest_version": 2,
- "minimum_chrome_version": "22",
+ "minimum_chrome_version": "41",
"name": "Web Power Switch Manager",
- "version": "2.3",
+ "version": "3.0",
"description": "Quickly control Web Power Switches",
"icons": {
"128": "images/outlet-128x128.png"
"default_title": "Control Your Switch",
"default_popup": "popup.html"
},
- "options_page": "options.html",
+ "options_ui": {
+ "page": "options.html",
+ "chrome_style": true
+ },
"permissions": [
"storage"
],
<head>
<title>Web Power Switch Manager Options</title>
-<link rel="stylesheet" type="text/css" href="chrome-bootstrap/chrome-bootstrap.css" />
<script src='common.js'></script>
<script src='options.js'></script>
+<style>body { padding: 0px; }</style>
</head>
-<body class="chrome-bootstrap">
- <div class="frame">
-
- <div class="navigation">
- <h1><a href="#">Web Power Switch</a></h1>
- <ul class="menu">
- <li class="selected">
- <a href="#options">Options</a>
- </li>
- </ul>
- <ul>
- <li> <img src='images/outlet-128x128.png'></li>
- </ul>
- </div>
-
- <div class="mainview view">
- <div id="options" class="selected">
- <header>
- <h1>Options</h1>
- </header>
- <div class="content">
-
-<section>
- <h3>Connection</h3>
-
+<body>
<table>
<tr>
- <td>URL:</td><td><input type='text' id='url' size=50></td>
+ <td>URL:</td><td><input type='text' id='url' size=40></td>
</tr>
<tr>
- <td>User:</td><td><input type='text' id='user' size=50></td>
+ <td>User:</td><td><input type='text' id='user' size=40></td>
</tr>
<tr>
- <td>Pass:</td><td><input type='text' id='pass' size=50></td>
+ <td>Pass:</td><td><input type='text' id='pass' size=40></td>
</tr>
</table>
-</section>
-
-<div>
- <h3>Save Settings</h3>
- <p>
- <input type='button' id='save' value='Save'></td>
- </p>
- <div id='msg'>You must hit "Save" the first time to authorize the client</div>
-</div>
-
- </div>
- </div>
- </div>
-
- </div>
+<p style='text-align: center'>
+<input type='button' id='save' value='Save'>
+</p>
+<p style='text-align: center' id='msg'>
+You must hit "Save" the first time to authorize the client.
+</p>
</body>
</html>
});
msg.timeout = setTimeout(function() {
- msg.innerText = '';
+ // Can't leave this blank or Chrome will resize the options page.
+ msg.innerHTML = ' ';
}, 5000);
}
+function keydown(e) {
+ if (e.key == 'Enter') {
+ update_settings();
+ }
+}
+
window.onload = function() {
storage.get(settings_keys, function(settings) {
var field = document.getElementById('save');
settings_keys.forEach(function(key) {
var field = document.getElementById(key);
field.value = settings[key] || settings_defaults[key];
+ field.onkeydown = keydown;
});
});
};
callback(xhr, state);
} else {
xhr.setstatus = true;
- setstatus('Could not connect;<br>check your ' +
- '<a href="' + chrome.extension.getURL('options.html') + '" target=_blank>settings</a>');
+ setstatus(
+ 'Could not connect;<br>check your ' +
+ '<a id="open-settings" href="">settings</a>'
+ );
+ document.getElementById('open-settings').onclick = open_settings_page;
console.log('connect error', state);
}
}
status.style.position = msg ? '' : 'absolute';
}
+function open_settings_page() {
+ chrome.runtime.openOptionsPage();
+}
+
document.addEventListener('DOMContentLoaded', function() {
storage.get(settings_keys, function(settings) {
url_base = settings['url'] || settings_defaults['url'];
} else {
setstatus(
'Missing permissions;<br>please visit the ' +
- '<a href="' + chrome.extension.getURL('options.html') + '" target=_blank>settings page</a>' +
+ '<a id="open-settings" href="">settings page</a>' +
'<br>to grant access.<br>' +
'<center><input id=retry type=submit value=Retry></center>'
);
+ document.getElementById('open-settings').onclick = open_settings_page;
// Work around http://crbug.com/125706.
document.getElementById('retry').onclick = function() {
chrome.permissions.request({origins: [url_base + '/*']});