1 |
/*---------------------------------------- |
2 |
$Id: feed.js,v 1.8 2006/02/08 19:19:44 migurski Exp $ |
3 |
vim: ts=4 foldcolumn=4 foldmethod=marker |
4 |
|
5 |
This file is part of Reblog: http://reblog.org |
6 |
A derivative work of Feed On Feeds: http://feedonfeeds.com |
7 |
|
8 |
Distributed under the Gnu Public License, see LICENSE |
9 |
|
10 |
Copyright ©2004 Michael Frumin, Michal Migurski |
11 |
mike@stamen.com, http://stamen.com |
12 |
mfrumin@eyebeam.org, http://eyebeam.org |
13 |
|
14 |
feed.js - Refeed.Feed represents a single feed row |
15 |
----------------------------------------*/ |
16 |
|
17 |
// namespace |
18 |
if(window.refeed == null) { window.refeed = {}; } |
19 |
if(Refeed == null) { var Refeed = window.refeed; } |
20 |
|
21 |
Refeed.Feed = function(id, node, link) |
22 |
{ |
23 |
this.id = id; |
24 |
this.setNode(node); |
25 |
this.link = link; |
26 |
|
27 |
var feed = this; |
28 |
Refeed.App.replaceEventHandler(function(e) { return feed.onClick(e); }, this.getNode(), 'onClick'); |
29 |
} |
30 |
|
31 |
Refeed.Feed.prototype = new Refeed.ListItem(); |
32 |
|
33 |
Refeed.Feed.prototype.keycodeHandlers = {}; |
34 |
|
35 |
Refeed.Feed.prototype.update = function() |
36 |
{ |
37 |
var script = Refeed.App.updateHREF; |
38 |
location.href = script+'?return='+escape(location.href)+'&feed='+this.id; |
39 |
return false; |
40 |
} |
41 |
|
42 |
Refeed.Feed.prototype.archive = function() |
43 |
{ |
44 |
archive_feed(this.id); |
45 |
return false; |
46 |
} |
47 |
|
48 |
Refeed.Feed.prototype.toggleRead = function(read, onResult, onError) |
49 |
{ |
50 |
if(read) { |
51 |
Refeed.ServerComm.remoteCall('markFeedRead', [this.toClassHint()], onResult, onError); |
52 |
|
53 |
} else { |
54 |
Refeed.ServerComm.remoteCall('markFeedUnread', [this.toClassHint()], onResult, onError); |
55 |
|
56 |
} |
57 |
} |
58 |
|
59 |
Refeed.Feed.prototype.togglePublished = function(publish, onResult, onError) |
60 |
{ |
61 |
if(publish) { |
62 |
Refeed.ServerComm.remoteCall('markFeedPublished', [this.toClassHint()], onResult, onError); |
63 |
|
64 |
} else { |
65 |
Refeed.ServerComm.remoteCall('markFeedUnpublished', [this.toClassHint()], onResult, onError); |
66 |
|
67 |
} |
68 |
} |
69 |
|
70 |
Refeed.Feed.prototype.setFeedTags = function(tags, onResult, onError) |
71 |
{ |
72 |
Refeed.ServerComm.remoteCall('setFeedTags', [this.toClassHint(), tags], onResult, onError); |
73 |
} |
74 |
|
75 |
Refeed.Feed.prototype.serverClassName = function() |
76 |
{ |
77 |
return 'RF_Feed'; |
78 |
} |