commit 51ca5010f3bbc9910a9e11ccb00f82ffe6898408
Author: Pete Travis <immanetize(a)fedoraproject.org>
Date: Thu May 28 12:21:30 2015 -0600
fedmenu!
fedmenu-patch.patch | 58 ++++++++++++++++++++
fedmenu.patch | 150 ++++++++++++++++++++++++++++++---------------------
public_html/toc.js | 58 ++++++++++++++++++++
3 files changed, 204 insertions(+), 62 deletions(-)
---
diff --git a/fedmenu-patch.patch b/fedmenu-patch.patch
new file mode 100644
index 0000000..474d20e
--- /dev/null
+++ b/fedmenu-patch.patch
@@ -0,0 +1,58 @@
+
+/* fedmenu integration */
+
+function install_fedmenu() {
+ var jquery_src = document.createElement('script');
+ jquery_src.type = 'text/javascript';
+ jquery_src.src =
'https://apps.fedoraproject.org/fedmenu/js/jquery-1.11.2.min.js';
+ var done = false;
+ jquery_src.onload = jquery_src.onreadystatechange = function() {
+ if (!done && (
+ !this.readyState ||
+ this.readyState == 'loaded' ||
+ this.readyState == 'complete'
+ )) {
+ done = true;
+ set_fedmenu(); // Do the callback
+ jquery_src.onload = jquery_src.onreadystatechange = null;
+ document.body.removeChild(jquery_src);
+ };
+ };
+ document.body.appendChild(jquery_src);
+}
+
+function set_fedmenu() {
+ var fedmenu_src = document.createElement('script');
+ fedmenu_src.type = 'text/javascript';
+ fedmenu_src.src = 'https://apps.fedoraproject.org/fedmenu/js/fedmenu.js';
+ var done = false;
+ fedmenu_src.onload = fedmenu_src.onreadystatechange = function() {
+ if (!done && (
+ !this.readyState ||
+ this.readyState == 'loaded' ||
+ this.readyState == 'complete'
+ )) {
+ done = true;
+ run_fedmenu(); // Do the callback
+ fedmenu_src.onload = fedmenu_src.onreadystatechange = null;
+ document.body.removeChild(fedmenu_src);
+ };
+ };
+ document.body.appendChild(fedmenu_src);
+}
+
+function run_fedmenu() {
+ var fedmenu_spt = document.createElement('script');
+ fedmenu_spt.type = 'text/javascript';
+ fedmenu_spt.text = 'fedmenu({'
+ + '"url": "https://apps.fedoraproject.org/js/data.js",
'
+ + '"mimetype": "application/javascript", '
+ + '"position": "bottom-right", '
+ + '"context": parent.document'
+ + '});';
+ document.body.appendChild(fedmenu_spt);
+}
+
+window.addEventListener("load", function(){
+ install_fedmenu();
+});
diff --git a/fedmenu.patch b/fedmenu.patch
index d5b21cc..48a5afc 100644
--- a/fedmenu.patch
+++ b/fedmenu.patch
@@ -1,62 +1,88 @@
---- toc.js.1 2015-05-06 18:00:20.000000000 +0200
-+++ toc.js 2015-05-07 09:23:33.652727936 +0200
-@@ -337,3 +337,59 @@
- setCookie(name_menu, 'open', expDate, '/', false, false);
- }
-
-+/* fedmenu integration */
-+
-+function install_fedmenu() {
-+ var jquery_src = document.createElement('script');
-+ jquery_src.type = 'text/javascript';
-+ jquery_src.src =
'https://apps.fedoraproject.org/fedmenu/js/jquery-1.11.2.min.js';
-+ var done = false;
-+ jquery_src.onload = jquery_src.onreadystatechange = function() {
-+ if (!done && (
-+ !this.readyState ||
-+ this.readyState == 'loaded' ||
-+ this.readyState == 'complete'
-+ )) {
-+ done = true;
-+ set_fedmenu(); // Do the callback
-+ jquery_src.onload = jquery_src.onreadystatechange = null;
-+ document.body.removeChild(jquery_src);
-+ };
-+ };
-+ document.body.appendChild(jquery_src);
-+}
-+
-+function set_fedmenu() {
-+ var fedmenu_src = document.createElement('script');
-+ fedmenu_src.type = 'text/javascript';
-+ fedmenu_src.src = 'https://apps.fedoraproject.org/fedmenu/js/fedmenu.js';
-+ var done = false;
-+ fedmenu_src.onload = fedmenu_src.onreadystatechange = function() {
-+ if (!done && (
-+ !this.readyState ||
-+ this.readyState == 'loaded' ||
-+ this.readyState == 'complete'
-+ )) {
-+ done = true;
-+ run_fedmenu(); // Do the callback
-+ fedmenu_src.onload = fedmenu_src.onreadystatechange = null;
-+ document.body.removeChild(fedmenu_src);
-+ };
-+ };
-+ document.body.appendChild(fedmenu_src);
-+}
-+
-+function run_fedmenu() {
-+ var fedmenu_spt = document.createElement('script');
-+ fedmenu_spt.type = 'text/javascript';
-+ fedmenu_spt.text = 'fedmenu({'
-+ + '"url": "https://apps.fedoraproject.org/js/data.js",
'
-+ + '"mimetype": "application/javascript", '
-+ + '"position": "bottom-left", '
-+ + '});';
-+ document.body.appendChild(fedmenu_spt);
-+}
-+
-+window.addEventListener("load", function(){
-+ install_fedmenu();
-+});
+From 23e9e1f56a48322fa229257305b092385d035fdd Mon Sep 17 00:00:00 2001
+From: Pierre-Yves Chibon <pingou(a)pingoured.fr>
+Date: Tue, 19 May 2015 15:45:13 -0400
+Subject: [PATCH] Add fedmenu to docs.fp.o.
+
+This is done by modifying ``toc.js`` to pull in the fedmenu resources
+which in turn write the fedmenu elements to the DOM. We run into
+trouble though, because toc.js executes in the context of an iframe
+child and fedmenu gets confused -- where should it write!?
+
+This required a patch to fedmenu that allows it to accept a `context`
+argument:
https://github.com/fedora-infra/fedmenu/pull/12
+
+In this patch, we pass ``parent.document`` as the context, which gets
+fedmenu to write to the correct location.
+
+Signed-off-by: Ralph Bean <rbean(a)redhat.com>
+---
+ public_html/toc.js | 57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 57 insertions(+)
+
+diff --git a/public_html/toc.js b/public_html/toc.js
+index 501b27a..a57d564 100644
+--- a/public_html/toc.js
++++ b/public_html/toc.js
+@@ -337,3 +337,60 @@ function showMenu() {
+ setCookie(name_menu, 'open', expDate, '/', false, false);
+ }
+
++/* fedmenu integration */
++
++function install_fedmenu() {
++ var jquery_src = document.createElement('script');
++ jquery_src.type = 'text/javascript';
++ jquery_src.src =
'https://apps.fedoraproject.org/fedmenu/js/jquery-1.11.2.min.js';
++ var done = false;
++ jquery_src.onload = jquery_src.onreadystatechange = function() {
++ if (!done && (
++ !this.readyState ||
++ this.readyState == 'loaded' ||
++ this.readyState == 'complete'
++ )) {
++ done = true;
++ set_fedmenu(); // Do the callback
++ jquery_src.onload = jquery_src.onreadystatechange = null;
++ document.body.removeChild(jquery_src);
++ };
++ };
++ document.body.appendChild(jquery_src);
++}
++
++function set_fedmenu() {
++ var fedmenu_src = document.createElement('script');
++ fedmenu_src.type = 'text/javascript';
++ fedmenu_src.src = 'https://apps.fedoraproject.org/fedmenu/js/fedmenu.js';
++ var done = false;
++ fedmenu_src.onload = fedmenu_src.onreadystatechange = function() {
++ if (!done && (
++ !this.readyState ||
++ this.readyState == 'loaded' ||
++ this.readyState == 'complete'
++ )) {
++ done = true;
++ run_fedmenu(); // Do the callback
++ fedmenu_src.onload = fedmenu_src.onreadystatechange = null;
++ document.body.removeChild(fedmenu_src);
++ };
++ };
++ document.body.appendChild(fedmenu_src);
++}
++
++function run_fedmenu() {
++ var fedmenu_spt = document.createElement('script');
++ fedmenu_spt.type = 'text/javascript';
++ fedmenu_spt.text = 'fedmenu({'
++ + '"url": "https://apps.fedoraproject.org/js/data.js",
'
++ + '"mimetype": "application/javascript", '
++ + '"position": "bottom-right", '
++ + '"context": parent.document'
++ + '});';
++ document.body.appendChild(fedmenu_spt);
++}
++
++window.addEventListener("load", function(){
++ install_fedmenu();
++});
+--
+2.4.1
diff --git a/public_html/toc.js b/public_html/toc.js
index 501b27a..5588a70 100644
--- a/public_html/toc.js
+++ b/public_html/toc.js
@@ -337,3 +337,61 @@ function showMenu() {
setCookie(name_menu, 'open', expDate, '/', false, false);
}
+
+/* fedmenu integration */
+
+function install_fedmenu() {
+ var jquery_src = document.createElement('script');
+ jquery_src.type = 'text/javascript';
+ jquery_src.src =
'https://apps.fedoraproject.org/fedmenu/js/jquery-1.11.2.min.js';
+ var done = false;
+ jquery_src.onload = jquery_src.onreadystatechange = function() {
+ if (!done && (
+ !this.readyState ||
+ this.readyState == 'loaded' ||
+ this.readyState == 'complete'
+ )) {
+ done = true;
+ set_fedmenu(); // Do the callback
+ jquery_src.onload = jquery_src.onreadystatechange = null;
+ document.body.removeChild(jquery_src);
+ };
+ };
+ document.body.appendChild(jquery_src);
+}
+
+function set_fedmenu() {
+ var fedmenu_src = document.createElement('script');
+ fedmenu_src.type = 'text/javascript';
+ fedmenu_src.src = 'https://apps.fedoraproject.org/fedmenu/js/fedmenu.js';
+ var done = false;
+ fedmenu_src.onload = fedmenu_src.onreadystatechange = function() {
+ if (!done && (
+ !this.readyState ||
+ this.readyState == 'loaded' ||
+ this.readyState == 'complete'
+ )) {
+ done = true;
+ run_fedmenu(); // Do the callback
+ fedmenu_src.onload = fedmenu_src.onreadystatechange = null;
+ document.body.removeChild(fedmenu_src);
+ };
+ };
+ document.body.appendChild(fedmenu_src);
+}
+
+function run_fedmenu() {
+ var fedmenu_spt = document.createElement('script');
+ fedmenu_spt.type = 'text/javascript';
+ fedmenu_spt.text = 'fedmenu({'
+ + '"url": "https://apps.fedoraproject.org/js/data.js",
'
+ + '"mimetype": "application/javascript", '
+ + '"position": "bottom-right", '
+ + '"context": parent.document'
+ + '});';
+ document.body.appendChild(fedmenu_spt);
+}
+
+window.addEventListener("load", function(){
+ install_fedmenu();
+});