summaryrefslogtreecommitdiff
path: root/utils/notifier/options.html
blob: 99ae0787d605ef132c354d8fd957c96c35ff2f45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
<html>
<head>
<title>Tiny Tiny RSS Notifier Options</title>
<link rel="stylesheet" href="style.css" type="text/css"/>
<script type="text/javascript" src="lib/prototype.js"></script>
<script type="text/javascript" src="lib/scriptaculous/scriptaculous.js?load=effects,dragdrop,controls"></script>

<script type="text/javascript">
function save() {

	var s = $("status");

	s.innerHTML = "Options saved successfully.";

	var f = document.forms['options'];

	if (f.site_url.value.length > 0) 
		localStorage['site_url'] = f.site_url.value;
	else {
		s.innerHTML = "Error: Site url cannot be blank.";
		new Effect.Highlight(f.site_url);
	}

	if (f.login.value.length > 0) 
		localStorage['login'] = f.login.value;
	else {
		s.innerHTML = "Error: Login cannot be blank.";
		new Effect.Highlight(f.login);
	}

	var update_interval = parseInt(f.update_interval.value);

	if (update_interval > 0) 
		localStorage['update_interval'] = f.update_interval.value;
	else {
		s.innerHTML = "Error: Update interval must be greater than zero.";
		new Effect.Highlight(f.update_interval);
	}

	var d = new Date();

	localStorage["prefs_updated"] = d.getTime();

	Element.show(s);
		
	return false;
}

function init() {
	var f = document.forms['options'];

	if (localStorage['site_url'])	
		f.site_url.value = localStorage['site_url'];
	else 
		f.site_url.value = "http://example.dom/tt-rss/";

	if (localStorage['login'])
		f.login.value = localStorage['login'];
	else
		f.login.value = "user";

	if (localStorage['update_interval'])
		f.update_interval.value = localStorage['update_interval'];
	else
		f.update_interval.value = '15';

	var last_updated = $('last_updated');

	var d = new Date();

	d.setTime(localStorage["last_updated"]);


	last_updated.innerHTML = d;	
}
</script>

<style type="text/css">
fieldset {
	border : 0px;
	margin : 0px;
	clear : left;
	line-height : 25px;
}

div#status {
	font-size : 14px;
	color : #88b0ff;
}

label {
	width : 250px;
	display : block;
	float : left;
	text-align : right;
	padding-right : 1em;
}

p.last-updated {
	color : gray;
}
</style>

<body onload="init()">
	<div class="floatingLogo"><img src="images/ttrss_logo.png"></div>

	<h1>Tiny Tiny RSS Notifier</h1>

	<p class='last-updated'>Last update: <span id="last_updated">N/A</span></p>

	<div style='display : none' id="status"></div>

	<h2>Options</h2>

	<form name="options" id="options" onsubmit="return save()">
		<fieldset>
			<label>URL of your Tiny Tiny RSS installation:</label>
			<input name="site_url" size="60" value=""/>
		</fieldset>

		<fieldset>
			<label>Login:</label>
			<input name="login" size="30" value=""/>
		</fieldset>

		<fieldset>
			<label>Update interval (in minutes):</label>
			<input name="update_interval" size="30" value=""/>
		</fieldset>

		<input type="submit" value="Save"/>
	</form>

	<p>Copyright &copy; 2010 <a target="_blank" href="http://tt-rss.org">Andrew Dolgov</a></p>

</body>