Diferencia entre revisiones de «MediaWiki:Common.js»

De CNB
Ir a la navegación Ir a la búsqueda
Busca en cnbGuatemala con Google

Línea 1: Línea 1:
 
/*hide empty table columns*/
 
/*hide empty table columns*/
 
( function ( $, mw ) {
 
( function ( $, mw ) {
$('.smwtable tr th').each(function(i) {
+
$('.smwtable th').each(function(i) {
    //select all tds in this column
+
    var remove = 0;
    var tds = $(this).parents('table')
+
 
              .find('tr td:nth-child(' + (i + 1) + ')');
+
    var tds = $(this).parents('table').find('tr td:nth-child(' + (i + 1) + ')')
        //check if all the cells in this column are empty
+
    tds.each(function(j) { if (this.innerHTML == '') remove++; });
        if(tds.length == tds.filter(':empty').length) {  
+
 
            //hide header
+
    if (remove == ($('#mytable tr').length - 1)) {
            $(this).hide();
+
        $(this).hide();
            //hide cells
+
        tds.hide();
            tds.hide();
+
    }
        }  
+
})
});
 
  
 
} ( jQuery, mediaWiki ) );
 
} ( jQuery, mediaWiki ) );

Revisión del 18:09 27 nov 2016

/*hide empty table columns*/
( function ( $, mw ) {
$('.smwtable th').each(function(i) {
    var remove = 0;

    var tds = $(this).parents('table').find('tr td:nth-child(' + (i + 1) + ')')
    tds.each(function(j) { if (this.innerHTML == '') remove++; });

    if (remove == ($('#mytable tr').length - 1)) {
        $(this).hide();
        tds.hide();
    }
})

} ( jQuery, mediaWiki ) );


( function ( $, mw ) {

	'use strict';

	mw.guidedTour = mw.guidedTour || {};

	/**
	 * A module for launching guided tours that has no dependencies. This
	 * stops the *ext.guidedTour.lib* being loaded if it's not needed.
	 *
	 * @class mw.guidedTour.launcher
	 * @singleton
	 */
	mw.guidedTour.launcher = {

		/**
		 * Loads the *ext.guidedTour.lib* library and launches the
		 * guided tour.
		 *
		 * See the documentation for `mw.guidedTour.launchTour` for
		 * details of the `tourName` and `tourId` parameters.
		 *
		 * @param {string} tourName Name of tour
		 * @param {string} [tourId='gt-' + tourName + '-' + step] ID of
		 *   tour and step
		 * @return {void} Always, regardless of the return value of
		 *   `mw.guidedTour.launchTour`
		 */
		launchTour: function ( tourName, tourId ) {
			mw.loader.using( 'ext.guidedTour.lib', function () {
				mw.guidedTour.launchTour( tourName, tourId );
			} );
		}

	};

} ( jQuery, mediaWiki ) );


/*ask users to register*/
/*
setTimeout(function(){
    if (mw.cookie.get('inicio_tour')!==null && mw.cookie.get('registro_tour')===null && mw.user.isAnon()){
var answer = confirm ("¿Quieres aprender a registrarte como usuario del sitio?");
if (answer)
window.location="http://cnbguatemala.org/index.php?title=Especial:SemanticSignup&tour=registro";
}
}, 10000);
*/

/*blinking + register tour first step*/  

if (mw.cookie.get('inicio_tour')!==null && mw.cookie.get('registro_tour')===null && mw.cookie.get('registroprelude_tour')===null && mw.user.isAnon()){
$("#pt-createaccount a").prop("href", "http://cnbguatemala.org/index.php?title=Especial:SemanticSignup&tour=registro");
for(i=0;i<10;i++) {
   //$("#pt-createaccount").css({'background-color': 'blue'}, 'slow');
   //$("#pt-createaccount").css({'background-color': 'red'}, 'slow');
  $("#pt-createaccount a").fadeTo('slow', 0.5).fadeTo('slow', 1.0);   
  } 
mw.guidedTour.launcher.launchTour('registroprelude');
//mw.guidedTour.setTourCookie( 'registroprelude');
}



/*the first tour
mw.guidedTour.setTourCookie('inicio_tour');
*/

/*
var conf = mw.config.get([
    'wgNamespaceNumber',
    'wgTitle',
    'wgPageName'
]);
// Only do the following on the Project:Sandbox page.
if ( conf.wgNamespaceNumber === 0  ) {
    // Add a link to the actions menu to Special:Log for this page.
    mw.loader.using( 'mediawiki.util', function () {
        mw.util.addPortletLink(
            'p-cactions',
            mw.util.getUrl( 'Special:Log', { page : conf.wgPageName } ),
            'Logs'
        );
    } );
}
*/

/* Cualquier código JavaScript escrito aquí se cargará para todos los usuarios en cada carga de página */

/* Activa instrumento para definir coordenadas de imágenes como vínculos bajo ImageMap
/*importScriptURI('//tools.wmflabs.org/imagemapedit/ime.js');*/