Diferencia entre revisiones de «MediaWiki:Common.js»
Ir a la navegación
Ir a la búsqueda
Busca en cnbGuatemala con Google
(No se muestran 71 ediciones intermedias de 2 usuarios) | |||
Línea 1: | Línea 1: | ||
− | /* | + | //collapse default TOC on opening pages |
− | if ( | + | function hideToc() { |
− | + | var toc = document.getElementById('toc').getElementsByTagName('ul')[0]; | |
+ | var toggleLink = document.getElementById('togglelink'); | ||
+ | toc.style.display = 'none'; | ||
+ | } | ||
+ | hideToc(); | ||
+ | |||
+ | /*table grouping*/ | ||
+ | |||
+ | $(function() { | ||
+ | function groupTable($rows, startIndex, total){ | ||
+ | if (total === 0){ | ||
+ | return; | ||
+ | } | ||
+ | var i , currentIndex = startIndex, count=1, lst=[]; | ||
+ | var tds = $rows.find('td:eq('+ currentIndex +')'); | ||
+ | var ctrl = $(tds[0]); | ||
+ | lst.push($rows[0]); | ||
+ | for (i=1;i<=tds.length;i++){ | ||
+ | if (ctrl.text() == $(tds[i]).text()){ | ||
+ | count++; | ||
+ | $(tds[i]).addClass('deleted'); | ||
+ | lst.push($rows[i]); | ||
+ | } | ||
+ | else{ | ||
+ | if (count>1){ | ||
+ | ctrl.attr('rowspan',count); | ||
+ | groupTable($(lst),startIndex+1,total-1) | ||
+ | } | ||
+ | count=1; | ||
+ | lst = []; | ||
+ | ctrl=$(tds[i]); | ||
+ | lst.push($rows[i]); | ||
+ | } | ||
+ | } | ||
} | } | ||
+ | |||
+ | var cols; | ||
+ | jQuery('.groupTable tr').each(function () { | ||
+ | cols = jQuery(this).children('th, td'); | ||
+ | cols.eq(1).detach().insertBefore(cols.eq(0)); | ||
+ | }); | ||
+ | |||
+ | groupTable($('.groupTable tr:has(td)'),0,1); | ||
+ | $('.groupTable .deleted').remove(); | ||
+ | }); | ||
+ | |||
+ | |||
+ | /*hide empty table columns*/ | ||
+ | ( function ( $, mw ) { | ||
+ | $('.highlight-publication').first().css('background-color', '#bdffff'); | ||
+ | $('.smwtable tr th').each(function(i) { | ||
+ | //select all tds in this column | ||
+ | var tds = $(this).parents('table') | ||
+ | .find('tr td:nth-child(' + (i + 1) + ')'); | ||
+ | //check if all the cells in this column are empty | ||
+ | if(tds.length == tds.filter(':empty').length) { | ||
+ | //hide header | ||
+ | $(this).hide(); | ||
+ | //hide cells | ||
+ | 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*/ | ||
+ | |||
+ | $( document ).ready(function() { | ||
+ | if (mw.cookie.get('inicio_tour')!==null && mw.cookie.get('registro_tour')===null && mw.cookie.get('registroprelude_tour')===null ){ | ||
+ | $("#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 | /*the first tour | ||
− | mw.guidedTour.setTourCookie(' | + | mw.guidedTour.setTourCookie('inicio_tour'); |
*/ | */ | ||
Revisión actual del 11:42 26 dic 2020
//collapse default TOC on opening pages function hideToc() { var toc = document.getElementById('toc').getElementsByTagName('ul')[0]; var toggleLink = document.getElementById('togglelink'); toc.style.display = 'none'; } hideToc(); /*table grouping*/ $(function() { function groupTable($rows, startIndex, total){ if (total === 0){ return; } var i , currentIndex = startIndex, count=1, lst=[]; var tds = $rows.find('td:eq('+ currentIndex +')'); var ctrl = $(tds[0]); lst.push($rows[0]); for (i=1;i<=tds.length;i++){ if (ctrl.text() == $(tds[i]).text()){ count++; $(tds[i]).addClass('deleted'); lst.push($rows[i]); } else{ if (count>1){ ctrl.attr('rowspan',count); groupTable($(lst),startIndex+1,total-1) } count=1; lst = []; ctrl=$(tds[i]); lst.push($rows[i]); } } } var cols; jQuery('.groupTable tr').each(function () { cols = jQuery(this).children('th, td'); cols.eq(1).detach().insertBefore(cols.eq(0)); }); groupTable($('.groupTable tr:has(td)'),0,1); $('.groupTable .deleted').remove(); }); /*hide empty table columns*/ ( function ( $, mw ) { $('.highlight-publication').first().css('background-color', '#bdffff'); $('.smwtable tr th').each(function(i) { //select all tds in this column var tds = $(this).parents('table') .find('tr td:nth-child(' + (i + 1) + ')'); //check if all the cells in this column are empty if(tds.length == tds.filter(':empty').length) { //hide header $(this).hide(); //hide cells 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*/ $( document ).ready(function() { if (mw.cookie.get('inicio_tour')!==null && mw.cookie.get('registro_tour')===null && mw.cookie.get('registroprelude_tour')===null ){ $("#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');*/