diff --git a/README.rst b/README.rst
index fc57083..4cca6e0 100644
--- a/README.rst
+++ b/README.rst
@@ -23,6 +23,8 @@ Setup and Configuration
'next_prev_link': True or False, \\ DEFAULTS TO FALSE
'html_last_updated_fmt': '%Y-%m-%d %H:%M:%S', \\ REQUIRED FOR FEDERATED SEARCH, DO NOT CHANGE
# 'surveymonkey_url' = '', \\ DEFAULTS TO ""
+ # 'medallia_embed_url' = '', \\ DEFAULTS TO ""
+ # 'medallia_id' = '', \\ DEFAULTS TO "medallia_inline_survey"
# 'base_url' = '' \\ DEFAULTS TO '/'
}
diff --git a/f5_sphinx_theme/__init__.py b/f5_sphinx_theme/__init__.py
index 7da61b7..3ab6200 100644
--- a/f5_sphinx_theme/__init__.py
+++ b/f5_sphinx_theme/__init__.py
@@ -16,7 +16,7 @@
from os import path
-__version__ = "2.1.1"
+__version__ = "2.2.0"
def get_html_theme_path():
diff --git a/f5_sphinx_theme/layout.html b/f5_sphinx_theme/layout.html
index d1682d3..c745682 100644
--- a/f5_sphinx_theme/layout.html
+++ b/f5_sphinx_theme/layout.html
@@ -135,8 +135,15 @@
+ {% if theme_medallia_embed_url %}
+
+
+
+
+ {% endif %}
+ {% if theme_surveymonkey_url %}
+
+
{% endif %}
@@ -158,8 +165,8 @@
{{ project }} {{ version }}
{% if (theme_version_selector) %}
{%- endif %}
-{% if (surveymonkey_url) %}
-
+{% if (theme_surveymonkey_url or theme_medallia_embed_url) %}
+
{%- endif %}
diff --git a/f5_sphinx_theme/static/js/feedback.js b/f5_sphinx_theme/static/js/feedback.js
new file mode 100644
index 0000000..10bf27b
--- /dev/null
+++ b/f5_sphinx_theme/static/js/feedback.js
@@ -0,0 +1,105 @@
+const data = {
+ surveyMonkey: {
+ site: "site",
+ page: "page",
+ version: "version"
+ },
+ medallia: {
+ site: "subsite",
+ page: "page",
+ version: "version"
+ }
+}
+
+const surveyMonkeyDivId = "survey-sm-div";
+const surveyMonkeyAId = "survey-sm";
+const surveyMonkeyUrlAttr = 'survey-sm-url';
+
+const htmlString = ".html";
+const htmlDefaultIndex = "index.html";
+
+// 'window' is a global variable. Define 'medalliaData' global variable here.
+var medalliaData = {};
+const medalliaDivClassName = "medallia_survey";
+
+$(document).ready(function () {
+ const surveyMonkeyDiv = document.getElementById(surveyMonkeyDivId);
+ const medalliaDivs = document.getElementsByClassName(medalliaDivClassName);
+
+ // SurveyMonkey and Medallia are disabled.
+ if (surveyMonkeyDiv == null && !medalliaDivs.length) {
+ return;
+ }
+
+ if (surveyMonkeyDiv != null) {
+ renderSM(surveyMonkeyDiv);
+ }
+
+ if (medalliaDivs.length >= 1) {
+ renderMedallia();
+ }
+})
+
+function renderSM(smDiv) {
+ // Get SurveyMonkey URL from div id 'survey-sm-div'.
+ const surveyMonkeyUrl = smDiv.getAttribute(surveyMonkeyUrlAttr);
+ const surveyMonkey = new URL(surveyMonkeyUrl);
+
+ // Get the current URL.
+ const url = new URL(window.location.href);
+ const urlPathNames = url.pathname.split('/').filter(Boolean);
+
+ // If this is an 'index.html' or isn't even an html page, hide the SurveyMonkey link.
+ if (url.pathname.trim().endsWith(htmlDefaultIndex) || !url.pathname.endsWith(htmlString)) {
+ console.debug('This page need to hide SurveyMonkey link')
+ // Hide the SurveyMonkey Div because this pages doesn't need it.
+ if (smDiv != null) {
+ $("#" + surveyMonkeyDivId).hide();
+ }
+ }
+ // Otherwise determine the custom variables for SurveyMonkey.
+ else if (urlPathNames[urlPathNames.length - 1].endsWith(htmlString)) {
+ if (urlPathNames.length == 1) {
+ surveyMonkey.searchParams.append(data.surveyMonkey.page, urlPathNames[urlPathNames.length - 1]);
+ } else if (urlPathNames.length == 2) {
+ surveyMonkey.searchParams.append(data.surveyMonkey.site, urlPathNames[urlPathNames.length - 2]);
+ surveyMonkey.searchParams.append(data.surveyMonkey.page, urlPathNames[urlPathNames.length - 1]);
+ } else if (urlPathNames.length >= 3) {
+ surveyMonkey.searchParams.append(data.surveyMonkey.site, urlPathNames[urlPathNames.length - 3]);
+ surveyMonkey.searchParams.append(data.surveyMonkey.version, urlPathNames[urlPathNames.length - 2]);
+ surveyMonkey.searchParams.append(data.surveyMonkey.page, urlPathNames[urlPathNames.length - 1]);
+ }
+ // Modify SurveyMonkey href.
+ var surveyMonkeyLink = document.getElementById(surveyMonkeyAId);
+ if (surveyMonkeyLink != null) {
+ console.debug('Modifying SurveyMonkey link');
+ surveyMonkeyLink.href = surveyMonkey.toString();
+ }
+ }
+}
+
+function renderMedallia() {
+ // Initialize data Medallia variables.
+ var medalliaDataSite, medalliaDataVersion, medalliaDataPage;
+ // Get the current URL.
+ const url = new URL(window.location.href);
+ // Create array with each element split by '/' character in url pathname. Then, remove and empty array entries.
+ const urlPathNames = url.pathname.split('/').filter(Boolean);
+
+ // Assign subsite, page, and version information.
+ if (urlPathNames.length == 1) {
+ medalliaDataPage = urlPathNames[urlPathNames.length - 1];
+ } else if (urlPathNames.length == 2) {
+ medalliaDataSite = urlPathNames[urlPathNames.length - 2];
+ medalliaDataPage = urlPathNames[urlPathNames.length - 1];
+ } else if (urlPathNames.length >= 3) {
+ medalliaDataSite = urlPathNames[urlPathNames.length - 3];
+ medalliaDataVersion = urlPathNames[urlPathNames.length - 2];
+ medalliaDataPage = urlPathNames[urlPathNames.length - 1];
+ }
+
+ // Set HTML global variable medalliaData.
+ window.medalliaData[data.medallia.site] = medalliaDataSite;
+ window.medalliaData[data.medallia.version] = medalliaDataVersion;
+ window.medalliaData[data.medallia.page] = medalliaDataPage;
+}
diff --git a/f5_sphinx_theme/static/js/survey-monkey.js b/f5_sphinx_theme/static/js/survey-monkey.js
deleted file mode 100644
index 1bab2d2..0000000
--- a/f5_sphinx_theme/static/js/survey-monkey.js
+++ /dev/null
@@ -1,53 +0,0 @@
-const surveyMonkeyVariablePage = "page";
-const surveyMonkeyVariableSite = "site";
-const surveyMonkeyVariableVersion = "version";
-
-const surveyMonkeyDivId = "survey-sm-div";
-const surveyMonkeyAId = "survey-sm";
-const surveyMonkeyUrlAttr = 'survey-sm-url';
-
-const htmlString = ".html";
-
-$(document).ready(function () {
- var surveyMonkeyDiv = document.getElementById(surveyMonkeyDivId);
- // SurveyMonkey is disabled.
- if (surveyMonkeyDiv == null) {
- return;
- }
-
- // Get SurveyMonkey URL from div id 'survey-sm-div'.
- const surveyMonkeyUrl = surveyMonkeyDiv.getAttribute(surveyMonkeyUrlAttr);
- const surveyMonkey = new URL(surveyMonkeyUrl);
-
- // Get the current URL.
- const url = new URL(window.location.href);
- const urlPathNames = url.pathname.split('/').filter(Boolean);
-
- // If this is an 'index.html' or isn't even an html page, hide the SurveyMonkey link.
- if (url.pathname.trim().endsWith("index.html") || !url.pathname.endsWith(htmlString)) {
- console.debug('This page need to hide SurveyMonkey link')
- // Hide the SurveyMonkey Div because this pages doesn't need it.
- if (surveyMonkeyDiv != null) {
- $("#" + surveyMonkeyDivId).hide();
- }
- }
- // Otherwise determine the custom variables for SurveyMonkey.
- else if (urlPathNames[urlPathNames.length - 1].endsWith(htmlString)) {
- if (urlPathNames.length == 1) {
- surveyMonkey.searchParams.append(surveyMonkeyVariablePage, urlPathNames[urlPathNames.length - 1]);
- } else if (urlPathNames.length == 2) {
- surveyMonkey.searchParams.append(surveyMonkeyVariableSite, urlPathNames[urlPathNames.length - 2]);
- surveyMonkey.searchParams.append(surveyMonkeyVariablePage, urlPathNames[urlPathNames.length - 1]);
- } else if (urlPathNames.length >= 3) {
- surveyMonkey.searchParams.append(surveyMonkeyVariableSite, urlPathNames[urlPathNames.length - 3]);
- surveyMonkey.searchParams.append(surveyMonkeyVariableVersion, urlPathNames[urlPathNames.length - 2]);
- surveyMonkey.searchParams.append(surveyMonkeyVariablePage, urlPathNames[urlPathNames.length - 1]);
- }
- // Modify SurveyMonkey href.
- var surveyMonkeyLink = document.getElementById(surveyMonkeyAId);
- if (surveyMonkeyLink != null) {
- console.debug('Modifying SurveyMonkey link');
- surveyMonkeyLink.href = surveyMonkey.toString();
- }
- }
-})
diff --git a/f5_sphinx_theme/theme.conf b/f5_sphinx_theme/theme.conf
index 6074601..f389d1a 100644
--- a/f5_sphinx_theme/theme.conf
+++ b/f5_sphinx_theme/theme.conf
@@ -8,4 +8,6 @@ next_prev_link = False
version_selector = False
base_url = /
enable_version_warning_banner = False
-surveymonkey_url = ""
+surveymonkey_url =
+medallia_embed_url =
+medallia_id = medallia_inline_survey