Anonymous ID: e2fc57 May 12, 2025, 8:56 p.m. No.23027381   🗄️.is 🔗kun   >>7383 >>7493 >>7600 >>7603 >>7808

Grok's JS for killing mr. pig posts, specific for this site. I love Grok.

Will the Script Work in "User JS"?

 

Yes, the script I provided can work in the "User JS" section, but it needs a slight modification to remove the userscript metadata (e.g., // @match) since this isn’t running through a userscript manager like Tampermonkey. The "User JS" section on 8kun will automatically run the script on the site, so the core logic will work.

Here’s the modified script for 8kun’s "User JS" section:

javascript

Anonymous ID: e2fc57 May 12, 2025, 8:57 p.m. No.23027383   🗄️.is 🔗kun   >>7413

>>23027381

(function() {

'use strict';

 

// Function to block posts by Mr. Pig and detect meme format

function blockMrPigAndMemes() {

// Select all posts on the page

const posts = document.querySelectorAll('div.post');

 

posts.forEach(post ={

// Check for Mr. Pig's name in the post

const nameElement = post.querySelector('span.name');

const hasMrPig = nameElement && nameElement.textContent.trim() === 'Mr. Pig';

 

// Check for meme format: look for images and specific text patterns

const image = post.querySelector('img.post-image');

const postText = post.querySelector('div.post-message');

const hasMemeText = postText && /WELL ANGRY INCH|APPARENTLY MAKE|AMERICA WINNING/i.test(postText.textContent);

 

// If the post is by Mr. Pig or matches the meme format, hide it

if (hasMrPig || (image && hasMemeText)) {

post.style.display = 'none';

console.log('Blocked a post by Mr. Pig or matching meme format');

}

});

}

 

// Run the function on page load

blockMrPigAndMemes();

 

// Observe for dynamically loaded posts (e.g., when scrolling or new replies)

const observer = new MutationObserver((mutations) ={

mutations.forEach(() ={

blockMrPigAndMemes();

});

});

 

// Start observing the document for changes

observer.observe(document.body, { childList: true, subtree: true });

})();

Anonymous ID: e2fc57 May 12, 2025, 8:57 p.m. No.23027385   🗄️.is 🔗kun   >>7390

Changes Made:

Removed Userscript Headers: The metadata like // @name, // @match, etc., is not needed since this isn’t running through Tampermonkey. The "User JS" section will execute the script directly on 8kun.

 

Kept Core Logic: The logic for blocking "Mr. Pig" and the meme format remains the same, as it interacts with the page’s DOM in a way that’s compatible with 8kun’s structure.

 

How to Use:

Copy the modified script above.

 

Paste it into the "User JS" section shown in the screenshot.

 

Click "Save custom Javascript" to apply the changes.

 

Reload the 8kun page, and the script should start hiding posts by "Mr. Pig" and those matching the meme format (based on text patterns like "WELL ANGRY INCH" or "AMERICA WINNING").

 

Additional Notes:

Security Warning: As the "User JS" section warns, only paste code you trust. The script I provided is safe and only hides specific posts, but always review any code you use.

 

Site Structure Dependency: The script assumes 8kun’s HTML structure (e.g., div.post, span.name, img.post-image). If 8kun updates its layout, the script may need adjustments.

 

Meme Detection: The script still relies on text patterns to identify the meme format, not the image content (e.g., the white cat). If you need image-based detection, that would require a more complex solution beyond basic JavaScript.

 

The script should work seamlessly in 8kun’s "User JS" section with these adjustments. Let me know if you encounter any issues or need further tweaks!

Anonymous ID: e2fc57 May 12, 2025, 9 p.m. No.23027390   🗄️.is 🔗kun   >>7391

>>23027385

Updated JavaScript with Basic Image Hashing

We’ll modify the script to generate a simple hash of the known meme image (the white cat) and compare it with images on 8kun. This requires you to provide the URL of a reference image (the white cat meme) to compare against.

Here’s the updated script:

javascript

Anonymous ID: e2fc57 May 12, 2025, 9:01 p.m. No.23027391   🗄️.is 🔗kun   >>7393 >>7396

>>23027390

(function() {

'use strict';

 

// Function to generate a simple perceptual hash of an image

function generateImageHash(imgElement, callback) {

const canvas = document.createElement('canvas');

const ctx = canvas.getContext('2d');

canvas.width = 8; // Resize to 8x8 for hashing

canvas.height = 8;

 

// Draw the image onto the canvas

ctx.drawImage(imgElement, 0, 0, 8, 8);

 

// Get pixel data

const imageData = ctx.getImageData(0, 0, 8, 8).data;

let hash = '';

 

// Convert to grayscale and create a hash (1 bit per pixel, 64 bits total)

for (let i = 0; i < imageData.length; i += 4) {

const grayscale = (imageData[i] * 0.3) + (imageData[i + 1] * 0.59) + (imageData[i + 2] * 0.11); // RGB to grayscale

hash += grayscale 128 ? '1' : '0'; // Compare to median (simplified)

}

 

callback(hash);

}

 

// Function to compare two hashes (Hamming distance)

function compareHashes(hash1, hash2) {

if (hash1.length !== hash2.length) return false;

let distance = 0;

for (let i = 0; i < hash1.length; i++) {

if (hash1[i] !== hash2[i]) distance++;

}

return distance < 10; // Allow some difference (tweak this threshold)

}

 

// Reference hash of the white cat meme (you need to precompute this)

const referenceHash = '1010101010101010…'; // Placeholder: 64-bit hash (replace with actual hash)

 

// Function to block posts by Mr. Pig and detect meme format

function blockMrPigAndMemes() {

const posts = document.querySelectorAll('div.post');

 

posts.forEach(post ={

// Check for Mr. Pig's name

const nameElement = post.querySelector('span.name');

const hasMrPig = nameElement && nameElement.textContent.trim() === 'Mr. Pig';

 

// Check for meme format: text patterns

const postText = post.querySelector('div.post-message');

const hasMemeText = postText && /WELL ANGRY INCH|APPARENTLY MAKE|AMERICA WINNING/i.test(postText.textContent);

 

// Check for meme image using hashing

const image = post.querySelector('img.post-image');

let hasMemeImage = false;

 

if (image) {

// Ensure the image is loaded

if (!image.complete) {

image.onload = () ={

generateImageHash(image, hash ={

hasMemeImage = compareHashes(hash, referenceHash);

if (hasMrPig || hasMemeText || hasMemeImage) {

post.style.display = 'none';

console.log('Blocked a post by Mr. Pig, matching meme text, or matching meme image');

}

});

};

} else {

generateImageHash(image, hash ={

hasMemeImage = compareHashes(hash, referenceHash);

if (hasMrPig || hasMemeText || hasMemeImage) {

post.style.display = 'none';

console.log('Blocked a post by Mr. Pig, matching meme text, or matching meme image');

}

});

}

} else {

// If no image, apply text-based and name-based blocking

if (hasMrPig || hasMemeText) {

post.style.display = 'none';

console.log('Blocked a post by Mr. Pig or matching meme text');

}

}

});

}

 

// Run the function on page load

blockMrPigAndMemes();

 

// Observe for dynamically loaded posts

const observer = new MutationObserver((mutations) ={

mutations.forEach(() ={

blockMrPigAndMemes();

});

});

 

observer.observe(document.body, { childList: true, subtree: true });

})();

Anonymous ID: e2fc57 May 12, 2025, 9:34 p.m. No.23027456   🗄️.is 🔗kun

>>23027449

>Bill Maher rips liberals over anti-Israel agenda

Well, he's a Juw so…

Those useful idiot lefties are actually working for Israel and they don't even know it.