1wpdevart_lightbox={ 2 3 /*###################################### Default Dinamic Variables ##########################################################*/ 4 defaults:{ 5 elem_array:[], 6 current_img_index:null, 7 wordpress_admin_bar_height:0, 8 9 // overlay parametrs 10 remov_overlay_when_clicked:true, 11 remov_overlay_esc_button:true, 12 // popup parametrs 13 popup_position:5, 14 popup_outside_margin:0, 15 popup_border_width:0, 16 popup_border_color:"#000000", 17 popup_background_color:"#FFFFFF", 18 popup_border_radius:"0", 19 popup_fixed_position:true, 20 popup_initial_width:300, // initial width 21 popup_initial_height:300,// initial height 22 23 popup_youtube_width:640, // initial width 24 popup_youtube_height:408,// initial height 25 26 popup_vimeo_width:500, // initial width 27 popup_vimeo_height:409,// initial height 28 29 popup_max_width:1900, 30 popup_max_height:1900, 31 popup_min_width:300, 32 popup_min_height:300, 33 popup_can_run:true, 34 popup_inside_element_ordering:'{"0":"control_buttons","1":"content","2":"information_line"}', 35 popup_loading_image:'http://api.ning.com/files/*tHd*uipNJDnOZQFSoRrnHkt2t9HWUPt*0bw5zsEme2gxFWTpf4V1SLn9muc5YYHVUzOFawiDFQUQd8h1v216YMI5kXEkD3L/1064534191.gif', 36 broken_icon_img_src:'http://www.wickedauctions.com/Images/img_not_found.gif', 37 popup_window_demision:[300,300,300], 38 39 // control buttons 40 control_buttons_show:true, 41 control_buttons_show_in_content:false, 42 control_buttons_height:35, 43 control_buttons_line_bg_color:'#0073aa', 44 enable_picture_download_link:true, 45 enable_picture_open_new_widow:true, 46 enable_picture_full_width:true, 47 enabled_picture_full_width:false, 48 enabled_picture_full_screen:false, 49 50 curent_image_width:null, 51 curent_image_height:null, 52 53 54 55 56 control_button_next_img_src:'https://cdn3.iconfinder.com/data/icons/google-material-design-icons/48/ic_keyboard_arrow_right_48px-128.png', 57 control_button_next_hover_img_src:'https://cdn3.iconfinder.com/data/icons/google-material-design-icons/48/ic_keyboard_arrow_right_48px-128.png', 58 control_button_content_next_img_src:'https://cdn3.iconfinder.com/data/icons/google-material-design-icons/48/ic_keyboard_arrow_right_48px-128.png', 59 control_button_window_next_img_src:'https://cdn3.iconfinder.com/data/icons/google-material-design-icons/48/ic_keyboard_arrow_right_48px-128.png', 60 61 control_button_prev_img_src:'https://cdn3.iconfinder.com/data/icons/google-material-design-icons/48/ic_keyboard_arrow_left_48px-128.png', 62 control_button_prev_hover_img_src:'https://cdn3.iconfinder.com/data/icons/google-material-design-icons/48/ic_keyboard_arrow_left_48px-128.png', 63 control_button_content_prev_img_src:'https://cdn3.iconfinder.com/data/icons/google-material-design-icons/48/ic_keyboard_arrow_right_48px-128.png', 64 control_button_window_prev_img_src:'https://cdn3.iconfinder.com/data/icons/google-material-design-icons/48/ic_keyboard_arrow_right_48px-128.png', 65 66 67 control_button_download_img_src:'https://cdn4.iconfinder.com/data/icons/miu/22/circle_arrow-down_download-128.png', 68 control_button_download_hover_img_src:'https://cdn4.iconfinder.com/data/icons/miu/22/circle_arrow-down_download-128.png', 69 70 control_button_innewwindow_img_src:'http://www.rcq.gouv.qc.ca/images/design/newWindow.png', 71 control_button_innewwindow_hover_img_src:'http://www.rcq.gouv.qc.ca/images/design/newWindow.png', 72 73 74 control_button_fullwidth_img_src:"http://stories.kera.org/wp-content/themes/jrny/images/expand.png", 75 control_button_fullwidht_hover_img_src:"http://stories.kera.org/wp-content/themes/jrny/images/expand.png", 76 77 control_button_fullwidthrest_img_src:"https://cdn0.iconfinder.com/data/icons/pixon-1/24/arrows_extend_full_screen_fullscreen_minimize_resize-128.png", 78 control_button_fullwidhtrest_hover_img_src:"https://cdn0.iconfinder.com/data/icons/pixon-1/24/arrows_extend_full_screen_fullscreen_minimize_resize-128.png", 79 80 control_button_close_img_src:"https://cdn3.iconfinder.com/data/icons/virtual-notebook/16/button_close-128.png", 81 control_button_close_hover_img_src:"https://cdn3.iconfinder.com/data/icons/virtual-notebook/16/button_close-128.png",
82 control_button_ordering:'{"left":[[1,"prev"],[1,"next"],[1,"play"],[1,"download"],[1,"innewwindow"],[1,"fullwidth"],[1,"fullscreen"]],"right":[[1,"close"]]}', 83 84 keyboard_navigation:true, 85 autoplay_ids:[], 86 87 /// information line 88 89 information_panel_show:true, 90 information_panel_show_in_content:true, 91 information_panel_heght:30, 92 information_panel_bg_color:"#00a0d2", 93 94 information_panel_text_for_no_title:'No title', 95 information_panel_text_for_no_caption:'no Description', 96 97 information_panel_count_image_after_text:"image", 98 information_panel_count_image_middle_text:"of", 99 information_panel_ordering:'{"count":[1,"count"],"title":[1,"title"],"caption":[1,"caption"]}' 100 101 }, 102 /*###################################### Default Constant Variables ##########################################################*/ 103 constant_defaults:{ 104 105 // this ids conected in css.. if change anithing please change in css to... 106 parent_div_foe_mozilla_full:'parent_div_for_mozila', 107 overlay_id:'wpdevart_lb_overlay', 108 popup_window_id:'wpdevart_lb_main_window', 109 popup_window_desc_content_id:'wpdevart_lb_main_desc', 110 popup_window_information_content_id:'wpdevart_lb_information_content', 111 popup_window_pic_content_id:'wpdevart_lb_pic_content_id', 112 popup_window_first_elem_id:'wpdevart_lb_content_first_pic', 113 popup_window_second_elem_id:'wpdevart_lb_content_second_pic', 114 popup_window_loading_pic_id:'wpdevart_lb_loading_img', 115 popup_window_loading_first_pic_id:'wpdevart_lb_loading_img_first', 116 117 // description buttons 118 popup_window_description_next_button_id:'wpdevart_desc_next_img', 119 popup_window_next_content_button_id:'wpdevart_content_next_img', 120 popup_window_next_window_button_id:'wpdevart_window_next_img', 121 popup_window_description_prev_button_id:'wpdevart_desc_prev_img', 122 popup_window_prev_content_button_id:'wpdevart_content_prev_img', 123 popup_window_prev_window_button_id:'wpdevart_window_prev_img', 124 popup_window_description_close_button_id:'wpdevart_desc_close_img', 125 popup_window_description_enable_full_width_img_id:'wpdevart_desc_enable_full_img', 126 popup_window_description_disable_ful_width_img_id:'wpdevart_desc_disable_full_img', 127 128 /////////////////// information div elements 129 popup_window_information_count_id:'wpdevart_info_counter_of_imgs', 130 popup_window_information_title_id:'wpdevart_info_title', 131 popup_window_information_aption_id:'wpdevart_info_caption', 132 133 //////////////////////////////// 134 download_icon_id:'wpdevart_download_img', 135 open_img_in_new_window_icon_id:'wpdevart_download_img', 136 137 popup_window_alternative_window_next_button_id:'wpdevart_alternativ_next', 138 popup_window_alternative_window_previous_button_id:'wpdevart_alternativ_previous', 139 140 141 }, 142 143 144 145 /*###################################### CREATE POPUP ##########################################################*/ 146 create_popup:function(element_index){ 147 148 // disable duble open popup 149 this.defaults.popup_can_run=false; 150 // var requered elements 151 var self=this; 152 var popup_window=jQuery('<div>',{id: this.constant_defaults.popup_window_id}); // popup window 153 var popup_window_parent=jQuery('<div>',{id: this.constant_defaults.parent_div_foe_mozilla_full}); // popup window 154 155 156 /* POSITION */ 157 if(this.defaults.popup_fixed_position) 158 jQuery(popup_window).css('position','fixed'); 159 else 160 jQuery(popup_window).css('position','absolute'); 161 162 163 /* BORDER */ 164 jQuery(popup_window).css('border-radius',this.defaults.popup_border_radius+'px'); 165 self.generete_border(popup_window); 166 167 168 /* Control cantrol buttons */ 169 var order_popup_inside_elements=JSON.parse(this.defaults.popup_inside_element_ordering); 170 var vertical_mode='top'; 171 var vertical_pixels=0; 172 var position_of_elem=[]; 173 jQuery.each(order_popup_inside_elements,function(key, value) { 174 switch(value){ 175 case 'control_buttons' : 176 if(self.defaults.control_buttons_show){ 177 position_of_elem[0]=vertical_mode; 178 position_of_elem[1]=vertical_pixels;
179 self.create_description_panel(popup_window,position_of_elem); 180 vertical_pixels=self.defaults.control_buttons_height; 181 } 182 break; 183 case 'content' : 184 self.generete_content_popup(popup_window,position_of_elem); 185 vertical_mode='bottom'; 186 if(vertical_pixels){ 187 vertical_pixels=0; 188 } 189 else{ 190 var revers_ordering 191 if(self.defaults.information_panel_show_in_content || self.defaults.control_buttons_show_in_content){ 192 revers_ordering=order_popup_inside_elements[1]; 193 order_popup_inside_elements[1]=order_popup_inside_elements[2] 194 order_popup_inside_elements[2]=revers_ordering; 195 } 196 } 197 198 break; 199 case 'information_line' : 200 if(self.defaults.information_panel_show){ 201 position_of_elem[0]=vertical_mode; 202 position_of_elem[1]=vertical_pixels; 203 self.create_information_panel(element_index,popup_window,position_of_elem) 204 vertical_pixels=self.defaults.control_buttons_height; 205 } 206 break; 207 } 208 }); 209 210 jQuery(popup_window_parent).prepend(popup_window); 211 jQuery('body').prepend(popup_window_parent); 212 // transitiony problem uni 213 this.resize_popup() 214 this.load_element_in_content(element_index) 215 // append element in popup 216 217 218 }, 219 call_function_when_load_complited:function(){ 220 var self=this; 221 self.set_loading_image_position(); 222 }, 223 generete_border:function(element){ 224 225 if(this.get_correct_border(jQuery(window).width(),jQuery(window).height(),this.defaults.popup_border_width)){ 226 jQuery(element).css('border','solid '+this.defaults.popup_border_width+'px '+this.defaults.popup_border_color); 227 } 228 else{ 229 jQuery(element).css('border','none'); 230 } 231 232 }, 233 generete_content_popup:function(popup_element){ 234 235 var popup_window_pic_content=jQuery('<div>',{id: this.constant_defaults.popup_window_pic_content_id}); // popup picture_content main element 236 237 var popup_window_pic_loading=jQuery('<img>',{id: this.constant_defaults.popup_window_loading_pic_id,src:this.defaults.popup_loading_image}); // loading_image 238 239 jQuery(popup_window_pic_content).css('background-color',this.defaults.popup_background_color); 240 241 jQuery(popup_window_pic_loading).css('display','none'); 242 jQuery(popup_window_pic_loading).css('visibility','hidden'); 243 jQuery(popup_window_pic_loading).css('max-height','10%'); 244 jQuery(popup_window_pic_loading).css('max-width','10%'); 245 jQuery(popup_window_pic_content).append(popup_window_pic_loading); 246 247 jQuery(popup_window_pic_loading).load(function(){self.set_loading_image_position();jQuery(popup_window_pic_loading).css('visibility','visible')}); 248 jQuery(popup_element).append(popup_window_pic_content); 249 250 }, 251 252 create_first_loading_imge:function(){ 253 var sef=this; 254 var first_loading_image= new Image(); 255 256 jQuery(first_loading_image).attr('id',this.constant_defaults.popup_window_loading_first_pic_id); 257 first_loading_image.src=this.defaults.popup_loading_image; 258 259 260 // append image whn is alredi is loading 261 first_loading_image.onload=function(){ 262 // if photos is loacal and loading faster than loading image 263 if(jQuery('#'+self.constant_defaults.popup_window_first_elem_id).length<1){ 264 jQuery('body').append(first_loading_image); 265 self.first_image_loading_postion(first_loading_image); 266 } 267 else{ 268 if(jQuery('#'+self.constant_defaults.popup_window_first_elem_id ).prop('nodeName')=='IFRAME'){ 269 jQuery('body').append(first_loading_image); 270 self.first_image_loading_postion(first_loading_image); 271 } 272 } 273 } 274 }, 275 first_image_loading_postion:function(loading_image){ 276 277 var top=parseInt((jQuery(window).height()-jQuery(loading_image).height())/2); 278 279 var left=parseInt((jQuery(window).width()-jQuery(loading_image).width())/2); 280 jQuery(loading_image).css('position','fixed'); 281 jQuery(loading_image).css('z-index','99998'); 282 jQuery(loading_image).css('max-height','15%'); 283 jQuery(loading_image).css('max-width','auto'); 284 jQuery(loading_image).css('left',left+'px'); 285 jQuery(loading_image).css('top',top+'px'); 286 }, 287 remove_first_loading_image:function(loading_element){ 288 if(jQuery('#'+this.constant_defaults.popup_window_loading_first_pic_id).length>0) 289 jQuery('#'+this.constant_defaults.popup_window_loading_first_pic_id).remove(); 290 }, 291
292 /*###################################### Craeate control buttons ##########################################################*/ 293 /*###################################### Craeate control buttons ##########################################################*/ 294 /*###################################### Craeate control buttons ##########################################################*/ 295 /*###################################### Craeate control buttons ##########################################################*/ 296 create_description_panel:function(parnet_element,position_of_elem){ 297 298 var popup_window_desc=jQuery('<div>',{id: this.constant_defaults.popup_window_desc_content_id}); // popup description main element 299 300 popup_window_desc.css('height',this.defaults.control_buttons_height); 301 popup_window_desc.css('width',this.defaults.window_description_initial_width); 302 popup_window_desc.css('background-color',this.defaults.control_buttons_line_bg_color); 303 if(this.defaults.control_buttons_show_in_content){ 304 popup_window_desc.css('position','absolute'); 305 popup_window_desc.css('z-index','9999999'); 306 popup_window_desc.css(position_of_elem[0],position_of_elem[1]); 307 308 //es momenty botom lineluca mi hat kveranaes information liny naeluc 309 //popup_window_desc.css('transform','translate(0px,-'+this.defaults.control_buttons_height+'px)'); 310 311 } 312 313 jQuery(parnet_element).append(popup_window_desc); 314 315 this.create_descriptions_buttons(popup_window_desc); 316 317 }, 318 319 320 create_descriptions_buttons:function(element){ 321 var self=this; 322 323 var next_button=jQuery('<img>',{id: this.constant_defaults.popup_window_description_next_button_id,src:this.defaults.control_button_next_img_src}); // next button 324 325 var prev_button=jQuery('<img>',{id: this.constant_defaults.popup_window_description_prev_button_id,src:this.defaults.control_button_prev_img_src}); // previus button 326 327 var download_link=jQuery('<img>',{id: this.constant_defaults.download_icon_id,src:this.defaults.control_button_download_img_src}); // pause button 328 var new_window_link=jQuery('<img>',{id: this.constant_defaults.open_img_in_new_window_icon_id,src:this.defaults.control_button_innewwindow_img_src}); // pause button 329 330 var enable_full_width=jQuery('<img>',{id: this.constant_defaults.popup_window_description_enable_full_width_img_id,src:this.defaults.control_button_fullwidth_img_src}); // enable_full 331 var disable_full_width=jQuery('<img>',{id: this.constant_defaults.popup_window_description_disable_ful_width_img_id,src:this.defaults.control_button_fullwidthrest_img_src}); // disable full 332 333 var enable_full_screen=jQuery('<img>',{id: this.constant_defaults.popup_window_description_enable_full_screen_img_id,src:this.defaults.control_button_fullscreen_img_src}); // enable_full 334 var disable_full_screen=jQuery('<img>',{id: this.constant_defaults.popup_window_description_disable_full_screen_img_id,src:this.defaults.control_button_fullscreenrest_img_src}); // disable full 335 336 var close_button=jQuery('<img>',{id: this.constant_defaults.popup_window_description_close_button_id,src:this.defaults.control_button_close_img_src}); // pause button 337 338 jQuery(disable_full_width).css('display','none'); 339 jQuery(close_button).css('float','right'); 340 jQuery(next_button).click(function(){ 341 self.change_to_next_picture(); 342 }) 343 jQuery(next_button).hover( 344 function(){ 345 jQuery(this).attr('src',self.defaults.control_button_next_hover_img_src); 346 }, 347 function(){ 348 jQuery(this).attr('src',self.defaults.control_button_next_img_src); 349 } 350 ) 351 jQuery(prev_button).click(function(){ 352 self.change_to_previus_picture(); 353 }) 354 jQuery(prev_button).hover( 355 function(){ 356 jQuery(this).attr('src',self.defaults.control_button_prev_hover_img_src); 357 }, 358 function(){ 359 jQuery(this).attr('src',self.defaults.control_button_prev_img_src); 360 } 361 ) 362 363 jQuery(download_link).click(function(){ 364 self.download_img(); 365 }) 366 jQuery(download_link).hover( 367 function(){ 368 jQuery(this).attr('src',self.defaults.control_button_download_hover_img_src); 369 }, 370 function(){ 371 jQuery(this).attr('src',self.defaults.control_button_download_img_src); 372 } 373 ) 374 375 376 jQuery(new_window_link).click(function(){ 377 self.open_in_new_window_img(); 378 }) 379 jQuery(new_window_link).hover( 380 function(){ 381 jQuery(this).attr('src',self.defaults.control_button_innewwindow_hover_img_src); 382 }, 383 function(){ 384 jQuery(this).attr('src',self.defaults.control_button_innewwindow_img_src); 385 } 386 ) 387 jQuery(enable_full_width).click(function(){ 388 self.enable_popup_full_width(); 389 }) 390 jQuery(enable_full_width).hover( 391 function(){ 392 jQuery(this).attr('src',self.defaults.control_button_fullwidht_hover_img_src); 393 }, 394 function(){ 395 jQuery(this).attr('src',self.defaults.control_button_fullwidth_img_src); 396 } 397 ) 398 jQuery(disable_full_width).click(function(){ 399 self.disable_popup_full_width(); 400 }) 401 jQuery(disable_full_width).hover( 402 function(){ 403 jQuery(this).attr('src',self.defaults.control_button_fullwidhtrest_hover_img_src); 404 }, 405 function(){ 406 jQuery(this).attr('src',self.defaults.control_button_fullwidthrest_img_src); 407 } 408 ) 409 410 jQuery(enable_full_screen).click(function(){ 411 self.check_and_set_full_screen(true); 412 }) 413 jQuery(enable_full_screen).hover( 414 function(){ 415 jQuery(this).attr('src',self.defaults.control_button_fullscreen_hover_img_src); 416 }, 417 function(){ 418 jQuery(this).attr('src',self.defaults.control_button_fullscreen_img_src); 419 } 420 ) 421 jQuery(disable_full_screen).click(function(){ 422 self.check_and_set_full_screen(false); 423 }) 424 jQuery(disable_full_screen).hover( 425 function(){ 426 jQuery(this).attr('src',self.defaults.control_button_fullscreenrest_hover_img_src); 427 }, 428 function(){ 429 jQuery(this).attr('src',self.defaults.control_button_fullscreenrest_img_src); 430 } 431 ) 432 jQuery(close_button).click(function(){ 433 self.remove_overlay(); 434 }) 435 jQuery(close_button).hover( 436 function(){ 437 jQuery(this).attr('src',self.defaults.control_button_close_hover_img_src); 438 }, 439 function(){ 440 jQuery(this).attr('src',self.defaults.control_button_close_img_src); 441 } 442 ) 443 ordering_object=JSON.parse(this.defaults.control_button_ordering); 444 jQuery.each(ordering_object,function(key,value){ 445 var ordering=key; 446 jQuery.each(value,function(key,value){ 447 if(value[0]) 448 switch(value[1]){ 449 case 'prev': 450 jQuery(element).append(prev_button) 451 if(ordering=='left') 452 jQuery(prev_button).css('float',ordering) 453 break 454 case 'next': 455 jQuery(element).append(next_button) 456 if(ordering=='left') 457 jQuery(next_button).css('float',ordering) 458 break 459 460 case 'download': 461 jQuery(element).append(download_link) 462 if(ordering=='left') 463 jQuery(download_link).css('float',ordering) 464 break 465 case 'innewwindow': 466 jQuery(element).append(new_window_link) 467 if(ordering=='left') 468 jQuery(new_window_link).css('float',ordering) 469 break 470 case 'fullwidth': 471 jQuery(element).append(enable_full_width) 472 jQuery(element).append(disable_full_width) 473 if(ordering=='left'){ 474 jQuery(enable_full_width).css('float',ordering) 475 jQuery(disable_full_width).css('float',ordering) 476 } 477 break 478 case 'close': 479 jQuery(element).append(close_button) 480 if(ordering=='left') 481 jQuery(close_button).css('float',ordering) 482 break 483 } 484 }) 485 }) 486 }, 487 488 /// functionality for buttons 489 change_to_next_picture:function(){ 490 var self=this; 491 if(jQuery('#'+self.constant_defaults.popup_window_second_elem_id).length){ 492 return 493 } 494 next_pic_index=parseInt((this.defaults.current_img_index+1)%this.defaults.elem_array.length); 495 this.load_element_in_content(next_pic_index) 496 }, 497 change_to_previus_picture:function(){ 498 var self=this; 499 if(jQuery('#'+self.constant_defaults.popup_window_second_elem_id).length){ 500 return 501 } 502 prev_pic_index=(this.defaults.current_img_index-1); 503 if(prev_pic_index<0) 504 prev_pic_index=this.defaults.elem_array.length-1; 505 this.load_element_in_content(prev_pic_index) 506 }, 507 download_img:function(){ 508 donwloaded_hiperlink = jQuery("<a>").attr("href", jQuery(this.defaults.elem_array[this.defaults.current_img_index][0]).attr('href')).attr("download", ".img").appendTo("body"); 509 donwloaded_hiperlink[0].click(); 510 donwloaded_hiperlink.remove(); 511 }, 512 open_in_new_window_img:function(){ 513 donwloaded_hiperlink = jQuery("<a>").attr("href", jQuery(this.defaults.elem_array[this.defaults.current_img_index][0]).attr('href')).attr("target", "_blank").appendTo("body"); 514 donwloaded_hiperlink[0].click(); 515 donwloaded_hiperlink.remove(); 516 }, 517 enable_popup_full_width:function(){ 518 jQuery('#'+this.constant_defaults.popup_window_description_disable_ful_width_img_id).css('display','inline-block'); 519 jQuery('#'+this.constant_defaults.popup_window_description_enable_full_width_img_id).css('display','none'); 520 this.defaults.enabled_picture_full_width=true; 521 this.resize_popup(); 522 }, 523 disable_popup_full_width:function(){ 524 jQuery('#'+this.constant_defaults.popup_window_description_enable_full_width_img_id).css('display','inline-block'); 525 jQuery('#'+this.constant_defaults.popup_window_description_disable_ful_width_img_id).css('display','none'); 526 this.defaults.enabled_picture_full_width=false; 527 this.resize_popup(); 528 529 }, 530 check_and_set_full_screen:function(enabled){ 531 if(enabled == true){ 532 this.defaults.enabled_picture_full_screen=true; 533 if(!this.defaults.enabled_picture_full_width); 534 this.enable_popup_full_width() 535 this.defaults.wordpress_admin_bar_height=0; 536 jQuery('#'+this.constant_defaults.popup_window_description_disable_full_screen_img_id).css('display','inline-block'); 537 jQuery('#'+this.constant_defaults.popup_window_description_enable_full_screen_img_id).css('display','none'); 538 this.fullscreen(true); 539 } 540 if(enabled == false){ 541 this.defaults.enabled_picture_full_screen=false; 542 if(this.defaults.enabled_picture_full_width); 543 this.disable_popup_full_width() 544 this.defaults.wordpress_admin_bar_height=jQuery('#wpadminbar').height(); 545 546 jQuery('#'+this.constant_defaults.popup_window_description_disable_full_screen_img_id).css('display','none'); 547 jQuery('#'+this.constant_defaults.popup_window_description_enable_full_screen_img_id).css('display','inline-block'); 548 this.fullscreen(false); 549 } 550 if(enabled == 'undefined'){ 551 var fullScreen_mode = document.fullscreenEnabled || document.mozFullScreen || document.webkitIsFullScreen ? true : false; 552 if(fullScreen_mode){ 553 if(!this.defaults.enabled_picture_full_width); 554 this.enable_popup_full_width() 555 this.defaults.wordpress_admin_bar_height=0; 556 this.defaults.enabled_picture_full_screen=true; 557 jQuery('#'+this.constant_defaults.popup_window_description_disable_full_screen_img_id).css('display','inline-block'); 558 jQuery('#'+this.constant_defaults.popup_window_description_enable_full_screen_img_id).css('display','none'); 559 }else{ 560 if(this.defaults.enabled_picture_full_width); 561 this.disable_popup_full_width() 562 this.defaults.wordpress_admin_bar_height=jQuery('#wpadminbar').height(); 563 jQuery('#'+this.constant_defaults.popup_window_description_disable_full_screen_img_id).css('display','none'); 564 jQuery('#'+this.constant_defaults.popup_window_description_enable_full_screen_img_id).css('display','inline-block'); 565 this.defaults.enabled_picture_full_screen=false; 566 567 } 568 } 569 this.resize_popup(); 570 }, 571 572 fullscreen:function(full){ 573 var element=document.getElementById(this.constant_defaults.parent_div_foe_mozilla_full) 574 if(full){ 575 if(element.requestFullScreen) { 576 element.requestFullScreen(); 577 } else if(element.mozRequestFullScreen) { 578 element.mozRequestFullScreen(); 579 } else if(element.webkitRequestFullScreen) { 580 element.webkitRequestFullScreen(); 581 }else if(element.msRequestFullscreen) { 582 element.msRequestFullscreen(); 583 } 584 }else{ 585 if(document.cancelFullScreen) { 586 document.cancelFullScreen(); 587 } else if(document.mozCancelFullScreen) { 588 document.mozCancelFullScreen(); 589 } else if(document.webkitCancelFullScreen) { 590 document.webkitCancelFullScreen(); 591 }else if(document.msExitFullscreen) { 592 document.msExitFullscreen(); 593 } 594 } 595 596 597 }, 598 keyboard_navigation:function(is_enable){ 599 var self=this; 600 if(is_enable){ 601 jQuery(document).keyup(function(e) { 602 if(e.keyCode ==37) 603 self.change_to_previus_picture() 604 if(e.keyCode ==39) 605 self.change_to_next_picture() 606 607 }) 608 609 } 610 }, 611 612
613 /*###################################### Create Information Panel ##########################################################*/ 614 /*###################################### Create Information Panel ##########################################################*/ 615 /*###################################### Create Information Panel ##########################################################*/ 616 /*###################################### Create Information Panel ##########################################################*/ 617 618 create_information_panel:function(element_index,popup_element,position_of_elem){ 619 if(!this.defaults.information_panel_show) 620 return; //when disabled information panel 621 var self=this; 622 var information_main=jQuery('<div>',{id: self.constant_defaults.popup_window_information_content_id}); 623 var count_images=jQuery('<span>',{id: this.constant_defaults.popup_window_information_count_id}); 624 var title_image=jQuery('<span>',{id: this.constant_defaults.popup_window_information_title_id}); 625 var caption_image=jQuery('<span>',{id: this.constant_defaults.popup_window_information_aption_id}); 626 if(this.defaults.information_panel_show_in_content){ 627 information_main.css('position','absolute'); 628 information_main.css('z-index','9999999'); 629 information_main.css(position_of_elem[0],position_of_elem[1]); 630 } 631 632 //information_main.css('height',this.defaults.information_panel_heght) 633 information_main.css('background-color',this.defaults.information_panel_bg_color) 634 635 var text_of_count_images=this.defaults.information_panel_count_image_after_text + ' ' + (element_index+1) + ' ' + this.defaults.information_panel_count_image_middle_text + ' ' + self.defaults.elem_array.length; 636 var text_of_title_image=self.defaults.elem_array[element_index][1] 637 var text_of_caption_image=self.defaults.elem_array[element_index][2] 638 639 if(text_of_caption_image==null){ 640 text_of_caption_image=self.defaults.information_panel_text_for_no_caption; 641 } 642 if(text_of_title_image==null){ 643 text_of_title_image=self.defaults.information_panel_text_for_no_title; 644 } 645 646 if(self.defaults.elem_array[element_index][1]==null && this.defaults.information_panel_desc_show_if_not==false){ 647 jQuery(title_image).hide(); 648 } 649 if(self.defaults.elem_array[element_index][2]==null && this.defaults.information_panel_title_show_if_not==false){ 650 jQuery(title_image).hide(); 651 } 652 ordering_object=JSON.parse(this.defaults.information_panel_ordering); 653 jQuery.each(ordering_object,function(key,value){ 654 if(value[0]) 655 switch(value[1]){ 656 case 'count': 657 jQuery(count_images).html(text_of_count_images); 658 jQuery(information_main).append(count_images); 659 break 660 case 'title': 661 jQuery(title_image).html(text_of_title_image); 662 jQuery(information_main).append(title_image); 663 break 664 case 'caption': 665 jQuery(caption_image).html(text_of_caption_image); 666 jQuery(information_main).append(caption_image); 667 break 668 } 669 }) 670 671 672 jQuery(popup_element).append(information_main); 673 674 675 }, 676 change_information_panel_informations:function(element_index){ 677 678 var text_of_count_images=this.defaults.information_panel_count_image_after_text + ' ' + (element_index+1) + ' ' + this.defaults.information_panel_count_image_middle_text + ' ' + self.defaults.elem_array.length; 679 var text_of_title_image=self.defaults.elem_array[element_index][1] 680 var text_of_caption_image=self.defaults.elem_array[element_index][2] 681 if(text_of_caption_image==null){ 682 text_of_caption_image=self.defaults.information_panel_text_for_no_caption; 683 } 684 if(text_of_title_image==null){ 685 text_of_title_image=self.defaults.information_panel_text_for_no_title; 686 } 687 if(jQuery('#'+this.constant_defaults.popup_window_information_count_id).length>0){ 688 jQuery('#'+this.constant_defaults.popup_window_information_count_id).html(text_of_count_images) 689 } 690 if(jQuery('#'+this.constant_defaults.popup_window_information_title_id).length>0){ 691 if(this.defaults.information_panel_desc_show_if_not==false){ 692 if(text_of_title_image==null){ 693 jQuery('#'+this.constant_defaults.popup_window_information_title_id).hide(); 694 } 695 else{ 696 jQuery('#'+this.constant_defaults.popup_window_information_title_id).html(text_of_title_image) 697 jQuery('#'+this.constant_defaults.popup_window_information_title_id).show(); 698 } 699 } 700 else{ 701 jQuery('#'+this.constant_defaults.popup_window_information_title_id).html(text_of_title_image) 702 } 703 } 704 if(jQuery('#'+this.constant_defaults.popup_window_information_aption_id).length>0){ 705 if(this.defaults.information_panel_desc_show_if_not==false){ 706 if(text_of_caption_image==null){ 707 jQuery('#'+this.constant_defaults.popup_window_information_aption_id).hide(); 708 } 709 else{ 710 jQuery('#'+this.constant_defaults.popup_window_information_aption_id).html(text_of_caption_image) 711 jQuery('#'+this.constant_defaults.popup_window_information_aption_id).show(); 712 } 713 } 714 else{ 715 jQuery('#'+this.constant_defaults.popup_window_information_aption_id).html(text_of_caption_image) 716 } 717 718 } 719 720 }, 721 /*###################################### REMOVE POPUP ##########################################################*/ 722 remove_popup:function(){ 723 self=this; 724 jQuery('#'+self.constant_defaults.popup_window_id).remove();self.defaults.popup_can_run=true; 725 self.set_initial_parametrs(); 726 727 }, 728 set_initial_parametrs:function(){ 729 this.defaults.current_img_index=null; 730 731 732 }, 733 /*###################################### LOADING IMAGE INTO CONTENT BY INDEX ##########################################################*/ 734 load_element_in_content:function(element_index,popup_window){ 735 self=this; 736 if(this.defaults.elem_array[element_index][3]=='iframe'){ 737 return this.load_iframe_in_content(element_index,popup_window); 738 } 739 else{ 740 // worked_cantrol buttons 741 this.set_display_control_button(this.constant_defaults.download_icon_id,true); 742 } 743 // when first image loading 744 var is_frst_image=true; 745 if(this.defaults.current_img_index!= null) 746 is_frst_image=false; 747 // set curent image index 748 this.defaults.current_img_index=element_index; 749 // firs or last image item 750 var img_id=this.constant_defaults.popup_window_second_elem_id 751 if(is_frst_image) 752 var img_id=this.constant_defaults.popup_window_first_elem_id 753 754 // loading image 755 jQuery('#'+self.constant_defaults.popup_window_loading_pic_id).css('display','inline-block'); 756 jQuery('<img>', { 757 src: jQuery(this.defaults.elem_array[element_index][0]).attr('href'), 758 id: img_id, 759 load:function(){ 760 self.change_information_panel_informations(self.defaults.current_img_index) 761 // hide loading image 762 jQuery('#'+self.constant_defaults.popup_window_loading_pic_id).css('display','none'); 763 // open for loading 764 765 766 767 self.defaults.curent_img_width=this.width; 768 self.defaults.curent_img_height=this.height; 769 jQuery('#'+self.constant_defaults.popup_window_pic_content_id).prepend(this); 770 if(!is_frst_image){ 771 jQuery('#'+self.constant_defaults.popup_window_first_elem_id).remove(); 772 jQuery('#'+self.constant_defaults.popup_window_second_elem_id).attr('id',self.constant_defaults.popup_window_first_elem_id); 773 } 774 self.resize_popup_by_image(self.defaults.curent_img_width,self.defaults.curent_img_height)// dont use this.width and this.height becouse prepended ement width other 775 self.call_function_when_load_complited(); 776 }, 777 //error:function() { 778 // var broken_img= new Image(); 779 // jQuery(img).attr('id',self.constant_defaults.popup_window_first_elem_id) 780 // broken_img.src=self.defaults.broken_icon_img_src; 781 // broken_img.onload=function(){ 782 // jQuery('#'+self.constant_defaults.popup_window_loading_pic_id).css('display','none') 783 784 // self.defaults.curent_img_width=this.width; 785 // self.defaults.curent_img_height=this.height; 786 // jQuery('#'+self.constant_defaults.popup_window_pic_content_id).prepend(this); 787 // self.resize_popup_by_image(self.defaults.curent_img_width,self.defaults.curent_img_height)// dont use this.width and this.height becouse prepended ement width other 788 // } 789 // self.call_function_when_load_complited(); 790 // } 791 792 }); 793 }, 794 /*###################################### LOADING IFRAME INTO CONTENT BY INDEX ##########################################################*/ 795 load_iframe_in_content:function(element_index,popup_window){ 796 797 self=this; 798 799 // for functionality content 800 var is_first_element=true; 801 if(this.defaults.current_img_index!= null) 802 is_first_element=false; 803 this.defaults.current_img_index=element_index; 804 805 // worked_cantrol buttons 806 this.set_display_control_button(this.constant_defaults.download_icon_id,false); 807
808 var iframe= document.createElement("IFRAME");; 809 var iframe_id 810 if(is_first_element) 811 iframe_id=this.constant_defaults.popup_window_first_elem_id 812 else 813 iframe_id=this.constant_defaults.popup_window_second_elem_id; 814 if(!this.get_curent_ordering_element_enabled('fullscreen') && this.defaults.control_buttons_show) 815 jQuery(iframe).attr('allowfullscreen','true'); 816 iframe_src=this.get_video_type_and_url(jQuery(this.defaults.elem_array[element_index][0]).attr('href')) 817 if(iframe_src==null){ 818 this.remove_popup(); 819 return; 820 } 821 if(iframe_src[0]=='youtube'){ 822 self.defaults.curent_img_width=this.defaults.popup_youtube_width; 823 self.defaults.curent_img_height=this.defaults.popup_youtube_height; 824 } 825 if(iframe_src[0]=='vimeo'){ 826 self.defaults.curent_img_width=this.defaults.popup_vimeo_width; 827 self.defaults.curent_img_height=this.defaults.popup_vimeo_height; 828 } 829 iframe_src=iframe_src[1]; 830 // show loading image 831 jQuery('#'+self.constant_defaults.popup_window_loading_pic_id).css('display','inline-block'); 832 jQuery('<iframe>', { 833 src: iframe_src, 834 id: iframe_id, 835 load:function(){ 836 self.change_information_panel_informations(self.defaults.current_img_index) 837 // hide loading image 838 jQuery('#'+self.constant_defaults.popup_window_loading_pic_id).css('display','none'); 839 if(!is_first_element){ 840 jQuery('#'+self.constant_defaults.popup_window_first_elem_id).remove(); 841 jQuery('#'+self.constant_defaults.popup_window_second_elem_id).attr('id',self.constant_defaults.popup_window_first_elem_id); 842 } 843 self.resize_popup_by_image(self.defaults.curent_img_width,self.defaults.curent_img_height)// dont use this.width and this.height becouse prepended ement width other 844 self.call_function_when_load_complited(); 845 846 }, 847 }).prependTo('#'+self.constant_defaults.popup_window_pic_content_id); 848 }, 849 850 /*###################################### RESIZE POPUP BY IMAGE ##########################################################*/ 851 resize_popup_by_image:function(img_width,img_height){ 852 853 // outside margin when sizes is small 854 var local_outside_margin=this.defaults.popup_outside_margin; 855 if(this.defaults.popup_position==5) 856 local_outside_margin=0; 857 local_outside_margin=this.get_correct_margin(jQuery(window).width(),(jQuery(window).height()),this.defaults.popup_outside_margin); 858 // description panel when it disabled or in content 859 loc_description_panel_height=this.get_correct_description_height(); 860 // outside border when sizes is smoll 861 var loc_outside_border=this.get_correct_border(jQuery(window).width(),jQuery(window).height(),this.defaults.popup_border_width); 862 863 var window_information_line_height=this.get_correct_information_height(); 864 var oteher_elements_height=loc_outside_border*2 + loc_description_panel_height + this.defaults.wordpress_admin_bar_height + local_outside_margin*2; 865 // en erkarutiuna vori mej nkary piti mna 866 var window_width=jQuery(window).width()-loc_outside_border*2-local_outside_margin*2; 867 868 // noric nkari erkarutiunna vercum 869 var window_height=jQuery(window).height()-loc_outside_border*2-loc_description_panel_height-this.defaults.wordpress_admin_bar_height-local_outside_margin*2-window_information_line_height; 870 871 872 // for max width and heght 873 window_width=Math.min(window_width,this.defaults.popup_max_width); 874 window_height=Math.min(window_height,(this.defaults.popup_max_width-loc_outside_border*2-loc_description_panel_height-this.defaults.wordpress_admin_bar_height-window_information_line_height-local_outside_margin*2)); 875 876 // for full width not for full screen 877 if(this.defaults.enabled_picture_full_width){ 878 curent_image_height=window_height; 879 curent_image_width=curent_image_height*(img_width/img_height); 880 curent_image_width=Math.min(window_width,curent_image_width); 881 curent_image_height=curent_image_width*(img_height/img_width); 882 } 883 else{ 884 curent_image_width=Math.min(window_width,img_width); 885 curent_image_height=curent_image_width*(img_height/img_width); 886 curent_image_height=Math.min(window_height,curent_image_height); 887 curent_image_width=curent_image_height*(img_width/img_height); 888 } 889 // get popup and image demisions for using other functiuons 890 this.defaults.popup_window_demision[0]=parseInt(curent_image_width); 891 892 this.defaults.popup_window_demision[1]=parseInt(curent_image_height)+loc_description_panel_height+window_information_line_height; 893 this.defaults.popup_window_demision[2]=parseInt(curent_image_height); 894 895 jQuery('#'+this.constant_defaults.popup_window_id).width(this.defaults.popup_window_demision[0]); 896 jQuery('#'+this.constant_defaults.popup_window_id).height(this.defaults.popup_window_demision[1]); 897 jQuery('#'+this.constant_defaults.popup_window_pic_content_id).height(curent_image_height); 898 this.generete_border(jQuery('#'+this.constant_defaults.popup_window_id)); 899 this.set_popup_position(); 900 901 902 }, 903 904 /*###################################### RESIZE POPUP ##########################################################*/ 905 resize_popup:function(){ 906 if(this.defaults.curent_img_width && this.defaults.curent_img_height) 907 this.resize_popup_by_image(this.defaults.curent_img_width,this.defaults.curent_img_height) 908 else 909 this.resize_popup_by_image(this.defaults.popup_initial_width,this.defaults.popup_initial_height) 910 }, 911 912 913 /*#################################### LOADING IMAGE POSITION ###################################################*/ 914
915 set_loading_image_position:function(){ 916 var content_width= this.defaults.popup_window_demision[0];// get content width 917 var content_height= this.defaults.popup_window_demision[2]; // get content height 918 jQuery('#'+this.constant_defaults.popup_window_loading_pic_id).css('left',( content_width-jQuery('#'+this.constant_defaults.popup_window_loading_pic_id).width())/2+'px'); 919 jQuery('#'+this.constant_defaults.popup_window_loading_pic_id).css('top',( content_height-jQuery('#'+this.constant_defaults.popup_window_loading_pic_id).height())/2+'px'); 920 }, 921 922 923 /*#################################### SET POPUP POSITION ###################################################*/ 924 set_popup_position:function(){ 925 926 var window_width=jQuery(window).width(); 927 var window_height=jQuery(window).height(); 928 var window_information_line_height=jQuery('#'+this.constant_defaults.popup_window_information_content_id).height(); 929 930 // when outside margin is bigger or border 931 var loc_outside_margin=this.get_correct_margin(window_width,window_height,this.defaults.popup_outside_margin); 932 var loc_outside_border=this.get_correct_border(window_width,window_height,this.defaults.popup_border_width); 933 934 var scroll_to_top=0; 935 if(!this.defaults.popup_fixed_position) 936 scroll_to_top=this.get_top_scroled_pixel(); 937 938 939 switch (this.defaults.popup_position) { 940 case 1: 941 jQuery('#'+this.constant_defaults.popup_window_id).css('left',(loc_outside_border+loc_outside_margin)+'px'); 942 jQuery('#'+this.constant_defaults.popup_window_id).css('top',(this.defaults.wordpress_admin_bar_height+loc_outside_margin)+scroll_to_top+'px'); 943 break; 944 case 2: 945 jQuery('#'+this.constant_defaults.popup_window_id).css('left',(window_width-(this.defaults.popup_window_demision[0]+loc_outside_border*2) )/2+'px'); 946 jQuery('#'+this.constant_defaults.popup_window_id).css('top',(loc_outside_margin+this.defaults.wordpress_admin_bar_height)+scroll_to_top+'px'); 947 break; 948 case 3: 949 jQuery('#'+this.constant_defaults.popup_window_id).css('left',(window_width-(loc_outside_margin+this.defaults.popup_window_demision[0]+loc_outside_border*2))+'px'); 950 jQuery('#'+this.constant_defaults.popup_window_id).css('top',(loc_outside_margin+this.defaults.wordpress_admin_bar_height)+scroll_to_top+'px'); 951 break; 952 case 4: 953 jQuery('#'+this.constant_defaults.popup_window_id).css('left',(loc_outside_border+loc_outside_margin)+'px'); 954 jQuery('#'+this.constant_defaults.popup_window_id).css('top',(window_height-this.defaults.wordpress_admin_bar_height-loc_outside_border*2-this.defaults.popup_window_demision[1])/2+this.defaults.wordpress_admin_bar_height+scroll_to_top+'px'); 955 break; 956 case 5: 957 jQuery('#'+this.constant_defaults.popup_window_id).css('left',(window_width-(this.defaults.popup_window_demision[0]+loc_outside_border*2) )/2+'px'); 958 jQuery('#'+this.constant_defaults.popup_window_id).css('top',(window_height-this.defaults.wordpress_admin_bar_height-loc_outside_border*2-this.defaults.popup_window_demision[1])/2+this.defaults.wordpress_admin_bar_height+scroll_to_top+'px'); 959 break; 960 case 6: 961 jQuery('#'+this.constant_defaults.popup_window_id).css('left',(window_width-(loc_outside_border*2+loc_outside_margin+this.defaults.popup_window_demision[0]))+'px'); 962 jQuery('#'+this.constant_defaults.popup_window_id).css('top',(window_height-this.defaults.wordpress_admin_bar_height-loc_outside_border*2-this.defaults.popup_window_demision[1])/2+this.defaults.wordpress_admin_bar_height+scroll_to_top+'px'); 963 break; 964 case 7: 965 jQuery('#'+this.constant_defaults.popup_window_id).css('left',loc_outside_margin+'px'); 966 jQuery('#'+this.constant_defaults.popup_window_id).css('top',(window_height-loc_outside_border*2-loc_outside_margin-this.defaults.popup_window_demision[1])+scroll_to_top+'px'); 967 break; 968 case 8: 969 jQuery('#'+this.constant_defaults.popup_window_id).css('left',(window_width-(this.defaults.popup_window_demision[0]+loc_outside_border*2) )/2+'px'); 970 jQuery('#'+this.constant_defaults.popup_window_id).css('top',(window_height-loc_outside_border*2-loc_outside_margin-this.defaults.popup_window_demision[1])+scroll_to_top+'px'); 971 break; 972 case 9: 973 jQuery('#'+this.constant_defaults.popup_window_id).css('left',(window_width-(loc_outside_border*2+loc_outside_margin+this.defaults.popup_window_demision[0]))+'px'); 974 jQuery('#'+this.constant_defaults.popup_window_id).css('top',(window_height-loc_outside_border*2-loc_outside_margin-this.defaults.popup_window_demision[1])+scroll_to_top+'px'); 975 break; 976 default: 977 jQuery('#'+this.constant_defaults.popup_window_id).css('left',(window_width-(loc_outside_border+this.defaults.popup_window_demision[0]))/2+'px'); 978 jQuery('#'+this.constant_defaults.popup_window_id).css('top',(window_height-this.defaults.wordpress_admin_bar_height-loc_outside_border*2-this.defaults.popup_window_demision[1])/2+this.defaults.wordpress_admin_bar_height+scroll_to_top+'px'); 979 break; 980 } 981 this.set_loading_image_position(); 982 }, 983 984 985 986 987 988 989 990 991 /*#################################### CREATE OVERLAY ###################################################*/ 992 create_overlay:function(){ 993 var wpdevart_self=this; 994 var element_overlay=jQuery('<div>
994',{id: this.constant_defaults.overlay_id}); // 995 996 997 // if element overay // add opaciti animation 998 999 jQuery(element_overlay).addClass('wpdevart_opacity'); 1000 jQuery('body').prepend(element_overlay); 1001 1002 1003 // remove overlay when clicked 1004 if(wpdevart_self.defaults.remov_overlay_when_clicked){ 1005 jQuery(element_overlay).click(function(e){ if(e.target!=document.getElementById(wpdevart_self.constant_defaults.overlay_id)) return; wpdevart_self.remove_overlay()}) 1006 } 1007 // remove overlay when pressed esc button 1008 if(wpdevart_self.defaults.remov_overlay_esc_button){ 1009 jQuery(document).keyup(function(e) { 1010 if(e.keyCode ==27) 1011 wpdevart_self.remove_overlay() 1012 }) 1013 } 1014 }, 1015 1016 1017 /*#################################### REMOVEW OVERLAY ###################################################*/ 1018 remove_overlay:function(){ 1019 var wpdevart_self=this; //crate self for using in inside section 1020 if(!jQuery('#'+this.constant_defaults.overlay_id).hasClass('wpdevart_opacity')) 1021 return; 1022 1023 jQuery('#'+this.constant_defaults.overlay_id).removeClass('wpdevart_opacity'); //remove opacity class 1024 jQuery('#'+wpdevart_self.constant_defaults.overlay_id).remove(); 1025 this.remove_popup(); 1026 }, 1027 1028 // conect array ru outside value 1029 conect_outside_variable:function(defaults,seted){ 1030 self=this; 1031 jQuery.each(defaults,function(index, element) { 1032 if(typeof(seted[index])!='undefined'){ 1033 if(seted[index]=='true') 1034 seted[index]=true; 1035 if(seted[index]=='false') 1036 seted[index]=false; 1037 if(typeof(seted[index])=='string' && self.isnumeric(seted[index])) 1038 seted[index]=parseInt(seted[index]); 1039 defaults[index]=seted[index]; 1040 } 1041 }); 1042 return defaults; 1043 1044 }, 1045 1046 /*#################################### Library Functions ###################################################*/ 1047 isnumeric:function(x) { 1048 var anum=/(^\d+$)|(^\d+\.\d+$)/ 1049 if (anum.test(x)) { 1050 return true; 1051 } 1052 return false; 1053 }, 1054 get_correct_margin:function(window_width,window_height,demision){ 1055 if( ( window_width-demision*2 ) < 320 || ( window_height-demision*2 ) < 320 || this.defaults.popup_position==5) 1056 demision=0; 1057 return demision; 1058 }, 1059 get_correct_description_height:function(){ 1060 if(this.defaults.control_buttons_show && !this.defaults.control_buttons_show_in_content) 1061 return this.defaults.control_buttons_height; 1062 return 0; 1063 }, 1064 get_correct_information_height:function(){ 1065 if(this.defaults.information_panel_show && !this.defaults.information_panel_show_in_content) 1066 return jQuery('#'+this.constant_defaults.popup_window_information_content_id).height()?jQuery('#'+this.constant_defaults.popup_window_information_content_id).height():0; 1067 return 0; 1068 }, 1069 get_correct_border:function(window_width,window_height,border){ 1070 if( ( window_width-border*2*5 ) < 320 || ( window_height-border*2*5 ) < 320 ) 1071 border=0; 1072 return border; 1073 }, 1074 get_top_scroled_pixel:function(){ 1075 if(this.defaults.enabled_picture_full_screen) 1076 return 0; 1077 var doc = document.documentElement; 1078 var top = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0); 1079 return top; 1080 }, 1081 set_display_control_button:function(control_button_id,show_hide){ 1082 if(jQuery('#'+control_button_id).length>0){ 1083 if(show_hide){ 1084 jQuery('#'+control_button_id).css('display','inline-block'); 1085 return; 1086 } 1087 jQuery('#'+control_button_id).css('display','none'); 1088 } 1089 1090 }, 1091 get_video_type_and_url:function(iframe_link){ 1092 var type='none'; 1093 iframe_src=iframe_link.match(/(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/); 1094 if(iframe_src!=null){ 1095 type='youtube' 1096 if(iframe_src[1].indexOf('embed/')!=-1){ 1097 iframe_src[1] = iframe_src[1].substring(6); 1098 } 1099 iframe_src='https://www.youtube.com/embed/'+iframe_src[1]; 1100 }else{ 1101 iframe_src=iframe_link.match(/(?:https?:\/{2})?(?:w{3}\.)?vimeo.com(?:.*)/); 1102 if(iframe_src!=null){ 1103 type='vimeo'; 1104 var vimeoid = iframe_link.substring(iframe_link.lastIndexOf("/") + 1, iframe_link.length); 1105 iframe_src='https://player.vimeo.com/video/'+vimeoid; 1106 } 1107 else{ 1108 return null; 1109 } 1110 } 1111 return [type,iframe_src]; 1112 }, 1113 hexToRgbA:function(hex,opasity){ 1114 var h = "0123456789abcdef"; 1115 var r = h.indexOf(hex[1])*16+h.indexOf(hex[2]); 1116 var g = h.indexOf(hex[3])*16+h.indexOf(hex[4]); 1117 var b = h.indexOf(hex[5])*16+h.indexOf(hex[6]); 1118 return "rgba("+r+", "+g+", "+b+", "+opasity+")"; 1119 1120 }, 1121 get_curent_ordering_element_enabled:function(element){ 1122 ordering_object=JSON.parse(this.defaults.control_button_ordering); 1123 isset_element=0; 1124 jQuery.each(ordering_object,function(key,value){ 1125 var ordering=key; 1126 jQuery.each(value,function(keyy,valuee){ 1127 if(element==valuee[1]) 1128 return isset_element=valuee[0]; 1129 }) 1130 }) 1131 return isset_element; 1132 }, 1133 /*#################################### MAIN CONSTRUCT FUNCTION ###################################################*/ 1134 start:function(){ 1135 1136 var self=this; 1137 // get and merge variable by our customer paramntrs 1138 this.defaults=this.conect_outside_variable(this.defaults,wpdevart_lb_variables); 1139 // corect some parametrs 1140 jQuery(document).on("webkitfullscreenchange mozfullscreenchange fullscreenchange",function(){ 1141 setTimeout(function(){self.check_and_set_full_screen('undefined')},500) 1142 }); 1143 jQuery(window).resize(function(){ 1144 self.resize_popup(); 1145 self.set_popup_position(); 1146 }) 1147 1148 if(jQuery('#wpadminbar').length>0){ 1149 this.defaults.wordpress_admin_bar_height=jQuery('#wpadminbar').height(); 1150 } 1151 jQuery('a[rel~="wpdevart_lightbox"],a[rel~="wpdevart_lightbox_video"]').each(function(index, element) { 1152 var title=null; 1153 var caption=null; 1154 var type=(jQuery(element).attr('rel').indexOf('wpdevart_lightbox_video')!=-1)?'iframe':'img'; 1155 1156 if(typeof(jQuery(element).find( "img" ).attr('alt'))!='undefined' && jQuery(element).find( "img" ).attr('alt')!=''){ 1157 title=jQuery(element).find( "img" ).attr('alt'); 1158 } 1159 if(typeof(jQuery(element).find( "img" ).attr('title'))!='undefined' && jQuery(element).find( "img" ).attr('title')!=''){ 1160 title=jQuery(element).find( "img" ).attr('title'); 1161 } 1162 if(jQuery(element).parent().prop('tagName')=='FIGURE' && (jQuery(element).parent().hasClass('wp-caption') || jQuery(element).parent().hasClass('wp-block-image')) ){ 1163 if(typeof(jQuery(element).parent().find('figcaption'))!='undefined' && jQuery(element).parent().find('figcaption').html()!=''){ 1164 caption= jQuery(element).parent().find('figcaption').html() 1165 } 1166 } 1167 self.defaults.elem_array.push(new Array(element, title,caption,type)); 1168 }); 1169 jQuery('a[rel^="wpdevart_lightbox"]').click(function(){ 1170 if(self.defaults.popup_can_run){ 1171 self.create_overlay(); 1172 self.create_popup(jQuery('a[rel^="wpdevart_lightbox"]').index(this)); 1173 } 1174 1175 return false; 1176 }); 1177 this.keyboard_navigation(self.defaults.keyboard_navigation) 1178 } 1179 1180} 1181 1182 1183 1184 1185jQuery(document).ready(function(e) { 1186 wpdevart_lightbox.start(); 1187});
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.