Changed 'preferences' to 'settings'; partial commit of alphabetical key listing transformer; additional minor clean-up;
authorJames Craig <jcraig@apple.com>
Thu, 14 Mar 2013 14:05:45 -0700
changeset 91 59511393d379
parent 90 f230283856c2
child 92 d0d561e413bb
Changed 'preferences' to 'settings'; partial commit of alphabetical key listing transformer; additional minor clean-up;
src/indie-ui-context.html
src/js/respec-transformers.js
--- a/src/indie-ui-context.html	Wed Mar 13 20:02:41 2013 -0700
+++ b/src/indie-ui-context.html	Thu Mar 14 14:05:45 2013 -0700
@@ -6,7 +6,7 @@
 		<link href="./css/screen.css" rel="stylesheet" type="text/css">
 		<script type="text/javascript" src="./loc/en/strings.js"></script>
 		<script type="text/javascript" src="./js/utils.js"></script>
-		<script type="text/javascript" src="./js/respec-transformers.js" class="remove"></script>
+		<script type="text/javascript" src="./js/respec-transformers.js"></script>
 		
 		<!-- 
       === NOTA BENE ===
@@ -103,12 +103,12 @@
 		<!-- :::::::::::::::::::: END INTRO :::::::::::::::::::: -->
 		
 
-		<!-- :::::::::::::::::::: window.preferences :::::::::::::::::::: -->
-		<section id="UserPreferences">
-			<h3>Interface UserPreferences</h3>
-			<p>The <code>preferences</code> attribute of the Window interface MUST return an instance of the UserPreferences interface. The same object must be returned each time.</p>
+		<!-- :::::::::::::::::::: window.settings :::::::::::::::::::: -->
+		<section id="UserSettings">
+			<h3>Interface UserSettings</h3>
+			<p>The <code>settings</code> attribute of the Window interface MUST return an instance of the UserSettings interface. The same object must be returned each time.</p>
 
-			<dl title="interface UserPreferences" class="idl">
+			<dl title="interface UserSettings" class="idl">
 
 				<dt>DOMstring? valueForKey(<!-- params defined in dl below -->)</dt>
 				<dd>
@@ -117,14 +117,14 @@
 					<p class="note">An undefined or empty value for the <var>taxonomy</var> parameter indicates the <var>key</var> matches a preference defined in <a href="#preference-keys">Preference Keys</a> section of this document. Standard vendor prefixes (<code>ie</code>, <code>moz</code>, <code>o</code>, <code>webkit</code>) are reserved for the <var>taxonomy</var> parameter, and any additional implementation or external taxonomy identifiers will be defined in a supplemental, informative document.</p>
 					<pre class="example">
 						// example of a preference defined within the IndieUI User Context specification.
-						window.preferences.valueForKey('fontSize'); // e.g. '16px'
-						window.preferences.valueForKey('susbtitle'); // e.g. returns true if the user wants to see subtitles or captions by default
+						window.settings.valueForKey('fontSize'); // e.g. '16px'
+						window.settings.valueForKey('susbtitle'); // e.g. returns true if the user wants to see subtitles or captions by default
 						
 						// example of an vendor-proposed preference, intended for standardization.
-						window.preferences.valueForKey('foo', 'moz');
+						window.settings.valueForKey('foo', 'moz');
 						
 						// example of an implementation-specific preference that does not apply to other user agents.
-						window.preferences.valueForKey('focusAllControls', 'webkit');
+						window.settings.valueForKey('focusAllControls', 'webkit');
 					</pre>
 					<dl class="parameters">
 						
@@ -142,7 +142,7 @@
 				<h4>User Preference Keys</h4>
 				<p class="ednote">The different key groupings are to allow individual privacy restrictions for each group. We're still working on the best way to spec those privacy restrictions.</p>
 
-				<section id="GeneralKeys">
+				<section id="GeneralKeys" class="keys">
 					<h5>General User Preference Keys</h5>
 					
 					<dl title="dictionary GeneralKeys" class="idl">
@@ -160,14 +160,14 @@
 						<dd>Returns a DOM element that indicates the users current point-of-regard.
 							<p class="ednote">I am still hoping we'll come up with a better name than point-of-regard.</p>
 							<div class="note">Indicates the user's focused point of attention, which make be the element under the mouse, in keyboard focus, or indicated by assistive technology such as eye tracking software or screen reader focus. Point-of-regard is similar to the concept of document.activeElement, and in the simple case of full keyboard access, it will likely stay in sync with document.activeElement.</div>
-							<p class="ednote">This one may indicate too much about AT to remain in the general preferences.</p>
+							<p class="ednote">This one may indicate too much about AT to remain in the general settings.</p>
 						</dd>
 					
 					</dl>
 					
 				</section>
 				
-				<section id="AuditoryAlternativeKeys">
+				<section id="AuditoryAlternativeKeys" class="keys">
 					<h5>Auditory Alternative Keys (Subtitles, Captions, and Transcripts)</h5>
 					<p class="ednote">TBD: Keys in this section will be subject to domain-specific privacy policy limiting initial access and prompting the user. TBD whether these keys may be accessed only on a user triggered event, as opposed to onload for example.</p>
 					
@@ -198,7 +198,7 @@
 				</section>
 				
 				
-				<section id="ScreenReaderKeys">
+				<section id="ScreenReaderKeys" class="keys">
 					<h5>Screen Reader Keys</h5>
 					<p class="ednote">TBD: Keys in this section will be subject to domain-specific privacy policy limiting initial access and prompting the user. TBD whether these keys may be accessed only on a user triggered event, as opposed to onload for example.</p>
 				
@@ -218,7 +218,7 @@
 				
 			</section>
 		</section>
-		<!-- :::::::::::::::::::: window.preferences :::::::::::::::::::: -->
+		<!-- :::::::::::::::::::: window.settings :::::::::::::::::::: -->
 
 
 		
@@ -433,6 +433,11 @@
 		<pre data-transform='xmp'>This markup is <b>escaped</b> like an <code>xmp</code>.</pre>
 		-->
 		<section id="terms" class="appendix" data-include="./include/terms.html"></section>
+		<section id="keyslist" class="">
+			<h2>Settings Key List (alphabetical)</h2>
+			<div data-transform="listKeys"><!-- dynamically generates key list --></div>
+		</section>
+		
 		<section id="acknowledgements" class="appendix" data-include="./include/ack.html"></section>
 		
 	</body>
--- a/src/js/respec-transformers.js	Wed Mar 13 20:02:41 2013 -0700
+++ b/src/js/respec-transformers.js	Thu Mar 14 14:05:45 2013 -0700
@@ -19,7 +19,7 @@
 		if (els.length) description = els[0].innerText; // use its text value as the short description
 		s += '<li><a href="#' +title+ '">' +title+ '</a>: ' +description+ '</li>';
 	}
-	s += '</ul>'
+	s += '</ul>';
 	return content + s;
 }
 
@@ -30,11 +30,41 @@
 		var title = eventList[i];
 		s += '<li><code>' +title.replace('request','')+ '</code></li>';
 	}
-	s += '</ul>'
+	s += '</ul>';
 	return content + s;
 }
 
 
+// utility used by listKeys
+function allKeys() {
+	var selector = '', keyList = [], nodeList = $$('.keys');
+	// first find all the Dictionary IDs ('GeneralKeys', 'AuditoryAlternativeKeys', etc.); we'll use them 
+	for (var i=0; i<nodeList.length; i++) {
+		selector += '#' + nodeList[i].id + ' dt, '; // construct selector for the next query: '#GeneralKeys dt, #AuditoryAlternativeKeys dt, '
+	}
+	selector = selector.replace(/, $/, ''); // trim the trailing ', ', or querySelectorAll will throw a syntax error
+	// now the real key search
+	nodeList = $$(selector);
+	for (var i=0; i<nodeList.length; i++) {
+		var nodeId = nodeList[i].id;
+		console.log(document.getElementById(nodeId));
+		nodeId = nodeId.substring(nodeId.lastIndexOf('-')+1);
+		keyList.push(nodeId);
+	}
+	return keyList.sort();
+}
+
+/* listKeys: alphabetical list generated from user context keys. */
+function listKeys(r, content) {
+	var s = '<ul>', keyList = allKeys();
+	for (var i=0; i<keyList.length; i++){
+		var keyName = keyList[i];
+		s += '<li><code>' + keyName + '</code></li>'; // todo: link these
+	}
+	s += '</ul>';
+	return content + s;
+}
+
 
 /* syntax highlighting for JavaScript examples */
 function syntaxJavaScript(r, content) {
@@ -45,8 +75,8 @@
 			lines[i] = lines[i].replace('//', '<span class="comment linecomment">//').replace(/$/, '</span>');
 		}
 		// block comments
-		lines[i] = lines[i].replace('/*', '<span class="comment blockcomment">/*')
-		lines[i] = lines[i].replace('*/', '*/</span>')
+		lines[i] = lines[i].replace('/*', '<span class="comment blockcomment">/*');
+		lines[i] = lines[i].replace('*/', '*/</span>');
 	}
 	return lines.join('\n'); // reassemble the string
 }
@@ -56,8 +86,8 @@
 	lines = content.split(/\n/);
 	for (var i=0; i<lines.length; i++) {
 		// block comments
-		lines[i] = lines[i].replace('/*', '<span class="comment blockcomment">/*')
-		lines[i] = lines[i].replace('*/', '*/</span>')
+		lines[i] = lines[i].replace('/*', '<span class="comment blockcomment">/*');
+		lines[i] = lines[i].replace('*/', '*/</span>');
 	}
 	return lines.join('\n'); // reassemble the string
 }
@@ -67,8 +97,8 @@
 	lines = content.split(/\n/);
 	for (var i=0; i<lines.length; i++) {
 		// comments
-		lines[i] = lines[i].replace('&lt;!--', '<span class="comment blockcomment">&lt;!--')
-		lines[i] = lines[i].replace('--&gt;', '--&gt;</span>')
+		lines[i] = lines[i].replace('&lt;!--', '<span class="comment blockcomment">&lt;!--');
+		lines[i] = lines[i].replace('--&gt;', '--&gt;</span>');
 	}
 	return lines.join('\n'); // reassemble the string