PageSourceSearch

https://dnipromarathon.com/wp-content/plugins/photo-gallery/js/bwg_embed_ver-1.4.17.js

js dnipromarathon.com collected 2026-10-08 07:58:17 UTC 12,486 bytes, 373 lines download raw bytes

1/*server side analogue is function display_embed in WDWLibraryEmbed*/
2/*params
3  embed_type: string , one of predefined accepted types
4  embed_id: string, id of media in corresponding host, or url if no unique id system is defined for host
5  attrs: object with html attributes and values format e.g. {width:'100px', style:"display:inline;"}
6*/
7
8function spider_display_embed(embed_type, file_url, embed_id, attrs) {
9  var html_to_insert = '';
10  switch(embed_type) {
11    case 'EMBED_OEMBED_YOUTUBE_VIDEO':
12      var oembed_youtube_html ='<iframe ';
13      if(embed_id!=''){
14        oembed_youtube_html += ' src="' + 'https://www.youtube.com/embed/'+ embed_id + '?enablejsapi=1&wmode=transparent"';
15      }
16      for (attr in attrs) {
17        if(!(/src/i).test(attr)){
18          if(attr != '' && attrs[attr] != ''){
19            oembed_youtube_html += ' '+ attr + '="'+ attrs[attr] + '"';
20          }
21        }
22      }
23      oembed_youtube_html += " ></iframe>";
24      html_to_insert += oembed_youtube_html;
25            
26      break;
27    case 'EMBED_OEMBED_VIMEO_VIDEO':
28      var oembed_vimeo_html ='<iframe ';
29      if(embed_id!=''){
30        oembed_vimeo_html += ' src="' + 'https://player.vimeo.com/video/'+embed_id + '?enablejsapi=1"';
31      }
32      for (attr in attrs) {
33        if(!(/src/i).test(attr)){
34          if(attr != '' && attrs[attr] != ''){
35            oembed_vimeo_html += ' '+ attr + '="'+ attrs[attr] + '"';
36          }
37        }
38      }
39      oembed_vimeo_html += " ></iframe>";
40      html_to_insert += oembed_vimeo_html;
41            
42      break;
43    case 'EMBED_OEMBED_FLICKR_IMAGE':
44        var oembed_flickr_html ='<div ';     
45        for (attr in attrs) {
46        if(!(/src/i).test(attr)){
47          if(attr != '' && attrs[attr] != ''){
48            oembed_flickr_html += ' '+ attr + '="'+ attrs[attr] + '"';
49          }
50        }
51      }
52        oembed_flickr_html += " >";
53        if(embed_id!=''){
54        
55        oembed_flickr_html += '<img src="'+embed_id+'"'+ 
56        ' style="'+
57        'max-width:'+'100%'+" !important"+
58        '; max-height:'+'100%'+" !important"+
59        '; width:'+'auto !important'+
60        '; height:'+ 'auto !important' + 
61        ';">';
62        }
63
64        oembed_flickr_html +="</div>";
65
66        html_to_insert += oembed_flickr_html;
67        break;
68      case 'EMBED_OEMBED_FLICKR_VIDEO':
69        /* code...*/
70        break;
71
72    case 'EMBED_OEMBED_INSTAGRAM_VIDEO':
73      var oembed_instagram_html ='<div ';     
74        for (attr in attrs) {
75        if(!(/src/i).test(attr)){
76          if(attr != '' && attrs[attr] != ''){
77            oembed_instagram_html += ' '+ attr + '="'+ attrs[attr] + '"';
78          }
79        }
80      }
81      oembed_instagram_html += " >";
82        if(embed_id!=''){
83
84        /*oembed_instagram_html += '<iframe src="'+embed_id+'"'+ 
85        ' style="'+
86        'max-width:'+'100%'+" !important"+
87        '; max-height:'+'100%'+" !important"+
88        '; width:'+'auto'+
89        '; height:'+ '100%' + " "+
90        '; margin:0;"'+
91        'frameborder="0" scrolling="no" allowtransparency="false"></iframe>';
92        */
93        oembed_instagram_html += '<video style="width:auto !important; height:auto !important; max-width:100% !important; max-height:100% !important; margin:0 !important;" controls>'+
94        '<source src="'+embed_id+
95        '" type="video/mp4"> Your browser does not support the video tag. </video>';
96
97        }
98        
99        
100        oembed_instagram_html +="</div>";
101
102        html_to_insert += oembed_instagram_html;
103
104        break;
105
106    case 'EMBED_OEMBED_INSTAGRAM_IMAGE':
107      var oembed_instagram_html ='<div ';     
108        for (attr in attrs) {
109        if(!(/src/i).test(attr)){
110          if(attr != '' && attrs[attr] != ''){
111            oembed_instagram_html += ' '+ attr + '="'+ attrs[attr] + '"';
112          }
113        }
114      }
115      oembed_instagram_html += " >";
116        if(embed_id!=''){
117
118        oembed_instagram_html += '<img src="https://instagram.com/p/'+embed_id+'/media/?size=l"'+ 
119        ' style=" '+
120        'max-width:'+'100%'+" !important"+
121        '; max-height:'+'100%'+" !important"+
122        '; width:'+'auto'+
123        '; height:'+ 'auto' +
124        ';">';
125        }
126        oembed_instagram_html +="</div>";
127
128        html_to_insert += oembed_instagram_html;
129
130        break;
131    case 'EMBED_OEMBED_INSTAGRAM_POST':
132      var oembed_instagram_html ='<div '; 
133      var id = '';
134        for (attr in attrs) {
135        if(!(/src/i).test(attr)){
136          if(attr != '' && attrs[attr] != ''){
137            oembed_instagram_html += ' '+ attr + '="'+ attrs[attr] + '"';
138            if(attr == 'CLASS' || attr =='class' || attr =='Class'){
139              obj_class = attrs[attr];
140            }
141          }
142        }
143      }
144      oembed_instagram_html += " >";
145        if(embed_id!=''){
146        oembed_instagram_html += '<iframe class="inner_instagram_iframe_'+obj_class+'" src="https://instagr.am/p/'+embed_id+'/embed/?enablejsapi=1"'+ 
147        ' style="'+
148        'max-width:'+'100%'+" !important"+
149        '; max-height:'+'100%'+" !important"+
150        '; width:'+'100%'+
151        '; height:'+ '100%' + 
152        '; margin:0'+
153        '; display:table-cell; vertical-align:middle;"'+
154        'frameborder="0" scrolling="no" allowtransparency="false" allowfullscreen'+
155        '></iframe>';
156        }
157
158        oembed_instagram_html +="</div>";
159        html_to_insert += oembed_instagram_html;
160    break;       
161	case 'EMBED_OEMBED_FACEBOOK_IMAGE':
162      var oembed_facebook_html ='<span ';	
163        for (attr in attrs) {
164          if(!(/src/i).test(attr)){
165            if(attr != '' && attrs[attr] != ''){
166              oembed_facebook_html += ' '+ attr + '="'+ attrs[attr] + '"';
167            }
168          }
169        }
170      oembed_facebook_html += " >";
171      if(embed_id!=''){
172        oembed_facebook_html += '<img src="'+file_url+'"'+ 
173        ' style=" '+
174        'max-width:'+'100%'+" !important"+
175        '; max-height:'+'100%'+" !important"+
176        '; width:'+'auto'+
177        '; height:'+ '100%' +
178        ';">';
179      }
180      oembed_facebook_html +="</span>";
181      html_to_insert += oembed_facebook_html;
182    break; 	
183	case 'EMBED_OEMBED_FACEBOOK_VIDEO': 
184      var oembed_facebook_video_html ='<div ';     
185        for (attr in attrs) {
186          if(!(/src/i).test(attr)){
187            if(attr != '' && attrs[attr] != ''){
188              oembed_facebook_video_html += ' '+ attr + '="'+ attrs[attr] + '"';
189            }
190          }
191        }
192      oembed_facebook_video_html += " >";
193      if(embed_id!=''){
194        oembed_facebook_video_html += '<iframe src="https://www.facebook.com/video/embed?video_id='+file_url+'&enablejsapi=1&wmode=transparent"' +
195        ' style="'+
196        'max-width:'+'100%'+" !important"+
197        '; max-height:'+'100%'+" !important"+
198        '; width:'+'100%'+
199        '; height:'+ '100%' + 
200        '; margin:0'+
201        '; display:table-cell; vertical-align:middle;"'+
202        'frameborder="0" class="bwg_fb_video" scrolling="no" allowtransparency="false" allowfullscreen'+
203        '></iframe>';
204      }
205      oembed_facebook_video_html +="</div>";
206      html_to_insert += oembed_facebook_video_html;
207    break;  
208    case 'EMBED_OEMBED_DAILYMOTION_VIDEO':
209      var oembed_dailymotion_html ='<iframe ';
210      if(embed_id!=''){
211        oembed_dailymotion_html += ' src="' + 'https://www.dailymotion.com/embed/video/'+embed_id + '?api=postMessage"';
212      }
213      for (attr in attrs) {
214        if(!(/src/i).test(attr)){
215          if(attr != '' && attrs[attr] != ''){
216            oembed_dailymotion_html += ' '+ attr + '="'+ attrs[attr] + '"';
217          }
218        }
219      }
220      oembed_dailymotion_html += " ></iframe>";
221      html_to_insert += oembed_dailymotion_html;
222            
223      break;
224    case 'EMBED_OEMBED_IMGUR':
225    /*not working yet*/
226      var oembed_imgur_html ='<div ';     
227        for (attr in attrs) {
228        if(!(/src/i).test(attr)){
229          if(attr != '' && attrs[attr] != ''){
230            oembed_instagram_html += ' '+ attr + '="'+ attrs[attr] + '"';
231          }
232        }
233      }
234      oembed_imgur_html += " >";
235        if(embed_id!=''){
236
237        oembed_imgur_html += '<img src="'+embed_id+'"'+ 
238        ' style="'+
239        'max-width:'+'100%'+" !important"+
240        '; max-height:'+'100%'+" !important"+
241        '; width:'+'auto'+
242        '; height:'+ 'auto' + " !important"+
243        ';">';
244        }
245        oembed_imgur_html +="</div>";
246
247        html_to_insert += oembed_imgur_html;
248
249        break;              
250    default:
251      ;
252  }
253  
254  return html_to_insert;
255
256}
257
258/**
259 * @param from_popup: optional, true if from bulk embed popup, false(default) if from instagram gallery
260 * @return "ok" if adds instagram gallery, false if any error when adding instagram gallery
261 */
262function bwg_add_instagram_gallery(instagram_access_token, from_popup){
263  from_popup = typeof from_popup !== 'undefined' ? from_popup : false;
264  /*if bulk_embed action*/
265  if (from_popup === true) {
266    if (bwg_check_instagram_gallery_input(instagram_access_token, from_popup)){
267      return false;
268    }
269    var whole_post = '0';
270    if(jQuery("input[name=popup_instagram_post_gallery]:checked").val() == 1){
271      whole_post = '1';
272    };
273    var instagram_user = encodeURI(jQuery("#popup_instagram_gallery_source").val());
274    var autogallery_image_number = encodeURI(jQuery("#popup_instagram_image_number").val());
275  }
276  else{
277    /*check if there is problem with input*/
278    if ( bwg_check_instagram_gallery_input(instagram_access_token, from_popup) ) {
279      return false;
280    }
281    if ( !bwg_check_gallery_empty(false, true) ) {
282      return false;
283    }
284    var whole_post = '0';
285    if ( jQuery("input[name=instagram_post_gallery]:checked").val() == 1 ) {
286      whole_post = '1';
287    }
288    
289    var instagram_user = encodeURI(jQuery("#gallery_source").val());
290    var update_flag = jQuery("input[name=update_flag]:checked").val();
291    var autogallery_image_number = encodeURI(jQuery("#autogallery_image_number").val());
292  }
293  jQuery('#bulk_embed').hide();
294  jQuery('#loading_div').show();
295
296 /*prepare data for request*/
297  var filesValid = [];
298  var data = {
299    'action': 'addInstagramGallery',
300    'instagram_user': instagram_user,
301    'instagram_access_token': instagram_access_token,
302    'whole_post': whole_post,
303    'autogallery_image_number':autogallery_image_number,
304    'update_flag':update_flag,
305    'async':true
306  };
307
308   /* get response data. Here we use the server as a proxy, since Cross-Origin Resource Sharing AJAX is forbidden. */
309  jQuery.post(ajax_url, data, function(response) {
310    if ( response == false ) {
311      alert('Error: cannot get response from the server.');
312      jQuery('#loading_div').hide();
313      if(from_popup){
314        jQuery('#bulk_embed').show();
315      }
316      return false;
317    }
318    else {
319      var index_start = response.indexOf("WD_delimiter_start");
320      var index_end = response.indexOf("WD_delimiter_end");
321      if(index_start == -1 || index_end == -1){
322        jQuery('#loading_div').hide();
323        if(from_popup){
324          jQuery('#bulk_embed').show();
325        }
326        return false;
327      }
328
329      /*filter out other echoed characters*/
330      /*18 is the length of "wd_delimiter_start"*/
331      response = response.substring(index_start+18,index_end);
332      response_JSON = jQuery.parseJSON(response);
333
334      if(!response_JSON ){
335        alert('There is some error. Cannot add Instagram gallery.');
336        jQuery('#loading_div').hide();
337        if(from_popup){
338          jQuery('#bulk_embed').show();
339        }
340        return false;
341      }
342      else{
343        if(response_JSON[0] == 'error'){
344          alert('Error: ' + jQuery.parseJSON(response)[1]);
345          jQuery('#loading_div').hide();
346          if(from_popup){
347            jQuery('#bulk_embed').show();
348          }
349          return false;
350        }
351        else{
352          var len = response_JSON.length;
353          for (var i=1; i<=len; i++) {
354            if(response_JSON[len-i]!= false){
355              var item = response_JSON[len-i];
356              filesValid.push(item);
357            }
358          }
359          bwg_add_image(filesValid);
360          if(!from_popup){
361            bwg_gallery_update_flag();
362            jQuery('#tr_instagram_gallery_add_button').hide();
363          }
364          jQuery('#loading_div').hide();
365          if(from_popup){
366            jQuery('.opacity_bulk_embed').hide();
367          }
368          return "ok";
369        }
370      }      
371    }/*end of considering all cases*/
372  });
373}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.