1function _rplg_badge_init(el) { 2 var badge_cnt = el.querySelector('.rplg-badge-cnt'), 3 is_float = badge_cnt.className.indexOf('-fixed') > -1; 4 if (is_float) { 5 document.body.appendChild(el); 6 } 7 8 var badges = el.querySelectorAll('.rplg-badge2'), 9 rplg = document.createElement('div'); 10 11 for (var i = 0; i < badges.length; i++) { 12 var badge = badges[i], 13 badge_key = 'badge_float_' + badge.getAttribute('data-provider'), 14 session = sessionStorage.getItem(badge_key), 15 btn = badge.querySelector('.rplg-badge2-btn'), 16 close = badge.querySelector('.rplg-badge2-close'), 17 form = badge.querySelector('.rplg-form'); 18 (function(badge, badge_key, session, btn, close, form) { 19 if (is_float) { 20 badge.style.display='block'; 21 } 22 if (close) { 23 if (session) { 24 var data = JSON.parse(session); 25 if (data.hide) { 26 badge.style.display='none'; 27 } 28 } 29 close.onclick = function() { 30 badge.style.display='none'; 31 var value = JSON.parse(sessionStorage.getItem(badge_key) || '{}'); 32 value.hide = true; 33 sessionStorage.setItem(badge_key, JSON.stringify(value)); 34 }; 35 } 36 if (form) { 37 btn.onclick = function() { 38 rplg_load_imgs(form); 39 form.style.display='block'; 40 }; 41 rplg.appendChild(form); 42 } 43 })(badge, badge_key, session, btn, close, form); 44 } 45 46 if (rplg.hasChildNodes()) { 47 rplg.className = 'rplg'; 48 document.body.appendChild(rplg); 49 } 50} 51 52function rplg_load_imgs(el) { 53 var imgs = el.querySelectorAll('img.rplg-blazy[data-src]'); 54 for (var i = 0; i < imgs.length; i++) { 55 imgs[i].setAttribute('src', imgs[i].getAttribute('data-src')); 56 imgs[i].removeAttribute('data-src'); 57 } 58} 59 60function rplg_next_reviews(pagin) { 61 var parent = this.parentNode, 62 selector = '.rplg .rplg-hide'; 63 reviews = parent.querySelectorAll(selector); 64 for (var i = 0; i < pagin && i < reviews.length; i++) { 65 if (reviews[i]) { 66 reviews[i].className = reviews[i].className.replace('rplg-hide', ''); 67 } 68 } 69 reviews = parent.querySelectorAll(selector); 70 if (reviews.length < 1) { 71 parent.removeChild(this); 72 } 73 window.rplg_blazy && window.rplg_blazy.revalidate(); 74 return false; 75} 76 77function rplg_leave_review_window() { 78 _rplg_popup(this.getAttribute('href'), 620, 500); 79 return false; 80} 81 82function _rplg_lang() { 83 var n = navigator; 84 return (n.language || n.systemLanguage || n.userLanguage || 'en').substr(0, 2).toLowerCase(); 85} 86 87function _rplg_popup(url, width, height) { 88 var dual_left = window.screenLeft != undefined ? window.screenLeft : window.screenX, 89 dual_top = window.screenTop != undefined ? window.screenTop : window.screenY, 90 91 doc_elem = document.documentElement, 92 screen_width = window.innerWidth ? window.innerWidth : doc_elem.clientWidth ? doc_elem.clientWidth : screen.width, 93 screen_height = window.innerHeight ? window.innerHeight : doc_elem.clientHeight ? doc_elem.clientHeight : screen.height, 94 95 left = ((screen_width / 2) - (width / 2)) + dual_left, 96 top = ((screen_height / 2) - (height / 2)) + dual_top, 97 win = window.open(url, '', 'scrollbars=yes, width=' + width + ', height=' + height + ', top=' + top + ', left=' + left); 98 99 if (window.focus) { 100 win.focus(); 101 } 102 103 return win; 104} 105 106function _rplg_init_timeago(el) { 107 var els = el.querySelectorAll('.rplg-review-time'); 108 for (var i = 0; i < els.length; i++) { 109 var clss = els[i].className, time; 110 time = parseInt(els[i].getAttribute('data-time')) * 1000; 111 els[i].innerHTML = WPacTime.getTime(time, _rplg_lang(), 'ago'); 112 } 113} 114 115function _rplg_init_blazy(attempts) { 116 if (!window.Blazy) { 117 if (attempts > 0) { 118 setTimeout(function() { _rplg_init_blazy(attempts - 1); }, 200); 119 } 120 return; 121 } 122 window.rplg_blazy = new Blazy({selector: 'img.rplg-blazy'}); 123} 124 125function _rplg_read_more(el) { 126 var read_more = el.querySelectorAll('.rplg-more-toggle'); 127 for (var i = 0; i < read_more.length; i++) { 128 (function(rm) { 129 rm.onclick = function() { 130 rm.parentNode.removeChild(rm.previousSibling.previousSibling); 131 rm.previousSibling.className = ''; 132 rm.textContent = ''; 133 }; 134 })(read_more[i]); 135 } 136} 137 138function _rplg_init_slider(el, data) { 139 if (!window.Rplgsw) { 140 return setTimeout(function() { _rplg_init_slider(el, data); }, 200); 141 } 142 var swiperEl = el.querySelector('.rplgsw-container'), 143 swiperData = { 144 loop : true, 145 autoplay : parseInt(data.speed), 146 effect : data.effect, 147 slidesPerView : parseInt(data.count), 148 spaceBetween : parseInt(data.space), 149 autoHeight : true, 150 fade : { crossFade : true }, 151 breakpoints : {}, 152 onInit : function(swiper) { 153 setTimeout(function() { 154 window.dispatchEvent(new Event('resize')); 155 }, 500); 156 }, 157 onTransitionEnd : function(swiper){ 158 window.rplg_blazy && window.rplg_blazy.revalidate(); 159 } 160 }; 161 162 if (data.pagin) { 163 swiperData.paginationClickable = true; 164 swiperData.pagination = '.rplgsw-pagination'; 165 } 166 if (data.nextprev) { 167 swiperData.nextButton = el.querySelector('.rplg-slider-next'); 168 swiperData.prevButton = el.querySelector('.rplg-slider-prev'); 169 } 170 swiperData.breakpoints[data.mobileBreakpoint] = { 171 slidesPerView: parseInt(data.mobileCount), 172 spaceBetween: 10 173 };
174 swiperData.breakpoints[data.tabletBreakpoint] = { 175 slidesPerView: parseInt(data.tabletCount), 176 spaceBetween: 20 177 }; 178 swiperData.breakpoints[data.desktopBreakpoint] = { 179 slidesPerView: parseInt(data.desktopCount), 180 spaceBetween: 30 181 }; 182 return new Rplgsw(swiperEl, swiperData); 183} 184 185function _rplg_get_parent(el, cl) { 186 cl = cl || 'rplg'; 187 if (el.className.split(' ').indexOf(cl) < 0) { 188 // the last semicolon (;) without braces ({}) in empty loop makes error in WP Faster Cache 189 //while ((el = el.parentElement) && el.className.split(' ').indexOf(cl) < 0); 190 while ((el = el.parentElement) && el.className.split(' ').indexOf(cl) < 0){} 191 } 192 return el; 193} 194 195function rplg_init_slider_theme(el, data) { 196 el = _rplg_get_parent(el); 197 _rplg_init_timeago(el); 198 _rplg_read_more(el); 199 _rplg_init_slider(el, data); 200 _rplg_init_blazy(10); 201} 202 203function rplg_init_grid_theme(el) { 204 el = _rplg_get_parent(el); 205 _rplg_init_timeago(el); 206 _rplg_read_more(el); 207 _rplg_init_blazy(10); 208} 209 210function rplg_init_list_theme(el) { 211 el = _rplg_get_parent(el); 212 _rplg_init_timeago(el); 213 _rplg_read_more(el); 214 _rplg_init_blazy(10); 215} 216 217function rplg_init_badge_theme(el) { 218 el = _rplg_get_parent(el); 219 _rplg_init_timeago(el); 220 _rplg_read_more(el); 221 _rplg_badge_init(el); 222 _rplg_init_blazy(10); 223} 224 225function rplg_init_temp_theme(el, data) { 226 el = _rplg_get_parent(el); 227 _rplg_read_more(el); 228 _rplg_init_blazy(10); 229}
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.