From 2960ff8dc1902fcd59d2756e14ad4dd756f5fa01 Mon Sep 17 00:00:00 2001 From: Vikram Goyal Date: Thu, 23 May 2019 16:11:47 +1000 Subject: [PATCH] adding tool to load modules --- _javascripts/page-loader.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/_javascripts/page-loader.js b/_javascripts/page-loader.js index 0ae2edffee..bc0a643d8f 100644 --- a/_javascripts/page-loader.js +++ b/_javascripts/page-loader.js @@ -54,4 +54,20 @@ function selectVersion(currentVersion) { el.value = currentVersion; } // alert(currentVersion); + + // in enterprise branch 4, we have modules and this is an attempt to load the + // modules by double clicking on them. + if(currentVersion.charAt(0) === "4") { + var element = document.getElementsByTagName('h2'); + Object.entries(element).map(( object ) => { + object[1].addEventListener("dblclick", function() { + // alert(this.id); + // alert(this.id.split("_", 1)[0] + ".adoc"); + var fn = this.id.split("_", 1)[0] + ".adoc"; + window.open("https://github.com/openshift/openshift-docs/tree/enterprise-" + + currentVersion + "/modules/" + fn, "_new"); + }); + }); + } + }