PageSourceSearch

https://notebook.school/wp-content/plugins/nb-wp-utility/assets/cache/nb-utility-script.js?ver=8121

js notebook.school collected 2026-10-02 01:09:17 UTC 16,960 bytes, 523 lines download raw bytes

1// FILE BEGIN : /var/web/site/public_html/wp-content/plugins/nb-wp-utility/assets/js/utility.js
2jQuery(document).ready(function ($) {
3  if ($("#btn_nb_wp_config_save").length > 0) {
4    $("#btn_nb_wp_config_save").click(function (e) {
5      saveUpdateConfig();
6    });
7
8    function saveUpdateConfig() {
9      var formdata = {
10        nb_web_url: $("#txt_nb_web_url").val(),
11        nb_ej_web_url: $("#txt_nb_ej_web_url").val(),
12        nb_ej_api_url: $("#txt_nb_ej_api_url").val(),
13        nb_ej_client_id: $("#txt_nb_ej_client_id").val(),
14        google_client_id: $("#txt_google_client_id").val(),
15        google_client_secret: $("#txt_google_client_secret").val(),
16        google_auth_redirect_url: $("#txt_google_auth_redirect_url").val(),
17      };
18      jQuery.ajax({
19        type: "post",
20        url: "/wp-admin/admin-ajax.php",
21        data: { action: "nb_save_update_config", data: formdata },
22        success: function (response) {
23          var data = JSON.parse(response);
24          if (data.success) window.location = window.location;
25        },
26      });
27    }
28  }
29
30  $(".text-number").on("keydown", function (e) {
31    if (isNaN(e.key) && e.key !== "Backspace") {
32      e.preventDefault();
33    }
34  });
35});
36
37function validateEmail(email) {
38  var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
39  return emailReg.test(email);
40}
41function validatePhoneNumber(input_str) {
42  var re = /^[\+]?[(]?[0-9]{1,3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,9}$/im;
43  return re.test(input_str);
44}
45function validateName(input_str) {
46  var re = /^[a-zA-Z .]+$/;
47  return re.test(input_str);
48}
49function validateNumber(input_str) {
50  var re = /^[0-9]+$/;
51  return re.test(input_str);
52}
53function passwordPolicy(input_str) {
54  var re = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*-+=()]).{8,32}$/;
55  return re.test(input_str);
56}
57
58function loadingAlert(msg = "") {
59  Swal.fire({
60    loaderHtml: "",
61    html:
62      '<div class="d-flex flex-row align-content-center align-items-center"><div class="swal2-loader" style="display: block;"></div><div class="text-secondary">' +
63      (msg == "" ? "Loading" : msg) +
64      "</div></div>",
65    timer: 30000,
66    allowOutsideClick: false,
67    allowEscapeKey: false,
68    showConfirmButton: false,
69    customClass: {
70      popup: "justify-content-center",
71      container: "swal-container-custom swal-container-custom-toast",
72      htmlContainer:
73        "h-100 d-flex flex-row justify-content-start align-content-center align-items-center m-2 overflow-hidden",
74    },
75    didOpen: () => {
76      Swal.showLoading();
77    },
78  });
79}
80
81// FILE END : /var/web/site/public_html/wp-content/plugins/nb-wp-utility/assets/js/utility.js
82
83
84// FILE BEGIN : /var/web/site/public_html/wp-content/plugins/nb-wp-utility/assets/js/auth/login-signup-up.js
85jQuery(document).ready(function ($) {
86  if (
87    ($(".nb-btn-login").length > 0 || ".nb-btn-signup".length > 0) &&
88    $("#popup-login-signup").length > 0
89  ) {
90    var _username = "";
91    $(".nb-btn-signup,.nb-btn-login").addClass("pointer");
92    $(".nb-btn-login").click(function (e) {
93      e.preventDefault();
94      $("#popup-login-signup").appendTo("body").modal("show");
95      showLogin();
96    });
97    $(".nb-btn-signup").click(function (e) {
98      e.preventDefault();
99      $("#popup-login-signup").appendTo("body").modal("show");
100      showSignUp();
101    });
102    $(".nb-btn-login").click(function (e) {
103      e.preventDefault();
104      $("#popup-login-signup").appendTo("body").modal("show");
105      showLogin();
106    });
107    $(".modal .close").click(function () {
108      hideModalPopUp();
109    });
110    $(".btn-nav-to-sign-up-option").click(function () {
111      showSignUp();
112    });
113    $(".btn-nav-to-login-option").click(function () {
114      showLogin();
115    });
116    $(".btn-nav-to-sign-up-email").click(function () {
117      showSignUpEmail();
118    });
119    $(".btn-social-login").click(function (e) {
120      hideModalPopUp();
121      window.location = this.dataset.href;
122    });
123
124    $(".btn-sign-up-submit").click(function (e) {
125      createFreeAccount();
126    });
127    $(".btn-login-submit").click(function (e) {
128      loginSubmit();
129    });
130    $(".btn-login-request-otp").click(function (e) {
131      OtpLoginRequest();
132    });
133    $(".btn-nav-to-sign-up-email").click(function () {
134      showSignUpEmail();
135    });
136    $(".btn-otp-login-verify-submit").click(function (e) {
137      OTPLoginVerifySubmit();
138    });
139    $("#btn-otp-login-resend").click(function (e) {
140      if (_allResendOTP) OtpLoginRequest();
141    });
142
143    function hideModalPopUp() {
144      $("#popup-login-signup").modal("hide");
145    }
146
147    function restModalView() {
148      $("#div-sign-up-option").addClass("d-none");
149      $("#div-login-option").addClass("d-none");
150      $("#div-sign-up-email").addClass("d-none");
151      $("#div-otp-login-verify").addClass("d-none");
152      $("#txt_login_userid").val("");
153      $("#txt_login_password").val("");
154      $("#txt_sign_up_email").val("");
155      $("#txt_otp_login_verify").val("");
156      $("#div_login_social,#div_login_userid").removeClass("d-none");
157      $("#div_login_otp_request,#ddl_login_mobile_code").addClass("d-none");
158      hideError();
159    }
160
161    function showError(errMsg) {
162      $("#div-error-section").removeClass("d-none");
163      $("#div-error-section-msg").html(errMsg);
164    }
165    function hideError() {
166      $("#div-error-section").addClass("d-none");
167      $("#div-error-section-msg").html("");
168    }
169
170    function showLogin() {
171      restModalView();
172      $("#div-login-option").removeClass("d-none");
173    }
174    function showSignUp() {
175      restModalView();
176      $("#div-sign-up-option").removeClass("d-none");
177    }
178    function showSignUpEmail() {
179      restModalView();
180      $("#div-sign-up-email").removeClass("d-none");
181    }
182    function showOtpLoginVerify() {
183      restModalView();
184      resetOTPTimer();
185      _allResendOTP = false;
186      $("#div-otp-login-verify").removeClass("d-none");
187      $("#btn-otp-login-resend").removeClass("btn-outline-primary");
188      $("#btn-otp-login-resend").addClass("border border-2 text-secondary");
189      $("#div-otp-login-verify-sub-title").html("OTP sent to  " + _username);
190    }
191
192    $("#txt_login_userid").on("keyup", function () {
193      var k = this.value;
194      hideError();
195      $("#div_login_otp_request,#ddl_login_mobile_code").addClass("d-none");
196      $("#div_login_social").removeClass("d-none");
197      if (k.length > 4) {
198        _username = this.value;
199        $("#div_login_social").addClass("d-none");
200        if (validatePhoneNumber(k)) {
201          _username = "+91-" + this.value;
202          $("#div_login_otp_request").removeClass("d-none");
203          $("#ddl_login_mobile_code").removeClass("d-none");
204        }
205        if (validateEmail(k)) {
206          $("#div_login_otp_request").removeClass("d-none");
207        }
208      }
209    });
210
211    function loginSubmit() {
212      hideError();
213      var formdata = {
214        login_userid: _username,
215        login_password: $("#txt_login_password").val(),
216      };
217      if (formdata.login_userid != "") {
218        loadingAlert();
219        jQuery.ajax({
220          type: "post",
221          url: "/wp-admin/admin-ajax.php",
222          data: { action: "nb_ej_login", data: formdata },
223          success: function (response) {
224            Swal.close();
225            var data = JSON.parse(response);
226            if (data.success) {
227              hideModalPopUp();
228              window.location = data.url;
229            } else {
230              showError(
231                "Your login id and password do not match, please try again."
232              );
233            }
234          },
235        });
236      }
237    }
238
239    function OtpLoginRequest() {
240      var formdata = {
241        username: _username,
242      };
243      loadingAlert("Submitting");
244      jQuery.ajax({
245        type: "post",
246        url: "/wp-admin/admin-ajax.php",
247        data: { action: "nb_ej_login_otp", data: formdata },
248        success: function (response) {
249          Swal.close();
250          var data = JSON.parse(response);
251          if (data.status) {
252            showOtpLoginVerify();
253          } else {
254            showError("Incorrect Phone Number, please try again.");
255          }
256        },
257      });
258    }
259
260    var _countDownDateTimer;
261    var _allResendOTP = false;
262    function resetOTPTimer() {
263      _allResendOTP = false;
264      var duration = 32;
265      var countDownDate = new Date();
266      countDownDate.setSeconds(countDownDate.getSeconds() + parseInt(duration));
267      _countDownDateTimer = setInterval(function () {
268        var now = new Date().getTime();
269        var distance = countDownDate - now;
270        var seconds = Math.floor((distance % (1000 * 60)) / 1000);
271        document.getElementById("btn-otp-login-resend").innerHTML =
272          "Resend OTP in <span class='text-danger ms-1'>" +
273          seconds +
274          "s</span>";
275        console.log(distance);
276        if (distance < 0) {
277          _allResendOTP = true;
278          clearInterval(_countDownDateTimer);
279          document.getElementById("btn-otp-login-resend").innerHTML =
280            "Resend OTP";
281          $("#btn-otp-login-resend").addClass("btn-outline-primary");
282          $("#btn-otp-login-resend").removeClass(
283            "border border-2 text-secondary"
284          );
285        }
286      }, 1000);
287    }
288
289    function OTPLoginVerifySubmit() {
290      hideError();
291      var otp_login_verify = $("#txt_otp_login_verify").val();
292      var userNameType = 0;
293      var emailU = "";
294      var phoneU = "";
295      if (validateEmail(_username)) {
296        userNameType = 1;
297        emailU = _username;
298      }
299      if (validatePhoneNumber(_username)) {
300        userNameType = 2;
301        phoneU = _username;
302      }
303
304      var formdata = {
305        userName: _username,
306        phone: phoneU,
307        email: emailU,
308        token: otp_login_verify,
309        userNameType: userNameType,
310      };
311      if (formdata.token.length == 6) {
312        loadingAlert();
313        jQuery.ajax({
314          type: "post",
315          url: "/wp-admin/admin-ajax.php",
316          data: { action: "nb_ej_otp_login_verify", data: formdata },
317          success: function (response) {
318            Swal.close();
319            var data = JSON.parse(response);
320            if (data.success) {
321              hideModalPopUp();
322              window.location = data.url;
323            } else {
324              showError(
325                "Sorry, your OTP is either invalid or expired. Please try again or request a new OTP."
326              );
327            }
328          },
329        });
330      } else {
331        showError(
332          "Sorry, your OTP is either invalid or expired. Please try again or request a new OTP."
333        );
334      }
335    }
336
337    $("#txt_sign_up_email,#txt_sign_up_password").on("keyup", function () {
338      hideError();
339    });
340    $("#rdo-check-tandc").change(function () {
341      hideError();
342    });
343    function createFreeAccount() {
344      hideError();
345      var valid = false;
346      var sign_up_email = $("#txt_sign_up_email").val();
347      var check_tandc = $("#rdo_check_tandc").is(":checked");
348      var errMsg = "";
349      var validMail = false;
350      var vaildPhone = false;
351
352      if (sign_up_email != "" && validateEmail(sign_up_email)) {
353        validMail = true;
354      }
355
356      if (validMail == false && vaildPhone == false) {
357        errMsg += "<div>Please enter valid Email Id</div>";
358      }
359
360      if (!check_tandc) errMsg += "<div>Please accept Terms of Use.</div>";
361
362      valid = errMsg == "";
363      if (valid) {
364        loadingAlert("Submitting");
365        var formdata = {
366          sign_up_name: "",
367          sign_up_email: validMail ? sign_up_email : "",
368          sign_up_mobile: "",
369        };
370        jQuery.ajax({
371          type: "post",
372          url: "/wp-admin/admin-ajax.php",
373          data: { action: "nb_ej_free_signup", data: formdata },
374          success: function (response) {
375            Swal.close();
376            valid = false;
377            var data = JSON.parse(response);
378            if (data.status) {
379              hideModalPopUp();
380              window.location = data.data;
381            } else {
382              showError(data.message);
383            }
384          },
385        });
386      } else {
387        showError('<div class="d-flex flex-column">' + errMsg + "</div>");
388      }
389    }
390  }
391});
392
393// FILE END : /var/web/site/public_html/wp-content/plugins/nb-wp-utility/assets/js/auth/login-signup-up.js
394
395
396// FILE BEGIN : /var/web/site/public_html/wp-content/plugins/nb-wp-utility/assets/js/auth/free-signup-up.js
397jQuery(document).ready(function ($) {
398  if ($("#div-free-sign-up").length > 0) {
399    var ddl_sign_up_grade_val = "";
400    $("#btn-social-signup").click(function (e) {
401      window.location = this.dataset.href;
402    });
403    $("#btn-free-sign-up-submit").click(function (e) {
404      createFreeAccount();
405    });
406
407    function showError(errMsg) {
408      $("#div-error-section").removeClass("d-none");
409      $("#div-error-section-msg").html(errMsg);
410    }
411    function hideError() {
412      $("#div-error-section").addClass("d-none");
413      $("#div-error-section-msg").html("");
414    }
415
416    $("#txt_sign_up_name,#txt_sign_up_email,#txt_sign_up_mobile").on(
417      "keyup",
418      function () {
419        hideError();
420      }
421    );
422    $("#rdo-check-tandc").change(function () {
423      hideError();
424    });
425    $(".ddl_sign_up_grade_option").click(function (e) {
426      $("#ddl_sign_up_grade_selected").removeClass("text-black-50");
427      $("#ddl_sign_up_grade_selected").html(this.dataset.name);
428      $(".ddl_sign_up_grade_option").removeClass("bg-light-secondary");
429      $(this).addClass("bg-light-secondary");
430      ddl_sign_up_grade_val = this.dataset.value;
431      hideError();
432    });
433
434    function createFreeAccount() {
435      hideError();
436      var valid = false;
437      var sign_up_name = $("#txt_sign_up_name").val();
438      var sign_up_email = $("#txt_sign_up_email").val();
439      var sign_up_mobile = $("#txt_sign_up_mobile").val();
440      var check_tandc = $("#rdo_check_tandc").is(":checked");
441      var errMsg = "";
442      if (
443        sign_up_name == undefined ||
444        sign_up_name == null ||
445        sign_up_name == ""
446      )
447        errMsg = "<div>Please enter your Name.</div>";
448      var validMail = false;
449      var vaildPhone = false;
450
451      if (sign_up_email != "" && validateEmail(sign_up_email)) {
452        validMail = true;
453      }
454      if (sign_up_mobile.length > 0 && sign_up_mobile.length == 10) {
455        vaildPhone = true;
456      }
457
458      if (validMail == false && vaildPhone == false) {
459        errMsg += "<div>Please enter valid Email Id or Phone Number.</div>";
460      }
461      if (ddl_sign_up_grade_val == "") {
462        errMsg += "<div>Please select your class.</div>";
463      }
464
465      if (!check_tandc) errMsg += "<div>Please accept Terms of Use.</div>";
466
467      valid = errMsg == "";
468      if (valid) {
469        loadingAlert("Submitting");
470        var formdata = {
471          sign_up_name: sign_up_name,
472          sign_up_email: validMail ? sign_up_email : "",
473          sign_up_mobile: vaildPhone ? "+91-" + sign_up_mobile : sign_up_mobile,
474          sign_up_grade: ddl_sign_up_grade_val,
475          sign_up_src: $("#hf_sign_up_src").val(),
476        };
477        jQuery.ajax({
478          type: "post",
479          url: "/wp-admin/admin-ajax.php",
480          data: { action: "nb_ej_free_signup", data: formdata },
481          success: function (response) {
482            Swal.close();
483            valid = false;
484            var data = JSON.parse(response);
485            if (data.status) {
486              window.location = data.data;
487            } else {
488              showError(data.message);
489            }
490          },
491        });
492      } else {
493        showError('<div class="d-flex flex-column">' + errMsg + "</div>");
494      }
495    }
496  }
497});
498
499// FILE END : /var/web/site/public_html/wp-content/plugins/nb-wp-utility/assets/js/auth/free-signup-up.js
500
501
502// FILE BEGIN : /var/web/site/public_html/wp-content/plugins/nb-wp-utility/assets/js/course/course-upload.js
503jQuery(document).ready(function ($) {
504  if ($("#form-cbse-upload-course-page").length > 0) {
505    var processing = false;
506    $("#btn-submit").click(function () {
507      if (processing) {
508        return;
509      }
510      processing = true;
511      jQuery.ajax({
512        type: "post",
513        url: "/wp-admin/admin-ajax.php",
514        data: { action: "nb_process_course_post" },
515        success: function (response) {},
516      });
517    });
518  }
519});
520
521// FILE END : /var/web/site/public_html/wp-content/plugins/nb-wp-utility/assets/js/course/course-upload.js
522
523

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.