Просмотр исходного кода

Add workaround to support "hover" selection of CSS elements in IE browsers. Solution uses "csshover.htc" from Peter Nederlof (http://www.xs4all.nl/~peterned/).

[SVN r30143]
Rene Rivera 21 лет назад
Родитель
Сommit
f2b164dc01
2 измененных файлов с 135 добавлено и 38 удалено
  1. 44 38
      index.htm
  2. 91 0
      more/css_0/csshover.htc

+ 44 - 38
index.htm

@@ -6,6 +6,11 @@
   <title>Boost C++ Libraries</title>
   <meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
   <link rel="stylesheet" type="text/css" href="more/css_0/front.css" />
+  <!--[if IE]>
+  <style type="text/css">
+    body { behavior: url(more/css_0/csshover.htc); }
+  </style>
+  <![endif-->
 </head>
 
 <body>
@@ -32,44 +37,44 @@
             <div class="section-body">
               <div class="section-body-0">
                 <div class="section-body-1">
-                  <p>Boost provides free peer-reviewed portable
-                  C++ source libraries.</p>
-
-                  <p>We emphasize libraries that work well with the
-                  C++ Standard Library. Boost libraries are intended to be
-                  widely useful, and usable
-                  across a broad spectrum of applications. The <a href=
-                  "more/license_info.html">Boost license</a> encourages both
-                  commercial and non-commercial use.</p>
-
-                  <p>We aim to establish "existing practice" and
-                  provide reference implementations so that Boost libraries
-                  are suitable for eventual standardization. Ten Boost
-                  libraries are already included in the <a href=
+                  <p>Boost provides free peer-reviewed portable C++ source
+                  libraries.</p>
+
+                  <p>We emphasize libraries that work well with the C++
+                  Standard Library. Boost libraries are intended to be widely
+                  useful, and usable across a broad spectrum of applications.
+                  The <a href="more/license_info.html">Boost license</a>
+                  encourages both commercial and non-commercial use.</p>
+
+                  <p>We aim to establish "existing practice" and provide
+                  reference implementations so that Boost libraries are
+                  suitable for eventual standardization. Ten Boost libraries
+                  are already included in the <a href=
                   "http://www.open-std.org/jtc1/sc22/wg21">C++ Standards
                   Committee's</a> Library Technical Report (<a href=
-                  "http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1745.pdf">TR1</a>)
-                  as a step toward becoming part of a future C++ Standard.
-                  More Boost libraries will part of the upcoming <a href=
+                  "http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1745.pdf">
+                  TR1</a>) as a step toward becoming part of a future C++
+                  Standard. More Boost libraries will part of the upcoming
+                  <a href=
                   "http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1810.html">
                   TR2</a>.</p>
 
                   <p class="faq"><span class="faq-question">Getting
-                  started:</span> <span class="faq-answer">Follow the <a href=
-                  "more/getting_started.html">Getting Started Guide</a>
-                  to download and install Boost. Popular Linux and Unix distributions such
-                  as <a href="http://fedora.redhat.com/">Fedora</a>, <a href=
+                  started:</span> <span class="faq-answer">Follow the
+                  <a href="more/getting_started.html">Getting Started
+                  Guide</a> to download and install Boost. Popular Linux and
+                  Unix distributions such as <a href=
+                  "http://fedora.redhat.com/">Fedora</a>, <a href=
                   "http://www.debian.org/">Debian</a>, and <a href=
-                  "http://www.netbsd.org/">NetBSD</a> include pre-built
-                  Boost packages. Boost may already be available on your
+                  "http://www.netbsd.org/">NetBSD</a> include pre-built Boost
+                  packages. Boost may already be available on your
                   organization's internal web server.</span></p>
 
                   <p class="faq"><span class=
                   "faq-question">Background:</span> <span class=
                   "faq-answer">The <a href="more/background.html">Background
                   Information page</a> has introductory material to help
-                  those educating their organization
-                  about Boost.</span></p>
+                  those educating their organization about Boost.</span></p>
                 </div>
               </div>
             </div>
@@ -435,25 +440,26 @@
 
                     <li>
                       <span class="library"><a href=
-                      "libs/program_options/doc/index.html">Program options library</a>:</span>
+                      "libs/program_options/doc/index.html">Program options
+                      library</a>:</span>
 
                       <ul>
-                        <li>Option descriptions are now printed with
-                        word wrapping.</li>
+                        <li>Option descriptions are now printed with word
+                        wrapping.</li>
 
                         <li>Command line parser can bypass unregistered
                         options, instread of throwing.</li>
 
-                        <li>Removed support for "implicit" (optional) values.</li>
+                        <li>Removed support for "implicit" (optional)
+                        values.</li>
 
                         <li>New customization method
-                            'command_line_parser::extra_style_parser'. Unlike
-                            'additional_parser', allows the user to parse
-                            several tokens and return a vector of options, not
-                            just a single option.</li>
+                        'command_line_parser::extra_style_parser'. Unlike
+                        'additional_parser', allows the user to parse several
+                        tokens and return a vector of options, not just a
+                        single option.</li>
 
                         <li>Work with disabled exceptions.</li>
-                          
                       </ul>
                     </li>
 
@@ -623,7 +629,7 @@
                           <div id="revised">
                             <p>Revised 
                             <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
-                             <!-- #BeginDate format:Sw1 -->8 May, 2005
+                             <!-- #BeginDate format:Sw1 -->8 May, 2005 
                             <!-- #EndDate -->
                              
                             <!--webbot bot="Timestamp" endspan i-checksum="40407" --></p>
@@ -648,8 +654,8 @@
                           <div id="banners">
                             <p><a href=
                             "http://validator.w3.org/check?uri=referer"><img class="c1"
-                            src="more/w3c_valid_xhtml10.png" alt=
-                            "Valid XHTML 1.0!" /></a></p>
+                                 src="more/w3c_valid_xhtml10.png" alt=
+                                 "Valid XHTML 1.0!" /></a></p>
 
                             <p><a href=
                             "http://jigsaw.w3.org/css-validator/check/referer">
@@ -659,7 +665,7 @@
                             <p><a href="http://sourceforge.net"><img class=
                             "c1" src=
                             "http://sourceforge.net/sflogo.php?group_id=7586&amp;type=1"
-                            alt="SourceForge.net" /></a></p>
+                                 alt="SourceForge.net" /></a></p>
                           </div>
                         </div>
                       </div>

+ 91 - 0
more/css_0/csshover.htc

@@ -0,0 +1,91 @@
+<attach event="ondocumentready" handler="parseStylesheets" />
+<script language="JScript">
+/**
+ *  Pseudos - V1.30.050121 - hover & active
+ *  ---------------------------------------------
+ *  Peterned - http://www.xs4all.nl/~peterned/
+ *  (c) 2005 - Peter Nederlof
+ *
+ *  Credits  - Arnoud Berendsen 
+ *           - Martin Reurings
+ *           - Robert Hanson
+ *
+ *  howto: body { behavior:url("csshover.htc"); }
+ *  ---------------------------------------------
+ */
+
+var currentSheet, doc = window.document, activators = {
+    onhover:{on:'onmouseover', off:'onmouseout'},
+    onactive:{on:'onmousedown', off:'onmouseup'}
+}
+
+function parseStylesheets() {
+    var sheets = doc.styleSheets, l = sheets.length;
+    for(var i=0; i<l; i++) 
+        parseStylesheet(sheets[i]);
+}
+    function parseStylesheet(sheet) {
+        if(sheet.imports) {
+            try {
+                var imports = sheet.imports, l = imports.length;
+                for(var i=0; i<l; i++) parseStylesheet(sheet.imports[i]);
+            } catch(securityException){}
+        }
+
+        try {
+            var rules = (currentSheet = sheet).rules, l = rules.length;
+            for(var j=0; j<l; j++) parseCSSRule(rules[j]);
+        } catch(securityException){}
+    }
+
+    function parseCSSRule(rule) {
+        var select = rule.selectorText, style = rule.style.cssText;
+        if(!(/(^|\s)(([^a]([^ ]+)?)|(a([^#.][^ ]+)+)):(hover|active)/i).test(select) || !style) return;
+        
+        var pseudo = select.replace(/[^:]+:([a-z-]+).*/i, 'on$1');
+        var newSelect = select.replace(/(\.([a-z0-9_-]+):[a-z]+)|(:[a-z]+)/gi, '.$2' + pseudo);
+        var className = (/\.([a-z0-9_-]*on(hover|active))/i).exec(newSelect)[1];
+        var affected = select.replace(/:hover.*$/, '');
+        var elements = getElementsBySelect(affected);
+
+        currentSheet.addRule(newSelect, style);
+        for(var i=0; i<elements.length; i++)
+            new HoverElement(elements[i], className, activators[pseudo]);
+    }
+
+function HoverElement(node, className, events) {
+    if(!node.hovers) node.hovers = {};
+    if(node.hovers[className]) return;
+    node.hovers[className] = true;
+    node.attachEvent(events.on,
+        function() { node.className += ' ' + className; });
+    node.attachEvent(events.off,
+        function() { node.className = 
+            node.className.replace(new RegExp('\\s+'+className, 'g'),''); });
+}
+
+function getElementsBySelect(rule) {
+    var parts, nodes = [doc];
+    parts = rule.split(' ');
+    for(var i=0; i<parts.length; i++) {
+        nodes = getSelectedNodes(parts[i], nodes);
+    }
+    return nodes;
+}
+    function getSelectedNodes(select, elements) {
+        var result, node, nodes = [];
+        var classname = (/\.([a-z0-9_-]+)/i).exec(select);
+        var identify = (/\#([a-z0-9_-]+)/i).exec(select);
+        var tagName = select.replace(/(\.|\#|\:)[a-z0-9_-]+/i, '');
+        for(var i=0; i<elements.length; i++) {
+            result = tagName? elements[i].all.tags(tagName):elements[i].all; 
+            for(var j=0; j<result.length; j++) {
+                node = result[j];
+                if((identify && node.id != identify[1]) || (classname && !(new RegExp('\\b' +
+                    classname[1] + '\\b').exec(node.className)))) continue;
+                nodes[nodes.length] = node;
+            }
+        }
+        return nodes;
+    }
+</script>

粤ICP备19079148号