Skip to content
This repository was archived by the owner on Oct 12, 2020. It is now read-only.

Small bugfixes and manifest_version 2.0 compatiblity #22

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ Changelog
- Disabled horizontal scroll (Ivan Nevostruev)
- refresh button in popup (Ivan Nevostruev)
- desktop notification (Ivan Nevostruev)
- manifest_version 2 compatibility (Jyry Suvilehto)

[extension_site]: http://bit.ly/hudson_extension
11 changes: 0 additions & 11 deletions background.html

This file was deleted.

15 changes: 10 additions & 5 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ hudson.init = function (conf, results) {

function timeout () {
console.log("timeout");
if (xhr) {
xhr.abort();
}
newRequest();
}

Expand All @@ -77,7 +74,12 @@ hudson.init = function (conf, results) {
}

function start() {
xhr = new XMLHttpRequest();
if (xhr != undefined){
xhr.abort();
}
else {
xhr = new XMLHttpRequest();
}
xhr.onreadystatechange = onchange;
xhr.open("GET", conf.apiURL(), true);
try {
Expand Down Expand Up @@ -105,7 +107,7 @@ hudson.init = function (conf, results) {
try {
results.hudson = JSON.parse(text);
} catch (e) {
onerror("Failed to parse JSON data from " + conf.hudsonUrl() + ": " + e);
onerror("Failed to parse JSON data from " + conf.hudsonURL() + ": " + e);
return;
}
results.error = undefined;
Expand Down Expand Up @@ -227,3 +229,6 @@ hudson.init = function (conf, results) {
};

}(hudson.conf, hudson.results);

//new place to initialize the system
window.onload = hudson.init
20 changes: 14 additions & 6 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
{
"name": "Hudson Extension",
"version": "0.9.3",
"version": "0.9.4",
"description": "This Extensions monitors Hudson.",
"background": {
"scripts": ["conf.js", "notifications.js", "background.js"]
},
"icons": { "128": "icon128.png" },

"options_page": "options.html",
"background_page": "background.html",
"browser_action": {
"default_icon": "icon.png",
"default_title": "Hudson",
"popup" : "status.html"
"default_icon": "icon.png",
"default_title": "Hudson",
"default_popup" : "status.html"
},
"permissions": [
"tabs",
"notifications",
"http://*/",
"https://*/"
]
],
"web_accessible_resources": [
"green_big.png",
"red_big.png"
],
"manifest_version": 2
}
12 changes: 6 additions & 6 deletions options.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@
<script src="conf.js"></script>
<script src="options.js"></script>
</head>
<body onload="hudson.options.init()">
<body>
<div id="header"><h1>Hudson Extension</h1></div>

<div class="section-header first">Options</div>
<p><label for="hudson-url">Enter the URL of your Hudson here</label>:</p>
<input type="text" id="hudson-url" oninput="hudson.options.markDirty()">
<input type="text" id="hudson-url">
<p><label for="poll-intervall">Enter poll intervall in in minutes</label>:</p>
<input type="text" id="poll-intervall" oninput="hudson.options.markDirty()">
<input type="text" id="poll-intervall">
<p><label for="desktop-notifications">Enable Desktop Notifications</label>
<input type="checkbox" id="desktop-notifications" onchange="hudson.options.markDirty()">
<input type="checkbox" id="desktop-notifications">
</p>
<div class="footer">
<button id="save-button" style="font-weight:bold" onclick="hudson.options.save()" >Save</button>
<button onclick="hudson.options.init()">Cancel</button>
<button id="save-button" style="font-weight:bold" >Save</button>
<button id="cancel-button">Cancel</button>
<span id="save-status" style="display:none">Options saved.</span>
</div>
</body>
Expand Down
10 changes: 10 additions & 0 deletions options.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,13 @@ hudson.options = function(conf) {
};
}(hudson.conf);

//set event handlers
window.onload = setEventHandlers;
function setEventHandlers(){
document.getElementById("hudson-url").oninput = hudson.options.markDirty;
document.getElementById("desktop-notifications").onchange = hudson.options.markDirty;
document.getElementById("poll-intervall").oninput = hudson.options.markDirty;
document.getElementById("save-button").onclick = hudson.options.save;
document.getElementById("cancel-button").onclick = hudson.options.save;
hudson.options.init();
}
2 changes: 1 addition & 1 deletion status.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
</style>
<script src="status.js"></script>
</head>
<body onload="hudson.status.show()">
<body >
<div id="content">
<div id="heading" class="heading">Loading...</div>
<div id="refresh_url" class="refresh_url"></div>
Expand Down
3 changes: 2 additions & 1 deletion status.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,5 @@ hudson.status = function() {
options.appendChild(link(chrome.extension.getURL('options.html'), 'Options'));
}}
}();

//yet another event handler
window.onload = hudson.status.show;