2007-02-13 10:25:05 +01:00
|
|
|
/*
|
|
|
|
* Based on Simon Willison's blockquotes.js
|
|
|
|
* http://simon.incutio.com/archive/2002/12/20/#blockquoteCitations
|
|
|
|
*/
|
|
|
|
function extractBlockquoteCitations() {
|
|
|
|
var quotes = document.getElementsByTagName('blockquote');
|
|
|
|
for (i = 0; i < quotes.length; i++) {
|
|
|
|
var cite = quotes[i].getAttribute('cite');
|
|
|
|
if (cite && cite != '') {
|
|
|
|
var newlink = document.createElement('a');
|
|
|
|
newlink.setAttribute('href', cite);
|
|
|
|
newlink.setAttribute('title', cite);
|
|
|
|
newlink.appendChild(document.createTextNode('#'));
|
|
|
|
var newspan = document.createElement('span');
|
|
|
|
newspan.setAttribute('class','blockquotesource');
|
|
|
|
newspan.appendChild(newlink);
|
|
|
|
quotes[i].lastChild.previousSibling.appendChild(newspan);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2008-10-17 23:26:17 +02:00
|
|
|
|
|
|
|
function fixRunIn() {
|
|
|
|
// work around lack of gecko support for display:run-in
|
|
|
|
var re = /^num_|\s+num_|^un_|\s+un_|proof/;
|
|
|
|
$$('div > h6').each(function(element) {
|
|
|
|
if(re.test($(element.parentNode).className)) {
|
|
|
|
var new_span = new Element('span').update(element.textContent);
|
|
|
|
new_span.addClassName('theorem_label');
|
|
|
|
var next_el = element.next().firstChild;
|
|
|
|
next_el.parentNode.insertBefore(new_span, next_el);
|
|
|
|
var period = new Element('span').update('. ');
|
|
|
|
next_el.parentNode.insertBefore(period, next_el);
|
|
|
|
element.remove();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
// add tombstone to proof, since gecko doesn't support :last-child properly
|
|
|
|
$$('div.proof').each(function(element) {
|
|
|
|
var l = element.childElements().length -1;
|
|
|
|
var span = new Element('span').update('\u00a0\u00a0\u25ae');
|
|
|
|
element.childElements()[l].insert(span);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2009-11-06 21:32:45 +01:00
|
|
|
function mactionWorkarounds() {
|
|
|
|
$$('maction[actiontype="tooltip"]').each( function(mtool){
|
2009-11-08 09:27:38 +01:00
|
|
|
Element.writeAttribute(mtool, 'title',
|
|
|
|
Element.firstDescendant(mtool).nextSibling.firstChild.data);
|
|
|
|
});
|
2009-11-06 21:32:45 +01:00
|
|
|
$$('maction[actiontype="statusline"]').each( function(mstatus){
|
2009-11-08 09:27:38 +01:00
|
|
|
var v = Element.firstDescendant(mstatus).nextSibling.firstChild.data;
|
|
|
|
Event.observe(mstatus, 'mouseover', function(){window.status = v;});
|
|
|
|
Event.observe(mstatus, 'mouseout', function(){window.status = '';});
|
2009-11-06 21:32:45 +01:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2007-02-13 10:25:05 +01:00
|
|
|
window.onload = function (){
|
|
|
|
extractBlockquoteCitations();
|
2008-10-17 23:26:17 +02:00
|
|
|
fixRunIn();
|
2009-11-06 21:32:45 +01:00
|
|
|
mactionWorkarounds();
|
2007-02-13 10:25:05 +01:00
|
|
|
};
|