mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-13 17:52:22 +00:00
refactor(grunt and caching): cache icon fonts, spritesmith and use icons from spritesmith for coins notification
This commit is contained in:
parent
fb496de42f
commit
8fdc5327e9
4 changed files with 14 additions and 46 deletions
15
Gruntfile.js
15
Gruntfile.js
|
|
@ -56,7 +56,8 @@ module.exports = function(grunt) {
|
|||
build: {
|
||||
files: [
|
||||
{expand: true, cwd: 'public/', src: 'favicon.ico', dest: 'build/'},
|
||||
{expand: true, cwd: 'public/', src: 'bower_components/habitrpg-shared/dist/spritesmith-*.png', dest: 'build/'}
|
||||
{expand: true, cwd: 'public/', src: 'bower_components/habitrpg-shared/dist/spritesmith.png', dest: 'build/'},
|
||||
{expand: true, cwd: 'public/', src: 'bower_components/bootstrap/dist/fonts/*', dest: 'build/'}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
@ -69,18 +70,14 @@ module.exports = function(grunt) {
|
|||
},
|
||||
src: [
|
||||
'build/*.js', 'build/*.css', 'build/favicon.ico',
|
||||
'build/bower_components/bootstrap/docs/assets/css/*.css',
|
||||
'build/bower_components/habitrpg-shared/dist/*.css'
|
||||
'build/bower_components/habitrpg-shared/dist/*.png',
|
||||
'build/bower_components/bootstrap/dist/fonts/*'
|
||||
],
|
||||
dest: 'make-sure-i-do-not-exist'
|
||||
dest: 'build/*.css'
|
||||
}
|
||||
},
|
||||
|
||||
nodemon: {
|
||||
dev: {
|
||||
ignoredFiles: ['public/*', 'Gruntfile.js', 'CHANGELOG.md', 'views/*', 'build/*', '.idea*', '.git*', '*.log']
|
||||
}
|
||||
},
|
||||
nodemon: { dev: {} },
|
||||
|
||||
watch: {
|
||||
dev: {
|
||||
|
|
|
|||
|
|
@ -33,6 +33,10 @@ alert-sm-mixin()
|
|||
.alert
|
||||
alert-sm-mixin()
|
||||
|
||||
.notification-icon
|
||||
transform: scale(0.8)
|
||||
|
||||
|
||||
// variables
|
||||
|
||||
gpColor = #FBEFC0
|
||||
|
|
@ -95,35 +99,6 @@ borderDarken = 20%
|
|||
border-color: darken(dropColor,borderDarken)
|
||||
color: dropText
|
||||
|
||||
// alert icons
|
||||
|
||||
.icon-gold
|
||||
background: url("/bower_components/habitrpg-shared/img/coin_single_gold.png") no-repeat
|
||||
background-position: center center
|
||||
background-size: 18px
|
||||
width: 14px
|
||||
height: 14px
|
||||
display: inline-block
|
||||
vertical-align: middle
|
||||
|
||||
.icon-silver
|
||||
background: url("/bower_components/habitrpg-shared/img/coin_single_silver.png") no-repeat
|
||||
background-position: center center
|
||||
background-size: 18px
|
||||
width: 14px
|
||||
height: 14px
|
||||
display: inline-block
|
||||
vertical-align: middle
|
||||
|
||||
.icon-death
|
||||
background: url("/bower_components/habitrpg-shared/img/sprites/dead.png") no-repeat
|
||||
background-position: center center
|
||||
background-size: 14px
|
||||
width: 14px
|
||||
height: 14px
|
||||
display: inline-block
|
||||
vertical-align: middle
|
||||
|
||||
.undo-button
|
||||
z-index: 3000
|
||||
position:absolute
|
||||
|
|
|
|||
|
|
@ -94,7 +94,6 @@ habitrpg.controller('NotificationCtrl',
|
|||
$rootScope.$watch('user.items.' + watched, function(before, after){
|
||||
if (after == before) return;
|
||||
if (+after < +before) {
|
||||
Notification.death();
|
||||
//don't want to day "lost a head"
|
||||
if (watched === 'head') watched = 'helm';
|
||||
Notification.text('Lost GP, 1 LVL, ' + watched);
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ angular.module("notificationServices", [])
|
|||
top_offset: 20,
|
||||
align: 'right', //('left', 'right', or 'center')
|
||||
width: 250, //(integer, or 'auto')
|
||||
delay: (type=='error') ? 0 : 7000,
|
||||
delay: (type=='error') ? 0 : 0,
|
||||
allow_dismiss: true,
|
||||
stackup_spacing: 10 // spacing between consecutive stacecked growls.
|
||||
});
|
||||
|
|
@ -25,11 +25,11 @@ angular.module("notificationServices", [])
|
|||
gold = Math.floor(absolute);
|
||||
silver = Math.floor((absolute - gold) * 100);
|
||||
if (gold && silver > 0) {
|
||||
return "" + gold + " <span class='icon-gold'></span> " + silver + " <span class='icon-silver'></span>";
|
||||
return "" + gold + " <span class='notification-icon shop_gold'></span> " + silver + " <span class='notification-icon shop_silver'></span>";
|
||||
} else if (gold > 0) {
|
||||
return "" + gold + " <span class='icon-gold'></span>";
|
||||
return "" + gold + " <span class='notification-icon shop_gold'></span>";
|
||||
} else if (silver > 0) {
|
||||
return "" + silver + " <span class='icon-silver'></span>";
|
||||
return "" + silver + " <span class='notification-icon shop_silver'></span>";
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -60,9 +60,6 @@ angular.module("notificationServices", [])
|
|||
lvl: function(){
|
||||
growl('<span class="glyphicon glyphicon-chevron-up"></span> ' + window.env.t('levelUp'), 'lvl');
|
||||
},
|
||||
death: function(){
|
||||
growl("<span class='glyphicon glyphicon-death'></span> " + window.env.t('respawn'), "death");
|
||||
},
|
||||
error: function(error){
|
||||
growl("<span class='glyphicon glyphicon-exclamation-sign'></span> " + error, "danger");
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue