Force the use of single quotes

This commit is contained in:
MrTimscampi 2020-05-04 12:44:12 +02:00
parent 8b6dc05d64
commit 9e3ca706c4
217 changed files with 8541 additions and 8540 deletions

View file

@ -37,69 +37,69 @@ define(['events'], function (events) {
// 5) It wasn't as smart as it could have been about what should be part of a
// URL and what should be part of human language.
var protocols = "(?:(?:http|https|rtsp|ftp):\\/\\/)";
var protocols = '(?:(?:http|https|rtsp|ftp):\\/\\/)';
var credentials = "(?:(?:[a-z0-9\\$\\-\\_\\.\\+\\!\\*\\'\\(\\)\\,\\;\\?\\&\\=]|(?:\\%[a-f0-9]{2})){1,64}" // username (1-64 normal or url escaped characters)
+ "(?:\\:(?:[a-z0-9\\$\\-\\_\\.\\+\\!\\*\\'\\(\\)\\,\\;\\?\\&\\=]|(?:\\%[a-f0-9]{2})){1,25})?" // followed by optional password (: + 1-25 normal or url escaped characters)
+ "\\@)";
+ '\\@)';
// IPv6 Regex http://forums.intermapper.com/viewtopic.php?t=452
// by Dartware, LLC is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License
// http://intermapper.com/
var ipv6 = "("
+ "(([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))"
+ "|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))"
+ "|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))"
+ "|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))"
+ "|(([0-9A-Fa-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]|[1-9]|0)\\.'
+ '(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[0-9])';
// This would have been a lot cleaner if JS RegExp supported conditionals...
var linkRegExpString =
// begin match for protocol / username / password / host
"(?:"
'(?:'
// ============================
// If we have a recognized protocol at the beginning of the URL, we're
// more relaxed about what we accept, because we assume the user wants
// this to be a URL, and we're not accidentally matching human language
+ protocols + "?"
+ protocols + '?'
// optional username:password@
+ credentials + "?"
+ credentials + '?'
// IP address (both v4 and v6)
+ "(?:"
+ '(?:'
// IPv6
+ ipv6
// IPv4
+ "|" + ipv4
+ '|' + ipv4
+ ")"
+ ')'
// end match for protocol / username / password / host
+ ")"
+ ')'
// optional port number
+ "(?:\\:\\d{1,5})?"
+ '(?:\\:\\d{1,5})?'
// plus optional path and query params (no unicode allowed here?)
+ "(?:"
+ "\\/(?:"
+ '(?:'
+ '\\/(?:'
// some characters we'll accept because it's unlikely human language
// would use them after a URL unless they were part of the url
+ "(?:[a-z0-9\\/\\@\\&\\#\\~\\*\\_\\-\\+])"
+ "|(?:\\%[a-f0-9]{2})"
+ '(?:[a-z0-9\\/\\@\\&\\#\\~\\*\\_\\-\\+])'
+ '|(?:\\%[a-f0-9]{2})'
// some characters are much more likely to be used AFTER a url and
// were not intended to be included in the url itself. Mostly end
// of sentence type things. It's also likely that the URL would
@ -108,9 +108,9 @@ define(['events'], function (events) {
// they must be followed by another character that we're reasonably
// sure is part of the url
+ "|(?:[\\;\\?\\:\\.\\!\\'\\(\\)\\,\\=]+(?=(?:[a-z0-9\\/\\@\\&\\#\\~\\*\\_\\-\\+])|(?:\\%[a-f0-9]{2})))"
+ ")*"
+ "|\\b|\$"
+ ")";
+ ')*'
+ '|\\b|\$'
+ ')';
// regex = XRegExp(regex,'gi');
var linkRegExp = RegExp(linkRegExpString, 'gi');
@ -120,7 +120,7 @@ define(['events'], function (events) {
// if url doesn't begin with a known protocol, add http by default
function ensureProtocol(url) {
if (!url.match(protocolRegExp)) {
url = "http://" + url;
url = 'http://' + url;
}
return url;
}
@ -190,7 +190,7 @@ define(['events'], function (events) {
return apiClient.getPublicSystemInfo().then(function (info) {
var localAddress = info.LocalAddress;
if (!localAddress) {
console.debug("No valid local address returned, defaulting to external one");
console.debug('No valid local address returned, defaulting to external one');
localAddress = serverAddress;
}
addToCache(serverAddress, localAddress);

View file

@ -54,7 +54,7 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
// production version registered with google
// replace this value if you want to test changes on another instance
var applicationID = "F007D354";
var applicationID = 'F007D354';
var messageNamespace = 'urn:x-cast:com.connectsdk';
@ -114,14 +114,14 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
*/
CastPlayer.prototype.onInitSuccess = function () {
this.isInitialized = true;
console.debug("chromecast init success");
console.debug('chromecast init success');
};
/**
* Generic error callback function
*/
CastPlayer.prototype.onError = function () {
console.debug("chromecast error");
console.debug('chromecast error');
};
/**
@ -177,10 +177,10 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
*/
CastPlayer.prototype.receiverListener = function (e) {
if (e === 'available') {
console.debug("chromecast receiver found");
console.debug('chromecast receiver found');
this.hasReceivers = true;
} else {
console.debug("chromecast receiver list empty");
console.debug('chromecast receiver list empty');
this.hasReceivers = false;
}
};
@ -195,8 +195,8 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
this.session = null;
this.deviceState = DEVICE_STATE.IDLE;
this.castPlayerState = PLAYER_STATE.IDLE;
document.removeEventListener("volumeupbutton", onVolumeUpKeyDown, false);
document.removeEventListener("volumedownbutton", onVolumeDownKeyDown, false);
document.removeEventListener('volumeupbutton', onVolumeUpKeyDown, false);
document.removeEventListener('volumedownbutton', onVolumeDownKeyDown, false);
console.debug('sessionUpdateListener: setting currentMediaSession to null');
this.currentMediaSession = null;
@ -211,7 +211,7 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
* session request in opt_sessionRequest.
*/
CastPlayer.prototype.launchApp = function () {
console.debug("chromecast launching app...");
console.debug('chromecast launching app...');
chrome.cast.requestSession(this.onRequestSessionSuccess.bind(this), this.onLaunchError.bind(this));
};
@ -220,7 +220,7 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
* @param {Object} e A chrome.cast.Session object
*/
CastPlayer.prototype.onRequestSessionSuccess = function (e) {
console.debug("chromecast session success: " + e.sessionId);
console.debug('chromecast session success: ' + e.sessionId);
this.onSessionConnected(e);
};
@ -232,8 +232,8 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
this.session.addMediaListener(this.sessionMediaListener.bind(this));
this.session.addUpdateListener(this.sessionUpdateListener.bind(this));
document.addEventListener("volumeupbutton", onVolumeUpKeyDown, false);
document.addEventListener("volumedownbutton", onVolumeDownKeyDown, false);
document.addEventListener('volumeupbutton', onVolumeUpKeyDown, false);
document.addEventListener('volumedownbutton', onVolumeDownKeyDown, false);
events.trigger(this, 'connect');
this.sendMessage({
@ -262,7 +262,7 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
* Callback function for launch error
*/
CastPlayer.prototype.onLaunchError = function () {
console.debug("chromecast launch error");
console.debug('chromecast launch error');
this.deviceState = DEVICE_STATE.ERROR;
sendConnectionResult(false);
};
@ -284,8 +284,8 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
this.deviceState = DEVICE_STATE.IDLE;
this.castPlayerState = PLAYER_STATE.IDLE;
document.removeEventListener("volumeupbutton", onVolumeUpKeyDown, false);
document.removeEventListener("volumedownbutton", onVolumeDownKeyDown, false);
document.removeEventListener('volumeupbutton', onVolumeUpKeyDown, false);
document.removeEventListener('volumedownbutton', onVolumeDownKeyDown, false);
this.currentMediaSession = null;
};
@ -296,7 +296,7 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
*/
CastPlayer.prototype.loadMedia = function (options, command) {
if (!this.session) {
console.debug("no session");
console.debug('no session');
return Promise.reject();
}
@ -386,7 +386,7 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
*/
CastPlayer.prototype.onMediaDiscovered = function (how, mediaSession) {
console.debug("chromecast new media session ID:" + mediaSession.mediaSessionId + ' (' + how + ')');
console.debug('chromecast new media session ID:' + mediaSession.mediaSessionId + ' (' + how + ')');
this.currentMediaSession = mediaSession;
if (how === 'loadMedia') {
@ -405,7 +405,7 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
* @param {!Boolean} e true/false
*/
CastPlayer.prototype.onMediaStatusUpdate = function (e) {
console.debug("chromecast updating media: " + e);
console.debug('chromecast updating media: ' + e);
if (e === false) {
this.castPlayerState = PLAYER_STATE.IDLE;
}
@ -482,7 +482,7 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
} else {
query.Limit = query.Limit || 100;
query.ExcludeLocationTypes = "Virtual";
query.ExcludeLocationTypes = 'Virtual';
query.EnableTotalRecordCount = false;
return apiClient.getItems(userId, query);
@ -506,13 +506,13 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
instance._castPlayer = new CastPlayer();
// To allow the native android app to override
document.dispatchEvent(new CustomEvent("chromecastloaded", {
document.dispatchEvent(new CustomEvent('chromecastloaded', {
detail: {
player: instance
}
}));
events.on(instance._castPlayer, "connect", function (e) {
events.on(instance._castPlayer, 'connect', function (e) {
if (currentResolve) {
sendConnectionResult(true);
@ -525,22 +525,22 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
instance.lastPlayerData = null;
});
events.on(instance._castPlayer, "playbackstart", function (e, data) {
events.on(instance._castPlayer, 'playbackstart', function (e, data) {
console.debug('cc: playbackstart');
instance._castPlayer.initializeCastPlayer();
var state = instance.getPlayerStateInternal(data);
events.trigger(instance, "playbackstart", [state]);
events.trigger(instance, 'playbackstart', [state]);
});
events.on(instance._castPlayer, "playbackstop", function (e, data) {
events.on(instance._castPlayer, 'playbackstop', function (e, data) {
console.debug('cc: playbackstop');
var state = instance.getPlayerStateInternal(data);
events.trigger(instance, "playbackstop", [state]);
events.trigger(instance, 'playbackstop', [state]);
var state = instance.lastPlayerData.PlayState || {};
var volume = state.VolumeLevel || 0.5;
@ -553,12 +553,12 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
instance.lastPlayerData.PlayState.IsMuted = mute;
});
events.on(instance._castPlayer, "playbackprogress", function (e, data) {
events.on(instance._castPlayer, 'playbackprogress', function (e, data) {
console.debug('cc: positionchange');
var state = instance.getPlayerStateInternal(data);
events.trigger(instance, "timeupdate", [state]);
events.trigger(instance, 'timeupdate', [state]);
});
bindEventForRelay(instance, 'timeupdate');
@ -567,12 +567,12 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
bindEventForRelay(instance, 'volumechange');
bindEventForRelay(instance, 'repeatmodechange');
events.on(instance._castPlayer, "playstatechange", function (e, data) {
events.on(instance._castPlayer, 'playstatechange', function (e, data) {
console.debug('cc: playstatechange');
var state = instance.getPlayerStateInternal(data);
events.trigger(instance, "pause", [state]);
events.trigger(instance, 'pause', [state]);
});
}
@ -630,24 +630,24 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
name: PlayerName,
id: PlayerName,
playerName: PlayerName,
playableMediaTypes: ["Audio", "Video"],
playableMediaTypes: ['Audio', 'Video'],
isLocalPlayer: false,
appName: PlayerName,
deviceName: appName,
supportedCommands: [
"VolumeUp",
"VolumeDown",
"Mute",
"Unmute",
"ToggleMute",
"SetVolume",
"SetAudioStreamIndex",
"SetSubtitleStreamIndex",
"DisplayContent",
"SetRepeatMode",
"EndSession",
"PlayMediaSource",
"PlayTrailers"
'VolumeUp',
'VolumeDown',
'Mute',
'Unmute',
'ToggleMute',
'SetVolume',
'SetAudioStreamIndex',
'SetSubtitleStreamIndex',
'DisplayContent',
'SetRepeatMode',
'EndSession',
'PlayMediaSource',
'PlayTrailers'
]
};
};
@ -667,7 +667,7 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
console.debug(JSON.stringify(data));
if (triggerStateChange) {
events.trigger(this, "statechange", [data]);
events.trigger(this, 'statechange', [data]);
}
return data;