iks: virtonomica форум

Добавление кнопки ответить как прочитанные на верх страницы. Так-же скрывает сообщения, подпись и информацию пользователя под spoiler, в зависимости от ваших настроек.

  1. // ==UserScript==
  2. // @name iks: virtonomica форум
  3. // @namespace virtonomica
  4. // @description Добавление кнопки ответить как прочитанные на верх страницы. Так-же скрывает сообщения, подпись и информацию пользователя под spoiler, в зависимости от ваших настроек.
  5. // @include http*://*virtonomic*.*/*/forum/forum_new/*/view*
  6. // @include http*://*virtonomic*.*/*/forum/forum_new/*/topic/*/view*
  7. // @version 1.33
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. var run = function() {
  12. $("div#content > table").each(function() {
  13. if($(this).html().indexOf('Создать тему') + 1 )
  14. $(this).append( $('div#content > table.pagingContainer > tbody > tr').html() );
  15. });
  16. },
  17.  
  18. strCss = '.forumIks_exit { background: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\' width=\'10\' height=\'10\'><path fill=\'none\' stroke=\'rgb(142,143,143)\' stroke-width=\'2\' d=\'M0,0 L10,10 M0,10 L10,0\' /></svg>") no-repeat;'
  19. +' position: absolute; top:-5px; right:0; margin:0; padding:0; width:10px; height:10px; border: 4px solid gray; border-radius:50%; font-size:18px; color:darkred; cursor:pointer}'
  20. +' .forumIks_but { width:50%; margin-top:10px; cursor:pointer; color:white; border:1px solid #708090; border-radius: 10px; background: #708090;'
  21. +' background: linear-gradient(top, #e1e1e1, #708090, #e1e1e1);'
  22. +' background: -webkit-linear-gradient(top, #e1e1e1, #708090, #e1e1e1);'
  23. +' background: -moz-linear-gradient(top, #e1e1e1, #708090, #e1e1e1);'
  24. +' background: -ms-linear-gradient(top, #e1e1e1, #708090, #e1e1e1);'
  25. +' background: -o-linear-gradient(top, #e1e1e1, #708090, #e1e1e1) }',
  26. str = '<div id="forumSettings" style="position:fixed; margin:0 auto; padding:0; display:none; background: #EEE none repeat;'
  27. +' border: 2px solid #b4b4b4; box-shadow: 0 0 0 2px #708090, 0 0 0 4px #b4b4b4; border-radius:11px;"><div style="position:relative; margin:0; padding:0">'
  28. +'<h1 style="width:100%; text-align:center">Настройки форума</h1><table style="margin:5px">'
  29. +'<tr><td>Скрывать большие сообщения в форуме:</td><td>'
  30. +'<select name="topic">'
  31. +'<option value=0>Не скрывать</option>'
  32. +'<option value=1>Только первое</option>'
  33. +'<option value=2>По всему форуму</option>'
  34. +'</select>'
  35. +'</td></tr>'
  36. +'<tr name="topic"><td>Сколько символов скрывать:</td><td>'
  37. +'<input type="text" name="topic1" size="4" value="250" style="width:95%; border:2px solid #708090; border-radius:3px; background:#e1e1e1; text-align:right">'
  38. +'</td></tr>'
  39. +'<tr><td>Скрывать информацию об авторе:</td><td>'
  40. +'<select name="user">'
  41. +'<option value=0>Не скрывать</option>'
  42. +'<option value=1>Только первое</option>'
  43. +'<option value=2>По всему форуму</option>'
  44. +'</select>'
  45. +'</td></tr>'
  46. +'<tr name="user"><td>Как скрывать информацию об авторе:</td><td>'
  47. +'<select name="user1" style="width:100%">'
  48. +'<option value=0>С аватором</option>'
  49. +'<option value=1>Ниже аватора</option>'
  50. +'</select>'
  51. +'</td></tr>'
  52. +'<tr><td>Подпись:</td><td>'
  53. +'<select name="signature" style="width:100%">'
  54. +'<option value=0>Не скрывать</option>'
  55. +'<option value=1>Скрывать</option>'
  56. +'<option value=2>Удалять</option>'
  57. +'</select>'
  58. +'</td></tr>'
  59. +'</td></tr>'
  60. +'<tr><td align="center" colspan="2"><input type="button" value="Сохранить" class="forumIks_but"></td></tr>'
  61. +'</table>'
  62. +'<div id="forumExitBloc" title="Закрыть" class="forumIks_exit"></div>'
  63. +'</div></div>',
  64.  
  65. topic = function(){
  66. var str, str1,
  67. o = { 'top': '5px', 'left': '5px', 'topic': 1, 'topic1': 250, 'user': 2, 'user1': 1, 'signature': 0 },
  68. workTopic = function(id, p) {
  69. str = $(id).html();
  70. if(str.length > o['topic1']) {
  71. $(id).html( '<div class="bbSpoiler" style="padding:0; border:none"><div class="bbSpoilerTitle">'
  72. +'<a href="#" onclick="return xbbSpoiler(this)" style="text-decoration:none"><span><strong><u>[+] Развернуть</u></strong>'
  73. +'<p style="color:#000; font-weight:normal">' + str.replace(/<[^>]+>/g,'').replace(/\[\+\] spoiler/g,'').replace(/\[-\] spoiler/g,' ').substring(0, o['topic1']) + '...</p>'
  74. +'</span><span style="display:none"><strong><u>[-] Свернуть</u></strong></span></a></div>'
  75. +'<div class="bbSpoilerText" style="display: none"><hr>'+ str + '</div></div>');
  76. }
  77. },
  78. work = function(id, p) {
  79. str = '';
  80. $(id).find('script').remove();
  81. $(id).parent().css('width','170');
  82. if(o['user1']==1 && p) {
  83. str = '<table width="164" cellspacing="0" cellpadding="0" border="0" style="margin-left:4px;margin-bottom:5px;">' + $(id).find('table:first').html() + '</table>';
  84. $(id).find('table:first').remove();
  85. }
  86. $(id).html( str +'<div class="bbSpoiler" style="padding:0; border:none"><div class="bbSpoilerTitle">'
  87. +'<a href="#" onclick="return xbbSpoiler(this)" style="text-decoration:none"><span><small><u>[+] Показать</u></small>'
  88. +'</span><span style="display:none"><small><u>[-] Скрыть</u></small></span></a></div>'
  89. +'<div class="bbSpoilerText" style="padding:0; display: none;">' + $(id).html() + '</div></div>' );
  90. };
  91. if( window.localStorage.getItem('forumSettings') ) {
  92. o = JSON.parse( window.localStorage.getItem('forumSettings') );
  93. if(!o.signature) o.signature = 0;
  94. }
  95. // Сообщения
  96. switch ( o['topic'] ) {
  97. case '1':
  98. workTopic( $('table.message_color2:first tr:nth-child(3) > td[id]'), true );
  99. break;
  100. case '2':
  101. $('table.message_color2 tr:nth-child(3) > td[id]').each(function(){
  102. workTopic( $(this), true );
  103. });
  104. break;
  105. default:
  106. }
  107. // Автор соообщения
  108. switch ( o['user'] ) {
  109. case '1':
  110. work( $('table.message_color2:first tr:nth-child(2) > td:nth-child(1) > noindex'), true );
  111. break;
  112. case '2':
  113. $('table.message_color2 tr:nth-child(2) > td:nth-child(1) > noindex').each(function() {
  114. work( $(this), true );
  115. });
  116. break;
  117. default:
  118. }
  119. // Подпись
  120. switch ( o['signature'] ) {
  121. case '1':
  122. $('table.message_color2 tr:nth-child(4) > td.signature').each(function(){
  123. work( $(this), false );
  124. });
  125. break;
  126. case '2':
  127. $('table.message_color2 tr:nth-child(4)').remove();
  128. break;
  129. default:
  130. }
  131. /* Настройки */
  132. $('#forumSettings').css({'top': ($('body').height()/2-$('#forumSettings').height()/2-5) + 'px',
  133. 'left': ($('body').width()/2-$('#forumSettings').width()/2-5) + 'px',
  134. 'display':'none'});
  135. $('#forumSettings select[name="topic"]').val(o['topic']).change();
  136. $('#forumSettings input[name="topic1"]').val(o['topic1']);
  137. $('#forumSettings select[name="user"]').val(o['user']).change();
  138. $('#forumSettings select[name="user1"]').val(o['user1']).change();
  139. $('#forumSettings select[name="signature"]').val(o['signature']).change();
  140. if( $('#forumSettings select[name="topic"]').val() == 0 ) $('#forumSettings tr[name="topic"]').css('display', 'none');
  141. if( $('#forumSettings select[name="user"]').val() == 0 ) $('#forumSettings tr[name="user"]').css('display', 'none');
  142. // Показать/Скрыть
  143. $('div.forumIks_exit').click( function() {
  144. $('#forumSettings').css('display', 'none');
  145. });
  146. $('#forumLinkSettings').click( function() {
  147. if( $('#forumSettings').css('display') == 'block' ) $('#forumSettings').css('display', 'none');
  148. else $('#forumSettings').css('display', 'block');
  149. });
  150. // Только цифры
  151. $('#forumSettings inputnput[name]').bind("change keyup input click", function() {
  152. $(this).val( parseInt( $(this).val().replace(/[^0-9]/g, '') ) | 0 );
  153. });
  154. // Отследим выбор select
  155. $('#forumSettings select').change(function() {
  156. switch ( $(this).attr('name') ) {
  157. case 'topic':
  158. if( $(this).val() > 0 ) $('#forumSettings tr[name="topic"]').removeAttr('style');
  159. else $('#forumSettings tr[name="topic"]').css('display', 'none');
  160. break;
  161. case 'user':
  162. if( $(this).val() > 0 ) $('#forumSettings tr[name="user"]').removeAttr('style');
  163. else $('#forumSettings tr[name="user"]').css('display', 'none');
  164. break;
  165. case 'signature':
  166. if( $(this).val() > 0 ) $('#forumSettings tr[name="signature"]').removeAttr('style');
  167. else $('#forumSettings tr[name="signature"]').css('display', 'none');
  168. break;
  169. default:
  170. }
  171. });
  172. // Сохранить
  173. $('#forumSettings input.forumIks_but').click( function() {
  174. window.localStorage.setItem('forumSettings',
  175. JSON.stringify( {'top': $('#forumSettings').css('top') + 'px',
  176. 'left': $('#forumSettings').css('left') + 'px',
  177. 'topic': $('#forumSettings select[name="topic"]').val(),
  178. 'topic1': $('#forumSettings input[name]').val(),
  179. 'user': $('#forumSettings select[name="user"]').val(),
  180. 'user1': $('#forumSettings select[name="user1"]').val(),
  181. 'signature': $('#forumSettings select[name="signature"]').val()
  182. } ));
  183. $('#forumSettings').css('display', 'none');
  184. location.reload();
  185. });
  186. }
  187.  
  188. if(window.top == window) {
  189. if( window.location.href.indexOf('/topic') + 1 ) {
  190. $( '<style/>', {text: strCss } ).appendTo('head');
  191. $('#user_info.relams.user > div.floatright > span.menu').append('<span class="linka"><a id="forumLinkSettings" href="#">Настройки форума</a></span>');
  192. $('body').append( str );
  193. $( '<script/>', { text: '(' + topic.toString() + ')()' } ).appendTo('head');
  194. } else
  195. $( '<script/>', { text: '(' + run.toString() + ')()' } ).appendTo('head');
  196. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址