Permalink
Browse files

Add option for opening custom page instead of new tab (Resolves #3)

  • Loading branch information...
1 parent bba99a3 commit 600e7575ab7c3ca1eac62264f61b14416cc276d6 @livibetter livibetter committed Jun 18, 2012
Showing with 30 additions and 5 deletions.
  1. +2 −0 CHANGES.mkd
  2. +7 −4 background.html
  3. +1 −1 manifest.json
  4. +20 −0 options.html
View
@@ -3,7 +3,9 @@ CHANGES
## Development
+## Version 0.5
+ * Add opening custom page instead of new tab (#3)
## Version 0.4.1 (2012-02-02T12:21:35Z)
View
@@ -14,10 +14,13 @@
creating_tab = true;
var select_new_created = localStorage["select_new_created"] == 1;
var auto_pin = localStorage["auto_pin"] == 1;
- chrome.tabs.create({
- selected: select_new_created,
- pinned: (auto_pin && !w.tabs[0].pinned)
- }, function(tab){
+ var create_options = {
+ selected: select_new_created,
+ pinned: (auto_pin && !w.tabs[0].pinned)
+ };
+ if (localStorage["open_custom_page"] == 1)
+ create_options['url'] = localStorage["custom_page_url"];
+ chrome.tabs.create(create_options, function(tab){
// save this tab id in case of Close Tabs to The Right.
// Chrome will close this tab if that is the case even it's just being
// added.
View
@@ -1,6 +1,6 @@
{
"name": "Keep Last Two Tabs",
- "version": "0.4.1",
+ "version": "0.5",
"description": "This extension keep last two tabs to prevent Chrome quits when last tab is closed.",
"icons": { "16": "icon16.png",
"48": "icon48.png",
View
@@ -37,6 +37,13 @@
else
localStorage["auto_pin"] = 0;
+ var open_custom_page = document.getElementById("open_custom_page");
+ if (open_custom_page.checked)
+ localStorage["open_custom_page"] = 1;
+ else
+ localStorage["open_custom_page"] = 0;
+ localStorage["custom_page_url"] = document.getElementById("custom_page_url").value;
+
// Update status to let user know options were saved.
var status = document.getElementById("status");
status.innerHTML = "Options Saved.";
@@ -59,6 +66,11 @@
if (auto_pin == 1) {
document.getElementById("auto_pin").checked = true;
}
+ var open_custom_page = localStorage["open_custom_page"];
+ if (open_custom_page == 1) {
+ document.getElementById("open_custom_page").checked = true;
+ }
+ document.getElementById("custom_page_url").value = localStorage["custom_page_url"] || '';
}
</script>
@@ -87,6 +99,14 @@
</label>
</div>
+<div>
+<label>
+<input type="checkbox" id="open_custom_page" name="open_custom_page" value="true"/>
+Open custom page
+<input type="input" id="custom_page_url" name="custom_page_url"/>
+</label>
+</div>
+
<hr/>
<div>

0 comments on commit 600e757

Please sign in to comment.