ডোম নেভিগেশন (DOM Navigation)

এইচটিএমএল ডোমের সাহায্যে আপনি নোডের সম্পর্ক ব্যবহার করে নোড ট্রি নেভিগেট করতে পারেন।


ডোম নোড

W3C এর এইচটিএমএল ডোমের স্ট্যান্ডার্ড অনুযায়ী, একটি এইচটিএমএল ডকুমেন্টের সবকিছুই একটি নোডঃ

  • সম্পূর্ণ ডকুমেন্ট একটি ডকুমেন্ট নোড
  • প্রতিটি এইচটিএমএল এলিমেন্ট একটি এলিমেন্ট নোড
  • এইচটিএমএল এলিমেন্টের ভিতরের টেক্সট হচ্ছে টেক্সট নোড
  • প্রতিটি এইচটিএমএল এট্রিবিউট হলো এট্রিবিউট নোড
  • সকল কমেন্ট হচ্ছে কমেন্ট নোড
DOM HTML tree

এইচটিএমএল ডোমের মাধ্যমে নোড ট্রির সকল নোডকে জাভাস্ক্রিপ্ট দ্বারা এক্সেস করা যাবে।

নতুন নোড তৈরি করা যাবে এবং সমস্ত নোড পরিবর্তন বা বাদ দেওয়া যাবে।


নোডের সম্পর্ক

এই সম্পর্ককে বর্ণনা করতে প্যারেন্ট,চাইল্ড এবং সিবলিং ব্যবহার করা হয়।

  • একটি নোড ট্রির মধ্যে সবচেয়ে উপরের নোডকে রুট(বা রুট নোড) বলা হয়
  • প্রতিটি নোডের শুধুমাত্র একটাই প্যারেন্ট থাকে, রুট ছাড়া (যার কোন প্যারেন্ট নেই)
  • একটি নোডের অনেকগুলো চিলড্রেন থাকতে পারে
  • সিবলিং(ব্রাদারস-সিস্টারস) হলো সেই নোড যাদের একই প্যারেন্ট থাকে

kt_satt_skill_example_id=1498

উপরের এইচটিএমএল থেকে আমরা যা শিখলামঃ

  • হচ্ছে একটি রুট নোড
  • এর কোন প্যারেন্ট নেই
  • হচ্ছে এবং এর প্যারেন্ট
  • হচ্ছে এর প্রথম চাইল্ড
  • হলো এর শেষ চাইল্ড

এবং

  • এর একটি চাইল্ড আছেঃ </li><li><title> এর একটি চাইল্ড টেক্সট নোড রয়েছেঃ "জাভাস্ক্রিপ্ট উদাহরণ"</li><li><body> এর দুইটি চাইল্ড আছেঃ <h1> এবং <p></li><li><h1> এর একটি চাইল্ড আছেঃ "ডোম টিউটোরিয়াল"</li><li><p> এর একটি চাইল্ড আছেঃ "স্যাট একাডেমী"</li><li><h1> এবং <p> হচ্ছে সিবলিং</li></ul><hr><h2 style="margin-left:0px;">নোডের মধ্যে নেভিগেট করা</h2><p style="margin-left:0px;">আপনি জাভাস্ক্রিপ্ট দিয়ে নোডের মধ্যে নেভিগেট করতে নিম্নলিখিত নোড প্রোপার্টি ব্যবহার করতে পারেনঃ</p><ul><li>parentNode</li><li>childNodes[<i>nodenumber</i>]</li><li>firstChild</li><li>lastChild</li><li>nextSibling</li><li>previousSibling</li></ul><hr><h2 style="margin-left:0px;">সতর্কতা!</h2><p style="margin-left:0px;">ডোম(DOM) প্রক্রিয়াকরণে একটি ভুল ধারণা হলো একটি এলিমেন্ট নোডে শুধু টেক্সট থাকবে।</p><p style="margin-left:0px;">এই উদাহরণেঃ <strong><title>ডোম টিউটোরিয়াল, এলিমেন্ট নোড টেক্সট ধারণ করে না। এটি "ডোম টিউটোরিয়াল" ভ্যালুসহ একটি <strong>টেক্সট নোড(text node)</strong> ধারণ করে।</p><p style="margin-left:0px;">নোডের <strong>innerHTML</strong>প্রোপারটি অথবা <strong>nodeValue</strong> দ্বারা টেক্সট নোডের ভ্যালু এক্সেস করা যেতে পারে।</p><hr><h2 style="margin-left:0px;">চাইল্ড নোড এবং নোড ভ্যালু</h2><p style="margin-left:0px;">innerHTML প্রোপারটি ছাড়াও আপনি একটি এলিমেন্টের কন্টেন্টকে পেতে childNodes এবং nodeValue প্রোপারটি ব্যবহার করতে পারেন।</p><p style="margin-left:0px;">নিম্নলিখিত উদাহরণে আমরা একটি <h1> এলিমেন্টের নোড ভ্যালুকে সংগ্রহ করে এবং একটি <p> এলিমেন্টে ব্যবহার করেছি।</p><p>short note</p><p style="margin-left:0px;">উপরোক্ত উদাহরণে getElementById হলো একটি মেথড, childNodes এবং nodeValue হচ্ছে প্রোপার্টি।</p><p style="margin-left:0px;">এই টিউটোরিয়ালে innerHTML প্রোপার্টি ব্যবহার করা হয়েছে। তবে ট্রি স্ট্রাকচার এবং ডোমের নেভিগেশন জানার জন্য উপরোক্ত মেথডটি অবশ্যই শেখা প্রয়োজন।</p><p style="margin-left:0px;">firstChild প্রোপারটির ব্যবহার এবং childNodes[0] এর ব্যবহার একই রকমঃ</p><p>short note</p><h2 style="margin-left:0px;">ডোম রুট নোড</h2><p style="margin-left:0px;">শুধুমাত্র দুটি উপায়ে সম্পূর্ণ ডকুমেন্টকে এক্সেস করা যায়ঃ</p><ul><li>document.body - ডকুমেন্টের বডি</li><li>document.documentElement - সম্পূর্ণ ডকুমেন্ট</li></ul><p>short note</p><p>short note</p><h2 style="margin-left:0px;">nodeName প্রোপার্টি</h2><p style="margin-left:0px;">nodeName প্রোপার্টি দ্বারা একটি নোডের নাম নির্দেশ করা হয়।</p><ul><li>nodeName প্রোপার্টি read-only</li><li>একটি এলিমেন্ট নোডের nodeName এবং TagName একই রকম</li><li>একটি এট্রিবিউট নোডের nodeName হলো এট্রিবিউটের নাম</li><li>একটি টেক্সট নোডের nodeName সবসময় #text হয়</li><li>ডকুমেন্ট নোডের nodeName সবসময় #document হয়</li></ul><p style="margin-left:0px;"><strong>নোটঃ</strong> nodeName সবসময় একটি এইচটিএমএল এলিমেন্টের বড়হাতের অক্ষরের ট্যাগ নাম ধারণ করে।</p><hr><h2 style="margin-left:0px;">nodeValue প্রোপার্টি</h2><p style="margin-left:0px;">nodeValue প্রোপার্টি একটি নোডের ভ্যালু নির্দেশ করে।</p><ul><li>এলিমেন্ট নোডের nodeValue এর ভ্যালু undefined থাকে</li><li>টেক্সট নোডের nodeValue ঐ টেক্সটকেই নির্দেশ করে</li><li>এট্রিবিউট নোডের nodeValue হলো এট্রিবিউটের ভ্যালু</li></ul><hr><h2 style="margin-left:0px;">nodeType প্রোপার্টি</h2><p style="margin-left:0px;">nodeType প্রোপার্টি নোডের টাইপ রিটার্ন করে। nodeType হলো read only প্রোপার্টি।</p><p style="margin-left:0px;">সবচেয়ে গুরুত্বপূর্ণ নোড টাইপগুলো হচ্ছেঃ</p><figure class="table" style="width:642.484px;"><table style="background-color:transparent;border:1px solid rgb(204, 204, 204);"><tbody><tr><th style="padding:8px;vertical-align:top;">ইলিমেন্ট টাইপ</th><th style="padding:8px;vertical-align:top;">নোডটাইপ</th></tr><tr><th style="padding:8px;vertical-align:top;">Element</th><th style="padding:8px;vertical-align:top;">১</th></tr><tr><th style="padding:8px;vertical-align:top;">Attribute</th><th style="padding:8px;vertical-align:top;">২</th></tr><tr><th style="padding:8px;vertical-align:top;">Text</th><th style="padding:8px;vertical-align:top;">৩</th></tr><tr><th style="padding:8px;vertical-align:top;">Comment</th><th style="padding:8px;vertical-align:top;">৮</th></tr><tr><th style="padding:8px;vertical-align:top;">Document</th><th style="padding:8px;vertical-align:top;">৯</th></tr></tbody></table></figure><p> </p> </div> <!--end::content--> <!--begin::Content Video--> <!--end::Content Video--> <!--begin::User Info--> <div class="d-flex flex-column flex-md-row align-items-start align-items-md-center justify-content-md-between justify-content-start mb-9"> <div> <span class="text-gray-800 text-uppercase mb-1 fs-7"> Content added || updated By </span> <!--begin::Item--> <div class="d-flex align-items-center pe-2"> <!--begin::Avatar--> <a href="https://sattacademy.com/public/user/u&id=70115/profile" class=""> <div class="symbol symbol-30px symbol-circle me-3 user-statistics" data-id="70115" data-flug="-1"> <img src="https://sattacademy.com/public/assets/media/avatars/blank.png" class="toolbar-img" alt=""> </div> </a> <!--end::Avatar--> <!--begin::Text--> <div class="fs-7 fw-bold"> <a href="https://sattacademy.com/public/user/u&id=70115/profile" class="text-gray-700 text-hover-primary"> Ibnul Haisan </a> </div> <!--end::Text--> </div> <!--end::Item--> </div> </div> <!--end::User Info--> <!--begin::Question--> <div class=""> </div> <!--end::Question--> </div> </div> </div> <!--begin::Related Topics--> <div class="mb-9 mx-5"> <p class="fs-4">আরও দেখুন...</p> <div class="d-flex flex-wrap align-items-center"> </div> </div> <!--end::Related Topics--> </div> <!--end::Content--> </div> <!--end::Col--> <!--begin::Col--> <div class="col-md-4 d-none d-md-block" style="overflow:scroll; height:800px; position:sticky; top:100px;"> <!--begin::card--> <div class="card"> <!--begin::Body--> <div class="card-body p-7"> <!--begin::Layout--> <div class="d-flex flex-column flex-lg-row"> <!--begin::Sidebar--> <div class="flex-column flex-lg-row-auto w-100"> <!--begin::Catigories--> <div class="mb-md-15"> <div class="sidebar-title mb-3"> <h4 class="text-dark text-uppercase">On This Page</h4> </div> <div class="mb-7 heading-border-bttom"></div> <ul class="p-0"> <li style="list-style: none"> <!--begin::Item--> <div class="d-flex flex-stack"> <!--begin::Section--> <a href="#kk_target_ডোম-নেভিগেশন-dom-navigation" class="text-primary fw-semibold fs-6 me-2">ডোম নেভিগেশন (DOM Navigation)</a> <!--end::Section--> </div> <!--end::Item--> <!--begin::Separator--> <div class="separator separator-dashed my-3"></div> <!--end::Separator--> </li> </ul> </div> <!--end::Catigories--> </div> <!--end::Sidebar--> </div> <!--end::Layout--> </div> <!--end::Body--> </div> <!--end::card--> </div> <!--end::Col--> </div> <!--end::Row--> </div> <!--end::subject topic--> </div> <!--end::Container--> </div> <!--end:Post --> <div class="modal fade z-index-1500" id="kk_modal_self_test" tabindex="-1" aria-hidden="true"> <!--begin::Modal dialog--> <div class="modal-dialog modal-dialog-centered mw-650px"> <!--begin::Modal content--> <div class="modal-content rounded"> <!--begin::Modal header--> <div class="modal-header pb-0 border-0 justify-content-end"> <!--begin::Close--> <div class="btn btn-sm btn-icon btn-active-color-primary" data-bs-dismiss="modal"> <!--begin::Svg Icon | path: icons/duotune/arrows/arr061.svg--> <span class="svg-icon svg-icon-1"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"> <rect opacity="0.5" x="6" y="17.3137" width="16" height="2" rx="1" transform="rotate(-45 6 17.3137)" fill="black" /> <rect x="7.41422" y="6" width="16" height="2" rx="1" transform="rotate(45 7.41422 6)" fill="black" /> </svg> </span> <!--end::Svg Icon--> </div> <!--end::Close--> </div> <!--begin::Modal header--> <!--begin::Modal body--> <div class="modal-body scroll-y px-10 px-lg-15 pt-0 pb-15"> <!--begin:Form--> <form id="kk_modal_self_test_form" class="form" enctype="multipart/form-data"> <input type="hidden" name="_token" value="cpD0Ry8y7DbDLBOJoEMtREsFCH6k20fTWQX4NBlV" autocomplete="off"> <input type="hidden" name="subject_id" value=""> <!--begin::Heading--> <div class="mb-9 text-center"> <!--begin::Title--> <h1 class="mb-3">Self Test</h1> <!--end::Title--> <!--begin::Description--> <div class="text-muted fw-bold fs-5">Fill up the form and submit </div> <!--end::Description--> </div> <!--end::Heading--> <!---Error Message --> <div class="messages col-md-12 mx-auto fw-bolder text-center mb-3"></div> <!---Error Message --> <div class="text-center mb-9"> <span class="fs-4 fw-bold">To attend a self test please, login first. <a href="https://sattacademy.com/public/login" class="text-decoration-underline">click here to login</a></span> </div> <!--begin::Actions--> <div class="text-center"> <button type="reset" id="kk_modal_self_test_cancel" class="btn btn-light me-3">Cancel</button> <a href="https://sattacademy.com/public/login" class="btn btn-primary"> Login </a> </div> <!--end::Actions--> </form> <!--end:Form--> </div> <!--end::Modal body--> </div> <!--end::Modal content--> </div> <!--end::Modal dialog--> </div> <!--begin::Modal - Bookmark modal--> <div class="modal fade" id="kk_modal_new_bookmark" tabindex="-1" aria-hidden="true"> <!--begin::Modal dialog--> <div class="modal-dialog modal-dialog-centered mw-600px"> <!--begin::Modal content--> <div class="modal-content rounded"> <!--begin::Modal header--> <div class="modal-header pb-0 border-0 justify-content-end"> <!--begin::Close--> <div class="btn btn-sm btn-icon btn-active-color-primary" data-bs-dismiss="modal"> <!--begin::Svg Icon | path: icons/duotune/arrows/arr061.svg--> <span class="svg-icon svg-icon-1"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"> <rect opacity="0.5" x="6" y="17.3137" width="16" height="2" rx="1" transform="rotate(-45 6 17.3137)" fill="black" /> <rect x="7.41422" y="6" width="16" height="2" rx="1" transform="rotate(45 7.41422 6)" fill="black" /> </svg> </span> <!--end::Svg Icon--> </div> <!--end::Close--> </div> <!--begin::Modal header--> <!--begin::Modal body--> <div class="modal-body scroll-y px-10 px-lg-15 pt-0 pb-15"> <!--begin:Form--> <form id="kk_modal_new_bookmark_form" class="form" method="POST" enctype="multipart/form-data"> <!-- csrf token --> <input type="hidden" name="_token" value="cpD0Ry8y7DbDLBOJoEMtREsFCH6k20fTWQX4NBlV" autocomplete="off"> <input type="hidden" name="question_id"> <input type="hidden" name="catid"> <input type="hidden" name="type"> <!--begin::Heading--> <div class="mb-13 text-center"> <!--begin::Title--> <h1 class="mb-3">Add New Bookmark</h1> <!--end::Title--> <!--begin::Description--> <div class="text-muted fw-bold fs-5">Fill up the form and submit </div> <!--end::Description--> </div> <!--end::Heading--> <div class="messages text-center fw-bold"></div> <div class="text-center mb-9"> <span class="fs-4 fw-bold">To add a bookmark login first. <a href="https://sattacademy.com/public/login" class="text-decoration-underline">click here to login</a></span> </div> <!--begin::Actions--> <div class="text-center"> <button type="reset" id="kk_modal_bookmark_cancel" class="btn btn-light me-3 ">Cancel</button> <a href="https://sattacademy.com/public/login" class="btn btn-primary"> Login </a> </div> <!--end::Actions--> </form> <!--end:Form--> </div> <!--end::Modal body--> </div> <!--end::Modal content--> </div> <!--end::Modal dialog--> </div> <!--end::Modal - Bookmark modal--> <!--begin::Modal - Error Report--> <div class="modal fade" id="kk_modal_error_report" tabindex="-1" aria-hidden="true"> <!--begin::Modal dialog--> <div class="modal-dialog modal-dialog-centered mw-650px"> <!--begin::Modal content--> <div class="modal-content rounded"> <!--begin::Modal header--> <div class="modal-header pb-0 border-0 justify-content-end"> <!--begin::Close--> <div class="btn btn-sm btn-icon btn-active-color-primary" data-bs-dismiss="modal"> <!--begin::Svg Icon | path: icons/duotune/arrows/arr061.svg--> <span class="svg-icon svg-icon-1"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"> <rect opacity="0.5" x="6" y="17.3137" width="16" height="2" rx="1" transform="rotate(-45 6 17.3137)" fill="black" /> <rect x="7.41422" y="6" width="16" height="2" rx="1" transform="rotate(45 7.41422 6)" fill="black" /> </svg> </span> <!--end::Svg Icon--> </div> <!--end::Close--> </div> <!--begin::Modal header--> <!--begin::Modal body--> <div class="modal-body scroll-y px-10 px-lg-15 pt-0 pb-15"> <!--begin:Form--> <form id="kk_modal_error_report_form" class="form" enctype="multipart/form-data"> <div class="messages"></div> <!-- csrf token --> <input type="hidden" name="_token" value="cpD0Ry8y7DbDLBOJoEMtREsFCH6k20fTWQX4NBlV" autocomplete="off"> <!--begin::Heading--> <div class="mb-13 text-center"> <!--begin::Title--> <h1 class="mb-3">Error Report</h1> <!--end::Title--> <!--begin::Description--> <div class="text-muted fw-bold fs-5">Fill up the form and submit </div> <!--end::Description--> </div> <!--end::Heading--> <!--begin::Hidden Input --> <input type="hidden" name="id" value=""> <input type="hidden" name="type" value=""> <!--begin::Hidden Input--> <div class="text-center mb-9"> <span class="fs-4 fw-bold">To report an error please, login first. <a href="https://sattacademy.com/public/login" class="text-decoration-underline">click here to login</a></span> </div> <!--begin::Actions--> <div class="text-center"> <button type="reset" id="kk_modal_error_report_cancel" class="btn btn-light me-3">Close</button> <a href="https://sattacademy.com/public/login" class="btn btn-primary"> Login </a> </div> <!--end::Actions--> </form> <!--end:Form--> </div> <!--end::Modal body--> </div> <!--end::Modal content--> </div> <!--end::Modal dialog--> </div><!--end::Modal - Error Report--> <!--begin::Modal - Video--> <div class="modal fade" id="kk_modal_add_video" tabindex="-1" aria-hidden="true"> <!--begin::Modal dialog--> <div class="modal-dialog modal-dialog-centered mw-650px"> <!--begin::Modal content--> <div class="modal-content rounded"> <!--begin::Modal header--> <div class="modal-header pb-0 border-0 justify-content-end"> <!--begin::Close--> <div class="btn btn-sm btn-icon btn-active-color-primary" data-bs-dismiss="modal"> <!--begin::Svg Icon | path: icons/duotune/arrows/arr061.svg--> <span class="svg-icon svg-icon-1"> <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"> <rect opacity="0.5" x="6" y="17.3137" width="16" height="2" rx="1" transform="rotate(-45 6 17.3137)" fill="black" /> <rect x="7.41422" y="6" width="16" height="2" rx="1" transform="rotate(45 7.41422 6)" fill="black" /> </svg> </span> <!--end::Svg Icon--> </div> <!--end::Close--> </div> <!--begin::Modal header--> <!--begin::Modal body--> <div class="modal-body scroll-y px-10 px-lg-15 pt-0 pb-15"> <!--begin:Form--> <form id="kk_modal_new_video_form" class="form" enctype="multipart/form-data"> <!-- csrf token --> <input type="hidden" name="_token" value="cpD0Ry8y7DbDLBOJoEMtREsFCH6k20fTWQX4NBlV" autocomplete="off"> <!--begin::Hidden Input--> <input type="hidden" name="data_id"> <input type="hidden" name="type"> <!--end::Hidden Input--> <!--begin::Heading--> <div class="mb-13 text-center"> <!--begin::Title--> <h1 class="mb-3">Add Video</h1> <!--end::Title--> <!--begin::Description--> <div class="text-muted fw-bold fs-5">Fill up the form and submit </div> <!--end::Description--> </div> <!--end::Heading--> <!--begin::Error Message--> <div class="messages text-center fw-bold"></div> <!--end::Error Message--> <div class="text-center mb-9"> <span class="fs-4 fw-bold">To add a video please, login first. <a href="https://sattacademy.com/public/login" class="text-decoration-underline">click here to login</a></span> </div> <!--begin::Actions--> <div class="text-center"> <button type="reset" id="kk_modal_add_video_cancel" class="btn btn-light me-3 ">Cancel</button> <a href="https://sattacademy.com/public/login" class="btn btn-primary"> Login </a> </div> <!--end::Actions--> </form> <!--end:Form--> </div> <!--end::Modal body--> </div> <!--end::Modal content--> </div> <!--end::Modal dialog--> </div><!--end::Modal - Video--> <!--end::Post--> <div class="container"> <!--begin::Dynamic promotion content--> <div id="footer-promotion-content"></div> <!--end::Dynamic promotion content--> </div> </div> <!--end::Content--> <!--begin::Footer--> <!--begin::Footer--> <div class="footer pt-10 pb-0" id="kt_footer"> <!--Begin::Copywrite--> <div class="footer-bg"> <!--begin::Container--> <div class="container"> <!--begin::--> <div class="d-flex align-items-md-center justify-content-center py-3"> <!--begin::copyright--> <a class="text-light fw-bold fs-7" href="https://sattacademy.com/public">©2024 SATT ACADEMY. All rights reserved.</a> </div> <!--end::--> </div> <!--end::Container--> </div> <!--end::Copywrite--> </div> <!--end::Footer--> <!--end::Footer--> <div id="overlay"></div> <div class="card" id="rightLoginCard"> <div class="sidebar-login-form"> <div class="position-relative"> <button type="button" class="btn_login_modal position-absolute model-close-btn" id="closeLoginModal"> X </button> <div class="d-flex justify-content-center align-items-center"> <section id="custom_modal" class="d-md-block"> <div class="custom_modal md_device" style="bottom: 25px;"> <div class="overflow-auto"> <div class="container"> <!-- Authentication card with logo --> <div class="black-logo"> <a class="d-flex justify-content-center mb-4 margin-auto" href="/" > <img alt="SATT ACADEMY" class="text-center justify-content-center w-50 ff" src="https://sattacademy.com/public/uploads/company/login_card_logo.png"> </a> </div> <div class="white-logo"> <a class="d-flex justify-content-center mb-4 margin-auto" href="/" > <img alt="SATT ACADEMY" class="text-center justify-content-center w-50 ff" src="https://sattacademy.com/public/uploads/company/1685883735.png"> </a> </div> <div class="card"> <div class="social-login-wrap mt-4"> <div class="mt-3 mb-4"> <a href="https://sattacademy.com/public/auth/google" class="login-btn"> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" class="LgbsSe-Bz112c"> <g> <path fill="#EA4335" d="M24 9.5c3.54 0 6.71 1.22 9.21 3.6l6.85-6.85C35.9 2.38 30.47 0 24 0 14.62 0 6.51 5.38 2.56 13.22l7.98 6.19C12.43 13.72 17.74 9.5 24 9.5z"> </path> <path fill="#4285F4" d="M46.98 24.55c0-1.57-.15-3.09-.38-4.55H24v9.02h12.94c-.58 2.96-2.26 5.48-4.78 7.18l7.73 6c4.51-4.18 7.09-10.36 7.09-17.65z"> </path> <path fill="#FBBC05" d="M10.53 28.59c-.48-1.45-.76-2.99-.76-4.59s.27-3.14.76-4.59l-7.98-6.19C.92 16.46 0 20.12 0 24c0 3.88.92 7.54 2.56 10.78l7.97-6.19z"> </path> <path fill="#34A853" d="M24 48c6.48 0 11.93-2.13 15.89-5.81l-7.73-6c-2.15 1.45-4.92 2.3-8.16 2.3-6.26 0-11.57-4.22-13.47-9.91l-7.98 6.19C6.51 42.62 14.62 48 24 48z"> </path> <path fill="none" d="M0 0h48v48H0z"></path> </g> </svg> <span>Continue with Google</span> </a> </div> <div class="mt-3 mb-4"> <a href="https://sattacademy.com/public/auth/facebook" class="login-btn"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 1024 1024"> <defs /> <defs> <path id="a" d="M.06.04H1024v1017.74H.06z" /> </defs> <g fill="none" fill-rule="evenodd"> <mask id="b" fill="#fff"> <use xlink:href="#a" /> </mask> <path fill="#1877F2" d="M1024 512C1024 229.23 794.77 0 512 0S0 229.23 0 512c0 255.554 187.231 467.37 432 505.78V660H302V512h130V399.2C432 270.88 508.438 200 625.39 200 681.407 200 740 210 740 210v126h-64.562C611.835 336 592 375.467 592 415.957V512h142l-22.7 148H592v357.78c244.769-38.41 432-250.226 432-505.78" mask="url(#b)" /> <path fill="#FFF" d="M711.3 660L734 512H592v-96.043c0-40.49 19.835-79.957 83.438-79.957H740V210s-58.593-10-114.61-10C508.438 200 432 270.88 432 399.2V512H302v148h130v357.78c26.067 4.09 52.784 6.22 80 6.22s53.933-2.13 80-6.22V660h119.3" /> </g> </svg> <span>Continue with Facebook</span> </a> </div> </div> <div class="or_divider_wrpa mt-3 mb-4"> <p>or</p> </div> <div class="card-bodyss pb-2"> <!-- Validation errors --> <!-- Status message --> <form method="POST" action="https://sattacademy.com/public/login"> <input type="hidden" name="_token" value="cpD0Ry8y7DbDLBOJoEMtREsFCH6k20fTWQX4NBlV" autocomplete="off"> <div class="mb-3 text-start"> <label for="email" class="form-label"><b>Email, Mobile or Username:</b></label> <input type="text" class="form-control" class="" id="email" name="email" value="" required> <!-- Error messages for email --> </div> <div class="mb-3 text-start"> <label for="password" class="form-label"><b>Password:</b></label> <div class="position-relative"> <input type="password" class="form-control password" id="password" name="password" class="" required autocomplete="current-password"> <span onclick="showpass()" class="show-hide-password"> <i class="fa-solid fa-eye position-absolute show-pass"></i> <i class="fa-solid fa-eye-slash position-absolute hide-pass d-none"></i> </span> </div> <!-- Error messages for password --> </div> <div> <input type="hidden" name="route_path" value="skill/%E0%A6%A1%E0%A7%8B%E0%A6%AE-%E0%A6%A8%E0%A7%87%E0%A6%AD%E0%A6%BF%E0%A6%97%E0%A7%87%E0%A6%B6%E0%A6%A8-dom-navigation"> </div> <div class="remember-forget d-flex justify-content-between gap-3 align-items-center"> <div class="form-check d-flex"> <input class="form-check-input" type="checkbox" value="" name="remember" id="remember_me"> <label class="form-check-label text-dark fw-bold" style="font-size: 15px;" class="" for="remember_me">   Remember Me </label> </div> <div> <a class="text-dark fw-bold me-3" href="https://sattacademy.com/public/forgot-password"> Forgot password? </a> </div> </div> <div class="my-2 text-start"> <div class="d-grid"> <button type="submit" class="btn btn-primary mt-5 mb-4">Log in</button> <hr style="width: 90%; margin-inline:auto; color: #948686;margin:10px auto;"> <div class="text-center pb-3"> <p>Don't have an account? <a href="https://sattacademy.com/public/register">Register</a></p> </div> </div> </div> </form> </div> </div> </div> </div> </div> </section> </div> </div> </div> </div> <style> .show-hide-password i { top: 15px; right: 16px; z-index: 100; cursor: pointer; font-size: 15px; } a.login-btn { display: flex; border: 1px solid #afafaf38; width: 100%; padding: 10px; border-radius: 4px; color: #000; font-weight: 600; } a.login-btn svg { height: 18px; margin-right: 8px; min-width: 18px; width: 18px; margin-left: 10px; } a.login-btn span { flex-grow: 1; text-align: center; } .or_divider_wrpa { align-items: center; display: flex; width: 100%; text-align: center; justify-content: center; position: relative; line-height: 1; } .or_divider_wrpa::before { content: ''; height: 1px; background: #e4e6ef; width: 50%; } .or_divider_wrpa::after { content: ''; height: 1px; background: #e4e6ef; width: 50%; } .or_divider_wrpa p { padding-left: 17px; padding-right: 17px; /* line-height: 1; */ margin-bottom: 0; font-weight: 600; font-size: 14px; text-transform: uppercase; } #rightLoginCard { background: #fff; } </style> <!--begin::Dynamic Modal--> <div class="modal fade" tabindex="-1" id="satt_dynamic_modal"> <div class="modal-dialog modal-dialog-centered mw-650px"> <div class="modal-content" style="background-color: transparent"> <!--begin::Close--> <button type="button" class="promotion-close-btn promotion-modal-close-btn" data-bs-dismiss="modal" aria-label="Close"> <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none"> <rect opacity="0.5" x="6" y="17.3137" width="16" height="2" rx="1" transform="rotate(-45 6 17.3137)" fill="currentColor"></rect> <rect x="7.41422" y="6" width="16" height="2" rx="1" transform="rotate(45 7.41422 6)" fill="currentColor"></rect> </svg> </button> <!--end::Close--> <div class="dynamic-modal-body promotion-body"> </div> </div> </div> </div> <!--end::Dynamic Modal--> <div class="modal fade" id="notification_item_modal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog modal-dialog-centered modal-dialog-scrollable"> <div class="modal-content"> <div class="modal-header"> <h1 class="modal-title fs-5" id="exampleModalLabel">Notification</h1> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> <div href="#" class="dropdown-item notification-message-item border-0"> <!-- loader --> <div class="my-4 text-center" id="notification-details-loader"> <span class="spinner-border text-primary" role="status"></span> </div> <div class="notification-media d-none"> <div class="symbol d-flex gap-3 border-bottom"> <img src="https://sattacademy.com/public/custom/blank.png" alt="Avatar" class="rounded-circle" id="notification-avatar"> <div class="w-100"> <h6 class="dropdown-item-title mb-1" id="notification-title"></h6> <p class="text-sm small text-muted mb-2"><i class="far fa-clock mr-2"></i> <span id="notification-time"></span> </p> </div> </div> <div class="media-body"> <p class="text-sm my-2" id="notification-body"> </p> <a href="#" class="notification-action btn btn-primary btn-sm rounded-1 d-none">Action</a> </div> </div> </div> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> </div> </div> </div> </div> <div class="modal fade" id="notification_item_list_modal"> <div class="modal-dialog modal-dialog-centered modal-dialog-scrollable"> <div class="modal-content"> <div class="modal-header"> <h1 class="modal-title fs-5" id="exampleModalLabel">All Notifications</h1> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> <a href="#" class="dropdown-item notification-message-item"> <div class="notification-media d-flex align-items-start gap-3"> <div class="symbol"> <img src="https://new-job-solution.test/custom/blank.png" alt="User Avatar" class="rounded-circle"> </div> <div class="media-body"> <h6 class="dropdown-item-title mb-1">Lorem ipsum dolor sit amet consectetur adipisicing elit. Eaque, officia!</h6> <p class="text-sm mb-1"> Lorem ipsum dolor, sit amet consectetur adipisicing elit. Ducimus nihil, quo, quis minus aspernatur expedita, incidunt facilis aliquid inventore voluptate dolores accusantium laborum labore a dolorum dolore omnis qui? Consequuntur sed facilis repellendus corrupti amet in quibusdam ducimus illo autem, a praesentium. </p> <p class="text-sm text-muted mb-0"><i class="far fa-clock mr-2"></i> 1 hour ago </p> </div> </div> </a> <a href="#" class="dropdown-item notification-message-item"> <div class="notification-media d-flex align-items-start gap-3"> <div class="symbol"> <img src="https://new-job-solution.test/custom/blank.png" alt="User Avatar" class="rounded-circle"> </div> <div class="media-body"> <h6 class="dropdown-item-title mb-1">Lorem ipsum dolor sit amet consectetur adipisicing elit. Eaque, officia!</h6> <p class="text-sm mb-1"> Lorem ipsum dolor, sit amet consectetur adipisicing elit. Ducimus nihil, quo, quis minus aspernatur expedita, incidunt facilis aliquid inventore voluptate dolores accusantium laborum labore a dolorum dolore omnis qui? Consequuntur sed facilis repellendus corrupti amet in quibusdam ducimus illo autem, a praesentium. </p> <p class="text-sm text-muted mb-0"><i class="far fa-clock mr-2"></i> 1 hour ago </p> </div> </div> </a> <a href="#" class="dropdown-item notification-message-item"> <div class="notification-media d-flex align-items-start gap-3"> <div class="symbol"> <img src="https://new-job-solution.test/custom/blank.png" alt="User Avatar" class="rounded-circle"> </div> <div class="media-body"> <h6 class="dropdown-item-title mb-1">Lorem ipsum dolor sit amet consectetur adipisicing elit. Eaque, officia!</h6> <p class="text-sm mb-1"> Lorem ipsum dolor, sit amet consectetur adipisicing elit. Ducimus nihil, quo, quis minus aspernatur expedita, incidunt facilis aliquid inventore voluptate dolores accusantium laborum labore a dolorum dolore omnis qui? Consequuntur sed facilis repellendus corrupti amet in quibusdam ducimus illo autem, a praesentium. </p> <p class="text-sm text-muted mb-0"><i class="far fa-clock mr-2"></i> 1 hour ago </p> </div> </div> </a> <a href="#" class="dropdown-item notification-message-item"> <div class="notification-media d-flex align-items-start gap-3"> <div class="symbol"> <img src="https://new-job-solution.test/custom/blank.png" alt="User Avatar" class="rounded-circle"> </div> <div class="media-body"> <h6 class="dropdown-item-title mb-1">Lorem ipsum dolor sit amet consectetur adipisicing elit. Eaque, officia!</h6> <p class="text-sm mb-1"> Lorem ipsum dolor, sit amet consectetur adipisicing elit. Ducimus nihil, quo, quis minus aspernatur expedita, incidunt facilis aliquid inventore voluptate dolores accusantium laborum labore a dolorum dolore omnis qui? Consequuntur sed facilis repellendus corrupti amet in quibusdam ducimus illo autem, a praesentium. </p> <p class="text-sm text-muted mb-0"><i class="far fa-clock mr-2"></i> 1 hour ago </p> </div> </div> </a> <a href="#" class="dropdown-item notification-message-item"> <div class="notification-media d-flex align-items-start gap-3"> <div class="symbol"> <img src="https://new-job-solution.test/custom/blank.png" alt="User Avatar" class="rounded-circle"> </div> <div class="media-body"> <h6 class="dropdown-item-title mb-1">Lorem ipsum dolor sit amet consectetur adipisicing elit. Eaque, officia!</h6> <p class="text-sm mb-1"> Lorem ipsum dolor, sit amet consectetur adipisicing elit. Ducimus nihil, quo, quis minus aspernatur expedita, incidunt facilis aliquid inventore voluptate dolores accusantium laborum labore a dolorum dolore omnis qui? Consequuntur sed facilis repellendus corrupti amet in quibusdam ducimus illo autem, a praesentium. </p> <p class="text-sm text-muted mb-0"><i class="far fa-clock mr-2"></i> 1 hour ago </p> </div> </div> </a> <a href="#" class="dropdown-item notification-message-item"> <div class="notification-media d-flex align-items-start gap-3"> <div class="symbol"> <img src="https://new-job-solution.test/custom/blank.png" alt="User Avatar" class="rounded-circle"> </div> <div class="media-body"> <h6 class="dropdown-item-title mb-1">Lorem ipsum dolor sit amet consectetur adipisicing elit. Eaque, officia!</h6> <p class="text-sm mb-1"> Lorem ipsum dolor, sit amet consectetur adipisicing elit. Ducimus nihil, quo, quis minus aspernatur expedita, incidunt facilis aliquid inventore voluptate dolores accusantium laborum labore a dolorum dolore omnis qui? Consequuntur sed facilis repellendus corrupti amet in quibusdam ducimus illo autem, a praesentium. </p> <p class="text-sm text-muted mb-0"><i class="far fa-clock mr-2"></i> 1 hour ago </p> </div> </div> </a> <a href="#" class="dropdown-item notification-message-item"> <div class="notification-media d-flex align-items-start gap-3"> <div class="symbol"> <img src="https://new-job-solution.test/custom/blank.png" alt="User Avatar" class="rounded-circle"> </div> <div class="media-body"> <h6 class="dropdown-item-title mb-1">Lorem ipsum dolor sit amet consectetur adipisicing elit. Eaque, officia!</h6> <p class="text-sm mb-1"> Lorem ipsum dolor, sit amet consectetur adipisicing elit. Ducimus nihil, quo, quis minus aspernatur expedita, incidunt facilis aliquid inventore voluptate dolores accusantium laborum labore a dolorum dolore omnis qui? Consequuntur sed facilis repellendus corrupti amet in quibusdam ducimus illo autem, a praesentium. </p> <p class="text-sm text-muted mb-0"><i class="far fa-clock mr-2"></i> 1 hour ago </p> </div> </div> </a> <a href="#" class="dropdown-item notification-message-item"> <div class="notification-media d-flex align-items-start gap-3"> <div class="symbol"> <img src="https://new-job-solution.test/custom/blank.png" alt="User Avatar" class="rounded-circle"> </div> <div class="media-body"> <h6 class="dropdown-item-title mb-1">Lorem ipsum dolor sit amet consectetur adipisicing elit. Eaque, officia!</h6> <p class="text-sm mb-1"> Lorem ipsum dolor, sit amet consectetur adipisicing elit. Ducimus nihil, quo, quis minus aspernatur expedita, incidunt facilis aliquid inventore voluptate dolores accusantium laborum labore a dolorum dolore omnis qui? Consequuntur sed facilis repellendus corrupti amet in quibusdam ducimus illo autem, a praesentium. </p> <p class="text-sm text-muted mb-0"><i class="far fa-clock mr-2"></i> 1 hour ago </p> </div> </div> </a> <a href="#" class="dropdown-item notification-message-item"> <div class="notification-media d-flex align-items-start gap-3"> <div class="symbol"> <img src="https://new-job-solution.test/custom/blank.png" alt="User Avatar" class="rounded-circle"> </div> <div class="media-body"> <h6 class="dropdown-item-title mb-1">Lorem ipsum dolor sit amet consectetur adipisicing elit. Eaque, officia!</h6> <p class="text-sm mb-1"> Lorem ipsum dolor, sit amet consectetur adipisicing elit. Ducimus nihil, quo, quis minus aspernatur expedita, incidunt facilis aliquid inventore voluptate dolores accusantium laborum labore a dolorum dolore omnis qui? Consequuntur sed facilis repellendus corrupti amet in quibusdam ducimus illo autem, a praesentium. </p> <p class="text-sm text-muted mb-0"><i class="far fa-clock mr-2"></i> 1 hour ago </p> </div> </div> </a> <a href="#" class="dropdown-item notification-message-item"> <div class="notification-media d-flex align-items-start gap-3"> <div class="symbol"> <img src="https://new-job-solution.test/custom/blank.png" alt="User Avatar" class="rounded-circle"> </div> <div class="media-body"> <h6 class="dropdown-item-title mb-1">Lorem ipsum dolor sit amet consectetur adipisicing elit. Eaque, officia!</h6> <p class="text-sm mb-1"> Lorem ipsum dolor, sit amet consectetur adipisicing elit. Ducimus nihil, quo, quis minus aspernatur expedita, incidunt facilis aliquid inventore voluptate dolores accusantium laborum labore a dolorum dolore omnis qui? Consequuntur sed facilis repellendus corrupti amet in quibusdam ducimus illo autem, a praesentium. </p> <p class="text-sm text-muted mb-0"><i class="far fa-clock mr-2"></i> 1 hour ago </p> </div> </div> </a> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button> </div> </div> </div> </div> <!-- begin: Dynamic offcanvas --> <div class="offcanvas" tabindex="-1" id="satt_dynamic_offcanvas" aria-labelledby="offcanvasLabel"> <div class="offcanvas-header"> <h5 class="offcanvas-title" id="offcanvasLabel">Promotion</h5> <button type="button" class="btn-close promotion-close-btn" data-bs-dismiss="offcanvas" aria-label="Close"></button> </div> <div class="offcanvas-body promotion-body" id="dynamic_offcanvas_body"> </div> </div> <!-- end: Dynamic offcanvas --> <!--begin::Javascript--> <script src="https://code.jquery.com/jquery-3.6.1.min.js" integrity="sha256-o88AwQnZB+VDvE9tvIXrMQaPlFFSUTR+nldQm1LuPXQ=" crossorigin="anonymous"></script> <!--Bootstrap Js --> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"> </script> <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.min.js"></script> <script src="https://sattacademy.com/public/custom/js/jquery.meanmenu.min.js"></script> <style> .swal2-container.swal2-center>.swal2-popup { padding: 20px !important; } div:where(.swal2-container) div:where(.swal2-actions) { gap: 12px; } span.alert_satt_title { position: absolute; top: 16px; left: 0; right: 0; font-size: 1.5rem; font-weight: 600; text-transform: uppercase; } /* .swal2-popup .swal2-title { margin-bottom: -20px; } */ .swal2-close { margin-top: -18px !important; } </style> <script> function restrict(data) { var globalPackagePlans = [{"id":17,"package_id":5,"name":"S-BASIC","monthly_price":100,"yearly_price":1200,"monthly_discount":50,"yearly_discount":800,"discount_type":"fixed","status":"active","created_by":1,"updated_by":1,"created_at":"2024-11-12T03:03:26.000000Z","updated_at":"2024-11-12T06:58:51.000000Z","deleted_at":null},{"id":18,"package_id":5,"name":"S-PLUS","monthly_price":250,"yearly_price":3000,"monthly_discount":100,"yearly_discount":2200,"discount_type":"fixed","status":"active","created_by":1,"updated_by":1,"created_at":"2024-11-12T03:04:38.000000Z","updated_at":"2024-11-12T07:08:33.000000Z","deleted_at":null},{"id":19,"package_id":5,"name":"S-PRO","monthly_price":400,"yearly_price":4800,"monthly_discount":200,"yearly_discount":3600,"discount_type":"fixed","status":"active","created_by":1,"updated_by":1,"created_at":"2024-11-12T03:06:34.000000Z","updated_at":"2024-11-12T08:42:37.000000Z","deleted_at":null}]; // show alert if subscriptions need if (data.need_subscribe == true) { hideSpinner(); Swal.fire({ title: '<p class="mb-0"><b class="text-warning">Free limit exceeded!</b></p><p class="mb-0 fs-6">Subscribe for unlimited access!</p>', icon: "warning", showDenyButton: true, showCancelButton: true, confirmButtonText: "View Details", denyButtonText: `Not Now!`, html: ` <div x-data="{ activeTab: 'monthly' }" class="restrictCard"> <span class="alert_satt_title">SATT Academy</span> <!-- Nav tabs --> <ul class="nav nav-tabs justify-content-center" role="tablist"> <li class="nav-item"> <a class="nav-link" :class="{ 'active': activeTab === 'monthly' }" @click.prevent="activeTab = 'monthly'" href="#">Monthly</a> </li> <li class="nav-item"> <a class="nav-link" :class="{ 'active': activeTab === 'yearly' }" @click.prevent="activeTab = 'yearly'" href="#">Yearly</a> </li> </ul> <!-- Tab panes --> <div class="tab-content"> <div id="monthly" x-show="activeTab === 'monthly'" class="container tab-pane active"><br> <div class="table-responsive"> <table class="table" style="border: 1px solid black;"> <thead class="restrict-thead text-dark rounded"> <tr class="text-center" style="border: 1px solid black;"> <th class="ps-2">Package</th> <th>Price</th> <th>Action</th> </tr> </thead> <tbody> ${globalPackagePlans.map(plan => ` <tr style="border: 1px solid black;"> <td>${plan.name}</td> <td> <span class="text-muted text-decoration-line-through fs-7">${plan.monthly_price}</span> <span class="fw-bolder text-success fs-5">${ (plan.discount_type === 'fixed' ? plan.monthly_price - plan.monthly_discount : (plan.monthly_price - (plan.monthly_price/100)*plan.monthly_discount ) )}৳</span> </td> <td> <div class="mt-n6 d-flex gap-3"> <form action="https://sattacademy.com/public/subscribe" method="post"> <input type="hidden" name="_token" value="cpD0Ry8y7DbDLBOJoEMtREsFCH6k20fTWQX4NBlV" autocomplete="off"> <input type="hidden" name="id" value="${plan.id}"/> <input type="hidden" name="type" value="plan"/> <input type="hidden" name="month_year" value="month"/> <button type="submit" class="btn btn-green text-white btn-sm ">Subscribe</button> </form> <a href="https://sattacademy.com/public/packages" class="btn btn-details text-white btn-sm d-none d-md-block">View Details</a> </div> </td> </tr> `).join('')} </tbody> </table> </div> </div> <div id="yearly" x-show="activeTab === 'yearly'" class="container tab-pane active"><br> <div class="table-responsive"> <table class="table" style="border: 1px solid black;"> <thead class="restrict-thead bg-secondary text-dark rounded"> <tr class="text-center" style="border: 1px solid black;"> <th class="ps-2">Package</th> <th>Price</th> <th>Action</th> </tr> </thead> <tbody> ${globalPackagePlans.map(plan => ` <tr style="border: 1px solid black;"> <td>${plan.name}</td> <td> <span class="text-muted text-decoration-line-through fs-7">${plan.yearly_price}</span> <span class="fw-bolder text-success fs-5">${ (plan.discount_type === 'fixed' ? plan.yearly_price - plan.yearly_discount : (plan.yearly_price - (plan.yearly_price/100)*plan.yearly_discount ) )}৳</span> </td> <td> <div class="mt-n6 d-flex gap-3"> <form action="https://sattacademy.com/public/subscribe" method="post"> <input type="hidden" name="_token" value="cpD0Ry8y7DbDLBOJoEMtREsFCH6k20fTWQX4NBlV" autocomplete="off"> <input type="hidden" name="id" value="${plan.id}"/> <input type="hidden" name="type" value="plan"/> <input type="hidden" name="month_year" value="year"/> <button type="submit" class="btn btn-green text-white btn-sm ">Subscribe</button> </form> <a href="https://sattacademy.com/public/packages" class="btn btn-details text-white btn-sm d-none d-md-block">View Details</a> </div> </td> </tr> `).join('')} </tbody> </table> </div> </div> </div> </div> `, width: '570px', heightAuto: true, customClass: { popup: 'swal-height', confirmButton: 'btn-green', }, showCloseButton: true }).then((result) => { if (result.isConfirmed) { Swal.fire("Redirecting to package plan page...", "", "success"); window.location.href = "/packages"; } else if (result.isDenied) { Swal.fire("Thanks, But if you want this service you need to subscribe", "", "info"); } }); } else if (data.need_login == true) { hideSpinner(); Swal.fire({ title: data.message?.title ?? "Login to continue...", text: data.message?.body ?? "If you need more content, you need to login", icon: "warning", showDenyButton: true, showCancelButton: true, confirmButtonText: "Login Now", denyButtonText: `Not Now!` }).then((result) => { /* Read more about isConfirmed, isDenied below */ if (result.isConfirmed) { Swal.fire("Redirecting to login page...", "", "success"); // if user want to subscribe then redirect to package plan page window.location.href = "/login"; } else if (result.isDenied) { Swal.fire("Thanks, But if you need more content, you need to login", "", "info"); } }); hideSpinner(); } else { hideSpinner(); window.scrollTo({ top: 0, behavior: 'smooth' }); MathJax.Hub.Typeset(); } } // subscribe alert function hideSpinner() { $("#spinner-gif").hide(); $("#spinner-gif_1").hide(); $("#spinner-gif_2").hide(); $("#spinner-gif_3").hide(); $("#spinner-gif_4").hide(); $("#spinner-gif_5").hide(); $('.indicator-label').show(); $('.indicator-progress').hide(); $('#kk_modal_new_service_submit').removeAttr('disabled'); } function activeTab() { // active, inactive tab $(document).on('click', '.subject-list-nav li button', function(e) { e.preventDefault(); $('.subject-list-nav li button').removeClass('active'); $(this).addClass('active'); }); } </script> <script> /**** Livewire Alert Scripts ****/ (()=>{var __webpack_modules__={757:(e,t,r)=>{e.exports=r(666)},666:e=>{var t=function(e){"use strict";var t,r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{s({},"")}catch(e){s=function(e,t,r){return e[t]=r}}function l(e,t,r,n){var o=t&&t.prototype instanceof y?t:y,i=Object.create(o.prototype),a=new x(n||[]);return i._invoke=function(e,t,r){var n=f;return function(o,i){if(n===_)throw new Error("Generator is already running");if(n===d){if("throw"===o)throw i;return S()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=L(a,r);if(c){if(c===h)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===f)throw n=d,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=_;var s=u(e,t,r);if("normal"===s.type){if(n=r.done?d:p,s.arg===h)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n=d,r.method="throw",r.arg=s.arg)}}}(e,r,a),i}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=l;var f="suspendedStart",p="suspendedYield",_="executing",d="completed",h={};function y(){}function v(){}function b(){}var m={};s(m,i,(function(){return this}));var w=Object.getPrototypeOf,g=w&&w(w(D([])));g&&g!==r&&n.call(g,i)&&(m=g);var O=b.prototype=y.prototype=Object.create(m);function E(e){["next","throw","return"].forEach((function(t){s(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function r(o,i,a,c){var s=u(e[o],e,i);if("throw"!==s.type){var l=s.arg,f=l.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,a,c)}),(function(e){r("throw",e,a,c)})):t.resolve(f).then((function(e){l.value=e,a(l)}),(function(e){return r("throw",e,a,c)}))}c(s.arg)}var o;this._invoke=function(e,n){function i(){return new t((function(t,o){r(e,n,t,o)}))}return o=o?o.then(i,i):i()}}function L(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,L(e,r),"throw"===r.method))return h;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return h}var o=u(n,e.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,h;var i=o.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,h):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,h)}function j(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function P(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(j,this),this.reset(!0)}function D(e){if(e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return a.next=a}}return{next:S}}function S(){return{value:t,done:!0}}return v.prototype=b,s(O,"constructor",b),s(b,"constructor",v),v.displayName=s(b,c,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===v||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,s(e,c,"GeneratorFunction")),e.prototype=Object.create(O),e},e.awrap=function(e){return{__await:e}},E(k.prototype),s(k.prototype,a,(function(){return this})),e.AsyncIterator=k,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new k(l(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(O),s(O,c,"Generator"),s(O,i,(function(){return this})),s(O,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=D,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var s=n.call(a,"catchLoc"),l=n.call(a,"finallyLoc");if(s&&l){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,h):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),h},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),P(r),h}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;P(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:D(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),h}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}},__webpack_module_cache__={};function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](r,r.exports,__webpack_require__),r.exports}__webpack_require__.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return __webpack_require__.d(t,{a:t}),t},__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var __webpack_exports__={};(()=>{"use strict";var _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__=__webpack_require__(757),_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default=__webpack_require__.n(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0__);function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function asyncGeneratorStep(e,t,r,n,o,i,a){try{var c=e[i](a),s=c.value}catch(e){return void r(e)}c.done?t(s):Promise.resolve(s).then(n,o)}function _asyncToGenerator(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function a(e){asyncGeneratorStep(i,n,o,a,c,"next",e)}function c(e){asyncGeneratorStep(i,n,o,a,c,"throw",e)}a(void 0)}))}}function evalCallbacksOptions(options){for(var callbacksKeysAllowed=["allowOutsideClick","allowEscapeKey","allowEnterKey","loaderHtml","inputOptions","inputValidator","preConfirm","preDeny","didClose","didDestroy","didOpen","didRender","willClose","willOpen"],_i=0,_callbacksKeysAllowed=callbacksKeysAllowed;_i<_callbacksKeysAllowed.length;_i++){var callbackKey=_callbacksKeysAllowed[_i];options.hasOwnProperty(callbackKey)&&("string"==typeof options[callbackKey]||options[callbackKey]instanceof String)&&options[callbackKey]&&""!=options[callbackKey].trim()&&(options[callbackKey]=eval(options[callbackKey]))}}function afterAlertInteraction(e){if(e.confirmed)return"self"===e.onConfirmed.component?void Livewire.find(e.onConfirmed.id).dispatchSelf(e.onConfirmed.listener,e.result):void Livewire.dispatchTo(e.onConfirmed.component,e.onConfirmed.listener,e.result);if(e.isDenied)return"self"===e.onDenied.component?void Livewire.find(e.onDenied.id).dispatchSelf(e.onDenied.listener,e.result):void Livewire.dispatchTo(e.onDenied.component,e.onDenied.listener,e.result);if(e.onProgressFinished&&e.dismiss===Swal.DismissReason.timer)return"self"===e.onProgressFinished.component?void Livewire.find(e.onProgressFinished.id).dispatchSelf(e.onProgressFinished.listener,e.result):void Livewire.dispatchTo(e.onProgressFinished.component,e.onProgressFinished.listener,e.result);if(e.onDismissed){if("self"===e.onDismissed.component)return void Livewire.find(e.onDismissed.id).dispatch(e.onDismissed.listener,e.result);Livewire.dispatchTo(e.onDismissed.component,e.onDismissed.listener,e.result)}}window.addEventListener("alert",function(){var e=_asyncToGenerator(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark((function e(t){var r,n,o,i,a,c,s,l;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=t.detail.message,i=null!==(r=t.detail.type)&&void 0!==r?r:null,a=t.detail.data,c=t.detail.events,evalCallbacksOptions(s=t.detail.options),e.next=8,Swal.fire(_objectSpread({title:o,icon:i},s));case 8:afterAlertInteraction(_objectSpread(_objectSpread(_objectSpread({confirmed:(l=e.sent).isConfirmed,denied:l.isDenied,dismiss:l.dismiss,result:_objectSpread(_objectSpread({},l),{},{data:_objectSpread(_objectSpread({},a),{},{inputAttributes:null!==(n=s.inputAttributes)&&void 0!==n?n:null})})},c),l),s));case 10:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),window.flashAlert=function(){var e=_asyncToGenerator(_babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().mark((function e(t){var r,n,o,i,a,c,s;return _babel_runtime_regenerator__WEBPACK_IMPORTED_MODULE_0___default().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=t.events,a=t.events.data,evalCallbacksOptions(c=t.options),e.next=6,Swal.fire(_objectSpread({title:null!==(r=t.message)&&void 0!==r?r:"",icon:null!==(n=t.type)&&void 0!==n?n:null},c));case 6:afterAlertInteraction(_objectSpread(_objectSpread({confirmed:(s=e.sent).isConfirmed,denied:s.isDenied,dismiss:s.dismiss,result:_objectSpread(_objectSpread({},s),{},{data:_objectSpread(_objectSpread({},a),{},{inputAttributes:null!==(o=c.inputAttributes)&&void 0!==o?o:null})})},i),t.options));case 8:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()})()})(); </script> <script> </script> <script> </script> <!---Global page js----> <script src="https://sattacademy.com/public/custom/js/globalPage.js"></script> <!---Dependable category ----> <script src="https://sattacademy.com/public/js/custom.js"></script> <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.min.js"></script> <!--Toastr Notification --> <script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/js/toastr.min.js"></script> <script> </script> <!--import Global search script--> <script type="text/javascript"> //Margin remove function function revomeMargin(){ $('.search-question').find('p').css({ 'margin' : '0px' }); } //Global search $(document).ready(function() { var timeout = null; $(document).on('keyup', '.global-search-input', function() { var this_input = $(this); //console.log(id) clearTimeout(timeout); timeout = setTimeout(() => { var val = $(this).val(); if (val == "") { $('.global-search-spinner').addClass('d-none'); $('#global-search-result').html(''); } //If val is not empty. else { //show spinner $('.global-search-spinner').removeClass('d-none'); //AJAX is called. $.ajax({ type: "POST", url: "https://sattacademy.com/public/global-search", headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')}, data: { //Assigning value of "val" into "search_txt" variable. search_txt: val, }, //If result found, this funtion will be called. success: function(data) { //console.log(data) $('.global-search-spinner').addClass('d-none'); $('#global-search-result').html(data.html); }, complete:function(){ revomeMargin(); } }); } }, 1000); }); $(document).on('click', '#go-to-search', function(){ //console.log('here'); var val = $('.global-search-input').val(); var url = "/search-results?search_txt="+val; window.location.href = url ; }) }) </script> <script> document.addEventListener('livewire:navigated', () => { $('.sa-avatar').click(function(e) { $('#profile-menu').addClass('d-flex'); }); // Search $('.fa-search').click(function(e) { $('#global-menu').addClass('d-flex'); }); $(document).click(function(e) { if (e.target.id != 'profile-menu' && !e.target.classList.contains('sa-avatar')) { $('#profile-menu').removeClass('d-flex'); } // Search if (e.target.closest('#global-menu') == null && !e.target.classList.contains('fa-search')) { $('#global-menu').removeClass('d-flex'); } }); }); // PWA Loader document.addEventListener('DOMContentLoaded', function() { // Page is loaded, it is safe to hide loading animation document.getElementById('pwa-loader').style.display = 'none'; window.addEventListener('beforeunload', function() { if (window.matchMedia('(display-mode: standalone)').matches) { // User has triggered a navigation, show the loading animation document.getElementById('pwa-loader').style.display = 'block'; } }); }); </script> <script> $(document).ready(function() { /// chapter select base parent with children select // var chapter = $('#chapter-self-test'); chapter.select2({ placeholder: "Select chapter" }); // chapter select base parent with children select chapter.on('change', function(e) { var selectedValues = $(this).val(); // Get the selected values as an array setSelected(selectedValues); }); function setSelected(selectedValues = []) { // Enable all options first $('#chapter-self-test option').prop('disabled', false); // Iterate over each selected value selectedValues.forEach(function(value) { var userArrOptions = $("select[name='chapter_id[]'] option[data-parent-id=" + value + "]"); if (userArrOptions.length === 0) return; userArrOptions.each(function() { var optionValue = $(this).val(); // Disable the option with the matching data-parent-id $('#chapter-self-test option[value="' + optionValue + '"]').prop('selected', false); $('#chapter-self-test option[value="' + optionValue + '"]').prop('disabled', true); // Recursively disable children options disableChildren(optionValue); }); }); // Refresh Select2 to reflect changes chapter.trigger('change.select2'); } function disableChildren(parentValue) { var childrenOptions = $("select[name='chapter_id[]'] option[data-parent-id=" + parentValue + "]"); if (childrenOptions.length === 0) return; childrenOptions.each(function() { var childValue = $(this).val(); // Disable the child option $('#chapter-self-test option[value="' + childValue + '"]').prop('selected', false); $('#chapter-self-test option[value="' + childValue + '"]').prop('disabled', true); // Recursively disable children options disableChildren(childValue); }); } }); </script> <script type="text/javascript"> $(document).ready(function() { $('#bookmark_type').select2({ tags: true, dropdownParent: $("#kk_modal_new_bookmark"), maximumSelectionLength: 1 }); }); </script> <script type="text/javascript"> //check mobile device function isMobileDevice() { var check = false; (function(a) { if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i .test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i .test(a.substr(0, 4))) check = true; })(navigator.userAgent || navigator.vendor || window.opera); return check; }; //Toolbar btn **Menu Show Hide**// $(document).ready(function() { $(document).on('click', '.toolbar-btn', function() { $(this).toggleClass('show'); $(this).toggleClass('menu-dropdown'); $(this).closest('div').find('.menu').toggleClass('show'); if (isMobileDevice() == 'false' || isMobileDevice() == false) { $(this).closest('div').find('.menu').css({ 'z-index': '105', 'position': 'absolute', 'margin': '0px', 'inset': '70px 0px auto auto', // 'transform' : 'traslate3d(-30px, 65px, 0px)' }); } else { $(this).closest('div').find('.menu').css({ 'z-index': '105', 'position': 'absolute', 'margin': '0px', 'inset': '170px 15px auto auto', // 'transform' : 'traslate3d(-15px, 55px, 0px)' }); } }); $('#kt_post').on('click', (evt) => { //console.log(evt.target.classList); const hasClass = evt.target.classList.contains('toolbar-btn'); if (!hasClass) { let isVisible = $('.toolbar-btn').siblings('div.menu-sub').is(":visible"); if (isVisible == true) { $('.toolbar-btn').removeClass('show').removeClass('menu-dropdown'); $('.toolbar-btn').closest('div').find('.menu').removeClass('show'); } } }); }); /**###### begin::vote||love ##########**/ $(document).on('click', '.vote', function() { var id = $(this).data('id'); var val = $(this).find('span.vote_value').text(); var type = $(this).data('type'); var click_element = $(this); $.ajax({ type: "GET", url: "https://sattacademy.com/public/question/vote" + '/' + id + '/' + type, dataType: 'json', success: function(data) { if (data.success) { //console.log(data); click_element.find('span.vote_value').text(parseInt(val) + 1); click_element.find('i.fa-heart').addClass('text-danger'); click_element.removeClass('vote custom-text-gray'); click_element.addClass('undo-vote text-danger'); click_element.data('vote_id', data.vote); //toastr.success(data.message); //toolbar btn chnage on toolbar btn click click_element.parent('div.favorite_btn').find('a').text('Remove Favorite'); click_element.parent('div.favorite_btn').find('a').addClass('undo-vote'); click_element.parent('div.favorite_btn').find('a').removeClass('vote'); } else { toastr.error(data.message); } } }) }); /**####### end::vote ##########**/ /**###### begin::undo vote #######**/ $(document).on('click', '.undo-vote', function() { var id = $(this).data('vote_id'); var question_id = $(this).data('id'); var val = $(this).find('span.vote_value').text(); var type = $(this).data('type'); //console.log(id); var thisbtn = $(this); $.ajax({ type: "GET", url: "https://sattacademy.com/public/question/undo-vote", data: { 'vote_id': id, 'question_id': question_id, 'type': type }, dataType: 'json', success: function(data) { thisbtn.find('span.vote_value').text(parseInt(val) - 1); thisbtn.find('i.fa-heart').removeClass('text-danger'); thisbtn.removeClass('undo-vote text-danger'); thisbtn.addClass('vote custom-text-gray'); //toolbar btn chnage on toolbar btn click thisbtn.parent('div.favorite_btn').find('a').text('Make Favorite'); thisbtn.parent('div.favorite_btn').find('a').addClass('vote'); thisbtn.parent('div.favorite_btn').find('a').removeClass('undo-vote'); } }); }) /**##### end::undo vote ########**/ /**#### begin::description like #####**/ $(document).on('click', '.description-like', function() { var id = $(this).data('description_id'); var val = $(this).find('span.des-like').text(); var type = $(this).data('btntype'); var click_element = $(this); $.ajax({ type: "GET", url: "https://sattacademy.com/public/description/like" + '/' + id, data: { btntype: type }, dataType: 'json', success: function(data) { if (data.success) { click_element.find('span.des-like').text(parseInt(val) + 1); if (type == 'like') { click_element.find('i.fa-thumbs-up').addClass('text-primary'); } else { click_element.find('i.fa-thumbs-down').addClass('text-primary'); } click_element.removeClass('description-like'); click_element.addClass('undo-description-like'); click_element.data('vote_id', data.vote); //toastr.success(data.message); } else { toastr.error(data.message); } } }) }) /**#### end::description like ######**/ /**##### begin::undo-description-like ######**/ $(document).on('click', '.undo-description-like', function() { var id = $(this).data('vote_id'); var description_id = $(this).data('description_id'); var val = $(this).find('span.des-like').text(); var type = $(this).data('btntype'); //console.log(type); var thisbtn = $(this); $.ajax({ type: "GET", url: "https://sattacademy.com/public/question/undo-description-like", data: { 'vote_id': id, 'description_id': description_id, 'btntype': type }, dataType: 'json', success: function(data) { if (data.success) { thisbtn.removeClass('undo-description-like'); thisbtn.addClass('description-like'); thisbtn.find('span.des-like').text(parseInt(val) - 1); if (type == 'like') { thisbtn.find('i.fa-thumbs-up').removeClass('text-primary'); } else { thisbtn.find('i.fa-thumbs-down').removeClass('text-primary'); } } else { toastr.error(data.message); } } }); }) /**##### end::undo-description-like #####**/ /**begin::Question Edit**/ //edit Question $(document).on('click', '.editQuestion', function() { var id = $(this).data('id'); var question = $(this).data('question'); var type = $(this).data('type'); //console.log(question); Swal.fire({ text: "Are you sure you want to edit this question?", icon: "warning", showCancelButton: !0, buttonsStyling: !1, confirmButtonText: "Confirm", cancelButtonText: "No, cancel", customClass: { confirmButton: "btn fw-bold btn-danger", cancelButton: "btn fw-bold btn-active-light-primary" } }).then((function(o) { if (o.value) { //if agree if (type == 'written') { myEditor3.setData(question); $("input[name='question']").val(question); $("input[name='question_id']").val(id); $("#kk_edit_written_question_modal").modal('show'); // $.ajax({ // type:"GET", // url: "https://sattacademy.com/public/question/edit-written-question"+'/'+id, // dataType: 'json', // success:function(data){ // $("#edit_question_data").html(data.html); // $("#kk_edit_question_modal").modal('show'); // } // }); } else if (type == 'mcq') { $.ajax({ type: "GET", url: "https://sattacademy.com/public/question/edit-question" + '/' + id, dataType: 'json', success: function(data) { $("#edit_question_data").html(data.html); $("#kk_edit_question_modal").modal('show'); } }); } else if (type == 'samprotik') { $.ajax({ type: "GET", url: "https://sattacademy.com/public/samprotik-question/edit" + '/' + id, dataType: 'json', success: function(data) { $("#edit_question_data").html(data.html); $("#kk_edit_question_modal").modal('show'); } }); } } })) }); //edit question cancel button $(document).on('click', '#kk_modal_new_service_cancel', function() { //console.log('here'); $('.indicator-label').show() $('.indicator-progress').hide() $('#kk_modal_new_service_submit').removeAttr('disabled') $("#kk_edit_question_modal").modal('hide'); $("#kk_edit_written_question_modal").modal('hide'); }) //update mcq edited question $(document).on('submit', '#kk_modal_question_update_form', function(e) { e.preventDefault() //console.log('here') $('.with-errors').text(''); $('.indicator-label').hide(); $('.indicator-progress').show(); var formData = new FormData(this); $.ajax({ type: "POST", url: "https://sattacademy.com/public/question/edit-question/update", data: formData, cache: false, contentType: false, processData: false, success: function(data) { if (data.success == false || data.success == "false") { var arr = Object.keys(data.errors); var arr_val = Object.values(data.errors); for (var i = 0; i < arr.length; i++) { $('.' + arr[i] + '-error').text(arr_val[i][0]) } } else if (data.error || data.error == 'true') { var alertBox = '<div class="alert alert-danger alert-dismissable">' + data .message + '</div>'; $('#kk_modal_question_update_form').find('.messages').html(alertBox).show(); } else { // empty the form $('#kk_modal_question_update_form')[0].reset(); $("#kk_edit_question_modal").modal('hide'); toastr.success(data.message); } $('.indicator-label').show() $('.indicator-progress').hide() $('#kk_modal_new_service_submit').removeAttr('disabled') } }); }) /**end::Question Edit**/ //update written edited question $(document).on('submit', '#kk_modal_written_question_update_form', function(e) { e.preventDefault() //console.log('here') $('.with-errors').text(''); $('.indicator-label').hide(); $('.indicator-progress').show(); var formData = new FormData(this); $.ajax({ type: "POST", url: "https://sattacademy.com/public/written-question/edited-question/store", data: formData, cache: false, contentType: false, processData: false, success: function(data) { if (data.success == false || data.success == "false") { var arr = Object.keys(data.errors); var arr_val = Object.values(data.errors); for (var i = 0; i < arr.length; i++) { $('.' + arr[i] + '-error').text(arr_val[i][0]) } } else if (data.error || data.error == 'true') { var alertBox = '<div class="alert alert-danger alert-dismissable">' + data .message + '</div>'; $('#kk_modal_written_question_update_form').find('.messages').html(alertBox) .show(); } else { // empty the form $('#kk_modal_written_question_update_form')[0].reset(); $("#kk_edit_written_question_modal").modal('hide'); toastr.success(data.message); } $('.indicator-label').show() $('.indicator-progress').hide() $('#kk_modal_new_service_submit').removeAttr('disabled') } }); }) //update samprotik edited question $(document).on('submit', '#kk_modal_samprotik_question_update_form', function(e) { e.preventDefault() //console.log('here') $('.with-errors').text(''); $('.indicator-label').hide(); $('.indicator-progress').show(); var formData = new FormData(this); $.ajax({ type: "POST", url: "https://sattacademy.com/public/samprotik-question/edit-question/update", data: formData, cache: false, contentType: false, processData: false, success: function(data) { if (data.success == false || data.success == "false") { var arr = Object.keys(data.errors); var arr_val = Object.values(data.errors); for (var i = 0; i < arr.length; i++) { $('.' + arr[i] + '-error').text(arr_val[i][0]) } } else if (data.error || data.error == 'true') { var alertBox = '<div class="alert alert-danger alert-dismissable">' + data .message + '</div>'; $('#kk_modal_samprotik_question_update_form').find('.messages').html(alertBox) .show(); } else { // empty the form $('#kk_modal_samprotik_question_update_form')[0].reset(); $("#kk_edit_question_modal").modal('hide'); toastr.success(data.message); } $('.indicator-label').show() $('.indicator-progress').hide() $('#kk_modal_new_service_submit').removeAttr('disabled') } }); }) /**end::Question Edit**/ /**#########begin::Description ########**/ //get description// $(document).on('click', '.getDescription', function() { var id = $(this).data('id'); var type = $(this).data('type'); //console.log(type); var thisbtn = $(this); $.ajax({ type: "GET", beforeSend: function() { thisbtn.closest('span').find('.indicator-progress').show(); }, url: "https://sattacademy.com/public/description/get-des" + '/' + id + '/' + type, dataType: 'json', success: function(data) { thisbtn.parents('div.card-footer').find('div.all-description').html(data.html); thisbtn.removeClass('getDescription'); $('.indicator-progress').hide(); MathJax.Hub.Typeset(); }, complete: function() { //call the function on page load tableWrap(); imageSize(); $('.indicator-progress').hide(); } }); }) //add new description $(document).on('click', '.addDescription', function() { var id = $(this).data('id'); var type = $(this).data('type'); //console.log(id); $('.with-errors').text(''); $('.messages').text(''); myEditor.setData(''); $('#kk_modal_new_question_des_form')[0].reset(); $('input[name="question_id"]').val(id); $('input[name="type"]').val(type); $('#kk_modal_new_question_des').modal('show'); }); //new description save// $('#kk_modal_new_question_des_form').on('submit', function(e) { e.preventDefault() $('.with-errors').text(''); $('.indicator-label').hide(); $('.indicator-progress').show(); var formData = new FormData(this); formData.append('description', myEditor.getData()); $.ajax({ type: "POST", url: "https://sattacademy.com/public/description/store", data: formData, cache: false, contentType: false, processData: false, success: function(data) { if (data.success == false || data.success == "false") { var arr = Object.keys(data.errors); var arr_val = Object.values(data.errors); for (var i = 0; i < arr.length; i++) { $('.' + arr[i] + '-error').text(arr_val[i][0]) } } else if (data.error || data.error == 'true') { var alertBox = '<div class="alert alert-danger" alert-dismissable">' + data .message + '</div>'; $('#kk_modal_new_question_des_form').find('.messages').html(alertBox).show(); } else { // empty the form myEditor.setData(''); $('#kk_modal_new_question_des_form')[0].reset(); $("#kk_modal_new_question_des").modal('hide'); toastr.success(data.message); } $('.indicator-label').show(); $('.indicator-progress').hide(); $('#kk_modal_new_service_submit').removeAttr('disabled'); } }); }) //add description cancel button// $(document).on('click', '#kk_modal_add_description_cancel', function() { $('.with-errors').text(''); $('.indicator-label').show(); $('.indicator-progress').hide(); $('#kk_modal_new_service_submit').removeAttr('disabled'); $('#kk_modal_new_question_des_form')[0].reset(); $("#kk_modal_new_question_des").modal('hide'); }) /**########begin::edit-description#########**/ $(document).on('click', '.edit-description', function() { var des_id = $(this).data('description_id'); var short_description = $(this).data('short_description'); var description = $(this).data('description'); var question_id = $(this).data('question_id'); var type = $(this).data('type'); // console.log(des_id); Swal.fire({ text: "Are you sure you want to edit this description?", icon: "warning", showCancelButton: !0, buttonsStyling: !1, confirmButtonText: "Confirm", cancelButtonText: "No, cancel", customClass: { confirmButton: "btn fw-bold btn-danger", cancelButton: "btn fw-bold btn-active-light-primary" } }).then((function(o) { if (o.value) { //if agree myEditor4.setData(description); $("textarea[name='short_description']").val(short_description); $("textarea[name='description']").val(description); $("input[name='description_id']").val(des_id); $("input[name='question_id']").val(question_id); $("input[name='type']").val(type); $("#kk_modal_edit_description").modal('show'); // $("#kk_modal_edit_description").modal({ // focus: false // }); // $.ajax({ // type:"GET", // url: "https://sattacademy.com/public/description/edit-des", // dataType: 'json', // data:{ // 'description_id' : des_id // }, // success:function(data){ // $("#edit_description_data").html(data.html); // $("#kk_modal_edit_description").modal('show'); // } // }); } })) }); //update description// $(document).on('submit', '#kk_modal_edit_description_form', function(e) { e.preventDefault() $('.with-errors').text(''); $('.indicator-label').hide(); $('.indicator-progress').show(); var formData = new FormData(this); //formData.append('description', myEditor.getData()); $.ajax({ type: "POST", url: "https://sattacademy.com/public/description/update", data: formData, cache: false, contentType: false, processData: false, success: function(data) { if (data.success == false || data.success == "false") { var arr = Object.keys(data.errors); var arr_val = Object.values(data.errors); for (var i = 0; i < arr.length; i++) { $('.' + arr[i] + '-error').text(arr_val[i][0]) } } else if (data.error || data.error == 'true') { var alertBox = '<div class="alert alert-danger" alert-dismissable">' + data .message + '</div>'; $('#kk_modal_edit_description_form').find('.messages').html(alertBox).show(); } else { // empty the form $('#kk_modal_edit_description_form')[0].reset(); $("#kk_modal_edit_description").modal('hide'); toastr.success(data.message); } $('.indicator-label').show(); $('.indicator-progress').hide(); $('#kk_modal_new_service_submit').removeAttr('disabled'); } }); }) //description edit cancel button// $(document).on('click', '#kk_modal_edit_description_cancel', function() { $('.indicator-label').show(); $('.indicator-progress').hide(); $('#kk_modal_new_service_submit').removeAttr('disabled'); $('#kk_modal_edit_description_form')[0].reset(); $("#kk_modal_edit_description").modal('hide'); }) /**######### Show Hide Description #######*/ $(document).on('click', '.show-des', function() { $(this).closest('span').find('.fa-caret-right').css({ "transform": "rotate(90deg)" }); $(this).addClass('hide-des'); $(this).parents('div.card-footer').find('div.all-description').removeClass('d-none'); }) $(document).on('click', '.hide-des', function() { $(this).closest('span').find('.fa-caret-right').css({ "transform": "rotate(360deg)" }); $(this).parents('div.card-footer').find('div.all-description').addClass('d-none'); $(this).removeClass('hide-des'); }) /**########## end::Description #######**/ /**###### begin:: Bookmark ######**/ $(document).ready(function() { var thisbtn; $(document).on('click', '.bookmark', function() { var id = $(this).data('id'); var catid = $(this).data('catid'); var type = $(this).data('type'); //console.log('type'); // console.log(catid); thisbtn = $(this); $('.with-errors').text(''); $('#kk_modal_new_bookmark_form')[0].reset(); //append category_id and question_id into bookmark form $('input[name="question_id"]').val(id); $('input[name="catid"]').val(catid); $('input[name="type"]').val(type); $('#kk_modal_new_bookmark').modal('show'); }); //new bookmark save// $('#kk_modal_new_bookmark_form').on('submit', function(e) { e.preventDefault() $('.with-errors').text(''); $('.indicator-label').hide(); $('.indicator-progress').show(); var formData = new FormData(this); $.ajax({ type: "POST", url: "https://sattacademy.com/public/question/bookmark", data: formData, cache: false, contentType: false, processData: false, success: function(data) { if (data.success == false || data.success == "false") { var arr = Object.keys(data.errors); var arr_val = Object.values(data.errors); for (var i = 0; i < arr.length; i++) { $('.' + arr[i] + '-error').text(arr_val[i][0]) } } else if (data.error || data.error == 'true') { var alertBox = '<div class="alert alert-danger alert-dismissable">' + data .message + '</div>'; $('#kk_modal_new_bookmark_form').find('.messages').html(alertBox) .show(); } else { // empty the form $('#kk_modal_new_bookmark_form')[0].reset(); $("#kk_modal_new_bookmark").modal('hide'); toastr.success(data.message); //footer btn change on footer btn click thisbtn.addClass('remove-bookmark'); thisbtn.data('bookmark_id', data.bookmark.id); thisbtn.removeClass('bookmark') thisbtn.children().addClass('text-primary'); //tolbar html change on footer btn click thisbtn.parents('div.card-footer').siblings('div.card-header').find( 'div.bookmark-btn').find('a').addClass('remove-bookmark'); thisbtn.parents('div.card-footer').siblings('div.card-header').find( 'div.bookmark-btn').find('a').data('bookmark_id', data .bookmark.id); thisbtn.parents('div.card-footer').siblings('div.card-header').find( 'div.bookmark-btn').find('a').removeClass('bookmark'); thisbtn.parents('div.card-footer').siblings('div.card-header').find( 'div.bookmark-btn').find('a').text('Remove Bookmark'); //toolbar btn chnage on toolbar btn click thisbtn.parent('div.bookmark-btn').find('a').text( 'Remove Bookmark'); thisbtn.parent('div.bookmark-btn').find('a').addClass( 'remove-bookmark'); thisbtn.parent('div.bookmark-btn').find('a').removeClass( 'bookmark'); //footer button change on toolbar btn click thisbtn.parents('div.card-header').siblings('div.card-footer').find( 'div.footer-bookmark').find('a').addClass('remove-bookmark'); thisbtn.parents('div.card-header').siblings('div.card-footer').find( 'div.footer-bookmark').find('a').data('bookmark_id', data .bookmark.id); thisbtn.parents('div.card-header').siblings('div.card-footer').find( 'div.footer-bookmark').find('a').children().addClass( 'text-primary'); } $('.indicator-progress').hide(); $('.indicator-label').show(); $('#bookmark_type').val(null).trigger('change'); } }); }); //cancel button// $('#kk_modal_bookmark_cancel').on('click', function() { console.log('working'); $('.messages').empty(); $('.with-errors').text(''); $('.indicator-label').show(); $('.indicator-progress').hide(); $('#kk_modal_new_bookmark_form')[0].reset(); $('#kk_modal_new_bookmark').modal('hide'); $('#bookmark_type').val(null).trigger('change'); }) }); /**####### end:: Bookmark ###########**/ /**######## begin::remove from bookmark ########**/ $(document).on('click', '.remove-bookmark', function() { var id = $(this).data('bookmark_id'); //console.log('remove'); var thisbtn = $(this); Swal.fire({ text: "Are you sure you want to remove this Question from your bookmarks?", icon: "warning", showCancelButton: !0, buttonsStyling: !1, confirmButtonText: "Yes, remove", cancelButtonText: "No, cancel", customClass: { confirmButton: "btn fw-bold btn-danger", cancelButton: "btn fw-bold btn-active-light-primary" } }).then((function(o) { if (o.value) { //if agree $.ajax({ type: "GET", url: "https://sattacademy.com/public/question/remove-from-bookmark", dataType: 'json', data: { 'id': id }, success: function(data) { toastr.success(data.message); //footer btn change on footer btn click thisbtn.removeClass('remove-bookmark'); thisbtn.addClass('bookmark'); thisbtn.children().removeClass('text-primary'); //tolbar html change on footer btn click thisbtn.parents('div.card-footer').siblings('div.card-header') .find('div.bookmark-btn').find('a').addClass('bookmark'); thisbtn.parents('div.card-footer').siblings('div.card-header') .find('div.bookmark-btn').find('a').removeClass( 'remove-bookmark'); thisbtn.parents('div.card-footer').siblings('div.card-header') .find('div.bookmark-btn').find('a').text('Add Bookmark'); //toolbar btn chnage on toolbar btn click thisbtn.parent('div.bookmark-btn').find('a').text( 'Add Bookmark'); thisbtn.parent('div.bookmark-btn').find('a').addClass( 'bookmark'); thisbtn.parent('div.bookmark-btn').find('a').removeClass( 'remove-bookmark'); //footer button change on toolbar btn click thisbtn.parents('div.card-header').siblings('div.card-footer') .find('div.footer-bookmark').find('a').addClass('bookmark'); thisbtn.parents('div.card-header').siblings('div.card-footer') .find('div.footer-bookmark').find('a').removeClass( 'remove-bookmark'); thisbtn.parents('div.card-header').siblings('div.card-footer') .find('div.footer-bookmark').find('a').children() .removeClass('text-primary'); } }); } })) }) /**####### end::remove from bookmark ##########**/ /**####### begin::Video section ######**/ $(document).on('click', '.add-video', function() { $('#kk_modal_show_video').modal('hide'); var id = $(this).data('id'); // console.log(id); var type = $(this).data('type'); $('input[name="data_id"]').val(id); $('input[name="type"]').val(type); $('#kk_modal_add_video').modal('show'); }); $(document).on('click', '#kk_modal_add_video_cancel', function() { $('.messages').empty(); $('.with-errors').text(''); $('.indicator-label').show(); $('.indicator-progress').hide(); $('#kk_modal_add_video').modal('hide'); }) //add video// $(document).on('submit', '#kk_modal_new_video_form', function(e) { e.preventDefault(); $('.messages').empty(); $('.with-errors').text(''); $('.indicator-label').hide(); $('.indicator-progress').show(); var formData = new FormData(this); $.ajax({ type: "POST", url: "https://sattacademy.com/public/question/video/store", data: formData, cache: false, contentType: false, processData: false, success: function(data) { if (data.success == false || data.success == "false") { var arr = Object.keys(data.errors); var arr_val = Object.values(data.errors); for (var i = 0; i < arr.length; i++) { $('.' + arr[i] + '-error').text(arr_val[i][0]) } } else if (data.error || data.error == 'true') { var alertBox = '<div class="alert alert-danger" alert-dismissable">' + data .message + '</div>'; $('#kk_modal_new_video_form').find('.messages').html(alertBox).show(); } else { // empty the form $('#kk_modal_new_video_form')[0].reset(); $("#kk_modal_add_video").modal('hide'); toastr.success(data.message); } $('.indicator-label').show(); $('.indicator-progress').hide(); $('#kk_modal_new_service_submit').removeAttr('disabled'); } }); }) //show video// $(document).on('click', '.show-video', function() { var id = $(this).data('id'); // console.log(id); var type = $(this).data('type'); $.ajax({ type: "GET", url: "https://sattacademy.com/public/question/video/show" + '/' + id + '/' + type, dataType: 'json', beforeSend: function() { $('#kk_modal_add_video').modal('hide'); }, success: function(data) { $("#video_data").html(data.html); $("#kk_modal_show_video").modal('show'); }, complete: function() { var w = window.innerWidth; var h = window.innerHeight; // console.log(w); // console.log(h); if (w <= 390) { $('iframe').css({ 'width': '100%', 'height': 'auto' }) } else if (w > 390 && w <= 576) { $('iframe').css({ 'width': '100%', 'height': '200px' }) } else if (w > 576 && w <= 768) { $('iframe').css({ 'width': '100%', 'height': '250px' }) } else { $('iframe').css({ 'width': '100%', 'height': '315px' }) } } }); }); $(document).on('click', '#kk_modal_show_video_cancel', function() { $('#kk_modal_show_video').modal('hide'); }) /**###### end::Video section ########**/ /**####### begin::add tag ###########**/ //add new// $(document).on('click', '.tag', function() { var id = $(this).data('id'); var subject_id = $(this).data('subject_id'); var type = $(this).data('type'); // console.log(id); // console.log(subject_id); //clear $('input[name="question_id"]').val(''); $('input[name="subject_id"]').val(''); $('input[name="type"]').val(''); $('input[name="tag"]').val(''); $('div.result').html(''); $('div.tag-div_2').html(''); //append subject_id and question_id into tag modal// $('input[name="question_id"]').val(id); $('input[name="subject_id"]').val(subject_id); $('input[name="type"]').val(type); $('#kk_modal_add_tag').modal('show'); }); //search tag// $(document).ready(function() { var timeout = null; $(document).on('keyup', '.search_tag', function() { var question_id = $('input[name="question_id"]').val(); var subject_id = $('input[name="subject_id"]').val(); var type = $('input[name="type"]').val(); var this_input = $(this); //console.log(id) clearTimeout(timeout); timeout = setTimeout(() => { var val = $(this).val(); if (val == "") { $('.result').html(''); } //If val is not empty. else { //AJAX is called. $.ajax({ type: "POST", url: "https://sattacademy.com/public/question/tag/search", headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') }, data: { //Assigning value of "val" into "search" variable. search: val, question_id: question_id, subject_id: subject_id, type: type }, //If result found, this funtion will be called. success: function(data) { //console.log(data) this_input.closest('div').find('.result').html(data); //this_input.closest('#result').hide() //$('#result').html(data); } }); } }, 700); }); }) $(document).on('click', '#kk_modal_tag_close', function() { //clear $('input[name="question_id"]').val(''); $('input[name="subject_id"]').val(''); $('input[name="tag"]').val(''); $('input[name="type"]').val(''); $('div.result').html(''); $('div.tag-div_2').html(''); $('#kk_modal_add_tag').modal('hide'); }) //add tag $(document).on('click', '.add-tag', function() { var sid = $(this).data('sid'); var qid = $(this).data('qid'); var type = $(this).data('type'); var thisElement = $(this); //AJAX is called. $.ajax({ type: "POST", url: "https://sattacademy.com/public/question/tag/tag-added", headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') }, data: { //Assigning value of "val" into "search" variable. subject_id: sid, question_id: qid, type: type }, //If result found, this funtion will be called. success: function(data) { if (data.success) { toastr.success(data.message); // $('#kk_modal_add_tag').modal('hide'); // $('.result').html(''); // $('.search_tag').val(''); thisElement.removeClass('add-tag'); thisElement.addClass('remove-tag'); let html = `<span class="badge badge-info cursor-pointer fs-8 mb-3 me-2 remove-tag" data-sid="${data.subject.id}" data-qid="${data.question_id}" data-type="${data.type}" title="Remove">${data.subject.name}</span>`; thisElement.parents('div.modal-body').find('div.tag-div_2').append(html); } else { toastr.error(data.message); } } }); }) //remove tag// $(document).on('click', '.remove-tag', function() { var sid = $(this).data('sid'); var qid = $(this).data('qid'); var type = $(this).data('type'); //console.log(sid); //console.log(type); var thisBtn = $(this); console.log(thisBtn); //AJAX is called. $.ajax({ type: "POST", url: "https://sattacademy.com/public/admin/question/remove-tag", headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') }, data: { //Assigning value of "val" into "search" variable. subject_id: sid, question_id: qid, type: type }, //If result found, this funtion will be called. success: function(data) { if (data.success) { toastr.success(data.message); thisBtn.removeClass('remove-tag'); thisBtn.addClass('add-tag'); thisBtn.parents('div.modal-body').find('.tag-div_2 span[data-sid="' + sid + '"]').remove(); //location.reload(); } else { toastr.error(data.message) } } }); }) /**####### end::Tag #########**/ /*##### begin::Error Report #####*/ function cleanForm() { $('.messages').empty(); $('.with-errors').text(''); $('.indicator-label').show(); $('.indicator-progress').hide(); $('#kk_modal_error_report_form')[0].reset(); } $(document).on('click', '.error-report', function() { const id = $(this).data('id'); const type = $(this).data('type'); cleanForm(); $('input[name="id"]').val(id); $('input[name="type"]').val(type); $('#kk_modal_error_report').modal('show'); }) $(document).on('click', '#kk_modal_error_report_cancel', function() { cleanForm(); $('#kk_modal_error_report').modal('hide'); }) //submit $(document).on('submit', '#kk_modal_error_report_form', function(e) { e.preventDefault(); $('.messages').empty(); $('.with-errors').text(''); $('.indicator-label').hide(); $('.indicator-progress').show(); var formData = new FormData(this); $.ajax({ type: "POST", url: "https://sattacademy.com/public/error-report/store", data: formData, cache: false, contentType: false, processData: false, success: function(data) { if (data.success == false || data.success == "false") { var arr = Object.keys(data.errors); var arr_val = Object.values(data.errors); for (var i = 0; i < arr.length; i++) { $('.' + arr[i] + '-error').text(arr_val[i][0]) } } else if (data.error || data.error == 'true') { var alertBox = '<div class="alert alert-danger" alert-dismissable">' + data .message + '</div>'; $('#kk_modal_error_report_form').find('.messages').html(alertBox).show(); } else { // empty the form $('#kk_modal_error_report_form')[0].reset(); $("#kk_modal_error_report").modal('hide'); toastr.success(data.message); } $('.indicator-label').show(); $('.indicator-progress').hide(); } }); }) /*##### end::Error Report #####*/ /* begin::voteing script */ $(document).on('click', '.choosen-option', function() { if ($(this).is(':checked')) { var choosen = $(this).val(); } else { var choosen = 0; } let ques_id = $(this).data('ques_id'); //console.log(choosen); //set & get local storage data let previous = localStorage.getItem('key'); localStorage.setItem('key', choosen); //console.log(previous); const thisElement = $(this); incrementDecrement(thisElement, choosen, previous); //AJAX is called. $.ajax({ type: "POST", url: "https://sattacademy.com/public/mcq-question/answer-vote", headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') }, data: { ques_id: ques_id, choosen: choosen, }, //If result found, this funtion will be called. success: function(data) { if (data.success) { console.log(data.message); } else { toastr.error(data.message); } } }); }) /* end::voteing script */ function onlyOne(checkbox) { let name = $(checkbox).attr('name'); var checkboxes = document.getElementsByName(name) checkboxes.forEach((item) => { if (item !== checkbox) item.checked = false }) } function incrementDecrement(thisElement, choosen, previous) { var option1 = thisElement.parents('div.parent-card-body').find('span.vote_option_1'); var option2 = thisElement.parents('div.parent-card-body').find('span.vote_option_2'); var option3 = thisElement.parents('div.parent-card-body').find('span.vote_option_3'); var option4 = thisElement.parents('div.parent-card-body').find('span.vote_option_4'); var option5 = thisElement.parents('div.parent-card-body').find('span.vote_option_5'); if (choosen == 1) { let val = parseInt(option1.text()); option1.text(val + 1); } else if (choosen == 2) { let val = parseInt(option2.text()); option2.text(val + 1); } else if (choosen == 3) { let val = parseInt(option3.text()); option3.text(val + 1); } else if (choosen == 4) { let val = parseInt(option4.text()); option4.text(val + 1); } else if (choosen == 5) { let val = parseInt(option5.text()); option5.text(val + 1); } if (previous == 1) { let val = parseInt(option1.text()); if (val > 0) { option1.text(val - 1); } } else if (previous == 2) { let val = parseInt(option2.text()); if (val > 0) { option2.text(val - 1); } } else if (previous == 3) { let val = parseInt(option3.text()); if (val > 0) { option3.text(val - 1); } } else if (previous == 4) { let val = parseInt(option4.text()); if (val > 0) { option4.text(val - 1); } } else if (previous == 5) { let val = parseInt(option5.text()); if (val > 0) { option5.text(val - 1); } } } </script> <script type="text/javascript"> /**######begin::test mode & reading mode hide show #######**/ $(document).ready(function(){ $('.test-mode-data').addClass('d-none'); $('input[name="active_mode"]').val('reading'); $('.test-mode').on('click', function(){ $('.test-mode-data').removeClass('d-none'); $('.reading-mode-data').addClass('d-none'); $('.edit-btn-div').addClass('d-none'); $(this).addClass('d-none'); $('.mark-count').removeClass('d-none'); $('.reading-mode').removeClass('d-none'); $('input[name="active_mode"]').val('test'); $('.toolbar-div').addClass('d-none'); $('.tag-div').addClass('d-none'); $('.activity').addClass('d-none'); $('.custom-bookmark-card').addClass('d-none'); }) $('.reading-mode').on('click', function(){ $('.reading-mode-data').removeClass('d-none'); $('.test-mode-data').addClass('d-none'); $('.edit-btn-div').removeClass('d-none'); $(this).addClass('d-none'); $('.mark-count').addClass('d-none'); $('.test-mode').removeClass('d-none'); $('input[name="active_mode"]').val('reading'); $('.toolbar-div').removeClass('d-none'); $('.tag-div').removeClass('d-none'); $('.activity').removeClass('d-none'); $('.custom-bookmark-card').removeClass('d-none'); }) }) /**######end::test mode & reading mode hide show #######**/ /**######begin::Test #######**/ $(document).ready(function(){ $(document).on('click', '.click-option', function(){ var id = $(this).data('id') var option_value = $(this).data('option_value'); var answer = $(this).parents('div.parent-row').find('input[name="answer"]').val(); // console.log('question='+id); // console.log('option='+option_value); // console.log('answer='+answer); $(this).parents('div.parent-row').find('span').click(function() { return false; }); $(this).parents('div.parent-row').find('div.click-option').removeClass('cursor-pointer'); if(answer == 1){ $(this).parents('div.parent-row').find('i.option-1').removeClass('fa-dot-circle text-dark'); $(this).parents('div.parent-row').find('i.option-1').addClass('fa-check-circle fs-4 sa-success'); $(this).parents('div.parent-row').find('div.option-1-text').removeClass('text-dark'); $(this).parents('div.parent-row').find('div.option-1-text').addClass('sa-success fs-4 fw-bold'); }else if(answer == 2){ $(this).parents('div.parent-row').find('i.option-2').removeClass('fa-dot-circle text-dark'); $(this).parents('div.parent-row').find('i.option-2').addClass('fa-check-circle fs-4 sa-success'); $(this).parents('div.parent-row').find('div.option-2-text').removeClass('text-dark'); $(this).parents('div.parent-row').find('div.option-2-text').addClass('sa-success fs-2 fw-bold'); }else if(answer == 3){ $(this).parents('div.parent-row').find('i.option-3').removeClass('fa-dot-circle text-dark'); $(this).parents('div.parent-row').find('i.option-3').addClass('fa-check-circle fs-4 sa-success'); $(this).parents('div.parent-row').find('div.option-3-text').removeClass('text-dark'); $(this).parents('div.parent-row').find('div.option-3-text').addClass('sa-success fs-2 fw-bold'); }else if(answer == 4){ $(this).parents('div.parent-row').find('i.option-4').removeClass('fa-dot-circle text-dark'); $(this).parents('div.parent-row').find('i.option-4').addClass('fa-check-circle fs-4 sa-success'); $(this).parents('div.parent-row').find('div.option-4-text').removeClass('text-dark'); $(this).parents('div.parent-row').find('div.option-4-text').addClass('sa-success fs-2 fw-bold'); }else if(answer == 5){ $(this).parents('div.parent-row').find('i.option-5').removeClass('fa-dot-circle text-dark'); $(this).parents('div.parent-row').find('i.option-5').addClass('fa-check-circle fs-4 sa-success'); $(this).parents('div.parent-row').find('div.option-5-text').removeClass('text-dark'); $(this).parents('div.parent-row').find('div.option-5-text').addClass('sa-success fs-2 fw-bold'); } if(answer == option_value){ var val = $('#wright').html(); $('#wright').html(parseInt(val)+1); $(this).find('span.d-flex').append('<span class="ms-2"><i class="fas fa-check sa-success fs-3"></i></span>'); }else{ var val = $('#wrong').html(); //console.log(val) $('#wrong').html(parseInt(val)+1); $(this).find('span.d-flex').append('<span class="ms-2"><i class="fas fa-times sa-danger fs-3"></i></span>'); } }) }) /**######end::Test #######**/ /**begin::Question Edit**/ // //edit Question // $(document).on('click', '.editQuestion', function() { // var id = $(this).data('id'); // //console.log(id); // Swal.fire({ // text: "Are you sure you want to edit this Question?", // icon: "warning", // showCancelButton: !0, // buttonsStyling: !1, // confirmButtonText: "Confirm", // cancelButtonText: "No, cancel", // customClass: { // confirmButton: "btn fw-bold btn-danger", // cancelButton: "btn fw-bold btn-active-light-primary" // } // }).then((function (o) { // if(o.value){ //if agree // $.ajax({ // type:"GET", // url: "https://sattacademy.com/public/question/edit-question"+'/'+id, // dataType: 'json', // success:function(data){ // $("#edit_question_data").html(data.html); // $("#kk_edit_question_modal").modal('show'); // } // }); // } // })) // }); // //edit question cancel button // $(document).on('click', '#kk_modal_new_service_cancel', function(){ // $('.indicator-label').show() // $('.indicator-progress').hide() // $('#kk_modal_new_service_submit').removeAttr('disabled') // $("#kk_edit_question_modal").modal('hide'); // }) // //update edited question // $(document).on('submit', '#kk_modal_question_update_form', function(e){ // e.preventDefault() // //console.log('here') // $('.with-errors').text(''); // $('.indicator-label').hide(); // $('.indicator-progress').show(); // var formData = new FormData(this); // $.ajax({ // type:"POST", // url: "https://sattacademy.com/public/question/edit-question/update", // data:formData, // cache:false, // contentType: false, // processData: false, // success:function(data){ // if(data.success == false || data.success == "false"){ // var arr = Object.keys(data.errors); // var arr_val = Object.values(data.errors); // for(var i= 0;i < arr.length;i++){ // $('.'+arr[i]+'-error').text(arr_val[i][0]) // } // }else if(data.error || data.error == 'true'){ // var alertBox = '<div class="alert alert-danger" alert-dismissable">' + data.message + '</div>'; // $('#kk_modal_question_update_form').find('.messages').html(alertBox).show(); // }else{ // // empty the form // $('#kk_modal_question_update_form')[0].reset(); // $("#kk_edit_question_modal").modal('hide'); // toastr.success(data.message); // } // $('.indicator-label').show() // $('.indicator-progress').hide() // $('#kk_modal_new_service_submit').removeAttr('disabled') // } // }); // }) // /**end::Question Edit**/ /**########begin::edit-passage #########**/ $(document).on('click', '.edit-passage', function(){ var passage_id = $(this).data('passage_id'); //console.log(des_id); Swal.fire({ text: "Are you sure you want to edit this passage?", icon: "warning", showCancelButton: !0, buttonsStyling: !1, confirmButtonText: "Confirm", cancelButtonText: "No, cancel", customClass: { confirmButton: "btn fw-bold btn-danger", cancelButton: "btn fw-bold btn-active-light-primary" } }).then((function (o) { if(o.value){ //if agree $.ajax({ type:"GET", url: "https://sattacademy.com/public/question/passage/edit", dataType: 'json', data:{ 'passage_id' : passage_id }, success:function(data){ $("#edit_passage").html(data.html); $("#kk_modal_edit_passage").modal('show'); } }); } })) }); //update passage $(document).on('submit', '#kk_modal_edit_passage_form',function(e){ e.preventDefault() $('.with-errors').text(''); $('.indicator-label').hide(); $('.indicator-progress').show(); var formData = new FormData(this); // formData.append('passage', myPassaseEditor.getData()); $.ajax({ type:"POST", url: "https://sattacademy.com/public/question/passage/update", data:formData, cache:false, contentType: false, processData: false, success:function(data){ if(data.success == false || data.success == "false"){ var arr = Object.keys(data.errors); var arr_val = Object.values(data.errors); for(var i= 0;i < arr.length;i++){ $('.'+arr[i]+'-error').text(arr_val[i][0]) } }else if(data.error || data.error == 'true'){ var alertBox = '<div class="alert alert-danger" alert-dismissable">' + data.message + '</div>'; $('#kk_modal_edit_passage_form').find('.messages').html(alertBox).show(); }else{ // empty the form $('#kk_modal_edit_passage_form')[0].reset(); $("#kk_modal_edit_passage").modal('hide'); toastr.success(data.message); } $('.indicator-label').show(); $('.indicator-progress').hide(); $('#kk_modal_new_service_submit').removeAttr('disabled'); } }); }) //passage edit cancel button $(document).on('click', '#kk_modal_edit_passage_cancel', function(){ $('.indicator-label').show(); $('.indicator-progress').hide(); $('#kk_modal_new_service_submit').removeAttr('disabled'); $('#kk_modal_edit_passage_form')[0].reset(); $("#kk_modal_edit_passage").modal('hide'); }) /**#########end::edit-passage ##########**/ </script> <script type="text/javascript"> $(document).ready(function(){ $(document).on('click', '.test-yourself', function(){ $(this).text('Loading...'); var id = $(this).data('subject_id'); var total_ques = $(this).data('total_ques'); //console.log(id); $('.with-errors').text(''); $('#error-message').html(''); $('.messages').html(''); $('#kk_modal_self_test_form')[0].reset(); $('input[name="subject_id"]').val(id); var val = '<label class="d-flex align-items-center fs-6 fw-bold mb-2"><span class="">Subject Total Question</span> </label>' val += '<span class="badge badge-primary badge-lg " id="total">' + total_ques + '</span>' $('#total_question').html(val); $('#kk_modal_new_service_submit_btn').attr('disabled' , true); $('#kk_modal_self_test').modal('show'); setTimeout(() => { $(this).text('TEST'); }, 2000); }); //calculate the mark, time, cut mark function calculatePassMark(totalQuestion, value) { let val = Math.round((value * totalQuestion) / 100); return val ; } function calculateDuration(totalQuestion, value) { let val = Math.round((value * totalQuestion) / 100); return val ; } //empty the error message $(document).on('keyup', ".number_of_ques", function () { if(isNaN($(this).val()) || $(this).val() == NaN || $(this).val() == '') { $('#error-message').html(''); $('#kk_modal_new_service_submit_btn').attr('disabled', true); $('input[name="duration"]').val(''); $('input[name="cut_mark"]').val(''); $('input[name="total_mark"]').val(''); } }) //count input number of question value $(document).on('keyup', ".number_of_ques", function () { //console.log('here'); var input_total = 0; input_total += parseInt($(this).val()) var total_question = parseInt($('#total').text()); // console.log(total_question) $('#error-message').html(''); if(isNaN(input_total) || input_total == NaN) { input_total = 0; //console.log(input_total); } if(input_total > 0) { //set the total mark value $('input[name="total_mark"]').val(input_total); let pass_mark = calculatePassMark(input_total, 40); $('input[name="cut_mark"]').val(pass_mark); let exam_duration = calculateDuration(input_total, 60); $('input[name="duration"]').val(exam_duration); }else { $('input[name="duration"]').val(''); $('input[name="cut_mark"]').val(''); $('input[name="total_mark"]').val(''); } if ( input_total > total_question || input_total > 200 || input_total < 5 && input_total > 0){ $('#error-message').html( `<span class="text-danger">Number of input question must be grater than or equal <span class="fw-bolder">5</span> and less than <span class="fw-bolder">100</span>.</span>` ); $('#kk_modal_new_service_submit_btn').attr('disabled', true); }else{ $('#error-message').html(''); $('#kk_modal_new_service_submit_btn').attr('disabled', false); } }) $(document).on('click', '#kk_modal_self_test_cancel', function(){ $('.with-errors').text(''); $('.messages').html(''); $('.test-yourself').text('TEST'); $('.indicator-label').show(); $('#error-message').html(''); $('.indicator-progress').hide(); $('#kk_modal_new_service_submit').removeAttr('disabled'); $('#kk_modal_self_test_form')[0].reset(); $('#kk_modal_self_test').modal('hide'); }) //submit// $(document).on('submit', '#kk_modal_self_test_form', function(e){ e.preventDefault() $('.with-errors').text(''); $('.indicator-label').hide(); $('.indicator-progress').show(); var formData = new FormData(this); $.ajax({ type:"POST", url: "https://sattacademy.com/public/test", data:formData, cache:false, contentType: false, processData: false, success:function(data){ if(data.success == false || data.success == "false"){ var arr = Object.keys(data.errors); var arr_val = Object.values(data.errors); for(var i= 0;i < arr.length;i++){ $('.'+arr[i]+'-error').text(arr_val[i][0]) } }else if(data.error || data.error == 'true'){ var alertBox = '<div class="alert alert-danger alert-dismissable">' + data.message + '</div>'; $('#kk_modal_self_test_form').find('.messages').html(alertBox).show(); }else{ // empty the form $('#kk_modal_self_test_form')[0].reset(); $("#kk_modal_self_test").modal('hide'); $('.messages').html(''); //console.log(data); window.location.href = data.data.url+'?s_id='+data.data.subject_id+ '&n_o_q='+data.data.number_of_question+ '&t_m='+data.data.total_mark+ '&c_m='+data.data.cut_mark+ '&n_m='+data.data.negative_mark+ '&du='+data.data.duration+ '&chapter_id='+data.data.chapter_id; } $('.indicator-label').show(); $('.test-yourself').text('TEST'); $('#error-message').html(''); $('.indicator-progress').hide(); $('#kk_modal_new_service_submit').removeAttr('disabled'); } }); }) }); </script> <script type="text/javascript"> $(document).on('click', '.kt_user_follow_button', function() { //console.log('Follow btn click'); var id = $(this).data('id'); var thisBtn = $(this); $.ajax({ type: "GET", url: "https://sattacademy.com/public/user-follow" + "/" + id, data: {}, beforeSend: function() { thisBtn.find('.indicator-label').hide(); thisBtn.find('.indicator-progress').show(); }, success: function(data) { let follower_count_html = thisBtn.parent('div.d-flex').find('.follower_count') .html(); let blog_following_count_html = thisBtn.parent().parent().find( '.blog_follower_count').html(); if (data.success) { if (data.value == 'follow') { $('.indicator-label').show(); $('.indicator-progress').hide(); thisBtn.removeClass('btn-primary').addClass('btn-success'); thisBtn.find('.indicator-label').text('Following'); if ($('.follower_count').length > 0) { if (!follower_count_html.includes('k')) { let followers = parseInt(follower_count_html); thisBtn.parent('div.d-flex').find('.follower_count').html( `${followers + 1}`); } } // blog details if ($('.blog_follower_count').length > 0) { if (!blog_following_count_html.includes('k')) { let followersBlog = parseInt(blog_following_count_html); thisBtn.parent().parent().find('.blog_follower_count').html( `${followersBlog + 1}`); } } } else { $('.indicator-label').show(); $('.indicator-progress').hide(); thisBtn.removeClass('btn-success').addClass('btn-primary'); thisBtn.find('.indicator-label').text('Follow'); if ($('.follower_count').length > 0) { if (!follower_count_html.includes('k')) { let followers = parseInt(follower_count_html); thisBtn.parent('div.d-flex').find('.follower_count').html( `${followers - 1}`); } } // blog details if ($('.blog_follower_count').length > 0) { if (!blog_following_count_html.includes('k')) { let followersBlog = parseInt(blog_following_count_html); thisBtn.parent().parent().find('.blog_follower_count').html( `${followersBlog - 1}`); } } } } else { toastr.error(data.message); $('.indicator-label').show(); $('.indicator-progress').hide(); } }, error: function(data) { toastr.error('Please login to follow'); $('.indicator-label').show(); $('.indicator-progress').hide(); } }); }); </script> <script type="text/javascript"> //user short statistics $(document).on('mouseover', '.user-statistics', function(){ let id = $(this).data('id'); let flug = $(this).data('flug'); //console.log(flug); const thisElement = $(this); if(flug == '-1'){ $.ajax({ type:"GET", url: "https://sattacademy.com/public/user-short-statistics"+'/'+id, data:{}, dataType: 'json', success:function(data){ if(data.success == true || data.success == 'true'){ thisElement.prepend(data.html); thisElement.data('flug', '1'); }else{ toastr.error(data.message); } } }); } }); // //close $(document).on('mouseleave', '.user-statistics', function(){ //console.log('leave'); let flug = $(this).data('flug', '-1'); $('div.statistics-data').hide(); }) </script> <script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML"> </script> <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.0/highlight.min.js"></script> <script src="https://unpkg.com/highlightjs-copy/dist/highlightjs-copy.min.js"></script> <script> hljs.highlightAll(); hljs.addPlugin(new CopyButtonPlugin()); </script> <script type="text/javascript"> $(document).ready(function(){ //call the function on page load tableWrap(); imageSize(); /*toggle btn*/ $('#toggle-subject-chapter').on('click', function(){ $("#toggle-div").slideToggle(500); $(this).find('i.fas').toggleClass('fa-chevron-down fa-chevron-up'); }); $(document).on('click', '.show-result', function(){ $(this).siblings("div.toggle-result").slideToggle(500); if ($(this).text() == "Show Result") { $(this).text("Hide Result"); } else { $(this).text("Show Result"); }; }); //Append Example// //console.log($("p:contains('satt_code_example')")); $("p:contains('kt_satt_skill_example_id')").each(function() { //console.log(this); const thisElement = $(this); let text = $(this).text(); text = $.trim(text); //console.log(text); exampleId = text.slice(25); //console.log(exampleId); // exampleId = text.replace('"', ''); // console.log(text); // let exampleId = $(this).data('example_id'); // //console.log(exampleId); // const thisElement = $(this); let url = "https://sattacademy.com/public/skill/examples/:id"; url = url.replace(':id', exampleId); //console.log(url); $.ajax({ url: url, success:function(data) { //console.log(data.html); thisElement.html(data.html); } }); }); }); //table wrap function function tableWrap() { $("table").wrap(`<div class="table-responsive w-100"></div>`); $("table").addClass('table table-striped table-bordered'); $("table").find('thead').addClass('thead-dark fw-bolder fs-4'); $("table").find('th').addClass('ps-2'); $("table").find('td').addClass('ps-2'); $("table").css({ 'max-width' : '100%', 'margin-top': '10px', 'margin-bottom': '10px', }); $("table").find('thead').css({ 'background-color' : 'gray', 'color' : 'white' }); } //image sizeing function function imageSize() { $(".subject-all-topic img").not('.toolbar-img').wrap(`<div class="w-100"></div>`); $(".subject-all-topic img").css({ 'max-width': '100%', 'margin-top': '10px', 'margin-bottom': '10px', }); } </script> <script> $(document).ready(function() { // When the header dropdown profile is clicked, ajax call to show dropdown var dropdownLoaded = false; $('#header-dropdown').click(function() { if (dropdownLoaded) { return; } $.ajax({ url: "https://sattacademy.com/public/profile/dropdown", method: 'GET', beforeSend: function() { $('#header-dropdown-profile').html( '<div class="skeleton-c9ay7k6i5vw my-3"></div>' ); }, success: function(data) { dropdownLoaded = true; $('#header-dropdown-profile').html(data); }, error: function(xhr) { console.error(xhr.responseText); } }); }); }); </script> <script type="text/javascript"> //Newsletter Subscriber $(document).on('click', '#kk_newsletter_subscriber', function(e) { e.preventDefault() //console.log('here') $('.with-errors').text('') var thisaddbtn = $(this); var email = $('input[name=email]').val(); // console.log(email); $.ajax({ type: "POST", url: "https://sattacademy.com/public/newsletter-subscriber/store", data: { "_token": "cpD0Ry8y7DbDLBOJoEMtREsFCH6k20fTWQX4NBlV", email: email, }, dataType: "json", success: function(data) { if (data.success == false || data.success == "false") { var arr = Object.keys(data.errors); var arr_val = Object.values(data.errors); for (var i = 0; i < arr.length; i++) { $('.' + arr[i] + '-error').text(arr_val[i][0]) } } else if (data.error || data.error == 'true') { var alertBox = '<div class="alert alert-danger" alert-dismissable">' + data .message + '</div>'; $('#kk_modal_new_question_form').find('.messages').html(alertBox).show(); } else { toastr.success(data.message); $("#subscriber_email").val(''); } } }); }) </script> <script src="/livewire/livewire.min.js?id=38dc8241" data-csrf="cpD0Ry8y7DbDLBOJoEMtREsFCH6k20fTWQX4NBlV" data-update-uri="/livewire/update" data-navigate-once="true"></script> <!--begin::dynamic promotion | Adveritsement--> <script type="text/javascript"> function card(content, options = { withLink: true, countClick: true }) { let card = ''; if (content.target_url && options?.withLink) { card += `<a href="/promotion-link?id=${content.id}&countClick=${options?.countClick}&_token=cpD0Ry8y7DbDLBOJoEMtREsFCH6k20fTWQX4NBlV" target="_blank">`; } card += `<div class="card card-rounded promotion-card">`; if (content.content_header) { card += `<div class="p-4 fw-bolder fs-6" style="border-bottom: 1px solid #eff2f5;"> ${content.content_header} </div>`; } if (content.type == 'custom') { card += `<div class="card-body p-4"> ${content.content} </div>`; } else if (content.type == 'image') { let imgUrl = content.image.startsWith('http') ? content.image : '/storage/' + content.image; card += `<img src="${imgUrl}" style="max-width: 100%; height: auto;" />`; } else if (content.type == 'video') { if (content.video.includes('youtube.com/') || content.video.includes('vimeo.com/') || content.video .includes('facebook.com/')) { card += `<iframe src="${convertToEmbedUrl(content.video)}" style="width: 100%; aspect-ratio: 16/9;" scrolling="no" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>`; } else { card += `<video src="${content.video}" class="rounded my-auto promoted-video" style="width: 100%;" controls autoplay loop muted playsinline />`; } } else if (content.type == 'book') { card += ` <div class="row g-0 h-100"> <div class="col-4"> <img src="${content.book.cover_image}" class="img-fluid rounded-start" style="height: 100%; object-fit: cover; max-height: 200px;" alt="..."> </div> <div class="col-8"> <div class="card-body p-4"> <span class="fs-9 text-muted">BOOK</span> <h5 class="card-title"> ${content.book.name} </h5> <div class="my-1"> ${content.book.author_name ? '<span class="fs-7 text-gray-700">' + content.book.author_name + '</span>' : ''} <span class="fs-7 text-gray-700"> by ${content.book.business?.name || 'Satt Academy'}</span><br> </div> <div class="d-flex align-items-center justify-content-between"> <span class=""> ${content.book.price == 0 || content.book.price == '0' || content.book.price == null ? '<span class="badge badge-success">Free</span>' : '<span class="fw-bold text-danger fs-6">৳' + content.book.price + '</span>'} </span> <span> <i class="fs-5 fas fa-${content.book.book_type == 'soft_copy' ? 'file-pdf text-danger' : 'book text-info'}"></i> </span> </div> </div> </div> </div> `; } else if (content.type == 'course') { //console.log(content); card += ` <div class="row g-0 h-100"> <div class="col-4"> <img src="${content.course.cover_photo}" class="img-fluid rounded-start" style="height: 100%; object-fit: cover;" alt="..."> </div> <div class="col-8"> <div class="card-body p-4"> <span class="fs-9 text-muted">COURSE</span> <h5 class="card-title"> ${content.course.name} </h5> <div class="my-1"> ${content.course.author_name ? '<span class="fs-7 text-gray-700">' + content.course.author_name + '</span>' : ''} <span class="fs-7 text-gray-700"> by ${content.course.business?.name || 'Satt Academy'}</span><br> </div> <div class="d-flex align-items-center justify-content-between"> <span class=""> ${content.course.price == 0 || content.course.price == '0' || content.course.price == null ? '<span class="badge badge-success">Free</span>' : '<span class="fw-bold text-danger fs-6">৳' + content.course.price + '</span>'} </span> <span class="rounded text-white p-1 fs-9" style="background-color: #D82D2F">${content.course.course_level.toUpperCase()}</span> </div> </div> </div> </div> `; } else if (content.type == 'exam') { card += ` <div class="row g-0 h-100"> <div class="col-12"> <div class="card-body p-4"> <span class="fs-8 pb-3">MODEL TEST || SATT ACADEMY</span> <h5 class="text-primary text-capitalize fs-3 fw-bold mb-1"> ${content.exam.name} </h5> <p class="m-0">by ${ content.exam.business?.name ?? 'Satt Academy' }</p> <div class="d-flex mt-2 gap-2 justify-content-between align-items-end"> <div class="d-flex align-items-center gap-2"> <span class="badge badge-secondary">${content.exam.duration} min</span> <span class="badge badge-secondary">${content.exam.number_of_question} questions</span> <span class="badge badge-secondary">${content.exam.total_mark} marks</span> </div> <div class="btn btn-primary sa-btn-primary py-2 px-3 fs-7">Attend now!</div> </div> </div> </div> </div> `; } else if (content.type == 'business') { card += ` <div class="row g-0 h-100"> <div class="col-12"> <div class="card-body p-4"> <div class="row"> <div class="col-2"> <img src="${content.business?.logo}" width="100" height="100" class="img-fluid rounded"> </div> <div class="col-10"> <span class="fs-8 pb-3 text-muted">BUSINESS</span> <h5 class="text-primary text-capitalize fs-3 fw-bold mb-1"> ${content.business?.name} </h5> <p class="m-0">by ${ content.business?.user?.name ?? 'Satt Academy' }</p> <div class="d-flex mt-2 gap-2 justify-content-between align-items-end"> <div class="d-flex align-items-center gap-2"> <span class="badge badge-secondary">${content.business?.books_count} books</span> <span class="badge badge-secondary">${content.business?.courses_count} courses</span> <span class="badge badge-secondary">${content.business?.exams_count} exams</span> </div> </div> </div> </div> </div> </div> </div> `; } if (content.content_footer) { card += `<div class="card-footer p-4"> ${content.content_footer} </div>`; } card += `</div>`; if (content.target_url && options?.withLink) { card += `</a>`; } return card; } function convertToEmbedUrl(videoUrl) { // YouTube URL patterns const youtubePattern1 = /youtube\.com\/watch\?v=([^&]+)/; const youtubePattern2 = /youtu\.be\/([^?]+)/; // Vimeo URL pattern const vimeoPattern = /vimeo\.com\/(\d+)/; // Facebook URL pattern const facebookPattern = /facebook\.com\/.+\/videos\/(\d+)/; // Check for YouTube URL (full or shortened) let match = videoUrl.match(youtubePattern1) || videoUrl.match(youtubePattern2); if (match) { const videoId = match[1]; return `https://www.youtube.com/embed/${videoId}?autoplay=1&loop=1&playlist=${videoId}`; } // Check for Vimeo URL match = videoUrl.match(vimeoPattern); if (match) { const videoId = match[1]; return `https://player.vimeo.com/video/${videoId}`; } // Check for Facebook URL match = videoUrl.match(facebookPattern); if (match) { const videoId = match[1]; return `https://www.facebook.com/plugins/video.php?href=${encodeURIComponent(videoUrl)}`; } // Return the original URL if it's not a valid YouTube or Vimeo URL return videoUrl; } </script> <script type="text/javascript"> let offcanvasEl = document.getElementById('satt_dynamic_offcanvas'); let offcanvas = offcanvasEl && new bootstrap.Offcanvas(offcanvasEl); $(document).ready(function() { setTimeout(() => { loadPromotionData(); setTimeout(() => { initVideoObserver(); if (isMobile()) { $('#header-promotion-content, #footer-promotion-content').slick({ arrows: false, autoplay: true, //adaptiveHeight: true, }); } }, 500); // Remove promotion content when modal or offcanvas is closed $('.promotion-close-btn').on('click', function() { $('.promotion-body').html(''); }); $('#satt_dynamic_modal').on('hidden.bs.modal', function() { $('.promotion-body').html(''); }); $('#satt_dynamic_offcanvas').on('hidden.bs.offcanvas', function() { $('.promotion-body').html(''); }); }, 1000); }); // Insert inner promotion content divs let $contentListItems = $('.content-list-item'); let insertAfterEach = 3; if ($contentListItems.length >= insertAfterEach) { $contentListItems.each((index, el) => { // Insert a div after each 3 items if ((index + 1) % insertAfterEach === 0) { $(el).after('<div class="inner-promotion-content"></div>'); } }) } function isMobile() { return window.matchMedia("only screen and (max-width: 767px)").matches; } function loadPromotionData() { let route = "skill.subject.chapter"; //console.log(route); $.ajax({ type: "GET", url: "https://sattacademy.com/public/dynamic-promotion-content" + "?_token=" + $('meta[name="csrf-token"]').attr( 'content') + "&route=" + route + "&sidebar=" + $( '#sidebar-promotion-content').length + "&inner=" + $('.inner-promotion-content').length, dataType: 'json', success: function(data) { if (data) { const headerContents = data.headerContents; const footerContents = data.footerContents; const innerContents = data.innerContents; const sidebarContents = data.sidebarContents; const modalContents = data.modalContents; const offcanvasContents = data.offcanvasContents; const modalSettings = data.modalSettings; let headerCards = ''; let footerCards = ''; let innerCards = ''; let sidebarCards = ''; let modalCards = ''; let offcanvasCards = ''; if (headerContents && headerContents.length > 0) { headerContents.forEach((content) => { headerCards += card(content); }); } if (footerContents && footerContents.length > 0) { footerContents.forEach((content) => { footerCards += card(content); }); } if (innerContents && innerContents.length > 0) { let $innerPromotionContentEls = $('.inner-promotion-content'); innerContents.forEach((content, index) => { // innerCards += card(content); $innerPromotionContentEls.eq(index).html(card(content)); }); } if (sidebarContents && sidebarContents.length > 0) { sidebarContents.forEach((content) => { sidebarCards += card(content); }); } if (modalContents && modalContents.length > 0) { if (modalSettings.dont_show_vendor_promotions_in_modal && modalSettings .modal_header) { modalCards += `<div class='text-center'>${modalSettings.modal_header}</div>`; } modalContents.forEach((content) => { modalCards += card(content); }); if (modalSettings.dont_show_vendor_promotions_in_modal && modalSettings .modal_footer) { modalCards += `<div class='text-center'>${modalSettings.modal_footer}</div>`; } $('#satt_dynamic_modal .dynamic-modal-body').html(modalCards); $('#satt_dynamic_modal').modal('show'); } if (offcanvasContents && offcanvasContents.length > 0) { let positions = ['left', 'right']; let offcanvasPosition = positions[Math.floor(Math.random() * positions.length)]; offcanvasContents.forEach((content) => { offcanvasCards += card(content); }); if (offcanvasPosition == 'left') { offcanvasEl?.classList.add('offcanvas-start'); } else if (offcanvasPosition == 'top') { offcanvasEl?.classList.add('offcanvas-top'); } else if (offcanvasPosition == 'bottom') { offcanvasEl?.classList.add('offcanvas-bottom'); } else { offcanvasEl?.classList.add('offcanvas-end'); } $('#satt_dynamic_offcanvas .offcanvas-body')?.html(offcanvasCards); offcanvas?.show(); } $('#header-promotion-content').html(headerCards); $('#footer-promotion-content').html(footerCards); $('#sidebar-promotion-content').html(sidebarCards); // $('#inner-promotion-content').html(innerCards); } } }); } function initVideoObserver() { const videos = document.querySelectorAll('video.promoted-video'); const observerOptions = { root: null, rootMargin: '0px', threshold: 0.5 }; const observerCallback = (entries, observer) => { entries.forEach(entry => { const video = entry.target; if (entry.isIntersecting) { video.play(); } else { video.pause(); } }); }; const observer = new IntersectionObserver(observerCallback, observerOptions); videos.forEach(video => { observer.observe(video); }); } </script> <!--end::Javascript--> <script src="https://sattacademy.com/public/js/sideLoginFormScript.js"></script> <div class="page-spinner-wrapper" style="display: none" id="page-spinner"> <div class="spinner-grow" style="width: 3rem; height: 3rem;" role="status"></div> </div> <i class="fas fa-angle-up back_to_top_btn"></i> <script src="https://sattacademy.com/public/assets/js/custom/bengalitoenglishinput.js"></script> <script src="https://www.meanthemes.com/demo/meanmenu/jquery.meanmenu.js"></script> <script> document.getElementById('light_dark_btn').addEventListener('click', function() { const currentTheme = document.documentElement.getAttribute('data-theme'); const newTheme = currentTheme === 'light' ? 'dark' : 'light'; document.documentElement.setAttribute('data-theme', newTheme); localStorage.setItem('theme', newTheme); }); jQuery(document).ready(function() { jQuery('.st-header-menu nav').meanmenu({ meanMenuContainer: '.mobile-menu', meanScreenWidth: '1200', }); }); $('.sa_aside_mobile_toggle').click(function() { $('#mobileSidebarOffcanvas').offcanvas('show'); // $('.menu-sidebar').addClass('active'); // $('.body-overlay').addClass('active'); }); $('.body-overlay, .mobile-menu-close').click(function() { $('#mobileSidebarOffcanvas').offcanvas('hide'); // $('.menu-sidebar').removeClass('active'); // $('.body-overlay').removeClass('active'); }); // back to top var $backToTop = $(".back_to_top_btn"); $backToTop.hide(); $(window).on('scroll', function() { if ($(this).scrollTop() > 100) { $backToTop.fadeIn(); } else { $backToTop.fadeOut(); } }); $backToTop.on('click', function(e) { $("html, body").animate({ scrollTop: 0 }, 500); }); // $('.select2').select2(); </script> <script> function viewNotificationDetails(e, el) { e.preventDefault(); let id = $(el).data('id'); $('#notification_item_modal').modal('show'); $.ajax({ url: 'https://sattacademy.com/public/notifications' + '/' + id + '/details', type: 'GET', beforeSend: function() { $('#notification-details-loader').removeClass('d-none'); $('.notification-media').addClass('d-none'); $('.notification-action').addClass('d-none'); }, success: function(notification) { let time = new Date(notification.created_at).toLocaleString(); // console.log(notification.data); $('#notification-details-loader').addClass('d-none'); $('.notification-media').removeClass('d-none'); $('#notification-title').text(notification.data.title); $('#notification-body').html(notification.data.body); $('#notification-time').text(time); if (notification.data.avatar) { $('#notification-avatar').attr('src', notification.data.avatar); } if (notification.data.action) { $('.notification-action').removeClass('d-none'); $('.notification-action').text(notification.data.action.text || 'Check it out'); $('.notification-action').attr('href', notification.data.action.url); } $(el).removeClass('unread'); // Fire a custom event window.dispatchEvent(new CustomEvent('notification-read', { detail: { id: id } })); } }); } // Remove google ad intent info banner $(document).ready(function() { setTimeout(() => { let allDivs = document.querySelectorAll('div'); allDivs.forEach((el) => { if(el.shadowRoot) { // console.log(el); el.shadowRoot.querySelector('.ipr-container').style.display = 'none'; } }); }, 3000); }); </script> </body> </html>