From 4a58142c462dae441e638a873bfc0aa5cb112328 Mon Sep 17 00:00:00 2001 From: Wikimedia Espana Date: Sat, 7 Jul 2012 08:49:38 -0700 Subject: [PATCH] =?utf8?q?A=C3=B1ado=20el=20javascript=20para=20variar=20l?= =?utf8?q?as=20im=C3=A1genes,=20registr=C3=A1ndolo=20en=20el=20ResourceLoa?= =?utf8?q?der.=20El=20fichero=20home.js=20=20proviene=20del=20tema=20de=20?= =?utf8?q?wmes,=20hab=C3=ADa=20un=20segundo=20fichero=20javascript=20(jQue?= =?utf8?q?ry=201.4.4),=20no=20incluido=20por=20incluir=20ya=20jQuery=20Med?= =?utf8?q?iaWiki.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- HomePageWMES.php | 7 +++++++ js/home.js | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100755 js/home.js diff --git a/HomePageWMES.php b/HomePageWMES.php index 020ea15..f54b2d4 100644 --- a/HomePageWMES.php +++ b/HomePageWMES.php @@ -15,6 +15,12 @@ /* Deriva del fichero wp-content/themes/wmes-theme/home-page.php del tema para WordPress */ $wgHooks['ParserFirstCallInit'][] = 'efSetupHomepageWMES'; +$wgResourceModules['ext.homepage-wmes'] = array( + 'scripts' => 'home.js', + 'dependencies' => 'jquery', + 'localBasePath' => dirname( __FILE__ ) . '/js', + 'remoteExtPath' => 'HomePageWMES/js' +); function efSetupHomepageWMES(&$parser) { $parser->setHook( 'Portada', 'efHookHomepageWMES' ); @@ -49,6 +55,7 @@ function landingbox($nombre, $class, $texto, $enlace2, $titulo2) { function efHookHomepageWMES( $input, array $args, Parser $parser, PPFrame $frame ) { global $wgOut; $wgOut->addInlineStyle('h1 { display: none }'); // FIXME + $wgOut->addModules( 'ext.homepage-wmes' ); $html = '
diff --git a/js/home.js b/js/home.js new file mode 100755 index 0000000..826d6b2 --- /dev/null +++ b/js/home.js @@ -0,0 +1,53 @@ +(function($) { + +$.fn.extend({ + dmWidgetContentLandingboxForm: function(widget) + { + var $form = this.find('form:first'); + this.dmWidgetContentBaseMediaForm(widget, { + accept: '#dm_media_bar li.file.image' + }); + } +}); +})(jQuery); + +(function($) { +$(document).ready(function() { + + var position = 0; + var img_count = 5; + var slideshowItems = $('.slideshow-item'); + slideshowItems.hide(); + $('#slideshow-item-0').show(); + function nextSlide(){ + var oldItem = $('#slideshow-item-'+position); + if (position < img_count -1){ + position ++; + }else{ + position = 0; + } + var newItem = $('#slideshow-item-'+position); + hideSlide(oldItem); + showSlide(newItem); + interval(); + } + function showSlide(item){ + item.fadeIn('slow'); + } + function hideSlide(item){ + item.hide(); + } + var intervalTimeout = null; + function interval() + { + if (intervalTimeout) + { + clearTimeout(intervalTimeout); + } + intervalTimeout = setTimeout(nextSlide, 5 * 700); + } + interval(); +}); +})(jQuery); + + -- 2.30.2