NeoLite

Flat Theme for Cpaelites

当前为 2016-11-25 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name NeoLite
  3. // @version 1.0.0.2
  4. // @author Quobi
  5. // @description Flat Theme for Cpaelites
  6. // @include www*://cpaelites.com/*
  7. // @include http*://www.cpaelites.com/*
  8. // @include http*://cpaelites.com/*
  9. // @exclude http://www.cpaelites.com/tools/*
  10. // @exclude http://www.cpaelites.com/listings.php
  11. // @require https://code.jquery.com/jquery-2.1.4.min.js
  12. // @resource customCSS https://dl.dropboxusercontent.com/s/1bk6up4eieq699a/NeoLite.css
  13. // @resource anotherMenu https://dl.dropboxusercontent.com/s/ey30qrwhaq1ly8w/MeNu_v2.css
  14. // @resource anotherAlert https://dl.dropboxusercontent.com/s/kajnmpelpa8dg4u/Alerto_v2.css
  15. // @resource anotherNotify https://dl.dropboxusercontent.com/s/0323mas83lkk8un/Notify_v2.css
  16. // @grant GM_addStyle
  17. // @grant GM_getResourceText
  18. // @run-at document-start
  19. // @namespace https://greasyfork.org/users/82626
  20. // ==/UserScript==
  21. // Implement Custom CSS
  22.  
  23. var newCSS = GM_getResourceText("customCSS");
  24. GM_addStyle(newCSS);
  25. var newMenu = GM_getResourceText("anotherMenu");
  26. GM_addStyle(newMenu);
  27. var newAlertStyle = GM_getResourceText("anotherAlert");
  28. GM_addStyle(newAlertStyle);
  29. var newNotificationStyle = GM_getResourceText("anotherNotify");
  30. GM_addStyle(newNotificationStyle);
  31. $(window).load(function() {
  32. document.getElementById("logo").src = "https://s21.postimg.org/w3eowmqfr/neolite.jpg";
  33. $(".expander").hide();
  34. if (window.location.href == "http://www.cpaelites.com/") {
  35. document.getElementById('container').setAttribute("style", "width:100%");
  36. } else {
  37. if (window.location.pathname == "/index.php") {
  38. document.getElementById('container').setAttribute("style", "width:100%");
  39. } else {
  40. document.getElementById('container').setAttribute("style", "width:90%");
  41. }
  42. }
  43. var anchors = document.getElementsByTagName("span");
  44. for (var i = 0; i < anchors.length; i++) {
  45. anchors[i].style.fontWeight = "300";
  46. }
  47. var xo = document.getElementsByClassName('float_right')[0];
  48. xo.style.marginTop = "12px";
  49. var xo2 = document.getElementsByClassName('thead')[10];
  50. xo2.style.borderRadius = "0px";
  51. var xo3 = document.getElementsByClassName('thead')[10];
  52. xo3.style.borderRadius = "0px";
  53. });
  54.  
  55. // Smooth Scroll
  56. if (window.addEventListener) window.addEventListener('DOMMouseScroll', wheel, false);
  57. window.onmousewheel = document.onmousewheel = wheel;
  58. function wheel(event) {
  59. var delta = 0;
  60. if (event.wheelDelta) delta = event.wheelDelta / 120;
  61. else if (event.detail) delta = -event.detail / 3;
  62. handle(delta);
  63. if (event.preventDefault) event.preventDefault();
  64. event.returnValue = false;
  65. }
  66. var goUp = true;
  67. var end = null;
  68. var interval = null;
  69. function handle(delta) {
  70. var animationInterval = 20;
  71. var scrollSpeed = 20;
  72.  
  73. if (end === null) {
  74. end = $(window).scrollTop();
  75. }
  76. end -= 20 * delta;
  77. goUp = delta > 0;
  78.  
  79. if (interval === null) {
  80. interval = setInterval(function() {
  81. var scrollTop = $(window).scrollTop();
  82. var step = Math.round((end - scrollTop) / scrollSpeed);
  83. if (scrollTop <= 0 ||
  84. scrollTop >= $(window).prop("scrollHeight") - $(window).height() ||
  85. goUp && step > -1 ||
  86. !goUp && step < 1) {
  87. clearInterval(interval);
  88. interval = null;
  89. end = null;
  90. }
  91. $(window).scrollTop(scrollTop + step);
  92. }, animationInterval);
  93. }
  94. }