Skip to content

Commit

Permalink
Finished annos for Dmitry A. Soshnikov articles.
Browse files Browse the repository at this point in the history
  • Loading branch information
sideshowbarker committed Jan 19, 2011
1 parent 24da03c commit 67ba8e6
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 72 deletions.
137 changes: 70 additions & 67 deletions anno.js
Expand Up @@ -130,7 +130,6 @@ function annotateToc() {
E = document.createElement("span");
E.setAttribute("class", "toc-anno");
E.textContent = symbol;
// E.textContent = "\u24ba";
document.getElementById(nodeList[i].parentNode.id + "-toc").parentNode.firstChild.appendChild(E);
}
}
Expand All @@ -140,15 +139,47 @@ function annotateToc() {
addMarker("anno", "\u24b6");
addMarker("mdcr", "\u24c7");
addMarker("mdcg", "\u24bc");
addMarker("dmas", "\u24b9");
}
function addMdcRefAnnos() {
var baseUrl = "https://developer.mozilla.org/en/JavaScript/Reference",
element,
hyperlink,
i,
id,
space,
annos = {
function annotateHeadings(baseUrl, marker, className, annos) {
var element, hyperlink, i, id, space;
for (id in annos) {
if (id !== null && id !== undefined) {
element = document.getElementById(id);
for (i = 0; i < annos[id].length; i = i + 1) {
space = document.createTextNode(" ");
hyperlink = document.createElement("a");
hyperlink.href = baseUrl + annos[id][i];
hyperlink.className = className;
hyperlink.target = "_blank";
hyperlink.title = "Open " + hyperlink.href + " in new tab/window";
hyperlink.textContent = marker;
element.appendChild(space);
element.appendChild(hyperlink);
}
}
}
}
document.addEventListener('click', annoShow, false);
// enable annotation pop-up to be dismissed by hitting esc key
document.addEventListener("keyup", function (e) {
var key = 0;
if (!e) {
e = window.event;
}
key = e.keyCode ? e.keyCode : e.which;
if (key === 27 && annoPanel) {
document.getElementById("bubble").setAttribute("style", "display: none");
annotations.removeChild(annoPanel);
annoPanel = null;
}
}, true);

annotateHeadings(
"https://developer.mozilla.org/en/JavaScript/Reference",
"\u24c7",
"mdcr",
{
"x7.4": [ "/Comments/comment" ],
"x10.6": [ "/Functions_and_function_scope/arguments" ],
"x11.1.1": [ "/Operators/Special/this" ],
Expand Down Expand Up @@ -416,32 +447,13 @@ function addMdcRefAnnos() {
"x15.12": [ "/Global_Objects/JSON" ],
"x15.12.2": [ "/Global_Objects/JSON/parse" ],
"x15.12.3": [ "/Global_Objects/JSON/stringify" ]
};
for (id in annos) {
if (id !== null && id !== undefined) {
element = document.getElementById(id);
for (i = 0; i < annos[id].length; i = i + 1) {
space = document.createTextNode(" ");
hyperlink = document.createElement("a");
hyperlink.href = baseUrl + annos[id][i];
hyperlink.className = "mdcr";
hyperlink.target = "_blank";
hyperlink.title = "Open " + hyperlink.href + " in new tab/window";
hyperlink.textContent = "\u24c7";
element.appendChild(space);
element.appendChild(hyperlink);
}
}
}
}
function addMdcGuideAnnos() {
var baseUrl = "https://developer.mozilla.org/en/JavaScript/Guide",
element,
hyperlink,
i,
id,
space,
annos = {
);
annotateHeadings(
"https://developer.mozilla.org/en/JavaScript/Guide",
"\u24bc",
"mdcg",
{
"x4.2": [ "/Working_with_Objects" ],
"x4.2.1": [ "/Details_of_the_Object_Model" ],
"x6": [ "/Values%2c_Variables%2c_and_Literals#Unicode" ],
Expand Down Expand Up @@ -510,39 +522,30 @@ function addMdcGuideAnnos() {
"x15.9": [ "/Predefined_Core_Objects#Date_Object" ],
"x15.10": [ "/Regular_Expressions", "/Predefined_Core_Objects#RegExp_Object" ],
"B.2.1": [ "/Functions#escape_and_unescape_Functions" ],
"B.2.2": [ "/Functions#escape_and_unescape_Functions" ],
};
for (id in annos) {
if (id !== null && id !== undefined) {
element = document.getElementById(id);
for (i = 0; i < annos[id].length; i = i + 1) {
space = document.createTextNode(" ");
hyperlink = document.createElement("a");
hyperlink.href = baseUrl + annos[id][i];
hyperlink.className = "mdcg";
hyperlink.target = "_blank";
hyperlink.title = "Open " + hyperlink.href + " in new tab/window";
hyperlink.textContent = "\u24bc";
element.appendChild(space);
element.appendChild(hyperlink);
}
}
}
}
document.addEventListener('click', annoShow, false);
// enable annotation pop-up to be dismissed by hitting esc key
document.addEventListener("keyup", function (e) {
var key = 0;
if (!e) {
e = window.event;
"B.2.2": [ "/Functions#escape_and_unescape_Functions" ]
}
key = e.keyCode ? e.keyCode : e.which;
if (key === 27 && annoPanel) {
document.getElementById("bubble").setAttribute("style", "display: none");
annotations.removeChild(annoPanel);
annoPanel = null;
);
annotateHeadings(
"http://dmitrysoshnikov.com/ecmascript",
"\u24b9",
"dmas",
{
"x4.2": [ "/javascript-the-core" ],
"x4.3": [ "/es5-chapter-1-properties-and-property-descriptors" ],
"x8.6": [ "/es5-chapter-1-properties-and-property-descriptors" ],
"x8.10": [ "/es5-chapter-1-properties-and-property-descriptors" ],
"x8.12": [ "/es5-chapter-1-properties-and-property-descriptors" ],
"x15.2.3": [ "/es5-chapter-1-properties-and-property-descriptors" ],
"x4.2.2": [ "/es5-chapter-2-strict-mode/" ],
"x10.1.1": [ "/es5-chapter-2-strict-mode/" ],
"x14.1": [ "/es5-chapter-2-strict-mode/" ],
"x15.1.2.1.1": [ "/es5-chapter-2-strict-mode/" ],
"C": [ "/es5-chapter-2-strict-mode/" ],
"x10.2": [ "/es5-chapter-3-1-lexical-environments-common-theory" ],
"x13.2": [ "/note-1-ecmascript-bound-functions" ],
"x15.3.4.5": [ "/note-1-ecmascript-bound-functions" ],
"x11.4.3": [ "/note-2-ecmascript-equality-operators/" ],
"x11.9": [ "/note-2-ecmascript-equality-operators/" ]
}
}, true);
addMdcRefAnnos();
addMdcGuideAnnos();
);
annotateToc();
14 changes: 10 additions & 4 deletions index.html
Expand Up @@ -39,9 +39,9 @@ <h3 id="annos">About the annotations</h3>

<p>To view annotations for a particular section of the present
document, follow the hyperlinks
marked <b>Ⓐ</b>, <b>Ⓡ</b>, <b>Ⓖ</b>, <b>Ⓔ</b>, and <b>①</b> in the
section headings. The different types of annotations provided by each of
those are as follows:</p>
marked <b>Ⓐ</b>, <b>Ⓓ</b>, <b>Ⓡ</b>, <b>Ⓖ</b>, <b>Ⓔ</b>, and <b>①</b> in
the section headings. The different types of annotations provided by each
of those are as follows:</p>

<dl>
<dt><b>Ⓐ</b> Contributed annotations</dt>
Expand All @@ -54,6 +54,12 @@ <h3 id="annos">About the annotations</h3>
the
<a href="http://github.com/sideshowbarker/es5-spec#readme">instructions on the Annotated ES5 project page</a>.</dd>

<dt><b>Ⓓ</b> Dmitry A. Soshnikov ECMA-262 article series</dt>
<dd>These do not mark annotations at this site but are instead direct
hyperlinks to relevant articles by
<a href="http://dmitrysoshnikov.com/">Dmitry A. Soshnikov</a> in his
<a href="http://dmitrysoshnikov.com/ecmascript/">ECMA-262 article series</a>.</dd>

<dt><b>Ⓡ</b> MDC JavaScript Reference</dt>
<dd>These do not mark annotations at this site but are instead direct
hyperlinks to corresponding sections in the
Expand All @@ -74,7 +80,7 @@ <h3 id="annos">About the annotations</h3>
“Editorial Items with no Technical Significance” section were
not.</dd>

<dt><b>①</b> Additional changes in the Edition 5.1</dt>
<dt><b>①</b> Additional changes in Edition 5.1</dt>
<dd>These provide details about changes included in Annex F of Edition 5.1
of the spec but that were not already in the July 2010 erratum document.</dd>
</dl>
Expand Down
4 changes: 3 additions & 1 deletion style.css
Expand Up @@ -22,8 +22,10 @@ a:hover {

a.mdcr,
a.mdcg,
a.dmas,
a.mdcr:visited,
a.mdcg:visited
a.mdcg:visited,
a.dmas:visited
{
color: green;
}
Expand Down

0 comments on commit 67ba8e6

Please sign in to comment.