[ Home / Rules / Radio / Streams / Net Friends ] [ cel / digi / lum / ran / vnt / media / lit / ocvid / kind / wap ]

/wap/ - wapchan discussion

for anything surrounding the site itself
Name
Email
Subject
Comment
File
Embed
Password (For file deletion.)

File: 1714525974606.jpg (280.16 KB, 810x375, showmethesource.jpg)

 No.1374

Every time I click the "SauceNAO" link it says
> Specified file does not seem to be an image...

 No.1375

>>1374
Fixed

 No.1376

File: 1714595306129.jpg (30.18 KB, 465x438, thankssempai.jpg)


 No.1377

File: 1714595544386.jpg (1.68 MB, 1667x2052, 1703853094346.jpg)

This made me notice... Posts that appear by auto-update after posting does not have the SauceNAO link at all!

It's probably no big deal.

 No.1378

File: 1714595853037.gif (2.84 MB, 540x405, 38e.gif)

>>1377
Technical explanation: The SauceNAO link is generated by a piece of javascript I wrote (you can view it at https://wapchan.org/.static/js/sauce.js ). It only runs once per page because otherwise I would have to make it a loop and that would tax people's systems unnecessarily if there wasn't anything new.

 No.1382

File: 1714603071513.gif (1.09 MB, 480x270, 1503060627715.gif)

>>1378
How about something like this? Admittedly it is a bit hacky, but I added it to my user JS in the settings, and it seems to work. Of course if you can change static/js/posting.js, you don't actually need the hacky part, you could just change it there.

function addSauceNao(post) {
const files = post.getElementsByClassName("uploadDetails");
for (let i = 0; i [orange] files.length; i++) {
if (files[i].getElementsByClassName("sauceNaoLink").length != 0)
return post

let sauceLink = document.createElement('a');
sauceLink.innerHTML = " SauceNAO"
sauceLink.href = "https://saucenao.com/search.php?url=" + files[i].getElementsByClassName('originalNameLink')[0]
sauceLink.target="_blank"
sauceLink.className="sauceNaoLink"
files[i].appendChild(sauceLink)
}
}

// Add links for the whole thread.
addSauceNao(document)

// Add links for the new posts.
const oldPost = posting.addPost
posting.addPost = function(post, boardUri, threadId, noExtra, preview) {
let result = oldPost(post, boardUri, threadId, noExtra, preview)
addSauceNao(result)
return result
}

(I hope code tags work and this won't become a mess. I did not find any pages explaining how to format stuff.)

 No.1383

>>1382
Well, formatting did not work, and I just noticed that the "return post" in "addSauceNao" should have been "continue" (or maybe "break"?), but the link did appear with my new post.

 No.1384

>>1382
>>1383
There is a page but it's not linked anywhere I think. I haven't edited it at all so it's the default lynxchan page. I should actually write one myself with the same information and link it on the front page.
Also, I just realized the code tags had to be manually enabled per board so I fixed that for all the boards on here where I'm the BO.
https://wapchan.org/.static/pages/posting.html



[Return][Go to top] Catalog [Post a Reply]
Delete Post [ ]
[ Home / Rules / Radio / Streams / Net Friends ] [ cel / digi / lum / ran / vnt / media / lit / ocvid / kind / wap ]