dojo.byId => document.getElementById user/sandbergja/lp1890342-no-more-dojo
authorJane Sandberg <js7389@princeton.edu>
Sun, 12 Mar 2023 00:24:39 +0000 (16:24 -0800)
committerJane Sandberg <js7389@princeton.edu>
Sun, 12 Mar 2023 00:24:39 +0000 (16:24 -0800)
Open-ILS/src/templates-bootstrap/opac/parts/acjs.tt2
Open-ILS/src/templates-bootstrap/opac/parts/ebook_api/base_js.tt2
Open-ILS/src/templates-bootstrap/opac/parts/ebook_api/login_js.tt2
Open-ILS/src/templates-bootstrap/opac/parts/js.tt2
Open-ILS/web/js/ui/default/opac/ebook_api/avail.js
Open-ILS/web/js/ui/default/opac/ebook_api/ebook.js
Open-ILS/web/js/ui/default/opac/ebook_api/loggedin.js

index d158aa8..d225c0b 100755 (executable)
@@ -66,7 +66,7 @@
                 function(d){
                     // note if d.length == 0, there is no content to display
                     // hide the Loading... text
-                    dojo.byId('novelist-loading').innerHTML = '';
+                    document.getElementById('novelist-loading').innerHTML = '';
                 }
             )}, 100);
 [%- END; # Novelist -%]
index 9d30478..7f06020 100755 (executable)
@@ -73,14 +73,11 @@ myopac_page = "[% myopac_page %]";
 
 // enforce removal of ebook API cookies on logout
 window.addEventListener("load", () => {
-    var logout_handle = dojo.connect(dojo.byId('#logout_link'), 'onclick', function() {
+    document.getElementById('logout_link').addEventListener('click', () => {
         dojo.forEach(cookie_registry, function(cookie) {
             dojo.cookie(cookie, '', {path: '/', expires: '-1h'});
         });
-        // When we switch to jQuery, use .one()
-        // instead of dojo's .connect() and .disconnect()
-        dojo.disconnect(logout_handle);
-    });
+    }, { once: true });
 });
 </script>
 
index bde4e0f..be6723e 100755 (executable)
@@ -9,18 +9,14 @@ vendors_requiring_password.push('overdrive');
 [% END %]
 
 window.addEventListener("load", () => {
-    var handle = dojo.connect(dojo.byId('#login-form-box'), 'onclick', function(evt) {
-        // disconnect this event since it's one-time-only
-        // (when we switch to jQuery, we can use .one() here)
-        dojo.disconnect(handle);
-
+    document.getElementById('login-form-box').addEventListener('click', () => {
         // we cache the username (and password) for now, but will
         // replace that with the patron's active barcode later
         vendors_requiring_password.forEach(function(v) {
             if (vendor_list.includes(v)) {
                 checkSession(v, function(v,ses) {
-                    var username = dojo.byId('#username_field').value;
-                    var password = dojo.byId('#password_field').value;
+                    var username = document.getElementById('username_field').value;
+                    var password = document.getElementById('password_field').value;
                     new OpenSRF.ClientSession('open-ils.ebook_api').request({
                         method: 'open-ils.ebook_api.patron.cache_password',
                         params: [ ses, password ],
@@ -36,6 +32,6 @@ window.addEventListener("load", () => {
                 });
             }
         });
-    });
+    }, { once: true });
 });
 </script>
index 53dbd0c..e213a42 100755 (executable)
     /* Set focus, and place the cursor at the end of the input string */
     window.addEventListener("load", () => {
         /* Don't error out if the object doesn't exist, like on advanced search pages */
-        if (dojo.byId('search_box')) {
+        if (document.getElementById('search_box')) {
             dijit.byId('search_box').focus();
             var sb_value = dijit.byId('search_box').value;
             /* Dojo won't trigger a change if the value doesn't change */
index fb86d32..06dacf6 100644 (file)
@@ -32,7 +32,7 @@ dojo.addOnLoad(function() {
                                 dojo.forEach(holdings.formats, function(f) {
                                     dojo.create("li", { innerHTML: f.name }, formats_ul);
                                 });
-                                var status_node = dojo.byId(ebook.rec_id + '_status');
+                                var status_node = document.getElementById(ebook.rec_id + '_status');
                                 var status_str = holdings.copies_available + ' of ' + holdings.copies_owned + ' available';
                                 status_node.innerHTML = status_str;
                                 document.getElementById(ebook.rec_id + '_ebook_holdings').classList.remove('hidden');
index 03814c4..f03fc7e 100644 (file)
@@ -75,7 +75,7 @@ Ebook.prototype.checkout = function(authtoken, patron_id, callback) {
     var ebook = this;
     // get selected checkout format (optional, used by OverDrive)
     var checkout_format;
-    var format_selector = dojo.byId('checkout-format');
+    var format_selector = document.getElementById('checkout-format');
     if (format_selector) {
         checkout_format = format_selector.value;
     }
@@ -132,7 +132,7 @@ Ebook.prototype.download = function() {
     var ses = this.ses || dojo.cookie(this.vendor);
     var ebook = this;
     var request_link;
-    var format_selector = dojo.byId('download-format');
+    var format_selector = document.getElementById('download-format');
     if (!format_selector) {
         console.log('could not find a specified format for download');
         return;
index 1cfcfa8..62c66f5 100644 (file)
@@ -96,15 +96,15 @@ function updateDashboard() {
 
     if(typeof(eCheckout) != 'undefined' && eCheckout != null)
     {
-        dojo.byId('dash_e_checked').innerHTML = total_checkouts;
+        document.getElementById('dash_e_checked').innerHTML = total_checkouts;
     }
     if(typeof(eHolds) != 'undefined' && eHolds != null)
     {
-        dojo.byId('dash_e_holds').innerHTML = total_holds_pending;
+        document.getElementById('dash_e_holds').innerHTML = total_holds_pending;
     }
     if(typeof(ePickup) != 'undefined' && ePickup != null)
     {
-        dojo.byId('dash_e_pickup').innerHTML = total_holds_ready;
+        document.getElementById('dash_e_pickup').innerHTML = total_holds_ready;
     }
     if(typeof(eDash) != 'undefined' && eDash != null)
     {
@@ -121,9 +121,9 @@ function updateMyAccountSummary() {
         var total_holds_pending = (typeof xacts.holds_pending === 'undefined') ? '-' : xacts.holds_pending.length;
         var total_holds_ready = (typeof xacts.holds_ready === 'undefined') ? '-' : xacts.holds_ready.length;
         // update totals
-        dojo.byId('acct_sum_ebook_circ_total').innerHTML = total_checkouts;
-        dojo.byId('acct_sum_ebook_hold_total').innerHTML = total_holds_pending;
-        dojo.byId('acct_sum_ebook_hold_ready_total').innerHTML = total_holds_ready;
+        document.getElementById('acct_sum_ebook_circ_total').innerHTML = total_checkouts;
+        document.getElementById('acct_sum_ebook_hold_total').innerHTML = total_holds_pending;
+        document.getElementById('acct_sum_ebook_hold_ready_total').innerHTML = total_holds_ready;
         // unhide display elements
         document.getElementById('acct_sum_ebook_circs').classList.remove('hidden');
         document.getElementById('acct_sum_ebook_holds').classList.remove('hidden');