|
0
|
1 |
$.fn.realVal = function() { |
|
|
2 |
var obj = $(this[0]); |
|
|
3 |
if(obj.val) { |
|
|
4 |
if(obj.val() == obj.attr('defaultText')) { |
|
|
5 |
return ''; |
|
|
6 |
} |
|
|
7 |
else { |
|
|
8 |
return obj.val(); |
|
|
9 |
} |
|
|
10 |
} |
|
|
11 |
else { |
|
|
12 |
return null; |
|
|
13 |
} |
|
|
14 |
}; |
|
|
15 |
|
|
24
|
16 |
|
|
0
|
17 |
function init_events_base(base_node, embed_url) { |
|
24
|
18 |
|
|
|
19 |
$('.ldt_link',base_node).each(function(i){ |
|
|
20 |
$(this).attr("target","_iri"); |
|
|
21 |
}); |
|
0
|
22 |
$('.ldt_link',base_node).nyroModal({ |
|
24
|
23 |
filters: ['iriIFrame'], |
|
|
24 |
sizes: { |
|
|
25 |
minW: '1022', |
|
|
26 |
minH: '662' |
|
|
27 |
}, |
|
|
28 |
showCloseButton: true, |
|
|
29 |
callbacks: { |
|
|
30 |
afterShowCont: function(nm) { |
|
|
31 |
nm.store.iframe.height(662); |
|
|
32 |
nm.store.iframe.width(1022); |
|
|
33 |
} |
|
|
34 |
} |
|
|
35 |
}); |
|
0
|
36 |
|
|
|
37 |
|
|
|
38 |
$('.ldt_link_embed',base_node).click(function(e) { |
|
|
39 |
e.preventDefault(); |
|
|
40 |
var link = $(e.target); |
|
|
41 |
var json_url = link.attr("href"); |
|
|
42 |
var player_id = link.attr("id"); |
|
|
43 |
var ldt_id = player_id.substring(15); |
|
24
|
44 |
$('<a />', { |
|
|
45 |
href: embed_url+'?json_url='+escape(json_url)+'&player_id='+escape(player_id)+'&ldt_id='+escape(ldt_id), |
|
|
46 |
target: "_blank" |
|
|
47 |
}).nyroModal({ |
|
|
48 |
filters: ['iframe'], |
|
|
49 |
sizes: { |
|
|
50 |
minW: '750', |
|
|
51 |
minH: '662' |
|
|
52 |
}, |
|
|
53 |
callbacks: { |
|
|
54 |
afterShowCont: function(nm) { |
|
|
55 |
nm.store.iframe.height(662); |
|
|
56 |
nm.store.iframe.width(750); |
|
|
57 |
} |
|
|
58 |
} |
|
|
59 |
}).trigger('nyroModal'); |
|
|
60 |
return false; |
|
0
|
61 |
}); |
|
|
62 |
|
|
|
63 |
|
|
|
64 |
$('.imageline',base_node).each(function(i) { |
|
|
65 |
var tr = $(this); |
|
|
66 |
tr.mouseover(function() { |
|
|
67 |
$('.cellimgdiv',this).css('visibility', 'visible'); |
|
|
68 |
}); |
|
|
69 |
tr.mouseout(function() { |
|
|
70 |
$('.cellimgdiv',this).css('visibility', 'hidden'); |
|
|
71 |
}); |
|
|
72 |
}); |
|
|
73 |
|
|
|
74 |
$('.cellimgdiv img').qtip({ |
|
|
75 |
style: { |
|
|
76 |
'name': 'dark', |
|
|
77 |
'filter':'alpha(opacity=70)', |
|
|
78 |
'-moz-opacity':'0.7', |
|
|
79 |
'-khtml-opacity': '0.7', |
|
|
80 |
'opacity': '0.7', |
|
|
81 |
'border': { |
|
|
82 |
'width' : '0', |
|
|
83 |
'color': '#505050' |
|
|
84 |
}, |
|
|
85 |
'tip': true |
|
|
86 |
} |
|
|
87 |
}); |
|
|
88 |
|
|
|
89 |
|
|
|
90 |
}; |
|
|
91 |
|
|
|
92 |
|
|
|
93 |
function searchCallback(target, container_selector, url, timeout) { |
|
|
94 |
|
|
|
95 |
timeout = typeof(timeout) != 'undefined' ? timeout : 0; |
|
|
96 |
var target = $(target); |
|
|
97 |
|
|
|
98 |
// remove all qtip |
|
|
99 |
$(".qtip").remove(); |
|
|
100 |
|
|
|
101 |
if(target.realVal().length > 0) { |
|
|
102 |
target.nextAll(".searchclear").show(); |
|
|
103 |
} |
|
|
104 |
|
|
|
105 |
if(target.attr('timer')) { |
|
|
106 |
clearTimeout(target.attr('timer')); |
|
|
107 |
} |
|
|
108 |
|
|
|
109 |
target.attr( |
|
|
110 |
'timer', |
|
|
111 |
setTimeout(function() { |
|
|
112 |
target.next(".searchajaxloader").show(); |
|
|
113 |
target.nextAll(".searchclear").hide(); |
|
|
114 |
var filterVal = "_" + escape(target.realVal()); |
|
|
115 |
url = url.replace('__FILTER__',filterVal); |
|
|
116 |
$.ajax({ |
|
|
117 |
url: url, |
|
|
118 |
cache: false, |
|
|
119 |
success: function(data, status, request) { |
|
|
120 |
$(container_selector).html(data); |
|
|
121 |
target.next(".searchajaxloader").hide(); |
|
|
122 |
if(target.realVal().length > 0) { |
|
|
123 |
target.nextAll(".searchclear").show(); |
|
|
124 |
} |
|
|
125 |
init_events($(container_selector)); |
|
|
126 |
target.removeAttr('timer'); |
|
|
127 |
} |
|
|
128 |
}); |
|
|
129 |
}, |
|
|
130 |
300) |
|
|
131 |
); |
|
|
132 |
}; |
|
|
133 |
|
|
|
134 |
|
|
|
135 |
function init_events_contents(base_node, embed_url, content_filter_url) { |
|
|
136 |
|
|
|
137 |
init_events_base(base_node, embed_url); |
|
|
138 |
|
|
24
|
139 |
$('.content_link_create').each(function(i){ |
|
|
140 |
$(this).attr("target","_blank"); |
|
0
|
141 |
}); |
|
24
|
142 |
$('.content_link_create').nyroModal({ |
|
|
143 |
filters: ['iframe'], |
|
|
144 |
sizes: { |
|
|
145 |
minW: 770, |
|
|
146 |
minH: 500 |
|
0
|
147 |
}, |
|
24
|
148 |
callbacks: { |
|
|
149 |
afterClose: function(nm) { |
|
|
150 |
searchCallback($('#searchprojectsinput'), "#contentslistcontainer", content_filter_url); |
|
|
151 |
}, |
|
|
152 |
afterShowCont: function(nm) { |
|
|
153 |
nm.store.iframe.width(770); |
|
|
154 |
nm.store.iframe.height(500); |
|
|
155 |
nm.store.iframe.load(function() { |
|
|
156 |
var form_status = $(this).contents().find("#content_form_status").val(); |
|
|
157 |
if(form_status == 'saved' || form_status == 'deleted' ) { |
|
|
158 |
$.nmTop().close(); |
|
|
159 |
} |
|
|
160 |
}); |
|
|
161 |
} |
|
0
|
162 |
} |
|
|
163 |
}); |
|
|
164 |
|
|
24
|
165 |
$('.contenttitlelink').each(function(i){ |
|
|
166 |
$(this).attr("target","_blank"); |
|
|
167 |
}); |
|
|
168 |
$('.contenttitlelink').nyroModal({ |
|
|
169 |
filters: ['iframe'], |
|
|
170 |
sizes: { |
|
|
171 |
minW: 770, |
|
|
172 |
minH: 500 |
|
|
173 |
}, |
|
|
174 |
callbacks: { |
|
|
175 |
afterClose: function(nm) { |
|
|
176 |
searchCallback($("#searchcontentsinput"),"#contentslistcontainer",content_filter_url,0); |
|
|
177 |
}, |
|
|
178 |
afterShowCont: function(nm) { |
|
|
179 |
nm.store.iframe.width(770); |
|
|
180 |
nm.store.iframe.height(500); |
|
|
181 |
nm.store.iframe.load(function() { |
|
|
182 |
var form_status = $(this).contents().find("#content_form_status").val(); |
|
|
183 |
if(form_status == 'saved' || form_status == 'deleted') { |
|
|
184 |
$.nmTop().close(); |
|
|
185 |
} |
|
|
186 |
}); |
|
|
187 |
} |
|
|
188 |
} |
|
|
189 |
}); |
|
0
|
190 |
} |
|
|
191 |
|
|
|
192 |
function init_events_base_projects(base_node, embed_url, searchprojectfilterurl, publishprojecturl, unpublishprojecturl) { |
|
|
193 |
|
|
24
|
194 |
$('.ldt_link_create',base_node).each(function(i){ |
|
|
195 |
$(this).attr("target","_iri"); |
|
|
196 |
}); |
|
0
|
197 |
$('.ldt_link_create',base_node).nyroModal({ |
|
24
|
198 |
|
|
|
199 |
filters: ['iriIframe'], |
|
|
200 |
sizes: { |
|
|
201 |
minW: '600', |
|
|
202 |
minH: '500' |
|
0
|
203 |
}, |
|
24
|
204 |
callbacks: { |
|
|
205 |
afterShowCont: function(nm) { |
|
|
206 |
nm.store.iframe.width(600); |
|
|
207 |
nm.store.iframe.height(500); |
|
|
208 |
var iframe = nm.store.iframe; |
|
|
209 |
iframe.load(function(){ |
|
|
210 |
var form_status = $(this).contents().find("#project_form_status").val(); |
|
|
211 |
if(form_status == 'saved' || form_status == 'deleted' ) { |
|
|
212 |
$.nmTop().close(); |
|
|
213 |
} |
|
|
214 |
var swfobject = $(this).contents().find("#ldtInitSwf"); |
|
|
215 |
if (swfobject.length) { |
|
|
216 |
nm['sizes']['initW'] = swfobject.width() + 21; |
|
|
217 |
nm['sizes']['initH'] = swfobject.height() + 31; |
|
|
218 |
nm.resize(); |
|
|
219 |
nm.store.iframe.height(swfobject.height() + 31); |
|
|
220 |
nm.store.iframe.width(swfobject.width() + 21); |
|
|
221 |
} |
|
|
222 |
}); |
|
|
223 |
}, |
|
|
224 |
afterClose: function(nm) { |
|
|
225 |
searchCallback($('#searchprojectsinput'), "#projectslistcontainer", searchprojectfilterurl, 0); |
|
|
226 |
} |
|
|
227 |
} |
|
|
228 |
|
|
|
229 |
}); |
|
0
|
230 |
|
|
|
231 |
|
|
|
232 |
$('.publishedproject', base_node).click(function(e) { |
|
|
233 |
e.preventDefault(); |
|
|
234 |
var target = $(e.target); |
|
|
235 |
var project_id = target.attr('id').replace('project_',''); |
|
|
236 |
var url = unpublishprojecturl.replace('__PROJECT_ID__', project_id); |
|
|
237 |
$.ajax({ |
|
|
238 |
url: url, |
|
|
239 |
type: 'POST', |
|
|
240 |
dataType: 'json', |
|
|
241 |
success: function(json, textStatus, XMLHttpRequest){ |
|
|
242 |
if(json.res) { |
|
|
243 |
searchCallback($('#searchprojectsinput'), "#projectslistcontainer", searchprojectfilterurl, 0); |
|
|
244 |
} |
|
|
245 |
} |
|
|
246 |
}); |
|
|
247 |
}); |
|
|
248 |
|
|
|
249 |
$('.unpublishedproject', base_node).click(function(e) { |
|
|
250 |
e.preventDefault(); |
|
|
251 |
var target = $(e.target); |
|
|
252 |
var project_id = target.attr('id').replace('project_',''); |
|
|
253 |
var url = publishprojecturl.replace('__PROJECT_ID__', project_id); |
|
|
254 |
$.ajax({ |
|
|
255 |
url: url, |
|
|
256 |
type: 'POST', |
|
|
257 |
dataType: 'json', |
|
|
258 |
success: function(json, textStatus, XMLHttpRequest){ |
|
|
259 |
if(json.res) { |
|
|
260 |
searchCallback($('#searchprojectsinput'), "#projectslistcontainer", searchprojectfilterurl, 0); |
|
|
261 |
} |
|
|
262 |
} |
|
|
263 |
}); |
|
|
264 |
}); |
|
|
265 |
|
|
24
|
266 |
$('.projecttitlelink').each(function(i){ |
|
|
267 |
$(this).attr("target","_blank"); |
|
|
268 |
}); |
|
0
|
269 |
$('.projecttitlelink').nyroModal({ |
|
24
|
270 |
filters: ['iframe'], |
|
|
271 |
sizes: { |
|
|
272 |
minH:680, |
|
|
273 |
minW:500 |
|
0
|
274 |
}, |
|
24
|
275 |
callbacks: { |
|
|
276 |
afterClose: function(nm) { |
|
|
277 |
searchCallback($('#searchprojectsinput'), "#projectslistcontainer", searchprojectfilterurl, 0); |
|
|
278 |
}, |
|
|
279 |
afterShowCont: function(nm) { |
|
|
280 |
nm.store.iframe.height(680); |
|
|
281 |
nm.store.iframe.width(600); |
|
|
282 |
var iframe = nm.store.iframe; |
|
|
283 |
iframe.load(function(){ |
|
|
284 |
var form_status = $(this).contents().find("#project_form_status").val(); |
|
|
285 |
if(form_status == 'saved' || form_status == 'deleted') { |
|
|
286 |
$.nmTop().close(); |
|
|
287 |
} |
|
|
288 |
}); |
|
|
289 |
} |
|
0
|
290 |
} |
|
|
291 |
}); |
|
|
292 |
|
|
|
293 |
} |
|
|
294 |
|
|
|
295 |
function init_events_projects(base_node, embed_url, searchprojectfilterurl, publishprojecturl, unpublishprojecturl) { |
|
|
296 |
|
|
|
297 |
init_events_base(base_node, embed_url); |
|
|
298 |
init_events_base_projects(base_node, embed_url, searchprojectfilterurl, publishprojecturl, unpublishprojecturl); |
|
|
299 |
} |
|
|
300 |
|
|
|
301 |
function init_events_all(base_node, embed_url, searchcontentfilterurl, searchprojectfilterurl, publishprojecturl, unpublishprojecturl) { |
|
|
302 |
|
|
|
303 |
init_events_contents(base_node, embed_url, searchcontentfilterurl); |
|
|
304 |
init_events_base_projects(base_node, embed_url, searchprojectfilterurl, publishprojecturl, unpublishprojecturl); |
|
|
305 |
} |
|
|
306 |
|
|
|
307 |
|
|
|
308 |
|
|
|
309 |
function searchFieldInit(input_list_init) { |
|
|
310 |
|
|
|
311 |
$(".searchfieldinputbase").keydown(function (e) { |
|
|
312 |
if(e.which == 27) { |
|
|
313 |
$(e.target).blur(); |
|
|
314 |
$(e.target).next(".searchajaxloader").hide(); |
|
|
315 |
} |
|
|
316 |
}); |
|
|
317 |
|
|
|
318 |
$('.searchfieldinput').each(function(i) { |
|
|
319 |
var sbox = $(this); |
|
|
320 |
if(sbox.val() != '') { |
|
|
321 |
sbox.attr('defaultText', sbox.val()); |
|
|
322 |
} |
|
|
323 |
|
|
|
324 |
sbox.focus(function() { |
|
|
325 |
box = $(this); |
|
|
326 |
if(box.val() == box.attr('defaultText')) { |
|
|
327 |
box.val(''); |
|
|
328 |
box.toggleClass("searchfieldinput"); |
|
|
329 |
} |
|
|
330 |
}); |
|
|
331 |
|
|
|
332 |
sbox.blur(function() { |
|
|
333 |
var box = $(this); |
|
|
334 |
if(box.val() == '' && box.attr('defaultText')) { |
|
|
335 |
box.val(box.attr('defaultText')); |
|
|
336 |
box.toggleClass("searchfieldinput"); |
|
|
337 |
} |
|
|
338 |
}); |
|
|
339 |
|
|
|
340 |
}); |
|
|
341 |
|
|
|
342 |
$.each(input_list_init, function(index, value) { |
|
|
343 |
$(value['input_selector']).keyup(function (e) { |
|
|
344 |
searchCallback(e.target, value['container_selector'], value['url']); |
|
|
345 |
}); |
|
|
346 |
}); |
|
|
347 |
|
|
|
348 |
$('.searchclear').click(function(e) { |
|
|
349 |
var box = $(e.target).parent().find("input"); |
|
|
350 |
box.val(box.attr('defaultText')); |
|
|
351 |
box.addClass("searchfieldinput"); |
|
|
352 |
box.blur(); |
|
|
353 |
box.keyup(); |
|
|
354 |
}); |
|
|
355 |
|
|
|
356 |
$('.searchclear').each(function(i) { |
|
|
357 |
$(this).hide(); |
|
|
358 |
}); |
|
|
359 |
|
|
|
360 |
} |