Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
43 changes: 39 additions & 4 deletions chrome/iso.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified firefox/isometric-contributions.xpi
Binary file not shown.
43 changes: 39 additions & 4 deletions firefox/isometric-contributions/iso.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 39 additions & 4 deletions safari/isometric-contributions.safariextension/iso.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 27 additions & 3 deletions src/iso.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,19 @@ class Iso

constructor: (target) ->
if target
graphContainer = ($ '.js-contribution-graph').parent()[0]
if graphContainer
observer = new MutationObserver (mutations) =>
isGraphAdded = mutations.find (mutation) ->
[].find.call mutation.addedNodes, (node) ->
node.className == "js-contribution-graph"
if isGraphAdded
this.generateIsometricChart()

observer.observe(graphContainer, { childList: true })

this.getSettings =>
this.initUI()
this.loadStats()
this.renderIsometricChart()
this.generateIsometricChart()

getSettings: (callback) ->
# Check for user preference, if chrome.storage is available.
Expand All @@ -44,6 +53,20 @@ class Iso
localStorage[key] = value
callback()

generateIsometricChart: ->
this.resetValues()
this.initUI()
this.loadStats()
this.renderIsometricChart()

resetValues: ->
yearTotal = 0
maxCount = 0
bestDay = null
firstDay = null
lastDay = null
contributionsBox = null

initUI: ->
($ '<div class="ic-contributions-wrapper"></div>')
.insertBefore ($ '.js-calendar-graph')
Expand Down Expand Up @@ -86,6 +109,7 @@ class Iso
($ this).addClass 'active'

self.persistSetting "toggleSetting", option
self.toggleSetting = option

# Apply user preference
($ ".ic-toggle-option.#{this.toggleSetting}").addClass 'active'
Expand Down