)/ig, '$1\n')
.replace(/(<.+?>|<\/.+?>)/ig, '')
.replace(/"/gi, '\"')
.replace(/'/gi, '\'')
.replace(/ /gi, ' ')
.replace(/>/gi, '>')
.replace(/</gi, '<')
.replace(/&/gi, '&');
return content;
};
var $enterReadModeLink = $('
进入阅读模式')
.appendTo('#toptb > .wp > .z')
.click(function (event) {
event.preventDefault();
var $this = $(this);
if ($this.text() === '退出阅读模式') {
$('#pd_read_mode_style').remove();
$this.text('进入阅读模式');
}
else {
enterReadMode();
$this.text('退出阅读模式');
}
});
$('
提取帖子内容')
.insertBefore($enterReadModeLink)
.click(function (event) {
event.preventDefault();
if ($('#pd_thread_content').length > 0) return;
var content = '';
$('[id^="postmessage_"], .pattl').each(function () {
content += $(this).html() + Config.threadSeparator;
});
var $threadContent = $(
'
' +
'
' +
' ×' +
'
' +
'
' +
'
' +
' ' +
'
' +
'
'
).appendTo('body');
$threadContent.css('left', ($(window).width() - $threadContent.outerWidth()) / 2 + 'px')
.css('top', ($(window).height() - $threadContent.outerHeight()) / 2 + 'px')
.find('span:first')
.click(function (e) {
e.preventDefault();
$('#pd_thread_content').remove();
});
var $textArea = $threadContent.find('textarea');
var $removeBlankLines = $threadContent.find('#pd_remove_blank_lines');
$removeBlankLines.click(function () {
if ($(this).prop('checked')) {
var content = $textArea.val();
$textArea.data('content', content);
$textArea.val(content.replace(/\n{3,}/g, '\n\n'));
}
else {
var content = $textArea.data('content');
if (content) $textArea.val(content);
}
$textArea.focus().select();
});
$textArea.val(handleThreadContent(content)).focus().select();
if (Config.autoRemoveBlankLines)
$removeBlankLines.prop('checked', true).triggerHandler('click');
});
$('img[id^="aimg_"]').each(function () {
var $this = $(this);
$this.attr('src', $this.attr('file'));
});
if (Config.autoEnterReadMode) {
var forumId = parseInt($('input[type="hidden"][name="srhfid"]').val());
if (!Config.autoEnterForumIdList.length || $.inArray(forumId, Config.autoEnterForumIdList) > -1) {
enterReadMode();
$enterReadModeLink.text('退出阅读模式');
}
}
})(jQuery);