Línea 1: |
Línea 1: |
| + | //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*/ | | /*hide empty table columns*/ |
| ( function ( $, mw ) { | | ( function ( $, mw ) { |
− | $('.smwtable th').each(function(i) { | + | $('.highlight-publication').first().css('background-color', '#bdffff'); |
− | var remove = 0;
| + | $('.smwtable tr th').each(function(i) { |
− | | + | //select all tds in this column |
− | var tds = $(this).parents('table').find('tr td:nth-child(' + (i + 1) + ')')
| + | var tds = $(this).parents('table') |
− | tds.each(function(j) { if (this.innerHTML == '') remove++; });
| + | .find('tr td:nth-child(' + (i + 1) + ')'); |
− | | + | //check if all the cells in this column are empty |
− | if (remove == ($('#mytable tr').length - 1)) {
| + | if(tds.length == tds.filter(':empty').length) { |
− | $(this).hide();
| + | //hide header |
− | tds.hide();
| + | $(this).hide(); |
− | }
| + | //hide cells |
− | }) | + | tds.hide(); |
| + | } |
| + | }); |
| | | |
| } ( jQuery, mediaWiki ) ); | | } ( jQuery, mediaWiki ) ); |
Línea 68: |
Línea 119: |
| /*blinking + register tour first step*/ | | /*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()){ | + | $( 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"); | | $("#pt-createaccount a").prop("href", "http://cnbguatemala.org/index.php?title=Especial:SemanticSignup&tour=registro"); |
| for(i=0;i<10;i++) { | | for(i=0;i<10;i++) { |
Línea 78: |
Línea 130: |
| //mw.guidedTour.setTourCookie( 'registroprelude'); | | //mw.guidedTour.setTourCookie( 'registroprelude'); |
| } | | } |
| + | |
| + | }); |
| | | |
| | | |