117 function searchCallback(target, container_selector, url, timeout) { |
117 function searchCallback(target, container_selector, url, timeout) { |
118 |
118 |
119 timeout = typeof(timeout) != 'undefined' ? timeout : 0; |
119 timeout = typeof(timeout) != 'undefined' ? timeout : 0; |
120 var target = $(target); |
120 var target = $(target); |
121 |
121 |
|
122 // remove all qtip |
|
123 $(".qtip").remove(); |
|
124 |
122 if(target.realVal().length > 0) { |
125 if(target.realVal().length > 0) { |
123 target.nextAll(".searchclear").show(); |
126 target.nextAll(".searchclear").show(); |
124 } |
127 } |
125 |
128 |
126 if(target.attr('timer')) { |
129 if(target.attr('timer')) { |
195 }); |
198 }); |
196 |
199 |
197 |
200 |
198 } |
201 } |
199 |
202 |
|
203 function init_events_base_projects(base_node, embed_url, searchprojectfilterurl, publishprojecturl, unpublishprojecturl) { |
|
204 |
|
205 $('.publishedproject', base_node).click(function(e) { |
|
206 e.preventDefault(); |
|
207 var target = $(e.target); |
|
208 var project_id = target.attr('id').replace('project_',''); |
|
209 var url = unpublishprojecturl.replace('__PROJECT_ID__', project_id); |
|
210 $.ajax({ |
|
211 url: url, |
|
212 type: 'POST', |
|
213 dataType: 'json', |
|
214 success: function(json, textStatus, XMLHttpRequest){ |
|
215 if(json.res) { |
|
216 searchCallback($('#searchprojectsinput'), "#projectslistcontainer", searchprojectfilterurl, 0); |
|
217 } |
|
218 } |
|
219 }); |
|
220 }); |
|
221 |
|
222 $('.unpublishedproject', base_node).click(function(e) { |
|
223 e.preventDefault(); |
|
224 var target = $(e.target); |
|
225 var project_id = target.attr('id').replace('project_',''); |
|
226 var url = publishprojecturl.replace('__PROJECT_ID__', project_id); |
|
227 $.ajax({ |
|
228 url: url, |
|
229 type: 'POST', |
|
230 dataType: 'json', |
|
231 success: function(json, textStatus, XMLHttpRequest){ |
|
232 if(json.res) { |
|
233 searchCallback($('#searchprojectsinput'), "#projectslistcontainer", searchprojectfilterurl, 0); |
|
234 } |
|
235 } |
|
236 }); |
|
237 }); |
|
238 |
|
239 } |
|
240 |
|
241 function init_events_projects(base_node, embed_url, searchprojectfilterurl, publishprojecturl, unpublishprojecturl) { |
|
242 |
|
243 init_events_base(base_node, embed_url); |
|
244 init_events_base_projects(base_node, embed_url, searchprojectfilterurl, publishprojecturl, unpublishprojecturl); |
|
245 } |
|
246 |
|
247 function init_events_all(base_node, embed_url, searchcontentfilterurl, searchprojectfilterurl, publishprojecturl, unpublishprojecturl) { |
|
248 |
|
249 init_events_contents(base_node, embed_url, searchcontentfilterurl); |
|
250 init_events_base_projects(base_node, embed_url, searchprojectfilterurl, publishprojecturl, unpublishprojecturl); |
|
251 } |
|
252 |
200 |
253 |
201 |
254 |
202 function searchFieldInit(input_list_init) { |
255 function searchFieldInit(input_list_init) { |
203 |
256 |
204 $(".searchfieldinputbase").keydown(function (e) { |
257 $(".searchfieldinputbase").keydown(function (e) { |