Skip to content

Commit eede4a7

Browse files
committed
Add way to start with NGT, fix title attribute on button element
1 parent adb0d24 commit eede4a7

File tree

5 files changed

+20
-8
lines changed

5 files changed

+20
-8
lines changed

dist/nmgt/nmgt.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*/(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(_dereq_,module,exports){
1212
'use strict';
1313

14-
mejs.i18n.en['mejs.nmgt-chooser'] = 'NmG/NGT Chooser';
14+
mejs.i18n.en['mejs.nmgt-chooser'] = 'NmG / NGT Chooser';
1515

1616
Object.assign(mejs.MepDefaults, {});
1717

@@ -51,7 +51,7 @@ Object.assign(MediaElementPlayer.prototype, {
5151

5252
player.nmgtContainer = document.createElement('div');
5353
player.nmgtContainer.className = t.options.classPrefix + 'button ' + t.options.classPrefix + 'nmgt-button';
54-
player.nmgtContainer.innerHTML = '<button ' + 'type="button" ' + ('aria-controls="' + generateId + '" ') + 'aria-expanded="false" ' + ('title=' + nmgtTitle + ' ') + ('aria-label="' + nmgtTitle + '" ') + 'tabindex="0"' + '>' + userPreference + arrowSVGIcon + '</button>' + '<div ' + 'class="' + t.options.classPrefix + 'nmgt-selector ' + t.options.classPrefix + 'offscreen' + '"' + '>' + '<ul ' + 'id="' + generateId + '" ' + 'class="' + t.options.classPrefix + 'nmgt-selector-list' + '"' + 'tabindex="-1"' + '></ul>' + '</div>';
54+
player.nmgtContainer.innerHTML = '<button ' + 'type="button" ' + ('aria-controls="' + generateId + '" ') + 'aria-expanded="false" ' + ('title="' + nmgtTitle + '" ') + ('aria-label="' + nmgtTitle + '" ') + 'tabindex="0"' + '>' + userPreference + arrowSVGIcon + '</button>' + '<div ' + 'class="' + t.options.classPrefix + 'nmgt-selector ' + t.options.classPrefix + 'offscreen' + '"' + '>' + '<ul ' + 'id="' + generateId + '" ' + 'class="' + t.options.classPrefix + 'nmgt-selector-list' + '"' + 'tabindex="-1"' + '></ul>' + '</div>';
5555

5656
t.addControlElement(player.nmgtContainer, 'nmgt');
5757

@@ -280,6 +280,12 @@ Object.assign(MediaElementPlayer.prototype, {
280280
}
281281

282282
function getDefaultStreamName() {
283+
var startSrcDataAttr = player.node.dataset.startSrc;
284+
285+
if (startSrcDataAttr == '1') {
286+
return ngtName();
287+
}
288+
283289
return nmgName();
284290
}
285291
},

dist/nmgt/nmgt.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@A-VISION-BV/mediaelement-plugins",
3-
"version": "4.1.2",
3+
"version": "4.1.3",
44
"repository": {
55
"type": "git",
66
"url": "https://github.com/A-VISION-BV/mediaelement-plugins.git"

src/nmgt/nmgt.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99

1010
// Translations (English required)
11-
mejs.i18n.en['mejs.nmgt-chooser'] = 'NmG/NGT Chooser';
11+
mejs.i18n.en['mejs.nmgt-chooser'] = 'NmG / NGT Chooser';
1212

1313
// Feature configuration
1414
Object.assign(mejs.MepDefaults, {
@@ -76,7 +76,7 @@ Object.assign(MediaElementPlayer.prototype, {
7676
'type="button" ' +
7777
`aria-controls="${generateId}" ` +
7878
'aria-expanded="false" ' +
79-
`title=${nmgtTitle} ` +
79+
`title="${nmgtTitle}" ` +
8080
`aria-label="${nmgtTitle}" ` +
8181
'tabindex="0"' +
8282
'>' +
@@ -342,6 +342,12 @@ Object.assign(MediaElementPlayer.prototype, {
342342
}
343343

344344
function getDefaultStreamName() {
345+
const startSrcDataAttr = player.node.dataset.startSrc
346+
347+
if(startSrcDataAttr == '1') {
348+
return ngtName()
349+
}
350+
345351
return nmgName()
346352
}
347353
},

0 commit comments

Comments
 (0)