").attr("class","clones") );
$(".filter").keydown(function(event){
if(event.which != 13){
return;
}
if($("#fmark").is(":checked")){
$(".marked").removeClass("marked");
var ty = $("#ftrip").is(":checked") ? ".postertrip" : ".name";
var m = $(".post").filter(function(){console.log(".postInfo .nameBlock " + ty); return $(this).find(".postInfo .nameBlock " + ty).text() == $(".filter").val().replace(/^\s+/,"").replace(/\s+$/,""); }).addClass("marked");
$("#freport").html(m.filter(function(){ return !$(this).closest(".clones").length }).length + " post(s) were marked.");
return;
}
$(".clones").children().remove();
var filter = $(".filter").val().replace(/^\s+/,"").replace(/\s+$/,"");
if(filter.length == 0){
return $("#freport").html(0 + " post(s) were filtered");
}
var ftype, p, n, c=0;
if($("#fname").is(":checked")) {ftype = "name"} else if($("#ftrip").is(":checked")) {ftype = "tripcode"}
else {return $("#freport").html("Choose \"Name\" or \"Tripcode\"")}
switch(ftype){
case "name":
$("div[id^=pc]").each(function(){
p = $(this).attr("id").replace(/pc/,"");
n = $(this).children("#p"+p).children("#pi"+p).find("span.name").html();
if(filter === n){
$(".clones").append( $(this).clone(true).addClass("clone") );
c++;
$(".clone").find("[id$=t"+p+"]").remove();
$(".clone").find("a[class*=qLinkOpen]").removeClass("qLinkOpen");
}
});
break;
case "tripcode":
$("div[id^=pc]").each(function(){
p = $(this).attr("id").replace(/pc/,"");
n = $(this).children("#p"+p).children("#pi"+p).find("span.postertrip").html();
if(filter === n){
$(".clones").append( $(this).clone(true).addClass("clone") );
c++;
$(".clone").find("[id$=t"+p+"]").remove();
$(".clone").find("a[class*=qLinkOpen]").removeClass("qLinkOpen");
}
});
break;
default:
return $("#freport").html("Ran into a problem.\nFilter could not be executed.");
}
$("#freport").html(c + " post(s) were filtered");
});
});
/* Inline Quote */
$('blockquote a.quotelink') .click(function (event) {
if (event.shiftKey) {
event.preventDefault();
window.location = this;
return ;
}
event.preventDefault();
var qPost = $(this) .attr('href') .replace('#p', '');
var tPost = $(this) .parents("blockquote") .attr('id') .replace(/[a-z]/, '');
if ($(this) .next('[id^=f' + qPost + ']') .length) {
$(this) .next('[id^=f' + qPost + ']') .remove();
$(this) .removeClass('qLinkOpen');
} else {
if ($('#p' + qPost) .hasClass('op')) {
$(this) .after($('#p' + qPost) .clone(true) .attr('id', 'f' + qPost + 't' + tPost) .addClass('reply'));
$(this) .addClass('qLinkOpen');
$(this) .next('[id^=f' + qPost + ']') .find('[id$=t' + qPost + ']') .remove();
} else {
$(this) .after($('#p' + qPost) .clone(true) .attr('id', 'f' + qPost + 't' + tPost));
$(this) .addClass('qLinkOpen');
$(this) .next('[id^=f' + qPost + ']') .find('[id$=t' + qPost + ']') .remove();
}
}
});
/* Quote Preview */
$('blockquote a.quotelink') .hover(function (event) {
var qPost = $(this) .attr('href') .replace('#p', '');
var tPost = $(this) .parents("blockquote") .attr('id') .replace(/[a-z]/, '');
var linkOffset = $(this) .offset() .left + 10 + $(this).width();
if ($('#p' + qPost) .hasClass('op')) {
$(this) .before($('#p' + qPost) .clone() .addClass('qPreview reply') .attr('id', ''));
$(this) .siblings('.qPreview') .find('[id$=t' + qPost + ']') .remove();
} else {
$(this) .before($('#p' + qPost) .clone() .addClass('qPreview') .attr('id', ''));
$(this) .siblings('.qPreview') .find('[id$=t' + qPost + ']') .remove();
}
var qpheight = $('.qPreview') .height();
$('.qPreview') .attr('style', 'margin-top: -' + qpheight / 2 + 'px !important; margin-left: ' + linkOffset + 'px !important');
var pb = ($(window) .height() + $(window) .scrollTop()) - ($('.qPreview') .offset() .top + qpheight);
var pt = $('.qPreview') .offset() .top - $(window) .scrollTop();
qpheight = $('.qPreview') .height();
if (pb < 0) {
var pos = qpheight / 2 - pb + 10;
$('.qPreview') .attr('style', 'margin-top: -' + pos + 'px !important; margin-left: ' + linkOffset + 'px !important;');
} else if (pt < 0) {
var pos = qpheight / 2 + pt - 10;
$('.qPreview') .attr('style', 'margin-top: -' + pos + 'px !important; margin-left: ' + linkOffset + 'px !important;');
}
$(".qPreview").css("left", "0");
}, function (event) {
$('.qPreview') .remove();
});
/* Inline Image Expansion */
$('a.fileThumb') .click(function (event) {
event.preventDefault();
if ($(this) .hasClass('image_expanded')) {
$(this) .find('.expImage') .remove();
$(this) .children('img:first') .css('display', 'block');
$(this) .removeClass('image_expanded');
} else {
var imgLink = $(this) .attr('href');
var imgDim = $(this) .siblings('.fileText') .html() .replace(/
/, '') .match(/[0-9]{1,6}x[0-9]{1,6}/);
var imgW = imgDim[0].replace(/x[0-9]{1,6}/, '');
var imgH = imgDim[0].replace(/[0-9]{1,6}x/, '');
if (imgW > $(window) .width()) {
imgH = (($(window) .width() - ($(this) .offset() .left * 2)) / imgW) * imgH;
imgW = $(window) .width() - ($(this) .offset() .left * 2);
}
$(this) .children('img:first') .css('display', 'none');
$(this) .addClass('image_expanded') .children('img:first') .after($('
') .attr({
'src': imgLink,
'href': imgLink
}) .css({
'width': imgW + 'px',
'height': imgH + 'px'
}) .addClass('expImage'));
}
});
var css = $('') .attr({
'rel': 'stylesheet',
'type': 'text/css',
'href': 'data:text/css,' +
'.qPreview { position: absolute; font-size: 10pt; display: inline-block !important;}' +
'.postContainer, .postInfo:after { content: \'\'; display: block; clear: both; }' +
'.backlink_ > span { font-size: 80%; margin: 0 0.4em 0 0; }' +
'.backlink_ { display: inline; margin-left: 0.2em; }' +
'a.qLinkOpen{ opacity: 0.5; }' +
'div.reply{ border-style: solid; border-width: 1px; border-color: rgb(180,180,180) !important; }' +
'a.quotelink{ color: rgb(20,80,100) !important; }' +
'.backlink_ span{ display: inline-block; }' +
'.filterWrap{position:absolute;top: 105px;right: 5px;}' +
'.filterWrap input{position: relative;margin: 2px;padding: 3px;}' +
'.filter{width: 170px;}' +
'.clones{background-color:rgba(220,0,110,.1)}' +
'.post.marked{border-left: 2px solid orange !important}'
}) .appendTo('head');