Skip to content

Commit f2c8919

Browse files
nickmessingchrisvfritz
authored andcommitted
Bring funny titles back! (vuejs#1020)
* Bring funny titles back on konami code * Update beforeUnmount to beforeDestroy in team konami code
1 parent 32ab547 commit f2c8919

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

src/v2/guide/team.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ order: 31
1515
<div class="profile">
1616
<h3 :data-official-title="profile.title">
1717
{{ profile.name }}
18+
<sup v-if="profile.title && titleVisible" v-html="profile.title"></sup>
1819
</h3>
1920
<dl>
2021
<template v-if="profile.reposOfficial">
@@ -142,6 +143,7 @@ order: 31
142143
v-for="profile in sortedTeam"
143144
:key="profile.github"
144145
:profile="profile"
146+
:title-visible="titleVisible"
145147
></vuer-profile>
146148
</div>
147149

@@ -181,6 +183,7 @@ order: 31
181183
v-for="profile in sortedPartners"
182184
:key="profile.github"
183185
:profile="profile"
186+
:title-visible="titleVisible"
184187
></vuer-profile>
185188
</div>
186189
</div>
@@ -724,7 +727,8 @@ order: 31
724727
Vue.component('vuer-profile', {
725728
template: '#vuer-profile-template',
726729
props: {
727-
profile: Object
730+
profile: Object,
731+
titleVisible: Boolean
728732
},
729733
computed: {
730734
workHtml: function () {
@@ -828,14 +832,21 @@ order: 31
828832
isSorting: false,
829833
errorGettingLocation: false,
830834
userPosition: null,
831-
useMiles: false
835+
useMiles: false,
836+
konami: {
837+
position: 0,
838+
code: [38, 38, 40, 40, 37, 39, 37, 39, 66, 65]
839+
}
832840
},
833841
computed: {
834842
sortedTeam: function () {
835843
return this.sortVuersByDistance(this.team)
836844
},
837845
sortedPartners: function () {
838846
return this.sortVuersByDistance(this.partners)
847+
},
848+
titleVisible: function () {
849+
return this.konami.code.length === this.konami.position
839850
}
840851
},
841852
created: function () {
@@ -849,7 +860,11 @@ order: 31
849860
this.useMiles = true
850861
}
851862
}
863+
document.addEventListener('keydown', this.konamiKeydown)
852864
},
865+
beforeDestroy: function () {
866+
document.removeEventListener('keydown', this.konamiKeydown)
867+
}
853868
methods: {
854869
getUserPosition: function () {
855870
var vm = this
@@ -890,6 +905,15 @@ order: 31
890905
)
891906
})
892907
return vuersWithDistances
908+
},
909+
konamiKeydown: function (event) {
910+
if (this.titleVisible) {
911+
return
912+
}
913+
914+
if (event.keyCode !== this.konami.code[this.konami.position++]) {
915+
this.konami.position = 0
916+
}
893917
}
894918
}
895919
})

0 commit comments

Comments
 (0)