Google Authenticator – WordPress Two Factor Authentication (2FA) - Version 5.4.12

Version Description

  • Google Authenticator-Two Factor Authentication (2FA, MFA) : Support Form Improvement.
Download this release

Release Info

Developer cyberlord92
Plugin Icon 128x128 Google Authenticator – WordPress Two Factor Authentication (2FA)
Version 5.4.12
Comparing to
See all releases

Code changes from version 5.4.9 to 5.4.12

controllers/feedback_footer.php CHANGED
@@ -7,7 +7,7 @@
7
  switch($_POST['option'])
8
  {
9
  case "mo_wpns_send_query":
10
- wpns_handle_support_form($_POST['query_email'],$_POST['query'],$_POST['query_phone']); break;
11
  }
12
  }
13
 
@@ -19,7 +19,7 @@
19
  /* SUPPORT FORM RELATED FUNCTIONS */
20
 
21
  //Function to handle support form submit
22
- function wpns_handle_support_form($email,$query,$phone)
23
  {
24
 
25
  if( empty($email) || empty($query) )
7
  switch($_POST['option'])
8
  {
9
  case "mo_wpns_send_query":
10
+ wpns_handle_feedback_footer_form($_POST['query_email'],$_POST['query'],$_POST['query_phone']); break;
11
  }
12
  }
13
 
19
  /* SUPPORT FORM RELATED FUNCTIONS */
20
 
21
  //Function to handle support form submit
22
+ function wpns_handle_feedback_footer_form($email,$query,$phone)
23
  {
24
 
25
  if( empty($email) || empty($query) )
controllers/main_controller.php CHANGED
@@ -74,7 +74,17 @@
74
  }
75
 
76
  }
77
- include $controller . 'feedback_footer.php';
 
 
 
 
 
 
 
 
 
 
78
  ?>
79
  <?php //if(get_option('mo_wpns_scan_initialize')) { ?>
80
  <!-- <script>
74
  }
75
 
76
  }
77
+ if (isset( $_GET[ 'page' ])) {
78
+
79
+ if ($_GET[ 'page' ] == "mo_2fa_upgrade" || $_GET[ 'page' ] == "mo_2fa_addons")
80
+ {
81
+ include $controller . 'feedback_footer.php';
82
+ }
83
+ else
84
+ {
85
+ include $controller . 'support.php';
86
+ }
87
+ }
88
  ?>
89
  <?php //if(get_option('mo_wpns_scan_initialize')) { ?>
90
  <!-- <script>
controllers/pointers.php CHANGED
@@ -8,7 +8,7 @@ if(array_key_exists('tab',$_GET))
8
  if(get_option('mo2f_two_factor_tour')==1)
9
  {
10
  $pointers['default-miniorange-2fa-select-authentication'] = array(
11
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Select Authentication Method (Step 1 out of 10)' ) ),
12
  'content' => sprintf( '<p>%s</p>', esc_html__( 'Choose your Two Factor authentication method.' ) ),
13
  'anchor_id' => '#mo2f_save_free_plan_auth_methods_form',
14
  'isdefault' => 'yes',
@@ -18,7 +18,7 @@ if(get_option('mo2f_two_factor_tour')==1)
18
  'where' => array( 'toplevel_page_mo_2fa_two_fa' ) // <-- Please note this
19
  );
20
  $pointers['default-miniorange-2fa-configure'] = array(
21
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Click on configure(Step 2 out of 10)' ) ),
22
  'content' => sprintf( '<p>%s</p>', esc_html__( 'Setup the two-factor authentication here.' ) ),
23
  'anchor_id' => '#GoogleAuthenticator_configuration',
24
  'isdefault' => 'yes',
@@ -29,7 +29,7 @@ if(get_option('mo2f_two_factor_tour')==1)
29
  );
30
 
31
  $pointers['default-miniorange-2fa-choose_app'] = array(
32
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Choose the app type(Step 1 out of 7)' ) ),
33
  'content' => sprintf( '<p>%s</p>', esc_html__( 'Choose the app which you want to use as the second factor' ) ),
34
  'anchor_id' => '#mo2f_choose_app_tour',
35
  'isdefault' => 'yes',
@@ -40,7 +40,7 @@ if(get_option('mo2f_two_factor_tour')==1)
40
  );
41
 
42
  $pointers['default-miniorange-2fa-download_app'] = array(
43
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Download app(Step 2 out of 7)' ) ),
44
  'content' => sprintf( '<p>%s</p>', esc_html__( 'If you do not have app in your phone then you can donwload the app here.' ) ),
45
  'anchor_id' => '#links_to_apps_tour',
46
  'isdefault' => 'yes',
@@ -52,7 +52,7 @@ if(get_option('mo2f_two_factor_tour')==1)
52
 
53
 
54
  $pointers['default-miniorange-2fa-scan-qrcode'] = array(
55
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Scan the QR code(Step 3 out of 7)' ) ),
56
  'content' => sprintf( '<p>%s</p>', esc_html__( 'Scan the QR code with your app on your phone.' ) ),
57
  'anchor_id' => '#displayGAQrCodeTour',
58
  'isdefault' => 'yes',
@@ -62,7 +62,7 @@ if(get_option('mo2f_two_factor_tour')==1)
62
  'where' => array( 'toplevel_page_mo_2fa_two_fa' ) // <-- Please note this
63
  );
64
  $pointers['default-miniorange-2fa-choose_name_on_app'] = array(
65
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Choose app name(Step 4 out of 7)' ) ),
66
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can choose the app name which you want to display on your app for the code.' ) ),
67
  'anchor_id' => '#mo2f_change_app_name',
68
  'isdefault' => 'yes',
@@ -73,7 +73,7 @@ if(get_option('mo2f_two_factor_tour')==1)
73
  );
74
 
75
  $pointers['default-miniorange-2fa-enter_code_manually'] = array(
76
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Can\'t scan the QR code?(Step 5 out of 7)' ) ),
77
  'content' => sprintf( '<p>%s</p>', esc_html__( 'If you can not scan the QR code then you can follow these steps to configure the two-factor without scanning the code.' ) ),
78
  'anchor_id' => '#mo2f_scanbarcode_a',
79
  'isdefault' => 'yes',
@@ -84,7 +84,7 @@ if(get_option('mo2f_two_factor_tour')==1)
84
  );
85
 
86
  $pointers['default-miniorange-2fa-enter-otp'] = array(
87
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Enter the OTP(Step 6 of 7)' ) ),
88
  'content' => sprintf( '<p>%s</p>', esc_html__( 'After Scanning the QR code please enter the OTP generated in the app on your phone.' ) ),
89
  'anchor_id' => '#EnterOTPGATour',
90
  'isdefault' => 'yes',
@@ -104,7 +104,7 @@ if(get_option('mo2f_two_factor_tour')==1)
104
  'where' => array( 'toplevel_page_mo_2fa_two_fa' ) // <-- Please note this
105
  );
106
  $pointers['default-miniorange-2fa-test'] = array(
107
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Test the method(Step 3 out of 10).' ) ),
108
  'content' => sprintf( '<p>%s</p>', esc_html__( 'After configuring the 2-factor you can test it here by clicking on Test button.' ) ),
109
  'anchor_id' => '#test',
110
  'isdefault' => 'yes',
@@ -115,7 +115,7 @@ if(get_option('mo2f_two_factor_tour')==1)
115
  );
116
 
117
  $pointers['default-miniorange-2fa-customizations'] = array(
118
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Temporary disable two-factor(Step 4 of 10)' ) ),
119
  'content' => sprintf( '<p>%s</p>', esc_html__( 'While testing if you need to disable the plugin. You can do it from here.' ) ),
120
  'anchor_id' => '#disable_two_factor_tour',
121
  'isdefault' => 'yes',
@@ -125,7 +125,7 @@ if(get_option('mo2f_two_factor_tour')==1)
125
  'where' => array( 'toplevel_page_mo_2fa_two_fa' ) // <-- Please note this
126
  );
127
  $pointers['default-miniorange-2fa-inline-registration'] = array(
128
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'User Enrollment(Step 5 of 10)' ) ),
129
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can force two-factor setup of login for other user here.' ) ),
130
  'anchor_id' => '#mo2f_inline_registration_tour',
131
  'isdefault' => 'yes',
@@ -135,7 +135,7 @@ if(get_option('mo2f_two_factor_tour')==1)
135
  'where' => array( 'toplevel_page_mo_2fa_two_fa' ) // <-- Please note this
136
  );
137
  $pointers['default-minorange-2fa-integration'] = array(
138
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Integrate 2fa with custom forms(Step 6 of 10)' ) ),
139
  'content' => sprintf( '<p>%s</p>', esc_html__( 'We support almost all worpdress forms and some popular forms are listed here. If your form is not in the list you can contact us.' ) ),
140
  'anchor_id' => '#custom_form_2fa_div',
141
  'isdefault' => 'yes',
@@ -145,7 +145,7 @@ if(get_option('mo2f_two_factor_tour')==1)
145
  'where' => array( 'toplevel_page_mo_2fa_two_fa' ) // <-- Please note this
146
  );
147
  $pointers['default-minorange-2fa-premium-features'] = array(
148
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Premium features (Step 7 of 10)' ) ),
149
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can check what features you will get in the premium and upgrade to your preferred plan.' ) ),
150
  'anchor_id' => '#custom_login_2fa',
151
  'isdefault' => 'yes',
@@ -156,7 +156,7 @@ if(get_option('mo2f_two_factor_tour')==1)
156
  );
157
 
158
  $pointers['default-miniorange-2fa-upgrade'] = array(
159
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Upgrade your plan(step 8 out of 10)' ) ),
160
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can check the premium features and upgrade your plan here.' ) ),
161
  'anchor_id' => '#mo_2fa_upgrade_tour',
162
  'isdefault' => 'yes',
@@ -166,8 +166,8 @@ if(get_option('mo2f_two_factor_tour')==1)
166
  'where' => array( 'toplevel_page_mo_2fa_two_fa' ) // <-- Please note this
167
  );
168
  $pointers['default-miniorange-2fa-support_open'] = array(
169
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Contact us!!(step 9 out of 10)' ) ),
170
- 'content' => sprintf( '<p>%s</p>', esc_html__( 'Click to open support form.' ) ),
171
  'anchor_id' => '#mo_wpns_support_layout_tour',
172
  'isdefault' => 'yes',
173
  'edge' => 'bottom',
@@ -176,22 +176,11 @@ if(get_option('mo2f_two_factor_tour')==1)
176
  'where' => array( 'toplevel_page_mo_2fa_two_fa' ) // <-- Please note this
177
  );
178
 
179
-
180
- $pointers['default-miniorange-2fa-support'] = array(
181
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'We are here!!(step 10 out of 10)' ) ),
182
- 'content' => sprintf( '<p>%s</p>', esc_html__( 'If you are having any difficulty while setting up the plugin or using any feature. We are just one click away' ) ),
183
- 'anchor_id' => '#mo_wpns_support_layout_tour_open',
184
- 'isdefault' => 'yes',
185
- 'edge' => 'right',
186
- 'align' => 'left',
187
- 'index' => 'default-miniorange-2fa-support',
188
- 'where' => array( 'toplevel_page_mo_2fa_two_fa' ) // <-- Please note this
189
- );
190
 
191
  }
192
  if(get_option('mo2f_tour_firewall') == 1 ){
193
  $pointers['default-miniorange-firewall-level'] = array(
194
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Choose your level of the firewall(step 1 out of 8)' ) ),
195
  'content' => sprintf( '<p>%s</p>', esc_html__( 'Choose on which level you want to enable firewall. htaccess level is the recommended one.' ) ),
196
  'anchor_id' => '#mo_waf_options_tour',
197
  'isfirewall'=> 'yes',
@@ -201,7 +190,7 @@ if(get_option('mo2f_tour_firewall') == 1 ){
201
  'where' => array( 'miniorange-2-factor_page_mo_2fa_waf' ) // <-- Please note this
202
  );
203
  $pointers['default-miniorange-firewall-attacks'] = array(
204
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Select the types of attacks you want to stop.(step 2 out of 8)' ) ),
205
  'content' => sprintf( '<p>%s</p>', esc_html__( 'Enable attack protection here for different attacks.' ) ),
206
  'anchor_id' => '#mo2f_AttackTypes',
207
  'isfirewall'=> 'yes',
@@ -211,7 +200,7 @@ if(get_option('mo2f_tour_firewall') == 1 ){
211
  'where' => array( 'miniorange-2-factor_page_mo_2fa_waf' ) // <-- Please note this
212
  );
213
  $pointers['default-miniorange-firewall-attack-limit'] = array(
214
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Choose attack limit(step 3 out of 8)' ) ),
215
  'content' => sprintf( '<p>%s</p>', esc_html__( 'Choose the number of attacks an IP can make before getting blocked. If an IP reach the limit it will be blocked on the next attack.' ) ),
216
  'anchor_id' => '#mo2f_waf_block_after',
217
  'isfirewall'=> 'yes',
@@ -223,7 +212,7 @@ if(get_option('mo2f_tour_firewall') == 1 ){
223
  );
224
 
225
  $pointers['default-miniorange-firewall-rate-limit'] = array(
226
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Turn on rate limiting(step 4 out of 8)' ) ),
227
  'content' => sprintf( '<p>%s</p>', esc_html__( 'Turn on rate limiting to protect from Dos attack. Choose request limit and action for rate limiting.' ) ),
228
  'anchor_id' => '#mo2f_ratelimiting',
229
  'isfirewall'=> 'yes',
@@ -233,7 +222,7 @@ if(get_option('mo2f_tour_firewall') == 1 ){
233
  'where' => array( 'miniorange-2-factor_page_mo_2fa_waf' ) // <-- Please note this
234
  );
235
  $pointers['default-miniorange-firewall-check-attacks'] = array(
236
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Check blocked IPs and attacks.(step 5 out of 8)' ) ),
237
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can check the Information about blocked IPs and Attacks here.' ) ),
238
  'anchor_id' => '#mo2f_firewall_attack_dash',
239
  'isfirewall'=> 'yes',
@@ -243,7 +232,7 @@ if(get_option('mo2f_tour_firewall') == 1 ){
243
  'where' => array( 'miniorange-2-factor_page_mo_2fa_waf' ) // <-- Please note this
244
  );
245
  $pointers['default-miniorange-2fa-upgrade'] = array(
246
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Upgrade your plan (step 6 out of 8)' ) ),
247
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can check the premium features and upgrade your plan here.' ) ),
248
  'anchor_id' => '#mo_2fa_upgrade_tour',
249
  'isfirewall' => 'yes',
@@ -254,8 +243,8 @@ if(get_option('mo2f_tour_firewall') == 1 ){
254
  );
255
 
256
  $pointers['default-miniorange-firewall-support'] = array(
257
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Contact us!!(step 7 out of 8)' ) ),
258
- 'content' => sprintf( '<p>%s</p>', esc_html__( 'Click to open support form.' ) ),
259
  'anchor_id' => '#mo_wpns_support_layout_tour',
260
  'isfirewall' => 'yes',
261
  'edge' => 'bottom',
@@ -263,21 +252,12 @@ if(get_option('mo2f_tour_firewall') == 1 ){
263
  'index' => 'default-miniorange-firewall-support',
264
  'where' => array( 'miniorange-2-factor_page_mo_2fa_waf' ) // <-- Please note this
265
  );
266
- $pointers['default-miniorange-firewall-support_open'] = array(
267
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'We are here!!(step 8 out of 8)' ) ),
268
- 'content' => sprintf( '<p>%s</p>', esc_html__( 'If you are having any difficulty while setting up the plugin or using any feature. We are just one click away' ) ),
269
- 'anchor_id' => '#mo_wpns_support_layout_tour_open',
270
- 'isfirewall' => 'yes',
271
- 'edge' => 'right',
272
- 'align' => 'left',
273
- 'index' => 'default-miniorange-firewall-support_open',
274
- 'where' => array( 'miniorange-2-factor_page_mo_2fa_waf' ) // <-- Please note this
275
- );
276
  }
277
 
278
  if(get_option('mo2f_tour_malware_scan') ==1){
279
  $pointers['default-miniorange-malware-scan-modes'] = array(
280
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Scanning Modes (Step 1 of 7)' ) ),
281
  'content' => sprintf( '<p>%s</p>', esc_html__( 'Choose the Scanning mode ' ) ),
282
  'anchor_id' => '#scan_status_table',
283
  'ismalware' => 'yes',
@@ -287,7 +267,7 @@ if(get_option('mo2f_tour_malware_scan') ==1){
287
  'where' => array( 'miniorange-2-factor_page_mo_2fa_malwarescan' ) // <-- Please note this
288
  );
289
  $pointers['default-miniorange-malware-custom-scan-files'] = array(
290
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Select files from custom scan (Step 2 of 7)' ) ),
291
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can select the files you want to scan. Just select the files and start the custom scan' ) ),
292
  'anchor_id' => '#mo2f_select_scanning_files',
293
  'ismalware' => 'yes',
@@ -297,7 +277,7 @@ if(get_option('mo2f_tour_malware_scan') ==1){
297
  'where' => array( 'miniorange-2-factor_page_mo_2fa_malwarescan' ) // <-- Please note this
298
  );
299
  $pointers['default-miniorange-malware-scan-reports'] = array(
300
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Scan report.(Step 3 of 7)' ) ),
301
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can check the scan report here.' ) ),
302
  'anchor_id' => '#scan_report_table',
303
  'ismalware' => 'yes',
@@ -308,7 +288,7 @@ if(get_option('mo2f_tour_malware_scan') ==1){
308
  );
309
 
310
  $pointers['default-miniorange-malware-scan-dashboard'] = array(
311
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Scan dashboard (Step 4 of 7)' ) ),
312
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can check the Information about the files being scanned currently, files scanned in last scans & Infected files' ) ),
313
  'anchor_id' => '#mo2f_scan_dash',
314
  'ismalware' => 'yes',
@@ -318,7 +298,7 @@ if(get_option('mo2f_tour_malware_scan') ==1){
318
  'where' => array( 'miniorange-2-factor_page_mo_2fa_malwarescan' ) // <-- Please note this
319
  );
320
  $pointers['default-miniorange-2fa-upgrade'] = array(
321
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Upgrade your plan(step 5 out of 7)' ) ),
322
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can check the premium features and upgrade your plan here.' ) ),
323
  'anchor_id' => '#mo_2fa_upgrade_tour',
324
  'ismalware' => 'yes',
@@ -329,8 +309,8 @@ if(get_option('mo2f_tour_malware_scan') ==1){
329
  );
330
 
331
  $pointers['default-miniorange-malware-support'] = array(
332
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Contact us!!(step 6 out of 7)' ) ),
333
- 'content' => sprintf( '<p>%s</p>', esc_html__( 'Click to open support form.' ) ),
334
  'anchor_id' => '#mo_wpns_support_layout_tour',
335
  'ismalware' => 'yes',
336
  'edge' => 'bottom',
@@ -338,21 +318,12 @@ if(get_option('mo2f_tour_malware_scan') ==1){
338
  'index' => 'default-miniorange-malware-support',
339
  'where' => array( 'miniorange-2-factor_page_mo_2fa_malwarescan' ) // <-- Please note this
340
  );
341
- $pointers['default-miniorange-malware-support_open'] = array(
342
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'We are here!!(step 7 out of 7)' ) ),
343
- 'content' => sprintf( '<p>%s</p>', esc_html__( 'If you are having any difficulty while setting up the plugin or using any feature. We are just one click away' ) ),
344
- 'anchor_id' => '#mo_wpns_support_layout_tour_open',
345
- 'ismalware' => 'yes',
346
- 'edge' => 'right',
347
- 'align' => 'left',
348
- 'index' => 'default-miniorange-malware-support_open',
349
- 'where' => array( 'miniorange-2-factor_page_mo_2fa_malwarescan' ) // <-- Please note this
350
- );
351
  }
352
 
353
  if(get_option('mo2f_tour_advance_blocking') ==1){
354
  $pointers['default-miniorange-advance-blocking-IP-blocking'] = array(
355
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Manual IP Blocking (Step 1 of 10)' ) ),
356
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can block a specific IP. Access for that IP will be blocked for your site.' ) ),
357
  'anchor_id' => '#mo2f_manual_ip_blocking',
358
  'advcblock' => 'yes',
@@ -362,7 +333,7 @@ if(get_option('mo2f_tour_advance_blocking') ==1){
362
  'where' => array( 'miniorange-2-factor_page_mo_2fa_advancedblocking' ) // <-- Please note this
363
  );
364
  $pointers['default-miniorange-advance-blocking-IP-whitelisting'] = array(
365
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Whitelist IP (Step 2 of 10)' ) ),
366
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can Whitelist a specific IP. The IP will never get blocked on your site.' ) ),
367
  'anchor_id' => '#mo2f_ip_whitelisting',
368
  'advcblock' => 'yes',
@@ -373,7 +344,7 @@ if(get_option('mo2f_tour_advance_blocking') ==1){
373
  );
374
 
375
  $pointers['default-miniorange-advance-blocking-IP-lookup'] = array(
376
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Lookup IP(Step 3 of 10)' ) ),
377
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can get details of an IP here. Example country, city, etc.' ) ),
378
  'anchor_id' => '#mo2f_ip_lookup',
379
  'advcblock' => 'yes',
@@ -385,7 +356,7 @@ if(get_option('mo2f_tour_advance_blocking') ==1){
385
 
386
 
387
  $pointers['default-miniorange-advance-blocking-IP-range'] = array(
388
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'IP range Blocking.(Step 4 of 10)' ) ),
389
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can block a specific range of IPs. Access from those IP will be blocked for your site.' ) ),
390
  'anchor_id' => '#mo2f_ip_range_blocking',
391
  'advcblock' => 'yes',
@@ -395,7 +366,7 @@ if(get_option('mo2f_tour_advance_blocking') ==1){
395
  'where' => array( 'miniorange-2-factor_page_mo_2fa_advancedblocking' ) // <-- Please note this
396
  );
397
  $pointers['default-miniorange-advance-blocking-htaccess-blocking'] = array(
398
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Htaccess Blocking (Step 5 of 10)' ) ),
399
  'content' => sprintf( '<p>%s</p>', esc_html__( 'htaccess level blocking will block the IP before wordpress load on your site. So it will minimize server resources from illegitimate users.' ) ),
400
  'anchor_id' => '#mo2f_htaccess_blocking',
401
  'advcblock' => 'yes',
@@ -405,7 +376,7 @@ if(get_option('mo2f_tour_advance_blocking') ==1){
405
  'where' => array( 'miniorange-2-factor_page_mo_2fa_advancedblocking' ) // <-- Please note this
406
  );
407
  $pointers['default-miniorange-advance-blocking-browser-blocking'] = array(
408
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Browser Blocking (Step 6 of 10)' ) ),
409
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can block specific browser from which you don\'t want users to access.' ) ),
410
  'anchor_id' => '#mo2f_browser_blocking',
411
  'advcblock' => 'yes',
@@ -415,7 +386,7 @@ if(get_option('mo2f_tour_advance_blocking') ==1){
415
  'where' => array( 'miniorange-2-factor_page_mo_2fa_advancedblocking' ) // <-- Please note this
416
  );
417
  $pointers['default-miniorange-advance-blocking-country-blocking'] = array(
418
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Country Blocking (Step 7 of 10)' ) ),
419
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can choose the countries from where you don\'t want access to your site.' ) ),
420
  'anchor_id' => '#mo2f_country_blocking',
421
  'advcblock' => 'yes',
@@ -426,7 +397,7 @@ if(get_option('mo2f_tour_advance_blocking') ==1){
426
  );
427
 
428
  $pointers['default-miniorange-2fa-upgrade'] = array(
429
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Upgrade your plan (step 8 out of 10)' ) ),
430
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can check the premium features and upgrade your plan here.' ) ),
431
  'anchor_id' => '#mo_2fa_upgrade_tour',
432
  'advcblock' => 'yes',
@@ -436,8 +407,8 @@ if(get_option('mo2f_tour_advance_blocking') ==1){
436
  'where' => array( 'miniorange-2-factor_page_mo_2fa_advancedblocking' ) // <-- Please note this
437
  );
438
  $pointers['default-miniorange-advance-blocking-support'] = array(
439
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Contact us!!(step 9 out of 10)' ) ),
440
- 'content' => sprintf( '<p>%s</p>', esc_html__( 'Click to open support form.' ) ),
441
  'anchor_id' => '#mo_wpns_support_layout_tour',
442
  'advcblock' => 'yes',
443
  'edge' => 'bottom',
@@ -445,22 +416,13 @@ if(get_option('mo2f_tour_advance_blocking') ==1){
445
  'index' => 'default-miniorange-advance-blocking-support',
446
  'where' => array( 'miniorange-2-factor_page_mo_2fa_advancedblocking' ) // <-- Please note this
447
  );
448
- $pointers['default-miniorange-advance-blocking-support_open'] = array(
449
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'We are here!!(step 10 out of 10)' ) ),
450
- 'content' => sprintf( '<p>%s</p>', esc_html__( 'If you are having any difficulty while setting up the plugin or using any feature. We are just one click away' ) ),
451
- 'anchor_id' => '#mo_wpns_support_layout_tour_open',
452
- 'advcblock' => 'yes',
453
- 'edge' => 'right',
454
- 'align' => 'left',
455
- 'index' => 'default-miniorange-advance-blocking-support_open',
456
- 'where' => array( 'miniorange-2-factor_page_mo_2fa_advancedblocking' ) // <-- Please note this
457
- );
458
  }
459
 
460
 
461
  if(get_option('mo2f_tour_backup') == 1 ){
462
  $pointers['default-miniorange-backup-manual-db'] = array(
463
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Manual database backup.(Step 1 of 7)' ) ),
464
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can take manual database backup here.The backup will be saved in your uploads directory.' ) ),
465
  'anchor_id' => '#mo2f_select_files_backup',
466
  'isBackup'=> 'yes',
@@ -470,7 +432,7 @@ if(get_option('mo2f_tour_backup') == 1 ){
470
  'where' => array( 'miniorange-2-factor_page_mo_2fa_backup' ) // <-- Please note this
471
  );
472
  $pointers['default-miniorange-backup-auto-db'] = array(
473
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Scheduled/Automated Database backups.(Step 2 of 7)' ) ),
474
  'content' => sprintf( '<p>%s</p>', esc_html__( 'With the help of this you can specify the time duration after which an automatic backup will be taken.' ) ),
475
  'anchor_id' => '#mo2f_auto_dbbackup',
476
  'isBackup'=> 'yes',
@@ -480,7 +442,7 @@ if(get_option('mo2f_tour_backup') == 1 ){
480
  'where' => array( 'miniorange-2-factor_page_mo_2fa_backup' ) // <-- Please note this
481
  );
482
  $pointers['default-miniorange-backup-file'] = array(
483
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Auto backup status(Step 3 of 7)' ) ),
484
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can check the auto backup status.' ) ),
485
  'anchor_id' => '#mo2f_schedule_backup_status',
486
  'isBackup'=> 'yes',
@@ -490,7 +452,7 @@ if(get_option('mo2f_tour_backup') == 1 ){
490
  'where' => array( 'miniorange-2-factor_page_mo_2fa_backup' ) // <-- Please note this
491
  );
492
  $pointers['default-miniorange-backup-report'] = array(
493
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Report of backups.(Step 4 of 7)' ) ),
494
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can check backup taken details.' ) ),
495
  'anchor_id' => '#backup_report_table',
496
  'isBackup'=> 'yes',
@@ -501,7 +463,7 @@ if(get_option('mo2f_tour_backup') == 1 ){
501
  );
502
 
503
  $pointers['default-miniorange-2fa-upgrade'] = array(
504
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Upgrade your plan (step 5 out of 7)' ) ),
505
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can check the premium features and upgrade your plan here.' ) ),
506
  'anchor_id' => '#mo_2fa_upgrade_tour',
507
  'isBackup' => 'yes',
@@ -511,8 +473,8 @@ if(get_option('mo2f_tour_backup') == 1 ){
511
  'where' => array( 'miniorange-2-factor_page_mo_2fa_backup' ) // <-- Please note this
512
  );
513
  $pointers['default-miniorange-backup-support'] = array(
514
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Contact us!!(step 6 out of 7)' ) ),
515
- 'content' => sprintf( '<p>%s</p>', esc_html__( 'Click to open support form.' ) ),
516
  'anchor_id' => '#mo_wpns_support_layout_tour',
517
  'isBackup' => 'yes',
518
  'edge' => 'bottom',
@@ -520,23 +482,12 @@ if(get_option('mo2f_tour_backup') == 1 ){
520
  'index' => 'default-miniorange-backup-support',
521
  'where' => array( 'miniorange-2-factor_page_mo_2fa_backup' ) // <-- Please note this
522
  );
523
- $pointers['default-miniorange-backup-support_open'] = array(
524
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'We are here!!(step 7 out of 7)' ) ),
525
- 'content' => sprintf( '<p>%s</p>', esc_html__( 'If you are having any difficulty while setting up the plugin or using any feature. We are just one click away' ) ),
526
- 'anchor_id' => '#mo_wpns_support_layout_tour_open',
527
- 'isBackup' => 'yes',
528
- 'edge' => 'right',
529
- 'align' => 'left',
530
- 'index' => 'default-miniorange-backup-support_open',
531
- 'where' => array( 'miniorange-2-factor_page_mo_2fa_backup' ) // <-- Please note this
532
- );
533
-
534
 
535
  }
536
 
537
  if(get_option('mo2f_tour_loginSpam') == 1){
538
  $pointers['default-miniorange-login-spam-bruteforce'] = array(
539
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Enable BruteForce protection.(step 1 out of 9)' ) ),
540
  'content' => sprintf( '<p>%s</p>', esc_html__( 'Choose the number of attempts before blocking an IP on login page. It will protect you from bruteforce attack.' ) ),
541
  'anchor_id' => '#mo2f_bruteforce',
542
  'loginSpam' => 'yes',
@@ -546,7 +497,7 @@ if(get_option('mo2f_tour_loginSpam') == 1){
546
  'where' => array( 'miniorange-2-factor_page_mo_2fa_login_and_spam' ) // <-- Please note this
547
  );
548
  $pointers['default-miniorange-login-spam-recaptcha'] = array(
549
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Enable google reCaptcha.(step 2 out of 9)' ) ),
550
  'content' => sprintf( '<p>%s</p>', esc_html__( 'Enable google reCaptcha ' ) ),
551
  'anchor_id' => '#mo2f_google_recaptcha',
552
  'loginSpam' => 'yes',
@@ -556,7 +507,7 @@ if(get_option('mo2f_tour_loginSpam') == 1){
556
  'where' => array( 'miniorange-2-factor_page_mo_2fa_login_and_spam' ) // <-- Please note this
557
  );
558
  $pointers['default-miniorange-login-spam-strong-pass'] = array(
559
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Enforce strong password(step 3 out of 9)' ) ),
560
  'content' => sprintf( '<p>%s</p>', esc_html__( 'Enforce strong password to your users so that their account will not get hacked easily.' ) ),
561
  'anchor_id' => '#mo2f_enforce_strong_password_div',
562
  'loginSpam' => 'yes',
@@ -567,7 +518,7 @@ if(get_option('mo2f_tour_loginSpam') == 1){
567
  );
568
 
569
  $pointers['default-miniorange-login-spam-fake-registration'] = array(
570
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Turn on block fake registration(step 4 out of 9)' ) ),
571
  'content' => sprintf( '<p>%s</p>', esc_html__( 'This will block fake registration on your site.' ) ),
572
  'anchor_id' => '#mo2f_block_registration',
573
  'loginSpam' => 'yes',
@@ -577,7 +528,7 @@ if(get_option('mo2f_tour_loginSpam') == 1){
577
  'where' => array( 'miniorange-2-factor_page_mo_2fa_login_and_spam' ) // <-- Please note this
578
  );
579
  $pointers['default-miniorange-login-spam-content'] = array(
580
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Content Protection.(step 5 out of 9)' ) ),
581
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can protect your content which is directly accessible from path/URL by anyone.' ) ),
582
  'anchor_id' => '#mo2f_content_protection',
583
  'loginSpam' => 'yes',
@@ -587,7 +538,7 @@ if(get_option('mo2f_tour_loginSpam') == 1){
587
  'where' => array( 'miniorange-2-factor_page_mo_2fa_login_and_spam' ) // <-- Please note this
588
  );
589
  $pointers['default-miniorange-login-spam-block-spam'] = array(
590
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Block Spam Comment(Step 6 out of 9)' ) ),
591
  'content' => sprintf( '<p>%s</p>', esc_html__( 'Block automated scripts and bots on comment.' ) ),
592
  'anchor_id' => '#mo2f_comment_protection',
593
  'loginSpam' => 'yes',
@@ -597,7 +548,7 @@ if(get_option('mo2f_tour_loginSpam') == 1){
597
  'where' => array( 'miniorange-2-factor_page_mo_2fa_login_and_spam' ) // <-- Please note this
598
  );
599
  $pointers['default-miniorange-2fa-upgrade'] = array(
600
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Upgrade your plan(step 7 out of 9)' ) ),
601
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can check the premium features and upgrade your plan here.' ) ),
602
  'anchor_id' => '#mo_2fa_upgrade_tour',
603
  'loginSpam' => 'yes',
@@ -608,8 +559,8 @@ if(get_option('mo2f_tour_loginSpam') == 1){
608
  );
609
 
610
  $pointers['default-miniorange-login-spam-support'] = array(
611
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Contact us!!(step 8 out of 9)' ) ),
612
- 'content' => sprintf( '<p>%s</p>', esc_html__( 'Click to open support form.' ) ),
613
  'anchor_id' => '#mo_wpns_support_layout_tour',
614
  'loginSpam' => 'yes',
615
  'edge' => 'bottom',
@@ -617,18 +568,7 @@ if(get_option('mo2f_tour_loginSpam') == 1){
617
  'index' => 'default-miniorange-login-spam-support',
618
  'where' => array( 'miniorange-2-factor_page_mo_2fa_login_and_spam' ) // <-- Please note this
619
  );
620
- $pointers['default-miniorange-login-spam-support_open'] = array(
621
- 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'We are here!!(step 9 out of 9)' ) ),
622
- 'content' => sprintf( '<p>%s</p>', esc_html__( 'If you are having any difficulty while setting up the plugin or using any feature. We are just one click away' ) ),
623
- 'anchor_id' => '#mo_wpns_support_layout_tour_open',
624
- 'loginSpam' => 'yes',
625
- 'edge' => 'right',
626
- 'align' => 'left',
627
- 'index' => 'default-miniorange-login-spam-support_open',
628
- 'where' => array( 'miniorange-2-factor_page_mo_2fa_login_and_spam' ) // <-- Please note this
629
- );
630
-
631
-
632
 
633
  }
634
 
8
  if(get_option('mo2f_two_factor_tour')==1)
9
  {
10
  $pointers['default-miniorange-2fa-select-authentication'] = array(
11
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Select Authentication Method (Step 1 out of 9)' ) ),
12
  'content' => sprintf( '<p>%s</p>', esc_html__( 'Choose your Two Factor authentication method.' ) ),
13
  'anchor_id' => '#mo2f_save_free_plan_auth_methods_form',
14
  'isdefault' => 'yes',
18
  'where' => array( 'toplevel_page_mo_2fa_two_fa' ) // <-- Please note this
19
  );
20
  $pointers['default-miniorange-2fa-configure'] = array(
21
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Click on configure(Step 2 out of 9)' ) ),
22
  'content' => sprintf( '<p>%s</p>', esc_html__( 'Setup the two-factor authentication here.' ) ),
23
  'anchor_id' => '#GoogleAuthenticator_configuration',
24
  'isdefault' => 'yes',
29
  );
30
 
31
  $pointers['default-miniorange-2fa-choose_app'] = array(
32
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Choose the app type(Step 1 out of 6)' ) ),
33
  'content' => sprintf( '<p>%s</p>', esc_html__( 'Choose the app which you want to use as the second factor' ) ),
34
  'anchor_id' => '#mo2f_choose_app_tour',
35
  'isdefault' => 'yes',
40
  );
41
 
42
  $pointers['default-miniorange-2fa-download_app'] = array(
43
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Download app(Step 2 out of 6)' ) ),
44
  'content' => sprintf( '<p>%s</p>', esc_html__( 'If you do not have app in your phone then you can donwload the app here.' ) ),
45
  'anchor_id' => '#links_to_apps_tour',
46
  'isdefault' => 'yes',
52
 
53
 
54
  $pointers['default-miniorange-2fa-scan-qrcode'] = array(
55
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Scan the QR code(Step 3 out of 6)' ) ),
56
  'content' => sprintf( '<p>%s</p>', esc_html__( 'Scan the QR code with your app on your phone.' ) ),
57
  'anchor_id' => '#displayGAQrCodeTour',
58
  'isdefault' => 'yes',
62
  'where' => array( 'toplevel_page_mo_2fa_two_fa' ) // <-- Please note this
63
  );
64
  $pointers['default-miniorange-2fa-choose_name_on_app'] = array(
65
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Choose app name(Step 4 out of 6)' ) ),
66
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can choose the app name which you want to display on your app for the code.' ) ),
67
  'anchor_id' => '#mo2f_change_app_name',
68
  'isdefault' => 'yes',
73
  );
74
 
75
  $pointers['default-miniorange-2fa-enter_code_manually'] = array(
76
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Can\'t scan the QR code?(Step 5 out of 6)' ) ),
77
  'content' => sprintf( '<p>%s</p>', esc_html__( 'If you can not scan the QR code then you can follow these steps to configure the two-factor without scanning the code.' ) ),
78
  'anchor_id' => '#mo2f_scanbarcode_a',
79
  'isdefault' => 'yes',
84
  );
85
 
86
  $pointers['default-miniorange-2fa-enter-otp'] = array(
87
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Enter the OTP(Step 6 of 6)' ) ),
88
  'content' => sprintf( '<p>%s</p>', esc_html__( 'After Scanning the QR code please enter the OTP generated in the app on your phone.' ) ),
89
  'anchor_id' => '#EnterOTPGATour',
90
  'isdefault' => 'yes',
104
  'where' => array( 'toplevel_page_mo_2fa_two_fa' ) // <-- Please note this
105
  );
106
  $pointers['default-miniorange-2fa-test'] = array(
107
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Test the method(Step 3 out of 9).' ) ),
108
  'content' => sprintf( '<p>%s</p>', esc_html__( 'After configuring the 2-factor you can test it here by clicking on Test button.' ) ),
109
  'anchor_id' => '#test',
110
  'isdefault' => 'yes',
115
  );
116
 
117
  $pointers['default-miniorange-2fa-customizations'] = array(
118
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Temporary disable two-factor(Step 4 of 9)' ) ),
119
  'content' => sprintf( '<p>%s</p>', esc_html__( 'While testing if you need to disable the plugin. You can do it from here.' ) ),
120
  'anchor_id' => '#disable_two_factor_tour',
121
  'isdefault' => 'yes',
125
  'where' => array( 'toplevel_page_mo_2fa_two_fa' ) // <-- Please note this
126
  );
127
  $pointers['default-miniorange-2fa-inline-registration'] = array(
128
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'User Enrollment(Step 5 of 9)' ) ),
129
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can force two-factor setup of login for other user here.' ) ),
130
  'anchor_id' => '#mo2f_inline_registration_tour',
131
  'isdefault' => 'yes',
135
  'where' => array( 'toplevel_page_mo_2fa_two_fa' ) // <-- Please note this
136
  );
137
  $pointers['default-minorange-2fa-integration'] = array(
138
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Integrate 2fa with custom forms(Step 6 of 9)' ) ),
139
  'content' => sprintf( '<p>%s</p>', esc_html__( 'We support almost all worpdress forms and some popular forms are listed here. If your form is not in the list you can contact us.' ) ),
140
  'anchor_id' => '#custom_form_2fa_div',
141
  'isdefault' => 'yes',
145
  'where' => array( 'toplevel_page_mo_2fa_two_fa' ) // <-- Please note this
146
  );
147
  $pointers['default-minorange-2fa-premium-features'] = array(
148
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Premium features (Step 7 of 9)' ) ),
149
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can check what features you will get in the premium and upgrade to your preferred plan.' ) ),
150
  'anchor_id' => '#custom_login_2fa',
151
  'isdefault' => 'yes',
156
  );
157
 
158
  $pointers['default-miniorange-2fa-upgrade'] = array(
159
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Upgrade your plan(step 8 out of 9)' ) ),
160
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can check the premium features and upgrade your plan here.' ) ),
161
  'anchor_id' => '#mo_2fa_upgrade_tour',
162
  'isdefault' => 'yes',
166
  'where' => array( 'toplevel_page_mo_2fa_two_fa' ) // <-- Please note this
167
  );
168
  $pointers['default-miniorange-2fa-support_open'] = array(
169
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Contact us!!(step 9 out of 9)' ) ),
170
+ 'content' => sprintf( '<p>%s</p>', esc_html__( 'Need Help? We are just one click away.' ) ),
171
  'anchor_id' => '#mo_wpns_support_layout_tour',
172
  'isdefault' => 'yes',
173
  'edge' => 'bottom',
176
  'where' => array( 'toplevel_page_mo_2fa_two_fa' ) // <-- Please note this
177
  );
178
 
 
 
 
 
 
 
 
 
 
 
 
179
 
180
  }
181
  if(get_option('mo2f_tour_firewall') == 1 ){
182
  $pointers['default-miniorange-firewall-level'] = array(
183
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Choose your level of the firewall(step 1 out of 7)' ) ),
184
  'content' => sprintf( '<p>%s</p>', esc_html__( 'Choose on which level you want to enable firewall. htaccess level is the recommended one.' ) ),
185
  'anchor_id' => '#mo_waf_options_tour',
186
  'isfirewall'=> 'yes',
190
  'where' => array( 'miniorange-2-factor_page_mo_2fa_waf' ) // <-- Please note this
191
  );
192
  $pointers['default-miniorange-firewall-attacks'] = array(
193
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Select the types of attacks you want to stop.(step 2 out of 7)' ) ),
194
  'content' => sprintf( '<p>%s</p>', esc_html__( 'Enable attack protection here for different attacks.' ) ),
195
  'anchor_id' => '#mo2f_AttackTypes',
196
  'isfirewall'=> 'yes',
200
  'where' => array( 'miniorange-2-factor_page_mo_2fa_waf' ) // <-- Please note this
201
  );
202
  $pointers['default-miniorange-firewall-attack-limit'] = array(
203
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Choose attack limit(step 3 out of 7)' ) ),
204
  'content' => sprintf( '<p>%s</p>', esc_html__( 'Choose the number of attacks an IP can make before getting blocked. If an IP reach the limit it will be blocked on the next attack.' ) ),
205
  'anchor_id' => '#mo2f_waf_block_after',
206
  'isfirewall'=> 'yes',
212
  );
213
 
214
  $pointers['default-miniorange-firewall-rate-limit'] = array(
215
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Turn on rate limiting(step 4 out of 7)' ) ),
216
  'content' => sprintf( '<p>%s</p>', esc_html__( 'Turn on rate limiting to protect from Dos attack. Choose request limit and action for rate limiting.' ) ),
217
  'anchor_id' => '#mo2f_ratelimiting',
218
  'isfirewall'=> 'yes',
222
  'where' => array( 'miniorange-2-factor_page_mo_2fa_waf' ) // <-- Please note this
223
  );
224
  $pointers['default-miniorange-firewall-check-attacks'] = array(
225
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Check blocked IPs and attacks.(step 5 out of 7)' ) ),
226
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can check the Information about blocked IPs and Attacks here.' ) ),
227
  'anchor_id' => '#mo2f_firewall_attack_dash',
228
  'isfirewall'=> 'yes',
232
  'where' => array( 'miniorange-2-factor_page_mo_2fa_waf' ) // <-- Please note this
233
  );
234
  $pointers['default-miniorange-2fa-upgrade'] = array(
235
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Upgrade your plan (step 6 out of 7)' ) ),
236
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can check the premium features and upgrade your plan here.' ) ),
237
  'anchor_id' => '#mo_2fa_upgrade_tour',
238
  'isfirewall' => 'yes',
243
  );
244
 
245
  $pointers['default-miniorange-firewall-support'] = array(
246
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Contact us!!(step 7 out of 7)' ) ),
247
+ 'content' => sprintf( '<p>%s</p>', esc_html__( 'Need Help? We are just one click away.' ) ),
248
  'anchor_id' => '#mo_wpns_support_layout_tour',
249
  'isfirewall' => 'yes',
250
  'edge' => 'bottom',
252
  'index' => 'default-miniorange-firewall-support',
253
  'where' => array( 'miniorange-2-factor_page_mo_2fa_waf' ) // <-- Please note this
254
  );
255
+
 
 
 
 
 
 
 
 
 
256
  }
257
 
258
  if(get_option('mo2f_tour_malware_scan') ==1){
259
  $pointers['default-miniorange-malware-scan-modes'] = array(
260
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Scanning Modes (Step 1 of 6)' ) ),
261
  'content' => sprintf( '<p>%s</p>', esc_html__( 'Choose the Scanning mode ' ) ),
262
  'anchor_id' => '#scan_status_table',
263
  'ismalware' => 'yes',
267
  'where' => array( 'miniorange-2-factor_page_mo_2fa_malwarescan' ) // <-- Please note this
268
  );
269
  $pointers['default-miniorange-malware-custom-scan-files'] = array(
270
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Select files from custom scan (Step 2 of 6)' ) ),
271
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can select the files you want to scan. Just select the files and start the custom scan' ) ),
272
  'anchor_id' => '#mo2f_select_scanning_files',
273
  'ismalware' => 'yes',
277
  'where' => array( 'miniorange-2-factor_page_mo_2fa_malwarescan' ) // <-- Please note this
278
  );
279
  $pointers['default-miniorange-malware-scan-reports'] = array(
280
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Scan report.(Step 3 of 6)' ) ),
281
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can check the scan report here.' ) ),
282
  'anchor_id' => '#scan_report_table',
283
  'ismalware' => 'yes',
288
  );
289
 
290
  $pointers['default-miniorange-malware-scan-dashboard'] = array(
291
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Scan dashboard (Step 4 of 6)' ) ),
292
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can check the Information about the files being scanned currently, files scanned in last scans & Infected files' ) ),
293
  'anchor_id' => '#mo2f_scan_dash',
294
  'ismalware' => 'yes',
298
  'where' => array( 'miniorange-2-factor_page_mo_2fa_malwarescan' ) // <-- Please note this
299
  );
300
  $pointers['default-miniorange-2fa-upgrade'] = array(
301
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Upgrade your plan(step 5 out of 6)' ) ),
302
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can check the premium features and upgrade your plan here.' ) ),
303
  'anchor_id' => '#mo_2fa_upgrade_tour',
304
  'ismalware' => 'yes',
309
  );
310
 
311
  $pointers['default-miniorange-malware-support'] = array(
312
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Contact us!!(step 6 out of 6)' ) ),
313
+ 'content' => sprintf( '<p>%s</p>', esc_html__( 'Need Help? We are just one click away.' ) ),
314
  'anchor_id' => '#mo_wpns_support_layout_tour',
315
  'ismalware' => 'yes',
316
  'edge' => 'bottom',
318
  'index' => 'default-miniorange-malware-support',
319
  'where' => array( 'miniorange-2-factor_page_mo_2fa_malwarescan' ) // <-- Please note this
320
  );
321
+
 
 
 
 
 
 
 
 
 
322
  }
323
 
324
  if(get_option('mo2f_tour_advance_blocking') ==1){
325
  $pointers['default-miniorange-advance-blocking-IP-blocking'] = array(
326
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Manual IP Blocking (Step 1 of 9)' ) ),
327
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can block a specific IP. Access for that IP will be blocked for your site.' ) ),
328
  'anchor_id' => '#mo2f_manual_ip_blocking',
329
  'advcblock' => 'yes',
333
  'where' => array( 'miniorange-2-factor_page_mo_2fa_advancedblocking' ) // <-- Please note this
334
  );
335
  $pointers['default-miniorange-advance-blocking-IP-whitelisting'] = array(
336
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Whitelist IP (Step 2 of 9)' ) ),
337
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can Whitelist a specific IP. The IP will never get blocked on your site.' ) ),
338
  'anchor_id' => '#mo2f_ip_whitelisting',
339
  'advcblock' => 'yes',
344
  );
345
 
346
  $pointers['default-miniorange-advance-blocking-IP-lookup'] = array(
347
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Lookup IP(Step 3 of 9)' ) ),
348
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can get details of an IP here. Example country, city, etc.' ) ),
349
  'anchor_id' => '#mo2f_ip_lookup',
350
  'advcblock' => 'yes',
356
 
357
 
358
  $pointers['default-miniorange-advance-blocking-IP-range'] = array(
359
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'IP range Blocking.(Step 4 of 9)' ) ),
360
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can block a specific range of IPs. Access from those IP will be blocked for your site.' ) ),
361
  'anchor_id' => '#mo2f_ip_range_blocking',
362
  'advcblock' => 'yes',
366
  'where' => array( 'miniorange-2-factor_page_mo_2fa_advancedblocking' ) // <-- Please note this
367
  );
368
  $pointers['default-miniorange-advance-blocking-htaccess-blocking'] = array(
369
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Htaccess Blocking (Step 5 of 9)' ) ),
370
  'content' => sprintf( '<p>%s</p>', esc_html__( 'htaccess level blocking will block the IP before wordpress load on your site. So it will minimize server resources from illegitimate users.' ) ),
371
  'anchor_id' => '#mo2f_htaccess_blocking',
372
  'advcblock' => 'yes',
376
  'where' => array( 'miniorange-2-factor_page_mo_2fa_advancedblocking' ) // <-- Please note this
377
  );
378
  $pointers['default-miniorange-advance-blocking-browser-blocking'] = array(
379
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Browser Blocking (Step 6 of 9)' ) ),
380
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can block specific browser from which you don\'t want users to access.' ) ),
381
  'anchor_id' => '#mo2f_browser_blocking',
382
  'advcblock' => 'yes',
386
  'where' => array( 'miniorange-2-factor_page_mo_2fa_advancedblocking' ) // <-- Please note this
387
  );
388
  $pointers['default-miniorange-advance-blocking-country-blocking'] = array(
389
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Country Blocking (Step 7 of 9)' ) ),
390
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can choose the countries from where you don\'t want access to your site.' ) ),
391
  'anchor_id' => '#mo2f_country_blocking',
392
  'advcblock' => 'yes',
397
  );
398
 
399
  $pointers['default-miniorange-2fa-upgrade'] = array(
400
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Upgrade your plan (step 8 out of 9)' ) ),
401
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can check the premium features and upgrade your plan here.' ) ),
402
  'anchor_id' => '#mo_2fa_upgrade_tour',
403
  'advcblock' => 'yes',
407
  'where' => array( 'miniorange-2-factor_page_mo_2fa_advancedblocking' ) // <-- Please note this
408
  );
409
  $pointers['default-miniorange-advance-blocking-support'] = array(
410
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Contact us!!(step 9 out of 9)' ) ),
411
+ 'content' => sprintf( '<p>%s</p>', esc_html__( 'Need Help? We are just one click away.' ) ),
412
  'anchor_id' => '#mo_wpns_support_layout_tour',
413
  'advcblock' => 'yes',
414
  'edge' => 'bottom',
416
  'index' => 'default-miniorange-advance-blocking-support',
417
  'where' => array( 'miniorange-2-factor_page_mo_2fa_advancedblocking' ) // <-- Please note this
418
  );
419
+
 
 
 
 
 
 
 
 
 
420
  }
421
 
422
 
423
  if(get_option('mo2f_tour_backup') == 1 ){
424
  $pointers['default-miniorange-backup-manual-db'] = array(
425
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Manual database backup.(Step 1 of 6)' ) ),
426
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can take manual database backup here.The backup will be saved in your uploads directory.' ) ),
427
  'anchor_id' => '#mo2f_select_files_backup',
428
  'isBackup'=> 'yes',
432
  'where' => array( 'miniorange-2-factor_page_mo_2fa_backup' ) // <-- Please note this
433
  );
434
  $pointers['default-miniorange-backup-auto-db'] = array(
435
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Scheduled/Automated Database backups.(Step 2 of 6)' ) ),
436
  'content' => sprintf( '<p>%s</p>', esc_html__( 'With the help of this you can specify the time duration after which an automatic backup will be taken.' ) ),
437
  'anchor_id' => '#mo2f_auto_dbbackup',
438
  'isBackup'=> 'yes',
442
  'where' => array( 'miniorange-2-factor_page_mo_2fa_backup' ) // <-- Please note this
443
  );
444
  $pointers['default-miniorange-backup-file'] = array(
445
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Auto backup status(Step 3 of 6)' ) ),
446
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can check the auto backup status.' ) ),
447
  'anchor_id' => '#mo2f_schedule_backup_status',
448
  'isBackup'=> 'yes',
452
  'where' => array( 'miniorange-2-factor_page_mo_2fa_backup' ) // <-- Please note this
453
  );
454
  $pointers['default-miniorange-backup-report'] = array(
455
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Report of backups.(Step 4 of 6)' ) ),
456
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can check backup taken details.' ) ),
457
  'anchor_id' => '#backup_report_table',
458
  'isBackup'=> 'yes',
463
  );
464
 
465
  $pointers['default-miniorange-2fa-upgrade'] = array(
466
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Upgrade your plan (step 5 out of 6)' ) ),
467
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can check the premium features and upgrade your plan here.' ) ),
468
  'anchor_id' => '#mo_2fa_upgrade_tour',
469
  'isBackup' => 'yes',
473
  'where' => array( 'miniorange-2-factor_page_mo_2fa_backup' ) // <-- Please note this
474
  );
475
  $pointers['default-miniorange-backup-support'] = array(
476
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Contact us!!(step 6 out of 6)' ) ),
477
+ 'content' => sprintf( '<p>%s</p>', esc_html__( 'Need Help? We are just one click away.' ) ),
478
  'anchor_id' => '#mo_wpns_support_layout_tour',
479
  'isBackup' => 'yes',
480
  'edge' => 'bottom',
482
  'index' => 'default-miniorange-backup-support',
483
  'where' => array( 'miniorange-2-factor_page_mo_2fa_backup' ) // <-- Please note this
484
  );
 
 
 
 
 
 
 
 
 
 
 
485
 
486
  }
487
 
488
  if(get_option('mo2f_tour_loginSpam') == 1){
489
  $pointers['default-miniorange-login-spam-bruteforce'] = array(
490
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Enable BruteForce protection.(step 1 out of 8)' ) ),
491
  'content' => sprintf( '<p>%s</p>', esc_html__( 'Choose the number of attempts before blocking an IP on login page. It will protect you from bruteforce attack.' ) ),
492
  'anchor_id' => '#mo2f_bruteforce',
493
  'loginSpam' => 'yes',
497
  'where' => array( 'miniorange-2-factor_page_mo_2fa_login_and_spam' ) // <-- Please note this
498
  );
499
  $pointers['default-miniorange-login-spam-recaptcha'] = array(
500
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Enable google reCaptcha.(step 2 out of 8)' ) ),
501
  'content' => sprintf( '<p>%s</p>', esc_html__( 'Enable google reCaptcha ' ) ),
502
  'anchor_id' => '#mo2f_google_recaptcha',
503
  'loginSpam' => 'yes',
507
  'where' => array( 'miniorange-2-factor_page_mo_2fa_login_and_spam' ) // <-- Please note this
508
  );
509
  $pointers['default-miniorange-login-spam-strong-pass'] = array(
510
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Enforce strong password(step 3 out of 8)' ) ),
511
  'content' => sprintf( '<p>%s</p>', esc_html__( 'Enforce strong password to your users so that their account will not get hacked easily.' ) ),
512
  'anchor_id' => '#mo2f_enforce_strong_password_div',
513
  'loginSpam' => 'yes',
518
  );
519
 
520
  $pointers['default-miniorange-login-spam-fake-registration'] = array(
521
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Turn on block fake registration(step 4 out of 8)' ) ),
522
  'content' => sprintf( '<p>%s</p>', esc_html__( 'This will block fake registration on your site.' ) ),
523
  'anchor_id' => '#mo2f_block_registration',
524
  'loginSpam' => 'yes',
528
  'where' => array( 'miniorange-2-factor_page_mo_2fa_login_and_spam' ) // <-- Please note this
529
  );
530
  $pointers['default-miniorange-login-spam-content'] = array(
531
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Content Protection.(step 5 out of 8)' ) ),
532
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can protect your content which is directly accessible from path/URL by anyone.' ) ),
533
  'anchor_id' => '#mo2f_content_protection',
534
  'loginSpam' => 'yes',
538
  'where' => array( 'miniorange-2-factor_page_mo_2fa_login_and_spam' ) // <-- Please note this
539
  );
540
  $pointers['default-miniorange-login-spam-block-spam'] = array(
541
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Block Spam Comment(Step 6 out of 8)' ) ),
542
  'content' => sprintf( '<p>%s</p>', esc_html__( 'Block automated scripts and bots on comment.' ) ),
543
  'anchor_id' => '#mo2f_comment_protection',
544
  'loginSpam' => 'yes',
548
  'where' => array( 'miniorange-2-factor_page_mo_2fa_login_and_spam' ) // <-- Please note this
549
  );
550
  $pointers['default-miniorange-2fa-upgrade'] = array(
551
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Upgrade your plan(step 7 out of 8)' ) ),
552
  'content' => sprintf( '<p>%s</p>', esc_html__( 'You can check the premium features and upgrade your plan here.' ) ),
553
  'anchor_id' => '#mo_2fa_upgrade_tour',
554
  'loginSpam' => 'yes',
559
  );
560
 
561
  $pointers['default-miniorange-login-spam-support'] = array(
562
+ 'title' => sprintf( '<h3>%s</h3>', esc_html__( 'Contact us!!(step 8 out of 8)' ) ),
563
+ 'content' => sprintf( '<p>%s</p>', esc_html__( 'Need Help? We are just one click away.' ) ),
564
  'anchor_id' => '#mo_wpns_support_layout_tour',
565
  'loginSpam' => 'yes',
566
  'edge' => 'bottom',
568
  'index' => 'default-miniorange-login-spam-support',
569
  'where' => array( 'miniorange-2-factor_page_mo_2fa_login_and_spam' ) // <-- Please note this
570
  );
571
+
 
 
 
 
 
 
 
 
 
 
 
572
 
573
  }
574
 
handler/twofa/setup_twofa.php CHANGED
@@ -313,7 +313,7 @@
313
  }
314
  $form .=' <b>' . $auth_method .
315
  '</b><br>
316
- <p style="padding:0px; padding-left:0px;font-size: 16px;"> ' . $two_factor_methods_descriptions[ $auth_method ] . '</p>
317
 
318
  </div>
319
  </div>
313
  }
314
  $form .=' <b>' . $auth_method .
315
  '</b><br>
316
+ <p style="padding:0px; padding-left:0px;font-size: 14px;"> ' . $two_factor_methods_descriptions[ $auth_method ] . '</p>
317
 
318
  </div>
319
  </div>
handler/twofa/two_fa_pass2login.php CHANGED
@@ -140,7 +140,7 @@ class Miniorange_Password_2Factor_Login {
140
  update_option( 'mo_wpns_enable_log_requests' , true );
141
  update_option( 'mo2f_miniorange_admin', $id );
142
  update_option( 'mo_2factor_admin_registration_status', 'MO_2_FACTOR_CUSTOMER_REGISTERED_SUCCESS' );
143
-
144
  }
145
  function mo2f_inline_validate_otp(){
146
  if(isset($_POST['miniorange_inline_validate_otp_nonce'])){
140
  update_option( 'mo_wpns_enable_log_requests' , true );
141
  update_option( 'mo2f_miniorange_admin', $id );
142
  update_option( 'mo_2factor_admin_registration_status', 'MO_2_FACTOR_CUSTOMER_REGISTERED_SUCCESS' );
143
+ update_option( 'mo_2factor_user_registration_status', 'MO_2_FACTOR_PLUGIN_SETTINGS' );
144
  }
145
  function mo2f_inline_validate_otp(){
146
  if(isset($_POST['miniorange_inline_validate_otp_nonce'])){
helper/curl.php CHANGED
@@ -221,8 +221,8 @@ class MocURL
221
  'customerKey' => $customerKey,
222
  'fromEmail' => $fromEmail,
223
  'fromName' => 'Xecurify',
224
- 'toEmail' => 'akansha@xecurify.com',
225
- 'toName' => 'akansha@xecurify.com',
226
  'subject' => $subject,
227
  'content' => $content
228
  ),
221
  'customerKey' => $customerKey,
222
  'fromEmail' => $fromEmail,
223
  'fromName' => 'Xecurify',
224
+ 'toEmail' => '2fasupport@xecurify.com',
225
+ 'toName' => '2fasupport@xecurify.com',
226
  'subject' => $subject,
227
  'content' => $content
228
  ),
includes/css/style_settings.css CHANGED
@@ -760,6 +760,7 @@
760
  background-color: white;
761
  color: black;
762
  width :162px;
 
763
  }
764
 
765
  /* Change background color of buttons on hover */
@@ -823,7 +824,7 @@
823
  margin-bottom: 10px;
824
  margin-top: 10px;
825
  height:auto;
826
- width:100%;
827
  float:left;
828
 
829
 
@@ -1713,6 +1714,7 @@ h2.mo_wpns_nav-tab-wrapper
1713
  background-color: white;
1714
  color: black;
1715
  width: 129px;
 
1716
  }
1717
  .mo_wpns_tab button.active {
1718
  background-color: #20b2aa;
760
  background-color: white;
761
  color: black;
762
  width :162px;
763
+ height: 55%;
764
  }
765
 
766
  /* Change background color of buttons on hover */
824
  margin-bottom: 10px;
825
  margin-top: 10px;
826
  height:auto;
827
+ width:70%;
828
  float:left;
829
 
830
 
1714
  background-color: white;
1715
  color: black;
1716
  width: 129px;
1717
+ height: 55%;
1718
  }
1719
  .mo_wpns_tab button.active {
1720
  background-color: #20b2aa;
includes/jquery-qrcode/jquery-qrcode.js CHANGED
@@ -1,2337 +1,2815 @@
1
- /*! jquery-qrcode v0.14.0 - https://larsjung.de/jquery-qrcode/ */
2
- (function (vendor_qrcode) {
3
- 'use strict';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
- var jq = window.jQuery;
 
 
6
 
7
- // Check if canvas is available in the browser (as Modernizr does)
8
- var hasCanvas = (function () {
9
- var elem = document.createElement('canvas');
10
- return !!(elem.getContext && elem.getContext('2d'));
11
- }());
12
 
13
- // Wrapper for the original QR code generator.
14
- function createQRCode(text, level, version, quiet) {
15
- var qr = {};
16
 
17
- var vqr = vendor_qrcode(version, level);
18
- vqr.addData(text);
19
- vqr.make();
20
 
21
- quiet = quiet || 0;
22
 
23
- var qrModuleCount = vqr.getModuleCount();
24
- var quietModuleCount = vqr.getModuleCount() + 2 * quiet;
25
 
26
- function isDark(row, col) {
27
- row -= quiet;
28
- col -= quiet;
29
 
30
- if (row < 0 || row >= qrModuleCount || col < 0 || col >= qrModuleCount) {
31
- return false;
32
- }
33
- return vqr.isDark(row, col);
 
 
 
34
  }
 
 
 
 
35
 
36
- function addBlank(l, t, r, b) {
37
- var prevIsDark = qr.isDark;
38
- var moduleSize = 1 / quietModuleCount;
39
 
40
- qr.isDark = function (row, col) {
41
- var ml = col * moduleSize;
42
- var mt = row * moduleSize;
43
- var mr = ml + moduleSize;
44
- var mb = mt + moduleSize;
45
 
46
- return prevIsDark(row, col) && (l > mr || ml > r || t > mb || mt > b);
47
- };
 
 
 
 
 
48
  }
 
49
 
50
- qr.text = text;
51
- qr.level = level;
52
- qr.version = version;
53
- qr.moduleCount = quietModuleCount;
54
- qr.isDark = isDark;
55
- qr.addBlank = addBlank;
56
 
57
- return qr;
58
- }
59
 
60
- // Returns a minimal QR code for the given text starting with version `minVersion`.
61
- // Returns `undefined` if `text` is too long to be encoded in `maxVersion`.
62
- function createMinQRCode(text, level, minVersion, maxVersion, quiet) {
63
- minVersion = Math.max(1, minVersion || 1);
64
- maxVersion = Math.min(40, maxVersion || 40);
65
- for (var version = minVersion; version <= maxVersion; version += 1) {
66
- try {
67
- return createQRCode(text, level, version, quiet);
68
- } catch (err) {/* empty */}
69
  }
70
- return undefined;
71
- }
72
 
73
- function drawBackgroundLabel(qr, context, settings) {
74
- var size = settings.size;
75
- var font = 'bold ' + settings.mSize * size + 'px ' + settings.fontname;
76
- var ctx = jq('<canvas/>')[0].getContext('2d');
77
-
78
- ctx.font = font;
79
-
80
- var w = ctx.measureText(settings.label).width;
81
- var sh = settings.mSize;
82
- var sw = w / size;
83
- var sl = (1 - sw) * settings.mPosX;
84
- var st = (1 - sh) * settings.mPosY;
85
- var sr = sl + sw;
86
- var sb = st + sh;
87
- var pad = 0.01;
88
-
89
- if (settings.mode === 1) {
90
- // Strip
91
- qr.addBlank(0, st - pad, size, sb + pad);
92
- } else {
93
- // Box
94
- qr.addBlank(sl - pad, st - pad, sr + pad, sb + pad);
95
  }
 
 
 
96
 
97
- context.fillStyle = settings.fontcolor;
98
- context.font = font;
99
- context.fillText(settings.label, sl * size, st * size + 0.75 * settings.mSize * size);
100
- }
101
 
102
- function drawBackgroundImage(qr, context, settings) {
103
- var size = settings.size;
104
- var w = settings.image.naturalWidth || 1;
105
- var h = settings.image.naturalHeight || 1;
106
- var sh = settings.mSize;
107
- var sw = sh * w / h;
108
- var sl = (1 - sw) * settings.mPosX;
109
- var st = (1 - sh) * settings.mPosY;
110
- var sr = sl + sw;
111
- var sb = st + sh;
112
- var pad = 0.01;
113
-
114
- if (settings.mode === 3) {
115
- // Strip
116
- qr.addBlank(0, st - pad, size, sb + pad);
117
- } else {
118
- // Box
119
- qr.addBlank(sl - pad, st - pad, sr + pad, sb + pad);
120
- }
121
 
122
- context.drawImage(settings.image, sl * size, st * size, sw * size, sh * size);
123
- }
124
 
125
- function drawBackground(qr, context, settings) {
126
- if (jq(settings.background).is('img')) {
127
- context.drawImage(settings.background, 0, 0, settings.size, settings.size);
128
- } else if (settings.background) {
129
- context.fillStyle = settings.background;
130
- context.fillRect(settings.left, settings.top, settings.size, settings.size);
131
- }
132
 
133
- var mode = settings.mode;
134
- if (mode === 1 || mode === 2) {
135
- drawBackgroundLabel(qr, context, settings);
136
- } else if (mode === 3 || mode === 4) {
137
- drawBackgroundImage(qr, context, settings);
138
- }
139
- }
140
 
141
- function drawModuleDefault(qr, context, settings, left, top, width, row, col) {
142
- if (qr.isDark(row, col)) {
143
- context.rect(left, top, width, width);
144
- }
145
- }
146
 
147
- function drawModuleRoundedDark(ctx, l, t, r, b, rad, nw, ne, se, sw) {
148
- if (nw) {
149
- ctx.moveTo(l + rad, t);
150
- } else {
151
- ctx.moveTo(l, t);
152
- }
153
 
154
- if (ne) {
155
- ctx.lineTo(r - rad, t);
156
- ctx.arcTo(r, t, r, b, rad);
157
- } else {
158
- ctx.lineTo(r, t);
159
- }
160
 
161
- if (se) {
162
- ctx.lineTo(r, b - rad);
163
- ctx.arcTo(r, b, l, b, rad);
164
- } else {
165
- ctx.lineTo(r, b);
 
 
 
166
  }
 
 
 
 
 
 
167
 
168
- if (sw) {
169
- ctx.lineTo(l + rad, b);
170
- ctx.arcTo(l, b, l, t, rad);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
  } else {
172
- ctx.lineTo(l, b);
173
  }
 
 
 
 
174
 
175
- if (nw) {
176
- ctx.lineTo(l, t + rad);
177
- ctx.arcTo(l, t, r, t, rad);
 
 
 
178
  } else {
179
- ctx.lineTo(l, t);
180
  }
181
- }
182
 
183
- function drawModuleRoundendLight(ctx, l, t, r, b, rad, nw, ne, se, sw) {
184
- if (nw) {
185
- ctx.moveTo(l + rad, t);
186
- ctx.lineTo(l, t);
187
- ctx.lineTo(l, t + rad);
188
- ctx.arcTo(l, t, l + rad, t, rad);
189
- }
190
 
191
- if (ne) {
192
- ctx.moveTo(r - rad, t);
193
- ctx.lineTo(r, t);
194
- ctx.lineTo(r, t + rad);
195
- ctx.arcTo(r, t, r - rad, t, rad);
196
- }
197
 
198
- if (se) {
199
- ctx.moveTo(r - rad, b);
200
- ctx.lineTo(r, b);
201
- ctx.lineTo(r, b - rad);
202
- ctx.arcTo(r, b, r - rad, b, rad);
203
- }
204
 
205
- if (sw) {
206
- ctx.moveTo(l + rad, b);
207
- ctx.lineTo(l, b);
208
- ctx.lineTo(l, b - rad);
209
- ctx.arcTo(l, b, l + rad, b, rad);
210
- }
211
- }
212
 
213
- function drawModuleRounded(qr, context, settings, left, top, width, row, col) {
214
- var isDark = qr.isDark;
215
- var right = left + width;
216
- var bottom = top + width;
217
- var radius = settings.radius * width;
218
- var rowT = row - 1;
219
- var rowB = row + 1;
220
- var colL = col - 1;
221
- var colR = col + 1;
222
- var center = isDark(row, col);
223
- var northwest = isDark(rowT, colL);
224
- var north = isDark(rowT, col);
225
- var northeast = isDark(rowT, colR);
226
- var east = isDark(row, colR);
227
- var southeast = isDark(rowB, colR);
228
- var south = isDark(rowB, col);
229
- var southwest = isDark(rowB, colL);
230
- var west = isDark(row, colL);
231
-
232
- if (center) {
233
- drawModuleRoundedDark(context, left, top, right, bottom, radius, !north && !west, !north && !east, !south && !east, !south && !west);
234
- } else {
235
- drawModuleRoundendLight(context, left, top, right, bottom, radius, north && west && northwest, north && east && northeast, south && east && southeast, south && west && southwest);
236
- }
237
- }
238
 
239
- function drawModules(qr, context, settings) {
240
- var moduleCount = qr.moduleCount;
241
- var moduleSize = settings.size / moduleCount;
242
- var fn = drawModuleDefault;
243
- var row;
244
- var col;
245
 
246
- if (settings.radius > 0 && settings.radius <= 0.5) {
247
- fn = drawModuleRounded;
248
- }
 
 
249
 
250
- context.beginPath();
251
- for (row = 0; row < moduleCount; row += 1) {
252
- for (col = 0; col < moduleCount; col += 1) {
253
- var l = settings.left + col * moduleSize;
254
- var t = settings.top + row * moduleSize;
255
- var w = moduleSize;
 
 
 
 
 
 
256
 
257
- fn(qr, context, settings, l, t, w, row, col);
 
 
 
258
  }
259
- }
260
- if (jq(settings.fill).is('img')) {
261
- context.strokeStyle = 'rgba(0,0,0,0.5)';
262
- context.lineWidth = 2;
263
- context.stroke();
264
- var prev = context.globalCompositeOperation;
265
- context.globalCompositeOperation = 'destination-out';
266
- context.fill();
267
- context.globalCompositeOperation = prev;
268
-
269
- context.clip();
270
- context.drawImage(settings.fill, 0, 0, settings.size, settings.size);
271
- context.restore();
272
- } else {
273
- context.fillStyle = settings.fill;
274
- context.fill();
275
- }
276
- }
277
 
278
- // Draws QR code to the given `canvas` and returns it.
279
- function drawOnCanvas(canvas, settings) {
280
- var qr = createMinQRCode(settings.text, settings.ecLevel, settings.minVersion, settings.maxVersion, settings.quiet);
281
- if (!qr) {
282
- return null;
283
  }
 
 
284
 
285
- var $canvas = jq(canvas).data('qrcode', qr);
286
- var context = $canvas[0].getContext('2d');
287
 
288
- drawBackground(qr, context, settings);
289
- drawModules(qr, context, settings);
290
 
291
- return $canvas;
292
- }
293
 
294
- // Returns a `canvas` element representing the QR code for the given settings.
295
- function createCanvas(settings) {
296
- var $canvas = jq('<canvas/>').attr('width', settings.size).attr('height', settings.size);
297
- return drawOnCanvas($canvas, settings);
298
- }
299
 
300
- // Returns an `image` element representing the QR code for the given settings.
301
- function createImage(settings) {
302
- return jq('<img/>').attr('src', createCanvas(settings)[0].toDataURL('image/png'));
303
- }
304
 
305
- // Returns a `div` element representing the QR code for the given settings.
306
- function createDiv(settings) {
307
- var qr = createMinQRCode(settings.text, settings.ecLevel, settings.minVersion, settings.maxVersion, settings.quiet);
308
- if (!qr) {
309
- return null;
310
- }
311
 
312
- // some shortcuts to improve compression
313
- var settings_size = settings.size;
314
- var settings_bgColor = settings.background;
315
- var math_floor = Math.floor;
316
-
317
- var moduleCount = qr.moduleCount;
318
- var moduleSize = math_floor(settings_size / moduleCount);
319
- var offset = math_floor(0.5 * (settings_size - moduleSize * moduleCount));
320
-
321
- var row;
322
- var col;
323
-
324
- var containerCSS = {
325
- position: 'relative',
326
- left: 0,
327
- top: 0,
328
- padding: 0,
329
- margin: 0,
330
- width: settings_size,
331
- height: settings_size
332
- };
333
- var darkCSS = {
334
- position: 'absolute',
335
- padding: 0,
336
- margin: 0,
337
- width: moduleSize,
338
- height: moduleSize,
339
- 'background-color': settings.fill
340
- };
341
-
342
- var $div = jq('<div/>').data('qrcode', qr).css(containerCSS);
343
-
344
- if (settings_bgColor) {
345
- $div.css('background-color', settings_bgColor);
346
  }
 
347
 
348
- for (row = 0; row < moduleCount; row += 1) {
349
- for (col = 0; col < moduleCount; col += 1) {
350
- if (qr.isDark(row, col)) {
351
- jq('<div/>')
352
- .css(darkCSS)
353
- .css({
354
- left: offset + col * moduleSize,
355
- top: offset + row * moduleSize
356
- })
357
- .appendTo($div);
358
- }
359
- }
360
  }
 
361
 
362
- return $div;
363
- }
 
 
364
 
365
- function createHTML(settings) {
366
- if (hasCanvas && settings.render === 'canvas') {
367
- return createCanvas(settings);
368
- } else if (hasCanvas && settings.render === 'image') {
369
- return createImage(settings);
 
 
 
 
370
  }
 
371
 
372
- return createDiv(settings);
373
- }
 
 
 
 
 
 
374
 
375
- // Plugin
376
- // ======
377
 
378
- // Default settings
379
- // ----------------
380
- var defaults = {
381
- // render method: `'canvas'`, `'image'` or `'div'`
382
- render: 'canvas',
383
 
384
- // version range somewhere in 1 .. 40
385
- minVersion: 1,
386
- maxVersion: 40,
387
 
388
- // error correction level: `'L'`, `'M'`, `'Q'` or `'H'`
389
- ecLevel: 'L',
390
 
391
- // offset in pixel if drawn onto existing canvas
392
- left: 0,
393
- top: 0,
 
 
 
394
 
395
- // size in pixel
396
- size: 200,
 
 
 
397
 
398
- // code color or image element
399
- fill: '#000',
 
 
 
 
 
400
 
401
- // background color or image element, `null` for transparent background
402
- background: null,
 
 
403
 
404
- // content
405
- text: 'no text',
 
 
406
 
407
- // corner radius relative to module width: 0.0 .. 0.5
408
- radius: 0,
409
 
410
- // quiet zone in modules
411
- quiet: 0,
 
 
412
 
413
- // modes
414
- // 0: normal
415
- // 1: label strip
416
- // 2: label box
417
- // 3: image strip
418
- // 4: image box
419
- mode: 0,
420
 
421
- mSize: 0.1,
422
- mPosX: 0.5,
423
- mPosY: 0.5,
424
 
425
- label: 'no label',
426
- fontname: 'sans',
427
- fontcolor: '#000',
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
428
 
429
- image: null
 
430
  };
431
 
432
- // Register the plugin
433
- // -------------------
434
- jq.fn.qrcode = function (options) {
435
- var settings = jq.extend({}, defaults, options);
 
 
436
 
437
- return this.each(function (idx, el) {
438
- if (el.nodeName.toLowerCase() === 'canvas') {
439
- drawOnCanvas(el, settings);
440
- } else {
441
- jq(el).append(createHTML(settings));
442
- }
443
- });
444
  };
445
- }(function () {
446
- // `qrcode` is the single public function defined by the `QR Code Generator`
447
- //---------------------------------------------------------------------
448
- //
449
- // QR Code Generator for JavaScript
450
- //
451
- // Copyright (c) 2009 Kazuhiko Arase
452
- //
453
- // URL: http://www.d-project.com/
454
- //
455
- // Licensed under the MIT license:
456
- // http://www.opensource.org/licenses/mit-license.php
457
- //
458
- // The word 'QR Code' is registered trademark of
459
- // DENSO WAVE INCORPORATED
460
- // http://www.denso-wave.com/qrcode/faqpatent-e.html
461
- //
462
- //---------------------------------------------------------------------
463
-
464
- var qrcode = function() {
465
-
466
- //---------------------------------------------------------------------
467
- // qrcode
468
- //---------------------------------------------------------------------
469
-
470
- /**
471
- * qrcode
472
- * @param typeNumber 1 to 40
473
- * @param errorCorrectLevel 'L','M','Q','H'
474
- */
475
- var qrcode = function(typeNumber, errorCorrectLevel) {
476
-
477
- var PAD0 = 0xEC;
478
- var PAD1 = 0x11;
479
-
480
- var _typeNumber = typeNumber;
481
- var _errorCorrectLevel = QRErrorCorrectLevel[errorCorrectLevel];
482
- var _modules = null;
483
- var _moduleCount = 0;
484
- var _dataCache = null;
485
- var _dataList = new Array();
486
-
487
- var _this = {};
488
-
489
- var makeImpl = function(test, maskPattern) {
490
-
491
- _moduleCount = _typeNumber * 4 + 17;
492
- _modules = function(moduleCount) {
493
- var modules = new Array(moduleCount);
494
- for (var row = 0; row < moduleCount; row += 1) {
495
- modules[row] = new Array(moduleCount);
496
- for (var col = 0; col < moduleCount; col += 1) {
497
- modules[row][col] = null;
498
- }
499
- }
500
- return modules;
501
- }(_moduleCount);
502
-
503
- setupPositionProbePattern(0, 0);
504
- setupPositionProbePattern(_moduleCount - 7, 0);
505
- setupPositionProbePattern(0, _moduleCount - 7);
506
- setupPositionAdjustPattern();
507
- setupTimingPattern();
508
- setupTypeInfo(test, maskPattern);
509
-
510
- if (_typeNumber >= 7) {
511
- setupTypeNumber(test);
512
- }
513
 
514
- if (_dataCache == null) {
515
- _dataCache = createData(_typeNumber, _errorCorrectLevel, _dataList);
 
 
 
 
 
 
 
 
 
 
 
516
  }
517
 
518
- mapData(_dataCache, maskPattern);
519
- };
 
 
520
 
521
- var setupPositionProbePattern = function(row, col) {
 
 
 
522
 
523
- for (var r = -1; r <= 7; r += 1) {
 
524
 
525
- if (row + r <= -1 || _moduleCount <= row + r) continue;
 
526
 
527
- for (var c = -1; c <= 7; c += 1) {
528
 
529
- if (col + c <= -1 || _moduleCount <= col + c) continue;
 
530
 
531
- if ( (0 <= r && r <= 6 && (c == 0 || c == 6) )
532
- || (0 <= c && c <= 6 && (r == 0 || r == 6) )
533
- || (2 <= r && r <= 4 && 2 <= c && c <= 4) ) {
534
- _modules[row + r][col + c] = true;
535
- } else {
536
- _modules[row + r][col + c] = false;
537
- }
538
- }
539
- }
540
- };
541
 
542
- var getBestMaskPattern = function() {
 
 
 
 
 
543
 
544
- var minLostPoint = 0;
545
- var pattern = 0;
546
 
547
- for (var i = 0; i < 8; i += 1) {
548
 
549
- makeImpl(true, i);
 
 
 
 
 
 
 
 
 
 
 
550
 
551
- var lostPoint = QRUtil.getLostPoint(_this);
 
552
 
553
- if (i == 0 || minLostPoint > lostPoint) {
554
- minLostPoint = lostPoint;
555
- pattern = i;
556
- }
557
- }
558
 
559
- return pattern;
560
- };
561
 
562
- var setupTimingPattern = function() {
563
 
564
- for (var r = 8; r < _moduleCount - 8; r += 1) {
565
- if (_modules[r][6] != null) {
566
- continue;
567
- }
568
- _modules[r][6] = (r % 2 == 0);
569
- }
 
 
570
 
571
- for (var c = 8; c < _moduleCount - 8; c += 1) {
572
- if (_modules[6][c] != null) {
573
- continue;
574
- }
575
- _modules[6][c] = (c % 2 == 0);
576
- }
577
- };
578
 
579
- var setupPositionAdjustPattern = function() {
 
580
 
581
- var pos = QRUtil.getPatternPosition(_typeNumber);
 
 
 
 
 
582
 
583
- for (var i = 0; i < pos.length; i += 1) {
 
 
 
 
 
 
 
 
584
 
585
- for (var j = 0; j < pos.length; j += 1) {
 
586
 
587
- var row = pos[i];
588
- var col = pos[j];
589
 
590
- if (_modules[row][col] != null) {
591
- continue;
592
- }
593
 
594
- for (var r = -2; r <= 2; r += 1) {
 
595
 
596
- for (var c = -2; c <= 2; c += 1) {
 
 
597
 
598
- if (r == -2 || r == 2 || c == -2 || c == 2
599
- || (r == 0 && c == 0) ) {
600
- _modules[row + r][col + c] = true;
601
- } else {
602
- _modules[row + r][col + c] = false;
603
- }
604
- }
605
- }
606
- }
607
- }
608
- };
609
 
610
- var setupTypeNumber = function(test) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
611
 
612
- var bits = QRUtil.getBCHTypeNumber(_typeNumber);
 
613
 
614
- for (var i = 0; i < 18; i += 1) {
615
- var mod = (!test && ( (bits >> i) & 1) == 1);
616
- _modules[Math.floor(i / 3)][i % 3 + _moduleCount - 8 - 3] = mod;
617
- }
618
 
619
- for (var i = 0; i < 18; i += 1) {
620
- var mod = (!test && ( (bits >> i) & 1) == 1);
621
- _modules[i % 3 + _moduleCount - 8 - 3][Math.floor(i / 3)] = mod;
622
- }
623
- };
624
 
625
- var setupTypeInfo = function(test, maskPattern) {
626
 
627
- var data = (_errorCorrectLevel << 3) | maskPattern;
628
- var bits = QRUtil.getBCHTypeInfo(data);
 
 
 
 
629
 
630
- // vertical
631
- for (var i = 0; i < 15; i += 1) {
 
 
 
 
632
 
633
- var mod = (!test && ( (bits >> i) & 1) == 1);
 
 
 
 
 
634
 
635
- if (i < 6) {
636
- _modules[i][8] = mod;
637
- } else if (i < 8) {
638
- _modules[i + 1][8] = mod;
639
- } else {
640
- _modules[_moduleCount - 15 + i][8] = mod;
641
- }
642
  }
643
 
644
- // horizontal
645
- for (var i = 0; i < 15; i += 1) {
 
 
 
 
646
 
647
- var mod = (!test && ( (bits >> i) & 1) == 1);
 
 
648
 
649
- if (i < 8) {
650
- _modules[8][_moduleCount - i - 1] = mod;
651
- } else if (i < 9) {
652
- _modules[8][15 - i - 1 + 1] = mod;
653
- } else {
654
- _modules[8][15 - i - 1] = mod;
655
- }
656
- }
657
 
658
- // fixed module
659
- _modules[_moduleCount - 8][8] = (!test);
660
- };
661
 
662
- var mapData = function(data, maskPattern) {
 
663
 
664
- var inc = -1;
665
- var row = _moduleCount - 1;
666
- var bitIndex = 7;
667
- var byteIndex = 0;
668
- var maskFunc = QRUtil.getMaskFunction(maskPattern);
669
 
670
- for (var col = _moduleCount - 1; col > 0; col -= 2) {
 
 
671
 
672
- if (col == 6) col -= 1;
 
673
 
674
- while (true) {
 
 
675
 
676
- for (var c = 0; c < 2; c += 1) {
677
 
678
- if (_modules[row][col - c] == null) {
 
679
 
680
- var dark = false;
 
 
 
 
 
 
681
 
682
- if (byteIndex < data.length) {
683
- dark = ( ( (data[byteIndex] >>> bitIndex) & 1) == 1);
684
- }
685
 
686
- var mask = maskFunc(row, col - c);
 
 
687
 
688
- if (mask) {
689
- dark = !dark;
690
- }
 
691
 
692
- _modules[row][col - c] = dark;
693
- bitIndex -= 1;
694
 
695
- if (bitIndex == -1) {
696
- byteIndex += 1;
697
- bitIndex = 7;
698
- }
699
- }
700
- }
 
 
 
 
701
 
702
- row += inc;
 
703
 
704
- if (row < 0 || _moduleCount <= row) {
705
- row -= inc;
706
- inc = -inc;
707
- break;
708
- }
709
- }
710
- }
711
- };
712
 
713
- var createBytes = function(buffer, rsBlocks) {
 
 
 
 
 
 
 
 
 
714
 
715
- var offset = 0;
716
 
717
- var maxDcCount = 0;
718
- var maxEcCount = 0;
 
719
 
720
- var dcdata = new Array(rsBlocks.length);
721
- var ecdata = new Array(rsBlocks.length);
 
 
 
 
722
 
723
- for (var r = 0; r < rsBlocks.length; r += 1) {
724
 
725
- var dcCount = rsBlocks[r].dataCount;
726
- var ecCount = rsBlocks[r].totalCount - dcCount;
727
 
728
- maxDcCount = Math.max(maxDcCount, dcCount);
729
- maxEcCount = Math.max(maxEcCount, ecCount);
 
 
 
 
730
 
731
- dcdata[r] = new Array(dcCount);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
732
 
733
- for (var i = 0; i < dcdata[r].length; i += 1) {
734
- dcdata[r][i] = 0xff & buffer.getBuffer()[i + offset];
735
- }
736
- offset += dcCount;
737
 
738
- var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
739
- var rawPoly = qrPolynomial(dcdata[r], rsPoly.getLength() - 1);
740
 
741
- var modPoly = rawPoly.mod(rsPoly);
742
- ecdata[r] = new Array(rsPoly.getLength() - 1);
743
- for (var i = 0; i < ecdata[r].length; i += 1) {
744
- var modIndex = i + modPoly.getLength() - ecdata[r].length;
745
- ecdata[r][i] = (modIndex >= 0)? modPoly.getAt(modIndex) : 0;
 
 
 
 
 
 
 
 
 
 
 
746
  }
 
 
747
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
748
 
749
- var totalCodeCount = 0;
750
- for (var i = 0; i < rsBlocks.length; i += 1) {
751
- totalCodeCount += rsBlocks[i].totalCount;
752
- }
 
 
 
753
 
754
- var data = new Array(totalCodeCount);
755
- var index = 0;
 
 
 
 
 
756
 
757
- for (var i = 0; i < maxDcCount; i += 1) {
758
- for (var r = 0; r < rsBlocks.length; r += 1) {
759
- if (i < dcdata[r].length) {
760
- data[index] = dcdata[r][i];
761
- index += 1;
762
- }
763
- }
764
- }
765
 
766
- for (var i = 0; i < maxEcCount; i += 1) {
767
- for (var r = 0; r < rsBlocks.length; r += 1) {
768
- if (i < ecdata[r].length) {
769
- data[index] = ecdata[r][i];
770
- index += 1;
771
- }
772
- }
773
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
774
 
775
- return data;
776
- };
 
 
 
 
 
777
 
778
- var createData = function(typeNumber, errorCorrectLevel, dataList) {
779
 
780
- var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectLevel);
781
 
782
- var buffer = qrBitBuffer();
783
 
784
- for (var i = 0; i < dataList.length; i += 1) {
785
- var data = dataList[i];
786
- buffer.put(data.getMode(), 4);
787
- buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber) );
788
- data.write(buffer);
789
- }
 
 
790
 
791
- // calc num max data.
792
- var totalDataCount = 0;
793
- for (var i = 0; i < rsBlocks.length; i += 1) {
794
- totalDataCount += rsBlocks[i].dataCount;
795
- }
796
 
797
- if (buffer.getLengthInBits() > totalDataCount * 8) {
798
- throw new Error('code length overflow. ('
799
- + buffer.getLengthInBits()
800
- + '>'
801
- + totalDataCount * 8
802
- + ')');
803
- }
804
 
805
- // end code
806
- if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
807
- buffer.put(0, 4);
808
- }
 
 
 
 
809
 
810
- // padding
811
- while (buffer.getLengthInBits() % 8 != 0) {
812
- buffer.putBit(false);
813
- }
814
 
815
- // padding
816
- while (true) {
817
 
818
- if (buffer.getLengthInBits() >= totalDataCount * 8) {
819
- break;
820
- }
821
- buffer.put(PAD0, 8);
 
 
 
 
822
 
823
- if (buffer.getLengthInBits() >= totalDataCount * 8) {
824
- break;
825
- }
826
- buffer.put(PAD1, 8);
827
- }
828
 
829
- return createBytes(buffer, rsBlocks);
830
- };
831
 
832
- _this.addData = function(data) {
833
- var newData = qr8BitByte(data);
834
- _dataList.push(newData);
835
- _dataCache = null;
836
- };
837
 
838
- _this.isDark = function(row, col) {
839
- if (row < 0 || _moduleCount <= row || col < 0 || _moduleCount <= col) {
840
- throw new Error(row + ',' + col);
841
- }
842
- return _modules[row][col];
843
- };
844
 
845
- _this.getModuleCount = function() {
846
- return _moduleCount;
847
- };
848
 
849
- _this.make = function() {
850
- makeImpl(false, getBestMaskPattern() );
851
- };
852
 
853
- _this.createTableTag = function(cellSize, margin) {
 
854
 
855
- cellSize = cellSize || 2;
856
- margin = (typeof margin == 'undefined')? cellSize * 4 : margin;
857
 
858
- var qrHtml = '';
 
 
859
 
860
- qrHtml += '<table style="';
861
- qrHtml += ' border-width: 0px; border-style: none;';
862
- qrHtml += ' border-collapse: collapse;';
863
- qrHtml += ' padding: 0px; margin: ' + margin + 'px;';
864
- qrHtml += '">';
865
- qrHtml += '<tbody>';
866
-
867
- for (var r = 0; r < _this.getModuleCount(); r += 1) {
868
-
869
- qrHtml += '<tr>';
870
-
871
- for (var c = 0; c < _this.getModuleCount(); c += 1) {
872
- qrHtml += '<td style="';
873
- qrHtml += ' border-width: 0px; border-style: none;';
874
- qrHtml += ' border-collapse: collapse;';
875
- qrHtml += ' padding: 0px; margin: 0px;';
876
- qrHtml += ' width: ' + cellSize + 'px;';
877
- qrHtml += ' height: ' + cellSize + 'px;';
878
- qrHtml += ' background-color: ';
879
- qrHtml += _this.isDark(r, c)? '#000000' : '#ffffff';
880
- qrHtml += ';';
881
- qrHtml += '"/>';
882
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
883
 
884
- qrHtml += '</tr>';
 
 
 
 
 
 
 
 
 
 
 
885
  }
 
 
886
 
887
- qrHtml += '</tbody>';
888
- qrHtml += '</table>';
 
 
 
 
 
 
 
 
 
 
 
889
 
890
- return qrHtml;
891
- };
892
 
893
- _this.createImgTag = function(cellSize, margin) {
894
 
895
- cellSize = cellSize || 2;
896
- margin = (typeof margin == 'undefined')? cellSize * 4 : margin;
 
 
 
 
 
897
 
898
- var size = _this.getModuleCount() * cellSize + margin * 2;
899
- var min = margin;
900
- var max = size - margin;
901
 
902
- return createImgTag(size, size, function(x, y) {
903
- if (min <= x && x < max && min <= y && y < max) {
904
- var c = Math.floor( (x - min) / cellSize);
905
- var r = Math.floor( (y - min) / cellSize);
906
- return _this.isDark(r, c)? 0 : 1;
907
- } else {
908
- return 1;
909
- }
910
- } );
911
- };
912
 
913
- return _this;
914
- };
915
 
916
- //---------------------------------------------------------------------
917
- // qrcode.stringToBytes
918
- //---------------------------------------------------------------------
919
 
920
- qrcode.stringToBytes = function(s) {
921
- var bytes = new Array();
922
- for (var i = 0; i < s.length; i += 1) {
923
- var c = s.charCodeAt(i);
924
- bytes.push(c & 0xff);
925
- }
926
- return bytes;
927
- };
928
 
929
- //---------------------------------------------------------------------
930
- // qrcode.createStringToBytes
931
- //---------------------------------------------------------------------
932
 
933
- /**
934
- * @param unicodeData base64 string of byte array.
935
- * [16bit Unicode],[16bit Bytes], ...
936
- * @param numChars
937
- */
938
- qrcode.createStringToBytes = function(unicodeData, numChars) {
 
 
 
 
 
 
 
939
 
940
- // create conversion map.
941
 
942
- var unicodeMap = function() {
943
 
944
- var bin = base64DecodeInputStream(unicodeData);
945
- var read = function() {
946
- var b = bin.read();
947
- if (b == -1) throw new Error();
948
- return b;
949
- };
950
 
951
- var count = 0;
952
- var unicodeMap = {};
953
- while (true) {
954
- var b0 = bin.read();
955
- if (b0 == -1) break;
956
- var b1 = read();
957
- var b2 = read();
958
- var b3 = read();
959
- var k = String.fromCharCode( (b0 << 8) | b1);
960
- var v = (b2 << 8) | b3;
961
- unicodeMap[k] = v;
962
- count += 1;
963
- }
964
- if (count != numChars) {
965
- throw new Error(count + ' != ' + numChars);
966
- }
967
 
968
- return unicodeMap;
969
- }();
970
 
971
- var unknownChar = '?'.charCodeAt(0);
 
 
972
 
973
- return function(s) {
974
- var bytes = new Array();
975
- for (var i = 0; i < s.length; i += 1) {
976
- var c = s.charCodeAt(i);
977
- if (c < 128) {
978
- bytes.push(c);
979
- } else {
980
- var b = unicodeMap[s.charAt(i)];
981
- if (typeof b == 'number') {
982
- if ( (b & 0xff) == b) {
983
- // 1byte
984
- bytes.push(b);
985
- } else {
986
- // 2bytes
987
- bytes.push(b >>> 8);
988
- bytes.push(b & 0xff);
989
- }
990
- } else {
991
- bytes.push(unknownChar);
992
- }
993
- }
994
- }
995
- return bytes;
996
- };
997
- };
998
 
999
- //---------------------------------------------------------------------
1000
- // QRMode
1001
- //---------------------------------------------------------------------
1002
 
1003
- var QRMode = {
1004
- MODE_NUMBER : 1 << 0,
1005
- MODE_ALPHA_NUM : 1 << 1,
1006
- MODE_8BIT_BYTE : 1 << 2,
1007
- MODE_KANJI : 1 << 3
1008
- };
1009
 
1010
- //---------------------------------------------------------------------
1011
- // QRErrorCorrectLevel
1012
- //---------------------------------------------------------------------
1013
 
1014
- var QRErrorCorrectLevel = {
1015
- L : 1,
1016
- M : 0,
1017
- Q : 3,
1018
- H : 2
1019
- };
1020
 
1021
- //---------------------------------------------------------------------
1022
- // QRMaskPattern
1023
- //---------------------------------------------------------------------
1024
-
1025
- var QRMaskPattern = {
1026
- PATTERN000 : 0,
1027
- PATTERN001 : 1,
1028
- PATTERN010 : 2,
1029
- PATTERN011 : 3,
1030
- PATTERN100 : 4,
1031
- PATTERN101 : 5,
1032
- PATTERN110 : 6,
1033
- PATTERN111 : 7
1034
- };
1035
 
1036
- //---------------------------------------------------------------------
1037
- // QRUtil
1038
- //---------------------------------------------------------------------
1039
-
1040
- var QRUtil = function() {
1041
-
1042
- var PATTERN_POSITION_TABLE = [
1043
- [],
1044
- [6, 18],
1045
- [6, 22],
1046
- [6, 26],
1047
- [6, 30],
1048
- [6, 34],
1049
- [6, 22, 38],
1050
- [6, 24, 42],
1051
- [6, 26, 46],
1052
- [6, 28, 50],
1053
- [6, 30, 54],
1054
- [6, 32, 58],
1055
- [6, 34, 62],
1056
- [6, 26, 46, 66],
1057
- [6, 26, 48, 70],
1058
- [6, 26, 50, 74],
1059
- [6, 30, 54, 78],
1060
- [6, 30, 56, 82],
1061
- [6, 30, 58, 86],
1062
- [6, 34, 62, 90],
1063
- [6, 28, 50, 72, 94],
1064
- [6, 26, 50, 74, 98],
1065
- [6, 30, 54, 78, 102],
1066
- [6, 28, 54, 80, 106],
1067
- [6, 32, 58, 84, 110],
1068
- [6, 30, 58, 86, 114],
1069
- [6, 34, 62, 90, 118],
1070
- [6, 26, 50, 74, 98, 122],
1071
- [6, 30, 54, 78, 102, 126],
1072
- [6, 26, 52, 78, 104, 130],
1073
- [6, 30, 56, 82, 108, 134],
1074
- [6, 34, 60, 86, 112, 138],
1075
- [6, 30, 58, 86, 114, 142],
1076
- [6, 34, 62, 90, 118, 146],
1077
- [6, 30, 54, 78, 102, 126, 150],
1078
- [6, 24, 50, 76, 102, 128, 154],
1079
- [6, 28, 54, 80, 106, 132, 158],
1080
- [6, 32, 58, 84, 110, 136, 162],
1081
- [6, 26, 54, 82, 110, 138, 166],
1082
- [6, 30, 58, 86, 114, 142, 170]
1083
- ];
1084
- var G15 = (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0);
1085
- var G18 = (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0);
1086
- var G15_MASK = (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1);
1087
-
1088
- var _this = {};
1089
-
1090
- var getBCHDigit = function(data) {
1091
- var digit = 0;
1092
- while (data != 0) {
1093
- digit += 1;
1094
- data >>>= 1;
1095
- }
1096
- return digit;
1097
- };
1098
 
1099
- _this.getBCHTypeInfo = function(data) {
1100
- var d = data << 10;
1101
- while (getBCHDigit(d) - getBCHDigit(G15) >= 0) {
1102
- d ^= (G15 << (getBCHDigit(d) - getBCHDigit(G15) ) );
1103
- }
1104
- return ( (data << 10) | d) ^ G15_MASK;
1105
- };
1106
 
1107
- _this.getBCHTypeNumber = function(data) {
1108
- var d = data << 12;
1109
- while (getBCHDigit(d) - getBCHDigit(G18) >= 0) {
1110
- d ^= (G18 << (getBCHDigit(d) - getBCHDigit(G18) ) );
1111
- }
1112
- return (data << 12) | d;
1113
- };
1114
-
1115
- _this.getPatternPosition = function(typeNumber) {
1116
- return PATTERN_POSITION_TABLE[typeNumber - 1];
1117
- };
1118
-
1119
- _this.getMaskFunction = function(maskPattern) {
1120
-
1121
- switch (maskPattern) {
1122
-
1123
- case QRMaskPattern.PATTERN000 :
1124
- return function(i, j) { return (i + j) % 2 == 0; };
1125
- case QRMaskPattern.PATTERN001 :
1126
- return function(i, j) { return i % 2 == 0; };
1127
- case QRMaskPattern.PATTERN010 :
1128
- return function(i, j) { return j % 3 == 0; };
1129
- case QRMaskPattern.PATTERN011 :
1130
- return function(i, j) { return (i + j) % 3 == 0; };
1131
- case QRMaskPattern.PATTERN100 :
1132
- return function(i, j) { return (Math.floor(i / 2) + Math.floor(j / 3) ) % 2 == 0; };
1133
- case QRMaskPattern.PATTERN101 :
1134
- return function(i, j) { return (i * j) % 2 + (i * j) % 3 == 0; };
1135
- case QRMaskPattern.PATTERN110 :
1136
- return function(i, j) { return ( (i * j) % 2 + (i * j) % 3) % 2 == 0; };
1137
- case QRMaskPattern.PATTERN111 :
1138
- return function(i, j) { return ( (i * j) % 3 + (i + j) % 2) % 2 == 0; };
1139
-
1140
- default :
1141
- throw new Error('bad maskPattern:' + maskPattern);
1142
- }
1143
- };
1144
 
1145
- _this.getErrorCorrectPolynomial = function(errorCorrectLength) {
1146
- var a = qrPolynomial([1], 0);
1147
- for (var i = 0; i < errorCorrectLength; i += 1) {
1148
- a = a.multiply(qrPolynomial([1, QRMath.gexp(i)], 0) );
1149
- }
1150
- return a;
1151
- };
1152
 
1153
- _this.getLengthInBits = function(mode, type) {
1154
 
1155
- if (1 <= type && type < 10) {
1156
 
1157
- // 1 - 9
 
 
 
 
1158
 
1159
- switch(mode) {
1160
- case QRMode.MODE_NUMBER : return 10;
1161
- case QRMode.MODE_ALPHA_NUM : return 9;
1162
- case QRMode.MODE_8BIT_BYTE : return 8;
1163
- case QRMode.MODE_KANJI : return 8;
1164
- default :
1165
- throw new Error('mode:' + mode);
1166
- }
1167
 
1168
- } else if (type < 27) {
1169
 
1170
- // 10 - 26
 
 
1171
 
1172
- switch(mode) {
1173
- case QRMode.MODE_NUMBER : return 12;
1174
- case QRMode.MODE_ALPHA_NUM : return 11;
1175
- case QRMode.MODE_8BIT_BYTE : return 16;
1176
- case QRMode.MODE_KANJI : return 10;
1177
- default :
1178
- throw new Error('mode:' + mode);
1179
- }
1180
 
1181
- } else if (type < 41) {
 
 
 
1182
 
1183
- // 27 - 40
 
 
1184
 
1185
- switch(mode) {
1186
- case QRMode.MODE_NUMBER : return 14;
1187
- case QRMode.MODE_ALPHA_NUM : return 13;
1188
- case QRMode.MODE_8BIT_BYTE : return 16;
1189
- case QRMode.MODE_KANJI : return 12;
1190
- default :
1191
- throw new Error('mode:' + mode);
1192
- }
1193
 
1194
- } else {
1195
- throw new Error('type:' + type);
1196
- }
1197
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1198
 
1199
- _this.getLostPoint = function(qrcode) {
1200
 
1201
- var moduleCount = qrcode.getModuleCount();
1202
 
1203
- var lostPoint = 0;
 
 
 
 
 
 
 
 
 
 
 
 
1204
 
1205
- // LEVEL1
1206
 
1207
- for (var row = 0; row < moduleCount; row += 1) {
1208
- for (var col = 0; col < moduleCount; col += 1) {
1209
 
1210
- var sameCount = 0;
1211
- var dark = qrcode.isDark(row, col);
 
 
1212
 
1213
- for (var r = -1; r <= 1; r += 1) {
1214
 
1215
- if (row + r < 0 || moduleCount <= row + r) {
1216
- continue;
1217
- }
1218
 
1219
- for (var c = -1; c <= 1; c += 1) {
1220
 
1221
- if (col + c < 0 || moduleCount <= col + c) {
1222
- continue;
1223
- }
1224
 
1225
- if (r == 0 && c == 0) {
1226
- continue;
1227
- }
 
1228
 
1229
- if (dark == qrcode.isDark(row + r, col + c) ) {
1230
- sameCount += 1;
1231
- }
1232
- }
1233
- }
1234
 
1235
- if (sameCount > 5) {
1236
- lostPoint += (3 + sameCount - 5);
1237
- }
1238
- }
1239
- };
1240
-
1241
- // LEVEL2
1242
-
1243
- for (var row = 0; row < moduleCount - 1; row += 1) {
1244
- for (var col = 0; col < moduleCount - 1; col += 1) {
1245
- var count = 0;
1246
- if (qrcode.isDark(row, col) ) count += 1;
1247
- if (qrcode.isDark(row + 1, col) ) count += 1;
1248
- if (qrcode.isDark(row, col + 1) ) count += 1;
1249
- if (qrcode.isDark(row + 1, col + 1) ) count += 1;
1250
- if (count == 0 || count == 4) {
1251
- lostPoint += 3;
1252
- }
1253
- }
1254
- }
1255
 
1256
- // LEVEL3
1257
-
1258
- for (var row = 0; row < moduleCount; row += 1) {
1259
- for (var col = 0; col < moduleCount - 6; col += 1) {
1260
- if (qrcode.isDark(row, col)
1261
- && !qrcode.isDark(row, col + 1)
1262
- && qrcode.isDark(row, col + 2)
1263
- && qrcode.isDark(row, col + 3)
1264
- && qrcode.isDark(row, col + 4)
1265
- && !qrcode.isDark(row, col + 5)
1266
- && qrcode.isDark(row, col + 6) ) {
1267
- lostPoint += 40;
1268
- }
1269
- }
1270
- }
1271
 
1272
- for (var col = 0; col < moduleCount; col += 1) {
1273
- for (var row = 0; row < moduleCount - 6; row += 1) {
1274
- if (qrcode.isDark(row, col)
1275
- && !qrcode.isDark(row + 1, col)
1276
- && qrcode.isDark(row + 2, col)
1277
- && qrcode.isDark(row + 3, col)
1278
- && qrcode.isDark(row + 4, col)
1279
- && !qrcode.isDark(row + 5, col)
1280
- && qrcode.isDark(row + 6, col) ) {
1281
- lostPoint += 40;
1282
- }
1283
- }
1284
- }
1285
 
1286
- // LEVEL4
 
1287
 
1288
- var darkCount = 0;
1289
 
1290
- for (var col = 0; col < moduleCount; col += 1) {
1291
- for (var row = 0; row < moduleCount; row += 1) {
1292
- if (qrcode.isDark(row, col) ) {
1293
- darkCount += 1;
1294
- }
1295
- }
1296
- }
1297
 
1298
- var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
1299
- lostPoint += ratio * 10;
 
 
1300
 
1301
- return lostPoint;
1302
- };
 
 
 
1303
 
1304
- return _this;
1305
- }();
 
1306
 
1307
- //---------------------------------------------------------------------
1308
- // QRMath
1309
- //---------------------------------------------------------------------
1310
 
1311
- var QRMath = function() {
 
 
 
1312
 
1313
- var EXP_TABLE = new Array(256);
1314
- var LOG_TABLE = new Array(256);
 
1315
 
1316
- // initialize tables
1317
- for (var i = 0; i < 8; i += 1) {
1318
- EXP_TABLE[i] = 1 << i;
1319
- }
1320
- for (var i = 8; i < 256; i += 1) {
1321
- EXP_TABLE[i] = EXP_TABLE[i - 4]
1322
- ^ EXP_TABLE[i - 5]
1323
- ^ EXP_TABLE[i - 6]
1324
- ^ EXP_TABLE[i - 8];
1325
- }
1326
- for (var i = 0; i < 255; i += 1) {
1327
- LOG_TABLE[EXP_TABLE[i] ] = i;
1328
- }
1329
 
1330
- var _this = {};
 
1331
 
1332
- _this.glog = function(n) {
 
 
1333
 
1334
- if (n < 1) {
1335
- throw new Error('glog(' + n + ')');
1336
- }
1337
 
1338
- return LOG_TABLE[n];
1339
- };
1340
 
1341
- _this.gexp = function(n) {
1342
 
1343
- while (n < 0) {
1344
- n += 255;
1345
- }
1346
 
1347
- while (n >= 256) {
1348
- n -= 255;
1349
- }
1350
 
1351
- return EXP_TABLE[n];
1352
- };
1353
 
1354
- return _this;
1355
- }();
1356
 
1357
- //---------------------------------------------------------------------
1358
- // qrPolynomial
1359
- //---------------------------------------------------------------------
1360
 
1361
- function qrPolynomial(num, shift) {
 
 
 
1362
 
1363
- if (typeof num.length == 'undefined') {
1364
- throw new Error(num.length + '/' + shift);
 
 
 
1365
  }
 
 
1366
 
1367
- var _num = function() {
1368
- var offset = 0;
1369
- while (offset < num.length && num[offset] == 0) {
1370
- offset += 1;
1371
- }
1372
- var _num = new Array(num.length - offset + shift);
1373
- for (var i = 0; i < num.length - offset; i += 1) {
1374
- _num[i] = num[i + offset];
1375
- }
1376
- return _num;
1377
- }();
1378
-
1379
- var _this = {};
1380
 
1381
- _this.getAt = function(index) {
1382
- return _num[index];
1383
- };
 
 
 
1384
 
1385
- _this.getLength = function() {
1386
- return _num.length;
1387
- };
1388
 
1389
- _this.multiply = function(e) {
 
 
1390
 
1391
- var num = new Array(_this.getLength() + e.getLength() - 1);
1392
 
1393
- for (var i = 0; i < _this.getLength(); i += 1) {
1394
- for (var j = 0; j < e.getLength(); j += 1) {
1395
- num[i + j] ^= QRMath.gexp(QRMath.glog(_this.getAt(i) ) + QRMath.glog(e.getAt(j) ) );
1396
- }
1397
- }
1398
 
1399
- return qrPolynomial(num, 0);
1400
- };
1401
 
1402
- _this.mod = function(e) {
 
 
1403
 
1404
- if (_this.getLength() - e.getLength() < 0) {
1405
- return _this;
1406
- }
1407
 
1408
- var ratio = QRMath.glog(_this.getAt(0) ) - QRMath.glog(e.getAt(0) );
1409
 
1410
- var num = new Array(_this.getLength() );
1411
- for (var i = 0; i < _this.getLength(); i += 1) {
1412
- num[i] = _this.getAt(i);
1413
- }
1414
 
1415
- for (var i = 0; i < e.getLength(); i += 1) {
1416
- num[i] ^= QRMath.gexp(QRMath.glog(e.getAt(i) ) + ratio);
1417
- }
1418
 
1419
- // recursive call
1420
- return qrPolynomial(num, 0).mod(e);
1421
- };
 
 
 
1422
 
1423
- return _this;
1424
- };
 
 
1425
 
1426
- //---------------------------------------------------------------------
1427
- // QRRSBlock
1428
- //---------------------------------------------------------------------
1429
-
1430
- var QRRSBlock = function() {
1431
-
1432
- var RS_BLOCK_TABLE = [
1433
-
1434
- // L
1435
- // M
1436
- // Q
1437
- // H
1438
-
1439
- // 1
1440
- [1, 26, 19],
1441
- [1, 26, 16],
1442
- [1, 26, 13],
1443
- [1, 26, 9],
1444
-
1445
- // 2
1446
- [1, 44, 34],
1447
- [1, 44, 28],
1448
- [1, 44, 22],
1449
- [1, 44, 16],
1450
-
1451
- // 3
1452
- [1, 70, 55],
1453
- [1, 70, 44],
1454
- [2, 35, 17],
1455
- [2, 35, 13],
1456
-
1457
- // 4
1458
- [1, 100, 80],
1459
- [2, 50, 32],
1460
- [2, 50, 24],
1461
- [4, 25, 9],
1462
-
1463
- // 5
1464
- [1, 134, 108],
1465
- [2, 67, 43],
1466
- [2, 33, 15, 2, 34, 16],
1467
- [2, 33, 11, 2, 34, 12],
1468
-
1469
- // 6
1470
- [2, 86, 68],
1471
- [4, 43, 27],
1472
- [4, 43, 19],
1473
- [4, 43, 15],
1474
-
1475
- // 7
1476
- [2, 98, 78],
1477
- [4, 49, 31],
1478
- [2, 32, 14, 4, 33, 15],
1479
- [4, 39, 13, 1, 40, 14],
1480
-
1481
- // 8
1482
- [2, 121, 97],
1483
- [2, 60, 38, 2, 61, 39],
1484
- [4, 40, 18, 2, 41, 19],
1485
- [4, 40, 14, 2, 41, 15],
1486
-
1487
- // 9
1488
- [2, 146, 116],
1489
- [3, 58, 36, 2, 59, 37],
1490
- [4, 36, 16, 4, 37, 17],
1491
- [4, 36, 12, 4, 37, 13],
1492
-
1493
- // 10
1494
- [2, 86, 68, 2, 87, 69],
1495
- [4, 69, 43, 1, 70, 44],
1496
- [6, 43, 19, 2, 44, 20],
1497
- [6, 43, 15, 2, 44, 16],
1498
-
1499
- // 11
1500
- [4, 101, 81],
1501
- [1, 80, 50, 4, 81, 51],
1502
- [4, 50, 22, 4, 51, 23],
1503
- [3, 36, 12, 8, 37, 13],
1504
-
1505
- // 12
1506
- [2, 116, 92, 2, 117, 93],
1507
- [6, 58, 36, 2, 59, 37],
1508
- [4, 46, 20, 6, 47, 21],
1509
- [7, 42, 14, 4, 43, 15],
1510
-
1511
- // 13
1512
- [4, 133, 107],
1513
- [8, 59, 37, 1, 60, 38],
1514
- [8, 44, 20, 4, 45, 21],
1515
- [12, 33, 11, 4, 34, 12],
1516
-
1517
- // 14
1518
- [3, 145, 115, 1, 146, 116],
1519
- [4, 64, 40, 5, 65, 41],
1520
- [11, 36, 16, 5, 37, 17],
1521
- [11, 36, 12, 5, 37, 13],
1522
-
1523
- // 15
1524
- [5, 109, 87, 1, 110, 88],
1525
- [5, 65, 41, 5, 66, 42],
1526
- [5, 54, 24, 7, 55, 25],
1527
- [11, 36, 12, 7, 37, 13],
1528
-
1529
- // 16
1530
- [5, 122, 98, 1, 123, 99],
1531
- [7, 73, 45, 3, 74, 46],
1532
- [15, 43, 19, 2, 44, 20],
1533
- [3, 45, 15, 13, 46, 16],
1534
-
1535
- // 17
1536
- [1, 135, 107, 5, 136, 108],
1537
- [10, 74, 46, 1, 75, 47],
1538
- [1, 50, 22, 15, 51, 23],
1539
- [2, 42, 14, 17, 43, 15],
1540
-
1541
- // 18
1542
- [5, 150, 120, 1, 151, 121],
1543
- [9, 69, 43, 4, 70, 44],
1544
- [17, 50, 22, 1, 51, 23],
1545
- [2, 42, 14, 19, 43, 15],
1546
-
1547
- // 19
1548
- [3, 141, 113, 4, 142, 114],
1549
- [3, 70, 44, 11, 71, 45],
1550
- [17, 47, 21, 4, 48, 22],
1551
- [9, 39, 13, 16, 40, 14],
1552
-
1553
- // 20
1554
- [3, 135, 107, 5, 136, 108],
1555
- [3, 67, 41, 13, 68, 42],
1556
- [15, 54, 24, 5, 55, 25],
1557
- [15, 43, 15, 10, 44, 16],
1558
-
1559
- // 21
1560
- [4, 144, 116, 4, 145, 117],
1561
- [17, 68, 42],
1562
- [17, 50, 22, 6, 51, 23],
1563
- [19, 46, 16, 6, 47, 17],
1564
-
1565
- // 22
1566
- [2, 139, 111, 7, 140, 112],
1567
- [17, 74, 46],
1568
- [7, 54, 24, 16, 55, 25],
1569
- [34, 37, 13],
1570
-
1571
- // 23
1572
- [4, 151, 121, 5, 152, 122],
1573
- [4, 75, 47, 14, 76, 48],
1574
- [11, 54, 24, 14, 55, 25],
1575
- [16, 45, 15, 14, 46, 16],
1576
-
1577
- // 24
1578
- [6, 147, 117, 4, 148, 118],
1579
- [6, 73, 45, 14, 74, 46],
1580
- [11, 54, 24, 16, 55, 25],
1581
- [30, 46, 16, 2, 47, 17],
1582
-
1583
- // 25
1584
- [8, 132, 106, 4, 133, 107],
1585
- [8, 75, 47, 13, 76, 48],
1586
- [7, 54, 24, 22, 55, 25],
1587
- [22, 45, 15, 13, 46, 16],
1588
-
1589
- // 26
1590
- [10, 142, 114, 2, 143, 115],
1591
- [19, 74, 46, 4, 75, 47],
1592
- [28, 50, 22, 6, 51, 23],
1593
- [33, 46, 16, 4, 47, 17],
1594
-
1595
- // 27
1596
- [8, 152, 122, 4, 153, 123],
1597
- [22, 73, 45, 3, 74, 46],
1598
- [8, 53, 23, 26, 54, 24],
1599
- [12, 45, 15, 28, 46, 16],
1600
-
1601
- // 28
1602
- [3, 147, 117, 10, 148, 118],
1603
- [3, 73, 45, 23, 74, 46],
1604
- [4, 54, 24, 31, 55, 25],
1605
- [11, 45, 15, 31, 46, 16],
1606
-
1607
- // 29
1608
- [7, 146, 116, 7, 147, 117],
1609
- [21, 73, 45, 7, 74, 46],
1610
- [1, 53, 23, 37, 54, 24],
1611
- [19, 45, 15, 26, 46, 16],
1612
-
1613
- // 30
1614
- [5, 145, 115, 10, 146, 116],
1615
- [19, 75, 47, 10, 76, 48],
1616
- [15, 54, 24, 25, 55, 25],
1617
- [23, 45, 15, 25, 46, 16],
1618
-
1619
- // 31
1620
- [13, 145, 115, 3, 146, 116],
1621
- [2, 74, 46, 29, 75, 47],
1622
- [42, 54, 24, 1, 55, 25],
1623
- [23, 45, 15, 28, 46, 16],
1624
-
1625
- // 32
1626
- [17, 145, 115],
1627
- [10, 74, 46, 23, 75, 47],
1628
- [10, 54, 24, 35, 55, 25],
1629
- [19, 45, 15, 35, 46, 16],
1630
-
1631
- // 33
1632
- [17, 145, 115, 1, 146, 116],
1633
- [14, 74, 46, 21, 75, 47],
1634
- [29, 54, 24, 19, 55, 25],
1635
- [11, 45, 15, 46, 46, 16],
1636
-
1637
- // 34
1638
- [13, 145, 115, 6, 146, 116],
1639
- [14, 74, 46, 23, 75, 47],
1640
- [44, 54, 24, 7, 55, 25],
1641
- [59, 46, 16, 1, 47, 17],
1642
-
1643
- // 35
1644
- [12, 151, 121, 7, 152, 122],
1645
- [12, 75, 47, 26, 76, 48],
1646
- [39, 54, 24, 14, 55, 25],
1647
- [22, 45, 15, 41, 46, 16],
1648
-
1649
- // 36
1650
- [6, 151, 121, 14, 152, 122],
1651
- [6, 75, 47, 34, 76, 48],
1652
- [46, 54, 24, 10, 55, 25],
1653
- [2, 45, 15, 64, 46, 16],
1654
-
1655
- // 37
1656
- [17, 152, 122, 4, 153, 123],
1657
- [29, 74, 46, 14, 75, 47],
1658
- [49, 54, 24, 10, 55, 25],
1659
- [24, 45, 15, 46, 46, 16],
1660
-
1661
- // 38
1662
- [4, 152, 122, 18, 153, 123],
1663
- [13, 74, 46, 32, 75, 47],
1664
- [48, 54, 24, 14, 55, 25],
1665
- [42, 45, 15, 32, 46, 16],
1666
-
1667
- // 39
1668
- [20, 147, 117, 4, 148, 118],
1669
- [40, 75, 47, 7, 76, 48],
1670
- [43, 54, 24, 22, 55, 25],
1671
- [10, 45, 15, 67, 46, 16],
1672
-
1673
- // 40
1674
- [19, 148, 118, 6, 149, 119],
1675
- [18, 75, 47, 31, 76, 48],
1676
- [34, 54, 24, 34, 55, 25],
1677
- [20, 45, 15, 61, 46, 16]
1678
- ];
1679
-
1680
- var qrRSBlock = function(totalCount, dataCount) {
1681
- var _this = {};
1682
- _this.totalCount = totalCount;
1683
- _this.dataCount = dataCount;
1684
- return _this;
1685
- };
1686
-
1687
- var _this = {};
1688
-
1689
- var getRsBlockTable = function(typeNumber, errorCorrectLevel) {
1690
-
1691
- switch(errorCorrectLevel) {
1692
- case QRErrorCorrectLevel.L :
1693
- return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];
1694
- case QRErrorCorrectLevel.M :
1695
- return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
1696
- case QRErrorCorrectLevel.Q :
1697
- return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
1698
- case QRErrorCorrectLevel.H :
1699
- return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
1700
- default :
1701
- return undefined;
1702
- }
1703
- };
1704
 
1705
- _this.getRSBlocks = function(typeNumber, errorCorrectLevel) {
 
1706
 
1707
- var rsBlock = getRsBlockTable(typeNumber, errorCorrectLevel);
 
 
1708
 
1709
- if (typeof rsBlock == 'undefined') {
1710
- throw new Error('bad rs block @ typeNumber:' + typeNumber +
1711
- '/errorCorrectLevel:' + errorCorrectLevel);
1712
- }
1713
 
1714
- var length = rsBlock.length / 3;
 
 
1715
 
1716
- var list = new Array();
1717
 
1718
- for (var i = 0; i < length; i += 1) {
 
 
1719
 
1720
- var count = rsBlock[i * 3 + 0];
1721
- var totalCount = rsBlock[i * 3 + 1];
1722
- var dataCount = rsBlock[i * 3 + 2];
1723
 
1724
- for (var j = 0; j < count; j += 1) {
1725
- list.push(qrRSBlock(totalCount, dataCount) );
1726
- }
1727
- }
 
1728
 
1729
- return list;
1730
- };
1731
 
1732
- return _this;
1733
- }();
 
1734
 
1735
- //---------------------------------------------------------------------
1736
- // qrBitBuffer
1737
- //---------------------------------------------------------------------
1738
 
1739
- var qrBitBuffer = function() {
 
1740
 
1741
- var _buffer = new Array();
1742
- var _length = 0;
 
 
 
 
 
 
 
 
 
1743
 
1744
- var _this = {};
1745
 
1746
- _this.getBuffer = function() {
1747
- return _buffer;
1748
- };
1749
 
1750
- _this.getAt = function(index) {
1751
- var bufIndex = Math.floor(index / 8);
1752
- return ( (_buffer[bufIndex] >>> (7 - index % 8) ) & 1) == 1;
1753
- };
1754
 
1755
- _this.put = function(num, length) {
1756
- for (var i = 0; i < length; i += 1) {
1757
- _this.putBit( ( (num >>> (length - i - 1) ) & 1) == 1);
1758
- }
1759
- };
1760
 
1761
- _this.getLengthInBits = function() {
1762
- return _length;
1763
- };
1764
 
1765
- _this.putBit = function(bit) {
1766
 
1767
- var bufIndex = Math.floor(_length / 8);
1768
- if (_buffer.length <= bufIndex) {
1769
- _buffer.push(0);
1770
- }
1771
 
1772
- if (bit) {
1773
- _buffer[bufIndex] |= (0x80 >>> (_length % 8) );
1774
- }
1775
 
1776
- _length += 1;
1777
- };
1778
 
1779
- return _this;
1780
- };
 
 
 
 
 
1781
 
1782
- //---------------------------------------------------------------------
1783
- // qr8BitByte
1784
- //---------------------------------------------------------------------
1785
 
1786
- var qr8BitByte = function(data) {
1787
 
1788
- var _mode = QRMode.MODE_8BIT_BYTE;
1789
- var _data = data;
1790
- var _bytes = qrcode.stringToBytes(data);
1791
 
1792
- var _this = {};
 
 
 
1793
 
1794
- _this.getMode = function() {
1795
- return _mode;
1796
- };
1797
 
1798
- _this.getLength = function(buffer) {
1799
- return _bytes.length;
1800
- };
1801
 
1802
- _this.write = function(buffer) {
1803
- for (var i = 0; i < _bytes.length; i += 1) {
1804
- buffer.put(_bytes[i], 8);
1805
- }
1806
- };
1807
 
1808
- return _this;
1809
- };
1810
 
1811
- //=====================================================================
1812
- // GIF Support etc.
1813
- //
1814
 
1815
- //---------------------------------------------------------------------
1816
- // byteArrayOutputStream
1817
- //---------------------------------------------------------------------
1818
 
1819
- var byteArrayOutputStream = function() {
 
 
1820
 
1821
- var _bytes = new Array();
 
 
 
1822
 
1823
- var _this = {};
 
 
 
 
 
 
1824
 
1825
- _this.writeByte = function(b) {
1826
- _bytes.push(b & 0xff);
1827
- };
 
 
1828
 
1829
- _this.writeShort = function(i) {
1830
- _this.writeByte(i);
1831
- _this.writeByte(i >>> 8);
1832
- };
1833
 
1834
- _this.writeBytes = function(b, off, len) {
1835
- off = off || 0;
1836
- len = len || b.length;
1837
- for (var i = 0; i < len; i += 1) {
1838
- _this.writeByte(b[i + off]);
1839
- }
1840
- };
 
 
 
 
 
1841
 
1842
- _this.writeString = function(s) {
1843
- for (var i = 0; i < s.length; i += 1) {
1844
- _this.writeByte(s.charCodeAt(i) );
1845
- }
1846
- };
1847
-
1848
- _this.toByteArray = function() {
1849
- return _bytes;
1850
- };
1851
-
1852
- _this.toString = function() {
1853
- var s = '';
1854
- s += '[';
1855
- for (var i = 0; i < _bytes.length; i += 1) {
1856
- if (i > 0) {
1857
- s += ',';
1858
- }
1859
- s += _bytes[i];
1860
- }
1861
- s += ']';
1862
- return s;
1863
- };
1864
 
1865
- return _this;
1866
- };
 
1867
 
1868
- //---------------------------------------------------------------------
1869
- // base64EncodeOutputStream
1870
- //---------------------------------------------------------------------
1871
-
1872
- var base64EncodeOutputStream = function() {
1873
-
1874
- var _buffer = 0;
1875
- var _buflen = 0;
1876
- var _length = 0;
1877
- var _base64 = '';
1878
-
1879
- var _this = {};
1880
-
1881
- var writeEncoded = function(b) {
1882
- _base64 += String.fromCharCode(encode(b & 0x3f) );
1883
- };
1884
-
1885
- var encode = function(n) {
1886
- if (n < 0) {
1887
- // error.
1888
- } else if (n < 26) {
1889
- return 0x41 + n;
1890
- } else if (n < 52) {
1891
- return 0x61 + (n - 26);
1892
- } else if (n < 62) {
1893
- return 0x30 + (n - 52);
1894
- } else if (n == 62) {
1895
- return 0x2b;
1896
- } else if (n == 63) {
1897
- return 0x2f;
1898
- }
1899
- throw new Error('n:' + n);
1900
- };
1901
 
1902
- _this.writeByte = function(n) {
 
 
 
1903
 
1904
- _buffer = (_buffer << 8) | (n & 0xff);
1905
- _buflen += 8;
1906
- _length += 1;
1907
 
1908
- while (_buflen >= 6) {
1909
- writeEncoded(_buffer >>> (_buflen - 6) );
1910
- _buflen -= 6;
1911
- }
1912
- };
1913
 
1914
- _this.flush = function() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1915
 
1916
- if (_buflen > 0) {
1917
- writeEncoded(_buffer << (6 - _buflen) );
1918
- _buffer = 0;
1919
- _buflen = 0;
1920
- }
1921
 
1922
- if (_length % 3 != 0) {
1923
- // padding
1924
- var padlen = 3 - _length % 3;
1925
- for (var i = 0; i < padlen; i += 1) {
1926
- _base64 += '=';
1927
- }
1928
- }
1929
- };
1930
 
1931
- _this.toString = function() {
1932
- return _base64;
1933
- };
 
 
1934
 
1935
- return _this;
1936
- };
1937
 
1938
- //---------------------------------------------------------------------
1939
- // base64DecodeInputStream
1940
- //---------------------------------------------------------------------
 
 
1941
 
1942
- var base64DecodeInputStream = function(str) {
 
 
 
 
 
 
 
1943
 
1944
- var _str = str;
1945
- var _pos = 0;
1946
- var _buffer = 0;
1947
- var _buflen = 0;
1948
 
1949
- var _this = {};
 
1950
 
1951
- _this.read = function() {
 
 
1952
 
1953
- while (_buflen < 8) {
1954
 
1955
- if (_pos >= _str.length) {
1956
- if (_buflen == 0) {
1957
- return -1;
1958
- }
1959
- throw new Error('unexpected end of file./' + _buflen);
1960
- }
1961
 
1962
- var c = _str.charAt(_pos);
1963
- _pos += 1;
1964
 
1965
- if (c == '=') {
1966
- _buflen = 0;
1967
- return -1;
1968
- } else if (c.match(/^\s$/) ) {
1969
- // ignore if whitespace.
1970
- continue;
1971
- }
1972
 
1973
- _buffer = (_buffer << 6) | decode(c.charCodeAt(0) );
1974
- _buflen += 6;
1975
- }
1976
 
1977
- var n = (_buffer >>> (_buflen - 8) ) & 0xff;
1978
- _buflen -= 8;
1979
- return n;
1980
- };
1981
-
1982
- var decode = function(c) {
1983
- if (0x41 <= c && c <= 0x5a) {
1984
- return c - 0x41;
1985
- } else if (0x61 <= c && c <= 0x7a) {
1986
- return c - 0x61 + 26;
1987
- } else if (0x30 <= c && c <= 0x39) {
1988
- return c - 0x30 + 52;
1989
- } else if (c == 0x2b) {
1990
- return 62;
1991
- } else if (c == 0x2f) {
1992
- return 63;
1993
- } else {
1994
- throw new Error('c:' + c);
1995
  }
1996
- };
 
1997
 
1998
- return _this;
1999
- };
2000
 
2001
- //---------------------------------------------------------------------
2002
- // gifImage (B/W)
2003
- //---------------------------------------------------------------------
 
 
 
 
2004
 
2005
- var gifImage = function(width, height) {
 
 
2006
 
2007
- var _width = width;
2008
- var _height = height;
2009
- var _data = new Array(width * height);
 
2010
 
2011
- var _this = {};
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2012
 
2013
- _this.setPixel = function(x, y, pixel) {
2014
- _data[y * _width + x] = pixel;
2015
- };
2016
 
2017
- _this.write = function(out) {
 
 
2018
 
2019
- //---------------------------------
2020
- // GIF Signature
2021
 
2022
- out.writeString('GIF87a');
 
 
2023
 
2024
- //---------------------------------
2025
- // Screen Descriptor
2026
 
2027
- out.writeShort(_width);
2028
- out.writeShort(_height);
 
2029
 
2030
- out.writeByte(0x80); // 2bit
2031
- out.writeByte(0);
2032
- out.writeByte(0);
2033
 
2034
- //---------------------------------
2035
- // Global Color Map
2036
 
2037
- // black
2038
- out.writeByte(0x00);
2039
- out.writeByte(0x00);
2040
- out.writeByte(0x00);
2041
 
2042
- // white
2043
- out.writeByte(0xff);
2044
- out.writeByte(0xff);
2045
- out.writeByte(0xff);
2046
 
2047
- //---------------------------------
2048
- // Image Descriptor
2049
 
2050
- out.writeString(',');
2051
- out.writeShort(0);
2052
- out.writeShort(0);
2053
- out.writeShort(_width);
2054
- out.writeShort(_height);
2055
- out.writeByte(0);
2056
 
2057
- //---------------------------------
2058
- // Local Color Map
2059
 
2060
- //---------------------------------
2061
- // Raster Data
 
 
2062
 
2063
- var lzwMinCodeSize = 2;
2064
- var raster = getLZWRaster(lzwMinCodeSize);
 
 
2065
 
2066
- out.writeByte(lzwMinCodeSize);
 
2067
 
2068
- var offset = 0;
 
 
 
 
 
2069
 
2070
- while (raster.length - offset > 255) {
2071
- out.writeByte(255);
2072
- out.writeBytes(raster, offset, 255);
2073
- offset += 255;
2074
- }
2075
 
2076
- out.writeByte(raster.length - offset);
2077
- out.writeBytes(raster, offset, raster.length - offset);
2078
- out.writeByte(0x00);
2079
 
2080
- //---------------------------------
2081
- // GIF Terminator
2082
- out.writeString(';');
2083
- };
2084
 
2085
- var bitOutputStream = function(out) {
2086
 
2087
- var _out = out;
2088
- var _bitLength = 0;
2089
- var _bitBuffer = 0;
2090
 
2091
- var _this = {};
 
 
 
 
2092
 
2093
- _this.write = function(data, length) {
 
 
2094
 
2095
- if ( (data >>> length) != 0) {
2096
- throw new Error('length over');
2097
- }
 
2098
 
2099
- while (_bitLength + length >= 8) {
2100
- _out.writeByte(0xff & ( (data << _bitLength) | _bitBuffer) );
2101
- length -= (8 - _bitLength);
2102
- data >>>= (8 - _bitLength);
2103
- _bitBuffer = 0;
2104
- _bitLength = 0;
2105
- }
2106
 
2107
- _bitBuffer = (data << _bitLength) | _bitBuffer;
2108
- _bitLength = _bitLength + length;
2109
- };
2110
 
2111
- _this.flush = function() {
2112
- if (_bitLength > 0) {
2113
- _out.writeByte(_bitBuffer);
2114
- }
2115
- };
2116
 
2117
- return _this;
2118
- };
2119
 
2120
- var getLZWRaster = function(lzwMinCodeSize) {
 
 
2121
 
2122
- var clearCode = 1 << lzwMinCodeSize;
2123
- var endCode = (1 << lzwMinCodeSize) + 1;
2124
- var bitLength = lzwMinCodeSize + 1;
 
 
 
 
2125
 
2126
- // Setup LZWTable
2127
- var table = lzwTable();
 
2128
 
2129
- for (var i = 0; i < clearCode; i += 1) {
2130
- table.add(String.fromCharCode(i) );
2131
- }
2132
- table.add(String.fromCharCode(clearCode) );
2133
- table.add(String.fromCharCode(endCode) );
2134
 
2135
- var byteOut = byteArrayOutputStream();
2136
- var bitOut = bitOutputStream(byteOut);
2137
 
2138
- // clear code
2139
- bitOut.write(clearCode, bitLength);
2140
 
2141
- var dataIndex = 0;
 
 
2142
 
2143
- var s = String.fromCharCode(_data[dataIndex]);
2144
- dataIndex += 1;
2145
 
2146
- while (dataIndex < _data.length) {
 
 
 
 
2147
 
2148
- var c = String.fromCharCode(_data[dataIndex]);
2149
- dataIndex += 1;
2150
 
2151
- if (table.contains(s + c) ) {
 
2152
 
2153
- s = s + c;
2154
 
2155
- } else {
 
2156
 
2157
- bitOut.write(table.indexOf(s), bitLength);
2158
 
2159
- if (table.size() < 0xfff) {
 
2160
 
2161
- if (table.size() == (1 << bitLength) ) {
2162
- bitLength += 1;
2163
- }
2164
 
2165
- table.add(s + c);
2166
- }
2167
 
2168
- s = c;
2169
- }
2170
- }
2171
 
2172
  bitOut.write(table.indexOf(s), bitLength);
2173
 
2174
- // end code
2175
- bitOut.write(endCode, bitLength);
2176
 
2177
- bitOut.flush();
 
 
2178
 
2179
- return byteOut.toByteArray();
2180
- };
2181
 
2182
- var lzwTable = function() {
 
 
2183
 
2184
- var _map = {};
2185
- var _size = 0;
2186
 
2187
- var _this = {};
 
2188
 
2189
- _this.add = function(key) {
2190
- if (_this.contains(key) ) {
2191
- throw new Error('dup key:' + key);
2192
- }
2193
- _map[key] = _size;
2194
- _size += 1;
2195
- };
2196
 
2197
- _this.size = function() {
2198
- return _size;
2199
- };
2200
 
2201
- _this.indexOf = function(key) {
2202
- return _map[key];
2203
- };
2204
 
2205
- _this.contains = function(key) {
2206
- return typeof _map[key] != 'undefined';
2207
- };
2208
 
2209
- return _this;
2210
- };
2211
 
2212
- return _this;
 
 
 
 
 
2213
  };
2214
 
2215
- var createImgTag = function(width, height, getPixel, alt) {
2216
-
2217
- var gif = gifImage(width, height);
2218
- for (var y = 0; y < height; y += 1) {
2219
- for (var x = 0; x < width; x += 1) {
2220
- gif.setPixel(x, y, getPixel(x, y) );
2221
- }
2222
- }
2223
 
2224
- var b = byteArrayOutputStream();
2225
- gif.write(b);
 
2226
 
2227
- var base64 = base64EncodeOutputStream();
2228
- var bytes = b.toByteArray();
2229
- for (var i = 0; i < bytes.length; i += 1) {
2230
- base64.writeByte(bytes[i]);
2231
- }
2232
- base64.flush();
2233
 
2234
- var img = '';
2235
- img += '<img';
2236
- img += '\u0020src="';
2237
- img += 'data:image/gif;base64,';
2238
- img += base64;
2239
- img += '"';
2240
- img += '\u0020width="';
2241
- img += width;
2242
- img += '"';
2243
- img += '\u0020height="';
2244
- img += height;
2245
- img += '"';
2246
- if (alt) {
2247
- img += '\u0020alt="';
2248
- img += alt;
2249
- img += '"';
2250
- }
2251
- img += '/>';
2252
 
2253
- return img;
2254
- };
2255
 
2256
- //---------------------------------------------------------------------
2257
- // returns qrcode function.
 
 
 
 
 
2258
 
2259
- return qrcode;
2260
- }();
2261
 
2262
- (function (factory) {
2263
- if (typeof define === 'function' && define.amd) {
2264
- define([], factory);
2265
- } else if (typeof exports === 'object') {
2266
- module.exports = factory();
2267
- }
2268
- }(function () {
2269
- return qrcode;
2270
- }));
2271
- //---------------------------------------------------------------------
2272
- //
2273
- // QR Code Generator for JavaScript UTF8 Support (optional)
2274
- //
2275
- // Copyright (c) 2011 Kazuhiko Arase
2276
- //
2277
- // URL: http://www.d-project.com/
2278
- //
2279
- // Licensed under the MIT license:
2280
- // http://www.opensource.org/licenses/mit-license.php
2281
- //
2282
- // The word 'QR Code' is registered trademark of
2283
- // DENSO WAVE INCORPORATED
2284
- // http://www.denso-wave.com/qrcode/faqpatent-e.html
2285
- //
2286
- //---------------------------------------------------------------------
2287
-
2288
- !function(qrcode) {
2289
-
2290
- //---------------------------------------------------------------------
2291
- // overwrite qrcode.stringToBytes
2292
- //---------------------------------------------------------------------
2293
-
2294
- qrcode.stringToBytes = function(s) {
2295
- // http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array
2296
- function toUTF8Array(str) {
2297
- var utf8 = [];
2298
- for (var i=0; i < str.length; i++) {
2299
- var charcode = str.charCodeAt(i);
2300
- if (charcode < 0x80) utf8.push(charcode);
2301
- else if (charcode < 0x800) {
2302
- utf8.push(0xc0 | (charcode >> 6),
2303
- 0x80 | (charcode & 0x3f));
2304
- }
2305
- else if (charcode < 0xd800 || charcode >= 0xe000) {
2306
- utf8.push(0xe0 | (charcode >> 12),
2307
- 0x80 | ((charcode>>6) & 0x3f),
2308
- 0x80 | (charcode & 0x3f));
2309
- }
2310
- // surrogate pair
2311
- else {
2312
- i++;
2313
- // UTF-16 encodes 0x10000-0x10FFFF by
2314
- // subtracting 0x10000 and splitting the
2315
- // 20 bits of 0x0-0xFFFFF into two halves
2316
- charcode = 0x10000 + (((charcode & 0x3ff)<<10)
2317
- | (str.charCodeAt(i) & 0x3ff));
2318
- utf8.push(0xf0 | (charcode >>18),
2319
- 0x80 | ((charcode>>12) & 0x3f),
2320
- 0x80 | ((charcode>>6) & 0x3f),
2321
- 0x80 | (charcode & 0x3f));
2322
- }
2323
- }
2324
- return utf8;
2325
  }
2326
- return toUTF8Array(s);
2327
- };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2328
 
2329
- }(qrcode);
2330
 
2331
- return qrcode; // eslint-disable-line no-undef
2332
- }()));
2333
- jQuery('.mo2f_gauth').qrcode({
2334
- 'render': 'image',
2335
- size: 175,
2336
- 'text': jQuery('.mo2f_gauth').data('qrcode')
2337
  });
1
+ /*! jquery-qrcode v0.17.0 - https://larsjung.de/jquery-qrcode/ */
2
+ (function webpackUniversalModuleDefinition(root, factory) {
3
+ if(typeof exports === 'object' && typeof module === 'object')
4
+ module.exports = factory();
5
+ else if(typeof define === 'function' && define.amd)
6
+ define("jquery-qrcode", [], factory);
7
+ else if(typeof exports === 'object')
8
+ exports["jquery-qrcode"] = factory();
9
+ else
10
+ root["jquery-qrcode"] = factory();
11
+ })((typeof self !== 'undefined' ? self : this), function() {
12
+ return /******/ (function(modules) { // webpackBootstrap
13
+ /******/ // The module cache
14
+ /******/ var installedModules = {};
15
+ /******/
16
+ /******/ // The require function
17
+ /******/ function __webpack_require__(moduleId) {
18
+ /******/
19
+ /******/ // Check if module is in cache
20
+ /******/ if(installedModules[moduleId]) {
21
+ /******/ return installedModules[moduleId].exports;
22
+ /******/ }
23
+ /******/ // Create a new module (and put it into the cache)
24
+ /******/ var module = installedModules[moduleId] = {
25
+ /******/ i: moduleId,
26
+ /******/ l: false,
27
+ /******/ exports: {}
28
+ /******/ };
29
+ /******/
30
+ /******/ // Execute the module function
31
+ /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
32
+ /******/
33
+ /******/ // Flag the module as loaded
34
+ /******/ module.l = true;
35
+ /******/
36
+ /******/ // Return the exports of the module
37
+ /******/ return module.exports;
38
+ /******/ }
39
+ /******/
40
+ /******/
41
+ /******/ // expose the modules object (__webpack_modules__)
42
+ /******/ __webpack_require__.m = modules;
43
+ /******/
44
+ /******/ // expose the module cache
45
+ /******/ __webpack_require__.c = installedModules;
46
+ /******/
47
+ /******/ // define getter function for harmony exports
48
+ /******/ __webpack_require__.d = function(exports, name, getter) {
49
+ /******/ if(!__webpack_require__.o(exports, name)) {
50
+ /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
51
+ /******/ }
52
+ /******/ };
53
+ /******/
54
+ /******/ // define __esModule on exports
55
+ /******/ __webpack_require__.r = function(exports) {
56
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
57
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
58
+ /******/ }
59
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
60
+ /******/ };
61
+ /******/
62
+ /******/ // create a fake namespace object
63
+ /******/ // mode & 1: value is a module id, require it
64
+ /******/ // mode & 2: merge all properties of value into the ns
65
+ /******/ // mode & 4: return value when already ns object
66
+ /******/ // mode & 8|1: behave like require
67
+ /******/ __webpack_require__.t = function(value, mode) {
68
+ /******/ if(mode & 1) value = __webpack_require__(value);
69
+ /******/ if(mode & 8) return value;
70
+ /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
71
+ /******/ var ns = Object.create(null);
72
+ /******/ __webpack_require__.r(ns);
73
+ /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
74
+ /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
75
+ /******/ return ns;
76
+ /******/ };
77
+ /******/
78
+ /******/ // getDefaultExport function for compatibility with non-harmony modules
79
+ /******/ __webpack_require__.n = function(module) {
80
+ /******/ var getter = module && module.__esModule ?
81
+ /******/ function getDefault() { return module['default']; } :
82
+ /******/ function getModuleExports() { return module; };
83
+ /******/ __webpack_require__.d(getter, 'a', getter);
84
+ /******/ return getter;
85
+ /******/ };
86
+ /******/
87
+ /******/ // Object.prototype.hasOwnProperty.call
88
+ /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
89
+ /******/
90
+ /******/ // __webpack_public_path__
91
+ /******/ __webpack_require__.p = "";
92
+ /******/
93
+ /******/
94
+ /******/ // Load entry module and return exports
95
+ /******/ return __webpack_require__(__webpack_require__.s = 0);
96
+ /******/ })
97
+ /************************************************************************/
98
+ /******/ ([
99
+ /* 0 */
100
+ /***/ (function(module, exports, __webpack_require__) {
101
+
102
+ /* WEBPACK VAR INJECTION */(function(global) {var WIN = global.window;
103
+ var JQ = WIN.jQuery; // Check if canvas is available in the browser (as Modernizr does)
104
+
105
+ var HAS_CANVAS = function () {
106
+ var el = WIN.document.createElement('canvas');
107
+ return !!(el.getContext && el.getContext('2d'));
108
+ }();
109
+
110
+ var is_img_el = function is_img_el(x) {
111
+ return x && typeof x.tagName === 'string' && x.tagName.toUpperCase() === 'IMG';
112
+ }; // Wrapper for the original QR code generator.
113
+
114
+
115
+ var create_qrcode = function create_qrcode(text, level, version, quiet) {
116
+ var qr = {};
117
+
118
+ var qr_gen = __webpack_require__(2);
119
+
120
+ qr_gen.stringToBytes = qr_gen.stringToBytesFuncs['UTF-8'];
121
+ var vqr = qr_gen(version, level);
122
+ vqr.addData(text);
123
+ vqr.make();
124
+ quiet = quiet || 0;
125
+ var module_count = vqr.getModuleCount();
126
+ var quiet_module_count = module_count + 2 * quiet;
127
+
128
+ var is_dark = function is_dark(row, col) {
129
+ row -= quiet;
130
+ col -= quiet;
131
+ return row >= 0 && row < module_count && col >= 0 && col < module_count && vqr.isDark(row, col);
132
+ };
133
+
134
+ var add_blank = function add_blank(l, t, r, b) {
135
+ var prev_is_dark = qr.is_dark;
136
+ var module_size = 1 / quiet_module_count;
137
+
138
+ qr.is_dark = function (row, col) {
139
+ var ml = col * module_size;
140
+ var mt = row * module_size;
141
+ var mr = ml + module_size;
142
+ var mb = mt + module_size;
143
+ return prev_is_dark(row, col) && (l > mr || ml > r || t > mb || mt > b);
144
+ };
145
+ };
146
+
147
+ qr.text = text;
148
+ qr.level = level;
149
+ qr.version = version;
150
+ qr.module_count = quiet_module_count;
151
+ qr.is_dark = is_dark;
152
+ qr.add_blank = add_blank;
153
+ return qr;
154
+ }; // Returns a minimal QR code for the given text starting with version `min_ver`.
155
+ // Returns `undefined` if `text` is too long to be encoded in `max_ver`.
156
+
157
+
158
+ var create_min_qrcode = function create_min_qrcode(text, level, min_ver, max_ver, quiet) {
159
+ min_ver = Math.max(1, min_ver || 1);
160
+ max_ver = Math.min(40, max_ver || 40);
161
+
162
+ for (var ver = min_ver; ver <= max_ver; ver += 1) {
163
+ try {
164
+ return create_qrcode(text, level, ver, quiet);
165
+ } catch (err) {
166
+ /* empty */
167
+ }
168
+ }
169
+
170
+ return undefined;
171
+ };
172
+
173
+ var draw_background_label = function draw_background_label(qr, context, settings) {
174
+ var size = settings.size;
175
+ var font = 'bold ' + settings.mSize * size + 'px ' + settings.fontname;
176
+ var ctx = JQ('<canvas/>')[0].getContext('2d');
177
+ ctx.font = font;
178
+ var w = ctx.measureText(settings.label).width;
179
+ var sh = settings.mSize;
180
+ var sw = w / size;
181
+ var sl = (1 - sw) * settings.mPosX;
182
+ var st = (1 - sh) * settings.mPosY;
183
+ var sr = sl + sw;
184
+ var sb = st + sh;
185
+ var pad = 0.01;
186
+
187
+ if (settings.mode === 1) {
188
+ // Strip
189
+ qr.add_blank(0, st - pad, size, sb + pad);
190
+ } else {
191
+ // Box
192
+ qr.add_blank(sl - pad, st - pad, sr + pad, sb + pad);
193
+ }
194
+
195
+ context.fillStyle = settings.fontcolor;
196
+ context.font = font;
197
+ context.fillText(settings.label, sl * size, st * size + 0.75 * settings.mSize * size);
198
+ };
199
+
200
+ var draw_background_img = function draw_background_img(qr, context, settings) {
201
+ var size = settings.size;
202
+ var w = settings.image.naturalWidth || 1;
203
+ var h = settings.image.naturalHeight || 1;
204
+ var sh = settings.mSize;
205
+ var sw = sh * w / h;
206
+ var sl = (1 - sw) * settings.mPosX;
207
+ var st = (1 - sh) * settings.mPosY;
208
+ var sr = sl + sw;
209
+ var sb = st + sh;
210
+ var pad = 0.01;
211
+
212
+ if (settings.mode === 3) {
213
+ // Strip
214
+ qr.add_blank(0, st - pad, size, sb + pad);
215
+ } else {
216
+ // Box
217
+ qr.add_blank(sl - pad, st - pad, sr + pad, sb + pad);
218
+ }
219
+
220
+ context.drawImage(settings.image, sl * size, st * size, sw * size, sh * size);
221
+ };
222
+
223
+ var draw_background = function draw_background(qr, context, settings) {
224
+ if (is_img_el(settings.background)) {
225
+ context.drawImage(settings.background, 0, 0, settings.size, settings.size);
226
+ } else if (settings.background) {
227
+ context.fillStyle = settings.background;
228
+ context.fillRect(settings.left, settings.top, settings.size, settings.size);
229
+ }
230
+
231
+ var mode = settings.mode;
232
+
233
+ if (mode === 1 || mode === 2) {
234
+ draw_background_label(qr, context, settings);
235
+ } else if (is_img_el(settings.image) && (mode === 3 || mode === 4)) {
236
+ draw_background_img(qr, context, settings);
237
+ }
238
+ };
239
+
240
+ var draw_modules_default = function draw_modules_default(qr, context, settings, left, top, width, row, col) {
241
+ if (qr.is_dark(row, col)) {
242
+ context.rect(left, top, width, width);
243
+ }
244
+ };
245
+
246
+ var draw_modules_rounded_dark = function draw_modules_rounded_dark(ctx, l, t, r, b, rad, nw, ne, se, sw) {
247
+ if (nw) {
248
+ ctx.moveTo(l + rad, t);
249
+ } else {
250
+ ctx.moveTo(l, t);
251
+ }
252
+
253
+ if (ne) {
254
+ ctx.lineTo(r - rad, t);
255
+ ctx.arcTo(r, t, r, b, rad);
256
+ } else {
257
+ ctx.lineTo(r, t);
258
+ }
259
+
260
+ if (se) {
261
+ ctx.lineTo(r, b - rad);
262
+ ctx.arcTo(r, b, l, b, rad);
263
+ } else {
264
+ ctx.lineTo(r, b);
265
+ }
266
+
267
+ if (sw) {
268
+ ctx.lineTo(l + rad, b);
269
+ ctx.arcTo(l, b, l, t, rad);
270
+ } else {
271
+ ctx.lineTo(l, b);
272
+ }
273
+
274
+ if (nw) {
275
+ ctx.lineTo(l, t + rad);
276
+ ctx.arcTo(l, t, r, t, rad);
277
+ } else {
278
+ ctx.lineTo(l, t);
279
+ }
280
+ };
281
+
282
+ var draw_modules_rounded_light = function draw_modules_rounded_light(ctx, l, t, r, b, rad, nw, ne, se, sw) {
283
+ if (nw) {
284
+ ctx.moveTo(l + rad, t);
285
+ ctx.lineTo(l, t);
286
+ ctx.lineTo(l, t + rad);
287
+ ctx.arcTo(l, t, l + rad, t, rad);
288
+ }
289
+
290
+ if (ne) {
291
+ ctx.moveTo(r - rad, t);
292
+ ctx.lineTo(r, t);
293
+ ctx.lineTo(r, t + rad);
294
+ ctx.arcTo(r, t, r - rad, t, rad);
295
+ }
296
+
297
+ if (se) {
298
+ ctx.moveTo(r - rad, b);
299
+ ctx.lineTo(r, b);
300
+ ctx.lineTo(r, b - rad);
301
+ ctx.arcTo(r, b, r - rad, b, rad);
302
+ }
303
+
304
+ if (sw) {
305
+ ctx.moveTo(l + rad, b);
306
+ ctx.lineTo(l, b);
307
+ ctx.lineTo(l, b - rad);
308
+ ctx.arcTo(l, b, l + rad, b, rad);
309
+ }
310
+ };
311
+
312
+ var draw_modules_rounded = function draw_modules_rounded(qr, context, settings, left, top, width, row, col) {
313
+ var is_dark = qr.is_dark;
314
+ var right = left + width;
315
+ var bottom = top + width;
316
+ var radius = settings.radius * width;
317
+ var rowT = row - 1;
318
+ var rowB = row + 1;
319
+ var colL = col - 1;
320
+ var colR = col + 1;
321
+ var center = is_dark(row, col);
322
+ var northwest = is_dark(rowT, colL);
323
+ var north = is_dark(rowT, col);
324
+ var northeast = is_dark(rowT, colR);
325
+ var east = is_dark(row, colR);
326
+ var southeast = is_dark(rowB, colR);
327
+ var south = is_dark(rowB, col);
328
+ var southwest = is_dark(rowB, colL);
329
+ var west = is_dark(row, colL);
330
+
331
+ if (center) {
332
+ draw_modules_rounded_dark(context, left, top, right, bottom, radius, !north && !west, !north && !east, !south && !east, !south && !west);
333
+ } else {
334
+ draw_modules_rounded_light(context, left, top, right, bottom, radius, north && west && northwest, north && east && northeast, south && east && southeast, south && west && southwest);
335
+ }
336
+ };
337
+
338
+ var draw_modules = function draw_modules(qr, context, settings) {
339
+ var module_count = qr.module_count;
340
+ var module_size = settings.size / module_count;
341
+ var fn = draw_modules_default;
342
+ var row;
343
+ var col;
344
+
345
+ if (settings.radius > 0 && settings.radius <= 0.5) {
346
+ fn = draw_modules_rounded;
347
+ }
348
+
349
+ context.beginPath();
350
+
351
+ for (row = 0; row < module_count; row += 1) {
352
+ for (col = 0; col < module_count; col += 1) {
353
+ var l = settings.left + col * module_size;
354
+ var t = settings.top + row * module_size;
355
+ var w = module_size;
356
+ fn(qr, context, settings, l, t, w, row, col);
357
+ }
358
+ }
359
+
360
+ if (is_img_el(settings.fill)) {
361
+ context.strokeStyle = 'rgba(0,0,0,0.5)';
362
+ context.lineWidth = 2;
363
+ context.stroke();
364
+ var prev = context.globalCompositeOperation;
365
+ context.globalCompositeOperation = 'destination-out';
366
+ context.fill();
367
+ context.globalCompositeOperation = prev;
368
+ context.clip();
369
+ context.drawImage(settings.fill, 0, 0, settings.size, settings.size);
370
+ context.restore();
371
+ } else {
372
+ context.fillStyle = settings.fill;
373
+ context.fill();
374
+ }
375
+ }; // Draws QR code to the given `canvas` and returns it.
376
+
377
+
378
+ var draw_on_canvas = function draw_on_canvas(canvas, settings) {
379
+ var qr = create_min_qrcode(settings.text, settings.ecLevel, settings.minVersion, settings.maxVersion, settings.quiet);
380
+
381
+ if (!qr) {
382
+ return null;
383
+ }
384
+
385
+ var $canvas = JQ(canvas).data('qrcode', qr);
386
+ var context = $canvas[0].getContext('2d');
387
+ draw_background(qr, context, settings);
388
+ draw_modules(qr, context, settings);
389
+ return $canvas;
390
+ }; // Returns a `canvas` element representing the QR code for the given settings.
391
+
392
+
393
+ var create_canvas = function create_canvas(settings) {
394
+ var $canvas = JQ('<canvas/>').attr('width', settings.size).attr('height', settings.size);
395
+ return draw_on_canvas($canvas, settings);
396
+ }; // Returns an `image` element representing the QR code for the given settings.
397
+
398
+
399
+ var create_img = function create_img(settings) {
400
+ return JQ('<img/>').attr('src', create_canvas(settings)[0].toDataURL('image/png'));
401
+ }; // Returns a `div` element representing the QR code for the given settings.
402
+
403
+
404
+ var create_div = function create_div(settings) {
405
+ var qr = create_min_qrcode(settings.text, settings.ecLevel, settings.minVersion, settings.maxVersion, settings.quiet);
406
+
407
+ if (!qr) {
408
+ return null;
409
+ } // some shortcuts to improve compression
410
+
411
+
412
+ var settings_size = settings.size;
413
+ var settings_bgColor = settings.background;
414
+ var math_floor = Math.floor;
415
+ var module_count = qr.module_count;
416
+ var module_size = math_floor(settings_size / module_count);
417
+ var offset = math_floor(0.5 * (settings_size - module_size * module_count));
418
+ var row;
419
+ var col;
420
+ var container_css = {
421
+ position: 'relative',
422
+ left: 0,
423
+ top: 0,
424
+ padding: 0,
425
+ margin: 0,
426
+ width: settings_size,
427
+ height: settings_size
428
+ };
429
+ var dark_css = {
430
+ position: 'absolute',
431
+ padding: 0,
432
+ margin: 0,
433
+ width: module_size,
434
+ height: module_size,
435
+ 'background-color': settings.fill
436
+ };
437
+ var $div = JQ('<div/>').data('qrcode', qr).css(container_css);
438
+
439
+ if (settings_bgColor) {
440
+ $div.css('background-color', settings_bgColor);
441
+ }
442
+
443
+ for (row = 0; row < module_count; row += 1) {
444
+ for (col = 0; col < module_count; col += 1) {
445
+ if (qr.is_dark(row, col)) {
446
+ JQ('<div/>').css(dark_css).css({
447
+ left: offset + col * module_size,
448
+ top: offset + row * module_size
449
+ }).appendTo($div);
450
+ }
451
+ }
452
+ }
453
+
454
+ return $div;
455
+ };
456
+
457
+ var create_html = function create_html(settings) {
458
+ if (HAS_CANVAS && settings.render === 'canvas') {
459
+ return create_canvas(settings);
460
+ } else if (HAS_CANVAS && settings.render === 'image') {
461
+ return create_img(settings);
462
+ }
463
+
464
+ return create_div(settings);
465
+ };
466
+
467
+ var DEFAULTS = {
468
+ // render method: `'canvas'`, `'image'` or `'div'`
469
+ render: 'canvas',
470
+ // version range somewhere in 1 .. 40
471
+ minVersion: 1,
472
+ maxVersion: 40,
473
+ // error correction level: `'L'`, `'M'`, `'Q'` or `'H'`
474
+ ecLevel: 'L',
475
+ // offset in pixel if drawn onto existing canvas
476
+ left: 0,
477
+ top: 0,
478
+ // size in pixel
479
+ size: 200,
480
+ // code color or image element
481
+ fill: '#000',
482
+ // background color or image element, `null` for transparent background
483
+ background: '#fff',
484
+ // content
485
+ text: 'no text',
486
+ // corner radius relative to module width: 0.0 .. 0.5
487
+ radius: 0,
488
+ // quiet zone in modules
489
+ quiet: 0,
490
+ // modes
491
+ // 0: normal
492
+ // 1: label strip
493
+ // 2: label box
494
+ // 3: image strip
495
+ // 4: image box
496
+ mode: 0,
497
+ mSize: 0.1,
498
+ mPosX: 0.5,
499
+ mPosY: 0.5,
500
+ label: 'no label',
501
+ fontname: 'sans',
502
+ fontcolor: '#000',
503
+ image: null
504
+ };
505
+
506
+ JQ.fn.qrcode = module.exports = function main(options) {
507
+ var settings = JQ.extend({}, DEFAULTS, options);
508
+ return this.each(function (idx, el) {
509
+ if (el.nodeName.toLowerCase() === 'canvas') {
510
+ draw_on_canvas(el, settings);
511
+ } else {
512
+ JQ(el).append(create_html(settings));
513
+ }
514
+ });
515
+ };
516
+ /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(1)))
517
+
518
+ /***/ }),
519
+ /* 1 */
520
+ /***/ (function(module, exports) {
521
+
522
+ var g;
523
+
524
+ // This works in non-strict mode
525
+ g = (function() {
526
+ return this;
527
+ })();
528
+
529
+ try {
530
+ // This works if eval is allowed (see CSP)
531
+ g = g || new Function("return this")();
532
+ } catch (e) {
533
+ // This works if the window reference is available
534
+ if (typeof window === "object") g = window;
535
+ }
536
+
537
+ // g can still be undefined, but nothing to do about it...
538
+ // We return undefined, instead of nothing here, so it's
539
+ // easier to handle this case. if(!global) { ...}
540
+
541
+ module.exports = g;
542
+
543
+
544
+ /***/ }),
545
+ /* 2 */
546
+ /***/ (function(module, exports, __webpack_require__) {
547
+
548
+ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;//---------------------------------------------------------------------
549
+ //
550
+ // QR Code Generator for JavaScript
551
+ //
552
+ // Copyright (c) 2009 Kazuhiko Arase
553
+ //
554
+ // URL: http://www.d-project.com/
555
+ //
556
+ // Licensed under the MIT license:
557
+ // http://www.opensource.org/licenses/mit-license.php
558
+ //
559
+ // The word 'QR Code' is registered trademark of
560
+ // DENSO WAVE INCORPORATED
561
+ // http://www.denso-wave.com/qrcode/faqpatent-e.html
562
+ //
563
+ //---------------------------------------------------------------------
564
+
565
+ var qrcode = function() {
566
+
567
+ //---------------------------------------------------------------------
568
+ // qrcode
569
+ //---------------------------------------------------------------------
570
+
571
+ /**
572
+ * qrcode
573
+ * @param typeNumber 1 to 40
574
+ * @param errorCorrectionLevel 'L','M','Q','H'
575
+ */
576
+ var qrcode = function(typeNumber, errorCorrectionLevel) {
577
+
578
+ var PAD0 = 0xEC;
579
+ var PAD1 = 0x11;
580
+
581
+ var _typeNumber = typeNumber;
582
+ var _errorCorrectionLevel = QRErrorCorrectionLevel[errorCorrectionLevel];
583
+ var _modules = null;
584
+ var _moduleCount = 0;
585
+ var _dataCache = null;
586
+ var _dataList = [];
587
+
588
+ var _this = {};
589
+
590
+ var makeImpl = function(test, maskPattern) {
591
+
592
+ _moduleCount = _typeNumber * 4 + 17;
593
+ _modules = function(moduleCount) {
594
+ var modules = new Array(moduleCount);
595
+ for (var row = 0; row < moduleCount; row += 1) {
596
+ modules[row] = new Array(moduleCount);
597
+ for (var col = 0; col < moduleCount; col += 1) {
598
+ modules[row][col] = null;
599
+ }
600
+ }
601
+ return modules;
602
+ }(_moduleCount);
603
+
604
+ setupPositionProbePattern(0, 0);
605
+ setupPositionProbePattern(_moduleCount - 7, 0);
606
+ setupPositionProbePattern(0, _moduleCount - 7);
607
+ setupPositionAdjustPattern();
608
+ setupTimingPattern();
609
+ setupTypeInfo(test, maskPattern);
610
+
611
+ if (_typeNumber >= 7) {
612
+ setupTypeNumber(test);
613
+ }
614
 
615
+ if (_dataCache == null) {
616
+ _dataCache = createData(_typeNumber, _errorCorrectionLevel, _dataList);
617
+ }
618
 
619
+ mapData(_dataCache, maskPattern);
620
+ };
 
 
 
621
 
622
+ var setupPositionProbePattern = function(row, col) {
 
 
623
 
624
+ for (var r = -1; r <= 7; r += 1) {
 
 
625
 
626
+ if (row + r <= -1 || _moduleCount <= row + r) continue;
627
 
628
+ for (var c = -1; c <= 7; c += 1) {
 
629
 
630
+ if (col + c <= -1 || _moduleCount <= col + c) continue;
 
 
631
 
632
+ if ( (0 <= r && r <= 6 && (c == 0 || c == 6) )
633
+ || (0 <= c && c <= 6 && (r == 0 || r == 6) )
634
+ || (2 <= r && r <= 4 && 2 <= c && c <= 4) ) {
635
+ _modules[row + r][col + c] = true;
636
+ } else {
637
+ _modules[row + r][col + c] = false;
638
+ }
639
  }
640
+ }
641
+ };
642
+
643
+ var getBestMaskPattern = function() {
644
 
645
+ var minLostPoint = 0;
646
+ var pattern = 0;
 
647
 
648
+ for (var i = 0; i < 8; i += 1) {
 
 
 
 
649
 
650
+ makeImpl(true, i);
651
+
652
+ var lostPoint = QRUtil.getLostPoint(_this);
653
+
654
+ if (i == 0 || minLostPoint > lostPoint) {
655
+ minLostPoint = lostPoint;
656
+ pattern = i;
657
  }
658
+ }
659
 
660
+ return pattern;
661
+ };
 
 
 
 
662
 
663
+ var setupTimingPattern = function() {
 
664
 
665
+ for (var r = 8; r < _moduleCount - 8; r += 1) {
666
+ if (_modules[r][6] != null) {
667
+ continue;
 
 
 
 
 
 
668
  }
669
+ _modules[r][6] = (r % 2 == 0);
670
+ }
671
 
672
+ for (var c = 8; c < _moduleCount - 8; c += 1) {
673
+ if (_modules[6][c] != null) {
674
+ continue;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
675
  }
676
+ _modules[6][c] = (c % 2 == 0);
677
+ }
678
+ };
679
 
680
+ var setupPositionAdjustPattern = function() {
 
 
 
681
 
682
+ var pos = QRUtil.getPatternPosition(_typeNumber);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
683
 
684
+ for (var i = 0; i < pos.length; i += 1) {
 
685
 
686
+ for (var j = 0; j < pos.length; j += 1) {
 
 
 
 
 
 
687
 
688
+ var row = pos[i];
689
+ var col = pos[j];
 
 
 
 
 
690
 
691
+ if (_modules[row][col] != null) {
692
+ continue;
693
+ }
 
 
694
 
695
+ for (var r = -2; r <= 2; r += 1) {
 
 
 
 
 
696
 
697
+ for (var c = -2; c <= 2; c += 1) {
 
 
 
 
 
698
 
699
+ if (r == -2 || r == 2 || c == -2 || c == 2
700
+ || (r == 0 && c == 0) ) {
701
+ _modules[row + r][col + c] = true;
702
+ } else {
703
+ _modules[row + r][col + c] = false;
704
+ }
705
+ }
706
+ }
707
  }
708
+ }
709
+ };
710
+
711
+ var setupTypeNumber = function(test) {
712
+
713
+ var bits = QRUtil.getBCHTypeNumber(_typeNumber);
714
 
715
+ for (var i = 0; i < 18; i += 1) {
716
+ var mod = (!test && ( (bits >> i) & 1) == 1);
717
+ _modules[Math.floor(i / 3)][i % 3 + _moduleCount - 8 - 3] = mod;
718
+ }
719
+
720
+ for (var i = 0; i < 18; i += 1) {
721
+ var mod = (!test && ( (bits >> i) & 1) == 1);
722
+ _modules[i % 3 + _moduleCount - 8 - 3][Math.floor(i / 3)] = mod;
723
+ }
724
+ };
725
+
726
+ var setupTypeInfo = function(test, maskPattern) {
727
+
728
+ var data = (_errorCorrectionLevel << 3) | maskPattern;
729
+ var bits = QRUtil.getBCHTypeInfo(data);
730
+
731
+ // vertical
732
+ for (var i = 0; i < 15; i += 1) {
733
+
734
+ var mod = (!test && ( (bits >> i) & 1) == 1);
735
+
736
+ if (i < 6) {
737
+ _modules[i][8] = mod;
738
+ } else if (i < 8) {
739
+ _modules[i + 1][8] = mod;
740
  } else {
741
+ _modules[_moduleCount - 15 + i][8] = mod;
742
  }
743
+ }
744
+
745
+ // horizontal
746
+ for (var i = 0; i < 15; i += 1) {
747
 
748
+ var mod = (!test && ( (bits >> i) & 1) == 1);
749
+
750
+ if (i < 8) {
751
+ _modules[8][_moduleCount - i - 1] = mod;
752
+ } else if (i < 9) {
753
+ _modules[8][15 - i - 1 + 1] = mod;
754
  } else {
755
+ _modules[8][15 - i - 1] = mod;
756
  }
757
+ }
758
 
759
+ // fixed module
760
+ _modules[_moduleCount - 8][8] = (!test);
761
+ };
 
 
 
 
762
 
763
+ var mapData = function(data, maskPattern) {
 
 
 
 
 
764
 
765
+ var inc = -1;
766
+ var row = _moduleCount - 1;
767
+ var bitIndex = 7;
768
+ var byteIndex = 0;
769
+ var maskFunc = QRUtil.getMaskFunction(maskPattern);
 
770
 
771
+ for (var col = _moduleCount - 1; col > 0; col -= 2) {
 
 
 
 
 
 
772
 
773
+ if (col == 6) col -= 1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
774
 
775
+ while (true) {
 
 
 
 
 
776
 
777
+ for (var c = 0; c < 2; c += 1) {
778
+
779
+ if (_modules[row][col - c] == null) {
780
+
781
+ var dark = false;
782
 
783
+ if (byteIndex < data.length) {
784
+ dark = ( ( (data[byteIndex] >>> bitIndex) & 1) == 1);
785
+ }
786
+
787
+ var mask = maskFunc(row, col - c);
788
+
789
+ if (mask) {
790
+ dark = !dark;
791
+ }
792
+
793
+ _modules[row][col - c] = dark;
794
+ bitIndex -= 1;
795
 
796
+ if (bitIndex == -1) {
797
+ byteIndex += 1;
798
+ bitIndex = 7;
799
+ }
800
  }
801
+ }
802
+
803
+ row += inc;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
804
 
805
+ if (row < 0 || _moduleCount <= row) {
806
+ row -= inc;
807
+ inc = -inc;
808
+ break;
809
+ }
810
  }
811
+ }
812
+ };
813
 
814
+ var createBytes = function(buffer, rsBlocks) {
 
815
 
816
+ var offset = 0;
 
817
 
818
+ var maxDcCount = 0;
819
+ var maxEcCount = 0;
820
 
821
+ var dcdata = new Array(rsBlocks.length);
822
+ var ecdata = new Array(rsBlocks.length);
 
 
 
823
 
824
+ for (var r = 0; r < rsBlocks.length; r += 1) {
 
 
 
825
 
826
+ var dcCount = rsBlocks[r].dataCount;
827
+ var ecCount = rsBlocks[r].totalCount - dcCount;
828
+
829
+ maxDcCount = Math.max(maxDcCount, dcCount);
830
+ maxEcCount = Math.max(maxEcCount, ecCount);
 
831
 
832
+ dcdata[r] = new Array(dcCount);
833
+
834
+ for (var i = 0; i < dcdata[r].length; i += 1) {
835
+ dcdata[r][i] = 0xff & buffer.getBuffer()[i + offset];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
836
  }
837
+ offset += dcCount;
838
 
839
+ var rsPoly = QRUtil.getErrorCorrectPolynomial(ecCount);
840
+ var rawPoly = qrPolynomial(dcdata[r], rsPoly.getLength() - 1);
841
+
842
+ var modPoly = rawPoly.mod(rsPoly);
843
+ ecdata[r] = new Array(rsPoly.getLength() - 1);
844
+ for (var i = 0; i < ecdata[r].length; i += 1) {
845
+ var modIndex = i + modPoly.getLength() - ecdata[r].length;
846
+ ecdata[r][i] = (modIndex >= 0)? modPoly.getAt(modIndex) : 0;
 
 
 
 
847
  }
848
+ }
849
 
850
+ var totalCodeCount = 0;
851
+ for (var i = 0; i < rsBlocks.length; i += 1) {
852
+ totalCodeCount += rsBlocks[i].totalCount;
853
+ }
854
 
855
+ var data = new Array(totalCodeCount);
856
+ var index = 0;
857
+
858
+ for (var i = 0; i < maxDcCount; i += 1) {
859
+ for (var r = 0; r < rsBlocks.length; r += 1) {
860
+ if (i < dcdata[r].length) {
861
+ data[index] = dcdata[r][i];
862
+ index += 1;
863
+ }
864
  }
865
+ }
866
 
867
+ for (var i = 0; i < maxEcCount; i += 1) {
868
+ for (var r = 0; r < rsBlocks.length; r += 1) {
869
+ if (i < ecdata[r].length) {
870
+ data[index] = ecdata[r][i];
871
+ index += 1;
872
+ }
873
+ }
874
+ }
875
 
876
+ return data;
877
+ };
878
 
879
+ var createData = function(typeNumber, errorCorrectionLevel, dataList) {
 
 
 
 
880
 
881
+ var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, errorCorrectionLevel);
 
 
882
 
883
+ var buffer = qrBitBuffer();
 
884
 
885
+ for (var i = 0; i < dataList.length; i += 1) {
886
+ var data = dataList[i];
887
+ buffer.put(data.getMode(), 4);
888
+ buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber) );
889
+ data.write(buffer);
890
+ }
891
 
892
+ // calc num max data.
893
+ var totalDataCount = 0;
894
+ for (var i = 0; i < rsBlocks.length; i += 1) {
895
+ totalDataCount += rsBlocks[i].dataCount;
896
+ }
897
 
898
+ if (buffer.getLengthInBits() > totalDataCount * 8) {
899
+ throw 'code length overflow. ('
900
+ + buffer.getLengthInBits()
901
+ + '>'
902
+ + totalDataCount * 8
903
+ + ')';
904
+ }
905
 
906
+ // end code
907
+ if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
908
+ buffer.put(0, 4);
909
+ }
910
 
911
+ // padding
912
+ while (buffer.getLengthInBits() % 8 != 0) {
913
+ buffer.putBit(false);
914
+ }
915
 
916
+ // padding
917
+ while (true) {
918
 
919
+ if (buffer.getLengthInBits() >= totalDataCount * 8) {
920
+ break;
921
+ }
922
+ buffer.put(PAD0, 8);
923
 
924
+ if (buffer.getLengthInBits() >= totalDataCount * 8) {
925
+ break;
926
+ }
927
+ buffer.put(PAD1, 8);
928
+ }
 
 
929
 
930
+ return createBytes(buffer, rsBlocks);
931
+ };
 
932
 
933
+ _this.addData = function(data, mode) {
934
+
935
+ mode = mode || 'Byte';
936
+
937
+ var newData = null;
938
+
939
+ switch(mode) {
940
+ case 'Numeric' :
941
+ newData = qrNumber(data);
942
+ break;
943
+ case 'Alphanumeric' :
944
+ newData = qrAlphaNum(data);
945
+ break;
946
+ case 'Byte' :
947
+ newData = qr8BitByte(data);
948
+ break;
949
+ case 'Kanji' :
950
+ newData = qrKanji(data);
951
+ break;
952
+ default :
953
+ throw 'mode:' + mode;
954
+ }
955
 
956
+ _dataList.push(newData);
957
+ _dataCache = null;
958
  };
959
 
960
+ _this.isDark = function(row, col) {
961
+ if (row < 0 || _moduleCount <= row || col < 0 || _moduleCount <= col) {
962
+ throw row + ',' + col;
963
+ }
964
+ return _modules[row][col];
965
+ };
966
 
967
+ _this.getModuleCount = function() {
968
+ return _moduleCount;
 
 
 
 
 
969
  };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
970
 
971
+ _this.make = function() {
972
+ if (_typeNumber < 1) {
973
+ var typeNumber = 1;
974
+
975
+ for (; typeNumber < 40; typeNumber++) {
976
+ var rsBlocks = QRRSBlock.getRSBlocks(typeNumber, _errorCorrectionLevel);
977
+ var buffer = qrBitBuffer();
978
+
979
+ for (var i = 0; i < _dataList.length; i++) {
980
+ var data = _dataList[i];
981
+ buffer.put(data.getMode(), 4);
982
+ buffer.put(data.getLength(), QRUtil.getLengthInBits(data.getMode(), typeNumber) );
983
+ data.write(buffer);
984
  }
985
 
986
+ var totalDataCount = 0;
987
+ for (var i = 0; i < rsBlocks.length; i++) {
988
+ totalDataCount += rsBlocks[i].dataCount;
989
+ }
990
 
991
+ if (buffer.getLengthInBits() <= totalDataCount * 8) {
992
+ break;
993
+ }
994
+ }
995
 
996
+ _typeNumber = typeNumber;
997
+ }
998
 
999
+ makeImpl(false, getBestMaskPattern() );
1000
+ };
1001
 
1002
+ _this.createTableTag = function(cellSize, margin) {
1003
 
1004
+ cellSize = cellSize || 2;
1005
+ margin = (typeof margin == 'undefined')? cellSize * 4 : margin;
1006
 
1007
+ var qrHtml = '';
 
 
 
 
 
 
 
 
 
1008
 
1009
+ qrHtml += '<table style="';
1010
+ qrHtml += ' border-width: 0px; border-style: none;';
1011
+ qrHtml += ' border-collapse: collapse;';
1012
+ qrHtml += ' padding: 0px; margin: ' + margin + 'px;';
1013
+ qrHtml += '">';
1014
+ qrHtml += '<tbody>';
1015
 
1016
+ for (var r = 0; r < _this.getModuleCount(); r += 1) {
 
1017
 
1018
+ qrHtml += '<tr>';
1019
 
1020
+ for (var c = 0; c < _this.getModuleCount(); c += 1) {
1021
+ qrHtml += '<td style="';
1022
+ qrHtml += ' border-width: 0px; border-style: none;';
1023
+ qrHtml += ' border-collapse: collapse;';
1024
+ qrHtml += ' padding: 0px; margin: 0px;';
1025
+ qrHtml += ' width: ' + cellSize + 'px;';
1026
+ qrHtml += ' height: ' + cellSize + 'px;';
1027
+ qrHtml += ' background-color: ';
1028
+ qrHtml += _this.isDark(r, c)? '#000000' : '#ffffff';
1029
+ qrHtml += ';';
1030
+ qrHtml += '"/>';
1031
+ }
1032
 
1033
+ qrHtml += '</tr>';
1034
+ }
1035
 
1036
+ qrHtml += '</tbody>';
1037
+ qrHtml += '</table>';
 
 
 
1038
 
1039
+ return qrHtml;
1040
+ };
1041
 
1042
+ _this.createSvgTag = function(cellSize, margin) {
1043
 
1044
+ var opts = {};
1045
+ if (typeof arguments[0] == 'object') {
1046
+ // Called by options.
1047
+ opts = arguments[0];
1048
+ // overwrite cellSize and margin.
1049
+ cellSize = opts.cellSize;
1050
+ margin = opts.margin;
1051
+ }
1052
 
1053
+ cellSize = cellSize || 2;
1054
+ margin = (typeof margin == 'undefined')? cellSize * 4 : margin;
1055
+ var size = _this.getModuleCount() * cellSize + margin * 2;
1056
+ var c, mc, r, mr, qrSvg='', rect;
 
 
 
1057
 
1058
+ rect = 'l' + cellSize + ',0 0,' + cellSize +
1059
+ ' -' + cellSize + ',0 0,-' + cellSize + 'z ';
1060
 
1061
+ qrSvg += '<svg version="1.1" xmlns="http://www.w3.org/2000/svg"';
1062
+ qrSvg += !opts.scalable ? ' width="' + size + 'px" height="' + size + 'px"' : '';
1063
+ qrSvg += ' viewBox="0 0 ' + size + ' ' + size + '" ';
1064
+ qrSvg += ' preserveAspectRatio="xMinYMin meet">';
1065
+ qrSvg += '<rect width="100%" height="100%" fill="white" cx="0" cy="0"/>';
1066
+ qrSvg += '<path d="';
1067
 
1068
+ for (r = 0; r < _this.getModuleCount(); r += 1) {
1069
+ mr = r * cellSize + margin;
1070
+ for (c = 0; c < _this.getModuleCount(); c += 1) {
1071
+ if (_this.isDark(r, c) ) {
1072
+ mc = c*cellSize+margin;
1073
+ qrSvg += 'M' + mc + ',' + mr + rect;
1074
+ }
1075
+ }
1076
+ }
1077
 
1078
+ qrSvg += '" stroke="transparent" fill="black"/>';
1079
+ qrSvg += '</svg>';
1080
 
1081
+ return qrSvg;
1082
+ };
1083
 
1084
+ _this.createDataURL = function(cellSize, margin) {
 
 
1085
 
1086
+ cellSize = cellSize || 2;
1087
+ margin = (typeof margin == 'undefined')? cellSize * 4 : margin;
1088
 
1089
+ var size = _this.getModuleCount() * cellSize + margin * 2;
1090
+ var min = margin;
1091
+ var max = size - margin;
1092
 
1093
+ return createDataURL(size, size, function(x, y) {
1094
+ if (min <= x && x < max && min <= y && y < max) {
1095
+ var c = Math.floor( (x - min) / cellSize);
1096
+ var r = Math.floor( (y - min) / cellSize);
1097
+ return _this.isDark(r, c)? 0 : 1;
1098
+ } else {
1099
+ return 1;
1100
+ }
1101
+ } );
1102
+ };
 
1103
 
1104
+ _this.createImgTag = function(cellSize, margin, alt) {
1105
+
1106
+ cellSize = cellSize || 2;
1107
+ margin = (typeof margin == 'undefined')? cellSize * 4 : margin;
1108
+
1109
+ var size = _this.getModuleCount() * cellSize + margin * 2;
1110
+
1111
+ var img = '';
1112
+ img += '<img';
1113
+ img += '\u0020src="';
1114
+ img += _this.createDataURL(cellSize, margin);
1115
+ img += '"';
1116
+ img += '\u0020width="';
1117
+ img += size;
1118
+ img += '"';
1119
+ img += '\u0020height="';
1120
+ img += size;
1121
+ img += '"';
1122
+ if (alt) {
1123
+ img += '\u0020alt="';
1124
+ img += alt;
1125
+ img += '"';
1126
+ }
1127
+ img += '/>';
1128
 
1129
+ return img;
1130
+ };
1131
 
1132
+ var _createHalfASCII = function(margin) {
1133
+ var cellSize = 1;
1134
+ margin = (typeof margin == 'undefined')? cellSize * 2 : margin;
 
1135
 
1136
+ var size = _this.getModuleCount() * cellSize + margin * 2;
1137
+ var min = margin;
1138
+ var max = size - margin;
 
 
1139
 
1140
+ var y, x, r1, r2, p;
1141
 
1142
+ var blocks = {
1143
+ '██': '█',
1144
+ '█ ': '▀',
1145
+ ' █': '▄',
1146
+ ' ': ' '
1147
+ };
1148
 
1149
+ var blocksLastLineNoMargin = {
1150
+ '██': '▀',
1151
+ '█ ': '▀',
1152
+ ' █': ' ',
1153
+ ' ': ' '
1154
+ };
1155
 
1156
+ var ascii = '';
1157
+ for (y = 0; y < size; y += 2) {
1158
+ r1 = Math.floor((y - min) / cellSize);
1159
+ r2 = Math.floor((y + 1 - min) / cellSize);
1160
+ for (x = 0; x < size; x += 1) {
1161
+ p = '█';
1162
 
1163
+ if (min <= x && x < max && min <= y && y < max && _this.isDark(r1, Math.floor((x - min) / cellSize))) {
1164
+ p = ' ';
 
 
 
 
 
1165
  }
1166
 
1167
+ if (min <= x && x < max && min <= y+1 && y+1 < max && _this.isDark(r2, Math.floor((x - min) / cellSize))) {
1168
+ p += ' ';
1169
+ }
1170
+ else {
1171
+ p += '█';
1172
+ }
1173
 
1174
+ // Output 2 characters per pixel, to create full square. 1 character per pixels gives only half width of square.
1175
+ ascii += (margin < 1 && y+1 >= max) ? blocksLastLineNoMargin[p] : blocks[p];
1176
+ }
1177
 
1178
+ ascii += '\n';
1179
+ }
 
 
 
 
 
 
1180
 
1181
+ if (size % 2 && margin > 0) {
1182
+ return ascii.substring(0, ascii.length - size - 1) + Array(size+1).join('▀');
1183
+ }
1184
 
1185
+ return ascii.substring(0, ascii.length-1);
1186
+ };
1187
 
1188
+ _this.createASCII = function(cellSize, margin) {
1189
+ cellSize = cellSize || 1;
 
 
 
1190
 
1191
+ if (cellSize < 2) {
1192
+ return _createHalfASCII(margin);
1193
+ }
1194
 
1195
+ cellSize -= 1;
1196
+ margin = (typeof margin == 'undefined')? cellSize * 2 : margin;
1197
 
1198
+ var size = _this.getModuleCount() * cellSize + margin * 2;
1199
+ var min = margin;
1200
+ var max = size - margin;
1201
 
1202
+ var y, x, r, p;
1203
 
1204
+ var white = Array(cellSize+1).join('██');
1205
+ var black = Array(cellSize+1).join(' ');
1206
 
1207
+ var ascii = '';
1208
+ var line = '';
1209
+ for (y = 0; y < size; y += 1) {
1210
+ r = Math.floor( (y - min) / cellSize);
1211
+ line = '';
1212
+ for (x = 0; x < size; x += 1) {
1213
+ p = 1;
1214
 
1215
+ if (min <= x && x < max && min <= y && y < max && _this.isDark(r, Math.floor((x - min) / cellSize))) {
1216
+ p = 0;
1217
+ }
1218
 
1219
+ // Output 2 characters per pixel, to create full square. 1 character per pixels gives only half width of square.
1220
+ line += p ? white : black;
1221
+ }
1222
 
1223
+ for (r = 0; r < cellSize; r += 1) {
1224
+ ascii += line + '\n';
1225
+ }
1226
+ }
1227
 
1228
+ return ascii.substring(0, ascii.length-1);
1229
+ };
1230
 
1231
+ _this.renderTo2dContext = function(context, cellSize) {
1232
+ cellSize = cellSize || 2;
1233
+ var length = _this.getModuleCount();
1234
+ for (var row = 0; row < length; row++) {
1235
+ for (var col = 0; col < length; col++) {
1236
+ context.fillStyle = _this.isDark(row, col) ? 'black' : 'white';
1237
+ context.fillRect(row * cellSize, col * cellSize, cellSize, cellSize);
1238
+ }
1239
+ }
1240
+ }
1241
 
1242
+ return _this;
1243
+ };
1244
 
1245
+ //---------------------------------------------------------------------
1246
+ // qrcode.stringToBytes
1247
+ //---------------------------------------------------------------------
 
 
 
 
 
1248
 
1249
+ qrcode.stringToBytesFuncs = {
1250
+ 'default' : function(s) {
1251
+ var bytes = [];
1252
+ for (var i = 0; i < s.length; i += 1) {
1253
+ var c = s.charCodeAt(i);
1254
+ bytes.push(c & 0xff);
1255
+ }
1256
+ return bytes;
1257
+ }
1258
+ };
1259
 
1260
+ qrcode.stringToBytes = qrcode.stringToBytesFuncs['default'];
1261
 
1262
+ //---------------------------------------------------------------------
1263
+ // qrcode.createStringToBytes
1264
+ //---------------------------------------------------------------------
1265
 
1266
+ /**
1267
+ * @param unicodeData base64 string of byte array.
1268
+ * [16bit Unicode],[16bit Bytes], ...
1269
+ * @param numChars
1270
+ */
1271
+ qrcode.createStringToBytes = function(unicodeData, numChars) {
1272
 
1273
+ // create conversion map.
1274
 
1275
+ var unicodeMap = function() {
 
1276
 
1277
+ var bin = base64DecodeInputStream(unicodeData);
1278
+ var read = function() {
1279
+ var b = bin.read();
1280
+ if (b == -1) throw 'eof';
1281
+ return b;
1282
+ };
1283
 
1284
+ var count = 0;
1285
+ var unicodeMap = {};
1286
+ while (true) {
1287
+ var b0 = bin.read();
1288
+ if (b0 == -1) break;
1289
+ var b1 = read();
1290
+ var b2 = read();
1291
+ var b3 = read();
1292
+ var k = String.fromCharCode( (b0 << 8) | b1);
1293
+ var v = (b2 << 8) | b3;
1294
+ unicodeMap[k] = v;
1295
+ count += 1;
1296
+ }
1297
+ if (count != numChars) {
1298
+ throw count + ' != ' + numChars;
1299
+ }
1300
 
1301
+ return unicodeMap;
1302
+ }();
 
 
1303
 
1304
+ var unknownChar = '?'.charCodeAt(0);
 
1305
 
1306
+ return function(s) {
1307
+ var bytes = [];
1308
+ for (var i = 0; i < s.length; i += 1) {
1309
+ var c = s.charCodeAt(i);
1310
+ if (c < 128) {
1311
+ bytes.push(c);
1312
+ } else {
1313
+ var b = unicodeMap[s.charAt(i)];
1314
+ if (typeof b == 'number') {
1315
+ if ( (b & 0xff) == b) {
1316
+ // 1byte
1317
+ bytes.push(b);
1318
+ } else {
1319
+ // 2bytes
1320
+ bytes.push(b >>> 8);
1321
+ bytes.push(b & 0xff);
1322
  }
1323
+ } else {
1324
+ bytes.push(unknownChar);
1325
  }
1326
+ }
1327
+ }
1328
+ return bytes;
1329
+ };
1330
+ };
1331
+
1332
+ //---------------------------------------------------------------------
1333
+ // QRMode
1334
+ //---------------------------------------------------------------------
1335
+
1336
+ var QRMode = {
1337
+ MODE_NUMBER : 1 << 0,
1338
+ MODE_ALPHA_NUM : 1 << 1,
1339
+ MODE_8BIT_BYTE : 1 << 2,
1340
+ MODE_KANJI : 1 << 3
1341
+ };
1342
+
1343
+ //---------------------------------------------------------------------
1344
+ // QRErrorCorrectionLevel
1345
+ //---------------------------------------------------------------------
1346
+
1347
+ var QRErrorCorrectionLevel = {
1348
+ L : 1,
1349
+ M : 0,
1350
+ Q : 3,
1351
+ H : 2
1352
+ };
1353
+
1354
+ //---------------------------------------------------------------------
1355
+ // QRMaskPattern
1356
+ //---------------------------------------------------------------------
1357
+
1358
+ var QRMaskPattern = {
1359
+ PATTERN000 : 0,
1360
+ PATTERN001 : 1,
1361
+ PATTERN010 : 2,
1362
+ PATTERN011 : 3,
1363
+ PATTERN100 : 4,
1364
+ PATTERN101 : 5,
1365
+ PATTERN110 : 6,
1366
+ PATTERN111 : 7
1367
+ };
1368
+
1369
+ //---------------------------------------------------------------------
1370
+ // QRUtil
1371
+ //---------------------------------------------------------------------
1372
+
1373
+ var QRUtil = function() {
1374
+
1375
+ var PATTERN_POSITION_TABLE = [
1376
+ [],
1377
+ [6, 18],
1378
+ [6, 22],
1379
+ [6, 26],
1380
+ [6, 30],
1381
+ [6, 34],
1382
+ [6, 22, 38],
1383
+ [6, 24, 42],
1384
+ [6, 26, 46],
1385
+ [6, 28, 50],
1386
+ [6, 30, 54],
1387
+ [6, 32, 58],
1388
+ [6, 34, 62],
1389
+ [6, 26, 46, 66],
1390
+ [6, 26, 48, 70],
1391
+ [6, 26, 50, 74],
1392
+ [6, 30, 54, 78],
1393
+ [6, 30, 56, 82],
1394
+ [6, 30, 58, 86],
1395
+ [6, 34, 62, 90],
1396
+ [6, 28, 50, 72, 94],
1397
+ [6, 26, 50, 74, 98],
1398
+ [6, 30, 54, 78, 102],
1399
+ [6, 28, 54, 80, 106],
1400
+ [6, 32, 58, 84, 110],
1401
+ [6, 30, 58, 86, 114],
1402
+ [6, 34, 62, 90, 118],
1403
+ [6, 26, 50, 74, 98, 122],
1404
+ [6, 30, 54, 78, 102, 126],
1405
+ [6, 26, 52, 78, 104, 130],
1406
+ [6, 30, 56, 82, 108, 134],
1407
+ [6, 34, 60, 86, 112, 138],
1408
+ [6, 30, 58, 86, 114, 142],
1409
+ [6, 34, 62, 90, 118, 146],
1410
+ [6, 30, 54, 78, 102, 126, 150],
1411
+ [6, 24, 50, 76, 102, 128, 154],
1412
+ [6, 28, 54, 80, 106, 132, 158],
1413
+ [6, 32, 58, 84, 110, 136, 162],
1414
+ [6, 26, 54, 82, 110, 138, 166],
1415
+ [6, 30, 58, 86, 114, 142, 170]
1416
+ ];
1417
+ var G15 = (1 << 10) | (1 << 8) | (1 << 5) | (1 << 4) | (1 << 2) | (1 << 1) | (1 << 0);
1418
+ var G18 = (1 << 12) | (1 << 11) | (1 << 10) | (1 << 9) | (1 << 8) | (1 << 5) | (1 << 2) | (1 << 0);
1419
+ var G15_MASK = (1 << 14) | (1 << 12) | (1 << 10) | (1 << 4) | (1 << 1);
1420
+
1421
+ var _this = {};
1422
+
1423
+ var getBCHDigit = function(data) {
1424
+ var digit = 0;
1425
+ while (data != 0) {
1426
+ digit += 1;
1427
+ data >>>= 1;
1428
+ }
1429
+ return digit;
1430
+ };
1431
 
1432
+ _this.getBCHTypeInfo = function(data) {
1433
+ var d = data << 10;
1434
+ while (getBCHDigit(d) - getBCHDigit(G15) >= 0) {
1435
+ d ^= (G15 << (getBCHDigit(d) - getBCHDigit(G15) ) );
1436
+ }
1437
+ return ( (data << 10) | d) ^ G15_MASK;
1438
+ };
1439
 
1440
+ _this.getBCHTypeNumber = function(data) {
1441
+ var d = data << 12;
1442
+ while (getBCHDigit(d) - getBCHDigit(G18) >= 0) {
1443
+ d ^= (G18 << (getBCHDigit(d) - getBCHDigit(G18) ) );
1444
+ }
1445
+ return (data << 12) | d;
1446
+ };
1447
 
1448
+ _this.getPatternPosition = function(typeNumber) {
1449
+ return PATTERN_POSITION_TABLE[typeNumber - 1];
1450
+ };
 
 
 
 
 
1451
 
1452
+ _this.getMaskFunction = function(maskPattern) {
1453
+
1454
+ switch (maskPattern) {
1455
+
1456
+ case QRMaskPattern.PATTERN000 :
1457
+ return function(i, j) { return (i + j) % 2 == 0; };
1458
+ case QRMaskPattern.PATTERN001 :
1459
+ return function(i, j) { return i % 2 == 0; };
1460
+ case QRMaskPattern.PATTERN010 :
1461
+ return function(i, j) { return j % 3 == 0; };
1462
+ case QRMaskPattern.PATTERN011 :
1463
+ return function(i, j) { return (i + j) % 3 == 0; };
1464
+ case QRMaskPattern.PATTERN100 :
1465
+ return function(i, j) { return (Math.floor(i / 2) + Math.floor(j / 3) ) % 2 == 0; };
1466
+ case QRMaskPattern.PATTERN101 :
1467
+ return function(i, j) { return (i * j) % 2 + (i * j) % 3 == 0; };
1468
+ case QRMaskPattern.PATTERN110 :
1469
+ return function(i, j) { return ( (i * j) % 2 + (i * j) % 3) % 2 == 0; };
1470
+ case QRMaskPattern.PATTERN111 :
1471
+ return function(i, j) { return ( (i * j) % 3 + (i + j) % 2) % 2 == 0; };
1472
+
1473
+ default :
1474
+ throw 'bad maskPattern:' + maskPattern;
1475
+ }
1476
+ };
1477
 
1478
+ _this.getErrorCorrectPolynomial = function(errorCorrectLength) {
1479
+ var a = qrPolynomial([1], 0);
1480
+ for (var i = 0; i < errorCorrectLength; i += 1) {
1481
+ a = a.multiply(qrPolynomial([1, QRMath.gexp(i)], 0) );
1482
+ }
1483
+ return a;
1484
+ };
1485
 
1486
+ _this.getLengthInBits = function(mode, type) {
1487
 
1488
+ if (1 <= type && type < 10) {
1489
 
1490
+ // 1 - 9
1491
 
1492
+ switch(mode) {
1493
+ case QRMode.MODE_NUMBER : return 10;
1494
+ case QRMode.MODE_ALPHA_NUM : return 9;
1495
+ case QRMode.MODE_8BIT_BYTE : return 8;
1496
+ case QRMode.MODE_KANJI : return 8;
1497
+ default :
1498
+ throw 'mode:' + mode;
1499
+ }
1500
 
1501
+ } else if (type < 27) {
 
 
 
 
1502
 
1503
+ // 10 - 26
 
 
 
 
 
 
1504
 
1505
+ switch(mode) {
1506
+ case QRMode.MODE_NUMBER : return 12;
1507
+ case QRMode.MODE_ALPHA_NUM : return 11;
1508
+ case QRMode.MODE_8BIT_BYTE : return 16;
1509
+ case QRMode.MODE_KANJI : return 10;
1510
+ default :
1511
+ throw 'mode:' + mode;
1512
+ }
1513
 
1514
+ } else if (type < 41) {
 
 
 
1515
 
1516
+ // 27 - 40
 
1517
 
1518
+ switch(mode) {
1519
+ case QRMode.MODE_NUMBER : return 14;
1520
+ case QRMode.MODE_ALPHA_NUM : return 13;
1521
+ case QRMode.MODE_8BIT_BYTE : return 16;
1522
+ case QRMode.MODE_KANJI : return 12;
1523
+ default :
1524
+ throw 'mode:' + mode;
1525
+ }
1526
 
1527
+ } else {
1528
+ throw 'type:' + type;
1529
+ }
1530
+ };
 
1531
 
1532
+ _this.getLostPoint = function(qrcode) {
 
1533
 
1534
+ var moduleCount = qrcode.getModuleCount();
 
 
 
 
1535
 
1536
+ var lostPoint = 0;
 
 
 
 
 
1537
 
1538
+ // LEVEL1
 
 
1539
 
1540
+ for (var row = 0; row < moduleCount; row += 1) {
1541
+ for (var col = 0; col < moduleCount; col += 1) {
 
1542
 
1543
+ var sameCount = 0;
1544
+ var dark = qrcode.isDark(row, col);
1545
 
1546
+ for (var r = -1; r <= 1; r += 1) {
 
1547
 
1548
+ if (row + r < 0 || moduleCount <= row + r) {
1549
+ continue;
1550
+ }
1551
 
1552
+ for (var c = -1; c <= 1; c += 1) {
1553
+
1554
+ if (col + c < 0 || moduleCount <= col + c) {
1555
+ continue;
1556
+ }
1557
+
1558
+ if (r == 0 && c == 0) {
1559
+ continue;
1560
+ }
1561
+
1562
+ if (dark == qrcode.isDark(row + r, col + c) ) {
1563
+ sameCount += 1;
1564
+ }
 
 
 
 
 
 
 
 
 
1565
  }
1566
+ }
1567
+
1568
+ if (sameCount > 5) {
1569
+ lostPoint += (3 + sameCount - 5);
1570
+ }
1571
+ }
1572
+ };
1573
+
1574
+ // LEVEL2
1575
+
1576
+ for (var row = 0; row < moduleCount - 1; row += 1) {
1577
+ for (var col = 0; col < moduleCount - 1; col += 1) {
1578
+ var count = 0;
1579
+ if (qrcode.isDark(row, col) ) count += 1;
1580
+ if (qrcode.isDark(row + 1, col) ) count += 1;
1581
+ if (qrcode.isDark(row, col + 1) ) count += 1;
1582
+ if (qrcode.isDark(row + 1, col + 1) ) count += 1;
1583
+ if (count == 0 || count == 4) {
1584
+ lostPoint += 3;
1585
+ }
1586
+ }
1587
+ }
1588
 
1589
+ // LEVEL3
1590
+
1591
+ for (var row = 0; row < moduleCount; row += 1) {
1592
+ for (var col = 0; col < moduleCount - 6; col += 1) {
1593
+ if (qrcode.isDark(row, col)
1594
+ && !qrcode.isDark(row, col + 1)
1595
+ && qrcode.isDark(row, col + 2)
1596
+ && qrcode.isDark(row, col + 3)
1597
+ && qrcode.isDark(row, col + 4)
1598
+ && !qrcode.isDark(row, col + 5)
1599
+ && qrcode.isDark(row, col + 6) ) {
1600
+ lostPoint += 40;
1601
  }
1602
+ }
1603
+ }
1604
 
1605
+ for (var col = 0; col < moduleCount; col += 1) {
1606
+ for (var row = 0; row < moduleCount - 6; row += 1) {
1607
+ if (qrcode.isDark(row, col)
1608
+ && !qrcode.isDark(row + 1, col)
1609
+ && qrcode.isDark(row + 2, col)
1610
+ && qrcode.isDark(row + 3, col)
1611
+ && qrcode.isDark(row + 4, col)
1612
+ && !qrcode.isDark(row + 5, col)
1613
+ && qrcode.isDark(row + 6, col) ) {
1614
+ lostPoint += 40;
1615
+ }
1616
+ }
1617
+ }
1618
 
1619
+ // LEVEL4
 
1620
 
1621
+ var darkCount = 0;
1622
 
1623
+ for (var col = 0; col < moduleCount; col += 1) {
1624
+ for (var row = 0; row < moduleCount; row += 1) {
1625
+ if (qrcode.isDark(row, col) ) {
1626
+ darkCount += 1;
1627
+ }
1628
+ }
1629
+ }
1630
 
1631
+ var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
1632
+ lostPoint += ratio * 10;
 
1633
 
1634
+ return lostPoint;
1635
+ };
 
 
 
 
 
 
 
 
1636
 
1637
+ return _this;
1638
+ }();
1639
 
1640
+ //---------------------------------------------------------------------
1641
+ // QRMath
1642
+ //---------------------------------------------------------------------
1643
 
1644
+ var QRMath = function() {
 
 
 
 
 
 
 
1645
 
1646
+ var EXP_TABLE = new Array(256);
1647
+ var LOG_TABLE = new Array(256);
 
1648
 
1649
+ // initialize tables
1650
+ for (var i = 0; i < 8; i += 1) {
1651
+ EXP_TABLE[i] = 1 << i;
1652
+ }
1653
+ for (var i = 8; i < 256; i += 1) {
1654
+ EXP_TABLE[i] = EXP_TABLE[i - 4]
1655
+ ^ EXP_TABLE[i - 5]
1656
+ ^ EXP_TABLE[i - 6]
1657
+ ^ EXP_TABLE[i - 8];
1658
+ }
1659
+ for (var i = 0; i < 255; i += 1) {
1660
+ LOG_TABLE[EXP_TABLE[i] ] = i;
1661
+ }
1662
 
1663
+ var _this = {};
1664
 
1665
+ _this.glog = function(n) {
1666
 
1667
+ if (n < 1) {
1668
+ throw 'glog(' + n + ')';
1669
+ }
 
 
 
1670
 
1671
+ return LOG_TABLE[n];
1672
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1673
 
1674
+ _this.gexp = function(n) {
 
1675
 
1676
+ while (n < 0) {
1677
+ n += 255;
1678
+ }
1679
 
1680
+ while (n >= 256) {
1681
+ n -= 255;
1682
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1683
 
1684
+ return EXP_TABLE[n];
1685
+ };
 
1686
 
1687
+ return _this;
1688
+ }();
 
 
 
 
1689
 
1690
+ //---------------------------------------------------------------------
1691
+ // qrPolynomial
1692
+ //---------------------------------------------------------------------
1693
 
1694
+ function qrPolynomial(num, shift) {
 
 
 
 
 
1695
 
1696
+ if (typeof num.length == 'undefined') {
1697
+ throw num.length + '/' + shift;
1698
+ }
 
 
 
 
 
 
 
 
 
 
 
1699
 
1700
+ var _num = function() {
1701
+ var offset = 0;
1702
+ while (offset < num.length && num[offset] == 0) {
1703
+ offset += 1;
1704
+ }
1705
+ var _num = new Array(num.length - offset + shift);
1706
+ for (var i = 0; i < num.length - offset; i += 1) {
1707
+ _num[i] = num[i + offset];
1708
+ }
1709
+ return _num;
1710
+ }();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1711
 
1712
+ var _this = {};
 
 
 
 
 
 
1713
 
1714
+ _this.getAt = function(index) {
1715
+ return _num[index];
1716
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1717
 
1718
+ _this.getLength = function() {
1719
+ return _num.length;
1720
+ };
 
 
 
 
1721
 
1722
+ _this.multiply = function(e) {
1723
 
1724
+ var num = new Array(_this.getLength() + e.getLength() - 1);
1725
 
1726
+ for (var i = 0; i < _this.getLength(); i += 1) {
1727
+ for (var j = 0; j < e.getLength(); j += 1) {
1728
+ num[i + j] ^= QRMath.gexp(QRMath.glog(_this.getAt(i) ) + QRMath.glog(e.getAt(j) ) );
1729
+ }
1730
+ }
1731
 
1732
+ return qrPolynomial(num, 0);
1733
+ };
 
 
 
 
 
 
1734
 
1735
+ _this.mod = function(e) {
1736
 
1737
+ if (_this.getLength() - e.getLength() < 0) {
1738
+ return _this;
1739
+ }
1740
 
1741
+ var ratio = QRMath.glog(_this.getAt(0) ) - QRMath.glog(e.getAt(0) );
 
 
 
 
 
 
 
1742
 
1743
+ var num = new Array(_this.getLength() );
1744
+ for (var i = 0; i < _this.getLength(); i += 1) {
1745
+ num[i] = _this.getAt(i);
1746
+ }
1747
 
1748
+ for (var i = 0; i < e.getLength(); i += 1) {
1749
+ num[i] ^= QRMath.gexp(QRMath.glog(e.getAt(i) ) + ratio);
1750
+ }
1751
 
1752
+ // recursive call
1753
+ return qrPolynomial(num, 0).mod(e);
1754
+ };
 
 
 
 
 
1755
 
1756
+ return _this;
1757
+ };
1758
+
1759
+ //---------------------------------------------------------------------
1760
+ // QRRSBlock
1761
+ //---------------------------------------------------------------------
1762
+
1763
+ var QRRSBlock = function() {
1764
+
1765
+ var RS_BLOCK_TABLE = [
1766
+
1767
+ // L
1768
+ // M
1769
+ // Q
1770
+ // H
1771
+
1772
+ // 1
1773
+ [1, 26, 19],
1774
+ [1, 26, 16],
1775
+ [1, 26, 13],
1776
+ [1, 26, 9],
1777
+
1778
+ // 2
1779
+ [1, 44, 34],
1780
+ [1, 44, 28],
1781
+ [1, 44, 22],
1782
+ [1, 44, 16],
1783
+
1784
+ // 3
1785
+ [1, 70, 55],
1786
+ [1, 70, 44],
1787
+ [2, 35, 17],
1788
+ [2, 35, 13],
1789
+
1790
+ // 4
1791
+ [1, 100, 80],
1792
+ [2, 50, 32],
1793
+ [2, 50, 24],
1794
+ [4, 25, 9],
1795
+
1796
+ // 5
1797
+ [1, 134, 108],
1798
+ [2, 67, 43],
1799
+ [2, 33, 15, 2, 34, 16],
1800
+ [2, 33, 11, 2, 34, 12],
1801
+
1802
+ // 6
1803
+ [2, 86, 68],
1804
+ [4, 43, 27],
1805
+ [4, 43, 19],
1806
+ [4, 43, 15],
1807
+
1808
+ // 7
1809
+ [2, 98, 78],
1810
+ [4, 49, 31],
1811
+ [2, 32, 14, 4, 33, 15],
1812
+ [4, 39, 13, 1, 40, 14],
1813
+
1814
+ // 8
1815
+ [2, 121, 97],
1816
+ [2, 60, 38, 2, 61, 39],
1817
+ [4, 40, 18, 2, 41, 19],
1818
+ [4, 40, 14, 2, 41, 15],
1819
+
1820
+ // 9
1821
+ [2, 146, 116],
1822
+ [3, 58, 36, 2, 59, 37],
1823
+ [4, 36, 16, 4, 37, 17],
1824
+ [4, 36, 12, 4, 37, 13],
1825
+
1826
+ // 10
1827
+ [2, 86, 68, 2, 87, 69],
1828
+ [4, 69, 43, 1, 70, 44],
1829
+ [6, 43, 19, 2, 44, 20],
1830
+ [6, 43, 15, 2, 44, 16],
1831
+
1832
+ // 11
1833
+ [4, 101, 81],
1834
+ [1, 80, 50, 4, 81, 51],
1835
+ [4, 50, 22, 4, 51, 23],
1836
+ [3, 36, 12, 8, 37, 13],
1837
+
1838
+ // 12
1839
+ [2, 116, 92, 2, 117, 93],
1840
+ [6, 58, 36, 2, 59, 37],
1841
+ [4, 46, 20, 6, 47, 21],
1842
+ [7, 42, 14, 4, 43, 15],
1843
+
1844
+ // 13
1845
+ [4, 133, 107],
1846
+ [8, 59, 37, 1, 60, 38],
1847
+ [8, 44, 20, 4, 45, 21],
1848
+ [12, 33, 11, 4, 34, 12],
1849
+
1850
+ // 14
1851
+ [3, 145, 115, 1, 146, 116],
1852
+ [4, 64, 40, 5, 65, 41],
1853
+ [11, 36, 16, 5, 37, 17],
1854
+ [11, 36, 12, 5, 37, 13],
1855
+
1856
+ // 15
1857
+ [5, 109, 87, 1, 110, 88],
1858
+ [5, 65, 41, 5, 66, 42],
1859
+ [5, 54, 24, 7, 55, 25],
1860
+ [11, 36, 12, 7, 37, 13],
1861
+
1862
+ // 16
1863
+ [5, 122, 98, 1, 123, 99],
1864
+ [7, 73, 45, 3, 74, 46],
1865
+ [15, 43, 19, 2, 44, 20],
1866
+ [3, 45, 15, 13, 46, 16],
1867
+
1868
+ // 17
1869
+ [1, 135, 107, 5, 136, 108],
1870
+ [10, 74, 46, 1, 75, 47],
1871
+ [1, 50, 22, 15, 51, 23],
1872
+ [2, 42, 14, 17, 43, 15],
1873
+
1874
+ // 18
1875
+ [5, 150, 120, 1, 151, 121],
1876
+ [9, 69, 43, 4, 70, 44],
1877
+ [17, 50, 22, 1, 51, 23],
1878
+ [2, 42, 14, 19, 43, 15],
1879
+
1880
+ // 19
1881
+ [3, 141, 113, 4, 142, 114],
1882
+ [3, 70, 44, 11, 71, 45],
1883
+ [17, 47, 21, 4, 48, 22],
1884
+ [9, 39, 13, 16, 40, 14],
1885
+
1886
+ // 20
1887
+ [3, 135, 107, 5, 136, 108],
1888
+ [3, 67, 41, 13, 68, 42],
1889
+ [15, 54, 24, 5, 55, 25],
1890
+ [15, 43, 15, 10, 44, 16],
1891
+
1892
+ // 21
1893
+ [4, 144, 116, 4, 145, 117],
1894
+ [17, 68, 42],
1895
+ [17, 50, 22, 6, 51, 23],
1896
+ [19, 46, 16, 6, 47, 17],
1897
+
1898
+ // 22
1899
+ [2, 139, 111, 7, 140, 112],
1900
+ [17, 74, 46],
1901
+ [7, 54, 24, 16, 55, 25],
1902
+ [34, 37, 13],
1903
+
1904
+ // 23
1905
+ [4, 151, 121, 5, 152, 122],
1906
+ [4, 75, 47, 14, 76, 48],
1907
+ [11, 54, 24, 14, 55, 25],
1908
+ [16, 45, 15, 14, 46, 16],
1909
+
1910
+ // 24
1911
+ [6, 147, 117, 4, 148, 118],
1912
+ [6, 73, 45, 14, 74, 46],
1913
+ [11, 54, 24, 16, 55, 25],
1914
+ [30, 46, 16, 2, 47, 17],
1915
+
1916
+ // 25
1917
+ [8, 132, 106, 4, 133, 107],
1918
+ [8, 75, 47, 13, 76, 48],
1919
+ [7, 54, 24, 22, 55, 25],
1920
+ [22, 45, 15, 13, 46, 16],
1921
+
1922
+ // 26
1923
+ [10, 142, 114, 2, 143, 115],
1924
+ [19, 74, 46, 4, 75, 47],
1925
+ [28, 50, 22, 6, 51, 23],
1926
+ [33, 46, 16, 4, 47, 17],
1927
+
1928
+ // 27
1929
+ [8, 152, 122, 4, 153, 123],
1930
+ [22, 73, 45, 3, 74, 46],
1931
+ [8, 53, 23, 26, 54, 24],
1932
+ [12, 45, 15, 28, 46, 16],
1933
+
1934
+ // 28
1935
+ [3, 147, 117, 10, 148, 118],
1936
+ [3, 73, 45, 23, 74, 46],
1937
+ [4, 54, 24, 31, 55, 25],
1938
+ [11, 45, 15, 31, 46, 16],
1939
+
1940
+ // 29
1941
+ [7, 146, 116, 7, 147, 117],
1942
+ [21, 73, 45, 7, 74, 46],
1943
+ [1, 53, 23, 37, 54, 24],
1944
+ [19, 45, 15, 26, 46, 16],
1945
+
1946
+ // 30
1947
+ [5, 145, 115, 10, 146, 116],
1948
+ [19, 75, 47, 10, 76, 48],
1949
+ [15, 54, 24, 25, 55, 25],
1950
+ [23, 45, 15, 25, 46, 16],
1951
+
1952
+ // 31
1953
+ [13, 145, 115, 3, 146, 116],
1954
+ [2, 74, 46, 29, 75, 47],
1955
+ [42, 54, 24, 1, 55, 25],
1956
+ [23, 45, 15, 28, 46, 16],
1957
+
1958
+ // 32
1959
+ [17, 145, 115],
1960
+ [10, 74, 46, 23, 75, 47],
1961
+ [10, 54, 24, 35, 55, 25],
1962
+ [19, 45, 15, 35, 46, 16],
1963
+
1964
+ // 33
1965
+ [17, 145, 115, 1, 146, 116],
1966
+ [14, 74, 46, 21, 75, 47],
1967
+ [29, 54, 24, 19, 55, 25],
1968
+ [11, 45, 15, 46, 46, 16],
1969
+
1970
+ // 34
1971
+ [13, 145, 115, 6, 146, 116],
1972
+ [14, 74, 46, 23, 75, 47],
1973
+ [44, 54, 24, 7, 55, 25],
1974
+ [59, 46, 16, 1, 47, 17],
1975
+
1976
+ // 35
1977
+ [12, 151, 121, 7, 152, 122],
1978
+ [12, 75, 47, 26, 76, 48],
1979
+ [39, 54, 24, 14, 55, 25],
1980
+ [22, 45, 15, 41, 46, 16],
1981
+
1982
+ // 36
1983
+ [6, 151, 121, 14, 152, 122],
1984
+ [6, 75, 47, 34, 76, 48],
1985
+ [46, 54, 24, 10, 55, 25],
1986
+ [2, 45, 15, 64, 46, 16],
1987
+
1988
+ // 37
1989
+ [17, 152, 122, 4, 153, 123],
1990
+ [29, 74, 46, 14, 75, 47],
1991
+ [49, 54, 24, 10, 55, 25],
1992
+ [24, 45, 15, 46, 46, 16],
1993
+
1994
+ // 38
1995
+ [4, 152, 122, 18, 153, 123],
1996
+ [13, 74, 46, 32, 75, 47],
1997
+ [48, 54, 24, 14, 55, 25],
1998
+ [42, 45, 15, 32, 46, 16],
1999
+
2000
+ // 39
2001
+ [20, 147, 117, 4, 148, 118],
2002
+ [40, 75, 47, 7, 76, 48],
2003
+ [43, 54, 24, 22, 55, 25],
2004
+ [10, 45, 15, 67, 46, 16],
2005
+
2006
+ // 40
2007
+ [19, 148, 118, 6, 149, 119],
2008
+ [18, 75, 47, 31, 76, 48],
2009
+ [34, 54, 24, 34, 55, 25],
2010
+ [20, 45, 15, 61, 46, 16]
2011
+ ];
2012
+
2013
+ var qrRSBlock = function(totalCount, dataCount) {
2014
+ var _this = {};
2015
+ _this.totalCount = totalCount;
2016
+ _this.dataCount = dataCount;
2017
+ return _this;
2018
+ };
2019
 
2020
+ var _this = {};
2021
 
2022
+ var getRsBlockTable = function(typeNumber, errorCorrectionLevel) {
2023
 
2024
+ switch(errorCorrectionLevel) {
2025
+ case QRErrorCorrectionLevel.L :
2026
+ return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];
2027
+ case QRErrorCorrectionLevel.M :
2028
+ return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
2029
+ case QRErrorCorrectionLevel.Q :
2030
+ return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
2031
+ case QRErrorCorrectionLevel.H :
2032
+ return RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
2033
+ default :
2034
+ return undefined;
2035
+ }
2036
+ };
2037
 
2038
+ _this.getRSBlocks = function(typeNumber, errorCorrectionLevel) {
2039
 
2040
+ var rsBlock = getRsBlockTable(typeNumber, errorCorrectionLevel);
 
2041
 
2042
+ if (typeof rsBlock == 'undefined') {
2043
+ throw 'bad rs block @ typeNumber:' + typeNumber +
2044
+ '/errorCorrectionLevel:' + errorCorrectionLevel;
2045
+ }
2046
 
2047
+ var length = rsBlock.length / 3;
2048
 
2049
+ var list = [];
 
 
2050
 
2051
+ for (var i = 0; i < length; i += 1) {
2052
 
2053
+ var count = rsBlock[i * 3 + 0];
2054
+ var totalCount = rsBlock[i * 3 + 1];
2055
+ var dataCount = rsBlock[i * 3 + 2];
2056
 
2057
+ for (var j = 0; j < count; j += 1) {
2058
+ list.push(qrRSBlock(totalCount, dataCount) );
2059
+ }
2060
+ }
2061
 
2062
+ return list;
2063
+ };
 
 
 
2064
 
2065
+ return _this;
2066
+ }();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2067
 
2068
+ //---------------------------------------------------------------------
2069
+ // qrBitBuffer
2070
+ //---------------------------------------------------------------------
 
 
 
 
 
 
 
 
 
 
 
 
2071
 
2072
+ var qrBitBuffer = function() {
 
 
 
 
 
 
 
 
 
 
 
 
2073
 
2074
+ var _buffer = [];
2075
+ var _length = 0;
2076
 
2077
+ var _this = {};
2078
 
2079
+ _this.getBuffer = function() {
2080
+ return _buffer;
2081
+ };
 
 
 
 
2082
 
2083
+ _this.getAt = function(index) {
2084
+ var bufIndex = Math.floor(index / 8);
2085
+ return ( (_buffer[bufIndex] >>> (7 - index % 8) ) & 1) == 1;
2086
+ };
2087
 
2088
+ _this.put = function(num, length) {
2089
+ for (var i = 0; i < length; i += 1) {
2090
+ _this.putBit( ( (num >>> (length - i - 1) ) & 1) == 1);
2091
+ }
2092
+ };
2093
 
2094
+ _this.getLengthInBits = function() {
2095
+ return _length;
2096
+ };
2097
 
2098
+ _this.putBit = function(bit) {
 
 
2099
 
2100
+ var bufIndex = Math.floor(_length / 8);
2101
+ if (_buffer.length <= bufIndex) {
2102
+ _buffer.push(0);
2103
+ }
2104
 
2105
+ if (bit) {
2106
+ _buffer[bufIndex] |= (0x80 >>> (_length % 8) );
2107
+ }
2108
 
2109
+ _length += 1;
2110
+ };
 
 
 
 
 
 
 
 
 
 
 
2111
 
2112
+ return _this;
2113
+ };
2114
 
2115
+ //---------------------------------------------------------------------
2116
+ // qrNumber
2117
+ //---------------------------------------------------------------------
2118
 
2119
+ var qrNumber = function(data) {
 
 
2120
 
2121
+ var _mode = QRMode.MODE_NUMBER;
2122
+ var _data = data;
2123
 
2124
+ var _this = {};
2125
 
2126
+ _this.getMode = function() {
2127
+ return _mode;
2128
+ };
2129
 
2130
+ _this.getLength = function(buffer) {
2131
+ return _data.length;
2132
+ };
2133
 
2134
+ _this.write = function(buffer) {
 
2135
 
2136
+ var data = _data;
 
2137
 
2138
+ var i = 0;
 
 
2139
 
2140
+ while (i + 2 < data.length) {
2141
+ buffer.put(strToNum(data.substring(i, i + 3) ), 10);
2142
+ i += 3;
2143
+ }
2144
 
2145
+ if (i < data.length) {
2146
+ if (data.length - i == 1) {
2147
+ buffer.put(strToNum(data.substring(i, i + 1) ), 4);
2148
+ } else if (data.length - i == 2) {
2149
+ buffer.put(strToNum(data.substring(i, i + 2) ), 7);
2150
  }
2151
+ }
2152
+ };
2153
 
2154
+ var strToNum = function(s) {
2155
+ var num = 0;
2156
+ for (var i = 0; i < s.length; i += 1) {
2157
+ num = num * 10 + chatToNum(s.charAt(i) );
2158
+ }
2159
+ return num;
2160
+ };
 
 
 
 
 
 
2161
 
2162
+ var chatToNum = function(c) {
2163
+ if ('0' <= c && c <= '9') {
2164
+ return c.charCodeAt(0) - '0'.charCodeAt(0);
2165
+ }
2166
+ throw 'illegal char :' + c;
2167
+ };
2168
 
2169
+ return _this;
2170
+ };
 
2171
 
2172
+ //---------------------------------------------------------------------
2173
+ // qrAlphaNum
2174
+ //---------------------------------------------------------------------
2175
 
2176
+ var qrAlphaNum = function(data) {
2177
 
2178
+ var _mode = QRMode.MODE_ALPHA_NUM;
2179
+ var _data = data;
 
 
 
2180
 
2181
+ var _this = {};
 
2182
 
2183
+ _this.getMode = function() {
2184
+ return _mode;
2185
+ };
2186
 
2187
+ _this.getLength = function(buffer) {
2188
+ return _data.length;
2189
+ };
2190
 
2191
+ _this.write = function(buffer) {
2192
 
2193
+ var s = _data;
 
 
 
2194
 
2195
+ var i = 0;
 
 
2196
 
2197
+ while (i + 1 < s.length) {
2198
+ buffer.put(
2199
+ getCode(s.charAt(i) ) * 45 +
2200
+ getCode(s.charAt(i + 1) ), 11);
2201
+ i += 2;
2202
+ }
2203
 
2204
+ if (i < s.length) {
2205
+ buffer.put(getCode(s.charAt(i) ), 6);
2206
+ }
2207
+ };
2208
 
2209
+ var getCode = function(c) {
2210
+
2211
+ if ('0' <= c && c <= '9') {
2212
+ return c.charCodeAt(0) - '0'.charCodeAt(0);
2213
+ } else if ('A' <= c && c <= 'Z') {
2214
+ return c.charCodeAt(0) - 'A'.charCodeAt(0) + 10;
2215
+ } else {
2216
+ switch (c) {
2217
+ case ' ' : return 36;
2218
+ case '$' : return 37;
2219
+ case '%' : return 38;
2220
+ case '*' : return 39;
2221
+ case '+' : return 40;
2222
+ case '-' : return 41;
2223
+ case '.' : return 42;
2224
+ case '/' : return 43;
2225
+ case ':' : return 44;
2226
+ default :
2227
+ throw 'illegal char :' + c;
2228
+ }
2229
+ }
2230
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2231
 
2232
+ return _this;
2233
+ };
2234
 
2235
+ //---------------------------------------------------------------------
2236
+ // qr8BitByte
2237
+ //---------------------------------------------------------------------
2238
 
2239
+ var qr8BitByte = function(data) {
 
 
 
2240
 
2241
+ var _mode = QRMode.MODE_8BIT_BYTE;
2242
+ var _data = data;
2243
+ var _bytes = qrcode.stringToBytes(data);
2244
 
2245
+ var _this = {};
2246
 
2247
+ _this.getMode = function() {
2248
+ return _mode;
2249
+ };
2250
 
2251
+ _this.getLength = function(buffer) {
2252
+ return _bytes.length;
2253
+ };
2254
 
2255
+ _this.write = function(buffer) {
2256
+ for (var i = 0; i < _bytes.length; i += 1) {
2257
+ buffer.put(_bytes[i], 8);
2258
+ }
2259
+ };
2260
 
2261
+ return _this;
2262
+ };
2263
 
2264
+ //---------------------------------------------------------------------
2265
+ // qrKanji
2266
+ //---------------------------------------------------------------------
2267
 
2268
+ var qrKanji = function(data) {
 
 
2269
 
2270
+ var _mode = QRMode.MODE_KANJI;
2271
+ var _data = data;
2272
 
2273
+ var stringToBytes = qrcode.stringToBytesFuncs['SJIS'];
2274
+ if (!stringToBytes) {
2275
+ throw 'sjis not supported.';
2276
+ }
2277
+ !function(c, code) {
2278
+ // self test for sjis support.
2279
+ var test = stringToBytes(c);
2280
+ if (test.length != 2 || ( (test[0] << 8) | test[1]) != code) {
2281
+ throw 'sjis not supported.';
2282
+ }
2283
+ }('\u53cb', 0x9746);
2284
 
2285
+ var _bytes = stringToBytes(data);
2286
 
2287
+ var _this = {};
 
 
2288
 
2289
+ _this.getMode = function() {
2290
+ return _mode;
2291
+ };
 
2292
 
2293
+ _this.getLength = function(buffer) {
2294
+ return ~~(_bytes.length / 2);
2295
+ };
 
 
2296
 
2297
+ _this.write = function(buffer) {
 
 
2298
 
2299
+ var data = _bytes;
2300
 
2301
+ var i = 0;
 
 
 
2302
 
2303
+ while (i + 1 < data.length) {
 
 
2304
 
2305
+ var c = ( (0xff & data[i]) << 8) | (0xff & data[i + 1]);
 
2306
 
2307
+ if (0x8140 <= c && c <= 0x9FFC) {
2308
+ c -= 0x8140;
2309
+ } else if (0xE040 <= c && c <= 0xEBBF) {
2310
+ c -= 0xC140;
2311
+ } else {
2312
+ throw 'illegal char at ' + (i + 1) + '/' + c;
2313
+ }
2314
 
2315
+ c = ( (c >>> 8) & 0xff) * 0xC0 + (c & 0xff);
 
 
2316
 
2317
+ buffer.put(c, 13);
2318
 
2319
+ i += 2;
2320
+ }
 
2321
 
2322
+ if (i < data.length) {
2323
+ throw 'illegal char at ' + (i + 1);
2324
+ }
2325
+ };
2326
 
2327
+ return _this;
2328
+ };
 
2329
 
2330
+ //=====================================================================
2331
+ // GIF Support etc.
2332
+ //
2333
 
2334
+ //---------------------------------------------------------------------
2335
+ // byteArrayOutputStream
2336
+ //---------------------------------------------------------------------
 
 
2337
 
2338
+ var byteArrayOutputStream = function() {
 
2339
 
2340
+ var _bytes = [];
 
 
2341
 
2342
+ var _this = {};
 
 
2343
 
2344
+ _this.writeByte = function(b) {
2345
+ _bytes.push(b & 0xff);
2346
+ };
2347
 
2348
+ _this.writeShort = function(i) {
2349
+ _this.writeByte(i);
2350
+ _this.writeByte(i >>> 8);
2351
+ };
2352
 
2353
+ _this.writeBytes = function(b, off, len) {
2354
+ off = off || 0;
2355
+ len = len || b.length;
2356
+ for (var i = 0; i < len; i += 1) {
2357
+ _this.writeByte(b[i + off]);
2358
+ }
2359
+ };
2360
 
2361
+ _this.writeString = function(s) {
2362
+ for (var i = 0; i < s.length; i += 1) {
2363
+ _this.writeByte(s.charCodeAt(i) );
2364
+ }
2365
+ };
2366
 
2367
+ _this.toByteArray = function() {
2368
+ return _bytes;
2369
+ };
 
2370
 
2371
+ _this.toString = function() {
2372
+ var s = '';
2373
+ s += '[';
2374
+ for (var i = 0; i < _bytes.length; i += 1) {
2375
+ if (i > 0) {
2376
+ s += ',';
2377
+ }
2378
+ s += _bytes[i];
2379
+ }
2380
+ s += ']';
2381
+ return s;
2382
+ };
2383
 
2384
+ return _this;
2385
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2386
 
2387
+ //---------------------------------------------------------------------
2388
+ // base64EncodeOutputStream
2389
+ //---------------------------------------------------------------------
2390
 
2391
+ var base64EncodeOutputStream = function() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2392
 
2393
+ var _buffer = 0;
2394
+ var _buflen = 0;
2395
+ var _length = 0;
2396
+ var _base64 = '';
2397
 
2398
+ var _this = {};
 
 
2399
 
2400
+ var writeEncoded = function(b) {
2401
+ _base64 += String.fromCharCode(encode(b & 0x3f) );
2402
+ };
 
 
2403
 
2404
+ var encode = function(n) {
2405
+ if (n < 0) {
2406
+ // error.
2407
+ } else if (n < 26) {
2408
+ return 0x41 + n;
2409
+ } else if (n < 52) {
2410
+ return 0x61 + (n - 26);
2411
+ } else if (n < 62) {
2412
+ return 0x30 + (n - 52);
2413
+ } else if (n == 62) {
2414
+ return 0x2b;
2415
+ } else if (n == 63) {
2416
+ return 0x2f;
2417
+ }
2418
+ throw 'n:' + n;
2419
+ };
2420
 
2421
+ _this.writeByte = function(n) {
 
 
 
 
2422
 
2423
+ _buffer = (_buffer << 8) | (n & 0xff);
2424
+ _buflen += 8;
2425
+ _length += 1;
 
 
 
 
 
2426
 
2427
+ while (_buflen >= 6) {
2428
+ writeEncoded(_buffer >>> (_buflen - 6) );
2429
+ _buflen -= 6;
2430
+ }
2431
+ };
2432
 
2433
+ _this.flush = function() {
 
2434
 
2435
+ if (_buflen > 0) {
2436
+ writeEncoded(_buffer << (6 - _buflen) );
2437
+ _buffer = 0;
2438
+ _buflen = 0;
2439
+ }
2440
 
2441
+ if (_length % 3 != 0) {
2442
+ // padding
2443
+ var padlen = 3 - _length % 3;
2444
+ for (var i = 0; i < padlen; i += 1) {
2445
+ _base64 += '=';
2446
+ }
2447
+ }
2448
+ };
2449
 
2450
+ _this.toString = function() {
2451
+ return _base64;
2452
+ };
 
2453
 
2454
+ return _this;
2455
+ };
2456
 
2457
+ //---------------------------------------------------------------------
2458
+ // base64DecodeInputStream
2459
+ //---------------------------------------------------------------------
2460
 
2461
+ var base64DecodeInputStream = function(str) {
2462
 
2463
+ var _str = str;
2464
+ var _pos = 0;
2465
+ var _buffer = 0;
2466
+ var _buflen = 0;
 
 
2467
 
2468
+ var _this = {};
 
2469
 
2470
+ _this.read = function() {
 
 
 
 
 
 
2471
 
2472
+ while (_buflen < 8) {
 
 
2473
 
2474
+ if (_pos >= _str.length) {
2475
+ if (_buflen == 0) {
2476
+ return -1;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2477
  }
2478
+ throw 'unexpected end of file./' + _buflen;
2479
+ }
2480
 
2481
+ var c = _str.charAt(_pos);
2482
+ _pos += 1;
2483
 
2484
+ if (c == '=') {
2485
+ _buflen = 0;
2486
+ return -1;
2487
+ } else if (c.match(/^\s$/) ) {
2488
+ // ignore if whitespace.
2489
+ continue;
2490
+ }
2491
 
2492
+ _buffer = (_buffer << 6) | decode(c.charCodeAt(0) );
2493
+ _buflen += 6;
2494
+ }
2495
 
2496
+ var n = (_buffer >>> (_buflen - 8) ) & 0xff;
2497
+ _buflen -= 8;
2498
+ return n;
2499
+ };
2500
 
2501
+ var decode = function(c) {
2502
+ if (0x41 <= c && c <= 0x5a) {
2503
+ return c - 0x41;
2504
+ } else if (0x61 <= c && c <= 0x7a) {
2505
+ return c - 0x61 + 26;
2506
+ } else if (0x30 <= c && c <= 0x39) {
2507
+ return c - 0x30 + 52;
2508
+ } else if (c == 0x2b) {
2509
+ return 62;
2510
+ } else if (c == 0x2f) {
2511
+ return 63;
2512
+ } else {
2513
+ throw 'c:' + c;
2514
+ }
2515
+ };
2516
 
2517
+ return _this;
2518
+ };
 
2519
 
2520
+ //---------------------------------------------------------------------
2521
+ // gifImage (B/W)
2522
+ //---------------------------------------------------------------------
2523
 
2524
+ var gifImage = function(width, height) {
 
2525
 
2526
+ var _width = width;
2527
+ var _height = height;
2528
+ var _data = new Array(width * height);
2529
 
2530
+ var _this = {};
 
2531
 
2532
+ _this.setPixel = function(x, y, pixel) {
2533
+ _data[y * _width + x] = pixel;
2534
+ };
2535
 
2536
+ _this.write = function(out) {
 
 
2537
 
2538
+ //---------------------------------
2539
+ // GIF Signature
2540
 
2541
+ out.writeString('GIF87a');
 
 
 
2542
 
2543
+ //---------------------------------
2544
+ // Screen Descriptor
 
 
2545
 
2546
+ out.writeShort(_width);
2547
+ out.writeShort(_height);
2548
 
2549
+ out.writeByte(0x80); // 2bit
2550
+ out.writeByte(0);
2551
+ out.writeByte(0);
 
 
 
2552
 
2553
+ //---------------------------------
2554
+ // Global Color Map
2555
 
2556
+ // black
2557
+ out.writeByte(0x00);
2558
+ out.writeByte(0x00);
2559
+ out.writeByte(0x00);
2560
 
2561
+ // white
2562
+ out.writeByte(0xff);
2563
+ out.writeByte(0xff);
2564
+ out.writeByte(0xff);
2565
 
2566
+ //---------------------------------
2567
+ // Image Descriptor
2568
 
2569
+ out.writeString(',');
2570
+ out.writeShort(0);
2571
+ out.writeShort(0);
2572
+ out.writeShort(_width);
2573
+ out.writeShort(_height);
2574
+ out.writeByte(0);
2575
 
2576
+ //---------------------------------
2577
+ // Local Color Map
 
 
 
2578
 
2579
+ //---------------------------------
2580
+ // Raster Data
 
2581
 
2582
+ var lzwMinCodeSize = 2;
2583
+ var raster = getLZWRaster(lzwMinCodeSize);
 
 
2584
 
2585
+ out.writeByte(lzwMinCodeSize);
2586
 
2587
+ var offset = 0;
 
 
2588
 
2589
+ while (raster.length - offset > 255) {
2590
+ out.writeByte(255);
2591
+ out.writeBytes(raster, offset, 255);
2592
+ offset += 255;
2593
+ }
2594
 
2595
+ out.writeByte(raster.length - offset);
2596
+ out.writeBytes(raster, offset, raster.length - offset);
2597
+ out.writeByte(0x00);
2598
 
2599
+ //---------------------------------
2600
+ // GIF Terminator
2601
+ out.writeString(';');
2602
+ };
2603
 
2604
+ var bitOutputStream = function(out) {
 
 
 
 
 
 
2605
 
2606
+ var _out = out;
2607
+ var _bitLength = 0;
2608
+ var _bitBuffer = 0;
2609
 
2610
+ var _this = {};
 
 
 
 
2611
 
2612
+ _this.write = function(data, length) {
 
2613
 
2614
+ if ( (data >>> length) != 0) {
2615
+ throw 'length over';
2616
+ }
2617
 
2618
+ while (_bitLength + length >= 8) {
2619
+ _out.writeByte(0xff & ( (data << _bitLength) | _bitBuffer) );
2620
+ length -= (8 - _bitLength);
2621
+ data >>>= (8 - _bitLength);
2622
+ _bitBuffer = 0;
2623
+ _bitLength = 0;
2624
+ }
2625
 
2626
+ _bitBuffer = (data << _bitLength) | _bitBuffer;
2627
+ _bitLength = _bitLength + length;
2628
+ };
2629
 
2630
+ _this.flush = function() {
2631
+ if (_bitLength > 0) {
2632
+ _out.writeByte(_bitBuffer);
2633
+ }
2634
+ };
2635
 
2636
+ return _this;
2637
+ };
2638
 
2639
+ var getLZWRaster = function(lzwMinCodeSize) {
 
2640
 
2641
+ var clearCode = 1 << lzwMinCodeSize;
2642
+ var endCode = (1 << lzwMinCodeSize) + 1;
2643
+ var bitLength = lzwMinCodeSize + 1;
2644
 
2645
+ // Setup LZWTable
2646
+ var table = lzwTable();
2647
 
2648
+ for (var i = 0; i < clearCode; i += 1) {
2649
+ table.add(String.fromCharCode(i) );
2650
+ }
2651
+ table.add(String.fromCharCode(clearCode) );
2652
+ table.add(String.fromCharCode(endCode) );
2653
 
2654
+ var byteOut = byteArrayOutputStream();
2655
+ var bitOut = bitOutputStream(byteOut);
2656
 
2657
+ // clear code
2658
+ bitOut.write(clearCode, bitLength);
2659
 
2660
+ var dataIndex = 0;
2661
 
2662
+ var s = String.fromCharCode(_data[dataIndex]);
2663
+ dataIndex += 1;
2664
 
2665
+ while (dataIndex < _data.length) {
2666
 
2667
+ var c = String.fromCharCode(_data[dataIndex]);
2668
+ dataIndex += 1;
2669
 
2670
+ if (table.contains(s + c) ) {
 
 
2671
 
2672
+ s = s + c;
 
2673
 
2674
+ } else {
 
 
2675
 
2676
  bitOut.write(table.indexOf(s), bitLength);
2677
 
2678
+ if (table.size() < 0xfff) {
 
2679
 
2680
+ if (table.size() == (1 << bitLength) ) {
2681
+ bitLength += 1;
2682
+ }
2683
 
2684
+ table.add(s + c);
2685
+ }
2686
 
2687
+ s = c;
2688
+ }
2689
+ }
2690
 
2691
+ bitOut.write(table.indexOf(s), bitLength);
 
2692
 
2693
+ // end code
2694
+ bitOut.write(endCode, bitLength);
2695
 
2696
+ bitOut.flush();
 
 
 
 
 
 
2697
 
2698
+ return byteOut.toByteArray();
2699
+ };
 
2700
 
2701
+ var lzwTable = function() {
 
 
2702
 
2703
+ var _map = {};
2704
+ var _size = 0;
 
2705
 
2706
+ var _this = {};
 
2707
 
2708
+ _this.add = function(key) {
2709
+ if (_this.contains(key) ) {
2710
+ throw 'dup key:' + key;
2711
+ }
2712
+ _map[key] = _size;
2713
+ _size += 1;
2714
  };
2715
 
2716
+ _this.size = function() {
2717
+ return _size;
2718
+ };
 
 
 
 
 
2719
 
2720
+ _this.indexOf = function(key) {
2721
+ return _map[key];
2722
+ };
2723
 
2724
+ _this.contains = function(key) {
2725
+ return typeof _map[key] != 'undefined';
2726
+ };
 
 
 
2727
 
2728
+ return _this;
2729
+ };
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2730
 
2731
+ return _this;
2732
+ };
2733
 
2734
+ var createDataURL = function(width, height, getPixel) {
2735
+ var gif = gifImage(width, height);
2736
+ for (var y = 0; y < height; y += 1) {
2737
+ for (var x = 0; x < width; x += 1) {
2738
+ gif.setPixel(x, y, getPixel(x, y) );
2739
+ }
2740
+ }
2741
 
2742
+ var b = byteArrayOutputStream();
2743
+ gif.write(b);
2744
 
2745
+ var base64 = base64EncodeOutputStream();
2746
+ var bytes = b.toByteArray();
2747
+ for (var i = 0; i < bytes.length; i += 1) {
2748
+ base64.writeByte(bytes[i]);
2749
+ }
2750
+ base64.flush();
2751
+
2752
+ return 'data:image/gif;base64,' + base64;
2753
+ };
2754
+
2755
+ //---------------------------------------------------------------------
2756
+ // returns qrcode function.
2757
+
2758
+ return qrcode;
2759
+ }();
2760
+
2761
+ // multibyte support
2762
+ !function() {
2763
+
2764
+ qrcode.stringToBytesFuncs['UTF-8'] = function(s) {
2765
+ // http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array
2766
+ function toUTF8Array(str) {
2767
+ var utf8 = [];
2768
+ for (var i=0; i < str.length; i++) {
2769
+ var charcode = str.charCodeAt(i);
2770
+ if (charcode < 0x80) utf8.push(charcode);
2771
+ else if (charcode < 0x800) {
2772
+ utf8.push(0xc0 | (charcode >> 6),
2773
+ 0x80 | (charcode & 0x3f));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2774
  }
2775
+ else if (charcode < 0xd800 || charcode >= 0xe000) {
2776
+ utf8.push(0xe0 | (charcode >> 12),
2777
+ 0x80 | ((charcode>>6) & 0x3f),
2778
+ 0x80 | (charcode & 0x3f));
2779
+ }
2780
+ // surrogate pair
2781
+ else {
2782
+ i++;
2783
+ // UTF-16 encodes 0x10000-0x10FFFF by
2784
+ // subtracting 0x10000 and splitting the
2785
+ // 20 bits of 0x0-0xFFFFF into two halves
2786
+ charcode = 0x10000 + (((charcode & 0x3ff)<<10)
2787
+ | (str.charCodeAt(i) & 0x3ff));
2788
+ utf8.push(0xf0 | (charcode >>18),
2789
+ 0x80 | ((charcode>>12) & 0x3f),
2790
+ 0x80 | ((charcode>>6) & 0x3f),
2791
+ 0x80 | (charcode & 0x3f));
2792
+ }
2793
+ }
2794
+ return utf8;
2795
+ }
2796
+ return toUTF8Array(s);
2797
+ };
2798
+
2799
+ }();
2800
+
2801
+ (function (factory) {
2802
+ if (true) {
2803
+ !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
2804
+ __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
2805
+ (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
2806
+ __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
2807
+ } else {}
2808
+ }(function () {
2809
+ return qrcode;
2810
+ }));
2811
 
 
2812
 
2813
+ /***/ })
2814
+ /******/ ]);
 
 
 
 
2815
  });
includes/js/pointers.js CHANGED
@@ -342,8 +342,6 @@
342
  jQuery('#mo_wpns_support_layout_tour').css('position','relative');
343
  break;
344
  case '#mo_wpns_support_layout_tour':
345
- document.getElementById("myForm").style.display = "block";
346
- document.getElementById("feedback_form_bg").style.display = "block";
347
  jQuery('#GoogleAuthenticator_thumbnail_2_factor').css('opacity',1);
348
  jQuery('#miniOrangeQRCodeAuthentication_thumbnail_2_factor').css('opacity',1);
349
  jQuery('#SecurityQuestions_thumbnail_2_factor').css('opacity',1);
@@ -352,20 +350,7 @@
352
  jQuery('#OTPOverSMS_thumbnail_2_factor').css('opacity',1);
353
  jQuery('#OTPOverEmail_thumbnail_2_factor').css('opacity',1);
354
  break;
355
- case '#mo_wpns_support_layout_tour_open':
356
- document.getElementById("myForm").style.display = "none";
357
- document.getElementById("feedback_form_bg").style.display = "none";
358
-
359
-
360
- jQuery('#GoogleAuthenticator_thumbnail_2_factor').css('opacity',1);
361
- jQuery('#miniOrangeQRCodeAuthentication_thumbnail_2_factor').css('opacity',1);
362
- jQuery('#SecurityQuestions_thumbnail_2_factor').css('opacity',1);
363
- jQuery('#miniOrangeSoftToken_thumbnail_2_factor').css('opacity',1);
364
- jQuery('#miniOrangePushNotification_thumbnail_2_factor').css('opacity',1);
365
- jQuery('#OTPOverSMS_thumbnail_2_factor').css('opacity',1);
366
- jQuery('#OTPOverEmail_thumbnail_2_factor').css('opacity',1);
367
-
368
- break;
369
 
370
  }
371
  }
@@ -385,13 +370,8 @@
385
  jQuery('#mo_2fa_upgrade_tour').css('z-index',1);
386
  break;
387
  case '#mo_wpns_support_layout_tour':
388
- document.getElementById("myForm").style.display = "block";
389
- document.getElementById("feedback_form_bg").style.display = "block";
390
- break;
391
- case '#mo_wpns_support_layout_tour_open':
392
- document.getElementById("myForm").style.display = "none";
393
- document.getElementById("feedback_form_bg").style.display = "none";
394
  break;
 
395
  }
396
 
397
  }
@@ -411,12 +391,6 @@
411
  jQuery('#mo_2fa_upgrade_tour').css('z-index',1);
412
  break;
413
  case '#mo_wpns_support_layout_tour':
414
- document.getElementById("myForm").style.display = "block";
415
- document.getElementById("feedback_form_bg").style.display = "block";
416
- break;
417
- case '#mo_wpns_support_layout_tour_open':
418
- document.getElementById("myForm").style.display = "none";
419
- document.getElementById("feedback_form_bg").style.display = "none";
420
  break;
421
  }
422
  }
@@ -437,12 +411,6 @@
437
  jQuery('#mo_2fa_upgrade_tour').css('z-index',1);
438
  break;
439
  case '#mo_wpns_support_layout_tour':
440
- document.getElementById("myForm").style.display = "block";
441
- document.getElementById("feedback_form_bg").style.display = "block";
442
- break;
443
- case '#mo_wpns_support_layout_tour_open':
444
- document.getElementById("myForm").style.display = "none";
445
- document.getElementById("feedback_form_bg").style.display = "none";
446
  break;
447
  }
448
  }
@@ -470,16 +438,7 @@
470
  else if(data.anchor_id =='#mo2f_country_blocking')
471
  jQuery('#mo_2fa_upgrade_tour').css('z-index',1);
472
 
473
- else if(data.anchor_id == '#mo_wpns_support_layout_tour')
474
- {
475
- document.getElementById("myForm").style.display = "block";
476
- document.getElementById("feedback_form_bg").style.display = "block";
477
- }
478
- else if(data.anchor_id == '#mo_wpns_support_layout_tour_open')
479
- {
480
- document.getElementById("myForm").style.display = "none";
481
- document.getElementById("feedback_form_bg").style.display = "none";
482
- }
483
  }
484
  else if(data.isBackup =='yes')
485
  {
@@ -496,12 +455,6 @@
496
  document.getElementById('backup_set').click();
497
  break;
498
  case '#mo_wpns_support_layout_tour':
499
- document.getElementById("myForm").style.display = "block";
500
- document.getElementById("feedback_form_bg").style.display = "block";
501
- break;
502
- case '#mo_wpns_support_layout_tour_open':
503
- document.getElementById("myForm").style.display = "none";
504
- document.getElementById("feedback_form_bg").style.display = "none";
505
  break;
506
  }
507
  }
342
  jQuery('#mo_wpns_support_layout_tour').css('position','relative');
343
  break;
344
  case '#mo_wpns_support_layout_tour':
 
 
345
  jQuery('#GoogleAuthenticator_thumbnail_2_factor').css('opacity',1);
346
  jQuery('#miniOrangeQRCodeAuthentication_thumbnail_2_factor').css('opacity',1);
347
  jQuery('#SecurityQuestions_thumbnail_2_factor').css('opacity',1);
350
  jQuery('#OTPOverSMS_thumbnail_2_factor').css('opacity',1);
351
  jQuery('#OTPOverEmail_thumbnail_2_factor').css('opacity',1);
352
  break;
353
+
 
 
 
 
 
 
 
 
 
 
 
 
 
354
 
355
  }
356
  }
370
  jQuery('#mo_2fa_upgrade_tour').css('z-index',1);
371
  break;
372
  case '#mo_wpns_support_layout_tour':
 
 
 
 
 
 
373
  break;
374
+
375
  }
376
 
377
  }
391
  jQuery('#mo_2fa_upgrade_tour').css('z-index',1);
392
  break;
393
  case '#mo_wpns_support_layout_tour':
 
 
 
 
 
 
394
  break;
395
  }
396
  }
411
  jQuery('#mo_2fa_upgrade_tour').css('z-index',1);
412
  break;
413
  case '#mo_wpns_support_layout_tour':
 
 
 
 
 
 
414
  break;
415
  }
416
  }
438
  else if(data.anchor_id =='#mo2f_country_blocking')
439
  jQuery('#mo_2fa_upgrade_tour').css('z-index',1);
440
 
441
+
 
 
 
 
 
 
 
 
 
442
  }
443
  else if(data.isBackup =='yes')
444
  {
455
  document.getElementById('backup_set').click();
456
  break;
457
  case '#mo_wpns_support_layout_tour':
 
 
 
 
 
 
458
  break;
459
  }
460
  }
miniorange_2_factor_settings.php CHANGED
@@ -3,13 +3,13 @@
3
  * Plugin Name: miniOrange 2 Factor Authentication
4
  * Plugin URI: https://miniorange.com
5
  * Description: This plugin provides various two-factor authentication methods as an additional layer of security after the default wordpress login. We Support Google/Authy/LastPass Authenticator, QR Code, Push Notification, Soft Token and Security Questions(KBA) for 1 User in the free version of the plugin.
6
- * Version: 5.4.9
7
  * Author: miniOrange
8
  * Author URI: https://miniorange.com
9
  * License: GPL2
10
  */
11
  define( 'MO_HOST_NAME', 'https://login.xecurify.com' );
12
- define( 'MO2F_VERSION', '5.4.9' );
13
  define( 'MO2F_TEST_MODE', false );
14
  define( 'MO2F_IS_ONPREM', get_option('is_onprem'));
15
  class Miniorange_twoFactor{
@@ -512,4 +512,4 @@
512
  }
513
 
514
  new Miniorange_twoFactor;
515
- ?>
3
  * Plugin Name: miniOrange 2 Factor Authentication
4
  * Plugin URI: https://miniorange.com
5
  * Description: This plugin provides various two-factor authentication methods as an additional layer of security after the default wordpress login. We Support Google/Authy/LastPass Authenticator, QR Code, Push Notification, Soft Token and Security Questions(KBA) for 1 User in the free version of the plugin.
6
+ * Version: 5.4.12
7
  * Author: miniOrange
8
  * Author URI: https://miniorange.com
9
  * License: GPL2
10
  */
11
  define( 'MO_HOST_NAME', 'https://login.xecurify.com' );
12
+ define( 'MO2F_VERSION', '5.4.12' );
13
  define( 'MO2F_TEST_MODE', false );
14
  define( 'MO2F_IS_ONPREM', get_option('is_onprem'));
15
  class Miniorange_twoFactor{
512
  }
513
 
514
  new Miniorange_twoFactor;
515
+ ?>
readme.txt CHANGED
@@ -6,7 +6,7 @@ Donate link: https://miniorange.com/
6
  Requires at least: 3.0.1
7
  Tested up to: 5.4
8
  Requires PHP: 5.3.0
9
- Stable tag: 5.4.9
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -37,7 +37,7 @@ Many video sharing and E-learning platforms want to prevent sharing of account b
37
  Other sites like premium video content or any premium content where you want users not to share passwords between friends and Family then you can go for this solution.
38
 
39
  <h4>FREE Plugin Features</h4>
40
- * Simplified & easy to user interface.
41
  * Two Factor Authentication (2FA) for **3 User** forever FREE!
42
  * **Variety of Authentication Methods:** Any App supporting TOTP algorithm like Google, Authy, LastPass Authenticator, QR Code, Push Notification, Soft Token and Security Questions(KBA)
43
  * Includes Language Translation Support. Supports a wide variety of languages
@@ -307,11 +307,17 @@ miniOrange authentication service has 15+ authentication methods.One time passco
307
 
308
  == Changelog ==
309
 
 
 
 
 
 
 
310
  = 5.4.9 =
311
- * Google Authenticator-Two Factor Authentication (2FA) : User Experience, new support form and Security disabled by default. Added New Methods for users to choose.
312
 
313
  = 5.4.8 =
314
- * Google Authenticator-Two Factor Authentication (2FA) : Learning Management System support, Microsoft Authenticator and Duo Authenticator support and restrict account sharing add-on.
315
  = 5.4.7 =
316
  * Google Authenticator-Two Factor Authentication (2FA) : Fixing warnings and adding minor changes in the plans.
317
 
@@ -808,13 +814,20 @@ More descriptive setup messages and UI changes.
808
 
809
  == Upgrade Notice ==
810
 
 
 
 
 
 
 
811
  = 5.4.9 =
812
- * Google Authenticator-Two Factor Authentication (2FA) : User Experience, new support form and Security disabled by default. Added New Methods for users to choose.
813
 
814
  = 5.4.8 =
815
- * Google Authenticator-Two Factor Authentication (2FA) : Learning Management System support, Microsoft Authenticator and Duo Authenticator support and restrict account sharing add-on.
 
816
  = 5.4.7 =
817
- * Google Authenticator-Two Factor Authentication (2FA) : Fixing warnings and adding minor changes in the plans.
818
 
819
  = 5.4.6 =
820
  * Google Authenticator-Two Factor Authentication (2FA) : Improving Google Authenticator and adding Payment options.
6
  Requires at least: 3.0.1
7
  Tested up to: 5.4
8
  Requires PHP: 5.3.0
9
+ Stable tag: 5.4.12
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
37
  Other sites like premium video content or any premium content where you want users not to share passwords between friends and Family then you can go for this solution.
38
 
39
  <h4>FREE Plugin Features</h4>
40
+ * Simplified & easy user interface.
41
  * Two Factor Authentication (2FA) for **3 User** forever FREE!
42
  * **Variety of Authentication Methods:** Any App supporting TOTP algorithm like Google, Authy, LastPass Authenticator, QR Code, Push Notification, Soft Token and Security Questions(KBA)
43
  * Includes Language Translation Support. Supports a wide variety of languages
307
 
308
  == Changelog ==
309
 
310
+ = 5.4.12 =
311
+ * Google Authenticator-Two Factor Authentication (2FA, MFA) : Support Form Improvement.
312
+
313
+ = 5.4.11 =
314
+ * Google Authenticator-Two Factor Authentication (2FA, TFA) : Feedback Issue fix.
315
+
316
  = 5.4.9 =
317
+ * Google Authenticator-Two Factor Authentication (2FA, MFA) : User Experience, new support form and Security disabled by default. Added New Methods for users to choose.
318
 
319
  = 5.4.8 =
320
+ * Google Authenticator-Two Factor Authentication (2FA, TFA) : Learning Management System support, Microsoft Authenticator and Duo Authenticator support and restrict account sharing add-on.
321
  = 5.4.7 =
322
  * Google Authenticator-Two Factor Authentication (2FA) : Fixing warnings and adding minor changes in the plans.
323
 
814
 
815
  == Upgrade Notice ==
816
 
817
+ = 5.4.12 =
818
+ * Google Authenticator-Two Factor Authentication (2FA, TFA) : Support Form Improvement.
819
+
820
+ = 5.4.11 =
821
+ * Google Authenticator-Two Factor Authentication (2FA, MFA) : Feedback Issue fix.
822
+
823
  = 5.4.9 =
824
+ * Google Authenticator-Two Factor Authentication (2FA, TFA) : User Experience, new support form and Security disabled by default. Added New Methods for users to choose.
825
 
826
  = 5.4.8 =
827
+ * Google Authenticator-Two Factor Authentication (2FA, OTP Verification) : Learning Management System support, Microsoft Authenticator and Duo Authenticator support and restrict account sharing add-on.
828
+
829
  = 5.4.7 =
830
+ * Google Authenticator-Two Factor Authentication (2FA, SMS Verification) : Fixing warnings and adding minor changes in the plans.
831
 
832
  = 5.4.6 =
833
  * Google Authenticator-Two Factor Authentication (2FA) : Improving Google Authenticator and adding Payment options.