@@ -594,37 +594,16 @@ function finishfunctions() {
594
594
//getapp
595
595
close_app_panel ( ) ;
596
596
//platform_icon
597
-
598
- // ** Query helpers **//
599
-
600
- //get_setting
601
- //set_setting
602
- //get_requestli
603
- //ch_pending
604
- //get_addresslist
605
- //filter_addressli
606
- //filter_all_addressli
607
- //filter_list
608
- //get_currencyli
609
- //get_homeli
610
- //cs_node
611
- //getcoindata
612
- //activecoinsettings
613
- //getcoinsettings
614
- //getcoinconfig
615
597
gk ( ) ;
616
598
glob_html . addClass ( "loaded" ) ;
617
599
//is_opendialog
618
600
//is_openrequest
619
601
620
- // ** Check params ** //
621
-
622
602
check_params ( ) ;
623
603
//check_intents;
624
604
//expand_shoturl
625
605
//expand_bitly
626
606
//ln_connect
627
- //click_pop
628
607
//add_serviceworker
629
608
}
630
609
@@ -5057,153 +5036,6 @@ function platform_icon(platform) {
5057
5036
fetch_aws ( "img_button-desktop_app.png" ) ;
5058
5037
}
5059
5038
5060
- // ** Query helpers ** //
5061
-
5062
- // Retrieves a setting value
5063
- function get_setting ( setting , dat ) {
5064
- return $ ( "#" + setting ) . data ( dat ) ;
5065
- }
5066
-
5067
- // Sets a setting value and optionally updates its title
5068
- function set_setting ( setting , keypairs , title ) {
5069
- const set_node = $ ( "#" + setting ) ;
5070
- set_node . data ( keypairs ) ;
5071
- if ( title ) {
5072
- set_node . find ( "p" ) . text ( title ) ;
5073
- }
5074
- }
5075
-
5076
- // Finds a request list item based on data attributes
5077
- function get_requestli ( datakey , dataval ) {
5078
- return $ ( "#requestlist li.rqli" ) . filter ( function ( ) {
5079
- return $ ( this ) . data ( datakey ) == dataval ;
5080
- } )
5081
- }
5082
-
5083
- // Checks if a pending request exists for the given data
5084
- function ch_pending ( dat ) {
5085
- return ( $ ( "#requestlist li.rqli[data-address='" + dat . address + "'][data-pending='scanning'][data-cmcid='" + dat . cmcid + "']" ) . length > 0 ) ? true : false ;
5086
- }
5087
-
5088
- // Retrieves the address list for a given currency
5089
- function get_addresslist ( currency ) {
5090
- return $ ( "main #" + currency + " .content ul.pobox[data-currency='" + currency + "']" ) ;
5091
- }
5092
-
5093
- // Filters address list items based on data attributes
5094
- function filter_addressli ( currency , datakey , dataval ) {
5095
- const addressli = get_addresslist ( currency ) . children ( "li" ) ;
5096
- return filter_list ( addressli , datakey , dataval ) ;
5097
- }
5098
-
5099
- // Filters all address list items based on data attributes
5100
- function filter_all_addressli ( datakey , dataval ) {
5101
- return filter_list ( $ ( ".adli" ) , datakey , dataval ) ;
5102
- }
5103
-
5104
- // Filters a list based on data attributes
5105
- function filter_list ( list , datakey , dataval ) {
5106
- return list . filter ( function ( ) {
5107
- return $ ( this ) . data ( datakey ) == dataval ;
5108
- } )
5109
- }
5110
-
5111
- // Retrieves the currency list item for a given currency
5112
- function get_currencyli ( currency ) {
5113
- return $ ( "#usedcurrencies > li[data-currency='" + currency + "']" ) ;
5114
- }
5115
-
5116
- // Retrieves the home list item for a given currency
5117
- function get_homeli ( currency ) {
5118
- return $ ( "#currencylist > li[data-currency='" + currency + "']" ) ;
5119
- }
5120
-
5121
- // Retrieves coin settings node or data
5122
- function cs_node ( currency , id , data ) {
5123
- const coinnode = $ ( "#" + currency + "_settings .cc_settinglist li[data-id='" + id + "']" ) ;
5124
- if ( coinnode . length ) {
5125
- if ( data ) {
5126
- const coindat = coinnode . data ( ) ;
5127
- if ( coindat ) {
5128
- return coindat ;
5129
- }
5130
- }
5131
- return coinnode ;
5132
- }
5133
- const coindata = getcoinsettings ( currency ) ;
5134
- if ( coindata ) {
5135
- const apis = coindata . apis ;
5136
- if ( apis ) {
5137
- return apis ;
5138
- }
5139
- }
5140
- return false
5141
- }
5142
-
5143
- // Retrieves coin data for a given currency
5144
- function getcoindata ( currency ) {
5145
- const coindata_object = getcoinconfig ( currency ) ;
5146
- if ( coindata_object ) {
5147
- const coindata = coindata_object . data ,
5148
- settings = coindata_object . settings ,
5149
- has_settings = ( settings ) ? true : false ,
5150
- is_monitored = ( settings ) ? ( settings . apis ) ? true : false : false ,
5151
- cd_object = {
5152
- "currency" : coindata . currency ,
5153
- "ccsymbol" : coindata . ccsymbol ,
5154
- "cmcid" : coindata . cmcid ,
5155
- "monitored" : is_monitored ,
5156
- "urlscheme" : coindata . urlscheme ,
5157
- "settings" : has_settings ,
5158
- "regex" : coindata . address_regex ,
5159
- "erc20" : false
5160
- } ;
5161
- return cd_object ;
5162
- } // if not it's probably erc20 token
5163
- const currencyref = get_currencyli ( currency ) ; // check if erc20 token is added
5164
- if ( currencyref . length > 0 ) {
5165
- return $ . extend ( currencyref . data ( ) , glob_br_config . erc20_dat . data ) ;
5166
- } // else lookup erc20 data
5167
- const tokenobject = br_get_local ( "erc20tokens" , true ) ;
5168
- if ( tokenobject ) {
5169
- const erc20data = $ . grep ( tokenobject , function ( filter ) {
5170
- return filter . name == currency ;
5171
- } ) [ 0 ] ;
5172
- if ( erc20data ) {
5173
- const fetched_data = {
5174
- "currency" : erc20data . name ,
5175
- "ccsymbol" : erc20data . symbol ,
5176
- "cmcid" : erc20data . cmcid . toString ( ) ,
5177
- "contract" : erc20data . contract
5178
- }
5179
- return $ . extend ( fetched_data , glob_br_config . erc20_dat . data ) ;
5180
- }
5181
- }
5182
- return false ;
5183
- }
5184
-
5185
- // Retrieves active coin settings for a given currency
5186
- function activecoinsettings ( currency ) {
5187
- const saved_coinsettings = br_get_local ( currency + "_settings" , true ) ;
5188
- return ( saved_coinsettings ) ? saved_coinsettings : getcoinsettings ( currency ) ;
5189
- }
5190
-
5191
- // Retrieves coin settings for a given currency
5192
- function getcoinsettings ( currency ) {
5193
- const coindata = getcoinconfig ( currency ) ;
5194
- if ( coindata ) {
5195
- return coindata . settings ;
5196
- } // return erc20 settings
5197
- return glob_br_config . erc20_dat . settings ;
5198
- }
5199
-
5200
- // Retrieves coin configuration for a given currency
5201
- function getcoinconfig ( currency ) {
5202
- return $ . grep ( glob_br_config . bitrequest_coin_data , function ( filter ) {
5203
- return filter . currency == currency ;
5204
- } ) [ 0 ] ;
5205
- }
5206
-
5207
5039
// Checks if a dialog is currently open
5208
5040
function is_opendialog ( ) {
5209
5041
return ( $ ( "#dialogbody > div.formbox" ) . length ) ? true : false ;
@@ -5214,44 +5046,6 @@ function is_openrequest() {
5214
5046
return ( $ ( "#request_front" ) . length ) ? true : false ;
5215
5047
}
5216
5048
5217
- // ** Check params ** //
5218
-
5219
- // Checks and processes URL parameters
5220
- function check_params ( gets ) {
5221
- const lgets = ( gets ) ? gets : geturlparameters ( ) ;
5222
- if ( lgets . xss ) {
5223
- return
5224
- }
5225
- if ( lgets . i ) {
5226
- expand_shoturl ( lgets . i ) ;
5227
- return
5228
- }
5229
- if ( lgets . cl ) {
5230
- click_pop ( lgets . cl ) ;
5231
- }
5232
- const page = lgets . p ;
5233
- if ( page == "settings" ) {
5234
- if ( lgets . ro ) {
5235
- check_teaminvite ( lgets . ro ) ;
5236
- } else if ( lgets . sbu ) {
5237
- check_systembu ( lgets . sbu ) ;
5238
- } else if ( lgets . csv ) {
5239
- check_csvexport ( lgets . csv ) ;
5240
- } else if ( lgets . code ) {
5241
- init_access ( lgets . code ) ;
5242
- }
5243
- return
5244
- }
5245
- if ( lgets . scheme ) {
5246
- check_intents ( lgets . scheme ) ;
5247
- return
5248
- }
5249
- if ( lgets . lnconnect ) {
5250
- lm_function ( ) ;
5251
- ln_connect ( ) ;
5252
- }
5253
- }
5254
-
5255
5049
// Checks and processes URL scheme intents
5256
5050
function check_intents ( scheme ) {
5257
5051
if ( scheme == "false" ) {
@@ -5431,15 +5225,6 @@ function ln_connect(gets) {
5431
5225
notify ( translate ( "invalidformat" ) ) ;
5432
5226
}
5433
5227
5434
- // Triggers a click event after a delay
5435
- function click_pop ( fn ) {
5436
- const timeout = setTimeout ( function ( ) {
5437
- $ ( "#" + fn ) . trigger ( "click" ) ;
5438
- } , 1200 , function ( ) {
5439
- clearTimeout ( timeout ) ;
5440
- } ) ;
5441
- }
5442
-
5443
5228
// Adds a service worker to the application
5444
5229
function add_serviceworker ( ) {
5445
5230
if ( "serviceWorker" in navigator ) {
0 commit comments