Clean up des tâches à faire et ajout de doc pour les protections de poussière
275
Ressource/Bellows/Tuto/1/Bellows.htm
Normal file
@ -0,0 +1,275 @@
|
||||
<html>
|
||||
<head>
|
||||
<!-- Global site tag (gtag.js) - Google Analytics -->
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-129280539-1"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag() { dataLayer.push(arguments); }
|
||||
gtag('js', new Date());
|
||||
|
||||
gtag('config', 'UA-129280539-1');
|
||||
</script>
|
||||
<title>Bellows</title>
|
||||
<meta content="True" name="vs_showGrid">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link rel="stylesheet" type="text/css" href="/Site.css">
|
||||
<script type="text/javascript" src="/menu.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="mainContainer">
|
||||
<div id="topBar">
|
||||
<h1 align="center">Bellows</h1>
|
||||
</div>
|
||||
|
||||
<div id="leftColumn" w3-include-html="/menu.html"></div>
|
||||
|
||||
<div id="mainContent">
|
||||
<p>The linear slides I got off ebay didn't come with covers to stop swarf getting to the rails and ballscrews. So I decided to cover them with a bellows.</p>
|
||||
<p><img border="0" src="bellows.jpg" width="476" height="377"></p>
|
||||
<p>I did a little bit of research. There are some stock sized
|
||||
commercial bellows available; these are usually rubberised fabric, welded at the seams.
|
||||
I couldn't find any that fit, nor could I afford them. So
|
||||
I googled for DIY bellows folding. Again, I drew a blank.
|
||||
Then I checked the USPTO, and I hit a gold.</p>
|
||||
<p>
|
||||
<a href="http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO1&Sect2=HITOFF&d=PALL&p=1&u=/netahtml/PTO/srchnum.htm&r=1&f=G&l=50&s1=6,054,194.PN.&OS=PN/6,054,194&RS=PN/6,054,194">Patent number 6,054,194</a>,
|
||||
invented by Nathan R. Kane, is not just a description of
|
||||
bellows, but it is a complete thesis on optimal fold patterns
|
||||
for bellows. The optimal patterns will maximise the
|
||||
bellows extension length, while minimising the side wall
|
||||
distortion. By using just the fold pattern, a bellows can
|
||||
be created that holds its shape without external support.</p>
|
||||
<p>Polypropylene sheet was selected to make the bellows.
|
||||
Polypropylene is a good "hinge" material, meaning it can be fold
|
||||
back and forward repeatedly with fatigue. I tried a couple
|
||||
different thicknesses, 1.2mm, 1mm, .7mm, and finally settled on
|
||||
0.39mm - not that this is the best size, its just the thinnest
|
||||
stuff I could find in large sheets. I think thinner sheet
|
||||
would be better, but I couldn't find any. I found it at my
|
||||
local craft store.</p>
|
||||
<table id=polypropyleneGrain margin=5 bgcolor="#FFAAAA" border="2" bordercolor="#FF0000" cellspacing="6" cellpadding="6" bordercolorlight="#FF0000" bordercolordark="#FF0000" style="border-collapse: collapse">
|
||||
<tr>
|
||||
<td>
|
||||
<p>Update!</p>
|
||||
<p>Just a note on polypropylene. Polypropylene has grain!
|
||||
I'm sure my terminology is incorrect, but polypropylene, like
|
||||
paper or timber, has a preferred strong direction and a weak
|
||||
direction. If you try to tear polypropylene sheet in its
|
||||
weak direction, it will continue to tear in the direction it is
|
||||
forced. In the other direction, 90° to the weak
|
||||
direction, the polypropylene will not tear, in fact it will turn
|
||||
90° to the weak direction. This is because of the
|
||||
polymer chains (so I've read). </p>
|
||||
<p>Why is this a problem? If you try to fold the
|
||||
polypropylene with the folds running parallel to the weak
|
||||
direction, the polypropylene will crack. It is important
|
||||
to get the direction correct so the folds are perpendicular to
|
||||
the weak direction.</p>
|
||||
<p>So how do you find the weak direction? On the corner of
|
||||
a sheet of polypropylene, make a small cut, 5mm long and about
|
||||
5mm from the edge. Grab this tab and pull it. The
|
||||
pictures below show the results.</p>
|
||||
<p>
|
||||
<table>
|
||||
<tr>
|
||||
<td><img border="0" src="TearAgainst.jpg" width="250" height="356"></td>
|
||||
<td><img border="0" src="TearWith.jpg" width="250" height="356"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align=center>Against the grain</td>
|
||||
<td align=center>With the grain</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>
|
||||
The photo on the left shows trying to tear against the grain -
|
||||
you can't do it. The photo on the right shows tearing with
|
||||
the grain. The polypropylene tears easily. It is
|
||||
imporant that the bellows fold lines are placed perpendicular to
|
||||
this weak direction.</p>
|
||||
</td></tr></table>
|
||||
<p> </p>
|
||||
<h2>Building the Bellows</h2>
|
||||
<h3>1) Print the fold pattern</h3>
|
||||
<p>The first step is to produce a fold pattern for the bellows.
|
||||
For my first bellows, I used MS-Visio to lay out the lines.
|
||||
This was a bit tedious, so I wrote a simple program.</p>
|
||||
<p>
|
||||
<img border="0" src="Application.png" width="669" height="559"></p>
|
||||
<p>The program will only create a fold pattern for a simple bellows with either
|
||||
regular or alternating folds. The "generate g-code" option
|
||||
is not functional. I want to be able to generate g-code to
|
||||
guide a knife to score the bellows material, however all the
|
||||
bellows I need to create are larger than my mill, so this
|
||||
feature was postponed.</p>
|
||||
<p>The parameters are...</p>
|
||||
<table id="table1">
|
||||
<tr>
|
||||
<td width=150px>Config</td>
|
||||
<td>Different configurations can be selected.
|
||||
Configurations are automatically saved when the program
|
||||
exits, or a new configuration is selected.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>New</td>
|
||||
<td>Creates a new configuration. </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Shape</td>
|
||||
<td>Only a "Half Cover" is supported (2 sides and a top)</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Inversion</td>
|
||||
<td>Only 2 inversion are supported</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Mounting Folds</td>
|
||||
<td>The total number of extra folds to add for mounting
|
||||
the ends of the bellows</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Alternate Folds</td>
|
||||
<td>If true, adjacent folds will alternate up and down,
|
||||
rather than being in the same direction. This
|
||||
makes the compressed bellows smaller, but the top of the
|
||||
bellows has folds that may collect swarf. </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Inside Width</td>
|
||||
<td>The inside width that the bellows is going to cover.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Inside Heigth</td>
|
||||
<td>The inside height that the bellows is going to
|
||||
cover.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Protected Length</td>
|
||||
<td>The length of the area the bellows is going to
|
||||
cover.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Fold Width</td>
|
||||
<td>The width of one fold.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>The program will print out the fold pattern. It will
|
||||
tile the output over multiple pages. The diagonal line is
|
||||
used for lining up the pages when they are stuck together.</p>
|
||||
<p>The image below shows a snippet of the fold pattern.
|
||||
Note the solid and dotted lines. A solid line is a peak
|
||||
fold, and a dotted line is a valley fold (or vice-versa, it
|
||||
doesn't matter).</p>
|
||||
<p><img border="0" src="Pattern.png" width="451" height="447"></p>
|
||||
<p>The picture shows the fold pattern with a sheet of
|
||||
clear/translucent polypropylene on top.</p>
|
||||
<p><img border="0" src="Layout.jpg" width="600" height="435"></p>
|
||||
<p>The program and source can be downloaded here
|
||||
<a href="Bellows.zip">
|
||||
<img style="background-color=white" border="0" src="../../gplv3-88x31.png" width="88" height="31"></a>.
|
||||
The code isn't terribly stable. It was only used to
|
||||
generate a couple of patterns. The displayed pattern will
|
||||
only be updated when you tab between fields. There is no
|
||||
zoom - make the window bigger to see more of the pattern.</p>
|
||||
|
||||
|
||||
|
||||
<h3>2) Trim</h3>
|
||||
<p>The polypropylene sheet is cut to size. It is then
|
||||
stuck to the fold pattern using tape.</p>
|
||||
<h3>3) Score the lines</h3>
|
||||
<p>The next step is to encourage the polypropylene sheet to fold
|
||||
at the correct place. If these were being produced
|
||||
commercially, they could be vacuum formed, or pressed.
|
||||
Since this is overkill for a couple of one-offs, I tried a
|
||||
couple of manual techniques.</p>
|
||||
<p>First I tried scoring with a hobby knife. This was
|
||||
fine, but in a few spots the cuts went a bit deep and made the
|
||||
fold weak. Next, I tried using my soldering iron to melt a
|
||||
grove. This wasn't terribly successful as shown by the
|
||||
video below. I did learn though that the scoring and
|
||||
folding needs to be very accurate, or the bellows will not fold
|
||||
properly. Finally, I settled on a scriber - a pen with a
|
||||
sharp carbide tip used for scratching metal, to scratch the
|
||||
polypropylene.</p>
|
||||
<p>Use a metal ruler and carefully trace over the peak folds.
|
||||
Take care and do this accurately or the bellows will not fold
|
||||
properly. Don't score the diagonal guide line running the
|
||||
length of page.</p>
|
||||
<p>The picture below shows the scored peak folds. The
|
||||
lighting in the picture makes them appear black. </p>
|
||||
<p><img border="0" src="ScoredTop.jpg" width="500" height="362"></p>
|
||||
<p>When scoring fold corners (line intersections), make sure you
|
||||
overshoot the intersection by 2 or 3mm. This will help
|
||||
with the folding later.</p>
|
||||
<p>
|
||||
<img border="0" src="ScoredOver.jpg" width="682" height="511"></p>
|
||||
<p>When the top is finished, remove the polypropylene sheet,
|
||||
flip it over and stick it back down on the fold pattern.
|
||||
You can use the scored peak folds to line up with the printed
|
||||
peak lines as the bellows patterns are symetrical. Then
|
||||
score the valley fold lines.</p>
|
||||
<p>The photo below shows a scored polypropylene sheet.</p>
|
||||
<p><img border="0" src="Score.jpg" width="682" height="511"></p>
|
||||
<h3>4) Crease the Folds</h3>
|
||||
<p>Next, each of the scored lines needs to be creased.
|
||||
Here, we are not trying to fold the bellows, just get the folds
|
||||
going in the right direction. Just bend each fold and
|
||||
squeeze them with your fingers, like in the photo below.</p>
|
||||
<p><img border="0" src="Crease.jpg" width="500" height="303"></p>
|
||||
<p>It is important to get all the small angle folds.
|
||||
The folds must also be done in the right direction. If a
|
||||
scored line is on the top of the sheet, the two sides of the
|
||||
fold should fold down, like this...</p>
|
||||
<p>
|
||||
<img border="0" src="FoldDirection.png" width="497" height="312"></p>
|
||||
<p>The creased bellows will look like this...</p>
|
||||
<p><img border="0" src="Creased.jpg" width="568" height="407"></p>
|
||||
<h3>5) Folding</h3>
|
||||
<p>The final folding is the tricky bit. Although the
|
||||
initial creasing does help the bellows want to go in the right
|
||||
direction, it still takes a lot of finger muscle and patience to
|
||||
fold the bellows. It is important that the corners are
|
||||
sharp, otherwise they will be a source of ballooning.</p>
|
||||
<p>I found it easiest to fold the bellows if I worked on one
|
||||
side, folded 3 or 4 folds, clamp it, then do the other side.</p>
|
||||
<p>
|
||||
<img border="0" src="FingerFold.jpg" width="568" height="426"></p>
|
||||
<p>The quick release clamps worked well holding a few folds at a
|
||||
time.</p>
|
||||
<p><img border="0" src="AndClamp.jpg" width="568" height="358"></p>
|
||||
<p>Finally, all folded.</p>
|
||||
<p>
|
||||
<img border="0" src="DoubleClamp.jpg" width="594" height="248"></p>
|
||||
<p>The bellows is clamped between two chunks of timber to
|
||||
encourage it to stay in place.</p>
|
||||
<p><img border="0" src="BigClamp.jpg" width="409" height="408"></p>
|
||||
<p>The completed (blurry) bellows.</p>
|
||||
<p><img border="0" src="Folded.jpg" width="392" height="352"></p>
|
||||
<h3>6) Mounting</h3>
|
||||
<p>Obviously this will depend on what you plan to use the
|
||||
bellows for. I used some 3mm steel plate to mount on each
|
||||
end of the bellows. The bellows are held to the plates by
|
||||
M4 screws and small lengths of 3x10mm bar, tapped for the M4
|
||||
screws. These were then mounted to my X axis slide.</p>
|
||||
<p>
|
||||
<img border="0" src="MountingParts.jpg" width="417" height="362"><img border="0" src="Mounted.jpg" width="414" height="343"></p>
|
||||
<p>3mm steel plate probably wasn't the best choice for mounting
|
||||
the bellows, as I have already hit tall hold down bolts with it.
|
||||
In the future, I may tray thick plastic, and self adhesive
|
||||
velcro strips.</p>
|
||||
|
||||
|
||||
|
||||
<h2>When good bellows go bad!</h2>
|
||||
<p>The video below shows what happens when a bellows isn't
|
||||
folded correctly. The bellows on the right was bubbling
|
||||
out when it was closing. This snagged when moving in the Y
|
||||
direction, leaving what you see now...</p>
|
||||
<object width="425" height="350"> <param name="movie" value="http://www.youtube.com/v/1O0ln1kLFCI"> </param> <embed src="http://www.youtube.com/v/1O0ln1kLFCI" type="application/x-shockwave-flash" width="425" height="350"> </embed> </object>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- #include file="/analytics.html" -->
|
||||
</body>
|
||||
</html>
|
BIN
Ressource/Bellows/Tuto/1/Bellows_files/1O0ln1kLFCI.swf
Normal file
BIN
Ressource/Bellows/Tuto/1/Bellows_files/AndClamp.jpg
Normal file
After Width: | Height: | Size: 39 KiB |
BIN
Ressource/Bellows/Tuto/1/Bellows_files/Application.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
Ressource/Bellows/Tuto/1/Bellows_files/BigClamp.jpg
Normal file
After Width: | Height: | Size: 48 KiB |
BIN
Ressource/Bellows/Tuto/1/Bellows_files/Crease.jpg
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
Ressource/Bellows/Tuto/1/Bellows_files/Creased.jpg
Normal file
After Width: | Height: | Size: 44 KiB |
BIN
Ressource/Bellows/Tuto/1/Bellows_files/DoubleClamp.jpg
Normal file
After Width: | Height: | Size: 42 KiB |
BIN
Ressource/Bellows/Tuto/1/Bellows_files/FingerFold.jpg
Normal file
After Width: | Height: | Size: 37 KiB |
BIN
Ressource/Bellows/Tuto/1/Bellows_files/FoldDirection.png
Normal file
After Width: | Height: | Size: 8.0 KiB |
BIN
Ressource/Bellows/Tuto/1/Bellows_files/Folded.jpg
Normal file
After Width: | Height: | Size: 26 KiB |
BIN
Ressource/Bellows/Tuto/1/Bellows_files/Layout.jpg
Normal file
After Width: | Height: | Size: 38 KiB |
BIN
Ressource/Bellows/Tuto/1/Bellows_files/Mounted.jpg
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
Ressource/Bellows/Tuto/1/Bellows_files/MountingParts.jpg
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
Ressource/Bellows/Tuto/1/Bellows_files/Pattern.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
Ressource/Bellows/Tuto/1/Bellows_files/Score.jpg
Normal file
After Width: | Height: | Size: 42 KiB |
BIN
Ressource/Bellows/Tuto/1/Bellows_files/ScoredOver.jpg
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
Ressource/Bellows/Tuto/1/Bellows_files/ScoredTop.jpg
Normal file
After Width: | Height: | Size: 22 KiB |
131
Ressource/Bellows/Tuto/1/Bellows_files/Site.css
Normal file
@ -0,0 +1,131 @@
|
||||
|
||||
html{
|
||||
height:100%;
|
||||
font-family: Sans-Serif;
|
||||
}
|
||||
|
||||
body{
|
||||
background-color:#B0E0E6;
|
||||
}
|
||||
|
||||
h1
|
||||
{
|
||||
text-align: center;
|
||||
font-family: Serif;
|
||||
font-size: 24pt;
|
||||
}
|
||||
h2
|
||||
{
|
||||
}
|
||||
h3
|
||||
{
|
||||
}
|
||||
p
|
||||
{
|
||||
line-height: 130%;
|
||||
}
|
||||
.code {
|
||||
font-family:monospace;
|
||||
font-size:10pt;
|
||||
}
|
||||
#mainContainer{
|
||||
margin: 0 auto;
|
||||
margin-bottom: 10px;
|
||||
height:100%;
|
||||
text-align:left;
|
||||
}
|
||||
#leftColumn{
|
||||
width:170px;
|
||||
position:absolute;
|
||||
top: 90px;
|
||||
left: 0;
|
||||
padding-left:10px;
|
||||
background-color:#B0E0E6;
|
||||
}
|
||||
#mainContent{
|
||||
/*width:590px;*/
|
||||
padding-left:10px;
|
||||
padding-right:10px;
|
||||
position:absolute;
|
||||
left: 170px;
|
||||
top: 90px;
|
||||
margin-left: 10px;
|
||||
margin-right: 10px;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
background-color:azure;
|
||||
}
|
||||
#topBar{
|
||||
height:90px;
|
||||
width:100%;
|
||||
position:absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************************
|
||||
* LAYOUT CSS FOR THE MENU
|
||||
****************************************************************************************/
|
||||
#dhtmlgoodies_listMenu a, #dhtmlgoodies_listMenu p{ /* Main menu items */
|
||||
margin:1px;
|
||||
padding:0px;
|
||||
width:150px; /* Width of menu */
|
||||
|
||||
color:#000; /* Black text color */
|
||||
background-color:#70BAD5;
|
||||
|
||||
text-decoration:none; /* No underline */
|
||||
font-size:1em; /* Fixed font size */
|
||||
padding-left:3px;
|
||||
line-height:25px; /* Height of menu links */
|
||||
display:block;
|
||||
overflow:auto;
|
||||
font-family:sans-serif;
|
||||
|
||||
}
|
||||
|
||||
#dhtmlgoodies_listMenu ul li p /* Sub menu no-link */
|
||||
{
|
||||
color: #0092a3;
|
||||
font-weight:normal;
|
||||
font-size:0.8em;
|
||||
}
|
||||
|
||||
#dhtmlgoodies_listMenu ul li a /* Sub menu link */
|
||||
{
|
||||
font-weight:normal;
|
||||
font-size:0.8em;
|
||||
}
|
||||
|
||||
#dhtmlgoodies_listMenu ul li ul li a, #dhtmlgoodies_listMenu ul li ul li{ /* Sub Sub menu */
|
||||
color: #000;
|
||||
font-size:0.9em;
|
||||
font-weight:normal;
|
||||
}
|
||||
|
||||
#dhtmlgoodies_listMenu .activeMenuLink{ /* Styling of active menu item */
|
||||
background-color:#7099d5;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
No bullets
|
||||
*/
|
||||
#dhtmlgoodies_listMenu li{
|
||||
list-style-type:none;
|
||||
}
|
||||
|
||||
/*
|
||||
No margin and padding
|
||||
*/
|
||||
#dhtmlgoodies_listMenu, #dhtmlgoodies_listMenu ul{
|
||||
margin:0px;
|
||||
padding:0px;
|
||||
}
|
||||
|
||||
/* Margin of sub menu items */
|
||||
#dhtmlgoodies_listMenu ul{
|
||||
display:none;
|
||||
margin-left:10px;
|
||||
}
|
BIN
Ressource/Bellows/Tuto/1/Bellows_files/TearAgainst.jpg
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
Ressource/Bellows/Tuto/1/Bellows_files/TearWith.jpg
Normal file
After Width: | Height: | Size: 23 KiB |
BIN
Ressource/Bellows/Tuto/1/Bellows_files/bellows.jpg
Normal file
After Width: | Height: | Size: 43 KiB |
BIN
Ressource/Bellows/Tuto/1/Bellows_files/dot.png
Normal file
After Width: | Height: | Size: 215 B |
BIN
Ressource/Bellows/Tuto/1/Bellows_files/gplv3-88x31.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
278
Ressource/Bellows/Tuto/1/Bellows_files/menu.js
Normal file
@ -0,0 +1,278 @@
|
||||
|
||||
/************************************************************************************************************
|
||||
(C) www.dhtmlgoodies.com, October 2005
|
||||
|
||||
This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.
|
||||
|
||||
Terms of use:
|
||||
You are free to use this script as long as the copyright message is kept intact. However, you may not
|
||||
redistribute, sell or repost it without our permission.
|
||||
|
||||
Thank you!
|
||||
|
||||
www.dhtmlgoodies.com
|
||||
Alf Magne Kalleland
|
||||
|
||||
************************************************************************************************************/
|
||||
|
||||
/************************************************************************************************************
|
||||
(C) www.franksworkshop.com, October 2008
|
||||
|
||||
This was originally from www.dhtmlgoodies.com, but I made significant changes to support hrefs on branches,
|
||||
and match the full URL path to locate the current menu item. I couldn't really follow the code, so I rewrote
|
||||
most of it, but used the same concepts as the original.
|
||||
|
||||
Terms of use:
|
||||
You are free to use this script as long as the copyright message is kept intact. However, you may not
|
||||
redistribute, sell or repost it without our permission.
|
||||
|
||||
************************************************************************************************************/
|
||||
|
||||
var activeNode = null;
|
||||
var bAutoClose = true;
|
||||
|
||||
function isIE()
|
||||
{
|
||||
var ua = window.navigator.userAgent
|
||||
var msie = ua.indexOf ( "MSIE " )
|
||||
|
||||
if ( msie > 0 ) // If Internet Explorer, return true
|
||||
return true;
|
||||
else // If another browser, return 0
|
||||
return false;
|
||||
}
|
||||
|
||||
function getChildUL(node)
|
||||
{
|
||||
var ul = null;
|
||||
|
||||
for ( var i = 0; i < node.childNodes.length; i++ )
|
||||
{
|
||||
if ( node.childNodes[i].tagName == 'UL' )
|
||||
{
|
||||
ul = node.childNodes[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ul;
|
||||
}
|
||||
|
||||
function getParentUL(node)
|
||||
{
|
||||
while ( node != null )
|
||||
{
|
||||
if ( node.parentNode != null && node.parentNode.tagName == 'UL' )
|
||||
return node.parentNode;
|
||||
node = node.parentNode;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function toggleSubMenu(e)
|
||||
{
|
||||
var node = this;
|
||||
var ul = getChildUL(node);
|
||||
|
||||
// first toggle this menu item.
|
||||
if ( ul != null )
|
||||
{
|
||||
if ( ul.style.display == 'none' )
|
||||
ul.style.display = 'block';
|
||||
else
|
||||
ul.style.display = 'none';
|
||||
}
|
||||
|
||||
// next, optionally close any open menu items at the same level
|
||||
if ( bAutoClose )
|
||||
{
|
||||
ul = getParentUL(node);
|
||||
if ( ul != null )
|
||||
{
|
||||
for ( var i = 0; i < ul.childNodes.length; i++ )
|
||||
{
|
||||
var item = ul.childNodes[i];
|
||||
if ( item != node )
|
||||
{
|
||||
var childUL = getChildUL(item);
|
||||
if ( childUL != null )
|
||||
childUL.style.display = 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!e)
|
||||
e = window.event;
|
||||
e.cancelBubble = true;
|
||||
if (e.stopPropagation)
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
function showPath(node)
|
||||
{
|
||||
// May need to make child nodes visible
|
||||
var ul = getChildUL(node);
|
||||
if ( ul != null )
|
||||
ul.style.display = 'block';
|
||||
|
||||
// make the path to the parent visibile.
|
||||
while ( node != null )
|
||||
{
|
||||
ul = getParentUL(node);
|
||||
if ( ul != null )
|
||||
ul.style.display = 'block';
|
||||
node = ul;
|
||||
}
|
||||
}
|
||||
|
||||
function GetAElement( node )
|
||||
{
|
||||
for ( var i = 0; i < node.childNodes.length; i++ )
|
||||
{
|
||||
var node = node.childNodes[i];
|
||||
if ( node.tagName == 'A' )
|
||||
{
|
||||
return node;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function getHRefPath( node )
|
||||
{
|
||||
var s = node.pathname;
|
||||
while ( s != null && s.length > 0 && s.indexOf("/") == 0 )
|
||||
{
|
||||
s = s.substr(1);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
function ProcessList( root, fileNameThis )
|
||||
{
|
||||
var hasChildren = false;
|
||||
for ( var i = 0; i < root.childNodes.length; i++ )
|
||||
{
|
||||
var node = root.childNodes[i];
|
||||
if ( node.tagName == 'LI' || node.tagName == 'UL' )
|
||||
{
|
||||
if ( node.tagName == 'LI' )
|
||||
{
|
||||
hasChildren = true;
|
||||
// if this item has an A tag, check if it is the current page
|
||||
var atag = GetAElement( node );
|
||||
if ( atag != null && atag.href.charAt(atag.href.length-1)!='#')
|
||||
{
|
||||
var path = getHRefPath(atag).toLowerCase();
|
||||
if ( path == fileNameThis )
|
||||
{
|
||||
// match
|
||||
activeNode = node;
|
||||
}
|
||||
}
|
||||
else // No A tag. Is either a branch or dead leaf
|
||||
{
|
||||
}
|
||||
}
|
||||
else // node.tagName == 'UL'
|
||||
{
|
||||
node.style.display='none';
|
||||
}
|
||||
|
||||
if ( ProcessList( node, fileNameThis ) )
|
||||
{
|
||||
hasChildren = true;
|
||||
// this is a branch node
|
||||
if ( node.tagName == 'LI' )
|
||||
{
|
||||
node.onclick = toggleSubMenu;
|
||||
|
||||
var atag = node.firstChild;
|
||||
var pointer = document.createElement("div");
|
||||
if ( isIE() )
|
||||
{
|
||||
pointer.style.position = 'absolute';
|
||||
pointer.style.left = "145px";
|
||||
pointer.style.top = "20px";
|
||||
}
|
||||
else
|
||||
{
|
||||
pointer.style.position = 'relative';
|
||||
pointer.style.left = "145px";
|
||||
pointer.style.top = "0px";
|
||||
}
|
||||
pointer.style.width = "5px";
|
||||
pointer.style.height = "5px";
|
||||
pointer.style.borderStyle = "none";
|
||||
pointer.style.padding = "0";
|
||||
var img = document.createElement("img");
|
||||
img.src = "/dot.png";
|
||||
img.style.width = "5px";
|
||||
img.style.height = "5px";
|
||||
img.style.borderStyle = "none";
|
||||
img.style.padding = "0";
|
||||
atag.style.borderStyle = "none";
|
||||
pointer.appendChild(img);
|
||||
atag.appendChild(pointer);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return hasChildren;
|
||||
}
|
||||
|
||||
// http://w3schools.com/ somewhere
|
||||
function w3IncludeHTML() {
|
||||
var z, i, a, file, xhttp;
|
||||
z = document.getElementsByTagName("div");
|
||||
for (i = 0; i < z.length; i++) {
|
||||
if (z[i].getAttribute("w3-include-html")) {
|
||||
a = z[i].cloneNode(false);
|
||||
file = z[i].getAttribute("w3-include-html");
|
||||
var xhttp = new XMLHttpRequest();
|
||||
xhttp.onreadystatechange = function () {
|
||||
if (xhttp.readyState == 4 && xhttp.status == 200) {
|
||||
a.removeAttribute("w3-include-html");
|
||||
a.innerHTML = xhttp.responseText;
|
||||
|
||||
z[i].parentNode.replaceChild(a, z[i]);
|
||||
initMenu();
|
||||
}
|
||||
}
|
||||
xhttp.open("GET", file, true);
|
||||
xhttp.send();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function initMenu()
|
||||
{
|
||||
// Find tree branch nodes and add onclick handlers
|
||||
// Find the current node and select it
|
||||
var objMenuRoot = document.getElementById('dhtmlgoodies_listMenu');
|
||||
|
||||
// We use the file path part of the URL to match A tag hrefs
|
||||
var fileNameThis = getHRefPath(location).toLowerCase();
|
||||
// strip any trailing guff
|
||||
if (fileNameThis.indexOf('?') > 0)
|
||||
fileNameThis = fileNameThis.substr(0,fileNameThis.indexOf('?'));
|
||||
if (fileNameThis.indexOf('#') > 0)
|
||||
fileNameThis = fileNameThis.substr(0,fileNameThis.indexOf('#'));
|
||||
|
||||
|
||||
|
||||
// Recurse through the lists
|
||||
ProcessList( objMenuRoot, fileNameThis );
|
||||
|
||||
if ( activeNode != null )
|
||||
{
|
||||
activeNode.firstChild.className='activeMenuLink';
|
||||
showPath(activeNode);
|
||||
}
|
||||
|
||||
}
|
||||
window.onload = w3IncludeHTML;
|
||||
|