Sleazy Fork is available in English.

Kona-chan cleanup

A small userscript to ease to browsing of konachan.net

  1. // ==UserScript==
  2. // @name Kona-chan cleanup
  3. // @namespace http://www.konachan.* scroll/
  4. // @description A small userscript to ease to browsing of konachan.net
  5. // @include http://*konachan.net/post?*
  6. // @include https://*konachan.net/post?*
  7. // @include http://*konachan.net/post
  8. // @include https://*konachan.net/post
  9. // @include http://*konachan.net/post/show/*
  10. // @include https://*konachan.net/post/show/*
  11. // @version 1.0.5
  12. // @require http://code.jquery.com/jquery-2.2.1.min.js
  13. // @grant GM_addStyle
  14. // ==/UserScript==
  15. this.$ = this.jQuery = jQuery.noConflict(true);
  16.  
  17. if(window.location.pathname == "/post") {
  18. var pageNum = 1;
  19. var list = $('#post-list-posts');
  20. GM_addStyle("#post-list-posts img {min-height: 100px;} #post-list .content { } #post-list-posts li { width: auto; height: 100%;padding-right: 5px; } #post-list-posts li img { display: block; } #post-list-posts li a {width: 100%; display: inline-block; text-align: center; background: #2A1E1E; } #post-list-posts li a:hover {background: #514747;}");
  21. GM_addStyle(".sidebar > div:first-child { position: fixed; top: 150px; left: 40px; background: rgb(34, 34, 34); margin: 0; } .sidebar > div { margin-top:30px; } .sidebar { width: auto !important; margin-top: 40px;} .internalContent {display: block; margin-left: 210px} iframe {display: block;}");
  22. list.html("");
  23. list.css('display', 'inline-block');
  24. list.parent().css('margin-top', '1rem');
  25. $(".lsidebar").appendTo($('.sidebar').first().children().last().prev()).css('float', 'unset');
  26. $("#paginator").hide();
  27. document.querySelector("#post-list .content").className = "internalContent";
  28. var tags = "";
  29. try {
  30. var arr = window.location.search.split("?")[1].split("&");
  31. for (var i = 0; i < arr.length; i++) {
  32. var tagarr = arr[i].split("=");
  33. if (tagarr[0]== "tags") {
  34. tags = tagarr[1];
  35. break;
  36. }
  37. }
  38. } catch(err) {}
  39. var ad = $($(".content")[0]);
  40. $(".content .content").removeClass("content");
  41. var nexting = false;
  42. function nextPage () {
  43. if(!nexting) {
  44. nexting = true;
  45. $.get((/.*\.net.*/i.test(window.location.host) ? "http://konachan.net/post.json?limit=24&page=" : "http://konachan.com/post.json?limit=24&page=") + (pageNum++) + "&tags=rating:safe%20"+ tags, {data: 'here'}, function(data) {
  46. data.forEach(function(image) {
  47. list.append("<li><a href=\"/post/show/" + image.id + "\" target=\"_blank\"><img src=\""+ image.preview_url + "\" title=\"" + image.tags + "\" alt=\"" + image.tags + "\" />" + image.width + "x" + image.height + "</a></li>");
  48. });
  49. //$(list).append(ad.html());
  50. });
  51. $('.sidebar iframe').slice(0,2).clone().appendTo($('.sidebar').first().find('iframe').first().parent())
  52. setTimeout(function() { nexting = false; }, 200);
  53. }
  54. }
  55. $(window).bind('scroll', function(e) {
  56. if($(document).scrollTop() + $(window).height()>=$(document).height() - 500)
  57. {
  58. nextPage();
  59. }
  60. });
  61. nextPage();
  62. $($("#tag-sidebar").parent()).hide();
  63. $("#blacklisted-sidebar").hide();
  64. } else {
  65. GM_addStyle("#image { width: calc(100vw - 30%); margin-right: 0 !important; padding-right: 2rem; box-sizing: border-box;}");
  66. var imi = document.getElementById("image");
  67. imi.removeAttribute("width");
  68. imi.removeAttribute("height");
  69. imi.removeAttribute("large_width");
  70. imi.removeAttribute("large_height");
  71. }