1/*! 2 * Before After Slide Viewer - JavaScript ( jQUery plugin) for Before After Viewer 3 * 4 * Copyright (c) 2021 MAMEDUL ISLAM 5 * 6 * Licensed under the MIT license: 7 * https://opensource.org/licenses/MIT 8 * 9 * Project home: 10 * https://mamedul.gitlab.io/dev-projects/jquery-before-after-slider 11 * 12 * Version: 1.0.0 13 */ 14!(function (e) { 15 'use strict'; 16 jQuery.fn.beforeAfter = function (t) { 17 var o = jQuery.extend( 18 { 19 movable: !0, 20 clickMove: !0, 21 alwaysShow: !0, 22 position: 50, 23 opacity: 0.4, 24 activeOpacity: 1, 25 hoverOpacity: 0.8, 26 separatorColor: '#ffffff', 27 bulletColor: '#ffffff', 28 arrowColor: '#333333', 29 }, 30 t 31 ); 32 return this.each(function () { 33 !(function (t) { 34 if (2 == jQuery(t).children().length) { 35 var r = e(t).children()[0], 36 n = e(t).children()[1], 37 i = e(t).css('position'), 38 s = (e(t).css('z-index'), e(t).css('overflow')), 39 c = e(r).css('position'), 40 a = e(r).css('top'), 41 u = e(r).css('left'), 42 d = e(r).css('width'), 43 l = e(r).css('height'), 44 p = e(r).css('z-Index'), 45 h = 46 'position:' + 47 c + 48 ';top:' + 49 a + 50 ';left:' + 51 u + 52 ';width:' + 53 d + 54 ';height:' + 55 l + 56 ';z-index:' + 57 p + 58 ';float:' + 59 e(r).css('float'), 60 y = 61 'position:' + 62 e(n).css('position') + 63 ';top:' + 64 e(n).css('top') + 65 ';left:' + 66 e(n).css('left') + 67 ';width:' + 68 e(n).css('width') + 69 ';height:' + 70 e(n).css('height') + 71 ';z-index:' + 72 e(n).css('z-Index'); 73 jQuery(t).attr( 74 'data-bareservedstyle', 75 'position:' + i + ';overflow:' + s 76 ), 77 jQuery(r).attr('data-bareservedstyle', h), 78 jQuery(n).attr('data-bareservedstyle', y); 79 var v = isNaN(parseInt(p)) ? 0 : parseInt(p), 80 f = 81 '-webkit-user-select:none;-ms-user-select:none;user-select:none;'; 82 jQuery(t).css({ position: 'relative', overflow: 'hidden' }), 83 jQuery(r).css({ 84 position: 'relative', 85 top: '0', 86 left: '0', 87 width: '100%', 88 }), 89 jQuery(n).css({ 90 position: 'absolute', 91 top: '0', 92 right: '0', 93 width: 'auto', 94 height: '100%', 95 'z-index': v + 1, 96 }); 97 var m = document.createElement('DIV'); 98 m.setAttribute( 99 'style', 100 'position:relative !important;width:100% !important;height:100% !important;' + 101 f 102 ), 103 jQuery(r).clone({ withDataAndEvents: !0 }).appendTo(m); 104 var j = document.createElement('DIV'); 105 j.setAttribute( 106 'style', 107 'position:absolute !important;width:' + 108 o.position + 109 '% !important;height:100% !important;top:0px !important;right:0px !important;overflow:hidden !important;' + 110 f 111 ), 112 jQuery(n).clone({ withDataAndEvents: !0 }).appendTo(j); 113 var Q = document.createElement('I'); 114 Q.setAttribute( 115 'style', 116 'border:solid black;border-width:0 2px 2px 0;display:inline-block;padding:3px;transform:rotate(135deg);-webkit-transform:rotate(135deg);' 117 ); 118 var g = document.createElement('I'); 119 g.setAttribute( 120 'style', 121 'border:solid black;border-width:2px 0 0 2px;display:inline-block;padding:3px;transform:rotate(135deg);-webkit-transform:rotate(135deg);' 122 ); 123 var w = document.createElement('DIV'); 124 w.setAttribute( 125 'style', 126 'position:absolute;width:32px;height:32px;line-height:30px;padding:4xp;text-align:center;top:50%;left:50%;transform:translate(-50%,-50%);border-radius:50%;background-color:#fff;' 127 ); 128 var b = document.createElement('DIV'); 129 b.setAttribute( 130 'style', 131 'position:relative;width:100%;height:100%;' 132 ); 133 var x = document.createElement('DIV'); 134 x.setAttribute( 135 'style', 136 'position:absolute !important;width:2px !important;height:100% !important;top:0px !important;right:' + 137 o.position + 138 '% !important;overflow:visible !important;transform:translateX(50%) !important;background-color: #fff;cursor:e-resize;opacity:' + 139 o.opacity + 140 ';z-index:' + 141 v + 142 '2;' + 143 f 144 ), 145 jQuery(Q).css('border-color', o.arrowColor), 146 jQuery(g).css('border-color', o.arrowColor), 147 jQuery(w).css('background-color', o.bulletColor), 148 jQuery(x).css('background-color', o.separatorColor), 149 w.append(Q), 150 w.append(g), 151 b.append(w), 152 x.append(b), 153 t.append(m), 154 t.append(j), 155 t.append(x), 156 jQuery(r).remove(), 157 jQuery(n).remove(); 158 var M = function () { 159 jQuery(m).children().width() > 0 && 160 jQuery(j) 161 .children() 162 .width(jQuery(m).children().width()), 163 jQuery(m).children().height() > 0 && 164 jQuery(j) 165 .children() 166 .height(jQuery(m).children().height()); 167 }; 168 if ((jQuery(window).on('resize', M), o.movable)) { 169 var k = !1; 170 o.clickMove && 171 (jQuery(m).on('click', function () { 172 void 0 !== o.onMoveStart && o.onMoveStart(); 173 var e = jQuery(t).width(), 174 r = jQuery(x).css('right'), 175 n = ( 176 ((parseInt(r) + Math.min(0.05 * e, 5)) / 177 e) * 178 100 179 ).toFixed(2), 180 i = n > 100 ? 100 : n < 0 ? 0 : n; 181 (i += '%'), 182 jQuery(j).width(i), 183 jQuery(x).css('right', i), 184 void 0 !== o.onMoving && 185 r != jQuery(x).css('right') && 186 o.onMoving(), 187 void 0 !== o.onMoveEnd && o.onMoveEnd(); 188 }), 189 jQuery(j).on('click', function () { 190 void 0 !== o.onMoveStart && o.onMoveStart(); 191 var e = jQuery(t).width(), 192 r = jQuery(x).css('right'), 193 n = ( 194 ((parseInt(r) - Math.min(0.05 * e, 5)) / 195 e) * 196 100 197 ).toFixed(2), 198 i = n > 100 ? 100 : n < 0 ? 0 : n; 199 (i += '%'), 200 jQuery(j).width(i), 201 jQuery(x).css('right', i), 202 void 0 !== o.onMoving && 203 r != jQuery(x).css('right') && 204 o.onMoving(), 205 void 0 !== o.onMoveEnd && o.onMoveEnd(); 206 })), 207 jQuery(t).on('mouseenter', function () { 208 jQuery(x).css('opacity', o.hoverOpacity); 209 }), 210 jQuery(t).on('mouseleave', function () { 211 jQuery(x).css('opacity', o.opacity); 212 }); 213 var E = function (e) { 214 var r = e.pageX || e.touches[0].clientX, 215 n = jQuery(t).offset().left, 216 i = jQuery(t).width(), 217 s = jQuery(x).css('right'), 218 c = (((n + i - r) / i) * 100).toFixed(2), 219 a = c > 100 ? 100 : c < 0 ? 0 : c; 220 (a += '%'), 221 jQuery(j).width(a), 222 jQuery(x).css('right', a), 223 void 0 !== o.onMoving && 224 s != jQuery(x).css('right') && 225 o.onMoving(); 226 }, 227 I = function (e) { 228 (k = !0), 229 jQuery(x).css('opacity', o.opacity), 230 void 0 !== o.onMoveEnd && o.onMoveEnd(); 231 }; 232 jQuery(x).on('mousedown', function (e) { 233 (k = !1), 234 jQuery(x).css('opacity', o.activeOpacity), 235 void 0 !== o.onMoveStart && o.onMoveStart(), 236 jQuery(document).on('mousemove', E), 237 jQuery(document).on('mouseup', function (e) { 238 jQuery(document).off('mousemove', E), 239 k || I(); 240 }), 241 jQuery(window).on('mouseup', function (e) { 242 jQuery(document).off('mousemove', E), 243 k || I(); 244 }); 245 }), 246 jQuery(x).on('touchstart', function (e) { 247 (k = !1), 248 void 0 !== o.onMoveStart && o.onMoveStart(), 249 jQuery(x).css('opacity', o.activeOpacity), 250 jQuery(document).on('touchmove', E), 251 jQuery(document).on( 252 'touchcancel', 253 function (e) { 254 jQuery(document).off( 255 'touchmove', 256 E 257 ), 258 k || I(); 259 } 260 ), 261 jQuery(window).on( 262 'touchcancel', 263 function (e) { 264 jQuery(document).off( 265 'touchmove', 266 E 267 ), 268 k || I(); 269 } 270 ), 271 jQuery(document).on( 272 'touchend', 273 function (e) { 274 jQuery(document).off( 275 'touchmove', 276 E 277 ), 278 k || I(); 279 } 280 ); 281 }); 282 } 283 M(); 284 } else 285 console.log( 286 '%cWarning: %s', 287 'color:#e4672e;font-size:200%;', 288 'BeforeAfter plugin need absolutely two childrens.' 289 ); 290 })(this); 291 }); 292 }; 293})(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.