MediaWiki:Test.js: различия между версиями

Страница интерфейса MediaWiki
Нет описания правки
Метка: отменено
Нет описания правки
Метка: отменено
Строка 1: Строка 1:
$(function() {
$(function() {
  var btn = $('<div>▲ Наверх</div>').css({
    document.body.style.backgroundColor = "#f9fafc";
    position:'fixed', bottom:'20px', right:'20px',
     document.body.style.color = "#202124";
    padding:'5px 10px', background:'#333', color:'#fff',
     cursor:'pointer', borderRadius:'5px', zIndex:9999,
    boxShadow:'0 2px 5px rgba(0,0,0,0.4)'
  }).appendTo('body');


  var menu = $('<div></div>').css({
    $("table").css({
    position:'fixed', bottom:'60px', right:'20px',
        "border-collapse": "collapse",
    maxHeight:'300px', overflow:'auto',
        "border-radius": "12px",
     padding:'5px 0', background:'#333', border:'1px solid #222',
        "overflow": "hidden",
     borderRadius:'5px', display:'none', zIndex:9999,
        "box-shadow": "0 2px 6px rgba(0,0,0,0.1)"
    boxShadow:'0 2px 8px rgba(0,0,0,0.5)'
     });
  }).appendTo('body');
 
    $("table tr:nth-child(even)").css("background-color", "#f1f3f4");
     $("table tr:nth-child(odd)").css("background-color", "#ffffff");
 
    $("table th").css({
        "background-color": "#4285f4",
        "color": "white",
        "padding": "8px"
    });
 
    $("table td").css({
        "padding": "6px 10px"
    });


  $('h1, h2, h3').each(function() {
     $("a").css({
    var id = $(this).attr('id');
        "color": "#1a73e8",
    if (!id) {
        "text-decoration": "none",
      id = 'hdr-' + Math.random().toString(36).substr(2,5);
        "transition": "color 0.3s"
      $(this).attr('id', id);
    }
     var link = $('<div>'+$(this).text()+'</div>').css({
      cursor:'pointer', padding:'4px 8px',
      background:'#fff', color:'#000',
      margin:'2px 5px', borderRadius:'3px'
     }).hover(
     }).hover(
      function(){ $(this).css('background','#eee'); },
        function() { $(this).css("color", "#d93025"); },
      function(){ $(this).css('background','#fff'); }
        function() { $(this).css("color", "#1a73e8"); }
     ).appendTo(menu);
     );
     link.click(function() {
 
      $('html, body').animate({scrollTop:$('#'+id).offset().top}, 500);
     $("h1, h2, h3").css({
      menu.hide();
        "color": "#202124",
        "border-bottom": "2px solid #e8eaed",
        "padding-bottom": "4px"
     });
     });
  });


  btn.click(function() {
    $("blockquote").css({
     menu.toggle();
        "border-left": "4px solid #4285f4",
  });
        "padding": "6px 12px",
        "background-color": "#f1f3f4",
        "border-radius": "8px"
     });
});
});

Версия от 19:26, 23 августа 2025

$(function() {
    document.body.style.backgroundColor = "#f9fafc";
    document.body.style.color = "#202124";

    $("table").css({
        "border-collapse": "collapse",
        "border-radius": "12px",
        "overflow": "hidden",
        "box-shadow": "0 2px 6px rgba(0,0,0,0.1)"
    });

    $("table tr:nth-child(even)").css("background-color", "#f1f3f4");
    $("table tr:nth-child(odd)").css("background-color", "#ffffff");

    $("table th").css({
        "background-color": "#4285f4",
        "color": "white",
        "padding": "8px"
    });

    $("table td").css({
        "padding": "6px 10px"
    });

    $("a").css({
        "color": "#1a73e8",
        "text-decoration": "none",
        "transition": "color 0.3s"
    }).hover(
        function() { $(this).css("color", "#d93025"); },
        function() { $(this).css("color", "#1a73e8"); }
    );

    $("h1, h2, h3").css({
        "color": "#202124",
        "border-bottom": "2px solid #e8eaed",
        "padding-bottom": "4px"
    });

    $("blockquote").css({
        "border-left": "4px solid #4285f4",
        "padding": "6px 12px",
        "background-color": "#f1f3f4",
        "border-radius": "8px"
    });
});