Up

кнопка "вверх" в ГВД.

当前为 2018-12-14 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Up
  3. // @author sw.East
  4. // @description кнопка "вверх" в ГВД.
  5. // @namespace https://openuserjs.org/users/chesheerk/scripts
  6. // @homepageURL https://www.heroeswm.ru/pl_info.php?id=3541252
  7. // @supportURL https://www.heroeswm.ru/pl_info.php?id=3541252
  8. // @version 0.2
  9. // @icon http://i.imgur.com/GScgZzY.jpg
  10. // @require https://code.jquery.com/jquery-3.3.1.min.js
  11. // @include *//*.heroeswm.*/*
  12. // @include *//178.248.235.15/.php*
  13. // @include *//*.lordswm.*/*
  14. // @grant GM_addStyle
  15. // @copyright 2013-2018, sw.East (https://www.heroeswm.ru/pl_info.php?id=3541252)
  16. // @license MIT
  17. // @run-at document-end
  18. // ==/UserScript==
  19.  
  20. /** === Style === */
  21. GM_addStyle ( `
  22.  
  23. #button-up {
  24. background: none;
  25.  
  26. border: 7px solid #7D614C;
  27. border-radius: 50%;
  28.  
  29. margin: 0 auto;
  30. padding:5px;
  31.  
  32. height:7px;
  33. width:100px;
  34.  
  35. outline:none;
  36. text-decoration: none;
  37.  
  38. display:none;
  39. right: -15;
  40. bottom: 50%;
  41. position: fixed;
  42. }
  43. .round {
  44. background: #44372C;
  45. background: -webkit-radial-gradient(center, #A16A31, #16130E);
  46. background: -moz-radial-gradient(center, #A16A31, #16130E);
  47. background: radial-gradient(ellipse at A16A31, #A18031, #16130E);
  48.  
  49. border: 4px solid #CC9A2B;
  50. border-radius: 50%;
  51.  
  52. display: block;
  53. position: absolute;
  54. left: 10;
  55. bottom: -25;
  56.  
  57. margin:0 auto;
  58. padding:0;
  59.  
  60. height:60px;
  61. width:60px;
  62.  
  63. cursor:pointer;
  64. text-decoration: none;
  65. text-align: center;
  66. z-index: 2;
  67.  
  68. -webkit-box-shadow: 0px 0px 8px 1px rgba(0,0,0,0.75);
  69. -moz-box-shadow: 0px 0px 8px 1px rgba(0,0,0,0.75);
  70. -o-box-shadow: 0px 0px 8px 1px rgba(0,0,0,0.75);
  71. box-shadow: 0px 0px 8px 1px rgba(0,0,0,0.75);
  72. }
  73.  
  74. .round:hover {
  75.  
  76. background: rgba(91, 61, 51, 1.0);
  77. background: -webkit-radial-gradient(top left, rgba(91, 61, 51, 1.0), rgba(22, 19, 14, 1.0));
  78. background: -moz-radial-gradient(top left, rgba(91, 61, 51, 1.0), rgba(22, 19, 14, 1.0));
  79. background: radial-gradient(top left, rgba(91, 61, 51, 1.0), rgba(22, 19, 14, 1.0));
  80.  
  81. -webkit-box-shadow: inset 5px 5px 12px -7px rgba(0,0,0,0.75);
  82. -moz-box-shadow: inset 5px 5px 12px -7px rgba(0,0,0,0.75);
  83. box-shadow: inset 5px 5px 12px -7px rgba(0,0,0,0.75);
  84.  
  85. z-index: 2;
  86. border-radius: 50%;
  87.  
  88. -webkit-transform: rotate(-360deg);
  89. -moz-transform: rotate(-360deg);
  90. -o-transform: rotate(-360deg);
  91. transform: rotate(-360deg);
  92. }
  93.  
  94. .ts {
  95. display: block;
  96. position: absolute;
  97. left: 15;
  98. top: 20;
  99.  
  100. font-family: Arial;
  101. font-size: 20px;
  102. font-weight: bold;
  103.  
  104. color: #CC9A2B;
  105.  
  106. text-shadow:
  107. -0 -1px 3px #201712,
  108. 0 -1px 3px #201712,
  109. -0 1px 3px #201712,
  110. 0 1px 3px #201712,
  111. -1px -0 3px #201712,
  112. 1px -0 3px #201712,
  113. -1px 0 3px #201712,
  114. 1px 0 3px #201712,
  115. -1px -1px 3px #201712,
  116. 1px -1px 3px #201712,
  117. -1px 1px 3px #201712,
  118. 1px 1px 3px #201712,
  119. -1px -1px 3px #201712,
  120. 1px -1px 3px #201712,
  121. -1px 1px 3px #201712,
  122. 1px 1px 3px #201712;
  123. }
  124.  
  125. ` );
  126.  
  127. /* Style End */
  128.  
  129. $(document).ready(function(){
  130.  
  131. // крепим элемент позади меню
  132. $('#breadcrumbs').append('<div id="button-up" class="hvr-box-shadow-inset"><div class="round hvr-box-shadow-inset"><span class="ts">Up</span></div></div>');
  133.  
  134. /** При прокрутке страницы, показываем или срываем кнопку */
  135. $(window).scroll(function () {
  136. // Если отступ сверху больше 50px то показываем кнопку "Наверх"
  137. if ($(this).scrollTop() > 50) {
  138. $('#button-up').fadeIn();
  139. } else {
  140. $('#button-up').fadeOut();
  141. }
  142. GM_addStyle(GM_getResourceText("hv"));
  143. });
  144.  
  145. /** При нажатии на кнопку мы перемещаемся к началу страницы */
  146. $('#button-up').click(function () {
  147. $('body,html').animate({
  148. scrollTop: 0
  149. }, 500);
  150. return false;
  151. });
  152. });