]> git.mxchange.org Git - friendica.git/blob - view/theme/frost/js/main.js
- Remove TinyMCE mentions in themes
[friendica.git] / view / theme / frost / js / main.js
1
2         function openClose(listID) {
3 /*              if(document.getElementById(theID).style.display == "block") {
4                         document.getElementById(theID).style.display = "none"
5                 }
6                 else {
7                         document.getElementById(theID).style.display = "block"
8                 }*/
9                 listID = "#" + listID.replace(/:/g, "\\:");
10                 listID = listID.replace(/\./g, "\\.");
11                 listID = listID.replace(/@/g, "\\@");
12
13                 if($(listID).is(":visible")) {
14                         $(listID).hide();
15                         $(listID+"-wrapper").show();
16                 }
17                 else {
18                         $(listID).show();
19                         $(listID+"-wrapper").hide();
20                 }
21         }
22
23         function openMenu(theID) {
24                 document.getElementById(theID).style.display = "block"
25         }
26
27         function closeMenu(theID) {
28                 document.getElementById(theID).style.display = "none"
29         }
30
31
32
33         var src = null;
34         var prev = null;
35         var livetime = null;
36         var stopped = false;
37         var totStopped = false;
38         var timer = null;
39         var pr = 0;
40         var liking = 0;
41         var in_progress = false;
42         var langSelect = false;
43         var commentBusy = false;
44         var last_popup_menu = null;
45         var last_popup_button = null;
46
47         $(function() {
48                 $.ajaxSetup({cache: false});
49
50                 collapseHeight();
51
52                 /* setup tooltips *//*
53                 $("a,.tt").each(function(){
54                         var e = $(this);
55                         var pos="bottom";
56                         if (e.hasClass("tttop")) pos="top";
57                         if (e.hasClass("ttbottom")) pos="bottom";
58                         if (e.hasClass("ttleft")) pos="left";
59                         if (e.hasClass("ttright")) pos="right";
60                         e.tipTip({defaultPosition: pos, edgeOffset: 8});
61                 });*/
62
63
64
65                 /* setup onoff widgets */
66                 $(".onoff input").each(function(){
67                         val = $(this).val();
68                         id = $(this).attr("id");
69                         $("#"+id+"_onoff ."+ (val==0?"on":"off")).addClass("hidden");
70
71                 });
72                 $(".onoff > a").click(function(event){
73                         event.preventDefault();
74                         var input = $(this).siblings("input");
75                         var val = 1-input.val();
76                         var id = input.attr("id");
77                         $("#"+id+"_onoff ."+ (val==0?"on":"off")).addClass("hidden");
78                         $("#"+id+"_onoff ."+ (val==1?"on":"off")).removeClass("hidden");
79                         input.val(val);
80                         //console.log(id);
81                 });
82
83                 /* popup menus */
84                 function close_last_popup_menu(e) {
85
86                         if( last_popup_menu ) {
87                                 if( '#' + last_popup_menu.attr('id') !== $(e.target).attr('rel')) {
88                                         last_popup_menu.hide();
89                                         last_popup_button.removeClass("selected");
90                                         last_popup_menu = null;
91                                         last_popup_button = null;
92                                 }
93                         }
94                 }
95                 $('a[rel^=#]').click(function(e){
96
97                         close_last_popup_menu(e);
98                         menu = $( $(this).attr('rel') );
99                         e.preventDefault();
100                         e.stopPropagation();
101
102                         if (menu.attr('popup')=="false") return false;
103
104                         $(this).parent().toggleClass("selected");
105                         menu.slideToggle('fast');
106
107                         if (menu.css("display") == "none") {
108                                 last_popup_menu = null;
109                                 last_popup_button = null;
110                         } else {
111                                 last_popup_menu = menu;
112                                 last_popup_button = $(this).parent();
113                         }
114                         return false;
115                 });
116                 $('html').click(function(e) {
117                         close_last_popup_menu(e);
118                 });
119
120                 // fancyboxes
121                 $("a.popupbox").colorbox({
122                         'inline' : true,
123                         'transition' : 'elastic'
124                 });
125
126
127                 /* notifications template */
128                 var notifications_tpl= unescape($("#nav-notifications-template[rel=template]").html());
129                 var notifications_all = unescape($('<div>').append( $("#nav-notifications-see-all").clone() ).html()); //outerHtml hack
130                 var notifications_mark = unescape($('<div>').append( $("#nav-notifications-mark-all").clone() ).html()); //outerHtml hack
131                 var notifications_empty = unescape($("#nav-notifications-menu").html());
132
133                 /* nav update event  */
134                 $('nav').bind('nav-update', function(e,data){;
135                         var invalid = $(data).find('invalid').text();
136                         if(invalid == 1) { window.location.href=window.location.href }
137
138                         var net = $(data).find('net').text();
139                         if(net == 0) { net = ''; $('#net-update').removeClass('show') } else { $('#net-update').addClass('show') }
140                         $('#net-update').html(net);
141
142                         var home = $(data).find('home').text();
143                         if(home == 0) { home = '';  $('#home-update').removeClass('show') } else { $('#home-update').addClass('show') }
144                         $('#home-update').html(home);
145
146                         var intro = $(data).find('intro').text();
147                         if(intro == 0) { intro = '';  $('#intro-update').removeClass('show') } else { $('#intro-update').addClass('show') }
148                         $('#intro-update').html(intro);
149
150                         var mail = $(data).find('mail').text();
151                         if(mail == 0) { mail = '';  $('#mail-update').removeClass('show') } else { $('#mail-update').addClass('show') }
152                         $('#mail-update').html(mail);
153
154                         var intro = $(data).find('intro').text();
155                         if(intro == 0) { intro = '';  $('#intro-update-li').removeClass('show') } else { $('#intro-update-li').addClass('show') }
156                         $('#intro-update-li').html(intro);
157
158                         var mail = $(data).find('mail').text();
159                         if(mail == 0) { mail = '';  $('#mail-update-li').removeClass('show') } else { $('#mail-update-li').addClass('show') }
160                         $('#mail-update-li').html(mail);
161
162                         var eNotif = $(data).find('notif')
163
164                         if (eNotif.children("note").length==0){
165                                 $("#nav-notifications-menu").html(notifications_empty);
166                         } else {
167                                 nnm = $("#nav-notifications-menu");
168                                 nnm.html(notifications_all + notifications_mark);
169                                 //nnm.attr('popup','true');
170                                 eNotif.children("note").each(function(){
171                                         e = $(this);
172                                         text = e.text().format("<span class='contactname'>"+e.attr('name')+"</span>");
173                                         html = notifications_tpl.format(e.attr('href'),e.attr('photo'), text, e.attr('date'), e.attr('seen'));
174                                         nnm.append(html);
175                                 });
176
177                                 $("img[data-src]", nnm).each(function(i, el){
178                                         // Add src attribute for images with a data-src attribute
179                                         // However, don't bother if the data-src attribute is empty, because
180                                         // an empty "src" tag for an image will cause some browsers
181                                         // to prefetch the root page of the Friendica hub, which will
182                                         // unnecessarily load an entire profile/ or network/ page
183                                         if($(el).data("src") != '') $(el).attr('src', $(el).data("src"));
184                                 });
185                         }
186                         notif = eNotif.attr('count');
187                         if (notif>0){
188                                 $("#nav-notifications-linkmenu").addClass("on");
189                         } else {
190                                 $("#nav-notifications-linkmenu").removeClass("on");
191                         }
192                         if(notif == 0) { notif = ''; $('#notify-update').removeClass('show') } else { $('#notify-update').addClass('show') }
193                         $('#notify-update').html(notif);
194
195                         var eSysmsg = $(data).find('sysmsgs');
196                         eSysmsg.children("notice").each(function(){
197                                 text = $(this).text();
198                                 $.jGrowl(text, { sticky: false, theme: 'notice', life: 3000 }); // originally: sticky: true,
199                         });
200                         eSysmsg.children("info").each(function(){
201                                 text = $(this).text();
202                                 $.jGrowl(text, { sticky: false, theme: 'info', life: 1000 });
203                         });
204
205                 });
206
207
208                 NavUpdate();
209                 // Allow folks to stop the ajax page updates with the pause/break key
210                 $(document).keydown(function(event) {
211                         if(event.keyCode == '8') {
212                                 var target = event.target || event.srcElement;
213                                 if (!/input|textarea/i.test(target.nodeName)) {
214                                         return false;
215                                 }
216                         }
217                         if(event.keyCode == '19' || (event.ctrlKey && event.which == '32')) {
218                                 event.preventDefault();
219                                 if(stopped == false) {
220                                         stopped = true;
221                                         if (event.ctrlKey) {
222                                                 totStopped = true;
223                                         }
224                                         $('#pause').html('<img src="images/pause.gif" alt="pause" style="border: 1px solid black;" />');
225                                 } else {
226                                         unpause();
227                                 }
228                         } else {
229                                 if (!totStopped) {
230                                         unpause();
231                                 }
232                         }
233                 });
234
235
236         });
237
238         function NavUpdate() {
239
240                 if(! stopped) {
241                         var pingCmd = 'ping' + ((localUser != 0) ? '?f=&uid=' + localUser : '');
242                         $.get(pingCmd,function(data) {
243                                 $(data).find('result').each(function() {
244                                         // send nav-update event
245                                         $('nav').trigger('nav-update', this);
246
247
248                                         // start live update
249
250
251
252                                         if($('#live-network').length)   { src = 'network'; liveUpdate(); }
253                                         if($('#live-profile').length)   { src = 'profile'; liveUpdate(); }
254                                         if($('#live-community').length) { src = 'community'; liveUpdate(); }
255                                         if($('#live-notes').length)     { src = 'notes'; liveUpdate(); }
256                                         if($('#live-display').length) { src = 'display'; liveUpdate(); }
257                                         /*if($('#live-display').length) {
258                                                 if(liking) {
259                                                         liking = 0;
260                                                         window.location.href=window.location.href
261                                                 }
262                                         }*/
263                                         if($('#live-photos').length) {
264                                                 if(liking) {
265                                                         liking = 0;
266                                                         window.location.href=window.location.href
267                                                 }
268                                         }
269
270
271
272
273                                 });
274                         }) ;
275                 }
276                 timer = setTimeout(NavUpdate,updateInterval);
277         }
278
279         function liveUpdate() {
280                 if((src == null) || (stopped) || (typeof profile_uid == 'undefined') || (! profile_uid)) { $('.like-rotator').hide(); return; }
281                 if(($('.comment-edit-text-full').length) || (in_progress)) {
282                         if(livetime) {
283                                 clearTimeout(livetime);
284                         }
285                         livetime = setTimeout(liveUpdate, 5000);
286                         return;
287                 }
288                 if(livetime != null)
289                         livetime = null;
290
291                 prev = 'live-' + src;
292
293                 in_progress = true;
294                 var udargs = ((netargs.length) ? '/' + netargs : '');
295                 var update_url = 'update_' + src + udargs + '&p=' + profile_uid + '&page=' + profile_page;
296
297                 $.get(update_url,function(data) {
298                         in_progress = false;
299                         //                      $('.collapsed-comments',data).each(function() {
300                         //      var ident = $(this).attr('id');
301                         //      var is_hidden = $('#' + ident).is(':hidden');
302                         //      if($('#' + ident).length) {
303                         //              $('#' + ident).replaceWith($(this));
304                         //              if(is_hidden)
305                         //                      $('#' + ident).hide();
306                         //      }
307                         //});
308
309                         // add a new thread
310
311                         $('.toplevel_item',data).each(function() {
312                                 var ident = $(this).attr('id');
313
314                                 if($('#' + ident).length == 0 && profile_page == 1) {
315                                         $('img',this).each(function() {
316                                                 $(this).attr('src',$(this).attr('dst'));
317                                         });
318                                         $('#' + prev).after($(this));
319                                 }
320                                 else {
321                                         // Find out if the hidden comments are open, so we can keep it that way
322                                         // if a new comment has been posted
323                                         var id = $('.hide-comments-total', this).attr('id');
324                                         if(typeof id != 'undefined') {
325                                                 id = id.split('-')[3];
326                                                 var commentsOpen = $("#collapsed-comments-" + id).is(":visible");
327                                         }
328
329                                         $('img',this).each(function() {
330                                                 $(this).attr('src',$(this).attr('dst'));
331                                         });
332                                         //vScroll = $(document).scrollTop();
333                                         $('html').height($('html').height());
334                                         $('#' + ident).replaceWith($(this));
335
336                                         if(typeof id != 'undefined') {
337                                                 if(commentsOpen) showHideComments(id);
338                                         }
339                                         $('html').height('auto');
340                                         //$(document).scrollTop(vScroll);
341                                 }
342
343                                 // Add Colorbox for viewing Network page images
344                                 $("#" + ident + " .wall-item-body a img").each(function(){
345                                         var aElem = $(this).parent();
346                                         var imgHref = aElem.attr("href");
347
348                                         // We need to make sure we only put a Colorbox on links to Friendica images
349                                         // We'll try to do this by looking for links of the form
350                                         // .../photo/ab803d8eg08daf85023adfec08(-0.jpg) (with nothing more following), in hopes
351                                         // that that will be unique enough
352                                         if(imgHref.match(/\/photo\/[a-fA-F0-9]+(-[0-9]\.[\w]+?)?$/)) {
353
354                                                 // Add a unique class to all the images of a certain post, to allow scrolling through
355                                                 var cBoxClass = $(this).closest(".wall-item-body").attr("id") + "-lightbox";
356                                                 $(this).addClass(cBoxClass);
357
358                                                 aElem.colorbox({
359                                                         maxHeight: '90%',
360                                                         photo: true,
361                                                         rel: cBoxClass
362                                                 });
363                                         }
364                                 });
365
366                                 prev = ident;
367                         });
368
369                         // reset vars for inserting individual items
370
371                         /*prev = 'live-' + src;
372
373                         $('.wall-item-outside-wrapper',data).each(function() {
374                                 var ident = $(this).attr('id');
375
376                                 if($('#' + ident).length == 0 && prev != 'live-' + src) {
377                                                 $('img',this).each(function() {
378                                                         $(this).attr('src',$(this).attr('dst'));
379                                                 });
380                                                 $('#' + prev).after($(this));
381                                 }
382                                 else {
383                                         $('#' + ident + ' ' + '.wall-item-ago').replaceWith($(this).find('.wall-item-ago'));
384                                         if($('#' + ident + ' ' + '.comment-edit-text-empty').length)
385                                                 $('#' + ident + ' ' + '.wall-item-comment-wrapper').replaceWith($(this).find('.wall-item-comment-wrapper'));
386                                         $('#' + ident + ' ' + '.hide-comments-total').replaceWith($(this).find('.hide-comments-total'));
387                                         $('#' + ident + ' ' + '.wall-item-like').replaceWith($(this).find('.wall-item-like'));
388                                         $('#' + ident + ' ' + '.wall-item-dislike').replaceWith($(this).find('.wall-item-dislike'));
389                                         $('#' + ident + ' ' + '.my-comment-photo').each(function() {
390                                                 $(this).attr('src',$(this).attr('dst'));
391                                         });
392                                 }
393                                 prev = ident;
394                         });*/
395
396                         $('.like-rotator').hide();
397                         if(commentBusy) {
398                                 commentBusy = false;
399                                 $('body').css('cursor', 'auto');
400                         }
401                         /* autocomplete @nicknames */
402                         $(".comment-edit-form  textarea").editor_autocomplete(baseurl+"/acl");
403
404                         collapseHeight();
405
406                         // setup videos, since VideoJS won't take care of any loaded via AJAX
407                         if(typeof videojs != 'undefined') videojs.autoSetup();
408                 });
409         }
410
411         function collapseHeight(elems) {
412                 var elemName = '.wall-item-body:not(.divmore)';
413                 if(typeof elems != 'undefined') {
414                         elemName = elems + ' ' + elemName;
415                 }
416                 $(elemName).each(function() {
417                         if($(this).height() > 450) {
418                                 $('html').height($('html').height());
419                                 $(this).divgrow({ initialHeight: 400, showBrackets: false, speed: 0 });
420                                 $(this).addClass('divmore');
421                                 $('html').height('auto');
422                         }
423                 });
424         }
425
426         /*function imgbright(node) {
427                 $(node).removeClass("drophide").addClass("drop");
428         }
429
430         function imgdull(node) {
431                 $(node).removeClass("drop").addClass("drophide");
432         }*/
433
434         // Since our ajax calls are asynchronous, we will give a few
435         // seconds for the first ajax call (setting like/dislike), then
436         // run the updater to pick up any changes and display on the page.
437         // The updater will turn any rotators off when it's done.
438         // This function will have returned long before any of these
439         // events have completed and therefore there won't be any
440         // visible feedback that anything changed without all this
441         // trickery. This still could cause confusion if the "like" ajax call
442         // is delayed and NavUpdate runs before it completes.
443
444         function dolike(ident,verb) {
445                 unpause();
446                 $('#like-rotator-' + ident.toString()).show();
447                 $.get('like/' + ident.toString() + '?verb=' + verb, NavUpdate );
448                 liking = 1;
449         }
450
451         function dostar(ident) {
452                 ident = ident.toString();
453 //              $('#like-rotator-' + ident).show();
454                 $.get('starred/' + ident, function(data) {
455                         if(data.match(/1/)) {
456                                 $('#starred-' + ident).addClass('starred');
457                                 $('#starred-' + ident).removeClass('unstarred');
458                                 $('#star-' + ident).addClass('hidden');
459                                 $('#unstar-' + ident).removeClass('hidden');
460                         }
461                         else {
462                                 $('#starred-' + ident).addClass('unstarred');
463                                 $('#starred-' + ident).removeClass('starred');
464                                 $('#star-' + ident).removeClass('hidden');
465                                 $('#unstar-' + ident).addClass('hidden');
466                         }
467 //                      $('#like-rotator-' + ident).hide();
468                 });
469         }
470
471         function getPosition(e) {
472                 var cursor = {x:0, y:0};
473                 if ( e.pageX || e.pageY  ) {
474                         cursor.x = e.pageX;
475                         cursor.y = e.pageY;
476                 }
477                 else {
478                         if( e.clientX || e.clientY ) {
479                                 cursor.x = e.clientX + (document.documentElement.scrollLeft || document.body.scrollLeft) - document.documentElement.clientLeft;
480                                 cursor.y = e.clientY + (document.documentElement.scrollTop  || document.body.scrollTop)  - document.documentElement.clientTop;
481                         }
482                         else {
483                                 if( e.x || e.y ) {
484                                         cursor.x = e.x;
485                                         cursor.y = e.y;
486                                 }
487                         }
488                 }
489                 return cursor;
490         }
491
492         var lockvisible = false;
493
494         function lockview(event,id) {
495                 event = event || window.event;
496                 cursor = getPosition(event);
497                 if(lockvisible) {
498                         lockviewhide();
499                 }
500                 else {
501                         lockvisible = true;
502                         $.get('lockview/' + id, function(data) {
503                                 $('#panel').html(data);
504                                 $('#panel').css({ 'left': cursor.x + 5 , 'top': cursor.y + 5});
505                                 $('#panel').show();
506                         });
507                 }
508         }
509
510         function lockviewhide() {
511                 lockvisible = false;
512                 $('#panel').hide();
513         }
514
515         function post_comment(id) {
516                 unpause();
517                 commentBusy = true;
518                 $('body').css('cursor', 'wait');
519                 $("#comment-preview-inp-" + id).val("0");
520                 $.post(
521              "item",
522              $("#comment-edit-form-" + id).serialize(),
523                         function(data) {
524                                 if(data.success) {
525                                         $("#comment-edit-wrapper-" + id).hide();
526                                         $("#comment-edit-text-" + id).val('');
527                                 var tarea = document.getElementById("comment-edit-text-" + id);
528                                         if(tarea)
529                                                 commentClose(tarea,id);
530                                         if(timer) clearTimeout(timer);
531                                         timer = setTimeout(NavUpdate,10);
532                                 }
533                                 if(data.reload) {
534                                         window.location.href=data.reload;
535                                 }
536                         },
537                         "json"
538          );
539          return false;
540         }
541
542
543         function preview_comment(id) {
544                 $("#comment-preview-inp-" + id).val("1");
545                 $("#comment-edit-preview-" + id).show();
546                 $.post(
547              "item",
548              $("#comment-edit-form-" + id).serialize(),
549                         function(data) {
550                                 if(data.preview) {
551
552                                         $("#comment-edit-preview-" + id).html(data.preview);
553                                         $("#comment-edit-preview-" + id + " a").click(function() { return false; });
554                                 }
555                         },
556                         "json"
557          );
558          return true;
559         }
560
561
562         function showHideComments(id) {
563                 if( $("#collapsed-comments-" + id).is(":visible")) {
564                         $("#collapsed-comments-" + id).hide();
565                         $("#hide-comments-" + id).html(window.showMore);
566                 }
567                 else {
568                         $("#collapsed-comments-" + id).show();
569                         $("#hide-comments-" + id).html(window.showFewer);
570                         collapseHeight("#collapsed-comments-" + id);
571                 }
572         }
573
574
575         function preview_post() {
576                 $("#jot-preview").val("1");
577                 $("#jot-preview-content").show();
578                 $.post(
579                         "item",
580                         $("#profile-jot-form").serialize(),
581                         function(data) {
582                                 if(data.preview) {
583                                         $("#jot-preview-content").html(data.preview);
584                                         $("#jot-preview-content" + " a").click(function() { return false; });
585                                 }
586                         },
587                         "json"
588                 );
589                 $("#jot-preview").val("0");
590                 return true;
591         }
592
593
594         function unpause() {
595                 // unpause auto reloads if they are currently stopped
596                 totStopped = false;
597                 stopped = false;
598             $('#pause').html('');
599         }
600                 
601
602     function bin2hex(s){  
603         // Converts the binary representation of data to hex    
604         //   
605         // version: 812.316  
606         // discuss at: http://phpjs.org/functions/bin2hex  
607         // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)  
608         // +   bugfixed by: Onno Marsman  
609         // +   bugfixed by: Linuxworld  
610         // *     example 1: bin2hex('Kev');  
611         // *     returns 1: '4b6576'  
612         // *     example 2: bin2hex(String.fromCharCode(0x00));  
613         // *     returns 2: '00'  
614         var v,i, f = 0, a = [];  
615         s += '';  
616         f = s.length;  
617           
618         for (i = 0; i<f; i++) {  
619             a[i] = s.charCodeAt(i).toString(16).replace(/^([\da-f])$/,"0$1");  
620         }  
621           
622         return a.join('');  
623     }  
624
625         function groupChangeMember(gid, cid, sec_token) {
626                 $('body .fakelink').css('cursor', 'wait');
627                 $.get('group/' + gid + '/' + cid + "?t=" + sec_token, function(data) {
628                                 $('#group-update-wrapper').html(data);
629                                 $('body .fakelink').css('cursor', 'auto');
630                 });
631         }
632
633         function profChangeMember(gid,cid) {
634                 $('body .fakelink').css('cursor', 'wait');
635                 $.get('profperm/' + gid + '/' + cid, function(data) {
636                                 $('#prof-update-wrapper').html(data);
637                                 $('body .fakelink').css('cursor', 'auto');
638                 });
639         }
640
641         function contactgroupChangeMember(gid,cid) {
642                 $('body').css('cursor', 'wait');
643                 $.get('contactgroup/' + gid + '/' + cid, function(data) {
644                                 $('body').css('cursor', 'auto');
645                 });
646         }
647
648
649 function checkboxhighlight(box) {
650   if($(box).is(':checked')) {
651         $(box).addClass('checkeditem');
652   }
653   else {
654         $(box).removeClass('checkeditem');
655   }
656 }
657
658 function notifyMarkAll() {
659         $.get('notify/mark/all', function(data) {
660                 if(timer) clearTimeout(timer);
661                 timer = setTimeout(NavUpdate,1000);
662         });
663 }
664
665 /**
666  * sprintf in javascript
667  *      "{0} and {1}".format('zero','uno');
668  **/
669 String.prototype.format = function() {
670     var formatted = this;
671     for (var i = 0; i < arguments.length; i++) {
672         var regexp = new RegExp('\\{'+i+'\\}', 'gi');
673         formatted = formatted.replace(regexp, arguments[i]);
674     }
675     return formatted;
676 };
677 // Array Remove
678 Array.prototype.remove = function(item) {
679   to=undefined; from=this.indexOf(item);
680   var rest = this.slice((to || from) + 1 || this.length);
681   this.length = from < 0 ? this.length + from : from;
682   return this.push.apply(this, rest);
683 };
684
685 function previewTheme(elm) {
686         theme = $(elm).val();
687         $.getJSON('pretheme?f=&theme=' + theme,function(data) {
688                         $('#theme-preview').html('<div id="theme-desc">' + data.desc + '</div><div id="theme-version">' + data.version + '</div><div id="theme-credits">' + data.credits + '</div><a href="' + data.img + '"><img src="' + data.img + '" width="320" height="240" alt="' + theme + '" /></a>');
689         });
690
691 }