// ==UserScript== // @name 贴吧提醒界面快速回复 // @namespace // @include http://tieba.baidu.com/i/*/replyme // @version 1.1 // @grant // @description:zh-cn 直接在i贴吧里”回复我的“里边直接快速回复,回复快捷键:ctrl+回车或者alt+s // @author 小血 // @description ss // @downloadURL none // ==/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 = '
' zz += '
'; zz += '
'; zz += '

' zz += '

关闭
'; $('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 = '
'; html += ''; html += '提交' html += '
'; $(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; } }) })