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 overlay_fade_efect_time:600, 11 remov_overlay_when_clicked:true, 12 remov_overlay_esc_button:true, 13 overlay_fade_efect:true, 14 15 // popup parametrs 16 popup_position:5, 17 popup_outside_margin:0, 18 popup_border_width:0, 19 popup_border_color:"#000000", 20 popup_background_color:"#FFFFFF", 21 popup_border_radius:"0", 22 popup_fixed_position:true, 23 popup_initial_width:300, // initial width 24 popup_initial_height:300,// initial height 25 26 popup_youtube_width:640, // initial width 27 popup_youtube_height:408,// initial height 28 29 popup_vimeo_width:500, // initial width 30 popup_vimeo_height:409,// initial height 31 32 popup_max_width:1900, 33 popup_max_height:1900, 34 popup_min_width:300, 35 popup_min_height:300, 36 popup_animation_time:500, 37 popup_first_open_type:'open', 38 popup_can_run:true, 39 popup_animation_type:'fade', 40 popup_inside_element_ordering:'{"0":"control_buttons","1":"content","2":"information_line"}', 41 popup_loading_image:'http://api.ning.com/files/*tHd*uipNJDnOZQFSoRrnHkt2t9HWUPt*0bw5zsEme2gxFWTpf4V1SLn9muc5YYHVUzOFawiDFQUQd8h1v216YMI5kXEkD3L/1064534191.gif', 42 broken_icon_img_src:'http://www.wickedauctions.com/Images/img_not_found.gif', 43 popup_window_demision:[300,300,300], 44 45 // control buttons 46 control_buttons_show:true, 47 control_buttons_show_in_content:false, 48 control_buttons_height:35, 49 control_buttons_line_bg_color:'#0073aa', 50 51 control_button_play_slaidshow_time:5000, 52 control_button_play_autoplay_mode:false, 53 54 control_button_change_image_effect:'fade_elastic', 55 change_img_animation_duration:500, 56 57 control_buttons_content_navigation:true, 58 control_buttons_content_navigation_hover:true, 59 control_buttons_window_navigation:true, 60 enable_picture_download_link:true, 61 enable_picture_open_new_widow:true, 62 enable_picture_full_width:true, 63 enabled_picture_full_width:false, 64 enabled_picture_full_screen:false, 65 66 control_button_content_bacground :"#ffffff", 67 control_button_content_transparency: "0", 68 control_button_content_hover_bacground :"#00a0d2", 69 control_button_content_hover_transparency: "50", 70 71 control_button_window_bacground :"#ffffff", 72 control_button_window_transparency: "0", 73 control_button_window_hover_bacground :"#00a0d2", 74 control_button_window_hover_transparency: "50", 75 76 curent_image_width:null, 77 curent_image_height:null, 78 79 control_buttons_icon_type: "image", 80 81 control_button_content_prev_icon:'fa fa-angle-left', 82 control_button_content_next_icon:'fa fa-angle-right', 83 84 control_button_window_prev_icon:'fa fa-angle-left', 85 control_button_window_next_icon:'fa fa-angle-right', 86 87 control_button_prev_icon:'fa fa-angle-left', 88 control_button_prev_hover_icon:'fa fa-angle-left', 89 control_button_next_icon:'fa fa-angle-right', 90 control_button_next_hover_icon: 'fa fa-angle-right', 91 control_button_play_icon:'fa fa-play', 92 control_button_play_hover_icon:'fa fa-play', 93 control_button_pause_icon:'fa fa-pause', 94 control_button_pause_hover_icon:'fa fa-pause', 95 control_button_download_icon:'fa fa-download', 96 control_button_download_hover_icon:'fa fa-download', 97 control_button_innewwindow_icon:'fa fa-object-ungroup', 98 control_button_innewwindow_hover_icon:'fa fa-object-ungroup', 99 100 control_button_fullwidth_icon:'fi-arrows-expand', 101 control_button_fullwidht_hover_icon:'fi-arrows-expand', 102 control_button_fullwidthrest_icon:'fi-arrows-compress', 103 control_button_fullwidhtrest_hover_icon:'fi-arrows-compress', 104 105 control_button_fullscreen_icon:'fi-arrows-out', 106 control_button_fullscreen_hover_icon:'fi-arrows-out', 107 control_button_fullscreenrest_icon:'fi-arrows-in', 108 control_button_fullscreenrest_hover_icon:'fi-arrows-in', 109 110 control_button_close_icon:'fa fa-close', 111 control_button_close_hover_icon:'fa fa-close', 112 113 114 115 control_button_content_prev_color:'#37AAF4', 116 control_button_content_next_color:'#37AAF4', 117 118 control_button_window_prev_color:'#37AAF4', 119 control_button_window_next_color:'#37AAF4', 120 121 control_button_prev_color:'#37AAF4', 122 control_button_prev_hover_color:'#FFFFFF', 123 control_button_next_color:'#37AAF4', 124 control_button_next_hover_color:'#FFFFFF', 125 control_button_play_color:'#37AAF4', 126 control_button_play_hover_color:'#FFFFFF', 127 control_button_pause_color:'#37AAF4', 128 control_button_pause_hover_color:'#FFFFFF', 129 control_button_download_color:'#37AAF4', 130 control_button_download_hover_color:'#FFFFFF', 131 control_button_innewwindow_color:'#37AAF4', 132 control_button_innewwindow_hover_color:'#FFFFFF', 133 134 control_button_fullwidth_color:'#37AAF4', 135 control_button_fullwidht_hover_color:'#FFFFFF', 136 control_button_fullwidthrest_color:'#37AAF4', 137 control_button_fullwidhtrest_hover_color:'#FFFFFF', 138 139 control_button_fullscreen_color:'#37AAF4', 140 control_button_fullscreen_hover_color:'#FFFFFF', 141 control_button_fullscreenrest_color:'#37AAF4', 142 control_button_fullscreenrest_hover_color:'#FFFFFF', 143 144 control_button_close_color:'#37AAF4', 145 control_button_close_hover_color:'#FFFFFF', 146 147 148 control_button_next_img_src:'https://cdn3.iconfinder.com/data/icons/google-material-design-icons/48/ic_keyboard_arrow_right_48px-128.png', 149 control_button_next_hover_img_src:'https://cdn3.iconfinder.com/data/icons/google-material-design-icons/48/ic_keyboard_arrow_right_48px-128.png', 150 control_button_content_next_img_src:'https://cdn3.iconfinder.com/data/icons/google-material-design-icons/48/ic_keyboard_arrow_right_48px-128.png', 151 control_button_window_next_img_src:'https://cdn3.iconfinder.com/data/icons/google-material-design-icons/48/ic_keyboard_arrow_right_48px-128.png', 152 153 control_button_prev_img_src:'https://cdn3.iconfinder.com/data/icons/google-material-design-icons/48/ic_keyboard_arrow_left_48px-128.png', 154 control_button_prev_hover_img_src:'https://cdn3.iconfinder.com/data/icons/google-material-design-icons/48/ic_keyboard_arrow_left_48px-128.png', 155 control_button_content_prev_img_src:'https://cdn3.iconfinder.com/data/icons/google-material-design-icons/48/ic_keyboard_arrow_right_48px-128.png', 156 control_button_window_prev_img_src:'https://cdn3.iconfinder.com/data/icons/google-material-design-icons/48/ic_keyboard_arrow_right_48px-128.png', 157 158 control_button_play_img_src:'https://cdn3.iconfinder.com/data/icons/google-material-design-icons/48/ic_play_arrow_48px-128.png', 159 control_button_play_hover_img_src:'https://cdn3.iconfinder.com/data/icons/google-material-design-icons/48/ic_play_arrow_48px-128.png', 160 control_button_pause_img_src:'http://icons.iconarchive.com/icons/icons8/windows-8/128/Media-Controls-Pause-icon.png', 161 control_button_pause_hover_img_src:'http://icons.iconarchive.com/icons/icons8/windows-8/128/Media-Controls-Pause-icon.png', 162 163 control_button_download_img_src:'https://cdn4.iconfinder.com/data/icons/miu/22/circle_arrow-down_download-128.png', 164 control_button_download_hover_img_src:'https://cdn4.iconfinder.com/data/icons/miu/22/circle_arrow-down_download-128.png', 165
166 control_button_innewwindow_img_src:'http://www.rcq.gouv.qc.ca/images/design/newWindow.png', 167 control_button_innewwindow_hover_img_src:'http://www.rcq.gouv.qc.ca/images/design/newWindow.png', 168 169 170 control_button_fullwidth_img_src:"http://stories.kera.org/wp-content/themes/jrny/images/expand.png", 171 control_button_fullwidht_hover_img_src:"http://stories.kera.org/wp-content/themes/jrny/images/expand.png", 172 173 control_button_fullwidthrest_img_src:"https://cdn0.iconfinder.com/data/icons/pixon-1/24/arrows_extend_full_screen_fullscreen_minimize_resize-128.png", 174 control_button_fullwidhtrest_hover_img_src:"https://cdn0.iconfinder.com/data/icons/pixon-1/24/arrows_extend_full_screen_fullscreen_minimize_resize-128.png", 175 176 control_button_fullscreen_img_src:"https://cdn0.iconfinder.com/data/icons/seo-business-glyph-vol-2/512/Full_Screen-128.png", 177 control_button_fullscreen_hover_img_src:"https://cdn0.iconfinder.com/data/icons/seo-business-glyph-vol-2/512/Full_Screen-128.png", 178 179 control_button_fullscreenrest_img_src:"https://camo.githubusercontent.com/3db7e4c52134de6cee15716ec1adb9bc84d44f11/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f323531313334382f3733303130372f39323337633766342d653234392d313165322d396233372d3736656461306633376663362e706e67", 180 control_button_fullscreenrest_hover_img_src:"https://camo.githubusercontent.com/3db7e4c52134de6cee15716ec1adb9bc84d44f11/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f323531313334382f3733303130372f39323337633766342d653234392d313165322d396233372d3736656461306633376663362e706e67", 181 182 control_button_close_img_src:"https://cdn3.iconfinder.com/data/icons/virtual-notebook/16/button_close-128.png", 183 control_button_close_hover_img_src:"https://cdn3.iconfinder.com/data/icons/virtual-notebook/16/button_close-128.png", 184 185 186 187 control_button_ordering:'{"left":[[1,"prev"],[1,"next"],[1,"play"],[1,"download"],[1,"innewwindow"],[1,"fullwidth"],[1,"fullscreen"]],"right":[[1,"close"]]}', 188 189 keyboard_navigation:true, 190 autoplay_ids:[], 191 192 /// information line 193 194 information_panel_show:true, 195 information_panel_show_in_content:true, 196 information_panel_heght:30, 197 information_panel_bg_color:"#00a0d2", 198 199 information_panel_text_for_no_title:'No title', 200 information_panel_text_for_no_caption:'no Description', 201 202 information_panel_count_image_after_text:"image", 203 information_panel_count_image_middle_text:"of", 204 information_panel_ordering:'{"count":[1,"count"],"title":[1,"title"],"caption":[1,"caption"]}' 205 206 }, 207 /*###################################### Default Constant Variables ##########################################################*/ 208 constant_defaults:{ 209 210 // this ids conected in css.. if change anithing please change in css to... 211 parent_div_foe_mozilla_full:'parent_div_for_mozila', 212 overlay_id:'wpdevart_lb_overlay', 213 popup_window_id:'wpdevart_lb_main_window', 214 popup_window_desc_content_id:'wpdevart_lb_main_desc', 215 popup_window_information_content_id:'wpdevart_lb_information_content', 216 popup_window_pic_content_id:'wpdevart_lb_pic_content_id', 217 popup_window_first_elem_id:'wpdevart_lb_content_first_pic', 218 popup_window_second_elem_id:'wpdevart_lb_content_second_pic', 219 popup_window_loading_pic_id:'wpdevart_lb_loading_img', 220 popup_window_loading_first_pic_id:'wpdevart_lb_loading_img_first', 221 222 // description buttons 223 popup_window_description_next_button_id:'wpdevart_desc_next_img', 224 popup_window_next_content_button_id:'wpdevart_content_next_img', 225 popup_window_next_window_button_id:'wpdevart_window_next_img', 226 popup_window_description_prev_button_id:'wpdevart_desc_prev_img', 227 popup_window_prev_content_button_id:'wpdevart_content_prev_img', 228 popup_window_prev_window_button_id:'wpdevart_window_prev_img', 229 popup_window_description_play_button_id:'wpdevart_desc_play_img', 230 popup_window_description_pause_button_id:'wpdevart_desc_pause_img', 231 popup_window_description_close_button_id:'wpdevart_desc_close_img', 232 popup_window_description_enable_full_width_img_id:'wpdevart_desc_enable_full_img', 233 popup_window_description_disable_ful_width_img_id:'wpdevart_desc_disable_full_img', 234 popup_window_description_enable_full_screen_img_id:'wpdevart_desc_enable_full_screen_img', 235 popup_window_description_disable_full_screen_img_id:'wpdevart_desc_disable_full_screen_img', 236 237 /////////////////// information div elements 238 popup_window_information_count_id:'wpdevart_info_counter_of_imgs', 239 popup_window_information_title_id:'wpdevart_info_title',
240 popup_window_information_aption_id:'wpdevart_info_caption', 241 242 //////////////////////////////// 243 download_icon_id:'wpdevart_download_img', 244 open_img_in_new_window_icon_id:'wpdevart_newwindow_img', 245 246 popup_window_alternative_window_next_button_id:'wpdevart_alternativ_next', 247 popup_window_alternative_window_previous_button_id:'wpdevart_alternativ_previous', 248 249 250 }, 251 252 /*###################################### CREATE POPUP ##########################################################*/ 253 create_popup:function(element_index){ 254 var self=this 255 // disable duble open popup 256 this.defaults.popup_can_run=false; 257 var popup_window=jQuery('<div>',{id: this.constant_defaults.popup_window_id}); // popup window 258 var popup_window_parent=jQuery('<div>',{id: this.constant_defaults.parent_div_foe_mozilla_full}); // popup window 259 /* POSITION */ 260 if(this.defaults.popup_fixed_position) 261 jQuery(popup_window).css('position','fixed'); 262 else 263 jQuery(popup_window).css('position','absolute'); 264 /* Loading */ 265 if(this.defaults.popup_first_open_type=='load'){ 266 jQuery(popup_window).css('display','none'); 267 this.create_first_loading_imge(); 268 } 269 /* BORDER */ 270 jQuery(popup_window).css('border-radius',this.defaults.popup_border_radius+'px'); 271 self.generete_border(popup_window); 272 /* Control cantrol buttons */ 273 var order_popup_inside_elements=JSON.parse(this.defaults.popup_inside_element_ordering); 274 var vertical_mode='top'; 275 var vertical_pixels=0; 276 var position_of_elem=[]; 277 jQuery.each(order_popup_inside_elements,function(key, value) { 278 switch(value){ 279 case 'control_buttons' : 280 if(self.defaults.control_buttons_show){ 281 position_of_elem[0]=vertical_mode; 282 position_of_elem[1]=vertical_pixels; 283 self.create_description_panel(popup_window,position_of_elem); 284 vertical_pixels=self.defaults.control_buttons_height; 285 } 286 break; 287 case 'content' : 288 self.generete_content_popup(popup_window,position_of_elem); 289 vertical_mode='bottom'; 290 if(vertical_pixels){ 291 vertical_pixels=0; 292 } 293 else{ 294 var revers_ordering 295 if(self.defaults.information_panel_show_in_content || self.defaults.control_buttons_show_in_content){ 296 revers_ordering=order_popup_inside_elements[1]; 297 order_popup_inside_elements[1]=order_popup_inside_elements[2] 298 order_popup_inside_elements[2]=revers_ordering; 299 } 300 } 301 302 break; 303 case 'information_line' : 304 if(self.defaults.information_panel_show){ 305 position_of_elem[0]=vertical_mode; 306 position_of_elem[1]=vertical_pixels; 307 self.create_information_panel(element_index,popup_window,position_of_elem) 308 vertical_pixels=jQuery('#'+self.constant_defaults.popup_window_information_content_id).height(); 309 } 310 break; 311 } 312 }); 313 314 jQuery(popup_window_parent).prepend(popup_window); 315 jQuery('body').prepend(popup_window_parent); 316 self.start_css_for_opening_popup(popup_window); 317 // transitiony problem uni 318 self.resize_popup() 319 self.load_element_in_content(element_index) 320 }, 321 call_function_when_load_complited:function(){ 322 var self=this; 323 if(this.defaults.control_button_play_autoplay_mode && self.defaults.autoplay_ids.length==0){ 324 self.defaults.autoplay_ids.push(setTimeout(function(){self.defaults.autoplay_ids.pop();self.change_to_next_picture();},self.defaults.control_button_play_slaidshow_time+self.defaults.change_img_animation_duration)); 325 } 326 self.set_alternative_content_buttons_position(); 327 self.set_loading_image_position(); 328 }, 329 generete_border:function(element){ 330 if(this.get_correct_border(jQuery(window).width(),window.innerHeight,this.defaults.popup_border_width)){ 331 jQuery(element).css('border','solid '+this.defaults.popup_border_width+'px '+this.defaults.popup_border_color); 332 } 333 else{ 334 jQuery(element).css('border','none'); 335 } 336 }, 337 generete_content_popup:function(popup_element){ 338 var self=this; 339 var popup_window_pic_content=jQuery('<div>',{id: this.constant_defaults.popup_window_pic_content_id}); // popup picture_content main element 340 341 var popup_window_pic_loading=jQuery('<img>',{id: this.constant_defaults.popup_window_loading_pic_id,src:this.defaults.popup_loading_image}); // loading_image 342 343 jQuery(popup_window_pic_content).css('background-color',this.defaults.popup_background_color); 344 345 jQuery(popup_window_pic_loading).css('display','none'); 346 jQuery(popup_window_pic_loading).css('visibility','hidden'); 347 jQuery(popup_window_pic_loading).css('max-height','10%'); 348 jQuery(popup_window_pic_loading).css('max-width','10%'); 349 jQuery(popup_window_pic_content).append(popup_window_pic_loading); 350 351 jQuery(popup_window_pic_loading).load(function(){self.set_loading_image_position();jQuery(popup_window_pic_loading).css('visibility','visible')}); 352 353 self.alternative_navigation_buttons(popup_window_pic_content) 354 jQuery(popup_element).append(popup_window_pic_content); 355 356 }, 357 358 create_first_loading_imge:function(){ 359 var sef=this; 360 var first_loading_image= new Image(); 361 362 jQuery(first_loading_image).attr('id',this.constant_defaults.popup_window_loading_first_pic_id); 363 first_loading_image.src=this.defaults.popup_loading_image; 364 365 // append image whn is alredi is loading 366 first_loading_image.onload=function(){ 367 // if photos is loacal and loading faster than loading image 368 if(jQuery('#'+self.constant_defaults.popup_window_first_elem_id).length<1){ 369 jQuery('body').append(first_loading_image); 370 self.first_image_loading_postion(first_loading_image); 371 } 372 else{ 373 if(jQuery('#'+self.constant_defaults.popup_window_first_elem_id ).prop('nodeName')=='IFRAME'){ 374 jQuery('body').append(first_loading_image); 375 self.first_image_loading_postion(first_loading_image); 376 } 377 } 378 } 379 }, 380 381 first_image_loading_postion:function(loading_image){ 382 jQuery(loading_image).css('position','fixed'); 383 jQuery(loading_image).css('z-index','99998'); 384 jQuery(loading_image).css('max-height','15%'); 385 jQuery(loading_image).css('max-width','auto'); 386 var top=parseInt((window.innerHeight-jQuery(loading_image).height())/2); 387 var left=parseInt((jQuery(window).width()-jQuery(loading_image).width())/2); 388 jQuery(loading_image).css('left',left+'px'); 389 jQuery(loading_image).css('top',top+'px'); 390 }, 391 392 remove_first_loading_image:function(loading_element){ 393 if(jQuery('#'+this.constant_defaults.popup_window_loading_first_pic_id).length>0) 394 jQuery('#'+this.constant_defaults.popup_window_loading_first_pic_id).remove(); 395 }, 396 397 start_css_for_opening_popup:function(element_for_cssing){ 398 var self=this; 399 jQuery(element_for_cssing).css('-webkit-animation-duration',this.defaults.popup_animation_time +'ms'); 400 jQuery(element_for_cssing).css('animation-duration',this.defaults.popup_animation_time +'ms'); 401 jQuery(element_for_cssing).addClass(this.defaults.popup_animation_type); 402 setTimeout(function(element_for_cssing){jQuery('#'+self.constant_defaults.popup_window_id).removeClass(self.defaults.popup_animation_type);},this.defaults.popup_animation_time) 403 404 }, 405 406 end_css_for_opening_popup:function(element_for_cssing){ 407 jQuery(element_for_cssing).css('-webkit-animation-duration',this.defaults.popup_animation_time+200 +'ms'); 408 jQuery(element_for_cssing).css('animation-duration',this.defaults.popup_animation_time+200 +'ms'); 409 jQuery(element_for_cssing).addClass(this.defaults.popup_animation_type+'_remove'); 410 }, 411
412 /*###################################### Craeate control buttons ##########################################################*/ 413 /*###################################### Craeate control buttons ##########################################################*/ 414 /*###################################### Craeate control buttons ##########################################################*/ 415 /*###################################### Craeate control buttons ##########################################################*/ 416 417 create_description_panel:function(parnet_element,position_of_elem){ 418 var self=this; 419 var popup_window_desc=jQuery('<div>',{id: this.constant_defaults.popup_window_desc_content_id}); // popup description main element 420 popup_window_desc.css('height',this.defaults.control_buttons_height); 421 popup_window_desc.css('width',this.defaults.window_description_initial_width); 422 popup_window_desc.css('background-color',this.defaults.control_buttons_line_bg_color); 423 if(this.defaults.control_buttons_show_in_content){ 424 popup_window_desc.css('position','absolute'); 425 popup_window_desc.css('z-index','9999999'); 426 if(position_of_elem[1]==null) 427 setTimeout(function(){popup_window_desc.css(position_of_elem[0],jQuery('#'+self.constant_defaults.popup_window_information_content_id).height())},100); 428 else 429 popup_window_desc.css(position_of_elem[0],position_of_elem[1]); 430 } 431 432 jQuery(parnet_element).append(popup_window_desc); 433 434 this.create_descriptions_buttons(popup_window_desc); 435 436 }, 437 438 create_descriptions_buttons:function(element){ 439 var self=this; 440 if(this.defaults.control_buttons_icon_type==='image'){ 441 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 442 443 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 444 445 var play_button=jQuery('<img>',{id: this.constant_defaults.popup_window_description_play_button_id,src:this.defaults.control_button_play_img_src}); // play button 446 var pause_button=jQuery('<img>',{id: this.constant_defaults.popup_window_description_pause_button_id,src:this.defaults.control_button_pause_img_src}); // pause button 447 448 var download_link=jQuery('<img>',{id: this.constant_defaults.download_icon_id,src:this.defaults.control_button_download_img_src}); // pause button 449 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 450 451 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 452 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 453 454 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 455 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 456 457 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 458 }else{ 459 var next_button=jQuery('<i></i>',{id: this.constant_defaults.popup_window_description_next_button_id,class:this.defaults.control_button_next_icon}); // next button 460 461 var prev_button=jQuery('<i></i>',{id: this.constant_defaults.popup_window_description_prev_button_id,class:this.defaults.control_button_prev_icon}); // previus button 462 463 var play_button=jQuery('<i></i>',{id: this.constant_defaults.popup_window_description_play_button_id,class:this.defaults.control_button_play_icon}); // play button 464 var pause_button=jQuery('<i></i>',{id: this.constant_defaults.popup_window_description_pause_button_id,class:this.defaults.control_button_pause__icon}); // pause button 465 466 var download_link=jQuery('<i></i>',{id: this.constant_defaults.download_icon_id,class:this.defaults.control_button_download_icon}); // pause button 467 var new_window_link=jQuery('<i></i>',{id: this.constant_defaults.open_img_in_new_window_icon_id,class:this.defaults.control_button_innewwindow_icon}); // pause button 468 469 var enable_full_width=jQuery('<i></i>',{id: this.constant_defaults.popup_window_description_enable_full_width_img_id,class:this.defaults.control_button_fullwidth_icon}); // enable_full 470 var disable_full_width=jQuery('<i></i>',{id: this.constant_defaults.popup_window_description_disable_ful_width_img_id,class:this.defaults.control_button_fullwidthrest_icon}); // disable full 471 472 var enable_full_screen=jQuery('<i></i>',{id: this.constant_defaults.popup_window_description_enable_full_screen_img_id,class:this.defaults.control_button_fullscreen_icon}); // enable_full 473 var disable_full_screen=jQuery('<i></i>',{id: this.constant_defaults.popup_window_description_disable_full_screen_img_id,class:this.defaults.control_button_fullscreenrest_icon}); // disable full 474 475 var close_button=jQuery('<i></i>',{id: this.constant_defaults.popup_window_description_close_button_id,class:this.defaults.control_button_close_icon}); // pause button 476 } 477 478 jQuery(pause_button).css('display','none'); 479 jQuery(disable_full_width).css('display','none'); 480 jQuery(disable_full_screen).css('display','none'); 481 jQuery(close_button).css('float','right'); 482 jQuery(next_button).click(function(){ 483 self.change_to_next_picture(); 484 }) 485 486 if(this.defaults.control_buttons_icon_type==='image'){ 487 jQuery(next_button).hover( 488 function(){ 489 jQuery(this).attr('src',self.defaults.control_button_next_hover_img_src); 490 }, 491 function(){ 492 jQuery(this).attr('src',self.defaults.control_button_next_img_src); 493 } 494 ) 495 }else{ 496 jQuery(next_button).hover( 497 function(){ 498 jQuery(this).attr('class',self.defaults.control_button_next_hover_icon); 499 }, 500 function(){ 501 jQuery(this).attr('class',self.defaults.control_button_next_icon); 502 } 503 ) 504 } 505 jQuery(prev_button).click(function(){ 506 self.change_to_previus_picture(); 507 }) 508 if(this.defaults.control_buttons_icon_type==='image'){ 509 jQuery(prev_button).hover( 510 function(){ 511 jQuery(this).attr('src',self.defaults.control_button_prev_hover_img_src); 512 }, 513 function(){ 514 jQuery(this).attr('src',self.defaults.control_button_prev_img_src); 515 } 516 ) 517 }else{ 518 jQuery(prev_button).hover( 519 function(){ 520 jQuery(this).attr('class',self.defaults.control_button_prev_hover_icon); 521 }, 522 function(){ 523 jQuery(this).attr('class',self.defaults.control_button_prev_icon); 524 } 525 ) 526 } 527 jQuery(play_button).click(function(){
528 self.defaults.control_button_play_autoplay_mode=true; 529 self.autoplay(); 530 }) 531 if(this.defaults.control_buttons_icon_type==='image'){ 532 jQuery(play_button).hover( 533 function(){ 534 jQuery(this).attr('src',self.defaults.control_button_play_hover_img_src); 535 }, 536 function(){ 537 jQuery(this).attr('src',self.defaults.control_button_play_img_src); 538 } 539 ) 540 }else{ 541 jQuery(play_button).hover( 542 function(){ 543 jQuery(this).attr('class',self.defaults.control_button_play_hover_icon); 544 }, 545 function(){ 546 jQuery(this).attr('class',self.defaults.control_button_play_icon); 547 } 548 ) 549 } 550 jQuery(pause_button).click(function(){ 551 self.defaults.control_button_play_autoplay_mode=false; 552 self.pause(); 553 }) 554 if(this.defaults.control_buttons_icon_type==='image'){ 555 jQuery(pause_button).hover( 556 function(){ 557 jQuery(this).attr('src',self.defaults.control_button_pause_hover_img_src); 558 }, 559 function(){ 560 jQuery(this).attr('src',self.defaults.control_button_pause_img_src); 561 } 562 ) 563 }else{ 564 jQuery(pause_button).hover( 565 function(){ 566 jQuery(this).attr('class',self.defaults.control_button_pause_hover_icon); 567 }, 568 function(){ 569 jQuery(this).attr('class',self.defaults.control_button_pause_icon); 570 } 571 ) 572 } 573 574 jQuery(download_link).click(function(){ 575 self.download_img(); 576 }) 577 if(this.defaults.control_buttons_icon_type==='image'){ 578 jQuery(download_link).hover( 579 function(){ 580 jQuery(this).attr('src',self.defaults.control_button_download_hover_img_src); 581 }, 582 function(){ 583 jQuery(this).attr('src',self.defaults.control_button_download_img_src); 584 } 585 ) 586 }else{ 587 jQuery(download_link).hover( 588 function(){ 589 jQuery(this).attr('class',self.defaults.control_button_download_hover_icon); 590 }, 591 function(){ 592 jQuery(this).attr('class',self.defaults.control_button_download_icon); 593 } 594 ) 595 } 596 597 598 jQuery(new_window_link).click(function(){ 599 self.open_in_new_window_img(); 600 }) 601 if(this.defaults.control_buttons_icon_type==='image'){ 602 jQuery(new_window_link).hover( 603 function(){ 604 jQuery(this).attr('src',self.defaults.control_button_innewwindow_hover_img_src); 605 }, 606 function(){ 607 jQuery(this).attr('src',self.defaults.control_button_innewwindow_img_src); 608 } 609 ) 610 }else{ 611 jQuery(new_window_link).hover( 612 function(){ 613 jQuery(this).attr('class',self.defaults.control_button_innewwindow_hover_icon); 614 }, 615 function(){ 616 jQuery(this).attr('class',self.defaults.control_button_innewwindow_icon); 617 } 618 ) 619 } 620 jQuery(enable_full_width).click(function(){ 621 self.enable_popup_full_width(); 622 }) 623 if(this.defaults.control_buttons_icon_type==='image'){ 624 jQuery(enable_full_width).hover( 625 function(){ 626 jQuery(this).attr('src',self.defaults.control_button_fullwidht_hover_img_src); 627 }, 628 function(){ 629 jQuery(this).attr('src',self.defaults.control_button_fullwidth_img_src); 630 } 631 ) 632 }else{ 633 jQuery(enable_full_width).hover( 634 function(){ 635 jQuery(this).attr('class',self.defaults.control_button_fullwidht_hover_icon); 636 }, 637 function(){ 638 jQuery(this).attr('class',self.defaults.control_button_fullwidth_icon); 639 } 640 ) 641 } 642 jQuery(disable_full_width).click(function(){ 643 self.disable_popup_full_width(); 644 }) 645 if(this.defaults.control_buttons_icon_type==='image'){ 646 jQuery(disable_full_width).hover( 647 function(){ 648 jQuery(this).attr('src',self.defaults.control_button_fullwidhtrest_hover_img_src); 649 }, 650 function(){ 651 jQuery(this).attr('src',self.defaults.control_button_fullwidthrest_img_src); 652 } 653 ) 654 }else{ 655 jQuery(disable_full_width).hover( 656 function(){ 657 jQuery(this).attr('class',self.defaults.control_button_fullwidhtrest_hover_icon); 658 }, 659 function(){ 660 jQuery(this).attr('class',self.defaults.control_button_fullwidthrest_img_icon); 661 } 662 ) 663 } 664 665 jQuery(enable_full_screen).click(function(){ 666 self.check_and_set_full_screen(true); 667 }) 668 if(this.defaults.control_buttons_icon_type==='image'){ 669 jQuery(enable_full_screen).hover( 670 function(){ 671 jQuery(this).attr('src',self.defaults.control_button_fullscreen_hover_img_src); 672 }, 673 function(){ 674 jQuery(this).attr('src',self.defaults.control_button_fullscreen_img_src); 675 } 676 ) 677 }else{ 678 jQuery(enable_full_screen).hover( 679 function(){ 680 jQuery(this).attr('class',self.defaults.control_button_fullscreen_hover_icon); 681 }, 682 function(){ 683 jQuery(this).attr('class',self.defaults.control_button_fullscreen_icon); 684 } 685 ) 686 } 687 jQuery(disable_full_screen).click(function(){ 688 self.check_and_set_full_screen(false); 689 }) 690 if(this.defaults.control_buttons_icon_type==='image'){ 691 jQuery(disable_full_screen).hover( 692 function(){ 693 jQuery(this).attr('src',self.defaults.control_button_fullscreenrest_hover_img_src); 694 }, 695 function(){ 696 jQuery(this).attr('src',self.defaults.control_button_fullscreenrest_img_src); 697 } 698 ) 699 }else{ 700 jQuery(disable_full_screen).hover( 701 function(){ 702 jQuery(this).attr('class',self.defaults.control_button_fullscreenrest_hover_icon); 703 }, 704 function(){ 705 jQuery(this).attr('class',self.defaults.control_button_fullscreenrest_icon); 706 } 707 ) 708 } 709 jQuery(close_button).click(function(){ 710 self.remove_overlay(); 711 }) 712 if(this.defaults.control_buttons_icon_type==='image'){ 713 jQuery(close_button).hover( 714 function(){ 715 jQuery(this).attr('src',self.defaults.control_button_close_hover_img_src); 716 }, 717 function(){ 718 jQuery(this).attr('src',self.defaults.control_button_close_img_src); 719 } 720 ) 721 }else{ 722 jQuery(close_button).hover( 723 function(){ 724 jQuery(this).attr('class',self.defaults.control_button_close_hover_icon); 725 }, 726 function(){ 727 jQuery(this).attr('class',self.defaults.control_button_close_icon); 728 } 729 ) 730 } 731 732 ordering_object=JSON.parse(this.defaults.control_button_ordering); 733 jQuery.each(ordering_object,function(key,value){ 734 var ordering=key; 735 jQuery.each(value,function(key,value){ 736 if(value[0]) 737 switch(value[1]){ 738 case 'prev': 739 jQuery(element).append(prev_button) 740 if(ordering=='left') 741 jQuery(prev_button).css('float',ordering) 742 break 743 case 'next': 744 jQuery(element).append(next_button) 745 if(ordering=='left') 746 jQuery(next_button).css('float',ordering) 747 break 748 case 'play': 749 jQuery(element).append(play_button) 750 jQuery(element).append(pause_button) 751 if(ordering=='left'){ 752 jQuery(play_button).css('float',ordering) 753 jQuery(pause_button).css('float',ordering) 754 } 755 break 756 case 'download': 757 jQuery(element).append(download_link) 758 if(ordering=='left') 759 jQuery(download_link).css('float',ordering) 760 break 761 case 'innewwindow': 762 jQuery(element).append(new_window_link) 763 if(ordering=='left') 764 jQuery(new_window_link).css('float',ordering) 765 break 766 case 'fullwidth': 767 jQuery(element).append(enable_full_width) 768 jQuery(element).append(disable_full_width) 769 if(ordering=='left'){ 770 jQuery(enable_full_width).css('float',ordering) 771 jQuery(disable_full_width).css('float',ordering) 772 } 773 break 774 case 'fullscreen': 775 jQuery(element).append(enable_full_screen) 776 jQuery(element).append(disable_full_screen) 777 if(ordering=='left'){ 778 jQuery(enable_full_screen).css('float',ordering) 779 jQuery(disable_full_screen).css('float',ordering) 780 } 781 break 782 case 'close': 783 jQuery(element).append(close_button) 784 if(ordering=='left') 785 jQuery(close_button).css('float',ordering) 786 break 787 } 788 }) 789 }) 790 }, 791 792 /// functionality for buttons 793 change_to_next_picture:function(){ 794 var self=this; 795 if(jQuery('#'+self.constant_defaults.popup_window_second_elem_id).length){ 796 return; 797 } 798 next_pic_index=parseInt((self.defaults.current_img_index+1)%self.defaults.elem_array.length); 799 this.load_element_in_content(next_pic_index) 800 }, 801 change_to_previus_picture:function(){ 802 var self=this; 803 if(jQuery('#'+self.constant_defaults.popup_window_second_elem_id).length){ 804 return 805 } 806 prev_pic_index=(self.defaults.current_img_index-1); 807 if(prev_pic_index<0) 808 prev_pic_index=self.defaults.elem_array.length-1; 809 self.load_element_in_content(prev_pic_index) 810 }, 811 autoplay:function(){ 812 var self = this;
813 this.defaults.control_button_play_autoplay_mode=true; 814 jQuery('#'+this.constant_defaults.popup_window_description_play_button_id).css('display','none'); 815 jQuery('#'+this.constant_defaults.popup_window_description_pause_button_id).css('display','inline-block'); 816 if(jQuery('#'+self.constant_defaults.popup_window_second_elem_id).length){ 817 return; 818 } 819 if(self.defaults.autoplay_ids.length>=1){ 820 return; 821 } 822 self.change_to_next_picture(); 823 }, 824 pause:function(){ 825 var self=this; 826 jQuery('#'+this.constant_defaults.popup_window_description_play_button_id).css('display','inline-block'); 827 jQuery('#'+this.constant_defaults.popup_window_description_pause_button_id).css('display','none'); 828 this.defaults.control_button_play_autoplay_mode=false; 829 var last_loaded_id=self.defaults.autoplay_ids.pop(); 830 clearTimeout(last_loaded_id); 831 832 }, 833 834 download_img:function(){ 835 var self=this; 836 donwloaded_hiperlink = jQuery("<a>").attr("href", jQuery(self.defaults.elem_array[self.defaults.current_img_index][0]).attr('href')).attr("download", ".img").appendTo("body"); 837 donwloaded_hiperlink[0].click(); 838 donwloaded_hiperlink.remove(); 839 }, 840 841 open_in_new_window_img:function(){ 842 var self=this; 843 donwloaded_hiperlink = jQuery("<a>").attr("href", jQuery(self.defaults.elem_array[self.defaults.current_img_index][0]).attr('href')).attr("target", "_blank").appendTo("body"); 844 donwloaded_hiperlink[0].click(); 845 donwloaded_hiperlink.remove(); 846 }, 847 848 enable_popup_full_width:function(){ 849 var self=this; 850 jQuery('#'+this.constant_defaults.popup_window_description_disable_ful_width_img_id).css('display','inline-block'); 851 jQuery('#'+this.constant_defaults.popup_window_description_enable_full_width_img_id).css('display','none'); 852 this.defaults.enabled_picture_full_width=true; 853 this.resize_popup(); 854 }, 855 856 disable_popup_full_width:function(){ 857 var self=this; 858 jQuery('#'+this.constant_defaults.popup_window_description_enable_full_width_img_id).css('display','inline-block'); 859 jQuery('#'+this.constant_defaults.popup_window_description_disable_ful_width_img_id).css('display','none'); 860 this.defaults.enabled_picture_full_width=false; 861 this.resize_popup(); 862 863 }, 864 check_and_set_full_screen:function(enabled){ 865 var self=this; 866 if(enabled == true){ 867 this.defaults.enabled_picture_full_screen=true; 868 if(!this.defaults.enabled_picture_full_width); 869 this.enable_popup_full_width() 870 this.defaults.wordpress_admin_bar_height=0; 871 jQuery('#'+this.constant_defaults.popup_window_description_disable_full_screen_img_id).css('display','inline-block'); 872 jQuery('#'+this.constant_defaults.popup_window_description_enable_full_screen_img_id).css('display','none'); 873 this.fullscreen(true); 874 } 875 if(enabled == false){ 876 this.defaults.enabled_picture_full_screen=false; 877 if(this.defaults.enabled_picture_full_width); 878 this.disable_popup_full_width() 879 this.defaults.wordpress_admin_bar_height=jQuery('#wpadminbar').height(); 880 881 jQuery('#'+this.constant_defaults.popup_window_description_disable_full_screen_img_id).css('display','none'); 882 jQuery('#'+this.constant_defaults.popup_window_description_enable_full_screen_img_id).css('display','inline-block'); 883 this.fullscreen(false); 884 } 885 if(enabled == 'undefined'){ 886 var fullScreen_mode = document.fullscreenEnabled || document.mozFullScreen || document.webkitIsFullScreen ? true : false; 887 if(fullScreen_mode){ 888 if(!this.defaults.enabled_picture_full_width); 889 this.enable_popup_full_width() 890 this.defaults.wordpress_admin_bar_height=0; 891 this.defaults.enabled_picture_full_screen=true; 892 jQuery('#'+this.constant_defaults.popup_window_description_disable_full_screen_img_id).css('display','inline-block'); 893 jQuery('#'+this.constant_defaults.popup_window_description_enable_full_screen_img_id).css('display','none'); 894 }else{ 895 if(this.defaults.enabled_picture_full_width); 896 this.disable_popup_full_width() 897 this.defaults.wordpress_admin_bar_height=jQuery('#wpadminbar').height(); 898 jQuery('#'+this.constant_defaults.popup_window_description_disable_full_screen_img_id).css('display','none'); 899 jQuery('#'+this.constant_defaults.popup_window_description_enable_full_screen_img_id).css('display','inline-block'); 900 this.defaults.enabled_picture_full_screen=false; 901 902 } 903 } 904 this.resize_popup(); 905 }, 906 907 fullscreen:function(full){ 908 var element=document.getElementById(this.constant_defaults.parent_div_foe_mozilla_full) 909 if(full){ 910 if(element.requestFullScreen) { 911 element.requestFullScreen(); 912 } else if(element.mozRequestFullScreen) { 913 element.mozRequestFullScreen(); 914 } else if(element.webkitRequestFullScreen) { 915 element.webkitRequestFullScreen(); 916 }else if(element.msRequestFullscreen) { 917 element.msRequestFullscreen(); 918 } 919 }else{ 920 if(document.cancelFullScreen) { 921 document.cancelFullScreen(); 922 } else if(document.mozCancelFullScreen) { 923 document.mozCancelFullScreen(); 924 } else if(document.webkitCancelFullScreen) { 925 document.webkitCancelFullScreen(); 926 }else if(document.msExitFullscreen) { 927 document.msExitFullscreen(); 928 } 929 } 930 931 932 }, 933 934 keyboard_navigation:function(is_enable){ 935 var self=this; 936 if(is_enable){ 937 jQuery(document).keyup(function(e) { 938 if(e.keyCode ==37) 939 self.change_to_previus_picture() 940 if(e.keyCode ==39) 941 self.change_to_next_picture() 942 943 }) 944 945 } 946 }, 947 948 949 /*###################################### Alternative Navigation Buttons ##########################################################*/ 950 /*###################################### Alternative Navigation Buttons ##########################################################*/ 951 /*###################################### Alternative Navigation Buttons ##########################################################*/ 952 /*###################################### Alternative Navigation Buttons ##########################################################*/ 953 954 955 alternative_navigation_buttons:function(content_element){ 956 var self=this; 957 if(this.defaults.control_buttons_content_navigation){ 958 959 if(this.defaults.control_buttons_icon_type==='image'){ 960 var next_button_content= new Image(); 961 var prev_button_content= new Image(); 962 jQuery([next_button_content,prev_button_content]).css('z-index','9999'); 963 jQuery([next_button_content,prev_button_content]).css('position','absolute'); 964 jQuery([next_button_content,prev_button_content]).css('cursor','pointer'); 965 jQuery([next_button_content,prev_button_content]).css('max-height','15%'); 966 jQuery([next_button_content,prev_button_content]).css('max-width','auto'); 967 jQuery([next_button_content,prev_button_content]).css('width','auto'); 968 969 }else{ 970 var next_button_content= document.createElement("i"); 971 var prev_button_content= document.createElement("i"); 972 jQuery(next_button_content).addClass(this.defaults.control_button_content_next_icon); 973 jQuery(prev_button_content).addClass(this.defaults.control_button_content_prev_icon); 974 jQuery(next_button_content).css('color',this.defaults.control_button_content_next_color); 975 jQuery(prev_button_content).css('color',this.defaults.control_button_content_prev_color); 976 jQuery([next_button_content,prev_button_content]).css('text-align','center'); 977 jQuery([next_button_content,prev_button_content]).css('z-index','9999'); 978 jQuery([next_button_content,prev_button_content]).css('position','absolute'); 979 jQuery([next_button_content,prev_button_content]).css('cursor','pointer'); 980 jQuery([next_button_content,prev_button_content]).css('padding','1%'); 981 982 } 983 next_button_content.setAttribute('id',this.constant_defaults.popup_window_next_content_button_id); 984 prev_button_content.setAttribute('id',this.constant_defaults.popup_window_prev_content_button_id); 985 986 jQuery([next_button_content,prev_button_content]).css('background-color',self.hexToRgbA(self.defaults.control_button_content_bacground,(self.defaults.control_button_content_transparency/100))) 987 988 self.set_alternative_content_buttons_position(prev_button_content,next_button_content); 989 990 if(self.defaults.control_buttons_content_navigation_hover){ 991 jQuery(prev_button_content).css('visibility','hidden'); 992 jQuery(next_button_content).css('visibility','hidden'); 993 jQuery(content_element).hover( 994 function(){ 995 jQuery(prev_button_content).css('visibility','visible'); 996 jQuery(next_button_content).css('visibility','visible'); 997 }, 998 function(){ 999 jQuery(prev_button_content).css('visibility','hidden'); 1000 jQuery(next_button_content).css('visibility','hidden'); 1001 } 1002 ) 1003 } 1004 jQuery([next_button_content,prev_button_content]).hover( 1005 function(){ 1006 jQuery(this).css('background-color',self.hexToRgbA(self.defaults.control_button_content_hover_bacground,(self.defaults.control_button_content_hover_transparency/100))) 1007 }, 1008 function(){ 1009 jQuery(this).css('background-color',self.hexToRgbA(self.defaults.control_button_content_bacground,(self.defaults.control_button_content_transparency/100))) 1010 } 1011 ); 1012 if(this.defaults.control_buttons_icon_type==='image'){ 1013 next_button_content.src=self.defaults.control_button_content_next_img_src; 1014 next_button_content.onload=function(){ 1015 self.set_alternative_content_buttons_position(prev_button_content,next_button_content); 1016 } 1017 prev_button_content.src=self.defaults.control_button_content_prev_img_src; 1018 prev_button_content.onload=function(){ 1019 self.set_alternative_content_buttons_position(prev_button_content,next_button_content); 1020 } 1021 } 1022 jQuery(content_element).append(prev_button_content); 1023 jQuery(content_element).append(next_button_content); 1024 self.set_alternative_content_buttons_position(prev_button_content,next_button_content); 1025 jQuery(next_button_content).click(function(){self.change_to_next_picture();}); 1026 jQuery(prev_button_content).click(function(){self.change_to_previus_picture();}); 1027 } 1028 if(this.defaults.control_buttons_window_navigation){ 1029 if(this.defaults.control_buttons_icon_type==='image'){ 1030 var next_button_window= new Image(); 1031 var prev_button_window= new Image(); 1032 jQuery([next_button_window,prev_button_window]).css('z-index','99999'); 1033 jQuery([next_button_window,prev_button_window]).css('position','fixed'); 1034 jQuery([next_button_window,prev_button_window]).css('cursor','pointer'); 1035 jQuery([next_button_window,prev_button_window]).css('max-height','15%'); 1036 jQuery([next_button_window,prev_button_window]).css('max-width','auto'); 1037 jQuery([next_button_window,prev_button_window]).css('width','auto'); 1038 1039 }else{ 1040 var next_button_window= document.createElement("i"); 1041 var prev_button_window= document.createElement("i"); 1042 jQuery(next_button_window).addClass(this.defaults.control_button_window_next_icon); 1043 jQuery(prev_button_window).addClass(this.defaults.control_button_window_prev_icon); 1044 jQuery(next_button_window).css('color',this.defaults.control_button_window_next_color); 1045 jQuery(prev_button_window).css('color',this.defaults.control_button_window_prev_color); 1046 jQuery([next_button_window,prev_button_window]).css('text-align','center'); 1047 jQuery([next_button_window,prev_button_window]).css('position','fixed'); 1048 jQuery([next_button_window,prev_button_window]).css('z-index','9999'); 1049 jQuery([next_button_window,prev_button_window]).css('cursor','pointer'); 1050 jQuery([next_button_window,prev_button_window]).css('padding','1%'); 1051 } 1052 1053 next_button_window.setAttribute('id',this.constant_defaults.popup_window_next_window_button_id); 1054 prev_button_window.setAttribute('id',this.constant_defaults.popup_window_prev_window_button_id); 1055 1056 jQuery([next_button_window,prev_button_window]).css('background-color',self.hexToRgbA(self.defaults.control_button_window_bacground,(self.defaults.control_button_window_transparency/100))) 1057 1058 jQuery([next_button_window,prev_button_window]).hover( 1059 function(){ 1060 jQuery(this).css('background-color',self.hexToRgbA(self.defaults.control_button_window_hover_bacground,(self.defaults.control_button_window_hover_transparency/100))) 1061 }, 1062 function(){ 1063 jQuery(this).css('background-color',self.hexToRgbA(self.defaults.control_button_window_bacground,(self.defaults.control_button_window_transparency/100))) 1064 } 1065 ); 1066 1067 if(this.defaults.control_buttons_icon_type==='image'){ 1068 next_button_window.src=this.defaults.control_button_window_next_img_src; 1069 next_button_window.onload=function(){ 1070 self.set_alternative_window_buttons_position(prev_button_window,next_button_window); 1071 } 1072 prev_button_window.src=this.defaults.control_button_window_prev_img_src; 1073 next_button_window.onload=function(){ 1074 self.set_alternative_window_buttons_position(prev_button_window,next_button_window); 1075 } 1076 } 1077 1078 if(this.defaults.overlay_fade_efect){ 1079 jQuery(next_button_window).css('opacity','0'); 1080 jQuery(prev_button_window).css('opacity','0'); 1081 jQuery(next_button_window).css('transition','opacity '+self.defaults.overlay_fade_efect_time+'ms'); 1082 jQuery(prev_button_window).css('transition','opacity '+self.defaults.overlay_fade_efect_time+'ms'); 1083 jQuery(prev_button_window).css('opacity','0'); 1084 setTimeout(function(){jQuery(next_button_window).css('opacity','1');},30) 1085 setTimeout(function(){jQuery(prev_button_window).css('opacity','1');},30) 1086 1087 } 1088 jQuery('body').append(prev_button_window) 1089 jQuery('body').append(next_button_window) 1090 self.set_alternative_window_buttons_position(prev_button_window,next_button_window); 1091 jQuery(next_button_window).click(function(e){ self.change_to_next_picture(); }); 1092 jQuery(prev_button_window).click(function(e){ self.change_to_previus_picture(); }); 1093 } 1094 }, 1095 set_alternative_window_buttons_position:function(left_button,right_button){ 1096 1097 jQuery(left_button).css('left','0px'); 1098 jQuery(right_button).css('right','0px'); 1099 if(this.defaults.control_buttons_icon_type==='image'){ 1100 jQuery(left_button).css('top',parseInt((window.innerHeight-jQuery(left_button).height())/2)+'px') 1101 jQuery(right_button).css('top',parseInt((window.innerHeight-jQuery(right_button).height())/2)+'px') 1102 }else{ 1103 jQuery(left_button).css('font-size',parseInt(window.innerHeight*0.1)+'px') 1104 jQuery(right_button).css('font-size',parseInt(window.innerHeight*0.1)+'px') 1105 jQuery(left_button).width(jQuery(left_button).height()) 1106 jQuery(right_button).width(jQuery(right_button).height()) 1107 jQuery(left_button).css('top',parseInt((window.innerHeight-jQuery(left_button).outerHeight())/2)+'px') 1108 jQuery(right_button).css('top',parseInt((window.innerHeight-jQuery(right_button).outerHeight())/2)+'px') 1109 } 1110 1111 }, 1112 set_alternative_content_buttons_position:function(){ 1113 var self=this; 1114 var left_button =jQuery('#'+self.constant_defaults.popup_window_prev_content_button_id); 1115 var right_button =jQuery('#'+self.constant_defaults.popup_window_next_content_button_id); 1116 1117 if(left_button.length>0 && right_button.length>0){ 1118 jQuery(left_button).css('left','0px'); 1119 jQuery(right_button).css('right','0px'); 1120 if(this.defaults.control_button_change_image_effect=='fade_elastic'){ 1121 var css_parametrs='left '+self.defaults.change_img_animation_duration+'ms, top '+self.defaults.change_img_animation_duration+'ms'; 1122 jQuery(left_button).css('transition',css_parametrs); // add opaciti animation 1123 jQuery(right_button).css('transition',css_parametrs); // add opaciti animation 1124 } 1125 if(this.defaults.control_buttons_icon_type==='image'){ 1126 jQuery(left_button).css('top',parseInt((this.defaults.popup_window_demision[2]-Math.min(document.getElementById(self.constant_defaults.popup_window_prev_content_button_id).naturalHeight,(this.defaults.popup_window_demision[2]*0.15)))/2)+'px') 1127 jQuery(right_button).css('top',parseInt((this.defaults.popup_window_demision[2]-Math.min(document.getElementById(self.constant_defaults.popup_window_next_content_button_id).naturalHeight,(this.defaults.popup_window_demision[2]*0.15)))/2)+'px') 1128 }else{ 1129 jQuery(left_button
1129).css('font-size',Math.min(parseInt(this.defaults.popup_window_demision[2]*0.1), 54)+'px') 1130 jQuery(right_button).css('font-size',Math.min(parseInt(this.defaults.popup_window_demision[2]*0.1), 54)+'px') 1131 jQuery(left_button).width(jQuery(left_button).height()) 1132 jQuery(right_button).width(jQuery(right_button).height()) 1133 jQuery(left_button).css('top',parseInt((this.defaults.popup_window_demision[2]-jQuery(left_button).outerHeight())/2)+'px') 1134 jQuery(right_button).css('top',parseInt((this.defaults.popup_window_demision[2]-jQuery(left_button).outerHeight())/2)+'px') 1135 } 1136 } 1137 }, 1138 1139 remove_alternate_window_button:function(){ 1140 var self=this; 1141 if(this.defaults.control_buttons_window_navigation){ 1142 if(this.defaults.overlay_fade_efect){ 1143 jQuery('#'+self.constant_defaults.popup_window_prev_window_button_id).css('opacity','0'); 1144 jQuery('#'+self.constant_defaults.popup_window_next_window_button_id).css('opacity','0'); 1145 setTimeout(function(){jQuery('#'+self.constant_defaults.popup_window_prev_window_button_id).remove(); jQuery('#'+self.constant_defaults.popup_window_next_window_button_id).remove(); },self.defaults.overlay_fade_efect_time); 1146 } 1147 else{ 1148 jQuery('#'+self.constant_defaults.popup_window_prev_window_button_id).remove(); 1149 jQuery('#'+self.constant_defaults.popup_window_next_window_button_id).remove(); 1150 } 1151 } 1152 }, 1153 1154 /*###################################### Create Information Panel ##########################################################*/ 1155 /*###################################### Create Information Panel ##########################################################*/ 1156 /*###################################### Create Information Panel ##########################################################*/ 1157 /*###################################### Create Information Panel ##########################################################*/ 1158 1159 create_information_panel:function(element_index,popup_element,position_of_elem){ 1160 var self=this; 1161 if(!this.defaults.information_panel_show) 1162 return; //when disabled information panel 1163 var information_main=jQuery('<div>',{id: self.constant_defaults.popup_window_information_content_id}); 1164 var count_images=jQuery('<span>',{id: this.constant_defaults.popup_window_information_count_id}); 1165 var title_image=jQuery('<span>',{id: this.constant_defaults.popup_window_information_title_id}); 1166 var caption_image=jQuery('<span>',{id: this.constant_defaults.popup_window_information_aption_id}); 1167 if(this.defaults.information_panel_show_in_content){ 1168 information_main.css('position','absolute'); 1169 information_main.css('z-index','9999999'); 1170 information_main.css(position_of_elem[0],position_of_elem[1]); 1171 } 1172 1173 //information_main.css('height',this.defaults.information_panel_heght) 1174 information_main.css('background-color',this.defaults.information_panel_bg_color) 1175 1176 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; 1177 var text_of_title_image=self.defaults.elem_array[element_index][1] 1178 var text_of_caption_image=self.defaults.elem_array[element_index][2] 1179 if(text_of_caption_image==null){ 1180 text_of_caption_image=self.defaults.information_panel_text_for_no_caption; 1181 } 1182 if(text_of_title_image==null){ 1183 text_of_title_image=self.defaults.information_panel_text_for_no_title; 1184 } 1185 if(self.defaults.elem_array[element_index][1]==null && this.defaults.information_panel_desc_show_if_not==false){ 1186 jQuery(title_image).hide(); 1187 } 1188 if(self.defaults.elem_array[element_index][2]==null && this.defaults.information_panel_title_show_if_not==false){ 1189 jQuery(title_image).hide(); 1190 } 1191 ordering_object=JSON.parse(this.defaults.information_panel_ordering); 1192 jQuery.each(ordering_object,function(key,value){ 1193 if(value[0]) 1194 switch(value[1]){ 1195 case 'count': 1196 jQuery(count_images).html(text_of_count_images); 1197 jQuery(information_main).append(count_images); 1198 break 1199 case 'title': 1200 jQuery(title_image).html(text_of_title_image); 1201 jQuery(information_main).append(title_image); 1202 break 1203 case 'caption': 1204 jQuery(caption_image).html(text_of_caption_image); 1205 jQuery(information_main).append(caption_image); 1206 break 1207 } 1208 }) 1209 1210 jQuery(popup_element).append(information_main); 1211 }, 1212 1213 change_information_panel_informations:function(element_index){ 1214 var self=this; 1215 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; 1216 var text_of_title_image=self.defaults.elem_array[element_index][1] 1217 var text_of_caption_image=self.defaults.elem_array[element_index][2] 1218 if(text_of_caption_image==null){ 1219 text_of_caption_image=self.defaults.information_panel_text_for_no_caption; 1220 } 1221 if(text_of_title_image==null){ 1222 text_of_title_image=self.defaults.information_panel_text_for_no_title; 1223 } 1224 if(jQuery('#'+this.constant_defaults.popup_window_information_count_id).length>0){ 1225 jQuery('#'+this.constant_defaults.popup_window_information_count_id).html(text_of_count_images) 1226 } 1227 if(jQuery('#'+this.constant_defaults.popup_window_information_title_id).length>0){ 1228 if(this.defaults.information_panel_desc_show_if_not==false){ 1229 if(text_of_title_image==null){ 1230 jQuery('#'+this.constant_defaults.popup_window_information_title_id).hide(); 1231 } 1232 else{ 1233 jQuery('#'+this.constant_defaults.popup_window_information_title_id).html(text_of_title_image) 1234 jQuery('#'+this.constant_defaults.popup_window_information_title_id).show(); 1235 } 1236 } 1237 else{ 1238 jQuery('#'+this.constant_defaults.popup_window_information_title_id).html(text_of_title_image) 1239 } 1240 } 1241 if(jQuery('#'+this.constant_defaults.popup_window_information_aption_id).length>0){ 1242 if(this.defaults.information_panel_desc_show_if_not==false){ 1243 if(text_of_caption_image==null){ 1244 jQuery('#'+this.constant_defaults.popup_window_information_aption_id).hide(); 1245 } 1246 else{ 1247 jQuery('#'+this.constant_defaults.popup_window_information_aption_id).html(text_of_caption_image) 1248 jQuery('#'+this.constant_defaults.popup_window_information_aption_id).show(); 1249 } 1250 } 1251 else{ 1252 jQuery('#'+this.constant_defaults.popup_window_information_aption_id).html(text_of_caption_image) 1253 } 1254 1255 } 1256 1257 }, 1258 /*###################################### REMOVE POPUP ##########################################################*/ 1259 remove_popup:function(){ 1260 self=this; 1261 if(self.defaults.popup_animation_type!='disable'){ 1262 setTimeout(function(){jQuery('#'+self.constant_defaults.parent_div_foe_mozilla_full).remove();self.defaults.popup_can_run=true;},self.defaults.popup_animation_time); 1263 self.end_css_for_opening_popup(jQuery('#'+self.constant_defaults.popup_window_id)); 1264 }else{ 1265 jQuery('#'+self.constant_defaults.popup_window_id).remove();self.defaults.popup_can_run=true; 1266 } 1267 if(jQuery('#'+self.constant_defaults.popup_window_loading_first_pic_id).length>0){ 1268 jQuery('#'+self.constant_defaults.popup_window_loading_first_pic_id).remove(); 1269 } 1270 self.set_initial_parametrs(); 1271 self.pause(); 1272 }, 1273 1274 set_initial_parametrs:function(){ 1275 this.defaults.current_img_index=null; 1276 }, 1277 /*###################################### LOADING IMAGE INTO CONTENT BY INDEX ##########################################################*/ 1278 load_element_in_content:function(element_index,popup_window){ 1279 self=this; 1280 if(this.defaults.elem_array[element_index][3]=='iframe'){ 1281 return this.load_iframe_in_content(element_index,popup_window); 1282 } 1283 else{ 1284 // worked_cantrol buttons 1285 this.set_display_control_button(this.constant_defaults.download_icon_id,true); 1286 } 1287 // when first image loading 1288 var is_frst_image=true; 1289 if(this.defaults.current_img_index!= null) 1290 is_frst_image=false; 1291 // set curent image index 1292 this.defaults.current_img_index=element_index; 1293 // firs or last image item 1294 var img_id=this.constant_defaults.popup_window_second_elem_id 1295 if(is_frst_image) 1296 var img_id=this.constant_defaults.popup_window_first_elem_id 1297 1298 // loading image 1299 jQuery('#'+self.constant_defaults.popup_window_loading_pic_id).css('display','inline-block'); 1300 jQuery('<img>', { 1301 src: jQuery(this.defaults.elem_array[element_index][0]).attr('href'), 1302 id: img_id, 1303 load:function(){ 1304 self.change_information_panel_informations(self.defaults.current_img_index) 1305 // hide loading image 1306 jQuery('#'+self.constant_defaults.popup_window_loading_pic_id).css('display','none'); 1307 // open for loading 1308 1309 if(self.defaults.popup_first_open_type=='load' && is_frst_image){ 1310 self.start_css_for_opening_popup(jQuery('#'+self.constant_defaults.popup_window_id)) 1311 jQuery('#'+self.constant_defaults.popup_window_id).css('display','block'); 1312 self.remove_first_loading_image(); 1313 } 1314 1315 self.defaults.curent_img_width=this.width; 1316 self.defaults.curent_img_height=this.height; 1317 jQuery('#'+self.constant_defaults.popup_window_pic_content_id).prepend(this); 1318 if(!is_frst_image){ 1319 if(self.defaults.control_button_change_image_effect=='fade'){ 1320 jQuery('#'+self.constant_defaults.popup_window_first_elem_id).css('transition','opacity '+self.defaults.change_img_animation_duration+'ms'); // add opaciti animation 1321 jQuery('#'+self.constant_defaults.popup_window_first_elem_id).css('opacity','0'); 1322 } 1323 if(self.defaults.control_button_change_image_effect=='fade_elastic'){ 1324 var css_parametrs='opacity '+self.defaults.change_img_animation_duration+'ms, width '+self.defaults.change_img_animation_duration+'ms, height '+self.defaults.change_img_animation_duration+'ms, left '+self.defaults.change_img_animation_duration+'ms, top '+self.defaults.change_img_animation_duration+'ms'; 1325 jQuery('#'+self.constant_defaults.popup_window_first_elem_id).css('transition',css_parametrs); // add opaciti animation 1326 jQuery('#'+self.constant_defaults.popup_window_id).css('transition',css_parametrs); 1327 jQuery('#'+self.constant_defaults.popup_window_pic_content_id).css('transition',css_parametrs); 1328 jQuery('#'+self.constant_defaults.popup_window_first_elem_id).css('opacity','0'); 1329 } 1330 if(self.defaults.control_button_change_image_effect!='none'){ 1331 setTimeout( 1332 function(){ 1333 jQuery('#'+self.constant_defaults.popup_window_first_elem_id).remove(); 1334 jQuery('#'+self.constant_defaults.popup_window_second_elem_id).attr('id',self.constant_defaults.popup_window_first_elem_id); 1335 }, 1336 self.defaults.change_img_animation_duration); 1337 }else{ 1338 jQuery('#'+self.constant_defaults.popup_window_first_elem_id).remove(); 1339 jQuery('#'+self.constant_defaults.popup_window_second_elem_id).attr('id',self.constant_defaults.popup_window_first_elem_id); 1340 } 1341 } 1342 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 1343 self.call_function_when_load_complited(); 1344 }, 1345 //error:function() { 1346 // var broken_img= new Image(); 1347 // jQuery(img).attr('id',self.constant_defaults.popup_window_first_elem_id) 1348 // broken_img.src=self.defaults.broken_icon_img_src; 1349 // broken_img.onload=function(){ 1350 // jQuery('#'+self.constant_defaults.popup_window_loading_pic_id).css('display','none') 1351 1352 // self.defaults.curent_img_width=this.width; 1353 // self.defaults.curent_img_height=this.height; 1354 // jQuery('#'+self.constant_defaults.popup_window_pic_content_id).prepend(this); 1355 // 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 1356 // } 1357 // self.call_function_when_load_complited(); 1358 // } 1359 1360 }); 1361 }, 1362 /*###################################### LOADING IFRAME INTO CONTENT BY INDEX ##########################################################*/ 1363 load_iframe_in_content:function(element_index,popup_window){ 1364 self=this; 1365 // for functionality content 1366 var is_first_element=true; 1367 if(this.defaults.current_img_index!= null) 1368 is_first_element=false; 1369 this.defaults.current_img_index=element_index; 1370 1371 // worked_cantrol buttons 1372 this.set_display_control_button(this.constant_defaults.download_icon_id,false); 1373
1374 var iframe= document.createElement("IFRAME");; 1375 var iframe_id 1376 if(is_first_element) 1377 iframe_id=this.constant_defaults.popup_window_first_elem_id 1378 else 1379 iframe_id=this.constant_defaults.popup_window_second_elem_id; 1380 if(!this.get_curent_ordering_element_enabled('fullscreen') && this.defaults.control_buttons_show) 1381 jQuery(iframe).attr('allowfullscreen','true'); 1382 iframe_src=this.get_video_type_and_url(jQuery(this.defaults.elem_array[element_index][0]).attr('href')) 1383 if(iframe_src==null){ 1384 this.remove_popup(); 1385 return; 1386 } 1387 if(iframe_src[0]=='youtube'){ 1388 self.defaults.curent_img_width=this.defaults.popup_youtube_width; 1389 self.defaults.curent_img_height=this.defaults.popup_youtube_height; 1390 } 1391 if(iframe_src[0]=='vimeo'){ 1392 self.defaults.curent_img_width=this.defaults.popup_vimeo_width; 1393 self.defaults.curent_img_height=this.defaults.popup_vimeo_height; 1394 } 1395 iframe_src=iframe_src[1]; 1396 // show loading image 1397 jQuery('#'+self.constant_defaults.popup_window_loading_pic_id).css('display','inline-block'); 1398 jQuery('<iframe>', { 1399 src: iframe_src, 1400 id: iframe_id, 1401 load:function(){ 1402 self.change_information_panel_informations(self.defaults.current_img_index) 1403 // hide loading image 1404 jQuery('#'+self.constant_defaults.popup_window_loading_pic_id).css('display','none'); 1405 // open for loading 1406 1407 if(self.defaults.popup_first_open_type=='load' && is_first_element){ 1408 self.start_css_for_opening_popup(jQuery('#'+self.constant_defaults.popup_window_id)) 1409 jQuery('#'+self.constant_defaults.popup_window_id).css('display','block'); 1410 self.remove_first_loading_image(); 1411 } 1412 if(!is_first_element){ 1413 if(self.defaults.control_button_change_image_effect=='fade'){ 1414 jQuery('#'+self.constant_defaults.popup_window_first_elem_id).css('transition','opacity '+self.defaults.change_img_animation_duration+'ms'); // add opaciti animation 1415 jQuery('#'+self.constant_defaults.popup_window_first_elem_id).css('opacity','0'); 1416 } 1417 if(self.defaults.control_button_change_image_effect=='fade_elastic'){ 1418 var css_parametrs='opacity '+self.defaults.change_img_animation_duration+'ms, width '+self.defaults.change_img_animation_duration+'ms, height '+self.defaults.change_img_animation_duration+'ms, left '+self.defaults.change_img_animation_duration+'ms, top '+self.defaults.change_img_animation_duration+'ms'; 1419 jQuery('#'+self.constant_defaults.popup_window_first_elem_id).css('transition',css_parametrs); // add opaciti animation 1420 jQuery('#'+self.constant_defaults.popup_window_id).css('transition',css_parametrs); 1421 jQuery('#'+self.constant_defaults.popup_window_pic_content_id).css('transition',css_parametrs); 1422 jQuery('#'+self.constant_defaults.popup_window_first_elem_id).css('opacity','0'); 1423 } 1424 if(self.defaults.control_button_change_image_effect!='none'){ 1425 setTimeout( 1426 function(){ 1427 jQuery('#'+self.constant_defaults.popup_window_first_elem_id).remove(); 1428 jQuery('#'+self.constant_defaults.popup_window_second_elem_id).attr('id',self.constant_defaults.popup_window_first_elem_id); 1429 }, 1430 self.defaults.change_img_animation_duration 1431 ) 1432 }else{ 1433 jQuery('#'+self.constant_defaults.popup_window_first_elem_id).remove(); 1434 jQuery('#'+self.constant_defaults.popup_window_second_elem_id).attr('id',self.constant_defaults.popup_window_first_elem_id); 1435 } 1436 1437 } 1438 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 1439 self.call_function_when_load_complited(); 1440 1441 }, 1442 }).prependTo('#'+self.constant_defaults.popup_window_pic_content_id); 1443 }, 1444 1445 /*###################################### RESIZE POPUP BY IMAGE ##########################################################*/ 1446 resize_popup_by_image:function(img_width,img_height){ 1447 1448 // outside margin when sizes is small 1449 var local_outside_margin=this.defaults.popup_outside_margin; 1450 if(this.defaults.popup_position==5) 1451 local_outside_margin=0; 1452 local_outside_margin=this.get_correct_margin(jQuery(window).width(),(window.innerHeight),this.defaults.popup_outside_margin); 1453 // description panel when it disabled or in content 1454 loc_description_panel_height=this.get_correct_description_height(); 1455 // outside border when sizes is smoll 1456 var loc_outside_border=this.get_correct_border(jQuery(window).width(),window.innerHeight,this.defaults.popup_border_width); 1457 1458 var window_information_line_height=this.get_correct_information_height();
1459 var oteher_elements_height=loc_outside_border*2 + loc_description_panel_height + this.defaults.wordpress_admin_bar_height + local_outside_margin*2; 1460 // en erkarutiuna vori mej nkary piti mna 1461 var window_width=jQuery(window).width()-loc_outside_border*2-local_outside_margin*2; 1462 1463 // noric nkari erkarutiunna vercum 1464 var window_height=window.innerHeight-loc_outside_border*2-loc_description_panel_height-this.defaults.wordpress_admin_bar_height-local_outside_margin*2-window_information_line_height; 1465 1466 1467 // for max width and heght 1468 window_width=Math.min(window_width,this.defaults.popup_max_width); 1469 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)); 1470 1471 // for full width not for full screen 1472 if(this.defaults.enabled_picture_full_width){ 1473 curent_image_height=window_height; 1474 curent_image_width=curent_image_height*(img_width/img_height); 1475 curent_image_width=Math.min(window_width,curent_image_width); 1476 curent_image_height=curent_image_width*(img_height/img_width); 1477 } 1478 else{ 1479 curent_image_width=Math.min(window_width,img_width); 1480 curent_image_height=curent_image_width*(img_height/img_width); 1481 curent_image_height=Math.min(window_height,curent_image_height); 1482 curent_image_width=curent_image_height*(img_width/img_height); 1483 } 1484 // get popup and image demisions for using other functiuons 1485 this.defaults.popup_window_demision[0]=parseInt(curent_image_width); 1486 1487 this.defaults.popup_window_demision[1]=parseInt(curent_image_height)+loc_description_panel_height+window_information_line_height; 1488 this.defaults.popup_window_demision[2]=parseInt(curent_image_height); 1489 1490 jQuery('#'+this.constant_defaults.popup_window_id).width(this.defaults.popup_window_demision[0]); 1491 jQuery('#'+this.constant_defaults.popup_window_id).height(this.defaults.popup_window_demision[1]); 1492 jQuery('#'+this.constant_defaults.popup_window_pic_content_id).height(curent_image_height); 1493 this.generete_border(jQuery('#'+this.constant_defaults.popup_window_id)); 1494 this.set_popup_position(); 1495 }, 1496 1497 /*###################################### RESIZE POPUP ##########################################################*/ 1498 resize_popup:function(){ 1499 var self=this; 1500 if(this.defaults.control_buttons_window_navigation){ 1501 self.set_alternative_window_buttons_position(jQuery('#'+this.constant_defaults.popup_window_prev_window_button_id),jQuery('#'+this.constant_defaults.popup_window_next_window_button_id)); 1502 } 1503 1504 if(this.defaults.curent_img_width && this.defaults.curent_img_height) 1505 this.resize_popup_by_image(this.defaults.curent_img_width,this.defaults.curent_img_height) 1506 else 1507 this.resize_popup_by_image(this.defaults.popup_initial_width,this.defaults.popup_initial_height) 1508 }, 1509 1510 1511 /*#################################### LOADING IMAGE POSITION ###################################################*/ 1512 1513 set_loading_image_position:function(){ 1514 var content_width= this.defaults.popup_window_demision[0];// get content width 1515 var content_height= this.defaults.popup_window_demision[2]; // get content height 1516 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'); 1517 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'); 1518 }, 1519 1520 1521 /*#################################### SET POPUP POSITION ###################################################*/ 1522 set_popup_position:function(){ 1523 var self=this; 1524 var window_width=jQuery(window).width(); 1525 var window_height=window.innerHeight; 1526 var window_information_line_height=jQuery('#'+this.constant_defaults.popup_window_information_content_id).height(); 1527 1528 // when outside margin is bigger or border 1529 var loc_outside_margin=this.get_correct_margin(window_width,window_height,this.defaults.popup_outside_margin); 1530 var loc_outside_border=this.get_correct_border(window_width,window_height,this.defaults.popup_border_width); 1531 1532 var scroll_to_top=0; 1533 if(!this.defaults.popup_fixed_position) 1534 scroll_to_top=this.get_top_scroled_pixel(); 1535 1536 switch (this.defaults.popup_position) { 1537 case 1: 1538 jQuery('#'+this.constant_defaults.popup_window_id).css('left',(loc_outside_border+loc_outside_margin)+'px'); 1539 jQuery('#'+this.constant_defaults.popup_window_id).css('top',(this.defaults.wordpress_admin_bar_height+loc_outside_margin)+scroll_to_top+'px'); 1540 break; 1541 case 2: 1542 jQuery('#'+this.constant_defaults.popup_window_id).css('left',(window_width-(this.defaults.popup_window_demision[0]+loc_outside_border*2) )/2+'px'); 1543 jQuery('#'+this.constant_defaults.popup_window_id).css('top',(loc_outside_margin+this.defaults.wordpress_admin_bar_height)+scroll_to_top+'px'); 1544 break; 1545 case 3: 1546 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'); 1547 jQuery('#'+this.constant_defaults.popup_window_id).css('top',(loc_outside_margin+this.defaults.wordpress_admin_bar_height)+scroll_to_top+'px'); 1548 break; 1549 case 4: 1550 jQuery('#'+this.constant_defaults.popup_window_id).css('left',(loc_outside_border+loc_outside_margin)+'px'); 1551 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'); 1552 break; 1553 case 5: 1554 jQuery('#'+this.constant_defaults.popup_window_id).css('left',(window_width-(this.defaults.popup_window_demision[0]+loc_outside_border*2) )/2+'px'); 1555 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'); 1556 break; 1557 case 6: 1558 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'); 1559 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'); 1560 break; 1561 case 7: 1562 jQuery('#'+this.constant_defaults.popup_window_id).css('left',loc_outside_margin+'px'); 1563 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'); 1564 break; 1565 case 8: 1566 jQuery('#'+this.constant_defaults.popup_window_id).css('left',(window_width-(this.defaults.popup_window_demision[0]+loc_outside_border*2) )/2+'px'); 1567 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'); 1568 break; 1569 case 9: 1570 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'); 1571 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'); 1572 break; 1573 default: 1574 jQuery('#'+this.constant_defaults.popup_window_id).css('left',(window_width-(loc_outside_border+this.defaults.popup_window_demision[0]))/2+'px'); 1575 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'); 1576 break; 1577 } 1578 self.set_alternative_content_buttons_position(); 1579 self.set_loading_image_position(); 1580 }, 1581 1582 1583 1584 1585 1586 1587 1588 1589 /*#################################### CREATE OVERLAY ###################################################*/ 1590 create_overlay:function(){ 1591 var wpdevart_self=this; 1592 var element_overlay=jQuery('<div>
1592',{id: this.constant_defaults.overlay_id}); // 1593 1594 1595 // if element overay // add opaciti animation 1596 if(this.defaults.overlay_fade_efect){ 1597 jQuery(element_overlay).css('opacity','0'); 1598 jQuery(element_overlay).css('transition','opacity '+parseInt(this.defaults.overlay_fade_efect_time)+'ms'); 1599 setTimeout(function(){jQuery(element_overlay).addClass('wpdevart_opacity');},30) 1600 } else{ 1601 jQuery(element_overlay).addClass('wpdevart_opacity'); 1602 } 1603 jQuery('body').prepend(element_overlay); 1604 1605 1606 // remove overlay when clicked 1607 if(wpdevart_self.defaults.remov_overlay_when_clicked){ 1608 jQuery(element_overlay).click(function(e){ if(e.target!=document.getElementById(wpdevart_self.constant_defaults.overlay_id)) return; wpdevart_self.remove_overlay()}) 1609 } 1610 // remove overlay when pressed esc button 1611 if(wpdevart_self.defaults.remov_overlay_esc_button){ 1612 jQuery(document).keyup(function(e) { 1613 if(e.keyCode ==27) 1614 wpdevart_self.remove_overlay() 1615 }) 1616 } 1617 }, 1618 1619 1620 /*#################################### REMOVEW OVERLAY ###################################################*/ 1621 remove_overlay:function(){ 1622 var wpdevart_self=this; //crate self for using in inside section 1623 if(!jQuery('#'+this.constant_defaults.overlay_id).hasClass('wpdevart_opacity')) 1624 return; 1625 1626 jQuery('#'+this.constant_defaults.overlay_id).removeClass('wpdevart_opacity'); //remove opacity class 1627 // delete overlay when animation(css animation is complit) 1628 if(this.defaults.overlay_fade_efect){ 1629 setTimeout(function(){jQuery('#'+wpdevart_self.constant_defaults.overlay_id).remove();},parseInt(wpdevart_self.defaults.overlay_fade_efect_time*2/3)); 1630 } 1631 else{ 1632 jQuery('#'+wpdevart_self.constant_defaults.overlay_id).remove(); 1633 } 1634 this.remove_popup(); 1635 this.remove_alternate_window_button(); 1636 }, 1637 1638 // conect array ru outside value 1639 conect_outside_variable:function(defaults,seted){ 1640 self=this; 1641 jQuery.each(defaults,function(index, element) { 1642 if(typeof(seted[index])!='undefined'){ 1643 if(seted[index]=='true') 1644 seted[index]=true; 1645 if(seted[index]=='false') 1646 seted[index]=false; 1647 if(typeof(seted[index])=='string' && self.isnumeric(seted[index])) 1648 seted[index]=parseInt(seted[index]); 1649 defaults[index]=seted[index]; 1650 } 1651 }); 1652 return defaults; 1653 1654 }, 1655 1656 /*#################################### Library Functions ###################################################*/ 1657 isnumeric:function(x) { 1658 var anum=/(^\d+$)|(^\d+\.\d+$)/ 1659 if (anum.test(x)) { 1660 return true; 1661 } 1662 return false; 1663 }, 1664 1665 get_correct_margin:function(window_width,window_height,demision){ 1666 if( ( window_width-demision*2 ) < 320 || ( window_height-demision*2 ) < 320 || this.defaults.popup_position==5) 1667 demision=0; 1668 return demision; 1669 }, 1670 1671 get_correct_description_height:function(){ 1672 if(this.defaults.control_buttons_show && !this.defaults.control_buttons_show_in_content) 1673 return this.defaults.control_buttons_height; 1674 return 0; 1675 }, 1676 1677 get_correct_information_height:function(){ 1678 if(this.defaults.information_panel_show && !this.defaults.information_panel_show_in_content) 1679 return jQuery('#'+this.constant_defaults.popup_window_information_content_id).height()?jQuery('#'+this.constant_defaults.popup_window_information_content_id).height():0; 1680 return 0; 1681 }, 1682 1683 get_correct_border:function(window_width,window_height,border){ 1684 if( ( window_width-border*2*5 ) < 320 || ( window_height-border*2*5 ) < 320 ) 1685 border=0; 1686 return border; 1687 }, 1688 1689 get_top_scroled_pixel:function(){ 1690 if(this.defaults.enabled_picture_full_screen) 1691 return 0; 1692 var doc = document.documentElement; 1693 var top = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0); 1694 return top; 1695 }, 1696 1697 set_display_control_button:function(control_button_id,show_hide){ 1698 if(jQuery('#'+control_button_id).length>0){ 1699 if(show_hide){ 1700 jQuery('#'+control_button_id).css('display','inline-block'); 1701 return; 1702 } 1703 jQuery('#'+control_button_id).css('display','none'); 1704 } 1705 }, 1706 1707 get_video_type_and_url:function(iframe_link){ 1708 var type='none'; 1709 iframe_src=iframe_link.match(/(?:https?:\/{2})?(?:w{3}\.)?youtu(?:be)?\.(?:com|be)(?:\/watch\?v=|\/)([^\s&]+)/); 1710 if(iframe_src!=null){ 1711 type='youtube' 1712 iframe_src='https://www.youtube.com/embed/'+iframe_src[1]; 1713 }else{ 1714 iframe_src=iframe_link.match(/(?:https?:\/{2})?(?:w{3}\.)?vimeo.com(?:.*)/); 1715 if(iframe_src!=null){ 1716 type='vimeo'; 1717 var vimeoid = iframe_link.substring(iframe_link.lastIndexOf("/") + 1, iframe_link.length); 1718 iframe_src='http://player.vimeo.com/video/'+vimeoid; 1719 } 1720 else{ 1721 return null; 1722 } 1723 } 1724 return [type,iframe_src]; 1725 }, 1726 1727 hexToRgbA:function(hex,opasity){ 1728 var h = "0123456789abcdef"; 1729 var r = h.indexOf(hex[1])*16+h.indexOf(hex[2]); 1730 var g = h.indexOf(hex[3])*16+h.indexOf(hex[4]); 1731 var b = h.indexOf(hex[5])*16+h.indexOf(hex[6]); 1732 return "rgba("+r+", "+g+", "+b+", "+opasity+")"; 1733 1734 }, 1735 1736 get_curent_ordering_element_enabled:function(element){ 1737 ordering_object=JSON.parse(this.defaults.control_button_ordering); 1738 isset_element=0; 1739 jQuery.each(ordering_object,function(key,value){ 1740 var ordering=key; 1741 jQuery.each(value,function(keyy,valuee){ 1742 if(element==valuee[1]) 1743 return isset_element=valuee[0]; 1744 }) 1745 }) 1746 return isset_element; 1747 }, 1748 1749 /*#################################### MAIN CONSTRUCT FUNCTION ###################################################*/ 1750 start:function(){ 1751 var self=this; 1752 // get and merge variable by our customer paramntrs 1753 this.defaults=this.conect_outside_variable(this.defaults,wpdevart_lb_variables); 1754 // corect some parametrs 1755 jQuery(document).on("webkitfullscreenchange mozfullscreenchange fullscreenchange",function(){ 1756 setTimeout(function(){self.check_and_set_full_screen('undefined')},500) 1757 }); 1758 jQuery(window).resize(function(){ 1759 self.resize_popup(); 1760 self.set_popup_position(); 1761 }) 1762 1763 if(jQuery('#wpadminbar').length>0){ 1764 this.defaults.wordpress_admin_bar_height=jQuery('#wpadminbar').height(); 1765 } 1766 1767 jQuery('a[rel~="wpdevart_lightbox"],a[rel~="wpdevart_lightbox_video"]').each(function(index, element) { 1768 var title=null; 1769 var caption=null; 1770 var type=(jQuery(element).attr('rel').indexOf('wpdevart_lightbox_video')!=-1)?'iframe':'img'; 1771 1772 if(typeof(jQuery(element).find( "img" ).attr('alt'))!='undefined' && jQuery(element).find( "img" ).attr('alt')!=''){ 1773 title=jQuery(element).find( "img" ).attr('alt'); 1774 } 1775 if(jQuery(element).parent().prop('tagName')=='FIGURE' && jQuery(element).parent().hasClass('wp-caption')){ 1776 if(typeof(jQuery(element).parent().find('figcaption'))!='undefined' && jQuery(element).parent().find('figcaption').html()!=''){ 1777 caption= jQuery(element).parent().find('figcaption').html() 1778 } 1779 } 1780 self.defaults.elem_array.push(new Array(element, title,caption,type)); 1781 }); 1782 1783 jQuery('a[rel^="wpdevart_lightbox"]').click(function(){ 1784 if(self.defaults.popup_can_run){ 1785 self.create_overlay(); 1786 self.create_popup(jQuery('a[rel^="wpdevart_lightbox"]').index(this)); 1787 } 1788 1789 return false; 1790 }); 1791 1792 this.keyboard_navigation(self.defaults.keyboard_navigation) 1793 } 1794 1795} 1796 1797jQuery(document).ready(function(e) { 1798 wpdevart_lightbox.start(); 1799});
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.