Changeset 1319
- Timestamp:
- 06/16/12 09:54:21 (1 year ago)
- Location:
- branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager
- Files:
-
- 2 added
- 12 modified
-
Assets/Connector/FileManager.php (modified) (7 diffs)
-
Assets/Connector/Image.class.php (modified) (1 diff)
-
Assets/Css/FileManager.css (modified) (2 diffs)
-
Assets/Images/Icons/Large/directory.png (modified) (previous)
-
Assets/Images/Icons/Large/directory_up.png (modified) (previous)
-
Assets/js/milkbox/css/milkbox.css (modified) (1 diff)
-
Assets/js/milkbox/milkbox.js (modified) (43 diffs)
-
Language/Language.no.js (added)
-
Language/Language.pt.js (modified) (1 diff)
-
Language/language.zh.js (added)
-
Source/FileManager.js (modified) (49 diffs)
-
Source/Gallery.js (modified) (15 diffs)
-
Source/Uploader/Fx.ProgressBar.js (modified) (2 diffs)
-
Source/Uploader/Swiff.Uploader.js (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Assets/Connector/FileManager.php
r1309 r1319 58 58 * Note that currently support for copying subdirectories is missing. 59 59 * The parameter $action = 'move'. 60 * UploadIsComplete_cb (function/reference, default is *null*) Upload complete callback which can be used to post process a newly upload file. 61 * The parameter $action = 'upload'. 62 * DownloadIsComplete_cb (function/reference, default is *null*) Download complete callback which can be used to post process after a file has been downloaded file. 63 * The parameter $action = 'download'. 64 * DestroyIsComplete_cb (function/reference, default is *null*) Destroy complete callback which can be used to cleanup after a newly deleted/destroyed file. 65 * The parameter $action = 'destroy'. 60 66 * 61 67 * Obsoleted options: … … 525 531 526 532 527 require (strtr(dirname(__FILE__), '\\', '/') . '/Tooling.php');528 require (strtr(dirname(__FILE__), '\\', '/') . '/Image.class.php');533 require_once(strtr(dirname(__FILE__), '\\', '/') . '/Tooling.php'); 534 require_once(strtr(dirname(__FILE__), '\\', '/') . '/Image.class.php'); 529 535 530 536 … … 1031 1037 'DestroyIsAuthorized_cb' => null, 1032 1038 'MoveIsAuthorized_cb' => null, 1039 1040 'UploadIsComplete_cb' => null, 1041 'DownloadIsComplete_cb' => null, 1042 'DestroyIsComplete_cb' => null, 1043 1033 1044 'showHiddenFoldersAndFiles' => false, // Hide dot dirs/files ? 1034 'useGetID3IfAvailable' => true 1045 'useGetID3IfAvailable' => true, 1046 'enableXSendFile' => false 1035 1047 ), (is_array($options) ? $options : array())); 1036 1048 … … 1825 1837 'content' => 'destroyed' 1826 1838 )); 1839 1840 if (!empty($this->options['DestroyIsComplete_cb']) && function_exists($this->options['DestroyIsComplete_cb'])) 1841 $this->options['DestroyIsComplete_cb']($this, 'destroy', $fileinfo); 1842 1827 1843 return; 1828 1844 } … … 2130 2146 $fsize = filesize($file); 2131 2147 $fi = pathinfo($legal_url); 2148 2149 // Based on the gist here: https://gist.github.com/854168 2150 // Reference: http://codeutopia.net/blog/2009/03/06/sending-files-better-apache-mod_xsendfile-and-php/ 2151 // We should: 2152 // 1. try to use Apache mod_xsendfile 2153 // 2. Try to chunk the file into pieces 2154 // 3. If the file is sufficiently small, send it directly 2132 2155 2133 2156 $hdrs = array(); … … 2144 2167 break; 2145 2168 } 2169 2146 2170 $hdrs[] = 'Content-Disposition: attachment; filename="' . $fi['basename'] . '"'; // use 'attachment' to force a download 2147 $hdrs[] = 'Content-length: ' . $fsize; 2148 $hdrs[] = 'Expires: 0'; 2149 $hdrs[] = 'Cache-Control: must-revalidate, post-check=0, pre-check=0'; 2150 $hdrs[] = '!Cache-Control: private'; // flag as FORCED APPEND; use this to open files directly 2171 2172 // Content length isn't requied for mod_xsendfile (Apache handles this for us) 2173 $modx = $this->options['enableXSendFile'] && function_exists('apache_get_modules') && in_array('mod_xsendfile', apache_get_modules()); 2174 if ($modx) 2175 { 2176 $hdrs[] = 'X-Sendfile: '.$file; 2177 } 2178 else 2179 { 2180 $hdrs[] = 'Content-length: ' . $fsize; 2181 $hdrs[] = 'Expires: 0'; 2182 $hdrs[] = 'Cache-Control: must-revalidate, post-check=0, pre-check=0'; 2183 $hdrs[] = '!Cache-Control: private'; // flag as FORCED APPEND; use this to open files directly 2184 } 2151 2185 2152 2186 $this->sendHttpHeaders($hdrs); 2153 2154 fpassthru($fd); 2187 2188 if (!$modx) 2189 { 2190 $chunksize = 4*1024; // 4KB blocks 2191 if ($fsize > $chunksize) 2192 { 2193 // Turn off compression which prevents files from being re-assembled properly (especially zip files) 2194 function_exists('apache_setenv') && @apache_setenv('no-gzip', 1); 2195 @ini_set('zlib.output_compression', 0); 2196 2197 // Turn off any additional buffering by the server 2198 @ini_set('implicit_flush', 1); 2199 2200 // Disable any timeouts 2201 @set_time_limit(0); 2202 while (!feof($fd)) 2203 { 2204 echo @fread($fd, $chunksize); 2205 ob_flush(); 2206 flush(); 2207 } 2208 } 2209 else 2210 { 2211 fpassthru($fd); 2212 } 2213 } 2214 2155 2215 fclose($fd); 2216 2217 if (!empty($this->options['DownloadIsComplete_cb']) && function_exists($this->options['DownloadIsComplete_cb'])) 2218 $this->options['DownloadIsComplete_cb']($this, 'download', $fileinfo); 2219 2156 2220 return; 2157 2221 } 2158 2222 2159 2223 $emsg = 'read_error'; 2224 2225 2160 2226 } 2161 2227 catch(FileManagerException $e) … … 2433 2499 'name' => basename($file) 2434 2500 )); 2501 2502 if (!empty($this->options['UploadIsComplete_cb']) && function_exists($this->options['UploadIsComplete_cb'])) 2503 $this->options['UploadIsComplete_cb']($this, 'upload', $fileinfo); 2504 2435 2505 return; 2436 2506 } -
branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Assets/Connector/Image.class.php
r1309 r1319 20 20 21 21 22 define('IMAGE_PROCESSING_MEMORY_MAX_USAGE', 64); // memory_limit setting, in Megabytes; increase when Image class reports too often the images don't fit in memory.22 define('IMAGE_PROCESSING_MEMORY_MAX_USAGE', 160); // memory_limit setting, in Megabytes; increase when Image class reports too often the images don't fit in memory. 23 23 24 24 class Image { -
branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Assets/Css/FileManager.css
r1309 r1319 940 940 941 941 div.filemanager-wrapper div.img { 942 position: relative; 942 943 width: 260px; 943 944 height: 260px; … … 1007 1008 border-top: 1px solid #bebebe; 1008 1009 } 1010 div.filemanager-filelist ul { 1011 background: none; 1012 padding: 0; 1013 margin: 0; 1014 width: auto; 1015 height: auto; 1016 border: none; 1017 } 1018 div.filemanager-filelist li { 1019 display: inline-block; 1020 } 1021 1009 1022 div.filemanager-filelist .fi, div.gallery-image { 1010 1023 position: relative; -
branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Assets/js/milkbox/css/milkbox.css
r1309 r1319 3 3 #mbox-overlay{ 4 4 background-color: #000; /* set the Milkbox overlay color // opacity: see the js options */ 5 z-index: 9999;5 z-index:50000; 6 6 cursor: pointer; 7 7 } -
branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Assets/js/milkbox/milkbox.js
r1309 r1319 1 1 /* 2 Milkbox v3.0 - required: mootools.js v1.3 core + more (see the relative js file for details about used modules)3 4 by Luca Reghellin (http://www.reghellin.com) Dicember 2010, MIT-style license.2 Milkbox v3.0.3 - required: mootools.js v1.3 core + more (see the relative js file for details about used modules) 3 4 by Luca Reghellin (http://www.reghellin.com) September 2011, MIT-style license. 5 5 Inspiration Lokesh Dhakar (http://www.lokeshdhakar.com/projects/lightbox2/) 6 AND OF COURSE, SPECIAL THANKS TO THE MOOTOOLS DEVELOPERS AND DEVELOPERS HELPING ALL AROUND THE WORLD6 AND OF COURSE, SPECIAL THANKS TO THE MOOTOOLS DEVELOPERS AND THE OTHER DEVELOPERS HELPING ALL AROUND THE WORLD 7 7 */ 8 8 … … 25 25 fileboxBorderColor:'#000000', 26 26 fileboxPadding:'0px', 27 resizeDuration: 0.5,27 resizeDuration:.5, 28 28 resizeTransition:'sine:in:out',/*function (ex. Transitions.Sine.easeIn) or string (ex. 'bounce:out')*/ 29 29 autoPlay:false, … … 32 32 autoSize:true, 33 33 autoSizeMaxHeight:0,//only if autoSize==true 34 autoSizeMaxWidth:0,//only if autoSize==true35 autoSizeMinHeight:0,//only if autoSize==true36 autoSizeMinWidth:0,//only if autoSize==true37 34 centered:false, 38 35 imageOfText:'of', … … 43 40 44 41 initialize: function(options){ 45 if (milkbox_singleton) { 46 return milkbox_singleton; 47 } 42 if (milkbox_singleton) return milkbox_singleton; 48 43 milkbox_singleton = this; 49 44 50 45 this.setOptions(options); 51 this.autoPlayBkup = { 52 autoPlayDelay: this.options.autoPlayDelay, 53 autoPlay: this.options.autoPlay 54 }; 46 this.autoPlayBkup = { autoPlayDelay:this.options.autoPlayDelay, autoPlay:this.options.autoPlay }; 55 47 this.fullOptionsBkup = {}; 56 48 this.galleries = []; 57 49 this.formElements = []; 58 this.activated = false;50 this.activated; 59 51 this.busy = false; 60 52 this.paused = false; 61 53 this.closed = true; 62 this.intId = null;63 this.loadCheckerId = null;54 this.intId; 55 this.loadCheckerId; 64 56 this.externalGalleries = []; 65 57 this.singlePageLinkId = 0; 66 67 this.currentIndex = 0;68 this.currentGallery = null;69 this.fileReady = false;58 59 this.currentIndex; 60 this.currentGallery; 61 this.fileReady; 70 62 this.loadedImages = []; 71 this.currentFile = null; 72 73 this.display = null; 74 63 this.currentFile; 64 this.options_bkup; 65 66 this.display; 67 75 68 this.getPageGalleries(); 76 if(this.galleries.length !== 0){ 77 this.prepare(true); 78 } 79 }, 80 69 if(this.galleries.length != 0){ this.prepare(true); } 70 }, 71 81 72 prepare:function(checkForm){ 82 if(checkForm){ 83 this.checkFormElements(); 84 } 73 if(checkForm){ this.checkFormElements(); } 85 74 this.prepareHTML(); 86 75 this.prepareEventListeners(); 87 76 this.activated = true; 88 77 }, 89 78 90 79 //utility 91 80 open:function(gallery,index){ 92 81 var i; 93 94 if(!this.activated){ 95 this.prepare(true); 96 } 97 98 var g = (instanceOf(gallery,MilkboxGallery) ? gallery : this.getGallery(gallery)); 99 if(!g) { 100 return false; 101 } 102 103 // [i_a] when 'index' is not an number, it may be a element reference or string: resolve such indexes too 82 83 if(!this.activated){ this.prepare(true); } 84 85 var g = (instanceOf(gallery,MilkboxGallery)) ? gallery : this.getGallery(gallery); 86 if(!g) return false; 87 88 // [i_a] when 'index' is not an number, it may be a element reference or string: resolve such indexes too 104 89 if (typeOf(index) !== 'number') { 105 90 i = g.get_index_of(index); 106 if (i !== -1) { 107 index = i; 108 } 109 // on failure, try to parse index as an integer value. (e.g. when index is a string representing a index number) 110 } 91 if(i !== -1){ index = i; } 92 } 93 111 94 i = parseInt(index, 10); 112 if (isNaN(i)) { 113 i = 0; 114 } 95 if(isNaN(i)){ i = 0; } 115 96 116 97 this.closed = false; 117 var item = g.get_item(i); // [i_a] index is undefined 118 if(!item) { 119 return false; 120 } 121 98 var item = g.get_item(i); 99 if(!item) return false; 100 122 101 this.currentGallery = g; 123 this.currentIndex = i; // [i_a]124 102 this.currentIndex = i; 103 125 104 this.hideFormElements(); 126 105 127 106 this.display.set_mode(this.currentGallery.type); 128 107 this.display.appear(); 129 130 131 if(this.options.autoPlay || g.options.autoplay){ 132 this.startAutoPlay(true); 133 } 108 109 110 if(this.options.autoPlay || g.options.autoplay){ this.startAutoPlay(true); } 134 111 135 112 this.loadFile(item,this.getPreloads()); 136 113 return true; 137 114 }, 138 139 115 116 140 117 //utility 141 118 close:function(hideDisplay){ 142 if(hideDisplay){ 143 this.display.disappear(); 144 } 119 if(hideDisplay){ this.display.disappear(); } 145 120 this.showFormElements(); 146 121 this.pauseAutoPlay(); 147 122 this.stopLoadingCheck(); 148 123 this.currentGallery = null; 149 this.currentIndex = 0;124 this.currentIndex = null; 150 125 this.currentFile = null; 151 126 this.busy = false; … … 153 128 this.fileReady = false; 154 129 this.closed = true; 155 this.fireEvent('close'); 130 131 this.fireEvent('closed'); 156 132 }, 157 133 158 134 startAutoPlay:function(opening){ 159 var d = (this.currentGallery.options.autoplay_delay || this.options.autoPlayDelay); 160 if(d < this.options.resizeDuration*2) { 161 d = this.options.resizeDuration*2; 162 } 163 164 var f; // [i_a] split decl and assignment in two statements as jsLint said: Problem at line 148 character 42: 'f' has not been fully defined yet. 165 f = function(){ 135 var d = this.currentGallery.options.autoplay_delay || this.options.autoPlayDelay; 136 if(d < this.options.resizeDuration*2){ d = this.options.resizeDuration*2 }; 137 138 var f = function(){ 166 139 this.removeEvent('fileReady',f); 167 140 this.intId = this.navAux.periodical(d*1000,this,[null,'next']); 168 } ;141 } 169 142 170 143 if(opening){ … … 176 149 this.paused = false; 177 150 }, 178 151 179 152 pauseAutoPlay:function(){ 180 if(this.intId){ 181 clearInterval(this.intId); 182 this.intId = null; 183 } 184 153 if(this.intId){ 154 clearInterval(this.intId); 155 this.intId = null; 156 } 157 185 158 this.paused = true; 186 159 }, 187 160 188 161 //utility 189 162 //list:Array of objects or an object > [ { gallery:'gall1', autoplay:true, delay:6 } ] 190 //to permanently define autoplay options for any gallery 163 //to permanently define autoplay options for any gallery 191 164 setAutoPlay:function(list){ 192 var l = (typeOf(list) !== 'array' ? [list] : list);165 var l = (typeOf(list) == 'object') ? [list] : list; 193 166 l.each(function(item){ 194 167 var g = this.getGallery(item.gallery); 195 if(!g){ 196 return; 197 } 198 var a = (item.autoplay == true ? item.autoplay : false); 199 var d = ((item.delay && a) ? item.delay : this.options.autoPlayDelay); 200 g.setOptions({ 201 autoplay:a, 202 autoplay_delay:d 203 }).refresh(); 168 if(!g){ return; } 169 var a = (item.autoplay == true) ? item.autoplay : false; 170 var d = (item.delay && a) ? item.delay : this.options.autoPlayDelay; 171 g.setOptions({ autoplay:a, autoplay_delay:d }).refresh(); 204 172 },this); 205 173 }, 206 174 207 175 208 //utility 176 //utility 209 177 //{href:'file1.jpg',size:'width:900,height:100', title:'text'} 210 178 //show a file on the fly without gallery functionalities 211 openWithFile:function(file){ 212 var g = new MilkboxGallery([file]); 213 // [i_a] make sure this gallery is only created when there's actually something to show (supported formats and all that) 214 if (g.items && g.items.length > 0) { 215 this.open(g,0); 216 } 217 }, 218 179 openWithFile:function(file, options){ 180 if(!this.activated){ this.prepare(); } 181 182 if(options){ 183 this.refreshDisplay(options,true);//set custom options 184 } 185 186 var g = new MilkboxGallery([file],{ remove_title:this.options.removeTitle }); 187 this.open(g,0); 188 }, 189 219 190 getPreloads:function(){ 220 191 var items = this.currentGallery.items; 221 192 var index = this.currentIndex; 222 if(items.length === 1) { 223 return null; 224 } 225 226 var next = (index != items.length-1 ? items[index+1] : items[0]); 227 var prev = (index != 0 ? items[index-1] : items[items.length-1]); 228 var preloads = (prev == next ? [prev] : [prev,next]); //if gallery.length == 2, then prev == next 229 return preloads; 230 }, 231 193 if(items.length == 1) return null; 194 195 var next = (index != items.length-1) ? items[index+1] : items[0]; 196 var prev = (index != 0) ? items[index-1] : items[items.length-1]; 197 var preloads = (prev == next) ? [prev] : [prev,next]; //if gallery.length == 2, then prev == next 198 return preloads; 199 }, 200 232 201 //LOADING 233 202 loadFile:function(fileObj,preloads){ … … 236 205 this.display.clear_content(); 237 206 this.display.hide_bottom(); 238 207 239 208 if(this.checkFileType(fileObj,'swf')){ 240 209 this.loadSwf(fileObj); … … 244 213 this.loadImage(fileObj); 245 214 } 246 247 if(!this.checkFileType(fileObj,'swf')) { 248 this.startLoadingCheck(); 249 } 250 if(preloads){ 251 this.preloadFiles(preloads); 252 } 253 }, 254 215 216 if(!this.checkFileType(fileObj,'swf')) this.startLoadingCheck(); 217 if(preloads){ this.preloadFiles(preloads); } 218 }, 219 255 220 //to prevent the loader to show if the file is cached 256 221 startLoadingCheck:function(){ 257 222 var t = 0; 258 if (!this.loadCheckerId) 259 { 260 this.loadCheckerId = (function(){ 261 t+=1; 262 if(t > 5){ 263 if (this.loadCheckerId) 264 { 265 // only show the loader when the timer has not been cleared yet! 266 this.display.show_loader(); 267 } 268 this.stopLoadingCheck(); 223 if (!this.loadCheckerId) { 224 this.loadCheckerId = (function(){ 225 t+=1; 226 if(t > 5){ 227 if (this.loadCheckerId) { 228 // only show the loader when the timer has not been cleared yet! 229 this.display.show_loader(); 269 230 } 270 }).periodical(100,this); 271 } 231 this.stopLoadingCheck(); 232 } 233 }).periodical(100,this); 234 }//end if 272 235 }, 273 236 274 237 stopLoadingCheck:function(){ 275 238 clearInterval(this.loadCheckerId); 276 this.loadCheckerId = null; 277 }, 278 239 }, 240 279 241 preloadFiles:function(preloads){ 280 242 preloads.each(function(fileObj,index){ 281 if(!this.checkFileType(fileObj,"swf") && !this.checkFileType(fileObj,"html")){ 282 this.preloadImage(fileObj.href); 243 if(!this.checkFileType(fileObj,"swf") && !this.checkFileType(fileObj,"html")){ 244 this.preloadImage(fileObj.href); 283 245 } 284 246 },this); 285 247 }, 286 248 287 249 preloadImage:function(file){ 288 250 if(!this.loadedImages.contains(file)){ 289 var imageAsset = new Asset.image(file, { 251 var imageAsset = new Asset.image(file, { 290 252 onLoad:function(){ 291 253 this.loadedImages.push(file); … … 297 259 loadImage:function(fileObj){ 298 260 var file = fileObj.href; 299 var imageAsset = new Asset.image(file, { 261 var imageAsset = new Asset.image(file, { 300 262 onLoad:function(img){ 301 if(!this.loadedImages.contains(file)){ 302 //see next/prev events 303 this.loadedImages.push(file); 304 } 263 if(!this.loadedImages.contains(file)){ this.loadedImages.push(file); };//see next/prev events 305 264 this.loadComplete(img,fileObj.caption); 306 265 }.bind(this) … … 313 272 height:fileObj.size.height, 314 273 vars:fileObj.vars, 315 params:{ 316 wMode:'opaque', 317 swLiveConnect:'false' 318 } 319 }); 320 321 this.loadComplete($(swfObj),fileObj.caption); 274 params:{ wMode:'opaque', swLiveConnect:'false' } 275 }); 276 277 this.loadComplete(document.id(swfObj),fileObj.caption); 322 278 }, 323 279 324 280 loadHtml:function(fileObj){ 325 281 326 282 var query = (fileObj.vars ? '?' + Object.toQueryString(fileObj.vars) : ''); 327 283 var extras = (fileObj.extras ? fileObj.extras : ''); 284 328 285 var iFrame = new Element('iframe',{ 329 src:fileObj.href+query,330 styles:{331 'border-style':'solid',332 'border -width':'0px'286 'src':fileObj.href+query, 287 'frameborder':0,//for IE... 288 styles:{ 289 'border':'none' 333 290 } 334 291 }); … … 340 297 }); 341 298 } 342 299 343 300 this.loadComplete(iFrame,fileObj.caption); 344 301 },//loadHtml … … 347 304 //LOAD COMPLETE ********// 348 305 loadComplete:function(file,caption){ 349 350 if(this.closed) { 351 return;//if an onload event were still running 352 } 353 306 307 if(this.closed) return;//if an onload event were still running 308 354 309 this.fileReady = true;//the file is loaded and ready to be showed (see next_prev_aux()) 355 310 this.stopLoadingCheck(); 356 311 this.currentFile = file; 357 358 var timer; // split due to jsLint: Problem at line 338 character 31: 'timer' has not been fully defined yet. 312 var timer; 359 313 timer = (function(){ 360 314 if(this.display.ready){ … … 363 317 } 364 318 clearInterval(timer); 365 } 319 }//end if 366 320 }).periodical(100,this); 367 321 368 322 this.fireEvent('fileReady'); 369 323 },//end loadComplete 370 324 371 325 checkFileType:function(file,type){ 372 var href = (typeOf(file) !== 'string' ? file.href : file); 373 var regexp = new RegExp('\\.('+type+')$','i'); 374 return href.split('?')[0].test(regexp); 326 var href = (typeOf(file) != 'string') ? file.href : file; 327 var splitted = href.split('?')[0]; 328 var regexp = new RegExp("\.("+type+")$","i"); 329 var test = splitted.test(regexp); 330 331 if(!test && type=="html"){ 332 test = splitted.test(/\/\d+$/); 333 } 334 335 return test; 375 336 }, 376 337 … … 379 340 var names = []; 380 341 var links = $$('a[data-milkbox]'); 381 342 382 343 //check names 383 344 links.each(function(link){ 384 345 var name = link.get('data-milkbox'); 385 if(name === 'single'){ 386 var gallery = new MilkboxGallery(link,{ 387 name:'single'+this.singlePageLinkId++ 388 }); 389 // [i_a] make sure this gallery is only created when there's actually something to show (supported formats and all that) 390 if (gallery.items && gallery.items.length > 0) { 391 this.galleries.push(gallery); 392 } 346 if(name == 'single'){ 347 this.galleries.push(new MilkboxGallery(link,{name:'single'+this.singlePageLinkId++, remove_title:this.options.removeTitle })); 393 348 } else if(!names.contains(name)){ 394 349 names.push(name); 395 350 } 396 351 },this); 397 352 398 353 names.each(function(name){ 399 var gallery = new MilkboxGallery($$('a[data-milkbox='+name+']'),{ 400 name:name 401 }); 402 // [i_a] make sure this gallery is only created when there's actually something to show (supported formats and all that) 403 if (gallery.items && gallery.items.length > 0) { 404 this.galleries.push(gallery); 405 } 354 this.galleries.push(new MilkboxGallery($$('a[data-milkbox='+name+']'),{ name:name, remove_title:this.options.removeTitle })); 406 355 },this); 407 356 408 357 //set default autoplay // override with setAutoPlay 409 358 if(this.options.autoPlay){ 410 this.galleries.each(function(g){ 411 g.setOptions({ 412 autoplay:this.options.autoPlay, 413 autoplay_delay:this.options.autoPlayDelay 414 }); 415 }); 416 } 417 418 //console.log(this.galleries); 359 this.galleries.each(function(g){ 360 g.setOptions({autoplay:this.options.autoPlay,autoplay_delay:this.options.autoPlayDelay}); 361 g.refresh(); 362 }.bind(this)); 363 } 364 419 365 },//getPageGalleries 420 366 421 reloadPageGalleries:function(){ 367 reloadPageGalleries:function(){ 422 368 //reload page galleries 423 369 this.removePageGalleryEvents(); 424 370 425 371 this.galleries = this.galleries.filter(function(gallery){ 426 if(!gallery.external) { 427 gallery.clear(); 428 } 429 return gallery.external; 430 }); 431 372 if(!gallery.external) gallery.clear(); 373 return gallery.external; 374 }); 375 432 376 this.getPageGalleries(); 433 377 this.addPageGalleriesEvents(); 434 435 if(!this.activated){ 436 this.prepare(true); 437 } 378 379 if(!this.activated){ this.prepare(true); } 438 380 },//end reloadPageGalleries 439 381 … … 441 383 resetExternalGalleries:function(list){ 442 384 this.galleries = this.galleries.filter(function(gallery){ 443 if(gallery.external) { 444 gallery.clear(); 445 } 385 if(gallery.external) gallery.clear(); 446 386 return !gallery.external; 447 387 }); 448 388 449 if(!list) { 450 return; 451 } 452 var array = (typeOf(list) === 'array' ? list : [list]); 453 array.each(function(data){ 454 this.addGalleries(data); 455 }, this); 389 if(!list) return; 390 var array = (typeOf(list) == 'array') ? list : [list]; 391 array.each(function(data){ this.addGalleries(data); }, this); 456 392 }, 457 393 458 394 //utility 459 395 addGalleries:function(data){ 460 if(!this.activated){ 461 this.prepare(true); 462 } 463 if (typeOf(data) === 'string' && data.split('?')[0].test(/\.(xml)$/i)) { 396 if(!this.activated){ this.prepare(true); } 397 if (typeOf(data) == 'string' && data.split('?')[0].test(/\.(xml)$/i)) { 464 398 this.loadXml(data); 465 399 } else {//array or object 466 400 this.setObjectGalleries(data); 467 401 } 468 if(!this.activated){ 469 this.prepare(true); 470 } 471 }, 472 402 if(!this.activated){ this.prepare(true); } 403 }, 404 473 405 loadXml:function(xmlfile){ 474 406 var r = new Request({ … … 483 415 this.setXmlGalleries(new Element('div',{ html:t })); 484 416 }.bind(this), 485 onFailure:function(transport){ 486 alert('Milkbox :: loadXml: XML file path error or local Ajax test: please test xml galleries on-line'); 487 } 417 onFailure:function(transport){ alert('Milkbox :: loadXml: XML file path error or local Ajax test: please test xml galleries on-line'); } 488 418 }).send(); 489 419 }, 490 420 491 421 setXmlGalleries:function(container){ 492 422 var c = container; 493 423 var xml_galleries = c.getElements('.gallery'); 424 var links; 425 var aplist = []; 494 426 xml_galleries.each(function(xml_gallery,i){ 495 496 var options = { 497 name:xml_gallery.getProperty('name'), 427 428 var options = { 429 name:xml_gallery.getProperty('name'), 498 430 autoplay:Boolean(xml_gallery.getProperty('autoplay')), 499 431 autoplay_delay:Number(xml_gallery.getProperty('autoplay_delay')) 500 }; 501 502 var links = xml_gallery.getChildren('a').map(function(tag){ 503 return { 504 href:tag.href, 505 size:tag.get('data-milkbox-size'), 506 title:tag.get('title') 507 }; 432 } 433 434 var links = xml_gallery.getChildren('a').map(function(tag){ 435 return { href:tag.href, size:tag.get('data-milkbox-size'), title:tag.get('title') } 508 436 },this); 509 510 var gallery = new MilkboxGallery(links,options); 511 // [i_a] make sure this gallery is only created when there's actually something to show (supported formats and all that) 512 if (gallery.items && gallery.items.length > 0) { 513 this.galleries.push(gallery); 514 } 437 438 this.galleries.push(new MilkboxGallery(links,options)); 515 439 },this); 516 440 517 441 this.fireEvent('xmlGalleries'); 518 442 },//end setXmlGalleries 519 520 //[{ name:'gall1', autoplay:true, autoplay_delay:7, files:[{href:'file1.jpg',size:'width:900,height:100', title:'text'},{href:'file2.html',size:'w:800,h:200', title:'text'}] },{...},{...}] 443 444 //[{ name:'gall1', autoplay:true, autoplay_delay:7, files:[{href:'file1.jpg',size:'width:900,height:100', title:'text'},{href:'file2.html',size:'w:800,h:200', title:'text'}] },{...},{...}] 521 445 setObjectGalleries:function(data){ 522 var array = (typeOf(data) == = 'array' ? data : [data]);446 var array = (typeOf(data) == 'array') ? data : [data]; 523 447 array.each(function(newobj){ 524 448 var options = { 525 name:newobj.name, 449 name:newobj.name, 526 450 autoplay:newobj.autoplay, 527 451 autoplay_delay:newobj.autoplay_delay 528 }; 529 var gallery = new MilkboxGallery(newobj.files,options); 530 // [i_a] make sure this gallery is only created when there's actually something to show (supported formats and all that) 531 if (gallery.items && gallery.items.length > 0) { 532 this.galleries.push(gallery); 533 } 452 } 453 this.galleries.push(new MilkboxGallery(newobj.files,options)); 534 454 },this); 535 455 }, 536 456 537 457 //utility 538 458 getGallery:function(name){ 539 var g = this.galleries.filter(function(gallery){ 540 return gallery.name == name; 541 },this); 542 return (g[0] || null); 543 }, 544 459 var g = this.galleries.filter(function(gallery){ return gallery.name == name; },this); 460 return g[0] || null; 461 }, 462 545 463 //HTML 546 464 prepareHTML:function(){ 547 465 this.display = new MilkboxDisplay({ 548 init_width:this.options.initialWidth, 549 init_height:this.options.initialHeight, 550 overlay_opacity:this.options.overlayOpacity, 551 margin_top:this.options.marginTop, 552 filebox_border_color:this.options.fileboxBorderColor, 553 filebox_padding:this.options.fileboxPadding, 554 resize_duration:this.options.resizeDuration, 555 resize_transition:this.options.resizeTransition, 466 initialWidth:this.options.initialWidth, 467 initialHeight:this.options.initialHeight, 468 overlayOpacity:this.options.overlayOpacity, 469 marginTop:this.options.marginTop, 470 fileboxBorderWidth:this.options.fileboxBorderWidth, 471 fileboxBorderColor:this.options.fileboxBorderColor, 472 fileboxPadding:this.options.fileboxPadding, 473 resizeDuration:this.options.resizeDuration, 474 resizeTransition:this.options.resizeTransition, 556 475 centered:this.options.centered, 557 auto_size:this.options.autoSize, 558 autosize_max_height:this.options.autoSizeMaxHeight, 559 autosize_max_width:this.options.autoSizeMaxWidth, 560 autosize_min_height:this.options.autoSizeMinHeight, 561 autosize_min_width:this.options.autoSizeMinWidth, 562 image_of_text:this.options.imageOfText 563 }); 476 autoSize:this.options.autoSize, 477 autoSizeMaxHeight:this.options.autoSizeMaxHeight, 478 imageOfText:this.options.imageOfText 479 }); 480 }, 481 482 refreshDisplay:function(options,keepBackup){ 483 if(!this.activated) return; 484 485 var options_bkup = this.display.options;//save original options 486 var new_options = Object.merge({},options_bkup,options); 487 if(this.display){ this.display.clear() } 488 this.display = new MilkboxDisplay(new_options); 489 this.addDisplayEvents(); 490 491 if(keepBackup){ 492 this.options_bkup = options_bkup;//restored in close(); 493 } else { 494 this.options_bkup = null; 495 } 564 496 }, 565 497 566 498 checkFormElements:function(){ 567 499 this.formElements = $$('select, textarea'); 568 if(this.formElements.length === 0) { 569 return; 570 } 500 if(this.formElements.length == 0) return; 571 501 572 502 this.formElements = this.formElements.map(function(elem){ … … 576 506 }); 577 507 }, 578 508 579 509 hideFormElements:function(){ 580 if(this.formElements.length === 0) { 581 return; 582 } 583 this.formElements.each(function(elem){ 584 elem.setStyle('display','none'); 585 }); 586 }, 587 510 if(this.formElements.length == 0) return; 511 this.formElements.each(function(elem){ elem.setStyle('display','none'); }); 512 }, 513 588 514 showFormElements:function(){ 589 if(this.formElements.length === 0) { 590 return; 591 } 515 if(this.formElements.length == 0) return; 592 516 this.formElements.each(function(elem){ 593 517 elem.setStyle('visibility',elem.retrieve('visibility')); 594 518 elem.setStyle('display',elem.retrieve('display')); 595 }) ;596 }, 597 519 }) 520 }, 521 598 522 //EVENTS 599 523 addPageGalleriesEvents:function(){ 600 var pageGalleries = this.galleries.filter(function(gallery){ 601 return !gallery.external; 602 }); 524 var pageGalleries = this.galleries.filter(function(gallery){ return !gallery.external }); 603 525 pageGalleries.each(function(gallery){ 604 526 gallery.items.each(function(item){ … … 610 532 },this); 611 533 }, 612 534 613 535 removePageGalleryEvents:function(){ 614 var pageGalleries = this.galleries.filter(function(gallery){ 615 return !gallery.external; 616 }); 536 var pageGalleries = this.galleries.filter(function(gallery){ return !gallery.external }); 617 537 pageGalleries.each(function(gallery){ 618 538 gallery.items.each(function(item){ … … 621 541 }); 622 542 }, 623 624 prepareEventListeners:function(){ 625 626 this.addPageGalleriesEvents(); 627 543 544 addDisplayEvents:function(){ 628 545 this.display.addEvent('nextClick',function(){ 629 546 this.navAux(true,'next'); 630 547 }.bind(this)); 631 548 632 549 this.display.addEvent('prevClick',function(){ 633 550 this.navAux(true,'prev'); 634 551 }.bind(this)); 635 552 636 553 this.display.addEvent('playPauseClick',function(){ 637 554 if(this.paused){ … … 642 559 this.display.set_paused(this.paused); 643 560 }.bind(this)); 644 561 645 562 this.display.addEvent('disappear',function(){ 563 if(this.options_bkup){ this.refreshDisplay(this.options_bkup); } 646 564 this.close(false); 647 565 }.bind(this)); 648 566 649 567 this.display.addEvent('resizeComplete',function(){ 650 568 this.busy = false;//see navAux 651 569 }.bind(this)); 652 570 }, 571 572 prepareEventListeners:function(){ 573 574 this.addPageGalleriesEvents(); 575 this.addDisplayEvents(); 576 653 577 //reset overlay height and position onResize 654 578 window.addEvent('resize',function(){ 655 if(this.display.ready){ 656 this.display.resetOverlaySize(); 657 } 579 if(this.display.ready){ this.display.resetOverlaySize(); } 658 580 }.bind(this)); 659 581 660 582 //keyboard next/prev/close 661 583 window.document.addEvent('keydown',function(e){ 662 if(this.busy == true || this.closed){ 663 return; 584 if(this.busy == true || this.closed){ return; } 585 if(e.key == 'right' || e.key == 'left' || e.key == 'space'){ e.preventDefault(); } 586 587 if(this.display.mode != 'single'){ 588 if(e.key == 'right' || e.key == 'space'){ this.navAux(e,'next'); } 589 else if(e.key == 'left'){ this.navAux(e,'prev'); } 664 590 } 665 switch (e.key) 666 { 667 case 'right': 668 case 'space': 669 e.preventDefault(); 670 this.navAux(e,'next'); 671 break; 672 673 case 'left': 674 e.preventDefault(); 675 this.navAux(e,'prev'); 676 break; 677 678 case 'esc': 679 e.stop(); 680 this.close(true); 681 break; 682 } 591 592 if(e.key == 'esc'){ this.display.disappear(); } 683 593 }.bind(this)); 684 594 }, 685 595 686 596 navAux:function(e,direction){ 687 597 688 598 if(e){//called from a button/key event 689 599 this.pauseAutoPlay(); 690 600 } else {//called from autoplay 691 if(this.busy || !this.fileReady){ 692 //prevent autoplay() 693 return; 694 } 601 if(this.busy || !this.fileReady){ return; }//prevent autoplay() 695 602 } 696 603 697 604 this.busy = true; //for keyboard and autoplay 698 699 var i1, i2; 700 701 if(direction === 'next'){ 702 i1 = (this.currentIndex != this.currentGallery.items.length-1 ? this.currentIndex + 1 : 0); 703 this.currentIndex = i1; 704 i2 = (this.currentIndex != this.currentGallery.items.length-1 ? this.currentIndex + 1 : 0); 605 606 var i, _i; 607 608 if(direction == "next"){ 609 i= (this.currentIndex != this.currentGallery.items.length-1) ? this.currentIndex += 1 : this.currentIndex = 0; 610 _i= (this.currentIndex != this.currentGallery.items.length-1) ? this.currentIndex + 1 : 0; 705 611 } else { 706 i1 = (this.currentIndex != 0 ? this.currentIndex - 1 : this.currentGallery.items.length-1); 707 this.currentIndex = i1; 708 i2 = (this.currentIndex != 0 ? this.currentIndex - 1 : this.currentGallery.items.length-1); 709 } 710 711 this.loadFile(this.currentGallery.get_item(i1),[this.currentGallery.get_item(i2)]); 612 i= (this.currentIndex != 0) ? this.currentIndex -= 1 : this.currentIndex = this.currentGallery.items.length-1; 613 _i= (this.currentIndex != 0) ? this.currentIndex - 1 : this.currentGallery.items.length-1; 614 }; 615 616 this.loadFile(this.currentGallery.get_item(i),[this.currentGallery.get_item(_i)]); 712 617 } 713 618 … … 725 630 726 631 Implements:[Options,Events], 727 632 728 633 options:{ 729 init_width:100, 730 init_height:100, 731 overlay_opacity:1, 732 margin_top:0, 733 filebox_border_color:'#000000', 734 filebox_padding:'0px', 735 resize_duration:0.5, 736 resize_transition:'sine:in:out', 634 initialWidth:100, 635 initialHeight:100, 636 overlayOpacity:1, 637 marginTop:0, 638 fileboxBorderWidth:'0px', 639 fileboxBorderColor:'#000000', 640 fileboxPadding:'0px', 641 resizeDuration:.5, 642 resizeTransition:'sine:in:out', 737 643 centered:false, 738 auto_size:false, 739 autosize_max_height:0, 740 autosize_max_width:0, 741 autosize_min_height:0, 742 autosize_min_width:0, 743 fixup_dimension:true, 744 image_of_text:'of', 745 zIndex: 410000, // required to be a high number > 400000 as the 'filemanager as tinyMCE plugin' sits at z-index 400K+ 644 autoSize:false, 645 autoSizeMaxHeight:0, 646 imageOfText:'of', 746 647 onNextClick:function(){}, 747 648 onPrevClick:function(){}, … … 750 651 onResizeComplete:function(){} 751 652 }, 752 653 753 654 initialize: function(options){ 754 655 this.setOptions(options); 755 756 this.overlay = null;757 this.mainbox = null;758 this.filebox = null;759 this.bottom = null;760 this.controls = null;761 this.caption = null;762 this.close = null;763 this.next = null;764 this.prev = null;765 this.playpause = null;656 657 this.overlay; 658 this.mainbox; 659 this.filebox; 660 this.bottom; 661 this.controls; 662 this.caption; 663 this.close; 664 this.next; 665 this.prev; 666 this.playpause; 766 667 this.paused = false; 767 this.count = null;768 668 this.count; 669 769 670 this.mode = 'standard'; 770 671 this.ready = false;//after overlay and mainbox become visible == true 771 772 this.overlay_show_fx = null;773 this.overlay_hide_fx = null;774 775 this.mainbox_show_fx = null;776 this.mainbox_hide_fx = null;777 this.mainbox_resize_fx = null;778 672 673 this.overlay_show_fx; 674 this.overlay_hide_fx; 675 676 this.mainbox_show_fx; 677 this.mainbox_hide_fx; 678 this.mainbox_resize_fx; 679 779 680 this.current_file = null; 780 681 … … 784 685 785 686 },//end init 786 687 787 688 build_html:function(){ 788 this.overlay = new Element('div', { 689 this.overlay = new Element('div', { 789 690 'id':'mbox-overlay', 790 691 'styles':{ … … 792 693 'position':'fixed', 793 694 'display':'none', 794 'z-index': this.options.zIndex,795 695 'left':0, 796 696 'width':'100%', … … 801 701 'padding':0 802 702 } 803 }).inject( $(document.body));703 }).inject(document.id(document.body)); 804 704 805 705 this.mainbox = new Element('div', { 806 706 'id':'mbox-mainbox', 807 707 'styles': { 808 'position':(this.options.centered ? 'fixed' : 'absolute'),708 'position':(this.options.centered) ? 'fixed' : 'absolute', 809 709 'overflow':'hidden', 810 710 'display':'none', 811 'z-index': this.options.zIndex + 1, // required to be > overlay.z-index812 'width':this.options.init _width,813 'height':this.options.init _height,711 'z-index':50001,//overlay z-index (see css) + 1 712 'width':this.options.initialWidth, 713 'height':this.options.initialHeight, 814 714 'opacity':0, 815 715 'margin':0, 816 716 'left':'50%', 817 'marginLeft':-(this.options.init _width/2),818 'marginTop':(this.options.centered ? -(this.options.init_height/2) : ''),819 'top':(this.options.centered ? '50%' : '')717 'marginLeft':-(this.options.initialWidth/2), 718 'marginTop':(this.options.centered) ? -(this.options.initialHeight/2) : '', 719 'top':(this.options.centered) ? '50%' : '' 820 720 } 821 }).inject($(document.body)); 822 823 this.filebox = new Element('div#mbox-filebox').inject(this.mainbox); 824 721 }).inject(document.id(document.body)); 722 723 this.filebox = new Element('div',{ 724 'id':'mbox-filebox', 725 'styles':{ 726 'border-style':'solid', 727 'border-width':this.options.fileboxBorderWidth, 728 'border-color':this.options.fileboxBorderColor, 729 'padding':this.options.fileboxPadding, 730 'opacity':0 731 } 732 }).inject(this.mainbox); 733 825 734 this.bottom = new Element('div#mbox-bottom').setStyle('visibility','hidden').inject(this.mainbox); 826 this.controls = new Element('div#mbox-controls'); //.setStyle('visibility','hidden');735 this.controls = new Element('div#mbox-controls'); 827 736 this.caption = new Element('div#mbox-caption',{'html':'test'}).setStyle('display','none'); 828 737 829 738 this.bottom.adopt(new Element('div.mbox-reset'),this.controls, this.caption, new Element('div.mbox-reset')); 830 739 831 740 this.close = new Element('div#mbox-close'); 832 741 this.next = new Element('div#mbox-next'); … … 834 743 this.playpause = new Element('div#mbox-playpause'); 835 744 this.count = new Element('div#mbox-count'); 836 837 //$$(this.next, this.prev, this.count, this.playpause).setStyle('display','none'); 745 838 746 $$(this.next, this.prev, this.close, this.playpause).setStyles({ 839 747 'outline':'none', … … 843 751 this.controls.adopt(new Element('div.mbox-reset'), this.close, this.next, this.prev, this.playpause, new Element('div.mbox-reset'), this.count); 844 752 }, 845 753 846 754 prepare_effects:function(){ 847 this.overlay_show_fx = new Fx.Tween(this.overlay,{ 755 this.overlay_show_fx = new Fx.Tween(this.overlay,{ 848 756 duration:'short', 849 757 link:'cancel', 850 758 property:'opacity', 851 759 onStart:function(){ 852 //console.log('overlay_show_fx start');853 760 this.element.setStyles({ 854 761 'top':-window.getScroll().y, 855 'height':window.getScrollSize().y +window.getScroll().y,762 'height':window.getScrollSize().y+window.getScroll().y, 856 763 'display':'block' 857 764 }); 858 765 }, 859 766 onComplete:function(){ 860 //console.log('overlay_show_fx complete');861 767 this.mainbox_show_fx.start(1); 862 768 }.bind(this) 863 769 }); 864 770 865 this.overlay_hide_fx = new Fx.Tween(this.overlay,{ 771 this.overlay_hide_fx = new Fx.Tween(this.overlay,{ 866 772 duration:'short', 867 773 link:'cancel', … … 870 776 onComplete:function(){ 871 777 this.overlay.setStyle('display','none'); 778 this.fireEvent('disappear'); 872 779 }.bind(this) 873 780 }); 874 875 this.mainbox_show_fx = new Fx.Tween(this.mainbox,{ 781 782 this.mainbox_show_fx = new Fx.Tween(this.mainbox,{ 876 783 duration:'short', 877 784 link:'cancel', 878 785 property:'opacity', 879 786 onStart:function(){ 880 //console.log('mainbox_show_fx start');881 787 this.mainbox.setStyle('display','block'); 882 788 }.bind(this), 883 789 onComplete:function(){ 884 //console.log('mainbox_show_fx complete');885 790 this.ready = true; 886 791 }.bind(this) 887 792 }); 888 793 889 this.mainbox_hide_fx = new Fx.Tween(this.mainbox,{ 794 this.mainbox_hide_fx = new Fx.Tween(this.mainbox,{ 890 795 duration:'short', 891 796 link:'cancel', … … 898 803 }.bind(this) 899 804 }); 900 901 902 this.mainbox_resize_fx = new Fx.Morph(this.mainbox,{ 903 duration:this.options.resize _duration*1000,904 transition:this.options.resize _transition,805 806 807 this.mainbox_resize_fx = new Fx.Morph(this.mainbox,{ 808 duration:this.options.resizeDuration*1000, 809 transition:this.options.resizeTransition, 905 810 link:'cancel', 906 811 onStart:function(){ 907 //console.log('resize_fx start');908 } ,812 this.filebox.setStyle('opacity',0) 813 }.bind(this), 909 814 onComplete:function(){ 910 var w, h;911 w = this.current_file.width;912 h = this.current_file.height;913 if (w < this.options.autosize_min_width) w = this.options.autosize_min_width;914 if (h < this.options.autosize_min_height) h = this.options.autosize_min_height;915 815 this.show_bottom(); 916 this.filebox.setStyle('width', w+'px'); 917 this.filebox.setStyle('height', h+'px'); 918 this.filebox.setStyle('opacity',0).grab(this.current_file).tween('opacity',1); 816 this.filebox.setStyle('height',this.current_file.height+'px'); 817 this.filebox.grab(this.current_file).tween('opacity',1); 919 818 this.fireEvent('resizeComplete'); 920 819 }.bind(this) 921 820 }); 922 821 923 822 this.filebox.set('tween',{ duration:'short', link:'chain' }); 924 823 },//end prepare_effects 925 824 926 825 prepare_events:function(){ 927 $$(this.overlay,this.close).addEvent('click', function(){ 928 this.disappear(); 929 }.bind(this)); 930 this.prev.addEvent('click',function(){ 931 this.fireEvent('prevClick'); 932 }.bind(this)); 933 this.next.addEvent('click',function(){ 934 this.fireEvent('nextClick'); 935 }.bind(this)); 936 this.playpause.addEvent('click',function(){ 937 this.fireEvent('playPauseClick'); 938 }.bind(this) ); 826 $$(this.overlay,this.close).addEvent('click', function(){ this.disappear(); }.bind(this)); 827 this.prev.addEvent('click',function(){ this.fireEvent('prevClick') }.bind(this)); 828 this.next.addEvent('click',function(){ this.fireEvent('nextClick') }.bind(this)); 829 this.playpause.addEvent('click',function(){ this.fireEvent('playPauseClick') }.bind(this) ); 939 830 }, 940 831 941 832 show_file:function(file,caption,index,length){ 942 833 943 //this.clear_display();944 834 this.hide_loader(); 945 946 if(file.match && file.match('img') && (this.options.auto_size || this.options.centered)){ 947 file = this.get_resized_image(file); 948 } 949 950 var file_size = { 951 w:file.width.toInt(), 952 h:file.height.toInt() 835 836 if(file.match && file.match('img') && (this.options.autoSize || this.options.centered)){ 837 var file = this.get_resized_image(file); 953 838 }; 954 if(!file_size.w || !file_size.h){ 955 //data-milkbox-size not passed 956 if (!this.options.fixup_dimension) { 957 alert('Milkbox error: you must pass size values if the file is swf or html or a free file (openWithFile)'); 958 return; 959 } 960 // assume some sensible defaults: 961 var dims = Window.getSize(); 962 file.width = dims.x; 963 file.height = dims.y; 964 file_size = { 965 w: dims.x * 0.85, 966 h: dims.y * 0.85 967 }; 968 file.set({ 'width':file_size.w.toInt(), 'height':file_size.h.toInt() }); 969 } 970 971 if(this.options.autosize_min_height > file_size.h){ 972 var mt = Math.round((this.options.autosize_min_height - file_size.h) / 2); 973 var mb = this.options.autosize_min_height - file_size.h - mt; 974 file.setStyles({ 975 'margin-top': mt, // no need to say "+'px'": mootools takes care of that! 976 'margin-bottom': mb 977 }); 978 file_size.h = this.options.autosize_min_height; 979 } 980 if(this.options.autosize_min_width > file_size.w){ 981 var ml = Math.round((this.options.autosize_min_width - file_size.w) / 2); 982 var mr = this.options.autosize_min_width - file_size.w - ml; 983 file.setStyles({ 984 'margin-left': ml, 985 'margin-right': mr 986 }); 987 file_size.w = this.options.autosize_min_width; 988 } 989 990 file_size = Object.map(file_size,function(value){ 991 return value.toInt(); 992 }); 993 994 this.caption.innerHTML = (caption ? caption : ''); 839 840 var file_size = { w:file.width.toInt(), h:file.height.toInt() }; 841 if(!file_size.w || !file_size.h){ alert('Milkbox error: you must pass size values if the file is swf or html or a free file (openWithFile)'); return; }//data-milkbox-size not passed 842 file_size = Object.map(file_size,function(value){ return value.toInt(); }); 843 844 this.caption.innerHTML = (caption) ? caption : ''; 995 845 this.update_count(index,length); 996 846 997 847 var filebox_addsize = this.filebox.getStyle('border-width').toInt()*2+this.filebox.getStyle('padding').toInt()*2; 848 998 849 var final_w = file_size.w+filebox_addsize; 999 850 1000 851 //so now I can predict the caption height 1001 852 var caption_adds = this.caption.getStyles('paddingRight','marginRight'); 1002 this.caption.setStyle('width',final_w-caption_adds.paddingRight.toInt()-caption_adds.marginRight.toInt() );853 this.caption.setStyle('width',final_w-caption_adds.paddingRight.toInt()-caption_adds.marginRight.toInt() - 2); 1003 854 $$(this.bottom,this.controls).setStyle('height',Math.max(this.caption.getDimensions().height,this.controls.getComputedSize().totalHeight)); 1004 855 var mainbox_size = this.mainbox.getComputedSize(); 1005 856 1006 857 var final_h = file_size.h+filebox_addsize+this.bottom.getComputedSize().totalHeight; 1007 1008 var target_size = { 858 859 var target_size = { 1009 860 w:final_w, 1010 861 h:final_h, 1011 862 total_w:final_w+mainbox_size.totalWidth-mainbox_size.width, 1012 863 total_h:final_h+mainbox_size.totalHeight-mainbox_size.height 1013 } ;1014 864 } 865 1015 866 this.current_file = file; 1016 867 this.resize_to(target_size); … … 1023 874 var ratio; 1024 875 var check; 1025 1026 var i_size = { 1027 w:image.get('width').toInt(), 1028 h:image.get('height').toInt() 1029 }; 1030 876 877 var i_size = { w:image.get('width').toInt(), h:image.get('height').toInt() }; 878 1031 879 //cut out some pixels to make it better 1032 880 var w_size = window.getSize(); 1033 max_size = {1034 w:w_size.x-60, 1035 h:w_size.y-68-this.options.margin _top*2881 var max_size = { 882 w:w_size.x-60, 883 h:w_size.y-68-this.options.marginTop*2 1036 884 }; 1037 885 … … 1045 893 check = 'w'; 1046 894 } 1047 1048 ratio = (ratio <= 1 ? ratio : 1); 1049 1050 i_size = Object.map(i_size,function(value){ 1051 return value*ratio; 1052 }); 1053 1054 ratio = (max_size[check]/i_size[check] <= 1 ? max_size[check]/i_size[check] : 1); 1055 i_size = Object.map(i_size,function(value){ 1056 return value*ratio; 1057 }); 1058 1059 if(this.options.autosize_max_height > 0){ 1060 ratio = (this.options.autosize_max_height/i_size.h < 1 ? this.options.autosize_max_height/i_size.h : 1); 1061 i_size = Object.map(i_size,function(value){ 1062 return value*ratio; 1063 }); 1064 } 1065 if(this.options.autosize_max_width > 0){ 1066 ratio = (this.options.autosize_max_width/i_size.w < 1 ? this.options.autosize_max_width/i_size.w : 1); 1067 i_size = Object.map(i_size,function(value){ 1068 return value*ratio; 1069 }); 1070 } 1071 1072 image.set({ 'width': Math.round(i_size.w), 'height': Math.round(i_size.h) }); 1073 895 896 ratio = (ratio <= 1) ? ratio : 1; 897 898 i_size = Object.map(i_size,function(value){ return Math.floor(value*ratio); }); 899 900 ratio = (max_size[check]/i_size[check] <= 1) ? max_size[check]/i_size[check] : 1; 901 i_size = Object.map(i_size,function(value){ return Math.floor(value*ratio); }); 902 903 if(this.options.autoSizeMaxHeight > 0){ 904 ratio = (this.options.autoSizeMaxHeight/i_size.height < 1) ? this.options.autoSizeMaxHeight/i_size.height : 1; 905 i_size = Object.map(i_size,function(value){ return Math.floor(value*ratio); }); 906 } 907 908 image.set({ 'width':i_size.w, 'height':i_size.h }); 909 1074 910 return image; 1075 911 },//get_resized_image … … 1080 916 'height':target_size.h, 1081 917 'marginLeft':-(target_size.total_w/2).round(), 1082 'marginTop':(this.options.centered ? -(target_size.total_h/2).round() : '')1083 }); 1084 }, 1085 918 'marginTop':(this.options.centered) ? -(target_size.total_h/2).round() : '' 919 }); 920 }, 921 1086 922 show_loader:function(){ 1087 923 this.mainbox.addClass('mbox-loading'); 1088 924 }, 1089 925 1090 926 hide_loader:function(){ 1091 927 this.mainbox.removeClass('mbox-loading'); … … 1098 934 $$(this.bottom,this.controls).setStyle('height',''); 1099 935 }, 1100 936 1101 937 hide_bottom:function(){ 1102 938 this.caption.setStyle('display','none'); … … 1108 944 this.bottom.setStyle('visibility','visible'); 1109 945 }, 1110 946 1111 947 appear:function(){ 1112 if(!this.options.centered){ 1113 this.mainbox.setStyle('top',window.getScroll().y+this.options.margin_top); 1114 } 1115 this.overlay_show_fx.start(this.options.overlay_opacity); 1116 }, 1117 948 if(!this.options.centered){ this.mainbox.setStyle('top',window.getScroll().y+this.options.marginTop); } 949 this.overlay_show_fx.start(this.options.overlayOpacity); 950 }, 951 1118 952 disappear:function(){ 1119 953 this.cancel_effects(); 1120 954 1121 955 this.current_file = null; 1122 956 this.ready = false; … … 1129 963 this.caption.setStyle('display','none').empty(); 1130 964 this.bottom.setStyle('visibility','hidden'); 1131 965 1132 966 //TODO anche opacity a 0 se si usa un tween per il file 1133 967 this.filebox.setStyle('height','').empty(); 1134 968 1135 969 this.mainbox.setStyles({ 1136 970 'opacity':0, 1137 971 'display':'none', 1138 'width':this.options.init_width, 1139 'height':this.options.init_height, 1140 'marginLeft':-(this.options.init_width/2), 1141 'marginTop':(this.options.centered ? -(this.options.init_height/2) : ''), 1142 'top':(this.options.centered ? '50%' : '') 1143 }); 1144 972 'width':this.options.initialWidth, 973 'height':this.options.initialHeight, 974 'marginLeft':-(this.options.initialWidth/2), 975 'marginTop':(this.options.centered) ? -(this.options.initialHeight/2) : '', 976 'top':(this.options.centered) ? '50%' : '' 977 }); 978 979 this.filebox.setStyle('opacity',0); 980 1145 981 this.overlay_hide_fx.start(0); 1146 1147 this.fireEvent('disappear');982 983 //this.fireEvent('disappear'); 1148 984 },//end disappear 1149 985 1150 986 cancel_effects:function(){ 1151 987 [this.mainbox_resize_fx, … … 1154 990 this.overlay_hide_fx, 1155 991 this.overlay_show_fx 1156 ].each(function(fx){ 1157 fx.cancel(); 1158 }); 1159 }, 1160 992 ].each(function(fx){ fx.cancel(); }); 993 }, 994 1161 995 set_mode:function(gallery_type){ 1162 996 1163 997 this.mode = gallery_type; 1164 998 var close_w = this.close.getComputedSize().width; … … 1167 1001 var playpause_w = this.playpause.getComputedSize().width; 1168 1002 var offset = this.mainbox.getStyle('border-right-width').toInt();//for design purposes 1169 1003 1170 1004 switch(gallery_type){ 1171 1005 case 'autoplay': … … 1185 1019 return; 1186 1020 } 1187 1021 1188 1022 this.caption.setStyle('margin-right',this.controls.getComputedSize().totalWidth); 1189 1023 },//end set_mode 1190 1024 1191 1025 set_paused:function(paused){ 1192 1026 this.paused = paused; 1193 var pos = (this.paused ? '0 -66px' : '');1027 var pos = (this.paused) ? '0 -66px' : ''; 1194 1028 this.playpause.setStyle('background-position',pos); 1195 1029 }, 1196 1030 1197 1031 update_count:function(index,length){ 1198 this.count.set('text',index+' '+this.options.image _of_text+' '+length);1032 this.count.set('text',index+' '+this.options.imageOfText+' '+length); 1199 1033 }, 1200 1034 1201 1035 resetOverlaySize:function(){ 1202 if(this.overlay.getStyle('opacity') == 0){ 1203 //resize only if visible 1204 return; 1205 } 1206 var h = window.getSize().y; 1207 this.overlay.setStyles({ 'height':h }); 1036 if(this.overlay.getStyle('opacity') == 0){ return; };//resize only if visible 1037 var h = window.getScrollSize().y+window.getScroll().y; 1038 this.overlay.setStyles({ 'height':h, 'top':-window.getScroll().y }); 1039 }, 1040 1041 clear:function(){ 1042 this.overlay.destroy(); 1043 this.mainbox.destroy(); 1208 1044 } 1209 1045 1210 1046 });//END 1211 1047 … … 1215 1051 1216 1052 //Class: MilkboxGallery 1217 //args: source,options 1053 //args: source,options 1218 1054 // *source: element, elements, array 1219 1055 // *options: name, autoplay, autoplay_delay … … 1226 1062 name:null, 1227 1063 autoplay:null, 1228 autoplay_delay:null 1064 autoplay_delay:null, 1065 remove_title:true 1229 1066 }, 1230 1067 1231 1068 initialize:function(source,options){ 1232 1069 1233 1070 this.setOptions(options); 1234 1071 1235 1072 this.source = source; 1236 1073 this.external = false; … … 1243 1080 1244 1081 prepare_gallery:function(){ 1245 switch(typeOf(this.source)) 1246 { 1247 case 'element'://single 1248 if(this.check_extension(this.source.href)){ 1249 this.items = [this.source]; 1250 } 1251 break; 1252 case 'elements'://html 1253 this.items = this.source.filter(function(link){ 1254 return this.check_extension(link.href); 1255 },this); 1256 break; 1257 case 'array'://xml, array 1258 this.items = this.source.filter(function(link){ 1259 return this.check_extension(link.href); 1260 },this); 1261 this.external = true; 1262 break; 1263 default: 1264 return; 1265 } 1266 }, 1267 1082 switch(typeOf(this.source)){ 1083 case 'element'://single 1084 if(this.check_extension(this.source.href)){ this.items = [this.source]; } 1085 else{ alert('Wrong file extension: '+this.source.href); } 1086 break; 1087 case 'elements'://html 1088 this.items = this.source.filter(function(link){ return this.check_extension(link.href); },this); 1089 break; 1090 case 'array'://xml, array 1091 this.items = this.source.filter(function(link){ return this.check_extension(link.href); },this); 1092 this.external = true; 1093 break; 1094 default: 1095 return; 1096 } 1097 1098 if(this.items.length == 0){ alert('Warning: gallery '+this.name+' is empty'); } 1099 }, 1100 1268 1101 //turns everything into an object 1269 1102 prepare_elements:function(){ 1270 //console.log('items gallery', this.items);1271 if(!this.items || this.items.length === 0) {1272 return; // [i_a] prevent crash when none have been set up1273 }1274 1275 1103 this.items = this.items.map(function(item){ 1276 1104 var splitted_url = item.href.split('?'); 1277 1105 var output = {}; 1278 output.element = (typeOf(item) == = 'element' ? item : null);1106 output.element = (typeOf(item) == 'element') ? item : null; 1279 1107 output.href = splitted_url[0]; 1280 output.vars = (splitted_url[1] ? splitted_url[1].parseQueryString() : null);1108 output.vars = (splitted_url[1]) ? splitted_url[1].parseQueryString() : null; 1281 1109 output.size = null; 1282 output.caption = (output.element ? output.element.get('title') : item.title); 1283 var size_string = (output.element ? output.element.get('data-milkbox-size') : item.size); 1284 if(size_string){ 1285 output.size = Object.map(this.get_item_props(size_string),function(value,key){ 1286 return value.toInt(); 1287 }); 1288 } 1110 output.caption = (output.element) ? output.element.get('title') : item.title; 1111 if(this.options.remove_title && output.element){ output.element.removeProperty('title') } 1112 1113 var size_string = (output.element) ? output.element.get('data-milkbox-size') : item.size; 1114 if(size_string){ output.size = Object.map(this.get_item_props(size_string),function(value,key){ return value.toInt(); }); } 1115 1116 var extras = (output.element) ? output.element.get('data-milkbox-extras') : item.extras; 1117 output.extras = (extras) ? extras : ''; 1118 1289 1119 return output; 1290 1120 },this); 1291 1292 if(this.items.length === 0) { 1293 return; 1294 } 1295 1296 this.type = (this.items.length === 1 ? 'single' : (this.options.autoplay ? 'autoplay' : 'standard')); 1297 }, 1298 1121 1122 if(this.items.length == 0) return; 1123 1124 this.type = (this.items.length == 1) ? 'single' : (this.options.autoplay) ? 'autoplay' : 'standard'; 1125 }, 1126 1299 1127 check_extension:function(string){ 1300 return string.split('?')[0].test(/\.(gif|jpg|jpeg|png|bmp|tif|tiff|swf|html)$/i); 1301 }, 1302 1128 var splitted, regular_file, dyn_url; 1129 1130 splitted = string.split('?')[0]; 1131 1132 regular_file = splitted.test(/\.(gif|jpg|jpeg|png|swf|html)$/i); 1133 if(!regular_file){ dyn_url = splitted.test(/\/\d+$/); } 1134 1135 var pass = (regular_file || dyn_url) ? true : false; 1136 1137 return pass; 1138 }, 1139 1303 1140 get_index_of:function(item){ 1304 var index = (typeOf(item) === 'string' ? this.items.indexOf(this.items.filter(function(i){ 1305 return i.href === item; 1306 })[0]) : this.items.indexOf(item)); 1307 return index; 1308 }, 1309 1141 var index = (typeOf(item) == 'string') ? this.items.indexOf(this.items.filter(function(i){ return i.href === item; })[0]) : this.items.indexOf(item); 1142 return this.items.indexOf(item); 1143 }, 1144 1310 1145 get_item:function(index){ 1311 1146 return this.items[index]; 1312 1147 }, 1313 1148 1314 1149 get_item_props:function(prop_string){ 1315 1150 var props = {}; 1316 prop_string.split(',').each(function(p,i){1151 var s = prop_string.split(',').each(function(p,i){ 1317 1152 var clean = p.trim().split(':'); 1318 1153 props[clean[0].trim()] = clean[1].trim(); … … 1320 1155 return props; 1321 1156 }, 1322 1157 1323 1158 refresh:function(){ 1324 this.type = (this.items.length == = 1 ? 'single' : (this.options.autoplay ? 'autoplay' : 'standard'));1325 }, 1326 1159 this.type = (this.items.length == 1) ? 'single' : (this.options.autoplay) ? 'autoplay' : 'standard'; 1160 }, 1161 1327 1162 clear:function(){ 1328 1163 this.source = null; … … 1334 1169 1335 1170 1336 // Creating Milkbox instance: set __MILKBOX_NO_AUTOINIT__ to instantiate Milkbox somewhere else instead. 1337 if (typeof __MILKBOX_NO_AUTOINIT__ === 'undefined') 1338 { 1339 window.addEvent('domready', function(){ 1340 this.milkbox = new Milkbox({ 1341 centered:false 1342 }); 1171 //Creating Milkbox instance: you can comment this code and instantiate Milkbox somewhere else instead. 1172 window.addEvent('domready', function(){ 1173 //milkbox = new Milkbox({overlayOpacity:1, fileboxBorderWidth:'10px', fileboxBorderColor:'#ff0000', fileboxPadding:'20px', centered:true}); 1174 milkbox = new Milkbox({ 1175 //autoPlay:true 1343 1176 }); 1344 } 1345 1346 /* 1347 jsLint settings: 1348 disallow undefined variables, assume browser 1349 predefined variables: alert, Class, Options, Events, instanceOf, typeOf, Request, Fx, Asset, Swiff, $, $$, Element 1350 include these to shut up jsLint about further undefined/too early errors: Milkbox, MilkboxGallery, MilkboxDisplay 1351 expect ~ 15 errors reported 1352 */ 1177 }); -
branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Language/Language.pt.js
r1309 r1319 7 7 */ 8 8 9 FileManager.Language. en= {9 FileManager.Language.pt = { 10 10 more: 'Detalhes', 11 11 width: 'Largura:', -
branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Source/FileManager.js
r1309 r1319 84 84 createFolders: false, 85 85 filter: '', 86 listType: 'thumb', // the standard list type can be 'list' or 'thumb' 86 87 keyboardNavigation: true, // set to false to turn off keyboard navigation (tab, up/dn/pageup/pagedn etc) 87 88 detailInfoMode: '', // (string) whether you want to receive extra metadata on select/etc. and/or view this metadata in the preview pane (modes: '', '+metaHTML', '+metaJSON'. Modes may be combined) … … 92 93 hideClose: false, 93 94 hideOverlay: false, 94 hide QonDelete: false,95 hideOnDelete: false, 95 96 hideOnSelect: true, // (boolean). Default to true. If set to false, it leavers the FM open after a picture select. 96 97 showDirGallery: true, … … 135 136 this.root = null; 136 137 this.CurrentDir = null; 137 this.listType = 'list';138 this.listType = this.options.listType; 138 139 this.dialogOpen = false; 139 140 this.storeHistory = false; … … 273 274 this.diag.log('pathTitle-click event: ', e, ' @ ', e.target.outerHTML); 274 275 e.stop(); 275 if (this.header.getElement('span.filemanager-dir') != null) {276 if (this.header.getElement('span.filemanager-dir') !== null) { 276 277 this.selectablePath.setStyle('width',(this.header.getSize().x - this.pathTitle.getSize().x - 55)); 277 278 this.selectablePath.replaces(this.clickablePath); … … 373 374 'style' : 'margin-right: 10px;', 374 375 'title': this.language.toggle_side_boxes 375 }).set ('opacity',0.5).addEvents({376 }).setStyle('opacity',0.5).addEvents({ 376 377 click: this.toggleList.bind(this) 377 378 }); … … 380 381 'class':'listType', 381 382 'title': this.language.toggle_side_list 382 }).set ('opacity',1).addEvents({383 }).setStyle('opacity',1).addEvents({ 383 384 click: this.toggleList.bind(this) 384 385 }); 386 387 if(this.listType == 'thumb') { 388 this.browserMenu_thumb.setStyle('opacity',1); 389 this.browserMenu_list.setStyle('opacity',0.5); 390 } 391 392 // set startup list type 393 if(this.options.thumbnailList === true) 394 this.toggleList.bind(this); 385 395 386 396 // Add a scroller to scroll the browser list when dragging a file … … 395 405 }); 396 406 407 if(this.options.showDirGallery) 408 { 397 409 // Partikule : Thumbs list in preview panel 398 410 this.browserMenu_thumbList = new Element('a',{ … … 419 431 }.bind(this)); 420 432 // /Partikule 421 433 } 422 434 423 435 this.browser_dragndrop_info = new Element('a',{ … … 427 439 this.browser_paging = new Element('div',{ 428 440 'id':'fm_view_paging' 429 }).set ('opacity', 0); // .setStyle('visibility', 'hidden');441 }).setStyle('opacity', 0); // .setStyle('visibility', 'hidden'); 430 442 this.browser_paging_first = new Element('a',{ 431 443 'id':'paging_goto_first' 432 }).set ('opacity', 1).addEvents({444 }).setStyle('opacity', 1).addEvents({ 433 445 click: this.paging_goto_first.bind(this) 434 446 }); 435 447 this.browser_paging_prev = new Element('a',{ 436 448 'id':'paging_goto_previous' 437 }).set ('opacity', 1).addEvents({449 }).setStyle('opacity', 1).addEvents({ 438 450 click: this.paging_goto_prev.bind(this) 439 451 }); 440 452 this.browser_paging_next = new Element('a',{ 441 453 'id':'paging_goto_next' 442 }).set ('opacity', 1).addEvents({454 }).setStyle('opacity', 1).addEvents({ 443 455 click: this.paging_goto_next.bind(this) 444 456 }); 445 457 this.browser_paging_last = new Element('a',{ 446 458 'id':'paging_goto_last' 447 }).set ('opacity', 1).addEvents({459 }).setStyle('opacity', 1).addEvents({ 448 460 click: this.paging_goto_last.bind(this) 449 461 }); … … 522 534 // Thumbs list container (in preview panel) 523 535 this.dir_filelist = new Element('div', {'class': 'filemanager-filelist'}); 536 // creates a list, HELPS to make the thumblist DRAGABLE 537 this.dir_filelist_thumbUl = new Element('ul'); 538 this.dir_filelist_thumbUl.inject(this.dir_filelist); 524 539 525 540 // /Partikule … … 553 568 } 554 569 }); 570 571 // add toolTips 555 572 if (!this.options.hideClose) { 556 573 this.tips.attach(this.closeIcon); 557 574 } 575 this.tips.attach(this.browserMenu_thumb); 576 this.tips.attach(this.browserMenu_list); 577 this.tips.attach(this.browserMenu_thumbList); 558 578 559 579 this.imageadd = Asset.image(this.assetBasePath + 'Images/add.png', { … … 563 583 'z-index': this.options.zIndex + 1600 564 584 } 565 }).set ('opacity', 0).set('tween', {duration: 'short'}).inject(this.container);585 }).setStyle('opacity', 0).set('tween', {duration: 'short'}).inject(this.container); 566 586 567 587 if (!this.options.hideOverlay) { … … 734 754 else 735 755 { 736 var parent = (this.options.parentContainer != null ? $(this.options.parentContainer) : this.container.getParent());756 var parent = (this.options.parentContainer !== null ? document.id(this.options.parentContainer) : this.container.getParent()); 737 757 if (parent) 738 758 { … … 769 789 if (e) e.stop(); 770 790 791 // if the clicked elelement is from the preview gallery, get the corresponding element 792 if(el.retrieve('el_ref')) 793 el = el.retrieve('el_ref'); 794 771 795 // ignore mouse clicks while drag&drop + resulting copy/move is pending. 772 796 // 773 797 // Theoretically only the first click originates from the same mouse event as the 'drop' event, so we 774 798 // COULD reset 'drop_pending' after processing that one. 775 if (this.drop_pending != 0)799 if (this.drop_pending !== 0) 776 800 { 777 801 this.drop_pending = 0; … … 811 835 812 836 this.switchButton4Current(); 837 838 // // // now make sure we can see the selected item in the left pane: scroll there: 839 this.browserSelection('current'); 813 840 } 814 841 }, … … 817 844 818 845 /** 819 * Catches both single and double click on thumb list icon in the directory preview thumb/gallery list 820 */ 821 relayDblClick: function(e, self, dg_el, file, clicks) 846 * Catches double clicks and open the file if selectable is true */ 847 relayDblClick: function(e, el) 822 848 { 849 if(this.options.selectable === false) 850 return; 823 851 if (e) e.stop(); 824 852 825 this.diag.log('on relayDblClick file = ', file, ', current dir: ', this.CurrentDir, ', # clicks: ', clicks);853 this.diag.log('on relayDblClick file = ', el.retrieve('file'), ', current dir: ', this.CurrentDir); 826 854 827 855 this.tips.hide(); 828 856 829 var el_ref = dg_el.retrieve('el_ref'); 830 831 if (this.Current) 832 { 833 this.Current.removeClass('selected'); 834 } 835 836 this.Current = el_ref.addClass('selected'); 837 file = el_ref.retrieve('file'); 838 839 this.CurrentFile = file; 840 841 // now make sure we can see the selected item in the left pane: scroll there: 842 this.browserSelection('none'); 843 844 // only simulate the 'select' button click by doubleclick on thumbnail in directory preview, when 'select' is actually allowed. 845 if (clicks === 2 && this.options.selectable) 846 { 857 this.CurrentFile = el.retrieve('file'); 858 859 if (this.CurrentFile.mime !== 'text/directory') 847 860 this.open_on_click(null); 848 }849 else850 {851 // the single-click action is to simulate a click on the corresponding line in the directory view (left pane)852 this.relayClick(e, el_ref);853 }854 861 }, 855 862 … … 859 866 if (e) e.stop(); 860 867 861 $$('.filemanager-browserheader a.listType').set ('opacity',0.5);868 $$('.filemanager-browserheader a.listType').setStyle('opacity',0.5); 862 869 if (!this.browserMenu_thumb.retrieve('set',false)) { 863 870 this.browserMenu_list.store('set',false); 864 this.browserMenu_thumb.store('set',true).set ('opacity',1);871 this.browserMenu_thumb.store('set',true).setStyle('opacity',1); 865 872 this.listType = 'thumb'; 866 873 if (typeof jsGET !== 'undefined') jsGET.set('fmListType=thumb'); 867 874 } else { 868 875 this.browserMenu_thumb.store('set',false); 869 this.browserMenu_list.store('set',true).set ('opacity',1);876 this.browserMenu_list.store('set',true).setStyle('opacity',1); 870 877 this.listType = 'list'; 871 878 if (typeof jsGET !== 'undefined') jsGET.set('fmListType=list'); … … 912 919 case 'fmFile': 913 920 var hot_item = (this.Current && this.Current.retrieve('file')); 914 if (hot_item == null || value !== hot_item.name)921 if (hot_item === null || value !== hot_item.name) 915 922 { 916 923 this.browser.getElements('span.fi span').each((function(current) … … 946 953 if (typeof loaddir === 'undefined') loaddir = null; 947 954 948 if (loaddir == null && typeof jsGET !== 'undefined')949 { 950 if (jsGET.get('fmPath') != null)955 if (loaddir === null && typeof jsGET !== 'undefined') 956 { 957 if (jsGET.get('fmPath') !== null) 951 958 { 952 959 loaddir = jsGET.get('fmPath'); 953 960 } 954 961 } 955 if (loaddir == null)962 if (loaddir === null) 956 963 { 957 964 if (this.CurrentDir) … … 970 977 this.diag.log('on show: set onShow on fmFile: ', jsGET.get('fmFile')); 971 978 } 972 if (jsGET.get('fmListType') != null) {973 $$('.filemanager-browserheader a.listType').set ('opacity',0.5);979 if (jsGET.get('fmListType') !== null) { 980 $$('.filemanager-browserheader a.listType').setStyle('opacity',0.5); 974 981 this.listType = jsGET.get('fmListType'); 975 982 if (this.listType === 'thumb') 976 this.browserMenu_thumb.store('set',true).set ('opacity',1);983 this.browserMenu_thumb.store('set',true).setStyle('opacity',1); 977 984 else 978 this.browserMenu_list.store('set',true).set ('opacity',1);985 this.browserMenu_list.store('set',true).setStyle('opacity',1); 979 986 } 980 987 jsGET.set({ … … 1437 1444 this.view_fill_timer = null; 1438 1445 1446 // was here before 1447 } 1448 } 1449 1450 // -> move this here, so it always reloads the thumbnail pane in the preview window 1439 1451 rerendering_list = true; 1440 1452 this.fill(null, this.get_view_fill_startindex(), this.listPaginationLastSize); 1441 } 1442 } 1453 1443 1454 // make sure fade does not clash with parallel directory (re)load: 1444 1455 if (!rerendering_list) … … 1452 1463 } 1453 1464 this.browserLoader.fade(0); 1465 1466 // clear preview pane thumbnails 1467 // this.dir_filelist.empty(); 1468 1454 1469 }).bind(this), 1455 1470 onComplete: function() {}, … … 1464 1479 1465 1480 destroy: function(file) { 1466 if (this.options.hide QonDelete) {1481 if (this.options.hideOnDelete) { 1467 1482 this.destroy_noQasked(file); 1468 1483 } … … 1557 1572 1558 1573 browserSelection: function(direction) { 1559 var csel ;1574 var csel,current; 1560 1575 1561 1576 this.diag.log('browserSelection : direction = ', direction); 1562 if (this.browser.getElement('li') == null) return;1577 if (this.browser.getElement('li') === null) return; 1563 1578 1564 1579 if (direction === 'go-bottom') … … 1569 1584 // blow away any lingering 'selected' after a page switch like that 1570 1585 csel = this.browser.getElement('span.fi.selected'); 1571 if (csel != null)1586 if (csel !== null) 1572 1587 csel.removeClass('selected'); 1573 1588 } … … 1579 1594 // blow away any lingering 'selected' after a page switch like that 1580 1595 csel = this.browser.getElement('span.fi.selected'); 1581 if (csel != null)1596 if (csel !== null) 1582 1597 csel.removeClass('selected'); 1583 1598 } 1584 else if (this.browser.getElement('span.fi.hover') == null && this.browser.getElement('span.fi.selected')== null)1599 else if (this.browser.getElement('span.fi.hover') === null && this.browser.getElement('span.fi.selected') === null) 1585 1600 { 1586 1601 // none is selected: select first item (folder/file) 1587 1602 current = this.browser.getFirst('li').getElement('span.fi'); 1588 1603 } 1604 else if(direction === 'current') { 1605 current = this.Current; 1606 } 1589 1607 else 1590 1608 { 1591 1609 // select the current file/folder or the one with hover 1592 varcurrent = null;1593 if (this.browser.getElement('span.fi.hover') == null && this.browser.getElement('span.fi.selected') != null) {1610 current = null; 1611 if (this.browser.getElement('span.fi.hover') === null && this.browser.getElement('span.fi.selected') !== null) { 1594 1612 current = this.browser.getElement('span.fi.selected'); 1595 1613 } 1596 else if (this.browser.getElement('span.fi.hover') != null) {1614 else if (this.browser.getElement('span.fi.hover') !== null) { 1597 1615 current = this.browser.getElement('span.fi.hover'); 1598 1616 } … … 1628 1646 // when we're at the bottom of the view and there are more pages, go to the next page: 1629 1647 next = current.getNext('li'); 1630 if (next == null)1648 if (next === null) 1631 1649 { 1632 1650 if (this.paging_goto_next(null, 'go-bottom')) … … 1637 1655 for ( ; stepsize > 0; stepsize--) { 1638 1656 next = current.getNext('li'); 1639 if (next == null)1657 if (next === null) 1640 1658 break; 1641 1659 current = next; … … 1668 1686 // when we're at the top of the view and there are pages before us, go to the previous page: 1669 1687 var previous = current.getPrevious('li'); 1670 if (previous == null)1688 if (previous === null) 1671 1689 { 1672 1690 if (this.paging_goto_prev(null, 'go-top')) … … 1677 1695 for ( ; stepsize > 0; stepsize--) { 1678 1696 previous = current.getPrevious('li'); 1679 if (previous == null)1697 if (previous === null) 1680 1698 break; 1681 1699 current = previous; … … 1700 1718 this.Current = current; 1701 1719 csel = this.browser.getElement('span.fi.selected'); 1702 if (csel != null) // remove old selected one1720 if (csel !== null) // remove old selected one 1703 1721 csel.removeClass('selected'); 1704 1722 … … 1707 1725 this.diag.log('on key ENTER file = ', currentFile); 1708 1726 if (currentFile.mime === 'text/directory') { 1709 this.load(currentFile. dir + currentFile.name/*.replace(this.root,'')*/);1727 this.load(currentFile.path /*.replace(this.root,'')*/); 1710 1728 } 1711 1729 else { … … 1725 1743 var parent = current.getParent('li'); 1726 1744 next = parent.getNext('li'); 1727 if (next == null) {1745 if (next === null) { 1728 1746 next = parent.getPrevious('li'); 1729 1747 } 1730 if (next != null) {1748 if (next !== null) { 1731 1749 next = next.getElement('span.fi'); 1732 1750 next.addClass('hover'); … … 1896 1914 1897 1915 // Adding the thumbnail list in the preview panel: blow away any pre-existing list now, as we'll generate a new one now: 1898 this.dir_filelist .empty();1916 this.dir_filelist_thumbUl.empty(); 1899 1917 1900 1918 // set history … … 2194 2212 file = j.dirs[idx]; 2195 2213 2196 if (idx % 10== 0) {2214 if (idx % 10 === 0) { 2197 2215 // try not to spend more than 100 msecs per (UI blocking!) loop run! 2198 2216 loop_duration = new Date().getTime() - loop_starttime; … … 2240 2258 editButtons.each(function(v) { 2241 2259 //icons.push( 2242 Asset.image(this.assetBasePath + 'Images/' + v + '.png', {title: this.language[v]}).addClass('browser-icon').set ('opacity', 0).addEvent('mouseup', (function(e, target) {2260 Asset.image(this.assetBasePath + 'Images/' + v + '.png', {title: this.language[v]}).addClass('browser-icon').setStyle('opacity', 0).addEvent('mouseup', (function(e, target) { 2243 2261 // this = el, self = FM instance 2244 2262 e.preventDefault(); … … 2275 2293 file = j.files[idx - dir_count]; 2276 2294 2277 if (idx % 10 == 0) {2295 if (idx % 10 === 0) { 2278 2296 // try not to spend more than 100 msecs per (UI blocking!) loop run! 2279 2297 loop_duration = new Date().getTime() - loop_starttime; … … 2453 2471 } 2454 2472 2473 // add double click functionality to the list elements 2474 if(this.options.selectable === true) { 2475 el.addEvent('dblclick', (function(e) { 2476 self.diag.log('is_file:DBLCLICK: ', e); 2477 var node = this; 2478 self.relayDblClick.apply(self, [e, node]); 2479 }).bind(el)); 2480 } 2481 2455 2482 editButtons = []; 2456 2483 … … 2461 2488 2462 2489 editButtons.each(function(v) { 2463 Asset.image(this.assetBasePath + 'Images/' + v + '.png', {title: this.language[v]}).addClass('browser-icon').set ('opacity', 0).addEvent('mouseup', (function(e, target) {2490 Asset.image(this.assetBasePath + 'Images/' + v + '.png', {title: this.language[v]}).addClass('browser-icon').setStyle('opacity', 0).addEvent('mouseup', (function(e, target) { 2464 2491 // this = el, self = FM instance 2465 2492 e.preventDefault(); … … 2510 2537 // Partikule 2511 2538 // Thumbs list 2539 // edit: Fabian Vogelsteller: made thumblist DRAGGABLE 2512 2540 2513 2541 // use a closure to keep a reference to the current dg_el, otherwise dg_el, file, etc. will carry the values they got at the end of the loop! 2514 2542 (function(dg_el, el, file) 2515 2543 { 2516 dg_el.store('el_ref', el).addEvents({ 2517 'click': function(e) 2518 { 2519 clearTimeout(self.dir_gallery_click_timer); 2520 self.dir_gallery_click_timer = self.relayDblClick.delay(700, self, [e, this, dg_el, file, 1]); 2521 }, 2522 'dblclick': function(e) 2523 { 2524 clearTimeout(self.dir_gallery_click_timer); 2525 self.dir_gallery_click_timer = self.relayDblClick.delay(0, self, [e, this, dg_el, file, 2]); 2526 } 2527 }); 2528 2529 dg_el.inject(this.dir_filelist); 2544 var thumbLi = new Element('li'); 2545 2546 dg_el.store('el_ref', el).store('file',file).store('parent',thumbLi); 2547 2548 thumbLi.inject(this.dir_filelist_thumbUl); 2549 dg_el.inject(thumbLi); 2530 2550 }).bind(this)(dg_el, el, file); 2531 2551 … … 2563 2583 //this.diag.log(' + time taken in array traversal + revert = ', duration); 2564 2584 2585 // -> made preview thumblist DRAGGABLE 2586 // add the thumbnail pane in preview window to the dropable elements 2587 this.dir_filelist.getChildren('ul li div.fi').each((function(thumb){ 2588 els[0].push(thumb); 2589 }).bind(this)); 2590 2591 // make draggable 2565 2592 if (support_DnD_for_this_dir) { 2566 2593 // -> make draggable … … 2750 2777 this.view_fill_timer = null; 2751 2778 2752 rerendering_list = true; 2753 this.fill(null, this.get_view_fill_startindex(), this.listPaginationLastSize); 2779 // was here 2754 2780 } 2755 2781 } 2782 2783 // -> moves this here so it always reloads the thumbnail pane in the preview window 2784 rerendering_list = true; 2785 this.fill(null, this.get_view_fill_startindex(), this.listPaginationLastSize); 2756 2786 2757 2787 // make sure fade does not clash with parallel directory (re)load: … … 2795 2825 } 2796 2826 2827 // add tooltip for drag n drop icon 2828 this.tips.attach(this.browser_dragndrop_info); 2829 2797 2830 // check how much we've consumed so far: 2798 2831 duration = new Date().getTime() - starttime; … … 2925 2958 2926 2959 this.diag.log('fillInfo: request detail for file: ', Object.clone(file), ', dir: ', dir); 2927 if(this.options.showDirGallery == false && file.mime === 'text/directory') return;2960 if(this.options.showDirGallery === false && file.mime === 'text/directory') return; 2928 2961 var tx_cfg = this.options.mkServerRequestURL(this, 'detail', { 2929 2962 directory: this.dirname(file.path), … … 3150 3183 .inject(previewArea); 3151 3184 3152 previewArea = new Element('div', { class: 'filemanager-preview-content'}).inject(previewArea);3185 previewArea = new Element('div', {'class': 'filemanager-preview-content'}).inject(previewArea); 3153 3186 3154 3187 var dewplayer = this.assetBasePath + '/dewplayer.swf'; … … 3175 3208 }); 3176 3209 3177 $(appearOn).addEvents({3210 document.id(appearOn).addEvents({ 3178 3211 mouseenter: (function() { 3179 this.set ('opacity', opacity[0]);3212 this.setStyle('opacity', opacity[0]); 3180 3213 }).bind(icon), 3181 3214 mouseleave: (function() { 3182 this.set ('opacity', opacity[1]);3215 this.setStyle('opacity', opacity[1]); 3183 3216 }).bind(icon) 3184 3217 }); … … 3718 3751 if (autofocus_el) 3719 3752 { 3720 if (('autofocus' in autofocus_el) && !(Browser.Engine && Browser.Engine.webkit))3721 {3722 3753 // HTML5 support: see http://diveintohtml5.org/detect.html 3723 // 3724 // Unfortunately, it's not really working for me in webkit browsers (Chrome, Safari) :-(( 3725 autofocus_el.set('autofocus', 'autofocus'); 3726 autofocus_el = null; 3727 } 3728 else 3729 { 3730 // Safari / Chrome have trouble focussing on things not yet fully rendered! 3731 } 3754 autofocus_el.setProperty('autofocus', 'autofocus'); 3755 autofocus_el.focus(); 3732 3756 } 3733 3757 this.el.center().fade(1).get('tween').chain((function() { … … 3863 3887 this.resize(); 3864 3888 3865 this.el.setStyles({ 3866 opacity: 0, 3867 display: 'block' 3868 }).get('tween'). /* pause(). */ start('opacity', 0.5); 3889 this.el.setStyle('display', 'block'); 3890 this.el.fade('hide').fade(0.5); 3869 3891 3870 3892 window.addEvent('resize', this.resize.bind(this)); … … 3908 3930 if (this.objects && this.objects.length) { 3909 3931 this.objects.each(function(el) { 3910 el.style.visibility = 'visible';3932 el.setStyle('visibility', 'visible'); 3911 3933 }); 3912 3934 } -
branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Source/Gallery.js
r1309 r1319 9 9 10 10 requires: 11 core/1. 3.1: '*'12 more/1. 3.1.1: [Sortables]11 core/1.4.5: '*' 12 more/1.4.0.1: [Sortables] 13 13 14 14 provides: FileManager.Gallery … … 73 73 } 74 74 self.hideClone(); 75 self.wrapper.setStyle('display', 'none');75 // self.wrapper.setStyle('display', 'none'); 76 76 }, 77 77 … … 90 90 styles: 91 91 { 92 'z-index': this.options.zIndex +1092 'z-index': this.options.zIndex - 10 93 93 } 94 94 }).inject(this.container); … … 105 105 styles: 106 106 { 107 'z-index': this.options.zIndex + 750 108 }, 109 tween: {duration: 'short'}, 110 opacity: 0, 111 events: { 112 mouseenter: function() { 113 if (self.options.closeCaptionEditorOnMouseOut) 114 { 115 clearTimeout(timer); 116 } 117 }, 118 mouseleave: function(e) { 119 var target = this; 120 121 if (self.options.closeCaptionEditorOnMouseOut) 122 { 123 timer = (function() { 124 self.removeClone(e, target); 125 }).delay(500); 126 } 127 } 128 } 107 'z-index': this.options.zIndex + 750, 108 'opacity': 0, 109 'display': 'none' 110 }, 111 tween: {duration: 'short'} 129 112 }).adopt( 130 113 new Element('span', {text: this.language.gallery.text}), … … 178 161 w: wrapper_pos.width 179 162 }; 180 181 163 this.droppables.push(this.gallery); 182 164 … … 285 267 286 268 this.hideClone(); 287 this.wrapper.setStyle('display', 'none');269 // this.wrapper.setStyle('display', 'none'); 288 270 }, 289 271 … … 329 311 var cw = this.captionImgContainerSize.x; 330 312 var ch = this.captionImgContainerSize.y; 313 var redux; 331 314 if (w > cw) 332 315 { 333 varredux = cw / w;316 redux = cw / w; 334 317 w *= redux; 335 318 h *= redux; … … 337 320 if (h > ch) 338 321 { 339 varredux = ch / h;322 redux = ch / h; 340 323 w *= redux; 341 324 h *= redux; … … 380 363 }); 381 364 382 //li_wrapper.set('opacity', 0); 365 // clone image for caption container 366 //li_wrapper.setStyle('opacity', 0); 383 367 this.clone = img_el.clone(); 384 this.clone.store('file', file).store('parent', li_wrapper).addClass('filemanager-clone').setStyles(this.animation.from).set({ 385 morph: {link: 'chain'}, 368 this.clone.store('file', file).store('parent', li_wrapper).addClass('filemanager-clone').set({ 386 369 styles: { 387 position: 'absolute', 370 position: 'relative', 371 width: w, 372 height: h, 373 top: ((260- h) / 2) - 2, 374 left: ((260- w) / 2) - 1, 388 375 'z-index': this.options.zIndex + 800 389 }, 390 events: { 391 click: function(e) { 392 if (!self.files[name]) 393 return; 394 self.fireEvent('galleryPreview', [file.path, self.files[name], li_wrapper, self]); 395 } 396 } 397 }).inject(document.body).morph(this.animation.to).get('morph').chain(function() { 398 if (!self.files[name]) 399 return; 400 self.input.set('value', self.files[name].caption || ''); 401 self.wrapper.setStyles({ 402 opacity: 1, 403 display: 'block', 404 left: self.animation.to.left + self.captionDialogOffsets.x /* -12 */, 405 top: self.animation.to.top + self.captionDialogOffsets.y /* -53 */ 406 }).fade(1).get('tween').chain(function() { 407 self.input.focus(); 408 }); 409 }); 376 } 377 }).inject(self.wrapper.getChildren('div.img')[0]); 378 379 // blend in the caption container 380 if (!this.files[name]) 381 return; 382 this.input.set('value', self.files[name].caption || ''); 383 this.wrapper.setStyles({ 384 'position':'fixed', 385 'display': 'block', 386 'left': this.animation.to.left /* -12 */, 387 'top': this.animation.to.top - this.captionDialogOffsets.y /* -53 */ 388 }).fade('hide').fade(1).get('tween').chain((function() { 389 this.input.focus(); 390 }).bind(this)); 410 391 }, 411 392 … … 426 407 var cw = this.imgContainerSize.x; 427 408 var ch = this.imgContainerSize.y; 409 var redux; 428 410 if (w > cw) 429 411 { 430 varredux = cw / w;412 redux = cw / w; 431 413 w *= redux; 432 414 h *= redux; … … 434 416 if (h > ch) 435 417 { 436 varredux = ch / h;418 redux = ch / h; 437 419 w *= redux; 438 420 h *= redux; … … 461 443 if (e) e.stop(); 462 444 if (!self.isSorting) { 463 self.show_caption_editor(img_el, li_wrapper, file);445 self.show_caption_editor(img_el, li_wrapper, file); 464 446 } 465 447 self.isSorting = false; … … 527 509 events: { 528 510 click: function(e) { 529 if (e) e.stop(); 530 511 if(e) e.stop(); 531 512 self.erasePicture(name); 532 513 } 533 514 } 534 515 }); 535 536 /* 537 * as 'imgcontainer.getSize() won't deliver the dimensions as set in the CSS, we turn it the other way around: 538 * we set the w/h of the image container here explicitly; the CSS can be used for other bits of styling. 539 */ 516 // hide on start 517 destroyIcon.setStyle('opacity',0); 518 519 /** 520 * as 'imgcontainer.getSize() won't deliver the dimensions as set in the CSS, we turn it the other way around: 521 * we set the w/h of the image container here explicitly; the CSS can be used for other bits of styling. 522 */ 540 523 var imgcontainer = new Element('div', { 541 524 'class': 'gallery-image', … … 671 654 this.files[name].caption = (this.input.value || ''); 672 655 673 this.clone.morph(this.animation.from).get('morph').clearChain().chain((function() { 674 //this.clone.retrieve('parent').set('opacity', 1); 675 this.clone.destroy(); 676 }).bind(this)); 656 self = this; 677 657 678 658 this.wrapper.fade(0).get('tween').chain(function() { 679 659 this.element.setStyle('display', 'none'); 660 self.clone.destroy(); 680 661 }); 681 662 }, … … 688 669 var parent = this.clone.retrieve('parent'); 689 670 if (parent) { 690 //parent.set ('opacity', 1);671 //parent.setStyle('opacity', 1); 691 672 } 692 673 this.clone.destroy(); 693 674 this.wrapper.setStyles({ 694 675 opacity: 0, 695 display: 'none'676 'display': 'none' 696 677 }); 697 678 }, -
branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Source/Uploader/Fx.ProgressBar.js
r1309 r1319 30 30 31 31 initialize: function(element, options) { 32 this.element = $(element);32 this.element = document.id(element); 33 33 this.parent(options); 34 34 … … 70 70 this.element.setStyle('backgroundPosition', css + ' 0px').title = Math.round(to) + '%'; 71 71 72 var text = $(this.options.text);72 var text = document.id(this.options.text); 73 73 if (text) text.set('text', Math.round(to) + '%'); 74 74 -
branches/MootoolsFileManager-Update/plugins/MootoolsFileManager/mootools-filemanager/Source/Uploader/Swiff.Uploader.js
r1309 r1319 126 126 127 127 // container options for Swiff class 128 this.options.container = this.box = new Element('span', {'class': 'swiff-uploader-box',events: { click: function(e) { e.stopPropagation(); } }}).inject( $(this.options.container) || document.body);128 this.options.container = this.box = new Element('span', {'class': 'swiff-uploader-box',events: { click: function(e) { e.stopPropagation(); } }}).inject(document.id(this.options.container) || document.body); 129 129 130 130 // target 131 this.target = $(this.options.target);131 this.target = document.id(this.options.target); 132 132 if(this.target) { 133 133 var scroll = window.getScroll(); … … 226 226 initializeSwiff: function() { 227 227 this.appendCookieData(); // looks like there's a bit of trouble with xSetOptions, so we circumvent it by passing it all in one go through xInitialize 228 // if (typeof console !== 'undefined' && console.log) console.log('initializeSwiff: data count = ' + this.options.data.length + ' : ' + this.options.data);228 // if (typeof console !== 'undefined' && console.log) console.log('initializeSwiff: data count = ' + this.options.data.length + ' : ' + this.options.data); 229 229 230 230 // extracted options for the swf … … 259 259 reposition: function(coords) { 260 260 // update coordinates, manual or automatically 261 coords = coords || (this.target && this.target.offsetHeight) 262 ? this.target.getCoordinates(this.box.getOffsetParent()) 263 : {top: window.getScrollTop(), left: 0, width: 40, height: 40}; 261 coords = coords || (this.target && this.target.offsetHeight) ? this.target.getCoordinates(this.box.getOffsetParent()) : {top: window.getScrollTop(), left: 0, width: 40, height: 40}; 264 262 this.box.setStyles(coords); 265 263 this.fireEvent('reposition', [coords, this.box, this.target]); … … 267 265 268 266 setOptions: function(options) { 269 // if (typeof console !== 'undefined' && console.log) console.log('Swiff.Uploader: BASE::setOptions');267 // if (typeof console !== 'undefined' && console.log) console.log('Swiff.Uploader: BASE::setOptions'); 270 268 if (options) { 271 269 if (options.url) options.url = Swiff.Uploader.qualifyPath(options.url); … … 274 272 if (this.loaded) { 275 273 this.remote('xSetOptions', options); 276 }274 } 277 275 } 278 276 return this; … … 316 314 appendCookieData: function() { 317 315 var append = this.options.appendCookieData; 318 // if (typeof console !== 'undefined' && console.log) console.log('appendCookieData: ' + (1 * append) + ' / ' + append);316 // if (typeof console !== 'undefined' && console.log) console.log('appendCookieData: ' + (1 * append) + ' / ' + append); 319 317 if (!append) return; 320 318 … … 323 321 document.cookie.split(/;\s*/).each(function(cookie) { 324 322 cookie = cookie.split('='); 325 //if (typeof console !== 'undefined' && console.log) console.log('appendCookieData: cookie: "' + cookie[0] + '"(' + cookie.length + ') = "' + (cookie.length > 1 ? cookie[1] : '???') + '"');323 //if (typeof console !== 'undefined' && console.log) console.log('appendCookieData: cookie: "' + cookie[0] + '"(' + cookie.length + ') = "' + (cookie.length > 1 ? cookie[1] : '???') + '"'); 326 324 if (cookie.length == 2) { 327 325 //hash['\"' + decodeURIComponent(cookie[0]) + '\"'] = decodeURIComponent(cookie[1]); // allow session IDs such as the ASP.NET ones, which come with a dot, etc. … … 331 329 332 330 var data = this.options.data || {}; 333 if (typeOf(append) === 'string') { 334 data[append] = hash; 335 } 336 else { 337 Object.append(data, hash); 338 } 339 331 if (typeOf(append) == 'string') { 332 data[append] = hash; 333 } else { 334 Object.append(data, hash); 335 } 340 336 this.setOptions({data: data}); 341 337 }, … … 484 480 if (options.url) { 485 481 options.url = Swiff.Uploader.qualifyPath(options.url); 486 }482 } 487 483 this.base.remote('xFileSetOptions', this.id, options); 488 484 this.options = Object.merge(this.base.options, options);
