From 01eca1a96e108b449cc39056b33abe3c21df4578 Mon Sep 17 00:00:00 2001 From: tompng Date: Wed, 19 Nov 2025 22:16:45 +0900 Subject: [PATCH] Modernize aliki.js coding style Use template literals, arrow functions, const, let. Add "use strict" to detect potential problem quickly. --- lib/rdoc/generator/template/aliki/js/aliki.js | 200 +++++++++--------- 1 file changed, 101 insertions(+), 99 deletions(-) diff --git a/lib/rdoc/generator/template/aliki/js/aliki.js b/lib/rdoc/generator/template/aliki/js/aliki.js index 5fcc3ac317..af851900c4 100644 --- a/lib/rdoc/generator/template/aliki/js/aliki.js +++ b/lib/rdoc/generator/template/aliki/js/aliki.js @@ -1,7 +1,9 @@ +'use strict'; + /* ===== Method Source Code Toggling ===== */ -function showSource( e ) { - var target = e.target; +function showSource(e) { + let target = e.target; while (!target.classList.contains('method-detail')) { target = target.parentNode; } @@ -11,10 +13,10 @@ function showSource( e ) { if (typeof target !== "undefined" && target !== null) { target.classList.toggle('active-menu') } -}; +} function hookSourceViews() { - document.querySelectorAll('.method-source-toggle').forEach(function (codeObject) { + document.querySelectorAll('.method-source-toggle').forEach((codeObject) => { codeObject.addEventListener('click', showSource); }); } @@ -26,23 +28,23 @@ function createSearchInstance(input, result) { result.classList.remove("initially-hidden"); - var search = new Search(search_data, input, result); + const search = new Search(search_data, input, result); search.renderItem = function(result) { - var li = document.createElement('li'); - var html = ''; + const li = document.createElement('li'); + let html = ''; // TODO add relative path to