summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/util.js18
1 files changed, 15 insertions, 3 deletions
diff --git a/js/util.js b/js/util.js
index b738d1e..dcc978f 100644
--- a/js/util.js
+++ b/js/util.js
@@ -61,9 +61,9 @@ function loadImage(imageURL, callback) {
}
}
-function giveImage() {
+function giveImage(t) {
if (window.gif) {
- return gif.frames[gif.currentFrame()];
+ return gif.frames[gif.currentFrame(t)];
} else {
return img;
}
@@ -74,4 +74,16 @@ function proxify (url) {
return "/cgi-bin/proxy?" + url // .replace(/^https?:\/\//, "");
else
return url
-};
+}
+
+function filesize(n) {
+ if (n < 1e3) return n + " bytes"
+ if (n < 1e6) return decimalString(n/1e3) + " kb"
+ if (n < 1e9) return decimalString(n/1e6) + " mb"
+ return "WAY TOO BIG DUDE"
+}
+function decimalString(n){
+ var m = Math.floor(n);
+ return m + "." + Math.round((n-m)*10)
+}
+