Advertisement
Guest User

Linux.org.ru Classic v5

a guest
Feb 1st, 2013
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // ==UserScript==
  2. // @name        LOR Classic
  3. // @namespace   http://www.linux.org.ru/*
  4. // @namespace   https://www.linux.org.ru/*
  5. // @require     http://code.jquery.com/jquery-1.8.1.min.js
  6. // @version     5
  7. // @author      Sadler
  8. // @grant       none
  9. // ==/UserScript==
  10.  
  11. //////////////////////////// НАСТРОЙКИ ////////////////////////
  12.  
  13. // без иконок "В избранное" и "Отслеживать"
  14. noFavorites = true;
  15. // решётки и заголовки у всех сообщений
  16. gridLinks = true;
  17. // перенести аватарки из футера
  18. moveAvatar = true;
  19. // старый вид тегов и навигации
  20. oldNav = true;
  21. // теги после текста сообщения
  22. tagsDown = true;
  23.  
  24. //////////////////////////////////////////////////////////////
  25.  
  26. if (window.location.hostname.indexOf('linux.org.ru') != -1) {
  27.  
  28. //window.addEventListener('DOMContentLoaded', function (e) {
  29.     $ = window.$;
  30.     if (noFavorites) $('.fav-buttons').hide();
  31.  
  32.     isTango = false;
  33.     if ($('.msg').first().css('border-radius') != '0px') isTango = true;
  34.  
  35.     if (moveAvatar || $('.userpic').length == 0) $('.sign').css('margin-left','0');
  36.     $('.msg').css('padding','0');
  37.     $('.msg-container').css('margin-left','5px');
  38.     $('.msg-container').css('padding-bottom','7px');
  39.  
  40.     $('footer').css('border-top','0');
  41.     $('footer').css('border-bottom','0');
  42.     $('footer').css('padding-top','0');
  43.     $('footer').css('padding-bottom','0');
  44.     $('footer').css('margin-bottom','0');
  45.  
  46.     $('.msg h1').css('font-size','x-large');
  47.     $('.msg h1').css('padding-left','10px');
  48.     $('header').css('margin-bottom','0');
  49.  
  50.     $('.msg_body').css('margin-left','5px');
  51.  
  52.     $('.tags-section-info').css('border-top','0');
  53.     $('.tags-section-info').css('border-bottom','0');
  54.     $('.tags-section-info').css('padding-top','0');
  55.     $('.tags-section-info').css('padding-bottom','0');
  56.     $('.tags-section-info').css('padding-left','8px');
  57.  
  58. //  $('.fav-buttons a').css('font-size','100%');
  59.  
  60.     $('div[itemprop="articleBody"]').css('padding-bottom','0');
  61.  
  62.     $('.title').css('padding-left','5px');
  63.  
  64.     var navPath = "";
  65.  
  66.     $('.msg').each(function() {
  67.  
  68.         message = $(this);
  69.         title = message.children('.title');
  70.         container = message.children('.msg-container');
  71.         messagebody = container.children('.msg_body');
  72.         msgfooter = messagebody.children('footer');
  73.         reply = messagebody.children('.reply').children('ul');
  74.         tags = message.children('.tags-section-info').children('span[itemprop="articleSection"]');
  75.  
  76. //////////////////////////// FAV-ки в заголовок ///////////////////////////
  77. /*  favText = container.children('.fav-buttons').html();
  78.     if (favText !== undefined)
  79.     {
  80.         titleButtons = $('<div style="float: right;"></div>').addClass('fav-buttons');
  81.         titleButtons.appendTo(title);
  82.  
  83.         $('#favs_button').appendTo(titleButtons);
  84.         $('#favs_count').appendTo(titleButtons);
  85.         $('<span> </span>').appendTo(titleButtons);
  86.         $('#memories_button').appendTo(titleButtons);
  87.         $('#memories_count').appendTo(titleButtons);
  88.  
  89.     }
  90. */
  91. /////////////////////////// ИЩЕМ ССЫЛКИ И ПРЕВРАЩАЕМ ИХ В РЕШЁТКИ //////////////////////
  92.  
  93. if (gridLinks) {
  94.         msg_link = "";
  95.  
  96.         reply.children('li').each(function() {
  97.             msg_link = $(this).children('a').attr('href');
  98.             if ($(this).children('a').text() == "Ссылка") $(this).hide();
  99.         });
  100.  
  101.         oldTitle = title.html();
  102.         title.html('[<a href="'+msg_link+'">#</a>] '+oldTitle);
  103. }
  104. else
  105. {
  106.         if (isTango && tags.length == 0) container.css('padding-top','7px');
  107. }
  108.  
  109. ///////////////////////// ИЩЕМ ТЕГИ И ПЕРЕНОСИМ НАВИГАЦИЮ НАВЕРХ //////////////////////
  110.  
  111.         if (tags !== undefined && oldNav)
  112.         {
  113.             tagsText = '<i class="icon-tag"></i> ';
  114.  
  115.             navPath2 = tags.html();
  116.  
  117.             if (navPath2 !== undefined)
  118.             {
  119.                 navPath = navPath2;
  120.                 navPath2 = navPath.split('<i class="icon-tag">')[0];
  121.                 if (navPath2.length > 0) navPath = navPath2;
  122.             }
  123.  
  124.             tagList = tags.children('.tag');
  125.             if (tagList.length==0) tagsText = '';
  126.    
  127.             tagList.each( function(index) {
  128.                 if (index>0) tagsText += ', ';
  129.                 tagName = $(this).html();
  130.                 tagsText += '<a class="tag" href="/tag/'+tagName+'" rel="tag">'+tagName+'</a>';
  131.             });
  132.  
  133. if (tagsDown) {
  134.             tags.appendTo(messagebody.children('div[itemprop="articleBody"]'));
  135.             msgfooter.css('margin-top','7px');
  136.  
  137. }
  138.  
  139.             tags.css('font-size','13px');
  140.             tags.html(tagsText);
  141.         }
  142.  
  143. //////////////////////// ИЩЕМ АВАТАРКУ НЕ НА МЕСТЕ ////////////////////////////////////
  144.  
  145. if (moveAvatar) {
  146.         msgfooter.children('.userpic').each(function() {
  147.             messagebody.children('div[itemprop="articleBody"]').css('padding-left','170px');
  148.  
  149.             messagebody.children('footer').css('margin-left','170px');
  150.             messagebody.children('.reply').css('margin-left','170px');
  151.  
  152.             userpic = $(this);
  153.  
  154.             userpic.css('padding-top','5px');
  155.             userpic.css('margin-right','10px');
  156.  
  157.             userpic.children('img').attr('width','150px');
  158.             userpic.children('img').removeAttr('height');
  159.             userpic.prependTo(messagebody);
  160.         });
  161. }
  162.     });
  163.  
  164. //////////////////////// Восстанавливаем навигацию ////////////////////////////////////
  165. //<div class="nav">
  166. //<div id="navPath">
  167.  
  168.     if (oldNav && $('#navPath').length == 0 && navPath.length > 0)
  169.     {
  170.         navPath = navPath.replace('Форум -','<a href="/forum/">Форум</a> -');
  171.         $('#bd').prepend('<div class="nav"><div id="navPath">'+navPath+'</div></div>');
  172.     }
  173.  
  174. //});
  175.  
  176. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement