From 4537f5fe4efc2173ef6619b28236da692665b980 Mon Sep 17 00:00:00 2001 From: John Du Hart Date: Sun, 15 Jan 2012 06:07:24 +0000 Subject: [PATCH] Adding jquery.arrowSteps to core, from UploadWizard --- resources/Resources.php | 4 + .../images/jquery.arrowSteps.divider-ltr.png | Bin 0 -> 307 bytes .../images/jquery.arrowSteps.divider-rtl.png | Bin 0 -> 310 bytes .../images/jquery.arrowSteps.head-ltr.png | Bin 0 -> 939 bytes .../images/jquery.arrowSteps.head-rtl.png | Bin 0 -> 1006 bytes .../images/jquery.arrowSteps.tail-ltr.png | Bin 0 -> 338 bytes .../images/jquery.arrowSteps.tail-rtl.png | Bin 0 -> 485 bytes resources/jquery/jquery.arrowSteps.css | 45 ++++++++++ resources/jquery/jquery.arrowSteps.js | 81 ++++++++++++++++++ 9 files changed, 130 insertions(+) create mode 100644 resources/jquery/images/jquery.arrowSteps.divider-ltr.png create mode 100644 resources/jquery/images/jquery.arrowSteps.divider-rtl.png create mode 100644 resources/jquery/images/jquery.arrowSteps.head-ltr.png create mode 100644 resources/jquery/images/jquery.arrowSteps.head-rtl.png create mode 100644 resources/jquery/images/jquery.arrowSteps.tail-ltr.png create mode 100644 resources/jquery/images/jquery.arrowSteps.tail-rtl.png create mode 100644 resources/jquery/jquery.arrowSteps.css create mode 100644 resources/jquery/jquery.arrowSteps.js diff --git a/resources/Resources.php b/resources/Resources.php index 667d5ca6c8..5a81af7752 100644 --- a/resources/Resources.php +++ b/resources/Resources.php @@ -82,6 +82,10 @@ return array( 'jquery.appear' => array( 'scripts' => 'resources/jquery/jquery.appear.js', ), + 'jquery.arrowSteps' => array( + 'scripts' => 'resources/jquery/jquery.arrowSteps.js', + 'styles' => 'resources/jquery/jquery.arrowSteps.css', + ), 'jquery.async' => array( 'scripts' => 'resources/jquery/jquery.async.js', ), diff --git a/resources/jquery/images/jquery.arrowSteps.divider-ltr.png b/resources/jquery/images/jquery.arrowSteps.divider-ltr.png new file mode 100644 index 0000000000000000000000000000000000000000..0de1ae9cb9c5774a32002464f9dc2710bc276d61 GIT binary patch literal 307 zcmeAS@N?(olHy`uVBq!ia0vp^T0rd2!3-o8U}fi7AzZCsS>Jir4~tLR^<$|M~y_|HNvS_dpS*k|4j}{|ryJ8+ZYETRmMI zLn>}GxpN@Q2qq%gc)AU2}zcMo~Fa0gPQfFP1$c`DMg5QkT+ddv@-uy{nz0C?n zxhvZIRo(1zFUnq?d!_cK?(MZ_Iu#b%EzX@h`Q(|K=bwAAJFW=+-)8=f^WpJ-w{)*x py;*xl^}f1${oyauFRCA4V7|b!qQrN@HJ}F=JYD@<);T3K0RU?Lg`@xg literal 0 HcmV?d00001 diff --git a/resources/jquery/images/jquery.arrowSteps.divider-rtl.png b/resources/jquery/images/jquery.arrowSteps.divider-rtl.png new file mode 100644 index 0000000000000000000000000000000000000000..f3f065199cfe8417f21c60466661cd2550f206e1 GIT binary patch literal 310 zcmeAS@N?(olHy`uVBq!ia0vp^T0rd2!3HGf{tDj&q!^2X+?^QKos)S9a~60+7BevL9R^{>gw^r0|B(qjM<;Wgj}_ZGZWRNwq8~3e1u|rVi8I_#db)Tg9>| z#Wo?BcY^9``J4@m{5KTV!e@L6Rfgl%B%#sn8DN4&t;uc GLK6Uw1a%Vt literal 0 HcmV?d00001 diff --git a/resources/jquery/images/jquery.arrowSteps.head-ltr.png b/resources/jquery/images/jquery.arrowSteps.head-ltr.png new file mode 100644 index 0000000000000000000000000000000000000000..dbcc71b9d419262b3a311c1834ef0fe7ade93108 GIT binary patch literal 939 zcmeAS@N?(olHy`uVBq!ia0y~yV15B)`*SdZ$R2rFAjMc5epdfQekYDis{|whp@dDK{a29w(7BevL z9R^{>bL-CS~w5OB@PpyJ(=#)*c*=l4bc@iq5NSp z&>rheE*yV=dZscpx-cyV>UlIV)#sBXAjvS_(n zq#jEd(Be`Dh3N-C7FVa76!-x$gt0M&X+6-8PZLv}A8Z90!pgFV)5d)6i<|D#_!^%B z4G|RZQ2$^s_r**1Y5a}HfdafhfrN{f^>yT#W`BR-)!@L$^zT*NgA+>A)Ia?1lze~j zv^Zl!29uqncx~K6feN9D|KZ)P;T$YQoIl=gy>r{E?ZE5<-)F1q>vo1u|5Uu&{LZV%L8dYOe5YJ_O5-Wvj0(RmpVl%c^g5g_UbH+ma^5SJ zS@VSVR_Q+BSHAFV&Wpr!vE>$xea~I=?{R7@I=lRaKZL&?v1!jDl^Fs6bw8dJDnn0ng zaz*U|Gd|CGq4->Eu|}gOP-u&MQo6v5uYdlr&v39hFwvoW1~8v6c)I$ztaD0e0suZB BjoAPI literal 0 HcmV?d00001 diff --git a/resources/jquery/images/jquery.arrowSteps.head-rtl.png b/resources/jquery/images/jquery.arrowSteps.head-rtl.png new file mode 100644 index 0000000000000000000000000000000000000000..760798bf7d77a22add696ce535095c8a81227b6f GIT binary patch literal 1006 zcmeAS@N?(olHy`uVBq!ia0y~yV15B)`*SdZ$R2rFAjMc5epdfQekYDis{|whp@dDK{a29w(7BevL z9R^{>o1=d}jUi@Zy?#hZh@32Vk4wfppda?a-`ujKpW@vr5@bk*$ zo3jt>I*{~Y-~9EHt0piq6Gy&O3lI<4zI^9J?{afn24#y)Rs-z?N9+t_-c zbRYApNTyDv?+ahse9S9T+Mrq>z3bd|8(SZRpa*&-bKU2i4PyDmlIL{&r`+=8oGDx} z?dv|DS$(tXz_J6WFRbog`C`!+(75_Ssa%yww%`rX9UQUGch8uoK0&KMZr3@WFZG#j zGc8~Ey5{yJhQ^4-%|M0KM%{up#4UiX_&r69;|Z4x(8N34H+vi$9~hL(6<6sM;1ILm zihX{NeX~?!*8#^DR_h&RDNfM&AhYY-%sD;oQOF09w$7Fxmmhd=gtsncYZPptQVvj3Lmcq~x-pkFfA zoTXPtLg9nhu5;`%r@C0InAQUgWX_m&fTgkhocf%TeJoW>`xbxy<0CAg_#pj@VEQJN z#(53(rSE^vR5Nfo@PBc?#bi~^FD!r3V$Pp8X%u9tyIy-_rjF+V^#|*(SJf@!>=F3z z{e|+m6i+5w#{3yCA=<1TyUjT{325{^rrV#5eG^(5zVCt>R1@S4G03hu7i!SukZOoQ zKcNOSKEJTHbCG)1EQbZa5cT5UGkGe<7M4Dz@T%@B28}k2hc8T>SFRx~_<{o%9bfuZ zMluyLsV~&FeHSFAbV0y^JN6}S$YPdDEPl@6Rkv2YabBPYjNePISE+HfaK^N(`?4WA zvfUx_fmX@V>5;rbCxmwJ#J-F?zKOSS)q&C%Uh8+wQWj7x5Z-lZ@w!w=CfCN@7pBIw zn7S!=J}@g;sy_F$9!nN532N_E%kFZRaKH)Zz+KZrIi|3L0Ug+RO`uVxaVgM&#Rjtl zR&cCoUH7GHtt68nQ#a6o&yvIx0|X*?V_&kyD6<5y{9`&^Z*}1D&bk@Etj6H!>gTe~ HDWM4fRUoql literal 0 HcmV?d00001 diff --git a/resources/jquery/images/jquery.arrowSteps.tail-ltr.png b/resources/jquery/images/jquery.arrowSteps.tail-ltr.png new file mode 100644 index 0000000000000000000000000000000000000000..61340fa8d8edbd8a39fe8bdd1d988125b8edf042 GIT binary patch literal 338 zcmV-Y0j>UtP)z>%&`Cr=RCwC7*Etr$FbqRMB=^UdW%zR zzm(dILi?l4?iAUB5_?i$FWTFiwsxSM9cg1HTHBeH_CYKAq=j8*ZdaPxfMzzLi4AFN zV;b6oMmD2?P3dZLy4Zp~ZABlpq_eH*WE(o#jt;h^x9#a=0X;3DhedR^jQ%X7oBjK) zGMs=6wL0GWrNG0HGBUnXY+3T>t<807*qoM6N<$g2|(cE&u=k literal 0 HcmV?d00001 diff --git a/resources/jquery/images/jquery.arrowSteps.tail-rtl.png b/resources/jquery/images/jquery.arrowSteps.tail-rtl.png new file mode 100644 index 0000000000000000000000000000000000000000..dd2d8e8a31a98e51b03b0a1c18765639030345f7 GIT binary patch literal 485 zcmeAS@N?(olHy`uVBq!ia0vp^T0rd2!3HGf{tDj&q!^2X+?^QKos)S9a~60+7BevL9R^{>z$Nhhe-tMAS&J&=jlb-EQnu!T?4;6*%##FfxomRW?VKM>pI#OE4j2v7e#9oM;W|2+0xgb_Yc}r(%tK5b&7i6c&?n;c`Wt5Zs URqCK2Fcug*UHx3vIVCg!0Ko9LsQ>@~ literal 0 HcmV?d00001 diff --git a/resources/jquery/jquery.arrowSteps.css b/resources/jquery/jquery.arrowSteps.css new file mode 100644 index 0000000000..f8f6e9515f --- /dev/null +++ b/resources/jquery/jquery.arrowSteps.css @@ -0,0 +1,45 @@ +.arrowSteps { + list-style-type: none; + list-style-image: none; + border: 1px solid #666666; + position: relative; +} + +.arrowSteps li { + float: left; + padding: 0px; + margin: 0px; + border: 0 none; +} + +.arrowSteps li div { + padding: 0.5em; + text-align: center; + white-space: nowrap; + overflow: hidden; +} + +.arrowSteps li.arrow div { + /* @embed */ + background: url(images/jquery.arrowSteps.divider-ltr.png) no-repeat right center; +} + +/* applied to the element preceding the highlighted step */ +.arrowSteps li.arrow.tail div { + /* @embed */ + background: url(images/jquery.arrowSteps.tail-ltr.png) no-repeat right center; +} + +/* this applies to all highlighted, including the last */ +.arrowSteps li.head div { + /* @embed */ + background: url(images/jquery.arrowSteps.head-ltr.png) no-repeat left center; + font-weight: bold; +} + +/* this applies to all highlighted arrows except the last */ +.arrowSteps li.arrow.head div { + /* TODO: eliminate duplication of jquery.arrowSteps.head.png embedding */ + /* @embed */ + background: url(images/jquery.arrowSteps.head-ltr.png) no-repeat right center; +} diff --git a/resources/jquery/jquery.arrowSteps.js b/resources/jquery/jquery.arrowSteps.js new file mode 100644 index 0000000000..f9637545dc --- /dev/null +++ b/resources/jquery/jquery.arrowSteps.js @@ -0,0 +1,81 @@ +/** + * jQuery arrowSteps plugin + * Copyright Neil Kandalgaonkar, 2010 + * + * This work is licensed under the terms of the GNU General Public License, + * version 2 or later. + * (see http://www.fsf.org/licensing/licenses/gpl.html). + * Derivative works and later versions of the code must be free software + * licensed under the same or a compatible license. + * + * + * DESCRIPTION + * + * Show users their progress through a series of steps, via a row of items that fit + * together like arrows. One item can be highlighted at a time. + * + * + * SYNOPSIS + * + *
    + *
  • Guard!
  • + *
  • Turn!
  • + *
  • Parry!
  • + *
  • Dodge!
  • + *
  • Spin!
  • + *
  • Ha!
  • + *
  • Thrust!
  • + *
+ * + * + * + */ + +( function( $j ) { + $j.fn.arrowSteps = function() { + this.addClass( 'arrowSteps' ); + var $steps = this.find( 'li' ); + + var width = parseInt( 100 / $steps.length, 10 ); + $steps.css( 'width', width + '%' ); + + // every step except the last one has an arrow at the right hand side. Also add in the padding + // for the calculated arrow width. + var arrowWidth = parseInt( this.outerHeight(), 10 ); + $steps.filter( ':not(:last-child)' ).addClass( 'arrow' ) + .find( 'div' ).css( 'padding-right', arrowWidth.toString() + 'px' ); + + this.data( 'arrowSteps', $steps ); + return this; + }; + + $j.fn.arrowStepsHighlight = function( selector ) { + var $steps = this.data( 'arrowSteps' ); + var $previous; + $j.each( $steps, function( i, step ) { + var $step = $j( step ); + if ( $step.is( selector ) ) { + if ($previous) { + $previous.addClass( 'tail' ); + } + $step.addClass( 'head' ); + } else { + $step.removeClass( 'head tail lasthead' ); + } + $previous = $step; + } ); + }; + +} )( jQuery ); -- 2.20.1