Window floating container

Adds a fixed header element for use by other scripts

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

此脚本不应直接安装。它是供其他脚本使用的外部库,要使用该库请加入元指令 // @require https://update.cn-greasyfork.org/scripts/18233/160323/Window%20floating%20container.js

  1. // ==UserScript==
  2. // @name Window floating container
  3. // @version 1.1.0
  4. // @description Adds a fixed header element for use by other scripts
  5. // @author @_jnblog
  6. // @require https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js
  7. // @grant GM_addStyle
  8. // ==/UserScript==
  9. /* jshint -W097 */
  10. /* global $ */
  11. /* jshint asi: true, multistr: true */
  12. 'use strict'
  13.  
  14. var ijgFloater = $('#ijgWindowFloater')
  15. if (!ijgFloater.length) {
  16. GM_addStyle('#ijgWindowFloater {\
  17. position: fixed;\
  18. top: 32px;\
  19. left: 0;\
  20. z-index: 2000;\
  21. color: white;\
  22. background-color: #EB6841;\
  23. }\
  24. #ijgWindowFloater a {\
  25. color: white !important;\
  26. padding: 5px;\
  27. display: inline-block;\
  28. }\
  29. #ijgWindowFloater a:hover {\
  30. color: #FAF667 !important;\
  31. }\
  32. .ijgWindowFloater-item {\
  33. display: none;\
  34. }\
  35. .ijgWindowFloater-item + .ijgWindowFloater-item {\
  36. padding-left: 1em;\
  37. }\
  38. .ijgWindowFloater-toggle {\
  39. padding: 0;\
  40. top: -1px;\
  41. left: -22px;\
  42. box-shadow: inset 0 0 0 32px;\
  43. -webkit-transform-origin: right;\
  44. -ms-transform-origin: right;\
  45. transform-origin: right;\
  46. transform: rotate(180deg);\
  47. display: inline-block;\
  48. vertical-align: middle;\
  49. position: relative;\
  50. font-style: normal;\
  51. color: transparent;\
  52. text-align: left;\
  53. text-indent: -9999px;\
  54. direction: ltr;\
  55. box-sizing: border-box;\
  56. border: 2px solid white;\
  57. transition: all .2s;\
  58. border-radius: 50%;\
  59. width: 24px;\
  60. height: 24px;\
  61. margin: 2px;\
  62. background-color: transparent;\
  63. }\
  64. .ijgWindowFloater-toggle:before {\
  65. content: "";\
  66. width: 14px;\
  67. height: 2px;\
  68. position: absolute;\
  69. bottom: 0;\
  70. margin: auto 0;\
  71. box-shadow: inset 0 0 0 32px;\
  72. -webkit-transform-origin: right;\
  73. -ms-transform-origin: right;\
  74. transform-origin: right;\
  75. top: 2px;\
  76. -webkit-transform: rotate(45deg);\
  77. -ms-transform: rotate(45deg);\
  78. transform: rotate(45deg);\
  79. pointer-events: none;\
  80. width: 9px;\
  81. right: 6px;\
  82. color: white;\
  83. }\
  84. .ijgWindowFloater-toggle:after {\
  85. content: "";\
  86. height: 2px;\
  87. position: absolute;\
  88. bottom: 0;\
  89. margin: auto 0;\
  90. box-shadow: inset 0 0 0 32px;\
  91. -webkit-transform-origin: right;\
  92. -ms-transform-origin: right;\
  93. transform-origin: right;\
  94. top: 0;\
  95. -webkit-transform: rotate(-45deg);\
  96. -ms-transform: rotate(-45deg);\
  97. transform: rotate(-45deg);\
  98. pointer-events: none;\
  99. width: 9px;\
  100. right: 6px;\
  101. color: white;\
  102. }\
  103. .ijgWindowFloater-toggle.ijg-is-closed:before {\
  104. top: 12px;\
  105. right: 7px;\
  106. }\
  107. .ijgWindowFloater-toggle.ijg-is-closed:after {\
  108. top: -10;\
  109. right: 7px;\
  110. }')
  111. ijgFloater = $('<div id="ijgWindowFloater"><i class="ijgWindowFloater-toggle"></i></div>')
  112. $('body').prepend(ijgFloater)
  113. }
  114.  
  115. function getFloater() {
  116. return ijgFloater
  117. }