이미지 캐러셀

잠깐 정지!!

SCP 위키 내부에서 사용되는 템플릿 페이지입니다.

스탭의 허가없이
이 페이지를 만지지 마세요


평가: 0+x

What this is

A bunch of miscellaneous CSS 'improvements' that I, CroquemboucheCroquembouche, use on a bunch of pages because I think it makes them easier to deal with.

The changes this component makes are bunch of really trivial modifications to ease the writing experience and to make documenting components/themes a bit easier (which I do a lot). It doesn't change anything about the page visually for the reader — the changes are for the writer.

I wouldn't expect translations of articles that use this component to also use this component, unless the translator likes it and would want to use it anyway.

This component probably won't conflict with other components or themes, and even if it does, it probably won't matter too much.

Usage

On any wiki:

[[include :scp-wiki:component:croqstyle]]

This component is designed to be used on other components. When using on another component, be sure to add this inside the component's [[iftags]] block, so that users of your component are not forced into also using Croqstyle.

Related components

Other personal styling components (which change just a couple things):

Personal styling themes (which are visual overhauls):

CSS changes

Reasonably-sized footnotes

Stops footnotes from being a million miles wide, so that you can actually read them.

.hovertip { max-width: 400px; }

Monospace edit/code

Makes the edit textbox monospace, and also changes all monospace text to Fira Code, the obviously superior monospace font.

@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;700&display=swap');
 
:root { --mono-font: "Fira Code", Cousine, monospace; }
#edit-page-textarea, .code pre, .code p, .code, tt, .page-source { font-family: var(--mono-font); }
.code pre * { white-space: pre; }
.code *, .pre * { font-feature-settings: unset; }

Teletype backgrounds

Adds a light grey background to <tt> elements ({{text}}), so code snippets stand out more.

tt {
  background-color: var(--swatch-something-bhl-idk-will-fix-later, #f4f4f4);
  font-size: 85%;
  padding: 0.2em 0.4em;
  margin: 0;
  border-radius: 6px;
}

No more bigfaces

Stops big pictures from appearing when you hover over someone's avatar image, because they're stupid and really annoying and you can just click on them if you want to see the big version.

.avatar-hover { display: none !important; }

Breaky breaky

Any text inside a div with class nobreak has line-wrapping happen between every letter.

.nobreak { word-break: break-all; }

Code colours

Add my terminal's code colours as variables. Maybe I'll change this to a more common terminal theme like Monokai or something at some point, but for now it's just my personal theme, which is derived from Tomorrow Night Eighties.

Also, adding the .terminal class to a fake code block as [[div class="code terminal"]] gives it a sort of pseudo-terminal look with a dark background. Doesn't work with [[code]], because Wikidot inserts a bunch of syntax highlighting that you can't change yourself without a bunch of CSS. Use it for non-[[code]] code snippets only.

Quick tool to colourise a 'standard' Wikidot component usage example with the above vars: link

:root {
  --c-bg: #393939;
  --c-syntax: #e0e0e0;
  --c-comment: #999999;
  --c-error: #f2777a;
  --c-value: #f99157;
  --c-symbol: #ffcc66;
  --c-string: #99cc99;
  --c-operator: #66cccc;
  --c-builtin: #70a7df;
  --c-keyword: #cc99cc;
}
 
.terminal, .terminal > .code {
  color: var(--c-syntax);
  background: var(--c-bg);
  border: 0.4rem solid var(--c-comment);
  border-radius: 1rem;
}

Debug mode

Draw lines around anything inside .debug-mode. The colour of the lines is red but defers to CSS variable --debug-colour.

You can also add div.debug-info.over and div.debug-info.under inside an element to annotate the debug boxes — though you'll need to make sure to leave enough vertical space that the annotation doesn't overlap the thing above or below it.

…like this!

.debug-mode, .debug-mode *, .debug-mode *::before, .debug-mode *::after {
  outline: 1px solid var(--debug-colour, red);
  position: relative;
}
.debug-info {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Fira Code', monospace;
  font-size: 1rem;
  white-space: nowrap;
}
.debug-info.over { top: -2.5rem; }
.debug-info.under { bottom: -2.5rem; }
.debug-info p { margin: 0; }

소개

한 가지 이미지 대신 여러 장을 순환시켜 보여주는 이미지 캐러셀(슬라이드) 구성요소입니다.

사용법

이미지 캐러셀을 사용하고 싶으면 이 코드를 표준 이미지 블록 대신 사용하세요.

사용하려는 이미지는 여러분의 페이지에 먼저 업로드되어있어야 합니다. 무시하고 캐러셀 설정 후에 업로드했다면 캐시 새로고침(Ctrl+Shift+R) 하기 전까지 안 나올 겁니다.

[[include :scpko:component:carousel
| images=photograph.png,old-map.png,jumpscare.gif
| caption=선택한 이미지들입니다.
| interval=5
| wiki=scpko
| page=scp-173
| width=300px
| height=240px
| position=right
| no-caption=false
| background=white
| options=yes
]]

이미지 캐러셀 사용은 접근성 면에서 문제가 될 수 있습니다. 끝없는 움직임이 주의를 분산시킬 수 있으며, 독자가 문서의 이미지를 기다리게 하는 것도 좋은 생각이 아닙니다. 이 구성요소는 정적인 콘텐츠에서 상호작용을 강제해 독자를 짜증나게 만들기에 최적인 장치입니다. 가능하면 이 구성요소를 사용하지 말 것을 권장드립니다. 그냥 표준 이미지 블록을 여러 개 놓으세요.

각 옵션의 역할

기울임체 속 내용은 전부 선택 사항이며, 그 외엔 필수입니다.

선택적 옵션을 생략하면 기본값이 적용됩니다. 필수 옵션을 생략했다면 정상 작동을 기대하지 마세요.

images: 쉼표로 구분되는 이미지 목록입니다. 각각이 페이지에 미리 업로드되어있어야 하고, URL을 사용할 수도 있습니다.
이미지들은 목록에 작성한 순서대로 캐러셀에 출력됩니다.
links:
(선택 사항)
caption:
(선택 사항)
캐러셀 아래에 붙는 설명입니다.
쓸 설명이 없다면 no-caption 값을 true로 설정해주세요.
기본값: "{$caption}"
interval:
(선택 사항)
이 값을 0이 아닌 숫자로 설정하면 해당 시간(초) 후에 다음 이미지로 넘어갑니다.
사용자가 직접 이미지를 넘기거나 캐러셀에 커서를 올리면 자동으로 넘어가지 않게 됩니다.
기본값: "0"
wiki: 캐러셀에 사용할 이미지가 업로드된 위키의 이름입니다. 예를 들자면 scpko("scp-ko"가 아닙니다), scpkrsandbox 등이 가능합니다.
page: 캐러셀에 사용할 이미지가 업로드된 페이지의 슬러그입니다. 카테고리가 있으면 함께 입력해주세요. (여기서 '슬러그'란 URL에서 나타나는 페이지명을 말합니다. SCP-\̅\̅\̅\̅-J의 경우 슬러그는 scp-botnik-j가 됩니다.)
width:
(선택 사항)
캐러셀에서 가로로 가장 긴 이미지의 너비입니다.
기본값: "300px"
height:
(선택 사항)
캐러셀에서 세로로 가장 긴 이미지의 높이입니다.
브라우저에 따라 기본값 다름
position:
(선택 사항)
페이지에서 캐러셀이 놓이는 수평 위치입니다. "left"나 "right", "center"를 선택할 수 있습니다.
기본값: "right"
no-caption:
(선택 사항)
설명을 넣고 싶지 않으면 "true"로 설정하세요. 그게 아니라면 값을 비우거나 "false"로 설정하면 되고, 아예 지워버려도 괜찮습니다.
기본값: "false"
background:
(선택 사항)
이미지 뒤의 배경 색상입니다.
기본값: "transparent"
options:
(선택 사항)
세부 옵션(재생/일시정지 버튼과 페이지 표시 점)이 보이길 원하시나요? 숨기고 싶다면 "yes"로 설정하세요.
기본값: "yes"

캐러셀이 페이지에 가로로 가득 차면 좋겠어요!
width 값은 "100%", position값은 "center"로 설정하세요.

가장 큰 이미지에 맞추어 너비/높이를 설정했는데 너무 큰 것 같아요!
숫자를 좀 낮추거나 이미지를 작게 만드세요.



코드베이스

캐러셀의 HTML 구조

<html ng-app="carousel" ng-controller="CarouselController">
<head>
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.7.2/angular.min.js"></script>
  <script src="https://scp-wiki.wikidot.com/local--code/component%3Acarousel/2"></script>
  <link href="https://d3g0gp89917ko0.cloudfront.net/v--edac79f846ba/common--theme/base/css/style.css" rel="stylesheet">
  <link href="https://scpko.wdfiles.com/local--code/component%3Atheme/1" rel="stylesheet">
  <link href="https://scp-wiki.wdfiles.com/local--code/component%3Acarousel/4" rel="stylesheet">
  <style>.arrow.inactive { opacity: 0; }</style>
</head>
<body>
  <div class="wrapper" id="background">
    <div class="carousel">
      <div class="horsie" ng-repeat="image in images track by $index"
           ng-class="[index > $index ? 'past' : null,
                      index === $index ? 'present' : null,
                      index < $index ? 'future' : null]">
        <img ng-src="{{image}}" ng-if="!links[$index]">
        <a href="{{links[$index]}}" target="_blank" ng-if="links[$index]">
          <img ng-src="{{image}}">
        </a>
      </div>
    </div>
    <div class="arrow decrementor"
         ng-class="index === 0 ? 'inactive' : 'active'"
         ng-click="increment(-1)">
      <div class="image"></div>
    </div>
    <div class="arrow incrementor"
         ng-class="index === images.length-1 ? 'inactive' : 'active'"
         ng-click="increment(1)">
      <div class="image"></div>
    </div>
    <div class="bubble-holder" ng-class="[options === 'yes' ? null : 'invisible']">
      <div class="bubble" ng-repeat="image in images track by $index"
           ng-class="[index === $index ? 'present' : null]"
           ng-click="selectImage($index)">
      </div>
    </div>
    <div class="control play" ng-click="control('play')"
         ng-class="[state === 'play' ? 'active' : null,
                    options === 'yes' ? null : 'invisible']"></div>
    <div class="control pause" ng-click="control('pause')"
         ng-class="[state === 'pause' ? 'active' : null,
                    options === 'yes' ? null : 'invisible']"></div>
  </div>
</body>
</html>
🈲: SCP 재단의 모든 컨텐츠는 15세 미만의 어린이 혹은 청소년이 시청하기에 부적절합니다.
따로 명시하지 않는 한 이 사이트의 모든 콘텐츠는 크리에이티브 커먼즈 저작자표시-동일조건변경허락 3.0 라이선스를 따릅니다.