<?xml version="1.0" encoding="UTF-8"?>
<Module>
  <ModulePrefs title="Bloglines Notifier" height="20" description="Shows the number of unread or saved items in your Bloglines account" author="Ben Reichelt"  render_inline="optional"/> 
  <UserPref name="login" display_name="Login" default_value="user@example.com"/>
  <UserPref name="activetextcolor" display_name="Active Color" default_value="green"/>
  <UserPref name="lazytextcolor" display_name="Inactive Color" default_value="black"/>
  <Content type="html"> 
       <![CDATA[
          <table width=100%>
	    <tr>
              <td id="__MODULE_ID__col" width="*%" style="color:white">
		<a href="http://bloglines.com/myblogs" target="_blank" id="__MODULE_ID__link">
		  <span id="__MODULE_ID__num">Checking...</span>
		</a>
	      </td>
	    </tr>
	  </table>

          <script language="javascript">
           
            function displayBloglinesNotification__MODULE_ID__(prefs) {
                var login = prefs.getString("login");
		var url = "http://rpc.bloglines.com/update?user=" + login + "&ver=1&r=" + new Date().getTime();
		_IG_FetchContent(url, function (responseText) {
                    var num = responseText.split('|')[1];
                    if (num > 0) {
					  _gel('__MODULE_ID__num').innerHTML = "You have "+num+" unread items";
                      _gel('__MODULE_ID__link').style.color = prefs.getString("activetextcolor");
                    } else {
					  _gel('__MODULE_ID__num').innerHTML = "No new items to read";
                      _gel('__MODULE_ID__link').style.color = prefs.getString("lazytextcolor");
                    }
                });
            }
           
            displayBloglinesNotification__MODULE_ID__(new _IG_Prefs(__MODULE_ID__));
          </script>
      ]]> 
  </Content>
</Module>
