Skip to content

Commit

Permalink
Merge pull request #77 from jasonlong/save-normal-chart-state
Browse files Browse the repository at this point in the history
Save normal chart state
  • Loading branch information
jasonlong authored Mar 15, 2017
2 parents 955d7a0 + 481a99c commit 999a3d8
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 26 deletions.
27 changes: 20 additions & 7 deletions chrome/iso.js

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

2 changes: 1 addition & 1 deletion chrome/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Isometric Contributions",
"version": "1.0.17",
"version": "1.0.18",
"description": "Renders an isometric pixel view of GitHub contribution graphs.",
"content_scripts": [ {
"css": [ "iso.css" ],
Expand Down
Binary file modified firefox/isometric-contributions.xpi
Binary file not shown.
27 changes: 20 additions & 7 deletions firefox/isometric-contributions/iso.js

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

2 changes: 1 addition & 1 deletion firefox/isometric-contributions/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Isometric Contributions",
"version": "1.0.17",
"version": "1.0.18",
"description": "Renders an isometric pixel view of GitHub contribution graphs.",
"content_scripts": [ {
"css": [ "iso.css" ],
Expand Down
4 changes: 2 additions & 2 deletions safari/isometric-contributions.safariextension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleShortVersionString</key>
<string>1.0.17</string>
<string>1.0.18</string>
<key>CFBundleVersion</key>
<string>1.0.17</string>
<string>1.0.18</string>
<key>Chrome</key>
<dict>
<key>Database Quota</key>
Expand Down
27 changes: 20 additions & 7 deletions safari/isometric-contributions.safariextension/iso.js

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

16 changes: 15 additions & 1 deletion src/iso.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,13 @@ class Iso
# The storage API is not supported in content scripts.
# https://developer.mozilla.org/Add-ons/WebExtensions/Chrome_incompatibilities#storage
if chrome?.storage?
chrome.storage.local.get ['toggleSetting'], ({toggleSetting}) =>
chrome.storage.local.get ['toggleSetting', 'show2DSetting'], ({toggleSetting, show2DSetting}) =>
this.toggleSetting = toggleSetting ? 'cubes'
this.show2DSetting = show2DSetting ? 'no'
callback()
else
this.toggleSetting = localStorage.toggleSetting ? 'cubes'
this.show2DSetting = localStorage.show2DSetting ? 'no'
callback()

persistSetting: (key, value, callback = ->) ->
Expand Down Expand Up @@ -120,9 +122,21 @@ class Iso
if contributionsBox.hasClass 'show-2d'
($ this).text 'Show normal chart ▾'
contributionsBox.removeClass 'show-2d'
self.persistSetting "show2DSetting", 'no'
self.show2DSetting = 'no'
else
($ this).text 'Hide normal chart ▴'
contributionsBox.addClass 'show-2d'
self.persistSetting "show2DSetting", 'yes'
self.show2DSetting = 'yes'

# Apply user preference
if (this.show2DSetting == "yes")
contributionsBox.addClass 'show-2d'
($ '.ic-2d-toggle').text 'Hide normal chart ▴'
else
contributionsBox.removeClass 'show-2d'
($ '.ic-2d-toggle').text 'Show normal chart ▾'

loadStats: ->
streakLongest = 0
Expand Down

0 comments on commit 999a3d8

Please sign in to comment.