@@ -134,23 +134,11 @@ function resizeText(multiplier) {
134134 document . getElementById ( "text" ) . style . fontSize = parseFloat ( document . getElementById ( "text" ) . style . fontSize ) + ( multiplier * 0.2 ) + "em" ;
135135}
136136
137- function printConsoleArt ( ) {
138- const consoleStr = `
139- ███████ ██████ ██ ████████ ██████ █████ ██████
140- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
141- █████ ██ ██ ██ ██ ██████ ███████ ██ ██
142- ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
143- ███████ ██████ ██ ██ ██ ██ ██ ██████
144-
145-
146- Github: https://github.com/shweshi/editpad
147- `
148- console . log ( consoleStr ) ;
149- }
150-
151137// Close the dropdown menu if the user clicks outside of it
152138window . onclick = function ( event ) {
153- if ( event . target . matches ( '.font' ) || event . target . matches ( '.color-button' ) ) {
139+ if ( event . target . matches ( '.font' ) || event . target . matches ( '.color-button' ) || event . target . matches ( '.share-button' ) || event . target . matches ( '.bottom' )
140+ || event . target . matches ( '.input' ) || event . target . matches ( '.shareLinkButton' ) || event . target . matches ( 'h3' ) || event . target . matches ( '.share-div' )
141+ || event . target . matches ( '.copied' ) ) {
154142 event . stopPropagation ( ) ;
155143 } else {
156144 if ( ! event . target . matches ( '.dropbtn' ) ) {
@@ -163,6 +151,10 @@ window.onclick = function (event) {
163151 }
164152 }
165153 }
154+
155+ if ( ! event . target . matches ( '.share-button' ) ) {
156+ document . getElementById ( 'bottom' ) . style . display = 'none' ;
157+ }
166158 }
167159}
168160
@@ -171,7 +163,7 @@ function share() {
171163 if ( tooltip . style . display != 'block' ) {
172164 tooltip . style . display = 'block' ;
173165 const input = document . getElementById ( 'shareLink' ) ;
174- input . value = 'https://editpad.org ?content=' + getEncodedContent ( ) ;
166+ input . value = 'https://editpad.shashi.dev ?content=' + getEncodedContent ( ) ;
175167 input . select ( ) ;
176168 } else {
177169 tooltip . style . display = 'none' ;
@@ -180,11 +172,11 @@ function share() {
180172
181173function getEncodedContent ( ) {
182174 const content = document . getElementById ( "text" ) . value ;
183- return btoa ( content ) ;
175+ return window . btoa ( content ) ;
184176}
185177
186178function copyToClipboard ( ) {
187- const content = document . getElementById ( "text " ) ;
179+ const content = document . getElementById ( "shareLink " ) ;
188180
189181 content . select ( ) ;
190182 content . setSelectionRange ( 0 , 99999 ) ; /* For mobile devices */
@@ -196,4 +188,32 @@ function copyToClipboard() {
196188 } else {
197189 copied . style . display = 'none' ;
198190 }
191+ }
192+
193+ function setContent ( ) {
194+ let params = ( new URL ( document . location ) ) . searchParams ;
195+ let content = params . get ( "content" ) ;
196+ if ( content ) {
197+ let textarea = document . querySelector ( 'textarea' )
198+
199+ text = window . atob ( content ) ;
200+ textarea . value = text ;
201+ setCleanRequired ( 0 ) ;
202+ }
203+ }
204+
205+ function printConsoleArt ( ) {
206+ const consoleStr = `
207+ ███████ ██████ ██ ████████ ██████ █████ ██████
208+ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
209+ █████ ██ ██ ██ ██ ██████ ███████ ██ ██
210+ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
211+ ███████ ██████ ██ ██ ██ ██ ██ ██████
212+
213+
214+ Github: https://github.com/shweshi/editpad
215+
216+ Version: 1.0.1
217+ `
218+ console . log ( consoleStr ) ;
199219}
0 commit comments