1var isPopUpOpened = false; 2var bwg_overflow_initial_value = false; 3var bwg_overflow_x_initial_value = false; 4var bwg_overflow_y_initial_value = false; 5 6function spider_createpopup(url, current_view, width, height, duration, description, lifetime, lightbox_ctrl_btn_pos) { 7 url = url.replace(/&/g, '&'); 8 if (isPopUpOpened) { return }; 9 isPopUpOpened = true; 10 if (spider_hasalreadyreceivedpopup(description) || spider_isunsupporteduseragent()) { 11 return; 12 } 13 bwg_overflow_initial_value = jQuery("html").css("overflow"); 14 bwg_overflow_x_initial_value = jQuery("html").css("overflow-x"); 15 bwg_overflow_y_initial_value = jQuery("html").css("overflow-y"); 16 jQuery("html").attr("style", "overflow:hidden !important;"); 17 jQuery("#bwg_spider_popup_loading_" + current_view).css({display: "block"}); 18 jQuery("#spider_popup_overlay_" + current_view).css({display: "block"}); 19 20 jQuery.get(url, function(data) { 21 var popup = jQuery( 22 '<div id="spider_popup_wrap" class="spider_popup_wrap" style="' + 23 ' width:' + width + 'px;' + 24 ' height:' + height + 'px;' + 25 ' margin-top:-' + height / 2 + 'px;' + 26 ' margin-left: -' + width / 2 + 'px; ">' + 27 data + 28 '</div>') 29 .hide() 30 .appendTo("body"); 31 spider_showpopup(description, lifetime, popup, duration, lightbox_ctrl_btn_pos); 32 }).success(function(jqXHR, textStatus, errorThrown) { 33 jQuery("#bwg_spider_popup_loading_" + current_view).css({display: "none !important;"}); 34 }); 35} 36 37function spider_showpopup(description, lifetime, popup, duration, lightbox_ctrl_btn_pos) { 38 isPopUpOpened = true; 39 popup.show(); 40 spider_receivedpopup(description, lifetime, lightbox_ctrl_btn_pos); 41} 42 43function spider_hasalreadyreceivedpopup(description) { 44 if (document.cookie.indexOf(description) > -1) { 45 delete document.cookie[document.cookie.indexOf(description)]; 46 } 47 return false; 48} 49 50function spider_receivedpopup(description, lifetime, lightbox_ctrl_btn_pos) { 51 var date = new Date(); 52 date.setDate(date.getDate() + lifetime); 53 document.cookie = description + "=true;expires=" + date.toUTCString() + ";path=/"; 54 if (lightbox_ctrl_btn_pos == 'bottom') { 55 jQuery(".bwg_toggle_container").css("bottom", jQuery(".bwg_ctrl_btn_container").height() + "px"); 56 } 57 else if (lightbox_ctrl_btn_pos == 'top') { 58 jQuery(".bwg_toggle_container").css("top", jQuery(".bwg_ctrl_btn_container").height() + "px"); 59 } 60} 61 62function spider_isunsupporteduseragent() { 63 return (!window.XMLHttpRequest); 64} 65 66function spider_destroypopup(duration) { 67 if (document.getElementById("spider_popup_wrap") != null) { 68 if (typeof jQuery().fullscreen !== 'undefined' && jQuery.isFunction(jQuery().fullscreen)) { 69 if (jQuery.fullscreen.isFullScreen()) { 70 jQuery.fullscreen.exit(); 71 } 72 } 73 if (typeof enable_addthis != "undefined" && enable_addthis) { 74 jQuery(".at4-share-outer").hide(); 75 } 76 setTimeout(function () { 77 jQuery(".spider_popup_wrap").remove(); 78 jQuery(".bwg_spider_popup_loading").css({display: "none"}); 79 jQuery(".spider_popup_overlay").css({display: "none"}); 80 jQuery(document).off("keydown"); 81 if (bwg_overflow_initial_value) { 82 jQuery("html").css("overflow", bwg_overflow_initial_value); 83 } 84 if (bwg_overflow_x_initial_value) { 85 jQuery("html").css("overflow-x", bwg_overflow_x_initial_value); 86 } 87 if (bwg_overflow_y_initial_value) { 88 jQuery("html").css("overflow-y", bwg_overflow_y_initial_value); 89 } 90 }, 20); 91 } 92 isPopUpOpened = false; 93 var isMobile = (/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i.test(navigator.userAgent.toLowerCase())); 94 var viewportmeta = document.querySelector('meta[name="viewport"]'); 95 if (isMobile && viewportmeta) { 96 viewportmeta.content = 'width=device-width, initial-scale=1'; 97 } 98 clearInterval(bwg_playInterval); 99} 100 101// Submit popup. 102function spider_ajax_save(form_id) { 103 var post_data = {}; 104 post_data["bwg_name"] = jQuery("#bwg_name").val(); 105 post_data["bwg_comment"] = jQuery("#bwg_comment").val(); 106 post_data["bwg_email"] = jQuery("#bwg_email").val(); 107 post_data["bwg_captcha_input"] = jQuery("#bwg_captcha_input").val(); 108 post_data["ajax_task"] = jQuery("#ajax_task").val(); 109 post_data["image_id"] = jQuery("#image_id").val(); 110 post_data["comment_id"] = jQuery("#comment_id").val(); 111 post_data["bwg_tag_id_" + id] = jQuery("#bwg_tag_id_" + id).val(); 112 113 // Loading. 114 jQuery("#ajax_loading").css('height', jQuery(".bwg_comments").css('height')); 115 jQuery("#opacity_div").css('width', jQuery(".bwg_comments").css('width')); 116 jQuery("#opacity_div").css('height', jQuery(".bwg_comments").css('height')); 117 jQuery("#loading_div").css('width', jQuery(".bwg_comments").css('width')); 118 jQuery("#loading_div").css('height', jQuery(".bwg_comments").css('height')); 119 document.getElementById("opacity_div").style.display = ''; 120 document.getElementById("loading_div").style.display = 'table-cell'; 121 jQuery.ajax({ 122 type: "POST", 123 url: jQuery('#' + form_id).attr('action'), 124 data: post_data, 125 success: function (data) { 126 var str = jQuery(data).find('.bwg_comments').html(); 127 jQuery('.bwg_comments').html(str); 128 }, 129 beforeSend: function(){ 130 }, 131 complete:function(){ 132 document.getElementById("opacity_div").style.display = 'none'; 133 document.getElementById("loading_div").style.display = 'none'; 134 // Update scrollbar. 135 jQuery(".bwg_comments").mCustomScrollbar({scrollInertia: 150}); 136 // Bind comment container close function to close button. 137 jQuery(".bwg_comments_close_btn").on("click", bwg_comment); 138 } 139 }); 140 return false;
141} 142 143// Submit rating. 144function spider_rate_ajax_save(form_id) { 145 var post_data = {}; 146 post_data["image_id"] = jQuery("#" + form_id + " input[name='image_id']").val(); 147 post_data["rate"] = jQuery("#" + form_id + " input[name='score']").val(); 148 post_data["ajax_task"] = jQuery("#rate_ajax_task").val(); 149 jQuery.ajax({ 150 type: "POST", 151 url: jQuery('#' + form_id).attr('action'), 152 data: post_data, 153 success: function (data) { 154 var str = jQuery(data).find('#' + form_id).html(); 155 jQuery('#' + form_id).html(str); 156 }, 157 beforeSend: function(){ 158 }, 159 complete:function(){ 160 } 161 }); 162 return false; 163} 164 165// Set value by ID. 166function spider_set_input_value(input_id, input_value) { 167 if (document.getElementById(input_id)) { 168 document.getElementById(input_id).value = input_value; 169 } 170} 171 172// Submit form by ID. 173function spider_form_submit(event, form_id) { 174 if (document.getElementById(form_id)) { 175 document.getElementById(form_id).submit(); 176 } 177 if (event.preventDefault) { 178 event.preventDefault(); 179 } 180 else { 181 event.returnValue = false; 182 } 183} 184 185// Check if required field is empty. 186function spider_check_required(id, name) { 187 if (jQuery('#' + id).val() == '') { 188 alert(name + '* ' + bwg_objectL10n.bwg_field_required); 189 jQuery('#' + id).attr('style', 'border-color: #FF0000;'); 190 jQuery('#' + id).focus(); 191 return true; 192 } 193 else { 194 return false; 195 } 196} 197 198// Check Email. 199function spider_check_email(id) { 200 if (jQuery('#' + id).val() != '') { 201 var email = jQuery('#' + id).val().replace(/^\s+|\s+$/g, ''); 202 if (email.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1) { 203 alert(bwg_objectL10n.bwg_mail_validation); 204 return true; 205 } 206 return false; 207 } 208} 209 210// Refresh captcha. 211function bwg_captcha_refresh(id) { 212 if (document.getElementById(id + "_img") && document.getElementById(id + "_input")) { 213 srcArr = document.getElementById(id + "_img").src.split("&r="); 214 document.getElementById(id + "_img").src = srcArr[0] + '&r=' + Math.floor(Math.random() * 100); 215 document.getElementById(id + "_img").style.display = "inline-block"; 216 document.getElementById(id + "_input").value = ""; 217 } 218}
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.