I was having trouble viewing the AA Bar in Safari because I did not want to set my default font to Mona. I wrote a little Javascript that adjusted the CSS of the page to use the Mona font and display properly. Take a look at it:
javascript:
var main_doc = parent.frames["main"].document;
for(i=0;i<main_doc.styleSheets.length;i++){
for(j=0;j<main_doc.styleSheets[i].cssRules.length;j++){
if(main_doc.styleSheets[i].cssRules[j].selectorText.match(/\.replytext/){
main_doc.styleSheets[i].cssRules[j].style.setProperty('font-family','Mona',null);
}}}
In Safari, copy the script to a single line and past it into the URL bar. It will change the font of all elements in the class "replytext" to Mona. Note that Monafont must be installed to do this.
Can anyone think of a cleaner, more robust way of doing this?
I don't have Mona, so I can't test it, but what's wrong with just defining a stylesheet like:
.replytext{font-family:Mona;}
saving it somewhere, then telling Safari to use it in the Advanced section of the preferences?
Sure, that is the easy way to do it.
Here is another method I came up with. Run this script, and the next html element clicked on will switched to the mona font.
function display(e){
e.target.style.fontFamily = 'Mona';
var doc_array = parent.frames;
if(doc_array.length <= 1)
doc_array = new Array(window);
for(i=0;i<doc_array.length;i++)
{
doc_array[i].document.releaseEvents(Event.MOUSEUP);
doc_array[i].document.onmouseup = null
}
}
var doc_array = parent.frames;
if(doc_array.length <= 1)
doc_array = new Array(window);
for(i=0;i<doc_array.length;i++){
doc_array[i].document.captureEvents(Event.MOUSEUP);
doc_array[i].document.onmouseup = display;
}
It works by assigning a onmouseup event to the window that changes the target element's fontFamily. After the event happens, the onmouseup event is removed. The only tricky bit is determining where to put the event hander if there are frames being used. Each frame is treated as a different window and needs its own hander assigned. The script works just about everywhere. The exception being on 2ch where the frames are directed at different domains. When a script attempts to run across a different domain then the main window a security error is generated. The workaround is to open the content frame in a new window.
Holy stealth thread, Batman!