Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [-------Reply Backlinks for Kusaba X-------]
- [[[[[[[ STOP STOP STOP 𝗦𝗧𝗢𝗣 ]]]]]]]
- Don't use this, cause this is better:
- https://github.com/Kinuchan/k-ba/blob/master/k-ba.js
- That said, if you still wanna go ahead~
- This is a little rip/fork of a bit of Rorichan Updater script.
- Includes links back to replies in post footers.
- Check 34pchan.org to see it in action.
- 1. Make a new file called backlinks.js in /lib/javascript. Paste in it:
- function updateBackLinks() {
- var i;
- var links = document.getElementsByTagName('a');
- var linkslen = links.length;
- for (i=0;i<linkslen;i++){
- var linksclass = links[i].getAttribute('class');
- var testref = links[i].parentNode.getAttribute('class');
- if (linksclass != null && linksclass.indexOf('ref|') != -1 && (testref == undefined || testref != 'replybacklinks')) {
- var onde = links[i].href.substr(links[i].href.indexOf('#') + 1);
- //adicionado um parentNode
- var quem = links[i].parentNode.parentNode.parentNode.getElementsByTagName('a')[0].name;
- var br = links[i].href.substring(0, links[i].href.indexOf('/res'));
- br = br.substring(br.lastIndexOf('/')+1);
- var tr = links[i].href.substring(links[i].href.lastIndexOf('/')+1, links[i].href.lastIndexOf('.'));
- // alert(br+' '+brlen+' '+tr);
- addBackLinks(quem, onde, tr, br);
- }
- }
- function addBackLinks (quem, onde, tr, br) {
- var ondeid = document.getElementById('reply' + onde);
- if (ondeid != undefined) {
- var onderefl = ondeid.querySelectorAll('span.replybacklinks')[0];
- if (onderefl.innerHTML.indexOf(quem) == -1){
- // alert(quem+' '+onde);
- var e = document.createElement('a');
- e.innerHTML=' <u>>>' + quem + '</u>';
- e.setAttribute('href','/' + br + '/res/' + tr + '.html#' + quem);
- e.setAttribute('class','ref|' + br + '|' + tr + '|' + quem);
- e.setAttribute('onclick','return highlight(\'' + quem + '\', true);');
- onderefl.appendChild(e);
- return linkslen++;
- }
- }
- }
- return 0;
- }
- updateBackLinks();
- 2. In /dwoo/templates/global_board_footer.tpl, right above </body>, paste in:
- <script type="text/javascript" src="{$cwebpath}/lib/javascript/backlinks.js"></script>
- 3. In img_thread.tpl and img_board_page.tpl, find {$post.message}, and paste right under it:
- <br/> <span class="replybacklinks"></span>
- 4. In you css files, paste:
- .replybacklinks {
- background-color:#43f49f;
- font-family:tahoma,arial,helvetica,sans-serif;
- font-size:80%
- }
- And edit that css to your liking. And you're done!
- If you use other board types (like upload or oekaki), repeat step 3 for the relevant _thread.tpl and _board_page.tpl files.
- Let me know if you have any problems at mail@34pchan.org, or find me lurking kusabax.culnet.net/sup/ or 34pchan.org/s/ as either (=^・ェ・^=)!p3l2W3bRxk!!HmZQR2Lwyu or (=^・ェ・^=)!KinuB0nt8M
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement