File tree Expand file tree Collapse file tree 6 files changed +72
-40087
lines changed Expand file tree Collapse file tree 6 files changed +72
-40087
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,14 @@ const commands = {
9292 } ,
9393
9494 test : function ( ) {
95- term . openURL ( "https://i.imgur.com/Q2Unw.gif" ) ;
95+ // innerText HTMLElement pointer for the correct terminal line.
96+ // We use this line to replace it with a video element.
97+ term . stylePrint ( `${ colorText ( "nf134bf139b" , "command" ) } ` , false ) ;
98+
99+ // Mass print of background lines to correctly represent the height of the video
100+ for ( let i = 0 ; i < 41 ; i ++ ) {
101+ term . stylePrint ( `${ colorText ( "dn19BRXub191" , "command" ) } ` , false ) ;
102+ }
96103 } ,
97104
98105 email : function ( ) {
@@ -242,7 +249,14 @@ const commands = {
242249 term . stylePrint ( `No such file: ${ filename } ` ) ;
243250 }
244251 if ( filename == "id_rsa" ) {
245- term . openURL ( "https://i.imgur.com/Q2Unw.gif" ) ;
252+ // innerText HTMLElement pointer for the correct terminal line.
253+ // We use this line to replace it with a video element.
254+ term . stylePrint ( `${ colorText ( "nf134bf139b" , "command" ) } ` , false ) ;
255+
256+ // Mass print of background lines to correctly represent the height of the video
257+ for ( let i = 0 ; i < 41 ; i ++ ) {
258+ term . stylePrint ( `${ colorText ( "dn19BRXub191" , "command" ) } ` , false ) ;
259+ }
246260 }
247261 } ,
248262
Original file line number Diff line number Diff line change 4646
4747 < script src ="js/aalib.js "> </ script >
4848 < script src ="js/xterm.js "> </ script >
49- < script src ="js/xterm-addon-fit.js "> </ script >
50- < script src ="js/xterm-addon-web-links.js "> </ script >
49+ < script src ="js/addon-fit.js "> </ script >
50+ < script src ="js/addon-web-links.js "> </ script >
51+ < script src ="js/rickroll.js "> </ script >
5152 < script src ="js/terminal.js "> </ script >
5253 < script src ="js/terminal-ext.js "> </ script >
5354 < script src ="js/ascii-art.js "> </ script >
@@ -81,6 +82,21 @@ <h2 style="display: none;">Seed stage venture capital firm investing in deep tec
8182 term . loadAddon ( webLinksAddon ) ;
8283 extend ( term ) ;
8384 runRootTerminal ( term ) ;
85+
86+ // MutationObserver listens to changes of .xterm-rows (term.onRender() doesn't work)
87+ const targetNode = document . querySelector ( '.xterm-rows' ) ;
88+ if ( targetNode ) {
89+ const config = { childList : true , subtree : true , characterData : true } ;
90+ const callback = function ( mutationsList , observer ) {
91+ observer . disconnect ( ) ;
92+ RickRoll ( ) ;
93+ observer . observe ( targetNode , config ) ;
94+ } ;
95+ const observer = new MutationObserver ( callback ) ;
96+ observer . observe ( targetNode , config ) ;
97+ } else {
98+ console . warn ( 'No element with class "xterm-rows" found.' ) ;
99+ }
84100 </ script >
85101 </ body >
86102 </ html >
Original file line number Diff line number Diff line change 1+ function RickRoll ( ) {
2+ const Prefiltered = document . querySelectorAll ( `span.xterm-bold.xterm-fg-13` ) ;
3+ const RickRollPaste_EL = [ ] ;
4+ for ( let i = 0 ; i < Prefiltered . length ; i ++ ) {
5+ if ( Prefiltered [ i ] . innerText == 'nf134bf139b' ) {
6+ RickRollPaste_EL . push ( Prefiltered [ i ] ) ;
7+ } else if ( Prefiltered [ i ] . innerText == 'dn19BRXub191' ) {
8+ Prefiltered [ i ] . style . color = 'transparent'
9+ }
10+ }
11+ console . log ( RickRollPaste_EL ) ;
12+ RickRollPaste_EL . forEach ( ( rickroll ) => {
13+ if ( ! rickroll . querySelector ( 'video' ) ) {
14+ var video = document . createElement ( 'video' ) ;
15+ video . src = './videos/rickroll.mp4' ;
16+ video . autoplay = true ;
17+ video . loop = true ;
18+ rickroll . appendChild ( video ) ;
19+ rickroll . style . height = '720px' ;
20+ // rickroll.parentElement.style.position = 'absolute';
21+ // rickroll.parentElement.style.height = '720px';
22+ rickroll . style . color = 'transparent'
23+ rickroll . style . display = 'flex' ;
24+ rickroll . style . position = 'absolute'
25+ video . style . position = 'absolute' ;
26+ }
27+ } ) ;
28+ }
Original file line number Diff line number Diff line change @@ -76,12 +76,16 @@ extend = (term) => {
7676 } ;
7777
7878 term . setCurrentLine = ( newLine , preserveCursor = false ) => {
79+ // Something with the new xterm package is messing up the location of term.pos() right after the clearCurrentLine()
80+ // Because of this, we need to collect the position beforehand.
81+ const oldPos = term . pos ( )
7982 const length = term . currentLine . length ;
8083 term . clearCurrentLine ( ) ;
8184 term . currentLine = newLine ;
8285 term . write ( newLine ) ;
8386 if ( preserveCursor ) {
84- term . write ( '\x1b[D' . repeat ( length - term . pos ( ) ) ) ;
87+ // New XTERM package cursor preservation fix
88+ term . write ( '\x1b[D' . repeat ( length - oldPos ) ) ;
8589 }
8690 }
8791
You can’t perform that action at this time.
0 commit comments