Skip to content

Commit 4ff67a0

Browse files
author
Stéphan Zych
committed
First commit
1 parent 6727c74 commit 4ff67a0

File tree

7 files changed

+238
-0
lines changed

7 files changed

+238
-0
lines changed

.bowerrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory": "packages"
3+
}

.jshintrc

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"esnext": true,
3+
"bitwise": true,
4+
"browser": true,
5+
"camelcase": true,
6+
"curly": true,
7+
"debug": true,
8+
"eqeqeq": true,
9+
"immed": true,
10+
"indent": 4,
11+
"latedef": true,
12+
"newcap": true,
13+
"noarg": true,
14+
"quotmark": "single",
15+
"regexp": true,
16+
"undef": true,
17+
"unused": "vars",
18+
"strict": true,
19+
"trailing": true,
20+
"smarttabs": true
21+
}

Gruntfile.js

+131
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
/* global module */
2+
3+
module.exports = function (grunt) {
4+
'use strict';
5+
6+
grunt.initConfig({
7+
// Metadata
8+
pkg: grunt.file.readJSON('package.json'),
9+
10+
11+
// -- Tasks
12+
clean: {
13+
dist: [
14+
'dist/css/jquery-tubular.min.css',
15+
'dist/js/jquery-tubular.min.js'
16+
]
17+
}, // clean
18+
19+
recess: {
20+
minified: {
21+
options: {
22+
compress: true
23+
},
24+
files: {
25+
'dist/css/jquery-tubular.min.css': [
26+
'src/less/jquery-tubular.less'
27+
]
28+
}
29+
} // minified
30+
},
31+
32+
jshint: {
33+
options: {
34+
jshintrc: '.jshintrc'
35+
},
36+
all: [
37+
'Gruntfile.js',
38+
'src/js/*.js',
39+
'!dist/js/*.min.js'
40+
]
41+
},
42+
43+
uglify: {
44+
minified: {
45+
options: {
46+
banner: '/* <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>' +
47+
'* by <%= pkg.author %> (http://monkeymonk.be)' +
48+
'* forked from Sean McCambridge (http://www.seanmccambridge.com/tubular)' + '* licensed under the MIT License '+
49+
'*/'
50+
},
51+
files: {
52+
'dist/js/jquery-tubular.min.js': [
53+
'src/js/jquery-tubular.js'
54+
]
55+
}
56+
}, // minified
57+
}, // uglify
58+
59+
60+
shell: {
61+
done: {
62+
command: 'terminal-notifier -message "Bazinga! Grunt Tasks done!" -title "Gruntfile.js"'
63+
}
64+
}, // shell
65+
66+
connect: {
67+
server: {
68+
options: {
69+
port: 8800,
70+
base: '.'
71+
}
72+
}
73+
}, // connect
74+
75+
watch: {
76+
less: {
77+
files: [
78+
'src/less/*.less'
79+
],
80+
81+
tasks: ['recess', 'shell:done']
82+
},
83+
84+
js: {
85+
files: [
86+
'<%= jshint.all %>'
87+
],
88+
89+
tasks: ['jshint', 'uglify', 'shell:done']
90+
}
91+
}, // watch
92+
});
93+
94+
grunt.loadNpmTasks('grunt-contrib-clean');
95+
grunt.loadNpmTasks('grunt-contrib-jshint');
96+
grunt.loadNpmTasks('grunt-contrib-connect');
97+
grunt.loadNpmTasks('grunt-contrib-uglify');
98+
grunt.loadNpmTasks('grunt-contrib-watch');
99+
grunt.loadNpmTasks('grunt-recess');
100+
grunt.loadNpmTasks('grunt-shell');
101+
102+
103+
grunt.event.on('watch', function(action, filepath, target) {
104+
grunt.log.writeln(target + ': ' + filepath + ' has ' + action);
105+
});
106+
107+
108+
// -- Tasks
109+
110+
grunt.registerTask('before-test', [
111+
'clean'
112+
]);
113+
grunt.registerTask('test', [
114+
'recess',
115+
'uglify'
116+
]);
117+
grunt.registerTask('after-test', [
118+
'shell:done'
119+
]);
120+
121+
grunt.registerTask('js', [
122+
'uglify',
123+
'shell:done'
124+
]);
125+
grunt.registerTask('css', [
126+
'recess',
127+
'shell:done'
128+
]);
129+
130+
grunt.registerTask('default', ['before-test', 'test', 'after-test']);
131+
};

bower.json

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"name": "jquery-tubular",
3+
"version": "0.0.1",
4+
"dependencies": {
5+
"jquery": "~1.10.2"
6+
}
7+
}

dist/js/jquery-tubular.min.js

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "jquery-tubular",
3+
"version": "0.0.1",
4+
"description": "This repository is a fork of jQuery tubular plugin by Sean McCambridge (http://www.seanmccambridge.com/tubular).",
5+
"author": "Stéphan Zych",
6+
"license": "MIT",
7+
"devDependencies": {
8+
"grunt": "latest",
9+
"grunt-contrib-clean": "latest",
10+
"grunt-contrib-connect": "latest",
11+
"grunt-contrib-jshint": "latest",
12+
"grunt-contrib-uglify": "latest",
13+
"grunt-contrib-watch": "latest",
14+
"grunt-recess": "latest",
15+
"grunt-shell": "latest"
16+
}
17+
}

src/js/jquery-tubular.js

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
2+
(function ($) {
3+
'use strict';
4+
5+
6+
var Tubular = function (element, options) {
7+
this.options = options;
8+
this.$element = $(element);
9+
}; // Tubular
10+
11+
Tubular.DEFAULTS = {
12+
ratio: 16/9, // usually either 4/3 or 16/9 -- tweak as needed
13+
videoId: 'ZCAnLxRvNNc', // toy robot in space is a good default, no?
14+
mute: true,
15+
repeat: true,
16+
width: $(window).width(),
17+
wrapperZIndex: 99,
18+
playButtonClass: 'tubular-play',
19+
pauseButtonClass: 'tubular-pause',
20+
muteButtonClass: 'tubular-mute',
21+
volumeUpClass: 'tubular-volume-up',
22+
volumeDownClass: 'tubular-volume-down',
23+
increaseVolumeBy: 10,
24+
start: 0,
25+
callback: null
26+
}; // DEFAULTS
27+
28+
Tubular.prototype = {}; // Prototypes
29+
30+
var old = $.fn.tubular;
31+
32+
$.fn.tubular = function (option) {
33+
return this.each(function () {
34+
var $this = $(this),
35+
data = $this.data('.tubular'),
36+
options = $.extend({}, Tubular.DEFAULTS, $this.data(), typeof option === 'object' && option);
37+
38+
if (!data) {
39+
$this.data('.tubular', (data = new Tubular(this, options)));
40+
}
41+
42+
if (typeof option === 'string') {
43+
data[option]();
44+
}
45+
});
46+
}; // $.fn.tubular
47+
48+
$.fn.tubular.Constructor = Tubular;
49+
50+
$.fn.tubular.noConflict = function () {
51+
$.fn.tubular = old;
52+
return this;
53+
}; // No conflict
54+
55+
$(document)
56+
.on('', '', function () {});
57+
58+
}) (window.jQuery);

0 commit comments

Comments
 (0)