From db5294c6ffd14fd0382c381283829030c7259c31 Mon Sep 17 00:00:00 2001 From: Harry Bomrah Date: Mon, 5 May 2014 14:07:18 +0800 Subject: [PATCH] full working gem for gallery including frontend and backend --- .../gallery/.keep => images/gallery/.gitkeep} | 0 app/assets/images/gallery/default.jpg | Bin 0 -> 1620 bytes app/assets/images/gallery/nodata.jpg | Bin 0 -> 12657 bytes app/assets/images/gallery/pbar-ani.gif | Bin 0 -> 3159 bytes app/assets/images/gallery/slidelistbg.png | Bin 0 -> 194 bytes app/assets/images/gallery/slidenav.png | Bin 0 -> 514 bytes app/assets/images/gallery/slidetitlebg.png | Bin 0 -> 219 bytes app/assets/images/gallery/slideui.gif | Bin 0 -> 431 bytes app/assets/images/gallery/upicon.png | Bin 0 -> 2831 bytes app/assets/images/gallery/uploadbg.gif | Bin 0 -> 5150 bytes app/assets/images/gallery/uppt.png | Bin 0 -> 658 bytes app/assets/images/gallery/upsep.png | Bin 0 -> 231 bytes app/assets/javascripts/admin/galleries.js | 2 - app/assets/javascripts/cycle.js | 1551 +++++++++++++++++ app/assets/javascripts/gallery.js | 267 +++ app/assets/javascripts/galleryAPI.js.erb | 278 +++ .../javascripts/galleryAPI_frontend.js.erb | 253 +++ app/assets/javascripts/gallery_old.js | 1 + .../javascripts/jquery.lite.image.resize.js | 136 ++ app/assets/javascripts/jquery.masonry.min.js | 10 + app/assets/javascripts/rss.js | 586 +++++++ app/assets/javascripts/upload.js | 39 + app/assets/stylesheets/admin/galleries.css | 4 - app/assets/stylesheets/filter.css | 84 + app/assets/stylesheets/gallery.css | 521 ++++++ app/assets/stylesheets/gallery/.keep | 0 app/assets/stylesheets/gallery_frontend.css | 332 ++++ app/assets/stylesheets/gallery_old.css | 564 ++++++ app/assets/stylesheets/jquery-ui.css | 566 ++++++ .../stylesheets/jquery.fileupload-ui.css | 168 ++ app/assets/stylesheets/widget_gallery.css | 70 + app/controllers/admin/galleries_controller.rb | 226 ++- app/controllers/admin/images_controller.rb | 64 + app/controllers/galleries_controller.rb | 48 + app/models/album.rb | 24 + app/models/album_image.rb | 15 + app/uploaders/gallery_uploader.rb | 86 + app/views/admin/galleries/_album.html.erb | 22 + app/views/admin/galleries/_form.html.erb | 106 ++ app/views/admin/galleries/_image.html.erb | 13 + app/views/admin/galleries/create.js.erb | 3 + app/views/admin/galleries/edit.html.erb | 3 + app/views/admin/galleries/index.html.erb | 22 +- app/views/admin/galleries/new.html.erb | 5 + app/views/admin/galleries/new_images.html.erb | 3 + app/views/admin/galleries/show.html.erb | 243 +++ .../admin/galleries/upload_panel.html.erb | 107 ++ app/views/admin/images/show.html.erb | 59 + app/views/admin/images/upload_panel.html.erb | 111 ++ app/views/galleries/index.html.erb | 1 + app/views/galleries/show.html.erb | 1 + app/views/galleries/theater.html.erb | 72 + config/routes.rb | 13 +- lib/gallery/engine.rb | 11 +- 54 files changed, 6679 insertions(+), 11 deletions(-) rename app/assets/{javascripts/gallery/.keep => images/gallery/.gitkeep} (100%) create mode 100755 app/assets/images/gallery/default.jpg create mode 100755 app/assets/images/gallery/nodata.jpg create mode 100755 app/assets/images/gallery/pbar-ani.gif create mode 100755 app/assets/images/gallery/slidelistbg.png create mode 100755 app/assets/images/gallery/slidenav.png create mode 100755 app/assets/images/gallery/slidetitlebg.png create mode 100755 app/assets/images/gallery/slideui.gif create mode 100755 app/assets/images/gallery/upicon.png create mode 100755 app/assets/images/gallery/uploadbg.gif create mode 100755 app/assets/images/gallery/uppt.png create mode 100755 app/assets/images/gallery/upsep.png delete mode 100644 app/assets/javascripts/admin/galleries.js create mode 100755 app/assets/javascripts/cycle.js create mode 100644 app/assets/javascripts/gallery.js create mode 100644 app/assets/javascripts/galleryAPI.js.erb create mode 100644 app/assets/javascripts/galleryAPI_frontend.js.erb create mode 100644 app/assets/javascripts/gallery_old.js create mode 100644 app/assets/javascripts/jquery.lite.image.resize.js create mode 100644 app/assets/javascripts/jquery.masonry.min.js create mode 100644 app/assets/javascripts/rss.js create mode 100755 app/assets/javascripts/upload.js delete mode 100644 app/assets/stylesheets/admin/galleries.css create mode 100644 app/assets/stylesheets/filter.css create mode 100644 app/assets/stylesheets/gallery.css delete mode 100644 app/assets/stylesheets/gallery/.keep create mode 100644 app/assets/stylesheets/gallery_frontend.css create mode 100755 app/assets/stylesheets/gallery_old.css create mode 100644 app/assets/stylesheets/jquery-ui.css create mode 100755 app/assets/stylesheets/jquery.fileupload-ui.css create mode 100644 app/assets/stylesheets/widget_gallery.css create mode 100644 app/controllers/admin/images_controller.rb create mode 100644 app/controllers/galleries_controller.rb create mode 100644 app/models/album.rb create mode 100644 app/models/album_image.rb create mode 100644 app/uploaders/gallery_uploader.rb create mode 100644 app/views/admin/galleries/_album.html.erb create mode 100644 app/views/admin/galleries/_form.html.erb create mode 100644 app/views/admin/galleries/_image.html.erb create mode 100644 app/views/admin/galleries/create.js.erb create mode 100644 app/views/admin/galleries/edit.html.erb create mode 100644 app/views/admin/galleries/new.html.erb create mode 100644 app/views/admin/galleries/new_images.html.erb create mode 100644 app/views/admin/galleries/show.html.erb create mode 100755 app/views/admin/galleries/upload_panel.html.erb create mode 100644 app/views/admin/images/show.html.erb create mode 100755 app/views/admin/images/upload_panel.html.erb create mode 100644 app/views/galleries/index.html.erb create mode 100644 app/views/galleries/show.html.erb create mode 100644 app/views/galleries/theater.html.erb diff --git a/app/assets/javascripts/gallery/.keep b/app/assets/images/gallery/.gitkeep similarity index 100% rename from app/assets/javascripts/gallery/.keep rename to app/assets/images/gallery/.gitkeep diff --git a/app/assets/images/gallery/default.jpg b/app/assets/images/gallery/default.jpg new file mode 100755 index 0000000000000000000000000000000000000000..3a48d48ff4d09708de702a556eb7bbf5c9618b6d GIT binary patch literal 1620 zcmaKqdpJ~S9LL`?XXeaI5);{4BNMV>j7zso7gJfev|_TTkm^Z`XeeZ`X7))`cF84$ zvBl&zm33DkG)OKR#-(vttr8}aon^9J%$^C)u7CD>o^#&keb49j{r=8-UU{E<7^vD= z+gbw%f`AQr0eL^z3ouIsE2i**u=67p6;5&E5Cn(AFO|Xsny*0_93H_Tc*4Avg8w&@ z*8&m&oCnunhy*Ys2qr;t0nh>vz`$s`5Lgt9#UOYHM&~+nv4(-wBvaI!oXPE zN`$n|Y`2q|j`^|Uft)(sJ&dcjiqtorIGdQ&ftIQN$8Nz^u}b@Pk(^IU7>hw0N z<;5I{=kSiF^IV34JB-n1PXRz6X0bC3P!h$R6{M8?1b>6xu;6wWvxY)R#83ceH&7zc zT?B!e5r#dkTU8$0rA<1x>##>%9~`*iY5TG=<+jPS6n-1!S8$W6ZXjlZ6+w^vqYe5f z)Wd~Q*1>wXSk7@u5Z9!FOZC3(l4)PyJh6LfqK@G=chh$m$jpKg;|?bCq>V;?{t_FN z&RPG`yUY)ohh&p?#`>Gzb>-ZY19~J*)%+-OP`*+1AnFmkL6r zeS7m{22OFgCZ)j~;kg5Q3;KIG5dtz5;!8+T69 zoLT!#mhtbE_jwE*jOuOYZZJtte{tV`fSiGz-+BA>a3ej|VZP=Bg@? z_adK7Gr47(8=&OK+9K4Lt=J>31Bsj_E=j$iOnHllphrJF@DFwKa7{rz)$9cUS##NG4>DvOI48&2l$d#_#EOkV;iT@peh>VJ#P54UqHZ)4_^9>{T=#w(8ue z*P0u1YzB=!dv-Azxd4EMae#!%uOICx9dpTCWWSBqJzA<0p7(P z9*oF5Iru5!M&+bbqD)?J2U@?XIDYA1$+Hl?p?=l<#@&5yyah9=97$LNK96uYlsz&# zcUrb(r_$EFRmqlfopfXz<==a@mh)i`SX7O(lc?= literal 0 HcmV?d00001 diff --git a/app/assets/images/gallery/nodata.jpg b/app/assets/images/gallery/nodata.jpg new file mode 100755 index 0000000000000000000000000000000000000000..d3c857b6b60e374db099ebc86b9e48307644be79 GIT binary patch literal 12657 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 literal 0 HcmV?d00001 diff --git a/app/assets/images/gallery/slidelistbg.png b/app/assets/images/gallery/slidelistbg.png new file mode 100755 index 0000000000000000000000000000000000000000..8d468d00048c31f5610f665839e2ea63ab9eae6e GIT binary patch literal 194 zcmeAS@N?(olHy`uVBq!ia0vp^AT}2V8<6ZZI=>f4u@pObhHwBu4M$1`kk47*5n0T@ zz%2yAjF;}#{Q(NfmAFQf1m~xflqVLYGB~E>C#5R5WfrBD=NDxcD>w(6>KU$<_jnCd zDF#yMT$Gwvl9`{U5R#dj%3x@yZ)B`*XjqgfC=65~;pyTSA~7{NB_ZL)83&dGCAW(! doL*_NFzEI(9RH=v%@0(=;OXk;vd$@?2>=`+GOqvt literal 0 HcmV?d00001 diff --git a/app/assets/images/gallery/slidenav.png b/app/assets/images/gallery/slidenav.png new file mode 100755 index 0000000000000000000000000000000000000000..79fd32ea0803ee352b6a78dcfcf7f87eb141b7ec GIT binary patch literal 514 zcmeAS@N?(olHy`uVBq!ia0vp^Hb5M}!3HEL;ETt$J9TnWyXg74h~*=*}8v%>hISvrKfMGVp|O(6hBBj{&C@R zg=nt%FRuIhTJ|-zoZGWBdhzD@54XKI<+)mQSJkw<_Ou$^txlWwwclRw_ptKK+H*T6 z_le$O6}Xk!a66&VYKN%UipJZCjW#<}#ZENdPGV%pUb|iX_BPpx`_=6-c8kYH3!P8+ z$`giznDL;wV$JsMxQ_Hjew%g2=HC*Q1{!>LagR~N0zSXqu+vG6QWmyRE1Ot9J-C#y zO$%tp>BTc8A{6+R^|&P`GXDQiakKCETK47N_8e{6G`q4j^YO%p7jL3x8OilFuB&M~ z{dnf87q2{5o6K9=ls0GS<;PPuz0l6ASC>`4GN)KRx#i#S@0lxM;Q;8arl(C#5R5WfrBD=NDxcD>w(6>KU$<_jnCd zDF#yMT$Gwvl9`{U5R#dj%3x@yZ)B`*XjqgfC=66#=;`7Z!Z9=1qToS;>gH|R%(R7> znGf5mv9Y!7FA%GHWUr?u_1gaM|Ns9bXGlm$bf_^rSSBInHfhxopk@Y7S3j3^P6*W@ zpvOSl06gS60h^;cApGSUjC=f?d=ZO#VeEXZ{6M@py3C_tEgSvP3w|x09cODU4w$a~ zz43l9zhGMZnP0ET-|znqFrdJJ1PdBGh%li-4=Ebn(*}r0#5)chT1WwA;){xa4KGf_ z_=ls$Hy=ly5or)2KAl9^F`$t=C9$Rhk_dw-nkA ZJ#D@{DQ9h7w|^ndJ&ZW9;(`SL06R^A#=!sp literal 0 HcmV?d00001 diff --git a/app/assets/images/gallery/upicon.png b/app/assets/images/gallery/upicon.png new file mode 100755 index 0000000000000000000000000000000000000000..0a16ebe0c26c8df812735eefb8750d0f4dd5f740 GIT binary patch literal 2831 zcma)82{0S#7EYBSh_q}=l%$alk?_cJhZ_fGtL$J0q1p%di0001l zfScHGyea^2=n~%%PDF+3uX7wX)(C;*<`)zwkMs*b z1J0b$ID1y(%o)m?@NmwhXoQI&@>bDWakRhfl+0ic@z%78>(v&h0zZgfiS#99@JNLi z&~}^AY@re$nV>>~Gi7b;)DuN6jM`hEnX`ejH5G_LlXz~5nqe{jz`!H8(Fs2;%yqgU zm)`}g`iW-f`+Lysi(7+TT9%&pm^kg$q*%G34@VZUv^&`Kj*g;6T8lX*9jT%|!xfRh zQ{5yleyp+=k8~uNQ3Na>+rC-~P2cH+m`xpl$y&Wz9w`I`N$WSOpmg=LRfsKRb8EkN zd3$^8_g+3!j~lK2a)4{noyGnzq#S)RDlo__U4^L8J==USj=#{=b zR2i7Db&Csy@vSO9q*_JFa|cwNZ=Phtu~Iug>E+JGAd8@Vzx3j#{w?obSFb-mEacU@ z_T`eFE&K#XLAiO{8l|MCO}lO7r&`aI4%wIF7RH5T+^IJV{bM;j`9z?0B9dfd#K*6o zoOqh{@-uA`GuF!!Kl1C1+B8?FM4dUJef(ib12BTM?tY+#A|CoO>4Ujp1QB`b(E+gr+r#=pedT!_0L@=1GWwB8wHWOfSb#(1q@(TuyFvZ6^P<7dIE zEKfb$j8s1Xyu{*lA^`<#JPg%N!IS<<=$~LexyTDM^5n(l=H~MjOae%wXS3plF5$)# z=eK@uF9oh&y*0kV(>!U|`SsTaA$4gp zJ7@RCkkz~yKM6z?=n{}XY??k#)%hG7#`8<#@vqR(dgE+TqnFbpyCEIF?C3HxH zM0J|+JzB9gt>@AAiS)n>J*7DNZc4jGj4|%p@?ug%x2tJyr=)%&q-3$H~#SLpB=ecPY0vl8xgSTg05b~!$px%%z5jk6NM zM5Wm_{muuDC{HsrcvTZKPa`R{i1(dPu~Z>t_(M&`>;Bxzp0+maiv(E|-Lq>Yw8Le8 zv^)H%&bm`<8`_DmAbjsck*}sOv}H|)z<6gn8HB6fC+No+|t`& zMBOoh9)yfK7pXh6A%1dqu9d}b@AmAM!DgY&^S}^DB;);^y;=u@S%$^7w;1&V^7zLI zt&3aJd0E-ncUL{V(C8gmrE4|R2?+-C+T1J$1!ztQ~u8~9qQ zEe1A}TMz*7fDx4BY>&h%4HDUhxDVCstmgGh2M&GAi`(jzGh&0+ZcuVvl;Q>3qHEN4 zy-oo7;#V0QW zsLb-cd4Zr_sQqAPEw`U_uy!+aDqC7N{F%%p@}!gv;u)^y_#3;zkd4jb@bc42U;i*J zb??f`$?k)hcKNt3Fd~gSutzYbR;hN(R@h^E@Wz@Pj#zQ zKgKMmp{BRcBB;=ix&|>#_pPtI`$1iEZgZJs_ugc}4_l0#GzybGiIPjdrEwE^_Nj{^Hfv1cz2mSlU0M*QsdX=} z!*iz9j{g>nzc_lEc;VW=f3N?fJCp_7h!RcXcek=}b`Sz%UmELueT0 zDh?g#qyr&;MT9w9MajWvQ)9TH#W9>;*#l__-Wn~)Y6Mq-F0@Z3l zQF+T`?8VAkt}th`khys+fLp4MrA51@pJ!oAbRgG!VROkX8F^)m2Yda86B348t;S~- zI2xE^uM@p4J(-(R#x|478P6{XSsX3G@AfT&Cw(?d>EM-v+42Zh?Zi~W;%ETNZB%__ zR%xYr&UlIXY@(p3h(6yLH&&&r%vkN>Qr4uexg8%v*-JpQAl3D?Q$O)f9fDQo6UVL1 zJl{N~5k*WYI0esiG2KS_0f#T>_@ypi(y|7TOUOeV*coO>AjyM9*} z>^u8S?Y)Nug@)02{zrmb;9|*qk=I@}T0AKU`%-skmq%dW z(?rM@#i%H#o$SS?#c)ec=itGNl8K3!Z6!TDb_2V?-2ufCya;eDVw^#{t$t%FNG6iM9Gh}u6Q>XUX z1GlBmP0x$ntYACb3nZ+l;)yteS3mo=KPy0aiRVCQNRoC`oMmdnX-NTy%a$e$M%VHG E1cvlQ`v3p{ literal 0 HcmV?d00001 diff --git a/app/assets/images/gallery/uploadbg.gif b/app/assets/images/gallery/uploadbg.gif new file mode 100755 index 0000000000000000000000000000000000000000..e5fac4244e2982f1139d841e39fc5d1994111ec4 GIT binary patch literal 5150 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 MOePz~005W&2i3)}9{>OV literal 0 HcmV?d00001 diff --git a/app/assets/images/gallery/uppt.png b/app/assets/images/gallery/uppt.png new file mode 100755 index 0000000000000000000000000000000000000000..b1c0db0a6a74c79a86afa30cba134f4e9bfef8b9 GIT binary patch literal 658 zcmV;D0&V??P)X)>i_@& z=t)FDR5*=&luMExF$jY{gpZK>A1||>^$#cuKQh^*tGe248?c1rux)-kGlQfzUfz;9D$V>pb`vvKxQh=eVN#&jk zp+2x?OjTjbr;AX~(b!asvAxQDHAX&lkVCjLKqVP@(jv6eSjHbhK&x?(|86V_Qq<0c!yO+ z5(sR@(3cddC6n}R2Mj& z1~M0l-FkI5D;GK~SBUARy0AeJ@cDcQ1yx045E-O|J;;X4d@`#~ZL$myXlAxRk2Z6y z+ZJrIq$79f2?s;2q^eot9ksP7V2I4;Fkw@l&t~6492D1C>!;N9qs%qWGfuE4E~2|> zeX5>%LVkxH(vjy8tuH5$T-VK7m9vaYry`(sohaq5k8#okn73=r!ugBWGI3nV`x>wG1cRUjx sCcnPE{^`NJ)NX$Q_{D!7{cjQA4@g#xTD4Q{i~s-t07*qoM6N<$g6*RYWdHyG literal 0 HcmV?d00001 diff --git a/app/assets/images/gallery/upsep.png b/app/assets/images/gallery/upsep.png new file mode 100755 index 0000000000000000000000000000000000000000..314f8ac9cbeaf1e87a43a7035e6a7497fe0a26e2 GIT binary patch literal 231 zcmeAS@N?(olHy`uVBq!ia0vp^OhBx`!3HF+G-{UsDVAa<&kznEsNqQI0P;BtJR*x3 z7`TN%nDNrxx<5ccu@cva66d1S#FEVXJcW?V+*AfbLwzG7eM7@jSIf$PD&#;ag7ec# z$`gxH85~pclTsDjGK*5n^NX^J6`X@j^$b_bd%Om!wDojx43U^R)qkfTg968C!{yQ& zr#7pGWh`cr75{YTZu^qVNem2b#{^GQ<~});sF!|tgWB`m{&K%w2XnkV6RD6~Rrt)Y R?=8?E22WQ%mvv4FO#qWpN1Olv literal 0 HcmV?d00001 diff --git a/app/assets/javascripts/admin/galleries.js b/app/assets/javascripts/admin/galleries.js deleted file mode 100644 index dee720f..0000000 --- a/app/assets/javascripts/admin/galleries.js +++ /dev/null @@ -1,2 +0,0 @@ -// Place all the behaviors and hooks related to the matching controller here. -// All this logic will automatically be available in application.js. diff --git a/app/assets/javascripts/cycle.js b/app/assets/javascripts/cycle.js new file mode 100755 index 0000000..cd60730 --- /dev/null +++ b/app/assets/javascripts/cycle.js @@ -0,0 +1,1551 @@ +/*! + * jQuery Cycle Plugin (with Transition Definitions) + * Examples and documentation at: http://jquery.malsup.com/cycle/ + * Copyright (c) 2007-2010 M. Alsup + * Version: 2.9999.8 (26-OCT-2012) + * Dual licensed under the MIT and GPL licenses. + * http://jquery.malsup.com/license.html + * Requires: jQuery v1.3.2 or later + */ +;(function($, undefined) { +"use strict"; + +var ver = '2.9999.8'; + +// if $.support is not defined (pre jQuery 1.3) add what I need +if ($.support === undefined) { + $.support = { + opacity: !($.browser.msie) + }; +} + +function debug(s) { + if ($.fn.cycle.debug) + log(s); +} +function log() { + if (window.console && console.log) + console.log('[cycle] ' + Array.prototype.join.call(arguments,' ')); +} +$.expr[':'].paused = function(el) { + return el.cyclePause; +}; + + +// the options arg can be... +// a number - indicates an immediate transition should occur to the given slide index +// a string - 'pause', 'resume', 'toggle', 'next', 'prev', 'stop', 'destroy' or the name of a transition effect (ie, 'fade', 'zoom', etc) +// an object - properties to control the slideshow +// +// the arg2 arg can be... +// the name of an fx (only used in conjunction with a numeric value for 'options') +// the value true (only used in first arg == 'resume') and indicates +// that the resume should occur immediately (not wait for next timeout) + +$.fn.cycle = function(options, arg2) { + var o = { s: this.selector, c: this.context }; + + // in 1.3+ we can fix mistakes with the ready state + if (this.length === 0 && options != 'stop') { + if (!$.isReady && o.s) { + log('DOM not ready, queuing slideshow'); + $(function() { + $(o.s,o.c).cycle(options,arg2); + }); + return this; + } + // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready() + log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)')); + return this; + } + + // iterate the matched nodeset + return this.each(function() { + var opts = handleArguments(this, options, arg2); + if (opts === false) + return; + + opts.updateActivePagerLink = opts.updateActivePagerLink || $.fn.cycle.updateActivePagerLink; + + // stop existing slideshow for this container (if there is one) + if (this.cycleTimeout) + clearTimeout(this.cycleTimeout); + this.cycleTimeout = this.cyclePause = 0; + this.cycleStop = 0; // issue #108 + + var $cont = $(this); + var $slides = opts.slideExpr ? $(opts.slideExpr, this) : $cont.children(); + var els = $slides.get(); + + if (els.length < 2) { + log('terminating; too few slides: ' + els.length); + return; + } + + var opts2 = buildOptions($cont, $slides, els, opts, o); + if (opts2 === false) + return; + + var startTime = opts2.continuous ? 10 : getTimeout(els[opts2.currSlide], els[opts2.nextSlide], opts2, !opts2.backwards); + + // if it's an auto slideshow, kick it off + if (startTime) { + startTime += (opts2.delay || 0); + if (startTime < 10) + startTime = 10; + debug('first timeout: ' + startTime); + this.cycleTimeout = setTimeout(function(){go(els,opts2,0,!opts.backwards);}, startTime); + } + }); +}; + +function triggerPause(cont, byHover, onPager) { + var opts = $(cont).data('cycle.opts'); + if (!opts) + return; + var paused = !!cont.cyclePause; + if (paused && opts.paused) + opts.paused(cont, opts, byHover, onPager); + else if (!paused && opts.resumed) + opts.resumed(cont, opts, byHover, onPager); +} + +// process the args that were passed to the plugin fn +function handleArguments(cont, options, arg2) { + if (cont.cycleStop === undefined) + cont.cycleStop = 0; + if (options === undefined || options === null) + options = {}; + if (options.constructor == String) { + switch(options) { + case 'destroy': + case 'stop': + var opts = $(cont).data('cycle.opts'); + if (!opts) + return false; + cont.cycleStop++; // callbacks look for change + if (cont.cycleTimeout) + clearTimeout(cont.cycleTimeout); + cont.cycleTimeout = 0; + if (opts.elements) + $(opts.elements).stop(); + $(cont).removeData('cycle.opts'); + if (options == 'destroy') + destroy(cont, opts); + return false; + case 'toggle': + cont.cyclePause = (cont.cyclePause === 1) ? 0 : 1; + checkInstantResume(cont.cyclePause, arg2, cont); + triggerPause(cont); + return false; + case 'pause': + cont.cyclePause = 1; + triggerPause(cont); + return false; + case 'resume': + cont.cyclePause = 0; + checkInstantResume(false, arg2, cont); + triggerPause(cont); + return false; + case 'prev': + case 'next': + opts = $(cont).data('cycle.opts'); + if (!opts) { + log('options not found, "prev/next" ignored'); + return false; + } + $.fn.cycle[options](opts); + return false; + default: + options = { fx: options }; + } + return options; + } + else if (options.constructor == Number) { + // go to the requested slide + var num = options; + options = $(cont).data('cycle.opts'); + if (!options) { + log('options not found, can not advance slide'); + return false; + } + if (num < 0 || num >= options.elements.length) { + log('invalid slide index: ' + num); + return false; + } + options.nextSlide = num; + if (cont.cycleTimeout) { + clearTimeout(cont.cycleTimeout); + cont.cycleTimeout = 0; + } + if (typeof arg2 == 'string') + options.oneTimeFx = arg2; + go(options.elements, options, 1, num >= options.currSlide); + return false; + } + return options; + + function checkInstantResume(isPaused, arg2, cont) { + if (!isPaused && arg2 === true) { // resume now! + var options = $(cont).data('cycle.opts'); + if (!options) { + log('options not found, can not resume'); + return false; + } + if (cont.cycleTimeout) { + clearTimeout(cont.cycleTimeout); + cont.cycleTimeout = 0; + } + go(options.elements, options, 1, !options.backwards); + } + } +} + +function removeFilter(el, opts) { + if (!$.support.opacity && opts.cleartype && el.style.filter) { + try { el.style.removeAttribute('filter'); } + catch(smother) {} // handle old opera versions + } +} + +// unbind event handlers +function destroy(cont, opts) { + if (opts.next) + $(opts.next).unbind(opts.prevNextEvent); + if (opts.prev) + $(opts.prev).unbind(opts.prevNextEvent); + + if (opts.pager || opts.pagerAnchorBuilder) + $.each(opts.pagerAnchors || [], function() { + this.unbind().remove(); + }); + opts.pagerAnchors = null; + $(cont).unbind('mouseenter.cycle mouseleave.cycle'); + if (opts.destroy) // callback + opts.destroy(opts); +} + +// one-time initialization +function buildOptions($cont, $slides, els, options, o) { + var startingSlideSpecified; + // support metadata plugin (v1.0 and v2.0) + var opts = $.extend({}, $.fn.cycle.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {}); + var meta = $.isFunction($cont.data) ? $cont.data(opts.metaAttr) : null; + if (meta) + opts = $.extend(opts, meta); + if (opts.autostop) + opts.countdown = opts.autostopCount || els.length; + + var cont = $cont[0]; + $cont.data('cycle.opts', opts); + opts.$cont = $cont; + opts.stopCount = cont.cycleStop; + opts.elements = els; + opts.before = opts.before ? [opts.before] : []; + opts.after = opts.after ? [opts.after] : []; + + // push some after callbacks + if (!$.support.opacity && opts.cleartype) + opts.after.push(function() { removeFilter(this, opts); }); + if (opts.continuous) + opts.after.push(function() { go(els,opts,0,!opts.backwards); }); + + saveOriginalOpts(opts); + + // clearType corrections + if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg) + clearTypeFix($slides); + + // container requires non-static position so that slides can be position within + if ($cont.css('position') == 'static') + $cont.css('position', 'relative'); + if (opts.width) + $cont.width(opts.width); + if (opts.height && opts.height != 'auto') + $cont.height(opts.height); + + if (opts.startingSlide !== undefined) { + opts.startingSlide = parseInt(opts.startingSlide,10); + if (opts.startingSlide >= els.length || opts.startSlide < 0) + opts.startingSlide = 0; // catch bogus input + else + startingSlideSpecified = true; + } + else if (opts.backwards) + opts.startingSlide = els.length - 1; + else + opts.startingSlide = 0; + + // if random, mix up the slide array + if (opts.random) { + opts.randomMap = []; + for (var i = 0; i < els.length; i++) + opts.randomMap.push(i); + opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;}); + if (startingSlideSpecified) { + // try to find the specified starting slide and if found set start slide index in the map accordingly + for ( var cnt = 0; cnt < els.length; cnt++ ) { + if ( opts.startingSlide == opts.randomMap[cnt] ) { + opts.randomIndex = cnt; + } + } + } + else { + opts.randomIndex = 1; + opts.startingSlide = opts.randomMap[1]; + } + } + else if (opts.startingSlide >= els.length) + opts.startingSlide = 0; // catch bogus input + opts.currSlide = opts.startingSlide || 0; + var first = opts.startingSlide; + + // set position and zIndex on all the slides + $slides.css({position: 'absolute', top:0, left:0}).hide().each(function(i) { + var z; + if (opts.backwards) + z = first ? i <= first ? els.length + (i-first) : first-i : els.length-i; + else + z = first ? i >= first ? els.length - (i-first) : first-i : els.length-i; + $(this).css('z-index', z); + }); + + // make sure first slide is visible + $(els[first]).css('opacity',1).show(); // opacity bit needed to handle restart use case + removeFilter(els[first], opts); + + // stretch slides + if (opts.fit) { + if (!opts.aspect) { + if (opts.width) + $slides.width(opts.width); + if (opts.height && opts.height != 'auto') + $slides.height(opts.height); + } else { + $slides.each(function(){ + var $slide = $(this); + var ratio = (opts.aspect === true) ? $slide.width()/$slide.height() : opts.aspect; + if( opts.width && $slide.width() != opts.width ) { + $slide.width( opts.width ); + $slide.height( opts.width / ratio ); + } + + if( opts.height && $slide.height() < opts.height ) { + $slide.height( opts.height ); + $slide.width( opts.height * ratio ); + } + }); + } + } + + if (opts.center && ((!opts.fit) || opts.aspect)) { + $slides.each(function(){ + var $slide = $(this); + $slide.css({ + "margin-left": opts.width ? + ((opts.width - $slide.width()) / 2) + "px" : + 0, + "margin-top": opts.height ? + ((opts.height - $slide.height()) / 2) + "px" : + 0 + }); + }); + } + + if (opts.center && !opts.fit && !opts.slideResize) { + $slides.each(function(){ + var $slide = $(this); + $slide.css({ + "margin-left": opts.width ? ((opts.width - $slide.width()) / 2) + "px" : 0, + "margin-top": opts.height ? ((opts.height - $slide.height()) / 2) + "px" : 0 + }); + }); + } + + // stretch container + var reshape = (opts.containerResize || opts.containerResizeHeight) && !$cont.innerHeight(); + if (reshape) { // do this only if container has no size http://tinyurl.com/da2oa9 + var maxw = 0, maxh = 0; + for(var j=0; j < els.length; j++) { + var $e = $(els[j]), e = $e[0], w = $e.outerWidth(), h = $e.outerHeight(); + if (!w) w = e.offsetWidth || e.width || $e.attr('width'); + if (!h) h = e.offsetHeight || e.height || $e.attr('height'); + maxw = w > maxw ? w : maxw; + maxh = h > maxh ? h : maxh; + } + if (opts.containerResize && maxw > 0 && maxh > 0) + $cont.css({width:maxw+'px',height:maxh+'px'}); + if (opts.containerResizeHeight && maxh > 0) + $cont.css({height:maxh+'px'}); + } + + var pauseFlag = false; // https://github.com/malsup/cycle/issues/44 + if (opts.pause) + $cont.bind('mouseenter.cycle', function(){ + pauseFlag = true; + this.cyclePause++; + triggerPause(cont, true); + }).bind('mouseleave.cycle', function(){ + if (pauseFlag) + this.cyclePause--; + triggerPause(cont, true); + }); + + if (supportMultiTransitions(opts) === false) + return false; + + // apparently a lot of people use image slideshows without height/width attributes on the images. + // Cycle 2.50+ requires the sizing info for every slide; this block tries to deal with that. + var requeue = false; + options.requeueAttempts = options.requeueAttempts || 0; + $slides.each(function() { + // try to get height/width of each slide + var $el = $(this); + this.cycleH = (opts.fit && opts.height) ? opts.height : ($el.height() || this.offsetHeight || this.height || $el.attr('height') || 0); + this.cycleW = (opts.fit && opts.width) ? opts.width : ($el.width() || this.offsetWidth || this.width || $el.attr('width') || 0); + + if ( $el.is('img') ) { + // sigh.. sniffing, hacking, shrugging... this crappy hack tries to account for what browsers do when + // an image is being downloaded and the markup did not include sizing info (height/width attributes); + // there seems to be some "default" sizes used in this situation + var loadingIE = ($.browser.msie && this.cycleW == 28 && this.cycleH == 30 && !this.complete); + var loadingFF = ($.browser.mozilla && this.cycleW == 34 && this.cycleH == 19 && !this.complete); + var loadingOp = ($.browser.opera && ((this.cycleW == 42 && this.cycleH == 19) || (this.cycleW == 37 && this.cycleH == 17)) && !this.complete); + var loadingOther = (this.cycleH === 0 && this.cycleW === 0 && !this.complete); + // don't requeue for images that are still loading but have a valid size + if (loadingIE || loadingFF || loadingOp || loadingOther) { + if (o.s && opts.requeueOnImageNotLoaded && ++options.requeueAttempts < 100) { // track retry count so we don't loop forever + log(options.requeueAttempts,' - img slide not loaded, requeuing slideshow: ', this.src, this.cycleW, this.cycleH); + setTimeout(function() {$(o.s,o.c).cycle(options);}, opts.requeueTimeout); + requeue = true; + return false; // break each loop + } + else { + log('could not determine size of image: '+this.src, this.cycleW, this.cycleH); + } + } + } + return true; + }); + + if (requeue) + return false; + + opts.cssBefore = opts.cssBefore || {}; + opts.cssAfter = opts.cssAfter || {}; + opts.cssFirst = opts.cssFirst || {}; + opts.animIn = opts.animIn || {}; + opts.animOut = opts.animOut || {}; + + $slides.not(':eq('+first+')').css(opts.cssBefore); + $($slides[first]).css(opts.cssFirst); + + if (opts.timeout) { + opts.timeout = parseInt(opts.timeout,10); + // ensure that timeout and speed settings are sane + if (opts.speed.constructor == String) + opts.speed = $.fx.speeds[opts.speed] || parseInt(opts.speed,10); + if (!opts.sync) + opts.speed = opts.speed / 2; + + var buffer = opts.fx == 'none' ? 0 : opts.fx == 'shuffle' ? 500 : 250; + while((opts.timeout - opts.speed) < buffer) // sanitize timeout + opts.timeout += opts.speed; + } + if (opts.easing) + opts.easeIn = opts.easeOut = opts.easing; + if (!opts.speedIn) + opts.speedIn = opts.speed; + if (!opts.speedOut) + opts.speedOut = opts.speed; + + opts.slideCount = els.length; + opts.currSlide = opts.lastSlide = first; + if (opts.random) { + if (++opts.randomIndex == els.length) + opts.randomIndex = 0; + opts.nextSlide = opts.randomMap[opts.randomIndex]; + } + else if (opts.backwards) + opts.nextSlide = opts.startingSlide === 0 ? (els.length-1) : opts.startingSlide-1; + else + opts.nextSlide = opts.startingSlide >= (els.length-1) ? 0 : opts.startingSlide+1; + + // run transition init fn + if (!opts.multiFx) { + var init = $.fn.cycle.transitions[opts.fx]; + if ($.isFunction(init)) + init($cont, $slides, opts); + else if (opts.fx != 'custom' && !opts.multiFx) { + log('unknown transition: ' + opts.fx,'; slideshow terminating'); + return false; + } + } + + // fire artificial events + var e0 = $slides[first]; + if (!opts.skipInitializationCallbacks) { + if (opts.before.length) + opts.before[0].apply(e0, [e0, e0, opts, true]); + if (opts.after.length) + opts.after[0].apply(e0, [e0, e0, opts, true]); + } + if (opts.next) + $(opts.next).bind(opts.prevNextEvent,function(){return advance(opts,1);}); + if (opts.prev) + $(opts.prev).bind(opts.prevNextEvent,function(){return advance(opts,0);}); + if (opts.pager || opts.pagerAnchorBuilder) + buildPager(els,opts); + + exposeAddSlide(opts, els); + + return opts; +} + +// save off original opts so we can restore after clearing state +function saveOriginalOpts(opts) { + opts.original = { before: [], after: [] }; + opts.original.cssBefore = $.extend({}, opts.cssBefore); + opts.original.cssAfter = $.extend({}, opts.cssAfter); + opts.original.animIn = $.extend({}, opts.animIn); + opts.original.animOut = $.extend({}, opts.animOut); + $.each(opts.before, function() { opts.original.before.push(this); }); + $.each(opts.after, function() { opts.original.after.push(this); }); +} + +function supportMultiTransitions(opts) { + var i, tx, txs = $.fn.cycle.transitions; + // look for multiple effects + if (opts.fx.indexOf(',') > 0) { + opts.multiFx = true; + opts.fxs = opts.fx.replace(/\s*/g,'').split(','); + // discard any bogus effect names + for (i=0; i < opts.fxs.length; i++) { + var fx = opts.fxs[i]; + tx = txs[fx]; + if (!tx || !txs.hasOwnProperty(fx) || !$.isFunction(tx)) { + log('discarding unknown transition: ',fx); + opts.fxs.splice(i,1); + i--; + } + } + // if we have an empty list then we threw everything away! + if (!opts.fxs.length) { + log('No valid transitions named; slideshow terminating.'); + return false; + } + } + else if (opts.fx == 'all') { // auto-gen the list of transitions + opts.multiFx = true; + opts.fxs = []; + for (var p in txs) { + if (txs.hasOwnProperty(p)) { + tx = txs[p]; + if (txs.hasOwnProperty(p) && $.isFunction(tx)) + opts.fxs.push(p); + } + } + } + if (opts.multiFx && opts.randomizeEffects) { + // munge the fxs array to make effect selection random + var r1 = Math.floor(Math.random() * 20) + 30; + for (i = 0; i < r1; i++) { + var r2 = Math.floor(Math.random() * opts.fxs.length); + opts.fxs.push(opts.fxs.splice(r2,1)[0]); + } + debug('randomized fx sequence: ',opts.fxs); + } + return true; +} + +// provide a mechanism for adding slides after the slideshow has started +function exposeAddSlide(opts, els) { + opts.addSlide = function(newSlide, prepend) { + var $s = $(newSlide), s = $s[0]; + if (!opts.autostopCount) + opts.countdown++; + els[prepend?'unshift':'push'](s); + if (opts.els) + opts.els[prepend?'unshift':'push'](s); // shuffle needs this + opts.slideCount = els.length; + + // add the slide to the random map and resort + if (opts.random) { + opts.randomMap.push(opts.slideCount-1); + opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;}); + } + + $s.css('position','absolute'); + $s[prepend?'prependTo':'appendTo'](opts.$cont); + + if (prepend) { + opts.currSlide++; + opts.nextSlide++; + } + + if (!$.support.opacity && opts.cleartype && !opts.cleartypeNoBg) + clearTypeFix($s); + + if (opts.fit && opts.width) + $s.width(opts.width); + if (opts.fit && opts.height && opts.height != 'auto') + $s.height(opts.height); + s.cycleH = (opts.fit && opts.height) ? opts.height : $s.height(); + s.cycleW = (opts.fit && opts.width) ? opts.width : $s.width(); + + $s.css(opts.cssBefore); + + if (opts.pager || opts.pagerAnchorBuilder) + $.fn.cycle.createPagerAnchor(els.length-1, s, $(opts.pager), els, opts); + + if ($.isFunction(opts.onAddSlide)) + opts.onAddSlide($s); + else + $s.hide(); // default behavior + }; +} + +// reset internal state; we do this on every pass in order to support multiple effects +$.fn.cycle.resetState = function(opts, fx) { + fx = fx || opts.fx; + opts.before = []; opts.after = []; + opts.cssBefore = $.extend({}, opts.original.cssBefore); + opts.cssAfter = $.extend({}, opts.original.cssAfter); + opts.animIn = $.extend({}, opts.original.animIn); + opts.animOut = $.extend({}, opts.original.animOut); + opts.fxFn = null; + $.each(opts.original.before, function() { opts.before.push(this); }); + $.each(opts.original.after, function() { opts.after.push(this); }); + + // re-init + var init = $.fn.cycle.transitions[fx]; + if ($.isFunction(init)) + init(opts.$cont, $(opts.elements), opts); +}; + +// this is the main engine fn, it handles the timeouts, callbacks and slide index mgmt +function go(els, opts, manual, fwd) { + var p = opts.$cont[0], curr = els[opts.currSlide], next = els[opts.nextSlide]; + + // opts.busy is true if we're in the middle of an animation + if (manual && opts.busy && opts.manualTrump) { + // let manual transitions requests trump active ones + debug('manualTrump in go(), stopping active transition'); + $(els).stop(true,true); + opts.busy = 0; + clearTimeout(p.cycleTimeout); + } + + // don't begin another timeout-based transition if there is one active + if (opts.busy) { + debug('transition active, ignoring new tx request'); + return; + } + + + // stop cycling if we have an outstanding stop request + if (p.cycleStop != opts.stopCount || p.cycleTimeout === 0 && !manual) + return; + + // check to see if we should stop cycling based on autostop options + if (!manual && !p.cyclePause && !opts.bounce && + ((opts.autostop && (--opts.countdown <= 0)) || + (opts.nowrap && !opts.random && opts.nextSlide < opts.currSlide))) { + if (opts.end) + opts.end(opts); + return; + } + + // if slideshow is paused, only transition on a manual trigger + var changed = false; + if ((manual || !p.cyclePause) && (opts.nextSlide != opts.currSlide)) { + changed = true; + var fx = opts.fx; + // keep trying to get the slide size if we don't have it yet + curr.cycleH = curr.cycleH || $(curr).height(); + curr.cycleW = curr.cycleW || $(curr).width(); + next.cycleH = next.cycleH || $(next).height(); + next.cycleW = next.cycleW || $(next).width(); + + // support multiple transition types + if (opts.multiFx) { + if (fwd && (opts.lastFx === undefined || ++opts.lastFx >= opts.fxs.length)) + opts.lastFx = 0; + else if (!fwd && (opts.lastFx === undefined || --opts.lastFx < 0)) + opts.lastFx = opts.fxs.length - 1; + fx = opts.fxs[opts.lastFx]; + } + + // one-time fx overrides apply to: $('div').cycle(3,'zoom'); + if (opts.oneTimeFx) { + fx = opts.oneTimeFx; + opts.oneTimeFx = null; + } + + $.fn.cycle.resetState(opts, fx); + + // run the before callbacks + if (opts.before.length) + $.each(opts.before, function(i,o) { + if (p.cycleStop != opts.stopCount) return; + o.apply(next, [curr, next, opts, fwd]); + }); + + // stage the after callacks + var after = function() { + opts.busy = 0; + $.each(opts.after, function(i,o) { + if (p.cycleStop != opts.stopCount) return; + o.apply(next, [curr, next, opts, fwd]); + }); + if (!p.cycleStop) { + // queue next transition + queueNext(); + } + }; + + debug('tx firing('+fx+'); currSlide: ' + opts.currSlide + '; nextSlide: ' + opts.nextSlide); + + // get ready to perform the transition + opts.busy = 1; + if (opts.fxFn) // fx function provided? + opts.fxFn(curr, next, opts, after, fwd, manual && opts.fastOnEvent); + else if ($.isFunction($.fn.cycle[opts.fx])) // fx plugin ? + $.fn.cycle[opts.fx](curr, next, opts, after, fwd, manual && opts.fastOnEvent); + else + $.fn.cycle.custom(curr, next, opts, after, fwd, manual && opts.fastOnEvent); + } + else { + queueNext(); + } + + if (changed || opts.nextSlide == opts.currSlide) { + // calculate the next slide + var roll; + opts.lastSlide = opts.currSlide; + if (opts.random) { + opts.currSlide = opts.nextSlide; + if (++opts.randomIndex == els.length) { + opts.randomIndex = 0; + opts.randomMap.sort(function(a,b) {return Math.random() - 0.5;}); + } + opts.nextSlide = opts.randomMap[opts.randomIndex]; + if (opts.nextSlide == opts.currSlide) + opts.nextSlide = (opts.currSlide == opts.slideCount - 1) ? 0 : opts.currSlide + 1; + } + else if (opts.backwards) { + roll = (opts.nextSlide - 1) < 0; + if (roll && opts.bounce) { + opts.backwards = !opts.backwards; + opts.nextSlide = 1; + opts.currSlide = 0; + } + else { + opts.nextSlide = roll ? (els.length-1) : opts.nextSlide-1; + opts.currSlide = roll ? 0 : opts.nextSlide+1; + } + } + else { // sequence + roll = (opts.nextSlide + 1) == els.length; + if (roll && opts.bounce) { + opts.backwards = !opts.backwards; + opts.nextSlide = els.length-2; + opts.currSlide = els.length-1; + } + else { + opts.nextSlide = roll ? 0 : opts.nextSlide+1; + opts.currSlide = roll ? els.length-1 : opts.nextSlide-1; + } + } + } + if (changed && opts.pager) + opts.updateActivePagerLink(opts.pager, opts.currSlide, opts.activePagerClass); + + function queueNext() { + // stage the next transition + var ms = 0, timeout = opts.timeout; + if (opts.timeout && !opts.continuous) { + ms = getTimeout(els[opts.currSlide], els[opts.nextSlide], opts, fwd); + if (opts.fx == 'shuffle') + ms -= opts.speedOut; + } + else if (opts.continuous && p.cyclePause) // continuous shows work off an after callback, not this timer logic + ms = 10; + if (ms > 0) + p.cycleTimeout = setTimeout(function(){ go(els, opts, 0, !opts.backwards); }, ms); + } +} + +// invoked after transition +$.fn.cycle.updateActivePagerLink = function(pager, currSlide, clsName) { + $(pager).each(function() { + $(this).children().removeClass(clsName).eq(currSlide).addClass(clsName); + }); +}; + +// calculate timeout value for current transition +function getTimeout(curr, next, opts, fwd) { + if (opts.timeoutFn) { + // call user provided calc fn + var t = opts.timeoutFn.call(curr,curr,next,opts,fwd); + while (opts.fx != 'none' && (t - opts.speed) < 250) // sanitize timeout + t += opts.speed; + debug('calculated timeout: ' + t + '; speed: ' + opts.speed); + if (t !== false) + return t; + } + return opts.timeout; +} + +// expose next/prev function, caller must pass in state +$.fn.cycle.next = function(opts) { advance(opts,1); }; +$.fn.cycle.prev = function(opts) { advance(opts,0);}; + +// advance slide forward or back +function advance(opts, moveForward) { + var val = moveForward ? 1 : -1; + var els = opts.elements; + var p = opts.$cont[0], timeout = p.cycleTimeout; + if (timeout) { + clearTimeout(timeout); + p.cycleTimeout = 0; + } + if (opts.random && val < 0) { + // move back to the previously display slide + opts.randomIndex--; + if (--opts.randomIndex == -2) + opts.randomIndex = els.length-2; + else if (opts.randomIndex == -1) + opts.randomIndex = els.length-1; + opts.nextSlide = opts.randomMap[opts.randomIndex]; + } + else if (opts.random) { + opts.nextSlide = opts.randomMap[opts.randomIndex]; + } + else { + opts.nextSlide = opts.currSlide + val; + if (opts.nextSlide < 0) { + if (opts.nowrap) return false; + opts.nextSlide = els.length - 1; + } + else if (opts.nextSlide >= els.length) { + if (opts.nowrap) return false; + opts.nextSlide = 0; + } + } + + var cb = opts.onPrevNextEvent || opts.prevNextClick; // prevNextClick is deprecated + if ($.isFunction(cb)) + cb(val > 0, opts.nextSlide, els[opts.nextSlide]); + go(els, opts, 1, moveForward); + return false; +} + +function buildPager(els, opts) { + var $p = $(opts.pager); + $.each(els, function(i,o) { + $.fn.cycle.createPagerAnchor(i,o,$p,els,opts); + }); + opts.updateActivePagerLink(opts.pager, opts.startingSlide, opts.activePagerClass); +} + +$.fn.cycle.createPagerAnchor = function(i, el, $p, els, opts) { + var a; + if ($.isFunction(opts.pagerAnchorBuilder)) { + a = opts.pagerAnchorBuilder(i,el); + debug('pagerAnchorBuilder('+i+', el) returned: ' + a); + } + else + a = ''+(i+1)+''; + + if (!a) + return; + var $a = $(a); + // don't reparent if anchor is in the dom + if ($a.parents('body').length === 0) { + var arr = []; + if ($p.length > 1) { + $p.each(function() { + var $clone = $a.clone(true); + $(this).append($clone); + arr.push($clone[0]); + }); + $a = $(arr); + } + else { + $a.appendTo($p); + } + } + + opts.pagerAnchors = opts.pagerAnchors || []; + opts.pagerAnchors.push($a); + + var pagerFn = function(e) { + e.preventDefault(); + opts.nextSlide = i; + var p = opts.$cont[0], timeout = p.cycleTimeout; + if (timeout) { + clearTimeout(timeout); + p.cycleTimeout = 0; + } + var cb = opts.onPagerEvent || opts.pagerClick; // pagerClick is deprecated + if ($.isFunction(cb)) + cb(opts.nextSlide, els[opts.nextSlide]); + go(els,opts,1,opts.currSlide < i); // trigger the trans +// return false; // <== allow bubble + }; + + if ( /mouseenter|mouseover/i.test(opts.pagerEvent) ) { + $a.hover(pagerFn, function(){/* no-op */} ); + } + else { + $a.bind(opts.pagerEvent, pagerFn); + } + + if ( ! /^click/.test(opts.pagerEvent) && !opts.allowPagerClickBubble) + $a.bind('click.cycle', function(){return false;}); // suppress click + + var cont = opts.$cont[0]; + var pauseFlag = false; // https://github.com/malsup/cycle/issues/44 + if (opts.pauseOnPagerHover) { + $a.hover( + function() { + pauseFlag = true; + cont.cyclePause++; + triggerPause(cont,true,true); + }, function() { + if (pauseFlag) + cont.cyclePause--; + triggerPause(cont,true,true); + } + ); + } +}; + +// helper fn to calculate the number of slides between the current and the next +$.fn.cycle.hopsFromLast = function(opts, fwd) { + var hops, l = opts.lastSlide, c = opts.currSlide; + if (fwd) + hops = c > l ? c - l : opts.slideCount - l; + else + hops = c < l ? l - c : l + opts.slideCount - c; + return hops; +}; + +// fix clearType problems in ie6 by setting an explicit bg color +// (otherwise text slides look horrible during a fade transition) +function clearTypeFix($slides) { + debug('applying clearType background-color hack'); + function hex(s) { + s = parseInt(s,10).toString(16); + return s.length < 2 ? '0'+s : s; + } + function getBg(e) { + for ( ; e && e.nodeName.toLowerCase() != 'html'; e = e.parentNode) { + var v = $.css(e,'background-color'); + if (v && v.indexOf('rgb') >= 0 ) { + var rgb = v.match(/\d+/g); + return '#'+ hex(rgb[0]) + hex(rgb[1]) + hex(rgb[2]); + } + if (v && v != 'transparent') + return v; + } + return '#ffffff'; + } + $slides.each(function() { $(this).css('background-color', getBg(this)); }); +} + +// reset common props before the next transition +$.fn.cycle.commonReset = function(curr,next,opts,w,h,rev) { + $(opts.elements).not(curr).hide(); + if (typeof opts.cssBefore.opacity == 'undefined') + opts.cssBefore.opacity = 1; + opts.cssBefore.display = 'block'; + if (opts.slideResize && w !== false && next.cycleW > 0) + opts.cssBefore.width = next.cycleW; + if (opts.slideResize && h !== false && next.cycleH > 0) + opts.cssBefore.height = next.cycleH; + opts.cssAfter = opts.cssAfter || {}; + opts.cssAfter.display = 'none'; + $(curr).css('zIndex',opts.slideCount + (rev === true ? 1 : 0)); + $(next).css('zIndex',opts.slideCount + (rev === true ? 0 : 1)); +}; + +// the actual fn for effecting a transition +$.fn.cycle.custom = function(curr, next, opts, cb, fwd, speedOverride) { + var $l = $(curr), $n = $(next); + var speedIn = opts.speedIn, speedOut = opts.speedOut, easeIn = opts.easeIn, easeOut = opts.easeOut; + $n.css(opts.cssBefore); + if (speedOverride) { + if (typeof speedOverride == 'number') + speedIn = speedOut = speedOverride; + else + speedIn = speedOut = 1; + easeIn = easeOut = null; + } + var fn = function() { + $n.animate(opts.animIn, speedIn, easeIn, function() { + cb(); + }); + }; + $l.animate(opts.animOut, speedOut, easeOut, function() { + $l.css(opts.cssAfter); + if (!opts.sync) + fn(); + }); + if (opts.sync) fn(); +}; + +// transition definitions - only fade is defined here, transition pack defines the rest +$.fn.cycle.transitions = { + fade: function($cont, $slides, opts) { + $slides.not(':eq('+opts.currSlide+')').css('opacity',0); + opts.before.push(function(curr,next,opts) { + $.fn.cycle.commonReset(curr,next,opts); + opts.cssBefore.opacity = 0; + }); + opts.animIn = { opacity: 1 }; + opts.animOut = { opacity: 0 }; + opts.cssBefore = { top: 0, left: 0 }; + } +}; + +$.fn.cycle.ver = function() { return ver; }; + +// override these globally if you like (they are all optional) +$.fn.cycle.defaults = { + activePagerClass: 'activeSlide', // class name used for the active pager link + after: null, // transition callback (scope set to element that was shown): function(currSlideElement, nextSlideElement, options, forwardFlag) + allowPagerClickBubble: false, // allows or prevents click event on pager anchors from bubbling + animIn: null, // properties that define how the slide animates in + animOut: null, // properties that define how the slide animates out + aspect: false, // preserve aspect ratio during fit resizing, cropping if necessary (must be used with fit option) + autostop: 0, // true to end slideshow after X transitions (where X == slide count) + autostopCount: 0, // number of transitions (optionally used with autostop to define X) + backwards: false, // true to start slideshow at last slide and move backwards through the stack + before: null, // transition callback (scope set to element to be shown): function(currSlideElement, nextSlideElement, options, forwardFlag) + center: null, // set to true to have cycle add top/left margin to each slide (use with width and height options) + cleartype: !$.support.opacity, // true if clearType corrections should be applied (for IE) + cleartypeNoBg: false, // set to true to disable extra cleartype fixing (leave false to force background color setting on slides) + containerResize: 1, // resize container to fit largest slide + containerResizeHeight: 0, // resize containers height to fit the largest slide but leave the width dynamic + continuous: 0, // true to start next transition immediately after current one completes + cssAfter: null, // properties that defined the state of the slide after transitioning out + cssBefore: null, // properties that define the initial state of the slide before transitioning in + delay: 0, // additional delay (in ms) for first transition (hint: can be negative) + easeIn: null, // easing for "in" transition + easeOut: null, // easing for "out" transition + easing: null, // easing method for both in and out transitions + end: null, // callback invoked when the slideshow terminates (use with autostop or nowrap options): function(options) + fastOnEvent: 0, // force fast transitions when triggered manually (via pager or prev/next); value == time in ms + fit: 0, // force slides to fit container + fx: 'fade', // name of transition effect (or comma separated names, ex: 'fade,scrollUp,shuffle') + fxFn: null, // function used to control the transition: function(currSlideElement, nextSlideElement, options, afterCalback, forwardFlag) + height: 'auto', // container height (if the 'fit' option is true, the slides will be set to this height as well) + manualTrump: true, // causes manual transition to stop an active transition instead of being ignored + metaAttr: 'cycle', // data- attribute that holds the option data for the slideshow + next: null, // element, jQuery object, or jQuery selector string for the element to use as event trigger for next slide + nowrap: 0, // true to prevent slideshow from wrapping + onPagerEvent: null, // callback fn for pager events: function(zeroBasedSlideIndex, slideElement) + onPrevNextEvent: null, // callback fn for prev/next events: function(isNext, zeroBasedSlideIndex, slideElement) + pager: null, // element, jQuery object, or jQuery selector string for the element to use as pager container + pagerAnchorBuilder: null, // callback fn for building anchor links: function(index, DOMelement) + pagerEvent: 'click.cycle', // name of event which drives the pager navigation + pause: 0, // true to enable "pause on hover" + pauseOnPagerHover: 0, // true to pause when hovering over pager link + prev: null, // element, jQuery object, or jQuery selector string for the element to use as event trigger for previous slide + prevNextEvent: 'click.cycle',// event which drives the manual transition to the previous or next slide + random: 0, // true for random, false for sequence (not applicable to shuffle fx) + randomizeEffects: 1, // valid when multiple effects are used; true to make the effect sequence random + requeueOnImageNotLoaded: true, // requeue the slideshow if any image slides are not yet loaded + requeueTimeout: 250, // ms delay for requeue + rev: 0, // causes animations to transition in reverse (for effects that support it such as scrollHorz/scrollVert/shuffle) + shuffle: null, // coords for shuffle animation, ex: { top:15, left: 200 } + skipInitializationCallbacks: false, // set to true to disable the first before/after callback that occurs prior to any transition + slideExpr: null, // expression for selecting slides (if something other than all children is required) + slideResize: 1, // force slide width/height to fixed size before every transition + speed: 1000, // speed of the transition (any valid fx speed value) + speedIn: null, // speed of the 'in' transition + speedOut: null, // speed of the 'out' transition + startingSlide: undefined,// zero-based index of the first slide to be displayed + sync: 1, // true if in/out transitions should occur simultaneously + timeout: 4000, // milliseconds between slide transitions (0 to disable auto advance) + timeoutFn: null, // callback for determining per-slide timeout value: function(currSlideElement, nextSlideElement, options, forwardFlag) + updateActivePagerLink: null,// callback fn invoked to update the active pager link (adds/removes activePagerClass style) + width: null // container width (if the 'fit' option is true, the slides will be set to this width as well) +}; + +})(jQuery); + + +/*! + * jQuery Cycle Plugin Transition Definitions + * This script is a plugin for the jQuery Cycle Plugin + * Examples and documentation at: http://malsup.com/jquery/cycle/ + * Copyright (c) 2007-2010 M. Alsup + * Version: 2.73 + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + */ +(function($) { +"use strict"; + +// +// These functions define slide initialization and properties for the named +// transitions. To save file size feel free to remove any of these that you +// don't need. +// +$.fn.cycle.transitions.none = function($cont, $slides, opts) { + opts.fxFn = function(curr,next,opts,after){ + $(next).show(); + $(curr).hide(); + after(); + }; +}; + +// not a cross-fade, fadeout only fades out the top slide +$.fn.cycle.transitions.fadeout = function($cont, $slides, opts) { + $slides.not(':eq('+opts.currSlide+')').css({ display: 'block', 'opacity': 1 }); + opts.before.push(function(curr,next,opts,w,h,rev) { + $(curr).css('zIndex',opts.slideCount + (rev !== true ? 1 : 0)); + $(next).css('zIndex',opts.slideCount + (rev !== true ? 0 : 1)); + }); + opts.animIn.opacity = 1; + opts.animOut.opacity = 0; + opts.cssBefore.opacity = 1; + opts.cssBefore.display = 'block'; + opts.cssAfter.zIndex = 0; +}; + +// scrollUp/Down/Left/Right +$.fn.cycle.transitions.scrollUp = function($cont, $slides, opts) { + $cont.css('overflow','hidden'); + opts.before.push($.fn.cycle.commonReset); + var h = $cont.height(); + opts.cssBefore.top = h; + opts.cssBefore.left = 0; + opts.cssFirst.top = 0; + opts.animIn.top = 0; + opts.animOut.top = -h; +}; +$.fn.cycle.transitions.scrollDown = function($cont, $slides, opts) { + $cont.css('overflow','hidden'); + opts.before.push($.fn.cycle.commonReset); + var h = $cont.height(); + opts.cssFirst.top = 0; + opts.cssBefore.top = -h; + opts.cssBefore.left = 0; + opts.animIn.top = 0; + opts.animOut.top = h; +}; +$.fn.cycle.transitions.scrollLeft = function($cont, $slides, opts) { + $cont.css('overflow','hidden'); + opts.before.push($.fn.cycle.commonReset); + var w = $cont.width(); + opts.cssFirst.left = 0; + opts.cssBefore.left = w; + opts.cssBefore.top = 0; + opts.animIn.left = 0; + opts.animOut.left = 0-w; +}; +$.fn.cycle.transitions.scrollRight = function($cont, $slides, opts) { + $cont.css('overflow','hidden'); + opts.before.push($.fn.cycle.commonReset); + var w = $cont.width(); + opts.cssFirst.left = 0; + opts.cssBefore.left = -w; + opts.cssBefore.top = 0; + opts.animIn.left = 0; + opts.animOut.left = w; +}; +$.fn.cycle.transitions.scrollHorz = function($cont, $slides, opts) { + $cont.css('overflow','hidden').width(); + opts.before.push(function(curr, next, opts, fwd) { + if (opts.rev) + fwd = !fwd; + $.fn.cycle.commonReset(curr,next,opts); + opts.cssBefore.left = fwd ? (next.cycleW-1) : (1-next.cycleW); + opts.animOut.left = fwd ? -curr.cycleW : curr.cycleW; + }); + opts.cssFirst.left = 0; + opts.cssBefore.top = 0; + opts.animIn.left = 0; + opts.animOut.top = 0; +}; +$.fn.cycle.transitions.scrollVert = function($cont, $slides, opts) { + $cont.css('overflow','hidden'); + opts.before.push(function(curr, next, opts, fwd) { + if (opts.rev) + fwd = !fwd; + $.fn.cycle.commonReset(curr,next,opts); + opts.cssBefore.top = fwd ? (1-next.cycleH) : (next.cycleH-1); + opts.animOut.top = fwd ? curr.cycleH : -curr.cycleH; + }); + opts.cssFirst.top = 0; + opts.cssBefore.left = 0; + opts.animIn.top = 0; + opts.animOut.left = 0; +}; + +// slideX/slideY +$.fn.cycle.transitions.slideX = function($cont, $slides, opts) { + opts.before.push(function(curr, next, opts) { + $(opts.elements).not(curr).hide(); + $.fn.cycle.commonReset(curr,next,opts,false,true); + opts.animIn.width = next.cycleW; + }); + opts.cssBefore.left = 0; + opts.cssBefore.top = 0; + opts.cssBefore.width = 0; + opts.animIn.width = 'show'; + opts.animOut.width = 0; +}; +$.fn.cycle.transitions.slideY = function($cont, $slides, opts) { + opts.before.push(function(curr, next, opts) { + $(opts.elements).not(curr).hide(); + $.fn.cycle.commonReset(curr,next,opts,true,false); + opts.animIn.height = next.cycleH; + }); + opts.cssBefore.left = 0; + opts.cssBefore.top = 0; + opts.cssBefore.height = 0; + opts.animIn.height = 'show'; + opts.animOut.height = 0; +}; + +// shuffle +$.fn.cycle.transitions.shuffle = function($cont, $slides, opts) { + var i, w = $cont.css('overflow', 'visible').width(); + $slides.css({left: 0, top: 0}); + opts.before.push(function(curr,next,opts) { + $.fn.cycle.commonReset(curr,next,opts,true,true,true); + }); + // only adjust speed once! + if (!opts.speedAdjusted) { + opts.speed = opts.speed / 2; // shuffle has 2 transitions + opts.speedAdjusted = true; + } + opts.random = 0; + opts.shuffle = opts.shuffle || {left:-w, top:15}; + opts.els = []; + for (i=0; i < $slides.length; i++) + opts.els.push($slides[i]); + + for (i=0; i < opts.currSlide; i++) + opts.els.push(opts.els.shift()); + + // custom transition fn (hat tip to Benjamin Sterling for this bit of sweetness!) + opts.fxFn = function(curr, next, opts, cb, fwd) { + if (opts.rev) + fwd = !fwd; + var $el = fwd ? $(curr) : $(next); + $(next).css(opts.cssBefore); + var count = opts.slideCount; + $el.animate(opts.shuffle, opts.speedIn, opts.easeIn, function() { + var hops = $.fn.cycle.hopsFromLast(opts, fwd); + for (var k=0; k < hops; k++) { + if (fwd) + opts.els.push(opts.els.shift()); + else + opts.els.unshift(opts.els.pop()); + } + if (fwd) { + for (var i=0, len=opts.els.length; i < len; i++) + $(opts.els[i]).css('z-index', len-i+count); + } + else { + var z = $(curr).css('z-index'); + $el.css('z-index', parseInt(z,10)+1+count); + } + $el.animate({left:0, top:0}, opts.speedOut, opts.easeOut, function() { + $(fwd ? this : curr).hide(); + if (cb) cb(); + }); + }); + }; + $.extend(opts.cssBefore, { display: 'block', opacity: 1, top: 0, left: 0 }); +}; + +// turnUp/Down/Left/Right +$.fn.cycle.transitions.turnUp = function($cont, $slides, opts) { + opts.before.push(function(curr, next, opts) { + $.fn.cycle.commonReset(curr,next,opts,true,false); + opts.cssBefore.top = next.cycleH; + opts.animIn.height = next.cycleH; + opts.animOut.width = next.cycleW; + }); + opts.cssFirst.top = 0; + opts.cssBefore.left = 0; + opts.cssBefore.height = 0; + opts.animIn.top = 0; + opts.animOut.height = 0; +}; +$.fn.cycle.transitions.turnDown = function($cont, $slides, opts) { + opts.before.push(function(curr, next, opts) { + $.fn.cycle.commonReset(curr,next,opts,true,false); + opts.animIn.height = next.cycleH; + opts.animOut.top = curr.cycleH; + }); + opts.cssFirst.top = 0; + opts.cssBefore.left = 0; + opts.cssBefore.top = 0; + opts.cssBefore.height = 0; + opts.animOut.height = 0; +}; +$.fn.cycle.transitions.turnLeft = function($cont, $slides, opts) { + opts.before.push(function(curr, next, opts) { + $.fn.cycle.commonReset(curr,next,opts,false,true); + opts.cssBefore.left = next.cycleW; + opts.animIn.width = next.cycleW; + }); + opts.cssBefore.top = 0; + opts.cssBefore.width = 0; + opts.animIn.left = 0; + opts.animOut.width = 0; +}; +$.fn.cycle.transitions.turnRight = function($cont, $slides, opts) { + opts.before.push(function(curr, next, opts) { + $.fn.cycle.commonReset(curr,next,opts,false,true); + opts.animIn.width = next.cycleW; + opts.animOut.left = curr.cycleW; + }); + $.extend(opts.cssBefore, { top: 0, left: 0, width: 0 }); + opts.animIn.left = 0; + opts.animOut.width = 0; +}; + +// zoom +$.fn.cycle.transitions.zoom = function($cont, $slides, opts) { + opts.before.push(function(curr, next, opts) { + $.fn.cycle.commonReset(curr,next,opts,false,false,true); + opts.cssBefore.top = next.cycleH/2; + opts.cssBefore.left = next.cycleW/2; + $.extend(opts.animIn, { top: 0, left: 0, width: next.cycleW, height: next.cycleH }); + $.extend(opts.animOut, { width: 0, height: 0, top: curr.cycleH/2, left: curr.cycleW/2 }); + }); + opts.cssFirst.top = 0; + opts.cssFirst.left = 0; + opts.cssBefore.width = 0; + opts.cssBefore.height = 0; +}; + +// fadeZoom +$.fn.cycle.transitions.fadeZoom = function($cont, $slides, opts) { + opts.before.push(function(curr, next, opts) { + $.fn.cycle.commonReset(curr,next,opts,false,false); + opts.cssBefore.left = next.cycleW/2; + opts.cssBefore.top = next.cycleH/2; + $.extend(opts.animIn, { top: 0, left: 0, width: next.cycleW, height: next.cycleH }); + }); + opts.cssBefore.width = 0; + opts.cssBefore.height = 0; + opts.animOut.opacity = 0; +}; + +// blindX +$.fn.cycle.transitions.blindX = function($cont, $slides, opts) { + var w = $cont.css('overflow','hidden').width(); + opts.before.push(function(curr, next, opts) { + $.fn.cycle.commonReset(curr,next,opts); + opts.animIn.width = next.cycleW; + opts.animOut.left = curr.cycleW; + }); + opts.cssBefore.left = w; + opts.cssBefore.top = 0; + opts.animIn.left = 0; + opts.animOut.left = w; +}; +// blindY +$.fn.cycle.transitions.blindY = function($cont, $slides, opts) { + var h = $cont.css('overflow','hidden').height(); + opts.before.push(function(curr, next, opts) { + $.fn.cycle.commonReset(curr,next,opts); + opts.animIn.height = next.cycleH; + opts.animOut.top = curr.cycleH; + }); + opts.cssBefore.top = h; + opts.cssBefore.left = 0; + opts.animIn.top = 0; + opts.animOut.top = h; +}; +// blindZ +$.fn.cycle.transitions.blindZ = function($cont, $slides, opts) { + var h = $cont.css('overflow','hidden').height(); + var w = $cont.width(); + opts.before.push(function(curr, next, opts) { + $.fn.cycle.commonReset(curr,next,opts); + opts.animIn.height = next.cycleH; + opts.animOut.top = curr.cycleH; + }); + opts.cssBefore.top = h; + opts.cssBefore.left = w; + opts.animIn.top = 0; + opts.animIn.left = 0; + opts.animOut.top = h; + opts.animOut.left = w; +}; + +// growX - grow horizontally from centered 0 width +$.fn.cycle.transitions.growX = function($cont, $slides, opts) { + opts.before.push(function(curr, next, opts) { + $.fn.cycle.commonReset(curr,next,opts,false,true); + opts.cssBefore.left = this.cycleW/2; + opts.animIn.left = 0; + opts.animIn.width = this.cycleW; + opts.animOut.left = 0; + }); + opts.cssBefore.top = 0; + opts.cssBefore.width = 0; +}; +// growY - grow vertically from centered 0 height +$.fn.cycle.transitions.growY = function($cont, $slides, opts) { + opts.before.push(function(curr, next, opts) { + $.fn.cycle.commonReset(curr,next,opts,true,false); + opts.cssBefore.top = this.cycleH/2; + opts.animIn.top = 0; + opts.animIn.height = this.cycleH; + opts.animOut.top = 0; + }); + opts.cssBefore.height = 0; + opts.cssBefore.left = 0; +}; + +// curtainX - squeeze in both edges horizontally +$.fn.cycle.transitions.curtainX = function($cont, $slides, opts) { + opts.before.push(function(curr, next, opts) { + $.fn.cycle.commonReset(curr,next,opts,false,true,true); + opts.cssBefore.left = next.cycleW/2; + opts.animIn.left = 0; + opts.animIn.width = this.cycleW; + opts.animOut.left = curr.cycleW/2; + opts.animOut.width = 0; + }); + opts.cssBefore.top = 0; + opts.cssBefore.width = 0; +}; +// curtainY - squeeze in both edges vertically +$.fn.cycle.transitions.curtainY = function($cont, $slides, opts) { + opts.before.push(function(curr, next, opts) { + $.fn.cycle.commonReset(curr,next,opts,true,false,true); + opts.cssBefore.top = next.cycleH/2; + opts.animIn.top = 0; + opts.animIn.height = next.cycleH; + opts.animOut.top = curr.cycleH/2; + opts.animOut.height = 0; + }); + opts.cssBefore.height = 0; + opts.cssBefore.left = 0; +}; + +// cover - curr slide covered by next slide +$.fn.cycle.transitions.cover = function($cont, $slides, opts) { + var d = opts.direction || 'left'; + var w = $cont.css('overflow','hidden').width(); + var h = $cont.height(); + opts.before.push(function(curr, next, opts) { + $.fn.cycle.commonReset(curr,next,opts); + opts.cssAfter.display = ''; + if (d == 'right') + opts.cssBefore.left = -w; + else if (d == 'up') + opts.cssBefore.top = h; + else if (d == 'down') + opts.cssBefore.top = -h; + else + opts.cssBefore.left = w; + }); + opts.animIn.left = 0; + opts.animIn.top = 0; + opts.cssBefore.top = 0; + opts.cssBefore.left = 0; +}; + +// uncover - curr slide moves off next slide +$.fn.cycle.transitions.uncover = function($cont, $slides, opts) { + var d = opts.direction || 'left'; + var w = $cont.css('overflow','hidden').width(); + var h = $cont.height(); + opts.before.push(function(curr, next, opts) { + $.fn.cycle.commonReset(curr,next,opts,true,true,true); + if (d == 'right') + opts.animOut.left = w; + else if (d == 'up') + opts.animOut.top = -h; + else if (d == 'down') + opts.animOut.top = h; + else + opts.animOut.left = -w; + }); + opts.animIn.left = 0; + opts.animIn.top = 0; + opts.cssBefore.top = 0; + opts.cssBefore.left = 0; +}; + +// toss - move top slide and fade away +$.fn.cycle.transitions.toss = function($cont, $slides, opts) { + var w = $cont.css('overflow','visible').width(); + var h = $cont.height(); + opts.before.push(function(curr, next, opts) { + $.fn.cycle.commonReset(curr,next,opts,true,true,true); + // provide default toss settings if animOut not provided + if (!opts.animOut.left && !opts.animOut.top) + $.extend(opts.animOut, { left: w*2, top: -h/2, opacity: 0 }); + else + opts.animOut.opacity = 0; + }); + opts.cssBefore.left = 0; + opts.cssBefore.top = 0; + opts.animIn.left = 0; +}; + +// wipe - clip animation +$.fn.cycle.transitions.wipe = function($cont, $slides, opts) { + var w = $cont.css('overflow','hidden').width(); + var h = $cont.height(); + opts.cssBefore = opts.cssBefore || {}; + var clip; + if (opts.clip) { + if (/l2r/.test(opts.clip)) + clip = 'rect(0px 0px '+h+'px 0px)'; + else if (/r2l/.test(opts.clip)) + clip = 'rect(0px '+w+'px '+h+'px '+w+'px)'; + else if (/t2b/.test(opts.clip)) + clip = 'rect(0px '+w+'px 0px 0px)'; + else if (/b2t/.test(opts.clip)) + clip = 'rect('+h+'px '+w+'px '+h+'px 0px)'; + else if (/zoom/.test(opts.clip)) { + var top = parseInt(h/2,10); + var left = parseInt(w/2,10); + clip = 'rect('+top+'px '+left+'px '+top+'px '+left+'px)'; + } + } + + opts.cssBefore.clip = opts.cssBefore.clip || clip || 'rect(0px 0px 0px 0px)'; + + var d = opts.cssBefore.clip.match(/(\d+)/g); + var t = parseInt(d[0],10), r = parseInt(d[1],10), b = parseInt(d[2],10), l = parseInt(d[3],10); + + opts.before.push(function(curr, next, opts) { + if (curr == next) return; + var $curr = $(curr), $next = $(next); + $.fn.cycle.commonReset(curr,next,opts,true,true,false); + opts.cssAfter.display = 'block'; + + var step = 1, count = parseInt((opts.speedIn / 13),10) - 1; + (function f() { + var tt = t ? t - parseInt(step * (t/count),10) : 0; + var ll = l ? l - parseInt(step * (l/count),10) : 0; + var bb = b < h ? b + parseInt(step * ((h-b)/count || 1),10) : h; + var rr = r < w ? r + parseInt(step * ((w-r)/count || 1),10) : w; + $next.css({ clip: 'rect('+tt+'px '+rr+'px '+bb+'px '+ll+'px)' }); + (step++ <= count) ? setTimeout(f, 13) : $curr.css('display', 'none'); + })(); + }); + $.extend(opts.cssBefore, { display: 'block', opacity: 1, top: 0, left: 0 }); + opts.animIn = { left: 0 }; + opts.animOut = { left: 0 }; +}; + +})(jQuery); \ No newline at end of file diff --git a/app/assets/javascripts/gallery.js b/app/assets/javascripts/gallery.js new file mode 100644 index 0000000..4ab5ac5 --- /dev/null +++ b/app/assets/javascripts/gallery.js @@ -0,0 +1,267 @@ +!function ($) { + $.fn.checkListLength = function (param){ + _defaultSettings = { + onlyOne: null, + }; + _set = $.extend(_defaultSettings, param); + $this = this; + $li = this.children('li'); + $dropzone = $('#dropzone'); + if(($li.length - _set.onlyOne) == 0) { + $('#dropzone').fadeIn(300); + } else { + $('#dropzone').fadeOut(300); + }; + $('#file-list').nanoScroller({ scrollTop: 0, iOSNativeScrolling: true }); + } +}(window.jQuery); + +$(function () { + 'use strict'; + // Initialize the jQuery File Upload widget: + if($('#fileupload').length){ + $('#fileupload').fileupload({ + maxFileSize: 5000000, + acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i, + dropZone: $('#dropzone'), + headers:{ + 'X-CSRF-Token': $('meta[name="csrf-token"]').attr("content") + } + }); + } +}); + +$(function() { + var $container = $('.gallery'), + $containerData = $container.data(); + $container.imagesLoaded(function(){ + var $albumname = $('.albumname'), + $img = $('.rgalbum img'); + $('.rgalbum > a').rsImg(); + if($containerData.galleryId == 'gallery') { + $container.masonry({ + itemSelector : '.rgalbum', + isAnimated: true, + }); + $albumname.each(function(i) { + var $albumblock = $(this).closest('a').height(), + $H = $(this).outerHeight(true); + if($H > $albumblock) { + $(this).css({ + 'bottom': "auto", + 'top': 0, + }); + $(this).hover(function() { + $(this).stop(true, true).delay(500).animate({ + 'top': '-='+($H-$albumblock), + },($H-$albumblock)*10) + },function() { + $(this).stop(true, true); + $(this).css({ + 'bottom': "auto", + 'top': 0, + }); + }); + }; + }); + $('#orbit_gallery').delegate('.icons-tag', clickEvent, function(){ + $(this).parents('.gallery_info').nextAll('.albumtag').slideToggle(300, function() { + $container.masonry({ + itemSelector : '.rgalbum', + isAnimated: true, + }); + }); + }); + }; + }); + + var bindEvent = function(instance,elem){ + var $e = elem, + image_id = $e.closest(".rgalbum").data("image-id"); + obj = photosData.galleries.filter(function(a) { + return a.id == image_id; + })[0]; + switch($e.attr("for")){ + case "description": + if(obj.description){ + instance.find("textarea").each(function(){ + if(obj.description[$(this).attr("for")]) + $(this).val(obj.description[$(this).attr("for")]); + }) + + } + instance.find("input[type=hidden]").val(image_id); + instance.find("form").bind("ajax:success",function(evt, data, status){ + $.pageslide.close(); + photosData = data; + }) + break; + case "tags": + instance.find('.tags-groups').cardCheck({ + item: '.card' + }); + for(i = 0; i < obj.tags.length; i++){ + instance.find("input[value="+obj.tags[i]+"]").parent().addClass('active'); + instance.find("input[value="+obj.tags[i]+"]").prop("checked","checked"); + } + instance.find("form").submit(function(event) { + var checkboxes = $(this).find("input[type=checkbox]:checked"), + tag_ids = [], + image_ids =[image_id]; + + checkboxes.each(function(){ + tag_ids.push($(this).val()); + }) + + $.post("/admin/galleries/image_tagging",{"image_ids":image_ids,"tag_ids":tag_ids},function(json){ + $.pageslide.close(); + photosData = json; + }) + return false; + }); + break; + case "batch": + instance.find('.tags-groups').cardCheck({ + item: '.card' + }); + instance.find("form").submit(function(event) { + var checkboxes = $(this).find("input[type=checkbox]:checked"), + tag_ids = [], + image_ids =[], + images = $("#imgholder .rgalbum.active"); + checkboxes.each(function(){ + tag_ids.push($(this).val()); + }) + images.each(function(){ + image_ids.push($(this).data("image-id")); + }) + $.post("/admin/galleries/image_tagging",{"image_ids":image_ids,"tag_ids":tag_ids},function(json){ + $.pageslide.close(); + photosData = json; + }) + return false; + }); + break; + } + } + + var photosData = null; + if($("#imgholder").length){ + $.getJSON(window.location.pathname, function(json, textStatus) { + photosData = json; + $('.open').pageslide({ + loadComplete: function(instance,elem) { + bindEvent(instance,elem); + } + }) + }); + } + + + + $("#imgholder").on(clickEvent, '.photo_cover', function(event) { + var image_id = $(this).closest(".rgalbum").data("image-id"), + album_id = $("#imgholder").data("gallery-id"), + set_cover = true; + if($(this).children().hasClass("icons-star-2")){ + $(".icons-star").removeClass("icons-star").addClass('icons-star-2'); + $(this).children().removeClass("icons-star-2").addClass("icons-star"); + }else{ + $(this).children().removeClass("icons-star").addClass("icons-star-2"); + set_cover = false; + } + $.post("/admin/galleries/set_cover",{"album_id":album_id,"image_id":image_id,"set_cover":set_cover}); + + }); + + $("#delete_selected_photos_btn").click(function(){ + var photos_to_delete = [], + delete_cover = false, + $photos = $(".rgalbum.active"), + album_id = $("#imgholder").data("gallery-id"); + $('.modal-body .spinning').fadeIn('fast'); + $('.modal-body .text-warning').hide(0); + $photos.each(function(){ + photos_to_delete.push($(this).data('image-id')); + if ($(this).find(".icons-star").length) { + delete_cover = true; + }; + }); + $.ajax({ + url : "/admin/galleries/delete_photos", + type : "POST", + data : {"images":photos_to_delete,"delete_cover":delete_cover,"album_id":album_id}, + success : function(){ + $photos.slideUp(300,function() { + $(this).remove(); + }); + $('#dialog').modal('hide'); + $('.modal-body .spinning').hide(); + $('.modal-body .text-warning').show(); + $('.deletephoto, .deselect, .addtags').addClass('hide') + } + }); + }) + + $('#imgholder').on(clickEvent, '.checkbox', function() { + $(this).prop('checked') ? $(this).closest('.rgalbum').addClass('active') : $(this).closest('.rgalbum').removeClass('active'); + var checkLength = $("#imgholder .rgalbum.active"); + checkLength.length ? $('.deletephoto, .deselect, .addtags').removeClass('hide') : $('.deletephoto, .deselect, .addtags').addClass('hide'); + }); + $('.deselect').on(clickEvent, function(event) { + $('.rgalbum').removeClass('active'); + $('.checkbox').prop('checked', false) + $('.deletephoto, .deselect, .addtags').addClass('hide') + event.preventDefault(); + }); + $('.phtot-action').delegate('li', clickEvent, function(event) { + $('.checkbox').prop('checked', false) + $('.rgalbum').removeClass('active'); + $('.deletephoto, .deselect, .addtags').removeClass('hide') + }); + + // + $('.add-imgs').on({ + click: function() { + $('#fileupload').slideToggle(300, function() { + if(!$(this).is(':hidden')) { + $('.add-imgs').html(' Close panel'); + $('.rgbody').stop(true, false).animate({'padding-bottom': 280}, 300); + } else { + $('.add-imgs').html(' Add Image'); + $('.files').empty() + $('#file-list').checkListLength(); + $('.rgbody').stop(true, false).animate({'padding-bottom': 0}, 300); + fetchNewImages(); + }; + }); + return false; + } + }); + var fetchNewImages = function(){ + var lastid = ( $("li.rgalbum:last").length ? $("li.rgalbum:last").data("image-id") : null), + albumid = $("#fileupload_aid").val(); + + $.getJSON(window.location.pathname, function(json, textStatus) { + photosData = json; + }); + + $.ajax({ + url : "/admin/new_images", + data : {"last_image_id" : lastid, "album_id" : albumid}, + success : function(data){ + var $e = $(data); + $imgs = $e.find("img"); + $("#imgholder").append($e); + $os = $e.find("a.open"); + $os.pageslide({ + loadComplete: function(instance,elem) { + bindEvent(instance,elem); + } + }); + } + }) + + } +}); + diff --git a/app/assets/javascripts/galleryAPI.js.erb b/app/assets/javascripts/galleryAPI.js.erb new file mode 100644 index 0000000..d52e08b --- /dev/null +++ b/app/assets/javascripts/galleryAPI.js.erb @@ -0,0 +1,278 @@ +<%# encoding: utf-8 %> +$.extend($.expr[':'], { + 'containsi': function (elem, i, match, array) { + return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0; + } +}); +var galleryAPI = function(){ + g = this; + this.urlVars = rcom.getUrlVars(); + this.albumArea = $("#orbit_gallery"); + this.loadArea = null; + this.tagList = $("ul#gallery_tag_list"); + this.loading = $("#loading"); + + this.loadTheater = function(id){ + + g.loadstart(); + var imageArray; + var imagecount = 0; + var picHeight = 0; + var bindHandlers = function(){ + var $slidelist = $('.slidelist'), + $rslide = $('.rslide'), + $rslidenav = $('.rslidenav'), + $img = $("#main_pic img"), + wHeight = $(window).height(); + + $("#main_pic").height(picHeight); + $img.height("100%"); + + $('.bt-tag').click(function(){ + if(!$(this).hasClass("active")) + updatePhotoTag(); + $(this).toggleClass("active"); + var $tag_panel = $('#tag_panel'), + tag_panel_position = 0; + + if( $tag_panel.css('right') == '0px' ){ + tag_panel_position = -200; + } + $tag_panel.animate({'right':tag_panel_position}, 300); + + g.albumArea + .delay(200) + .animate({'margin-right':tag_panel_position+200},300); + return false; + }); + var updatePhotoTag = function(){ + var tags = imageArray[imagecount].tag_ids; + if(tags.length > 0 && g.tagList.find("li").length == 0){ + var tagnames = imageArray[imagecount].tag_names; + g.tagList.empty(); + for(i in tagnames){ + $li = $("
  • "+tagnames[i]+"
  • "); + g.tagList.append($li); + } + }else if(tags.length > 0 && g.tagList.find("li").length > 0) { + g.tagList.find("input").attr("checked",false); + for(tag in tags){ + g.tagList.find("li[data-content="+tags[tag]+"] input").attr("checked",true); + } + }else if(tags.length == 0){ + if(g.tagList.find("input").length == 0) + g.tagList.empty(); + else + g.tagList.find("input").attr("checked",false); + } + } + g.albumArea.find("#tag_search_box").keyup(function(e){ + sval = $(this).val(); + if(sval == "<%= I18n.t('gallery.search_tags') %>") + sval = ""; + sval = sval.replace(/(^\s*)|(\s*$)/g,''); + if(sval){ + var re1 = new RegExp("^[\u4E00-\uFA29]*$"); //Chinese character range + var re2 = new RegExp("^[\uE7C7-\uE7F3]*$"); + if ((re1.test(sval) && (re2.test(sval)))){ + $("#gallery_tag_list li span:not(:contains("+sval+"))").parent().slideUp(); + }else{ + $("#gallery_tag_list li span:not(:containsi("+sval+"))").parent().slideUp(); + } + + }else{ + $("#gallery_tag_list li").slideDown(); + } + }) + g.albumArea.find("#tag_panel .bt-save").click(function(){ + g.saveTags(imageArray[imagecount]._id,"pic",function(tagids){ + imageArray[imagecount].tag_ids = tagids; + }) + }) + $(".slidectrl a.togglelist").click(function(){ + var rslide_h = $rslide.outerHeight(); + if ( $slidelist.height() < 1 ){ + $slidelist.stop().animate({'height':rslide_h - 30}, 300); + $slidelist.find("ul").show(); + } else { + $slidelist.stop().animate({'height':'0px'}, 300); + $slidelist.find("ul").hide(); + } + }) + $(".slidectrl .togglescreen").click(function(){ + toggleFullscreen(); + }) + $(".slidectrl .browserfullscreen").click(function(){ + browserFullScreen(); + }) + $slidelist.find(".list_element").click(function(){ + imagecount = parseInt($(this).parent().attr("for")); + changeImage($(this)); + }) + $rslidenav.find(".navN").click(function(){ + nextpic($(this)); + }) + $rslidenav.find("a.navP").click(function(){ + prevpic($(this)); + }) + $("#nextpic").click(function(){ + nextpic($(this)); + }) + + $(document).keydown(function(e){ + if (e.keyCode == 37){ + prevpic($rslidenav.find(".navP")); + return false; + } + if(e.keyCode == 39){ + nextpic($rslidenav.find(".navN")); + return false; + } + if(e.keyCode == 27){ + toggleFullscreen(); + $rslide.removeClass('browserFullScreen'); + return false; + } + if(e.keyCode == 70 || e.keyCode == 102){ + if($rslide.hasClass("fullscreen")) + browserFullScreen(); + } + }); + var browserFullScreen = function(){ + var el = document.documentElement, + rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen; + rfs.call(el); + } + $(window).resize(function(){ + if(window.innerWidth == screen.width && window.innerHeight == screen.height) { + $rslide.addClass('browserFullScreen'); + } else { + $rslide.removeClass('browserFullScreen'); + } + }) + var nextpic = function(dom){ + if(imagecount == imageArray.length - 1) + imagecount = 0; + else + imagecount++; + changeImage(dom); + } + var prevpic = function(dom){ + if(imagecount == 0) + imagecount = imageArray.length - 1 + else + imagecount--; + changeImage(dom); + } + var toggleFullscreen = function(){ + if($rslide.hasClass("fullscreen")){ + $rslide.css("position","relative"); + $rslide.removeClass("fullscreen"); + $(".slidectrl .browserfullscreen").hide(); + $img.css({"padding":""}) + $("#main_pic").height(picHeight ); + }else{ + $("#main_pic").height(wHeight); + // $img.height("100%"); + $rslide.css("position",""); + $rslide.addClass("fullscreen"); + $img.css({"padding":($rslide.height()-$img.height())/2}) + $(".slidectrl .browserfullscreen").show(); + } + } + var changeImage = function(dom){ + var pageurl = dom.attr('href'); + + $img.fadeOut(200,function(){ + g.loadstart(); + $img.attr("src",""); + $img.attr({"src":dom.attr("data-content"),"height":picHeight+"px"}).load(function(){ + $img.fadeIn(200); + g.loadcomplete(); + }); + + + if($rslide.hasClass("fullscreen")){ + $img.css({"padding":($rslide.height()-$img.height())/2}) + } + $slidelist.stop().animate({'height':'0px'}, 300); + $slidelist.find("ul").hide(); + if(rcom.getInternetExplorerVersion() == -1){ + if(pageurl!=window.location){ + window.history.pushState({path:pageurl},'',pageurl); + } + }else{ + window.location.hash = pageurl; + } + // $(".slideinfo b.info").text(imageArray[imagecount].title); + if($('.bt-tag').hasClass("active")) + updatePhotoTag(); + if(imageArray[imagecount].description) + $(".slideinfo .info").text(imageArray[imagecount].description); + else + $(".slideinfo .info").text(""); + if(imageArray.length > 1) + updateNavigation(); + }) + + } + var updateNavigation = function(){ + var next, prev; + if(imagecount == 0){ + next = 1; + prev = imageArray.length - 1; + }else if(imagecount == imageArray.length - 1){ + next = 0 + prev = imageArray.length - 2; + }else{ + next = imagecount + 1; + prev = imagecount - 1; + } + $(".navN").attr({"href":imageArray[next]._id,"data-content":imageArray[next].file.theater.url}); + $(".navP").attr({"href":imageArray[prev]._id,"data-content":imageArray[prev].file.theater.url}); + }; + if(imageArray.length > 1) + updateNavigation(); + } + + var preparestage = function(albumid){ + $.getJSON("../galleries/"+albumid+"/imgs",function(album){ + imageArray = eval(album.images); + $.each(album.images,function(i,image){ + if(image._id == id) + imagecount = i; + }) + bindHandlers(); + }) + } + + if(rcom.getInternetExplorerVersion()!=-1){ + var photo_id = window.location.hash.replace("#",""); + if(photo_id){ + var url = window.location.href; + var params = url.split("/"); + // params[params.length-1] = photo_id; + url = url.replace(params[params.length-1],photo_id); + + window.location.href = url; + } + } + + var albumid = $("#main_pic").attr("data-content"); + g.albumArea.find(".bt-back").attr("href","../galleries/"+albumid); + g.albumArea.find(".bt-edit").attr("href","../albums/"+albumid+"/edit"); + g.albumArea.css("margin-bottom","0"); + picHeight = $(window).height() - ($("#orbit-bar").outerHeight() + $("#orbit_gallery .form-actions").outerHeight()); + preparestage(albumid); + + } + this.loadcomplete = function(){ + g.loading.hide(); + } + this.loadstart = function(){ + g.loading.show(); + } + +} + galleryAPI.prototype.locale = "<%= I18n.locale %>"; + diff --git a/app/assets/javascripts/galleryAPI_frontend.js.erb b/app/assets/javascripts/galleryAPI_frontend.js.erb new file mode 100644 index 0000000..91f1efa --- /dev/null +++ b/app/assets/javascripts/galleryAPI_frontend.js.erb @@ -0,0 +1,253 @@ +<%# encoding: utf-8 %> +$.extend($.expr[':'], { + 'containsi': function (elem, i, match, array) { + return (elem.textContent || elem.innerText || '').toLowerCase().indexOf((match[3] || "").toLowerCase()) >= 0; + } +}); +var galleryAPI = function(){ + g = this; + this.urlVars = rcom.getUrlVars(); + this.albumArea = $("#orbit_gallery"); + this.loadArea = "theater"; + this.tagList = $(".taglist ul"); + this.loading = $("#loading"); + // this.authenticated = false; + this.initialize = function(callbackFn){ + if(g.loadArea == "theater"){ + if(rcom.getInternetExplorerVersion()!=-1){ + var photo_id = window.location.hash.replace("#",""); + if(photo_id){ + var params = rcom.getUrlVars(); + var url = window.location.href.split("?")[0]; + params["image_id"] = photo_id; + for(i=0;i"+tags[tag].name+""); + } + + } + + + $(".slidectrl a.togglelist").click(function(){ + var rslide_h = $rslide.outerHeight(); + if ( $slidelist.height() < 1 ){ + $slidelist.stop().animate({'height':rslide_h - 30}, 300); + $slidelist.find("ul").show(); + } else { + $slidelist.stop().animate({'height':'0px'}, 300); + $slidelist.find("ul").hide(); + } + }) + $(".slidectrl .togglescreen").click(function(){ + toggleFullscreen(); + }) + $(".slidectrl .browserfullscreen").click(function(){ + browserFullScreen(); + }) + $slidelist.find(".list_element").click(function(){ + imagecount = parseInt($(this).parent().attr("for")); + changeImage($(this)); + }) + $rslidenav.find(".navN").click(function(){ + nextpic($(this)); + }) + $rslidenav.find("a.navP").click(function(){ + prevpic($(this)); + }) + $("#nextpic").click(function(){ + nextpic($(this)); + }) + + $(document).keydown(function(e){ + if (e.keyCode == 37){ + prevpic($rslidenav.find(".navP")); + return false; + } + if(e.keyCode == 39){ + nextpic($rslidenav.find(".navN")); + return false; + } + if(e.keyCode == 27){ + toggleFullscreen(); + $rslide.removeClass('browserFullScreen'); + return false; + } + if(e.keyCode == 70 || e.keyCode == 102){ + if($rslide.hasClass("fullscreen")) + browserFullScreen(); + } + }); + var browserFullScreen = function(){ + var el = document.documentElement, + rfs = el.requestFullScreen || el.webkitRequestFullScreen || el.mozRequestFullScreen; + rfs.call(el); + } + $(window).resize(function(){ + if(window.innerWidth == screen.width && window.innerHeight == screen.height) { + $rslide.addClass('browserFullScreen'); + } else { + $rslide.removeClass('browserFullScreen'); + } + }) + var nextpic = function(dom){ + if(imagecount == imageArray.length - 1) + imagecount = 0; + else + imagecount++; + changeImage(dom); + } + var prevpic = function(dom){ + if(imagecount == 0) + imagecount = imageArray.length - 1 + else + imagecount--; + changeImage(dom); + } + var toggleFullscreen = function(){ + if($rslide.hasClass("fullscreen")){ + $rslide.css("position","relative"); + $rslide.removeClass("fullscreen"); + $(".slidectrl .browserfullscreen").hide(); + $img.css({"padding":""}) + $("#main_pic").height("auto"); + }else{ + $("#main_pic").height(wHeight); + $img.css("height","auto"); + $rslide.css("position",""); + $rslide.addClass("fullscreen"); + $img.css({"padding":($rslide.height()-$img.height())/2}) + $(".slidectrl .browserfullscreen").show(); + } + } + var changeImage = function(dom){ + var pageurl = dom.attr('href'); + + $img.fadeOut(200,function(){ + g.loadstart(); + if($rslide.hasClass("fullscreen")){ + + $img.attr({"src":dom.attr("data-content")}).css("height","100%").load(function(){ + g.loadcomplete(); + $img.fadeIn(200); + }); + }else{ + $img.attr({"src":dom.attr("data-content")}).css("height","auto").load(function(){ + g.loadcomplete(); + $img.fadeIn(200); + });; + } + if($rslide.hasClass("fullscreen")){ + $img.css({"padding":($rslide.height()-$img.height())/2}) + } + $slidelist.stop().animate({'height':'0px'}, 300); + $slidelist.find("ul").hide(); + if(rcom.getInternetExplorerVersion() == -1){ + if(pageurl!=window.location){ + var segments = window.location.pathname.split("/"), + uid = segments[segments.length-1]; + pageurl = window.location.pathname.replace(uid,"-"+pageurl)+"?method=theater"; + window.history.pushState({path:pageurl},'',pageurl); + } + }else{ + window.location.hash = pageurl; + } + // $(".slideinfo b.info").text(imageArray[imagecount].title); + updatePhotoTag(); + if(imageArray[imagecount].description) + $(".slideinfo .info").text(imageArray[imagecount].description); + else + $(".slideinfo .info").text(""); + if(imageArray.length > 1) + updateNavigation(); + }) + + } + var updateNavigation = function(){ + var next, prev; + if(imagecount == 0){ + next = 1; + prev = imageArray.length - 1; + }else if(imagecount == imageArray.length - 1){ + next = 0 + prev = imageArray.length - 2; + }else{ + next = imagecount + 1; + prev = imagecount - 1; + } + $(".navN").attr({"href":imageArray[next]._id,"data-content":imageArray[next].file.theater.url}); + $(".navP").attr({"href":imageArray[prev]._id,"data-content":imageArray[prev].file.theater.url}); + }; + if(imageArray.length > 1) + updateNavigation(); + } + + var preparestage = function(albumid){ + $.getJSON("/admin/galleries/"+albumid+"/imgs", function(album){ + imageArray = eval(album.images); + $.each(album.images,function(i,image){ + if(image._id == id) + imagecount = i; + }) + bindHandlers(); + }) + } + // if(rcom.getInternetExplorerVersion()!=-1){ + // var url_constructor = window.location.href.split("/"); + // var url = ""; + // for(x=0;x<=url_constructor.length-1;x++){ + // if(x == url_constructor.length-1){ + // url+="#!/"+url_constructor[x]; + // }else{ + // url+=url_constructor[x]+"/"; + // } + // } + + // window.location.href = url; + // } + + var albumid = $("#main_pic").attr("data-content"); + g.albumArea.css("margin-bottom","0"); + // picHeight = $(window).height() - ($("#orbit-bar").outerHeight() + $("#orbit_gallery .form-actions").outerHeight()); + preparestage(albumid); + + } + this.loadcomplete = function(){ + g.loading.hide(); + } + this.loadstart = function(){ + g.loading.show(); + } + +} +galleryAPI.prototype.locale = "en"; diff --git a/app/assets/javascripts/gallery_old.js b/app/assets/javascripts/gallery_old.js new file mode 100644 index 0000000..a683941 --- /dev/null +++ b/app/assets/javascripts/gallery_old.js @@ -0,0 +1 @@ +//= require galleryAPI \ No newline at end of file diff --git a/app/assets/javascripts/jquery.lite.image.resize.js b/app/assets/javascripts/jquery.lite.image.resize.js new file mode 100644 index 0000000..27873c3 --- /dev/null +++ b/app/assets/javascripts/jquery.lite.image.resize.js @@ -0,0 +1,136 @@ +/* =================================================== + * jquery-lite-image-resize v.1.0.1 + * https://github.com/RayChang/jquery-lite-image-resize + * =================================================== + * How to use ? + * + * HTML element closest to the image to add class "resizeimg". + * + * Example: + *
    + * + *
    + * + * Or you can use: + * $('your class').rsImg(); + * + * Note : HTML structure must be a structure like the example above. + * +*/ + +!function ($) { + + "use strict"; + + var ResizeImg = function(element, elementLength, i) { + this.element = $(element); + this.element.data('exists', true); + this.elementLength = elementLength; + this.index = i; + }; + ResizeImg.prototype.resize = function(callback) { + var $img = this.element.children('img').eq(0), + elW = this.element.innerWidth(), + elH = this.element.innerHeight(), + elScale = elW/elH, + ell = this.elementLength, + index = this.index, + image = document.createElement("img"); + image.src = $img.attr('src'); + this.element.css({ + 'position': 'relative', + 'overflow': 'hidden', + }); + function imageLoadComplete() { + var imgW = image.width, + imgH = image.height, + imgScale = imgW/imgH, + portrait = { + 'position': 'absolute', + 'height': '100%', + 'width': 'auto', + 'max-width': 'none', + 'left': '50%', + 'top': 0, + 'margin-left': imgW*(elH/imgH)/-2 + }, + landscape = { + 'position': 'absolute', + 'height': 'auto', + 'max-height': 'none', + 'width': '100%', + 'left': 0, + 'top': '50%', + 'margin-top': imgH*(elW/imgW)/-2 + }, + center = { + 'position': 'absolute', + 'height': '100%', + 'width': '100%', + 'top': 0, + 'left': 0 + }; + if(imgScale < 1) { + if(elScale < 1) { + if(elScale > imgScale) { + $img.css(landscape); + } else { + $img.css(portrait); + }; + } else { + $img.css(landscape); + }; + }; + + if(imgScale > 1) { + if(elScale > 1) { + if(elScale > imgScale) { + $img.css(landscape); + } else { + $img.css(portrait); + }; + } else { + $img.css(portrait); + }; + }; + + if(imgScale == 1) { + if(elScale < 1) { + $img.css(portrait); + } else if(elScale > 1) { + $img.css(landscape); + } else { + $img.css(center); + }; + }; + $img.fadeTo(500, 1); + + if(index == ell && callback) { + ResizeImg.prototype.callback(callback) + } + } + if(/MSIE 8.0/g.test($ua)) { + imageLoadComplete(); + } else { + image.onload = imageLoadComplete; + } + }; + + ResizeImg.prototype.callback = function(callback) { + callback(); + }; + + $.fn.rsImg = function (callback) { + var elementLength = this.length - 1; + this.each(function (i) { + if(!$(this).data('exists')) { + $(this).children("img").fadeTo(0,0); + new ResizeImg(this, elementLength, i).resize(callback); + }; + }); + }; + + $(function() { + $('.resizeimg').rsImg(); + }); +}(window.jQuery); diff --git a/app/assets/javascripts/jquery.masonry.min.js b/app/assets/javascripts/jquery.masonry.min.js new file mode 100644 index 0000000..57c081c --- /dev/null +++ b/app/assets/javascripts/jquery.masonry.min.js @@ -0,0 +1,10 @@ +/** + * jQuery Masonry v2.1.08 + * A dynamic layout plugin for jQuery + * The flip-side of CSS Floats + * http://masonry.desandro.com + * + * Licensed under the MIT license. + * Copyright 2012 David DeSandro + */ +(function(e,t,n){"use strict";var r=t.event,i;r.special.smartresize={setup:function(){t(this).bind("resize",r.special.smartresize.handler)},teardown:function(){t(this).unbind("resize",r.special.smartresize.handler)},handler:function(e,t){var n=this,s=arguments;e.type="smartresize",i&&clearTimeout(i),i=setTimeout(function(){r.dispatch.apply(n,s)},t==="execAsap"?0:100)}},t.fn.smartresize=function(e){return e?this.bind("smartresize",e):this.trigger("smartresize",["execAsap"])},t.Mason=function(e,n){this.element=t(n),this._create(e),this._init()},t.Mason.settings={isResizable:!0,isAnimated:!1,animationOptions:{queue:!1,duration:500},gutterWidth:0,isRTL:!1,isFitWidth:!1,containerStyle:{position:"relative"}},t.Mason.prototype={_filterFindBricks:function(e){var t=this.options.itemSelector;return t?e.filter(t).add(e.find(t)):e},_getBricks:function(e){var t=this._filterFindBricks(e).css({position:"absolute"}).addClass("masonry-brick");return t},_create:function(n){this.options=t.extend(!0,{},t.Mason.settings,n),this.styleQueue=[];var r=this.element[0].style;this.originalStyle={height:r.height||""};var i=this.options.containerStyle;for(var s in i)this.originalStyle[s]=r[s]||"";this.element.css(i),this.horizontalDirection=this.options.isRTL?"right":"left";var o=this.element.css("padding-"+this.horizontalDirection),u=this.element.css("padding-top");this.offset={x:o?parseInt(o,10):0,y:u?parseInt(u,10):0},this.isFluid=this.options.columnWidth&&typeof this.options.columnWidth=="function";var a=this;setTimeout(function(){a.element.addClass("masonry")},0),this.options.isResizable&&t(e).bind("smartresize.masonry",function(){a.resize()}),this.reloadItems()},_init:function(e){this._getColumns(),this._reLayout(e)},option:function(e,n){t.isPlainObject(e)&&(this.options=t.extend(!0,this.options,e))},layout:function(e,t){for(var n=0,r=e.length;n"; + for(i=current_year;i>=year;i--){ + dthtml+=""; + } + dthtml+=" Date: Month: "; + dom.html(dthtml); +}, + +//loading overlay around a dom... +loadingWrapper : function(dom, display){ + if(display){ + dom.prepend("
    "); + $rss("#loading_wrapper").height(dom.height()); + $rss("#loading_wrapper").width(dom.width()); + }else{ + domId=dom.attr("id"); + $rss("#"+domId+" #loading_wrapper").remove(); + } + }, + +//validating a dom.... +validate : function(dom, validation, errormsg){ + var domValue = dom.val(); + var error = false; + var regex=""; + var msg = ""; + switch(validation){ + case "required": + if(domValue=="")error=true; + msg="Cannot be empty."; + break; + case "email": + regex=/^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/; + msg="Invalid Email Address."; + break; + case "number": + regex=/^\d*[0-9](|.\d*[0-9]|,\d*[0-9])?$/; + msg = "Only numbers are accepted."; + break; + case "alphanumeric": + regex=/^\s*[a-zA-Z0-9,\s]+\s*$/; + msg="Only numbers, alphabets and spaces are allowed."; + break; + } + domId=dom.attr("name"); + if(errormsg=="")errormsg=msg; + if(regex!="")if(!regex.test(domValue))error=true; + if(error){$rss("#"+domId+"_error").remove();dom.after(""+errormsg+"");return false;} else{ $rss("#"+domId+"_error").remove();return true;} + }, + +bindToSpinner : function(dom,data,callbackFn){ + var domId = dom.attr("id"); + var dhtml=""; + var spinnerValue=Array(); + var spinnerDisplay=Array(); + $rss.each(data,function(i,it){ + $rss.each(data[i],function(key,it){ + spinnerValue.push(it); + }); + }); + dhtml=""; + dom.html(dhtml); + if(typeof callbackFn=="function") + callbackFn.call(this, dhtml); + }, + + //binds the recieved json to a table +bindToTable : function(dom,data,headers,actions,css_class,callbackFn){ + if(!css_class)css_class=""; + var dhtml=""; + var domId = dom.attr("id"); + if(actions){ + var btnTitles=Array(); + var btnFunctions=Array(); + $rss.each(actions,function(title,func){ + btnTitles.push(title); + btnFunctions.push(func); + }); + rcom.translate(btnTitles,function(convertedData){ + btnTitles=convertedData.slice(); + + rcom.translate(headers,function(convertedData){ + headers=convertedData; + if(!data)return; + $rss.each(headers,function(i,head){ + dhtml+=""; + }); + dhtml+=""; + if(data.length==0)dhtml+=""; + $rss.each(data,function(i,item){ + var cl=""; + if(i%2!=0)cl="even"; + dhtml+=""; + $rss.each(item,function(i,it){ + if(i!="id"){ + if(it==null)it="Not Set"; + dhtml+=""; + } + }) + dhtml+=""; + dhtml+=""; + }); + dhtml+="
    "+head+"
    No Data
    "+it+""; + for(x=0;x"+btnTitles[x]+""; + } + dhtml+="
    "; + dom.html(dhtml); + }); + }); + }else{ + rcom.translate(headers,function(convertedData){ + headers=convertedData; + if(!data)return; + if(headers.length>0){ + $rss.each(headers,function(i,head){ + dhtml+=""+head+""; + }); + } + dhtml+=""; + if(data.length==0)dhtml+="No Data"; + + $rss.each(data,function(i,item){ + var cl=""; + if(i%2!=0)cl="even"; + dhtml+=""; + $rss.each(item,function(i,it){ + if(i!="id"){ + if(it==null)it="Not Set"; + dhtml+=""+it+""; + } + }) + dhtml+=""; + }); + dhtml+=""; + dom.html(dhtml); + }); + } + + if(typeof callbackFn=="function") + callbackFn.call(this, dhtml); +}, + //convert to date string which can be directly inserted in database or according to any format. +convertToInsertableDate : function(y,m,d,format){ + var dt=""; + if(m<10)m="0"+m; + if(d<10)d="0"+d; + switch(format){ + case "yyyy-mm-dd": + dt= y+"-"+m+"-"+d; + break; + case "dd-mm-yyyy": + dt= d+"-"+m+"-"+y; + break; + case "mm-dd-yyyy": + dt= m+"-"+d+"-"+y; + break; + default: + dt= y+"-"+m+"-"+d; + break; + } + return dt; + }, +//a fucntion to show specific divs and hide all other +showDoms : function(doms){ + $rss("body").find("div").each(function(){$rss(this).hide();}); + $rss.each(doms,function(i,dom){ + dom.show(); + }); + }, + +//a function to translate the word or array.. +translate : function(data,callbackFn){ + var cdata=""; + var status =true; + if(!data){ + if(typeof callbackFn=="function") + callbackFn.call(this,cdata); + status=false; + } + if(data==""){ + if(typeof callbackFn=="function") + callbackFn.call(this,cdata); + status=false; + } + if(status){ + $rss.getJSON("../../classes/translate.php", {fn:"translateThis",tData:data},function(convertedData){ + if(typeof callbackFn=="function") + callbackFn.call(this, convertedData); + }); + } + }, + +// a function to bind JSON to list +bindToList : function(dom,data,callbackFn){ + var domId = dom.attr("id"); + var dhtml=""; + var listValue=Array(); + var listDisplay=Array(); + $rss.each(data,function(i,it){ + $rss.each(data[i],function(key,it){ + listValue.push(it); + }); + }); + dhtml="
      "; + for(i=0,y=1,z=0;i"+listValue[y]+""; + } + dhtml+="
    "; + dom.html(dhtml); + if(typeof callbackFn=="function") + callbackFn.call(this,dhtml); + }, +makeDraggable : function(handler,dom){ + handler.css("position","absolute"); + dom.css("position","absolute"); + var puranix=0; + var nayeex=0; + var puraniy=0; + var nayeey=0; + var offset=""; + var zIndex=dom.css("z-index"); + handler.mousedown(function(e){ + puranix=e.clientX; + puraniy=e.clientY; + offset=dom.offset(); + $rss(this).mousemove(function(e){ + nayeex=e.clientX-puranix; + nayeex+=offset.left; + nayeey=e.clientY-puraniy; + nayeey+=offset.top; + dom.css({"left":nayeex+"px","top":nayeey+"px","z-index":"9999"}); + }) + }).mouseup(function(){ + $rss(this).unbind("mousemove"); + dom.css("z-index",zIndex); + }) + }, + +//automatically scrolls to the bottom of the div +scrollToBottom : function(dom){ + var domId = dom.attr("id"); +// var domScrollHeight = document.getElementById(domId).scrollHeight; + var obj = document.getElementById(domId); + + if((obj.scrollTop+100) >= (obj.scrollHeight - obj.offsetHeight)) + dom.scrollTop(obj.scrollHeight); + }, + +/*ajax loading of images... needs following settings +dom:in which images ve to be loaded +url:the server url for making ajax calls +limit:how many images to load +divClass:the class of div surrounding each image +nameClass:class for span showing name +fn:function to be called in on the server +imageSrc:the image source of all the images. +bindTo:to bind images to a onclick function or else will be binded to normal a tag. +urlKey:to specify the key of the value.. if bindTo is used, this will be neglected.. +returns json; +*/ +loadImages : function(settings,callbackFn){ + + var dom = settings.dom; + var domid= dom.attr("id"); + var temp_array=Array(); + var starting = $rss("#"+domid+" img:last").attr("id"); + if(typeof starting != 'undefined'){ + starting = starting.substr(4,starting.length-1); + }else{starting = 0}; + var temp_var=""; + var json = ""; + var dhtml=""; + var extraparam=""; + if(typeof settings.extraParam != "undefined"){ + extraparam = settings.extraParam; + } + $rss.getJSON(settings.url,{fn:settings.fn,id:settings.whereId,limit:settings.limit,start:starting,extra:extraparam},function(images){ + json = eval(images); + $rss.each(images,function(i,pic){ + var temp_array=Array(); + var a_var=Array(); + var name_var=""; + var title=""; + $rss.each(pic,function(i,value){ + temp_array.push(value); + }) + if(temp_array.length>=4){ + name_var=""+temp_array[3]+"" + } + if(temp_array[2]==null) + title = ""; + else + title = temp_array[2]; + if(typeof settings.bindTo!="undefined"){ + a_var[1]="onclick='"+settings.bindTo+"("+temp_array[0]+");return false;'"; + a_var[0]=""; + }else{a_var[0]='?'+settings.urlKey+'='+temp_array[0];a_var[1]="";} + dhtml="
    "+name_var; + dom.delay(100).append(dhtml); + $rss("#pic_"+pic.id).delay(100).fadeIn(200); + + }) + if(typeof callbackFn=="function") + callbackFn.call(this,json); + }) + + + }, + +//function to get url variables... +getUrlVars : function(){ + var vars = [], hash; + var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); + for(var i = 0; i < hashes.length; i++){ + hash = hashes[i].split('='); + vars.push(hash[0]); + vars[hash[0]] = hash[1]; + } + if(vars[0] == window.location.href){ + vars =[]; + } + return vars; +}, +/*function to open a modalwindow on a page.. self reliant no images, no css needed. +settings + +width:in percentage or pixcel +height:in percentage or pixcel +closeBtn:true or false +envClose:closing through background click, true or flase +loadDiv:load html from a div +loadPage:load a page +loadHtml: load html + +*/ +modalWindow : function(settings,callbackFn){ + + var envClose = settings.envClose; + var dhtml=""; + if(typeof envClose == "undefined") + envClose = true; + var closeBtn = settings.closeBtn; + if(typeof closeBtn == "undefined") + closeBtn = true; + + var rgmaskHeight = $rss(window).height(); + var rgmaskWidth = $rss(window).width(); + var tempheight = settings.height; + var tempwidth = settings.width; + + var maxheight = (rgmaskHeight*85)/100; + var maxwidth = (rgmaskWidth*85)/100; + + if(typeof tempheight!="undefined"){ + tempheight = tempheight.toString(); + if(tempheight.charAt(tempheight.length-1)=='%') + tempheight=(rgmaskHeight*parseInt(tempheight.substr(0,tempheight.length)))/100; + if(tempheight>maxheight) + tempheight=maxheight; + }else{tempheight="auto";} + if(typeof tempwidth!="undefined"){ + tempwidth = tempwidth.toString(); + if(tempwidth.charAt(tempwidth.length-1)=='%') + tempwidth=(rgmaskWidth*parseInt(tempwidth.substr(0,tempwidth.length)))/100; + if(tempwidth>maxwidth) + tempwidth=maxwidth; + }else{tempwidth="auto";} + $rss("body").append('
    '); + $rss("#rgsheath").css({background: "#000", width: "100%", position: "fixed", top: 0, left: 0,opacity:0.5,'z-index':199}); + $rss("body").append('
    '); + $rss("#rgWindow").css({"position": "fixed", "z-index": "999", "background": "#fff", "border": "solid 1px #ccc", "padding": "10px", "border-radius": "5px", "-webkit-border-radius": "5px", "-moz-border-radius": "5px", "-ms-border-radius": "5px", "box-shadow": "0 0 20px rgba(0,0,0,0.7)","-webkit-box-shadow": "0 0 20px rgba(0,0,0,0.7)","-moz-box-shadow": "0 0 20px rgba(0,0,0,0.7)","-ms-box-shadow": "0 0 20px rgba(0,0,0,0.7)"}); + var rgWTop = (rgmaskHeight-20)/2; + var rgWLeft = (rgmaskWidth-20)/2; + $rss("#rgWindow").css({top:rgWTop+"px", left:rgWLeft+"px"}); + if(typeof settings.loadDiv!="undefined"){ + dhtml = $rss(settings.loadDiv).html(); + $rss("#rgWindow").html(dhtml).hide(); + prepareWindow(); + } + if(typeof settings.loadHtml!="undefined"){ + dhtml = settings.loadHtml; + $rss("#rgWindow").html(dhtml).hide(); + prepareWindow(); + } + if(typeof settings.loadPage!="undefined"){ + $rss("#rgWindow").load(settings.loadPage,function(){$rss(this).hide();dhtml=$rss(this).html();prepareWindow();}); + } + function prepareWindow(){ + if(tempheight!="auto") + rgWTop = (rgmaskHeight-tempheight)/2; + else{ + tempheight=$rss("#rgWindow").height()+30; + if(tempheight>maxheight) + tempheight=maxheight; + rgWTop=(rgmaskHeight-tempheight)/2; + } + if(tempwidth!="auto") + rgWLeft = (rgmaskWidth-tempwidth)/2; + else{ + tempwidth=$rss("#rgWindow").width(); + if(tempwidth>maxwidth) + tempwidth=maxwidth; + rgWLeft=(rgmaskWidth-tempwidth)/2; + } + tempwidth=parseInt(tempwidth)+25; + $rss("#rgWindow").empty().show(); + var closebtn = ""; + if(closeBtn) + closebtn='X'; + $rss("#rgWindow").animate({"width":tempwidth+"px","height":tempheight+"px",top:rgWTop+"px", left:rgWLeft+"px"},500,function(){$rss("#rgWindow").html(closebtn+"
    "+dhtml+"
    "); + $rss("#close_modal").mouseover(function(){$rss(this).css("color","#999");}).mouseout(function(){$rss(this).css("color","#666");}) + $rss("#close_modal").click(function(){rcom.modalWindowClose(); return false;}) + if(envClose) + $rss("#rgsheath").click(function(){ + rcom.modalWindowClose(); + }) + $rss(document).one("keydown",function(e){ + if (e.keyCode == 27){ + rcom.modalWindowClose(); + return false; + } + }) + + if(typeof callbackFn=="function") + callbackFn.call(this,$rss("#rgWindow")); + }); + } +}, +modalWindowUpdate : function(settings,callbackFn){ + var rgmaskHeight = $rss(window).height(); + var rgmaskWidth = $rss(window).width(); + var tempheight = settings.height; + var tempwidth = settings.width; + var dhtml = ""; + var maxheight = (rgmaskHeight*85)/100; + var maxwidth = (rgmaskWidth*85)/100; + if(typeof tempheight!="undefined"){ + tempheight = tempheight.toString(); + if(tempheight.charAt(tempheight.length-1)=='%') + tempheight=(rgmaskHeight*parseInt(tempheight.substr(0,tempheight.length)))/100; + if(tempheight>maxheight) + tempheight=maxheight; + }else{tempheight="auto";} + if(typeof tempwidth!="undefined"){ + tempwidth = tempwidth.toString(); + if(tempwidth.charAt(tempwidth.length-1)=='%') + tempwidth=(rgmaskWidth*parseInt(tempwidth.substr(0,tempwidth.length)))/100; + if(tempwidth>maxwidth) + tempwidth=maxwidth; + }else{tempwidth="auto";}; + $rss("body").append("
    "); + + if(typeof settings.loadDiv!="undefined"){ + dhtml = $rss("#"+settings.loadDiv).html(); + $rss("#rgwindow_temp_div").html(dhtml).hide(); + prepareWindow(); + } + if(typeof settings.loadHtml!="undefined"){ + dhtml = settings.loadHtml; + $rss("#rgwindow_temp_div").html(dhtml).hide(); + prepareWindow(); + } + if(typeof settings.loadPage!="undefined"){ + $rss("#rgwindow_temp_div").load(settings.loadPage,function(){$rss(this).hide();dhtml=$rss(this).html();prepareWindow();}); + } + function prepareWindow(){ + if(tempheight!="auto") + rgWTop = (rgmaskHeight-tempheight)/2; + else{ + tempheight=$rss("#rgwindow_temp_div").height()+30; + if(tempheight>maxheight) + tempheight=maxheight; + rgWTop=(rgmaskHeight-tempheight)/2; + } + if(tempwidth!="auto") + rgWLeft = (rgmaskWidth-tempwidth)/2; + else{ + tempwidth=$rss("#rgwindow_temp_div").width(); + if(tempwidth>maxwidth) + tempwidth=maxwidth; + rgWLeft=(rgmaskWidth-tempwidth)/2; + } + tempwidth=parseInt(tempwidth)+25; + $rss("#rgContent").empty(); + $rss("#rgWindow").animate({"width":tempwidth+"px","height":tempheight+"px",top:rgWTop+"px", left:rgWLeft+"px"},500,function(){$rss("#rgContent").css("height",tempheight+"px").html(dhtml)}); + $rss("#rgwindow_temp_div").remove(); + } +}, +modalWindowClose : function(callbackFn){ + if($rss("#rgWindow").length>0){ + $rss("#rgWindow").empty(); + var rgmaskHeight = $rss(window).height(); + var rgmaskWidth = $rss(window).width(); + var x = (rgmaskHeight-20)/2; + var y = (rgmaskWidth-20)/2 + $rss("#rgWindow").animate({top:x+"px", left:y+"px","width":"50px","height":"50px"},300,function(){$rss(this).fadeOut(100).remove();$rss("#rgsheath").fadeOut(500).remove();}) + } + if(typeof callbackFn=="function") + callbackFn.call(this,"harry"); +}, +bindDomToHead : function(dom){ + var gc = dom.css("background"); + var t = dom.offset(); + var gw = dom.width(); + $rss(window).scroll(function(){ + var wt = $rss(window).scrollTop(); + if ( wt > t.top ) { + var cssObj = { + 'position':'fixed', + 'top':0, + 'width':gw, + 'background':gc, + 'box-shadow':'0 1px 0 rgba(0,0,0,0.2)', + 'z-index':99 + } + dom.css(cssObj); + } else { + dom.attr('style',""); + } + }); +}, +progressBar : function(dom,settings){ + var domid = dom.prop("id"); + if($rss("#rss_progressbar_div_"+domid).length==0){ + if(typeof settings.top == "undefined") + settings.value = 1; + if(typeof settings.top == "undefined") + settings.top = (dom.height()-12)/2; + dom.append(""); + $rss("#rss_progressbar_div_"+domid).fadeIn(500); + } +}, +progressBarValue : function(dom,value){ + var domid = dom.prop("id"); + if($rss("#rss_progressbar_div_"+domid).length==1){ + $rss("#rss_progressbar_"+domid).animate({"width":value+"%"},100); + + } +}, +progressBarClose : function(dom){ + var domid = dom.prop("id"); + $rss("#rss_progressbar_div_"+domid).fadeOut(500,function(){$(this).remove();}); +}, +getInternetExplorerVersion: function(){ + var rv = -1; // Return value assumes failure. + if (navigator.appName == 'Microsoft Internet Explorer') + { + var ua = navigator.userAgent; + var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); + if (re.exec(ua) != null) + rv = parseFloat( RegExp.$1 ); + } + return rv; + } +} +$ = jQuery.noConflict(); diff --git a/app/assets/javascripts/upload.js b/app/assets/javascripts/upload.js new file mode 100755 index 0000000..9ac09f2 --- /dev/null +++ b/app/assets/javascripts/upload.js @@ -0,0 +1,39 @@ +//https://github.com/blueimp/jQuery-File-Upload + +$(function () { + + 'use strict'; + // Initialize the jQuery File Upload widget: + $('#fileupload').fileupload({ + acceptFileTypes:/(\.|\/)(jpe?g|png)$/i, + headers:{ + 'X-CSRF-Token': $('meta[name="csrf-token"]').attr("content") + } + }); + $('#fileupload').bind("fileuploadadd",function(e,data){$(".fileupload-content").css("background-image","none");}) + // Load existing files: +/* $.getJSON($('#fileupload form').prop('action'),{albumid:pagevars['id']}, function (files) { + var fu = $('#fileupload').data('fileupload'); + fu._adjustMaxNumberOfFiles(-files.length); + fu._renderDownload(files) + .appendTo($('#fileupload .files')) + .fadeIn(function () { + // Fix for IE7 and lower: + $(this).show(); + }); + }); +*/ + // Open download dialogs via iframes, + // to prevent aborting current uploads: + $('#fileupload .files').delegate( + 'a:not([target^=_blank])', + 'click', + function (e) { + e.preventDefault(); + $('') + .prop('src', this.href) + .appendTo('body'); + } + ); + +}); \ No newline at end of file diff --git a/app/assets/stylesheets/admin/galleries.css b/app/assets/stylesheets/admin/galleries.css deleted file mode 100644 index afad32d..0000000 --- a/app/assets/stylesheets/admin/galleries.css +++ /dev/null @@ -1,4 +0,0 @@ -/* - Place all the styles related to the matching controller here. - They will automatically be included in application.css. -*/ diff --git a/app/assets/stylesheets/filter.css b/app/assets/stylesheets/filter.css new file mode 100644 index 0000000..6e76a70 --- /dev/null +++ b/app/assets/stylesheets/filter.css @@ -0,0 +1,84 @@ +/* Filter */ +#filter.open { + border-bottom: none; + padding-bottom: 10px; +} +#filter .filter-nav { + margin-bottom: 0px; +} +#filter.open .filter-nav { + margin-bottom: 10px; +} +#filter .filter-nav a { + text-decoration: none; +} +#filter .filter-nav .accordion-group { + border: none; +} +#filter .filter-nav .accordion-group.active { + background-color: #08c; + position: relative; +} +#filter .filter-nav .accordion-group.active a { + color: #FFF; +} +#filter .filter-nav .accordion-group.active:after { + display: block; + height: 0px; + width: 0px; + position: absolute; + bottom: -12px; + left: 50%; + margin-left: -5px; + content: ""; + border-style: solid; + border-width: 0 6px 6px 6px; + border-color: transparent transparent #e5e5e5 transparent; + z-index: 5 +} +#filter .filter-group { + clear: both; + border: none; + margin-bottom: 0px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + -o-border-radius: 4px; + border-radius: 4px; +} +#filter .filter-group .accordion-body { + background-color: #e5e5e5; + border-radius: 3px; +} +#filter .filter-group .accordion-body .filter-clear { + padding: 4px; + border-top: 1px solid #D5D5D5; + text-align: right; + -webkit-box-shadow: inset 0px 1px 0px #ECECEC; + -moz-box-shadow: inset 0px 1px 0px #ECECEC; + -o-box-shadow: inset 0px 1px 0px #ECECEC; + box-shadow: inset 0px 1px 0px #ECECEC; +} +#filter .filter-group .accordion-body .filter-clear a { + text-decoration: none; +} +#filter .filter-group .collapse.in { +} +#filter .filter-group .accordion-inner { + padding: 8px 8px 5px; + /*margin-top: 10px;*/ +} +#filter .filter-group .accordion-inner > .btn { + margin-bottom: 3px; +} + + +/* Responsive */ +@media (max-width: 480px) { + /* Filter */ + #filter .filter-nav { + float: left; + } + #filter .accordion-inner.pagination-right { + text-align: left; + } +} \ No newline at end of file diff --git a/app/assets/stylesheets/gallery.css b/app/assets/stylesheets/gallery.css new file mode 100644 index 0000000..7be5327 --- /dev/null +++ b/app/assets/stylesheets/gallery.css @@ -0,0 +1,521 @@ +#orbit_gallery { + margin: 0; + padding: 0 0 10px; + list-style: none; +} +#orbit_gallery .rgalbum { + margin: 5px; + padding: 10px; + width: 200px; + background: #FFFFFF; + -webkit-transition-property: left, right, top; + -moz-transition-property: left, right, top; + -ms-transition-property: left, right, top; + -o-transition-property: left, right, top; + transition-property: left, right, top; +} +#orbit_gallery .rgalbum:hover { + box-shadow: 0px 0px 5px rgba(0,0,0,.2); +} +#orbit_gallery .rgalbum > a { + position: relative; + display: block; + overflow: hidden; + margin: 0 0 10px; + width: 200px; + height: 200px; + -webkit-transition: all .2s linear; + -moz-transition: all .2s linear; + -o-transition: all .2s linear; + transition: all .2s linear; +} +#orbit_gallery .rgalbum a img { + max-width: none; +} +#orbit_gallery .rgalbum:hover a img { + -webkit-filter: blur(2px); +} +#orbit_gallery .rgalbum > a:after { + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + display: block; + margin: 0; + background-color: #000000; + opacity: .0; + -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; + filter: alpha(opacity=0); + -webkit-transition: all .2s linear; + -moz-transition: all .2s linear; + -o-transition: all .2s linear; + transition: all .2s linear; +} +#orbit_gallery .rgalbum:hover a:after { + opacity: .4; + -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=40)"; + filter: alpha(opacity=40); +} +#orbit_gallery .rgalbum a .albumname { + position: absolute; + bottom: 0; + margin: 0; + padding: 10px; + color: #F2F2F2; + text-shadow: 0px -1px 0 rgba(0,0,0,0.4); + letter-spacing: -0.5px; + font-size: 30px; + font-family: 'Playfair Display SC', sans-serif; + line-height: 28px; + z-index: 1; + opacity: .0; + -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; + filter: alpha(opacity=0); + -webkit-transition: all .2s linear; + -moz-transition: all .2s linear; + -o-transition: all .2s linear; + transition: all .2s linear; +} +#orbit_gallery .rgalbum:hover a .albumname { + opacity: 1; + -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + filter: alpha(opacity=100); + -webkit-transition: all .2s linear; + -moz-transition: all .2s linear; + -o-transition: all .2s linear; + transition: all .2s linear; +} +#orbit_gallery .rgalbum .gallery_info { + margin: 0; + list-style: none; +} +#orbit_gallery .rgalbum .gallery_info li { + display: inline-block; + float: left; + color: #777777; + font-size: 1.2em; + line-height: 20px; + cursor: pointer; +} +#orbit_gallery .rgalbum .gallery_info li > a { + display: inline-block; + margin-left: 5px; + color: #777777; +} +#orbit_gallery .rgalbum .gallery_info li:hover > a { + color: #E41B2B; + text-decoration: none; +} +#orbit_gallery .rgalbum .gallery_info li:hover { + color: #0088CC; +} +#orbit_gallery .rgalbum .gallery_info li .icons-tag { + margin-left: 3px; +} +#orbit_gallery .rgalbum .gallery_info li.albumcateg { + float: right; + overflow: hidden; + max-width: 125px; + text-align: right; + text-overflow: ellipsis; + white-space: nowrap; +} +#orbit_gallery .rgalbum .gallery_info li.view { + overflow: hidden; + max-width: 50px; + text-overflow: ellipsis; + white-space: nowrap; +} +#orbit_gallery .rgalbum .albumtag { + display: none; + overflow: hidden; + margin: 0; +} + + +/* Gallery Body */ +.rgbody .gallery-info { + padding: 0 5px; +} +.rgbody .gallery-info h3 { + margin: 5px 0 0; + color: #333; + text-shadow: 0 1px 0 #ffffff; + font-family: 'Playfair Display SC', sans-serif; +} +.rgbody .gallery-info .muted { + font-family: 'Raleway', sans-serif; +} + +#imgholder { + margin: 0; + padding: 0 0 10px; + list-style: none; +} +#imgholder .rgalbum { + position: relative; + float: left; + margin: 5px; + padding: 5px; + width: 200px; + background: #FFFFFF; + overflow: hidden; + -webkit-box-shadow: 0px 0px 5px rgba(0, 0, 0, .1); + -moz-box-shadow: 0px 0px 5px rgba(0, 0, 0, .1); + box-shadow: 0px 0px 5px rgba(0, 0, 0, .1); + -o-box-shadow: 0px 0px 5px rgba(0, 0, 0, .1); + -webkit-transition-property: left, right, top; + -moz-transition-property: left, right, top; + -ms-transition-property: left, right, top; + -o-transition-property: left, right, top; + transition-property: left, right, top; +} +#imgholder .rgalbum.active { + background-color: #51a351; +} +#imgholder .rgalbum.active-single { + background-color: #F89406; +} +#imgholder .rgalbum .photo-action { + margin: 0; + list-style: none; + left: 5px; + right: 5px; + height: 0; + position: absolute; + background-color: #FFF; + bottom: 5px; + opacity: .9; + -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=90)"; + filter: alpha(opacity=90); + -webkit-transition: all .2s linear; + -moz-transition: all .2s linear; + -o-transition: all .2s linear; + transition: all .2s linear; +} +#imgholder .rgalbum:hover .photo-action { + padding: 5px; + height: 30px; +} +#imgholder .rgalbum .photo-action li { + display: inline-block; + float: left; + color: #777; + font-size: 11px; + line-height: 30px; + cursor: pointer; + width: 33%; + text-align: center; + font-size: 1.2em; +} +#imgholder .rgalbum .photo-action a { + color: #777; + display: block; + text-decoration: none; + width: 100%; + height: 100%; +} +#imgholder .rgalbum .photo-action li:hover a { + color: #08C; +} +#imgholder .rgalbum .photo-action .icons-star { + color: #F8A900; + font-size: 1.4em; + line-height: 1.4em; +} +#imgholder .rgalbum a { + display: block; + overflow: hidden; + margin: 0; + width: 200px; + height: 200px; + -webkit-transition: all .2s linear; + -moz-transition: all .2s linear; + -o-transition: all .2s linear; + transition: all .2s linear; +} +#imgholder .rgalbum a img { + max-width: none; +} + +#imgholder .rgalbum .check { + position: absolute; + top: 0; + right: 0; + width: 40px; + height: 40px; +} +#imgholder .rgalbum .check:after { + font-family: FontAwesome; + font-weight: normal; + font-style: normal; + color: #F2F2F2; + text-decoration: inherit; + content: "\f00c"; + line-height: 25px; + text-indent: 20px; + font-size: 1.3em; + position: absolute; + top: 0; + right: 0; + width: 0px; + height: 0px; + border-style: solid; + border-width: 0 40px 40px 0; + border-color: transparent #FFF transparent transparent; +} +#imgholder .rgalbum.active .check:after { + color: #FFF; + border-color: transparent #51a351 transparent transparent; +} +#imgholder .rgalbum.active-single .check:after { + color: #FFF; + border-color: transparent #F89406 transparent transparent; +} +#imgholder .rgalbum input[type="checkbox"] { + position: absolute; + top: 0; + right: 0; + z-index: 3; + display: block; + margin: 0; + width: 100%; + height: 100%; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; + filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=0); + opacity: 0; +} + +/* Page Silde */ +#view-photo-tags .phtot-tags { + margin: 0; + padding: 0; + list-style: none; +} +#view-photo-tags .phtot-tags li { + margin: 0 5px 5px 0; + white-space: nowrap; +} + +/* Dialog */ +.modal-body { + min-height: 80px; + line-height: 80px; + text-align: center; +} +.modal-body .spinning { + display: none; + position: absolute; + width: 70px; + height: 70px; + top: 50%; + left: 50%; + margin: -35px 0 0 -35px; +} + +/* File Upload */ +#upload-panel { + clear: both; +} +#upload-panel iframe { + width: 100%; + border: none; +} +#fileupload { + position: relative; + display: none; + clear: both; + overflow: hidden; + margin: 40px 0 15px; + height: 254px; + border: 1px solid #d4d4d4; + border-radius: 4px; + background-color: #FDFDFD; + /*-webkit-box-shadow: 0px 0px 10px rgba(0, 0, 0, .15) inset; + box-shadow: 0px 0px 10px rgba(0, 0, 0, .15) inset;*/ +} +#fileupload table { + margin: 0; +} +#fileupload .fileupload-buttonbar .navbar { + margin-bottom: 0; +} +#fileupload .fileupload-buttonbar .navbar .add-photo { + border: none; + border-right: 1px solid #d4d4d4; + background-color: transparent; + padding: 10px 15px 10px; + color: #777777; + text-decoration: none; + text-shadow: 0 1px 0 #ffffff; +} +#fileupload .fileupload-buttonbar .navbar .add-photo:hover { + color: #333333; + text-decoration: none; + background-color: #EDEDED; +} +#fileupload .fileupload-buttonbar .navbar .fileinput-button { + position: relative; + overflow: hidden; +} +#fileupload .fileupload-buttonbar .navbar .fileinput-button input { + position: absolute; + top: 0; + right: 0; + margin: 0; + font-size: 23px; + opacity: 0; + -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; + filter: alpha(opacity=0); + cursor: pointer; + -webkit-transform: translate(-300px, 0) scale(4); + -moz-transform: translate(-300px, 0) scale(4); + -ms-transform: translate(-300px, 0) scale(4); + -o-transform: translate(-300px, 0) scale(4); + transform: translate(-300px, 0) scale(4); + direction: ltr; +} +#fileupload .fileupload-buttonbar .navbar-inner { + border-width: 0 0 1px; + border-radius: 4px 4px 0 0; + padding: 0; +} + +#fileupload .fileupload-progress .progress { + position: absolute; + right: 0; + left: 0; + margin-bottom: 0; + height: 5px; + border-radius: 0; + background-color: transparent; + background-image: none; +} +#fileupload .fileupload-progress .progress-success.progress-striped .bar { + background-color: #0088CC; +} +#fileupload .fileupload-progress .progress-extended { + position: absolute; + top: 1px; + right: 0; + padding-right: 15px; + color: #0088CC; + text-align: right; + text-shadow: 0 1px 0 #ffffff; + letter-spacing: -0.1em; + font-size: 12px; + font-family: 'Varela Round', sans-serif; + line-height: 40px; +} +#fileupload .fileupload-buttonbar { + position: relative; + z-index: 3; +} +#fileupload #dropzone { + margin: 15px 10px 10px; + padding: 30px; + text-align: center; + font-size: 2em; + font-family: 'Raleway'; + line-height: 1.2em; + color: #e4e4e4; +} +#fileupload #dropzone div[data-icons] { + font-size: 4em; + height: 70px; + padding-top: 30px; + text-shadow: 0px -1px 0px #ececec; + color: #f5f5f5; +} +#fileupload #dropzone.drop { + position: absolute; + top: 37px; + left: 0; + right: 0; + bottom: 0; + border: 2px dashed #0088CC; + border-radius: 10px; + color: #0088CC; + background-color: #FFFFFF; + z-index: 0; +} +#fileupload #dropzone.fade { + opacity: .3; +} +#fileupload #dropzone.in { + opacity: .7; + z-index: 2; + border-color: #faa732; + color: #faa732; +} +#fileupload #dropzone.drop div[data-icons] { + text-shadow: 0px -1px 0px #0c5f80; + color: #0088CC; +} +#fileupload #dropzone.in div[data-icons] { + text-shadow: 0px -1px 0px #a28a10; + color: #faa732; +} +#fileupload #file-list { + position: relative; + z-index: 1; + height: 209px; + margin: 2px 0; +} +#fileupload #file-list .pane { + margin-right: 2px; +} +#fileupload #file-list .files { + margin: 0; + padding: 10px 14px 10px 10px; + list-style: none; +} +#fileupload #file-list .files > li { + padding: 10px; +} +#fileupload #file-list .files > li:nth-child(even) { + background-color: #e9e9e9; + border-radius: 3px; +} +#fileupload #file-list .files ul { + position: relative; + margin: 0; + padding: 0; + list-style: none; +} +#fileupload #file-list .files ul li { + float: left; +} +#fileupload #file-list .files ul li.action-bnt { + float: right; +} +#fileupload #file-list .preview { + width: 80px; + min-height: 1px; + margin-right: 10px; + text-align: center; +} +#fileupload #file-list .name { + width: 150px; + max-width: 250px; + margin-left: 15px; +} +#fileupload #file-list .progress { + position: absolute; + left: -5px; + right: -5px; + bottom: -5px; + margin-bottom: 0; + height: 5px; + box-shadow: none; + background-color: transparent; + background-image: none; +} +#fileupload #file-list .size { + width: 80px; +} +#fileupload #file-list .action-bnt { + text-align: right; +} \ No newline at end of file diff --git a/app/assets/stylesheets/gallery/.keep b/app/assets/stylesheets/gallery/.keep deleted file mode 100644 index e69de29..0000000 diff --git a/app/assets/stylesheets/gallery_frontend.css b/app/assets/stylesheets/gallery_frontend.css new file mode 100644 index 0000000..c8cbef8 --- /dev/null +++ b/app/assets/stylesheets/gallery_frontend.css @@ -0,0 +1,332 @@ +.rg, .rgp { + transition: all 0.3s ease; + -webkit-transition: all 0.3s ease; + -moz-transition: all 0.3s ease; +} +.rg input, .rgp input, .rg textarea, .rgp textarea { + resize: none; + margin: 0; + display: block; + font-size: 13px; + } +.rgp textarea { overflow: auto; } +.rg a, .rgp a { + text-decoration: none; + outline: none; + } +.rg a:hover { } + +/*.rg img { display: block; border: none; }*/ + +.rgmask { background: #000; width: 100%; position: fixed; top: 0; left: 0; } + +.rgui { + display: inline-block; + cursor: pointer; + } +.rghead, .rgbody { overflow: hidden; } +.rghead { + padding: 10px 0; + } +.rgtitle { + color: #333; + text-shadow: 0 1px 0 #ddd; + font-size: 2em; + padding: 0 8px; + } +.rgbody { + + } +.rgfn { overflow: hidden; } +.rgalbum, .rgphoto { float: left; margin: 0 10px 24px 0; } +.rgalbum { + margin: 0 16px 16px 0; + padding: 6px; + width: 138px; + height: 220px; + border: solid 1px #ccc; + + transition: all 0.3s ease; + -webkit-transition: all 0.3s ease; + -moz-transition: all 0.3s ease; +} +.rgalbum > a { + display: block; + float: none; + margin: -6px -6px 0 -6px; +} +.rgalbum img { + transition: all, 0.5s ease; + -webkit-transition: all, 0.5s ease; + -moz-transition: all 0.5s ease; + -ms-transition: all, 0.5s ease; + } +.rgphoto { } +.rgphoto a { + display: block; + + transition: all, 0.3s ease; + -webkit-transition: all, 0.3s ease; + -moz-transition: all, 0.3s ease; +} +.rgphoto a:hover img { + opacity: 0.85; +} +.rgphoto img, .rgphoto_edit img { + /*display: block;*/ + + transition: all, 0.3s ease; + -webkit-transition: all, 0.3s ease; + -moz-transition: all, 0.3s ease; + } +.rgalbum .albumname { + font-size: 1.25em; + /*line-height: ;*/ + margin: 6px 0; + display: block; + height: 45px; + overflow: hidden; + transition: background 0.3s ease; + -webkit-transition: background 0.3s ease; + -moz-transition: background 0.3s ease; + -ms-transition: background 0.3s ease; + } +.rgalbum a:hover img { + opacity: 0.85; + } +.rgalbum .categoryname {} +.rgalbum .tagnames { + display: block; + margin-top: 8px; + padding-top: 8px; + line-height: 22px; + height: 22px; + overflow: hidden; + border-top: solid 1px #ccc; + color: #666; +} + +.taglist { + padding: 10px 0; +} +.taglist_title { + font-size: 1.5em; + margin: 0 0 10px 0; +} +.taglist ul { + padding: 10px 0; + border-top: solid 1px #ddd; + overflow: hidden; +} +.taglist li { + float: left; + margin: 0 8px 8px 0; +} + +.rgp .rgtitle { margin: 0 0 10px 0; } + + +/* Ruling Slide */ +.rslide { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + overflow: hidden; + background: #222; + clear: both; + /*z-index: 99;*/ + min-height: 250px; + + transition: all 0.3s ease; + -webkit-transition: all 0.3s ease; + -moz-transition: all 0.3s ease; + } +.rslide.fullscreen { position: fixed; z-index: 99; } +.rslide.fullscreen .comp img{ + width: auto; +} +.rslideinside { + } +.comp { + width: 100%; + height: auto; + overflow: hidden; + position: relative; + + transition: all 0.3s ease; + -webkit-transition: all 0.3s ease; + -moz-transition: all 0.3s ease; + } +.comp img{ display: block; width: 100%; height: auto; margin: 0 auto; cursor: pointer; min-height: 250px; } +.comp .full{ width: auto; height: auto; max-width: 100%; max-height: 100%; } +.rslidenav { + position: absolute; + top: 50%; + left: 0; + right: 0; + margin-top: -35px; + } +.rslidenav a { + position: absolute; + display: block; + width: 30px; + height: 40px; + overflow: hidden; + text-indent: -999px; + background: #000 0 center url(../../../assets/gallery/slidenav.png) no-repeat; + background: rgba(0,0,0,0.9) 0 0 url(../../../assets/gallery/slidenav.png) no-repeat; + + transition: all 0.3s ease; + -webkit-transition: all 0.3s ease; + -moz-transition: all 0.3s ease; + -ms-transition: all 0.3s ease; + } +.rslidenav a:hover { + background-color: #fff; + background-color: rgba(255,255,255,0.9); + } +.rslidenav .navP { left: 0; border-radius: 0 4px 4px 0; background-position: 0 -40px; } +.rslidenav .navN { right: 0; border-radius: 4px 0 0 4px; background-position: -30px 0; } +.rslidenav a.navP:hover { background-position: -30px -40px; } +.rslidenav a.navN:hover { background-position: 0 0; } +.slidectrl { + position: absolute; + bottom: 0; + left: 0; + right: 0; + width: 100%; + height: 30px; + background: #000 left top url(../../../assets/gallery/slidetitlebg.png) repeat-x; + background: rgba(0,0,0,0.9) left top url(../../../assets/gallery/slidetitlebg.png) repeat-x; + /*z-index: 999;*/ + } +.slidectrl a { + display: block; + float: right; + text-indent: -9999px; + overflow: hidden; + width: 30px; + height: 30px; + background: transparent 0 0 url(../../../assets/gallery/slideui.gif) no-repeat; + border-left: solid 1px #222; + } +.slidectrl a.togglelist { background-position: 0 -30px; } +.slidectrl a.togglescreen { background-position: 0 -90px; } +.slidectrl a.toinline { background-position: -30px 0; } +.slidectrl a.sharebt { background-position: -30px -30px; } +.slidectrl a.browserfullscreen { display:none;} +.slidectrl a.slidestop { background-position: 0 -60px; } +.fullscreen .slidectrl a.togglescreen { background-position: -30px -90px; } +.browserFullScreen .slidectrl a.browserfullscreen { background-position: -30px 0; } +.browserFullScreen .togglescreen { display: none; } +.slideinfo { + height: 30px; + line-height: 30px; + color: #fff; + font-size: 13px; + overflow: hidden; + } +.slideinfo .info { padding: 0 0 0 6px; text-transform: uppercase; } +.slideinfo span.info { color: #ccc; text-transform: none; } + +.slidelist { + position: absolute; + bottom: 30px; + z-index: 98; + width: 100%; + height: 0; + overflow: auto; + overflow-x: hidden; + background: transparent 0 0 url(../../../assets/gallery/slidelistbg.png); + } +.slidelist ul { + margin: 0 auto; + padding: 10px 0 10px 10px; + list-style: none; + } +.slidelist li { + display: inline-block; + margin: 0 10px 10px 0; + } +.slidelist a { + border: solid 2px #fff; + display: block; + width: 120px; + height: 96px; + position: relative; + + box-shadow: 0 0 6px rgba(0,0,0,0.7); + -webkit-box-shadow: 0 0 6px rgba(0,0,0,0.7); + -moz-box-shadow: 0 0 6px rgba(0,0,0,0.7); + -ms-box-shadow: 0 0 6px rgba(0,0,0,0.7); + } +.slidelist a.playall { + border: none; + width: 80px; + height: 32px; + margin: 31px 0 0 22px; + background: transparent 0 0 url(../../../assets/gallery/playall.png) no-repeat; + + box-shadow: none; + -webkit-box-shadow: none; + -moz-box-shadow: none; + -ms-box-shadow: none; + } +.slidelist a.playall:hover { background-position: 0 -32px; } +#li_play_all { width: 124px; height: 94px; } +.slidelist img { + margin: 0; + background: #fff; + display: block; + + transition: all 0.2s ease; + -webkit-transition: all 0.2s ease; + -moz-transition: all 0.2s ease; + -ms-transition: all 0.2s ease; + } +.slidelist a:hover img { + padding: 4px; + margin: -4px; + } + +.dm { + background: #fff; + border: solid 1px #a4a4a4; + border-right-color: #666; + position: absolute; + overflow: hidden; + padding: 2px 0; + display: none; + + border-radius: 4px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + -ms-border-radius: 4px; + } +.dm ul { margin: 0; padding: 0; list-style: none !important; } +.dm li { + margin: 0; + padding: 0; + border-bottom: solid 1px #ccc; + list-style: none !important; + } +.dm li a { + display: block; + padding: 6px 10px; + font-size: 13px; + + transition: all 0.3s ease; + -webkit-transition: all 0.3s ease; + -moz-transition: all 0.3s ease; + -ms-transition: all 0.3s ease; + } +.dm li a:hover { background: #eee; } + + + +/* orbit style implementation */ +#orbit_gallery { + margin: 0 -10px 30px -10px; +} \ No newline at end of file diff --git a/app/assets/stylesheets/gallery_old.css b/app/assets/stylesheets/gallery_old.css new file mode 100755 index 0000000..a3a2cb5 --- /dev/null +++ b/app/assets/stylesheets/gallery_old.css @@ -0,0 +1,564 @@ +.rg, .rgp { + transition: all 0.3s ease; + -webkit-transition: all 0.3s ease; + -moz-transition: all 0.3s ease; +} +.rg input, .rgp input, .rg textarea, .rgp textarea { + resize: none; + margin: 0; + display: block; + font-size: 13px; + } +.rgp textarea { overflow: auto; } +.rg a, .rgp a { + text-decoration: none; + outline: none; + } +.rg a:hover { } + +/*.rg img { display: block; border: none;}*/ + +.rgmask { background: #000; width: 100%; position: fixed; top: 0; left: 0; } + +.rgui { + display: inline-block; + cursor: pointer; + } +.rghead, .rgbody { overflow: hidden; } +.rghead { + border-bottom: solid 1px #ccc; + padding: 10px 0; + background: #fff; + } +.rgtitle { + color: #333; + text-shadow: 0 1px 0 #ddd; + font-size: 2em; + padding: 0 8px; + } +.rgbody { + + } +.rgfn { overflow: hidden; padding: 4px 10px; } +.rgalbum, .rgphoto { float: left; margin: 0 10px 24px 0; } +.rgalbum { + padding: 16px; + margin: 0 8px 8px 0; + border: solid 1px #ccc; + width: 300px; + height: 120px; + border-radius: 4px; + + transition: all 0.3s ease; + -webkit-transition: all 0.3s ease; + -moz-transition: all 0.3s ease; +} +.rgalbum > a { + display: block; + float: left; + margin-right: 10px; +} +.rgalbum:hover { + box-shadow: 0 0 6px rgba(0,0,0,0.2); +} +.rgalbum img { + transition: all, 0.5s ease; + -webkit-transition: all, 0.5s ease; + -moz-transition: all 0.5s ease; + -ms-transition: all, 0.5s ease; + } +.rgphoto { } +.rgphoto a { + display: block; + padding: 4px; + border: solid 1px #ddd; + background-color: #fff; + border-radius: 4px; + transition: all, 0.3s ease; + -webkit-transition: all, 0.3s ease; + -moz-transition: all, 0.3s ease; +} +.rgphoto a:hover { + border-color: #999; + box-shadow: 0 3px 6px rgba(0,0,0,0.2); +} +.rgphoto img, .rgphoto_edit img { + /*display: block;*/ + border-radius: 3px; + transition: all, 0.3s ease; + -webkit-transition: all, 0.3s ease; + -moz-transition: all, 0.3s ease; + } +.rgalbum .albumname { + font-size: 18px; + padding: 6px 0; + display: block; + transition: background 0.3s ease; + -webkit-transition: background 0.3s ease; + -moz-transition: background 0.3s ease; + -ms-transition: background 0.3s ease; + } +.rgalbum a:hover img { + opacity: 0.85; + } + +.rgp .rgtitle { margin: 0 0 10px 0; } + +/* Photo Edit */ +.albumname_edit label, .albumname_edit .rginput, .rgphoto_edit > a, .rgphoto_edit .rginput { float: left; } +.rgphoto_edit, .albumname_edit { + clear: both; + overflow: hidden; + margin-bottom: 10px; +} +.albumname_edit label { + width: 150px; + margin: 0 10px 0 0; + text-align: right; + padding: 0; + line-height: 24px; +} +.albumname_edit .rginput { } +.rgphoto_edit img { margin: 0 10px 10px 0; } +.rgphoto_edit .rginput { margin-right: 10px; } +.rgphoto_edit .edit_fn { float: left; margin-bottom: 10px; } +.rgphoto_edit .edit_fn .bt-dels { } + +/* Delete List */ +.rglist { overflow: hidden; padding: 10px 0; } +.list { table-layout:fixed; width: 100%; margin: 0 0 12px 0; } +.list thead th { padding: 8px 4px; font-size: 30px; font-weight: bold; } +.list th img { width: 60px; height: 45px; } +.list .photoname { padding-left: 6px; } +.list .photofn { padding-right: 4px; } +.list .photofn a { float: right; margin-left: 4px; display: block; } +.list th { padding: 4px 0 4px 4px; } +.list tbody th, .list tbody td { border-bottom: solid 1px #ccc; } +.list .odd th, .list .odd td { background: #f6f6f6; } +.list .c1 { width: 64px; } +.list .c3 { width: 40px; } + +/* Ruling Slide */ +.rslide { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + overflow: hidden; + background: #222; + clear: both; + /*z-index: 99;*/ + min-height: 250px; + + transition: all 0.3s ease; + -webkit-transition: all 0.3s ease; + -moz-transition: all 0.3s ease; + } +.rslide.fullscreen { position: fixed; z-index: 99; } +.rslideinside { + /* + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + overflow: hidden; + */ + } +.comp { + width: 100%; + height: auto; + overflow: hidden; + position: relative; + + transition: all 0.3s ease; + -webkit-transition: all 0.3s ease; + -moz-transition: all 0.3s ease; + } +.comp img{ display: block; width: auto; height: auto; margin: 0 auto; cursor: pointer; min-height: 250px; } +.comp .full{ width: auto; height: auto; max-width: 100%; max-height: 100%; } +.rslidenav { + position: absolute; + top: 50%; + left: 0; + right: 0; + margin-top: -35px; + } +.rslidenav a { + position: absolute; + display: block; + width: 30px; + height: 40px; + overflow: hidden; + text-indent: -999px; + background: #000 0 center url(../../../assets/gallery/slidenav.png) no-repeat; + background: rgba(0,0,0,0.9) 0 0 url(../../../assets/gallery/slidenav.png) no-repeat; + + transition: all 0.3s ease; + -webkit-transition: all 0.3s ease; + -moz-transition: all 0.3s ease; + -ms-transition: all 0.3s ease; + } +.rslidenav a:hover { + background-color: #fff; + background-color: rgba(255,255,255,0.9); + } +.rslidenav .navP { left: 0; border-radius: 0 4px 4px 0; background-position: 0 -40px; } +.rslidenav .navN { right: 0; border-radius: 4px 0 0 4px; background-position: -30px 0; } +.rslidenav a.navP:hover { background-position: -30px -40px; } +.rslidenav a.navN:hover { background-position: 0 0; } +.slidectrl { + position: absolute; + bottom: 0; + left: 0; + right: 0; + width: 100%; + height: 30px; + background: #000 left top url(../../../assets/gallery/slidetitlebg.png) repeat-x; + background: rgba(0,0,0,0.9) left top url(../../../assets/gallery/slidetitlebg.png) repeat-x; + /*z-index: 999;*/ + } +.slidectrl a { + display: block; + float: right; + text-indent: -9999px; + overflow: hidden; + width: 30px; + height: 30px; + background: transparent 0 0 url(../../../assets/gallery/slideui.gif) no-repeat; + border-left: solid 1px #222; + } +.slidectrl a.togglelist { background-position: 0 -30px; } +.slidectrl a.togglescreen { background-position: 0 -90px; } +.slidectrl a.toinline { background-position: -30px 0; } +.slidectrl a.sharebt { background-position: -30px -30px; } +.slidectrl a.browserfullscreen { display:none;} +.slidectrl a.slidestop { background-position: 0 -60px; } +.fullscreen .slidectrl a.togglescreen { background-position: -30px -90px; } +.browserFullScreen .slidectrl a.browserfullscreen { background-position: -30px 0; } +.browserFullScreen .togglescreen { display: none; } +.slideinfo { + height: 30px; + line-height: 30px; + color: #fff; + font-size: 13px; + overflow: hidden; + } +.slideinfo .info { padding: 0 0 0 6px; text-transform: uppercase; } +.slideinfo span.info { color: #ccc; text-transform: none; } + +.slidelist { + position: absolute; + bottom: 30px; + z-index: 99; + width: 100%; + height: 0; + overflow: auto; + overflow-x: hidden; + background: transparent 0 0 url(../../../assets/gallery/slidelistbg.png); + } +.slidelist ul { + margin: 0 auto; + padding: 10px 0 10px 10px; + list-style: none; + } +.slidelist li { + display: inline-block; + margin: 0 10px 10px 0; + } +.slidelist a { + border: solid 2px #fff; + display: block; + width: 150px; + height: 120px; + position: relative; + + box-shadow: 0 0 6px rgba(0,0,0,0.7); + -webkit-box-shadow: 0 0 6px rgba(0,0,0,0.7); + -moz-box-shadow: 0 0 6px rgba(0,0,0,0.7); + -ms-box-shadow: 0 0 6px rgba(0,0,0,0.7); + } +.slidelist a.playall { + border: none; + width: 80px; + height: 32px; + margin: 31px 0 0 22px; + background: transparent 0 0 url(../../../assets/gallery/playall.png) no-repeat; + + box-shadow: none; + -webkit-box-shadow: none; + -moz-box-shadow: none; + -ms-box-shadow: none; + } +.slidelist a.playall:hover { background-position: 0 -32px; } +#li_play_all { width: 124px; height: 94px; } +.slidelist img { + margin: 0; + background: #fff; + display: block; + + transition: all 0.2s ease; + -webkit-transition: all 0.2s ease; + -moz-transition: all 0.2s ease; + -ms-transition: all 0.2s ease; + } +.slidelist a:hover img { + padding: 4px; + margin: -4px; + } + +.dm { + background: #fff; + border: solid 1px #a4a4a4; + border-right-color: #666; + position: absolute; + overflow: hidden; + padding: 2px 0; + display: none; + + border-radius: 4px; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + -ms-border-radius: 4px; + } +.dm ul { margin: 0; padding: 0; list-style: none !important; } +.dm li { + margin: 0; + padding: 0; + border-bottom: solid 1px #ccc; + list-style: none !important; + } +.dm li a { + display: block; + padding: 6px 10px; + font-size: 13px; + + transition: all 0.3s ease; + -webkit-transition: all 0.3s ease; + -moz-transition: all 0.3s ease; + -ms-transition: all 0.3s ease; + } +.dm li a:hover { background: #eee; } + +/* Ruling Gallery UI */ +.rgbt { + padding: 0 0 0 32px; + vertical-align: top; + + text-shadow: 0 1px 0 #fff; + -webkit-text-shadow: 0 1px 0 #fff; + -moz-text-shadow: 0 1px 0 #fff; + -ms-text-shadow: 0 1px 0 #fff; + } +.rgbt span { + padding: 0 12px 0 8px; + display: inline-block; + line-height: 30px; + height: 32px; + font-size: 14px; + } + +.rgbtsg { + padding: 6px; + } +.rgphoto_edit .rgbtsg.active { display: inline-block; } +.bt-finish { display: block; float: right; clear: both; } +.bt-addnew { + margin: 0 auto; + width: 98px; + height: 100px; + display: block; + } +.bt-next{ + background-position: 0 -258px; + display: block; + float: right; + clear: both; + } +.bt-next:hover { background-position: 0 -448px; } +.bt-next:active { background-position: 0 -638px; } +.bt-close { + position: absolute; + right: 6px; + top: 6px; + } + + +.inputui { + margin: 0 0 8px 0; + } +.inputui span { + padding: 0 4px 0 0; + display: block; + } +.rginput { max-width: 400px; } +.rginput input, .rginput textarea { color: #999; } +.rginput.focus input, .rginput.focus textarea { color: #333; } + +.rgih26 { width: 208px; } +.rgih26 span { } +.rgih26 input { width: 356px; } +.rgih26.focus { } +.rgih26.focus span { } +.rgih68 { width: 396px; } +.rgih68 span { padding: 3px 4px 3px 0; } +.rgih68 textarea { width: 392px; height: 62px; } +.rgih68.focus { } +.rgih68.focus span { } +.rgih98 { width: 396px; } +.rgih98 span { } +.rgih98 textarea { width: 356px; height: 110px; } +.rgih98.focus { } +.rgih98.focus span { } + +.w380 { width: 386px; } + +#imgholder { overflow: hidden; } + +/* upload panel */ +#upload_panel_holder { + display: none; + margin: 16px 0 0 0; + clear: both; + float: right; + width: 100%; +} +#upload_panel { + background-color: #ddd; +} + +/* tag panel */ +#tag_panel { + position: fixed; + right: -200px; + top: 31px; + width: 200px; + min-height: 100px; + border-left: solid 1px #ccc; + background-color: #fff; +} +#tag_panel .scrollbar { + right: 0px; + top: 0px; + width: 9px; +} +#tag_panel .viewport { + height: 100%; +} + +.tag_list { + margin: 0; + padding: 0; +} +.tag_list li { + padding: 4px 6px; + border-top: solid 1px #f6f6f6; +} +.tag_list li:first-child { + border: 0; +} +.tag_list li:hover { + background-color: #08c; +} +.tag_list li:hover label { + color: #fff; +} +.tag_list input[type=checkbox], .tag_list label { + display: inline-block; + vertical-align: middle; + text-transform: capitalize; + margin: 0; +} +.tag_list label { + padding: 0 6px; +} +.tag_search { + position: absolute; + left: -1px; + bottom: -30px; + width: 200px; + height: 32px; + background-color: #f5f5f5; + border-left: solid 1px #ccc; + border-top: solid 1px #ddd; +} +.tag_search input[type=text] { + box-shadow: none; + width: 92px; + height: 25px; + line-height: 25px; + padding: 3px 6px 3px 24px; + border: 0; + border-top: solid 1px #fff; +} +.tag_search input[type=text]:focus { + background-color: #fff; +} +.tag_search .icon-search { + position: absolute; + left: 6px; + top: 50%; + margin-top: -7px; +} +#tag_panel .tag_save { + position: absolute; + right: 0; + bottom: 0; + height: 31px; + border-left: solid 1px #ccc; + background-color: #fff; + padding: 2px 4px 0 4px; +} + + +/* orbit style implementation */ +#orbit_gallery { + margin-bottom: 30px; +} +#orbit_gallery .nav-tabs, #orbit_gallery .tab-pane { + margin-left: 8px; + margin-right: 8px; +} +.tab_content .tab-pane{ + display: none; +} +.tab_content .active{ + display: block; +} +#orbit_gallery .btn { margin: 0; } +#orbit_gallery .btn i { margin-right: 4px; } +#orbit_gallery .rgfn .btn { + margin-left: 8px; +} +#orbit_gallery .form-actions { background-color: whiteSmoke; } + +.o_gallery .tagnames { + display: block; + margin-top: 6px; +} +.o_gallery .label-tags { + display: inline-block; + margin: 0 6px 6px 0; +} + +.o_gallery .rgbody, .o_album .rgbody { + padding: 10px 8px; +} + +#categories .add-album .control-label { + text-align: left; + width: 100px; + padding-left: 12px; + padding-right: 12px; +} +.o_album_edit form { + margin-left: 8px; +} + +#loading{ + background: #fff 0 center url("../../../assets/loading.gif") no-repeat; + height: 16px; + margin: auto; + width: 220px; +} diff --git a/app/assets/stylesheets/jquery-ui.css b/app/assets/stylesheets/jquery-ui.css new file mode 100644 index 0000000..759a187 --- /dev/null +++ b/app/assets/stylesheets/jquery-ui.css @@ -0,0 +1,566 @@ +/* + * jQuery UI CSS Framework 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + */ + +/* Layout helpers +----------------------------------*/ +.ui-helper-hidden { display: none; } +.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); } +.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } +.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } +.ui-helper-clearfix { display: inline-block; } +/* required comment for clearfix to work in Opera \*/ +* html .ui-helper-clearfix { height:1%; } +.ui-helper-clearfix { display:block; } +/* end clearfix */ +.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } + + +/* Interaction Cues +----------------------------------*/ +.ui-state-disabled { cursor: default !important; } + + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } + + +/* Misc visuals +----------------------------------*/ + +/* Overlays */ +.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } +/* + * jQuery UI Accordion 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Accordion#theming + */ +/* IE/Win - Fix animation bug - #4615 */ +.ui-accordion { width: 100%; } +.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; } +.ui-accordion .ui-accordion-li-fix { display: inline; } +.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; } +.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em .7em; } +.ui-accordion-icons .ui-accordion-header a { padding-left: 2.2em; } +.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; } +.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; zoom: 1; } +.ui-accordion .ui-accordion-content-active { display: block; } +/* + * jQuery UI Autocomplete 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Autocomplete#theming + */ +.ui-autocomplete { position: absolute; cursor: default; } + +/* workarounds */ +* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */ + +/* + * jQuery UI Menu 1.8.16 + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Menu#theming + */ +.ui-menu { + list-style:none; + padding: 2px; + margin: 0; + display:block; + float: left; +} +.ui-menu .ui-menu { + margin-top: -3px; +} +.ui-menu .ui-menu-item { + margin:0; + padding: 0; + zoom: 1; + float: left; + clear: left; + width: 100%; +} +.ui-menu .ui-menu-item a { + text-decoration:none; + display:block; + padding:.2em .4em; + line-height:1.5; + zoom:1; +} +.ui-menu .ui-menu-item a.ui-state-hover, +.ui-menu .ui-menu-item a.ui-state-active { + font-weight: normal; + margin: -1px; +} +/* + * jQuery UI Button 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Button#theming + */ +.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; text-decoration: none !important; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */ +.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */ +button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */ +.ui-button-icons-only { width: 3.4em; } +button.ui-button-icons-only { width: 3.7em; } + +/*button text element */ +.ui-button .ui-button-text { display: block; line-height: 1.4; } +.ui-button-text-only .ui-button-text { padding: .4em 1em; } +.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; } +.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; } +.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; } +.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; } +/* no icon support for input elements, provide padding by default */ +input.ui-button { padding: .4em 1em; } + +/*button icon element(s) */ +.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; } +.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; } +.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; } +.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } +.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; } + +/*button sets*/ +.ui-buttonset { margin-right: 7px; } +.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; } + +/* workarounds */ +button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */ +/* + * jQuery UI Datepicker 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Datepicker#theming + */ +.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; } +.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; } +.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; } +.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; } +.ui-datepicker .ui-datepicker-prev { left:2px; } +.ui-datepicker .ui-datepicker-next { right:2px; } +.ui-datepicker .ui-datepicker-prev-hover { left:1px; } +.ui-datepicker .ui-datepicker-next-hover { right:1px; } +.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; } +.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } +.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; } +.ui-datepicker select.ui-datepicker-month-year {width: 100%;} +.ui-datepicker select.ui-datepicker-month, +.ui-datepicker select.ui-datepicker-year { width: 49%;} +.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; } +.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; } +.ui-datepicker td { border: 0; padding: 1px; } +.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; } +.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; } +.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; } +.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; } + +/* with multiple calendars */ +.ui-datepicker.ui-datepicker-multi { width:auto; } +.ui-datepicker-multi .ui-datepicker-group { float:left; } +.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; } +.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; } +.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; } +.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; } +.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; } +.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; } +.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; } +.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; } + +/* RTL support */ +.ui-datepicker-rtl { direction: rtl; } +.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } +.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } +.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } +.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } +.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; } +.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } +.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; } +.ui-datepicker-rtl .ui-datepicker-group { float:right; } +.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; } +.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; } + +/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */ +.ui-datepicker-cover { + display: none; /*sorry for IE5*/ + display/**/: block; /*sorry for IE5*/ + position: absolute; /*must have*/ + z-index: -1; /*must have*/ + filter: mask(); /*must have*/ + top: -4px; /*must have*/ + left: -4px; /*must have*/ + width: 200px; /*must have*/ + height: 200px; /*must have*/ +}/* + * jQuery UI Dialog 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Dialog#theming + */ +.ui-dialog { position: absolute; padding: .2em; width: 300px; overflow: hidden; } +.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; } +.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; } +.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } +.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } +.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } +.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } +.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; } +.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; } +.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; } +.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } +.ui-draggable .ui-dialog-titlebar { cursor: move; } +/* + * jQuery UI Progressbar 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Progressbar#theming + */ +.ui-progressbar { height:2em; text-align: left; } +.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }/* + * jQuery UI Resizable 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Resizable#theming + */ +.ui-resizable { position: relative;} +.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block; } +.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } +.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; } +.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; } +.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; } +.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; } +.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } +.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } +.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } +.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* + * jQuery UI Selectable 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Selectable#theming + */ +.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; } +/* + * jQuery UI Slider 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Slider#theming + */ +.ui-slider { position: relative; text-align: left; } +.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } +.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; } + +.ui-slider-horizontal { height: .8em; } +.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } +.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } +.ui-slider-horizontal .ui-slider-range-min { left: 0; } +.ui-slider-horizontal .ui-slider-range-max { right: 0; } + +.ui-slider-vertical { width: .8em; height: 100px; } +.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } +.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } +.ui-slider-vertical .ui-slider-range-min { bottom: 0; } +.ui-slider-vertical .ui-slider-range-max { top: 0; }/* + * jQuery UI Tabs 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Tabs#theming + */ +.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ +.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; } +.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 1px; margin: 0 .2em 1px 0; border-bottom: 0 !important; padding: 0; white-space: nowrap; } +.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; } +.ui-tabs .ui-tabs-nav li.ui-tabs-selected { margin-bottom: 0; padding-bottom: 1px; } +.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; } +.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ +.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; } +.ui-tabs .ui-tabs-hide { display: none !important; } +/* + * jQuery UI CSS Framework 1.8.16 + * + * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + * + * To view and modify this theme, visit http://jqueryui.com/themeroller/ + */ + + +/* Component containers +----------------------------------*/ +.ui-widget { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1.1em/*{fsDefault}*/; } +.ui-widget .ui-widget { font-size: 1em; } +.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif/*{ffDefault}*/; font-size: 1em; } +.ui-widget-content { border: 1px solid #aaaaaa/*{borderColorContent}*/; background: #ffffff/*{bgColorContent}*/ url(images/ui-bg_flat_75_ffffff_40x100.png)/*{bgImgUrlContent}*/ 50%/*{bgContentXPos}*/ 50%/*{bgContentYPos}*/ repeat-x/*{bgContentRepeat}*/; color: #222222/*{fcContent}*/; } +.ui-widget-content a { color: #222222/*{fcContent}*/; } +.ui-widget-header { border: 1px solid #aaaaaa/*{borderColorHeader}*/; background: #cccccc/*{bgColorHeader}*/ url(images/ui-bg_highlight-soft_75_cccccc_1x100.png)/*{bgImgUrlHeader}*/ 50%/*{bgHeaderXPos}*/ 50%/*{bgHeaderYPos}*/ repeat-x/*{bgHeaderRepeat}*/; color: #222222/*{fcHeader}*/; font-weight: bold; } +.ui-widget-header a { color: #222222/*{fcHeader}*/; } + +/* Interaction states +----------------------------------*/ +.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3/*{borderColorDefault}*/; background: #e6e6e6/*{bgColorDefault}*/ url(images/ui-bg_glass_75_e6e6e6_1x400.png)/*{bgImgUrlDefault}*/ 50%/*{bgDefaultXPos}*/ 50%/*{bgDefaultYPos}*/ repeat-x/*{bgDefaultRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #555555/*{fcDefault}*/; } +.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555/*{fcDefault}*/; text-decoration: none; } +.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999/*{borderColorHover}*/; background: #dadada/*{bgColorHover}*/ url(images/ui-bg_glass_75_dadada_1x400.png)/*{bgImgUrlHover}*/ 50%/*{bgHoverXPos}*/ 50%/*{bgHoverYPos}*/ repeat-x/*{bgHoverRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcHover}*/; } +.ui-state-hover a, .ui-state-hover a:hover { color: #212121/*{fcHover}*/; text-decoration: none; } +.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa/*{borderColorActive}*/; background: #ffffff/*{bgColorActive}*/ url(images/ui-bg_glass_65_ffffff_1x400.png)/*{bgImgUrlActive}*/ 50%/*{bgActiveXPos}*/ 50%/*{bgActiveYPos}*/ repeat-x/*{bgActiveRepeat}*/; font-weight: normal/*{fwDefault}*/; color: #212121/*{fcActive}*/; } +.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121/*{fcActive}*/; text-decoration: none; } +.ui-widget :active { outline: none; } + +/* Interaction Cues +----------------------------------*/ +.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1/*{borderColorHighlight}*/; background: #fbf9ee/*{bgColorHighlight}*/ url(images/ui-bg_glass_55_fbf9ee_1x400.png)/*{bgImgUrlHighlight}*/ 50%/*{bgHighlightXPos}*/ 50%/*{bgHighlightYPos}*/ repeat-x/*{bgHighlightRepeat}*/; color: #363636/*{fcHighlight}*/; } +.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636/*{fcHighlight}*/; } +.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a/*{borderColorError}*/; background: #fef1ec/*{bgColorError}*/ url(images/ui-bg_glass_95_fef1ec_1x400.png)/*{bgImgUrlError}*/ 50%/*{bgErrorXPos}*/ 50%/*{bgErrorYPos}*/ repeat-x/*{bgErrorRepeat}*/; color: #cd0a0a/*{fcError}*/; } +.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a/*{fcError}*/; } +.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a/*{fcError}*/; } +.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; } +.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } +.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; } +.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsContent}*/; } +.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png)/*{iconsHeader}*/; } +.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png)/*{iconsDefault}*/; } +.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsHover}*/; } +.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png)/*{iconsActive}*/; } +.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png)/*{iconsHighlight}*/; } +.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png)/*{iconsError}*/; } + +/* positioning */ +.ui-icon-carat-1-n { background-position: 0 0; } +.ui-icon-carat-1-ne { background-position: -16px 0; } +.ui-icon-carat-1-e { background-position: -32px 0; } +.ui-icon-carat-1-se { background-position: -48px 0; } +.ui-icon-carat-1-s { background-position: -64px 0; } +.ui-icon-carat-1-sw { background-position: -80px 0; } +.ui-icon-carat-1-w { background-position: -96px 0; } +.ui-icon-carat-1-nw { background-position: -112px 0; } +.ui-icon-carat-2-n-s { background-position: -128px 0; } +.ui-icon-carat-2-e-w { background-position: -144px 0; } +.ui-icon-triangle-1-n { background-position: 0 -16px; } +.ui-icon-triangle-1-ne { background-position: -16px -16px; } +.ui-icon-triangle-1-e { background-position: -32px -16px; } +.ui-icon-triangle-1-se { background-position: -48px -16px; } +.ui-icon-triangle-1-s { background-position: -64px -16px; } +.ui-icon-triangle-1-sw { background-position: -80px -16px; } +.ui-icon-triangle-1-w { background-position: -96px -16px; } +.ui-icon-triangle-1-nw { background-position: -112px -16px; } +.ui-icon-triangle-2-n-s { background-position: -128px -16px; } +.ui-icon-triangle-2-e-w { background-position: -144px -16px; } +.ui-icon-arrow-1-n { background-position: 0 -32px; } +.ui-icon-arrow-1-ne { background-position: -16px -32px; } +.ui-icon-arrow-1-e { background-position: -32px -32px; } +.ui-icon-arrow-1-se { background-position: -48px -32px; } +.ui-icon-arrow-1-s { background-position: -64px -32px; } +.ui-icon-arrow-1-sw { background-position: -80px -32px; } +.ui-icon-arrow-1-w { background-position: -96px -32px; } +.ui-icon-arrow-1-nw { background-position: -112px -32px; } +.ui-icon-arrow-2-n-s { background-position: -128px -32px; } +.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } +.ui-icon-arrow-2-e-w { background-position: -160px -32px; } +.ui-icon-arrow-2-se-nw { background-position: -176px -32px; } +.ui-icon-arrowstop-1-n { background-position: -192px -32px; } +.ui-icon-arrowstop-1-e { background-position: -208px -32px; } +.ui-icon-arrowstop-1-s { background-position: -224px -32px; } +.ui-icon-arrowstop-1-w { background-position: -240px -32px; } +.ui-icon-arrowthick-1-n { background-position: 0 -48px; } +.ui-icon-arrowthick-1-ne { background-position: -16px -48px; } +.ui-icon-arrowthick-1-e { background-position: -32px -48px; } +.ui-icon-arrowthick-1-se { background-position: -48px -48px; } +.ui-icon-arrowthick-1-s { background-position: -64px -48px; } +.ui-icon-arrowthick-1-sw { background-position: -80px -48px; } +.ui-icon-arrowthick-1-w { background-position: -96px -48px; } +.ui-icon-arrowthick-1-nw { background-position: -112px -48px; } +.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } +.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } +.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } +.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } +.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } +.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } +.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } +.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } +.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } +.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } +.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } +.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } +.ui-icon-arrowreturn-1-w { background-position: -64px -64px; } +.ui-icon-arrowreturn-1-n { background-position: -80px -64px; } +.ui-icon-arrowreturn-1-e { background-position: -96px -64px; } +.ui-icon-arrowreturn-1-s { background-position: -112px -64px; } +.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } +.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } +.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } +.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } +.ui-icon-arrow-4 { background-position: 0 -80px; } +.ui-icon-arrow-4-diag { background-position: -16px -80px; } +.ui-icon-extlink { background-position: -32px -80px; } +.ui-icon-newwin { background-position: -48px -80px; } +.ui-icon-refresh { background-position: -64px -80px; } +.ui-icon-shuffle { background-position: -80px -80px; } +.ui-icon-transfer-e-w { background-position: -96px -80px; } +.ui-icon-transferthick-e-w { background-position: -112px -80px; } +.ui-icon-folder-collapsed { background-position: 0 -96px; } +.ui-icon-folder-open { background-position: -16px -96px; } +.ui-icon-document { background-position: -32px -96px; } +.ui-icon-document-b { background-position: -48px -96px; } +.ui-icon-note { background-position: -64px -96px; } +.ui-icon-mail-closed { background-position: -80px -96px; } +.ui-icon-mail-open { background-position: -96px -96px; } +.ui-icon-suitcase { background-position: -112px -96px; } +.ui-icon-comment { background-position: -128px -96px; } +.ui-icon-person { background-position: -144px -96px; } +.ui-icon-print { background-position: -160px -96px; } +.ui-icon-trash { background-position: -176px -96px; } +.ui-icon-locked { background-position: -192px -96px; } +.ui-icon-unlocked { background-position: -208px -96px; } +.ui-icon-bookmark { background-position: -224px -96px; } +.ui-icon-tag { background-position: -240px -96px; } +.ui-icon-home { background-position: 0 -112px; } +.ui-icon-flag { background-position: -16px -112px; } +.ui-icon-calendar { background-position: -32px -112px; } +.ui-icon-cart { background-position: -48px -112px; } +.ui-icon-pencil { background-position: -64px -112px; } +.ui-icon-clock { background-position: -80px -112px; } +.ui-icon-disk { background-position: -96px -112px; } +.ui-icon-calculator { background-position: -112px -112px; } +.ui-icon-zoomin { background-position: -128px -112px; } +.ui-icon-zoomout { background-position: -144px -112px; } +.ui-icon-search { background-position: -160px -112px; } +.ui-icon-wrench { background-position: -176px -112px; } +.ui-icon-gear { background-position: -192px -112px; } +.ui-icon-heart { background-position: -208px -112px; } +.ui-icon-star { background-position: -224px -112px; } +.ui-icon-link { background-position: -240px -112px; } +.ui-icon-cancel { background-position: 0 -128px; } +.ui-icon-plus { background-position: -16px -128px; } +.ui-icon-plusthick { background-position: -32px -128px; } +.ui-icon-minus { background-position: -48px -128px; } +.ui-icon-minusthick { background-position: -64px -128px; } +.ui-icon-close { background-position: -80px -128px; } +.ui-icon-closethick { background-position: -96px -128px; } +.ui-icon-key { background-position: -112px -128px; } +.ui-icon-lightbulb { background-position: -128px -128px; } +.ui-icon-scissors { background-position: -144px -128px; } +.ui-icon-clipboard { background-position: -160px -128px; } +.ui-icon-copy { background-position: -176px -128px; } +.ui-icon-contact { background-position: -192px -128px; } +.ui-icon-image { background-position: -208px -128px; } +.ui-icon-video { background-position: -224px -128px; } +.ui-icon-script { background-position: -240px -128px; } +.ui-icon-alert { background-position: 0 -144px; } +.ui-icon-info { background-position: -16px -144px; } +.ui-icon-notice { background-position: -32px -144px; } +.ui-icon-help { background-position: -48px -144px; } +.ui-icon-check { background-position: -64px -144px; } +.ui-icon-bullet { background-position: -80px -144px; } +.ui-icon-radio-off { background-position: -96px -144px; } +.ui-icon-radio-on { background-position: -112px -144px; } +.ui-icon-pin-w { background-position: -128px -144px; } +.ui-icon-pin-s { background-position: -144px -144px; } +.ui-icon-play { background-position: 0 -160px; } +.ui-icon-pause { background-position: -16px -160px; } +.ui-icon-seek-next { background-position: -32px -160px; } +.ui-icon-seek-prev { background-position: -48px -160px; } +.ui-icon-seek-end { background-position: -64px -160px; } +.ui-icon-seek-start { background-position: -80px -160px; } +/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ +.ui-icon-seek-first { background-position: -80px -160px; } +.ui-icon-stop { background-position: -96px -160px; } +.ui-icon-eject { background-position: -112px -160px; } +.ui-icon-volume-off { background-position: -128px -160px; } +.ui-icon-volume-on { background-position: -144px -160px; } +.ui-icon-power { background-position: 0 -176px; } +.ui-icon-signal-diag { background-position: -16px -176px; } +.ui-icon-signal { background-position: -32px -176px; } +.ui-icon-battery-0 { background-position: -48px -176px; } +.ui-icon-battery-1 { background-position: -64px -176px; } +.ui-icon-battery-2 { background-position: -80px -176px; } +.ui-icon-battery-3 { background-position: -96px -176px; } +.ui-icon-circle-plus { background-position: 0 -192px; } +.ui-icon-circle-minus { background-position: -16px -192px; } +.ui-icon-circle-close { background-position: -32px -192px; } +.ui-icon-circle-triangle-e { background-position: -48px -192px; } +.ui-icon-circle-triangle-s { background-position: -64px -192px; } +.ui-icon-circle-triangle-w { background-position: -80px -192px; } +.ui-icon-circle-triangle-n { background-position: -96px -192px; } +.ui-icon-circle-arrow-e { background-position: -112px -192px; } +.ui-icon-circle-arrow-s { background-position: -128px -192px; } +.ui-icon-circle-arrow-w { background-position: -144px -192px; } +.ui-icon-circle-arrow-n { background-position: -160px -192px; } +.ui-icon-circle-zoomin { background-position: -176px -192px; } +.ui-icon-circle-zoomout { background-position: -192px -192px; } +.ui-icon-circle-check { background-position: -208px -192px; } +.ui-icon-circlesmall-plus { background-position: 0 -208px; } +.ui-icon-circlesmall-minus { background-position: -16px -208px; } +.ui-icon-circlesmall-close { background-position: -32px -208px; } +.ui-icon-squaresmall-plus { background-position: -48px -208px; } +.ui-icon-squaresmall-minus { background-position: -64px -208px; } +.ui-icon-squaresmall-close { background-position: -80px -208px; } +.ui-icon-grip-dotted-vertical { background-position: 0 -224px; } +.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } +.ui-icon-grip-solid-vertical { background-position: -32px -224px; } +.ui-icon-grip-solid-horizontal { background-position: -48px -224px; } +.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } +.ui-icon-grip-diagonal-se { background-position: -80px -224px; } + + +/* Misc visuals +----------------------------------*/ + +/* Corner radius */ +.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px/*{cornerRadius}*/; -webkit-border-top-left-radius: 4px/*{cornerRadius}*/; -khtml-border-top-left-radius: 4px/*{cornerRadius}*/; border-top-left-radius: 4px/*{cornerRadius}*/; } +.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px/*{cornerRadius}*/; -webkit-border-top-right-radius: 4px/*{cornerRadius}*/; -khtml-border-top-right-radius: 4px/*{cornerRadius}*/; border-top-right-radius: 4px/*{cornerRadius}*/; } +.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px/*{cornerRadius}*/; -webkit-border-bottom-left-radius: 4px/*{cornerRadius}*/; -khtml-border-bottom-left-radius: 4px/*{cornerRadius}*/; border-bottom-left-radius: 4px/*{cornerRadius}*/; } +.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px/*{cornerRadius}*/; -webkit-border-bottom-right-radius: 4px/*{cornerRadius}*/; -khtml-border-bottom-right-radius: 4px/*{cornerRadius}*/; border-bottom-right-radius: 4px/*{cornerRadius}*/; } + +/* Overlays */ +.ui-widget-overlay { background: #aaaaaa/*{bgColorOverlay}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlOverlay}*/ 50%/*{bgOverlayXPos}*/ 50%/*{bgOverlayYPos}*/ repeat-x/*{bgOverlayRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityOverlay}*/; } +.ui-widget-shadow { margin: -8px/*{offsetTopShadow}*/ 0 0 -8px/*{offsetLeftShadow}*/; padding: 8px/*{thicknessShadow}*/; background: #aaaaaa/*{bgColorShadow}*/ url(images/ui-bg_flat_0_aaaaaa_40x100.png)/*{bgImgUrlShadow}*/ 50%/*{bgShadowXPos}*/ 50%/*{bgShadowYPos}*/ repeat-x/*{bgShadowRepeat}*/; opacity: .3;filter:Alpha(Opacity=30)/*{opacityShadow}*/; -moz-border-radius: 8px/*{cornerRadiusShadow}*/; -khtml-border-radius: 8px/*{cornerRadiusShadow}*/; -webkit-border-radius: 8px/*{cornerRadiusShadow}*/; border-radius: 8px/*{cornerRadiusShadow}*/; } \ No newline at end of file diff --git a/app/assets/stylesheets/jquery.fileupload-ui.css b/app/assets/stylesheets/jquery.fileupload-ui.css new file mode 100755 index 0000000..7d538c8 --- /dev/null +++ b/app/assets/stylesheets/jquery.fileupload-ui.css @@ -0,0 +1,168 @@ +@charset 'UTF-8'; +/* + * jQuery File Upload UI Plugin CSS 5.0.6 + * https://github.com/blueimp/jQuery-File-Upload + * + * Copyright 2010, Sebastian Tschan + * https://blueimp.net + * + * Licensed under the MIT license: + * http://creativecommons.org/licenses/MIT/ + */ +body { margin: 0; } +#fileupload { position: relative; } +#fileupload form { margin: 0; } +.fileupload-buttonbar .ui-button input { + position: absolute; + top: 0; + right: 0; + margin: 0; + border: solid transparent; + border-width: 0 0 100px 200px; + opacity: 0; + filter: alpha(opacity=0); + -o-transform: translate(250px, -50px) scale(1); + -moz-transform: translate(-300px, 0) scale(4); + direction: ltr; + cursor: pointer; +} + +.fileinput-button { + overflow: hidden; +} + +/* Fix for IE 6: */ +/**html .fileinput-button { + padding: 2px 0; +}*/ + +/* Fix for IE 7: */ +/**+html .fileinput-button { + padding: 2px 0; +}*/ + +.fileupload-buttonbar { + height: 44px; + border-bottom: none; + background: transparent 0 0 url(../../../assets/gallery/uppt.png) repeat-x; + position: relative; + z-index: 9; + } + +.fileupload-buttonbar .ui-button { + vertical-align: middle; + font-size: 13px; + font-family: mako; + border: none; + margin: 0; + padding: 0; + background: none; + } +.fileupload-buttonbar .ui-button .ui-button-text { + height: 40px; + line-height: 40px; + padding: 0 14px 0 26px; + background: transparent right center url(../../../assets/gallery/upsep.png) no-repeat; + text-shadow: 1px 1px 0 #fff; + } + +.fileupload-content { + border-top-width: 0; + height: 250px; + overflow: auto; + overflow-x:hidden; + background: #FAFAFA center center url(../../../assets/gallery/uploadbg.gif) no-repeat; + position: relative; + margin-top: -2px; + z-index: 2; + } + +.fileupload-content .ui-progressbar { + width: auto; + height: 18px; + } + +.fileupload-content .ui-progressbar-value { + background: url(../../../assets/gallery/pbar-ani.gif); + height: 16px; + margin: 0; + border-left: none; + border-right: none; + border-radius: 6px; + } +.files .ui-progressbar-value { border: none; height: 18px; border-radius: 2px; } +.fileupload-content .fileupload-progressbar { + width: 400px; + margin: -20px 0 0 -202px; + padding: 2px; + background: rgba(0,0,0,0.8); + position: fixed; + top: 50%; + left: 50%; + border: 0; + border-radius: 4px; + box-shadow: 0 2px 3px rgba(0,0,0,0.4); + -webkit-box-shadow: 0 2px 3px rgba(0,0,0,0.4); + -moz-box-shadow: 0 2px 3px rgba(0,0,0,0.4); + -ms-box-shadow: 0 2px 3px rgba(0,0,0,0.4); + } + +.files { + margin: 0; + border-collapse: collapse; + width: 100%; + table-layout:fixed; + font-family: mako; +} + +.files td { + padding: 5px 4px; + border-spacing: 0; + font-size: 13px; + } + +.files img { border: none; width: 80px; } + +.files .name { } + +.files .size { + text-align: right; + white-space: nowrap; + width: 100px; + } +.files .preview { width: 88px; } +/*.files .progress { width: ; }*/ +.files .start { width: 40px; } +.files .cancel { width: 40px; } + +.ui-state-disabled .ui-state-disabled { + opacity: 1; + filter: alpha(opacity=100); +} + +.ui-state-disabled input { + cursor: default; +} +.fileupload-buttonbar .ui-icon { + background: transparent center 0 url(../../../assets/gallery/upicon.png) no-repeat; + height: 16px; + margin: 0; + padding: 12px 0; + top: 0; + } +.ui-icon.ui-icon-plusthick {} +.ui-button:hover .ui-icon.ui-icon-plusthick { background-position: center -40px; } +.ui-icon.ui-icon-circle-arrow-e { background-position: center -80px; } +.ui-button:hover .ui-icon.ui-icon-circle-arrow-e { background-position: center -120px; } +.ui-icon.ui-icon-cancel { background-position: center -160px; } +.ui-button:hover .ui-icon.ui-icon-cancel { background-position: center -200px; } +.ui-icon.ui-icon-trash { background-position: center -240px; } +.ui-button:hover .ui-icon.ui-icon-trash { background-position: center -280px; } + +.files .ui-icon { background: transparent center 0 url(../../../assets/gallery/upicon.png) no-repeat; } +.files .ui-icon.ui-icon-circle-arrow-e { background-position: center -91px; } +.files .ui-button:hover .ui-icon.ui-icon-circle-arrow-e { background-position: center -131px; } +.files .ui-icon.ui-icon-cancel { background-position: center -171px; } +.files .ui-button:hover .ui-icon.ui-icon-cancel { background-position: center -211px; } +.files .ui-icon.ui-icon-trash { background-position: center -251px; } +.files .ui-button:hover .ui-icon.ui-icon-trash { background-position: center -291px; } \ No newline at end of file diff --git a/app/assets/stylesheets/widget_gallery.css b/app/assets/stylesheets/widget_gallery.css new file mode 100644 index 0000000..dd9f959 --- /dev/null +++ b/app/assets/stylesheets/widget_gallery.css @@ -0,0 +1,70 @@ +.widget_gallery { + margin-bottom: 20px; +} +.widget_gallery:after { + display: table; + width: 100%; + content: ''; +} +.widget_gallery ul { + list-style: none; + margin: 0; + padding: 0; +} +.widget_gallery li a { + display: block; +} +.widget_gallery li a img { + height: auto; + display: block; +} + +/* widget 1 */ +.w1 ul { + margin: 0 -1%; +} +.w1 li { + float: left; + margin: 1%; +} +.w1.c2 li { width: 48%; } +.w1.c3 li { width: 31.3333%; } +.w1.c4 li { width: 23%; } +.w1.c5 li { width: 18%; } +.w1.c6 li { width: 14.6666%; } +.w1 li a { + -webkit-transition: opacity 0.3s ease; + -moz-transition: opacity 0.3s ease; + transition: opacity 0.3s ease; +} +.w1 li a:hover { + opacity: 0.8; + position: relative; +} +.w1 li a img { + width: 100%; +} + +/* widget 2 */ +.w2 li { + width: 100%; +} +.w2 li a img { + width: 100%; + height: auto; +} +.w2 li a { + position: relative; + overflow: hidden; + color: #fff; + text-transform: capitalize; +} +.w2 li a .desc { + position: absolute; + bottom: -60px; + opacity: 0; + display: block; + width: 100%; + padding: 5%; + background-color: rgba(8, 166, 255, 0.8); +} \ No newline at end of file diff --git a/app/controllers/admin/galleries_controller.rb b/app/controllers/admin/galleries_controller.rb index 69eb5e0..f72f7ea 100644 --- a/app/controllers/admin/galleries_controller.rb +++ b/app/controllers/admin/galleries_controller.rb @@ -1,4 +1,228 @@ -class Admin::GalleriesController < ApplicationController +class Admin::GalleriesController < OrbitAdminController + before_filter :setup_vars def index + @albums = Album.all + @tags = @module_app.tags + end + + def show + @album = Album.find(params[:id]) + @images = @album.album_images + @image_content = [] + @images.each do |image| + @image_content << {"id" => image.id.to_s, "description" => image.description_translations,"tags" => image.tags.collect{|t| t.id.to_s}} + end + @tags = @module_app.tags + respond_to do |h| + h.html + h.json {render json: @image_content} + end + end + + def new + @album = Album.new + @tags = @module_app.tags + @categories = @module_app.categories + end + + def create + album = Album.new(album_params) + album.save! + redirect_to admin_galleries_path + end + + + + def destroy + album = Album.find(params[:id]) + album.destroy + redirect_to admin_galleries_path + + end + + def edit + @album = Album.find(params[:id]) + @tags = @module_app.tags + @categories = @module_app.categories + + end + + def set_cover + if params[:set_cover] == "true" + album = Album.find(params[:album_id]) + image = AlbumImage.find(params[:image_id]) + album.update_attributes({:cover_path => image.file.thumb.url, :cover=>params[:image_id]}) + else + album = Album.find(params[:album_id]) + album.update_attributes({:cover_path => nil, :cover=>"default"}) + end + render :json =>{"success"=>true}.to_json + end + + def get_album_json + albums = Album.all + output = Array.new + + albums.each do |album| + tag_names = Array.new + + album.tag_ids.each do |tag| + tag_names << get_tags.include?(tag) + end + if album.cover_path + cover_path = album.cover_path + else + cover_path = "/assets/gallery/default.jpg" + end + output << { + album_cover_file: "http://#{request.host_with_port}"+cover_path, + album_name: album.name, + album_tag_names: tag_names, + album_link:"http://#{request.host_with_port}#{panel_gallery_back_end_album_get_imgs_json_path(album)}", + } + end + + render :json=>JSON.pretty_generate(output) + end + + def get_imgs_json + album = Album.find(params[:album_id]) + images = album.album_images.all + output = Array.new + + images.each do |image| + tags = Array.new + + image.tag_ids.each do |tag| + tags << get_tags.include?(tag) + end + + if image.file.theater.present? + @image_file = image.file.theater.url + else + @image_file = image.file.url + end + + output << { + image_title: image.title, + image_description: image.description, + image_file: { url: "http://#{request.host_with_port}#{@image_file}", + thumb: "http://#{request.host_with_port}#{image.file.thumb.to_s}"}, + image_tag_names: tags} + end + + render :json=>JSON.pretty_generate(output) + end + + def imgs + @album = Album.find(params[:gallery_id]) + @tag_names = Array.new + @images = @album.album_images.all + @output = Array.new + @images.each do |values| + @output << { _id: values.id.to_s, + theater_link: admin_image_path(values), + description: values.description, + title: values.title, + file: values.file.as_json[:file], + gallery_album_id: values.album_id, + tags: values.tags} + end + render :json=>{"images" => @output, "tags" => @album.tags}.to_json + end + + + + def upload_image + @album = Album.find(params[:album_id]) + @files = params['files'] + a = Array.new + @files.each do |file| + @image = @album.album_images.new + @image.file = file + @image.tags = @album.tags rescue [] + @image.save! + a << {"thumbnail_url"=>@image.file.thumb.url,"url"=>admin_image_path(@image)} + end + render :json=>{"files"=>a}.to_json + end + + def new_images + + if params[:last_image_id] != "" + @lastimage = AlbumImage.find(params[:last_image_id]) + @album = Album.find(params[:album_id]) + @newimages = @album.album_images.where(:created_at.gt => @lastimage.created_at) + else + @album = Album.find(params[:album_id]) + @newimages = @album.album_images + end + + render :layout=>false + end + + + def images_tags + album = Album.find(params[:album_id]) + tags = Array.new + images = album.album_images.all + images.each do |image| + tags << {"id"=>image.id, "tags" => image.tags} + end + render :json=>tags.to_json + end + + def update + @album = Album.find(params[:id]) + tagsToDestroy = [] + tagsToAdd = [] + new_tags = params[:album][:tags] || [] + old_tags = @album.tags.collect{|t| t.id.to_s} + old_tags.each do |tag| + if !new_tags.include?(tag) + tagsToDestroy << tag + end + end + if new_tags != nil + new_tags.each do |tag| + if !old_tags.include?(tag) + tagsToAdd << tag + end + end + end + update_children_image_tag(tagsToDestroy,tagsToAdd) + @album.update_attributes(album_params) + redirect_to admin_gallery_path(@album) + end + + def update_children_image_tag(tagsToDestroy,tagsToAdd) + # tagsToDestroy will contain all tag ids which have to be deleted from the galley_images + # tagsToAdd will contain all tag ids which ve to be added in tall album_images + @images = AlbumImage.all + @images.each do |image| + image_tags = image.tags.collect{|t| t.id.to_s} + tagsToAdd.each do |tag| + image_tags << tag + end + tagsToDestroy.each do |tag| + if image_tags.include?tag + image_tags.delete(tag) + end + end + image.tags = image_tags + image.save + end + end + + private + + def setup_vars + @module_app = ModuleApp.where(:key=>"gallery").first + end + + def album_params + p = params.require(:album).permit! + p["tags"] = p["tags"] || [] + p end end diff --git a/app/controllers/admin/images_controller.rb b/app/controllers/admin/images_controller.rb new file mode 100644 index 0000000..761704b --- /dev/null +++ b/app/controllers/admin/images_controller.rb @@ -0,0 +1,64 @@ +class Admin::ImagesController < ApplicationController + before_filter :setup_vars + def show + @image = AlbumImage.find(params[:id]) + @albumid = @image.album_id + @album = Album.find(@albumid) + @images = @album.album_images.all + end + + def delete_photos + images = params['images'] + images.each do |image| + img = AlbumImage.find(image) + img.delete + end + if params['delete_cover'] == "true" + album = Album.find(params['album_id']) + album.update_attributes(:cover=>"default",:cover_path => nil) + end + render :json =>{"success"=>true}.to_json + end + + def image_tagging + images = params[:image_ids] + tags = params[:tag_ids] || [] + i = nil + images.each do |image| + img = AlbumImage.find(image) + img.tags = tags + img.save + i = img + end + @album = Album.find(i.album_id.to_s) + @images = @album.album_images + @image_content = [] + @images.each do |image| + @image_content << {"id" => image.id.to_s, "description" => image.description_translations,"tags" => image.tags.collect{|t| t.id.to_s}} + end + render :json=>{"galleries" => @image_content}.to_json + end + + def update_image + image = AlbumImage.find(params[:image_id]) + image.update_attributes(update_params) + image.save! + @album = Album.find(image.album_id.to_s) + @images = @album.album_images + @image_content = [] + @images.each do |image| + @image_content << {"id" => image.id.to_s, "description" => image.description_translations,"tags" => image.tags.collect{|t| t.id.to_s}} + end + render :json=>{"galleries" => @image_content}.to_json + end + + private + + def setup_vars + @module_app = ModuleApp.where(:key=>"gallery").first + end + + def update_params + params.require(:album_image).permit! + end +end \ No newline at end of file diff --git a/app/controllers/galleries_controller.rb b/app/controllers/galleries_controller.rb new file mode 100644 index 0000000..424ec43 --- /dev/null +++ b/app/controllers/galleries_controller.rb @@ -0,0 +1,48 @@ +class GalleriesController < ApplicationController + def index + albums = Album.filter_by_categories.collect do |a| + { + "album-name" => a.name, + "link_to_show" => OrbitHelper.url_to_show(a.to_param), + "thumb-src" => a.cover_path || "/assets/gallery/default.jpg" + } + end + { + "data" => albums, + "extras" => {"widget-title"=>"Gallery"} + } + + end + + def show + params = OrbitHelper.params + album = Album.find_by_param(params[:uid]) + images = album.album_images.collect do |a| + { + "link_to_show" => "/" + I18n.locale.to_s + params[:url] + "/-" + a.id.to_s + "?method=theater", + "thumb-src" => a.file.thumb.url + } + end + { + "images" => images, + "data" => {"album-title"=>album.name} + } + end + + def theater + params = OrbitHelper.params + image = AlbumImage.find(params[:uid]) + albumid = image.album_id + album = Album.find(albumid) + images = album.album_images.all + { + "album" => album, + "images" => images, + "image" => image, + "back_to_albums" => OrbitHelper.url_to_show(album.to_param) + } + end + + + +end \ No newline at end of file diff --git a/app/models/album.rb b/app/models/album.rb new file mode 100644 index 0000000..05b8202 --- /dev/null +++ b/app/models/album.rb @@ -0,0 +1,24 @@ +class Album + include Mongoid::Document + include Mongoid::Timestamps + + include OrbitCategory::Categorizable + include OrbitTag::Taggable + include Slug + + field :name, as: :slug_title, localize: true + field :description, localize: true + field :cover, default: "default" + field :cover_path #can refact + field :tag_names + field :uid, type: String + + # has_and_belongs_to_many :tags, :class_name => "GalleryTag" + has_many :album_images, :autosave => true, :dependent => :destroy + accepts_nested_attributes_for :album_images, :allow_destroy => true + + def self.find_by_param(input) + self.find_by(uid: input) + end + +end \ No newline at end of file diff --git a/app/models/album_image.rb b/app/models/album_image.rb new file mode 100644 index 0000000..fcaa0b3 --- /dev/null +++ b/app/models/album_image.rb @@ -0,0 +1,15 @@ +class AlbumImage + include Mongoid::Document + include Mongoid::Timestamps + include OrbitTag::Taggable + + mount_uploader :file, GalleryUploader + + field :title + field :description, localize: true + + # has_and_belongs_to_many :tags, :class_name => "GalleryTag" + + belongs_to :album + +end \ No newline at end of file diff --git a/app/uploaders/gallery_uploader.rb b/app/uploaders/gallery_uploader.rb new file mode 100644 index 0000000..a87ac5f --- /dev/null +++ b/app/uploaders/gallery_uploader.rb @@ -0,0 +1,86 @@ +# encoding: utf-8 +module CarrierWave + module Uploader + module Versions + def recreate_version!(version) + already_cached = cached? + cache_stored_file! if !already_cached + send(version).store! + if !already_cached && @cache_id + tmp_dir = File.expand_path(File.join(cache_dir, cache_id), CarrierWave.root) + FileUtils.rm_rf(tmp_dir) + end + end + end + end +end + +class GalleryUploader < CarrierWave::Uploader::Base + + # Include RMagick or ImageScience support: + # include CarrierWave::RMagick + # include CarrierWave::ImageScience + include CarrierWave::MiniMagick + + # Choose what kind of storage to use for this uploader: + # storage :file + # storage :s3 + + # Override the directory where uploaded files will be stored. + # This is a sensible default for uploaders that are meant to be mounted: + def store_dir + "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" + end + + # Provide a default URL as a default if there hasn't been a file uploaded: + # def default_url + # "/images/fallback/" + [version_name, "default.png"].compact.join('_') + # end + + # Process files as they are uploaded: + # process :scale => [200, 300] + # + # def scale(width, height) + # # do something + # end + + # Create different versions of your uploaded files: + # version :thumb do + # process :scale => [50, 50] + # end + + version :thumb do + process :resize_to_fill => [200, 200] + end + + version :theater do + process :resize_to_limit => [1920, 1080] + end + + version :mobile do + process :resize_to_limit => [1152, 768] + end + + # Add a white list of extensions which are allowed to be uploaded. + # For images you might use something like this: + # def extension_white_list + # %w(jpg jpeg gif png) + # end + + # Override the filename of the uploaded files: + # def filename + # "something.jpg" if original_filename + # end + +# def manipulate! +# raise current_path.inspect +# image = ::MiniMagick::Image.open(current_path) +# image = yield(image) +# image.write(current_path) +# ::MiniMagick::Image.open(current_path) +# rescue ::MiniMagick::Error, ::MiniMagick::Invalid => e +# raise CarrierWave::ProcessingError.new("Failed to manipulate with MiniMagick, maybe it is not an image? Original Error: #{e}") +# end + +end + diff --git a/app/views/admin/galleries/_album.html.erb b/app/views/admin/galleries/_album.html.erb new file mode 100644 index 0000000..9ae2301 --- /dev/null +++ b/app/views/admin/galleries/_album.html.erb @@ -0,0 +1,22 @@ +
  • + + <% if album.cover == "default" %> + <%= image_tag "gallery/default.jpg" %> + <% else %> + + <% end %> +

    <%= album.name %>

    +
    + +
      + <% album.tags.each do |tag| %> + <% r = @tags.select { |k| k.id.to_s == tag.id.to_s } %> +
    • <%= r.map {|t| t.name}[0]%>
    • + <%end%> +
    +
  • \ No newline at end of file diff --git a/app/views/admin/galleries/_form.html.erb b/app/views/admin/galleries/_form.html.erb new file mode 100644 index 0000000..0f212b8 --- /dev/null +++ b/app/views/admin/galleries/_form.html.erb @@ -0,0 +1,106 @@ +<% content_for :page_specific_css do %> + <%= stylesheet_link_tag "lib/main-forms" %> + <%= stylesheet_link_tag "lib/fileupload" %> + <%= stylesheet_link_tag "lib/main-list" %> +<% end %> +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "lib/bootstrap-fileupload" %> + <%= javascript_include_tag "lib/bootstrap-datetimepicker" %> + <%= javascript_include_tag "lib/datetimepicker/datetimepicker.js" %> + <%= javascript_include_tag "lib/modal-preview" %> + <%= javascript_include_tag "lib/file-type" %> +<% end %> +
    + +
    + + + + + + +
    + + +
    + + +
    + +
    + <%= f.select(:category_id, @categories.collect {|p| [ p.title, p.id ] }) %> +
    +
    + +
    + +
    + + +
    + +
    + <%@tags.each do |tag|%> + + <%end %> +
    +
    + +
    + +
    + + +
    + + + + <% I18n.available_locales.each_with_index do |locale, i| %> + +
    +
    + <%= f.fields_for :name_translations do |name| %> + <%= label_tag(locale, t("gallery.album_name"),:class=>"control-label muted") %> +
    + <%= name.text_field locale, :class => "input-block-level", :placeholder=>"Title",:value => (@album.name_translations[locale] rescue nil) %> +
    + <% end %> +
    +
    + <%= f.fields_for :description_translations do |desc| %> + <%= label_tag(locale, t("gallery.album_desc"), :class=>"control-label muted") %> +
    +
    + <%= desc.text_area locale, :class => "ckeditor input-block-level", :value => (@album.description_translations[locale] rescue nil)%> +
    +
    + <% end %> +
    +
    + <% end %> + +
    + +
    + +
    + <%= f.submit t("gallery.save"), :class=> "btn btn-primary bt-form-save" %> +
    + +
    \ No newline at end of file diff --git a/app/views/admin/galleries/_image.html.erb b/app/views/admin/galleries/_image.html.erb new file mode 100644 index 0000000..b93beb8 --- /dev/null +++ b/app/views/admin/galleries/_image.html.erb @@ -0,0 +1,13 @@ +
  • + + + +
      +
    • ">
    • +
    • +
    • +
    +
    + +
    +
  • \ No newline at end of file diff --git a/app/views/admin/galleries/create.js.erb b/app/views/admin/galleries/create.js.erb new file mode 100644 index 0000000..36cfe29 --- /dev/null +++ b/app/views/admin/galleries/create.js.erb @@ -0,0 +1,3 @@ +var gal = new galleryAPI(); +gal.loadAlbums("all"); +rcom.modalWindowClose(); diff --git a/app/views/admin/galleries/edit.html.erb b/app/views/admin/galleries/edit.html.erb new file mode 100644 index 0000000..a875509 --- /dev/null +++ b/app/views/admin/galleries/edit.html.erb @@ -0,0 +1,3 @@ +<%= form_for @album, :url => {:action => "update"}, :html => {:class => 'form-horizontal main-forms'} do |f| %> + <%= render :partial => 'form', :locals => {:f => f} %> +<% end %> diff --git a/app/views/admin/galleries/index.html.erb b/app/views/admin/galleries/index.html.erb index 3d3570d..1b96dc4 100644 --- a/app/views/admin/galleries/index.html.erb +++ b/app/views/admin/galleries/index.html.erb @@ -1,2 +1,20 @@ -

    Admin::Galleries#index

    -

    Find me in app/views/admin/galleries/index.html.erb

    + + +<% content_for :page_specific_css do %> + <%= stylesheet_link_tag "gallery" %> +<% end %> + +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "jquery.masonry.min.js" %> + <%= javascript_include_tag "jquery.lite.image.resize.js" %> + <%= javascript_include_tag "gallery" %> +<% end %> + + + + + diff --git a/app/views/admin/galleries/new.html.erb b/app/views/admin/galleries/new.html.erb new file mode 100644 index 0000000..474df33 --- /dev/null +++ b/app/views/admin/galleries/new.html.erb @@ -0,0 +1,5 @@ +
    +<%= form_for @album, :url => {:action => "create"}, :html => {:class => 'form-horizontal main-forms'} do |f| %> + <%= render :partial => 'form', :locals => {:f => f} %> +<% end %> +
    diff --git a/app/views/admin/galleries/new_images.html.erb b/app/views/admin/galleries/new_images.html.erb new file mode 100644 index 0000000..cdf89ca --- /dev/null +++ b/app/views/admin/galleries/new_images.html.erb @@ -0,0 +1,3 @@ +<% @newimages.each do |image| %> + <%= render :partial=>"image", :object=>image %> +<% end %> \ No newline at end of file diff --git a/app/views/admin/galleries/show.html.erb b/app/views/admin/galleries/show.html.erb new file mode 100644 index 0000000..0b0b2ab --- /dev/null +++ b/app/views/admin/galleries/show.html.erb @@ -0,0 +1,243 @@ + +<%= stylesheet_link_tag "gallery" %> +<%= stylesheet_link_tag "lib/tags-groups" %> + + +
    +
    + Back +
    + +
    + + +
    + + +
    + +
    +
    +
    + +
    +
    +
    + +
    +
    + Drop files here +
    + +
    + +
    +
    + +
    +
    +
    +
    + +
    + + +
    + + + + + +<% content_for :page_specific_javascript do %> + <%= javascript_include_tag "jquery.masonry.min.js" %> + <%= javascript_include_tag "jquery.lite.image.resize.js" %> + <%= javascript_include_tag "lib/checkbox.card" %> + <%= javascript_include_tag "file-upload/vendor/jquery.ui.widget.js" %> + <%= javascript_include_tag "file-upload/tmpl.min.js" %> + <%= javascript_include_tag "file-upload/load-image.min.js" %> + <%= javascript_include_tag "file-upload/canvas-to-blob.min.js" %> + <%= javascript_include_tag "file-upload/jquery.iframe-transport.js" %> + <%= javascript_include_tag "file-upload/jquery.fileupload.js" %> + <%= javascript_include_tag "file-upload/jquery.fileupload-fp.js" %> + <%= javascript_include_tag "file-upload/jquery.fileupload-ui.js" %> + <%= javascript_include_tag "file-upload/drop-zone.js" %> + <%= javascript_include_tag "gallery" %> +<% end %> + + + + + + + diff --git a/app/views/admin/galleries/upload_panel.html.erb b/app/views/admin/galleries/upload_panel.html.erb new file mode 100755 index 0000000..d5f563f --- /dev/null +++ b/app/views/admin/galleries/upload_panel.html.erb @@ -0,0 +1,107 @@ + + +<%= csrf_meta_tag %> +<%= javascript_include_tag "jquery-latest" %> +<%= stylesheet_link_tag "jquery-ui" %> +<%= stylesheet_link_tag "jquery.fileupload-ui.css" %> + + + +
    +
    + <%= form_for @album, :url => panel_gallery_back_end_upload_image_path, :html => {:class => 'clear'} do |f| %> +
    + + + + + +
    + + <% end %> +
    +
    +
    +
    +
    + + + +
    + + <%= javascript_include_tag "jquery-ui.min" %> + <%= javascript_include_tag "jquery.tmpl.min" %> + <%= javascript_include_tag "jquery.iframe-transport" %> + <%= javascript_include_tag "jquery.fileupload" %> + <%= javascript_include_tag "jquery.fileupload-ui" %> + <%= javascript_include_tag "upload" %> + + + + + diff --git a/app/views/admin/images/show.html.erb b/app/views/admin/images/show.html.erb new file mode 100644 index 0000000..500c2d3 --- /dev/null +++ b/app/views/admin/images/show.html.erb @@ -0,0 +1,59 @@ + +<%= stylesheet_link_tag "gallery_old" %> + + + +<%# content_for :page_specific_javascript do %> + <%= javascript_include_tag "rss" %> + <%= javascript_include_tag "galleryAPI" %> +<%# end %> + + + + + + + diff --git a/app/views/admin/images/upload_panel.html.erb b/app/views/admin/images/upload_panel.html.erb new file mode 100755 index 0000000..be4552b --- /dev/null +++ b/app/views/admin/images/upload_panel.html.erb @@ -0,0 +1,111 @@ + + +<%= csrf_meta_tag %> +<%= javascript_include_tag "jquery-latest" %> +<%= stylesheet_link_tag "jquery-ui" %> +<%= stylesheet_link_tag "jquery.fileupload-ui.css" %> + + + +
    +
    +<%= form_for @album, :url => panel_gallery_back_end_album_path(@album), :html => {:class => 'clear'} do |f| %> + + +
    + + + + + +
    + + <% end %> +
    +
    +
    +
    +
    + + + +
    + + <%= javascript_include_tag "jquery-ui.min" %> + <%= javascript_include_tag "jquery.tmpl.min" %> + <%= javascript_include_tag "jquery.iframe-transport" %> + <%= javascript_include_tag "jquery.fileupload" %> + <%= javascript_include_tag "jquery.fileupload-ui" %> + <%= javascript_include_tag "upload" %> + + + + + diff --git a/app/views/galleries/index.html.erb b/app/views/galleries/index.html.erb new file mode 100644 index 0000000..648b75c --- /dev/null +++ b/app/views/galleries/index.html.erb @@ -0,0 +1 @@ +<%= render_view %> \ No newline at end of file diff --git a/app/views/galleries/show.html.erb b/app/views/galleries/show.html.erb new file mode 100644 index 0000000..9f04326 --- /dev/null +++ b/app/views/galleries/show.html.erb @@ -0,0 +1 @@ +<%= render_view %> diff --git a/app/views/galleries/theater.html.erb b/app/views/galleries/theater.html.erb new file mode 100644 index 0000000..abd77f4 --- /dev/null +++ b/app/views/galleries/theater.html.erb @@ -0,0 +1,72 @@ +<% data = action_data + @images = data["images"] + @album = data["album"] + @image = data["image"] + @back_link = data["back_to_albums"] +%> + +<%= stylesheet_link_tag "gallery_frontend" %> + + + +<%# content_for :page_specific_javascript do %> + <%= javascript_include_tag "galleryAPI_frontend" %> + <%#= javascript_include_tag "jquery.tinyscrollbar" %> + <%= javascript_include_tag "rss" %> +<%# end %> + + + + + + + diff --git a/config/routes.rb b/config/routes.rb index e8a4834..5ca6ba4 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -4,7 +4,18 @@ Rails.application.routes.draw do scope "(:locale)", locale: Regexp.new(locales.join("|")) do namespace :admin do - resources :galleries + resources :galleries do + get "imgs" => "galleries#imgs" + end + resources :images + post "galleries/upload_image" => "galleries#upload_image" + + get "new_images" => "galleries#new_images" + post "galleries/set_cover" => "galleries#set_cover" + post "galleries/delete_photos" => "images#delete_photos" + post "galleries/update_image" => "images#update_image" + post "galleries/image_tagging" => "images#image_tagging" + # match "image_tagging" => "album_images#image_tagging" end end end diff --git a/lib/gallery/engine.rb b/lib/gallery/engine.rb index defd750..d167910 100644 --- a/lib/gallery/engine.rb +++ b/lib/gallery/engine.rb @@ -11,9 +11,18 @@ module Gallery side_bar do head_label_i18n 'gallery.gallery', icon_class: "icons-pictures" available_for [:admin,:manager,:sub_manager] - active_for_controllers ({:private=>['gallery']}) + active_for_controllers (['admin/galleries','admin/images']) head_link_path "admin_galleries_path" + context_link 'gallery.all', + :link_path=>"admin_galleries_path" , + :priority=>1, + :active_for_action=>{'admin/galleries'=>"index"} + + context_link 'gallery.new', + :link_path=>"new_admin_gallery_path" , + :priority=>2, + :active_for_action=>{'admin/galleries'=>"new"} end end end