Gaia Online PM improvements

Improves PMs on Gaia in a few different ways.

当前为 2017-08-29 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name       Gaia Online PM improvements
// @namespace  http://mathemaniac.org
// @version    1.1
// @description  Improves PMs on Gaia in a few different ways.
// @match      http://www.gaiaonline.com/profile/privmsg.php*
// @require      http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js
// @copyright  2012-2017, Sebastian Paaske Tørholm
// ==/UserScript==

// Downloaded from http://userscripts.org/scripts/show/137486

$('#erroroutput.msgbad').each( function (i, e) {
    //$('#entry_form').attr('action', $('#entry_form').attr('action') + '?auto=1');
    var cnt = 50;
    var username = $('#username').attr('value');
    var i = setInterval(function () {
        if (cnt > 0) {
            $(e).text("Autosending in " + cnt + " seconds.");
            $('title').text(username + ': ' + cnt + " seconds.");
            cnt--;
        } else {
            $(e).text("Autosending now...");
            clearInterval(i);
            $('title').text(username + ': Sending...');
            $('#selected_options').attr('value', 'post');
            $('#entry_form').submit();
        }
    }, 1000);
} );

$('button#btn_delete').each( function (i, e) {
    $(e).after('<a href="#" id="select_read" style="padding-left: 1em; padding-right: 1em;">Select replied</a>');
    $('#select_read').click( function (ev) {
        $('tr').each( function (i, e) {
            $('input[type="checkbox"]', e).attr('checked', $('img[alt="Replied Message"]', e).length > 0);
        });
        ev.preventDefault();
    } );
} );

$('div.mainError div.errorHead').each( function (i, e) {
    if ($.trim($(e).text()) != "Information") { return; }

    if (("" + document.location).match(/folder=inbox/)) {
        document.location = "http://www.gaiaonline.com/profile/privmsg.php?folder=inbox";
    } else {
        // TODO: Make it close window on sent message.
        // window.close();
    }
});

(function () {
    // Hide quotes more than 10 levels deep.
    var levels = 10;
    var selector = "";
    for (var i = 0; i < levels; i++) {
        selector += 'td.quote ';
    }
    var first = $(selector + 'table').first();

    first.css({'display': 'none'});
    first.before('<a id="mathemaniac_show_deeply_nested" href="#">Show hidden quotes.</a>');
    var nestlink = $('#mathemaniac_show_deeply_nested');
    nestlink.css({
        'display': 'block',
        'border': '1px solid red',
        'padding': '0.25em',
        'margin': '0.25em',
        'text-align': 'center'
    });
    nestlink.click( function (ev) {
        nestlink.remove();
        first.css({'display': 'inherit'});
        ev.preventDefault();
    });
})();