Skip to content

Commit

Permalink
WIP: upgrade ableplayer
Browse files Browse the repository at this point in the history
  • Loading branch information
zoltan-dulac committed Feb 5, 2025
1 parent 11a9f05 commit c6ab4c4
Show file tree
Hide file tree
Showing 306 changed files with 79,073 additions and 6,893 deletions.
1 change: 1 addition & 0 deletions bin/promote-node-modules-to-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const nodeFiles = [
'node_modules/jquery-validation/dist/jquery.validate.min.js',
'node_modules/accessibility-js-routines/dist/accessibility.module.js',
'node_modules/wicg-inert/dist/inert.min.js',
'node_modules/js-cookie/dist/js.cookie.js'
];

nodeFiles.forEach((fullPath) => {
Expand Down
147 changes: 147 additions & 0 deletions enable-node-libs/js-cookie/dist/js.cookie.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
/*! js-cookie v3.0.5 | MIT */
;
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, (function () {
var current = global.Cookies;
var exports = global.Cookies = factory();
exports.noConflict = function () { global.Cookies = current; return exports; };
})());
})(this, (function () { 'use strict';

/* eslint-disable no-var */
function assign (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
target[key] = source[key];
}
}
return target
}
/* eslint-enable no-var */

/* eslint-disable no-var */
var defaultConverter = {
read: function (value) {
if (value[0] === '"') {
value = value.slice(1, -1);
}
return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent)
},
write: function (value) {
return encodeURIComponent(value).replace(
/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
decodeURIComponent
)
}
};
/* eslint-enable no-var */

/* eslint-disable no-var */

function init (converter, defaultAttributes) {
function set (name, value, attributes) {
if (typeof document === 'undefined') {
return
}

attributes = assign({}, defaultAttributes, attributes);

if (typeof attributes.expires === 'number') {
attributes.expires = new Date(Date.now() + attributes.expires * 864e5);
}
if (attributes.expires) {
attributes.expires = attributes.expires.toUTCString();
}

name = encodeURIComponent(name)
.replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)
.replace(/[()]/g, escape);

var stringifiedAttributes = '';
for (var attributeName in attributes) {
if (!attributes[attributeName]) {
continue
}

stringifiedAttributes += '; ' + attributeName;

if (attributes[attributeName] === true) {
continue
}

// Considers RFC 6265 section 5.2:
// ...
// 3. If the remaining unparsed-attributes contains a %x3B (";")
// character:
// Consume the characters of the unparsed-attributes up to,
// not including, the first %x3B (";") character.
// ...
stringifiedAttributes += '=' + attributes[attributeName].split(';')[0];
}

return (document.cookie =
name + '=' + converter.write(value, name) + stringifiedAttributes)
}

function get (name) {
if (typeof document === 'undefined' || (arguments.length && !name)) {
return
}

// To prevent the for loop in the first place assign an empty array
// in case there are no cookies at all.
var cookies = document.cookie ? document.cookie.split('; ') : [];
var jar = {};
for (var i = 0; i < cookies.length; i++) {
var parts = cookies[i].split('=');
var value = parts.slice(1).join('=');

try {
var found = decodeURIComponent(parts[0]);
jar[found] = converter.read(value, found);

if (name === found) {
break
}
} catch (e) {}
}

return name ? jar[name] : jar
}

return Object.create(
{
set,
get,
remove: function (name, attributes) {
set(
name,
'',
assign({}, attributes, {
expires: -1
})
);
},
withAttributes: function (attributes) {
return init(this.converter, assign({}, this.attributes, attributes))
},
withConverter: function (converter) {
return init(assign({}, this.converter, converter), this.attributes)
}
},
{
attributes: { value: Object.freeze(defaultAttributes) },
converter: { value: Object.freeze(converter) }
}
)
}

var api = init(defaultConverter, { path: '/' });
/* eslint-enable no-var */

return api;

}));
108 changes: 108 additions & 0 deletions js/enable-libs/ableplayer-old/Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
module.exports = function(grunt) {

grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks("grunt-remove-logging");
grunt.loadNpmTasks('grunt-contrib-jshint');

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
build: {
src: [
// Ultimately this should be just 'scripts/*.js',
// but for now we're maintaining the order which was
// specified in the previous 'compile.sh' script
'scripts/ableplayer-base.js',
'scripts/initialize.js',
'scripts/preference.js',
'scripts/webvtt.js',
'scripts/buildplayer.js',
'scripts/track.js',
'scripts/youtube.js',
'scripts/slider.js',
'scripts/volume.js',
'scripts/dialog.js',
'scripts/misc.js',
'scripts/description.js',
'scripts/browser.js',
'scripts/control.js',
'scripts/caption.js',
'scripts/chapters.js',
'scripts/metadata.js',
'scripts/transcript.js',
'scripts/search.js',
'scripts/event.js',
'scripts/dragdrop.js',
'scripts/sign.js',
'scripts/langs.js',
'scripts/translation.js',
'scripts/ttml2webvtt.js',
'scripts/JQuery.doWhen.js',
'scripts/vts.js',
'scripts/vimeo.js'
],
dest: 'build/<%= pkg.name %>.js'
},
},
removelogging: {
dist: {
src: [
'build/<%= pkg.name %>.js'
],
dest: 'build/<%= pkg.name %>.dist.js'
},
options: {
// Remove all console output (see https://www.npmjs.com/package/grunt-remove-logging)
}
},
uglify: {
min: {
src : ['build/<%= pkg.name %>.dist.js'],
dest : 'build/<%= pkg.name %>.min.js',
},
options: {
// Add a banner with the package name and version
// (no date, otherwise a new build is different even if the code didn't change!)
banner: '/*! <%= pkg.name %> V<%= pkg.version %> */\n',
// Preserve comments that start with a bang (like the file header)
preserveComments: "some"
}
},
cssmin: {
min: {
src : [
'styles/ableplayer.css',
],
dest : 'build/<%= pkg.name %>.min.css',
},
options: {
// Add a banner with the package name and version
// (no date, otherwise a new build is different even if the code didn't change!)
// (oddly, here we don't need a '\n' at the end!)
banner: '/*! <%= pkg.name %> V<%= pkg.version %> */',
}
},
jshint: {
files: ['Gruntfile.js', 'scripts/**/*.js'],
options: {
// options here to override JSHint defaults
globals: {
browser: true,
jquery: true,
devel: true,
}
}
},
clean: {
build: ['build'],
},

});

grunt.registerTask('default', ['concat', 'removelogging', 'uglify', 'cssmin']);
grunt.registerTask('test', ['jshint']);
};
26 changes: 26 additions & 0 deletions js/enable-libs/ableplayer-old/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
The MIT License (MIT)

Copyright (c) 2014 University of Washington

Able Player development is supported in part by The AccessComputing project,
with financial support from the National Science Foundation
(grant #CNS-0540615, CNS-0837508, and CNS-1042260);
and by the Committee on Institutional Cooperation (CIC).

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Loading

0 comments on commit c6ab4c4

Please sign in to comment.