@@ -24,6 +24,10 @@ const _mainMenuObj = {
2424 ]
2525 }
2626 ] ,
27+ appScript : [ {
28+ startup : { } ,
29+ _appScriptGlobal : { }
30+ } ]
2731} ;
2832const _appScriptGlobal = `
2933
@@ -325,7 +329,6 @@ const _appScript = {
325329 this . showErrorMessage = ko . observable ( false ) ;
326330 this . showHtmlCodePage = ko . observable ( false ) ;
327331 this . showImgPage = ko . observable ( true ) ;
328- this . urlPool = [ ] ;
329332 this . png = ko . observable ( '' ) ;
330333 const self = this ;
331334 _view . showIconBar ( false ) ;
@@ -342,18 +345,21 @@ const _appScript = {
342345 const regex = new RegExp ( `${ filename } ` , 'g' ) ;
343346 const index = html . indexOf ( `${ filename } ` ) ;
344347 if ( index > - 1 ) {
345- if ( / \. j s $ / . test ( filename ) ) {
348+ if ( / j s $ / . test ( filename ) ) {
346349 _data = _data . replace ( / ^ d a t a : t e x t \/ p l a i n ; / , 'data:application/javascript;' ) ;
347350 }
348- else if ( / \. c s s $ / . test ( filename ) ) {
351+ else if ( / c s s $ / . test ( filename ) ) {
349352 _data = _data . replace ( / ^ d a t a : t e x t \/ p l a i n ; / , 'data:text/css;' ) ;
350353 }
351- else if ( / \. h t m l $ | \. h t m $ / . test ( filename ) ) {
354+ else if ( / h t m l $ | h t m $ / . test ( filename ) ) {
352355 _data = _data . replace ( / ^ d a t a : t e x t \/ p l a i n ; / , 'data:text/html;' ) ;
353356 }
354- else if ( / \. p d f $ / . test ( filename ) ) {
357+ else if ( / p d f $ / . test ( filename ) ) {
355358 _data = _data . replace ( / ^ d a t a : t e x t \/ p l a i n ; / , 'data:text/html;' ) ;
356359 }
360+ else {
361+ const kkk = _data ;
362+ }
357363 html = html . replace ( regex , _data ) ;
358364 }
359365 } ;
@@ -363,11 +369,13 @@ const _appScript = {
363369 } ) ;
364370 self . png ( data . img ) ;
365371 const htmlBolb = new Blob ( [ html ] , { type : 'text/html' } ) ;
366- const url = window . URL . createObjectURL ( htmlBolb ) ;
367- self . urlPool . push ( url ) ;
368- //_view.showLanguageSelect ( false )
372+ const _url = window . URL . createObjectURL ( htmlBolb ) ;
373+ const fileReader = new FileReader ( ) ;
374+ fileReader . onloadend = evt => {
375+ return window . URL . revokeObjectURL ( _url ) ;
376+ } ;
369377 self . showLoading ( false ) ;
370- self . htmlIframe ( url ) ;
378+ self . htmlIframe ( _url ) ;
371379 } ) ;
372380 } ) ;
373381 }
@@ -379,9 +387,6 @@ const _appScript = {
379387 this . showImgPage ( false ) ;
380388 this . showHtmlCodePage ( false ) ;
381389 this . png ( null ) ;
382- this . urlPool . forEach ( n => {
383- window . URL . revokeObjectURL ( n ) ;
384- } ) ;
385390 this . exit ( ) ;
386391 }
387392 imgClick ( ) {
@@ -523,6 +528,7 @@ const _appScript = {
523528 } ,
524529 search_form : ( self , event ) => {
525530 const search_text = self . searchInputText ( ) ;
531+ self . showSearchesRelated ( false ) ;
526532 self . showInputLoading ( true ) ;
527533 const width = window . innerWidth ;
528534 const height = window . outerHeight ;
@@ -555,34 +561,6 @@ const _appScript = {
555561 *
556562 * test Unit
557563 */
558- setTimeout ( ( ) => {
559- /** test error */
560- /*
561- return errorProcess ( 'eee ' )
562- /** */
563- /** Test response from Local host */
564- /** test status */
565- /*
566- setTimeout (() => {
567- self.loadingGetResponse ( false )
568- return self.conetResponse ( true )
569- }, 2000 )
570- return self.loadingGetResponse ( true )
571- /** */
572- /** test normail result */
573- /*
574- self.showInputLoading ( false )
575- self.loadingGetResponse ( false )
576- self.conetResponse ( false )
577-
578- const args = googleSearchResult1[0]
579- self.searchInputTextShow ( search_text )
580- self.searchItemsArray ( args.param )
581- self.returnSearchResultItemsInit ( args.param )
582- return self.showResultItems ( self, args.param )
583- /** */
584- } , 2000 ) ;
585- /** */
586564 return _view . keyPairCalss . emitRequest ( com , ( err , com ) => {
587565 if ( err ) {
588566 return errorProcess ( err ) ;
@@ -736,21 +714,6 @@ const _appScript = {
736714 break ;
737715 }
738716 }
739- /** TEST unit */
740- setTimeout ( ( ) => {
741- /** Error Test */
742- /*
743- return showError ( 'dd' )
744- /** */
745- /** Status Test */
746- /*
747- setTimeout (() => {
748- self.nextButtonLoadingGetResponse ( false )
749- self.nextButtonConetResponse ( true )
750- }, 2000 )
751- return self.nextButtonLoadingGetResponse ( true )
752- /** */
753- } , 2000 ) ;
754717 /** */
755718 return _view . keyPairCalss . emitRequest ( com , ( err , com ) => {
756719 if ( err ) {
@@ -996,6 +959,10 @@ const _appScript = {
996959 self . showSnapshop ( false ) ;
997960 } ) ) ;
998961 } ,
962+ searchesRelatedSelect : ( self , index ) => {
963+ self . searchInputText ( self . searchItem ( ) . searchesRelated [ index ] . text ) ;
964+ self . showSearchesRelated ( false ) ;
965+ } ,
999966 closeSimilarImagesResult : ( self ) => {
1000967 self . searchSimilarImagesList ( [ ] ) ;
1001968 self . showMain ( true ) ;
@@ -1060,11 +1027,10 @@ const _appScript = {
10601027 const _media = Buffer . from ( media [ 1 ] , 'base64' ) ;
10611028 const ret = {
10621029 total_bytes : media [ 1 ] . length ,
1063- media_type : type ,
1030+ media_type : 'image/png' ,
10641031 rawData : media [ 1 ] ,
10651032 media_id_string : null
10661033 } ;
1067- const uploadDataPool = [ ] ;
10681034 //if ( mediaData.length > maxImageLength) {
10691035 const exportImage = ( _type , img ) => {
10701036 return img . getBuffer ( _type , ( err , _buf ) => {
@@ -1081,25 +1047,16 @@ const _appScript = {
10811047 return CallBack ( err ) ;
10821048 }
10831049 const uu = image . bitmap ;
1084- if ( uu . height > uu . width ) {
1085- image . resize ( Jimp . AUTO , imageMaxHeight ) ;
1086- }
1087- else {
1088- image . resize ( imageMaxWidth , Jimp . AUTO ) ;
1089- }
1090- if ( / \/ P N G / i. test ( type ) ) {
1091- return image . deflateStrategy ( 1 , ( ) => {
1092- return exportImage ( type , image ) ;
1093- } ) ;
1094- }
1095- if ( / \/ ( J P E G | J P G ) / i. test ( type ) ) {
1096- return image . quality ( 100 , ( ) => {
1097- return exportImage ( type , image ) ;
1098- } ) ;
1050+ if ( uu . height + uu . width > imageMaxHeight + imageMaxWidth ) {
1051+ if ( uu . height > uu . widt ) {
1052+ image . resize ( Jimp . AUTO , imageMaxHeight ) ;
1053+ }
1054+ else {
1055+ image . resize ( imageMaxWidth , Jimp . AUTO ) ;
1056+ }
10991057 }
1100- // BMP and all other to PNG
1101- ret . media_type = 'image/png' ;
1102- return image . deflateStrategy ( 4 , ( ) => {
1058+ // to PNG
1059+ return image . deflateStrategy ( 2 , ( ) => {
11031060 return exportImage ( ret . media_type , image ) ;
11041061 } ) ;
11051062 } ) ;
@@ -1131,7 +1088,7 @@ const _appScript = {
11311088 if ( err ) {
11321089 return errorProcess ( err ) ;
11331090 }
1134- const uuid = uuid_generate ( ) ;
1091+ const uuid = uuid_generate ( ) + '.png' ;
11351092 return _view . keyPairCalss . encrypt ( data . rawData , ( err , textData ) => {
11361093 if ( err ) {
11371094 return errorProcess ( err ) ;
@@ -1221,7 +1178,7 @@ class appsManager {
12211178 } ;
12221179 const com = {
12231180 command : 'mainPage' ,
1224- Args : null ,
1181+ Args : [ '' ] ,
12251182 error : null ,
12261183 subCom : null
12271184 } ;
0 commit comments