PageSourceSearch

https://www.felicitysolar.com/wp-content/uploads/ac_assets/uc_before_after/uc-before-after.js?ver=1.5.143

js felicitysolar.com collected 2026-10-04 09:15:21 UTC 23,509 bytes, 501 lines download raw bytes

1!(function (e) {
2  if ("object" == typeof exports && "undefined" != typeof module) module.exports = e();
3  else if ("function" == typeof define && define.amd) define([], e);
4  else {
5    var t;
6    (t = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : this), (t.Cocoen = e());
7  }
8})(function () {
9  return (function e(t, n, i) {
10    function s(o, a) {
11      if (!n[o]) {
12        if (!t[o]) {
13          var l = "function" == typeof require && require;
14          if (!a && l) return l(o, !0);
15          if (r) return r(o, !0);
16          var d = new Error("Cannot find module '" + o + "'");
17          throw ((d.code = "MODULE_NOT_FOUND"), d);
18        }
19        var h = (n[o] = { exports: {} });
20        t[o][0].call(
21          h.exports,
22          function (e) {
23            var n = t[o][1][e];
24            return s(n ? n : e);
25          },
26          h,
27          h.exports,
28          e,
29          t,
30          n,
31          i
32          );
33        }
34        return n[o].exports;
35      }
36      for (var r = "function" == typeof require && require, o = 0; o < i.length; o++) s(i[o]);
37      return s;
38    })(
39      {
40        1: [
41          function (e, t, n) {
42            "use strict";
43            function i(e, t) {
44              if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
45            }
46            var s =
47            Object.assign ||
48            function (e) {
49              for (var t = 1; t < arguments.length; t++) {
50                var n = arguments[t];
51                for (var i in n) Object.prototype.hasOwnProperty.call(n, i) && (e[i] = n[i]);
52              }
53              return e;
54            },
55            r = (function () {
56              function e(e, t) {
57                for (var n = 0; n < t.length; n++) {
58                  var i = t[n];
59                  (i.enumerable = i.enumerable || !1), (i.configurable = !0), "value" in i && (i.writable = !0), Object.defineProperty(e, i.key, i);
60                }
61              }
62              return function (t, n, i) {
63                return n && e(t.prototype, n), i && e(t, i), t;
64              };
65            })(),
66            o = (function () {
67              function e(t, n) {
68                i(this, e), (this.options = s({}, e.defaults, n)), (this.element = t || document.querySelector(".cocoen")), this.init();
69              }
70              return (
71                r(e, [
72                  {
73                    key: "init",
74                    value: function () {
75                      this.lazyLoadProtection(),this.createElements(), this.addEventListeners(), this.dimensions();
76                    },
77                  },
78                  {
79                    key: "lazyLoadProtection",
80                    value: function () {
81                      var objImages = jQuery(this.element).find('img');
82                      
83                      objImages.each(function(){
84                        
85                        var objImage = jQuery(this);
86                        var loadingAttr = objImage.attr('loading');
87                        
88                        if(loadingAttr == undefined || loadingAttr == false || loadingAttr == 'lazy')
89                        return(true);
90                        
91                        objImage.removeAttr('loading');
92                        
93                      })
94                    },
95                  },
96                  {
97                    key: "createElements",
98                    value: function () {
99                      var e = document.createElement("span");
100                      (e.className = this.options.dragElementSelector.replace(".", "")), this.element.appendChild(e);
101                      
102                      if (this.element.querySelector("img:first-child")) 
103                      this.defineElements("img:first-child")
104                      
105                      // support for picture tag
106                      if (this.element.querySelector("picture:first-child"))
107                      this.defineElements("picture:first-child")
108                      
109                    },
110                  },
111                  {
112                    key: "defineElements",
113                    value: function (firstChildElem) {
114                      
115                      var t = document.createElement("div"),
116                      n = this.element.querySelector(firstChildElem);
117                      t.appendChild(n.cloneNode(!0)),
118                      n.parentNode.replaceChild(t, n),
119                      (this.dragElement = this.element.querySelector(this.options.dragElementSelector)),
120                      (this.beforeElement = this.element.querySelector("div:first-child")),
121                      (this.beforeImage = this.beforeElement.querySelector("img"));
122                      (this.labelBefore = this.element.querySelector(".cocoen-label-before"));
123                      (this.labelAfter = this.element.querySelector(".cocoen-label-after"));
124                      
125                    },
126                  },
127                  {
128                    key: "addEventListeners",
129                    value: function () {
130                      var cocoen = this;
131                      this.element.addEventListener("click", this.onTap.bind(this)),
132                      this.element.addEventListener("mouseover", this.onMouseover.bind(this)),
133                      this.element.addEventListener("mousemove", this.onMousemove.bind(this)),
134                      this.element.addEventListener("mouseleave", this.onMouseleave.bind(this)),
135                      this.element.addEventListener("touchmove", this.onTouchDrag.bind(this)),
136                      this.dragElement.addEventListener("mousedown", this.onMouseDragStart.bind(this)),
137                      this.dragElement.addEventListener("touchstart", this.onTouchDragStart.bind(this)),
138                      this.dragElement.addEventListener("touchend", this.onDragEnd.bind(this)),               
139                      window.addEventListener("mouseup", this.onDragEnd.bind(this)),
140                      window.addEventListener("resize", this.dimensions.bind(this)),
141                      jQuery(this.element).on("delayed_start", this.dimensions.bind(this)),                
142                      jQuery(this.labelBefore).on("click", this.onBeforeLabelClick.bind(this)),            
143                      jQuery(this.labelAfter).on("click", this.onAfterLabelClick.bind(this)); 
144                      jQuery(".nav-tabs .nav-item .nav-link").on("click", function(){setTimeout(cocoen.dimensions.bind(cocoen),400)});                         
145                    },
146                  },
147                  {
148                    key: "dimensions",
149                    value: function () {
150                      (this.elementWidth = parseInt(window.getComputedStyle(this.element).width, 10)),
151                      (this.elementHeight = parseInt(window.getComputedStyle(this.element).height, 10)),
152                      (this.elementOffsetLeft = this.element.getBoundingClientRect().left + document.body.scrollLeft),
153                      (this.elementOffsetTop = window.pageYOffset + this.element.getBoundingClientRect().top + document.body.scrollTop),
154                      (this.beforeImage.style.width = this.elementWidth + "px"),
155                      (this.dragElementWidth = parseInt(window.getComputedStyle(this.dragElement).width, 10)),
156                      (this.dragElementHeight = parseInt(window.getComputedStyle(this.dragElement).height, 10)),
157                      (this.minLeftPos = this.elementOffsetLeft),
158                      (this.minTopPos = this.elementOffsetTop),
159                      (this.maxLeftPos = this.elementOffsetLeft + this.elementWidth - this.dragElementWidth);
160                      (this.maxTopPos = this.elementOffsetTop + this.elementHeight - this.dragElementHeight);
161                      (this.startX = 0);
162                      (this.startY = 0);            
163                      (this.isOverElement = false);            
164                    },
165                  },
166                  {
167                    key: "onBeforeLabelClick",
168                    value: function (e) { 
169                      
170                      var objDevider = jQuery(this.dragElement);
171                      var objBeforeElement = jQuery(this.beforeElement);
172                      
173                      objDevider.css("transition", "all .3s");
174                      objBeforeElement.css("transition", "all .3s");
175                      
176                      if(this.options.direction == 'horizontal')                      
177                      this.leftPos = this.maxLeftPos, this.requestDrag();
178                      
179                      if(this.options.direction == 'vertical')                      
180                      this.topPos = this.maxTopPos, this.requestDrag();
181                      
182                      //wait while transition is over
183                      setTimeout(function(){
184                        
185                        objDevider.css("transition", "");
186                        objBeforeElement.css("transition", "");
187                        
188                      },400);
189                      
190                    },
191                  },
192                  {
193                    key: "onAfterLabelClick",
194                    value: function (e) { 
195                      
196                      var objDevider = jQuery(this.dragElement);
197                      var objBeforeElement = jQuery(this.beforeElement);
198                      
199                      objDevider.css("transition", "all .3s");
200                      objBeforeElement.css("transition", "all .3s");
201                      
202                      if(this.options.direction == 'horizontal')
203                      this.leftPos = this.minLeftPos, this.requestDrag();
204                      
205                      if(this.options.direction == 'vertical')
206                      this.topPos = this.minTopPos, this.requestDrag();
207                      
208                      //wait while transition is over
209                      setTimeout(function(){
210                        
211                        objDevider.css("transition", "");
212                        objBeforeElement.css("transition", "");
213                        
214                      },400);
215                      
216                    },
217                  },
218                  {
219                    key: "onMouseover",
220                    value: function (e) { 
221                      
222                      if(this.options.trigger == "hover" && this.isOverElement == false){
223                        
224                        if(this.options.direction == 'horizontal')                        
225                        (this.leftPos = e.pageX ? e.pageX : e.touches[0].pageX), this.requestDrag();
226                        
227                        
228                        if(this.options.direction == 'vertical')   
229                        (this.topPos = e.pageY ? e.pageY : e.touches[0].pageY), this.requestDrag();
230                        
231                        this.isOverElement = true;                        
232                        
233                      }                      
234                      
235                    },
236                  },
237                  {
238                    key: "onMousemove",
239                    value: function (e) {      
240                      
241                      if(this.options.trigger == "hover"){
242                        
243                        if(this.options.direction == 'horizontal')                        
244                        (this.leftPos = e.pageX ? e.pageX : e.touches[0].pageX), this.requestDrag();
245                        
246                        if(this.options.direction == 'vertical')                        
247                        (this.topPos = e.pageY ? e.pageY : e.touches[0].pageY), this.requestDrag();                      
248                        
249                      }else{
250                        
251                        this.onMouseDrag(e);
252                        
253                      }                      
254                      
255                    },
256                  },
257                  {
258                    key: "onMouseleave",
259                    value: function (e) {
260                      
261                      if(this.options.trigger == "hover"){
262                        
263                        this.startX = 0;
264                        this.startY = 0;                  
265                        this.isDragging = !1
266                        this.isOverElement = false
267                        
268                      }
269                      
270                    },
271                  },
272                  {
273                    key: "onTap",
274                    value: function (e) {    
275                      
276                      e.preventDefault();
277                      
278                      if(jQuery(e.target).hasClass("cocoen-label-before") == true)
279                      return(true);
280                      
281                      if(jQuery(e.target).hasClass("cocoen-label-after") == true)
282                      return(true);
283                      
284                      if(this.options.direction == 'horizontal')
285                      (this.leftPos = e.pageX ? e.pageX : e.touches[0].pageX), this.requestDrag();
286                      
287                      if(this.options.direction == 'vertical')
288                      (this.topPos = e.pageY ? e.pageY : e.touches[0].pageY), this.requestDrag();
289                      
290                      
291                    },
292                  },
293                  {
294                    key: "onTouchDragStart",
295                    value: function (e) {
296                      if (e.touches == undefined){
297                        return;
298                      }  
299                      
300                      this.startX = e.touches[0].pageX;
301                      this.startY = e.touches[0].pageY;   
302                      
303                      e.preventDefault();
304                      
305                      if(this.options.direction == 'horizontal'){
306                        
307                        var t = e.pageX ? e.pageX : e.touches[0].pageX,
308                        n = this.dragElement.getBoundingClientRect().left + document.body.scrollLeft;
309                        
310                        (this.posX = n + this.dragElementWidth - t), (this.isDragging = !0);
311                        
312                      }
313                      
314                      if(this.options.direction == 'vertical'){
315                        
316                        var startY = e.pageY ? e.pageY : e.touches[0].pageY;
316 //start Y position after mouse click on handle
317                        var dragElementTopPosition = window.pageYOffset + this.dragElement.getBoundingClientRect().top + document.body.scrollTop; //how much px dragged from top of page
318                        
319                        //find how much px was dragged from start drag 
320                        (this.posY = dragElementTopPosition + this.dragElementHeight - startY), (this.isDragging = !0);                                               
321                        
322                      }
323
324                      
325                      //hide labes during drag
326                      var objBeforeLabel = jQuery(this.labelBefore);
327                      var objAfterLabel = jQuery(this.labelAfter);
328
329                      if(objBeforeLabel && objBeforeLabel.length)
330                      objBeforeLabel.css("opacity", 0);
331
332                      if(objAfterLabel && objAfterLabel.length)
333                      objAfterLabel.css("opacity", 0);
334                      
335                    },
336                  },
337                  {
338                    key: "onMouseDragStart",
339                    value: function (e) {
340                      
341                      e.preventDefault();
342                      
343                      if(this.options.direction == 'horizontal'){
344                        
345                        var t = e.pageX ? e.pageX : e.touches[0].pageX,
346                        n = this.dragElement.getBoundingClientRect().left + document.body.scrollLeft;
347                        
348                        (this.posX = n + this.dragElementWidth - t), (this.isDragging = !0);
349                        
350                      }
351                      
352                      if(this.options.direction == 'vertical'){
353                        
354                        var startY = e.pageY ? e.pageY : e.touches[0].pageY;
354 //start Y position after mouse click on handle
355                        var dragElementTopPosition = window.pageYOffset + this.dragElement.getBoundingClientRect().top + document.body.scrollTop; //how much px dragged from top of page
356                        
357                        //find how much px was dragged from start drag 
358                        (this.posY = dragElementTopPosition + this.dragElementHeight - startY), (this.isDragging = !0);                                               
359                        
360                      }
361                      
362                      //hide labes during drag
363                      var objBeforeLabel = jQuery(this.labelBefore);
364                      var objAfterLabel = jQuery(this.labelAfter);
365
366                      if(objBeforeLabel && objBeforeLabel.length)
367                      objBeforeLabel.css("opacity", 0);
368
369                      if(objAfterLabel && objAfterLabel.length)
370                      objAfterLabel.css("opacity", 0);
371                      
372                    },
373                  },                        
374                  {
375                    key: "onDragEnd",
376                    value: function (e) {       
377                          
378                      this.startX = 0;
379                      this.startY = 0;                  
380                      e.preventDefault(), (this.isDragging = !1);
381
382                       
383                      //hide labes during drag
384                      var objBeforeLabel = jQuery(this.labelBefore);
385                      var objAfterLabel = jQuery(this.labelAfter);
386
387                      if(objBeforeLabel && objBeforeLabel.length)
388                      objBeforeLabel.css("opacity", "");
389
390                      if(objAfterLabel && objAfterLabel.length)
391                      objAfterLabel.css("opacity", "");
392                      
393                    },
394                  },
395                  {
396                    key: "onTouchDrag",
397                    value: function (e) {
398                      
399                      if (e.touches == undefined){
400                        return;
401                      }
402                      
403                      /* check drag direction (higher then 1 means horizontal direction, else - vertical direction) */
404                      var deltaX = Math.abs((e.touches[0].pageX - this.startX) / e.touches[0].pageX);
405                      var deltaY = Math.abs((e.touches[0].pageY - this.startY) / e.touches[0].pageY);
406                      
407                      e.preventDefault();
408                      
409                      if(this.options.direction == 'horizontal'){
410                        
411                        if ( e.cancelable)
412                        this.isDragging && ((this.moveX = e.pageX ? e.pageX : e.touches[0].pageX), (this.leftPos = this.moveX + this.posX - this.dragElementWidth), this.requestDrag());
413                        
414                      }
415                      
416                      //vertical direction
417                      if(this.options.direction == 'vertical'){
418                      
419                        if ( e.cancelable){
420                          this.isDragging && ((this.moveY = e.pageY ? e.pageY : e.touches[0].pageY), (this.topPos = this.moveY + this.posY - this.dragElementHeight), this.requestDrag());
421                          
422                          
423                        }
424                      }
425                    },
426                  },
427                  {
428                    key: "onMouseDrag",
429                    value: function (e) {    
430                      
431                      e.preventDefault();
432                      
433                      if(this.options.direction == 'horizontal')
434                      this.isDragging && ((this.moveX = e.pageX ? e.pageX : e.touches[0].pageX), (this.leftPos = this.moveX + this.posX - this.dragElementWidth), this.requestDrag());
435                      
436                      if(this.options.direction == 'vertical')
437                      this.isDragging && ((this.moveY = e.pageY ? e.pageY : e.touches[0].pageY), (this.topPos = this.moveY + this.posY - this.dragElementHeight), this.requestDrag());
438                      
439                    },
440                  },
441                  {
442                    key: "drag",
443                    value: function () {
444                      
445                      if(this.options.direction == 'horizontal'){
446                        
447                        this.leftPos < this.minLeftPos ? (this.leftPos = this.minLeftPos) : this.leftPos > this.maxLeftPos && (this.leftPos = this.maxLeftPos);
448                        
449                        var e = this.leftPos + this.dragElementWidth / 2 - this.elementOffsetLeft;
450                        
451                        e /= this.elementWidth;
452                        
453                        var t = 100 * e + "%";
454                        
455                        //posistion of the drag element for horizontal position
456                        (this.dragElement.style.left = t), (this.beforeElement.style.width = t), this.options.dragCallback && this.options.dragCallback(e);
457                        
458                      }
459                      
460                      if(this.options.direction == 'vertical'){
461                        
462                        this.topPos < this.minTopPos ? (this.topPos = this.minTopPos) : this.topPos > this.maxTopPos && (this.topPos = this.maxTopPos);
463                        
464                        var relativeTopPos = this.topPos + this.dragElementHeight / 2 - this.elementOffsetTop;
465                        
466                        relativeTopPos /= this.elementHeight; //index between 0 and 1
467                        
468                        var relativeTopPosPercents = 100 * relativeTopPos + "%";
469                        
470                        //posistion of the drag element for vertical position                                            
471                        (this.dragElement.style.top = relativeTopPosPercents), (this.beforeElement.style.height = relativeTopPosPercents), this.options.dragCallback && this.options.dragCallback(e);
472                        
473                      }
474                    },
475                  },
476                  {
477                    key: "requestDrag",
478                    value: function () {
479                      window.requestAnimationFrame(this.drag.bind(this));
480                    },
481                  },
482                ]),
483                e
484                );
485              })();
486              (o.defaults = { 
487                
488                dragElementSelector: ".cocoen-drag", 
489                dragCallback: null,
490                direction: 'vertical',
491                trigger: "click"
492                
493              }), (t.exports = o);
494            },
495            {},
496          ],
497        },
498        {},
499        [1]
500        )(1);
501      });

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.