Browser extension that demonstrates the Web Annotation Discovery mechanism: subscribe to people’s annotation collections/‘feeds’, to see their notes on the web; and create & publish annotations yourself.

web-annotation-discovery-we.../src/content_script/ MarginalAnnotations.module.scss
184 lines
3.6 KiB

  1. html {
  2. // Support hidden overflow into the right margin.
  3. // (would be better to not have to change the page’s style; but not sure how)
  4. position: relative;
  5. }
  6. html body {
  7. /* Increase specifity above that of our style reset */
  8. .annotationOuterContainer {
  9. --container-width: 300px;
  10. --toolbar-height: 40px;
  11. z-index: 999998;
  12. position: absolute;
  13. top: 0;
  14. right: 0;
  15. bottom: 0;
  16. width: var(--container-width);
  17. max-width: 50vw;
  18. display: flex;
  19. flex-flow: column;
  20. pointer-events: none;
  21. box-sizing: border-box;
  22. font-family: sans-serif;
  23. }
  24. .singleAnnotationOuterContainer {
  25. position: absolute;
  26. top: 0;
  27. right: 0;
  28. bottom: 0;
  29. width: var(--container-width);
  30. max-width: 50vw;
  31. display: flex;
  32. flex-flow: column;
  33. pointer-events: none;
  34. box-sizing: border-box;
  35. }
  36. .annotationContainer {
  37. flex-grow: 1;
  38. pointer-events: none;
  39. & > *:not(.singleAnnotationOuterContainer) {
  40. pointer-events: all;
  41. }
  42. }
  43. .singleAnnotationContainer {
  44. flex-grow: 1;
  45. pointer-events: none;
  46. & .annotation {
  47. pointer-events: all;
  48. }
  49. }
  50. .annotationWrapper {
  51. overflow: hidden;
  52. position: sticky; // TODO Fix sticky position.
  53. top: --toolbar-height;
  54. bottom: 0;
  55. }
  56. .annotationContainer > :nth-last-child(2) .annotationWrapper {
  57. top: calc(var(--toolbar-height) + 4px);
  58. }
  59. .annotationContainer > :nth-last-child(1) .annotationWrapper {
  60. top: calc(var(--toolbar-height) + 8px);
  61. }
  62. .annotationContainer > :nth-child(1) .annotationWrapper {
  63. bottom: 8px;
  64. }
  65. .annotationContainer > :nth-child(2) .annotationWrapper {
  66. bottom: 4px;
  67. }
  68. .annotation {
  69. border: #999 1px solid;
  70. border-radius: 10px;
  71. box-shadow: 10px 10px 10px #9996;
  72. margin: 10px 0px;
  73. padding: 5px 40px 5px 10px;
  74. background-color: lightyellow;
  75. transition: transform 200ms, background-color 200ms;
  76. transform: translateX(calc(var(--container-width) - 40px));
  77. &.dirty {
  78. opacity: 0.8;
  79. }
  80. .dirtyNotice {
  81. font-size: smaller;
  82. font-style: italic;
  83. }
  84. .cardBottom {
  85. padding-left: 10px;
  86. display: flex;
  87. justify-content: space-between;
  88. }
  89. .creator {
  90. font-style: italic;
  91. }
  92. }
  93. .annotationContainer.showAll .annotation,
  94. .annotation.highlightClicked,
  95. .annotation.highlightHovered,
  96. .annotation:hover,
  97. .annotation:focus-within {
  98. transform: none;
  99. }
  100. .annotation button,
  101. .toolbar button {
  102. font-size: 1em;
  103. border: none;
  104. background: none;
  105. cursor: pointer;
  106. &:hover {
  107. background: yellow;
  108. }
  109. .icon {
  110. width: 0.9em;
  111. }
  112. }
  113. .toolbarContainer {
  114. z-index: 999999;
  115. position: sticky;
  116. top: 0;
  117. display: flex;
  118. justify-content: end;
  119. .toolbar {
  120. max-width: var(--container-width);
  121. display: flex;
  122. flex-flow: column nowrap;
  123. align-items: flex-end;
  124. background-color: lightyellow;
  125. border-bottom-left-radius: 10px;
  126. border-left: #999 1px solid;
  127. border-bottom: #999 1px solid;
  128. box-shadow: 10px 10px 10px #9996;
  129. overflow: hidden;
  130. & > * {
  131. padding: 10px;
  132. }
  133. details {
  134. font-size: smaller;
  135. }
  136. summary {
  137. font-size: larger;
  138. list-style: none;
  139. cursor: pointer;
  140. }
  141. }
  142. }
  143. .hiddenWhenClosed {
  144. display: none;
  145. }
  146. .annotationContainer.showAll .hiddenWhenClosed {
  147. display: unset;
  148. }
  149. mark.highlight {
  150. background: #ff99;
  151. }
  152. mark.highlight.clicked,
  153. .annotation.highlightClicked,
  154. .showAll .showAllButton {
  155. background: #ff9;
  156. }
  157. mark.highlight.hovered,
  158. .annotation.highlightHovered {
  159. background: yellow;
  160. }
  161. }