From 2b57e170ef801ef4579b8d54e901355b8e1a958e Mon Sep 17 00:00:00 2001 From: yanxd Date: Thu, 10 Jul 2014 10:05:45 +0800 Subject: [PATCH] want that image popup in html when user click on thumbnail. --- app/helpers/application_helper.rb | 2 +- public/images/colorbox/border1.png | Bin 0 -> 1057 bytes public/images/colorbox/border2.png | Bin 0 -> 170 bytes public/images/colorbox/loading.gif | Bin 0 -> 9427 bytes public/javascripts/application.js | 15 +++++ public/javascripts/jquery.colorbox-min.js | 7 +++ public/stylesheets/nyan.css | 70 ++++++++++++++++++++++ 7 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 public/images/colorbox/border1.png create mode 100644 public/images/colorbox/border2.png create mode 100644 public/images/colorbox/loading.gif create mode 100644 public/javascripts/jquery.colorbox-min.js diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c9dc4fa26..e6bbf6ed6 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1396,7 +1396,7 @@ module ApplicationHelper # Returns the javascript tags that are included in the html layout head def javascript_heads - tags = javascript_include_tag('jquery-1.8.3-ui-1.9.2-ujs-2.0.3', 'application') + tags = javascript_include_tag('jquery-1.8.3-ui-1.9.2-ujs-2.0.3', 'application', 'jquery.colorbox-min') unless User.current.pref.warn_on_leaving_unsaved == '0' tags << "\n".html_safe + javascript_tag("$(window).load(function(){ warnLeavingUnsaved('#{escape_javascript l(:text_warn_on_leaving_unsaved)}'); });") end diff --git a/public/images/colorbox/border1.png b/public/images/colorbox/border1.png new file mode 100644 index 0000000000000000000000000000000000000000..0ddc704051b651f43cffb1326dee3ba563727acc GIT binary patch literal 1057 zcmV++1m63JP)r zAF%JpeZBR%PujJ&?cU$mzF@zQ4A^OFY-v$p7aBuKlp}eWDguO+1d;SiQl=<_wN?Ru z$}F)CZO*|QgDyN_U;rRDpw2LP$OLZD@3s^O2w|jPHUa@DKspfu0^h+*kZIDEfdC1N zo&f>EwiE)lfoMlz^h}7DN&?yjR1p>l!e}9cKf%uX+@UK4M1f#6=sL9_;DREMkOewV zfoO+dLI7s`|J0@eorTef?let$#kA*uOgea0n8ZlkOee&KKj{^r91I77A-eH8ps|f4 zR&?ZffL&>V(CCVRrvEA8dEmR#;6Zc*yd|vTX9rg5T7axEP5v+4Zntml@9#g&NiFW~ z?mj*|Jp4E|`@kX*eYOBf8o9vM2x2{|-tBguH=E5{t@UOONZ2e{4& z;l%aj`Xu76lRR)cL2`%#edS`pxl`^D?M4w&McV@gar&!0#ef2FI8(b z#DWlmm{Y_y#PX{mPj?a|R4~TXasN0V$FYKyxRUf(A#@Ibt8K`1v19a7GHVLjpv*rykJg@YO(c90K=lUwwq8p*)1_eipDm!ER2ms;1lNLjj`TTFBVX&~i5Rt@CB zKy)o2>smmrY5{rGKrRgAbrreRZnyhd1&FOAkAKnU>`_;KpIE`X&?=xfi#c? z(m)zW11T>$=X;6&QrscWyDBVl)L*rL{B9r@2J%=7$e|XHz7~+7fn1QRR3&ddR0UFn b{1IRPnb~f(1W%SC00000NkvXXu0mjf?Cjqi literal 0 HcmV?d00001 diff --git a/public/images/colorbox/border2.png b/public/images/colorbox/border2.png new file mode 100644 index 0000000000000000000000000000000000000000..aa62a0b724371d1f0a8e183c5f3707d2f7aecd63 GIT binary patch literal 170 zcmeAS@N?(olHy`uVBq!ia0vp^MnKHS!3HGfT>QHUNJ*BsMwA5SrjnPU>t&Bgig1lwFnk>0^Moe(#2j_SDR=qm2cFWSad{!^LK345wm0*~eFZqAj Sx%>#AxeT7JelF{r5}E+(L_S*p literal 0 HcmV?d00001 diff --git a/public/images/colorbox/loading.gif b/public/images/colorbox/loading.gif new file mode 100644 index 0000000000000000000000000000000000000000..602ce3c3ae9182650eca594ff76e4c27498f39e0 GIT binary patch literal 9427 zcmciIX;>5Y`Zw^&kbx{fLNXyN2~I-9fRL~W0YO6u5M?m|q=?9_f+C`VVvlXZgg_P` zVN(!LHWhcVE{Gc-Dk>^?tcNPr2)1rrw6(4Mw@>>Fp!Vq-d(L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V2UW#A|riWz{C_0NeeQTEwhP?6ktS_nsakAX)dfbnJgsC%&y*Zq_;0f3gr)iT`~Z2 zU`M$=d(m&=kcOQUnuqG^W}&>J4O$t3W{H^XK@M-iqkM_=Amb)<3~2HH>fYw4Gc@vCS*&oecYLWhhKRO$nJ^ zk{TV$s|Vs16wO3ow}r8+Rz}_jc~Stj&%$=F$rKr4Jo7eYn*%XxCf6|j(3MI`x@UF} z1Erq@=tKM)mHs31Y^RkdGngRONXBpBQT-2EVZ;V1HRiiXBLZK>LvC*OTQgvn-mV$& zLw+}IX%JNeWFBw%nAF%#{~ zxE(E{cwk@wAUZKpU@v*1-xOp~AU_ekvK=&&p8+7HI6Q=$XX?Bx>jU@u*FU65H`1sp z$dn`pn&-pqZ(d=zzC9y4{jCu>%!gEiN|>CIg1Lba4WPx;*B(W4gIyYYlkHvICO`H# zAe~mSbg)mH`qm?H@>`D^@btGHG!#!k={NYphQEI6F~x*^>v6vPXPv}0fJU47fI9V- zdABswA^wG_PYQwf3+a~5n5qpF(alx9uGtaspT+V+>lcRFr6t1!s|}J zV(MjKaUPeKcf*AM_R%8zx0e${|KJ!NE32;W2m#R=yx+=s%rUveUZq|I 0) { + $(element).colorbox({rel:'nofollow'}); + } + if($(element).attr('href').indexOf('.png') > 0) { + $(element).colorbox({rel:'nofollow'}); + } + if($(element).attr('href').indexOf('.gif') > 0) { + $(element).colorbox({rel:'nofollow'}); + } + }) +} +$(document).ready(img_thumbnails); diff --git a/public/javascripts/jquery.colorbox-min.js b/public/javascripts/jquery.colorbox-min.js new file mode 100644 index 000000000..f563217f0 --- /dev/null +++ b/public/javascripts/jquery.colorbox-min.js @@ -0,0 +1,7 @@ +/*! + Colorbox v1.5.10 - 2014-06-26 + jQuery lightbox and modal window plugin + (c) 2014 Jack Moore - http://www.jacklmoore.com/colorbox + license: http://www.opensource.org/licenses/mit-license.php +*/ +(function(t,e,i){function n(i,n,o){var r=e.createElement(i);return n&&(r.id=Z+n),o&&(r.style.cssText=o),t(r)}function o(){return i.innerHeight?i.innerHeight:t(i).height()}function r(e,i){i!==Object(i)&&(i={}),this.cache={},this.el=e,this.value=function(e){var n;return void 0===this.cache[e]&&(n=t(this.el).attr("data-cbox-"+e),void 0!==n?this.cache[e]=n:void 0!==i[e]?this.cache[e]=i[e]:void 0!==X[e]&&(this.cache[e]=X[e])),this.cache[e]},this.get=function(e){var i=this.value(e);return t.isFunction(i)?i.call(this.el,this):i}}function h(t){var e=W.length,i=(z+t)%e;return 0>i?e+i:i}function a(t,e){return Math.round((/%/.test(t)?("x"===e?E.width():o())/100:1)*parseInt(t,10))}function s(t,e){return t.get("photo")||t.get("photoRegex").test(e)}function l(t,e){return t.get("retinaUrl")&&i.devicePixelRatio>1?e.replace(t.get("photoRegex"),t.get("retinaSuffix")):e}function d(t){"contains"in y[0]&&!y[0].contains(t.target)&&t.target!==v[0]&&(t.stopPropagation(),y.focus())}function c(t){c.str!==t&&(y.add(v).removeClass(c.str).addClass(t),c.str=t)}function g(e){z=0,e&&e!==!1&&"nofollow"!==e?(W=t("."+te).filter(function(){var i=t.data(this,Y),n=new r(this,i);return n.get("rel")===e}),z=W.index(_.el),-1===z&&(W=W.add(_.el),z=W.length-1)):W=t(_.el)}function u(i){t(e).trigger(i),ae.triggerHandler(i)}function f(i){var o;if(!G){if(o=t(i).data(Y),_=new r(i,o),g(_.get("rel")),!$){$=q=!0,c(_.get("className")),y.css({visibility:"hidden",display:"block",opacity:""}),L=n(se,"LoadedContent","width:0; height:0; overflow:hidden; visibility:hidden"),b.css({width:"",height:""}).append(L),D=T.height()+k.height()+b.outerHeight(!0)-b.height(),j=C.width()+H.width()+b.outerWidth(!0)-b.width(),A=L.outerHeight(!0),N=L.outerWidth(!0);var h=a(_.get("initialWidth"),"x"),s=a(_.get("initialHeight"),"y"),l=_.get("maxWidth"),f=_.get("maxHeight");_.w=(l!==!1?Math.min(h,a(l,"x")):h)-N-j,_.h=(f!==!1?Math.min(s,a(f,"y")):s)-A-D,L.css({width:"",height:_.h}),J.position(),u(ee),_.get("onOpen"),O.add(I).hide(),y.focus(),_.get("trapFocus")&&e.addEventListener&&(e.addEventListener("focus",d,!0),ae.one(re,function(){e.removeEventListener("focus",d,!0)})),_.get("returnFocus")&&ae.one(re,function(){t(_.el).focus()})}v.css({opacity:parseFloat(_.get("opacity"))||"",cursor:_.get("overlayClose")?"pointer":"",visibility:"visible"}).show(),_.get("closeButton")?B.html(_.get("close")).appendTo(b):B.appendTo("
"),w()}}function p(){!y&&e.body&&(V=!1,E=t(i),y=n(se).attr({id:Y,"class":t.support.opacity===!1?Z+"IE":"",role:"dialog",tabindex:"-1"}).hide(),v=n(se,"Overlay").hide(),S=t([n(se,"LoadingOverlay")[0],n(se,"LoadingGraphic")[0]]),x=n(se,"Wrapper"),b=n(se,"Content").append(I=n(se,"Title"),R=n(se,"Current"),P=t('