Skip to content

Instantly share code, notes, and snippets.

@azu
Created November 22, 2009 04:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save azu/5433e8b8b294215c7335 to your computer and use it in GitHub Desktop.
Save azu/5433e8b8b294215c7335 to your computer and use it in GitHub Desktop.
9washのRTフォーマットを一般的なものに変更
// ==UserScript==
// @name 9wash RT format
// @namespace http://efcl.info/
// @include http://tw.9wash.com/
// ==/UserScript==
function evalInPage(fun) {
location.href = "javascript:void (" + fun + ")()";
}
evalInPage(function () {
bs.reply_form = function (id, el, opt) {
$('#map_wrapper').remove();
$('#uplFrame').remove();
if (bs.TL[id]) {
var name = bs.TL[id]['uname']
var text = bs.TL[id]['text'];
} else if (bs.VIEW.searchLine && bs.VIEW.searchLine[id]) {
var name = bs.VIEW.searchLine[id]['from_user'];
var text = bs.VIEW.searchLine[id]['text'];
} else if (opt != 'dm') {
return alert('error');
}
var div = $(el).parent().parent();
div.append(bs.post_form('reply'));
var ta = div.find('form textarea');
var btn = div.find('button span');
if (opt == 'rt') {
ta.val(' RT @' + name + ': ' + text.replace('>>>', '>>>')).focus();
btn.html('引用投稿する');
bs.textarea_cursor('statusFieldreply', 0);
} else if (opt == 'dm') {
btn.html('DMを送信する');
div.find('form').append('<input type="hidden" name="dm_user" value="' + id + '" />');
} else {
ta.val('@' + name + ' ').focus();
btn.html('返信する');
bs.textarea_cursor('statusFieldreply', ta.val().length);
div.find('form').append('<input type="hidden" name="in_reply_to_status_id" value="' + id + '" />');
}
div.find('form div.smt').append('<button type="button" class="cancel" onclick="$(this).parent().parent().remove();$(\'#map_wrapper\').remove();">×</button>');
bs.post_count(ta);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment