Skip to content

Commit

Permalink
fix firefox addon
Browse files Browse the repository at this point in the history
  • Loading branch information
Justineo committed Jul 5, 2016
1 parent 23a03c0 commit 196461c
Show file tree
Hide file tree
Showing 9 changed files with 1,287 additions and 89 deletions.
36 changes: 15 additions & 21 deletions Gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,54 +1,48 @@
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var clean = require('gulp-minify-css');
var fs = require('fs');
var exec = require('child_process').exec;
var pack = require('./package.json');
var version = pack.version;

gulp.task('minify-css', function () {
gulp.task('cp:css', function () {
return gulp.src('./src/coplay.css')
.pipe(clean({ keepBreaks: true }))
.pipe(gulp.dest('./extensions/chrome'))
.pipe(gulp.dest('./extensions/firefox/data'));
});

gulp.task('minify-js', function () {
gulp.task('cp:js', function () {
return gulp.src('./src/coplay.js')
.pipe(uglify())
.pipe(gulp.dest('./extensions/chrome'))
.pipe(gulp.dest('./extensions/firefox/data'));
});

gulp.task('pack-chrome-extension', ['minify-css', 'minify-js'], function (cb) {
gulp.task('pack-chrome-extension', ['cp:css', 'cp:js'], function (cb) {
var manifestPath = './extensions/chrome/manifest.json';
var manifest = JSON.parse(fs.readFileSync(manifestPath, { encoding: 'utf8' }));
manifest.version = version;
exec('find . -path \'*/.*\' -prune -o -type f -print | zip ../packed/coplay.zip -@', {
cwd: 'extensions/chrome'
}, function (error, stdout, stderr) {
if (error) {
return cb(error);
} else {
var pack = JSON.parse(fs.readFileSync('./package.json', { encoding: 'utf8' }));
var version = pack.version;
var manifestPath = './extensions/chrome/manifest.json';
var manifest = JSON.parse(fs.readFileSync(manifestPath, { encoding: 'utf8' }));
manifest.version = version;
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, ' '));
cb();
}
});
});

gulp.task('pack-firefox-addon', ['minify-css', 'minify-js'], function (cb) {
exec('cfx xpi --output-file=../packed/coplay.xpi', {
gulp.task('pack-firefox-addon', ['cp:css', 'cp:js'], function (cb) {
var fxPackPath = './extensions/firefox/package.json';
var fxPack = JSON.parse(fs.readFileSync(fxPackPath, { encoding: 'utf8' }));
fxPack.version = version;
fs.writeFileSync(fxPackPath, JSON.stringify(fxPack, null, ' '));
exec('jpm xpi', {
cwd: 'extensions/firefox'
}, function (error, stdout, stderr) {
if (error) {
return cb(error);
} else {
var pack = JSON.parse(fs.readFileSync('./package.json', { encoding: 'utf8' }));
var version = pack.version;
var fxPackPath = './extensions/firefox/package.json';
var fxPack = JSON.parse(fs.readFileSync(fxPackPath, { encoding: 'utf8' }));
fxPack.version = version;
fs.writeFileSync(fxPackPath, JSON.stringify(fxPack, null, ' '));
fs.renameSync('./extensions/firefox/@' + pack.name + '-' + version + '.xpi', './extensions/packed/' + pack.name + '.xpi');
cb();
}
});
Expand Down
116 changes: 98 additions & 18 deletions extensions/chrome/coplay.css
Original file line number Diff line number Diff line change
@@ -1,18 +1,98 @@
#coplay{position:fixed;left:2em;bottom:0;width:3em;height:3em;z-index:8192;border:2px solid rgba(255,255,255,.4);border-bottom:none;background-color:rgba(0,0,0,.75);background-clip:padding-box;transition:width .5s}
#coplay.active{width:40em}
#coplay.active #coplay-toggle{color:#c33;text-shadow:0 1px 0 #333}
#coplay *{box-sizing:border-box}
#coplay button,#coplay input{float:left;height:3em;border:none;background-color:transparent;color:#eee;font-size:inherit;font-family:inherit;line-height:3em;outline:0}
#coplay input{width:11em;padding:0 1em;font-family:Consolas,monospace;text-align:left}
#coplay button+button,#coplay button+input,#coplay input+button,#coplay input+input{border-left:none}
#coplay input:-moz-placeholder{color:#999}
#coplay input::-moz-placeholder{color:#999}
#coplay input::-webkit-input-placeholder{color:#999}
#coplay input:focus:-moz-placeholder{color:#ccc}
#coplay input:focus::-moz-placeholder{color:#ccc}
#coplay input:focus::-webkit-input-placeholder{color:#ccc}
#coplay input:focus{color:#fff;background-color:rgba(255,255,255,.3)}
#coplay button{width:3em;padding:0;border-radius:0;text-align:center}
#coplay button:hover:not(:disabled){color:#fff;text-shadow:0 1px 0 #111;background-color:rgba(255,255,255,.5)}
#coplay button:not(:disabled){cursor:pointer}
#coplay button:disabled{opacity:.3}
#coplay {
position: fixed;
left: 2em;
bottom: 0;
width: 3em;
height: 3em;
z-index: 8192;
border: 2px solid rgba(255, 255, 255, 0.4);
border-bottom: none;
background-color: rgba(0, 0, 0, 0.75);
background-clip: padding-box;
transition: width 0.5s;
}

#coplay.active {
width: 40em;
}

#coplay.active #coplay-toggle {
color: #c33;
text-shadow: 0 1px 0 #333;
}

#coplay * {
box-sizing: border-box;
}

#coplay input,
#coplay button {
float: left;
height: 3em;
border: none;
background-color: transparent;
color: #eee;
font-size: inherit;
font-family: inherit;
line-height: 3em;
outline: none;
}

#coplay input {
width: 11em;
padding: 0 1em;
font-family: Consolas, monospace;
text-align: left;
}

#coplay input + input,
#coplay input + button,
#coplay button + input,
#coplay button + button {
border-left: none;
}

#coplay input:-moz-placeholder {
color: #999;
}
#coplay input::-moz-placeholder {
color: #999;
}
#coplay input::-webkit-input-placeholder {
color: #999;
}
#coplay input:focus:-moz-placeholder {
color: #ccc;
}
#coplay input:focus::-moz-placeholder {
color: #ccc;
}
#coplay input:focus::-webkit-input-placeholder {
color: #ccc;
}

#coplay input:focus {
color: #fff;
background-color: rgba(255, 255, 255, 0.3);
}

#coplay button {
width: 3em;
padding: 0;
border-radius: 0;
text-align: center;
}

#coplay button:hover:not(:disabled) {
color: #fff;
text-shadow: 0 1px 0 #111;
background-color: rgba(255, 255, 255, 0.5);
}

#coplay button:not(:disabled) {
cursor: pointer;
}

#coplay button:disabled {
opacity: 0.3;
}
Loading

0 comments on commit 196461c

Please sign in to comment.