diff --git a/static/js/embed/pandora.js b/static/js/embed/pandora.js index 77f8e2e5..b1a19d11 100755 --- a/static/js/embed/pandora.js +++ b/static/js/embed/pandora.js @@ -103,15 +103,17 @@ Ox.load('UI', { options.censored = canPlayVideo ? [] : canPlayClips ? ( options.subtitles.length - ? Ox.merge( - options.subtitles.map(function(subtitle, i) { - return { - 'in': i == 0 ? 0 : options.subtitles[i - 1].out, - out: subtitle['in'] - }; - }), + ? options.subtitles.map(function(subtitle, i) { + return { + 'in': i == 0 ? 0 : options.subtitles[i - 1].out, + out: subtitle['in'] + }; + }).concat( [{'in': Ox.last(options.subtitles).out, out: data.duration}] - ) + ).filter(function(censored) { + // don't include gaps shorter than one second + return censored.out - censored['in'] >= 1; + }) : Ox.range(0, data.duration - 5, 60).map(function(position) { return { 'in': position + 5, diff --git a/static/js/pandora.js b/static/js/pandora.js index b4bdf6dc..c84ebb91 100644 --- a/static/js/pandora.js +++ b/static/js/pandora.js @@ -311,7 +311,7 @@ appPanel function loadBrowserMessage() { var isMSIE = $.browser.msie, - browsers = Ox.merge( + browsers = [].concat( isMSIE ? [{name: 'Chrome Frame', url: 'http://google.com/chromeframe/'}] : [], [ {name: 'Chrome', url: 'http://google.com/chrome/'}, diff --git a/static/js/pandora/URL.js b/static/js/pandora/URL.js index 39e7898d..36c2bee0 100644 --- a/static/js/pandora/URL.js +++ b/static/js/pandora/URL.js @@ -39,7 +39,7 @@ pandora.URL = (function() { // ... } else if (['timeline', 'player', 'editor'].indexOf(state.view) > -1) { var videoPoints = pandora.user.ui.videoPoints[state.item] || {}; - state.span = videoPoints.annotation || Ox.merge( + state.span = videoPoints.annotation || [].concat( videoPoints.position ? videoPoints.position : [], @@ -173,19 +173,17 @@ pandora.URL = (function() { findKeys, sortKeys = {}, spanType = {}, views = {}; views[itemsSection] = { - list: Ox.merge( - // listView is the default view - [pandora.user.ui.listView], + // listView is the default view + list: [pandora.user.ui.listView].concat( pandora.site.listViews.filter(function(view) { return view.id == pandora.user.ui.listView }).map(function(view) { return view.id; }) ), - item: Ox.merge( - // itemView is the default view, - // videoView is the default view if there is a duration - [pandora.user.ui.itemView, pandora.user.ui.videoView], + // itemView is the default view, + // videoView is the default view if there is a duration + item: [pandora.user.ui.itemView, pandora.user.ui.videoView].concat( pandora.site.itemViews.filter(function(view) { return [ pandora.user.ui.itemView, pandora.user.ui.videoView @@ -198,7 +196,7 @@ pandora.URL = (function() { sortKeys[itemsSection] = {list: {}, item: {}}; views[itemsSection].list.forEach(function(view) { - sortKeys[itemsSection].list[view] = Ox.merge( + sortKeys[itemsSection].list[view] = [].concat( // listSort[0].key is the default sort key Ox.getObjectById(pandora.site.sortKeys, pandora.user.ui.listSort[0].key) || pandora.isClipView(view) @@ -214,9 +212,13 @@ pandora.URL = (function() { }); views[itemsSection].item.forEach(function(view) { if (pandora.isClipView(view, true)) { - sortKeys[itemsSection].item[view] = Ox.merge( - // itemSort[0].key is the default sort key - [Ox.getObjectById(pandora.site.clipKeys, pandora.user.ui.itemSort[0].key)], + // itemSort[0].key is the default sort key + sortKeys[itemsSection].item[view] = [ + Ox.getObjectById( + pandora.site.clipKeys, + pandora.user.ui.itemSort[0].key + ) + ].concat( pandora.site.clipKeys.filter(function(key) { return key.id == pandora.user.ui.itemSort[0].key; }) @@ -238,13 +240,13 @@ pandora.URL = (function() { } }; - findKeys = Ox.merge([{id: 'list', type: 'string'}], pandora.site.itemKeys); + findKeys = [{id: 'list', type: 'string'}].concat(pandora.site.itemKeys); self.URL = Ox.URL({ findKeys: findKeys, getItem: pandora.getItemByIdOrTitle, getSpan: pandora.getMetadataByIdOrName, - pages: Ox.merge( + pages: [].concat( ['home', 'software', 'api', 'help', 'tv'], pandora.site.sitePages.map(function(page) { return page.id; diff --git a/static/js/pandora/account.js b/static/js/pandora/account.js index 21faf4d8..bd8dfcf1 100644 --- a/static/js/pandora/account.js +++ b/static/js/pandora/account.js @@ -84,7 +84,7 @@ pandora.ui.accountDialogOptions = function(action, value) { } return { - buttons: Ox.merge( + buttons: [].concat( buttons[action].map(function(type) { return button(type); }), diff --git a/static/js/pandora/annotationDialog.js b/static/js/pandora/annotationDialog.js index 0ceac691..42139c09 100644 --- a/static/js/pandora/annotationDialog.js +++ b/static/js/pandora/annotationDialog.js @@ -4,7 +4,7 @@ pandora.ui.annotationDialog = function(layer) { var isEditor = pandora.user.ui.itemView == 'editor', $dialog = Ox.Dialog({ - buttons: Ox.merge( + buttons: [].concat( isEditor ? [ Ox.Button({title: 'Sign Up...'}).bindEvent({ click: function() { diff --git a/static/js/pandora/browser.js b/static/js/pandora/browser.js index 0b016000..a20cee3a 100644 --- a/static/js/pandora/browser.js +++ b/static/js/pandora/browser.js @@ -87,7 +87,7 @@ pandora.ui.browser = function() { info = ( /^color/.test(format.type.toLowerCase()) ? Ox.Theme : Ox )['format' + Ox.toTitleCase(format.type)].apply( - this, Ox.merge([data[sortKey]], format.args || []) + this, [data[sortKey]].concat(format.args || []) ); } else { info = data[sortKey]; diff --git a/static/js/pandora/clipList.js b/static/js/pandora/clipList.js index 4007758f..dde43b3a 100644 --- a/static/js/pandora/clipList.js +++ b/static/js/pandora/clipList.js @@ -46,7 +46,7 @@ pandora.ui.clipList = function(videoRatio) { info = ( /^color/.test(format.type.toLowerCase()) ? Ox.Theme : Ox )['format' + Ox.toTitleCase(format.type)].apply( - this, Ox.merge([data[sortKey]], format.args || []) + this, [data[sortKey]].concat(format.args || []) ); } else { info = data[sortKey]; @@ -98,8 +98,7 @@ pandora.ui.clipList = function(videoRatio) { query: query }, data), callback); }, - keys: Ox.merge( - ['annotations', 'id', 'in', 'out'], + keys = ['annotations', 'id', 'in', 'out'].concat( !ui.item ? ['videoRatio'] : [] ), max: 1, diff --git a/static/js/pandora/filterForm.js b/static/js/pandora/filterForm.js index 3b7fd385..0522b6d2 100644 --- a/static/js/pandora/filterForm.js +++ b/static/js/pandora/filterForm.js @@ -15,20 +15,20 @@ pandora.ui.filterForm = function(list) { }, function(result) { that.append( that.$filter = Ox.Filter({ - findKeys: Ox.merge(pandora.site.itemKeys.map(function(itemKey) { + findKeys: pandora.site.itemKeys.map(function(itemKey) { var key = Ox.clone(itemKey); key.type = key.type == 'layer' ? Ox.getObjectById(pandora.site.layers, key.id).type : key.type; return key; - }), { + }).concat([{ id: 'list', title: 'List', type: 'list', values: result.data.items.map(function(item) { return item.id; }) - }), + }]), list: list ? null : { sort: pandora.user.ui.listSort, view: pandora.user.ui.listView diff --git a/static/js/pandora/findElement.js b/static/js/pandora/findElement.js index a902d221..8dee9c27 100644 --- a/static/js/pandora/findElement.js +++ b/static/js/pandora/findElement.js @@ -5,9 +5,9 @@ pandora.ui.findElement = function() { findKey = pandora.user.ui._findState.key, findValue = pandora.user.ui._findState.value, hasPressedClear = false, - previousFindKey = findKey; - var that = Ox.FormElementGroup({ - elements: Ox.merge(pandora.user.ui._list ? [ + previousFindKey = findKey, + that = Ox.FormElementGroup({ + elements: [].concat(pandora.user.ui._list ? [ pandora.$ui.findListSelect = Ox.Select({ items: [ {id: 'all', title: 'Find: All ' + pandora.site.itemName.plural}, @@ -27,7 +27,7 @@ pandora.ui.findElement = function() { ] : [], [ pandora.$ui.findSelect = Ox.Select({ id: 'select', - items: Ox.merge( + items: [].concat( pandora.site.findKeys.filter(function(key, i) { return !key.capability || pandora.site.capabilities[key.capability][pandora.user.level]; @@ -93,7 +93,7 @@ pandora.ui.findElement = function() { var findInList = pandora.user.ui._list && pandora.$ui.findListSelect.value() == 'list', key = pandora.$ui.findSelect.value(), - conditions = Ox.merge( + conditions = [].concat( findInList ? [{ key: 'list', value: pandora.user.ui._list, diff --git a/static/js/pandora/homePage.js b/static/js/pandora/homePage.js index b74146a7..92ffa753 100644 --- a/static/js/pandora/homePage.js +++ b/static/js/pandora/homePage.js @@ -37,7 +37,7 @@ pandora.ui.homePage = function() { // fixme: duplicated $select = Ox.Select({ id: 'select', - items: Ox.merge(pandora.site.findKeys.map(function(key) { + items: [].concat(pandora.site.findKeys.map(function(key) { return { id: key.id, title: 'Find: ' + key.title diff --git a/static/js/pandora/infoView.0xdb.js b/static/js/pandora/infoView.0xdb.js index e6c2b8d3..a0d2abad 100644 --- a/static/js/pandora/infoView.0xdb.js +++ b/static/js/pandora/infoView.0xdb.js @@ -598,7 +598,7 @@ pandora.ui.infoView = function(data) { } function renderCapabilities(rightsLevel) { - var capabilities = Ox.merge( + var capabilities = [].concat( canEdit ? [{name: 'canSeeItem', symbol: 'Find'}] : [], [ {name: 'canPlayClips', symbol: 'PlayInToOut'}, diff --git a/static/js/pandora/infoView.js b/static/js/pandora/infoView.js index 9024ccec..ef2932d7 100644 --- a/static/js/pandora/infoView.js +++ b/static/js/pandora/infoView.js @@ -571,7 +571,7 @@ pandora.ui.infoView = function(data) { } function renderCapabilities(rightsLevel) { - var capabilities = Ox.merge( + var capabilities = [].concat( canEdit ? [{name: 'canSeeItem', symbol: 'Find'}] : [], [ {name: 'canPlayClips', symbol: 'PlayInToOut'}, diff --git a/static/js/pandora/infoView.padma.js b/static/js/pandora/infoView.padma.js index 9024ccec..ef2932d7 100644 --- a/static/js/pandora/infoView.padma.js +++ b/static/js/pandora/infoView.padma.js @@ -571,7 +571,7 @@ pandora.ui.infoView = function(data) { } function renderCapabilities(rightsLevel) { - var capabilities = Ox.merge( + var capabilities = [].concat( canEdit ? [{name: 'canSeeItem', symbol: 'Find'}] : [], [ {name: 'canPlayClips', symbol: 'PlayInToOut'}, diff --git a/static/js/pandora/list.js b/static/js/pandora/list.js index 2aeb9f5d..2b4234f9 100644 --- a/static/js/pandora/list.js +++ b/static/js/pandora/list.js @@ -8,7 +8,7 @@ pandora.ui.list = function() { if (view == 'list') { that = Ox.TextList({ - columns: Ox.merge([{ + columns: [].concat([{ align: 'center', defaultWidth: 16, format: function(value, data) { @@ -139,7 +139,7 @@ pandora.ui.list = function() { info = ( /^color/.test(format.type.toLowerCase()) ? Ox.Theme : Ox )['format' + Ox.toTitleCase(format.type)].apply( - this, Ox.merge([data[sortKey]], format.args || []) + this, [data[sortKey]].concat(format.args || []) ); } else { info = data[sortKey]; @@ -192,7 +192,7 @@ pandora.ui.list = function() { info = ( /^color/.test(format.type.toLowerCase()) ? Ox.Theme : Ox )['format' + Ox.toTitleCase(format.type)].apply( - this, Ox.merge([data[sortKey]], format.args || []) + this, [data[sortKey]].concat(format.args || []) ); } else { info = data[sortKey]; @@ -272,7 +272,7 @@ pandora.ui.list = function() { info = ( /^color/.test(format.type.toLowerCase()) ? Ox.Theme : Ox )['format' + Ox.toTitleCase(format.type)].apply( - this, Ox.merge([data[sortKey]], format.args || []) + this, [data[sortKey]].concat(format.args || []) ); } else { info = data[sortKey]; @@ -525,15 +525,15 @@ pandora.ui.list = function() { }; } else { query = { - conditions: Ox.merge([ - pandora.user.ui.find - ], data.rest.map(function(id) { - return { - key: 'id', - value: id, - operator: '!=' - }; - })), + conditions: [pandora.user.ui.find].concat( + data.rest.map(function(id) { + return { + key: 'id', + value: id, + operator: '!=' + }; + }) + ), operator: '&' }; } diff --git a/static/js/pandora/listDialog.js b/static/js/pandora/listDialog.js index b0e5ae67..7c2fb099 100644 --- a/static/js/pandora/listDialog.js +++ b/static/js/pandora/listDialog.js @@ -7,7 +7,7 @@ pandora.ui.listDialog = function(section) { section = section || 'general'; var width = getWidth(section); var listData = pandora.getListData(), - tabs = Ox.merge([ + tabs = [].concat([ {id: 'general', title: 'General'}, {id: 'icon', title: 'Icon'} ], listData.type == 'smart' @@ -494,8 +494,7 @@ pandora.ui.listIconPanel = function(listData) { items: function(data, callback) { pandora.api.find(Ox.extend(data, { query: { - conditions: Ox.merge( - [{key: 'list', value: listData.id, operator: '=='}], + conditions: [{key: 'list', value: listData.id, operator: '=='}].concat( value !== '' ? [{key: key, value: value, operator: '='}] : [] ), operator: '&' diff --git a/static/js/pandora/logsDialog.js b/static/js/pandora/logsDialog.js index 4414570d..5a37a733 100644 --- a/static/js/pandora/logsDialog.js +++ b/static/js/pandora/logsDialog.js @@ -232,7 +232,7 @@ pandora.ui.logsDialog = function() { function updateList(key, value) { var query = { - conditions: Ox.merge( + conditions: [].concat( key != 'url' ? [{key: 'user', value: value, operator: '='}] : [], key != 'user' ? [{key: 'url', value: value, operator: '='}] : [] ), diff --git a/static/js/pandora/menu.js b/static/js/pandora/menu.js index de8bca6e..c4cd3a27 100644 --- a/static/js/pandora/menu.js +++ b/static/js/pandora/menu.js @@ -12,9 +12,9 @@ pandora.ui.mainMenu = function() { }) ], id: 'mainMenu', - menus: Ox.merge( + menus: [].concat( [ - { id: pandora.site.site.id + 'Menu', title: pandora.site.site.name, items: Ox.merge( + { id: pandora.site.site.id + 'Menu', title: pandora.site.site.name, items: [].concat( [ { id: 'home', title: 'Home' }, {} @@ -58,7 +58,7 @@ pandora.ui.mainMenu = function() { }, view); }) }, ]}, - { id: 'icons', title: 'Icons', items: Ox.merge([ + { id: 'icons', title: 'Icons', items: [].concat([ { group: 'viewicons', min: 1, max: 1, items: ['posters', 'frames'].map(function(icons) { return {id: icons, title: Ox.toTitleCase(icons), checked: ui.icons == icons}; }) } @@ -255,7 +255,7 @@ pandora.ui.mainMenu = function() { } }, click: function(data) { - if (Ox.merge( + if ([].concat( ['home', 'software'], pandora.site.sitePages.map(function(page) { return page.id; @@ -552,7 +552,7 @@ pandora.ui.mainMenu = function() { } function getListMenu(lists) { - return { id: 'listMenu', title: 'List', items: Ox.merge( + return { id: 'listMenu', title: 'List', items: [].concat( { id: 'allitems', title: 'All ' + pandora.site.itemName.plural, checked: !ui.item && !ui._list, keyboard: 'shift control w' }, ['personal', 'favorite', 'featured'].map(function(folder) { return { @@ -600,7 +600,7 @@ pandora.ui.mainMenu = function() { }) : []; return { id: 'sortMenu', title: 'Sort', items: [ { id: 'sortitems', title: 'Sort ' + (isClipView || ui.item ? 'Clips' : pandora.site.itemName.plural) + ' by', items: [ - { group: 'listsort', min: 1, max: 1, items: Ox.merge( + { group: 'listsort', min: 1, max: 1, items: [].concat( items, pandora.site.sortKeys.filter(function(key) { return Ox.getIndexById(items, key.id) == -1 && ( diff --git a/static/js/pandora/siteDialog.js b/static/js/pandora/siteDialog.js index aed72ae9..cbf02c7e 100644 --- a/static/js/pandora/siteDialog.js +++ b/static/js/pandora/siteDialog.js @@ -7,10 +7,7 @@ pandora.ui.siteDialog = function(section) { var dialogHeight = Math.round((window.innerHeight - 48) * 0.75), dialogWidth = Math.round(window.innerWidth * 0.75), isEditable = pandora.site.capabilities.canEditSitePages[pandora.user.level], - tabs = Ox.merge( - Ox.clone(pandora.site.sitePages, true), - [{id: 'software', title: 'Software'}] - ); + tabs = pandora.site.sitePages.concat([{id: 'software', title: 'Software'}]); Ox.getObjectById(tabs, section).selected = true; var $tabPanel = Ox.TabPanel({ content: function(id) { @@ -70,7 +67,7 @@ pandora.ui.siteDialog = function(section) { .css({width: '128px', height: '128px', marginBottom: '8px'}) .appendTo($right); risk = ['Unknown', 'Severe', 'High', 'Significant', 'General', 'Low']; - Ox.merge( + [].concat( ['Unknown'], pandora.site.rightsLevels.map(function(rightsLevel) { return rightsLevel.name; diff --git a/static/js/pandora/sortMenu.js b/static/js/pandora/sortMenu.js index 906d895c..c95c4a65 100644 --- a/static/js/pandora/sortMenu.js +++ b/static/js/pandora/sortMenu.js @@ -7,7 +7,7 @@ pandora.ui.sortMenu = function() { // FIXME: unused var that = Ox.MenuButton({ - items: Ox.merge( + items: [].concat( pandora.site.clipKeys.map(function(key) { return Ox.extend(Ox.clone(key), { checked: key.id == pandora.user.ui.itemSort[0].key, diff --git a/static/js/pandora/sortSelect.js b/static/js/pandora/sortSelect.js index d29ac8d0..a1c5dfbf 100644 --- a/static/js/pandora/sortSelect.js +++ b/static/js/pandora/sortSelect.js @@ -13,7 +13,7 @@ pandora.ui.sortSelect = function(isNavigationView) { sortKey = !pandora.user.ui.item ? 'listSort' : 'itemSort', that; if (!pandora.user.ui.item) { - items = Ox.merge( + items = [].concat( items, pandora.site.sortKeys.filter(function(key) { return Ox.getIndexById(items, key.id) == -1 && ( diff --git a/static/js/pandora/statisticsDialog.js b/static/js/pandora/statisticsDialog.js index 2b1e4bb3..aefecf53 100644 --- a/static/js/pandora/statisticsDialog.js +++ b/static/js/pandora/statisticsDialog.js @@ -26,7 +26,7 @@ pandora.ui.statisticsDialog = function() { }, dialogHeight = Math.round((window.innerHeight - 48) * 0.9), dialogWidth = Math.round(window.innerWidth * 0.9), - names = Ox.merge(Object.keys(colors.system), Object.keys(colors.browser)), + names = Object.keys(colors.system).concat(Object.keys(colors.browser)), tabs = [ {id: 'seen', title: 'First Seen & Last Seen', selected: true}, {id: 'locations', title: 'Locations'}, diff --git a/static/js/pandora/usersDialog.js b/static/js/pandora/usersDialog.js index 907c79e1..96380448 100644 --- a/static/js/pandora/usersDialog.js +++ b/static/js/pandora/usersDialog.js @@ -16,12 +16,9 @@ pandora.ui.usersDialog = function() { 'Android', 'BSD', 'iOS', 'Linux', 'Mac OS X', 'Unix', 'Windows' ], - userLevels = Ox.merge( - pandora.site.userLevels.map(function(userLevel) { - return Ox.toTitleCase(userLevel); - }), - ['Robot'] - ), + userLevels = pandora.site.userLevels.map(function(userLevel) { + return Ox.toTitleCase(userLevel); + }).concat(['Robot']), $reloadButton = Ox.Button({ title: 'redo', @@ -968,11 +965,11 @@ pandora.ui.usersDialog = function() { value = $findInput.value(), query = { conditions: value - ? Ox.merge( + ? [].concat( key != 'email' ? [{key: 'username', value: value, operator: '='}] : [], key != 'username' ? [{key: 'email', value: value, operator: '='}] : [] ) - : Ox.merge( + : [].concat( !guests ? [{key: 'level', value: 'guest', operator: '!='}] : [], !robots ? [{key: 'level', value: 'robot', operator: '!='}] : [] ), diff --git a/static/js/pandora/utils.js b/static/js/pandora/utils.js index 686ccc19..262a1f61 100644 --- a/static/js/pandora/utils.js +++ b/static/js/pandora/utils.js @@ -770,7 +770,7 @@ pandora.getMetadataByIdOrName = function(item, view, str, callback) { }; pandora.getPageTitle = function(stateOrURL) { - var pages = Ox.merge([ + var pages = [ {id: '', title: ''}, {id: 'help', title: 'Help'}, {id: 'home', title: ''}, @@ -780,7 +780,7 @@ pandora.getPageTitle = function(stateOrURL) { {id: 'signup', title: 'Sign Up'}, {id: 'software', title: 'Software'}, {id: 'tv', title: 'TV'} - ], pandora.site.sitePages), + ].concat(pandora.site.sitePages), page = Ox.getObjectById( pages, Ox.isObject(stateOrURL) ? stateOrURL.page : stateOrURL.substr(1) @@ -830,13 +830,12 @@ pandora.getVideoOptions = function(data) { options.censored = canPlayVideo ? [] : canPlayClips ? ( options.subtitles.length - ? Ox.merge( - options.subtitles.map(function(subtitle, i) { - return { - 'in': i == 0 ? 0 : options.subtitles[i - 1].out, - out: subtitle['in'] - }; - }), + ? options.subtitles.map(function(subtitle, i) { + return { + 'in': i == 0 ? 0 : options.subtitles[i - 1].out, + out: subtitle['in'] + }; + }).concat( [{'in': Ox.last(options.subtitles).out, out: data.duration}] ).filter(function(censored) { // don't include gaps shorter than one second diff --git a/static/js/pandora/viewSelect.js b/static/js/pandora/viewSelect.js index 14c2e8e8..a713d38b 100644 --- a/static/js/pandora/viewSelect.js +++ b/static/js/pandora/viewSelect.js @@ -16,7 +16,7 @@ pandora.ui.viewSelect = function() { viewKey == 'itemView' && pandora.site.capabilities.canSeeExtraItemViews[pandora.user.level] ) { - Ox.merge(items, [ + items = items.concat([ {}, {id: 'data', title: 'View Data'}, {id: 'files', title: 'View Files'}