Commit 6378ab54 authored by 神楽坂玲奈's avatar 神楽坂玲奈

修复附件rep播放地址

parent 06996158
......@@ -5,3 +5,58 @@
//= require jquery.markitup.set
//= require jquery.captcha
//= require jquery-ui
localStorage = {} if Storage?
localStorage['stream'] = {}
getstream = (data) ->
for key, value of data
for item in value
localStorage['stream'][key] ||= {}
localStorage['stream'][key][item.id] = item
for post in data.posts
post_element = $('<div />',
class: 'post'
id: "post" + post.id
)
post_element.append $('<img />',
src: '/users/' + post.user_id + '.png?size=small'
)
post_element.append $('<span />',
class: 'post[user]'
text: localStorage['stream']['users'][post.user_id].name
)
post_element.append $('<span />',
class: 'post[content]'
text: post.content
)
if $('#topic' + post.topic_id).length == 0
if $('#topics .topic').length >= 5
$('#topics .topic').last().remove()
$('#topics').prepend $('<div />',
id: 'topic' + post.topic_id
class: 'topic'
)
$('#topic' + post.topic_id).append $('<span />',
class: "topic[name]"
text: localStorage['stream']['topics'][post.topic_id].name
)
$('#topic' + post.topic_id).append $('<span />',
class: "topic[board]"
text: localStorage['stream']['boards'][localStorage['stream']['topics'][post.topic_id].category_id].name
href: '/boards/' + localStorage['stream']['topics'][post.topic_id].category_id
)
$('#topic' + post.topic_id).append post_element
else
post_element.addClass('last')
if $('#post' + post.id).length == 0
if $('#topic' + post.topic_id).length == 1
$('#topic' + post.topic_id + ' .post').addClass('first')
$('#topic' + post.topic_id).append post_element
else
$('#topic' + post.topic_id + ' .post').last().html post_element
else
$('#post' + post.id).html post_element
$.get('/stream.json?pull=2012-06-10 15:14:44 +0800', getstream)
......@@ -35,7 +35,7 @@ refresh_do = (rooms) ->
$('#users').append $('<a />',
class: 'user'
text: user.name
#href: '/users/' + user.id unless user.id == 0
href: '/users/' + user.id unless user.id == 0
)
if user = room.player2
room_html.append $('<a />',
......@@ -52,7 +52,7 @@ refresh_do = (rooms) ->
$('#users').append $('<a />',
class: "user"
text: user.name
#href: '/users/' + user.id unless user.id == 0
href: '/users/' + user.id unless user.id == 0
)
if room.status == 'wait'
room_html.append $('<a />',
......
......@@ -6,11 +6,11 @@
<% else %>
<% case File.extname attachment.data.original_filename %>
<% when ".yrp" %>
<span><%= link_to "播放", 'mycard://' + request.env['HTTP_HOST'] + URI.escape(URI.escape(attachment.data.url nil, timestamp: false )) %></span>
<span><%= link_to "播放", 'mycard://' + request.env['HTTP_HOST'] + URI.escape(attachment.data.url nil, timestamp: false ) %></span>
<% when ".ydk" %>
<span><%= link_to "编辑", 'mycard://' + request.env['HTTP_HOST'] + URI.escape(URI.escape(attachment.data.url nil, timestamp: false )) %></span>
<span><%= link_to "编辑", 'mycard://' + request.env['HTTP_HOST'] + URI.escape(attachment.data.url nil, timestamp: false ) %></span>
<% when ".deck" %>
<span><%= link_to "编辑", 'mycard://' + request.env['HTTP_HOST'] + URI.escape(URI.escape(attachment.data.url nil, timestamp: false )) %></span>
<span><%= link_to "编辑", 'mycard://' + request.env['HTTP_HOST'] + URI.escape(attachment.data.url nil, timestamp: false ) %></span>
<% end %>
<% end %>
</li>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment