Initial work to get working in Firefox
This commit is contained in:
@@ -1,16 +1,16 @@
|
|||||||
/* global chrome */
|
/* global browser */
|
||||||
|
|
||||||
var React = require('react');
|
var React = require('react');
|
||||||
|
|
||||||
var MainList = React.createClass({
|
var MainList = React.createClass({
|
||||||
|
|
||||||
_openOptionsPage: function() {
|
_openOptionsPage: function() {
|
||||||
if (chrome.runtime.openOptionsPage) {
|
if (browser.runtime.openOptionsPage) {
|
||||||
// New way to open options pages, if supported (Chrome 42+).
|
// New way to open options pages, if supported (Chrome 42+).
|
||||||
chrome.runtime.openOptionsPage();
|
browser.runtime.openOptionsPage();
|
||||||
} else {
|
} else {
|
||||||
// Reasonable fallback.
|
// Reasonable fallback.
|
||||||
window.open(chrome.runtime.getURL('options.html'));
|
window.open(browser.runtime.getURL('options.html'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* global chrome */
|
/* global browser */
|
||||||
|
|
||||||
var React = require('react');
|
var React = require('react');
|
||||||
var ReactCSSTransitionGroup = require('react-addons-css-transition-group');
|
var ReactCSSTransitionGroup = require('react-addons-css-transition-group');
|
||||||
@@ -37,13 +37,13 @@ var Options = React.createClass({
|
|||||||
restoreSettings: function () {
|
restoreSettings: function () {
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
chrome.storage.sync.get({
|
browser.storage.sync.get({
|
||||||
theme: config.theme,
|
theme: config.theme,
|
||||||
blacklist: '',
|
blacklist: '',
|
||||||
whitelist: '',
|
whitelist: '',
|
||||||
loggingType: config.loggingType,
|
loggingType: config.loggingType,
|
||||||
loggingStyle: config.loggingStyle
|
loggingStyle: config.loggingStyle
|
||||||
}, function (items) {
|
}).then(function (items) {
|
||||||
that.setState({
|
that.setState({
|
||||||
theme: items.theme,
|
theme: items.theme,
|
||||||
blacklist: items.blacklist,
|
blacklist: items.blacklist,
|
||||||
@@ -75,13 +75,13 @@ var Options = React.createClass({
|
|||||||
var whitelist = that.state.whitelist.trim();
|
var whitelist = that.state.whitelist.trim();
|
||||||
|
|
||||||
// Sync options with google storage.
|
// Sync options with google storage.
|
||||||
chrome.storage.sync.set({
|
browser.storage.sync.set({
|
||||||
theme: theme,
|
theme: theme,
|
||||||
blacklist: blacklist,
|
blacklist: blacklist,
|
||||||
whitelist: whitelist,
|
whitelist: whitelist,
|
||||||
loggingType: loggingType,
|
loggingType: loggingType,
|
||||||
loggingStyle: loggingStyle
|
loggingStyle: loggingStyle
|
||||||
}, function () {
|
}).then(function () {
|
||||||
// Set state to be newly entered values.
|
// Set state to be newly entered values.
|
||||||
that.setState({
|
that.setState({
|
||||||
theme: theme,
|
theme: theme,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* global chrome */
|
/* global browser */
|
||||||
|
|
||||||
var React = require("react");
|
var React = require("react");
|
||||||
var $ = require('jquery');
|
var $ = require('jquery');
|
||||||
@@ -40,9 +40,9 @@ var Wakatime = React.createClass({
|
|||||||
|
|
||||||
if (data !== false) {
|
if (data !== false) {
|
||||||
|
|
||||||
chrome.storage.sync.get({
|
browser.storage.sync.get({
|
||||||
loggingEnabled: config.loggingEnabled
|
loggingEnabled: config.loggingEnabled
|
||||||
}, function(items) {
|
}).then(function(items) {
|
||||||
that.setState({loggingEnabled: items.loggingEnabled});
|
that.setState({loggingEnabled: items.loggingEnabled});
|
||||||
|
|
||||||
if (items.loggingEnabled === true) {
|
if (items.loggingEnabled === true) {
|
||||||
@@ -127,7 +127,7 @@ var Wakatime = React.createClass({
|
|||||||
|
|
||||||
changeExtensionState('notLogging');
|
changeExtensionState('notLogging');
|
||||||
|
|
||||||
chrome.storage.sync.set({
|
browser.storage.sync.set({
|
||||||
loggingEnabled: false
|
loggingEnabled: false
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@@ -139,7 +139,7 @@ var Wakatime = React.createClass({
|
|||||||
|
|
||||||
changeExtensionState('allGood');
|
changeExtensionState('allGood');
|
||||||
|
|
||||||
chrome.storage.sync.set({
|
browser.storage.sync.set({
|
||||||
loggingEnabled: true
|
loggingEnabled: true
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
/* global chrome */
|
/* global browser */
|
||||||
//jshint esnext:true
|
//jshint esnext:true
|
||||||
|
|
||||||
var config = {
|
var config = {
|
||||||
// Extension name
|
// Extension name
|
||||||
name: 'WakaTime',
|
name: 'WakaTime',
|
||||||
// Extension version
|
// Extension version
|
||||||
version: chrome.app.getDetails().version,
|
version: browser.runtime.getManifest().version,
|
||||||
// Time for idle state of the browser
|
// Time for idle state of the browser
|
||||||
// The user is considered idle if there was
|
// The user is considered idle if there was
|
||||||
// no activity in the browser for x seconds
|
// no activity in the browser for x seconds
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* global chrome */
|
/* global browser */
|
||||||
//jshint esnext:true
|
//jshint esnext:true
|
||||||
|
|
||||||
var $ = require('jquery');
|
var $ = require('jquery');
|
||||||
@@ -84,21 +84,21 @@ class WakaTimeCore {
|
|||||||
*/
|
*/
|
||||||
recordHeartbeat() {
|
recordHeartbeat() {
|
||||||
|
|
||||||
chrome.storage.sync.get({
|
browser.storage.sync.get({
|
||||||
loggingEnabled: config.loggingEnabled,
|
loggingEnabled: config.loggingEnabled,
|
||||||
loggingStyle: config.loggingStyle,
|
loggingStyle: config.loggingStyle,
|
||||||
blacklist: '',
|
blacklist: '',
|
||||||
whitelist: ''
|
whitelist: ''
|
||||||
}, (items) => {
|
}).then((items) => {
|
||||||
if (items.loggingEnabled === true) {
|
if (items.loggingEnabled === true) {
|
||||||
|
|
||||||
changeExtensionState('allGood');
|
changeExtensionState('allGood');
|
||||||
|
|
||||||
chrome.idle.queryState(config.detectionIntervalInSeconds, (newState) => {
|
browser.idle.queryState(config.detectionIntervalInSeconds).then((newState) => {
|
||||||
|
|
||||||
if (newState === 'active') {
|
if (newState === 'active') {
|
||||||
// Get current tab URL.
|
// Get current tab URL.
|
||||||
chrome.tabs.query({active: true}, (tabs) => {
|
browser.tabs.query({active: true}).then((tabs) => {
|
||||||
|
|
||||||
var currentActiveTab = tabs[0];
|
var currentActiveTab = tabs[0];
|
||||||
|
|
||||||
@@ -152,7 +152,7 @@ class WakaTimeCore {
|
|||||||
time: moment().format('X'),
|
time: moment().format('X'),
|
||||||
project: '<<LAST_PROJECT>>',
|
project: '<<LAST_PROJECT>>',
|
||||||
is_debugging: debug,
|
is_debugging: debug,
|
||||||
plugin: 'chrome-wakatime/' + config.version
|
plugin: 'browser-wakatime/' + config.version
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,9 +166,9 @@ class WakaTimeCore {
|
|||||||
_getLoggingType() {
|
_getLoggingType() {
|
||||||
var deferredObject = $.Deferred();
|
var deferredObject = $.Deferred();
|
||||||
|
|
||||||
chrome.storage.sync.get({
|
browser.storage.sync.get({
|
||||||
loggingType: config.loggingType
|
loggingType: config.loggingType
|
||||||
}, function (items) {
|
}).then(function (items) {
|
||||||
deferredObject.resolve(items.loggingType);
|
deferredObject.resolve(items.loggingType);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
/* global chrome */
|
/* global browser */
|
||||||
|
|
||||||
// Create a connection to the background page
|
// Create a connection to the background page
|
||||||
var backgroundPageConnection = chrome.runtime.connect({
|
var backgroundPageConnection = browser.runtime.connect({
|
||||||
name: "devtools-page"
|
name: "devtools-page"
|
||||||
});
|
});
|
||||||
|
|
||||||
// Send a message to background page with the current active tabId
|
// Send a message to background page with the current active tabId
|
||||||
backgroundPageConnection.postMessage({
|
backgroundPageConnection.postMessage({
|
||||||
name: 'init',
|
name: 'init',
|
||||||
tabId: chrome.devtools.inspectedWindow.tabId
|
tabId: browser.devtools.inspectedWindow.tabId
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* global chrome */
|
/* global browser */
|
||||||
|
|
||||||
// Core
|
// Core
|
||||||
var WakaTimeCore = require("./core/WakaTimeCore").default;
|
var WakaTimeCore = require("./core/WakaTimeCore").default;
|
||||||
@@ -11,7 +11,7 @@ var wakatime = new WakaTimeCore();
|
|||||||
var connections = {};
|
var connections = {};
|
||||||
|
|
||||||
// Add a listener to resolve alarms
|
// Add a listener to resolve alarms
|
||||||
chrome.alarms.onAlarm.addListener(function (alarm) {
|
browser.alarms.onAlarm.addListener(function (alarm) {
|
||||||
// |alarm| can be undefined because onAlarm also gets called from
|
// |alarm| can be undefined because onAlarm also gets called from
|
||||||
// window.setTimeout on old chrome versions.
|
// window.setTimeout on old chrome versions.
|
||||||
if (alarm && alarm.name == 'heartbeatAlarm') {
|
if (alarm && alarm.name == 'heartbeatAlarm') {
|
||||||
@@ -23,14 +23,14 @@ chrome.alarms.onAlarm.addListener(function (alarm) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Create a new alarm for heartbeats.
|
// Create a new alarm for heartbeats.
|
||||||
chrome.alarms.create('heartbeatAlarm', {periodInMinutes: 2});
|
browser.alarms.create('heartbeatAlarm', {periodInMinutes: 2});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whenever a active tab is changed it records a heartbeat with that tab url.
|
* Whenever a active tab is changed it records a heartbeat with that tab url.
|
||||||
*/
|
*/
|
||||||
chrome.tabs.onActivated.addListener(function (activeInfo) {
|
browser.tabs.onActivated.addListener(function (activeInfo) {
|
||||||
|
|
||||||
chrome.tabs.get(activeInfo.tabId, function (tab) {
|
browser.tabs.get(activeInfo.tabId).then(function (tab) {
|
||||||
|
|
||||||
console.log('recording a heartbeat - active tab changed');
|
console.log('recording a heartbeat - active tab changed');
|
||||||
|
|
||||||
@@ -43,11 +43,11 @@ chrome.tabs.onActivated.addListener(function (activeInfo) {
|
|||||||
* Whenever any tab is updated it checks if the updated tab is the tab that is
|
* Whenever any tab is updated it checks if the updated tab is the tab that is
|
||||||
* currently active and if it is, then it records a heartbeat.
|
* currently active and if it is, then it records a heartbeat.
|
||||||
*/
|
*/
|
||||||
chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
|
browser.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
|
||||||
|
|
||||||
if (changeInfo.status === 'complete') {
|
if (changeInfo.status === 'complete') {
|
||||||
// Get current tab URL.
|
// Get current tab URL.
|
||||||
chrome.tabs.query({active: true}, function(tabs) {
|
browser.tabs.query({active: true}).then(function(tabs) {
|
||||||
// If tab updated is the same as active tab
|
// If tab updated is the same as active tab
|
||||||
if (tabId == tabs[0].id) {
|
if (tabId == tabs[0].id) {
|
||||||
console.log('recording a heartbeat - tab updated');
|
console.log('recording a heartbeat - tab updated');
|
||||||
@@ -64,7 +64,7 @@ chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab) {
|
|||||||
* This is in charge of detecting if devtools are opened or closed
|
* This is in charge of detecting if devtools are opened or closed
|
||||||
* and sending a heartbeat depending on that.
|
* and sending a heartbeat depending on that.
|
||||||
*/
|
*/
|
||||||
chrome.runtime.onConnect.addListener(function (port) {
|
browser.runtime.onConnect.addListener(function (port) {
|
||||||
|
|
||||||
if (port.name == "devtools-page") {
|
if (port.name == "devtools-page") {
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* global chrome */
|
/* global browser */
|
||||||
|
|
||||||
var config = require('../config');
|
var config = require('../config');
|
||||||
|
|
||||||
@@ -19,26 +19,26 @@ function changeExtensionIcon(color) {
|
|||||||
|
|
||||||
path = './graphics/wakatime-logo-38' + color + '.png';
|
path = './graphics/wakatime-logo-38' + color + '.png';
|
||||||
|
|
||||||
chrome.browserAction.setIcon({
|
browser.browserAction.setIcon({
|
||||||
path: path
|
path: path
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (color === '') {
|
if (color === '') {
|
||||||
chrome.storage.sync.get({
|
browser.storage.sync.get({
|
||||||
theme: config.theme
|
theme: config.theme
|
||||||
}, function (items) {
|
}).then(function (items) {
|
||||||
if (items.theme == config.theme) {
|
if (items.theme == config.theme) {
|
||||||
path = './graphics/wakatime-logo-38.png';
|
path = './graphics/wakatime-logo-38.png';
|
||||||
|
|
||||||
chrome.browserAction.setIcon({
|
browser.browserAction.setIcon({
|
||||||
path: path
|
path: path
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
path = './graphics/wakatime-logo-38-white.png';
|
path = './graphics/wakatime-logo-38-white.png';
|
||||||
|
|
||||||
chrome.browserAction.setIcon({
|
browser.browserAction.setIcon({
|
||||||
path: path
|
path: path
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* global chrome */
|
/* global browser */
|
||||||
|
|
||||||
var config = require('../config');
|
var config = require('../config');
|
||||||
|
|
||||||
@@ -16,7 +16,7 @@ function changeExtensionTooltip(text) {
|
|||||||
text = config.name + ' - ' + text;
|
text = config.name + ' - ' + text;
|
||||||
}
|
}
|
||||||
|
|
||||||
chrome.browserAction.setTitle({title: text});
|
browser.browserAction.setTitle({title: text});
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = changeExtensionTooltip;
|
module.exports = changeExtensionTooltip;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
/* global chrome */
|
/* global browser */
|
||||||
|
|
||||||
/* This is a fix for Bootstrap requiring jQuery */
|
/* This is a fix for Bootstrap requiring jQuery */
|
||||||
global.jQuery = require('jquery');
|
global.jQuery = require('jquery');
|
||||||
|
|||||||
4
assets/less/bootstrap/bootstrap.less
vendored
4
assets/less/bootstrap/bootstrap.less
vendored
@@ -1,6 +1,6 @@
|
|||||||
/*!
|
/*!
|
||||||
* Bootstrap v3.3.6 (http://getbootstrap.com)
|
* Bootstrap v3.3.7 (http://getbootstrap.com)
|
||||||
* Copyright 2011-2015 Twitter, Inc.
|
* Copyright 2011-2016 Twitter, Inc.
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@
|
|||||||
.border-right-radius(0);
|
.border-right-radius(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Need .dropdown-toggle since :last-child doesn't apply given a .dropdown-menu immediately after it
|
// Need .dropdown-toggle since :last-child doesn't apply, given that a .dropdown-menu is used immediately after it
|
||||||
.btn-group > .btn:last-child:not(:first-child),
|
.btn-group > .btn:last-child:not(:first-child),
|
||||||
.btn-group > .dropdown-toggle:not(:first-child) {
|
.btn-group > .dropdown-toggle:not(:first-child) {
|
||||||
.border-left-radius(0);
|
.border-left-radius(0);
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ input[type="search"] {
|
|||||||
// set a pixel line-height that matches the given height of the input, but only
|
// set a pixel line-height that matches the given height of the input, but only
|
||||||
// for Safari. See https://bugs.webkit.org/show_bug.cgi?id=139848
|
// for Safari. See https://bugs.webkit.org/show_bug.cgi?id=139848
|
||||||
//
|
//
|
||||||
// Note that as of 8.3, iOS doesn't support `datetime` or `week`.
|
// Note that as of 9.3, iOS doesn't support `week`.
|
||||||
|
|
||||||
@media screen and (-webkit-min-device-pixel-ratio: 0) {
|
@media screen and (-webkit-min-device-pixel-ratio: 0) {
|
||||||
input[type="date"],
|
input[type="date"],
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
// WebKit-style focus
|
// WebKit-style focus
|
||||||
|
|
||||||
.tab-focus() {
|
.tab-focus() {
|
||||||
// Default
|
// WebKit-specific. Other browsers will keep their default outline style.
|
||||||
outline: thin dotted;
|
// (Initially tried to also force default via `outline: initial`,
|
||||||
// WebKit
|
// but that seems to erroneously remove the outline in Firefox altogether.)
|
||||||
outline: 5px auto -webkit-focus-ring-color;
|
outline: 5px auto -webkit-focus-ring-color;
|
||||||
outline-offset: -2px;
|
outline-offset: -2px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -214,7 +214,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Collapsable panels (aka, accordion)
|
// Collapsible panels (aka, accordion)
|
||||||
//
|
//
|
||||||
// Wrap a series of panels in `.panel-group` to turn them into an accordion with
|
// Wrap a series of panels in `.panel-group` to turn them into an accordion with
|
||||||
// the help of our collapse JavaScript plugin.
|
// the help of our collapse JavaScript plugin.
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ hr {
|
|||||||
|
|
||||||
// Only display content to screen readers
|
// Only display content to screen readers
|
||||||
//
|
//
|
||||||
// See: http://a11yproject.com/posts/how-to-hide-content/
|
// See: http://a11yproject.com/posts/how-to-hide-content
|
||||||
|
|
||||||
.sr-only {
|
.sr-only {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*!
|
/*!
|
||||||
* Bootstrap v3.3.6 (http://getbootstrap.com)
|
* Bootstrap v3.3.7 (http://getbootstrap.com)
|
||||||
* Copyright 2011-2015 Twitter, Inc.
|
* Copyright 2011-2016 Twitter, Inc.
|
||||||
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -111,7 +111,7 @@
|
|||||||
//** Global background color for active items (e.g., navs or dropdowns).
|
//** Global background color for active items (e.g., navs or dropdowns).
|
||||||
@component-active-bg: @brand-primary;
|
@component-active-bg: @brand-primary;
|
||||||
|
|
||||||
//** Width of the `border` for generating carets that indicator dropdowns.
|
//** Width of the `border` for generating carets that indicate dropdowns.
|
||||||
@caret-width-base: 4px;
|
@caret-width-base: 4px;
|
||||||
//** Carets increase slightly in size for larger components.
|
//** Carets increase slightly in size for larger components.
|
||||||
@caret-width-large: 5px;
|
@caret-width-large: 5px;
|
||||||
|
|||||||
@@ -35,5 +35,10 @@
|
|||||||
"options_ui": {
|
"options_ui": {
|
||||||
"page": "options.html",
|
"page": "options.html",
|
||||||
"chrome_style": false
|
"chrome_style": false
|
||||||
|
},
|
||||||
|
"applicaitons": {
|
||||||
|
"gecko": {
|
||||||
|
"id": "addon@wakatime.com"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user