From 8de59061c6186228e42623e2540df98894b4106d Mon Sep 17 00:00:00 2001 From: Jonathan Kempf Date: Mon, 21 Jul 2014 22:46:58 -0400 Subject: [PATCH 1/5] Fixing takeoff extension to support latest Chrome standards. --- manifest.json | 1 + 1 file changed, 1 insertion(+) diff --git a/manifest.json b/manifest.json index 4957fa8..c21ecfa 100644 --- a/manifest.json +++ b/manifest.json @@ -5,5 +5,6 @@ "chrome_url_overrides": { "newtab": "takeoff.html" }, + "manifest-version": 2, "permissions": ["tabs", "bookmarks"] } -- 2.39.5 From 0faec7d62f4be8d824032fcc5af398ef8b82d4ea Mon Sep 17 00:00:00 2001 From: Jonathan Kempf Date: Mon, 21 Jul 2014 22:50:48 -0400 Subject: [PATCH 2/5] Updating README to show who created this extension, and giving clearer directions on use. --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d3ffd27..a984846 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +This is Forked from a great, simple extension from **[@ryanmcgrath](http://twitter.com/ryanmcgrath)** + Takeoff --------------------------------------------------------------------------- I was up late one night, and my brain was in one of those modes where I needed @@ -13,8 +15,8 @@ run with it as you see fit. MIT licensed. To Install ---------------------------------------------------------------------------- -Download it, unzip it somewhere, load it up in your extensions tab by loading -an "unpacked" extension. +Download it, unzip it somewhere, load it up in your [extensions tab](chrome://extensions/) by loading +an "unpacked" extension. Or, just drag and drop...easy. NOTE: You must enable developer tools to get this to work. Publicity --------------------------------------------------------------------------- -- 2.39.5 From 085913a03ba1823e4ef97922efc646095fc56d05 Mon Sep 17 00:00:00 2001 From: Jonathan Kempf Date: Mon, 21 Jul 2014 22:53:23 -0400 Subject: [PATCH 3/5] Updating README to include relevant links. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a984846..2547a88 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -This is Forked from a great, simple extension from **[@ryanmcgrath](http://twitter.com/ryanmcgrath)** +This is Forked from a great, simple extension from **[@ryanmcgrath](http://twitter.com/ryanmcgrath)** from **[here](https://github.com/ryanmcgrath/takeoff)**. Takeoff --------------------------------------------------------------------------- @@ -15,7 +15,7 @@ run with it as you see fit. MIT licensed. To Install ---------------------------------------------------------------------------- -Download it, unzip it somewhere, load it up in your [extensions tab](chrome://extensions/) by loading +Download it, unzip it somewhere, load it up in your **[extensions tab](chrome://extensions/)** by loading an "unpacked" extension. Or, just drag and drop...easy. NOTE: You must enable developer tools to get this to work. Publicity -- 2.39.5 From 3d6125a681dfce22bcd926ae73557045e14bd0db Mon Sep 17 00:00:00 2001 From: Jonathan Kempf Date: Fri, 25 Jul 2014 20:28:14 -0400 Subject: [PATCH 4/5] Fixed the issue with multiple layers of folders and giving correct node.url to the new window object. --- LICENSE | 0 README.md | 6 ++---- manifest.json | 4 ++-- takeoff.html | 35 +---------------------------------- takeoff.js | 34 ++++++++++++++++++++++++++++++++++ 5 files changed, 39 insertions(+), 40 deletions(-) mode change 100644 => 100755 LICENSE mode change 100644 => 100755 README.md mode change 100644 => 100755 manifest.json mode change 100644 => 100755 takeoff.html create mode 100644 takeoff.js diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/README.md b/README.md old mode 100644 new mode 100755 index 2547a88..d3ffd27 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -This is Forked from a great, simple extension from **[@ryanmcgrath](http://twitter.com/ryanmcgrath)** from **[here](https://github.com/ryanmcgrath/takeoff)**. - Takeoff --------------------------------------------------------------------------- I was up late one night, and my brain was in one of those modes where I needed @@ -15,8 +13,8 @@ run with it as you see fit. MIT licensed. To Install ---------------------------------------------------------------------------- -Download it, unzip it somewhere, load it up in your **[extensions tab](chrome://extensions/)** by loading -an "unpacked" extension. Or, just drag and drop...easy. NOTE: You must enable developer tools to get this to work. +Download it, unzip it somewhere, load it up in your extensions tab by loading +an "unpacked" extension. Publicity --------------------------------------------------------------------------- diff --git a/manifest.json b/manifest.json old mode 100644 new mode 100755 index c21ecfa..2239c4a --- a/manifest.json +++ b/manifest.json @@ -1,10 +1,10 @@ { "name": "Takeoff", - "version": "1.0", + "version": "2.0", "description": "Takeoff grabs a random entry from your Bookmarks collection and loads it when you start the browser or open a new tab.", "chrome_url_overrides": { "newtab": "takeoff.html" }, - "manifest-version": 2, + "manifest_version": 2, "permissions": ["tabs", "bookmarks"] } diff --git a/takeoff.html b/takeoff.html old mode 100644 new mode 100755 index d5d35eb..cac1a54 --- a/takeoff.html +++ b/takeoff.html @@ -3,40 +3,7 @@ - + diff --git a/takeoff.js b/takeoff.js new file mode 100644 index 0000000..35db08c --- /dev/null +++ b/takeoff.js @@ -0,0 +1,34 @@ +var marks = []; + +chrome.bookmarks.getTree(function(itemTree){ + itemTree.forEach(function(item){ + processNode(item); + }); +}); + +function processNode(node) { + + // recursively process child nodes + if(node.children) { + node.children.forEach(function(child) { + processNode(child); + }); + } + + // print leaf nodes URLs to console + if(node.url) { + console.log(node.url); + var book = marks.push(node.url); + } +} + + + +function setPage(windowObj) { + bookmark = marks[Math.floor(Math.random() * marks.length)]; + chrome.tabs.getSelected(windowObj.windowId, function(tab) { + chrome.tabs.update(tab.id, {url: bookmark}); + }); +} + +chrome.windows.getLastFocused(setPage); \ No newline at end of file -- 2.39.5 From ddc7c366368f02ecb31b215905c7eb25d6c72f4d Mon Sep 17 00:00:00 2001 From: Jonathan Kempf Date: Fri, 25 Jul 2014 20:44:29 -0400 Subject: [PATCH 5/5] Updated README to reflect my story of how this came about. --- README.md | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index d3ffd27..a247a0a 100755 --- a/README.md +++ b/README.md @@ -1,23 +1,21 @@ -Takeoff +Takeoff 2.0 --------------------------------------------------------------------------- -I was up late one night, and my brain was in one of those modes where I needed -a new, really quick project to distract myself from what I was currently working -on. Sometimes that kind of thing helps the brain to get to a better solution. +Several years ago, I started separating out my browser behavior. -I noticed someone on Reddit by the name of [hokku was looking for an extension](http://www.reddit.com/r/AskReddit/comments/fjb0v/is_there_a_chrome_extension_that_can_set_my/) -to randomly choose a bookmark and load it on new tab/window instances. I took -20 minutes and knocked this together. It's open source, as I have zero interest -in maintaining it; feel free to learn from it to build your own, or fork it and -run with it as you see fit. MIT licensed. +Firefox was for fun, Chrome was for development. As a result, whenever I came across something interesting or educational, I would bookmark it in Chrome. This turned into folders of folders of development info, assets, blogs, and more. While these bookmarks were well organized, I found myself forgetting what bookmarks I had saved or what I had even saved them for. + +"If they were so important," I asked myself, "I should remind myself what they were doing there in the first place." It was with this in mind that I began the search for an extension that would randomly load a bookmark and show it to me when I generated a new tab. This apparently didn't exist, so after Googling for a bit, I found a **[reddit post](http://www.reddit.com/r/AskReddit/comments/fjb0v/is_there_a_chrome_extension_that_can_set_my/)** that claimed to have solved this exact problem. The developer Ryan McGrath **[@ryanmcgrath](http://twitter.com/ryanmcgrath)** had created an extension, called "Takeoff", which I have now updated to work with any levels of folder structure and given an update to actually work with latest Chrome versions. (It was over 4 years old after all). + +I plan on uploading this to the Google Chrome extensions store, but in the meantime, if you want to go ahead and fork it for other browsers, or whatever, please feel free, it is MIT Licensed after all. To Install ---------------------------------------------------------------------------- Download it, unzip it somewhere, load it up in your extensions tab by loading -an "unpacked" extension. +an "unpacked" extension. Will also be in Chrome Extensions soon. Publicity --------------------------------------------------------------------------- -Email: ryan [at] venodesigns dot net -Twitter: **[@ryanmcgrath](http://twitter.com/ryanmcgrath)** -Web: **[Veno Designs - Personal Site](http://venodesigns.net/)** +Email: kempfjj [at] gmail dot com +Twitter: **[@kempfcreative](http://twitter.com/kempfcreative)** +Web: **[KempfCreative - Personal Site](http://www.kempfcreative.com/)** -- 2.39.5