From e3af05725c827366f160624b30cd2b58d28aea5f Mon Sep 17 00:00:00 2001
From: Mark Craig <mark.craig@forgerock.com>
Date: Wed, 19 Oct 2011 14:15:05 +0000
Subject: [PATCH] Made the <pre class="screen"> thing a toggle, so you don't have to reload the page.
---
opendj3/src/main/resources/css/coredoc.css | 2 +-
opendj3/pom.xml | 40 +++++++++++++++++++++++-----------------
2 files changed, 24 insertions(+), 18 deletions(-)
diff --git a/opendj3/pom.xml b/opendj3/pom.xml
index 46a4065..2a42c16 100644
--- a/opendj3/pom.xml
+++ b/opendj3/pom.xml
@@ -355,15 +355,18 @@
<replacevalue>
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script type="text/javascript">
-// On click, reformat <screen> commands for easier copying.
-$(document).ready(function(){
- $(".screen").click(function(event){
- $(this).replaceWith(
- "<pre class=\"screen\">" +
- $(this).text().replace(/\n /g," ") +
- "</pre>");
- });
+// On click, reformat <pre class="screen"> for easy copying.
+$(".screen").live("click", function() {
+ $(this).replaceWith(
+ "<pre class=\"flat\">" +
+ $(this).text().replace(/\n /g," ") + "\n<!--" + $(this).text() + "-->" +
+ "</pre>");
});
+$(".flat").live("click", function() {
+ $(this).replaceWith(
+ "<pre class=\"screen\">" +
+ $(this).html().replace(/(.|\n)+<!\-\-/m,"").replace(/\-\-\>/,"") +
+ "</pre>");
</script>
<link rel="shortcut icon" href="http://forgerock.org/favicon.ico">
</head></replacevalue>
@@ -431,16 +434,19 @@
<replacevalue>
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script type="text/javascript">
-// On click, reformat <screen> commands for easier copying.
-$(document).ready(function(){
- $(".screen").click(function(event){
- $(this).replaceWith(
- "<pre class=\"screen\">" +
- $(this).text().replace(/\n /g," ") +
- "</pre>");
- });
+// On click, reformat <pre class="screen"> for easy copying.
+$(".screen").live("click", function() {
+ $(this).replaceWith(
+ "<pre class=\"flat\">" +
+ $(this).text().replace(/\n /g," ") + "\n<!--" + $(this).text() + "-->" +
+ "</pre>");
});
-</script>
+$(".flat").live("click", function() {
+ $(this).replaceWith(
+ "<pre class=\"screen\">" +
+ $(this).html().replace(/(.|\n)+<!\-\-/m,"").replace(/\-\-\>/,"") +
+ "</pre>");
+});</script>
<link rel="shortcut icon" href="http://forgerock.org/favicon.ico">
</head></replacevalue>
</replace>
diff --git a/opendj3/src/main/resources/css/coredoc.css b/opendj3/src/main/resources/css/coredoc.css
index 9f79271..a015c6a 100644
--- a/opendj3/src/main/resources/css/coredoc.css
+++ b/opendj3/src/main/resources/css/coredoc.css
@@ -152,7 +152,7 @@
/*
* Block elements
*/
-pre.programlisting,pre.screen
+pre.programlisting,pre.screen,pre.flat
{
font-family: monospace;
white-space: pre;
--
Gitblit v1.10.0