From a082f1773ea9b5ad1574e759df83ddd33cd8c199 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 9 Jun 2012 17:47:05 -0400 Subject: [PATCH] Add disabled _initChromeExtension --- core.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/core.js b/core.js index 78937c6..b1c96f9 100644 --- a/core.js +++ b/core.js @@ -70,6 +70,8 @@ SkeletonKey.prototype._init = function() { this._generateButton.onclick = this._onGenerate.bind(this); this._password.labels[0].onclick = this._selectPassword.bind(this); + + this._initChromeExtension(); }; /** @@ -141,3 +143,26 @@ SkeletonKey.prototype._selectPassword = function() { this._password.focus(); this._password.select(); }; + +/** + * Initalizes the Chrome extension pieces if running inside chrome. + * @private + */ +SkeletonKey.prototype._initChromeExtension = function() { + return; + if (typeof chrome == 'undefined' || typeof chrome.extension == 'undefined') + return; + + // getCurrent is undefined for backround pages. Need content script. + chrome.tabs.getCurrent(function (tab) { + if (tab == null) + return; + + var url = tab.url; + if (url == null || url == "") + return; + + var siteKey = url.search(/https?:\/\/(www.?|login|accounts?)\.(.*)\.(com?|net|org|edu|biz|info)?.*/); + console.log(siteKey); + }); +}; -- 2.43.5