This repository has been archived by the owner on Jun 13, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b9be7b5
Showing
377 changed files
with
58,317 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
module.exports = function(grunt) { | ||
grunt.initConfig({ | ||
concat: { | ||
js : { | ||
src : [ | ||
'config/*.js', | ||
'notifications.js', | ||
'controllers/**/*.js', | ||
'handlers/*.js', | ||
'models/*.js' | ||
], | ||
dest : 'js/notifications.min.js' | ||
} | ||
}, | ||
uglify : { | ||
js: { | ||
files: { | ||
'js/notifications.min.js' : [ 'js/notifications.min.js' ] | ||
} | ||
} | ||
}, | ||
less: { | ||
development: { | ||
options: { | ||
compress: true, | ||
yuicompress: true, | ||
optimization: 2 | ||
}, | ||
files: { | ||
// target.css file: source.less file | ||
"css/notifications.css": "css/less/notifications.less" | ||
} | ||
} | ||
}, | ||
watch: { | ||
styles: { | ||
files: [ | ||
'css/less/*.less', | ||
], // which files to watch | ||
tasks: [ | ||
'less' | ||
], | ||
options: { | ||
nospawn: true, | ||
debounceDelay: 250 | ||
} | ||
}, | ||
scripts: { | ||
files: [ | ||
'config/*.js', | ||
'notifications.js', | ||
'controllers/**/*.js', | ||
'handlers/*.js', | ||
'models/*.js' | ||
], // which files to watch | ||
tasks: [ | ||
'concat' // , 'uglify' | ||
], | ||
options: { | ||
nospawn: true, | ||
debounceDelay: 250 | ||
} | ||
} | ||
} | ||
}); | ||
|
||
grunt.loadNpmTasks('grunt-contrib-less'); | ||
grunt.loadNpmTasks('grunt-contrib-watch'); | ||
grunt.loadNpmTasks('grunt-contrib-concat'); | ||
grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
|
||
grunt.registerTask('default', ['watch']); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
var routes = { | ||
'/': ['pages', 'home'], | ||
'/account': ['accounts', 'edit'], | ||
'/messages/view/([0-9]+)': ['messages', 'view'], | ||
// easy way to do a catch-all | ||
'.*': ['pages', 'not_found'] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
var AccountsEditController = Composer.Controller.extend({ | ||
inject: notifications.main_container_selector, | ||
el: false, | ||
className: 'accounts', | ||
|
||
elements: { | ||
|
||
}, | ||
|
||
events: { | ||
|
||
}, | ||
|
||
_tmp_data: false, | ||
|
||
|
||
init: function(data) | ||
{ | ||
this.with_bind(notifications.account, 'change:addon_data', this.render.bind(this)); | ||
this.render(); | ||
|
||
return this; | ||
}, | ||
|
||
|
||
render: function() | ||
{ | ||
data = {} | ||
|
||
|
||
|
||
console.log('addon_data: ', notifications.account.get('addon_data')); | ||
if (!notifications.account.get('addon_data').access_token) | ||
{ | ||
var html = notifications.render_template('pages_loading', data); | ||
} | ||
else | ||
{ | ||
var html = notifications.render_template('accounts_edit', data); | ||
} | ||
|
||
|
||
this.html(html); | ||
|
||
return this; | ||
}, | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
var AccountsNavBarController = Composer.Controller.extend({ | ||
inject: '#nav', | ||
el: false, | ||
template: 'accounts_nav_bar', | ||
|
||
elements: { | ||
|
||
}, | ||
|
||
events: { | ||
|
||
}, | ||
|
||
_tmp_data: false, | ||
|
||
|
||
init: function(data) | ||
{ | ||
console.log('data: ', this.id); | ||
|
||
this.with_bind(notifications.account, 'change:addon_exists', this.render.bind(this)); | ||
|
||
this.render(); | ||
|
||
return this; | ||
}, | ||
|
||
|
||
render: function() | ||
{ | ||
console.log('RENDERING NAV BAR'); | ||
|
||
data = { | ||
id: this.id | ||
} | ||
|
||
var html = notifications.render_template(this.template, data); | ||
this.html(html); | ||
|
||
if (notifications.account.get('addon_exists') == false) | ||
this.track_subcontroller('right_nav', function() { | ||
return new DownloadButtonController({ | ||
style: 'nav', | ||
inject: '#nav_right' | ||
}); | ||
}); | ||
else | ||
this.track_subcontroller('right_nav', function() { | ||
return new AccountsNavBarDropdownController(); | ||
}); | ||
|
||
|
||
return this; | ||
}, | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
var AccountsNavBarDropdownController = Composer.Controller.extend({ | ||
inject: '#nav_right', | ||
tag: 'li', | ||
el: false, | ||
template: 'accounts_nav_bar_dropdown', | ||
|
||
elements: { | ||
|
||
}, | ||
|
||
events: { | ||
'click a': 'handle_dropdown' | ||
}, | ||
|
||
_tmp_data: false, | ||
|
||
|
||
init: function(data) | ||
{ | ||
this.render(); | ||
|
||
return this; | ||
}, | ||
|
||
|
||
render: function() | ||
{ | ||
var html = notifications.render_template(this.template, data); | ||
this.html(html); | ||
|
||
return this; | ||
}, | ||
|
||
handle_dropdown: function(e) { | ||
/* | ||
e.preventDefault(); | ||
return false; | ||
*/ | ||
} | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
var DownloadButtonController = Composer.Controller.extend({ | ||
inject: null, // overridden | ||
style: null, // 'nav' | 'big' | ||
el: false, | ||
tag: 'li', | ||
|
||
elements: { | ||
|
||
}, | ||
|
||
events: { | ||
'click a': 'do_install' | ||
}, | ||
|
||
_tmp_data: false, | ||
|
||
|
||
init: function(data) | ||
{ | ||
this.render(); | ||
|
||
return this; | ||
}, | ||
|
||
|
||
render: function() | ||
{ | ||
console.log('RENDERING NAV BAR'); | ||
|
||
data = { | ||
browser: this.get_browser() | ||
} | ||
|
||
switch(this.style) { | ||
case 'nav': | ||
|
||
if (data.browser == 'Other') | ||
return console.log('Other browser not supported here :('); | ||
|
||
var template = 'download_button_nav' | ||
break; | ||
case 'big': | ||
|
||
var template = 'download_button_big' | ||
break; | ||
} | ||
|
||
var html = notifications.render_template(template, data); | ||
this.html(html); | ||
|
||
return this; | ||
}, | ||
|
||
do_install: function(e) { | ||
|
||
e.preventDefault(); | ||
|
||
if (this.get_browser() == 'Chrome') | ||
{ | ||
console.log('Trying to install from webstore') | ||
chrome.webstore.install(); | ||
} | ||
else | ||
{ | ||
alert('This browser is not supported yet. Try Chrome.'); | ||
} | ||
|
||
return false; | ||
}, | ||
|
||
get_browser: function() { | ||
if (window.chrome) | ||
return 'Chrome'; | ||
else if (navigator.userAgent.toLowerCase().indexOf('firefox') > -1) | ||
return 'Firefox'; | ||
else | ||
return 'Other'; | ||
} | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
var MessagesViewController = Composer.Controller.extend({ | ||
inject: notifications.main_container_selector, | ||
el: false, | ||
template: 'messages_view', | ||
|
||
elements: { | ||
|
||
}, | ||
|
||
events: { | ||
|
||
}, | ||
|
||
_tmp_data: false, | ||
|
||
|
||
init: function(data) | ||
{ | ||
console.log('data: ', this.id); | ||
this.render(); | ||
|
||
return this; | ||
}, | ||
|
||
|
||
render: function() | ||
{ | ||
data = { | ||
id: this.id | ||
} | ||
|
||
var html = notifications.render_template(this.template, data); | ||
this.html(html); | ||
|
||
return this; | ||
}, | ||
}); | ||
|
Oops, something went wrong.