Для Maxthon 2 есть фильтр, каторый хотелось бы сделать в виде Javascript.
Перепробывал многое методом тыка. Ничего не получилось... Может кто поможет...
<m2filter version="1.0">
<package author="Artyom Shegeda" description="Highlights users online" title="RU-Board Whos Online" support_url="http://forum.ru-board.com/" version="0.0.4"/>
<filterlist>
<filter enable="1" name="whos online ajax" author="Artyom Shegeda" type="text" comment="" action="3" priority="0" match="<\/head>" match_count="1" replace="<script type="text/javascript">
this.whosonline = ({
autoHighlight: false,
url: '/whosonline.cgi',
load: function() {
if (this.xmlHttp)
return;
try
{
this.xmlHttp=new XMLHttpRequest()
if (this.xmlHttp.overrideMimeType && this.method=='POST') this.xmlHttp.overrideMimeType('text/html')
}
catch (e)
{
var msv=["Msxml2.XMLHTTP.7.0", "Msxml2.XMLHTTP.6.0", "Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"]
for(var j=0;j<=msv.length;j++)
{
try
{
this.xmlHttp=new ActiveXObject(msv[j])
break
}
catch(e){ }
}
if (!this.xmlHttp) return false
}
var self = this
this.xmlHttp.onreadystatechange=function()
{
if(self.xmlHttp.readyState==4)
{
self.processResponse(self.xmlHttp.responseText)
self.xmlHttp = null;
}
}
this.xmlHttp.open("GET",this.url+'?timestamp='+Math.floor(new Date().valueOf()/60000),true);
this.xmlHttp.send(null);
},
processResponse: function(text) {
var users = {};
text.replace(/<a href="profile\\.cgi\\?action=show&member=.*?">(.*?)<\\/a>/g, function(a,b){
users[b]=true;
});
this.users = users;
this.autoHighlight && this.highlightUsers();
},
highlightUsers: function() {
if (!this.users) {
this.autoHighlight = true;
if (!this.xmlHttp) {
this.load();
}
return;
}
try {
var elements = document.getElementsByTagName('B');
for(var i=0; i<elements.length; i++) {
if (elements[i].parentNode.className=='m' && this.users[elements[i].innerText]) {
var onlinestatus = document.createElement('div');
onlinestatus.style.display='inline';
onlinestatus.style.width='10px';
onlinestatus.style.height='10px';
onlinestatus.style.lineHeight='10px';
onlinestatus.style.background='#80FF80';
onlinestatus.style.borderTop='1px solid #c0ffc0';
onlinestatus.style.borderLeft='1px solid #c0ffc0';
onlinestatus.style.borderRight='1px solid #60bf60';
onlinestatus.style.borderBottom='1px solid #60bf60';
onlinestatus.style.marginRight='5px';
onlinestatus.title='User online';
elements[i].parentNode.insertBefore(onlinestatus,elements[i]);
}
}
} catch(e) {
alert(e.message);
}
},
createHighlightButton: function() {
var node = document.forms['postform'].parentNode;
var button = document.createElement('button');
button.innerText = 'Показать, кто онлайн';
button.style.margin = '10px 0 0 40px'
var self = this;
button.onclick = function(){
if (!self.users) {
self.autoHighlight = true;
self.load();
}
}
node.parentNode.insertBefore(button, node);
},
run: function() {
return this;
}
}).run();
</script>
</head>" match_url="^http\:\/\/forum\.ru-board\.com\/topic\.cgi" exclude_url="" bound="" max_bound_size="0" exclude="" keywords=""/><filter name="auto highlight" author="Artyom Shegeda" type="text" comment="" action="3" priority="0" match="(<body\s)" match_count="1" replace="<script type="text/javascript">
whosonline&&(whosonline.load(),window.onload=function(){whosonline.highlightUsers();});
</script>
$1" match_url="^http\:\/\/forum\.ru-board\.com\/topic\.cgi" exclude_url="" bound="" max_bound_size="0" exclude="" keywords="" enable="1"/><filter name="whos online button" author="Artyom Shegeda" type="text" comment="" action="3" priority="0" match="<\/body>" match_count="1" replace="</body><script type="text/javascript">
whosonline&&whosonline.createHighlightButton();
</script>" match_url="^http\:\/\/forum\.ru-board\.com\/topic\.cgi" exclude_url="" bound="" max_bound_size="0" exclude="" keywords="" enable="1"/></filterlist>
</m2filter>