Anonymous ID: 520a6a Dec. 31, 2018, 8:28 p.m. No.4544807   🗄️.is 🔗kun   >>6224

Does anyone know where I can find info about 8ch's User JS feature?

I'm trying to call function in the main.js. But it's not working. I need to know how the namespace compartmentalization works.

I know my way around a couple other languages, but have no JavaScript experience.

Anonymous ID: 520a6a Dec. 31, 2018, 11:48 p.m. No.4547593   🗄️.is 🔗kun

>>4546224

Oh, it's a lot more than a misspelling.

I want a one-click filterID button. I know that such things exist, but I can't find it anywhere. So I'm trying to recreate it.

I thought I could take the code someone wrote for blacklisting images my MD5 hash and modify it to call the filter function that the '▶' button connects to. Wasn't as straight forward as I thought. My browser's Inspect Element and Debug Console features gave me clues about functions and variables being undefined. So i chased them down in the main.js code and included them. It's still not working. I have a hunch that "var boardId = board_name;" is incorrect. But I don't know how to debug it further.

As I said above, I have absolutely nor experience with JS. This is all monkey-see-monkey-do.

 

function setList(blacklist) { localStorage.postFilter = JSON.stringify(blacklist); $(document).trigger('filter_page');}function timestamp() { return Math.floor((new Date()).getTime() / 1000);}function initList(list, boardId, threadId) { if (typeof list.postFilter[boardId] 'undefined') { list.postFilter[boardId] = {}; list.nextPurge[boardId] = {}; } if (typeof list.postFilter[boardId][threadId] 'undefined') { list.postFilter[boardId][threadId] = []; } list.nextPurge[boardId][threadId] = {timestamp: timestamp(), interval: 86400}; // 86400 seconds 1 day}function onNopeClicked(event){ event.preventDefault(); event.stopPropagation(); var post = $(event.target).closest('.post'); var threadId = $post.parent().attr('id').replace('thread_', ); var postId = $post.find('.post_no').not('[id]').text(); var postUid = $post.find('.poster_id').text(); var boardId = board_name; //''blacklist.add.uid(pageData.boardId, threadId, postUid, true); var list = getList(); var filter = list.postFilter; initList(list, boardId, threadId); for (var i in filter[boardId][threadId]) { if (filter[boardId][threadId][i].uid uniqueId) return; } filter[boardId][threadId].push({uid: postUid, hideReplies: false}); setList(list);}function addNopeButtons() { $('.post').each(function(i, post) { if ($(post).find('.nope').length === 0) { $(post).prepend("<input type='button' class='nope' onClick='onNopeClicked(event)' value='Nope'></input>"); } }) }setInterval(function () { addNopeButtons(); }, 500);