summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/cabinet.js22
-rw-r--r--js/cheesesteak.js22
-rw-r--r--js/pomf.js41
3 files changed, 75 insertions, 10 deletions
diff --git a/js/cabinet.js b/js/cabinet.js
index cb8039b..f6f5f20 100644
--- a/js/cabinet.js
+++ b/js/cabinet.js
@@ -1,3 +1,25 @@
+/**
+ * Copyright (c) 2013 Peter Lejeck <peter.lejeck@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
/* jshint browser:true, jquery:true */
(function($) {
$.hasFileAPI = function hasFileAPI() {
diff --git a/js/cheesesteak.js b/js/cheesesteak.js
index 47aee93..821b9cd 100644
--- a/js/cheesesteak.js
+++ b/js/cheesesteak.js
@@ -1,3 +1,25 @@
+/**
+ * Copyright (c) 2013 Peter Lejeck <peter.lejeck@gmail.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
/* jshint browser:true, jquery:true */
(function() {
/* Lightweight EventEmitter implementation */
diff --git a/js/pomf.js b/js/pomf.js
index 7375797..b2a7b6b 100644
--- a/js/pomf.js
+++ b/js/pomf.js
@@ -1,7 +1,30 @@
+/**
+ * Copyright (c) 2013 Peter Lejeck <peter.lejeck@gmail.com>
+ * Copyright (c) 2015 the Pantsu.cat developers <hostmaster@pantsu.cat>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
/* jshint browser:true, jquery:true */
$(function() {
var uploadInput = $('#upload-input'),
- uploadBtn = $('#upload-btn'),
+ uploadBtn = $('#upload-btn'),
uploadFiles = $('#upload-filelist');
var btnContent = '';
@@ -54,7 +77,7 @@ $(function() {
rowName = $('<span class=file-name>'),
rowProg = $('<div class="file-progress progress-outer">'),
rowSize = $('<span class=file-size>'),
- rowUrl = $('<span class=file-url>');
+ rowUrl = $('<span class=file-url>');
rowItem.addClass(extra || '');
@@ -81,11 +104,12 @@ $(function() {
var totalRow = createRow('', files.humanSize, 'total');
totalRow.appendTo(uploadFiles);
+ var totalName = $('.file-name', totalRow);
+
if (files.size > MAX_SIZE) {
uploadFiles.addClass('error');
- $('.file-name', totalRow).html('onii-chan y-your upload is t-too ' +
- 'big&hellip;');
+ totalName.html('onii-chan y-your upload is t-too big&hellip;');
return;
}
@@ -95,14 +119,12 @@ $(function() {
var hits = {};
files.forEach(function(file) {
++hits[file.name] || (hits[file.name] = 0);
- var row = $($('li[data-filename="' + escape(file.name) + '"]') +
- [hits[file.name] || 0]);
+ var row = $($('li[data-filename="' +
+ escape(file.name) + '"]')[hits[file.name] || 0]);
fn.call(row, row, file, files);
});
};
- var totalName = $('.file-name', totalRow);
-
up.on('uploadprogress', function(e, files) {
eachRow(files, function(row, file, files) {
$('.progress-inner', row).width((file.percentUploaded * 100) + '%');
@@ -121,8 +143,7 @@ $(function() {
var res = JSON.parse(res);
if (!res.success) {
uploadFiles.addClass('error');
- $('.file-name', totalRow).text('Something went wrong; try again ' +
- 'later.');
+ totalName.text('Something went wrong; try again later.');
break;
}
eachRow(res.files, function(row, file, files) {