Author: nbelaevski
Date: 2008-02-22 20:07:17 -0500 (Fri, 22 Feb 2008)
New Revision: 6315
Added:
management/design/standardComponent/styles.js
Modified:
management/design/standardComponent/example.html
Log:
std components script added
Modified: management/design/standardComponent/example.html
===================================================================
--- management/design/standardComponent/example.html 2008-02-22 20:24:07 UTC (rev 6314)
+++ management/design/standardComponent/example.html 2008-02-23 01:07:17 UTC (rev 6315)
@@ -6,11 +6,15 @@
<title>Untitled</title>
<link rel="STYLESHEET" type="text/css"
href="basic.css">
-<link rel="STYLESHEET" type="text/css"
href="advanced.css">
+<link rel="STYLESHEET" type="text/css"
href="advanced.css" media="rich:std-components">
+
+<script src="styles.js"></script>
+
</head>
<body>
+
<fieldset>
<legend>Legend</legend>
<button>Test</button>
Added: management/design/standardComponent/styles.js
===================================================================
--- management/design/standardComponent/styles.js (rev 0)
+++ management/design/standardComponent/styles.js 2008-02-23 01:07:17 UTC (rev 6315)
@@ -0,0 +1,53 @@
+//skip Opera & Safari as they have their own custom styling
+
+var skipNavigator = window.opera || navigator.userAgent.indexOf('AppleWebKit/')
> -1;
+if (!skipNavigator) {
+
+ var getElementByTagName = function(elt, name) {
+ var elements;
+ try {
+ elements = elt.selectNodes(".//*[local-name()=\""+
+ name +"\"]");
+ } catch (ex) {
+ try {
+ elements = elt.getElementsByTagName(name);
+ } catch(nf){
+ //ok, give up, no elements found
+ }
+ }
+
+ return elements;
+ };
+
+ var links = getElementByTagName(window.document, 'link');
+ if (links) {
+ var l = links.length;
+
+ for (var i = 0; i < l; i++ ) {
+ var link = links[i];
+
+ if (link["rich:std-components"]) {
+ break;
+ }
+
+ var media = link.getAttribute('media');
+
+ if ("rich:std-components" == media) {
+ link["rich:std-components"] = true;
+
+ link.removeAttribute('media');
+
+ var ns = link.nextSibling;
+ var lpn = link.parentNode;
+ lpn.removeChild(link);
+ if (ns) {
+ lpn.insertBefore(link, ns);
+ } else {
+ lpn.appendChild(link);
+ }
+
+ break;
+ }
+ }
+ }
+}
\ No newline at end of file
Show replies by date