iks: virtonomica форум

Добавление кнопки ответить как прочитанные на верх страницы. Так-же скрывает шапку на всех страницах кроме первой под spoiler .

目前为 2015-06-22 提交的版本。查看 最新版本

// ==UserScript==
// @name        iks: virtonomica форум
// @namespace   virtonomica
// @description Добавление кнопки ответить как прочитанные на верх страницы. Так-же скрывает шапку на всех страницах кроме первой под spoiler .
// @include     http://*virtonomica*.*/*/forum/forum_new/*/view*
// @include     http://*virtonomica*.*/*/forum/forum_new/*/topic/*/view*
// @version     1.04
// @grant       none
// ==/UserScript==

var run = function() {
  $("div#content > table").each(function() {
    if($(this).html().indexOf('Создать тему') + 1 )
    $(this).append('<tr><td colspan="2">'
                   + '<small>' + $('div#content > table.pagingContainer > tbody > tr > td > table.paging > tbody > tr > td').html().replace(/Страница:/g, '') + '</small>'
                   + $('div#content > table.pagingContainer > tbody > tr > td').html()
                   +'</td></tr>');
  });
}

var topic = function() {
  if( parseInt( $('#content > table.pagingContainer > tbody > tr > td > table.paging > tbody > tr > td > div > span.selected').html() ) > 1 ) {
    var id = $('#content > table:nth-child(9).message_color2 > tbody > tr > td.forum_message_content');
    var str = $(id).html();
    $(id).html( '<div class="bbSpoiler"><div class="bbSpoilerTitle">'
               +'<a href="#" onclick="return xbbSpoiler(this)"><span><strong>' + str.replace(/<[^>]+>/g,'').substring(0, 70) + '...</strong></span><span style="display:none"><strong>[-] Свернуть</strong></span></a></div>'
               +'<div class="bbSpoilerText" style="display: none;">'+ str + '</div></div>');
  }
}

if(window.top == window) {
  if( window.location.href.indexOf('/topic') + 1 )
    $( '<script/>', { text: '(' + topic.toString() + ')()' } ).appendTo('head');
	else
    $( '<script/>', { text: '(' + run.toString() + ')()' } ).appendTo('head');
}