1/* drawer.js (Moodle 1.9 / Aardvark) 2 - Drawer panel derecho 3 - Integración robusta: número + toggle "dentro" del tÃtulo rojo SIN tocar el DOM interno de .tbloque 4 -> overlay absoluto dentro de .summary, colocado encima de .tbloque 5 - NO toca fondo de td.content 6 - Toggle: se MUEVE el <a> real (sin clonar) 7*/ 8 9(function () { 10 function hasClass(el, cls) { 11 return (" " + el.className + " ").indexOf(" " + cls + " ") > -1; 12 } 13 function addClass(el, cls) { 14 if (!hasClass(el, cls)) el.className = (el.className ? el.className + " " : "") + cls; 15 } 16 function removeClass(el, cls) { 17 el.className = (" " + el.className + " ").replace(" " + cls + " ", " ").replace(/^\s+|\s+$/g, ""); 18 } 19 function toggleClass(el, cls) { 20 if (hasClass(el, cls)) removeClass(el, cls); 21 else addClass(el, cls); 22 } 23 24 function ready(fn) { 25 if (document.addEventListener) document.addEventListener("DOMContentLoaded", fn, false); 26 else window.attachEvent("onload", fn); 27 } 28 function onload(fn) { 29 if (window.addEventListener) window.addEventListener("load", fn, false); 30 else window.attachEvent("onload", fn); 31 } 32 33 function isSmall() { 34 return (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) <= 1100; 35 } 36 37 function cleanText(s) { 38 return (s || "").replace(/\s+/g, " ").replace(/^\s+|\s+$/g, ""); 39 } 40 41 function imp(el, prop, val) { 42 if (!el || !el.style) return; 43 el.style.setProperty(prop, val, "important"); 44 } 45 46 // ---------- 1) DRAWER PANEL DERECHO ---------- 47 ready(function () { 48 var right = document.getElementById("right-column"); 49 if (!right) return; 50 51 var btn = document.getElementById("drawer-toggle"); 52 if (!btn) { 53 btn = document.createElement("div"); 54 btn.id = "drawer-toggle"; 55 btn.innerHTML = "â° Panel"; 56 document.body.appendChild(btn); 57 } 58 59 try { 60 if (window.localStorage) { 61 if (isSmall()) { 62 if (localStorage.getItem("drawerRightSmall") === "1") { 63 addClass(document.body, "drawer-open"); 64 btn.innerHTML = "â Panel"; 65 } else { 66 removeClass(document.body, "drawer-open"); 67 btn.innerHTML = "â° Panel"; 68 } 69 } else { 70 if (localStorage.getItem("drawerRight") === "0") { 71 addClass(document.body, "drawer-collapsed"); 72 btn.innerHTML = "â° Panel"; 73 } else { 74 removeClass(document.body, "drawer-collapsed"); 75 btn.innerHTML = "â Panel"; 76 } 77 } 78 } 79 } catch (e) {} 80 81 btn.onclick = function () { 82 if (isSmall()) { 83 toggleClass(document.body, "drawer-open"); 84 btn.innerHTML = hasClass(document.body, "drawer-open") ? "â Panel" : "â° Panel"; 85 try { 86 if (window.localStorage) { 87 localStorage.setItem("drawerRightSmall", hasClass(document.body, "drawer-open") ? "1" : "0"); 88 } 89 } catch (e) {} 90 } else { 91 toggleClass(document.body, "drawer-collapsed"); 92 btn.innerHTML = hasClass(document.body, "drawer-collapsed") ? "â° Panel" : "â Panel"; 93 try { 94 if (window.localStorage) { 95 localStorage.setItem("drawerRight", hasClass(document.body, "drawer-collapsed") ? "0" : "1"); 96 } 97 } catch (e) {} 98 } 99 }; 100 }); 101 102})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.