diff --git a/assets/javascripts/plupload/i18n/fa.js b/assets/javascripts/plupload/i18n/fa.js index 3ebe51dc..af36e228 100644 --- a/assets/javascripts/plupload/i18n/fa.js +++ b/assets/javascripts/plupload/i18n/fa.js @@ -29,7 +29,7 @@ plupload.addI18n({ 'Close': 'بستن', '%d files queued': '%d فایل در صف', 'Using runtime: ': 'استفاده میکنید از : ', - 'File: %f, size: %s, max file size: %m':' فایل: %f, سایز: %s, بزرگترین سایز فایل: %m', + 'File: %f, size: %s, max file size: %m': فایل: %f, سایز: %s, بزرگترین سایز فایل: %m', 'Upload element accepts only %d file(s) at a time. Extra files were stripped.': 'عنصر بارگذار فقط %d فایل رو در یک زمان می پذیرد. سایر فایل ها مجرد از این موضوع هستند.', 'Upload URL might be wrong or doesn\'t exist': 'آدرس آپلود اشتباه می باشد یا وجود ندارد', 'Error: File too large: ': 'خطا: فایل حجیم است :: ', diff --git a/assets/javascripts/plupload/i18n/fr.js b/assets/javascripts/plupload/i18n/fr.js index 2ea06655..13a103b7 100644 --- a/assets/javascripts/plupload/i18n/fr.js +++ b/assets/javascripts/plupload/i18n/fr.js @@ -3,33 +3,23 @@ plupload.addI18n({ 'Select files' : 'Sélectionnez les fichiers', 'Add files to the upload queue and click the start button.' : 'Ajoutez des fichiers à la file et appuyez sur le bouton démarrer.', 'Filename' : 'Nom de fichier', - 'Status' : 'Statut', + 'Status' : 'Status', 'Size' : 'Taille', 'Add files' : 'Ajouter Fichiers', 'Stop current upload' : 'Arrêter l\'envoi en cours', 'Start uploading queue' : 'Démarrer l\'envoi', 'Uploaded %d/%d files': '%d/%d fichiers envoyés', 'N/A' : 'Non applicable', - 'Drag files here.' : 'Déposer les fichiers ici', + 'Drag files here.' : 'Déposer les fichiers ici.', 'File extension error.': 'Erreur extension fichier', - 'File size error.': 'Erreur taille fichier', - 'Init error.': 'Erreur d\'initialisation', - 'HTTP Error.': 'Erreur HTTP', - 'Security error.': 'Erreur de sécurité', - 'Generic error.': 'Erreur générique', - 'IO error.': 'Erreur E/S', - 'Stop Upload': 'Arrêter les envois', + 'File size error.': 'Erreur taille fichier.', + 'Init error.': 'Erreur d\'initialisation.', + 'HTTP Error.': 'Erreur HTTP.', + 'Security error.': 'Erreur de sécurité.', + 'Generic error.': 'Erreur générique.', + 'IO error.': 'Erreur E/S.', + 'Stop Upload': 'Arrêter les envois.', 'Add Files': 'Ajouter des fichiers', - 'Start Upload': 'Démarrer les envois', - '%d files queued': '%d fichiers en attente', - 'File: %s':'Fichier: %s', - 'Close':'Fermer', - 'Using runtime:':'Moteur logiciel :', - 'File: %f, size: %s, max file size: %m':'Fichier: %f, poids: %s, poids maximal : %m', - 'Upload element accepts only %d file(s) at a time. Extra files were stripped.':'La file accepte %d fichier(s) à la fois. Les fichiers en trop sont ignorés.', - 'Upload URL might be wrong or doesn\'t exist':'L\'URL d\'envoi est erronée ou inexistante.', - 'Error: File to large: ':'Fichier trop volumineux : ', - 'Error: Invalid file extension: ':'Extension de fichier invalide : ', - 'File size error.':'Erreur de taille de fichier', - 'File count error.':'Erreur de comptage des fichiers' -}); + 'Start Upload': 'Démarrer les envois.', + '%d files queued': '%d fichiers en attente.' +}); \ No newline at end of file diff --git a/assets/javascripts/plupload/i18n/ru.js b/assets/javascripts/plupload/i18n/ru.js index 2a3a867a..41a2cfc7 100644 --- a/assets/javascripts/plupload/i18n/ru.js +++ b/assets/javascripts/plupload/i18n/ru.js @@ -8,7 +8,7 @@ plupload.addI18n({ 'Add files' : 'Добавить файлы', 'Stop current upload' : 'Остановить загрузку', 'Start uploading queue' : 'Загрузить файлы', - 'Uploaded %d/%d files': 'Загружено %d из %d файлов', + 'Uploaded %d/%d files': 'Загружено %d/%d файлов', 'N/A' : 'N/D', 'Drag files here.' : 'Перетащите файлы сюда.', 'File extension error.': 'Неправильное расширение файла.', diff --git a/assets/javascripts/plupload/i18n/sk.js b/assets/javascripts/plupload/i18n/sk.js new file mode 100644 index 00000000..8b4b2d95 --- /dev/null +++ b/assets/javascripts/plupload/i18n/sk.js @@ -0,0 +1,25 @@ +// .po file like language pack +plupload.addI18n({ + 'Select files' : 'Vyberte súbory', + 'Add files to the upload queue and click the start button.' : 'Pridajte súbory do zoznamu a potom spustite nahrávanie.', + 'Filename' : 'Názov súboru', + 'Status' : 'Stav', + 'Size' : 'Veľkosť', + 'Add files' : 'Pridať súbory', + 'Stop current upload' : 'Zastaviť nahrávanie', + 'Start uploading queue' : 'Spustiť nahrávanie zoznamu', + 'Drag files here.' : 'Sem pretiahnite súbory.', + 'Start upload': 'Spustiť nahrávanie', + 'Uploaded %d/%d files': 'Nahraných %d/%d súborov', + 'Using runtime: ': 'K odoslaniu súborov sa použije rozhranie: ', + 'N/A' : 'N/A', + 'File extension error.': 'Chybný typ súboru.', + 'File size error.': 'Súbor je príliš veľký.', + 'Init error.': 'Chyba inicializácie.', + 'HTTP Error.': 'HTTP Chyba.', + 'Security error.': 'Bezpečnostná Chyba.', + 'Generic error.': 'Chyba.', + 'IO error.': 'IO Chyba', + 'Stop Upload': 'Zastaviť nahrávanie', + '%d files queued': '%d súborov pridaných do zoznamu' +}); \ No newline at end of file diff --git a/assets/javascripts/plupload/i18n/sr.js b/assets/javascripts/plupload/i18n/sr.js index 38402645..5aa42d56 100644 --- a/assets/javascripts/plupload/i18n/sr.js +++ b/assets/javascripts/plupload/i18n/sr.js @@ -1,4 +1,4 @@ -// Serbian +// Serbian plupload.addI18n({ 'Select files' : 'Izaberite fajlove', 'Add files to the upload queue and click the start button.' : 'Dodajte fajlove u listu i kliknite na dugme Start.', diff --git a/assets/javascripts/plupload/i18n/sv.js b/assets/javascripts/plupload/i18n/sv.js index 20747944..74097843 100644 --- a/assets/javascripts/plupload/i18n/sv.js +++ b/assets/javascripts/plupload/i18n/sv.js @@ -1,4 +1,4 @@ -// .po file like language pack +// .po file like language pack plupload.addI18n({ 'Select files' : 'Välj filer', 'Add files to the upload queue and click the start button.' : 'Lägg till filer till kön och tryck på start.', diff --git a/assets/javascripts/plupload/i18n/zh-TW.js b/assets/javascripts/plupload/i18n/zh-TW.js deleted file mode 100644 index 8c47f167..00000000 --- a/assets/javascripts/plupload/i18n/zh-TW.js +++ /dev/null @@ -1,37 +0,0 @@ -// Traditional Chinese, translated by aecho1028@gmail.com. -plupload.addI18n({ - 'Select files' : '選取檔案', - 'Add files to the upload queue and click the start button.' : '新增檔案到上傳佇列,然後請點擊開始按鈕。', - 'Filename' : '檔案名稱', - 'Status' : '狀態', - 'Size' : '檔案大小', - 'Add Files' : '新增檔案', - 'Stop Upload' : '停止上傳', - 'Start Upload' : '開始上傳', - 'Add files' : '新增檔案', - 'Add files.' : '新增檔案', - 'Stop current upload' : '停止現在的上傳', - 'Start uploading queue' : '開始上傳', - 'Stop upload' : '停止上傳', - 'Start upload' : '開始上傳', - 'Uploaded %d/%d files': '己上傳 %d/%d 檔案', - 'N/A' : 'N/A', - 'Drag files here.' : '將檔案拖拉到這邊', - 'File extension error.': '副檔名錯誤', - 'File size error.': '檔案大小錯誤', - 'File count error.': '檔案筆數錯誤', - 'Init error.': '初始化錯誤', - 'HTTP Error.': 'HTTP錯誤', - 'Security error.': '安全性錯誤', - 'Generic error.': '錯誤', - 'IO error.': 'IO錯誤', - 'File: %s': '檔案: %s', - 'Close': '關閉', - '%d files queued': '%d 檔案佇列中', - 'Using runtime: ': 'Using runtime: ', - 'File: %f, size: %s, max file size: %m': '檔案: %f, 大小: %s, 最大檔案大小: %m', - 'Upload element accepts only %d file(s) at a time. Extra files were stripped.': '一次只能上傳 %d 個檔案。多餘的檔案將會被捨棄。', - 'Upload URL might be wrong or doesn\'t exist': '上傳的URL可能不正確,或是不存在。', - 'Error: File too large: ': '錯誤: 檔案太大了: ', - 'Error: Invalid file extension: ': '錯誤: 副檔名不正確: ' -}); diff --git a/assets/javascripts/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css b/assets/javascripts/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css new file mode 100644 index 00000000..4f377e22 --- /dev/null +++ b/assets/javascripts/plupload/jquery.plupload.queue/css/jquery.plupload.queue.css @@ -0,0 +1,177 @@ +/* + Plupload +------------------------------------------------------------------- */ + +.plupload_button { + display: -moz-inline-box; /* FF < 3*/ + display: inline-block; + font: normal 12px sans-serif; + text-decoration: none; + color: #42454a; + border: 1px solid #bababa; + padding: 2px 8px 3px 20px; + margin-right: 4px; + background: #f3f3f3 url('../img/buttons.png') no-repeat 0 center; + outline: 0; + + /* Optional rounded corners for browsers that support it */ + -moz-border-radius: 3px; + -khtml-border-radius: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; +} + +.plupload_button:hover { + color: #000; + text-decoration: none; +} + +.plupload_disabled, a.plupload_disabled:hover { + color: #737373; + border-color: #c5c5c5; + background: #ededed url('../img/buttons-disabled.png') no-repeat 0 center; + cursor: default; +} + +.plupload_add { + background-position: -181px center; +} + +.plupload_wrapper { + font: normal 11px Verdana,sans-serif; + width: 100%; +} + +.plupload_container { + padding: 8px; + background: url('../img/transp50.png'); + /*-moz-border-radius: 5px;*/ +} + +.plupload_container input { + border: 1px solid #DDD; + font: normal 11px Verdana,sans-serif; + width: 98%; +} + +.plupload_header {background: #2A2C2E url('../img/backgrounds.gif') repeat-x;} +.plupload_header_content { + background: url('../img/backgrounds.gif') no-repeat 0 -317px; + min-height: 56px; + padding-left: 60px; + color: #FFF; +} +.plupload_header_title { + font: normal 18px sans-serif; + padding: 6px 0 3px; +} +.plupload_header_text { + font: normal 12px sans-serif; +} + +.plupload_filelist { + margin: 0; + padding: 0; + list-style: none; +} + +.plupload_scroll .plupload_filelist { + height: 185px; + background: #F5F5F5; + overflow-y: scroll; +} + +.plupload_filelist li { + padding: 10px 8px; + background: #F5F5F5 url('../img/backgrounds.gif') repeat-x 0 -156px; + border-bottom: 1px solid #DDD; +} + +.plupload_filelist_header, .plupload_filelist_footer { + background: #DFDFDF; + padding: 8px 8px; + color: #42454A; +} +.plupload_filelist_header { + border-top: 1px solid #EEE; + border-bottom: 1px solid #CDCDCD; +} + +.plupload_filelist_footer {border-top: 1px solid #FFF; height: 22px; line-height: 20px; vertical-align: middle;} +.plupload_file_name {float: left; overflow: hidden} +.plupload_file_status {color: #777;} +.plupload_file_status span {color: #42454A;} +.plupload_file_size, .plupload_file_status, .plupload_progress { + float: right; + width: 80px; +} +.plupload_file_size, .plupload_file_status, .plupload_file_action {text-align: right;} + +.plupload_filelist .plupload_file_name {width: 205px} + +.plupload_file_action { + float: right; + width: 16px; + height: 16px; + margin-left: 15px; +} + +.plupload_file_action * { + display: none; + width: 16px; + height: 16px; +} + +li.plupload_uploading {background: #ECF3DC url('../img/backgrounds.gif') repeat-x 0 -238px;} +li.plupload_done {color:#AAA} + +li.plupload_delete a { + background: url('../img/delete.gif'); +} + +li.plupload_failed a { + background: url('../img/error.gif'); + cursor: default; +} + +li.plupload_done a { + background: url('../img/done.gif'); + cursor: default; +} + +.plupload_progress, .plupload_upload_status { + display: none; +} + +.plupload_progress_container { + margin-top: 3px; + border: 1px solid #CCC; + background: #FFF; + padding: 1px; +} +.plupload_progress_bar { + width: 0px; + height: 7px; + background: #CDEB8B; +} + +.plupload_scroll .plupload_filelist_header .plupload_file_action, .plupload_scroll .plupload_filelist_footer .plupload_file_action { + margin-right: 17px; +} + +/* Floats */ + +.plupload_clear,.plupload_clearer {clear: both;} +.plupload_clearer, .plupload_progress_bar { + display: block; + font-size: 0; + line-height: 0; +} + +li.plupload_droptext { + background: transparent; + text-align: center; + vertical-align: middle; + border: 0; + line-height: 165px; +} diff --git a/assets/javascripts/plupload/jquery.plupload.queue/img/backgrounds.gif b/assets/javascripts/plupload/jquery.plupload.queue/img/backgrounds.gif new file mode 100644 index 00000000..39e33ebc Binary files /dev/null and b/assets/javascripts/plupload/jquery.plupload.queue/img/backgrounds.gif differ diff --git a/assets/javascripts/plupload/jquery.plupload.queue/img/buttons-disabled.png b/assets/javascripts/plupload/jquery.plupload.queue/img/buttons-disabled.png new file mode 100644 index 00000000..afa11af9 Binary files /dev/null and b/assets/javascripts/plupload/jquery.plupload.queue/img/buttons-disabled.png differ diff --git a/assets/javascripts/plupload/jquery.plupload.queue/img/buttons.png b/assets/javascripts/plupload/jquery.plupload.queue/img/buttons.png new file mode 100644 index 00000000..153e7388 Binary files /dev/null and b/assets/javascripts/plupload/jquery.plupload.queue/img/buttons.png differ diff --git a/assets/javascripts/plupload/jquery.plupload.queue/img/delete.gif b/assets/javascripts/plupload/jquery.plupload.queue/img/delete.gif new file mode 100644 index 00000000..78ca8b3b Binary files /dev/null and b/assets/javascripts/plupload/jquery.plupload.queue/img/delete.gif differ diff --git a/assets/javascripts/plupload/jquery.plupload.queue/img/done.gif b/assets/javascripts/plupload/jquery.plupload.queue/img/done.gif new file mode 100644 index 00000000..29f3ed7c Binary files /dev/null and b/assets/javascripts/plupload/jquery.plupload.queue/img/done.gif differ diff --git a/assets/javascripts/plupload/jquery.plupload.queue/img/error.gif b/assets/javascripts/plupload/jquery.plupload.queue/img/error.gif new file mode 100644 index 00000000..4682b630 Binary files /dev/null and b/assets/javascripts/plupload/jquery.plupload.queue/img/error.gif differ diff --git a/assets/javascripts/plupload/jquery.plupload.queue/img/throbber.gif b/assets/javascripts/plupload/jquery.plupload.queue/img/throbber.gif new file mode 100644 index 00000000..4ae8b16a Binary files /dev/null and b/assets/javascripts/plupload/jquery.plupload.queue/img/throbber.gif differ diff --git a/assets/javascripts/plupload/jquery.plupload.queue/img/transp50.png b/assets/javascripts/plupload/jquery.plupload.queue/img/transp50.png new file mode 100644 index 00000000..eb0efe10 Binary files /dev/null and b/assets/javascripts/plupload/jquery.plupload.queue/img/transp50.png differ diff --git a/assets/javascripts/plupload/jquery.plupload.queue/jquery.plupload.queue.js b/assets/javascripts/plupload/jquery.plupload.queue/jquery.plupload.queue.js new file mode 100644 index 00000000..cd5d66fc --- /dev/null +++ b/assets/javascripts/plupload/jquery.plupload.queue/jquery.plupload.queue.js @@ -0,0 +1,336 @@ +/** + * jquery.plupload.queue.js + * + * Copyright 2009, Moxiecode Systems AB + * Released under GPL License. + * + * License: http://www.plupload.com/license + * Contributing: http://www.plupload.com/contributing + */ + +// JSLint defined globals +/*global plupload:false, jQuery:false, alert:false */ + +(function($) { + var uploaders = {}; + + function _(str) { + return plupload.translate(str) || str; + } + + function renderUI(id, target) { + // Remove all existing non plupload items + target.contents().each(function(i, node) { + node = $(node); + + if (!node.is('.plupload')) { + node.remove(); + } + }); + + target.prepend( + '
' + + '
' + + '
' + + '
' + + '
' + + '
' + _('Select files') + '
' + + '
' + _('Add files to the upload queue and click the start button.') + '
' + + '
' + + '
' + + + '
' + + '
' + + '
' + _('Filename') + '
' + + '
 
' + + '
' + _('Status') + '
' + + '
' + _('Size') + '
' + + '
 
' + + '
' + + + '
    ' + + + '' + + '
    ' + + '
    ' + + '
    ' + + '' + + '
    ' + ); + } + + $.fn.pluploadQueue = function(settings) { + if (settings) { + this.each(function() { + var uploader, target, id; + + target = $(this); + id = target.attr('id'); + + if (!id) { + id = plupload.guid(); + target.attr('id', id); + } + + uploader = new plupload.Uploader($.extend({ + dragdrop : true, + container : id + }, settings)); + + uploaders[id] = uploader; + + function handleStatus(file) { + var actionClass; + + if (file.status == plupload.DONE) { + actionClass = 'plupload_done'; + } + + if (file.status == plupload.FAILED) { + actionClass = 'plupload_failed'; + } + + if (file.status == plupload.QUEUED) { + actionClass = 'plupload_delete'; + } + + if (file.status == plupload.UPLOADING) { + actionClass = 'plupload_uploading'; + } + + var icon = $('#' + file.id).attr('class', actionClass).find('a').css('display', 'block'); + if (file.hint) { + icon.attr('title', file.hint); + } + } + + function updateTotalProgress() { + $('span.plupload_total_status', target).html(uploader.total.percent + '%'); + $('div.plupload_progress_bar', target).css('width', uploader.total.percent + '%'); + $('span.plupload_upload_status', target).html( + _('Uploaded %d/%d files').replace(/%d\/%d/, uploader.total.uploaded+'/'+uploader.files.length) + ); + } + + function updateList() { + var fileList = $('ul.plupload_filelist', target).html(''), inputCount = 0, inputHTML; + + $.each(uploader.files, function(i, file) { + inputHTML = ''; + + if (file.status == plupload.DONE) { + if (file.target_name) { + inputHTML += ''; + } + + inputHTML += ''; + inputHTML += ''; + + inputCount++; + + $('#' + id + '_count').val(inputCount); + } + + fileList.append( + '
  • ' + + '
    ' + file.name + '
    ' + + '
    ' + + '
    ' + file.percent + '%
    ' + + '
    ' + plupload.formatSize(file.size) + '
    ' + + '
     
    ' + + inputHTML + + '
  • ' + ); + + handleStatus(file); + + $('#' + file.id + '.plupload_delete a').click(function(e) { + $('#' + file.id).remove(); + uploader.removeFile(file); + + e.preventDefault(); + }); + }); + + $('span.plupload_total_file_size', target).html(plupload.formatSize(uploader.total.size)); + + if (uploader.total.queued === 0) { + $('span.plupload_add_text', target).html(_('Add files.')); + } else { + $('span.plupload_add_text', target).html(uploader.total.queued + ' files queued.'); + } + + $('a.plupload_start', target).toggleClass('plupload_disabled', uploader.files.length == (uploader.total.uploaded + uploader.total.failed)); + + // Scroll to end of file list + fileList[0].scrollTop = fileList[0].scrollHeight; + + updateTotalProgress(); + + // Re-add drag message if there is no files + if (!uploader.files.length && uploader.features.dragdrop && uploader.settings.dragdrop) { + $('#' + id + '_filelist').append('
  • ' + _("Drag files here.") + '
  • '); + } + } + + uploader.bind("UploadFile", function(up, file) { + $('#' + file.id).addClass('plupload_current_file'); + }); + + uploader.bind('Init', function(up, res) { + renderUI(id, target); + + // Enable rename support + if (!settings.unique_names && settings.rename) { + target.on('click', '#' + id + '_filelist div.plupload_file_name span', function(e) { + var targetSpan = $(e.target), file, parts, name, ext = ""; + + // Get file name and split out name and extension + file = up.getFile(targetSpan.parents('li')[0].id); + name = file.name; + parts = /^(.+)(\.[^.]+)$/.exec(name); + if (parts) { + name = parts[1]; + ext = parts[2]; + } + + // Display input element + targetSpan.hide().after(''); + targetSpan.next().val(name).focus().blur(function() { + targetSpan.show().next().remove(); + }).keydown(function(e) { + var targetInput = $(this); + + if ($.inArray(e.keyCode, [13, 27]) !== -1) { + e.preventDefault(); + + // Rename file and glue extension back on + if (e.keyCode === 13) { + file.name = targetInput.val() + ext; + targetSpan.html(file.name); + } + targetInput.blur(); + } + }); + }); + } + + $('a.plupload_add', target).attr('id', id + '_browse'); + + up.settings.browse_button = id + '_browse'; + + // Enable drag/drop + if (up.features.dragdrop && up.settings.dragdrop) { + up.settings.drop_element = id + '_filelist'; + $('#' + id + '_filelist').append('
  • ' + _("Drag files here.") + '
  • '); + } + + $('#' + id + '_container').attr('title', 'Using runtime: ' + res.runtime); + + $('a.plupload_start', target).click(function(e) { + if (!$(this).hasClass('plupload_disabled')) { + uploader.start(); + } + + e.preventDefault(); + }); + + $('a.plupload_stop', target).click(function(e) { + e.preventDefault(); + uploader.stop(); + }); + + $('a.plupload_start', target).addClass('plupload_disabled'); + }); + + uploader.init(); + + uploader.bind("Error", function(up, err) { + var file = err.file, message; + + if (file) { + message = err.message; + + if (err.details) { + message += " (" + err.details + ")"; + } + + if (err.code == plupload.FILE_SIZE_ERROR) { + alert(_("Error: File too large: ") + file.name); + } + + if (err.code == plupload.FILE_EXTENSION_ERROR) { + alert(_("Error: Invalid file extension: ") + file.name); + } + + file.hint = message; + $('#' + file.id).attr('class', 'plupload_failed').find('a').css('display', 'block').attr('title', message); + } + }); + + uploader.bind('StateChanged', function() { + if (uploader.state === plupload.STARTED) { + $('li.plupload_delete a,div.plupload_buttons', target).hide(); + $('span.plupload_upload_status,div.plupload_progress,a.plupload_stop', target).css('display', 'block'); + $('span.plupload_upload_status', target).html('Uploaded ' + uploader.total.uploaded + '/' + uploader.files.length + ' files'); + + if (settings.multiple_queues) { + $('span.plupload_total_status,span.plupload_total_file_size', target).show(); + } + } else { + updateList(); + $('a.plupload_stop,div.plupload_progress', target).hide(); + $('a.plupload_delete', target).css('display', 'block'); + } + }); + + uploader.bind('QueueChanged', updateList); + + uploader.bind('FileUploaded', function(up, file) { + handleStatus(file); + }); + + uploader.bind("UploadProgress", function(up, file) { + // Set file specific progress + $('#' + file.id + ' div.plupload_file_status', target).html(file.percent + '%'); + + handleStatus(file); + updateTotalProgress(); + + if (settings.multiple_queues && uploader.total.uploaded + uploader.total.failed == uploader.files.length) { + $(".plupload_buttons,.plupload_upload_status", target).css("display", "inline"); + $(".plupload_start", target).addClass("plupload_disabled"); + $('span.plupload_total_status,span.plupload_total_file_size', target).hide(); + } + }); + + // Call setup function + if (settings.setup) { + settings.setup(uploader); + } + }); + + return this; + } else { + // Get uploader instance for specified element + return uploaders[$(this[0]).attr('id')]; + } + }; +})(jQuery); diff --git a/assets/javascripts/plupload/jquery.ui.plupload/css/jquery.ui.plupload.css b/assets/javascripts/plupload/jquery.ui.plupload/css/jquery.ui.plupload.css new file mode 100644 index 00000000..a524f2dd --- /dev/null +++ b/assets/javascripts/plupload/jquery.ui.plupload/css/jquery.ui.plupload.css @@ -0,0 +1,147 @@ +/* + Plupload +------------------------------------------------------------------- */ + +.plupload_button {cursor: pointer;} + +.plupload_wrapper { + font: normal 11px Verdana,sans-serif; + width: 100%; +} + +.plupload .plupload_container input {width: 98%;} +.plupload .plupload_filelist_footer {border-width: 1px 0 0 0} +.plupload .plupload_filelist_header {border-width: 0 0 1px 0} +div.plupload .plupload_file {border-width: 0 0 1px 0} +div.plupload div.plupload_header {border-width: 0 0 1px 0; position: relative;} + +.plupload_file .ui-icon { + cursor:pointer; +} + +.plupload_header_content { + background-image: url('../img/plupload.png'); + background-repeat: no-repeat; + background-position: 8px center; + min-height: 56px; + padding-left: 60px; + position:relative; +} +.plupload_header_content_bw {background-image: url('../img/plupload-bw.png');} +.plupload_header_title { + font: normal 18px sans-serif; + padding: 6px 0 3px; +} +.plupload_header_text {font: normal 12px sans-serif;} + +.plupload_filelist, +.plupload_filelist_content { + border-collapse: collapse; + margin: 0; + padding: 0; + width: 100%; + -moz-user-select:none; + -webkit-user-select:none; + user-select:none; +} + +.plupload_cell {padding: 8px 6px;} + +.plupload_file { + border-left: none; + border-right: none; +} + +.plupload .ui-sortable-helper, +.plupload .ui-sortable .plupload_file { + cursor:move; +} + +.plupload_scroll { + max-height: 180px; + min-height: 168px; + _height: 168px; + overflow-y: auto; +} + +.plupload_file_size, .plupload_file_status {text-align: right;} +.plupload_file_size, .plupload_file_status {width: 52px;} +.plupload_file_action {width: 16px;} +.plupload_file_name { + overflow: hidden; + padding-left: 10px; +} + +.plupload_file_rename { + width:95%; +} + +.plupload_progress {width: 60px;} +.plupload_progress_container {padding: 1px;} + + +/* Floats */ + +.plupload_right {float: right;} +.plupload_left {float: left;} +.plupload_clear,.plupload_clearer {clear: both;} +.plupload_clearer, .plupload_progress_bar { + display: block; + font-size: 0; + line-height: 0; +} +.plupload_clearer {height: 0;} + +/* Misc */ +.plupload_hidden {display: none;} +.plupload_droptext { + background: transparent; + text-align: center; + vertical-align: middle; + border: 0; + line-height: 165px; +} + +.plupload_buttons, .plupload_upload_status {float: left} + +.plupload_message { + position: absolute; + top: 0px; + left: 0px; + height: 100%; + width: 100%; +} + +.plupload_message p { + padding:0.7em; + margin:0; +} + +.plupload_message strong { + font-weight: bold; +} + +plupload_message i { + font-style: italic; +} + +.plupload_message p span.ui-icon { + float: left; + margin-right: 0.3em; +} + +.plupload_header_content .ui-state-error, +.plupload_header_content .ui-state-highlight { + border:none; +} + +.plupload_message_close { + position:absolute; + top:5px; + right:5px; + cursor:pointer; +} + +.plupload .ui-sortable-placeholder { + height:35px; +} diff --git a/assets/javascripts/plupload/jquery.ui.plupload/img/plupload-bw.png b/assets/javascripts/plupload/jquery.ui.plupload/img/plupload-bw.png new file mode 100644 index 00000000..bb4147e8 Binary files /dev/null and b/assets/javascripts/plupload/jquery.ui.plupload/img/plupload-bw.png differ diff --git a/assets/javascripts/plupload/jquery.ui.plupload/img/plupload.png b/assets/javascripts/plupload/jquery.ui.plupload/img/plupload.png new file mode 100644 index 00000000..74fa3ad3 Binary files /dev/null and b/assets/javascripts/plupload/jquery.ui.plupload/img/plupload.png differ diff --git a/assets/javascripts/plupload/jquery.ui.plupload/jquery.ui.plupload.js b/assets/javascripts/plupload/jquery.ui.plupload/jquery.ui.plupload.js index a836bb62..bb0dc566 100644 --- a/assets/javascripts/plupload/jquery.ui.plupload/jquery.ui.plupload.js +++ b/assets/javascripts/plupload/jquery.ui.plupload/jquery.ui.plupload.js @@ -1 +1,754 @@ -(function(f,a,c,g,e){var h={};function b(i){return c.translate(i)||i}function d(i){i.html('
    '+b("Select files")+'
    '+b("Add files to the upload queue and click the start button.")+'
    '+b("Filename")+''+b("Status")+''+b("Size")+' 
    ')}g.widget("ui.plupload",{contents_bak:"",runtime:null,options:{browse_button_hover:"ui-state-hover",browse_button_active:"ui-state-active",dragdrop:true,multiple_queues:true,buttons:{browse:true,start:true,stop:true},autostart:false,sortable:false,rename:false,max_file_count:0},FILE_COUNT_ERROR:-9001,_create:function(){var i=this,k,j;k=this.element.attr("id");if(!k){k=c.guid();this.element.attr("id",k)}this.id=k;this.contents_bak=this.element.html();d(this.element);this.container=g(".plupload_container",this.element).attr("id",k+"_container");this.filelist=g(".plupload_filelist_content",this.container).attr({id:k+"_filelist",unselectable:"on"});this.browse_button=g(".plupload_add",this.container).attr("id",k+"_browse");this.start_button=g(".plupload_start",this.container).attr("id",k+"_start");this.stop_button=g(".plupload_stop",this.container).attr("id",k+"_stop");if(g.ui.button){this.browse_button.button({icons:{primary:"ui-icon-circle-plus"}});this.start_button.button({icons:{primary:"ui-icon-circle-arrow-e"},disabled:true});this.stop_button.button({icons:{primary:"ui-icon-circle-close"}})}this.progressbar=g(".plupload_progress_container",this.container);if(g.ui.progressbar){this.progressbar.progressbar()}this.counter=g(".plupload_count",this.element).attr({id:k+"_count",name:k+"_count"});j=this.uploader=h[k]=new c.Uploader(g.extend({container:k,browse_button:k+"_browse"},this.options));j.bind("Error",function(l,m){if(m.code===c.INIT_ERROR){i.destroy()}});j.bind("Init",function(l,m){if(!i.options.buttons.browse){i.browse_button.button("disable").hide();l.disableBrowse(true)}if(!i.options.buttons.start){i.start_button.button("disable").hide()}if(!i.options.buttons.stop){i.stop_button.button("disable").hide()}if(!i.options.unique_names&&i.options.rename){i._enableRenaming()}if(j.features.dragdrop&&i.options.dragdrop){i._enableDragAndDrop()}i.container.attr("title",b("Using runtime: ")+(i.runtime=m.runtime));i.start_button.click(function(n){if(!g(this).button("option","disabled")){i.start()}n.preventDefault()});i.stop_button.click(function(n){i.stop();n.preventDefault()})});if(i.options.max_file_count){j.bind("FilesAdded",function(l,n){var o=[],m=n.length;var p=l.files.length+m-i.options.max_file_count;if(p>0){o=n.splice(m-p,p);l.trigger("Error",{code:i.FILE_COUNT_ERROR,message:b("File count error."),file:o})}})}j.init();j.bind("FilesAdded",function(l,m){i._trigger("selected",null,{up:l,files:m});if(i.options.autostart){setTimeout(function(){i.start()},10)}});j.bind("FilesRemoved",function(l,m){i._trigger("removed",null,{up:l,files:m})});j.bind("QueueChanged",function(){i._updateFileList()});j.bind("StateChanged",function(){i._handleState()});j.bind("UploadFile",function(l,m){i._handleFileStatus(m)});j.bind("FileUploaded",function(l,m){i._handleFileStatus(m);i._trigger("uploaded",null,{up:l,file:m})});j.bind("UploadProgress",function(l,m){g("#"+m.id).find(".plupload_file_status").html(m.percent+"%").end().find(".plupload_file_size").html(c.formatSize(m.size));i._handleFileStatus(m);i._updateTotalProgress();i._trigger("progress",null,{up:l,file:m})});j.bind("UploadComplete",function(l,m){i._trigger("complete",null,{up:l,files:m})});j.bind("Error",function(l,p){var n=p.file,o,m;if(n){o=""+p.message+"";m=p.details;if(m){o+="
    "+p.details+""}else{switch(p.code){case c.FILE_EXTENSION_ERROR:m=b("File: %s").replace("%s",n.name);break;case c.FILE_SIZE_ERROR:m=b("File: %f, size: %s, max file size: %m").replace(/%([fsm])/g,function(r,q){switch(q){case"f":return n.name;case"s":return n.size;case"m":return c.parseSize(i.options.max_file_size)}});break;case i.FILE_COUNT_ERROR:m=b("Upload element accepts only %d file(s) at a time. Extra files were stripped.").replace("%d",i.options.max_file_count);break;case c.IMAGE_FORMAT_ERROR:m=c.translate("Image format either wrong or not supported.");break;case c.IMAGE_MEMORY_ERROR:m=c.translate("Runtime ran out of available memory.");break;case c.IMAGE_DIMENSIONS_ERROR:m=c.translate("Resoultion out of boundaries! %s runtime supports images only up to %wx%hpx.").replace(/%([swh])/g,function(r,q){switch(q){case"s":return l.runtime;case"w":return l.features.maxWidth;case"h":return l.features.maxHeight}});break;case c.HTTP_ERROR:m=b("Upload URL might be wrong or doesn't exist");break}o+="
    "+m+""}i.notify("error",o);i._trigger("error",null,{up:l,file:n,error:o})}})},_setOption:function(j,k){var i=this;if(j=="buttons"&&typeof(k)=="object"){k=g.extend(i.options.buttons,k);if(!k.browse){i.browse_button.button("disable").hide();up.disableBrowse(true)}else{i.browse_button.button("enable").show();up.disableBrowse(false)}if(!k.start){i.start_button.button("disable").hide()}else{i.start_button.button("enable").show()}if(!k.stop){i.stop_button.button("disable").hide()}else{i.start_button.button("enable").show()}}i.uploader.settings[j]=k},start:function(){this.uploader.start();this._trigger("start",null)},stop:function(){this.uploader.stop();this._trigger("stop",null)},getFile:function(j){var i;if(typeof j==="number"){i=this.uploader.files[j]}else{i=this.uploader.getFile(j)}return i},removeFile:function(j){var i=this.getFile(j);if(i){this.uploader.removeFile(i)}},clearQueue:function(){this.uploader.splice()},getUploader:function(){return this.uploader},refresh:function(){this.uploader.refresh()},_handleState:function(){var j=this,i=this.uploader;if(i.state===c.STARTED){g(j.start_button).button("disable");g([]).add(j.stop_button).add(".plupload_started").removeClass("plupload_hidden");g(".plupload_upload_status",j.element).text(b("Uploaded %d/%d files").replace("%d/%d",i.total.uploaded+"/"+i.files.length));g(".plupload_header_content",j.element).addClass("plupload_header_content_bw")}else{g([]).add(j.stop_button).add(".plupload_started").addClass("plupload_hidden");if(j.options.multiple_queues){g(j.start_button).button("enable");g(".plupload_header_content",j.element).removeClass("plupload_header_content_bw")}j._updateFileList()}},_handleFileStatus:function(l){var n,j;if(!g("#"+l.id).length){return}switch(l.status){case c.DONE:n="plupload_done";j="ui-icon ui-icon-circle-check";break;case c.FAILED:n="ui-state-error plupload_failed";j="ui-icon ui-icon-alert";break;case c.QUEUED:n="plupload_delete";j="ui-icon ui-icon-circle-minus";break;case c.UPLOADING:n="ui-state-highlight plupload_uploading";j="ui-icon ui-icon-circle-arrow-w";var i=g(".plupload_scroll",this.container),m=i.scrollTop(),o=i.height(),k=g("#"+l.id).position().top+g("#"+l.id).height();if(o'}i+='';i+='';l++;k.counter.val(l)}m.append(''+p.name+''+p.percent+'%'+c.formatSize(p.size)+'
    '+i+"");k._handleFileStatus(p);g("#"+p.id+".plupload_delete .ui-icon, #"+p.id+".plupload_done .ui-icon").click(function(r){g("#"+p.id).remove();j.removeFile(p);r.preventDefault()});k._trigger("updatelist",null,m)});if(j.total.queued===0){g(".ui-button-text",k.browse_button).text(b("Add Files"))}else{g(".ui-button-text",k.browse_button).text(b("%d files queued").replace("%d",j.total.queued))}if(j.files.length===(j.total.uploaded+j.total.failed)){k.start_button.button("disable")}else{k.start_button.button("enable")}m[0].scrollTop=m[0].scrollHeight;k._updateTotalProgress();if(!j.files.length&&j.features.dragdrop&&j.settings.dragdrop){g("#"+o+"_filelist").append(''+b("Drag files here.")+"")}else{if(k.options.sortable&&g.ui.sortable){k._enableSortingList()}}},_enableRenaming:function(){var i=this;g(".plupload_delete .plupload_file_name span",this.filelist).live("click",function(o){var m=g(o.target),k,n,j,l="";k=i.uploader.getFile(m.parents("tr")[0].id);j=k.name;n=/^(.+)(\.[^.]+)$/.exec(j);if(n){j=n[1];l=n[2]}m.hide().after('');m.next().val(j).focus().blur(function(){m.show().next().remove()}).keydown(function(q){var p=g(this);if(g.inArray(q.keyCode,[13,27])!==-1){q.preventDefault();if(q.keyCode===13){k.name=p.val()+l;m.text(k.name)}p.blur()}})})},_enableDragAndDrop:function(){this.filelist.append(''+b("Drag files here.")+"");this.filelist.parent().attr("id",this.id+"_dropbox");this.uploader.settings.drop_element=this.options.drop_element=this.id+"_dropbox"},_enableSortingList:function(){var j,i=this;if(g("tbody tr",this.filelist).length<2){return}g("tbody",this.filelist).sortable({containment:"parent",items:".plupload_delete",helper:function(l,k){return k.clone(true).find("td:not(.plupload_file_name)").remove().end().css("width","100%")},stop:function(p,o){var l,n,k,m=[];g.each(g(this).sortable("toArray"),function(q,r){m[m.length]=i.uploader.getFile(r)});m.unshift(m.length);m.unshift(0);Array.prototype.splice.apply(i.uploader.files,m)}})},notify:function(j,k){var i=g('

    '+k+"

    ");i.addClass("ui-state-"+(j==="error"?"error":"highlight")).find("p .ui-icon").addClass("ui-icon-"+(j==="error"?"alert":"info")).end().find(".plupload_message_close").click(function(){i.remove()}).end();g(".plupload_header_content",this.container).append(i)},destroy:function(){g(".plupload_button",this.element).unbind();if(g.ui.button){g(".plupload_add, .plupload_start, .plupload_stop",this.container).button("destroy")}if(g.ui.progressbar){this.progressbar.progressbar("destroy")}if(g.ui.sortable&&this.options.sortable){g("tbody",this.filelist).sortable("destroy")}this.uploader.destroy();this.element.empty().html(this.contents_bak);this.contents_bak="";g.Widget.prototype.destroy.apply(this)}})}(window,document,plupload,jQuery)); \ No newline at end of file +/** + * jquery.ui.plupload.js + * + * Copyright 2009, Moxiecode Systems AB + * Released under GPL License. + * + * License: http://www.plupload.com/license + * Contributing: http://www.plupload.com/contributing + * + * Depends: + * jquery.ui.core.js + * jquery.ui.widget.js + * + * Optionally: + * jquery.ui.button.js + * jquery.ui.progressbar.js + * jquery.ui.sortable.js + */ + +// JSLint defined globals +/*global window:false, document:false, plupload:false, jQuery:false */ + +(function(window, document, plupload, $, undef) { + +var uploaders = {}; + +function _(str) { + return plupload.translate(str) || str; +} + +function renderUI(obj) { + obj.html( + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + _('Select files') + '
    ' + + '
    ' + _('Add files to the upload queue and click the start button.') + '
    ' + + '
    ' + + '
    ' + + + '
    ' + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '
    ' + _('Filename') + '' + _('Status') + '' + _('Size') + ' 
    ' + + + '
    ' + + '
    ' + + '
    ' + + + '' + + '' + + '' + + '' + + '' + + '' + + '' + + '
    ' + + '
    ' + + '
    ' + + '
    ' + + '' + + '
    ' + ); +} + + +$.widget("ui.plupload", { + + contents_bak: '', + + runtime: null, + + options: { + browse_button_hover: 'ui-state-hover', + browse_button_active: 'ui-state-active', + + // widget specific + dragdrop : true, + multiple_queues: true, // re-use widget by default + + buttons: { + browse: true, + start: true, + stop: true + }, + autostart: false, + sortable: false, + rename: false, + max_file_count: 0 // unlimited + }, + + FILE_COUNT_ERROR: -9001, + + _create: function() { + var self = this, id, uploader; + + id = this.element.attr('id'); + if (!id) { + id = plupload.guid(); + this.element.attr('id', id); + } + this.id = id; + + // backup the elements initial state + this.contents_bak = this.element.html(); + renderUI(this.element); + + // container, just in case + this.container = $('.plupload_container', this.element).attr('id', id + '_container'); + + // list of files, may become sortable + this.filelist = $('.plupload_filelist_content', this.container) + .attr({ + id: id + '_filelist', + unselectable: 'on' + }); + + // buttons + this.browse_button = $('.plupload_add', this.container).attr('id', id + '_browse'); + this.start_button = $('.plupload_start', this.container).attr('id', id + '_start'); + this.stop_button = $('.plupload_stop', this.container).attr('id', id + '_stop'); + + if ($.ui.button) { + this.browse_button.button({ + icons: { primary: 'ui-icon-circle-plus' } + }); + + this.start_button.button({ + icons: { primary: 'ui-icon-circle-arrow-e' }, + disabled: true + }); + + this.stop_button.button({ + icons: { primary: 'ui-icon-circle-close' } + }); + } + + // progressbar + this.progressbar = $('.plupload_progress_container', this.container); + + if ($.ui.progressbar) { + this.progressbar.progressbar(); + } + + // counter + this.counter = $('.plupload_count', this.element) + .attr({ + id: id + '_count', + name: id + '_count' + }); + + // initialize uploader instance + uploader = this.uploader = uploaders[id] = new plupload.Uploader($.extend({ + container: id , + browse_button: id + '_browse' + }, this.options)); + + // do not show UI if no runtime can be initialized + uploader.bind('Error', function(up, err) { + if (err.code === plupload.INIT_ERROR) { + self.destroy(); + } + }); + + uploader.bind('Init', function(up, res) { + // all buttons are optional, so they can be disabled and hidden + if (!self.options.buttons.browse) { + self.browse_button.button('disable').hide(); + up.disableBrowse(true); + } + + if (!self.options.buttons.start) { + self.start_button.button('disable').hide(); + } + + if (!self.options.buttons.stop) { + self.stop_button.button('disable').hide(); + } + + if (!self.options.unique_names && self.options.rename) { + self._enableRenaming(); + } + + if (uploader.features.dragdrop && self.options.dragdrop) { + self._enableDragAndDrop(); + } + + self.container.attr('title', _('Using runtime: ') + (self.runtime = res.runtime)); + + self.start_button.click(function(e) { + if (!$(this).button('option', 'disabled')) { + self.start(); + } + e.preventDefault(); + }); + + self.stop_button.click(function(e) { + self.stop(); + e.preventDefault(); + }); + }); + + + // check if file count doesn't exceed the limit + if (self.options.max_file_count) { + uploader.bind('FilesAdded', function(up, selectedFiles) { + var removed = [], selectedCount = selectedFiles.length; + var extraCount = up.files.length + selectedCount - self.options.max_file_count; + + if (extraCount > 0) { + removed = selectedFiles.splice(selectedCount - extraCount, extraCount); + + up.trigger('Error', { + code : self.FILE_COUNT_ERROR, + message : _('File count error.'), + file : removed + }); + } + }); + } + + // uploader internal events must run first + uploader.init(); + + uploader.bind('FilesAdded', function(up, files) { + self._trigger('selected', null, { up: up, files: files } ); + + if (self.options.autostart) { + // set a little delay to make sure that QueueChanged triggered by the core has time to complete + setTimeout(function() { + self.start(); + }, 10); + } + }); + + uploader.bind('FilesRemoved', function(up, files) { + self._trigger('removed', null, { up: up, files: files } ); + }); + + uploader.bind('QueueChanged', function() { + self._updateFileList(); + }); + + uploader.bind('StateChanged', function() { + self._handleState(); + }); + + uploader.bind('UploadFile', function(up, file) { + self._handleFileStatus(file); + }); + + uploader.bind('FileUploaded', function(up, file) { + self._handleFileStatus(file); + + self._trigger('uploaded', null, { up: up, file: file } ); + }); + + uploader.bind('UploadProgress', function(up, file) { + // Set file specific progress + $('#' + file.id) + .find('.plupload_file_status') + .html(file.percent + '%') + .end() + .find('.plupload_file_size') + .html(plupload.formatSize(file.size)); + + self._handleFileStatus(file); + self._updateTotalProgress(); + + self._trigger('progress', null, { up: up, file: file } ); + }); + + uploader.bind('UploadComplete', function(up, files) { + self._trigger('complete', null, { up: up, files: files } ); + }); + + uploader.bind('Error', function(up, err) { + var file = err.file, message, details; + + if (file) { + message = '' + err.message + ''; + details = err.details; + + if (details) { + message += "
    " + err.details + ""; + } else { + + switch (err.code) { + case plupload.FILE_EXTENSION_ERROR: + details = _("File: %s").replace('%s', file.name); + break; + + case plupload.FILE_SIZE_ERROR: + details = _("File: %f, size: %s, max file size: %m").replace(/%([fsm])/g, function($0, $1) { + switch ($1) { + case 'f': return file.name; + case 's': return file.size; + case 'm': return plupload.parseSize(self.options.max_file_size); + } + }); + break; + + case self.FILE_COUNT_ERROR: + details = _("Upload element accepts only %d file(s) at a time. Extra files were stripped.") + .replace('%d', self.options.max_file_count); + break; + + case plupload.IMAGE_FORMAT_ERROR : + details = plupload.translate('Image format either wrong or not supported.'); + break; + + case plupload.IMAGE_MEMORY_ERROR : + details = plupload.translate('Runtime ran out of available memory.'); + break; + + case plupload.IMAGE_DIMENSIONS_ERROR : + details = plupload.translate('Resoultion out of boundaries! %s runtime supports images only up to %wx%hpx.').replace(/%([swh])/g, function($0, $1) { + switch ($1) { + case 's': return up.runtime; + case 'w': return up.features.maxWidth; + case 'h': return up.features.maxHeight; + } + }); + break; + + case plupload.HTTP_ERROR: + details = _("Upload URL might be wrong or doesn't exist"); + break; + } + message += "
    " + details + ""; + } + + self.notify('error', message); + self._trigger('error', null, { up: up, file: file, error: message } ); + } + }); + }, + + _setOption: function(key, value) { + var self = this; + + if (key == 'buttons' && typeof(value) == 'object') { + value = $.extend(self.options.buttons, value); + + if (!value.browse) { + self.browse_button.button('disable').hide(); + up.disableBrowse(true); + } else { + self.browse_button.button('enable').show(); + up.disableBrowse(false); + } + + if (!value.start) { + self.start_button.button('disable').hide(); + } else { + self.start_button.button('enable').show(); + } + + if (!value.stop) { + self.stop_button.button('disable').hide(); + } else { + self.start_button.button('enable').show(); + } + } + + self.uploader.settings[key] = value; + }, + + + start: function() { + this.uploader.start(); + this._trigger('start', null); + }, + + stop: function() { + this.uploader.stop(); + this._trigger('stop', null); + }, + + getFile: function(id) { + var file; + + if (typeof id === 'number') { + file = this.uploader.files[id]; + } else { + file = this.uploader.getFile(id); + } + return file; + }, + + removeFile: function(id) { + var file = this.getFile(id); + if (file) { + this.uploader.removeFile(file); + } + }, + + clearQueue: function() { + this.uploader.splice(); + }, + + getUploader: function() { + return this.uploader; + }, + + refresh: function() { + this.uploader.refresh(); + }, + + + _handleState: function() { + var self = this, up = this.uploader; + + if (up.state === plupload.STARTED) { + + $(self.start_button).button('disable'); + + $([]) + .add(self.stop_button) + .add('.plupload_started') + .removeClass('plupload_hidden'); + + $('.plupload_upload_status', self.element).html( + _('Uploaded %d/%d files').replace('%d/%d', up.total.uploaded+'/'+up.files.length) + ); + + $('.plupload_header_content', self.element).addClass('plupload_header_content_bw'); + + } else { + + $([]) + .add(self.stop_button) + .add('.plupload_started') + .addClass('plupload_hidden'); + + if (self.options.multiple_queues) { + $(self.start_button).button('enable'); + + $('.plupload_header_content', self.element).removeClass('plupload_header_content_bw'); + } + + self._updateFileList(); + } + }, + + + _handleFileStatus: function(file) { + var actionClass, iconClass; + + // since this method might be called asynchronously, file row might not yet be rendered + if (!$('#' + file.id).length) { + return; + } + + switch (file.status) { + case plupload.DONE: + actionClass = 'plupload_done'; + iconClass = 'ui-icon ui-icon-circle-check'; + break; + + case plupload.FAILED: + actionClass = 'ui-state-error plupload_failed'; + iconClass = 'ui-icon ui-icon-alert'; + break; + + case plupload.QUEUED: + actionClass = 'plupload_delete'; + iconClass = 'ui-icon ui-icon-circle-minus'; + break; + + case plupload.UPLOADING: + actionClass = 'ui-state-highlight plupload_uploading'; + iconClass = 'ui-icon ui-icon-circle-arrow-w'; + + // scroll uploading file into the view if its bottom boundary is out of it + var scroller = $('.plupload_scroll', this.container), + scrollTop = scroller.scrollTop(), + scrollerHeight = scroller.height(), + rowOffset = $('#' + file.id).position().top + $('#' + file.id).height(); + + if (scrollerHeight < rowOffset) { + scroller.scrollTop(scrollTop + rowOffset - scrollerHeight); + } + break; + } + actionClass += ' ui-state-default plupload_file'; + + $('#' + file.id) + .attr('class', actionClass) + .find('.ui-icon') + .attr('class', iconClass); + }, + + + _updateTotalProgress: function() { + var up = this.uploader; + + this.progressbar.progressbar('value', up.total.percent); + + this.element + .find('.plupload_total_status') + .html(up.total.percent + '%') + .end() + .find('.plupload_total_file_size') + .html(plupload.formatSize(up.total.size)) + .end() + .find('.plupload_upload_status') + .html(_('Uploaded %d/%d files').replace('%d/%d', up.total.uploaded+'/'+up.files.length)); + }, + + + _updateFileList: function() { + var self = this, up = this.uploader, filelist = this.filelist, + count = 0, + id, prefix = this.id + '_', + fields; + + // destroy sortable if enabled + if ($.ui.sortable && this.options.sortable) { + $('tbody.ui-sortable', filelist).sortable('destroy'); + } + + filelist.empty(); + + $.each(up.files, function(i, file) { + fields = ''; + id = prefix + count; + + if (file.status === plupload.DONE) { + if (file.target_name) { + fields += ''; + } + fields += ''; + fields += ''; + + count++; + self.counter.val(count); + } + + filelist.append( + '' + + '' + file.name + '' + + '' + file.percent + '%' + + '' + plupload.formatSize(file.size) + '' + + '
    ' + fields + '' + + '' + ); + + self._handleFileStatus(file); + + $('#' + file.id + '.plupload_delete .ui-icon, #' + file.id + '.plupload_done .ui-icon') + .click(function(e) { + $('#' + file.id).remove(); + up.removeFile(file); + + e.preventDefault(); + }); + + self._trigger('updatelist', null, filelist); + }); + + if (up.total.queued === 0) { + $('.ui-button-text', self.browse_button).html(_('Add Files')); + } else { + $('.ui-button-text', self.browse_button).html(_('%d files queued').replace('%d', up.total.queued)); + } + + + if (up.files.length === (up.total.uploaded + up.total.failed)) { + self.start_button.button('disable'); + } else { + self.start_button.button('enable'); + } + + + // Scroll to end of file list + filelist[0].scrollTop = filelist[0].scrollHeight; + + self._updateTotalProgress(); + + if (!up.files.length && up.features.dragdrop && up.settings.dragdrop) { + // Re-add drag message if there are no files + $('#' + id + '_filelist').append('' + _("Drag files here.") + ''); + } else { + // Otherwise re-initialize sortable + if (self.options.sortable && $.ui.sortable) { + self._enableSortingList(); + } + } + }, + + + _enableRenaming: function() { + var self = this; + + this.filelist.on('click', '.plupload_delete .plupload_file_name span', function(e) { + var targetSpan = $(e.target), file, parts, name, ext = ""; + + // Get file name and split out name and extension + file = self.uploader.getFile(targetSpan.parents('tr')[0].id); + name = file.name; + parts = /^(.+)(\.[^.]+)$/.exec(name); + if (parts) { + name = parts[1]; + ext = parts[2]; + } + + // Display input element + targetSpan.hide().after(''); + targetSpan.next().val(name).focus().blur(function() { + targetSpan.show().next().remove(); + }).keydown(function(e) { + var targetInput = $(this); + + if ($.inArray(e.keyCode, [13, 27]) !== -1) { + e.preventDefault(); + + // Rename file and glue extension back on + if (e.keyCode === 13) { + file.name = targetInput.val() + ext; + targetSpan.html(file.name); + } + targetInput.blur(); + } + }); + }); + }, + + + _enableDragAndDrop: function() { + this.filelist.append('' + _("Drag files here.") + ''); + + this.filelist.parent().attr('id', this.id + '_dropbox'); + + this.uploader.settings.drop_element = this.options.drop_element = this.id + '_dropbox'; + }, + + + _enableSortingList: function() { + var idxStart, self = this; + + if ($('tbody tr', this.filelist).length < 2) { + return; + } + + $('tbody', this.filelist).sortable({ + containment: 'parent', + items: '.plupload_delete', + + helper: function(e, el) { + return el.clone(true).find('td:not(.plupload_file_name)').remove().end().css('width', '100%'); + }, + + stop: function(e, ui) { + var i, length, idx, files = []; + + $.each($(this).sortable('toArray'), function(i, id) { + files[files.length] = self.uploader.getFile(id); + }); + + files.unshift(files.length); + files.unshift(0); + + // re-populate files array + Array.prototype.splice.apply(self.uploader.files, files); + } + }); + }, + + notify: function(type, message) { + var popup = $( + '
    ' + + '' + + '

    ' + message + '

    ' + + '
    ' + ); + + popup + .addClass('ui-state-' + (type === 'error' ? 'error' : 'highlight')) + .find('p .ui-icon') + .addClass('ui-icon-' + (type === 'error' ? 'alert' : 'info')) + .end() + .find('.plupload_message_close') + .click(function() { + popup.remove(); + }) + .end(); + + $('.plupload_header_content', this.container).append(popup); + }, + + + + destroy: function() { + // unbind all button events + $('.plupload_button', this.element).unbind(); + + // destroy buttons + if ($.ui.button) { + $('.plupload_add, .plupload_start, .plupload_stop', this.container) + .button('destroy'); + } + + // destroy progressbar + if ($.ui.progressbar) { + this.progressbar.progressbar('destroy'); + } + + // destroy sortable behavior + if ($.ui.sortable && this.options.sortable) { + $('tbody', this.filelist).sortable('destroy'); + } + + // destroy uploader instance + this.uploader.destroy(); + + // restore the elements initial state + this.element + .empty() + .html(this.contents_bak); + this.contents_bak = ''; + + $.Widget.prototype.destroy.apply(this); + } +}); + + +} (window, document, plupload, jQuery)); diff --git a/assets/javascripts/plupload/plupload.browserplus.js b/assets/javascripts/plupload/plupload.browserplus.js index e66404bd..2dd5e3ac 100644 --- a/assets/javascripts/plupload/plupload.browserplus.js +++ b/assets/javascripts/plupload/plupload.browserplus.js @@ -1 +1,361 @@ -(function(a){a.runtimes.BrowserPlus=a.addRuntime("browserplus",{getFeatures:function(){return{dragdrop:true,jpgresize:true,pngresize:true,chunks:true,progress:true,multipart:true,multi_selection:true}},init:function(g,i){var e=window.BrowserPlus,h={},d=g.settings,c=d.resize;function f(n){var m,l,j=[],k,o;for(l=0;l0){r(++t,v)}else{k.status=a.DONE;n.trigger("FileUploaded",k,{response:x.value.body,status:w});if(w>=400){n.trigger("Error",{code:a.HTTP_ERROR,message:a.translate("HTTP Error."),file:k,status:w})}}}else{n.trigger("Error",{code:a.GENERIC_ERROR,message:a.translate("Generic Error."),file:k,details:x.error})}})}function q(t){k.size=t.size;if(l){e.FileAccess.chunk({file:t,chunkSize:l},function(w){if(w.success){var x=w.value,u=x.length;o=Array(u);for(var v=0;v 0) { + // More chunks to be uploaded + uploadFile(++chunk, chunks); + } else { + file.status = plupload.DONE; + + up.trigger('FileUploaded', file, { + response : res.value.body, + status : httpStatus + }); + + // Is error status + if (httpStatus >= 400) { + up.trigger('Error', { + code : plupload.HTTP_ERROR, + message : plupload.translate('HTTP Error.'), + file : file, + status : httpStatus + }); + } + } + } else { + up.trigger('Error', { + code : plupload.GENERIC_ERROR, + message : plupload.translate('Generic Error.'), + file : file, + details : res.error + }); + } + }); + } + + function chunkAndUploadFile(native_file) { + file.size = native_file.size; + if (chunkSize) { + browserPlus.FileAccess.chunk({file : native_file, chunkSize : chunkSize}, function(cr) { + if (cr.success) { + var chunks = cr.value, len = chunks.length; + + loadProgress = Array(len); + + for (var i = 0; i < len; i++) { + loadProgress[i] = 0; + chunkStack.push(chunks[i]); + } + + uploadFile(0, len); + } + }); + } else { + loadProgress = Array(1); + chunkStack.push(native_file); + uploadFile(0, 1); + } + } + + // Resize image if it's a supported format and resize is enabled + if (resize && /\.(png|jpg|jpeg)$/i.test(file.name)) { + BrowserPlus.ImageAlter.transform({ + file : nativeFile, + quality : resize.quality || 90, + actions : [{ + scale : { + maxwidth : resize.width, + maxheight : resize.height + } + }] + }, function(res) { + if (res.success) { + chunkAndUploadFile(res.value.file); + } + }); + } else { + chunkAndUploadFile(nativeFile); + } + }); + + callback({success : true}); + } + + // Check for browserplus object + if (browserPlus) { + browserPlus.init(function(res) { + var services = [ + {service: "Uploader", version: "3"}, + {service: "DragAndDrop", version: "1"}, + {service: "FileBrowse", version: "1"}, + {service: "FileAccess", version: "2"} + ]; + + if (resize) { + services.push({service : 'ImageAlter', version : "4"}); + } + + if (res.success) { + browserPlus.require({ + services : services + }, function(sres) { + if (sres.success) { + setup(); + } else { + callback(); + } + }); + } else { + callback(); + } + }); + } else { + callback(); + } + } + }); +})(plupload); diff --git a/assets/javascripts/plupload/plupload.flash.js b/assets/javascripts/plupload/plupload.flash.js index aa87c6b8..c8520b31 100644 --- a/assets/javascripts/plupload/plupload.flash.js +++ b/assets/javascripts/plupload/plupload.flash.js @@ -1 +1,431 @@ -(function(f,b,d,e){var a={},g={};function c(){var h;try{h=navigator.plugins["Shockwave Flash"];h=h.description}catch(j){try{h=new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version")}catch(i){h="0.0"}}h=h.match(/\d+/g);return parseFloat(h[0]+"."+h[1])}d.flash={trigger:function(j,h,i){setTimeout(function(){var m=a[j],l,k;if(m){m.trigger("Flash:"+h,i)}},0)}};d.runtimes.Flash=d.addRuntime("flash",{getFeatures:function(){return{jpgresize:true,pngresize:true,maxWidth:8091,maxHeight:8091,chunks:true,progress:true,multipart:true,multi_selection:true}},init:function(m,o){var k,l,h=0,i=b.body;if(c()<10){o({success:false});return}g[m.id]=false;a[m.id]=m;k=b.getElementById(m.settings.browse_button);l=b.createElement("div");l.id=m.id+"_flash_container";d.extend(l.style,{position:"absolute",top:"0px",background:m.settings.shim_bgcolor||"transparent",zIndex:99999,width:"100%",height:"100%"});l.className="plupload flash";if(m.settings.container){i=b.getElementById(m.settings.container);if(d.getStyle(i,"position")==="static"){i.style.position="relative"}}i.appendChild(l);(function(){var p,q;p='';if(d.ua.ie){q=b.createElement("div");l.appendChild(q);q.outerHTML=p;q=null}else{l.innerHTML=p}}());function n(){return b.getElementById(m.id+"_flash")}function j(){if(h++>5000){o({success:false});return}if(g[m.id]===false){setTimeout(j,1)}}j();k=l=null;m.bind("Destroy",function(p){var q;d.removeAllEvents(b.body,p.id);delete g[p.id];delete a[p.id];q=b.getElementById(p.id+"_flash_container");if(q){i.removeChild(q)}});m.bind("Flash:Init",function(){var r={},q;try{n().setFileFilters(m.settings.filters,m.settings.multi_selection)}catch(p){o({success:false});return}if(g[m.id]){return}g[m.id]=true;m.bind("UploadFile",function(s,u){var v=s.settings,t=m.settings.resize||{};n().uploadFile(r[u.id],v.url,{name:u.target_name||u.name,mime:d.mimeTypes[u.name.replace(/^.+\.([^.]+)/,"$1").toLowerCase()]||"application/octet-stream",chunk_size:v.chunk_size,width:t.width,height:t.height,quality:t.quality,multipart:v.multipart,multipart_params:v.multipart_params||{},file_data_name:v.file_data_name,format:/\.(jpg|jpeg)$/i.test(u.name)?"jpg":"png",headers:v.headers,urlstream_upload:v.urlstream_upload})});m.bind("CancelUpload",function(){n().cancelUpload()});m.bind("Flash:UploadProcess",function(t,s){var u=t.getFile(r[s.id]);if(u.status!=d.FAILED){u.loaded=s.loaded;u.size=s.size;t.trigger("UploadProgress",u)}});m.bind("Flash:UploadChunkComplete",function(s,u){var v,t=s.getFile(r[u.id]);v={chunk:u.chunk,chunks:u.chunks,response:u.text};s.trigger("ChunkUploaded",t,v);if(t.status!==d.FAILED&&s.state!==d.STOPPED){n().uploadNextChunk()}if(u.chunk==u.chunks-1){t.status=d.DONE;s.trigger("FileUploaded",t,{response:u.text})}});m.bind("Flash:SelectFiles",function(s,v){var u,t,w=[],x;for(t=0;t' + + '' + + '' + + '' + + ''; + + if (plupload.ua.ie) { + el = document.createElement('div'); + flashContainer.appendChild(el); + el.outerHTML = html; + el = null; // just in case + } else { + flashContainer.innerHTML = html; + } + }()); + + function getFlashObj() { + return document.getElementById(uploader.id + '_flash'); + } + + function waitLoad() { + + // Wait for 5 sec + if (waitCount++ > 5000) { + callback({success : false}); + return; + } + + if (initialized[uploader.id] === false) { // might also be undefined, if uploader was destroyed by that moment + setTimeout(waitLoad, 1); + } + } + + waitLoad(); + + // Fix IE memory leaks + browseButton = flashContainer = null; + + // destroy should always be available, after Flash:Init or before (#516) + uploader.bind("Destroy", function(up) { + var flashContainer; + + plupload.removeAllEvents(document.body, up.id); + + delete initialized[up.id]; + delete uploadInstances[up.id]; + + flashContainer = document.getElementById(up.id + '_flash_container'); + if (flashContainer) { + flashContainer.parentNode.removeChild(flashContainer); + } + }); + + // Wait for Flash to send init event + uploader.bind("Flash:Init", function() { + var lookup = {}, i; + + try { + getFlashObj().setFileFilters(uploader.settings.filters, uploader.settings.multi_selection); + } catch (ex) { + callback({success : false}); + return; + } + + // Prevent eventual reinitialization of the instance + if (initialized[uploader.id]) { + return; + } + initialized[uploader.id] = true; + + uploader.bind("UploadFile", function(up, file) { + var settings = up.settings, resize = uploader.settings.resize || {}; + + getFlashObj().uploadFile(lookup[file.id], settings.url, { + name : file.target_name || file.name, + mime : plupload.mimeTypes[file.name.replace(/^.+\.([^.]+)/, '$1').toLowerCase()] || 'application/octet-stream', + chunk_size : settings.chunk_size, + width : resize.width, + height : resize.height, + quality : resize.quality, + multipart : settings.multipart, + multipart_params : settings.multipart_params || {}, + file_data_name : settings.file_data_name, + format : /\.(jpg|jpeg)$/i.test(file.name) ? 'jpg' : 'png', + headers : settings.headers, + urlstream_upload : settings.urlstream_upload + }); + }); + + uploader.bind("CancelUpload", function() { + getFlashObj().cancelUpload(); + }); + + + uploader.bind("Flash:UploadProcess", function(up, flash_file) { + var file = up.getFile(lookup[flash_file.id]); + + if (file.status != plupload.FAILED) { + file.loaded = flash_file.loaded; + file.size = flash_file.size; + + up.trigger('UploadProgress', file); + } + }); + + uploader.bind("Flash:UploadChunkComplete", function(up, info) { + var chunkArgs, file = up.getFile(lookup[info.id]); + + chunkArgs = { + chunk : info.chunk, + chunks : info.chunks, + response : info.text + }; + + up.trigger('ChunkUploaded', file, chunkArgs); + + // Stop upload if file is maked as failed + if (file.status !== plupload.FAILED && up.state !== plupload.STOPPED) { + getFlashObj().uploadNextChunk(); + } + + // Last chunk then dispatch FileUploaded event + if (info.chunk == info.chunks - 1) { + file.status = plupload.DONE; + + up.trigger('FileUploaded', file, { + response : info.text + }); + } + }); + + uploader.bind("Flash:SelectFiles", function(up, selected_files) { + var file, i, files = [], id; + + // Add the selected files to the file queue + for (i = 0; i < selected_files.length; i++) { + file = selected_files[i]; + + // Store away flash ref internally + id = plupload.guid(); + lookup[id] = file.id; + lookup[file.id] = id; + + files.push(new plupload.File(id, file.name, file.size)); + } + + // Trigger FilesAdded event if we added any + if (files.length) { + uploader.trigger("FilesAdded", files); + } + }); + + uploader.bind("Flash:SecurityError", function(up, err) { + uploader.trigger('Error', { + code : plupload.SECURITY_ERROR, + message : plupload.translate('Security error.'), + details : err.message, + file : uploader.getFile(lookup[err.id]) + }); + }); + + uploader.bind("Flash:GenericError", function(up, err) { + uploader.trigger('Error', { + code : plupload.GENERIC_ERROR, + message : plupload.translate('Generic error.'), + details : err.message, + file : uploader.getFile(lookup[err.id]) + }); + }); + + uploader.bind("Flash:IOError", function(up, err) { + uploader.trigger('Error', { + code : plupload.IO_ERROR, + message : plupload.translate('IO error.'), + details : err.message, + file : uploader.getFile(lookup[err.id]) + }); + }); + + uploader.bind("Flash:ImageError", function(up, err) { + uploader.trigger('Error', { + code : parseInt(err.code, 10), + message : plupload.translate('Image error.'), + file : uploader.getFile(lookup[err.id]) + }); + }); + + uploader.bind('Flash:StageEvent:rollOver', function(up) { + var browseButton, hoverClass; + + browseButton = document.getElementById(uploader.settings.browse_button); + hoverClass = up.settings.browse_button_hover; + + if (browseButton && hoverClass) { + plupload.addClass(browseButton, hoverClass); + } + }); + + uploader.bind('Flash:StageEvent:rollOut', function(up) { + var browseButton, hoverClass; + + browseButton = document.getElementById(uploader.settings.browse_button); + hoverClass = up.settings.browse_button_hover; + + if (browseButton && hoverClass) { + plupload.removeClass(browseButton, hoverClass); + } + }); + + uploader.bind('Flash:StageEvent:mouseDown', function(up) { + var browseButton, activeClass; + + browseButton = document.getElementById(uploader.settings.browse_button); + activeClass = up.settings.browse_button_active; + + if (browseButton && activeClass) { + plupload.addClass(browseButton, activeClass); + + // Make sure that browse_button has active state removed from it + plupload.addEvent(document.body, 'mouseup', function() { + plupload.removeClass(browseButton, activeClass); + }, up.id); + } + }); + + uploader.bind('Flash:StageEvent:mouseUp', function(up) { + var browseButton, activeClass; + + browseButton = document.getElementById(uploader.settings.browse_button); + activeClass = up.settings.browse_button_active; + + if (browseButton && activeClass) { + plupload.removeClass(browseButton, activeClass); + } + }); + + + uploader.bind('Flash:ExifData', function(up, obj) { + uploader.trigger('ExifData', uploader.getFile(lookup[obj.id]), obj.data); + }); + + + uploader.bind('Flash:GpsData', function(up, obj) { + uploader.trigger('GpsData', uploader.getFile(lookup[obj.id]), obj.data); + }); + + + uploader.bind("QueueChanged", function(up) { + uploader.refresh(); + }); + + uploader.bind("FilesRemoved", function(up, files) { + var i; + + for (i = 0; i < files.length; i++) { + getFlashObj().removeFile(lookup[files[i].id]); + } + }); + + uploader.bind("StateChanged", function(up) { + uploader.refresh(); + }); + + uploader.bind("Refresh", function(up) { + var browseButton, browsePos, browseSize; + + // Set file filters incase it has been changed dynamically + getFlashObj().setFileFilters(uploader.settings.filters, uploader.settings.multi_selection); + + browseButton = document.getElementById(up.settings.browse_button); + if (browseButton) { + browsePos = plupload.getPos(browseButton, document.getElementById(up.settings.container)); + browseSize = plupload.getSize(browseButton); + + plupload.extend(document.getElementById(up.id + '_flash_container').style, { + top : browsePos.y + 'px', + left : browsePos.x + 'px', + width : browseSize.w + 'px', + height : browseSize.h + 'px' + }); + } + }); + + uploader.bind("DisableBrowse", function(up, disabled) { + getFlashObj().disableBrowse(disabled); + }); + + callback({success : true}); + }); + } + }); +})(window, document, plupload); diff --git a/assets/javascripts/plupload/plupload.flash.swf b/assets/javascripts/plupload/plupload.flash.swf deleted file mode 100644 index 06949bfe..00000000 Binary files a/assets/javascripts/plupload/plupload.flash.swf and /dev/null differ diff --git a/assets/javascripts/plupload/plupload.full.js b/assets/javascripts/plupload/plupload.full.js deleted file mode 100644 index ea5f93b6..00000000 --- a/assets/javascripts/plupload/plupload.full.js +++ /dev/null @@ -1,2 +0,0 @@ -/*1.5.4*/ -(function(){var f=0,l=[],n={},j={},a={"<":"lt",">":"gt","&":"amp",'"':"quot","'":"#39"},m=/[<>&\"\']/g,b,c=window.setTimeout,d={},e;function h(){this.returnValue=false}function k(){this.cancelBubble=true}(function(o){var p=o.split(/,/),q,s,r;for(q=0;q0){g.each(p,function(s,r){o[r]=s})}});return o},cleanName:function(o){var p,q;q=[/[\300-\306]/g,"A",/[\340-\346]/g,"a",/\307/g,"C",/\347/g,"c",/[\310-\313]/g,"E",/[\350-\353]/g,"e",/[\314-\317]/g,"I",/[\354-\357]/g,"i",/\321/g,"N",/\361/g,"n",/[\322-\330]/g,"O",/[\362-\370]/g,"o",/[\331-\334]/g,"U",/[\371-\374]/g,"u"];for(p=0;p0?"&":"?")+q}return p},each:function(r,s){var q,p,o;if(r){q=r.length;if(q===b){for(p in r){if(r.hasOwnProperty(p)){if(s(r[p],p)===false){return}}}}else{for(o=0;o1073741824){return Math.round(o/1073741824,1)+" GB"}if(o>1048576){return Math.round(o/1048576,1)+" MB"}if(o>1024){return Math.round(o/1024,1)+" KB"}return o+" b"},getPos:function(p,t){var u=0,s=0,w,v=document,q,r;p=p;t=t||v.body;function o(C){var A,B,z=0,D=0;if(C){B=C.getBoundingClientRect();A=v.compatMode==="CSS1Compat"?v.documentElement:v.body;z=B.left+A.scrollLeft;D=B.top+A.scrollTop}return{x:z,y:D}}if(p&&p.getBoundingClientRect&&((navigator.userAgent.indexOf("MSIE")>0)&&(v.documentMode<8))){q=o(p);r=o(t);return{x:q.x-r.x,y:q.y-r.y}}w=p;while(w&&w!=t&&w.nodeType){u+=w.offsetLeft||0;s+=w.offsetTop||0;w=w.offsetParent}w=p.parentNode;while(w&&w!=t&&w.nodeType){u-=w.scrollLeft||0;s-=w.scrollTop||0;w=w.parentNode}return{x:u,y:s}},getSize:function(o){return{w:o.offsetWidth||o.clientWidth,h:o.offsetHeight||o.clientHeight}},parseSize:function(o){var p;if(typeof(o)=="string"){o=/^([0-9]+)([mgk]?)$/.exec(o.toLowerCase().replace(/[^0-9mkg]/g,""));p=o[2];o=+o[1];if(p=="g"){o*=1073741824}if(p=="m"){o*=1048576}if(p=="k"){o*=1024}}return o},xmlEncode:function(o){return o?(""+o).replace(m,function(p){return a[p]?"&"+a[p]+";":p}):o},toArray:function(q){var p,o=[];for(p=0;p=0;p--){if(r[p].key===q||r[p].orig===u){if(t.removeEventListener){t.removeEventListener(o,r[p].func,false)}else{if(t.detachEvent){t.detachEvent("on"+o,r[p].func)}}r[p].orig=null;r[p].func=null;r.splice(p,1);if(u!==b){break}}}if(!r.length){delete d[t[e]][o]}if(g.isEmptyObj(d[t[e]])){delete d[t[e]];try{delete t[e]}catch(s){t[e]=b}}},removeAllEvents:function(p){var o=arguments[1];if(p[e]===b||!p[e]){return}g.each(d[p[e]],function(r,q){g.removeEvent(p,q,o)})}};g.Uploader=function(s){var p={},v,u=[],r,q=false;v=new g.QueueProgress();s=g.extend({chunk_size:0,multipart:true,multi_selection:true,file_data_name:"file",filters:[]},s);function t(){var x,y=0,w;if(this.state==g.STARTED){for(w=0;w0?Math.ceil(v.uploaded/u.length*100):0}else{v.bytesPerSec=Math.ceil(v.loaded/((+new Date()-r||1)/1000));v.percent=v.size>0?Math.ceil(v.loaded/v.size*100):0}}g.extend(this,{state:g.STOPPED,runtime:"",features:{},files:u,settings:s,total:v,id:g.guid(),init:function(){var B=this,C,y,x,A=0,z;if(typeof(s.preinit)=="function"){s.preinit(B)}else{g.each(s.preinit,function(E,D){B.bind(D,E)})}s.page_url=s.page_url||document.location.pathname.replace(/\/[^\/]+$/g,"/");if(!/^(\w+:\/\/|\/)/.test(s.url)){s.url=s.page_url+s.url}s.chunk_size=g.parseSize(s.chunk_size);s.max_file_size=g.parseSize(s.max_file_size);B.bind("FilesAdded",function(D,G){var F,E,I=0,J,H=s.filters;if(H&&H.length){J=[];g.each(H,function(K){g.each(K.extensions.split(/,/),function(L){if(/^\s*\*\s*$/.test(L)){J.push("\\.*")}else{J.push("\\."+L.replace(new RegExp("["+("/^$.*+?|()[]{}\\".replace(/./g,"\\$&"))+"]","g"),"\\$&"))}})});J=new RegExp(J.join("|")+"$","i")}for(F=0;Fs.max_file_size){D.trigger("Error",{code:g.FILE_SIZE_ERROR,message:g.translate("File size error."),file:E});continue}u.push(E);I++}if(I){c(function(){B.trigger("QueueChanged");B.refresh()},1)}else{return false}});if(s.unique_names){B.bind("UploadFile",function(D,E){var G=E.name.match(/\.([^.]+)$/),F="tmp";if(G){F=G[1]}E.target_name=E.id+"."+F})}B.bind("UploadProgress",function(D,E){E.percent=E.size>0?Math.ceil(E.loaded/E.size*100):100;o()});B.bind("StateChanged",function(D){if(D.state==g.STARTED){r=(+new Date())}else{if(D.state==g.STOPPED){for(C=D.files.length-1;C>=0;C--){if(D.files[C].status==g.UPLOADING){D.files[C].status=g.QUEUED;o()}}}}});B.bind("QueueChanged",o);B.bind("Error",function(D,E){if(E.file){E.file.status=g.FAILED;o();if(D.state==g.STARTED){c(function(){t.call(B)},1)}}});B.bind("FileUploaded",function(D,E){E.status=g.DONE;E.loaded=E.size;D.trigger("UploadProgress",E);c(function(){t.call(B)},1)});if(s.runtimes){y=[];z=s.runtimes.split(/\s?,\s?/);for(C=0;C=0;w--){if(u[w].id===x){return u[w]}}},removeFile:function(x){var w;for(w=u.length-1;w>=0;w--){if(u[w].id===x.id){return this.splice(w,1)[0]}}},splice:function(y,w){var x;x=u.splice(y===b?0:y,w===b?u.length:w);this.trigger("FilesRemoved",x);this.trigger("QueueChanged");return x},trigger:function(x){var z=p[x.toLowerCase()],y,w;if(z){w=Array.prototype.slice.call(arguments);w[0]=this;for(y=0;y=0;x--){if(z[x].func===y){z.splice(x,1);break}}}else{z=[]}if(!z.length){delete p[w]}}},unbindAll:function(){var w=this;g.each(p,function(y,x){w.unbind(x)})},destroy:function(){this.stop();this.trigger("Destroy");this.unbindAll()}})};g.File=function(r,p,q){var o=this;o.id=r;o.name=p;o.size=q;o.loaded=0;o.percent=0;o.status=0};g.Runtime=function(){this.getFeatures=function(){};this.init=function(o,p){}};g.QueueProgress=function(){var o=this;o.size=0;o.loaded=0;o.uploaded=0;o.failed=0;o.queued=0;o.percent=0;o.bytesPerSec=0;o.reset=function(){o.size=o.loaded=o.uploaded=o.failed=o.queued=o.percent=o.bytesPerSec=0}};g.runtimes={};window.plupload=g})();(function(){if(window.google&&google.gears){return}var a=null;if(typeof GearsFactory!="undefined"){a=new GearsFactory()}else{try{a=new ActiveXObject("Gears.Factory");if(a.getBuildInfo().indexOf("ie_mobile")!=-1){a.privateSetGlobalObject(this)}}catch(b){if((typeof navigator.mimeTypes!="undefined")&&navigator.mimeTypes["application/x-googlegears"]){a=document.createElement("object");a.style.display="none";a.width=0;a.height=0;a.type="application/x-googlegears";document.documentElement.appendChild(a)}}}if(!a){return}if(!window.google){window.google={}}if(!google.gears){google.gears={factory:a}}})();(function(e,b,c,d){var f={};function a(h,k,m){var g,j,l,o;j=google.gears.factory.create("beta.canvas");try{j.decode(h);if(!k.width){k.width=j.width}if(!k.height){k.height=j.height}o=Math.min(width/j.width,height/j.height);if(o<1||(o===1&&m==="image/jpeg")){j.resize(Math.round(j.width*o),Math.round(j.height*o));if(k.quality){return j.encode(m,{quality:k.quality/100})}return j.encode(m)}}catch(n){}return h}c.runtimes.Gears=c.addRuntime("gears",{getFeatures:function(){return{dragdrop:true,jpgresize:true,pngresize:true,chunks:true,progress:true,multipart:true,multi_selection:true}},init:function(l,n){var m,h,g=false;if(!e.google||!google.gears){return n({success:false})}try{m=google.gears.factory.create("beta.desktop")}catch(k){return n({success:false})}function j(q){var p,o,r=[],s;for(o=0;o0;v=Math.ceil(r.size/s);if(!o){s=r.size;v=1}function p(){var C,y=u.settings.multipart,x=0,B={name:r.target_name||r.name},z=u.settings.url;function A(E){var D,J="----pluploadboundary"+c.guid(),G="--",I="\r\n",F,H;if(y){h.setRequestHeader("Content-Type","multipart/form-data; boundary="+J);D=google.gears.factory.create("beta.blobbuilder");c.each(c.extend(B,u.settings.multipart_params),function(L,K){D.append(G+J+I+'Content-Disposition: form-data; name="'+K+'"'+I+I);D.append(L+I)});H=c.mimeTypes[r.name.replace(/^.+\.([^.]+)/,"$1").toLowerCase()]||"application/octet-stream";D.append(G+J+I+'Content-Disposition: form-data; name="'+u.settings.file_data_name+'"; filename="'+r.name+'"'+I+"Content-Type: "+H+I+I);D.append(E);D.append(I+G+J+G+I);F=D.getAsBlob();x=F.length-E.length;E=F}h.send(E)}if(r.status==c.DONE||r.status==c.FAILED||u.state==c.STOPPED){return}if(o){B.chunk=w;B.chunks=v}C=Math.min(s,r.size-(w*s));if(!y){z=c.buildUrl(u.settings.url,B)}h=google.gears.factory.create("beta.httprequest");h.open("POST",z);if(!y){h.setRequestHeader("Content-Disposition",'attachment; filename="'+r.name+'"');h.setRequestHeader("Content-Type","application/octet-stream")}c.each(u.settings.headers,function(E,D){h.setRequestHeader(D,E)});h.upload.onprogress=function(D){r.loaded=t+D.loaded-x;u.trigger("UploadProgress",r)};h.onreadystatechange=function(){var D;if(h.readyState==4&&u.state!==c.STOPPED){if(h.status==200){D={chunk:w,chunks:v,response:h.responseText,status:h.status};u.trigger("ChunkUploaded",r,D);if(D.cancelled){r.status=c.FAILED;return}t+=C;if(++w>=v){r.status=c.DONE;u.trigger("FileUploaded",r,{response:h.responseText,status:h.status})}else{p()}}else{u.trigger("Error",{code:c.HTTP_ERROR,message:c.translate("HTTP Error."),file:r,chunk:w,chunks:v,status:h.status})}}};if(w3){l.pop()}while(l.length<4){l.push(0)}m=s.split(".");while(m.length>4){m.pop()}do{u=parseInt(m[q],10);n=parseInt(l[q],10);q++}while(q8?"":0.01});o.className="plupload silverlight";if(p.settings.container){k=b.getElementById(p.settings.container);if(d.getStyle(k,"position")==="static"){k.style.position="relative"}}k.appendChild(o);for(l=0;l';function j(){return b.getElementById(p.id+"_silverlight").content.Upload}p.bind("Silverlight:Init",function(){var r,s={};if(h[p.id]){return}h[p.id]=true;p.bind("Silverlight:StartSelectFiles",function(t){r=[]});p.bind("Silverlight:SelectFile",function(t,w,u,v){var x;x=d.guid();s[x]=w;s[w]=x;r.push(new d.File(x,u,v))});p.bind("Silverlight:SelectSuccessful",function(){if(r.length){p.trigger("FilesAdded",r)}});p.bind("Silverlight:UploadChunkError",function(t,w,u,x,v){p.trigger("Error",{code:d.IO_ERROR,message:"IO Error.",details:v,file:t.getFile(s[w])})});p.bind("Silverlight:UploadFileProgress",function(t,x,u,w){var v=t.getFile(s[x]);if(v.status!=d.FAILED){v.size=w;v.loaded=u;t.trigger("UploadProgress",v)}});p.bind("Refresh",function(t){var u,v,w;u=b.getElementById(t.settings.browse_button);if(u){v=d.getPos(u,b.getElementById(t.settings.container));w=d.getSize(u);d.extend(b.getElementById(t.id+"_silverlight_container").style,{top:v.y+"px",left:v.x+"px",width:w.w+"px",height:w.h+"px"})}});p.bind("Silverlight:UploadChunkSuccessful",function(t,w,u,z,y){var x,v=t.getFile(s[w]);x={chunk:u,chunks:z,response:y};t.trigger("ChunkUploaded",v,x);if(v.status!=d.FAILED&&t.state!==d.STOPPED){j().UploadNextChunk()}if(u==z-1){v.status=d.DONE;t.trigger("FileUploaded",v,{response:y})}});p.bind("Silverlight:UploadSuccessful",function(t,w,u){var v=t.getFile(s[w]);v.status=d.DONE;t.trigger("FileUploaded",v,{response:u})});p.bind("FilesRemoved",function(t,v){var u;for(u=0;u';if(d.ua.ie){r=b.createElement("div");m.appendChild(r);r.outerHTML=q;r=null}else{m.innerHTML=q}}());function o(){return b.getElementById(n.id+"_flash")}function k(){if(h++>5000){p({success:false});return}if(g[n.id]===false){setTimeout(k,1)}}k();l=m=null;n.bind("Destroy",function(q){var r;d.removeAllEvents(b.body,q.id);delete g[q.id];delete a[q.id];r=b.getElementById(q.id+"_flash_container");if(r){j.removeChild(r)}});n.bind("Flash:Init",function(){var s={},r;try{o().setFileFilters(n.settings.filters,n.settings.multi_selection)}catch(q){p({success:false});return}if(g[n.id]){return}g[n.id]=true;n.bind("UploadFile",function(t,v){var w=t.settings,u=n.settings.resize||{};o().uploadFile(s[v.id],w.url,{name:v.target_name||v.name,mime:d.mimeTypes[v.name.replace(/^.+\.([^.]+)/,"$1").toLowerCase()]||"application/octet-stream",chunk_size:w.chunk_size,width:u.width,height:u.height,quality:u.quality,multipart:w.multipart,multipart_params:w.multipart_params||{},file_data_name:w.file_data_name,format:/\.(jpg|jpeg)$/i.test(v.name)?"jpg":"png",headers:w.headers,urlstream_upload:w.urlstream_upload})});n.bind("CancelUpload",function(){o().cancelUpload()});n.bind("Flash:UploadProcess",function(u,t){var v=u.getFile(s[t.id]);if(v.status!=d.FAILED){v.loaded=t.loaded;v.size=t.size;u.trigger("UploadProgress",v)}});n.bind("Flash:UploadChunkComplete",function(t,v){var w,u=t.getFile(s[v.id]);w={chunk:v.chunk,chunks:v.chunks,response:v.text};t.trigger("ChunkUploaded",u,w);if(u.status!==d.FAILED&&t.state!==d.STOPPED){o().uploadNextChunk()}if(v.chunk==v.chunks-1){u.status=d.DONE;t.trigger("FileUploaded",u,{response:v.text})}});n.bind("Flash:SelectFiles",function(t,w){var v,u,x=[],y;for(u=0;u0){s(++u,w)}else{l.status=a.DONE;o.trigger("FileUploaded",l,{response:y.value.body,status:x});if(x>=400){o.trigger("Error",{code:a.HTTP_ERROR,message:a.translate("HTTP Error."),file:l,status:x})}}}else{o.trigger("Error",{code:a.GENERIC_ERROR,message:a.translate("Generic Error."),file:l,details:y.error})}})}function r(u){l.size=u.size;if(m){e.FileAccess.chunk({file:u,chunkSize:m},function(x){if(x.success){var y=x.value,v=y.length;p=Array(v);for(var w=0;w";G.scrollTop=100;E=k.getElementById(p.id+"_html5");if(w.features.triggerDialog){j.extend(E.style,{position:"absolute",width:"100%",height:"100%"})}else{j.extend(E.style,{cssFloat:"right",styleFloat:"right"})}E.onchange=function(){o(this.files);this.value=""};F=k.getElementById(w.settings.browse_button);if(F){var z=w.settings.browse_button_hover,A=w.settings.browse_button_active,x=w.features.triggerDialog?F:G;if(z){j.addEvent(x,"mouseover",function(){j.addClass(F,z)},w.id);j.addEvent(x,"mouseout",function(){j.removeClass(F,z)},w.id)}if(A){j.addEvent(x,"mousedown",function(){j.addClass(F,A)},w.id);j.addEvent(k.body,"mouseup",function(){j.removeClass(F,A)},w.id)}if(w.features.triggerDialog){j.addEvent(F,"click",function(H){var y=k.getElementById(w.id+"_html5");if(y&&!y.disabled){y.click()}H.preventDefault()},w.id)}}});p.bind("PostInit",function(){var s=k.getElementById(p.settings.drop_element);if(s){if(g){j.addEvent(s,"dragenter",function(w){var v,t,u;v=k.getElementById(p.id+"_drop");if(!v){v=k.createElement("input");v.setAttribute("type","file");v.setAttribute("id",p.id+"_drop");v.setAttribute("multiple","multiple");j.addEvent(v,"change",function(){o(this.files);j.removeEvent(v,"change",p.id);v.parentNode.removeChild(v)},p.id);s.appendChild(v)}t=j.getPos(s,k.getElementById(p.settings.container));u=j.getSize(s);if(j.getStyle(s,"position")==="static"){j.extend(s.style,{position:"relative"})}j.extend(v.style,{position:"absolute",display:"block",top:0,left:0,width:u.w+"px",height:u.h+"px",opacity:0})},p.id);return}j.addEvent(s,"dragover",function(t){t.preventDefault()},p.id);j.addEvent(s,"drop",function(u){var t=u.dataTransfer;if(t&&t.files){o(t.files)}u.preventDefault()},p.id)}});p.bind("Refresh",function(s){var t,u,v,x,w;t=k.getElementById(p.settings.browse_button);if(t){u=j.getPos(t,k.getElementById(s.settings.container));v=j.getSize(t);x=k.getElementById(p.id+"_html5_container");j.extend(x.style,{top:u.y+"px",left:u.x+"px",width:v.w+"px",height:v.h+"px"});if(p.features.triggerDialog){if(j.getStyle(t,"position")==="static"){j.extend(t.style,{position:"relative"})}w=parseInt(j.getStyle(t,"z-index"),10);if(isNaN(w)){w=0}j.extend(t.style,{zIndex:w});j.extend(x.style,{zIndex:w-1})}}});p.bind("DisableBrowse",function(s,u){var t=k.getElementById(s.id+"_html5");if(t){t.disabled=u}});p.bind("CancelUpload",function(){if(q&&q.abort){q.abort()}});p.bind("UploadFile",function(s,u){var v=s.settings,y,t;function x(A,D,z){var B;if(File.prototype.slice){try{A.slice();return A.slice(D,z)}catch(C){return A.slice(D,z-D)}}else{if(B=File.prototype.webkitSlice||File.prototype.mozSlice){return B.call(A,D,z)}else{return null}}}function w(A){var D=0,C=0,z=("FileReader" in h)?new FileReader:null;function B(){var I,M,K,L,H,J,F,E=s.settings.url;function G(V){var T=0,N="----pluploadboundary"+j.guid(),O,P="--",U="\r\n",R="";q=new XMLHttpRequest;if(q.upload){q.upload.onprogress=function(W){u.loaded=Math.min(u.size,C+W.loaded-T);s.trigger("UploadProgress",u)}}q.onreadystatechange=function(){var W,Y;if(q.readyState==4&&s.state!==j.STOPPED){try{W=q.status}catch(X){W=0}if(W>=400){s.trigger("Error",{code:j.HTTP_ERROR,message:j.translate("HTTP Error."),file:u,status:W})}else{if(K){Y={chunk:D,chunks:K,response:q.responseText,status:W};s.trigger("ChunkUploaded",u,Y);C+=J;if(Y.cancelled){u.status=j.FAILED;return}u.loaded=Math.min(u.size,(D+1)*H)}else{u.loaded=u.size}s.trigger("UploadProgress",u);V=I=O=R=null;if(!K||++D>=K){u.status=j.DONE;s.trigger("FileUploaded",u,{response:q.responseText,status:W})}else{B()}}}};if(s.settings.multipart&&n.multipart){L.name=u.target_name||u.name;q.open("post",E,true);j.each(s.settings.headers,function(X,W){q.setRequestHeader(W,X)});if(typeof(V)!=="string"&&!!h.FormData){O=new FormData();j.each(j.extend(L,s.settings.multipart_params),function(X,W){O.append(W,X)});O.append(s.settings.file_data_name,V);q.send(O);return}if(typeof(V)==="string"){q.setRequestHeader("Content-Type","multipart/form-data; boundary="+N);j.each(j.extend(L,s.settings.multipart_params),function(X,W){R+=P+N+U+'Content-Disposition: form-data; name="'+W+'"'+U+U;R+=unescape(encodeURIComponent(X))+U});F=j.mimeTypes[u.name.replace(/^.+\.([^.]+)/,"$1").toLowerCase()]||"application/octet-stream";R+=P+N+U+'Content-Disposition: form-data; name="'+s.settings.file_data_name+'"; filename="'+unescape(encodeURIComponent(u.name))+'"'+U+"Content-Type: "+F+U+U+V+U+P+N+P+U;T=R.length-V.length;V=R;if(q.sendAsBinary){q.sendAsBinary(V)}else{if(n.canSendBinary){var S=new Uint8Array(V.length);for(var Q=0;Qv.chunk_size&&(n.chunks||typeof(A)=="string")){H=v.chunk_size;K=Math.ceil(u.size/H);J=Math.min(H,u.size-(D*H));if(typeof(A)=="string"){I=A.substring(D*H,D*H+J)}else{I=x(A,D*H,D*H+J)}L.chunk=D;L.chunks=K}else{J=u.size;I=A}if(s.settings.multipart&&n.multipart&&typeof(I)!=="string"&&z&&n.cantSendBlobInFormData&&n.chunks&&s.settings.chunk_size){z.onload=function(){G(z.result)};z.readAsBinaryString(I)}else{G(I)}}B()}y=c[u.id];if(n.jpgresize&&s.settings.resize&&/\.(png|jpg|jpeg)$/i.test(u.name)){d.call(s,u,s.settings.resize,/\.png$/i.test(u.name)?"image/png":"image/jpeg",function(z){if(z.success){u.size=z.data.length;w(z.data)}else{if(n.chunks){w(y)}else{l(y,w)}}})}else{if(!n.chunks&&n.jpgresize){l(y,w)}else{w(y)}}});p.bind("Destroy",function(s){var u,v,t=k.body,w={inputContainer:s.id+"_html5_container",inputFile:s.id+"_html5",browseButton:s.settings.browse_button,dropElm:s.settings.drop_element};for(u in w){v=k.getElementById(w[u]);if(v){j.removeAllEvents(v,s.id)}}j.removeAllEvents(k.body,s.id);if(s.settings.container){t=k.getElementById(s.settings.container)}t.removeChild(k.getElementById(w.inputContainer))});r({success:true})}});function b(){var q=false,o;function r(t,v){var s=q?0:-8*(v-1),w=0,u;for(u=0;u>Math.abs(s+v*8))&255)}n(x,t,w)}return{II:function(s){if(s===e){return q}else{q=s}},init:function(s){q=false;o=s},SEGMENT:function(s,u,t){switch(arguments.length){case 1:return o.substr(s,o.length-s-1);case 2:return o.substr(s,u);case 3:n(t,s,u);break;default:return o}},BYTE:function(s){return r(s,1)},SHORT:function(s){return r(s,2)},LONG:function(s,t){if(t===e){return r(s,4)}else{p(s,t,4)}},SLONG:function(s){var t=r(s,4);return(t>2147483647?t-4294967296:t)},STRING:function(s,t){var u="";for(t+=s;s=65488&&p<=65495){n+=2;continue}if(p===65498||p===65497){break}q=r.SHORT(n+2)+2;if(u[p]&&r.STRING(n+4,u[p].signature.length)===u[p].signature){t.push({hex:p,app:u[p].app.toUpperCase(),name:u[p].name.toUpperCase(),start:n,length:q,segment:r.SEGMENT(n,q)})}n+=q}r.init(null);return{headers:t,restore:function(y){r.init(y);var w=new f(y);if(!w.headers){return false}for(var x=w.headers.length;x>0;x--){var z=w.headers[x-1];r.SEGMENT(z.start,z.length,"")}w.purge();n=r.SHORT(2)==65504?4+r.SHORT(4):2;for(var x=0,v=t.length;x=z.length){break}}},purge:function(){t=[];r.init(null)}}}function a(){var q,n,o={},t;q=new b();n={tiff:{274:"Orientation",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer"},exif:{36864:"ExifVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",36867:"DateTimeOriginal",33434:"ExposureTime",33437:"FNumber",34855:"ISOSpeedRatings",37377:"ShutterSpeedValue",37378:"ApertureValue",37383:"MeteringMode",37384:"LightSource",37385:"Flash",41986:"ExposureMode",41987:"WhiteBalance",41990:"SceneCaptureType",41988:"DigitalZoomRatio",41992:"Contrast",41993:"Saturation",41994:"Sharpness"},gps:{0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude"}};t={ColorSpace:{1:"sRGB",0:"Uncalibrated"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{1:"Daylight",2:"Fliorescent",3:"Tungsten",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 -5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire.",1:"Flash fired.",5:"Strobe return light not detected.",7:"Strobe return light detected.",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},ExposureMode:{0:"Auto exposure",1:"Manual exposure",2:"Auto bracket"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},GPSLatitudeRef:{N:"North latitude",S:"South latitude"},GPSLongitudeRef:{E:"East longitude",W:"West longitude"}};function p(u,C){var w=q.SHORT(u),z,F,G,B,A,v,x,D,E=[],y={};for(z=0;z4){x=q.LONG(x)+o.tiffHeader}for(F=0;F4){x=q.LONG(x)+o.tiffHeader}y[G]=q.STRING(x,A-1);continue;case 3:if(A>2){x=q.LONG(x)+o.tiffHeader}for(F=0;F1){x=q.LONG(x)+o.tiffHeader}for(F=0;F