HTML5 and Chrome fixes
This commit is contained in:
parent
8e42dc30c0
commit
4912d60739
@ -16,9 +16,16 @@ for name,value in zip(sys.argv[1::2],sys.argv[2::2]):
|
|||||||
try: opts[name] = eval(value)
|
try: opts[name] = eval(value)
|
||||||
except: opts[name] = value
|
except: opts[name] = value
|
||||||
|
|
||||||
from html5lib import liberalxmlparser, treewalkers, treebuilders, serializer
|
try:
|
||||||
parser = liberalxmlparser.XHTMLParser(tree=treebuilders.getTreeBuilder('dom'))
|
from xml.dom import minidom
|
||||||
tokens = treewalkers.getTreeWalker('dom')(parser.parse(sys.stdin))
|
doc = minidom.parse(sys.stdin)
|
||||||
|
except:
|
||||||
|
from html5lib import liberalxmlparser, treebuilders
|
||||||
|
parser = liberalxmlparser.XHTMLParser(tree=treebuilders.getTreeBuilder('dom'))
|
||||||
|
doc = parser.parse(sys.stdin, encoding='utf-8')
|
||||||
|
|
||||||
|
from html5lib import treewalkers, serializer
|
||||||
|
tokens = treewalkers.getTreeWalker('dom')(doc)
|
||||||
serializer = serializer.HTMLSerializer(**dict(opts))
|
serializer = serializer.HTMLSerializer(**dict(opts))
|
||||||
for text in serializer.serialize(tokens, encoding='utf-8'):
|
for text in serializer.serialize(tokens, encoding='utf-8'):
|
||||||
sys.stdout.write(text)
|
sys.stdout.write(text)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Written by Stefano Mazzocchi <stefano at apache dot org>
|
* Originally written by Stefano Mazzocchi <stefano at apache dot org>
|
||||||
|
* Adapted by Sam Ruby <rubys at intertwingly dot net>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* ----------------------------- Global Definitions -------------------- */
|
/* ----------------------------- Global Definitions -------------------- */
|
||||||
@ -40,7 +41,7 @@ a.rising {
|
|||||||
|
|
||||||
a[rel~='license'] {
|
a[rel~='license'] {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
body > h1 {
|
body > h1 {
|
||||||
font-size: x-large;
|
font-size: x-large;
|
||||||
@ -48,10 +49,12 @@ body > h1 {
|
|||||||
letter-spacing: 0.25em;
|
letter-spacing: 0.25em;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
margin: 0px 0px 0px 0px;
|
margin: 0px 0px 0px 0px;
|
||||||
color: #000;
|
color: #889;
|
||||||
font-weight: normal;
|
font-family: Sans-Serif;
|
||||||
|
font-weight: bold;
|
||||||
|
font-style: italic;
|
||||||
background-color: #eee;
|
background-color: #eee;
|
||||||
border-bottom: 2px solid #bbb
|
border-bottom: 2px solid #ccd;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------- Sidebar --------------------------- */
|
/* ----------------------------- Sidebar --------------------------- */
|
||||||
@ -63,10 +66,12 @@ body > h1 {
|
|||||||
width: 210px;
|
width: 210px;
|
||||||
background-color: white;
|
background-color: white;
|
||||||
|
|
||||||
padding: 0px 0px 20px 0px;
|
padding: 0px 0px 10px 0px;
|
||||||
margin: 0px 0px 20px 20px;
|
margin: 0px 0px 20px 20px;
|
||||||
border-left: 1px solid #ccc;
|
border-left: 2px solid #ccd;
|
||||||
border-bottom: 1px solid #ccc;
|
border-bottom: 2px solid #ccd;
|
||||||
|
-webkit-border-bottom-left-radius: 1em;
|
||||||
|
-moz-border-radius: 0 0 0 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#sidebar h2 {
|
#sidebar h2 {
|
||||||
@ -75,16 +80,19 @@ body > h1 {
|
|||||||
font-size: x-small;
|
font-size: x-small;
|
||||||
color: #666;
|
color: #666;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
padding: 2px 0px 2px 4px;
|
padding: 2px 0px 2px 12px;
|
||||||
margin: 15px 0px 5px 10px;
|
margin: 15px 0px 5px 10px;
|
||||||
border-top: 1px solid #ccc;
|
border-top: 1px solid #ccc;
|
||||||
border-left: 1px solid #ccc;
|
border-left: 1px solid #ccc;
|
||||||
border-bottom: 1px solid #ccc;
|
border-bottom: 1px solid #ccc;
|
||||||
|
-webkit-border-top-left-radius: 6px;
|
||||||
|
-webkit-border-bottom-left-radius: 6px;
|
||||||
|
-moz-border-radius: 6px 0 0 6px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#sidebar h2 a img {
|
#sidebar h2 a img {
|
||||||
margin-bottom: 2px;
|
margin-bottom: 4px;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
#sidebar p {
|
#sidebar p {
|
||||||
@ -128,6 +136,8 @@ body > h1 {
|
|||||||
|
|
||||||
#sidebar ul li:hover ul {
|
#sidebar ul li:hover ul {
|
||||||
background-color: #EEE;
|
background-color: #EEE;
|
||||||
|
-webkit-border-radius: 0.5em;
|
||||||
|
-moz-border-radius: 0.5em;
|
||||||
border: 2px solid #BBB;
|
border: 2px solid #BBB;
|
||||||
color:#000;
|
color:#000;
|
||||||
display: block;
|
display: block;
|
||||||
@ -142,6 +152,7 @@ body > h1 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#sidebar img {
|
#sidebar img {
|
||||||
|
margin-top: 2px;
|
||||||
border: 0;
|
border: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -177,7 +188,12 @@ body > h1 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#sidebar input[name=q] {
|
#sidebar input[name=q] {
|
||||||
margin: 4px 0 0 24px;
|
padding-left: 0.5em;
|
||||||
|
border: 1px solid #ccd;
|
||||||
|
-webkit-border-radius: 0.8em;
|
||||||
|
-moz-border-radius: 0.8em;
|
||||||
|
width: 12.5em;
|
||||||
|
margin: 4px 0 0 24px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------------------- Footer --------------------------- */
|
/* ---------------------------- Footer --------------------------- */
|
||||||
@ -213,16 +229,20 @@ body > h1 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#body > h2 {
|
#body > h2 {
|
||||||
|
float: right;
|
||||||
|
min-width: 25%;
|
||||||
|
-webkit-border-top-left-radius: 0.5em;
|
||||||
|
-webkit-border-bottom-left-radius: 0.5em;
|
||||||
|
-moz-border-radius: 0.5em 0 0 0.5em;
|
||||||
text-transform: none;
|
text-transform: none;
|
||||||
font-size: medium;
|
font-size: medium;
|
||||||
color: #333;
|
color: #667;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
text-align: right;
|
text-align: center;
|
||||||
border-top: 1px solid #ccc;
|
border: 2px solid #ccd;
|
||||||
background-color: #eee;
|
background-color: #eee;
|
||||||
border-bottom: 1px solid #ccc;
|
padding: 1px 1.5em 1px 1.5em;
|
||||||
padding: 1px 15px 1px 5px;
|
margin: -0.2em -22px 0 0;
|
||||||
margin: 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------- News ---------------------------- */
|
/* ----------------------------- News ---------------------------- */
|
||||||
@ -473,7 +493,7 @@ ul.tags a:link, ul.tags a:visited {
|
|||||||
|
|
||||||
a[rel='tag'] img {
|
a[rel='tag'] img {
|
||||||
border: 0;
|
border: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* DiveIntoMark */
|
/* DiveIntoMark */
|
||||||
.framed {
|
.framed {
|
||||||
|
@ -161,6 +161,7 @@ function localizeDate(element) {
|
|||||||
if (!date.getTime()) return;
|
if (!date.getTime()) return;
|
||||||
|
|
||||||
var local = date.toLocaleString();
|
var local = date.toLocaleString();
|
||||||
|
if (element.parentNode.nodeName == 'a') local = date.toLocaleTimeString();
|
||||||
var match = local.match(localere);
|
var match = local.match(localere);
|
||||||
if (match) { /* Firefox */
|
if (match) { /* Firefox */
|
||||||
element.innerHTML = match[4] + ' ' + match[5].toLowerCase();
|
element.innerHTML = match[4] + ' ' + match[5].toLowerCase();
|
||||||
@ -169,7 +170,7 @@ function localizeDate(element) {
|
|||||||
return days[date.getDay()] + ', ' + months[date.getMonth()] + ' ' +
|
return days[date.getDay()] + ', ' + months[date.getMonth()] + ' ' +
|
||||||
date.getDate() + ', ' + date.getFullYear();
|
date.getDate() + ', ' + date.getFullYear();
|
||||||
} else {
|
} else {
|
||||||
local = local.replace(/GMT(-\d\d\d\d) \(.*\)$/, '$1'); /* Webkit */
|
local = local.replace(/ GMT(-\d\d\d\d) \(.*\)$/, ''); /* Webkit */
|
||||||
element.title = element.innerHTML + ' GMT';
|
element.title = element.innerHTML + ' GMT';
|
||||||
element.innerHTML = local;
|
element.innerHTML = local;
|
||||||
return days[date.getDay()] + ', ' + date.getDate() + ' ' +
|
return days[date.getDay()] + ', ' + date.getDate() + ' ' +
|
||||||
@ -241,6 +242,10 @@ function moveSidebar() {
|
|||||||
if (sidebar.currentStyle && sidebar.currentStyle['float'] == 'none') return;
|
if (sidebar.currentStyle && sidebar.currentStyle['float'] == 'none') return;
|
||||||
if (window.getComputedStyle && document.defaultView.getComputedStyle(sidebar,null).getPropertyValue('float') == 'none') return;
|
if (window.getComputedStyle && document.defaultView.getComputedStyle(sidebar,null).getPropertyValue('float') == 'none') return;
|
||||||
|
|
||||||
|
var h1 = sidebar.previousSibling;
|
||||||
|
while (h1.nodeType != 1) h1=h1.previousSibling;
|
||||||
|
if (h1.nodeName.toLowerCase() == 'h1') h1.parentNode.removeChild(h1);
|
||||||
|
|
||||||
var footer = document.getElementById('footer');
|
var footer = document.getElementById('footer');
|
||||||
var ul = footer.lastChild;
|
var ul = footer.lastChild;
|
||||||
while (ul.nodeType != 1) ul=ul.previousSibling;
|
while (ul.nodeType != 1) ul=ul.previousSibling;
|
||||||
@ -288,11 +293,4 @@ function personalize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// hook event
|
// hook event
|
||||||
window.onload = personalize;
|
document.addEventListener("DOMContentLoaded", personalize, false);
|
||||||
if (document.addEventListener) {
|
|
||||||
onDOMLoad = function() {
|
|
||||||
window.onload = undefined;
|
|
||||||
personalize();
|
|
||||||
};
|
|
||||||
document.addEventListener("DOMContentLoaded", onDOMLoad, false);
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user