Greasy Fork

Greasy Fork is available in English.

贴吧提醒界面快速回复

ss

当前为 2014-11-03 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name        贴吧提醒界面快速回复
// @namespace   
// @include     http://tieba.baidu.com/i/*/replyme
// @version     1.1
// @grant
// @description:zh-cn 1
// @author      小血
// @description ss
// ==/UserScript==
function reply(fid, tid, tbs, kw, pid, ct, $cDiv, oldUrl) {
  var postData = {
    anonymous: 0,
    content: ct,
    fid: fid,
    floor_num: 16,
    ie: 'utf-8',
    kw: kw,
    rich_text: 1,
    lp_sub_type: 0,
    lp_type: 0,
    new_vcode: 1,
    tbs: tbs,
    tid: tid,
    repostid: pid,
    quote_id: pid,
    tag: 11
  }
  //alert(JSON.stringify(postData))
  $.post('http://tieba.baidu.com/f/commit/post/add', postData, function (r) {
    r = JSON.parse(r);
    if (r.err_code == '0') {
      alertEx('回复成功', 2000);
      $cDiv.remove();
    } else if (r.data.vcode.str_reason == '请点击验证码完成发贴') {
      alertEx('回复失败:此次回复内容需要验证码,本脚本赞不支持验证码,需要到帖子页回复,点击关闭跳转至帖子页面', 0)
      $('#msgClose').attr('oldUrl', oldUrl);
    } else {
      alertEx( '回复失败:' + JSON.stringify(r), 0)
    }
  });
}
function alertEx(msg, time) {
  $('#msgContent').text(msg);
  $('#msgDiv').show();
  if (time > 0) {
    setTimeout(function () {
      $('#msgDiv').hide();
    }, time)
  }
}
$(document).ready(function () {
  var zz = '<div id=\'msgDiv\' style=\'display:none;width:100%;height:100%;background:rgba(0,0,0,0.5);position: fixed; top: 0; left: 0;z-index:999997\'>'
  zz += '<div style=\'height:0px; width:0px;top:50%; left:50%;position:fixed;\'>';
  zz += '<div style=\'background:rgb(242,242,242);border:1px solid #ddd; width:260px;height:100px;padding:20px 30px 20px 30px;position:absolute; margin:-150px;border-radius:6px;box-shadow: 0 0 10px #333;text-align:center\'>';
  zz += '<p id=\'msgContent\' style=\'width:100%;text-align:left;line-height:25px;min-height:60px;\'>'
  zz += '</p><span id=\'msgClose\' style=\'background:rgb(242,242,242);border:1px solid #555;color:#000;cursor:pointer;height:24px;text-align:center;width:51px;line-height:24px;display:block;margin:0 auto;\'>关闭</span></div></div></div>';
  $('body').append(zz);
  $('body').on('click', '#msgClose', function () {
    $('#msgDiv').hide();
    oldUrl = $(this).attr('oldUrl');
    if (typeof (oldUrl) != 'undefined' && oldUrl != '') {
      $(this).removeAttr('oldUrl');
      window.open(oldUrl);
    }
  })
  $('#feed .reply').find('a:last').each(function () {
    $(this).attr('target', '')
    $(this).attr('temp', $(this).attr('href'))
    $(this).attr('href', 'javascript:void(0)')
  })
  $('#feed').on('click', '.reply a[href=\'javascript:void(0)\']', function (e) {
    if ($(this).parent().parent().find('.qkContent').length > 0) {
      return;
    }
    temp = $(this).attr('temp');
    temp = temp.substring(temp.indexOf('pid=') + 4)
    if (temp.indexOf('&') != - 1) {
      temp = temp.substring(0, temp.indexOf('&'))
    } else {
      temp = temp.substring(0, temp.indexOf('#'))
    }
    var userName = $(this).parent().parent().parent().find('.replyme_user').text();
    var html = '<div class=\'qkContent\' style=\'text-align:center\'>';
    html += '<textarea style=\'width:90%;\'></textarea>';
    html += '<span class=\'qkSubmit\' pid=\'' + temp + '\' oldUrl=\'' + $(this).attr('temp') + '\' style=\'background:url("http://tb2.bdstatic.com/tb/static-pb/img/pb_css_pic_a630a08.png") no-repeat scroll -344px -7px rgba(0, 0, 0, 0);color:#fff;cursor:pointer;height:24px;text-align:center;width:51px;line-height:24px;float:right;\'>提交</span>'
    html += '</div>';
    $(this).parent().after(html);
    $(this).parent().next().find('textarea').focus().val('回复 ' + userName.substring(0, userName.length - 1) + ' :');
  });
  $('#feed').on('click', '.qkSubmit', function () {
    tempData = eval('(' + $(this).parent().prev().children(':first').attr('data-param') + ')');
    reply(tempData.fid, tempData.tid, tempData.tbs, tempData.kw, $(this).attr('pid'), $(this).prev().val(), $(this).parent(), $(this).attr('oldUrl'));
  })
  $('#feed').on('keydown', 'textarea', function (e) {
    if ((e.keyCode == 83 && e.altKey) || (e.ctrlKey && e.keyCode == 13)) {
      $(this).next().click();
      e.preventDefault();
      return false;
    }
  })
})