Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import {Model} from 'backbone';
import DataSource from 'background/model/dataSource';
import YouTubeV3API from 'background/model/youTubeV3API';
// TODO: This doesn't update the index of playlist items on sequence change
var ChromeContextMenusManager = Model.extend({
defaults: {
textSelectionPlayId: -1,
textSelectionAddId: -1,
youTubeLinkPlayId: -1,
youTubeLinkAddId: -1,
youTubeLinkSaveId: -1,
youTubePagePlayId: -1,
youTubePageAddId: -1,
youTubePageSaveId: -1,
streamItems: null,
settings: null,
tabManager: null,
signInManager: null
},
initialize: function() {
import {Model} from 'backbone';
import LocalStorage from 'lib/backbone.localStorage';
import StreamItems from 'background/collection/streamItems';
import RelatedVideosManager from 'background/model/relatedVideosManager';
import PlayerState from 'common/enum/playerState';
import RepeatButtonState from 'common/enum/repeatButtonState';
var Stream = Model.extend({
localStorage: new LocalStorage('Stream'),
defaults: function() {
return {
// Need to set the ID for Backbone.LocalStorage
id: 'Stream',
items: new StreamItems(),
activeItem: null,
relatedVideosManager: new RelatedVideosManager(),
history: [],
player: null,
shuffleButton: null,
radioButton: null,
repeatButton: null
};
},
import {Model} from 'backbone';
import ClientErrors from 'background/collection/clientErrors';
var ClientErrorManager = Model.extend({
defaults: function() {
return {
platformInfo: {
os: '',
arch: ''
},
language: '',
signInManager: null,
reportedErrors: new ClientErrors()
};
},
initialize: function() {
chrome.runtime.getPlatformInfo(this._onChromeRuntimeGetPlatformInfo.bind(this));
// It's important to bind pre-emptively or attempts to call removeEventListener will fail to find the appropriate reference.
import {Model} from 'backbone';
var ClientError = Model.extend({
defaults: function() {
return {
instanceId: StreamusBG.instanceId,
message: '',
lineNumber: -1,
url: '',
clientVersion: chrome.runtime.getManifest().version,
browserVersion: this._getBrowserVersion(),
operatingSystem: '',
architecture: '',
stack: '',
error: null,
userId: ''
};
},
'use strict';
import {Model} from 'backbone';
var VideoStream = Model.extend({
defaults: {
currentTime: 0,
muted: false,
volume: 50,
suggestedQuality: 'default',
isSeeking: false
}
});
export default VideoStream;
import { Model } from 'backbone';
import RouteType from 'route/routeType.js';
export default Model.extend({
defaults: {
route: RouteType.NotFound,
isActive: false,
isSecondary: false,
text: ''
}
});
import {Model} from 'backbone';
var TimeSlider = Model.extend({
defaults: {
currentTime: 0,
isBeingDragged: false,
isEnabled: false,
player: null
},
initialize: function() {
var player = this.get('player');
this._setEnabledState(player.get('loadedVideo'));
this.listenTo(player, 'change:loadedVideo', this._onPlayerChangeLoadedVideo);
},
incrementCurrentTime: function(incrementValue) {
var incrementedCurrentTime = this.get('currentTime') + incrementValue;
this.set('currentTime', incrementedCurrentTime);
'use strict';
import {Model} from 'backbone';
var SaveStreamButton = Model.extend({
defaults: {
enabled: false,
streamItems: null,
signInManager: null
},
initialize: function() {
var streamItems = this.get('streamItems');
this.listenTo(streamItems, 'add:completed', this._onStreamItemsAddCompleted);
this.listenTo(streamItems, 'remove', this._onStreamItemsRemove);
this.listenTo(streamItems, 'reset', this._onStreamItemsReset);
var signInManager = this.get('signInManager');
this.listenTo(signInManager, 'change:signedInUser', this._onSignInManagerChangeSignedInUser);
this._setEnabled(signInManager.has('signedInUser'), streamItems.isEmpty());
},
import {Model} from 'backbone';
export default Model.extend({
schema: {
first: {
type: 'Text',
title: 'First Name',
validators: ['required'],
},
last: {
type: 'Text',
title: 'Last Name',
validators: ['required']
},
phone: {
type: 'Text',
validators: ['phone']
},
primary_website: {
import {Model} from 'backbone';
import moment from 'moment';
/**
* @class SearchResultModel
*/
const SearchResult = Model.extend({
defaults() {
return {
id: null,
etag: null,
kind: null,
videoId: null,
channelId: null,
description: '',
publishedAt: null,
thumbnails: null,
title: ''
};
},
parse(response) {
return {