comparison src/sync.coffee @ 24:08d9679da0f7

s/wrotes/writes/
author Mathias Gebbe <mgebbe@intevation.de>
date Thu, 19 Jun 2014 13:01:11 +0200
parents 6b3f38af3fa4
children 34cfa565f565
comparison
equal deleted inserted replaced
23:8c56fdbac0fb 24:08d9679da0f7
62 62
63 postParser = (post, user, network, callback) -> 63 postParser = (post, user, network, callback) ->
64 parsed = "" 64 parsed = ""
65 #console.log "\n" + post.id + "\n" + user.id + user.displayName 65 #console.log "\n" + post.id + "\n" + user.id + user.displayName
66 #PROFILE_LINK PROFILE_NAME PROFILE_PIC_LINK_80x80=$3 POST_LINK POST_TIME CONTENT 66 #PROFILE_LINK PROFILE_NAME PROFILE_PIC_LINK_80x80=$3 POST_LINK POST_TIME CONTENT
67 #text='<img src='$PROFILE_PIC_LINK_80x80'></img> <a href='$PROFILE_LINK'>'$PROFILE_NAME'</a> <a href='$POST_LINK'>wrotes</a> at '$POST_TIME':<br><br>'$CONTENT'' 67 #text='<img src='$PROFILE_PIC_LINK_80x80'></img> <a href='$PROFILE_LINK'>'$PROFILE_NAME'</a> <a href='$POST_LINK'>writes</a> at '$POST_TIME':<br><br>'$CONTENT''
68 68
69 if network is 'facebook' 69 if network is 'facebook'
70 if user? and user.profilePicLink? 70 if user? and user.profilePicLink?
71 profilePicLink = user.profilePicLink.replace("50x50", "80x80") 71 profilePicLink = user.profilePicLink.replace("50x50", "80x80")
72 else 72 else
73 profilePicLink = 'http://upload.wikimedia.org/wikipedia/commons/thumb/c/c2/F_icon.svg/80px-F_icon.svg.png' 73 profilePicLink = 'http://upload.wikimedia.org/wikipedia/commons/thumb/c/c2/F_icon.svg/80px-F_icon.svg.png'
74 74
75 if post.type is 'status' 75 if post.type is 'status'
76 parsed = "<img src='" + profilePicLink + "'></img> <a href='" + user.profileLink + "'>" + user.displayName + "</a> <a href='https://www.facebook.com/" + post.id + "'> wrotes</a> via " + network + " at " + post.updated_time + ":<br><br>" + post.message 76 parsed = "<img src='" + profilePicLink + "'></img> <a href='" + user.profileLink + "'>" + user.displayName + "</a> <a href='https://www.facebook.com/" + post.id + "'> writes</a> via " + network + " at " + post.updated_time + ":<br><br>" + post.message
77 77
78 if post.type is 'photo' 78 if post.type is 'photo'
79 parsed = "<img src='" + profilePicLink + "'></img> <a href='" + user.profileLink + "'>" + user.displayName + "</a> <a href='"+ post.link + "'> wrotes</a> via " + network + " at " + post.updated_time + ":<br>" 79 parsed = "<img src='" + profilePicLink + "'></img> <a href='" + user.profileLink + "'>" + user.displayName + "</a> <a href='"+ post.link + "'> writes</a> via " + network + " at " + post.updated_time + ":<br>"
80 parsed += "<br>" + post.message if post.message? and post.message isnt "" 80 parsed += "<br>" + post.message if post.message? and post.message isnt ""
81 parsed += "<br><img src='" + post.picture + "'></img>" 81 parsed += "<br><img src='" + post.picture + "'></img>"
82 82
83 if post.type is 'link' or post.type is 'video' 83 if post.type is 'link' or post.type is 'video'
84 parsed = "<img src='" + profilePicLink + "'></img> <a href='" + user.profileLink + "'>" + user.displayName + "</a> <a href='https://www.facebook.com/" + post.id + "'> wrotes</a> via " + network + " at " + post.updated_time + ":<br>" 84 parsed = "<img src='" + profilePicLink + "'></img> <a href='" + user.profileLink + "'>" + user.displayName + "</a> <a href='https://www.facebook.com/" + post.id + "'> writes</a> via " + network + " at " + post.updated_time + ":<br>"
85 parsed += "<br>" + post.message if post.message? and post.message isnt "" 85 parsed += "<br>" + post.message if post.message? and post.message isnt ""
86 parsed += "<br>" + post.description if post.description? 86 parsed += "<br>" + post.description if post.description?
87 parsed += "<br><a href='" + post.link + "'>"+ post.link + "</a>" if post.link? 87 parsed += "<br><a href='" + post.link + "'>"+ post.link + "</a>" if post.link?
88 parsed += "<br><img src='" + post.picture + "'></img>" if post.picture? 88 parsed += "<br><img src='" + post.picture + "'></img>" if post.picture?
89 89
90 callback null, parsed 90 callback null, parsed
91 91
92 if network is 'google' 92 if network is 'google'
93 parsed = "<img src='" + post.actor.image.url + "'></img> <a href='" + post.actor.url + "'>" + post.actor.displayName + "</a> <a href='"+ post.object.url + "'> wrotes</a> via " + network + " at " + post.updated + ":<br><br>" + post.object.content 93 parsed = "<img src='" + post.actor.image.url + "'></img> <a href='" + post.actor.url + "'>" + post.actor.displayName + "</a> <a href='"+ post.object.url + "'> writes</a> via " + network + " at " + post.updated + ":<br><br>" + post.object.content
94 if not post.object.attachments? 94 if not post.object.attachments?
95 _.each post.object.attachments, (attachment) -> 95 _.each post.object.attachments, (attachment) ->
96 96
97 if attachment.objectType == "photo" 97 if attachment.objectType == "photo"
98 parsed += "<br><img src='" + attachment.image.url + "'></img>" 98 parsed += "<br><img src='" + attachment.image.url + "'></img>"
109 109
110 callback null, parsed 110 callback null, parsed
111 111
112 if network is 'twitter' 112 if network is 'twitter'
113 113
114 parsed = "<img src='" + post.user.profile_image_url + "'></img> <a href='https://twitter.com/account/redirect_by_id/" + post.user.id + "'>" + post.user.name + "</a> <a href='https://twitter.com/" + post.user.screen_name + "/status/" + post.id_str + "'> wrotes </a> via " + network + " at " + post.created_at + ":<br><br>" + post.text 114 parsed = "<img src='" + post.user.profile_image_url + "'></img> <a href='https://twitter.com/account/redirect_by_id/" + post.user.id + "'>" + post.user.name + "</a> <a href='https://twitter.com/" + post.user.screen_name + "/status/" + post.id_str + "'> writes </a> via " + network + " at " + post.created_at + ":<br><br>" + post.text
115 _.each post.entities.media, (attachment) -> 115 _.each post.entities.media, (attachment) ->
116 parsed += "<br><img src='" + attachment.media_url + "'></img>" 116 parsed += "<br><img src='" + attachment.media_url + "'></img>"
117 callback null, parsed 117 callback null, parsed
118 118
119 return 119 return
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)