How to write X-notifier scripts.

Forums:

To make your own script, you should be able to handle javascript and regular expressions. When the login form of your webmail provider is like this,
<form action="https://logins.foo.com/login" method="post">
  <input name="user">
  <input name="passwd" type="password">
  <input name="key" value="abc=12" type="hidden">
  <input value="Login" type="submit">
</form>

the corresponding script is as below. Save below codes as 'mymail.js'(or other name that ends with '.js') And install it in X-notifier preferences.

var name="MyMail";
var ver="2010-06-08";
function init(){
  this.dataURL="http://welcome.foo.com";
  this.loginData=["https://logins.foo.com/login",
                      "user","passwd","key="+encodeURIComponent("abc=12")];
  this.viewURL="http://mail.foo.com";
}
function getCount(aData){ //aData is a html source in dataURL
  var fnd=aData.match(......); //find mail count
  if(fnd){
    var num;
    //get mail count here
    return num;
  }else{
    return -1;//display 'not checked' message
  }
}
  • name : the provider name that wiil be shown in X-notifier
  • dataURL : the url where you can get mail count
  • loginData : [ formSubmitURL, usernameField, passwordField, additionalData ]
    • formSubmitURL : action url of the login form
    • usernameField : input field name of username
    • passwordField : input field name of password
    • additionalData : other input fields data
  • viewURL : the url that will be opened when you click the icon or menuitem

This is the simplest form of script. If your script does not work, please refer to other scripts from here. http://xnotifier.tobwithu.com/scripts.php