https://bugs.documentfoundation.org/show_bug.cgi?id=38093

--- Comment #25 from Steve <[email protected]> ---
Come on people, how hard can this be.  I can create an HTML document with
elements you can hide/un-hide with an 11 line javascript script put in the
<head> element, and using 2 strings of javascript, one of the like 37
characters long and the other one like 34 characters long.  The 'parent' string
goes into the element that will always be visible, the 'child' string goes in
the element (such as a <span>) that you want to hide/unhide

Javascript function script in <head> Code :

<script type="text/javascript">
function toggleShowHide(elementId) {
    var element = document.getElementById(elementId);
    if (element) {
        if (element.style.display == "none")
            element.style.display = "inline";
        else
            element.style.display = "none";
    }
}
</script>

code end/

'Parent' string code (I added the style color stuff so it would show up blue
like a link) :

onClick="toggleShowHide('UniqueID')" style="color:#000030"

code end/

'Child' string code :

id="UniqueID" style="display:none"

code end/

You can use anything you want as the label instead of UniqueID, I just used
that as boilerplate.  Just make sure they match.

Used creatively, like putting a list in a <div>, you can have
hideable/collapsible sublists, used in a <span> you can have descriptive text
about something.  Using hidden lists and hidden spans for the description text,
you can put the whole Encyclopedia Britannica in an HTML document, with
collapsible/hideable lists & sub-lists and description spans.

Here is an entire webpage, that works if you paste it into a plain text editor
and save it as an .html file.  Do NOT, I repeat do NOT, try to use Writer/Web
to do this.  As it does NOT make clean (makes probably the messiest HTML code
of any product I have yet to see) plain HTML code, it messes this thing ALL up.
 If you see anything at all doing this with Writer/Web, it will just be the
code.  I was going to attach the thing as an attachment, but it's only 41 lines
long.

Sample hideable text HTML page code :

<html style="margin:40px; padding:40px; background-color:#303030">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- The javascript code in this page allows you to add text that can be
clicked to be shown and hidden -->

<title>Put your Title text here</title>

<head>
<script type="text/javascript">
function toggleShowHide(elementId) {
    var element = document.getElementById(elementId);
    if (element) {
        if (element.style.display == "none")
            element.style.display = "inline";
        else
            element.style.display = "none";
    }
}
</script>
</head>

<h3>Put the Header you want for your page here</h3>

<body style="font-family:'Georgia', serif;font-size:130%;color:#00cc00">

This is where you put the text for your page
<p>
<b onClick="toggleShowHide('UniqueID')" style="color:#000030">Click here to see
hidden text</b>
</p>

<p>
<span id="UniqueID" style="display:none">
This is the text that you are hiding from view until it is clicked 
</span>
</p>


</body>
</html>

code end/

Just copy that code, paste it into a plain text editor and play with it all day
clicking the blue text and watching the hidden text in the spank appear and
disappear.

SURELY someone could easily translate this into the code used to work in
LibreOffice and integrate it as a function(s) or method(s) or whatever you
would use.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to