MediaWiki:Gadget-Reader.js

De WikiEducator
Saltar a: navegación, buscar

Nota: después de guardar, quizás necesites refrescar la caché de tu navegador para ver los cambios.

  • Firefox / Safari: Mantén presionada Mayús mientras pulsas el botón Actualizar, o presiona Ctrl+F5 o Ctrl+R (⌘+R en Mac)
  • Google Chrome: presiona Ctrl+Shift+R (⌘+Mayús+R en Mac)
  • Internet Explorer: mantén presionada Ctrl mientras pulsas Actualizar, o presiona Ctrl+F5
  • Opera: vacía la caché en Herramientas → Preferencias
//<source lang="javascript">
// read-mostly layout adjustments for vector skin to make left panel into slideout drawer
$(function () {
  var ppos = -164;
  var pmenuheight = $(window).height()-15;
  var weReaderMode = false;
  var weReaderWidth = mw.user.options.get('userjs-weReader') || 1024;
  function reader(){
    if (!weReaderMode && ($(window).width() <= weReaderWidth)) {
      weReaderMode = true;
        $('head').append('<style>#p-search {margin-top: 30px !important; margin-bottom: 30px; width: 145px;} #gcse,#simpleSearch {width: 145px !important;} #cse-search-box .searchButton{display: none;}</style>');
      $('#mw-panel').css({position: 'fixed', top: '2px', left: ppos + 'px', background: '#f3f3f3', 'border-right': 'solid black', 'border-bottom': 'solid black', 'z-index': '10'})
                 .wrapInner('<div id="panelmenu" style="height: ' + pmenuheight + 'px; overflow: auto" />')
                 .prepend('<div id="panelbutton" style="position: absolute; top: 0px; background:black; color:white; padding: 10px 8px 10px 172px; border-top-right-radius: 8px; border-bottom-right-radius: 8px;">WikiEducator</div>');
      $('#p-logo,.editsection,#n-practice').hide();
      $('#content').css('margin-left', '0px').css('border', 'none');
      $('#p-search').insertBefore('#p-Navigation');
      $.each(['namespaces', 'views', 'cactions'], function (i, v) {
        $('#p-' + v + ' ul:first').css({'list-style': 'none', 'margin-bottom': '1em', 'line-height': 2}).insertBefore('#p-Navigation');
      });
      $('#ca-watch,#ca-unwatch').removeClass('icon');
      $('#p-personal').insertAfter('#p-Navigation')
                      .addClass('portal')
                      .css('position', 'static')
                      .css('right', '0px')
                      .find('ul').wrap('<div class="body" />').end()
                      .find('h5').css('display', 'block').end()
                      .find('li').css('float', 'none');
      $('#left-navigation').css('top', '0px');
      $('#right-navigation').css('margin-top', '0px');
      $('#head-base').css('height', '40px');
      $('#panelbutton').click(function(e) {
        e.preventDefault();
        ppos = (ppos === 0) ? -164 : 0;
        $('#mw-panel').animate( {left: ppos }, 'fast');
      });
    }
  }
  $(window).resize(function() {
    reader();
    if (weReaderMode) {
      $('#mw-head-base').css('height', '3em');
    }
  });
  reader();
});