r112362 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112361‎ | r112362 | r112363 >
Date:22:14, 24 February 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Follow up to r112215;
Modified paths:
  • /trunk/extensions/SemanticResultFormats/Gallery/SRF_Gallery.php (modified) (history)
  • /trunk/extensions/SemanticResultFormats/Gallery/resources/ext.srf.jcarousel.js (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticResultFormats/Gallery/SRF_Gallery.php
@@ -35,10 +35,7 @@
3636 static $carouselNr = 0;
3737
3838 // Set attributes for jcarousel
39 - $attribs = array(
40 - 'id' => 'carousel' . ++$carouselNr,
41 - 'class' => 'jcarousel jcarousel-skin-smw',
42 - 'style' => 'display:none;', // Avoid js loading issues by not displaying anything until js is able to do so.
 39+ $dataAttribs = array(
4340 'wrap' => 'both', // Whether to wrap at the first/last item (or both) and jump back to the start/end.
4441 'vertical' => 'false', // Orientation: vertical = false means horizontal
4542 'rtl' => 'false', // Directionality: rtl = false means ltr
@@ -46,13 +43,23 @@
4744
4845 // Use perrow parameter to determine the scroll sequence.
4946 if ( empty( $this->params['perrow'] ) ) {
50 - $attribs['scroll'] = 1; // default 1
 47+ $dataAttribs['scroll'] = 1; // default 1
5148 } else {
52 - $attribs['scroll'] = $this->params['perrow'];
53 - $attribs['visible'] = $this->params['perrow'];
 49+ $dataAttribs['scroll'] = $this->params['perrow'];
 50+ $dataAttribs['visible'] = $this->params['perrow'];
5451 }
 52+
 53+ $attribs = array(
 54+ 'id' => 'carousel' . ++$carouselNr,
 55+ 'class' => 'jcarousel jcarousel-skin-smw',
 56+ 'style' => 'display:none;', // Avoid js loading issues by not displaying anything until js is able to do so.
 57+ );
 58+
 59+ foreach ( $dataAttribs as $name => $value ) {
 60+ $attribs['data-' . $name] = $value;
 61+ }
5562
56 - $ig->setAttributes( $mAttribs );
 63+ $ig->setAttributes( $attribs );
5764
5865 // Load javascript module
5966 SMWOutputs::requireResource( 'ext.srf.jcarousel' );
Index: trunk/extensions/SemanticResultFormats/Gallery/resources/ext.srf.jcarousel.js
@@ -13,7 +13,7 @@
1414
1515 // Bind individual elements containing class jcarousel as the plug-in
1616 // requires different id's
17 - $(".jcarousel").each(function() {
 17+ $( '.jcarousel' ).each( function() {
1818 var $this = $( this );
1919
2020 // Display carousel only after js is loaded and is ready otherwise display=none
@@ -21,11 +21,11 @@
2222
2323 // Call the jcarousel plug-in
2424 $this.jcarousel( {
25 - scroll: parseInt( $this.attr( 'scroll' ), 10 ), // Number of items to be scrolled
26 - visible: parseInt( $this.attr( 'visible' ), 10 ), // calculated and set visible elements
27 - wrap: $this.attr( 'wrap' ), // Options are "first", "last", "both" or "circular"
28 - vertical: $this.attr( 'vertical' ) === 'true', // Whether the carousel appears in horizontal or vertical orientation
29 - rtl: $this.attr( 'rtl' ) === 'true' // Directionality
 25+ scroll: parseInt( $this.attr( 'data-scroll' ), 10 ), // Number of items to be scrolled
 26+ visible: parseInt( $this.attr( 'data-visible' ), 10 ), // calculated and set visible elements
 27+ wrap: $this.attr( 'data-wrap' ), // Options are "first", "last", "both" or "circular"
 28+ vertical: $this.attr( 'data-vertical' ) === 'true', // Whether the carousel appears in horizontal or vertical orientation
 29+ rtl: $this.attr( 'data-rtl' ) === 'true' // Directionality
3030 } );
3131 } );
3232

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r112215bug 34411 patch by MWJames, somewhat modifiedjeroendedauw16:28, 23 February 2012