65915aa386f518494df6f51052f45383e2938794
[Portfolio.git] / skins / portfolio_upload.js
1 // © 2013 Benoît Pin MINES ParisTech
2
3 var DDImageUploader;
4
5 (function(){
6
7 var isThumbnail = /.*\/getThumbnail$/;
8
9 DDImageUploader = function(dropbox, uploadUrl) {
10 DDFileUploaderBase.apply(this, [dropbox, uploadUrl]);
11
12 this.existingSlides = this.indexExistingSlides();
13 this.slideSize = 222;
14 this.progressBarMaxSize = 200; // pixels
15 this.thumbnailSize = 180;
16 this.previewQueue = [];
17 this._previewQueueRunning = false;
18 this.previewsLoaded = 0;
19 };
20
21 copyPrototype(DDImageUploader, DDFileUploaderBase);
22
23 DDImageUploader.prototype.indexExistingSlides = function() {
24 var images = this.dropbox.getElementsByTagName('img');
25 var i;
26 var index = [];
27 for (i=0 ; i < images.length ; i++) {
28 if (isThumbnail.test(images[i].src)) {
29 index[images[i].src] = images[i]; }
30 }
31 return index;
32 };
33
34 }());