[ home / board list / faq / random / create / bans / search / manage / irc ] [ ]

/acb/ - Anon Controlled Board

A place of true freedom. Do what you want and post what you want.

Catalog

Infinity Never
Name
Email
Subject
Comment *
File
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Embed
(replaces files and can be used instead)
Options
Password (For file and post deletion.)

Allowed file types:jpg, jpeg, gif, png, webm, mp4, swf, pdf
Max filesize is 8 MB.
Max image dimensions are 10000 x 10000.
You may upload 5 per post.


/acb/ - Where the only rules are "no spamming" and "global rules apply".

File: 1451516103448.gif (2.07 MB, 585x454, 585:454, 1442173340146.gif)

 No.348

Post general custom css and some other scripts you have.

I'm trying to teach myself bash and I'm currently trying to make a script that downloads every image in a thread.

But while I don't have shit I've personally made, I have some cool shit some other anons made:

//Hide reply numbers
function hide() {
this.style.display = 'none';
}
$('.mentioned').each(hide);

//hide thread
div[id="8ch-bottom"], div[id="8ch-top-ads"] {
display: none !important;
}

From another board.

function colortest-skulls
{
local f=3
local b=4
local bold=$'\033[1m'
local reset=$'\033[0m'

for j in f b; do
for i in {0..7}; do
printf -v $j$i %b "\033[${!j}${i}m"
done
done

cat << EOF
$bold
$f0 ▄ ▄▄▄▄▄▄▄ ▄ $f1 ▄ ▄▄▄▄▄▄▄ ▄ $f2 ▄ ▄▄▄▄▄▄▄ ▄ $f3 ▄ ▄▄▄▄▄▄▄ ▄
$f0 ▀▀▄ ▄█████████▄ ▄▀▀ $f1 ▀▀▄ ▄█████████▄ ▄▀▀ $f2 ▀▀▄ ▄█████████▄ ▄▀▀ $f3 ▀▀▄ ▄█████████▄ ▄▀▀
$f0 ██ ▀███▀ ██ $f1 ██ ▀███▀ ██ $f2 ██ ▀███▀ ██ $f3 ██ ▀███▀ ██
$f0 ▄ ▀████▀████▀ ▄ $f1 ▄ ▀████▀████▀ ▄ $f2 ▄ ▀████▀████▀ ▄ $f3 ▄ ▀████▀████▀ ▄
$f0 ▀█ ██▀█▀██ █▀ $f1 ▀█ ██▀█▀██ █▀ $f2 ▀█ ██▀█▀██ █▀ $f3 ▀█ ██▀█▀██ █▀

$f4 ▄ ▄▄▄▄▄▄▄ ▄ $f5 ▄ ▄▄▄▄▄▄▄ ▄ $f6 ▄ ▄▄▄▄▄▄▄ ▄ $f7 ▄ ▄▄▄▄▄▄▄ ▄
$f4 ▀▀▄ ▄█████████▄ ▄▀▀ $f5 ▀▀▄ ▄█████████▄ ▄▀▀ $f6 ▀▀▄ ▄█████████▄ ▄▀▀ $f7 ▀▀▄ ▄█████████▄ ▄▀▀
$f4 ██ ▀███▀ ██ $f5 ██ ▀███▀ ██ $f6 ██ ▀███▀ ██ $f7 ██ ▀███▀ ██
$f4 ▄ ▀████▀████▀ ▄ $f5 ▄ ▀████▀████▀ ▄ $f6 ▄ ▀████▀████▀ ▄ $f7 ▄ ▀████▀████▀ ▄
$f4 ▀█ ██▀█▀██ █▀ $f5 ▀█ ██▀█▀██ █▀ $f6 ▀█ ██▀█▀██ █▀ $f7 ▀█ ██▀█▀██ █▀
$r
EOF
}

from a /tech/ thread.

 No.359

This code is probably pretty messy, but whatever. This fixes the number of images in a thead correctly.

The current one doesn't count the images OP posted when he started the thread.

It also doesn't take into account multi-image posting.

I don't know how to get it working in the catalog. It displays the number of images in the replies correctly, but doesn't count images in the beginning of the thread.

I have no idea why it's even displaying the reply numbers correctly in the first place, so I'm pretty confused…

/*correctly displays the image count*/
$('document').ready( function () {

var threadNum = (document.location.pathname + document.location.search).split('/');
threadNum = threadNum[threadNum.length -1].split('+')[0].split('.')[0];
var replies = $('#thread_'+ threadNum +' > div.post.reply:not(.post-hover):not(.inline)');

//images in OP
var threadStart = $('#thread_'+ threadNum +' > div.files');
var threadFiles = threadStart.find(' > .file');
var first = threadFiles.length;

//images in replies
//finds all replies with images.
var imgReplies = replies.filter(function(){
return $(this).find('> .files').text().trim() != false;
});
//gets the number of images in each reply
var imgCounts = imgReplies.map( function () {
var files = $(this).find('> .files');
//console.log(files);
return files.find(' > .file').length;
});
//sums up the number of images.
/*will use reduce function later for cleaner code*/
var count = 0;
for(var i = 0; i < imgCounts.length; i++){
count += imgCounts[i];
}
//adds number of images from replies and first post together.
$('#thread_stats_images').text(count + first);
});




[Return][Go to top][Catalog][Post a Reply]
Delete Post [ ]
[]
[ home / board list / faq / random / create / bans / search / manage / irc ] [ ]