1function rplg_badge_init(el, name, root_class) { 2 if (el.className.indexOf('rplg-badge') < 0) { 3 while ((el = el.parentElement) && el.className.indexOf('rplg-badge') < 0); 4 } 5 6 var btn = el.querySelector('.wp-' + name + '-badge'), 7 form = el.querySelector('.wp-' + name + '-form'); 8 9 if (!btn || !form) return; 10 11 var wpac = document.createElement('div'); 12 wpac.className = root_class + ' wpac'; 13 14 if (btn.className.indexOf('-fixed') > -1) { 15 wpac.appendChild(btn); 16 } 17 wpac.appendChild(form); 18 document.body.appendChild(wpac); 19 20 btn.onclick = function() { 21 rplg_load_imgs(wpac); 22 form.style.display='block'; 23 }; 24} 25 26function rplg_load_imgs(el) { 27 var imgs = el.querySelectorAll('img.rplg-blazy[data-src]'); 28 for (var i = 0; i < imgs.length; i++) { 29 imgs[i].setAttribute('src', imgs[i].getAttribute('data-src')); 30 imgs[i].removeAttribute('data-src'); 31 } 32} 33 34function rplg_next_reviews(name, pagin) { 35 var parent = this.parentNode, 36 selector = '.wp-' + name + '-review.wp-' + name + '-hide'; 37 reviews = parent.querySelectorAll(selector); 38 for (var i = 0; i < pagin && i < reviews.length; i++) { 39 if (reviews[i]) { 40 reviews[i].className = reviews[i].className.replace('wp-' + name + '-hide', ' '); 41 rplg_load_imgs(reviews[i]); 42 } 43 } 44 reviews = parent.querySelectorAll(selector); 45 if (reviews.length < 1) { 46 parent.removeChild(this); 47 } 48 return false; 49} 50 51function rplg_leave_review_window() { 52 _rplg_popup(this.getAttribute('href'), 620, 500); 53 return false; 54} 55 56function _rplg_lang() { 57 var n = navigator; 58 return (n.language || n.systemLanguage || n.userLanguage || 'en').substr(0, 2).toLowerCase(); 59} 60 61function _rplg_popup(url, width, height, prms, top, left) { 62 top = top || (screen.height/2)-(height/2); 63 left = left || (screen.width/2)-(width/2); 64 return window.open(url, '', 'location=1,status=1,resizable=yes,width='+width+',height='+height+',top='+top+',left='+left); 65} 66 67function _rplg_timeago(els) { 68 for (var i = 0; i < els.length; i++) { 69 var clss = els[i].className, time; 70 if (clss.indexOf('google') > -1) { 71 time = parseInt(els[i].getAttribute('data-time')); 72 time *= 1000; 73 } else if (clss.indexOf('facebook') > -1) { 74 time = new Date(els[i].getAttribute('data-time').replace(/\+\d+$/, '') + '.000Z').getTime(); 75 } else { 76 time = new Date(els[i].getAttribute('data-time').replace(/ /, 'T')).getTime(); 77 } 78 els[i].innerHTML = WPacTime.getTime(time, _rplg_lang(), 'ago'); 79 } 80} 81 82function _rplg_init_blazy(attempts) { 83 if (!window.Blazy) { 84 if (attempts > 0) { 85 setTimeout(function() { _rplg_init_blazy(attempts - 1); }, 200); 86 } 87 return; 88 } 89 window.rplg_blazy = new Blazy({selector: 'img.rplg-blazy'}); 90} 91 92function _rplg_init_slider(el, data) { 93 if (!window.Rplgsw) { 94 return setTimeout(function() { _rplg_init_slider(el, data); }, 100); 95 } 96 if (el.className.indexOf('rplg-slider') < 0) { 97 while ((el = el.parentElement) && el.className.indexOf('rplg-slider') < 0); 98 } 99 var swiperEl = el.querySelector('.rplgsw-container'), 100 swiperData = { 101 loop : true, 102 autoplay : data.speed, 103 slidesPerView : data.count, 104 spaceBetween : 40, 105 autoHeight : true, 106 nextButton : el.querySelector('.rplg-slider-next'), 107 prevButton : el.querySelector('.rplg-slider-prev'), 108 breakpoints : { 109 500: { 110 slidesPerView: 1, 111 spaceBetween: 10 112 }, 113 800: { 114 slidesPerView: data.count > 1 ? 2 : 1, 115 spaceBetween: 20 116 }, 117 1024: { 118 slidesPerView: data.count, 119 spaceBetween: 30 120 } 121 }, 122 onTransitionEnd : function(swiper) { 123 window.rplg_blazy && window.rplg_blazy.revalidate(); 124 } 125 }; 126 127 if (data.pagin) { 128 swiperData.paginationClickable = true; 129 swiperData.pagination = '.rplgsw-pagination'; 130 } 131 return new Rplgsw(swiperEl, swiperData); 132} 133 134function rplg_init_slider_theme(el, data) { 135 _rplg_timeago(document.querySelectorAll('.rplg-slider [data-time]')); 136 _rplg_init_blazy(5); 137 _rplg_init_slider(el, data); 138} 139 140document.addEventListener('DOMContentLoaded', function() { 141 _rplg_timeago(document.querySelectorAll('.wpac [data-time]')); 142 _rplg_init_blazy(5); 143});
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.