##// END OF EJS Templates
Load reflink previews of posts that are not present on the current page
neko259 -
r354:34225dd7 default
parent child Browse files
Show More
@@ -55,8 +55,6 b' function showPostPreview(e) {'
55 55
56 56 cln.innerHTML = 'Загрузка...';
57 57
58 var found = false;
59
60 58 //если пост найден в дереве.
61 59 if($('div[id='+pNum+']').length > 0) {
62 60 var postdata = $('div[id='+pNum+']').html();
@@ -66,34 +64,29 b' function showPostPreview(e) {'
66 64
67 65 //make preview
68 66 mkPreview(cln, postdata);
69
70 found = true;
71 67 }
72 68 //ajax api
73 // else {
74 // $.getJSON(mayuri_cfg['board_url']+'api/single/'+pNum)
75 // .success(function(data) {
76 // //post templates
77 // var postdata = makeAjaxPost(data).html();
78 //
79 // //TODO: временно
80 // //funcInit(postdata);
81 //
82 // //make preview
83 // mkPreview(cln, postdata);
84 //
85 // })//if error
86 // .error(function() {
87 // cln.innerHTML = 'Пост не найден.';
88 // });
89 // }
69 else {
70 $.ajax({
71 url: '/api/post/' + pNum
72 })
73 .success(function(data) {
74 // TODO get a json, not post itself
75 var postdata = $(data).html();
76
77 //make preview
78 mkPreview(cln, postdata);
79
80 })
81 .error(function() {
82 cln.innerHTML = 'Пост не найден.';
83 });
84 }
90 85
91 86 $del(doc.getElementById(cln.id));
92 87
93 if (found) {
94 //add preview
95 $('body').append(cln);
96 }
88 //add preview
89 $('body').append(cln);
97 90 }
98 91
99 92 function delPostPreview(e) {
@@ -52,5 +52,5 b" urlpatterns = patterns('',"
52 52 url(r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict),
53 53
54 54 # API
55 url(r'^get_post/(?P<post_id>\w+)/$', views.get_post, name="get_post"),
55 url(r'^api/post/(?P<post_id>\w+)/$', views.get_post, name="get_post"),
56 56 )
General Comments 0
You need to be logged in to leave comments. Login now