Browse Source

Adds winter easter egg

main
Eric Amodio 4 years ago
parent
commit
fbab0e2653
14 changed files with 180 additions and 157 deletions
  1. BIN
      images/snowman.png
  2. +3
    -0
      src/webviews/apps/rebase/rebase.html
  3. +2
    -0
      src/webviews/apps/rebase/rebase.ts
  4. +0
    -23
      src/webviews/apps/scss/base.scss
  5. +2
    -0
      src/webviews/apps/scss/rebase.scss
  6. +1
    -0
      src/webviews/apps/scss/settings.scss
  7. +43
    -0
      src/webviews/apps/scss/snow.scss
  8. +1
    -0
      src/webviews/apps/scss/welcome.scss
  9. +3
    -0
      src/webviews/apps/settings/settings.html
  10. +2
    -0
      src/webviews/apps/settings/settings.ts
  11. +7
    -7
      src/webviews/apps/shared/snow.ts
  12. +3
    -14
      src/webviews/apps/welcome/welcome.html
  13. +2
    -2
      src/webviews/apps/welcome/welcome.ts

BIN
images/snowman.png View File

Before After
Width: 36  |  Height: 36  |  Size: 1.9 KiB

+ 3
- 0
src/webviews/apps/rebase/rebase.html View File

@ -11,6 +11,9 @@
</head>
<body class="preload">
<canvas class="snow"></canvas>
<img class="snow__trigger snow__trigger--right" src="#{root}/images/snowman.png" />
<div class="container">
<header>
<h2>GitLens Interactive Rebase</h2>

+ 2
- 0
src/webviews/apps/rebase/rebase.ts View File

@ -16,6 +16,7 @@ import {
} from '../../protocol';
import { App } from '../shared/appBase';
import { DOM } from '../shared/dom';
import { Snow } from '../shared/snow';
const rebaseActions = ['pick', 'reword', 'edit', 'squash', 'fixup', 'drop'];
const rebaseActionsMap = new Map<string, RebaseEntryAction>([
@ -432,3 +433,4 @@ class RebaseEditor extends App {
}
new RebaseEditor();
requestAnimationFrame(() => new Snow(false));

+ 0
- 23
src/webviews/apps/scss/base.scss View File

@ -13,29 +13,6 @@ body {
font-size: 100% !important;
}
// canvas.snow {
// max-width: calc(100% - 20px);
// pointer-events: none;
// position: fixed;
// z-index: 2147483646;
// }
// .snow__trigger {
// cursor: pointer;
// position: fixed;
// right: 10px;
// top: 5px;
// transform: rotate(-20deg);
// width: 22px;
// z-index: 2147483647;
// & svg:hover {
// & path:first-child {
// fill: #f30000;
// }
// }
// }
a {
border: 0;
color: var(--color-link-foreground);

+ 2
- 0
src/webviews/apps/scss/rebase.scss View File

@ -353,3 +353,5 @@ $entry-padding: 5px;
margin: 0 1px 0 -1px;
}
}
@import 'snow';

+ 1
- 0
src/webviews/apps/scss/settings.scss View File

@ -678,3 +678,4 @@ section {
@import 'utils';
@import 'popup';
@import 'snow';

+ 43
- 0
src/webviews/apps/scss/snow.scss View File

@ -0,0 +1,43 @@
canvas.snow {
max-width: calc(100% - 20px);
pointer-events: none;
position: fixed;
z-index: 2147483646;
}
.snow__trigger {
cursor: pointer;
position: fixed;
left: 7px;
top: 7px;
transform: rotate(-7deg);
width: 36px;
z-index: 2147483647;
opacity: 0.6;
transition: filter 250ms, opacity 250ms, transform 250ms;
body:not(.snowing) & {
filter: grayscale(100%);
opacity: 0.5;
}
&:hover {
filter: unset !important;
opacity: 0.9 !important;
transform: rotate(-4deg) scale(1.1);
}
}
.snow__trigger--right {
right: 15px;
left: unset;
top: 3px;
transform: rotate(4deg) scaleX(-1);
&:hover {
filter: unset !important;
opacity: 0.9 !important;
transform: rotate(1deg) scaleX(-1) scale(1.1);
}
}

+ 1
- 0
src/webviews/apps/scss/welcome.scss View File

@ -551,3 +551,4 @@ section {
}
@import 'utils';
@import 'snow';

+ 3
- 0
src/webviews/apps/settings/settings.html View File

@ -156,6 +156,9 @@
</template>
<body class="preload">
<canvas class="snow"></canvas>
<img class="snow__trigger" src="#{root}/images/snowman.png" />
<div class="container">
<header>
<a class="header__link" title="Learn more about GitLens" href="https://gitlens.amod.io">

+ 2
- 0
src/webviews/apps/settings/settings.ts View File

@ -4,6 +4,7 @@ import '../scss/settings.scss';
import { IpcMessage, onIpcNotification, SettingsDidRequestJumpToNotificationType, SettingsState } from '../../protocol';
import { AppWithConfig } from '../shared/appWithConfigBase';
import { DOM } from '../shared/dom';
import { Snow } from '../shared/snow';
export class SettingsApp extends AppWithConfig<SettingsState> {
private _scopes: HTMLSelectElement | null = null;
@ -228,3 +229,4 @@ export class SettingsApp extends AppWithConfig {
}
new SettingsApp();
requestAnimationFrame(() => new Snow());

src/webviews/apps/welcome/snow.ts → src/webviews/apps/shared/snow.ts View File

@ -38,8 +38,6 @@ class Snowflake {
}
export class Snow {
snowing = false;
private readonly _canvas: any;
private readonly _ctx: any;
private _height: number = 0;
@ -49,7 +47,7 @@ export class Snow {
private readonly _clearBound: any;
private readonly _updateBound: any;
constructor() {
constructor(public snowing: boolean = true) {
this._clearBound = this.clear.bind(this);
this._updateBound = this.update.bind(this);
@ -58,17 +56,19 @@ export class Snow {
const trigger = document.querySelector('.snow__trigger');
if (trigger != null) {
trigger.addEventListener('click', () => this.onToggle());
trigger.addEventListener('click', () => this.onToggle(!this.snowing));
}
window.addEventListener('resize', () => this.onResize());
this.onResize();
this.onToggle();
this.onToggle(snowing);
}
onToggle() {
this.snowing = !this.snowing;
onToggle(snowing: boolean) {
this.snowing = snowing;
document.body.classList.toggle('snowing', this.snowing);
if (this.snowing) {
this.createSnowflakes();
requestAnimationFrame(this._updateBound);

+ 3
- 14
src/webviews/apps/welcome/welcome.html View File

@ -11,20 +11,9 @@
</head>
<body class="preload">
<!-- <canvas class="snow"></canvas>
<div class="snow__trigger">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 125">
<path
fill="#b21a18"
d="M31.25 23.64C45.96 13.15 70.42 11.19 80.7 29.1c3.1 5.4 5.18 11.4 6.86 17.37 1.16 4.1 4.48 12.42.08 15.67-2.96 2.18-10.78 3.95-22.16 3.95s-23.17-2.3-25.32-7.87c-1.02-2.65 1.26-5.5.97-8.31-.63-6.2-7.5-5.97-10.86-3.75-4.58 3-5.17 6.66-9.64 10-1.5 1.12-3.6 1.93-5.22.98-1.5-.9-1.96-2.88-1.96-4.63 0-12.08 10.88-23.94 17.8-28.87z"
/>
<circle fill="#C5C5C5" cx="13.45" cy="69.81" r="8.45" />
<path
fill="#C5C5C5"
d="M64.66 84.31c-17.4 0-35.17-1.38-28.93-25.06.37 13.72 29 12.57 29 12.57s30.12.28 29.88-11.27C97.69 85.43 82.06 84.3 64.66 84.3z"
/>
</svg>
</div> -->
<canvas class="snow"></canvas>
<img class="snow__trigger" src="#{root}/images/snowman.png" />
<div class="container">
<header>
<a class="header__link" title="Learn more about GitLens" href="https://gitlens.amod.io">

+ 2
- 2
src/webviews/apps/welcome/welcome.ts View File

@ -2,8 +2,8 @@
/*global window*/
import '../scss/welcome.scss';
import { WelcomeState } from '../../protocol';
// import { Snow } from './snow';
import { AppWithConfig } from '../shared/appWithConfigBase';
import { Snow } from '../shared/snow';
export class WelcomeApp extends AppWithConfig<WelcomeState> {
constructor() {
@ -13,4 +13,4 @@ export class WelcomeApp extends AppWithConfig {
}
new WelcomeApp();
// requestAnimationFrame(() => new Snow());
requestAnimationFrame(() => new Snow());

Loading…
Cancel
Save