suvii 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -0
- data/.travis.yml +10 -0
- data/.yardopts +1 -0
- data/CHANGELOG.md +1 -0
- data/CONTRIBUTING.md +47 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +51 -0
- data/Rakefile +7 -0
- data/lib/suvii.rb +40 -0
- data/lib/suvii/cache.rb +24 -0
- data/lib/suvii/extract.rb +58 -0
- data/lib/suvii/extract/targz.rb +49 -0
- data/lib/suvii/extract/zip.rb +19 -0
- data/lib/suvii/http.rb +31 -0
- data/suvii.gemspec +23 -0
- data/test/acceptance_test.rb +29 -0
- data/test/cache_test.rb +42 -0
- data/test/extract/targz_test.rb +28 -0
- data/test/extract/zip_test.rb +28 -0
- data/test/extract_test.rb +26 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/.gitattributes +6 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/.jshintrc +15 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/Gulpfile.js +167 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/LICENSE +21 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/README.md +29 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/bower.json +36 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/ca.min.js +11 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/da.min.js +9 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/de.min.js +9 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/es.min.js +9 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/es_ar.min.js +9 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/fa.min.js +10 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/fi.min.js +9 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/fr.min.js +10 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/he.min.js +9 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/id.min.js +11 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/it.min.js +8 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/ko.min.js +10 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/pl.min.js +9 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/pt.min.js +11 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/ro.min.js +13 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/ru.min.js +8 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/tr.min.js +10 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/langs/zh_cn.min.js +10 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/plugins/base64/trumbowyg.base64.js +74 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/plugins/base64/trumbowyg.base64.min.js +1 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/plugins/colors/trumbowyg.colors.js +69 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/plugins/colors/trumbowyg.colors.min.js +1 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/plugins/colors/ui/images/icons-2x.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/plugins/colors/ui/images/icons.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/plugins/colors/ui/trumbowyg.colors.css +55 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/plugins/colors/ui/trumbowyg.colors.min.css +2 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/plugins/upload/trumbowyg.upload.js +140 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/plugins/upload/trumbowyg.upload.min.js +1 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/trumbowyg.js +1124 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/trumbowyg.min.js +2 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/ui/images/icons-2x.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/ui/images/icons.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/ui/trumbowyg.css +471 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/dist/ui/trumbowyg.min.css +2 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/examples/css/main.css +14 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/examples/index.html +41 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/examples/plugins/colors.html +49 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/index.html +252 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/package.json +48 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/plugins/base64/trumbowyg.base64.js +74 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/plugins/colors/Gulpfile.js +101 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/plugins/colors/trumbowyg.colors.js +69 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/plugins/colors/ui/images/icons-2x/backcolor.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/plugins/colors/ui/images/icons-2x/forecolor.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/plugins/colors/ui/images/icons/backcolor.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/plugins/colors/ui/images/icons/forecolor.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/plugins/colors/ui/sass/trumbowyg.colors.scss +65 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/plugins/upload/trumbowyg.upload.js +140 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/plugins/upload/trumbowyg.upload.php +49 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/ca.js +58 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/da.js +56 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/de.js +56 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/en.js +14 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/es.js +56 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/es_ar.js +56 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/fa.js +57 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/fi.js +56 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/fr.js +57 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/he.js +58 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/id.js +58 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/it.js +55 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/ko.js +57 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/pl.js +56 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/pt.js +58 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/ro.js +60 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/ru.js +55 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/tr.js +57 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/langs/zh_cn.js +57 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/trumbowyg.js +1113 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/attachement.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/barre.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/bold.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/center-align.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/close.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/formatting.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/fullscreen-exit.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/fullscreen.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/gras.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/horizontal-rule.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/image.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/italic.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/justify-align.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/left-align.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/link.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/ordered-list.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/right-align.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/souligne.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/strikethrough.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/underline.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/unordered-list.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/video.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons-2x/view-html.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/attachement.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/barre.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/bold.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/center-align.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/close.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/formatting.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/fullscreen-exit.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/fullscreen.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/gras.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/horizontal-rule.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/image.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/italic.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/justify-align.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/left-align.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/link.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/ordered-list.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/right-align.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/souligne.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/strikethrough.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/underline.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/unordered-list.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/video.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/images/icons/view-html.png +0 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/sass/mixins/_sprite-pos.scss +7 -0
- data/test/fixtures/results/Trumbowyg-1.1.7/src/ui/sass/trumbowyg.scss +564 -0
- data/test/fixtures/trumbowyg.tar.gz +0 -0
- data/test/fixtures/trumbowyg.zip +0 -0
- data/test/http_test.rb +61 -0
- data/test/test_helper.rb +24 -0
- metadata +409 -0
@@ -0,0 +1,101 @@
|
|
1
|
+
var gulp = require('gulp'),
|
2
|
+
$ = require('gulp-load-plugins')(),
|
3
|
+
path = require('path'),
|
4
|
+
spritesmith = require('gulp.spritesmith');
|
5
|
+
|
6
|
+
var paths = {
|
7
|
+
sprites: {
|
8
|
+
'icons': 'ui/images/icons/**.png',
|
9
|
+
'icons-2x': 'ui/images/icons-2x/**.png'
|
10
|
+
},
|
11
|
+
mainStyle: 'ui/sass/trumbowyg.colors.scss',
|
12
|
+
styles: {
|
13
|
+
sass: 'ui/sass',
|
14
|
+
includePaths: ['ui/sass', '../../src/ui/sass/mixins']
|
15
|
+
}
|
16
|
+
};
|
17
|
+
|
18
|
+
var pkg = require('../../package.json');
|
19
|
+
var banner = ['/**',
|
20
|
+
' * <%= pkg.title %> v<%= pkg.version %> - <%= pkg.description %>',
|
21
|
+
' * <%= description %>',
|
22
|
+
' * ------------------------',
|
23
|
+
' * @link <%= pkg.homepage %>',
|
24
|
+
' * @license <%= pkg.license %>',
|
25
|
+
' * @author <%= pkg.author.name %>',
|
26
|
+
' * Twitter : @AlexandreDemode',
|
27
|
+
' * Website : <%= pkg.author.url.replace("http://", "") %>',
|
28
|
+
' */',
|
29
|
+
'\n'].join('\n');
|
30
|
+
var bannerLight = ['/** <%= pkg.title %> v<%= pkg.version %> - <%= pkg.description %>',
|
31
|
+
' - <%= pkg.homepage.replace("http://", "") %>',
|
32
|
+
' - License <%= pkg.license %>',
|
33
|
+
' - Author : <%= pkg.author.name %>',
|
34
|
+
' / <%= pkg.author.url.replace("http://", "") %>',
|
35
|
+
' */',
|
36
|
+
'\n'].join('');
|
37
|
+
|
38
|
+
|
39
|
+
|
40
|
+
gulp.task('sprites', function(){
|
41
|
+
return makeSprite() && makeSprite('-2x');
|
42
|
+
});
|
43
|
+
function makeSprite(resolution){
|
44
|
+
if(!resolution)
|
45
|
+
resolution = '';
|
46
|
+
|
47
|
+
var sprite = gulp.src(paths.sprites['icons' + resolution])
|
48
|
+
.pipe(spritesmith({
|
49
|
+
imgName: 'icons' + resolution + '.png',
|
50
|
+
cssName: '_sprite' + resolution + '.scss',
|
51
|
+
cssTemplate: function(params){
|
52
|
+
var output = '', e;
|
53
|
+
for(var i in params.items){
|
54
|
+
e = params.items[i];
|
55
|
+
output += '$' + e.name + resolution + ': ' + e.px.offset_x + ' ' + e.px.offset_y + ';\n';
|
56
|
+
}
|
57
|
+
if(params.items.length > 0){
|
58
|
+
output += '\n\n';
|
59
|
+
output += '$sprite-height' + resolution + ': ' + params.items[0].px.total_height + ';\n';
|
60
|
+
output += '$sprite-width' + resolution + ': ' + params.items[0].px.total_width + ';\n';
|
61
|
+
output += '$icons' + resolution + ': "./images/icons' + resolution + '.png";';
|
62
|
+
}
|
63
|
+
|
64
|
+
return output;
|
65
|
+
}
|
66
|
+
}));
|
67
|
+
sprite.img.pipe(gulp.dest('../../dist/plugins/colors/ui/images/'));
|
68
|
+
sprite.css.pipe(gulp.dest(paths.styles.sass));
|
69
|
+
return sprite.css;
|
70
|
+
}
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
gulp.task("styles", ["sprites"], function(){
|
75
|
+
return gulp.src(paths.mainStyle)
|
76
|
+
.pipe($.sass({
|
77
|
+
sass: paths.styles.sass,
|
78
|
+
includePaths: paths.styles.includePaths
|
79
|
+
}))
|
80
|
+
.pipe($.autoprefixer(["last 1 version", "> 1%", "ff >= 20", "ie >= 8", "opera >= 12", "Android >= 2.2"], { cascade: true }))
|
81
|
+
.pipe($.header(banner, { pkg: pkg, description: "Colors plugin stylesheet for Trumbowyg editor" }))
|
82
|
+
.pipe(gulp.dest("../../dist/plugins/colors/ui/"))
|
83
|
+
.pipe($.size({ title: "trumbowyg.colors.css" }))
|
84
|
+
.pipe($.rename({ suffix: ".min" })) // génère une version minimifié
|
85
|
+
.pipe($.minifyCss())
|
86
|
+
.pipe($.header(bannerLight, { pkg: pkg }))
|
87
|
+
.pipe(gulp.dest("../../dist/plugins/colors/ui/"))
|
88
|
+
.pipe($.size({ title: "trumbowyg.colors.min.css" }));
|
89
|
+
});
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
gulp.task('watch', function(){
|
94
|
+
gulp.watch(paths.mainStyle, ['styles']);
|
95
|
+
});
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
gulp.task('build', ['styles']);
|
100
|
+
|
101
|
+
gulp.task('default', ['build', 'watch']);
|
@@ -0,0 +1,69 @@
|
|
1
|
+
/* ===========================================================
|
2
|
+
* trumbowyg.colors.js v1.0
|
3
|
+
* Colors picker plugin for Trumbowyg
|
4
|
+
* http://alex-d.github.com/Trumbowyg
|
5
|
+
* ===========================================================
|
6
|
+
* Author : Alexandre Demode (Alex-D)
|
7
|
+
* Twitter : @AlexandreDemode
|
8
|
+
* Website : alex-d.fr
|
9
|
+
*/
|
10
|
+
|
11
|
+
(function($){
|
12
|
+
'use strict';
|
13
|
+
|
14
|
+
$.extend(true, $.trumbowyg, {
|
15
|
+
langs: {
|
16
|
+
en: {
|
17
|
+
foreColor: "Text color",
|
18
|
+
backColor: "Background color"
|
19
|
+
},
|
20
|
+
fr: {
|
21
|
+
foreColor: "Couleur du text",
|
22
|
+
backColor: "Couleur de fond"
|
23
|
+
}
|
24
|
+
}
|
25
|
+
});
|
26
|
+
|
27
|
+
// Create btnsDef entry
|
28
|
+
$.extend(true, $.trumbowyg, {
|
29
|
+
opts: {
|
30
|
+
btnsDef: {}
|
31
|
+
}
|
32
|
+
});
|
33
|
+
|
34
|
+
// Set default colors
|
35
|
+
if(!$.trumbowyg.opts.colors)
|
36
|
+
$.trumbowyg.opts.colors = ['ffffff', '000000', 'eeece1', '1f497d', '4f81bd', 'c0504d', '9bbb59', '8064a2', '4bacc6', 'f79646', 'ffff00', 'f2f2f2', '7f7f7f', 'ddd9c3', 'c6d9f0', 'dbe5f1', 'f2dcdb', 'ebf1dd', 'e5e0ec', 'dbeef3', 'fdeada', 'fff2ca', 'd8d8d8', '595959', 'c4bd97', '8db3e2', 'b8cce4', 'e5b9b7', 'd7e3bc', 'ccc1d9', 'b7dde8', 'fbd5b5', 'ffe694', 'bfbfbf', '3f3f3f', '938953', '548dd4', '95b3d7', 'd99694', 'c3d69b', 'b2a2c7', 'b7dde8', 'fac08f', 'f2c314', 'a5a5a5', '262626', '494429', '17365d', '366092', '953734', '76923c', '5f497a', '92cddc', 'e36c09', 'c09100', '7f7f7f', '0c0c0c', '1d1b10', '0f243e', '244061', '632423', '4f6128', '3f3151', '31859b', '974806', '7f6000'];
|
37
|
+
|
38
|
+
// Add all colors in two dropdowns
|
39
|
+
$.extend(true, $.trumbowyg, {
|
40
|
+
opts: {
|
41
|
+
btnsDef: {
|
42
|
+
foreColor: {
|
43
|
+
dropdown: buildDropdown('foreColor')
|
44
|
+
},
|
45
|
+
backColor: {
|
46
|
+
dropdown: buildDropdown('backColor')
|
47
|
+
}
|
48
|
+
}
|
49
|
+
}
|
50
|
+
});
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
function buildDropdown(func){
|
55
|
+
var dropdown = [];
|
56
|
+
|
57
|
+
$.each($.trumbowyg.opts.colors, function(i, color){
|
58
|
+
var btn = '_' + func + color;
|
59
|
+
$.trumbowyg.opts.btnsDef[btn] = {
|
60
|
+
func: func,
|
61
|
+
param: '#' + color,
|
62
|
+
style: 'background-color: #' + color + ';'
|
63
|
+
};
|
64
|
+
dropdown.push(btn);
|
65
|
+
});
|
66
|
+
|
67
|
+
return dropdown;
|
68
|
+
}
|
69
|
+
})(jQuery);
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,65 @@
|
|
1
|
+
@import "sprite";
|
2
|
+
@import "sprite-2x";
|
3
|
+
@import "sprite-pos";
|
4
|
+
|
5
|
+
.foreColor-trumbowyg-dropdown,
|
6
|
+
.backColor-trumbowyg-dropdown {
|
7
|
+
width: 264px;
|
8
|
+
padding: 7px 5px;
|
9
|
+
|
10
|
+
button {
|
11
|
+
display: block;
|
12
|
+
position: relative;
|
13
|
+
float: left;
|
14
|
+
text-indent: -9999px;
|
15
|
+
height: 20px;
|
16
|
+
width: 20px;
|
17
|
+
border: 1px solid #333;
|
18
|
+
padding: 0;
|
19
|
+
margin: 2px;
|
20
|
+
|
21
|
+
&:hover,
|
22
|
+
&:focus {
|
23
|
+
&::after {
|
24
|
+
content: " ";
|
25
|
+
display: block;
|
26
|
+
height: 27px;
|
27
|
+
width: 27px;
|
28
|
+
background: inherit;
|
29
|
+
position: absolute;
|
30
|
+
top: -5px;
|
31
|
+
left: -5px;
|
32
|
+
border: 1px solid #FFF;
|
33
|
+
box-shadow: #000 0 0 2px;
|
34
|
+
z-index: 10;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
/*
|
43
|
+
* Buttons icons
|
44
|
+
*/
|
45
|
+
.trumbowyg-button-pane li button {
|
46
|
+
&.trumbowyg-foreColor-button,
|
47
|
+
&.trumbowyg-backColor-button {
|
48
|
+
background-image: url($icons);
|
49
|
+
}
|
50
|
+
|
51
|
+
&.trumbowyg-foreColor-button { @include sprite-pos($forecolor); }
|
52
|
+
&.trumbowyg-backColor-button { @include sprite-pos($backcolor); }
|
53
|
+
}
|
54
|
+
|
55
|
+
@media only screen and (-webkit-min-device-pixel-ratio: 1.3), only screen and (min--moz-device-pixel-ratio: 1.3), only screen and (-o-min-device-pixel-ratio: 4/3), only screen and (min-device-pixel-ratio: 1.3), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx){
|
56
|
+
.trumbowyg-button-pane li button {
|
57
|
+
&.trumbowyg-foreColor-button,
|
58
|
+
&.trumbowyg-backColor-button {
|
59
|
+
background-image: url($icons-2x) !important;
|
60
|
+
}
|
61
|
+
|
62
|
+
&.trumbowyg-foreColor-button { @include sprite-pos($forecolor-2x, true); }
|
63
|
+
&.trumbowyg-backColor-button { @include sprite-pos($backcolor-2x, true); }
|
64
|
+
}
|
65
|
+
}
|
@@ -0,0 +1,140 @@
|
|
1
|
+
/* ===========================================================
|
2
|
+
* trumbowyg.upload.js v1.0
|
3
|
+
* Upload plugin for Trumbowyg
|
4
|
+
* http://alex-d.github.com/Trumbowyg
|
5
|
+
* ===========================================================
|
6
|
+
* Author : Alexandre Demode (Alex-D)
|
7
|
+
* Twitter : @AlexandreDemode
|
8
|
+
* Website : alex-d.fr
|
9
|
+
*/
|
10
|
+
|
11
|
+
(function($){
|
12
|
+
'use strict';
|
13
|
+
|
14
|
+
addXhrProgressEvent();
|
15
|
+
|
16
|
+
$.extend(true, $.trumbowyg, {
|
17
|
+
langs: {
|
18
|
+
en: {
|
19
|
+
upload: "Upload",
|
20
|
+
file: "File",
|
21
|
+
uploadError: "Error"
|
22
|
+
},
|
23
|
+
fr: {
|
24
|
+
upload: "Envoi",
|
25
|
+
file: "Fichier",
|
26
|
+
uploadError: "Erreur"
|
27
|
+
}
|
28
|
+
},
|
29
|
+
|
30
|
+
upload: {
|
31
|
+
serverPath: './src/plugins/upload/trumbowyg.upload.php'
|
32
|
+
},
|
33
|
+
|
34
|
+
opts: {
|
35
|
+
btnsDef: {
|
36
|
+
upload: {
|
37
|
+
func: function(params, tbw){
|
38
|
+
var file,
|
39
|
+
pfx = tbw.o.prefix;
|
40
|
+
|
41
|
+
var $modal = tbw.openModalInsert(
|
42
|
+
// Title
|
43
|
+
tbw.lang.upload,
|
44
|
+
|
45
|
+
// Fields
|
46
|
+
{
|
47
|
+
file: {
|
48
|
+
type: 'file',
|
49
|
+
required: true
|
50
|
+
},
|
51
|
+
alt: {
|
52
|
+
label: 'description'
|
53
|
+
}
|
54
|
+
},
|
55
|
+
|
56
|
+
// Callback
|
57
|
+
function(){
|
58
|
+
var data = new FormData();
|
59
|
+
data.append('fileToUpload', file);
|
60
|
+
|
61
|
+
if($('.' + pfx +'progress', $modal).length === 0)
|
62
|
+
$('.' + pfx + 'modal-title', $modal)
|
63
|
+
.after(
|
64
|
+
$('<div/>', {
|
65
|
+
'class': pfx +'progress'
|
66
|
+
})
|
67
|
+
.append(
|
68
|
+
$('<div/>', {
|
69
|
+
'class': pfx +'progress-bar'
|
70
|
+
})
|
71
|
+
)
|
72
|
+
);
|
73
|
+
|
74
|
+
$.ajax({
|
75
|
+
url: $.trumbowyg.upload.serverPath,
|
76
|
+
type: 'POST',
|
77
|
+
data: data,
|
78
|
+
cache: false,
|
79
|
+
dataType: 'json',
|
80
|
+
processData: false,
|
81
|
+
contentType: false,
|
82
|
+
|
83
|
+
progressUpload: function(e){
|
84
|
+
$('.' + pfx + 'progress-bar').stop().animate({
|
85
|
+
width: Math.round(e.loaded * 100 / e.total) + '%'
|
86
|
+
}, 200);
|
87
|
+
},
|
88
|
+
|
89
|
+
success: function(data){
|
90
|
+
if(data.message == "uploadSuccess") {
|
91
|
+
tbw.execCmd('insertImage', data.file);
|
92
|
+
setTimeout(function(){
|
93
|
+
tbw.closeModal();
|
94
|
+
}, 250);
|
95
|
+
} else {
|
96
|
+
tbw.addErrorOnModalField(
|
97
|
+
$('input[type=file]', $modal),
|
98
|
+
tbw.lang[data.message]
|
99
|
+
);
|
100
|
+
}
|
101
|
+
},
|
102
|
+
error: function(){
|
103
|
+
tbw.addErrorOnModalField(
|
104
|
+
$('input[type=file]', $modal),
|
105
|
+
tbw.lang.uploadError
|
106
|
+
);
|
107
|
+
}
|
108
|
+
});
|
109
|
+
}
|
110
|
+
);
|
111
|
+
|
112
|
+
$('input[type=file]').on('change', function(e){
|
113
|
+
file = e.target.files[0];
|
114
|
+
});
|
115
|
+
}
|
116
|
+
}
|
117
|
+
}
|
118
|
+
}
|
119
|
+
});
|
120
|
+
|
121
|
+
|
122
|
+
function addXhrProgressEvent(){
|
123
|
+
if (!$.trumbowyg && !$.trumbowyg.addedXhrProgressEvent) { // Avoid adding progress event multiple times
|
124
|
+
var originalXhr = $.ajaxSettings.xhr;
|
125
|
+
$.ajaxSetup({
|
126
|
+
xhr: function() {
|
127
|
+
var req = originalXhr(),
|
128
|
+
that = this;
|
129
|
+
if(req && typeof req.upload == "object" && that.progressUpload !== undefined)
|
130
|
+
req.upload.addEventListener("progress", function(e){
|
131
|
+
that.progressUpload(e);
|
132
|
+
}, false);
|
133
|
+
|
134
|
+
return req;
|
135
|
+
}
|
136
|
+
});
|
137
|
+
$.trumbowyg.addedXhrProgressEvent = true;
|
138
|
+
}
|
139
|
+
}
|
140
|
+
})(jQuery);
|
@@ -0,0 +1,49 @@
|
|
1
|
+
<?php
|
2
|
+
/* ===========================================================
|
3
|
+
* trumbowyg.upload.php
|
4
|
+
* Upload plugin for Trumbowyg
|
5
|
+
* http://alex-d.github.com/Trumbowyg
|
6
|
+
* ===========================================================
|
7
|
+
* Author : Alexandre Demode (Alex-D)
|
8
|
+
* Twitter : @AlexandreDemode
|
9
|
+
* Website : alex-d.fr
|
10
|
+
* ===========================================================
|
11
|
+
* /!\ This file was make just for tests. Do not use it in
|
12
|
+
* production because it is not secure.
|
13
|
+
*/
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
/**
|
18
|
+
* Upload directory
|
19
|
+
*/
|
20
|
+
define("UPLOADDIR", "./uploaded-files/");
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
// Detect if it is an AJAX request
|
25
|
+
if(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
|
26
|
+
$file = array_shift($_FILES);
|
27
|
+
|
28
|
+
if(move_uploaded_file($file['tmp_name'], UPLOADDIR . basename($file['name']))) {
|
29
|
+
$file = dirname($_SERVER['PHP_SELF']) . str_replace('./', '/', UPLOADDIR) . $file['name'];
|
30
|
+
$data = array(
|
31
|
+
'message' => 'uploadSuccess',
|
32
|
+
'file' => $file,
|
33
|
+
);
|
34
|
+
} else {
|
35
|
+
$error = true;
|
36
|
+
$data = array(
|
37
|
+
'message' => 'uploadError',
|
38
|
+
);
|
39
|
+
}
|
40
|
+
} else {
|
41
|
+
$data = array(
|
42
|
+
'message' => 'uploadNotAjax',
|
43
|
+
'formData' => $_POST
|
44
|
+
);
|
45
|
+
}
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
echo json_encode($data);
|
@@ -0,0 +1,58 @@
|
|
1
|
+
/* ===========================================================
|
2
|
+
* ca.js
|
3
|
+
* Catalan translation for Trumbowyg
|
4
|
+
* http://alex-d.github.com/Trumbowyg
|
5
|
+
* ===========================================================
|
6
|
+
* Author : Àlfons Sánchez (alsanan)
|
7
|
+
* Twitter : @alsanan
|
8
|
+
* Website : about.me/alsanan
|
9
|
+
* Github : https://github.com/alsanan
|
10
|
+
*/
|
11
|
+
|
12
|
+
jQuery.trumbowyg.langs.ca = {
|
13
|
+
viewHTML: "Veure HTML",
|
14
|
+
|
15
|
+
formatting: "Formatar",
|
16
|
+
p: "Paragraf",
|
17
|
+
blockquote: "Citació",
|
18
|
+
code: "Codi",
|
19
|
+
header: "Títol",
|
20
|
+
|
21
|
+
bold: "Negreta",
|
22
|
+
italic: "Itàlica",
|
23
|
+
strikethrough: "Suprimir",
|
24
|
+
underline: "Subratllat",
|
25
|
+
|
26
|
+
strong: "Forta",
|
27
|
+
em: "Èmfasi",
|
28
|
+
del: "Apagar",
|
29
|
+
|
30
|
+
unorderedList: "Lista desordenada",
|
31
|
+
orderedList: "Lista ordenada",
|
32
|
+
|
33
|
+
insertImage: "Inserir imatge",
|
34
|
+
insertVideo: "Inserir vídeo",
|
35
|
+
link: "Enllaç",
|
36
|
+
createLink: "Crear un enllaç",
|
37
|
+
unlink: "Eliminar enllaç",
|
38
|
+
|
39
|
+
justifyLeft: "Alinear a esquerra",
|
40
|
+
justifyCenter: "Centrar",
|
41
|
+
justifyRight: "Alinear a dreta",
|
42
|
+
justifyFull: "Justificar",
|
43
|
+
|
44
|
+
horizontalRule: "Inserir separador horitzontal",
|
45
|
+
|
46
|
+
fullscreen: "Pantalla completa",
|
47
|
+
|
48
|
+
close: "Tancar",
|
49
|
+
|
50
|
+
submit: "Enviar",
|
51
|
+
reset: "Reiniciar",
|
52
|
+
|
53
|
+
invalidUrl: "URL invàlida",
|
54
|
+
required: "Obligatori",
|
55
|
+
description: "Descripció",
|
56
|
+
title: "Títol",
|
57
|
+
text: "Text"
|
58
|
+
};
|