Advertisement
Kinu-chan

Reply Backlinks for Kusaba X

Jan 1st, 2013
586
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.33 KB | None | 0 0
  1. [-------Reply Backlinks for Kusaba X-------]
  2.  
  3. [[[[[[[ STOP STOP STOP 𝗦𝗧𝗢𝗣 ]]]]]]]
  4. Don't use this, cause this is better:
  5. https://github.com/Kinuchan/k-ba/blob/master/k-ba.js
  6.  
  7. That said, if you still wanna go ahead~
  8.  
  9.  
  10. This is a little rip/fork of a bit of Rorichan Updater script.
  11. Includes links back to replies in post footers.
  12. Check 34pchan.org to see it in action.
  13.  
  14. 1. Make a new file called backlinks.js in /lib/javascript. Paste in it:
  15.  
  16. function updateBackLinks() {
  17. var i;
  18. var links = document.getElementsByTagName('a');
  19. var linkslen = links.length;
  20. for (i=0;i<linkslen;i++){
  21. var linksclass = links[i].getAttribute('class');
  22. var testref = links[i].parentNode.getAttribute('class');
  23. if (linksclass != null && linksclass.indexOf('ref|') != -1 && (testref == undefined || testref != 'replybacklinks')) {
  24. var onde = links[i].href.substr(links[i].href.indexOf('#') + 1);
  25. //adicionado um parentNode
  26. var quem = links[i].parentNode.parentNode.parentNode.getElementsByTagName('a')[0].name;
  27. var br = links[i].href.substring(0, links[i].href.indexOf('/res'));
  28. br = br.substring(br.lastIndexOf('/')+1);
  29.  
  30. var tr = links[i].href.substring(links[i].href.lastIndexOf('/')+1, links[i].href.lastIndexOf('.'));
  31. // alert(br+' '+brlen+' '+tr);
  32. addBackLinks(quem, onde, tr, br);
  33. }
  34. }
  35.  
  36. function addBackLinks (quem, onde, tr, br) {
  37. var ondeid = document.getElementById('reply' + onde);
  38. if (ondeid != undefined) {
  39. var onderefl = ondeid.querySelectorAll('span.replybacklinks')[0];
  40. if (onderefl.innerHTML.indexOf(quem) == -1){
  41. // alert(quem+' '+onde);
  42. var e = document.createElement('a');
  43. e.innerHTML='&nbsp;<u>>>' + quem + '</u>';
  44. e.setAttribute('href','/' + br + '/res/' + tr + '.html#' + quem);
  45. e.setAttribute('class','ref|' + br + '|' + tr + '|' + quem);
  46. e.setAttribute('onclick','return highlight(\'' + quem + '\', true);');
  47. onderefl.appendChild(e);
  48. return linkslen++;
  49. }
  50. }
  51. }
  52. return 0;
  53. }
  54.  
  55. updateBackLinks();
  56.  
  57. 2. In /dwoo/templates/global_board_footer.tpl, right above </body>, paste in:
  58.  
  59. <script type="text/javascript" src="{$cwebpath}/lib/javascript/backlinks.js"></script>
  60.  
  61. 3. In img_thread.tpl and img_board_page.tpl, find {$post.message}, and paste right under it:
  62.  
  63. <br/> <span class="replybacklinks"></span>
  64.  
  65. 4. In you css files, paste:
  66.  
  67. .replybacklinks {
  68. background-color:#43f49f;
  69. font-family:tahoma,arial,helvetica,sans-serif;
  70. font-size:80%
  71. }
  72.  
  73. And edit that css to your liking. And you're done!
  74. If you use other board types (like upload or oekaki), repeat step 3 for the relevant _thread.tpl and _board_page.tpl files.
  75.  
  76. 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