1(function ($) { 2 "use strict"; 3 4 var BPFW = { 5 init: function () { 6 this.actionFlipBack(); 7 this.actionReadBook(); 8 this.actionZoomIn(); 9 this.actionZoomOut(); 10 this.variation(); 11 }, 12 13 actionFlipBack: function () { 14 $(document).on('click', '.bpfw-action-flip', function (e) { 15 e.preventDefault(); 16 $('.bpfw-flip-wrapper').toggleClass('bpfw-view'); 17 }); 18 }, 19 actionReadBook: function () { 20 $(document).on('click', '.bpfw-action-read-book', function (e) { 21 e.preventDefault(); 22 23 var $this = $(this), 24 urlPopup = $this.attr('href'); 25 26 $.ajax({ 27 'type': 'get', 28 'url': urlPopup, 29 'success': function (res) { 30 if ($('#bpfw-popup').length > 0) { 31 $('#bpfw-popup').remove(); 32 } 33 34 var mfOptions = { 35 closeOnBgClick: true, 36 closeBtnInside: true, 37 mainClass: 'mfp-zoom-in', 38 midClick: true, 39 items: { 40 'src': urlPopup, 41 'type': 'ajax' 42 }, 43 callbacks: { 44 ajaxContentAdded: function() { 45 var popup_height = $(window).height() - 150; 46 $('.bpfw-popup-content-wrapper').css('height', popup_height); 47 } 48 } 49 }; 50 $.magnificPopup.open(mfOptions); 51 } 52 }); 53 }); 54 }, 55 actionZoomIn: function () { 56 $(document).on('click', '.bpfw-preview-zoom-in', function (e) { 57 e.preventDefault(); 58 59 var wrapWidth = $('.bpfw-popup-content-wrapper').width(); 60 var contentWidth = $('.bpfw-popup-content').width(); 61 62 if (contentWidth < wrapWidth) { 63 contentWidth = contentWidth + 100; 64 $('.bpfw-popup-content').css('width', contentWidth); 65 } 66 }); 67 }, 68 actionZoomOut: function () { 69 $(document).on('click', '.bpfw-preview-zoom-out', function (e) { 70 e.preventDefault(); 71 var contentWidth = $('.bpfw-popup-content').width(); 72 if (contentWidth > 600) { 73 contentWidth = contentWidth - 100; 74 $('.bpfw-popup-content').css('width', contentWidth); 75 } 76 }); 77 }, 78 variation: function () { 79 var $current_image_front = $('.bpfw-images .bpfw-flip-front img'); 80 var $current_image = $('.bpfw-flip-wrapper > img'); 81 82 if (typeof $current_image.attr('src') !== 'undefined') { 83 $current_image.attr('data-src',$current_image.attr('src')); 84 } 85 86 if (typeof $current_image.attr('width') !== 'undefined') { 87 $current_image.attr('data-width',$current_image.attr('width')); 88 } 89 90 if (typeof $current_image.attr('height') !== 'undefined') { 91 $current_image.attr('data-height',$current_image.attr('height')); 92 } 93 94 95 if (typeof $current_image_front.attr('src') !== 'undefined') { 96 $current_image_front.attr('data-src',$current_image_front.attr('src')); 97 } 98 99 if (typeof $current_image_front.attr('width') !== 'undefined') { 100 $current_image_front.attr('data-width',$current_image_front.attr('width')); 101 } 102 103 if (typeof $current_image_front.attr('height') !== 'undefined') { 104 $current_image_front.attr('data-height',$current_image_front.attr('height')); 105 } 106 107 if (typeof $current_image_front.attr('sizes') !== 'undefined') { 108 $current_image_front.attr('data-sizes',$current_image_front.attr('sizes')); 109 } 110 111 if (typeof $current_image_front.attr('srcset') !== 'undefined') { 112 $current_image_front.attr('data-srcset',$current_image_front.attr('srcset')); 113 } 114 115 if ($current_image_front.length === 0 || $current_image.length === 0) return; 116 $(document).on('found_variation', function (event, variation) { 117 if ((typeof variation !== 'undefined') && (typeof variation.image !== 'undefined')) { 118 if (typeof variation.image.src !== 'undefined') { 119 $current_image_front.attr('src',variation.image.src); 120 $current_image.attr('src',variation.image.src); 121 } 122 123 if (typeof variation.image.src_w !== 'undefined') { 124 $current_image_front.attr('width',variation.image.src_w); 125 $current_image.attr('width',variation.image.src_w); 126 } 127 128 if (typeof variation.image.src_h !== 'undefined') { 129 $current_image_front.attr('height',variation.image.src_h); 130 $current_image.attr('height',variation.image.src_h); 131 } 132 133 if (typeof variation.image.sizes !== 'undefined') { 134 $current_image_front.attr('sizes',variation.image.sizes); 135 } 136
137 if (typeof variation.image.srcset !== 'undefined') { 138 $current_image_front.attr('srcset',variation.image.srcset); 139 } 140 } 141 }); 142 143 $(document).on('reset_data', function (event) { 144 if (typeof $current_image.attr('data-src') !== 'undefined') { 145 $current_image.attr('src',$current_image.attr('data-src')); 146 } 147 148 if (typeof $current_image.attr('data-width') !== 'undefined') { 149 $current_image.attr('width',$current_image.attr('data-width')); 150 } 151 152 if (typeof $current_image.attr('data-height') !== 'undefined') { 153 $current_image.attr('height',$current_image.attr('data-height')); 154 } 155 156 157 if (typeof $current_image_front.attr('data-src') !== 'undefined') { 158 $current_image_front.attr('src',$current_image_front.attr('data-src')); 159 } 160 161 if (typeof $current_image_front.attr('data-width') !== 'undefined') { 162 $current_image_front.attr('width',$current_image_front.attr('data-width')); 163 } 164 165 if (typeof $current_image_front.attr('data-height') !== 'undefined') { 166 $current_image_front.attr('height',$current_image_front.attr('data-height')); 167 } 168 169 if (typeof $current_image_front.attr('data-sizes') !== 'undefined') { 170 $current_image_front.attr('sizes',$current_image_front.attr('data-sizes')); 171 } 172 173 if (typeof $current_image_front.attr('data-srcset') !== 'undefined') { 174 $current_image_front.attr('srcset',$current_image_front.attr('data-srcset')); 175 } 176 177 }); 178 } 179 }; 180 181 $(document).ready(function () { 182 BPFW.init(); 183 }); 184})(jQuery);
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.