View difference between Paste ID: bG74uPAc and AqtPNnhN
SHOW: | | - or go back to the newest paste.
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     3
5+
// @version     4
6
// @author      Sadler
7
// @grant       none
8
// ==/UserScript==
9
10
//////////////////////////// НАСТРОЙКИ ////////////////////////
11
12
// без иконок "В избранное" и "Отслеживать"
13-
//window.addEventListener('load', function (e) {
13+
noFavorites = true;
14
// решётки и заголовки у всех сообщений
15-
	$('.fav-buttons').hide();
15+
gridLinks = true;
16
// перенести аватарки из футера
17-
	$('.sign').css('margin-left','0');
17+
moveAvatar = true;
18
// старый вид тегов и навигации
19
oldNav = true;
20
21
//////////////////////////////////////////////////////////////
22
23
if (window.location.hostname.indexOf('linux.org.ru') != -1) {
24
25
//window.addEventListener('DOMContentLoaded', function (e) {
26
	$ = window.$;
27
	if (noFavorites) $('.fav-buttons').hide();
28
29
	if (moveAvatar || $('.userpic').length == 0) $('.sign').css('margin-left','0');
30
	$('.msg').css('padding','0');
31
	$('.msg-container').css('margin-left','5px');
32
	$('.msg-container').css('padding-bottom','7px');
33
34
	$('footer').css('border-top','0');
35
	$('footer').css('border-bottom','0');
36
	$('footer').css('padding-top','0');
37
	$('footer').css('padding-bottom','0');
38
	$('footer').css('margin-bottom','0');
39-
	$('.fav-buttons a').css('font-size','100%');
39+
40
	$('.msg h1').css('font-size','x-large');
41
	$('.msg h1').css('padding-left','10px');
42
43
	$('.msg_body').css('margin-left','5px');
44
45
	$('.tags-section-info').css('border-top','0');
46
	$('.tags-section-info').css('border-bottom','0');
47
	$('.tags-section-info').css('padding-top','0');
48
	$('.tags-section-info').css('padding-bottom','0');
49
	$('.tags-section-info').css('padding-left','8px');
50
51
//	$('.fav-buttons a').css('font-size','100%');
52
53
	$('div[itemprop="articleBody"]').css('padding-bottom','0');
54
55
	$('.title').css('padding-left','5px');
56
57
	var navPath = "";
58
59
	$('.msg').each(function() {
60
61
		message = $(this);
62
		title = message.children('.title');
63
		container = message.children('.msg-container');
64
		messagebody = container.children('.msg_body');
65
		msgfooter = messagebody.children('footer');
66
		reply = messagebody.children('.reply').children('ul');
67
		tags = message.children('.tags-section-info').children('span[itemprop="articleSection"]');
68
69
//////////////////////////// FAV-ки в заголовок ///////////////////////////
70
/*	favText = container.children('.fav-buttons').html();
71
	if (favText !== undefined)
72
	{
73
		titleButtons = $('<div style="float: right;"></div>').addClass('fav-buttons');
74
		titleButtons.appendTo(title);
75
76
		$('#favs_button').appendTo(titleButtons);
77
		$('#favs_count').appendTo(titleButtons);
78
		$('<span> </span>').appendTo(titleButtons);
79
		$('#memories_button').appendTo(titleButtons);
80
		$('#memories_count').appendTo(titleButtons);
81
82-
			if ($(this).children('a').text() == "Ссылка") {
82+
83-
				$(this).hide();
83+
84-
			}			
84+
85
86
if (gridLinks) {
87
		msg_link = "";
88
89
		reply.children('li').each(function() {
90
			msg_link = $(this).children('a').attr('href');
91
			if ($(this).children('a').text() == "Ссылка") $(this).hide();
92
		});
93-
		if (tags !== undefined)
93+
94
		oldTitle = title.html();
95
		title.html('[<a href="'+msg_link+'">#</a>] '+oldTitle);
96
}
97
98
///////////////////////// ИЩЕМ ТЕГИ И ПЕРЕНОСИМ НАВИГАЦИЮ НАВЕРХ //////////////////////
99
100
		if (tags !== undefined && oldNav)
101
		{
102
			tagsText = '<i class="icon-tag"></i> ';
103
104
			navPath2 = tags.html();
105
106
			if (navPath2 !== undefined)
107
			{
108
				navPath = navPath2;
109
				navPath2 = navPath.split('<i class="icon-tag">')[0];
110
				if (navPath2.length > 0) navPath = navPath2;
111
			}
112
113
			tagList = tags.children('.tag');
114
			if (tagList.length==0) tagsText = '';
115
	
116
			tagList.each( function(index) {
117
				if (index>0) tagsText += ', ';
118
				tagName = $(this).html();
119
				tagsText += '<a class="tag" href="/tag/'+tagName+'" rel="tag">'+tagName+'</a>';
120
			});
121
122
			tags.html(tagsText);
123
		}
124
125
//////////////////////// ИЩЕМ АВАТАРКУ НЕ НА МЕСТЕ ////////////////////////////////////
126
127
if (moveAvatar) {
128
		msgfooter.children('.userpic').each(function() {
129
			messagebody.children('div[itemprop="articleBody"]').css('padding-left','170px');
130
131
			messagebody.children('footer').css('margin-left','170px');
132
			messagebody.children('.reply').css('margin-left','170px');
133
134
			userpic = $(this);
135
136
			userpic.css('padding-top','5px');
137
			userpic.css('margin-right','10px');
138
139
			userpic.children('img').attr('width','150px');
140
			userpic.children('img').removeAttr('height');
141
			userpic.prependTo(messagebody);
142
		});
143
}
144-
	if ($('#navPath').length == 0 && navPath.length > 0)
144+
145
146
//////////////////////// Восстанавливаем навигацию ////////////////////////////////////
147
//<div class="nav">
148
//<div id="navPath">
149
150
	if (oldNav && $('#navPath').length == 0 && navPath.length > 0)
151
	{
152
		navPath = navPath.replace('Форум -','<a href="/forum/">Форум</a> -');
153
		$('#bd').prepend('<div class="nav"><div id="navPath">'+navPath+'</div></div>');
154
	}
155
156
//});
157
158
}