From a786f5d9bcb1d1a90faff2934611b3daaf4f50d2 Mon Sep 17 00:00:00 2001 From: j Date: Tue, 23 Jul 2019 11:26:13 +0200 Subject: [PATCH] remove unused code --- static/js/uploadVideoDialog.js | 599 --------------------------------- static/js/utils.js | 5 +- 2 files changed, 2 insertions(+), 602 deletions(-) delete mode 100644 static/js/uploadVideoDialog.js diff --git a/static/js/uploadVideoDialog.js b/static/js/uploadVideoDialog.js deleted file mode 100644 index cb455a67..00000000 --- a/static/js/uploadVideoDialog.js +++ /dev/null @@ -1,599 +0,0 @@ -'use strict'; - -pandora.ui.uploadVideoDialog = function(data) { - - var cancelled = false, - file, - hasFirefogg = !(Ox.isUndefined(window.Firefogg)) && ( - $.browser.version < '35' || Firefogg().version >= 334 - ), - infoContent = Ox._('Please select the video file that you want to upload.'), - itemView = pandora.hasCapability('canSeeExtraItemViews') ? 'media' : 'info', - selectFile, - $actionButton, - $closeButton, - $content = Ox.Element().css({margin: '16px'}), - $info = $('
') - .css({padding: '4px'}) - .html(infoContent), - $progress, - $status = $('
').css({padding: '4px', paddingTop: '8px'}), - that = Ox.Dialog({ - buttons: [ - $closeButton = Ox.Button({ - id: 'close', - title: Ox._('Close') - }).css({ - float: 'left' - }).bindEvent({ - click: function() { - if ($closeButton.options('title') == Ox._('Cancel')) { - cancelled = true; - $info.html(infoContent); - $status.html(''); - pandora.firefogg && pandora.firefogg.cancel(); - pandora.$ui.upload && pandora.$ui.upload.abort(); - $closeButton.options('title', Ox._('Close')); - if ($actionButton.options('title') == Ox._('Upload')) { - $closeButton.options('title', Ox._('Close')); - $actionButton.replaceWith($actionButton = hasFirefogg - ? getFirefoggButton() - : getSelectVideoButton() - ); - } - $actionButton.show(); - } else { - that.triggerEvent('close'); - } - } - }), - $actionButton = hasFirefogg ? getFirefoggButton() : getSelectVideoButton() - ], - content: $content, - height: 128, - removeOnClose: true, - width: 368, - title: Ox._('Upload Video'), - }) - .bindEvent({ - close: function(data) { - if (pandora.firefogg) { - pandora.firefogg.cancel(); - delete pandora.firefogg; - } - that.close(); - } - }); - - if (!pandora.site.itemRequiresVideo && !pandora.user.ui.item) { - $info.html(Ox._( - 'You can only upload a video to an existing {0}.' - + ' Please check if an entry for the {0}' - + ' you want to upload exists, and create one otherwise.', - [pandora.site.itemName.singular.toLowerCase()] - )); - $actionButton.hide(); - } - $content.append($info); - $content.append($status); - - function aspectratio(ratio) { - var denominator, numerator; - ratio = ratio.split(':'); - numerator = ratio[0]; - if (ratio.length == 2) { - denominator = ratio[1]; - } - if (Math.abs(numerator / denominator - 4/3) < 0.03) { - numerator = 4; - denominator = 3; - } else if (Math.abs(numerator / denominator - 16/9) < 0.02) { - numerator = 16; - denominator = 9; - } - return { - denominator: denominator, - 'float': numerator / denominator, - numerator: numerator, - ratio: numerator + ':' + denominator - }; - } - - function resetProgress(status) { - $progress = Ox.Progressbar({ - progress: 0, - showPercent: true, - showTime: true, - width: 304 - }); - $status.html(status || '').append($progress); - } - - function directUpload(file, info) { - resetProgress(); - pandora.api.addMedia({ - filename: info.name, - id: info.oshash, - item: pandora.site.itemRequiresVideo - ? undefined - : pandora.user.ui.item - }, function(result) { - uploadStream(result.data.item, info, file); - }); - } - - function encode() { - var filename = pandora.firefogg.sourceFilename, - info = JSON.parse(pandora.firefogg.sourceInfo), - item, - oshash = info.oshash; - $info.html('' + filename + '
' + Ox._('encoding...')); - resetProgress(); - pandora.api.addMedia({ - filename: filename, - id: oshash, - info: info, - item: pandora.site.itemRequiresVideo - ? undefined - : pandora.user.ui.item - }, function(result) { - item = result.data.item; - pandora.firefogg.encode( - getEncodingOptions(info), - function(result, file) { - result = JSON.parse(result); - if (result.progress != 1) { - $status.html( - cancelled - ? Ox._('Encoding cancelled.') - : Ox._('Encoding failed.') - ); - delete pandora.firefogg; - return; - } - setTimeout(function() { - $info.html( - '' + filename + '
' - + Ox._('uploading...') - ); - uploadStream(item, info, file); - }); - }, - Ox.throttle(function(progress) { - progress = JSON.parse(progress).progress || 0; - $progress.options({progress: progress}); - }, 1000) - ); - }); - } - - function getInfo(file, callback) { - Ox.oshash(file, function(oshash) { - var $video = $('