From 35bfd6d48f3d42b7a953ce8fa46fd7ea6bcf51dc Mon Sep 17 00:00:00 2001 From: ripevessel Date: Fri, 25 Feb 2011 00:32:48 -0800 Subject: [PATCH] Added loader --- i/js.js | 93 +++++++++++++++++++++++++-------------------------- i/loader.gif | Bin 0 -> 4178 bytes 2 files changed, 46 insertions(+), 47 deletions(-) create mode 100644 i/loader.gif diff --git a/i/js.js b/i/js.js index 4f038c2..a234502 100644 --- a/i/js.js +++ b/i/js.js @@ -18,12 +18,12 @@ var zindex = 0; var loader; -window.addEvent('domready', function() -{ +window.addEvent('domready', function() +{ // make draggable - + var draggable = A ? '#images li' : '#images li.image' ; - + $$(draggable).makeDraggable({ onStart: function() { dragging = false; @@ -47,17 +47,17 @@ window.addEvent('domready', function() 'left' : 0, 'opacity' : 0, 'display' : 'none' - }}).setProperty('id', 'bgFader').addEvent('click', - function () { + }}).setProperty('id', 'bgFader').addEvent('click', + function () { debiggen(selectedObj); } ).injectInside($E('body')); zindex = jsonObj.images.length; - - - - // enlarge selected from URL + + + + // enlarge selected from URL var selImg = location+""; selImg = selImg.split("#"); if(selImg[1]) { @@ -67,8 +67,8 @@ window.addEvent('domready', function() embiggen($(selImg[1])); } } - - + + loader = new Element('img'); loader.src = "i/loader.gif"; loader.setStyles({ @@ -78,7 +78,7 @@ window.addEvent('domready', function() 'left' : Number(window.getWidth() / 2), 'top' : Number(window.getHeight() / 2) }); - //loader.inject($E('body')); + loader.inject($E('body')); @@ -107,7 +107,7 @@ function select(obj) debiggen(enlargedObj); embiggen(obj); } - } + } else { embiggen(obj); } @@ -125,50 +125,49 @@ function getObjFromJson(obj) break; } } - + return imageObj; } -function embiggen(obj) -{ +function embiggen(obj) +{ embiggening = true; viewing = true; dragging = false; enlargedObj = obj; - enlargedID = obj.id; + enlargedID = obj.id; var o = $(obj); oldLeft = o.getLeft(); - oldTop = o.getTop(); + oldTop = o.getTop(); - var img = o.getElements('img'); + var img = o.getElements('img'); img = $(img[0]); - + // img.setStyle('opacity', .4); - + var loaded = false; - + img.addEvent('load', function(){ loader.setStyle('display' , 'none'); loaded = true; + }); + - }); - - // set source to actual image img.src = IMG_ROOT + obj.id; - + var imageObj = getObjFromJson(obj); - - + + o.effects({ - duration : 0, - transition : Fx.Transitions.Cubic.easeOut + duration : 500, + transition : Fx.Transitions.Cubic.easeInOut }).start({ 'left': [o.getLeft(), Number((window.getWidth() / 2) - imageObj.width/2).toInt()], 'top': [o.getTop(), ((window.getHeight() / 2) - imageObj.height/2 >= 0 ? Number((window.getHeight() / 2) - imageObj.height/2).toInt() : 30)], @@ -184,13 +183,13 @@ function embiggen(obj) }); zindex++; - + o.setStyle('z-index', zindex); - + bgFader.setStyle('display', 'block'); bgFader.setStyle('z-index', zindex-1); - - + + bgFader.effects({ duration : 0, transition : Fx.Transitions.Cubic.easeOut @@ -201,43 +200,43 @@ function embiggen(obj) } -function debiggen(obj) -{ +function debiggen(obj) +{ debiggening = true; viewing = false; dragging = false; enlargedObj = null; - + var imageObj = getObjFromJson(obj); - + $(obj).effects({ duration: 0, transition: Fx.Transitions.Cubic.easeOut }).start({ - 'padding': [$(obj).getStyle('padding').toInt(), 0], + 'padding': [$(obj).getStyle('padding').toInt(), 0], 'left': [$(obj).getStyle('left').toInt(), oldLeft], 'top': [$(obj).getStyle('top').toInt(), oldTop], 'width': [$(obj).getStyle('width').toInt(), Number(imageObj.width * ).toInt()], 'height': [$(obj).getStyle('height').toInt(), Number(imageObj.height * ).toInt()] - }).addEvent('onComplete', function(){ + }).addEvent('onComplete', function(){ debiggening = false; }); - + bgFader.effects({ duration : 0, transition : Fx.Transitions.Cubic.easeOut }).start({ 'opacity' : 0.0 - }); + }); } function setPositions() { var urlStr = "i/functions.php?action=createJson"; - + var count = 1; - + $$('#images li').each(function(li) { var name = escape(li.getProperty('id')); var type = li.getProperty('class'); @@ -247,13 +246,13 @@ function setPositions() urlStr += "&" + count + "=" + name + "," + type + "," + x + "," + y + "," + z; count++; } ); - + // console.log('sending: ' + urlStr); _do(urlStr); } -function _do(url) +function _do(url) { var jsel = document.createElement('SCRIPT'); jsel.type = 'text/javascript'; diff --git a/i/loader.gif b/i/loader.gif new file mode 100644 index 0000000000000000000000000000000000000000..fad025cab5ad4954b1308a69c53e284eac5ed82f GIT binary patch literal 4178 zcmd6qX;c&Gnt&^{C8myE{8O`}_MRCnrZoM>{$?s2%F)@#Dwi zJ z{nEfJ1R*{5`C8?d6*-YsBobRM>p3{MQ5q!r7n4qwEJ3zo(|+ZGFc?S!qPVdrs)WN# z4}J$Qqt+>yn*o?kXL-npFdhOy2p$y^$&JF(8K>z)J#)cPC2o8L!1qQUU^hUevCZ6j z3Q(`XXn(WD3nA!L>e>rgWn;HJLFDN(q$?JDIRoN+bi?q?FK3Y2 zgKTE2Pm8Dd@^SJn7wHo#Z7lbO&-kAe>SVI0JFG1aW~-Z4{cGk|$Td>hFI!#TupGOx z#HiNw#wM0$x?zLxj}cnho5(1H`mh4Z*kr{iZttRTDTL*n=z4oTXJc}a6F=U`Jhm`q zo3wuwA{O>gAYnv81U+h<3scU7poIq_!(b+g zGC5JC0_0*CF2l_#A#^ur#PLK$w*efvidD{QtMUjZY9q9N!Zs`t_D%4JqW+o zn>3m<^#FYJ8hjZ$`}%3y`@y&GKm3lp`1g;7-EoU+A88Z3FiU^2I3;zT7d-z#e(vEZ zR-2IHT=nNFWn=+Gs|1l)EV>64MNLi`HZWMHU-K2hXq;+3j@N>1KB*_@3V}i=&~$AEU%f z4t+*xX{fmSc+ASASkf zDTQI+Zc0KE(jXQ*>=L#vgP?q5ZI)dsggTF2hMTxv*My2`hJpmq1tYRt?KQgZ^P5b$K z<25IP&4p>Dc{e0?;{C!KQ(>Q1`{ie~t-LSHooKUh@Ef(#Qdq_^@ROvOTU7qI?9lzW zv&6x#GgL@&|BHdzHK*+2oYYH!7_;WUD>ced!S1!L?y-3I!bmVohP(R5a>D%;3$qWpa`V=?0lB5&XfTUThvmkulz2#*AdLrN}9MEP8t53RmEm zgGN{{&!#C?IevB2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