Advertisement
Guest User

Linux.org.ru Classic v2

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