Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
98 commits
Select commit Hold shift + click to select a range
e97f3f4
initial commit - with basic chrome extension
Arnavkar Jun 22, 2022
cbc66f0
Create README.md
Arnavkar Jun 23, 2022
938fce1
Created new folder structure, removed functions from Chrome quikstart…
Arnavkar Jun 30, 2022
70e0193
Added v1 of timeUtility.js
Jul 14, 2022
98ea2a2
Merged UI work
Jul 14, 2022
fc40b9d
Merge pull request #3 from Arnavkar/main
lucasNlind Jul 14, 2022
70b25be
completed input form buy functionality
Jul 18, 2022
ec9aaa7
Merge pull request #4 from Arnavkar/luke-ui-dev
lucasNlind Jul 18, 2022
52620bc
Added python script to convert all article entries in csv to a readab…
Jul 19, 2022
25ef414
added pie chart + minor form changes
Jul 19, 2022
fde393f
Merge pull request #5 from Arnavkar/luke-ui-dev
lucasNlind Jul 19, 2022
c4ce76a
Layed out skeleton for playerTracker.js
Jul 20, 2022
24e1ff6
Merge branch 'master' of https://github.com/Arnavkar/Morningstar_Case…
Jul 20, 2022
d7720e8
Added additional comments to player Tracker
Jul 20, 2022
6711e42
added news cards and minor form changes
Jul 21, 2022
57eb072
Merge pull request #6 from Arnavkar/luke-ui-dev
lucasNlind Jul 21, 2022
16196d6
added portfolio seciton
Jul 22, 2022
bdfd1e5
Merge pull request #7 from Arnavkar/luke-ui-dev
lucasNlind Jul 22, 2022
9378ef9
completed portfolio section
Jul 22, 2022
494d608
Merge pull request #8 from Arnavkar/luke-ui-dev
lucasNlind Jul 22, 2022
cdd02ec
Added new fields to player tracker.js
Jul 22, 2022
ac6cf90
Didn't save files
Jul 22, 2022
340c105
added extendable news card
Jul 25, 2022
e248549
Merge pull request #9 from Arnavkar/luke-ui-dev
lucasNlind Jul 25, 2022
07d2390
cleaning up assets folder
Jul 25, 2022
b10ffbf
minor aesthetic changes to newscard
Jul 25, 2022
3ffab23
Merge pull request #11 from Arnavkar/luke-ui-dev
lucasNlind Jul 25, 2022
ea42d29
added intro and info pages
Jul 26, 2022
b3cb462
Merge pull request #12 from Arnavkar/luke-ui-dev
lucasNlind Jul 26, 2022
a21d95e
Refactored time mechanisms to track time spent in pause state, time s…
Jul 27, 2022
847d126
Merge pull request #13 from Arnavkar/create_player_data_store
lucasNlind Jul 27, 2022
1c13a92
We are only adding the work we have done in playerTracker nothing els…
AstridV0522 Jul 28, 2022
b49e79c
we worked on the history array
AstridV0522 Jul 28, 2022
e07ba12
Added feature for reactive articles, and tracking how many have been …
Jul 28, 2022
dbfeae3
update playerDataStore and TradingPage
Aug 1, 2022
03889b6
update TradingPage
Aug 1, 2022
56e152d
update playerDataStore and TradingPage
Aug 1, 2022
dff014b
update
Aug 1, 2022
2bd2e42
update
Aug 1, 2022
9d5b83f
update
Aug 1, 2022
7842b85
update
Aug 1, 2022
489a1ac
update
Aug 2, 2022
583e799
update
Aug 2, 2022
c9ccf75
Quick v1 mockup of endPage
Aug 3, 2022
7cdaee1
Fixed merge conflict, retrieved changes to master after article_featu…
Aug 3, 2022
4d84f61
Added cards to hold portfolio snapshot pie charts, put them in the mi…
Aug 3, 2022
135ac8f
update
Aug 3, 2022
568b871
Made sure Piecharts were working with mock holdings Data
Aug 3, 2022
b228983
update
Aug 3, 2022
91ceab6
update
Aug 3, 2022
7e8fb1e
update
Aug 3, 2022
f369848
Merge branch 'master' into Astrid/Trish-PDS
trish-le Aug 3, 2022
ec7f3a1
Merge pull request #14 from Arnavkar/Astrid/Trish-PDS
trish-le Aug 3, 2022
b9a097c
Fixed function name passed in setInterval
Aug 3, 2022
233bf5e
Merged endPage branch into master
Aug 3, 2022
1cd84b4
Add comments about the NAN bug that Arnav and I discussed on Wednesday
Aug 3, 2022
6b0d0cd
NAN bug fixed
Aug 4, 2022
3f0b7d4
Update overconfidence metrics - excessive trading
Aug 4, 2022
ea783be
Add advisor messages
Aug 5, 2022
e70d5e7
Attempt to create advisor card
Aug 5, 2022
26c9d85
Added working page for player to Input Data
Aug 5, 2022
6ebe675
Merge branch 'master' into IntroPage
Aug 5, 2022
5e5c120
Fixed up remaining changes for intro pages and added animations to ar…
Aug 8, 2022
b3ec89d
Changed clock timing, added feature for articles to be rendered in gr…
Aug 8, 2022
a137525
Added portfolio snapshot tracking (NOT YET TESTED)
Aug 8, 2022
0b56ae7
update
Aug 8, 2022
55846b6
Merge branch 'master' into advisor
trish-le Aug 8, 2022
2552b67
Merge pull request #15 from Arnavkar/advisor
trish-le Aug 8, 2022
6873ab2
Update overconfidence metrics
Aug 8, 2022
b4e92c3
Added switch to info page to prompt user about advisor subscription
Aug 8, 2022
1c7668b
Merge branch 'advisor_purchase'
Aug 8, 2022
9a847ac
Update advisor card
Aug 8, 2022
c488ad6
Merge branch 'master' of https://github.com/Arnavkar/Morningstar_Case…
Aug 8, 2022
fd95b2a
Time bug fix, new.js fix, News Card rework
Aug 8, 2022
ac4a5cc
Merged fixes
Aug 8, 2022
2d805bc
Merged master in
Aug 8, 2022
a90749d
fix merge conflict
Aug 8, 2022
f0f5651
Syntax fix, tradingPage
Aug 8, 2022
e27ca52
Updated news
Aug 8, 2022
d8c2406
Merge branch 'master' of https://github.com/Arnavkar/Morningstar_Case…
Aug 8, 2022
6669a79
Hooked up 4/5 metrics to endPage
Aug 8, 2022
92218f7
Merge branch 'master' of https://github.com/Arnavkar/Morningstar_Case…
Aug 8, 2022
311b797
Added final overconfidence metric counting number of balanced portfol…
Aug 9, 2022
ce4e581
last frontend changes
Aug 9, 2022
e0ee347
Merge branch 'master' into luke-ui-dev
lucasNlind Aug 9, 2022
409c812
Merge pull request #16 from Arnavkar/luke-ui-dev
lucasNlind Aug 9, 2022
974c748
visual buttonn changes
Aug 9, 2022
812fbe8
Merge pull request #17 from Arnavkar/simulation-dev
lucasNlind Aug 9, 2022
a5bcdb6
Added hard cap for overconfidence Score, start at 125
Aug 9, 2022
813541f
Fixed overconfidence meter on end Page, added some additional data, a…
Aug 9, 2022
87508f2
fixes
Aug 9, 2022
33a7a92
simulation test
Aug 9, 2022
c0e5b63
More fixes
Aug 9, 2022
8d04230
Fix TradingForm bug in which account balance becomes negative if the …
Aug 9, 2022
895868e
Merge pull request #18 from Arnavkar/form-bug
trish-le Aug 9, 2022
f92b468
hr width change
Aug 9, 2022
0c9f626
Merge branch 'master' of github.com:Arnavkar/Morningstar_CaseStudy
Aug 9, 2022
f564e4a
Build of Github Pages
Aug 10, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.DS_Store
node_modules
/dist


# local env files
Expand Down
13 changes: 13 additions & 0 deletions chromeExtension/button.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
button {
height: 30px;
width: 30px;
outline: none;
margin: 10px;
border: none;
border-radius: 2px;
}

button.current {
box-shadow: 0 0 0 2px white,
0 0 0 4px black;
}
Binary file added chromeExtension/images/get_started128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added chromeExtension/images/get_started16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added chromeExtension/images/get_started32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added chromeExtension/images/get_started48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions chromeExtension/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "Trading Bias Helper",
"description": "Extension to help users beat their own overconfidence bias while putting in trade offers",
"version": "1.0",
"manifest_version": 3,
"icons": {
"16": "/images/get_started16.png",
"32": "/images/get_started32.png",
"48": "/images/get_started48.png",
"128": "/images/get_started128.png"
},
"permissions": [
"tabs",
"storage",
"activeTab",
"scripting",
"debugger",
"unlimitedStorage"
],

"background": {
"service_worker": "/scripts/background.js"
},
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["/scripts/pageTracker.js"]
}
],
"action": {
"default_popup": "/popup/popup.html",
"default_icon": {
"16": "/images/get_started16.png",
"32": "/images/get_started32.png",
"48": "/images/get_started48.png",
"128": "/images/get_started128.png"
}
}

}
11 changes: 11 additions & 0 deletions chromeExtension/popup/popup.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="button.css">
</head>
<body>
<script src="popup.js"></script>
<h1 id = "header">Message Title</h1>
<h2 id = "description">Message Description</h2>
</body>
</html>
1 change: 1 addition & 0 deletions chromeExtension/popup/popup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

162 changes: 162 additions & 0 deletions chromeExtension/scripts/activity.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
'use strict';

class Activity {
addTab(tab) {
if (this.isValidPage(tab) === true) {
if (tab.id && (tab.id != 0)) {
tabs = tabs || [];
var url = new Url(tab.url);
var isDifferentUrl = false;
if (!url.isMatch(currentTab)) {
isDifferentUrl = true;
}

if (this.isNewUrl(url) && !this.isInBlackList(url)) {
var favicon = tab.favIconUrl;
if (favicon === undefined) {
favicon = 'chrome://favicon/' + url.host;
}
var newTab = new Tab(url, favicon);
tabs.push(newTab);
}

if (isDifferentUrl && !this.isInBlackList(url)) {
this.setCurrentActiveTab(url);
var tabUrl = this.getTab(url);
if (tabUrl !== undefined)
tabUrl.incCounter();
this.addTimeInterval(url);
}
}
} else this.closeIntervalForCurrentTab();
}

isValidPage(tab) {//Checks if we are currently at a valid url -> maybe can check for our whitelisted pages?
if (!tab || !tab.url || (tab.url.indexOf('http:') == -1 && tab.url.indexOf('https:') == -1)
|| tab.url.indexOf('chrome://') !== -1
|| tab.url.indexOf('chrome-extension://') !== -1)
return false;
return true;
}

isInBlackList(domain) {
if (setting_black_list !== undefined && setting_black_list.length > 0)
return setting_black_list.find(o => o.isMatch(domain)) !== undefined;
else return false;
}

isLimitExceeded(domain, tab) {
if (setting_restriction_list !== undefined && setting_restriction_list.length > 0) {
var item = setting_restriction_list.find(o => o.url.isMatch(domain));
if (item !== undefined) {
var data = tab.days.find(x => x.date == todayLocalDate());
if (data !== undefined) {
var todayTimeUse = data.summary;
if (todayTimeUse >= item.time) {
return true;
}
}
}
}
return false;
}

wasDeferred(domain){
if (deferredRestrictionsList != undefined){
let defItem = deferredRestrictionsList.find(x => new Url(x.site).isMatch(domain));
if (defItem != null){
let time = defItem.dateOfDeferred;
if (time + DEFERRED_TIMEOUT > new Date().getTime()){
return true;
}
else {
let index = deferredRestrictionsList.indexOf(defItem);
if (index > -1)
deferredRestrictionsList.splice(index, 1);

return false;
}
}
}

return false;
}

isNewUrl(domain) {
if (tabs.length > 0)
return tabs.find(o => o.url.isMatch(domain)) === undefined;
else return true;
}

getTab(domain) {
if (tabs !== undefined)
return tabs.find(o => o.url.isMatch(domain));
}


updateFavicon(tab) {
if (!this.isValidPage(tab)){
return;
}

var url = new Url(tab.url);
var currentTab = this.getTab(url);
if (currentTab !== null && currentTab !== undefined) {
if (tab.favIconUrl !== undefined && tab.favIconUrl !== currentTab.favicon) {
currentTab.favicon = tab.favIconUrl;
}
}
}

setCurrentActiveTab(domain) {
this.closeIntervalForCurrentTab();
currentTab = domain;
this.addTimeInterval(domain);
}

addTimeInterval(domain) {
var item = timeIntervalList.find(o => o.url.isMatch(domain) && o.day == todayLocalDate());
if (item != undefined) {
if (item.day == todayLocalDate())
item.addInterval();
else {
var newInterval = new TimeInterval(todayLocalDate(), domain);
newInterval.addInterval();
timeIntervalList.push(newInterval);
}
} else {
var newInterval = new TimeInterval(todayLocalDate(), domain);
newInterval.addInterval();
timeIntervalList.push(newInterval);
}
}

closeIntervalForCurrentTab(preserveCurrentTab) {
if (currentTab && timeIntervalList != undefined) {
var item = timeIntervalList.find(o => o.url.isMatch(currentTab) && o.day == todayLocalDate());
if (item != undefined)
item.closeInterval();
}

if (!preserveCurrentTab) {
currentTab = null;
}
}

isNeedNotifyView(domain, tab){
if (setting_notification_list !== undefined && setting_notification_list.length > 0) {
var item = setting_notification_list.find(o => o.url.isMatch(domain));
if (item !== undefined) {
var today = todayLocalDate();
var data = tab.days.find(x => x.date == today);
if (data !== undefined) {
var todayTimeUse = data.summary;
if (todayTimeUse == item.time || todayTimeUse % item.time == 0) {
return true;
}
}
}
}
return false;
}
};
68 changes: 68 additions & 0 deletions chromeExtension/scripts/background.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
function checkPermissionsForNotifications(callback, ...props) {
chrome.permissions.contains({
permissions: ["notifications"]
}, function(result) {
if (callback != undefined && result)
callback(...props);
isHasPermissioForNotification = result;
});
}

function addListener() {
//Fires when an active tab in a window changes,
//URL may not be set at the time the event is fired but we can listen to onUpdated events to check when URL is set
chrome.tabs.onActivated.addListener(info => {
chrome.tabs.get(info.tabId, function(tab) {
activity.addTab(tab); //register the tab
});
});

//Fires when a document including it's resources is completely loaded
// chrome.webNavigation.onCompleted.addListener(function(details) {
// chrome.tabs.get(details.tabId, function(tab) {
// activity.updateFavicon(tab);
// });
// });

//fires when chrome extension is installed or updated
chrome.runtime.onInstalled.addListener(details => {
if (details.reason == 'install') {
storage.saveValue(SETTINGS_SHOW_HINT, SETTINGS_SHOW_HINT_DEFAULT);
setDefaultSettings();
}
if (details.reason == 'update') {
storage.saveValue(SETTINGS_SHOW_HINT, SETTINGS_SHOW_HINT_DEFAULT);
checkSettingsImEmpty();
setDefaultValueForNewSettings();
isNeedDeleteTimeIntervalFromTabs = true;
}
});

chrome.storage.onChanged.addListener(function(changes, namespace) {
for (var key in changes) {
if (key === STORAGE_BLACK_LIST) {
loadBlackList();
}
if (key === STORAGE_RESTRICTION_LIST) {
loadRestrictionList();
}
if (key === STORAGE_NOTIFICATION_LIST) {
loadNotificationList();
}
if (key === STORAGE_NOTIFICATION_MESSAGE) {
loadNotificationMessage();
}
if (key === SETTINGS_INTERVAL_INACTIVITY) {
storage.getValue(SETTINGS_INTERVAL_INACTIVITY, function(item) { setting_interval_inactivity = item; });
}
if (key === SETTINGS_VIEW_TIME_IN_BADGE) {
storage.getValue(SETTINGS_VIEW_TIME_IN_BADGE, function(item) { setting_view_in_badge = item; });
}
if (key === SETTINGS_BLOCK_DEFERRAL) {
storage.getValue(SETTINGS_BLOCK_DEFERRAL, function(item) { setting_block_deferral = item; });
}
if (key === SETTINGS_DARK_MODE) {
storage.getValue(SETTINGS_DARK_MODE, function(item) { setting_dark_mode = item; });
}
}
});
13 changes: 13 additions & 0 deletions chromeExtension/scripts/pageTracker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
let newPageOpened = Date.now()
let firstInstance = newPageOpened

console.log(`currentTime is ${newPageOpened}, starting Timer now!`)

document.addEventListener("click", function() {
let secondInstance = Date.now()
let timeElapsed = (secondInstance - firstInstance)/1000
console.log(`Time elapsed since last click is ${timeElapsed} seconds`)
firstInstance = secondInstance
}, false);


42 changes: 42 additions & 0 deletions chromeExtension/scripts/storage.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
'use strict';

class LocalStorage {
loadTabs(name, callback, callbackIsUndefined) {
chrome.storage.local.get(name, function(item) {
if (item[name] !== undefined) {
var result = item[name];
if (result !== undefined)
callback(result);
} else {
if (callbackIsUndefined !== undefined)
callbackIsUndefined();
}
});
}

saveTabs(value, callback) {
chrome.storage.local.set({ tabs: value });
if (callback !== undefined)
callback();
}

saveValue(name, value) {
chrome.storage.local.set({
[name]: value
});
}

getValue(name, callback) {
chrome.storage.local.get(name, function(item) {
if (item !== undefined) {
callback(item[name]);
} else {
console.log(`${name} not found in local storage`)
}
});
}

getMemoryUse(name, callback) {
chrome.storage.local.getBytesInUse(name, callback);
};
}
Loading