Skip to content

Commit

Permalink
mickey#7 dist/videojs.ga.js does not contain licene header
Browse files Browse the repository at this point in the history
  • Loading branch information
mickey committed May 23, 2014
1 parent e375bea commit 12b0482
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 17 deletions.
22 changes: 13 additions & 9 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ module.exports = function(grunt) {
grunt.initConfig({
// Metadata.
pkg: grunt.file.readJSON('package.json'),
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
banner: '/*\n* <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>\n' +
'* Licensed <%= pkg.license %>\n*/',
clean: {
files: ['dist']
},
Expand All @@ -22,22 +22,26 @@ module.exports = function(grunt) {
}
},
uglify: {
options: {
banner: '<%= banner %>'
},
dist: {
src: 'dist/videojs.ga.js',
dest: 'dist/videojs.ga.min.js'
},
},
usebanner: {
taskName: {
options: { banner: '<%= banner %>' },
files: { src: [ 'dist/*' ] }
}
}
});

// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-coffee');
grunt.loadNpmTasks('grunt-banner');

// Default task.
grunt.registerTask('default', ['clean', 'coffee', 'uglify']);
grunt.registerTask('default', ['clean', 'coffee', 'uglify', 'usebanner']);

};
8 changes: 8 additions & 0 deletions dist/videojs.ga.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
/*
* videojs-ga - v0.3.0 - 2014-05-23
* Copyright (c) 2014 Michael Bensoussan
* Licensed MIT
*/
(function() {
var __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };

videojs.plugin('ga', function(options) {
var dataSetupOptions, defaultsEventsToTrack, end, error, eventCategory, eventLabel, eventsToTrack, fullscreen, gaLibrary, loaded, parsedOptions, pause, percentsAlreadyTracked, percentsPlayedInterval, play, resize, seekEnd, seekStart, seeking, sendbeacon, timeupdate, volumeChange;
if (options == null) {
options = {};
}
dataSetupOptions = {};
if (this.options()["data-setup"]) {
parsedOptions = JSON.parse(this.options()["data-setup"]);
Expand Down
9 changes: 6 additions & 3 deletions dist/videojs.ga.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"name": "videojs-ga",
"version": "0.1.0",
"license": "MIT",
"author": {
"name": "Michael Bensoussan",
"email": "[email protected]"
Expand All @@ -12,6 +13,7 @@
"grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-clean": "~0.4.0",
"grunt-contrib-coffee": "~0.4.0",
"grunt-banner": "~0.2.2",
"grunt": "~0.4.1"
}
}
10 changes: 5 additions & 5 deletions src/videojs.ga.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# Licensed under the MIT license.
##

videojs.plugin 'ga', (options) ->
videojs.plugin 'ga', (options = {}) ->
# this loads options from the data-setup attribute of the video tag
dataSetupOptions = {}
if @options()["data-setup"]
Expand All @@ -24,10 +24,10 @@ videojs.plugin 'ga', (options) ->
eventCategory = options.eventCategory || dataSetupOptions.eventCategory || 'Video'
# if you didn't specify a name, it will be 'guessed' from the video src after metadatas are loaded
eventLabel = options.eventLabel || dataSetupOptions.eventLabel

# determine if we are using ga.js or analytics.js
gaLibrary = options.gaLibrary || dataSetupOptions.gaLibrary || 'ga.js'

# init a few variables
percentsAlreadyTracked = []
seekStart = seekEnd = 0
Expand Down Expand Up @@ -115,7 +115,7 @@ videojs.plugin 'ga', (options) ->
else
sendbeacon( 'exit fullscreen', false, currentTime )
return

sendbeacon = ( action, nonInteraction, value ) ->
try
if 'analytics.js' == gaLibrary
Expand All @@ -129,7 +129,7 @@ videojs.plugin 'ga', (options) ->
else
_gaq.push(['_trackEvent', eventCategory, action, eventLabel, value, nonInteraction])
return

@on("loadedmetadata", loaded)
@on("timeupdate", timeupdate)
@on("ended", end) if "end" in eventsToTrack
Expand Down

0 comments on commit 12b0482

Please sign in to comment.