Permalink
Browse files

Merge pull request #39 from Abscissa/index-no-js-needed-2

JS not required for homepage examples and "your code here" (the 2nd)
  • Loading branch information...
2 parents 4763e00 + 56d5b2d commit 63aac122d3ddf41450313a41b03fe5732389401a @WalterBright WalterBright committed Jan 10, 2012
Showing with 40 additions and 4 deletions.
  1. +8 −0 css/style.css
  2. +2 −2 doc.ddoc
  3. +30 −2 index.dd
View
@@ -633,3 +633,11 @@ TABLE.book CAPTION
display:none;
}
+.answer-nojs {
+ display:block;
+}
+
+.nobr {
+ white-space:nowrap;
+}
+
View
@@ -57,10 +57,10 @@ function showHideAnswer(zis)
var numericID = zis.id.replace(/[^\d]/g,'');
var obj = document.getElementById('a' + numericID);
if(obj.style.display=='block'){
- zis.innerHTML = "<nobr>See example.</nobr>";
+ zis.innerHTML = '<span class="nobr">See example.</span>';
obj.style.display='none';
}else{
- zis.innerHTML = "<nobr>Hide example.</nobr>";
+ zis.innerHTML = '<span class="nobr">Hide example.</span>';
obj.style.display='block';
}
}
View
@@ -5,6 +5,18 @@ $(D_S D Programming Language,
$(SECTION3 The D programming language. Modern
convenience. Modeling power. Native efficiency.,
+<script>
+function showHideYourCodeHere()
+{
+ var obj = document.getElementById('your-code-info');
+ if(obj.style.display=='block'){
+ obj.style.display='none';
+ }else{
+ obj.style.display = 'block';
+ }
+}
+</script>
+
----
#!/usr/bin/rdmd
// Computes average line length for standard input.
@@ -21,7 +33,15 @@ void main() {
lines ? sumLength / lines : 0);
}
----
-<div style="font-size:75%;text-align:right;position:relative;top:-3em;right:0.5em;bottom:0em;cursor:pointer;" onclick='alert("Got a brief example illustrating D? Submit your code to the digitalmars.D forum, specifying \"[your code here]\" in the title. Upon approval, it will be showcased on a random schedule on D&#145;s homepage.");'><a>[your code here]</a></div>
+<div style="font-size:75%;text-align:right;position:relative;top:-3em;right:0.5em;bottom:0em;cursor:pointer;" onclick='showHideYourCodeHere();'><a id="your-code-link">[your code here]</a></div>
+
+$(TAG2 div, id="your-code-info" style="display:block; position:relative; width: 50%; margin-left:auto; top:-2.5em; bottom:0em; background:white; border:1px solid #ccc; font-size:80%; padding:0px 5px 0px 5px; line-height:1.4em;",
+Got a brief example illustrating D? Submit your code to the
+$(LINK2 http://digitalmars.com/NewsGroup.html, digitalmars.D forum)$(COMMA)
+specifying <span class="nobr">"[your code here]"</span> in the title. Upon approval$(COMMA) it will be showcased
+on a random schedule on D&#145;s homepage.
+)
+<script>showHideYourCodeHere();</script>
D is a language with C-like syntax and static typing. It pragmatically combines
efficiency, control, and modeling power, with safety and programmer productivity.
@@ -501,7 +521,15 @@ Macros:
WEB=$(LINK2 http://$1,$2)
WEBX=$(LINK2 http://$1,$2)
D=<span class="d_inlinecode">$0</span>
- EXAMPLE=$(TAG2 div, id="q$1" class="question" onclick="showHideAnswer(this);", <nobr>See example.</nobr>)$(TAG2 div, id="a$1" class="answer", $2)
+ EXAMPLE=
+<script>
+ document.write('$(TAG2 div, id="q$1" class="question" onclick="showHideAnswer(this);", <span class="nobr">See example.</span>)');
+</script>
+<noscript><span class="nobr">See example.</span></noscript>
+$(TAG2 div, id="a$1" class="answer-nojs", $2)
+<script>
+ document.getElementById("a$1").style.display='none';
+</script>
LAYOUT=
<div id="navigation">
$1

0 comments on commit 63aac12

Please sign in to comment.