SHOW:
|
|
- or go back to the newest paste.
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 6 | |
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 | - | oldQuotation = true |
24 | + | oldQuotation = true; |
25 | ||
26 | ////////////////////////////////////////////////////////////// | |
27 | ||
28 | if (window.location.hostname.indexOf('linux.org.ru') != -1) { | |
29 | ||
30 | //window.addEventListener('DOMContentLoaded', function (e) { | |
31 | $ = window.$; | |
32 | if (noFavorites) $('.fav-buttons').hide(); | |
33 | ||
34 | isTango = false; | |
35 | if ($('.msg').first().css('border-radius') != '0px') isTango = true; | |
36 | ||
37 | if (moveAvatar || $('.userpic').length == 0) $('.sign').css('margin-left','0'); | |
38 | $('.msg').css('padding','0'); | |
39 | $('.msg-container').css('margin-left','5px'); | |
40 | $('.msg-container').css('padding-bottom','7px'); | |
41 | ||
42 | $('footer').css('border-top','0'); | |
43 | $('footer').css('border-bottom','0'); | |
44 | $('footer').css('padding-top','0'); | |
45 | $('footer').css('padding-bottom','0'); | |
46 | $('footer').css('margin-bottom','0'); | |
47 | ||
48 | $('.msg h1').css('font-size','x-large'); | |
49 | $('.msg h1').css('padding-left','10px'); | |
50 | $('header').css('margin-bottom','0'); | |
51 | ||
52 | $('.msg_body').css('margin-left','5px'); | |
53 | ||
54 | $('.tags-section-info').css('border-top','0'); | |
55 | $('.tags-section-info').css('border-bottom','0'); | |
56 | $('.tags-section-info').css('padding-top','0'); | |
57 | $('.tags-section-info').css('padding-bottom','0'); | |
58 | $('.tags-section-info').css('padding-left','8px'); | |
59 | ||
60 | // $('.fav-buttons a').css('font-size','100%'); | |
61 | ||
62 | $('div[itemprop="articleBody"]').css('padding-bottom','0'); | |
63 | ||
64 | $('.title').css('padding-left','5px'); | |
65 | ||
66 | var navPath = ""; | |
67 | ||
68 | //////////////////////////// Замена "ёлочек" /////////////////////////////////////////////// | |
69 | ||
70 | if (oldQuotation) { | |
71 | $('.msg_body p').each(function(){ | |
72 | msgtext = $(this).html(); | |
73 | msgtext = msgtext.split('«').join('"'); | |
74 | msgtext = msgtext.split('»').join('"'); | |
75 | $(this).html(msgtext); | |
76 | }); | |
77 | } | |
78 | ||
79 | //////////////////////////////////////////////////////////////////////////////////////////// | |
80 | ||
81 | $('.msg').each(function() { | |
82 | ||
83 | message = $(this); | |
84 | title = message.children('.title'); | |
85 | container = message.children('.msg-container'); | |
86 | messagebody = container.children('.msg_body'); | |
87 | msgfooter = messagebody.children('footer'); | |
88 | reply = messagebody.children('.reply').children('ul'); | |
89 | tags = message.children('.tags-section-info').children('span[itemprop="articleSection"]'); | |
90 | ||
91 | ||
92 | ||
93 | //////////////////////////// FAV-ки в заголовок /////////////////////////////////////////// | |
94 | /* favText = container.children('.fav-buttons').html(); | |
95 | if (favText !== undefined) | |
96 | { | |
97 | titleButtons = $('<div style="float: right;"></div>').addClass('fav-buttons'); | |
98 | titleButtons.appendTo(title); | |
99 | ||
100 | $('#favs_button').appendTo(titleButtons); | |
101 | $('#favs_count').appendTo(titleButtons); | |
102 | $('<span> </span>').appendTo(titleButtons); | |
103 | $('#memories_button').appendTo(titleButtons); | |
104 | $('#memories_count').appendTo(titleButtons); | |
105 | ||
106 | } | |
107 | */ | |
108 | /////////////////////////// ИЩЕМ ССЫЛКИ И ПРЕВРАЩАЕМ ИХ В РЕШЁТКИ ////////////////////// | |
109 | ||
110 | if (gridLinks) { | |
111 | msg_link = ""; | |
112 | ||
113 | reply.children('li').each(function() { | |
114 | msg_link = $(this).children('a').attr('href'); | |
115 | if ($(this).children('a').text() == "Ссылка") $(this).hide(); | |
116 | }); | |
117 | ||
118 | oldTitle = title.html(); | |
119 | title.html('[<a href="'+msg_link+'">#</a>] '+oldTitle); | |
120 | } | |
121 | else | |
122 | { | |
123 | if (isTango && tags.length == 0) container.css('padding-top','7px'); | |
124 | } | |
125 | ||
126 | ///////////////////////// ИЩЕМ ТЕГИ И ПЕРЕНОСИМ НАВИГАЦИЮ НАВЕРХ ////////////////////// | |
127 | ||
128 | if (tags !== undefined && oldNav) | |
129 | { | |
130 | tagsText = '<i class="icon-tag"></i> '; | |
131 | ||
132 | navPath2 = tags.html(); | |
133 | ||
134 | if (navPath2 !== undefined) | |
135 | { | |
136 | navPath = navPath2; | |
137 | navPath2 = navPath.split('<i class="icon-tag">')[0]; | |
138 | if (navPath2.length > 0) navPath = navPath2; | |
139 | } | |
140 | ||
141 | tagList = tags.children('.tag'); | |
142 | if (tagList.length==0) tagsText = ''; | |
143 | ||
144 | tagList.each( function(index) { | |
145 | if (index>0) tagsText += ', '; | |
146 | tagName = $(this).html(); | |
147 | tagsText += '<a class="tag" href="/tag/'+tagName+'" rel="tag">'+tagName+'</a>'; | |
148 | }); | |
149 | ||
150 | if (tagsDown) { | |
151 | tags.appendTo(messagebody.children('div[itemprop="articleBody"]')); | |
152 | msgfooter.css('margin-top','7px'); | |
153 | ||
154 | } | |
155 | ||
156 | tags.css('font-size','13px'); | |
157 | tags.html(tagsText); | |
158 | } | |
159 | ||
160 | //////////////////////// ИЩЕМ АВАТАРКУ НЕ НА МЕСТЕ //////////////////////////////////// | |
161 | ||
162 | if (moveAvatar) { | |
163 | msgfooter.children('.userpic').each(function() { | |
164 | messagebody.children('div[itemprop="articleBody"]').css('padding-left','170px'); | |
165 | ||
166 | messagebody.children('footer').css('margin-left','170px'); | |
167 | messagebody.children('.reply').css('margin-left','170px'); | |
168 | ||
169 | userpic = $(this); | |
170 | ||
171 | userpic.css('padding-top','5px'); | |
172 | userpic.css('margin-right','10px'); | |
173 | ||
174 | userpic.children('img').attr('width','150px'); | |
175 | userpic.children('img').removeAttr('height'); | |
176 | userpic.prependTo(messagebody); | |
177 | }); | |
178 | } | |
179 | }); | |
180 | ||
181 | //////////////////////// Восстанавливаем навигацию //////////////////////////////////// | |
182 | //<div class="nav"> | |
183 | //<div id="navPath"> | |
184 | ||
185 | if (oldNav && $('#navPath').length == 0 && navPath.length > 0) | |
186 | { | |
187 | navPath = navPath.replace('Форум -','<a href="/forum/">Форум</a> -'); | |
188 | $('#bd').prepend('<div class="nav"><div id="navPath">'+navPath+'</div></div>'); | |
189 | } | |
190 | ||
191 | //}); | |
192 | ||
193 | } |