Skip to content

Commit

Permalink
clean up code
Browse files Browse the repository at this point in the history
  • Loading branch information
jjj201200 committed Dec 8, 2018
1 parent 05949ec commit 3c09555
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/js/modules/background/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export class Background extends Feature {
} else if (reason === 'update' && !hasNewVersion(previousVersion)) {
chrome.notifications.create('bilibili-helper-update', {
type: 'basic',
iconUrl: '../statics/imgs/icon-256.png',
iconUrl: '../statics/imgs/cat.svg',
title: __('extensionNotificationTitle'),
message: __('extensionNotificationExtensionUpdate').replace('%v', version),
});
Expand Down
11 changes: 5 additions & 6 deletions src/js/modules/googleAnalytics/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* Description:
*/

import store from 'store';
import {Feature} from 'Libs/feature';
import {version} from 'Utils';

Expand Down Expand Up @@ -75,11 +74,11 @@ export class GoogleAnalytics extends Feature {
insertGAScriptTag = (UA = 'UA-39765420-2') => {
return new Promise(resolve => {
if (document.getElementsByClassName('ga-script').length === 0) {
const userID = store.get('userID');
let {userID} = this.store || {};
if (!userID) {
this.gaKey = String(Math.random()).slice(2);
store.set('userID', this.gaKey);
} else this.userID = userID;
userID= String(Math.random()).slice(2);
this.store = {userID: userID};
}
const script = `https://www.google-analytics.com/analytics.js`;
//const script = `https://www.google-analytics.com/analytics${debug ? '_debug' : ''}.js`;
window['GoogleAnalyticsObject'] = 'ga';
Expand All @@ -94,7 +93,7 @@ export class GoogleAnalytics extends Feature {
document.head.appendChild(scriptTag);
window.ga('create', UA, 'auto');
window.ga('set', 'checkProtocolTask');
window.ga('set', 'userId', this.userID);
window.ga('set', 'userId', userID);
resolve();
} else resolve();
});
Expand Down
1 change: 0 additions & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
}
],
"icons": {
"256": "statics/imgs/icon-256.png",
"128": "statics/imgs/icon-128.png",
"16": "statics/imgs/icon-16.png",
"32": "statics/imgs/icon-32.png"
Expand Down

0 comments on commit 3c09555

Please sign in to comment.