vendor: 40,521 bytes, lines 1-845
1var cff_js_exists = (typeof cff_js_exists !== 'undefined') ? true : false; 2if(!cff_js_exists){ 3 if (typeof window.cff_block_editor !== 'undefined') { 4 cffmetatrans = false; 5 cffajaxurl = window.cff_block_editor.cffajaxurl; 6 } 7 8 /*! Hammer.JS - v2.0.8 - 2016-04-23 9 * http://hammerjs.github.io/ 10 * 11 * Copyright (c) 2016 Jorik Tangelder; 12 * Licensed under the MIT license 13 * */ 14 if (typeof cffnomobileswipe === 'undefined') { 15 !function (a, b, c, d) { 16 "use strict"; 17 18 function e(a, b, c) { 19 return setTimeout(j(a, c), b) 20 } 21 22 function f(a, b, c) { 23 return Array.isArray(a) ? (g(a, c[b], c), !0) : !1 24 } 25 26 function g(a, b, c) { 27 var e; 28 if (a) if (a.forEach) a.forEach(b, c); else if (a.length !== d) for (e = 0; e < a.length;) b.call(c, a[e], e, a), e++; else for (e in a) a.hasOwnProperty(e) && b.call(c, a[e], e, a) 29 } 30 31 function h(b, c, d) { 32 var e = "DEPRECATED METHOD: " + c + "\n" + d + " AT \n"; 33 return function () { 34 var c = new Error("get-stack-trace"), 35 d = c && c.stack ? c.stack.replace(/^[^\(]+?[\n$]/gm, "").replace(/^\s+at\s+/gm, "").replace(/^Object.<anonymous>\s*\(/gm, "{anonymous}()@") : "Unknown Stack Trace", 36 f = a.console && (a.console.warn || a.console.log); 37 return f && f.call(a.console, e, d), b.apply(this, arguments) 38 } 39 } 40 41 function i(a, b, c) { 42 var d, e = b.prototype; 43 d = a.prototype = Object.create(e), d.constructor = a, d._super = e, c && la(d, c) 44 } 45 46 function j(a, b) { 47 return function () { 48 return a.apply(b, arguments) 49 } 50 } 51 52 function k(a, b) { 53 return typeof a == oa ? a.apply(b ? b[0] || d : d, b) : a 54 } 55 56 function l(a, b) { 57 return a === d ? b : a 58 } 59 60 function m(a, b, c) { 61 g(q(b), function (b) { 62 a.addEventListener(b, c, !1) 63 }) 64 } 65 66 function n(a, b, c) { 67 g(q(b), function (b) { 68 a.removeEventListener(b, c, !1) 69 }) 70 } 71 72 function o(a, b) { 73 for (; a;) { 74 if (a == b) return !0; 75 a = a.parentNode 76 } 77 return !1 78 } 79 80 function p(a, b) { 81 return a.indexOf(b) > -1 82 } 83 84 function q(a) { 85 return a.trim().split(/\s+/g) 86 } 87 88 function r(a, b, c) { 89 if (a.indexOf && !c) return a.indexOf(b); 90 for (var d = 0; d < a.length;) { 91 if (c && a[d][c] == b || !c && a[d] === b) return d; 92 d++ 93 } 94 return -1 95 } 96 97 function s(a) { 98 return Array.prototype.slice.call(a, 0) 99 } 100 101 function t(a, b, c) { 102 for (var d = [], e = [], f = 0; f < a.length;) { 103 var g = b ? a[f][b] : a[f]; 104 r(e, g) < 0 && d.push(a[f]), e[f] = g, f++ 105 } 106 return c && (d = b ? d.sort(function (a, c) { 107 return a[b] > c[b] 108 }) : d.sort()), d 109 } 110 111 function u(a, b) { 112 for (var c, e, f = b[0].toUpperCase() + b.slice(1), g = 0; g < ma.length;) { 113 if (c = ma[g], e = c ? c + f : b, e in a) return e; 114 g++ 115 } 116 return d 117 } 118 119 function v() { 120 return ua++ 121 } 122 123 function w(b) { 124 var c = b.ownerDocument || b; 125 return c.defaultView || c.parentWindow || a 126 } 127 128 function x(a, b) { 129 var c = this; 130 this.manager = a, this.callback = b, this.element = a.element, this.target = a.options.inputTarget, this.domHandler = function (b) { 131 k(a.options.enable, [a]) && c.handler(b) 132 }, this.init() 133 } 134 135 function y(a) { 136 var b, c = a.options.inputClass; 137 return new (b = c ? c : xa ? M : ya ? P : wa ? R : L)(a, z) 138 } 139 140 function z(a, b, c) { 141 var d = c.pointers.length, e = c.changedPointers.length, f = b & Ea && d - e === 0, 142 g = b & (Ga | Ha) && d - e === 0; 143 c.isFirst = !!f, c.isFinal = !!g, f && (a.session = {}), c.eventType = b, A(a, c), a.emit("hammer.input", c), a.recognize(c), a.session.prevInput = c 144 } 145 146 function A(a, b) { 147 var c = a.session, d = b.pointers, e = d.length; 148 c.firstInput || (c.firstInput = D(b)), e > 1 && !c.firstMultiple ? c.firstMultiple = D(b) : 1 === e && (c.firstMultiple = !1); 149 var f = c.firstInput, g = c.firstMultiple, h = g ? g.center : f.center, i = b.center = E(d); 150 b.timeStamp = ra(), b.deltaTime = b.timeStamp - f.timeStamp, b.angle = I(h, i), b.distance = H(h, i), B(c, b), b.offsetDirection = G(b.deltaX, b.deltaY); 151 var j = F(b.deltaTime, b.deltaX, b.deltaY); 152 b.overallVelocityX = j.x, b.overallVelocityY = j.y, b.overallVelocity = qa(j.x) > qa(j.y) ? j.x : j.y, b.scale = g ? K(g.pointers, d) : 1, b.rotation = g ? J(g.pointers, d) : 0, b.maxPointers = c.prevInput ? b.pointers.length > c.prevInput.maxPointers ? b.pointers.length : c.prevInput.maxPointers : b.pointers.length, C(c, b); 153 var k = a.element; 154 o(b.srcEvent.target, k) && (k = b.srcEvent.target), b.target = k 155 } 156 157 function B(a, b) { 158 var c = b.center, d = a.offsetDelta || {}, e = a.prevDelta || {}, f = a.prevInput || {}; 159 b.eventType !== Ea && f.eventType !== Ga || (e = a.prevDelta = { 160 x: f.deltaX || 0, 161 y: f.deltaY || 0 162 }, d = a.offsetDelta = {x: c.x, y: c.y}), b.deltaX = e.x + (c.x - d.x), b.deltaY = e.y + (c.y - d.y) 163 } 164 165 function C(a, b) { 166 var c, e, f, g, h = a.lastInterval || b, i = b.timeStamp - h.timeStamp; 167 if (b.eventType != Ha && (i > Da || h.velocity === d)) { 168 var j = b.deltaX - h.deltaX, k = b.deltaY - h.deltaY, l = F(i, j, k); 169 e = l.x, f = l.y, c = qa(l.x) > qa(l.y) ? l.x : l.y, g = G(j, k), a.lastInterval = b 170 } else c = h.velocity, e = h.velocityX, f = h.velocityY, g = h.direction; 171 b.velocity = c, b.velocityX = e, b.velocityY = f, b.direction = g 172 } 173 174 function D(a) { 175 for (var b = [], c = 0; c < a.pointers.length;) b[c] = { 176 clientX: pa(a.pointers[c].clientX), 177 clientY: pa(a.pointers[c].clientY) 178 }, c++; 179 return {timeStamp: ra(), pointers: b, center: E(b), deltaX: a.deltaX, deltaY: a.deltaY} 180 } 181 182 function E(a) { 183 var b = a.length; 184 if (1 === b) return {x: pa(a[0].clientX), y: pa(a[0].clientY)}; 185 for (var c = 0, d = 0, e = 0; b > e;) c += a[e].clientX, d += a[e].clientY, e++; 186 return {x: pa(c / b), y: pa(d / b)} 187 } 188 189 function F(a, b, c) { 190 return {x: b / a || 0, y: c / a || 0} 191 } 192 193 function G(a, b) { 194 return a === b ? Ia : qa(a) >= qa(b) ? 0 > a ? Ja : Ka : 0 > b ? La : Ma 195 } 196 197 function H(a, b, c) { 198 c || (c = Qa); 199 var d = b[c[0]] - a[c[0]], e = b[c[1]] - a[c[1]]; 200 return Math.sqrt(d * d + e * e) 201 } 202 203 function I(a, b, c) { 204 c || (c = Qa); 205 var d = b[c[0]] - a[c[0]], e = b[c[1]] - a[c[1]]; 206 return 180 * Math.atan2(e, d) / Math.PI 207 } 208 209 function J(a, b) { 210 return I(b[1], b[0], Ra) + I(a[1], a[0], Ra) 211 } 212 213 function K(a, b) { 214 return H(b[0], b[1], Ra) / H(a[0], a[1], Ra) 215 } 216 217 function L() { 218 this.evEl = Ta, this.evWin = Ua, this.pressed = !1, x.apply(this, arguments) 219 } 220 221 function M() { 222 this.evEl = Xa, this.evWin = Ya, x.apply(this, arguments), this.store = this.manager.session.pointerEvents = [] 223 } 224 225 function N() { 226 this.evTarget = $a, this.evWin = _a, this.started = !1, x.apply(this, arguments) 227 } 228 229 function O(a, b) { 230 var c = s(a.touches), d = s(a.changedTouches); 231 return b & (Ga | Ha) && (c = t(c.concat(d), "identifier", !0)), [c, d] 232 } 233 234 function P() { 235 this.evTarget = bb, this.targetIds = {}, x.apply(this, arguments) 236 } 237 238 function Q(a, b) { 239 var c = s(a.touches), d = this.targetIds; 240 if (b & (Ea | Fa) && 1 === c.length) return d[c[0].identifier] = !0, [c, c]; 241 var e, f, g = s(a.changedTouches), h = [], i = this.target; 242 if (f = c.filter(function (a) { 243 return o(a.target, i) 244 }), b === Ea) for (e = 0; e < f.length;) d[f[e].identifier] = !0, e++; 245 for (e = 0; e < g.length;) d[g[e].identifier] && h.push(g[e]), b & (Ga | Ha) && delete d[g[e].identifier], e++; 246 return h.length ? [t(f.concat(h), "identifier", !0), h] : void 0 247 } 248 249 function R() { 250 x.apply(this, arguments); 251 var a = j(this.handler, this); 252 this.touch = new P(this.manager, a), this.mouse = new L(this.manager, a), this.primaryTouch = null, this.lastTouches = [] 253 } 254 255 function S(a, b) { 256 a & Ea ? (this.primaryTouch = b.changedPointers[0].identifier, T.call(this, b)) : a & (Ga | Ha) && T.call(this, b) 257 } 258 259 function T(a) { 260 var b = a.changedPointers[0]; 261 if (b.identifier === this.primaryTouch) { 262 var c = {x: b.clientX, y: b.clientY}; 263 this.lastTouches.push(c); 264 var d = this.lastTouches, e = function () { 265 var a = d.indexOf(c); 266 a > -1 && d.splice(a, 1) 267 }; 268 setTimeout(e, cb) 269 } 270 } 271 272 function U(a) { 273 for (var b = a.srcEvent.clientX, c = a.srcEvent.clientY, d = 0; d < this.lastTouches.length; d++) { 274 var e = this.lastTouches[d], f = Math.abs(b - e.x), g = Math.abs(c - e.y); 275 if (db >= f && db >= g) return !0 276 } 277 return !1 278 } 279 280 function V(a, b) { 281 this.manager = a, this.set(b) 282 } 283 284 function W(a) { 285 if (p(a, jb)) return jb; 286 var b = p(a, kb), c = p(a, lb); 287 return b && c ? jb : b || c ? b ? kb : lb : p(a, ib) ? ib : hb 288 } 289 290 function X() { 291 if (!fb) return !1; 292 var b = {}, c = a.CSS && a.CSS.supports; 293 return ["auto", "manipulation", "pan-y", "pan-x", "pan-x pan-y", "none"].forEach(function (d) { 294 b[d] = c ? a.CSS.supports("touch-action", d) : !0 295 }), b 296 } 297 298 function Y(a) { 299 this.options = la({}, this.defaults, a || {}), this.id = v(), this.manager = null, this.options.enable = l(this.options.enable, !0), this.state = nb, this.simultaneous = {}, this.requireFail = [] 300 } 301 302 function Z(a) { 303 return a & sb ? "cancel" : a & qb ? "end" : a & pb ? "move" : a & ob ? "start" : "" 304 } 305 306 function $(a) { 307 return a == Ma ? "down" : a == La ? "up" : a == Ja ? "left" : a == Ka ? "right" : "" 308 } 309 310 function _(a, b) { 311 var c = b.manager; 312 return c ? c.get(a) : a 313 } 314 315 function aa() { 316 Y.apply(this, arguments) 317 } 318 319 function ba() { 320 aa.apply(this, arguments), this.pX = null, this.pY = null 321 } 322 323 function ca() { 324 aa.apply(this, arguments) 325 } 326 327 function da() { 328 Y.apply(this, arguments), this._timer = null, this._input = null 329 } 330 331 function ea() { 332 aa.apply(this, arguments) 333 } 334 335 function fa() { 336 aa.apply(this, arguments) 337 } 338 339 function ga() { 340 Y.apply(this, arguments), this.pTime = !1, this.pCenter = !1, this._timer = null, this._input = null, this.count = 0 341 } 342 343 function ha(a, b) { 344 return b = b || {}, b.recognizers = l(b.recognizers, ha.defaults.preset), new ia(a, b) 345 } 346 347 function ia(a, b) { 348 this.options = la({}, ha.defaults, b || {}), this.options.inputTarget = this.options.inputTarget || a, this.handlers = {}, this.session = {}, this.recognizers = [], this.oldCssProps = {}, this.element = a, this.input = y(this), this.touchAction = new V(this, this.options.touchAction), ja(this, !0), g(this.options.recognizers, function (a) { 349 var b = this.add(new a[0](a[1])); 350 a[2] && b.recognizeWith(a[2]), a[3] && b.requireFailure(a[3]) 351 }, this) 352 } 353 354 function ja(a, b) { 355 var c = a.element; 356 if (c.style) { 357 var d; 358 g(a.options.cssProps, function (e, f) { 359 d = u(c.style, f), b ? (a.oldCssProps[d] = c.style[d], c.style[d] = e) : c.style[d] = a.oldCssProps[d] || "" 360 }), b || (a.oldCssProps = {}) 361 } 362 } 363 364 function ka(a, c) { 365 var d = b.createEvent("Event"); 366 d.initEvent(a, !0, !0), d.gesture = c, c.target.dispatchEvent(d) 367 } 368 369 var la, ma = ["", "webkit", "Moz", "MS", "ms", "o"], na = b.createElement("div"), oa = "function", 370 pa = Math.round, qa = Math.abs, ra = Date.now; 371 la = "function" != typeof Object.assign ? function (a) { 372 if (a === d || null === a) throw new TypeError("Cannot convert undefined or null to object"); 373 for (var b = Object(a), c = 1; c < arguments.length; c++) { 374 var e = arguments[c]; 375 if (e !== d && null !== e) for (var f in e) e.hasOwnProperty(f) && (b[f] = e[f]) 376 } 377 return b 378 } : Object.assign; 379 var sa = h(function (a, b, c) { 380 for (var e = Object.keys(b), f = 0; f < e.length;) (!c || c && a[e[f]] === d) && (a[e[f]] = b[e[f]]), f++; 381 return a 382 }, "extend", "Use `assign`."), ta = h(function (a, b) { 383 return sa(a, b, !0) 384 }, "merge", "Use `assign`."), ua = 1, va = /mobile|tablet|ip(ad|hone|od)|android/i, 385 wa = "ontouchstart" in a, xa = u(a, "PointerEvent") !== d, ya = wa && va.test(navigator.userAgent), 386 za = "touch", Aa = "pen", Ba = "mouse", Ca = "kinect", Da = 25, Ea = 1, Fa = 2, Ga = 4, Ha = 8, Ia = 1, 387 Ja = 2, Ka = 4, La = 8, Ma = 16, Na = Ja | Ka, Oa = La | Ma, Pa = Na | Oa, Qa = ["x", "y"], 388 Ra = ["clientX", "clientY"]; 389 x.prototype = { 390 handler: function () { 391 }, init: function () { 392 this.evEl && m(this.element, this.evEl, this.domHandler), this.evTarget && m(this.target, this.evTarget, this.domHandler), this.evWin && m(w(this.element), this.evWin, this.domHandler) 393 }, destroy: function () { 394 this.evEl && n(this.element, this.evEl, this.domHandler), this.evTarget && n(this.target, this.evTarget, this.domHandler), this.evWin && n(w(this.element), this.evWin, this.domHandler) 395 } 396 }; 397 var Sa = {mousedown: Ea, mousemove: Fa, mouseup: Ga}, Ta = "mousedown", Ua = "mousemove mouseup"; 398 i(L, x, { 399 handler: function (a) { 400 var b = Sa[a.type]; 401 b & Ea && 0 === a.button && (this.pressed = !0), b & Fa && 1 !== a.which && (b = Ga), this.pressed && (b & Ga && (this.pressed = !1), this.callback(this.manager, b, { 402 pointers: [a], 403 changedPointers: [a], 404 pointerType: Ba, 405 srcEvent: a 406 })) 407 } 408 }); 409 var Va = {pointerdown: Ea, pointermove: Fa, pointerup: Ga, pointercancel: Ha, pointerout: Ha}, 410 Wa = {2: za, 3: Aa, 4: Ba, 5: Ca}, Xa = "pointerdown", Ya = "pointermove pointerup pointercancel"; 411 a.MSPointerEvent && !a.PointerEvent && (Xa = "MSPointerDown", Ya = "MSPointerMove MSPointerUp MSPointerCancel"), i(M, x, { 412 handler: function (a) { 413 var b = this.store, c = !1, d = a.type.toLowerCase().replace("ms", ""), e = Va[d], 414 f = Wa[a.pointerType] || a.pointerType, g = f == za, h = r(b, a.pointerId, "pointerId"); 415 e & Ea && (0 === a.button || g) ? 0 > h && (b.push(a), h = b.length - 1) : e & (Ga | Ha) && (c = !0), 0 > h || (b[h] = a, this.callback(this.manager, e, { 416 pointers: b, 417 changedPointers: [a], 418 pointerType: f, 419 srcEvent: a 420 }), c && b.splice(h, 1)) 421 } 422 }); 423 var Za = {touchstart: Ea, touchmove: Fa, touchend: Ga, touchcancel: Ha}, $a = "touchstart", 424 _a = "touchstart touchmove touchend touchcancel"; 425 i(N, x, { 426 handler: function (a) { 427 var b = Za[a.type]; 428 if (b === Ea && (this.started = !0), this.started) { 429 var c = O.call(this, a, b); 430 b & (Ga | Ha) && c[0].length - c[1].length === 0 && (this.started = !1), this.callback(this.manager, b, { 431 pointers: c[0], 432 changedPointers: c[1], 433 pointerType: za, 434 srcEvent: a 435 }) 436 } 437 } 438 }); 439 var ab = {touchstart: Ea, touchmove: Fa, touchend: Ga, touchcancel: Ha}, 440 bb = "touchstart touchmove touchend touchcancel"; 441 i(P, x, { 442 handler: function (a) { 443 var b = ab[a.type], c = Q.call(this, a, b); 444 c && this.callback(this.manager, b, { 445 pointers: c[0], 446 changedPointers: c[1], 447 pointerType: za, 448 srcEvent: a 449 }) 450 } 451 }); 452 var cb = 2500, db = 25; 453 i(R, x, { 454 handler: function (a, b, c) { 455 var d = c.pointerType == za, e = c.pointerType == Ba; 456 if (!(e && c.sourceCapabilities && c.sourceCapabilities.firesTouchEvents)) { 457 if (d) S.call(this, b, c); else if (e && U.call(this, c)) return; 458 this.callback(a, b, c) 459 } 460 }, destroy: function () { 461 this.touch.destroy(), this.mouse.destroy() 462 } 463 }); 464 var eb = u(na.style, "touchAction"), fb = eb !== d, gb = "compute", hb = "auto", ib = "manipulation", 465 jb = "none", kb = "pan-x", lb = "pan-y", mb = X(); 466 V.prototype = { 467 set: function (a) { 468 a == gb && (a = this.compute()), fb && this.manager.element.style && mb[a] && (this.manager.element.style[eb] = a), this.actions = a.toLowerCase().trim() 469 }, update: function () { 470 this.set(this.manager.options.touchAction) 471 }, compute: function () { 472 var a = []; 473 return g(this.manager.recognizers, function (b) { 474 k(b.options.enable, [b]) && (a = a.concat(b.getTouchAction())) 475 }), W(a.join(" ")) 476 }, preventDefaults: function (a) { 477 var b = a.srcEvent, c = a.offsetDirection; 478 if (this.manager.session.prevented) return void b.preventDefault(); 479 var d = this.actions, e = p(d, jb) && !mb[jb], f = p(d, lb) && !mb[lb], g = p(d, kb) && !mb[kb]; 480 if (e) { 481 var h = 1 === a.pointers.length, i = a.distance < 2, j = a.deltaTime < 250; 482 if (h && i && j) return 483 } 484 return g && f ? void 0 : e || f && c & Na || g && c & Oa ? this.preventSrc(b) : void 0 485 }, preventSrc: function (a) { 486 this.manager.session.prevented = !0, a.preventDefault() 487 } 488 }; 489 var nb = 1, ob = 2, pb = 4, qb = 8, rb = qb, sb = 16, tb = 32; 490 Y.prototype = { 491 defaults: {}, set: function (a) { 492 return la(this.options, a), this.manager && this.manager.touchAction.update(), this 493 }, recognizeWith: function (a) { 494 if (f(a, "recognizeWith", this)) return this; 495 var b = this.simultaneous; 496 return a = _(a, this), b[a.id] || (b[a.id] = a, a.recognizeWith(this)), this 497 }, dropRecognizeWith: function (a) { 498 return f(a, "dropRecognizeWith", this) ? this : (a = _(a, this), delete this.simultaneous[a.id], this) 499 }, requireFailure: function (a) { 500 if (f(a, "requireFailure", this)) return this; 501 var b = this.requireFail; 502 return a = _(a, this), -1 === r(b, a) && (b.push(a), a.requireFailure(this)), this 503 }, dropRequireFailure: function (a) { 504 if (f(a, "dropRequireFailure", this)) return this; 505 a = _(a, this); 506 var b = r(this.requireFail, a); 507 return b > -1 && this.requireFail.splice(b, 1), this 508 }, hasRequireFailures: function () { 509 return this.requireFail.length > 0 510 }, canRecognizeWith: function (a) { 511 return !!this.simultaneous[a.id] 512 }, emit: function (a) { 513 function b(b) { 514 c.manager.emit(b, a) 515 } 516 517 var c = this, d = this.state; 518 qb > d && b(c.options.event + Z(d)), b(c.options.event), a.additionalEvent && b(a.additionalEvent), d >= qb && b(c.options.event + Z(d)) 519 }, tryEmit: function (a) { 520 return this.canEmit() ? this.emit(a) : void (this.state = tb) 521 }, canEmit: function () { 522 for (var a = 0; a < this.requireFail.length;) { 523 if (!(this.requireFail[a].state & (tb | nb))) return !1; 524 a++ 525 } 526 return !0 527 }, recognize: function (a) { 528 var b = la({}, a); 529 return k(this.options.enable, [this, b]) ? (this.state & (rb | sb | tb) && (this.state = nb), this.state = this.process(b), void (this.state & (ob | pb | qb | sb) && this.tryEmit(b))) : (this.reset(), void (this.state = tb)) 530 }, process: function (a) { 531 }, getTouchAction: function () { 532 }, reset: function () { 533 } 534 }, i(aa, Y, { 535 defaults: {pointers: 1}, attrTest: function (a) { 536 var b = this.options.pointers; 537 return 0 === b || a.pointers.length === b 538 }, process: function (a) { 539 var b = this.state, c = a.eventType, d = b & (ob | pb), e = this.attrTest(a); 540 return d && (c & Ha || !e) ? b | sb : d || e ? c & Ga ? b | qb : b & ob ? b | pb : ob : tb 541 } 542 }), i(ba, aa, { 543 defaults: {event: "pan", threshold: 10, pointers: 1, direction: Pa}, 544 getTouchAction: function () { 545 var a = this.options.direction, b = []; 546 return a & Na && b.push(lb), a & Oa && b.push(kb), b 547 }, 548 directionTest: function (a) { 549 var b = this.options, c = !0, d = a.distance, e = a.direction, f = a.deltaX, g = a.deltaY; 550 return e & b.direction || (b.direction & Na ? (e = 0 === f ? Ia : 0 > f ? Ja : Ka, c = f != this.pX, d = Math.abs(a.deltaX)) : (e = 0 === g ? Ia : 0 > g ? La : Ma, c = g != this.pY, d = Math.abs(a.deltaY))), a.direction = e, c && d > b.threshold && e & b.direction 551 }, 552 attrTest: function (a) { 553 return aa.prototype.attrTest.call(this, a) && (this.state & ob || !(this.state & ob) && this.directionTest(a)) 554 }, 555 emit: function (a) { 556 this.pX = a.deltaX, this.pY = a.deltaY; 557 var b = $(a.direction); 558 b && (a.additionalEvent = this.options.event + b), this._super.emit.call(this, a) 559 } 560 }), i(ca, aa, { 561 defaults: {event: "pinch", threshold: 0, pointers: 2}, getTouchAction: function () { 562 return [jb] 563 }, attrTest: function (a) { 564 return this._super.attrTest.call(this, a) && (Math.abs(a.scale - 1) > this.options.threshold || this.state & ob) 565 }, emit: function (a) { 566 if (1 !== a.scale) { 567 var b = a.scale < 1 ? "in" : "out"; 568 a.additionalEvent = this.options.event + b 569 } 570 this._super.emit.call(this, a) 571 } 572 }), i(da, Y, { 573 defaults: {event: "press", pointers: 1, time: 251, threshold: 9}, 574 getTouchAction: function () { 575 return [hb] 576 }, 577 process: function (a) { 578 var b = this.options, c = a.pointers.length === b.pointers, d = a.distance < b.threshold, 579 f = a.deltaTime > b.time; 580 if (this._input = a, !d || !c || a.eventType & (Ga | Ha) && !f) this.reset(); else if (a.eventType & Ea) this.reset(), this._timer = e(function () { 581 this.state = rb, this.tryEmit() 582 }, b.time, this); else if (a.eventType & Ga) return rb; 583 return tb 584 }, 585 reset: function () { 586 clearTimeout(this._timer) 587 }, 588 emit: function (a) { 589 this.state === rb && (a && a.eventType & Ga ? this.manager.emit(this.options.event + "up", a) : (this._input.timeStamp = ra(), this.manager.emit(this.options.event, this._input))) 590 } 591 }), i(ea, aa, { 592 defaults: {event: "rotate", threshold: 0, pointers: 2}, getTouchAction: function () { 593 return [jb] 594 }, attrTest: function (a) { 595 return this._super.attrTest.call(this, a) && (Math.abs(a.rotation) > this.options.threshold || this.state & ob) 596 } 597 }), i(fa, aa, { 598 defaults: {event: "swipe", threshold: 10, velocity: .3, direction: Na | Oa, pointers: 1}, 599 getTouchAction: function () { 600 return ba.prototype.getTouchAction.call(this) 601 }, 602 attrTest: function (a) { 603 var b, c = this.options.direction; 604 return c & (Na | Oa) ? b = a.overallVelocity : c & Na ? b = a.overallVelocityX : c & Oa && (b = a.overallVelocityY), this._super.attrTest.call(this, a) && c & a.offsetDirection && a.distance > this.options.threshold && a.maxPointers == this.options.pointers && qa(b) > this.options.velocity && a.eventType & Ga 605 }, 606 emit: function (a) { 607 var b = $(a.offsetDirection); 608 b && this.manager.emit(this.options.event + b, a), this.manager.emit(this.options.event, a) 609 } 610 }), i(ga, Y, { 611 defaults: { 612 event: "tap", 613 pointers: 1, 614 taps: 1, 615 interval: 300, 616 time: 250, 617 threshold: 9, 618 posThreshold: 10 619 }, getTouchAction: function () { 620 return [ib] 621 }, process: function (a) { 622 var b = this.options, c = a.pointers.length === b.pointers, d = a.distance < b.threshold, 623 f = a.deltaTime < b.time; 624 if (this.reset(), a.eventType & Ea && 0 === this.count) return this.failTimeout(); 625 if (d && f && c) { 626 if (a.eventType != Ga) return this.failTimeout(); 627 var g = this.pTime ? a.timeStamp - this.pTime < b.interval : !0, 628 h = !this.pCenter || H(this.pCenter, a.center) < b.posThreshold; 629 this.pTime = a.timeStamp, this.pCenter = a.center, h && g ? this.count += 1 : this.count = 1, this._input = a; 630 var i = this.count % b.taps; 631 if (0 === i) return this.hasRequireFailures() ? (this._timer = e(function () { 632 this.state = rb, this.tryEmit() 633 }, b.interval, this), ob) : rb 634 } 635 return tb 636 }, failTimeout: function () { 637 return this._timer = e(function () { 638 this.state = tb 639 }, this.options.interval, this), tb 640 }, reset: function () { 641 clearTimeout(this._timer) 642 }, emit: function () { 643 this.state == rb && (this._input.tapCount = this.count, this.manager.emit(this.options.event, this._input)) 644 } 645 }), ha.VERSION = "2.0.8", ha.defaults = { 646 domEvents: !1, 647 touchAction: gb, 648 enable: !0, 649 inputTarget: null, 650 inputClass: null, 651 preset: [[ea, {enable: !1}], [ca, {enable: !1}, ["rotate"]], [fa, {direction: Na}], [ba, {direction: Na}, ["swipe"]], [ga], [ga, { 652 event: "doubletap", 653 taps: 2 654 }, ["tap"]], [da]], 655 cssProps: { 656 userSelect: "none", 657 touchSelect: "none", 658 touchCallout: "none", 659 contentZooming: "none", 660 userDrag: "none", 661 tapHighlightColor: "rgba(0,0,0,0)" 662 } 663 }; 664 var ub = 1, vb = 2; 665 ia.prototype = { 666 set: function (a) { 667 return la(this.options, a), a.touchAction && this.touchAction.update(), a.inputTarget && (this.input.destroy(), this.input.target = a.inputTarget, this.input.init()), this 668 }, stop: function (a) { 669 this.session.stopped = a ? vb : ub 670 }, recognize: function (a) { 671 var b = this.session; 672 if (!b.stopped) { 673 this.touchAction.preventDefaults(a); 674 var c, d = this.recognizers, e = b.curRecognizer; 675 (!e || e && e.state & rb) && (e = b.curRecognizer = null); 676 for (var f = 0; f < d.length;) c = d[f], b.stopped === vb || e && c != e && !c.canRecognizeWith(e) ? c.reset() : c.recognize(a), !e && c.state & (ob | pb | qb) && (e = b.curRecognizer = c), f++ 677 } 678 }, get: function (a) { 679 if (a instanceof Y) return a; 680 for (var b = this.recognizers, c = 0; c < b.length; c++) if (b[c].options.event == a) return b[c]; 681 return null 682 }, add: function (a) { 683 if (f(a, "add", this)) return this; 684 var b = this.get(a.options.event); 685 return b && this.remove(b), this.recognizers.push(a), a.manager = this, this.touchAction.update(), a 686 }, remove: function (a) { 687 if (f(a, "remove", this)) return this; 688 if (a = this.get(a)) { 689 var b = this.recognizers, c = r(b, a); 690 -1 !== c && (b.splice(c, 1), this.touchAction.update()) 691 } 692 return this 693 }, on: function (a, b) { 694 if (a !== d && b !== d) { 695 var c = this.handlers; 696 return g(q(a), function (a) { 697 c[a] = c[a] || [], c[a].push(b) 698 }), this 699 } 700 }, off: function (a, b) { 701 if (a !== d) { 702 var c = this.handlers; 703 return g(q(a), function (a) { 704 b ? c[a] && c[a].splice(r(c[a], b), 1) : delete c[a] 705 }), this 706 } 707 }, emit: function (a, b) { 708 this.options.domEvents && ka(a, b); 709 var c = this.handlers[a] && this.handlers[a].slice(); 710 if (c && c.length) { 711 b.type = a, b.preventDefault = function () { 712 b.srcEvent.preventDefault() 713 }; 714 for (var d = 0; d < c.length;) c[d](b), d++ 715 } 716 }, destroy: function () { 717 this.element && ja(this, !1), this.handlers = {}, this.session = {}, this.input.destroy(), this.element = null 718 } 719 }, la(ha, { 720 INPUT_START: Ea, 721 INPUT_MOVE: Fa, 722 INPUT_END: Ga, 723 INPUT_CANCEL: Ha, 724 STATE_POSSIBLE: nb, 725 STATE_BEGAN: ob, 726 STATE_CHANGED: pb, 727 STATE_ENDED: qb, 728 STATE_RECOGNIZED: rb, 729 STATE_CANCELLED: sb, 730 STATE_FAILED: tb, 731 DIRECTION_NONE: Ia, 732 DIRECTION_LEFT: Ja, 733 DIRECTION_RIGHT: Ka, 734 DIRECTION_UP: La, 735 DIRECTION_DOWN: Ma, 736 DIRECTION_HORIZONTAL: Na, 737 DIRECTION_VERTICAL: Oa, 738 DIRECTION_ALL: Pa, 739 Manager: ia, 740 Input: x, 741 TouchAction: V, 742 TouchInput: P, 743 MouseInput: L, 744 PointerEventInput: M, 745 TouchMouseInput: R, 746 SingleTouchInput: N, 747 Recognizer: Y, 748 AttrRecognizer: aa, 749 Tap: ga, 750 Pan: ba, 751 Swipe: fa, 752 Pinch: ca, 753 Rotate: ea, 754 Press: da, 755 on: m, 756 off: n, 757 each: g, 758 merge: ta, 759 extend: sa, 760 assign: la, 761 inherit: i, 762 bindFn: j, 763 prefixed: u 764 }); 765 var wb = "undefined" != typeof a ? a : "undefined" != typeof self ? self : {}; 766 wb.Hammer = ha, "function" == typeof define && define.amd ? define(function () { 767 return ha 768 }) : "undefined" != typeof module && module.exports ? module.exports = ha : a[c] = ha 769 }(window, document, "Hammer"); 770 (function (factory) { 771 if (typeof define === 'function' && define.amd) { 772 define(['jquery', 'hammerjs'], factory); 773 } else if (typeof exports === 'object') { 774 factory(require('jquery'), require('hammerjs')); 775 } else { 776 factory(jQuery, Hammer); 777 } 778 }(function (jQuery, Hammer) { 779 function hammerify(el, options) { 780 var $el = jQuery(el); 781 if (!$el.data("hammer")) { 782 $el.data("hammer", new Hammer($el[0], options)); 783 } 784 } 785 786 jQuery.fn.hammer = function (options) { 787 return this.each(function () { 788 hammerify(this, options); 789 }); 790 }; 791 792 // extend the emit method to also trigger jQuery events 793 Hammer.Manager.prototype.emit = (function (originalEmit) { 794 return function (type, data) { 795 originalEmit.call(this, type, data); 796 jQuery(this.element).trigger({ 797 type: type, 798 gesture: data 799 }); 800 }; 801 })(Hammer.Manager.prototype.emit); 802 })); 803 804 } else { 805 var Hammer = { 806 Manager: { 807 prototype: {} 808 } 809 }; 810 (function (factory) { 811 if (typeof define === 'function' && define.amd) { 812 define(['jquery', 'hammerjs'], factory); 813 } else if (typeof exports === 'object') { 814 factory(require('jquery'), require('hammerjs')); 815 } else { 816 factory(jQuery, Hammer); 817 } 818 }(function (jQuery, Hammer) { 819 function hammerify(el, options) { 820 } 821 822 jQuery.fn.hammer = function (options) { 823 return this.each(function () { 824 hammerify(this, options); 825 }); 826 }; 827 // extend the emit method to also trigger jQuery events 828 Hammer.Manager.prototype.emit = (function (originalEmit) { 829 return function (type, data) { 830 originalEmit.call(this, type, data); 831 jQuery(this.element).trigger({ 832 type: type, 833 gesture: data 834 }); 835 }; 836 })(Hammer.Manager.prototype.emit); 837 })); 838 } 839 840//Only load the Masonry code if there's a masonry feed on the page 841 if( jQuery('#cff.cff-masonry-js').length || typeof window.cff_block_editor !== 'undefined'){ 842 //Masonry 843 !function(a){function b(){} 844 function c(a){function c(b){b.prototype.option||(b.prototype.option=function(b){a.isPlainObject(b)&&(this.options=a.extend(!0,this.options,b))})} 845 function e(b,c){a.fn[b]=function(e){if("string"==typeof e){for(var g=d.c
845all(arguments,1),h=0,i=this.length;i>h;h++){var j=this[h],k=a.data(j,b);if(k)if(a.isFunction(k[e])&&"_"!==e.charAt(0)){var l=k[e].apply(k,g);if(void 0!==l)return l}else f("no such method '"+e+"' for "+b+" instance");else f("cannot call methods on "+b+" prior to initialization; attempted to call '"+e+"'")} 846 return this} 847 return this.each(function(){var d=a.data(this,b);d?(d.option(e),d._init()):(d=new c(this,e),a.data(this,b,d))})}} 848 if(a){var f="undefined"==typeof console?b:function(a){console.error(a)};return a.bridget=function(a,b){c(b),e(a,b)},a.bridget}} 849 var d=Array.prototype.slice;"function"==typeof define&&define.amd?define("jquery-bridget/jquery.bridget",["jquery"],c):c("object"==typeof exports?require("jquery"):a.jQuery)}(window),function(a){function b(b){var c=a.event;return c.target=c.target||c.srcElement||b,c} 850 var c=document.documentElement,d=function(){};c.addEventListener?d=function(a,b,c){a.addEventListener(b,c,!1)}:c.attachEvent&&(d=function(a,c,d){a[c+d]=d.handleEvent?function(){var c=b(a);d.handleEvent.call(d,c)}:function(){var c=b(a);d.call(a,c)},a.attachEvent("on"+c,a[c+d])});var e=function(){};c.removeEventListener?e=function(a,b,c){a.removeEventListener(b,c,!1)}:c.detachEvent&&(e=function(a,b,c){a.detachEvent("on"+b,a[b+c]);try{delete a[b+c]}catch(d){a[b+c]=void 0}});var f={bind:d,unbind:e};"function"==typeof define&&define.amd?define("eventie/eventie",f):"object"==typeof exports?module.exports=f:a.eventie=f}(window),function(){function a(){} 851 function b(a,b){for(var c=a.length;c--;)if(a[c].listener===b)return c;return-1} 852 function c(a){return function(){return this[a].apply(this,arguments)}} 853 var d=a.prototype,e=this,f=e.EventEmitter;d.getListeners=function(a){var b,c,d=this._getEvents();if(a instanceof RegExp){b={};for(c in d)d.hasOwnProperty(c)&&a.test(c)&&(b[c]=d[c])}else b=d[a]||(d[a]=[]);return b},d.flattenListeners=function(a){var b,c=[];for(b=0;b<a.length;b+=1)c.push(a[b].listener);return c},d.getListenersAsObject=function(a){var b,c=this.getListeners(a);return c instanceof Array&&(b={},b[a]=c),b||c},d.addListener=function(a,c){var d,e=this.getListenersAsObject(a),f="object"==typeof c;for(d in e)e.hasOwnProperty(d)&&-1===b(e[d],c)&&e[d].push(f?c:{listener:c,once:!1});return this},d.on=c("addListener"),d.addOnceListener=function(a,b){return this.addListener(a,{listener:b,once:!0})},d.once=c("addOnceListener"),d.defineEvent=function(a){return this.getListeners(a),this},d.defineEvents=function(a){for(var b=0;b<a.length;b+=1)this.defineEvent(a[b]);return this},d.removeListener=function(a,c){var d,e,f=this.getListenersAsObject(a);for(e in f)f.hasOwnProperty(e)&&(d=b(f[e],c),-1!==d&&f[e].splice(d,1));return this},d.off=c("removeListener"),d.addListeners=function(a,b){return this.manipulateListeners(!1,a,b)},d.removeListeners=function(a,b){return this.manipulateListeners(!0,a,b)},d.manipulateListeners=function(a,b,c){var d,e,f=a?this.removeListener:this.addListener,g=a?this.removeListeners:this.addListeners;if("object"!=typeof b||b instanceof RegExp)for(d=c.length;d--;)f.call(this,b,c[d]);else for(d in b)b.hasOwnProperty(d)&&(e=b[d])&&("function"==typeof e?f.call(this,d,e):g.call(this,d,e));return this},d.removeEvent=function(a){var b,c=typeof a,d=this._getEvents();if("string"===c)delete d[a];else if(a instanceof RegExp)for(b in d)d.hasOwnProperty(b)&&a.test(b)&&delete d[b];else delete this._events;return this},d.removeAllListeners=c("removeEvent"),d.emitEvent=function(a,b){var c,d,e,f,g=this.getListenersAsObject(a);for(e in g)if(g.hasOwnProperty(e))for(d=g[e].length;d--;)c=g[e][d],c.once===!0&&this.removeListener(a,c.listener),f=c.listener.apply(this,b||[]),f===this._getOnceReturnValue()&&this.removeListener(a,c.listener);return this},d.trigger=c("emitEvent"),d.emit=function(a){var b=Array.prototype.slice.call(arguments,1);return this.emitEvent(a,b)},d.setOnceReturnValue=function(a){return this._onceReturnValue=a,this},d._getOnceReturnValue=function(){return this.hasOwnProperty("_onceReturnValue")?this._onceReturnValue:!0},d._getEvents=function(){return this._events||(this._events={})},a.noConflict=function(){return e.EventEmitter=f,a},"function"==typeof define&&define.amd?define("eventEmitter/EventEmitter",[],function(){return a}):"object"==typeof module&&module.exports?module.exports=a:e.EventEmitter=a}.call(this),function(a){function b(a){if(a){if("string"==typeof d[a])return a;a=a.charAt(0).toUpperCase()+a.slice(1);for(var b,e=0,f=c.length;f>e;e++)if(b=c[e]+a,"string"==typeof d[b])return b}} 854 var c="Webkit Moz ms Ms O".split(" "),d=document.documentElement.style;"function"==typeof define&&define.amd?define("get-style-property/get-style-property",[],function(){return b}):"object"==typeof exports?module.exports=b:a.getStyleProperty=b}(window),function(a){function b(a){var b=parseFloat(a),c=-1===a.indexOf("%")&&!isNaN(b);return c&&b} 855 function c(){} 856 function d(){for(var a={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},b=0,c=g.length;c>b;b++){var d=g[b];a[d]=0} 857 return a} 858 function e(c){function e(){if(!m){m=!0;var d=a.getComputedStyle;if(j=function(){var a=d?function(a){return d(a,null)}:function(a){return a.currentStyle};return function(b){var c=a(b);return c||f("Style returned "+c+". Are you running this code in a hidden iframe on Firefox? See http://bit.ly/getsizebug1"),c}}(),k=c("boxSizing")){var e=document.createElement("div");e.style.width="200px",e.style.padding="1px 2px 3px 4px",e.style.borderStyle="solid",e.style.borderWidth="1px 2px 3px 4px",e.style[k]="border-box";var g=document.body||document.documentElement;g.appendChild(e);var h=j(e);l=200===b(h.width),g.removeChild(e)}}}
859 function h(a){if(e(),"string"==typeof a&&(a=document.querySelector(a)),a&&"object"==typeof a&&a.nodeType){var c=j(a);if("none"===c.display)return d();var f={};f.width=a.offsetWidth,f.height=a.offsetHeight;for(var h=f.isBorderBox=!(!k||!c[k]||"border-box"!==c[k]),m=0,n=g.length;n>m;m++){var o=g[m],p=c[o];p=i(a,p);var q=parseFloat(p);f[o]=isNaN(q)?0:q} 860 var r=f.paddingLeft+f.paddingRight,s=f.paddingTop+f.paddingBottom,t=f.marginLeft+f.marginRight,u=f.marginTop+f.marginBottom,v=f.borderLeftWidth+f.borderRightWidth,w=f.borderTopWidth+f.borderBottomWidth,x=h&&l,y=b(c.width);y!==!1&&(f.width=y+(x?0:r+v));var z=b(c.height);return z!==!1&&(f.height=z+(x?0:s+w)),f.innerWidth=f.width-(r+v),f.innerHeight=f.height-(s+w),f.outerWidth=f.width+t,f.outerHeight=f.height+u,f}} 861 function i(b,c){if(a.getComputedStyle||-1===c.indexOf("%"))return c;var d=b.style,e=d.left,f=b.runtimeStyle,g=f&&f.left;return g&&(f.left=b.currentStyle.left),d.left=c,c=d.pixelLeft,d.left=e,g&&(f.left=g),c} 862 var j,k,l,m=!1;return h} 863 var f="undefined"==typeof console?c:function(a){console.error(a)},g=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"];"function"==typeof define&&define.amd?define("get-size/get-size",["get-style-property/get-style-property"],e):"object"==typeof exports?module.exports=e(require("desandro-get-style-property")):a.getSize=e(a.getStyleProperty)}(window),function(a){function b(a){"function"==typeof a&&(b.isReady?a():g.push(a))} 864 function c(a){var c="readystatechange"===a.type&&"complete"!==f.readyState;b.isReady||c||d()} 865 function d(){b.isReady=!0;for(var a=0,c=g.length;c>a;a++){var d=g[a];d()}} 866 function e(e){return"complete"===f.readyState?d():(e.bind(f,"DOMContentLoaded",c),e.bind(f,"readystatechange",c),e.bind(a,"load",c)),b} 867 var f=a.document,g=[];b.isReady=!1,"function"==typeof define&&define.amd?define("doc-ready/doc-ready",["eventie/eventie"],e):"object"==typeof exports?module.exports=e(require("eventie")):a.docReady=e(a.eventie)}(window),function(a){function b(a,b){return a[g](b)} 868 function c(a){if(!a.parentNode){var b=document.createDocumentFragment();b.appendChild(a)}} 869 function d(a,b){c(a);for(var d=a.parentNode.querySelectorAll(b),e=0,f=d.length;f>e;e++)if(d[e]===a)return!0;return!1} 870 function e(a,d){return c(a),b(a,d)} 871 var f,g=function(){if(a.matches)return"matches";if(a.matchesSelector)return"matchesSelector";for(var b=["webkit","moz","ms","o"],c=0,d=b.length;d>c;c++){var e=b[c],f=e+"MatchesSelector";if(a[f])return f}}();if(g){var h=document.createElement("div"),i=b(h,"div");f=i?b:e}else f=d;"function"==typeof define&&define.amd?define("matches-selector/matches-selector",[],function(){return f}):"object"==typeof exports?module.exports=f:window.matchesSelector=f}(Element.prototype),function(a,b){"function"==typeof define&&define.amd?define("fizzy-ui-utils/utils",["doc-ready/doc-ready","matches-selector/matches-selector"],function(c,d){return b(a,c,d)}):"object"==typeof exports?module.exports=b(a,require("doc-ready"),require("desandro-matches-selector")):a.fizzyUIUtils=b(a,a.docReady,a.matchesSelector)}(window,function(a,b,c){var d={};d.extend=function(a,b){for(var c in b)a[c]=b[c];return a},d.modulo=function(a,b){return(a%b+b)%b};var e=Object.prototype.toString;d.isArray=function(a){return"[object Array]"==e.call(a)},d.makeArray=function(a){var b=[];if(d.isArray(a))b=a;else if(a&&"number"==typeof a.length)for(var c=0,e=a.length;e>c;c++)b.push(a[c]);else b.push(a);return b},d.indexOf=Array.prototype.indexOf?function(a,b){return a.indexOf(b)}:function(a,b){for(var c=0,d=a.length;d>c;c++)if(a[c]===b)return c;return-1},d.removeFrom=function(a,b){var c=d.indexOf(a,b);-1!=c&&a.splice(c,1)},d.isElement="function"==typeof HTMLElement||"object"==typeof HTMLElement?function(a){return a instanceof HTMLElement}:function(a){return a&&"object"==typeof a&&1==a.nodeType&&"string"==typeof a.nodeName},d.setText=function(){function a(a,c){b=b||(void 0!==document.documentElement.textContent?"textContent":"innerText"),a[b]=c} 872 var b;return a}(),d.getParent=function(a,b){for(;a!=document.body;)if(a=a.parentNode,c(a,b))return a},d.getQueryElement=function(a){return"string"==typeof a?document.querySelector(a):a},d.handleEvent=function(a){var b="on"+a.type;this[b]&&this[b](a)},d.filterFindElements=function(a,b){a=d.makeArray(a);for(var e=[],f=0,g=a.length;g>f;f++){var h=a[f];if(d.isElement(h))if(b){c(h,b)&&e.push(h);for(var i=h.querySelectorAll(b),j=0,k=i.length;k>j;j++)e.push(i[j])}else e.push(h)} 873 return e},d.debounceMethod=function(a,b,c){var d=a.prototype[b],e=b+"Timeout";a.prototype[b]=function(){var a=this[e];a&&clearTimeout(a);var b=arguments,f=this;this[e]=setTimeout(function(){d.apply(f,b),delete f[e]},c||100)}},d.toDashed=function(a){return a.replace(/(.)([A-Z])/g,function(a,b,c){return b+"-"+c}).toLowerCase()};var f=a.console;return d.htmlInit=function(c,e){b(function(){for(var b=d.toDashed(e),g=document.querySelectorAll(".js-"+b),h="data-"+b+"-options",i=0,j=g.length;j>i;i++){var k,l=g[i],m=l.getAttribute(h);try{k=m&&JSON.parse(m)}catch(n){f&&f.error("Error parsing "+h+" on "+l.nodeName.toLowerCase()+(l.id?"#"+l.id:"")+": "+n);continue} 874 var o=new c(l,k),p=a.jQuery;p&&p.data(l,e,o)}})},d}),function(a,b){"function"==typeof define&&define.amd?define("outlayer/item",["eventEmitter/EventEmitter","get-size/get-size","get-style-property/get-style-property","fizzy-ui-utils/utils"],function(c,d,e,f){return b(a,c,d,e,f)}):"object"==typeof exports?module.exports=b(a,require("wolfy87-eventemitter"),require("get-size"),require("desandro-get-style-property"),require("fizzy-ui-utils")):(a.Outlayer={}
874,a.Outlayer.Item=b(a,a.EventEmitter,a.getSize,a.getStyleProperty,a.fizzyUIUtils))}(window,function(a,b,c,d,e){function f(a){for(var b in a)return!1;return b=null,!0} 875 function g(a,b){a&&(this.element=a,this.layout=b,this.position={x:0,y:0},this._create())} 876 var h=a.getComputedStyle,i=h?function(a){return h(a,null)}:function(a){return a.currentStyle},j=d("transition"),k=d("transform"),l=j&&k,m=!!d("perspective"),n={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"otransitionend",transition:"transitionend"}[j],o=["transform","transition","transitionDuration","transitionProperty"],p=function(){for(var a={},b=0,c=o.length;c>b;b++){var e=o[b],f=d(e);f&&f!==e&&(a[e]=f)} 877 return a}();e.extend(g.prototype,b.prototype),g.prototype._create=function(){this._transn={ingProperties:{},clean:{},onEnd:{}},this.css({position:"absolute"})},g.prototype.handleEvent=function(a){var b="on"+a.type;this[b]&&this[b](a)},g.prototype.getSize=function(){this.size=c(this.element)},g.prototype.css=function(a){var b=this.element.style;for(var c in a){var d=p[c]||c;b[d]=a[c]}},g.prototype.getPosition=function(){var a=i(this.element),b=this.layout.options,c=b.isOriginLeft,d=b.isOriginTop,e=parseInt(a[c?"left":"right"],10),f=parseInt(a[d?"top":"bottom"],10);e=isNaN(e)?0:e,f=isNaN(f)?0:f;var g=this.layout.size;e-=c?g.paddingLeft:g.paddingRight,f-=d?g.paddingTop:g.paddingBottom,this.position.x=e,this.position.y=f},g.prototype.layoutPosition=function(){var a=this.layout.size,b=this.layout.options,c={},d=b.isOriginLeft?"paddingLeft":"paddingRight",e=b.isOriginLeft?"left":"right",f=b.isOriginLeft?"right":"left",g=this.position.x+a[d];g=b.percentPosition&&!b.isHorizontal?g/a.width*100+"%":g+"px",c[e]=g,c[f]="";var h=b.isOriginTop?"paddingTop":"paddingBottom",i=b.isOriginTop?"top":"bottom",j=b.isOriginTop?"bottom":"top",k=this.position.y+a[h];k=b.percentPosition&&b.isHorizontal?k/a.height*100+"%":k+"px",c[i]=k,c[j]="",this.css(c),this.emitEvent("layout",[this])};var q=m?function(a,b){return"translate3d("+a+"px, "+b+"px, 0)"}:function(a,b){return"translate("+a+"px, "+b+"px)"};g.prototype._transitionTo=function(a,b){this.getPosition();var c=this.position.x,d=this.position.y,e=parseInt(a,10),f=parseInt(b,10),g=e===this.position.x&&f===this.position.y;if(this.setPosition(a,b),g&&!this.isTransitioning)return void this.layoutPosition();var h=a-c,i=b-d,j={},k=this.layout.options;h=k.isOriginLeft?h:-h,i=k.isOriginTop?i:-i,j.transform=q(h,i),this.transition({to:j,onTransitionEnd:{transform:this.layoutPosition},isCleaning:!0})},g.prototype.goTo=function(a,b){this.setPosition(a,b),this.layoutPosition()},g.prototype.moveTo=l?g.prototype._transitionTo:g.prototype.goTo,g.prototype.setPosition=function(a,b){this.position.x=parseInt(a,10),this.position.y=parseInt(b,10)},g.prototype._nonTransition=function(a){this.css(a.to),a.isCleaning&&this._removeStyles(a.to);for(var b in a.onTransitionEnd)a.onTransitionEnd[b].call(this)},g.prototype._transition=function(a){if(!parseFloat(this.layout.options.transitionDuration))return void this._nonTransition(a);var b=this._transn;for(var c in a.onTransitionEnd)b.onEnd[c]=a.onTransitionEnd[c];for(c in a.to)b.ingProperties[c]=!0,a.isCleaning&&(b.clean[c]=!0);if(a.from){this.css(a.from);var d=this.element.offsetHeight;d=null} 878 this.enableTransition(a.to),this.css(a.to),this.isTransitioning=!0};var r=k&&e.toDashed(k)+",opacity";g.prototype.enableTransition=function(){this.isTransitioning||(this.css({transitionProperty:r,transitionDuration:this.layout.options.transitionDuration}),this.element.addEventListener(n,this,!1))},g.prototype.transition=g.prototype[j?"_transition":"_nonTransition"],g.prototype.onwebkitTransitionEnd=function(a){this.ontransitionend(a)},g.prototype.onotransitionend=function(a){this.ontransitionend(a)};var s={"-webkit-transform":"transform","-moz-transform":"transform","-o-transform":"transform"};g.prototype.ontransitionend=function(a){if(a.target===this.element){var b=this._transn,c=s[a.propertyName]||a.propertyName;if(delete b.ingProperties[c],f(b.ingProperties)&&this.disableTransition(),c in b.clean&&(this.element.style[a.propertyName]="",delete b.clean[c]),c in b.onEnd){var d=b.onEnd[c];d.call(this),delete b.onEnd[c]} 879 this.emitEvent("transitionEnd",[this])}},g.prototype.disableTransition=function(){this.removeTransitionStyles(),this.element.removeEventListener(n,this,!1),this.isTransitioning=!1},g.prototype._removeStyles=function(a){var b={};for(var c in a)b[c]="";this.css(b)};var t={transitionProperty:"",transitionDuration:""};return g.prototype.removeTransitionStyles=function(){this.css(t)},g.prototype.removeElem=function(){this.element.parentNode.removeChild(this.element),this.css({display:""}),this.emitEvent("remove",[this])},g.prototype.remove=function(){if(!j||!parseFloat(this.layout.options.transitionDuration))return void this.removeElem();var a=this;this.once("transitionEnd",function(){a.removeElem()}),this.hide()},g.prototype.reveal=function(){delete this.isHidden,this.css({display:""});var a=this.layout.options,b={}
879,c=this.getHideRevealTransitionEndProperty("visibleStyle");b[c]=this.onRevealTransitionEnd,this.transition({from:a.hiddenStyle,to:a.visibleStyle,isCleaning:!0,onTransitionEnd:b})},g.prototype.onRevealTransitionEnd=function(){this.isHidden||this.emitEvent("reveal")},g.prototype.getHideRevealTransitionEndProperty=function(a){var b=this.layout.options[a];if(b.opacity)return"opacity";for(var c in b)return c},g.prototype.hide=function(){this.isHidden=!0,this.css({display:""});var a=this.layout.options,b={},c=this.getHideRevealTransitionEndProperty("hiddenStyle");b[c]=this.onHideTransitionEnd,this.transition({from:a.visibleStyle,to:a.hiddenStyle,isCleaning:!0,onTransitionEnd:b})},g.prototype.onHideTransitionEnd=function(){this.isHidden&&(this.css({display:"none"}),this.emitEvent("hide"))},g.prototype.destroy=function(){this.css({position:"",left:"",right:"",top:"",bottom:"",transition:"",transform:""})},g}),function(a,b){"function"==typeof define&&define.amd?define("outlayer/outlayer",["eventie/eventie","eventEmitter/EventEmitter","get-size/get-size","fizzy-ui-utils/utils","./item"],function(c,d,e,f,g){return b(a,c,d,e,f,g)}):"object"==typeof exports?module.exports=b(a,require("eventie"),require("wolfy87-eventemitter"),require("get-size"),require("fizzy-ui-utils"),require("./item")):a.Outlayer=b(a,a.eventie,a.EventEmitter,a.getSize,a.fizzyUIUtils,a.Outlayer.Item)}(window,function(a,b,c,d,e,f){function g(a,b){var c=e.getQueryElement(a);if(!c)return void(h&&h.error("Bad element for "+this.constructor.namespace+": "+(c||a)));this.element=c,i&&(this.$element=i(this.element)),this.options=e.extend({},this.constructor.defaults),this.option(b);var d=++k;this.element.outlayerGUID=d,l[d]=this,this._create(),this.options.isInitLayout&&this.layout()} 880 var h=a.console,i=a.jQuery,j=function(){},k=0,l={};return g.namespace="outlayer",g.Item=f,g.defaults={containerStyle:{position:"relative"},isInitLayout:!0,isOriginLeft:!0,isOriginTop:!0,isResizeBound:!0,isResizingContainer:!0,transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}},e.extend(g.prototype,c.prototype),g.prototype.option=function(a){e.extend(this.options,a)},g.prototype._create=function(){this.reloadItems(),this.stamps=[],this.stamp(this.options.stamp),e.extend(this.element.style,this.options.containerStyle),this.options.isResizeBound&&this.bindResize()},g.prototype.reloadItems=function(){this.items=this._itemize(this.element.children)},g.prototype._itemize=function(a){for(var b=this._filterFindItemElements(a),c=this.constructor.Item,d=[],e=0,f=b.length;f>e;e++){var g=b[e],h=new c(g,this);d.push(h)} 881 return d},g.prototype._filterFindItemElements=function(a){return e.filterFindElements(a,this.options.itemSelector)},g.prototype.getItemElements=function(){for(var a=[],b=0,c=this.items.length;c>b;b++)a.push(this.items[b].element);return a},g.prototype.layout=function(){this._resetLayout(),this._manageStamps();var a=void 0!==this.options.isLayoutInstant?this.options.isLayoutInstant:!this._isLayoutInited;this.layoutItems(this.items,a),this._isLayoutInited=!0},g.prototype._init=g.prototype.layout,g.prototype._resetLayout=function(){this.getSize()},g.prototype.getSize=function(){this.size=d(this.element)},g.prototype._getMeasurement=function(a,b){var c,f=this.options[a];f?("string"==typeof f?c=this.element.querySelector(f):e.isElement(f)&&(c=f),this[a]=c?d(c)[b]:f):this[a]=0},g.prototype.layoutItems=function(a,b){a=this._getItemsForLayout(a),this._layoutItems(a,b),this._postLayout()},g.prototype._getItemsForLayout=function(a){for(var b=[],c=0,d=a.length;d>c;c++){var e=a[c];e.isIgnored||b.push(e)} 882 return b},g.prototype._layoutItems=function(a,b){if(this._emitCompleteOnItems("layout",a),a&&a.length){for(var c=[],d=0,e=a.length;e>d;d++){var f=a[d],g=this._getItemLayoutPosition(f);g.item=f,g.isInstant=b||f.isLayoutInstant,c.push(g)} 883 this._processLayoutQueue(c)}},g.prototype._getItemLayoutPosition=function(){return{x:0,y:0}},g.prototype._processLayoutQueue=function(a){for(var b=0,c=a.length;c>b;b++){var d=a[b];this._positionItem(d.item,d.x,d.y,d.isInstant)}},g.prototype._positionItem=function(a,b,c,d){d?a.goTo(b,c):a.moveTo(b,c)},g.prototype._postLayout=function(){this.resizeContainer()},g.prototype.resizeContainer=function(){if(this.options.isResizingContainer){var a=this._getContainerSize();a&&(this._setContainerMeasure(a.width,!0),this._setContainerMeasure(a.height,!1))}},g.prototype._getContainerSize=j,g.prototype._setContainerMeasure=function(a,b){if(void 0!==a){var c=this.size;c.isBorderBox&&(a+=b?c.paddingLeft+c.paddingRight+c.borderLeftWidth+c.borderRightWidth:c.paddingBottom+c.paddingTop+c.borderTopWidth+c.borderBottomWidth),a=Math.max(a,0),this.element.style[b?"width":"height"]=a+"px"}},g.prototype._emitCompleteOnItems=function(a,b){function c(){e.emitEvent(a+"Complete",[b])} 884 function d(){g++,g===f&&c()} 885 var e=this,f=b.length;if(!b||!f)return void c();for(var g=0,h=0,i=b.length;i>h;h++){var j=b[h];j.once(a,d)}},g.prototype.ignore=function(a){var b=this.getItem(a);b&&(b.isIgnored=!0)},g.prototype.unignore=function(a){var b=this.getItem(a);b&&delete b.isIgnored}
885,g.prototype.stamp=function(a){if(a=this._find(a)){this.stamps=this.stamps.concat(a);for(var b=0,c=a.length;c>b;b++){var d=a[b];this.ignore(d)}}},g.prototype.unstamp=function(a){if(a=this._find(a))for(var b=0,c=a.length;c>b;b++){var d=a[b];e.removeFrom(this.stamps,d),this.unignore(d)}},g.prototype._find=function(a){return a?("string"==typeof a&&(a=this.element.querySelectorAll(a)),a=e.makeArray(a)):void 0},g.prototype._manageStamps=function(){if(this.stamps&&this.stamps.length){this._getBoundingRect();for(var a=0,b=this.stamps.length;b>a;a++){var c=this.stamps[a];this._manageStamp(c)}}},g.prototype._getBoundingRect=function(){var a=this.element.getBoundingClientRect(),b=this.size;this._boundingRect={left:a.left+b.paddingLeft+b.borderLeftWidth,top:a.top+b.paddingTop+b.borderTopWidth,right:a.right-(b.paddingRight+b.borderRightWidth),bottom:a.bottom-(b.paddingBottom+b.borderBottomWidth)}},g.prototype._manageStamp=j,g.prototype._getElementOffset=function(a){var b=a.getBoundingClientRect(),c=this._boundingRect,e=d(a),f={left:b.left-c.left-e.marginLeft,top:b.top-c.top-e.marginTop,right:c.right-b.right-e.marginRight,bottom:c.bottom-b.bottom-e.marginBottom};return f},g.prototype.handleEvent=function(a){var b="on"+a.type;this[b]&&this[b](a)},g.prototype.bindResize=function(){this.isResizeBound||(b.bind(a,"resize",this),this.isResizeBound=!0)},g.prototype.unbindResize=function(){this.isResizeBound&&b.unbind(a,"resize",this),this.isResizeBound=!1},g.prototype.onresize=function(){function a(){b.resize(),delete b.resizeTimeout} 886 this.resizeTimeout&&clearTimeout(this.resizeTimeout);var b=this;this.resizeTimeout=setTimeout(a,100)},g.prototype.resize=function(){this.isResizeBound&&this.needsResizeLayout()&&this.layout()},g.prototype.needsResizeLayout=function(){var a=d(this.element),b=this.size&&a;return b&&a.innerWidth!==this.size.innerWidth},g.prototype.addItems=function(a){var b=this._itemize(a);return b.length&&(this.items=this.items.concat(b)),b},g.prototype.appended=function(a){var b=this.addItems(a);b.length&&(this.layoutItems(b,!0),this.reveal(b))},g.prototype.prepended=function(a){var b=this._itemize(a);if(b.length){var c=this.items.slice(0);this.items=b.concat(c),this._resetLayout(),this._manageStamps(),this.layoutItems(b,!0),this.reveal(b),this.layoutItems(c)}},g.prototype.reveal=function(a){this._emitCompleteOnItems("reveal",a);for(var b=a&&a.length,c=0;b&&b>c;c++){var d=a[c];d.reveal()}},g.prototype.hide=function(a){this._emitCompleteOnItems("hide",a);for(var b=a&&a.length,c=0;b&&b>c;c++){var d=a[c];d.hide()}},g.prototype.revealItemElements=function(a){var b=this.getItems(a);this.reveal(b)},g.prototype.hideItemElements=function(a){var b=this.getItems(a);this.hide(b)},g.prototype.getItem=function(a){for(var b=0,c=this.items.length;c>b;b++){var d=this.items[b];if(d.element===a)return d}},g.prototype.getItems=function(a){a=e.makeArray(a);for(var b=[],c=0,d=a.length;d>c;c++){var f=a[c],g=this.getItem(f);g&&b.push(g)} 887 return b},g.prototype.remove=function(a){var b=this.getItems(a);if(this._emitCompleteOnItems("remove",b),b&&b.length)for(var c=0,d=b.length;d>c;c++){var f=b[c];f.remove(),e.removeFrom(this.items,f)}},g.prototype.destroy=function(){var a=this.element.style;a.height="",a.position="",a.width="";for(var b=0,c=this.items.length;c>b;b++){var d=this.items[b];d.destroy()} 888 this.unbindResize();var e=this.element.outlayerGUID;delete l[e],delete this.element.outlayerGUID,i&&i.removeData(this.element,this.constructor.namespace)},g.data=function(a){a=e.getQueryElement(a);var b=a&&a.outlayerGUID;return b&&l[b]}
888,g.create=function(a,b){function c(){g.apply(this,arguments)} 889 return Object.create?c.prototype=Object.create(g.prototype):e.extend(c.prototype,g.prototype),c.prototype.constructor=c,c.defaults=e.extend({},g.defaults),e.extend(c.defaults,b),c.prototype.settings={},c.namespace=a,c.data=g.data,c.Item=function(){f.apply(this,arguments)},c.Item.prototype=new f,e.htmlInit(c,a),i&&i.bridget&&i.bridget(a,c),c},g.Item=f,g}),function(a,b){"function"==typeof define&&define.amd?define(["outlayer/outlayer","get-size/get-size","fizzy-ui-utils/utils"],b):"object"==typeof exports?module.exports=b(require("outlayer"),require("get-size"),require("fizzy-ui-utils")):a.Masonry=b(a.Outlayer,a.getSize,a.fizzyUIUtils)}(window,function(a,b,c){var d=a.create("masonry");return d.prototype._resetLayout=function(){this.getSize(),this._getMeasurement("columnWidth","outerWidth"),this._getMeasurement("gutter","outerWidth"),this.measureColumns();var a=this.cols;for(this.colYs=[];a--;)this.colYs.push(0);this.maxY=0},d.prototype.measureColumns=function(){if(this.getContainerWidth(),!this.columnWidth){var a=this.items[0],c=a&&a.element;this.columnWidth=c&&b(c).outerWidth||this.containerWidth} 890 var d=this.columnWidth+=this.gutter,e=this.containerWidth+this.gutter,f=e/d,g=d-e%d,h=g&&1>g?"round":"floor";f=Math[h](f),this.cols=Math.max(f,1)},d.prototype.getContainerWidth=function(){var a=this.options.isFitWidth?this.element.parentNode:this.element,c=b(a);this.containerWidth=c&&c.innerWidth},d.prototype._getItemLayoutPosition=function(a){a.getSize();var b=a.size.outerWidth%this.columnWidth,d=b&&1>b?"round":"ceil",e=Math[d](a.size.outerWidth/this.columnWidth);e=Math.min(e,this.cols);for(var f=this._getColGroup(e),g=Math.min.apply(Math,f),h=c.indexOf(f,g),i={x:this.columnWidth*h,y:g},j=g+a.size.outerHeight,k=this.cols+1-f.length,l=0;k>l;l++)this.colYs[h+l]=j;return i},d.prototype._getColGroup=function(a){if(2>a)return this.colYs;for(var b=[],c=this.cols+1-a,d=0;c>d;d++){var e=this.colYs.slice(d,d+a);b[d]=Math.max.apply(Math,e)} 891 return b},d.prototype._manageStamp=function(a){var c=b(a),d=this._getElementOffset(a),e=this.options.isOriginLeft?d.left:d.right,f=e+c.outerWidth,g=Math.floor(e/this.columnWidth);g=Math.max(0,g);var h=Math.floor(f/this.columnWidth);h-=f%this.columnWidth?0:1,h=Math.min(this.cols-1,h);for(var i=(this.options.isOriginTop?d.top:d.bottom)+c.outerHeight,j=g;h>=j;j++)this.colYs[j]=Math.max(i,this.colYs[j])},d.prototype._getContainerSize=function(){this.maxY=Math.max.apply(Math,this.colYs);var a={height:this.maxY};return this.options.isFitWidth&&(a.width=this._getContainerFitWidth()),a},d.prototype._getContainerFitWidth=function(){for(var a=0,b=this.cols;--b&&0===this.colYs[b];)a++;return(this.cols-a)*this.columnWidth-this.gutter},d.prototype.needsResizeLayout=function(){var a=this.containerWidth;return this.getContainerWidth(),a!==this.containerWidth},d}) 892 893 function cffAddMasonry($self) { 894 895 var evt = jQuery.Event('cffbeforemasonry'); 896 evt.$self = $self; 897 jQuery(window).trigger(evt); 898 899 if (typeof $self.masonry !== 'function') { 900 return; 901 } 902 var windowWidth = jQuery(window).width(), 903 masonryEnabled = false; 904 905 if (windowWidth > 800) { 906 if (! $self.hasClass('masonry-1-desktop')) { 907 masonryEnabled = true; 908 $self.addClass('cff-masonry cff-masonry-js').removeClass('cff-disable-masonry'); 909 } 910 } else if (windowWidth > 400) { 911 if ($self.hasClass('masonry-2-tablet') 912 || $self.hasClass('masonry-3-tablet') 913 || $self.hasClass('masonry-4-tablet') 914 || $self.hasClass('masonry-5-tablet') 915 || $self.hasClass('masonry-6-tablet')) { 916 masonryEnabled = true; 917 $self.addClass('cff-masonry cff-masonry-js').removeClass('cff-disable-masonry'); 918 } 919 } else { 920 if ($self.hasClass('masonry-2-mobile') 921 || $self.hasClass('masonry-3-mobile')) { 922 masonryEnabled = true; 923 $self.addClass('cff-masonry cff-masonry-js').removeClass('cff-disable-masonry'); 924 } 925 } 926 927 if ($self.hasClass('cff-masonry')) { 928 $self.find('.cff-album-item a').removeAttr('style'); 929 } 930 931 if (masonryEnabled) { 932 if($self.find('.cff-item').length) { 933 window.cffMasonrySettings.itemSelector = '.cff-new, .cff
933-item, .cff-likebox'; 934 $self.masonry(window.cffMasonrySettings); 935 // Add margin to the bottom of each post to give some space 936 $self.find('.cff-item').each( function() { 937 jQuery(this).css('margin-bottom', '15px'); 938 }); 939 } else if($self.find('.cff-album-item').length) { 940 window.cffMasonrySettings.itemSelector = '.cff-album-item, .cff-likebox'; 941 $self.masonry(window.cffMasonrySettings); 942 } 943 } 944 } 945 946 } //End Masonry code 947 948 window.cffMasonrySettings = {itemSelector: '.cff-album-item' }; 949 950 function Cff() { 951 this.feeds = {}; 952 this.options = {}; 953 } 954 955 Cff.prototype = { 956 createPage: function (createFeeds, createFeedsArgs) { 957 958 if (typeof window.cffOptions === 'undefined' 959 || typeof window.cffOptions.resized_url === 'undefined') { 960 window.cffOptions = { 961 resized_url: location.protocol + '//' + window.location.hostname + "/wp-content/uploads/sb-facebook-feed-images/", 962 placeholder: location.protocol + '//' + window.location.hostname + "/wp-content/plugins/custom-facebook-feed-pro/assets/img/placeholder.png", 963 } 964 } 965 966 createFeeds(createFeedsArgs); 967 }, 968 createFeeds: function (args) { 969 jQuery('.cff').each(function (index) { 970 jQuery(this).attr('data-cff-index', index + 1); 971 var $self = jQuery(this), 972 flags = typeof $self.attr('data-cff-flags') !== 'undefined' ? $self.attr('data-cff-flags').split(',') : []; 973 var feedOptions = { 974 feedID : $self.find('.cff_resized_image_data').attr('data-feedid'), 975 shortCodeAtts : $self.attr('data-cff-shortcode'), 976 resizingEnabled : $self.find('.cff_resized_image_data').length, 977 page: 1, 978 pag_url : '', 979 gdpr : (flags.indexOf('gdpr') > -1), 980 overrideBlockCDN : (flags.indexOf('overrideBlockCDN') > -1), 981 consentGiven : false, 982 locator : (flags.indexOf('locator') > -1), 983 postID : typeof $self.attr( 'data-postid' ) !== 'undefind' ? $self.attr( 'data-postid' ) : 'unknown', 984 }; 985 986 window.cff.feeds[index] = new CffFeed(this, index, feedOptions); 987 if (typeof window.cff.feeds[index].setResizedImages !== 'undefined') { 988 window.cff.feeds[index].setResizedImages(); 989 } 990 if (typeof window.cff.feeds[index].setResizedImages !== 'undefined') { 991 window.cff.feeds[index].init(); 992 } 993 }); 994 }, 995 996 }; 997 998 function CffFeed(el, index, settings) { 999 this.el = el; 1000 this.index = index; 1001 this.settings = settings; 1002 this.resizedImages = {}; 1003 this.needsResizing = []; 1004 this.imagesWaiting = 0; 1005 } 1006 1007 function CFFLocationGuess($cff = false) { 1008 var $feed = ($cff == false) ? jQuery(this.el) : $cff, 1009 location = 'content'; 1010 1011 if ($feed.closest('footer').length) { 1012 location = 'footer'; 1013 } else if ($feed.closest('.header').length 1014 || $feed.closest('header').length) { 1015 location = 'header'; 1016 } else if ($feed.closest('.sidebar').length 1017 || $feed.closest('aside').length) { 1018 location = 'sidebar'; 1019 } 1020 1021 return location; 1022 } 1023 1024 CffFeed.prototype = { 1025 init: function() { 1026 var feed = this; 1027 feed.settings.consentGiven = feed.checkConsent(); 1028 if (!feed.settings.consentGiven) { 1029 if (jQuery(this.el).find('.cff-load-more').is(':visible')) { 1030 jQuery(this.el).find('.cff-load-more').hide().addClass('cff-no-consent-hide'); 1031 } 1032 var $wrapper = jQuery(this.el).closest('.cff-wrapper'); 1033 if ($wrapper.find('.cff-visual-header').length) { 1034 $wrapper.find('.cff-header-text').closest('.cff-visual-header').addClass('cff-no-consent'); 1035 } 1036 $wrapper.find('.fb-video').addClass('cff-no-consent'); 1037 1038 setTimeout(function() { 1039 feed.settings.consentGiven = feed.checkConsent(); 1040 if (feed.settings.consentGiven) { 1041 feed.addFullFeatures(); 1042 } 1043 },1000); 1044 } 1045 1046 var cff_delay = (function () { 1047 var cff_timer = 0; 1048 return function (cff_callback, cff_ms) { 1049 clearTimeout(cff_timer); 1050 cff_timer = setTimeout(cff_callback, cff_ms); 1051 }; 1052 })(); 1053 this.afterInitialImagesLoaded(); 1054 jQuery(window).on('resize', function () { 1055 cff_delay(function () { 1056 feed.afterResize(); 1057 }, 500); 1058 }); 1059 1060 jQuery(this.el).find('.cff-item').each(function() { 1061 feed.lazyLoadCheck(jQuery(this)); 1062 }); 1063 1064 }, 1065 addFullFeatures: function() { 1066 var $ = jQuery, 1067 $self = jQuery(this.el); 1068 jQuery('.cff-gdpr-notice').remove(); 1069 1070 jQuery(this.el).find('.cff-author-img').each(function() { 1071 $(this).find('img').attr('src',$(this).attr('data-avatar')); 1072 $(this).removeClass('cff-no-consent'); 1073 }); 1074 jQuery('.fb-video.cff-no-consent').removeClass('cff-no-consent'); 1075 1076 if (jQuery('.cff-visual-header').length) { 1077 jQuery('.cff-visual-header').each(function() { 1078 jQuery(this).removeClass('cff-no-consent'); 1079 if (jQuery(this).find('.cff-header-hero').length) { 1080 jQuery(this).find('.cff-header-hero').find('img').attr('src',jQuery(this).find('.cff-header-hero').find('img').attr('data-cover-url')) 1081 } 1082 if (jQuery(this).find('.cff-header-img').length) { 1083 jQuery(this).find('.cff-header-img').find('img').attr('src',jQuery(this).find('.cff-header-img').find('img').attr('data-avatar')) 1084 } 1085 }); 1086 1087 1088 } 1089 jQuery('.cff-comment:visible').each(function() { 1090 var $thisComment = jQuery(this); // here 1091 var consentGiven = (typeof window.cff !== 'undefined' && typeof window.cff.feeds !== 'undefined') ? window.cff.feeds[0].settings.consentGiven : true; 1092 if (consentGiven) { 1093 $thisComment.find('.cff-comment-img:not(.cff-comment-reply-img) a, .cff-comment-img:not(.cff-comment-reply-img) span').html('<img src="' + $thisComment.attr("data-avatar") + '" alt="Avatar" onerror="this.style.display=\'none\'" />'); 1094 } 1095 }); 1096 1097 //cff-comment-image-placeholder, <img src="'+commentItem.attachment.media.image.src+'" alt=""/> 1098 jQuery('.cff-comment-image-placeholder').each(function() { 1099 jQuery(this).replaceWith('<img src="'+jQuery(this).attr('data-src')+'" alt="Attachement"/>'); 1100 }); 1101 // 1102 jQuery('.cff-likebox iframe').each(function(){ 1103 var $likebox = $(this), 1104 likeboxWidth = $likebox.attr('data-likebox-width'), 1105 cffFeedWidth = $likebox.parent().width(); 1106 1107 //Default width is 340 1108 if( likeboxWidth == '' ) likeboxWidth = 340; 1109 //Change the width dynamically so it's responsive 1110 if( cffFeedWidth < likeboxWidth ) likeboxWidth = cffFeedWidth; 1111 1112 $likebox.attr('src', 'https://www.facebook.com/plugins/page.php?href=https%3A%2F%2Fwww.facebook.com%2F'+$likebox.attr('data-likebox-id')+'%2F&tabs&width='+Math.floor(likeboxWidth)+'&small_header='+$likebox.attr('data-likebox-header')+'&adapt_container_width=true&hide_cover='+$likebox.attr('data-hide-cover')+'&hide_cta='+$likebox.attr('data-hide-cta')+'&show_facepile='+$likebox.attr('data-likebox-faces')+'&locale='+$likebox.attr('data-locale')); 1113 }); 1114 jQuery('.cff-iframe-placeholder').each(function(){ 1115 var $placeholder = jQuery(this), 1116 src = $placeholder.attr('data-src'), 1117 type = $placeholder.attr('data-type'); 1118 switch (type) { 1119 case 'facebook': 1120 $placeholder.replaceWith('<iframe src="'+src+'" title="Facebook video player" allowfullscreen frameborder="0" webkitallowfullscreen mozallowfullscreen></iframe>'); 1121 break; 1122 case 'youtube': 1123 $placeholder.replaceWith('<iframe class="youtube-player" type="text/html" src="'+src+'" allowfullscreen title="YouTube video"></iframe>'); 1124 break; 1125 case 'vimeo': 1126 $placeholder.replaceWith('<iframe src="'+src+'" webkitAllowFullScreen mozallowfullscreen allowFullScreen title="Vimeo video"></iframe>'); 1127 break; 1128 case 'soundcloud': 1129 $placeholder.replaceWith('<iframe class="cff-soundcloud" width="100%" height="100" scrolling="no" title="Music player" frameborder="no" src="'+src+'"></iframe>'); 1130 break; 1131 case 'spotify': 1132 $placeholder.replaceWith('<iframe class="cff-spotify" src="'+src+'" width="100%" height="80" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe>'); 1133 break; 1134 case 'video': 1135 var posterSrc = $placeholder.attr('data-poster-src'); 1136 $placeholder.replaceWith('<video src="'+src+'" poster="'+posterSrc+'" preload="none"></video>'); 1137 break; 1138 } 1139 }); 1140 1141 jQuery('a[data-x-cff-lightbox]').each(function() { 1142 jQuery(this).attr('data-cff-lightbox',jQuery(this).attr('data-x-cff-lightbox')); 1143 jQuery(this).removeAttr('data-x-cff-lightbox'); 1144 }); 1145 1146 jQuery(this.el).find('.cff-load-more.cff-no-consent-hide').show(); 1147 1148 this.afterResize(); 1149 }, 1150 setResizedImages: function() { 1151 if (jQuery(this.el).find('.cff_resized_image_data').length 1152 && typeof jQuery(this.el).find('.cff_resized_image_data').attr('data-resized') !== 'undefined' 1153 && (jQuery(this.el).find('.cff_resized_image_data').attr('data-resized').indexOf('{"') === 0 || jQuery(this.el).find('.cff_resized_image_data').attr('data-resized').indexOf('[') === 0)) { 1154 var rawResized = JSON.parse(jQuery(this.el).find('.cff_resized_image_data').attr('data-resized')), 1155 organizedResized = {}; 1156 1157 jQuery.each(rawResized,function(index,value) { 1158 organizedResized[value.facebook_id] = { 1159 id: value.media_id, 1160 sizes: JSON.parse(value.sizes), 1161 aspect: value.aspect_ratio 1162 } 1163 1164 }); 1165 1166 this.resizedImages = organizedResized; 1167 } 1168 jQuery(this.el).find('.cff_resized_image_data').remove(); 1169 }, 1170 sendNeedsResizingToServer: function() { 1171 var feed = this; 1172 1173 if (feed.needsResizing.length > 0 && feed.settings.resizingEnabled) { 1174 var itemOffset = jQuery(this.el).find('.cff-item').length; 1175 if (!feed.settings.consentGiven 1176 && !feed.settings.overrideBlockCDN) { 1177 if (typeof jQuery(this.el).find('.cff-lightbox-link').attr('data-cff-lightbox') !== 'undefined') { 1178 jQuery(this.el).find('.cff-lightbox-link').attr('data-x-cff-lightbox',jQuery(this.el).find('.cff-lightbox-link').attr('data-cff-lightbox')); 1179 jQuery(this.el).find('.cff-lightbox-link').removeAttr('data-cff-lightbox'); 1180 } 1181 } 1182 1183 var submitData = { 1184 action: 'cff_resized_images_submit', 1185 needs_resizing: feed.needsResizing, 1186 offset: itemOffset, 1187 feed_id: feed.settings.feedID, 1188 atts: feed.settings.shortCodeAtts, 1189 pag_url: feed.pag_url, 1190 location: CFFLocationGuess(), 1191 post_id: feed.settings.postID, 1192 }; 1193 var onSuccess = function(data) { 1194 feed.needsResizing = []; 1195 if (data.trim().indexOf('{') === 0) { 1196 var response = JSON.parse(data); 1197 if (feed.settings.debugEnabled) { 1198 console.log(response); 1199 } 1200 1201 if (typeof response.resizing !== 'undefined') { 1202 var resized = response.resizing; 1203 for (var property in resized) { 1204 if (resized.hasOwnProperty(property)) { 1205 feed.resizedImages[property] = resized[property]; 1206 } 1207 } 1208 feed.maybeRaiseImageResolution(); 1209 1210 if (typeof jQuery(feed.el).find('.cff-lightbox-link').attr('data-x-cff-lightbox') !== 'undefined') { 1211 jQuery(feed.el).find('.cff-lightbox-link').attr('data-cff-lightbox',jQuery(feed.el).find('.cff-lightbox-link').attr('data-x-cff-lightbox')); 1212 jQuery(feed.el).find('.cff-lightbox-link').removeAttr('data-x-cff-lightbox'); 1213 } 1214 1215 setTimeout(function() { 1216 feed.afterResize(); 1217 },500); 1218 } 1219 } 1220 }; 1221 cffAjax(submitData,onSuccess); 1222 } else if (feed.settings.locator) { 1223 var submitData = { 1224 action: 'cff_do_locator', 1225 feed_id: feed.settings.feedID, 1226 atts: feed.settings.shortCodeAtts, 1227 location: CFFLocationGuess(), 1228 post_id: feed.settings.postID 1229 }; 1230 var onSuccess = function(data) { 1231 1232 }; 1233 cffAjax(submitData,onSuccess); 1234 } 1235 }, 1236 hasTargetElement: function($cffItem) { 1237 var $target = $cffItem; 1238 if ($cffItem.find('.cff-photo').length) { 1239 $target = $cffItem.find('.cff-photo'); 1240 } else if ($cffItem.find('.cff-poster').length) { 1241 $target = $cffItem.find('.cff-poster'); 1242 } else if ($cffItem.find('.cff-link-slider-slides').length) { 1243 $target = $cffItem.find('.cff-link-slider-slides'); 1244 } else if ($cffItem.find('.cff-img-wrap').length) { 1245 $target = $cffItem.find('.cff-img-wrap'); 1246 } else if ($cffItem.find('.cff-album-cover').length) { 1247 $target = $cffItem.find('.cff-album-cover'); 1248 } else if ($cffItem.find('.cff-link').length) { 1249 $target = $cffItem.find('.cff-link'); 1250 } 1251 1252 return typeof $target.attr('data-img-src-set') !== 'undefined'; 1253 }, 1254 getTargetElement: function($cffItem) { 1255 var $target = $cffItem.find('.cff-photo'); 1256 1257 if ($cffItem.find('.cff-poster').length) { 1258 $target = $cffItem.find('.cff-poster'); 1259 } else if ($cffI
1259tem.find('.cff-link-slider-slides').length) { 1260 $target = $cffItem.find('.cff-link-slider-item'); 1261 } else if ($cffItem.find('.cff-img-wrap').length) { 1262 $target = $cffItem.find('.cff-img-wrap'); 1263 } else if ($cffItem.find('.cff-album-cover').length) { 1264 $target = $cffItem.find('.cff-album-cover'); 1265 } else if ($cffItem.find('.cff-link').length) { 1266 $target = $cffItem.find('.cff-link'); 1267 } 1268 1269 return $target; 1270 }, 1271 getTargetElementImage: function($targetItem) { 1272 if ($targetItem.find('img').length) { 1273 return $targetItem.find('img'); 1274 } else { 1275 return $targetItem; 1276 } 1277 }, 1278 getTargetWidth: function($imgWrapItem,$item,index) { 1279 var width = 50, 1280 newWidth = 0; 1281 1282 if ($item.find('.cff-multi-image').length > 2 && index > 0) { 1283 newWidth = $item.innerWidth() / 3; 1284 } else if ($item.closest('.cff-masonry').length) { 1285 newWidth = $item.innerWidth(); 1286 } else if ($imgWrapItem.closest('.cff-item').find('.cff-link-slider').length) { 1287 newWidth = $imgWrapItem.closest('.cff-item').find('.cff-link-slider').width(); 1288 } else if ($imgWrapItem.closest('.cff-media-wrap').length 1289 && !$imgWrapItem.closest('.cff-thumb-layout').length 1290 && !$imgWrapItem.closest('.cff-half-layout').length) { 1291 newWidth = $imgWrapItem.closest('.cff-media-wrap').width(); 1292 } else { 1293 newWidth = $imgWrapItem.innerWidth(); 1294 } 1295 1296 return Math.max(width,newWidth); 1297 }, 1298 maybeRaiseSingleImageResolution: function ($item, index, forceChange) { 1299 var feed = this, 1300 $target = feed.getTargetElement($item), 1301 imgSrcSet = feed.getImageUrls($item,$target); 1302 1303 $target.each(function(i) { 1304 var $imgWrapItem = jQuery(this), 1305 $targetImageElement = feed.getTargetElementImage($imgWrapItem), 1306 currentUrl = $targetImageElement.attr('src'), 1307 currentRes = typeof $imgWrapItem.attr('data-current') === 'undefined' ? 0 : parseInt($imgWrapItem.attr('data-current')), 1308 neededRes = feed.getTargetWidth($imgWrapItem,$item,i), 1309 changeToRes = false; 1310 if (currentRes < neededRes && typeof imgSrcSet[i] !== 'undefined') { 1311 var foundBestRes = false; 1312 jQuery.each(imgSrcSet[i], function (ii, value) { 1313 1314 if (! foundBestRes && ii > currentRes) { 1315 changeToRes = ii; 1316 if (ii >= neededRes) { 1317 foundBestRes = true; 1318 } 1319 } 1320 }); 1321 } 1322 1323 if (!feed.settings.consentGiven) { 1324 //'a[data-cff-lightbox], area[data-cff-lightbox]' 1325 var $lightboxAnchor = false; 1326 if ($imgWrapItem.find('a[data-cff-lightbox]').length) { 1327 $lightboxAnchor = $imgWrapItem.find('a[data-cff-lightbox]'); 1328 1329 } else if ($imgWrapItem.closest('.cff-item').find('a[data-cff-lightbox]').length) { 1330 $lightboxAnchor = $imgWrapItem.closest('.cff-item').find('a[data-cff-lightbox]'); 1331 1332 } 1333 1334 if ($imgWrapItem.find('area[data-cff-lightbox]').length) { 1335 $lightboxAnchor = $imgWrapItem.find('area[data-cff-lightbox]'); 1336 1337 } else if ($imgWrapItem.closest('.cff-item').find('area[data-cff-lightbox]').length) { 1338 $lightboxAnchor = $imgWrapItem.closest('.cff-item').find('area[data-cff-lightbox]'); 1339 1340 } 1341 if ($lightboxAnchor) { 1342 if($lightboxAnchor.parent('div').hasClass('cff-html5-video')){ 1343 //$lightboxAnchor.attr('href',$lightboxAnchor.parent('.cff-html5-video').attr('data-cff-video-link')); 1344 }else{ 1345 //$lightboxAnchor.attr('href',feed.getMaxResImage(imgSrcSet,i)); 1346 } 1347 } 1348 1349 //getMaxResImage: function(imgSrcSet,index) 1350 1351 } else { 1352 $lightboxAnchor = false; 1353 if ($imgWrapItem.find('a[data-cff-lightbox]').length) { 1354 $lightboxAnchor = $imgWrapItem.find('a[data-cff-lightbox]'); 1355 } else if ($imgWrapItem.closest('.cff-item').find('a[data-cff-lightbox]').length) { 1356 $lightboxAnchor = $imgWrapItem.closest('.cff-item').find('a[data-cff-lightbox]'); 1357 } else if ($imgWrapItem.closest('.cff-album-item').find('a[data-cff-lightbox]').length) { 1358 $lightboxAnchor = $imgWrapItem.closest('.cff-album-item').find('a[data-cff-lightbox]'); 1359 } 1360 1361 if ($imgWrapItem.find('area[data-cff-lightbox]').length) { 1362 $lightboxAnchor = $imgWrapItem.find('area[data-cff-lightbox]'); 1363 } else if ($imgWrapItem.closest('.cff-item').find('area[data-cff-lightbox]').length) { 1364 $lightboxAnchor = $imgWrapItem.closest('.cff-item').find('area[data-cff-lightbox]'); 1365 } 1366 1367 if ($lightboxAnchor && typeof($lightboxAnchor) !== "boolean") { 1368 if($lightboxAnchor.parent('div').hasClass('cff-html5-video')){ 1369 // $lightboxAnchor.attr('href',$lightboxAnchor.parent('.cff-html5-video').attr('data-cff-video-link')); 1370 }else{ 1371 //$lightboxAnchor.attr('href',feed.getMaxResImage(imgSrcSet,i)); 1372 } 1373 } 1374 } 1375 1376 if (changeToRes) { 1377 currentRes = changeToRes; 1378 if (feed.settings.debugEnabled) { 1379 var reason = currentUrl === feed.placeholderURL ? 'was placeholder' : 'too small'; 1380 } 1381 $imgWrapItem.attr('data-current',changeToRes); 1382 var newUrl = imgSrcSet[i][changeToRes]; 1383 if (newUrl !== currentUrl) { 1384 $targetImageElement.attr('src', newUrl); 1385 if ($imgWrapItem.hasClass('imgLiquid_ready')) { 1386 $imgWrapItem.css('background-image', 'url("' + newUrl + '")'); 1387 $imgWrapItem.imgLiquid({fill:true}); 1388 } 1389 1390 feed.processNewImage($imgWrapItem); 1391 1392 if (currentRes < 720 && $item.hasClass('cff-album-item') && ! $targetImageElement.hasClass('cff-secondary-check')) { 1393 $targetImageElement.addClass('cff-secondary-check'); 1394 $targetImageElement.on('load',function() { 1395 if (!jQuery(this).hasClass('cff-secondary-checked')) { 1396 jQuery(this).addClass('cff-secondary-checked'); 1397 var imagEl = $targetImageElement.get(0), 1398 height = imagEl.naturalHeight, 1399 aspectRatio = imagEl.naturalWi
1399dth/imagEl.naturalHeight; 1400 1401 if ($targetImageElement.innerWidth() > height) { 1402 neededRes = feed.getTargetWidth($imgWrapItem,$item,i) * aspectRatio; 1403 if (parseInt(currentRes) < neededRes) { 1404 foundBestRes = false; 1405 jQuery.each(imgSrcSet[i], function (ii, value) { 1406 1407 if (! foundBestRes && ii > currentRes) { 1408 changeToRes = ii; 1409 if (ii >= neededRes) { 1410 foundBestRes = true; 1411 } 1412 } 1413 }); 1414 1415 if (changeToRes) { 1416 $imgWrapItem.attr('data-current', changeToRes); 1417 var newUrl = imgSrcSet[i][changeToRes]; 1418 if (newUrl !== currentUrl) { 1419 $targetImageElement.attr('src', newUrl); 1420 if ($imgWrapItem.hasClass('imgLiquid_ready')) { 1421 $imgWrapItem.css('background-image', 'url("' + newUrl + '")'); 1422 $imgWrapItem.imgLiquid({fill:true}); 1423 } 1424 1425 feed.processNewImage($imgWrapItem); 1426 } 1427 } 1428 } 1429 } 1430 } 1431 1432 }); 1433 } 1434 1435 } 1436 1437 } 1438 1439 $targetImageElement.on('error', function () { 1440 if (!jQuery(this).hasClass('cff-img-error')) { 1441 jQuery(this).addClass('cff-img-error'); 1442 var newUrl = typeof jQuery(this).attr('data-orig-source') !== 'undefined' ? jQuery(this).attr('data-orig-source') : false; 1443 if (newUrl && newUrl !== currentUrl) { 1444 $targetImageElement.attr('src', newUrl); 1445 if ($imgWrapItem.hasClass('imgLiquid_ready')) { 1446 $imgWrapItem.css('background-image', 'url("' + newUrl + '")'); 1447 } 1448 } 1449 setTimeout(function() { 1450 feed.afterResize(); 1451 }, 1500) 1452 } else { 1453 console.log('unfixed error ' + jQuery(this).attr('src')); 1454 } 1455 }); 1456 }); 1457 1458 1459 }, 1460 maybeRaiseImageResolution: function (justNew) { 1461 var feed = this, 1462 itemsSelector = typeof justNew !== 'undefined' && justNew === true ? '.cff-item.cff-new, .cff-album-item.cff-new' : '.cff-item, .cff-album-item'; 1463 jQuery(feed.el).find(itemsSelector).each(function (index) { 1464 if (!jQuery(this).hasClass('cff-num-diff-hide') 1465 && feed.hasTargetElement(jQuery(this))) { 1466 feed.maybeRaiseSingleImageResolution(jQuery(this),index); 1467 } 1468 }); //End .cff-item each 1469 }, 1470 getImageUrls: function ($item,$target) { 1471 var feed = this, 1472 srcSet = {}, 1473 $srcSetItem = false, 1474 id = $item.attr('id').replace('cff_', ''); 1475 1476 if (typeof $target.attr('data-img-src-set') !== 'undefined') { 1477 $srcSetItem = $target; 1478 } else if (typeof $item.find('.cff-photo').attr('data-img-src-set') !== 'undefined') { 1479 $srcSetItem = $item.find('.cff-photo'); 1480 } else if (typeof $item.find('.cff-link-slider-slides').attr('data-img-src-set') !== 'undefined') { 1481 $srcSetItem = $item.find('.cff-link-slider-slides'); 1482 } else if (typeof $item.find('.cff-album-cover').attr('data-img-src-set') !== 'undefined') { 1483 $srcSetItem = $item.find('.cff-album-cover'); 1484 } 1485 1486 if ($srcSetItem) { 1487 srcSet = JSON.parse($srcSetItem.attr('data-img-src-set').replace(/\\\//g, '/')) 1488 } 1489 1490 if (!this.settings.consentGiven && !this.settings.overrideBlockCDN) { 1491 jQuery.each(srcSet,function(index,value) { 1492 srcSet[index] = {}; 1493 }); 1494 } 1495 1496 var returnSrcSet = srcSet; 1497 if (typeof feed.resizedImages[id] === 'undefined' && id.indexOf('_') === -1) { 1498 if ( typeof $item.attr('data-page-id') !== 'undefined') { 1499 id = $item.attr('data-page-id') + '_' + id; 1500 } 1501 } 1502 if (typeof feed.resizedImages[id] !== 'undefined' 1503 && feed.resizedImages[id].id !== 'pending' 1504 && feed.resizedImages[id].id !== 'error') { 1505 jQuery.each(srcSet,function(index,value) { 1506 1507 if (feed.settings.consentGiven) { 1508 returnSrcSet[index] = {}; 1509 var apiSourceSet = JSON.parse($srcSetItem.attr('data-img-src-set').replace(/\\\//g, '/')); 1510 1511 jQuery.each(apiSourceSet[index],function(index2,value2) { 1512 if (index2 > 700 1513 || index2 < 220) { 1514 returnSrcSet[index][index2] = value2; 1515 } 1516 }); 1517 } 1518 1519 1520 jQuery.each(feed.resizedImages[id].sizes,function(index2,value2) { 1521 returnSrcSet[index][value2] = window.cffOptions.resized_url+feed.resizedImages[id].id+'-'+index+'-'+value2+'.jpg'; 1522 }); 1523 }); 1524 } else if (typeof this.resizedImages[id] === 'undefined' 1525 || (typeof this.resizedImages[id]['id'] !== 'undefined' && this.resizedImages[id]['id'] !== 'pending' && this.resizedImages[id]['id'] !== 'error')) { 1526 var hasMediumSize = false; 1527 1528 jQuery.each(returnSrcSet[0],function(resolution) { 1529 if (parseInt(resolution) > 150 && parseInt(resolution) < 500) { 1530 hasMediumSize = true; 1531 } 1532 }); 1533 if (feed.settings.gdpr) { 1534 hasMediumSize = false; 1535 } 1536 if (!hasMediumSize) { 1537 this.addToNeedsResizing(id); 1538 } 1539 } 1540 1541 return returnSrcSet; 1542 }, 1543 addToNeedsResizing: function (id) { 1544 if (this.needsResizing.indexOf(id) === -1) { 1545 this.needsResizing.push(id); 1546 } 1547 }, 1548 processNewImage: function($item) { 1549 var feed = this; 1550 $item.find('img').each(function() { 1551 if (!jQuery(this).prop('complete')) { 1552 feed.imagesWaiting++; 1553 jQuery(this).addClass('cff-image-loading').on('load',function() { 1554 jQuery(this).removeClass('cff-image-loading'); 1555 feed.imagesWaiting--; 1556 if (feed.imagesWaiting < 1) { 1557 feed.afterResize(); 1558 } 1559 }); 1560 jQuery(this).on('error',function() { 1561 jQuery(this).removeClass('cff-image-loading'); 1562 feed.imagesWaiting--; 1563 if (feed.imagesWaiting < 1) { 1564 feed.afterResize(); 1565 } 1566 }); 1567 } 1568 }); 1569 }, 1570 getMaxResImage: function(imgSrcSet,index) { 1571 if (typeof imgSrcSet[index] === 'undefined') { 1572 return false; 1573 } 1574 var largest = 0, 1575 largestImage = false; 1576 jQuery.each(imgSrcSet[index], function (index, value) { 1577 if (index > largest) { 1578 largest = index; 1579 largestImage = value.toString(); 1580 } 1581 }); 1582 1583 return largestImage; 1584 }, 1585 lazyLoadCheck: function($item){ 1586 var feed = this, 1587 $target = feed.getTargetElement($item), 1588 imgSrcSet = feed.getImageUrls($item,$target); 1589 if (!$item.closest('.cff').hasClass('cff-no-ll-check')) { 1590 $item.find('img').each(function(index) { 1591 if (typeof jQuery(this).attr('data-src') !== 'undefined') { 1592 jQuery(this).attr('data-src',jQuery(this).attr('data-orig-source')); 1593 } 1594 if (typeof jQuery(this).attr('data-orig-src') !== 'undefined') { 1595 jQuery(this).attr('data-orig-src',jQuery(this).attr('data-orig-source')); 1596 } 1597 1598 if (!feed.settings.consentGiven) { 1599 jQuery(this).removeAttr('data-orig-source'); 1600 maxResImage = feed.getMaxResImage(imgSrcSet,index); 1601 if (maxResImage && maxResImage.indexOf('scontent') === -1) { 1602 jQuery(this).attr('data-orig-source',maxResImage); 1603 } 1604 } 1605 1606 jQuery(this).on('load',function() { 1607 if (!jQuery(this).hasClass('cff-replaced') 1608 && jQuery(this).attr('src').indexOf('placeholder') > -1) { 1609 jQuery(this).addClass('cff-replaced'); 1610 var origSource = typeof jQuery(this).attr('data-orig-source') !== 'undefined' ? jQuery(this).attr('data-orig-source') : false; 1611 if (origSource) { 1612 jQuery(this).attr('src',jQuery(this).attr('data-orig-source')); 1613 if (jQuery(this).closest('.imgLiquid_bgSize').length) { 1614 jQuery(this).closest('.imgLiquid_bgSize').css('background-image', 'url(' + origSource + ')'); 1615 } 1616 } 1617 } 1618 }); 1619 }); 1620 } 1621 }, 1622 maybeRelayoutMasonry: function() { 1623 var $cff = jQuery(this.el); 1624 if ($cff.hasClass('cff-masonry-js') && !$cff.hasClass('cff-masonry-css')){ 1625 var cff_delay = (function () { 1626 var cff_timer = 0; 1627 return function (cff_callback, cff_ms) { 1628 clearTimeout(cff_timer); 1629 cff_timer = setTimeout(cff_callback, cff_ms); 1630 }; 1631 })(); 1632 cff_delay(function () { 1633 cffAddMasonry($cff); 1634 }, 500); 1635 } 1636 }, 1637 afterInitialImagesLoaded: function(){ 1638 this.maybeRaiseImageResolution(); 1639 this.sendNeedsResizingToServer(); 1640 this.maybeCleanUpNew(); 1641 if (this.settings.consentGiven) { 1642 this.addFullFeatures(); 1643 }else{ 1644 jQuery('.cff-gdpr-notice').css({'display':'inline-block'});
1645 } 1646 }, 1647 afterResize: function () { 1648 this.maybeRaiseImageResolution(); 1649 this.maybeRelayoutMasonry(); 1650 }, 1651 afterLoadMoreClicked: function() { 1652 this.maybeRaiseImageResolution(); 1653 this.addFullFeatures(); 1654 }, 1655 maybeCleanUpNew: function() { 1656 var feed = this, 1657 $cff = jQuery(this.el); 1658 setTimeout(function() { 1659 if (feed.index > 0) { 1660 $cff.find('.cff-new').removeClass('cff-new'); 1661 } 1662 $cff.find('img').each(function() { 1663 if (feed.settings.consentGiven && !jQuery(this).hasClass('cff-image-loading') 1664 && ( jQuery(this).attr('src') != null && jQuery(this).attr('src') != undefined ) && jQuery(this).attr('src').indexOf('placeholder.png') > -1) { 1665 console.log('lazy load correction'); 1666 var $self = jQuery(this), 1667 currentSrc = $self.attr('src'), 1668 originalSrc = $self.attr('data-orig-source'); 1669 1670 // Check if the img source has been changed by lazy loading 1671 if(originalSrc != currentSrc){ 1672 $self.attr('src', originalSrc); 1673 } 1674 1675 // Timeline album posts need the background source reset 1676 if($self.hasClass('cff-multi-image')){ 1677 $self.css('background-image', 'url(' + originalSrc + ')'); 1678 } 1679 } 1680 }); 1681 },1250); 1682 }, 1683 checkConsent: function() { 1684 if (this.settings.consentGiven || !this.settings.gdpr) { 1685 return true; 1686 } 1687 if (typeof CLI_Cookie !== "undefined") { // GDPR Cookie Consent by WebToffee 1688 if (CLI_Cookie.read(CLI_ACCEPT_COOKIE_NAME) !== null) { 1689 1690 // WebToffee no longer uses this cookie but being left here to maintain backwards compatibility 1691 if (CLI_Cookie.read('cookielawinfo-checkbox-non-necessary') !== 'null') { 1692 this.settings.consentGiven = CLI_Cookie.read('cookielawinfo-checkbox-non-necessary') === 'yes'; 1693 } 1694 1695 if (CLI_Cookie.read('cookielawinfo-checkbox-necessary') !== 'null') { 1696 this.settings.consentGiven = CLI_Cookie.read('cookielawinfo-checkbox-necessary') === 'yes'; 1697 } 1698 } 1699 1700 } else if (typeof window.cnArgs !== "undefined") { // Cookie Notice by dFactory 1701 var value = "; " + document.cookie, 1702 parts = value.split( '; cookie_notice_accepted=' ); 1703 1704 if ( parts.length === 2 ) { 1705 var val = parts.pop().split( ';' ).shift(); 1706 1707 this.settings.consentGiven = (val === 'true'); 1708 } 1709 } else if (typeof window.cookieconsent !== 'undefined') { // Complianz by Really Simple Plugins 1710 this.settings.consentGiven = cffCmplzGetCookie('cmplz_consent_status') === 'allow'; 1711 } else if (typeof window.Cookiebot !== "undefined") { // Cookiebot by Cybot A/S 1712 this.settings.consentGiven = Cookiebot.consented; 1713 } else if (typeof window.BorlabsCookie !== 'undefined') { // Borlabs Cookie by Borlabs 1714 this.settings.consentGiven = window.BorlabsCookie.checkCookieConsent('facebook'); 1715 } 1716 1717 var evt = jQuery.Event('cffcheckconsent'); 1718 evt.feed = this; 1719 jQuery(window).trigger(evt); 1720 1721 return this.settings.consentGiven; // GDPR not enabled 1722 }, 1723 afterConsentToggled: function() { 1724 if (this.checkConsent()) { 1725 var feed = this; 1726 feed.maybeRaiseImageResolution(); 1727 this.addFullFeatures(); 1728 setTimeout(function() { 1729 feed.afterResize(); 1730 },500); 1731 } 1732 } 1733 }; 1734 1735 function cffAjax(submitData, onSuccess) { 1736 jQuery.ajax({ 1737 url: cffajaxurl, 1738 type: 'post', 1739 data: submitData, 1740 success: onSuccess 1741 }); 1742 } 1743 function cffCmplzGetCookie(cname) { 1744 var name = cname + "="; //Create the cookie name variable with cookie name concatenate with = sign 1745 var cArr = window.document.cookie.split(';'); //Create cookie array by split the cookie by ';' 1746 1747 //Loop through the cookies and return the cookie value if it find the cookie name 1748 for (var i = 0; i < cArr.length; i++) { 1749 var c = cArr[i].trim(); 1750 //If the name is the cookie string at position 0, we found the cookie and return the cookie value 1751 if (c.indexOf(name) == 0) 1752 return c.substring(name.length, c.length); 1753 } 1754 1755 return ""; 1756 } 1757 1758 function cff_init( $cff ){ 1759 //JS is running 1760 jQuery('.cff-nojs').removeClass('cff-nojs'); 1761 1762 //Check whether it's a touch device 1763 var cffTouchDevice = false; 1764 if (cffIsTouchDevice() === true) cffTouchDevice = true; 1765 function cffIsTouchDevice() { 1766 return true == ("ontouchstart" in window || window.DocumentTouch && document instanceof DocumentTouch); 1767 } 1768 1769 //If a feed selector isn't passed in then default to using selector for all feeds 1770 var firsttime = false; 1771 if(typeof $cff === 'undefined'){ 1772 $cff = jQuery('.cff'); 1773 firsttime = true; 1774 } 1775 1776 (function($){ 1777 1778 //Toggle comments 1779 jQuery(document).off('click', '#cff a.cff-view-comments').on('click', '#cff a.cff-view-comments', function(){ 1780 var $self = jQuery(this), 1781 $commentsBox = $self.closest('.cff-item').find('.cff-comments-box'); 1782 $self.toggleClass('cff-open'); 1783 1784 $commentsBox.slideToggle(300); 1785 1786 //Masonry - overlap comments box when open 1787 var $feed = $self.closest('#cff'), 1788 $item = $(this).closest('.cff-item'); 1789 if( $feed.hasClass('cff-masonry-js') && !$feed.hasClass('cff-opaque-comments') ){
1790 setTimeout(function(){ 1791 cffAddMasonry($feed); 1792 }, 500); 1793 } 1794 1795 //Add comment avatars 1796 $commentsBox.find('.cff-comment:visible').each(function(){ 1797 var $thisComment = jQuery(this); // here 1798 var consentGiven = (typeof window.cff !== 'undefined' && typeof window.cff.feeds !== 'undefined') ? window.cff.feeds[0].settings.consentGiven : true; 1799 if (consentGiven) { 1800 $thisComment.find('.cff-comment-img:not(.cff-comment-reply-img) a, .cff-comment-img:not(.cff-comment-reply-img) span').html( '<img src="'+$thisComment.attr("data-avatar")+'" alt="Avatar" onerror="this.style.display=\'none\'" />' ); 1801 } 1802 }); 1803 1804 }); 1805 1806 //Comments box hover 1807 var cffAnimateIconColorVar, 1808 stopAnimate = false; 1809 $cff.find('.cff-view-comments').on('mouseenter', function(){ 1810 var $self = $(this), 1811 time = 50; 1812 if( $self.hasClass('cff-open') ) return; 1813 1814 $self.find('.cff-icon').each(function() { 1815 var $cffIcon = jQuery(this); 1816 cffAnimateIconColor($cffIcon, time); 1817 time += 50; 1818 }); 1819 }).on('mouseleave', function(){ 1820 cffStopAnimateIconColor(); 1821 $(this).find('.cff-icon').removeClass('cff-animate'); 1822 }); 1823 function cffAnimateIconColor($cffIcon, time){ 1824 stopAnimate = false; 1825 cffAnimateIconColorVar = setTimeout( function(){ 1826 if( !stopAnimate ) $cffIcon.addClass('cff-animate'); 1827 }, time); 1828 } 1829 function cffStopAnimateIconColor() { 1830 clearTimeout(cffAnimateIconColorVar); 1831 stopAnimate = true; 1832 } 1833 1834 //Set paths for query.php 1835 if (typeof cffsiteurl === 'undefined' || cffsiteurl == '') cffsiteurl = window.location.host + '/wp-content/plugins'; 1836 var locatefile = true; 1837 1838 //Create meta data array for caching likes and comments 1839 var metaArr = {}, 1840 newMetaArr = {}, metaArray = []; //For caching only new posts that are loaded 1841 1842 //Loop through the feeds on the page and add a unique attribute to each to use for lightbox groups 1843 var lb = 0; 1844 jQuery('#cff.cff-lb').each(function(){ 1845 lb++; 1846 $(this).attr('data-cff-lb', lb); 1847 }); 1848 1849 1850 //If it's the first load then loop through all .cff-items on the page, otherwise, only loop through the feed where the load more button is clicked 1851 var $cff_post_selector = $cff.find('.cff-item.cff-new, .cff-album-item.cff-new'); 1852 if( firsttime ){ 1853 $cff_post_selector = jQuery('#cff .cff-item.cff-new, #cff .cff-album-item.cff-new'); 1854 } 1855 1856 //Loop through each item 1857 $cff_post_selector.each(function(){ 1858 1859 var $self = jQuery(this); 1860 1861 //Wpautop fix 1862 if( $self.find('.cff-viewpost-link, .cff-viewpost-facebook, .cff-viewpost').parent('p').length ){ 1863 //Don't unwrap event only viewpost link 1864 if( !$self.hasClass('event') ) $self.find('.cff-viewpost-link, .cff-viewpost-facebook, .cff-viewpost').unwrap('p'); 1865 } 1866 if( $self.find('.cff-photo').parent('p').length ){ 1867 $self.find('p .cff-photo').unwrap('p'); 1868 $self.find('.cff-album-icon').appendTo('.cff-photo:last'); 1869 } 1870 if( $self.find('.cff-event-thumb').parent('p').length ){ 1871 $self.find('.cff-event-thumb').unwrap('p'); 1872 } 1873 if( $self.find('.cff-vidLink').parent('p').length ){ 1874 $self.find('.cff-vidLink').unwrap('p'); 1875 } 1876 if( $self.find('.cff-link').parent('p').length ){ 1877 $self.find('.cff-link').unwrap('p'); 1878 } 1879 if( $self.find('.cff-viewpost-link').parent('p').length ){ 1880 $self.find('.cff-viewpost-link').unwrap('p'); 1881 } 1882 if( $self.find('.cff-viewpost-facebook').parent('p').length ){ 1883 $self.find('.cff-viewpost-facebook').unwrap('p'); 1884 } 1885 1886 if( $self.find('iframe').parent('p').length ){ 1887 $self.find('iframe').unwrap('p'); 1888 } 1889 if( $self.find('.cff-author').parent('p').length ){ 1890 $self.find('.cff-author').eq(1).unwrap('p'); 1891 $self.find('.cff-author').eq(1).remove(); 1892 } 1893 if( $self.find('.cff-view-comments').parent('p').length ){ 1894 $self.find('.cff-meta-wrap > p').remove(); 1895 $self.find('.cff-view-comments').eq(1).remove(); 1896 //Move meta ul inside the link element 1897 var $cffMeta = $self.find('.cff-meta'),
1898 cffMetaClasses = $cffMeta.attr('class'); 1899 $cffMeta.find('.cff-view-comments').unwrap().wrapInner('<ul class="'+cffMetaClasses+'">'); 1900 } 1901 if( $self.find('.cff-photo').siblings('.cff-photo').length ){ 1902 $self.find('.cff-photo').slice(0,2).remove(); 1903 } 1904 //Fix the formatting issue that pushes avatar to the left 1905 if( $('.cff-author-img').parent().is('p') ) $('.cff-author-img').unwrap('p'); 1906 //Remove empty p tags 1907 $self.find('p:empty').not('.cff-comments-box p').remove(); 1908 1909 //Expand post 1910 var expanded = false; 1911 if( $self.hasClass('cff-event') ){ 1912 var $post_text = $self.find('.cff-desc .cff-desc-text'), 1913 text_limit = $post_text.parent().attr('data-char'); 1914 } else { 1915 var $post_text = $self.find('.cff-post-text .cff-text'), 1916 text_limit = $self.closest('#cff').attr('data-char'); 1917 } 1918 1919 if (typeof text_limit === 'undefined' || text_limit == '') text_limit = 99999; 1920 1921 //If the text is linked then use the text within the link 1922 if ( $post_text.find('a.cff-post-text-link').length ) $post_text = $self.find('.cff-post-text .cff-text a'); 1923 var full_text = $post_text.html(); 1924 if(full_text == undefined) full_text = ''; 1925 1926 1927 //Truncate text taking HTML tags into account 1928 var cff_trunc_regx = new RegExp(/(<[^>]*>)/g); 1929 var cff_trunc_counter = 0; 1930 1931 //convert the string to array using the HTML tags as delimiter and keeping them as array elements 1932 full_text_arr = full_text.split(cff_trunc_regx); 1933 1934 for (var i = 0, len = full_text_arr.length; i < len; i++) { 1935 //ignore the array elements that are HTML tags 1936 if ( !(cff_trunc_regx.test(full_text_arr[i])) ) { 1937 //if the counter is 100, remove this element with text 1938 if (cff_trunc_counter == text_limit) { 1939 full_text_arr.splice(i, 1); 1940 continue; //ignore next commands and continue the for loop 1941 } 1942 //if the counter != 100, increase the counter with this element length 1943 cff_trunc_counter = cff_trunc_counter + full_text_arr[i].length; 1944 //if is over 100, slice the text of this element to match the total of 100 chars and set the counter to 100 1945 if (cff_trunc_counter > text_limit) { 1946 var diff = cff_trunc_counter - text_limit; 1947 full_text_arr[i] = full_text_arr[i].slice(0, -diff); 1948 cff_trunc_counter = text_limit; 1949 1950 //Show the 'See More' link if needed 1951 if (full_text.length > text_limit) $self.find('.cff-expand').show(); 1952 } 1953 } 1954 } 1955 1956 //new string from the array 1957 var short_text = full_text_arr.join(''); 1958 1959 //remove empty html tags from the array 1960 short_text = short_text.replace(/(<(?!\/)[^>]+>)+(<\/[^>]+>)/g, ""); 1961 1962 //If the short text cuts off in the middle of a <br> tag then remove the stray '<' which is displayed 1963 var lastChar = short_text.substr(short_text.length - 1); 1964 if(lastChar == '<') short_text = short_text.substring(0, short_text.length - 1); 1965 1966 //Remove any <br> tags from the end of the short_text 1967 short_text = short_text.replace(/(<br>\s*)+$/,''); 1968 short_text = short_text.replace(/(<img class="cff-linebreak">\s*)+$/,''); 1969 1970 //Cut the text based on limits set 1971 $post_text.html( short_text ); 1972 1973 1974 //Click function 1975 $self.find('.cff-expand a').off('click').on('click', function(e){
1976 e.preventDefault(); 1977 var $expand = jQuery(this), 1978 $more = $expand.find('.cff-more'), 1979 $less = $expand.find('.cff-less'); 1980 if (expanded == false){ 1981 $post_text.html( full_text ); 1982 expanded = true; 1983 $more.hide(); 1984 $less.show(); 1985 } else { 1986 $post_text.html( short_text ); 1987 expanded = false; 1988 $more.show(); 1989 $less.hide(); 1990 } 1991 cffLinkHashtags(); 1992 //Add target to links in text when expanded 1993 $post_text.find('a').attr('target', '_blank'); 1994 1995 //Re-init masonry for JS 1996 if( $self.closest('.cff').hasClass('cff-masonry-js') && !$self.closest('.cff').hasClass('cff-masonry-css') ){ 1997 cffAddMasonry($cff); 1998 } 1999 2000 }); 2001 //Add target attr to post text links via JS so aren't included in char count 2002 $post_text.find('a').add( $self.find('.cff-post-desc a') ).attr({ 2003 'target' : '_blank', 2004 'rel' : 'nofollow noopener noreferrer' 2005 }); 2006 2007 2008 //This is the modified Post ID - so if the post is an album post then this could be the album ID which is used to get the lightbox thumbs 2009 var post_id = $self.attr('id').substring(4), 2010 //This is the original post ID which is used to get the number of likes and comments for the timeline post 2011 post_id_orig = $self.find('.cff-view-comments').attr('id'); 2012 2013 if( locatefile != true ) $self.find('.cff-lightbox-thumbs-holder').css('min-height', 0); 2014 2015 2016 //Show all comments on click 2017 jQuery(document).off('click', '#cff .cff-show-more-comments, .cff-lightbox-sidebar .cff-show-more-comments').on('click', '#cff .cff-show-more-comments, .cff-lightbox-sidebar .cff-show-more-comments', function(){ 2018 2019 var $cffMoreCommentsLink = jQuery(this), 2020 thisCommentsTotal = parseInt($cffMoreCommentsLink.attr('data-cff-comments-total')); 2021 2022 //If there's more than 25 comments then link the "View more comments" link to post on Facebook 2023 if( $cffMoreCommentsLink.hasClass('cff-clicked') && thisCommentsTotal > 25 ){ 2024 //Link to Facebook 2025 $cffMoreCommentsLink.find('a').attr({ 2026 'href' : $cffMoreCommentsLink.closest('.cff-comments-box').find('.cff-comment-on-facebook a').attr('href'), 2027 'target' : '_blank' 2028 }); 2029 } 2030 //Hide 'View more comments' link 2031 if( thisCommentsTotal <= 25 ) $cffMoreCommentsLink.hide(); 2032 2033 //Add class so we can only trigger the above on the second click 2034 $cffMoreCommentsLink.addClass('cff-clicked'); 2035 2036 //Show comments and add comment avatars 2037 $cffMoreCommentsLink.parent().find('.cff-comment').show().each(function(){ 2038 var $thisComment = jQuery(this); 2039 var consentGiven = (typeof window.cff !== 'undefined' && typeof window.cff.feeds !== 'undefined') ? window.cff.feeds[0].settings.consentGiven : true; 2040 if (consentGiven) { 2041 $thisComment.find('.cff-comment-img:not(.cff-comment-reply-img) a, .cff-comment-img:not(.cff-comment-reply-img) span').html( '<img src="'+$thisComment.attr("data-avatar")+'" alt="Avatar" onerror="this.style.display=\'none\'" />' ); 2042 } 2043 2044 }); 2045 2046 //Re-init masonry when more comments loaded 2047 var $closestCff = $cffMoreCommentsLink.closest('.cff'); 2048 if( $closestCff.hasClass('cff-masonry-js') && !$closestCff.hasClass('cff-opaque-comments') ){
2049 setTimeout(function(){ 2050 cffAddMasonry( $closestCff ); 2051 }, 500); 2052 } 2053 }); 2054 2055 2056 //Remove event end date day if the same as the start date 2057 if( $self.hasClass('cff-timeline-event') || $self.hasClass('cff-event') ){ 2058 if( $(this).find('.cff-date .cff-start-date k').text() !== $(this).find('.cff-date .cff-end-date k').text() ) $(this).find('.cff-date .cff-end-date k').show(); 2059 } 2060 2061 2062 //Replace Photon (Jetpack CDN) images with the originals again 2063 var $cffPhotoImg = $self.find('.cff-photo img, .cff-event-thumb img, .cff-poster, .cff-album-cover img'), 2064 cffPhotoImgSrc = $cffPhotoImg.attr('src'), 2065 cffImgStringAttr = $cffPhotoImg.attr('data-querystring'); 2066 2067 if( typeof cffPhotoImgSrc == 'undefined' ) cffPhotoImgSrc = ''; 2068 2069 if( cffPhotoImgSrc.indexOf('i0.wp.com') > -1 || cffPhotoImgSrc.indexOf('i1.wp.com') > -1 || cffPhotoImgSrc.indexOf('i2.wp.com') > -1 || cffPhotoImgSrc.indexOf('i3.wp.com') > -1 || cffPhotoImgSrc.indexOf('i4.wp.com') > -1 || cffPhotoImgSrc.indexOf('i5.wp.com') > -1 ){ 2070 2071 //Create new src. Single slash in https is intentional as one is left over from removing i_.wp.com 2072 var photonSrc = $cffPhotoImg.attr('src').substring(0, $cffPhotoImg.attr('src').indexOf('?')), 2073 newSrc = photonSrc.replace('http://', 'https:/').replace(/i0.wp.com|i1.wp.com|i2.wp.com|i3.wp.com|i4.wp.com|i5.wp.com/gi, '') + '?' + cffImgStringAttr; 2074 2075 $cffPhotoImg.attr('src', newSrc); 2076 } 2077 2078 function cffLinkHashtags(){ 2079 //Link hashtags 2080 var cffTextStr = $self.find('.cff-text').html(), 2081 cffDescStr = $self.find('.cff-post-desc').html(), 2082 regex = /(^|\s)#(\w*[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFB
2082D3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]+\w*)/gi, 2083 linkcolor = $self.find('.cff-text').attr('data-color'), 2084 linkcolorHTML = ''; 2085 2086 function replacer(hash){ 2087 //Remove white space at beginning of hash 2088 var replacementString = jQuery.trim(hash); 2089 //If the hash is a hex code then don't replace it with a link as it's likely in the style attr, eg: "color: #ff0000" 2090 if ( /^#[0-9A-F]{6}$/i.test( replacementString ) ){ 2091 return replacementString; 2092 } else { 2093 if( typeof linkcolor !== 'undefined' ){ 2094 if( linkcolor.length > 1 ) linkcolorHTML = 'style="color:#' + linkcolor + '"'; 2095 } 2096 return ' <a href="https://www.facebook.com/hashtag/'+ replacementString.substring(1) +'" target="_blank" rel="nofollow noopener" '+linkcolorHTML+'>' + replacementString + '</a>'; 2097 } 2098 } 2099 2100 //If it's not defined in the source code then set it to be true 2101 if (typeof cfflinkhashtags == 'undefined') cfflinkhashtags = 'true'; 2102 2103 if(cfflinkhashtags == 'true'){ 2104 //Replace hashtags in text 2105 var $cffText = $self.find('.cff-text'); 2106 2107 if($cffText.length > 0){ 2108 //Add a space after all <br> tags so that #hashtags immediately after them are also converted to hashtag links. Without the space they aren't captured by the regex. 2109 cffTextStr = cffTextStr.replace(/<br>/g, "<br> "); 2110 $cffText.html( cffTextStr.replace( regex , replacer ) ); 2111 } 2112 } 2113 2114 //Replace hashtags in desc 2115 if( $self.find('.cff-post-desc').length > 0 ) $self.find('.cff-post-desc').html( cffDescStr.replace( regex , replacer ) ); 2116 } 2117 cffLinkHashtags(); 2118 2119 //Add target attr to post text links via JS so aren't included in char count 2120 $self.find('.cff-text a').attr('target', '_blank'); 2121 2122 2123 //Add lightbox tile link to photos 2124 if( $self.closest('#cff').hasClass('cff-lb') ){ 2125 $self.find('.cff-photo, .cff-album-cover, .cff-event-thumb, .cff-html5-video, .cff-iframe-wrap').each(function(){ 2126 var $photo = $(this), 2127 postId = post_id, 2128 cffLightboxTitle = '', 2129 cffShowThumbs = false, 2130 postType = '', 2131 cffgroupalbums = ''; 2132 2133 2134 // if( $self.hasClass('cff-album') || $self.hasClass('cff-albums-only') ) cffShowThumbs = true; 2135 cffShowThumbs = true; 2136 2137 function cffFormatCaption(text){ 2138 return String(text).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/\n/g, "<br/>"); 2139 } 2140 2141 //Set the caption/title 2142 if( $self.hasClass('cff-albums-only') ){ 2143 postType = 'albumsonly'; 2144 cffLightboxTitle = cffFormatCaption( $self.find('img').attr('alt') ); 2145 2146 //Check whether there's an absolute path attr and if there is then add it to the query 2147 var dataGroup = $self.closest('#cff').attr('data-group'); 2148 if( typeof dataGroup !== 'undefined' ) cffgroupalbums = 'data-cffgroupalbums="true"'; 2149 2150 } else if( $self.hasClass('cff-timeline-event') ) { 2151 var capText = ''; 2152 if( $self.find('.cff-author-text .cff-page-name').length ) capText += $self.find('.cff-author-text .cff-page-name').text() + '<br /><br />'; 2153 //Display the full event details but the info is hidden in CSS as it's too long in some cases 2154 if( full_text.length > 5 ) capText += full_text; 2155 cffLightboxTitle = cffFormatCaption( capText ); 2156 2157 } else if ( $self.hasClass('cff-event') ) { 2158 //Events feed 2159 if( $self.find('.cff-details').length ){ 2160 // if( $self.find('.cff-event-title').length ) cffLightboxTitle = cffFormatCaption( $self.find('.cff-event-title')[0].outerHTML ); 2161 // if( $self.find('.cff-date').length ) cffLightboxTitle += cffFormatCaption( $self.find('.cff-date')[0].outerHTML ); 2162 // if( $self.find('.cff-location').length ) cffLightboxTitle += cffFormatCaption( $self.find('.cff-location')[0].outerHTML ); 2163 2164 if( $self.find('.cff-event-title').length ) cffLightboxTitle = '<span class="cff-event-title" style="font-weight:bold;">' + cffFormatCaption( $self.find('.cff-event-title').html() + '</span>' ); 2165 if( $self.find('.cff-date').length ) cffLightboxTitle += '<span class="cff-date">' + cffFormatCaption( $self.find('.cff-date').html() + '</span>' ); 2166 if( $self.find('.cff-location').length ) cffLightboxTitle += '<span class="cff-location">' + cffFormatCaption( $self.find('.cff-location').html() + '</span>' ); 2167 2168 cffLightboxTitle += '<span class="cff-desc">' + full_text + '</span>'; 2169 } 2170 2171 } else if( $self.hasClass('cff-album-item') ) { 2172 cffLightboxTitle = cffFormatCaption( $self.find('img').attr('alt') ); 2173 } else { 2174 var lb_title = full_text; 2175 //If there's no post text then use the description 2176 if( full_text.trim() == '' ) lb_title = $self.find('.cff-post-desc').text(); 2177 2178 //If there's no post text or desc then use the story 2179 if( lb_title == '' && $self.find('.cff-author .cff-story').length ) lb_title = $self.find('.cff-author .cff-page-name').text(); 2180 2181 //If there's no text at all then just set it to be a space so that it renders as blank, otherwise it will use the caption from the post before 2182 if( lb_title == '' ) lb_title = ' '; 2183 2184 cffLightboxTitle = cffFormatCaption( lb_title ); 2185 } 2186 2187 if(cffLightboxTitle.length > 1) cffLightboxTitle = cffLightboxTitle.replace(/"/g, '"'); 2188 2189 2190 //Create the lightbox link 2191 //Add the hover tile 2192 var cffLightboxTile = '<a class="cff-lightbox-link nofancybox" rel="nofollow" '; 2193 2194 //If it's a YouTube or Vimeo then set the poster image to use in the lightbox 2195 if( $photo.hasClass('cff-iframe-wrap') ){ 2196 //Add the image to the video lightbox placeholder as a query string so that the href value is unique and is added to the lightbox order. Otherwise, if it doesn't contain the query string then all videos that use the placeholder have the same URL and so they aren't added to the lightbox order. The actual video image is very small and so we need to use the placeholder to have the video display larger in the lightbox: 2197 var iframeSrc = ''; 2198 if ($photo.find('iframe').length) { 2199 iframeSrc = $photo.find('iframe').attr('src'); 2200 } if ($photo.find('.cff-iframe-placeholder').length ) { 2201 iframeSrc = $photo.find('.cff-iframe-placeholder').attr('data-src'); 2202 } 2203 cffLightboxTile += 'href="'+cffsiteurl+'/custom-facebook-feed-pro/assets/img/video-lightbox.png?'+postId+'" data-iframe="'+iframeSrc+'" ';
2204 //If it's a swf then display it in an iframe 2205 } else if( $photo.hasClass('cff-swf') ) { 2206 cffLightboxTile += 'href="'+cffsiteurl+'/custom-facebook-feed-pro/assets/img/video-lightbox.png" data-iframe="'+$photo.find('video').attr('src')+'" '; 2207 } else { 2208 var lb_href = $photo.find('img').attr('src').indexOf('placeholder') === -1 ? $photo.find('img').attr('src') : $photo.find('img').attr('data-orig-source'); 2209 if( $photo.find('img').attr('data-cff-no-event-img-large') ) lb_href = $photo.find('img').attr('data-cff-no-event-img-large'); 2210 if( $photo.find('img').attr('data-cff-full-img') ) lb_href = $photo.find('img').attr('data-cff-full-img'); 2211 cffLightboxTile += 'href="'+lb_href+'" data-iframe="" '; 2212 } 2213 //No nav 2214 // cffLightboxTile += 'data-cff-lightbox="'+postId+'" data-title="'+cffLightboxTitle+'" data-id="'+postId+'" data-thumbs="'+cffShowThumbs+'" '; 2215 cffLightboxTile += 'data-cff-lightbox="cff-lightbox-'+$self.closest("#cff").attr("data-cff-lb")+'" data-title="'+cffLightboxTitle+'" data-id="'+postId+'" data-thumbs="'+cffShowThumbs+'" '+cffgroupalbums+' '; 2216 2217 //If it's an HTML5 video then set the data-video attr 2218 if( $photo.hasClass('cff-html5-video') ){ 2219 2220 if($photo.hasClass('cff-swf')){ 2221 cffLightboxTile += 'data-url="'+$photo.find('.cff-html5-play').attr('href')+'" data-video="'; 2222 } else { 2223 cffLightboxTile += 'data-url="'+$photo.find('.cff-html5-play').attr('href')+'" data-video="'+$photo.find('img').attr('data-cff-video'); 2224 } 2225 2226 //Videos only: 2227 } else if( $photo.hasClass('cff-video') ) { 2228 cffLightboxTile += 'data-url="http://facebook.com/'+$photo.attr('id')+'" data-video="'+$photo.attr('data-source'); 2229 } else if( $photo.hasClass('cff-iframe-wrap') ) { 2230 cffLightboxTile += 'data-url="http://facebook.com/'+post_id+'" data-video="'; 2231 } else { 2232 cffLightboxTile += 'data-url="'+$photo.attr('href')+'" data-video="'; 2233 } 2234 2235 cffLightboxTile += '" data-type="'+postType+'" data-lb-comments="'+$photo.closest('.cff-lb').attr('data-lb-comments')+'"><div class="cff-photo-hover"><svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="search-plus" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" class="svg-inline--fa fa-search-plus fa-w-16 fa-2x"><path fill="currentColor" d="M304 192v32c0 6.6-5.4 12-12 12h-56v56c0 6.6-5.4 12-12 12h-32c-6.6 0-12-5.4-12-12v-56h-56c-6.6 0-12-5.4-12-12v-32c0-6.6 5.4-12 12-12h56v-56c0-6.6 5.4-12 12-12h32c6.6 0 12 5.4 12 12v56h56c6.6 0 12 5.4 12 12zm201 284.7L476.7 505c-9.4 9.4-24.6 9.4-33.9 0L343 405.3c-4.5-4.5-7-10.6-7-17V372c-35.3 27.6-79.7 44-128 44C93.1 416 0 322.9 0 208S93.1 0 208 0s208 93.1 208 208c0 48.3-16.4 92.7-44 128h16.3c6.4 0 12.5 2.5 17 7l99.7 99.7c9.3 9.4 9.3 24.6 0 34zM344 208c0-75.2-60.8-136-136-136S72 132.8 72 208s60.8 136 136 136 136-60.8 136-136z" class=""></path></svg><span class="cff-screenreader">View</span></div></a>'; 2236 2237 //Add the link to the photos/videos in the feed 2238 $photo.prepend(cffLightboxTile); 2239 2240 if( !cffTouchDevice ){ //Only apply hover effect if not touch screen device 2241 //Fade in links on hover 2242 $photo.on('mouseenter', function(){ 2243 $self.find('.cff-photo-hover').fadeIn(150); 2244 }).on('mouseleave', function(){ 2245 $self.find('.cff-photo-hover').stop().fadeOut(500); 2246 }); 2247 } 2248 2249 }); 2250 } 2251 2252 //Share tooltip function 2253 $self.find('.cff-share-link').off('click').on('click', function(e){
2254 e.preventDefault(); 2255 var $cffShareTooltip = $self.find('.cff-share-tooltip') 2256 2257 //Hide tooltip 2258 if( $cffShareTooltip.is(':visible') ){ 2259 $cffShareTooltip.hide().find('a').removeClass('cff-show'); 2260 } else { 2261 //Show tooltip 2262 $cffShareTooltip.show(); 2263 2264 var time = 0; 2265 $cffShareTooltip.find('a').each(function() { 2266 var $cffShareIcon = jQuery(this); 2267 setTimeout( function(){ 2268 $cffShareIcon.addClass('cff-show'); 2269 }, time); 2270 time += 20; 2271 }); 2272 } 2273 }); 2274 2275 //If it's a restricted page then use the lightbox src for the photo feed images 2276 if( typeof $cff.attr('data-restricted') !== 'undefined' ){ 2277 var cff_restricted_page = true; 2278 } else { 2279 var cff_restricted_page = false; 2280 } 2281 2282 //Photos only 2283 if( $self.hasClass('cff-album-item') ){ 2284 var cff_data_full_size = $self.attr('data-cff-full-size'); 2285 2286 if( typeof cff_data_full_size !== 'undefined' && cff_data_full_size != '' ){ 2287 2288 if( cff_restricted_page ){ 2289 $self.find('.cff-lightbox-link').attr('href', cff_data_full_size).closest('.cff-album-cover').css('background-image', 'url('+cff_data_full_size+')'); 2290 $self.find('img').attr('src', cff_data_full_size); 2291 } else { 2292 $self.find('.cff-lightbox-link').attr('href', cff_data_full_size); 2293 } 2294 2295 } 2296 } 2297 2298 2299 //Add the HD video player 2300 //If it's a video post then add the video link to the video element so it can be used in the lightbox 2301 if( ( $self.find('.cff-html5-video').length || $self.hasClass('cff-video') ) ){ 2302 2303 var cff_live_video = false; 2304 2305 //Set the selector based on whether it's a timeline vid or videos only 2306 if( $self.find('.cff-html5-video').length ){ 2307 var $vid_sel = $self.find('.cff-html5-video'); 2308 if( $vid_sel.attr('data-cff-live') == 'true' ) cff_live_video = true; 2309 } 2310 if( $self.hasClass('cff-video') ) var $vid_sel = $self; 2311 2312 if( cff_live_video && $(window).width() <= 640 ){ 2313 //If it's live video and on mobile then use HTMl5 player as live video doesn't work on mobile using Facebook player 2314 } else { 2315 2316 if( !$self.closest('.cff').hasClass('cff-private-group') ){ 2317 //If the Facebook Player is selected then pass the iframe URL into the lightbox. 2318 if( $vid_sel.attr('data-cff-video-player') != 'standard' ){ 2319 $self.find('.cff-lightbox-link').attr({ 2320 'data-iframe' : 'https://www.facebook.com/v2.3/plugins/video.php?href=' + $vid_sel.attr('data-cff-video-link'), 2321 'data-video' : '' 2322 }); 2323 } 2324 } 2325 2326 } 2327 2328 } 2329 2330 //Try to fix any video wrapper formatting issues 2331 setTimeout(function(){ 2332 $self.find('.cff-iframe-wrap .fluid-width-video-wrapper iframe').unwrap().wrap('<div style="float: left; width: 100%;"></div>'); 2333 $self.find('.cff-iframe-wrap .iframe-embed iframe').unwrap('iframe-embed'); 2334 }, 500); 2335 2336 2337 //Open lightbox when clicking album or video title 2338 $self.find('.cff-album-info a').on('click', function(e){
2339 e.preventDefault(); 2340 $self.find('.cff-lightbox-link').trigger('click'); 2341 }); 2342 2343 2344 }); //End $cff_post_selector.each loop 2345 2346 2347 //Load comment replies 2348 jQuery(document).off('click', '.cff-comment-replies a').on('click', '.cff-comment-replies a', function(){ 2349 cffLoadCommentReplies( $(this) ); 2350 }); 2351 2352 2353 $('.cff-wrapper').each(function(){ 2354 var $cff = $(this).find('#cff'), 2355 cff_grid_pag = $cff.attr('data-grid-pag'); 2356 2357 //Get the Access Token from the shortcode so it can be used in the connect file 2358 var shortcode_token_param = cffGetShortcodeToken($cff); 2359 2360 var $cffNumDiffHide = $(this).find('.cff'); 2361 //maybe hide 2362 if (typeof $cffNumDiffHide.attr('data-nummobile') !== 'undefined') { 2363 var num = typeof $cffNumDiffHide.attr('data-pag-num') !== 'undefined' && $cffNumDiffHide.attr('data-pag-num') !== '' ? parseInt($cffNumDiffHide.attr('data-pag-num')) : 1, 2364 nummobile = typeof $cffNumDiffHide.attr('data-nummobile') !== 'undefined' && $cffNumDiffHide.attr('data-nummobile') !== '' ? parseInt($cffNumDiffHide.attr('data-nummobile')) : num, 2365 itemSelector = $cffNumDiffHide.find('.cff-item').length ? '.cff-item' : '.cff-album-item'; 2366 if ($(window).width() < 480) { 2367 if (nummobile < $cffNumDiffHide.find(itemSelector).length) { 2368 $cffNumDiffHide.find(itemSelector).slice(nummobile - $cffNumDiffHide.find(itemSelector).length).addClass('cff-num-diff-hide'); 2369 } 2370 } else { 2371 if (num < $cffNumDiffHide.find(itemSelector).length) { 2372 $cffNumDiffHide.find(itemSelector).slice(num - $cffNumDiffHide.find(itemSelector).length).addClass('cff-num-diff-hide'); 2373 } 2374 } 2375 $cffNumDiffHide.removeAttr('data-nummobile'); 2376 } 2377 2378 //Masonry 2379 if( $cff.hasClass('cff-masonry-js' && ! $cff.hasClass('cff-all-reviews') ) ){ 2380 2381 if( $cff.find('.cff-album-item').length && ! $cff.hasClass('cff-masonry')){ 2382 $cff.removeClass('cff-masonry-js'); 2383 return; 2384 } 2385 2386 cffAddMasonry($cff); 2387 //Call it again in case images aren't fully loaded 2388 setTimeout(function(){ cffAddMasonry($cff); }, 1000); 2389 2390 // Resizing the window can affect the masonry feed so it is reset on resize 2391 $(window).on('resize', function () { 2392 setTimeout(function(){ 2393 cffAddMasonry($cff); 2394 }, 500); 2395 }); 2396 2397 if( $cff.find('.cff-credit').length ) $cff.css('padding-bottom', 30); 2398 } 2399 2400 //Allow us to make some tweaks when the feed is narrow 2401 function cffCheckWidth(){ 2402 2403 if( $cff.hasClass('cff-album-items-feed') ){ 2404 var $cffElement = $cff; 2405 } else { 2406 var $cffElement = $cff.find('.cff-item').first(); 2407 } 2408 2409 if( $cffElement.innerWidth() < 400 ){ 2410 if( !$cff.hasClass('cff-disable-narrow') ){ 2411 $cff.addClass('narrow'); 2412 } 2413 } else { 2414 $cff.removeClass('narrow'); 2415 } 2416 if( $cffElement.innerWidth() < 250 ){ 2417 $cff.addClass('cff-super-narrow'); 2418 } 2419 } 2420 cffCheckWidth(); 2421 2422 function cffActionLinksPos(){ 2423 if( $cff.find('.cff-item').first().innerWidth() < (190 + $('.cff-post-links').innerWidth() ) ){ 2424 $cff.find('.cff-post-links').addClass('cff-left') 2425 } else { 2426 $cff.find('.cff-post-links').removeClass('cff-left'); 2427 } 2428 } 2429 cffActionLinksPos(); 2430 2431 //Only check the width once the resize event is over 2432 var cffdelay = (function(){ 2433 var cfftimer = 0; 2434 return function(cffcallback, cffms){ 2435 clearTimeout (cfftimer); 2436 cfftimer = setTimeout(cffcallback, cffms); 2437 }; 2438 })(); 2439 window.addEventListener('resize', function(event){ 2440 cffdelay(function(){ 2441 cffCheckWidth(); 2442 cffActionLinksPos(); 2443 cffResizeAlbum(); 2444 }, 500); 2445 }); 2446 2447 //Albums only 2448 //Resize image height 2449 function cffResizeAlbum(last){ 2450 if ( $cff.hasClass('cff-masonry') || $cff.hasClass('cff-disable-liquid')) { 2451 return; 2452 } 2453 var cffAlbumWidth = $cff.find('.cff-album-item').eq(0).find('a').innerWidth(); 2454 2455 $cff.find('.cff-album-item a').css('height', cffAlbumWidth);
2456 //Crops event images when selected 2457 $cff.find('.cff-photo.cff-crop').css( 'height', $cff.find('.cff-photo.cff-crop').width() ); 2458 2459 //Sets crop height of main post image to be 60% (or the height of the thumbs - whichever is larger - so it's never shorter than the thumbs) to make room for the thumbs beneath 2460 $cff.find('.cff-item.cff-album .cff-photo.cff-multiple, .cff-video-post .cff-html5-video.cff-multiple').each(function(){ 2461 var $cffPhotoEl = $(this); 2462 2463 //Crop image attachments in posts 2464 var cffPhotoImgWidth = $cffPhotoEl.find('img').first().width(); 2465 if( cffPhotoImgWidth < 10 ) cffPhotoImgWidth = 300; 2466 2467 if($cffPhotoEl.hasClass('cff-img-layout-3')) $cffPhotoEl.find('.cff-img-attachments .cff-crop').css( 'height', cffPhotoImgWidth/2 ); 2468 if($cffPhotoEl.hasClass('cff-img-layout-4')) $cffPhotoEl.find('.cff-img-attachments .cff-crop').css( 'height', cffPhotoImgWidth/3 ); 2469 2470 //Crop main image 2471 if( $cffPhotoEl.is('.cff-img-layout-3, .cff-img-layout-4') ){ 2472 var $cffMainImage = $cffPhotoEl.find('.cff-main-image'), 2473 cropPercentage = 0.6; 2474 if( $cffPhotoEl.hasClass('cff-img-layout-4') ) cropPercentage = 0.8; 2475 2476 //Set the height based on ratio 2477 var cffImageHeight = Math.round( cffPhotoImgWidth / $cffMainImage.find('img').attr('data-ratio') ); 2478 $cffMainImage.css( 'height', Math.round( Math.max(cffImageHeight*cropPercentage, $cffPhotoEl.find('.cff-img-attachments').height() ) ) ); 2479 } else if( $cffPhotoEl.is('.cff-img-layout-2') ) { 2480 var $cffCrop = $cffPhotoEl.find('.cff-img-wrap.cff-crop'); 2481 if( $cffPhotoEl.hasClass('cff-portrait') ){ 2482 $cffPhotoEl.find('.cff-img-wrap.cff-crop').css('height', $cffPhotoEl.width()*0.8 ); 2483 } else { 2484 $cffPhotoEl.find('.cff-img-wrap.cff-crop').css('height', $cffPhotoEl.width()/2 ); 2485 } 2486 } 2487 2488 //If the main image is being cropped to zero then remove the crop so the full image is shown 2489 if( last == true && ( $cffPhotoEl.is('.cff-img-layout-3') || $cffPhotoEl.is('.cff-img-layout-4') ) && $cffPhotoEl.find('.cff-main-image').height() < 10 ) $cffPhotoEl.find('.cff-img-layout-3 .cff-main-image img, .cff-img-layout-4 .cff-main-image img').css({ 2490 'display' : 'block', 2491 'visibility' : 'visible' 2492 }) 2493 2494 //Make "+6" text small if the images are small 2495 if( cffPhotoImgWidth < 200 ){ 2496 $cffPhotoEl.addClass('cff-small-layout'); 2497 } else { 2498 $cffPhotoEl.removeClass('cff-small-layout'); 2499 } 2500 }); 2501 2502 } 2503 cffResizeAlbum(false); 2504 setTimeout(function(){ cffResizeAlbum(false); }, 50); 2505 setTimeout(function(){ cffResizeAlbum(true); }, 500); 2506 setTimeout(function(){ cffResizeAlbum(true); }, 1500); 2507 2508 2509 //PAGINATION 2510 //Events JS pagination 2511 var num_events = parseInt( $cff.attr('data-pag-num') ), 2512 show_events = num_events, //Iterated for each set 2513 cff_total_events = $cff.find('.cff-event').length, 2514 cff_visible_events = $('.cff-event:visible' ).length; 2515 2516 //Show first set of events 2517 $cff.find('.cff-event').slice(0, num_events).css('display', 'inline-block'); 2518 2519 if ( cff_total_events > num_events ) { 2520 $('.cff-no-more-posts').replaceWith(function () { 2521 return $("<a href='javascript:void(0)' class='cff-load-more' />").append($(this).contents()).html('Load More'); 2522 }) 2523 $('.cff').on('click', '.cff-load-more', function(){ 2524 cff_visible_events = $(".cff-event:visible").length; 2525 if ( cff_visible_events + 2 < cff_total_events ) { 2526 $cff.find('.cff-event').slice(0, num_events + $(".cff-event:visible").length).css('display', 'inline-block'); 2527 } else { 2528 $('.cff-load-more').replaceWith(function () { 2529 return $('<p class="cff-no-more-posts">No more posts</p>'); 2530 }); 2531 } 2532 }); 2533 } 2534 2535 //cffResizeAlbum(); //Correctly recalcs height of event images when using eventimage=cropped 2536 2537 //Review JS pagination 2538 if( $cff.hasClass('cff-all-reviews') ){ 2539 var num_reviews = parseInt( $cff.attr('data-pag-num') ), 2540 show_reviews = num_reviews; 2541 2542 //Offset 2543 var review_offset = parseInt($cff.attr('data-offset')); 2544 if( typeof review_offset == 'undefined' || isNaN(review_offset) ) review_offset = 0; 2545 2546 //Only show the required number of reviews 2547 $cff.find('.cff-review').slice(0, num_reviews + review_offset ).css('display', 'inline-block'); 2548 2549 //Hide some reviews if using offset setting 2550 if( review_offset > 0 ) $cff.find('.cff-review').slice(0, review_offset ).remove(); 2551 2552 //If using masonry then run it here 2553 if( $cff.hasClass('cff-masonry-js') ) { 2554 2555 cffAddMasonry($cff); 2556 //Call it again in case images aren't fully loaded 2557 setTimeout(function(){ cffAddMasonry($cff); }, 1000); 2558 2559 // Resizing the window can affect the masonry feed so it is reset on resize 2560 $(window).on('resize', function () { 2561 setTimeout(function(){ 2562 cffAddMasonry($cff); 2563 }, 500); 2564 }); 2565 2566 if( $cff.find('.cff-credit').length ) $cff.css('padding-bottom', 30); 2567 } 2568 2569 } 2570 2571 //Set a data attr that lets us know whether no posts were loaded into the feed so that we can change the "until" value in the next request 2572 var $cffLoadMore = $cff.find('#cff-load-more'), 2573 cff_no_posts_added = $cff.find('.cff-load-more').attr('data-cff-no-posts-added'); 2574 if (typeof cff_no_posts_added == typeof undefined || cff_no_posts_added == false) { 2575 $cffLoadMore.attr('data-cff-no-posts-added', 'false'); 2576 } 2577
2578 //If there's no posts in the feed initially then set the data-attr to be true 2579 if( $cff.find('.cff-item, .cff-album-item').length < 1 ) $cffLoadMore.attr('data-cff-no-posts-added', 'true'); 2580 2581 // add the load more button and input to simulate a dynamic json file call 2582 $cffLoadMore.off().on('click', function() { 2583 // reveal any hidden posts due to difference in desktop vs mobile devices 2584 // read the json that is in the cff-data-shortcode that contains all of the shortcode arguments 2585 var shortcodeData = $cff.attr('data-cff-shortcode'), 2586 $paginationURL = $cff.find('.cff-pag-url'), 2587 pag_url = $paginationURL.attr('data-cff-pag-url'), 2588 feed_id = $paginationURL.attr('data-transient-name'), 2589 post_id = $paginationURL.attr('data-post-id'), 2590 location = CFFLocationGuess($cff); 2591 //Upmcoming events JS pagination 2592 var events_count = $cff.find('.cff-upcoming-event').length; 2593 //If it's an event feed 2594 if( events_count > 0 ){ 2595 show_events = show_events + num_events; 2596 //Show the next set of events 2597 $cff.find('.cff-upcoming-event').slice(0, show_events).css('display', 'inline-block'); 2598 if( show_events > events_count ){ 2599 $cff.find('#cff-load-more').hide(); 2600 cff_no_more_posts($cff, $cffLoadMore); 2601 } 2602 2603 //Re-init masonry for JS 2604 if( $cff.hasClass('cff-masonry-js') && !$cff.hasClass('cff-masonry-css') ){ 2605 cffAddMasonry($cff); 2606 } 2607 return; 2608 } 2609 2610 //Reviews JS pagination 2611 if( $cff.hasClass('cff-all-reviews') ){ 2612 var reviews_count = $cff.find('.cff-review').length; 2613 //If it's an reviews feed 2614 if( reviews_count > 0 ){ 2615 show_reviews = show_reviews + num_reviews; 2616 //Show the next set of reviews 2617 $cff.find('.cff-review').slice(0, show_reviews).css('display', 'inline-block'); 2618 if( show_reviews > reviews_count ){ 2619 $cff.find('#cff-load-more').hide(); 2620 cff_no_more_posts($cff, $cffLoadMore); 2621 } 2622 2623 //Re-init masonry for JS 2624 if( $cff.hasClass('cff-masonry-js') && !$cff.hasClass('cff-masonry-css') ){ 2625 cffAddMasonry($cff); 2626 } 2627 return; 2628 } 2629 } 2630 2631 2632 //Remove the ID so it can't be clicked twice before the posts are loaded 2633 $cffLoadMore.off().removeAttr('id').addClass('cff-disabled'); 2634 2635 // remove the hidden field since it will be replaced with new before token and after token next url data 2636 $paginationURL.remove(); 2637 2638 2639 //If it's a photo/vid/album feed then change the selector 2640 if( $cff.hasClass('cff-album-items-feed') ){ 2641 var item_sel = '.cff-album-item'; 2642 } else { 2643 var item_sel = '.cff-item'; 2644 } 2645 2646 if( item_sel == '.cff-album-item' ){ 2647 //If the next_url is empty then use the prev_url 2648 if( (pag_url == '' || pag_url == '{}') ) pag_url = $paginationURL.attr('data-cff-prev-url'); 2649 2650 //Loop through the previous URLs and if the next URL is empty for an ID then add it in 2651 var prev_urls = $paginationURL.attr('data-cff-prev-url'); 2652 2653 //Convert the JSON string into an object so we can loop through it 2654 var prev_urls_arr = ( typeof prev_urls == 'undefined' ) ? '' : JSON.parse( prev_urls ); 2655 } 2656 2657 //Parse the urls string into an array so we can loop through it 2658 var pag_url_arr = ( typeof pag_url == 'undefined' ) ? '' : JSON.parse( pag_url ); 2659 2660 if( item_sel == '.cff-album-item' ){ 2661 //Add the URL to the next_urls if it doesn't exist in the array 2662 for (var key in prev_urls_arr) { 2663 if (prev_urls_arr.hasOwnProperty(key)) { 2664 if( typeof pag_url_arr[key] == 'undefined' ) pag_url_arr[key] = prev_urls_arr[key]; 2665 } 2666 } 2667 } 2668 if( (pag_url == '' || pag_url == '{}' || pag_url == 0 || pag_url == '0' ) && item_sel == '.cff-item' ){ 2669 $cffLoadMore.hide(); 2670 cff_no_more_posts($cff, $cffLoadMore); 2671 } else { 2672 //Display loader
2673 $cffLoadMore.addClass('cff-loading').append('<div class="cff-loader"></div>'); 2674 $cffLoadMore.find('.cff-loader').css('background-color', $cffLoadMore.css('color')); 2675 } 2676 2677 2678 //Check which pagination method to use 2679 var cff_timeline_api_paging = false; 2680 if( $cff.attr('data-timeline-pag') ) cff_timeline_api_paging = true; 2681 2682 if( cff_timeline_api_paging == true ){ 2683 //Use the raw "next" URL with the "paging_token" in it, as using the "until" method can cause a problem with groups due to the fact that the recent activity ordering method of groups can cause the last post in a feed to have an older date than those in the next batch, and so some are missed when paginating using the date. 2684 } else { 2685 //Loop through the pag array. Replace the until params for each id. Stringify to send in the ajax request 2686 for (var key in pag_url_arr) { 2687 if (pag_url_arr.hasOwnProperty(key) && key != 'latest_record_date') { 2688 2689 var this_url = pag_url_arr[key], 2690 until_old = cffGetParameterByName('until', this_url), 2691 $last_item = $cff.find(item_sel+'.cff-' + key).last(), 2692 until_new = (parseInt( $last_item.attr('data-cff-timestamp') ) - 1).toString(), 2693 backdated_new = false; 2694 2695 //If the post is backdated then use that instead as the API orders posts by backdate 2696 if( typeof $last_item.attr('data-cff-backdated') != 'undefined' ){ 2697 until_new = (parseInt( $last_item.attr('data-cff-backdated') ) - 1).toString(); 2698 } 2699 2700 //If there's no posts in the feed for a specific author then use the timestamp from the last post in the feed from any author 2701 if( isNaN(parseFloat(until_new)) ){ 2702 $last_item = $cff.find(item_sel).last(); 2703 until_new = (parseInt( $last_item.attr('data-cff-timestamp') ) - 1).toString(); 2704 2705 //If the post is backdated then use that instead as the API orders posts by backdate 2706 if( typeof $last_item.attr('data-cff-backdated') != 'undefined' ){ 2707 until_new = (parseInt( $last_item.attr('data-cff-backdated') ) - 1).toString(); 2708 } 2709 } 2710 2711 var new_url = this_url; 2712 2713 if( $cffLoadMore.attr('data-cff-no-posts-added') == 'true' ){ 2714 //If there were no posts added to the feed from the previous response then don't replace the until_old with the until_new in the next request 2715 } else { 2716 //If it's a regular timeline feed then add the "until" param 2717 if( item_sel !== '.cff-album-item' ){ 2718 2719 //V2.9+ of the API don't include "until" in the next url so only replace it if it exists 2720 if( this_url.indexOf("until=") !== -1 ){ 2721 //Replace old until value with new one in the URL 2722 var new_url = this_url.replace("until="+until_old,"until="+until_new); 2723 } else { 2724 //If "until" doesn't exist then add it to the end of the URL 2725 var new_url = this_url + "&until="+until_new; 2726 } 2727 2728 //Remove the "after" param as it overrides the "until" param 2729 if( new_url.indexOf('&after=') > -1 ) new_url = new_url.replace("&after="+cffGetParameterByName('after', new_url),""); 2730 2731 } 2732 2733 } 2734 2735 //USE OFFSET PAGINATION METHOD 2736 if( cff_grid_pag == 'offset' ){ 2737 if( item_sel == '.cff-album-item' ){ 2738 //If it's an album item then remove the "after" param as it overrides the "until" param 2739 if( new_url.indexOf('&after=') > -1 ) new_url = new_url.replace("&after="+cffGetParameterByName('after', new_url),""); 2740 2741 //Add the offset param for pagination as time based doesn't work with albums due to the albums not always being in date order, and the other type of paging doesn't work due to filtering/higher post limits 2742 key = key.replace( /(:|\.|\[|\]|,|=)/g, "\\$1" ); 2743 var albumItemCount = $cff.find('.cff-album-item.cff-' + key).length + $cff.find('.cff-empty-album.cff
2743-' + key).length; 2744 if( new_url.indexOf('&offset=') > -1 ){ 2745 new_url = new_url.replace("&offset="+cffGetParameterByName('offset', new_url), "&offset="+albumItemCount); 2746 } else { 2747 new_url = new_url + "&offset=" + albumItemCount; 2748 } 2749 key = key.replace(/\\/g, ''); 2750 } 2751 } 2752 //END USE OFFSET PAGINATION METHOD 2753 2754 2755 //If it's an events only URL then remove the "after" param as we're using the "until" value instead 2756 if( (this_url.indexOf('/events') > -1 && this_url.indexOf('&after=') > -1) || (this_url.indexOf('/ratings') > -1 && this_url.indexOf('&after=') > -1 && $cff.hasClass('cff-all-reviews') ) ){ 2757 new_url = new_url.replace("&after="+cffGetParameterByName('after', new_url),""); 2758 } 2759 2760 //Remove the "__paging_token" parameter from the URL as it causes some posts to be missing and it isn't needed as we're using "until" 2761 if( new_url.indexOf('&__paging_token') > -1 ){ 2762 new_url = new_url.replace("&__paging_token="+cffGetParameterByName('__paging_token', new_url),""); 2763 } 2764 2765 pag_url_arr[key] = new_url; 2766 } 2767 } // End pag_url_arr loop 2768 } // End cff_timeline_api_paging if/else 2769 2770 var pageAtt = typeof $cff.attr('data-page') !== 'undefined' ? $cff.attr('data-page') : 1, 2771 page = parseInt(pageAtt) + 1; 2772 $cff.attr('data-page', page); 2773 //Convert the array back into a string 2774 pag_url = JSON.stringify( pag_url_arr ); 2775 jQuery.ajax({ 2776 url : cffajaxurl, 2777 type : 'post', 2778 data : { 2779 action : 'cff_get_new_posts', 2780 shortcode_data : shortcodeData, 2781 pag_url : pag_url, 2782 feed_id : feed_id, 2783 post_id : post_id, 2784 location : location, 2785 page: page 2786 }, 2787 success : function(data) { 2788 $cff.find('.cff-num-diff-hide').removeClass('cff-num-diff-hide'); 2789 //If there's no posts added to the feed then set a data attr on the button so that we can change the "until" value to get a new batch next time 2790 //Check by seeing if the data contains a div (ie. post) 2791 if( data.indexOf('<div class=') == -1 && data.indexOf('<span class=') == -1 ){ 2792 $cffLoadMore.attr('data-cff-no-posts-added', 'true'); 2793 } else { 2794 $cffLoadMore.attr('data-cff-no-posts-added', 'false'); 2795 } 2796 2797 //Appends the html echoed out in cff_get_new_posts() to the last existing post element 2798 if( $cff.find('.cff-item, .cff-album-item').length ){ 2799 $cff.find('.cff-item, .cff-album-item').addClass('cff-masonry-new').removeClass('cff-new').last().after(data); 2800 } else { 2801 //If there's no posts yet then just add it into the posts container 2802 $cff.find('.cff-posts-wrap').append(data); 2803 } 2804 /* 2805 if($cff.find('.cff-pag-url').attr('data-cff-pag-url') == 0){ 2806 $cffLoadMore.hide(); 2807 cff_no_more_posts($cff, $cffLoadMore); 2808 } 2809 */ 2810 2811 //Replace any duplicate album items with empty items so doesn't affect offset pagination 2812 $cff.find('.cff-album-item').each(function (i) { 2813 var $el = $('[id="' + this.id + '"]').eq(1); 2814 if($el.length){ 2815 this_classes = $el.attr('class'); 2816 this_classes = this_classes.replace("cff-album-item",""); 2817 } 2818 }); 2819 2820 //Remove loader 2821 $cffLoadMore.removeClass('cff-loading').find('.cff-loader').remove(); 2822 //Re-add the ID so it can be clicked again 2823 $cffLoadMore.attr('id', 'cff-load-more').removeClass('cff-disabled'); 2824 2825 //Rerun JS (only runs on new items - .cff-new) 2826 cff_init( $cff ); 2827 2828 // rerun image resolution code for new images 2829 var feedIndex = parseInt($cffLoadMore.closest('.cff').attr('data-cff-index')) - 1; 2830 if (typeof window.cff !== 'undefined' && window.cff.feeds[feedIndex] !== 'undefined') { 2831 window.cff.feeds[feedIndex].afterLoadMoreClicked($cffLoadMore); 2832 } 2833 /* 2834 if( $cff.hasClass('cff-album-items-feed')){ 2835 cffAddMasonry($cff); 2836 } 2837 */ 2838 //Re-init masonry 2839 var albumOverride = $cff.find('.cff-album-item').length && $cff.hasClass('cff-disable-liquid'); 2840 if( albumOverride || ($cff.hasClass('cff-masonry-js') && !$cff.hasClass('cff-masonry-css')) ){ 2841 $cff.masonry('appended', $cff.find('.cff-new')); 2842 $cff.find('.cff-view-comments, .cff-comment-replies a, .cff-show-more-comments a').off().on('click', function() { 2843 if( !$cff.hasClass('cff-opaque-comments') ){
2844 setTimeout(function(){ 2845 cffAddMasonry($cff); 2846 }, 500); 2847 } 2848 }); 2849 } 2850 2851 //If there's no more API URLs to hit then hide the load more button 2852 var next_urls = $cff.find('.cff-pag-url').attr('data-cff-pag-url'); 2853 if( item_sel == '.cff-item' || cff_grid_pag == 'cursor' ){ 2854 if( next_urls == '{}' ) cff_no_more_posts($cff, $cffLoadMore); 2855 } else { 2856 if( data.indexOf('class="cff-album-item') < 0 && data.indexOf('class="cff-empty-album') < 0 ){ 2857 cff_no_more_posts($cff, $cffLoadMore); 2858 } 2859 } 2860 2861 // Call Custom JS if it exists 2862 // if (typeof cff_custom_js == 'function') setTimeout(function(){ cff_custom_js(jQuery); }, 100); 2863 if (typeof cff_custom_js == 'function') cff_custom_js(jQuery); 2864 2865 } // End success 2866 }); // End Ajax call 2867 //Hover on Load More button 2868 }).on('mouseenter', function() { 2869 $(this).css('background', $(this).attr('data-cff-hover') ); 2870 }).on('mouseleave', function() { 2871 $(this).css('background', $(this).attr('data-cff-bg') ); 2872 }); 2873 2874 function cff_no_more_posts($cff, $cffLoadMore){ 2875 var no_more_posts_text = ( $cffLoadMore.attr('data-no-more') == '' ) ? 'No more posts' : $cffLoadMore.attr('data-no-more').replace(/\\'/g,"'"); 2876 if( $cff.find('.cff-no-more-posts').length < 1 ) $cffLoadMore.hide().after('<p class="cff-no-more-posts">'+no_more_posts_text+'</p>'); 2877 } 2878 2879 //Remove the masonry css class if it's a grid feed 2880 if( $cff.find('.cff-album-item').length && ! $cff.hasClass('cff-masonry')){ 2881 $cff.removeClass('cff-masonry cff-masonry-js cff-masonry-css'); 2882 } 2883 2884 //Multiple event dates toggle 2885 $cff.find('.cff-more-dates').on('click', function(){ 2886 $(this).siblings('.cff-multiple-dates').slideToggle(100); 2887 }); 2888 2889 2890 }); // End .$('.cff-wrapper').each 2891 2892 function cffGetCommentsIDArray(){ 2893 var commentsArrayIDs = []; 2894 $('.cff-posts-wrap').each(function(){ 2895 var wrapper = $(this); 2896 wrapper.find('.cff-item.cff-new:not(.cff-event)').each(function(){ 2897 var $self = $(this), 2898 post_id_orig = $self.find('.cff-view-comments').attr('id'), 2899 object_id = $self.closest('.cff-item').attr('data-object-id'); 2900 commentsArrayIDs.push(post_id_orig); 2901 }); 2902 2903 }); 2904 return commentsArrayIDs; 2905 } 2906 2907 function cffGetFeedLocatorDataArray(){ 2908 var feedLocatorData = []; 2909 $('.cff-timeline-feed').each(function(){ 2910 $cffPagUrl = $(this).find('.cff-pag-url'); 2911 var singleFeedLocatorData = { 2912 feedID : $cffPagUrl.attr('data-feed-id'), 2913 postID : $cffPagUrl.attr('data-post-id'), 2914 shortCodeAtts : $(this).attr('data-cff-shortcode').trim() == '' ? {} : JSON.parse($(this).attr('data-cff-shortcode')), 2915 location : CFFLocationGuess($(this)) 2916 }; 2917 feedLocatorData.push(singleFeedLocatorData); 2918 }); 2919 return feedLocatorData; 2920 } 2921 //GET/CACHE COMMENTS 2922 //Check if the meta transient exists (set in head JS vars) and that a timeline feed exists on the page 2923 if($('.cff-timeline-feed').length && (typeof cffdisablecommentcaching == 'undefined') ){ 2924 var commentsArrayIDs = cffGetCommentsIDArray(), 2925 feedLocatorData = cffGetFeedLocatorDataArray(); 2926 2927 //If the comments data is cached then get it from the transient in the DB 2928 var atts = typeof $cff.attr('data-cff-shortcode') !== 'undefined' && $cff.attr('data-cff-shortcode').indexOf('{') === 0 ? JSON.parse($cff.attr('data-cff-shortcode')) : {}; 2929 var page = typeof $cff.attr('data-page') !== 'undefined' ? parseInt($cff.attr('data-page')) : 1; 2930 2931 $.ajax({
2932 url: cffajaxurl, 2933 type: 'POST', 2934 async: true, 2935 cache: false, 2936 data:{ 2937 action: 'get_meta', 2938 comments_array_ids : commentsArrayIDs, 2939 feedLocatorData : feedLocatorData, 2940 atts: atts, 2941 page: page 2942 }, 2943 success: function(data) { 2944 //If there's no data then set the array to be empty so that it hits the API for the data 2945 if( data == '' || data.length < 1 ){ 2946 metaArr = []; 2947 } else { 2948 //Decode the JSON to that it can be used again 2949 //Replace any escaped single quotes as it results in invalid JSON 2950 data = data.replace(/\\'/g, "'"); 2951 //Convert the cached JSON string back to a JSON object 2952 metaArr = JSON.parse( data ); 2953 } 2954 // $cff.find('.cff-item.cff-new').each(function(){ 2955 $cff.each(function(){ 2956 $(this).find('.cff-item.cff-new:not(.cff-event)').each(function(){ 2957 var $self = $(this), 2958 post_id_orig = $self.find('.cff-view-comments').attr('id'), 2959 object_id = $self.closest('.cff-item').attr('data-object-id'); 2960 //If the post ID doesn't exist in the array then use the API to get the data 2961 if( metaArr.hasOwnProperty(post_id_orig) && metaArr[post_id_orig] != ""){ 2962 cffCreateComments($self, JSON.parse(metaArr[post_id_orig])['content']); 2963 cffAddFullsizeImageURLs($self, JSON.parse(metaArr[post_id_orig])['content']); 2964 } else { 2965 cffGetMetaAPI($self, post_id_orig, object_id); 2966 } 2967 }); 2968 }); 2969 }, 2970 error: function(xhr,textStatus,e) { 2971 return; 2972 } 2973 2974 }); //End ajax 2975 2976 } else { 2977 $('#cff .cff-item.cff-new:not(.cff-event)').each(function(){ 2978 var $self = $(this), 2979 post_id_orig = $self.find('.cff-view-comments').attr('id'), 2980 object_id = $self.closest('.cff-item').attr('data-object-id'); 2981 cffGetMetaAPI($self, post_id_orig, object_id); 2982 }); 2983 } //END GET/CACHE COMMENTS 2984 2985 function cffGetMetaAPI($self, post_id_orig, object_id){ 2986 2987 //If there's no comments box on the page then return so we don't hit the API to get the data 2988 if( $self.find('.cff-view-comments').length == 0 ) return; 2989 2990 if( typeof object_id == 'undefined' || object_id.length < 2 ) object_id = ''; 2991 2992 var object_id_query = ''+object_id, 2993 post_id_query = '?post_id='+post_id_orig, 2994 use_id = 'object', 2995 post_comment_count = $self.find('.cff-comments .cff-count').text(), 2996 post_likes_count = $self.find('.cff-likes .cff-count').text(), 2997 cff_page_id = $self.attr('data-page-id'); 2998 2999 if( typeof post_comment_count == 'undefined' || post_comment_count == '' ) post_comment_count = 0; 3000 //Load comment counts via JS 3001 if( typeof $self.attr('data-comments-js') !== 'undefined' ){ 3002 if( typeof post_comment_count == 'undefined' || post_comment_count == '' ) post_comment_count = 1; 3003 } 3004 if( typeof post_likes_count == 'undefined' || post_likes_count == '' ) post_like
3004s_count = 0; 3005 3006 //If it's a video post or there's no object ID then use the post ID (video posts don't have "images" field) 3007 // if( typeof object_id == 'undefined' || object_id.length < 2 || $self.hasClass('cff-video-post') ) use_id = 'post'; 3008 if( typeof object_id == 'undefined' || object_id.length < 2 || $self.find('.cff-comments-box').hasClass('cff-shared-story') || $self.hasClass('cff-timeline-event') ) use_id = 'post'; 3009 3010 var timeline_event = ''; 3011 if( $self.hasClass('cff-timeline-event') ) timeline_event = '&timeline_event=true'; 3012 3013 var usegrouptoken = '', 3014 useowntoken = ''; 3015 if( $self.closest('#cff').hasClass('cff-group') ) usegrouptoken = '&usegrouptoken=true'; 3016 if( $self.closest('#cff').attr('data-own-token') == 'true' ) useowntoken = '&useowntoken=true'; 3017 3018 shortcode_token_param = cffGetShortcodeToken( $self.closest('#cff') ); 3019 3020 //Is it a video post? If so, then we may be able to use the object ID to get the embeddable video object 3021 var cff_is_video_post = $self.hasClass('cff-video-post') ? '&isvideo=true' : ''; 3022 3023 var url = cffsiteurl + "/custom-facebook-feed-pro/query.php?o_id=" + object_id + '&post_id='+post_id_orig + '&use_id=' + use_id + timeline_event + usegrouptoken + useowntoken + '&comments_num=' + post_comment_count + '&likes_num=' + post_likes_count + '&type=meta' + cff_is_video_post + '&pageid=' + cff_page_id + shortcode_token_param; 3024 3025 if( $self.hasClass('cff-album') ) url += '&timelinealbum=true'; 3026 3027 //Get comments, reactions, and full size images data from the API 3028 if( locatefile == true && typeof window.cff_block_editor === 'undefined' ){ 3029 var submitData = { 3030 action: 'cff_query', 3031 o_id: object_id, 3032 post_id: post_id_orig, 3033 use_id: use_id, 3034 comments_num: post_comment_count, 3035 likes_num: post_likes_count, 3036 type: 'meta', 3037 pageid: cff_page_id, 3038 }; 3039 if( $self.hasClass('cff-video-post') ) { 3040 submitData.isvideo = true; 3041 } 3042 if( $self.hasClass('cff-timeline-event') ) { 3043 submitData.timeline_event = true; 3044 } 3045 if( $self.closest('#cff').hasClass('cff-group') ) { 3046 submitData.usegrouptoken = true; 3047 } 3048 if( $self.closest('#cff').attr('data-own-token') == 'true' ) { 3049 submitData.useowntoken = true; 3050 } 3051 if( shortcode_token_param !== '' ){ 3052 var token = shortcode_token_param.split('='); 3053 3054 submitData.at = token[1]; 3055 } 3056 3057 var onSuccess = function(data) { 3058 metaArray.push( {'id_post' : post_id_orig, 'content' : data} ); 3059 //Cache the comments by adding to the cache array 3060 metaArr[ post_id_orig ] = data; 3061 newMetaArr[ post_id_orig ] = data; //This is cached. Only the new comments. 3062 //Add the comments HTML 3063 cffCreateComments($self, data); 3064 3065 //Replace images URLs with full size ones 3066 cffAddFullsizeImageURLs($self, data); 3067 //Set the cache 3068 cffSetMetaCache(metaArray); 3069 3070 }; 3071 cffAjax(submitData,onSuccess); 3072 } 3073 3074 } //End cffGetMetaAPI() 3075 3076 //Only allow this function to run once every time new posts are loaded so that a load of ajax requests aren't all fired off at once. It's called once and then runs 3 times in total to cache all comments on the page into the cff_meta transient. 3077 var cffSetMetaCache_executed = false; 3078 function cffSetMetaCache(newMetaArr){ 3079 if( typeof cffdisablecommentcaching != 'undefined' ) return; 3080 if( !cffSetMetaCache_executed ){ 3081 3082 //Cache the comments data 3083 var cffTimesCached = 0, 3084 cffCacheDelay = setTimeout(function() { 3085 //Try to cache it multiple times so that if the comments data isn't finished returning the first time then the subsequent attempts gets it 3086 var cffCacheInterval = setInterval(function(){ 3087 3088 cffCacheMeta(newMetaArr); 3089 3090 cffTimesCached++; 3091 if(cffTimesCached == 2) clearInterval(cffCacheInterval); 3092 }, 3000); 3093 3094 //Send the data to DB initially via ajax after a 0.5 second delay 3095 cffCacheMeta(newMetaArr); 3096 }, 500); 3097 3098 cffSetMetaCache_executed = true; 3099 3100 } // End cffRunFunction check 3101 3102 3103 3104 3105 //Cache the likes and comments counts by sending an array via ajax to the main plugin file which then stores it in a transient 3106 function cffCacheMeta(newMetaArr){ 3107 //Convert the JSON object to a string 3108 var jsonstring = JSON.stringify( newMetaArr ); 3109 3110 //If the comments data is cached then get it from the transient in the DB 3111 var atts = typeof $cff.attr('data-cff-shortcode') !== 'undefined' && $cff.attr('data-cff-shortcode').indexOf('{') === 0 ? JSON.parse($cff.attr('data-cff-shortcode')) : {}; 3112 var page = typeof $cff.attr('data-page') !== 'undefined' ? parseInt($cff.attr('data-page')) : 1; 3113 3114 //Encode the JSON string so that it can be stored in the database 3115 //Cache the data 3116 var opts = { 3117 url: cffajaxurl, 3118 type: 'POST', 3119 async: true, 3120 cache: false, 3121 data:{ 3122 action: 'cache_meta', 3123 metadata: jsonstring, // Passes array of meta data to WP to cache 3124 atts: atts, 3125 page: page 3126 }, 3127 success: function(response) { 3128 return; 3129 }, 3130 error: function(xhr,textStatus,e) { 3131 return; 3132 } 3133 }; 3134 $.ajax(opts); 3135 3136 } // End cffCacheMeta() 3137 3138 } // End cffSetMetaCache() 3139 3140 3141 function cffGetParameterByName(name, url) { 3142 name = name.replace(/[\[\]]/g, "\\$&"); 3143 var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), 3144 results = regex.exec(url); 3145 if (!results) return null; 3146 if (!results[2]) return ''; 3147 return decodeURIComponent(results[2].replace(/\+/g, " "));
3148 } 3149 3150 function cffLinkify(inputText) { 3151 var replacedText, replacePattern1, replacePattern2, replacePattern3; 3152 3153 //URLs starting with http://, https://, or ftp:// 3154 replacePattern1 = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim; 3155 replacedText = inputText.replace(replacePattern1, '<a href="$1" target="_blank" rel="nofollow noopener noreferrer">$1</a>'); 3156 3157 //URLs starting with "www." (without // before it, or it'd re-link the ones done above). 3158 replacePattern2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim; 3159 replacedText = replacedText.replace(replacePattern2, '$1<a href="http://$2" target="_blank" rel="nofollow noopener noreferrer">$2</a>'); 3160 3161 //Change email addresses to mailto:: links. 3162 replacePattern3 = /(([a-zA-Z0-9\-\_\.])+@[a-zA-Z\_]+?(\.[a-zA-Z]{2,6})+)/gim; 3163 replacedText = replacedText.replace(replacePattern3, '<a href="mailto:$1">$1</a>'); 3164 3165 return replacedText; 3166 } 3167 3168 3169 //HTML5 Video play button 3170 $(document).off('click', '#cff .cff-html5-video .cff-html5-play').on('click', '#cff .cff-html5-video .cff-html5-play', function(e){ 3171 e.preventDefault(); 3172 3173 var $self = $(this), 3174 $videoWrapper = $self.closest('.cff-html5-video'), 3175 video = $self.siblings('video')[0]; 3176 video.play(); 3177 $self.hide(); 3178 $self.siblings('.cff-poster').hide(); 3179 3180 //Show controls when the play button is clicked 3181 if (video.hasAttribute("controls")) { 3182 video.removeAttribute("controls") 3183 } else { 3184 video.setAttribute("controls","controls") 3185 } 3186 3187 if($videoWrapper.innerWidth() < 150 && !$videoWrapper.hasClass('cff-no-video-expand')) { 3188 $videoWrapper.css('width','100%').closest('.cff-item').find('.cff-text-wrapper').css('width','100%'); 3189 } 3190 }); 3191 3192 3193 //Replace the lightbox image with the full size image which is retrieved in the meta API request 3194 function cffAddFullsizeImageURLs($self, data){ 3195 var data = JSON.parse( data ); 3196 3197 if( typeof data.images !== 'undefined' && data.images !== null ) $self.find('.cff-lightbox-link').attr('href', data.images[0].source); 3198 3199 //Removed in v3.7 as shouldn't be needed any longer. Commenting out in case needs to be re-added. 3200 //Add the full size video image which is retrieved from query.php to fix the Facebook video image size API bug 3201 // if( $self.find('.cff-html5-video').length && typeof data.attachments !== 'undefined' && data.attachments !== null ){ 3202 // $self.find('.cff-poster').attr('src', data.attachments.data[0].media.image.src); 3203 // console.log( data.attachments.data[0] ); 3204 // $self.find('.cff-lightbox-link').attr('href', data.attachments.data[0].media.image.src); 3205 // } 3206 } 3207 3208 3209 //Create comments 3210 function cffCreateComments($self, data){ 3211 3212 if (data.substring(0, 1) == "<") return false; 3213 3214 //Convert string of data received from comments.php to a JSON object 3215 var data = JSON.parse( data ), 3216 cff_comments = '', 3217 cff_likes_this = '', 3218 commentShow = parseInt( $self.find('.cff-comments-box').attr('data-num') ), 3219 like_count = ( typeof data.likes !== 'undefined' ) ? data.likes.summary.total_count : 0, 3220 $cffCommentsBox = $self.find('.cff-comments-box'), 3221 $cffCommentLikes = $cffCommentsBox.find('.cff-comment-likes'), 3222 cff_hide_comment_avatars = Boolean($self.find('.cff-comments-box').attr('data-cff-hide-avatars')), 3223 cff_expand_comments = Boolean($self.find('.cff-comments-box').attr('data-cff-expand-comments')), 3224 cff_translate_like_this_text = $cffCommentsBox.attr('data-cff-like-text'),
3225 cff_translate_likes_this_text = $cffCommentsBox.attr('data-cff-likes-text'), 3226 cff_translate_reacted_to_this_text = $cffCommentsBox.attr('data-cff-reacted-text'), 3227 cff_translate_and_text = $cffCommentsBox.attr('data-cff-and-text'), 3228 cff_translate_other_text = $cffCommentsBox.attr('data-cff-other-text'), 3229 cff_translate_others_text = $cffCommentsBox.attr('data-cff-others-text'), 3230 cff_translate_reply_text = $cffCommentsBox.attr('data-cff-reply-text'), 3231 cff_translate_replies_text = $cffCommentsBox.attr('data-cff-replies-text'), 3232 cff_total_comments_count = ( typeof data.comments !== 'undefined' ) ? data.comments.summary.total_count : 0, 3233 cff_meta_link_color = $self.find('.cff-comments-box').attr('data-cff-meta-link-color'), 3234 cff_post_tags = Boolean( $self.find('.cff-comments-box').attr('data-cff-post-tags') ); 3235 3236 //Load comment counts via JS 3237 if( typeof $self.attr('data-comments-js') !== 'undefined' ){ 3238 var comment_count = ( typeof data.comments !== 'undefined' ) ? data.comments.summary.total_count : 0; 3239 $self.find('.cff-comments .cff-count').text(comment_count); 3240 } 3241 3242 //ADD REACTIONS 3243 var cff_haha_count = ( typeof data.haha !== 'undefined' ) ? data.haha.summary.total_count : 0; 3244 var cff_love_count = ( typeof data.love !== 'undefined' ) ? data.love.summary.total_count : 0; 3245 var cff_wow_count = ( typeof data.wow !== 'undefined' ) ? data.wow.summary.total_count : 0; 3246 var cff_sad_count = ( typeof data.sad !== 'undefined' ) ? data.sad.summary.total_count : 0; 3247 var cff_angry_count = ( typeof data.angry !== 'undefined' ) ? data.angry.summary.total_count : 0; 3248 3249 var reactions_arr = [cff_haha_count, cff_love_count, cff_wow_count, cff_sad_count, cff_angry_count]; 3250 var reaction_first_num = reactions_arr.sort(sortNumber)[0]; 3251 var reaction_second_num = reactions_arr.sort(sortNumber)[1]; 3252 3253 //Sort array highest to lowest 3254 function sortNumber(a,b) { 3255 return b - a; 3256 } 3257 3258 var reactions_html = '', 3259 love_added = false, 3260 haha_added = false, 3261 wow_added = false, 3262 sad_added = false, 3263 angry_added = false, 3264 love_svg = '<svg role="img" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M462.3 62.7c-54.5-46.4-136-38.7-186.6 13.5L256 96.6l-19.7-20.3C195.5 34.1 113.2 8.7 49.7 62.7c-62.8 53.6-66.1 149.8-9.9 207.8l193.5 199.8c6.2 6.4 14.4 9.7 22.6 9.7 8.2 0 16.4-3.2 22.6-9.7L472 270.5c56.4-58 53.1-154.2-9.7-207.8zm-13.1 185.6L256.4 448.1 62.8 248.3c-38.4-39.6-46.4-115.1 7.7-161.2 54.8-46.8 119.2-12.9 142.8 11.5l42.7 44.1 42.7-44.1c23.2-24 88.2-58 142.8-11.5 54 46 46.1 121.5 7.7 161.2z"></path></svg>'+'<span class="cff-svg-bg-dark"><svg class="cff-svg-bg" role="img" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M462.3 62.6C407.5 15.9 326 24.3 275.7 76.2L256 96.5l-19.7-20.3C186.1 24.3 104.5 15.9 49.7 62.6c-62.8 53.6-66.1 149.8-9.9 207.9l193.5 199.8c12.5 12.9 32.8 12.9 45.3 0l193.5-199.8c56.3-58.1 53-154.3-9.8-207.9z"></path></svg></span>', 3265 haha_svg = '<svg role="img" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path d="M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm152.7 400.7c-19.8 19.8-43 35.4-68.7 46.3-26.6 11.3-54.9 17-84.1 17s-57.5-5.7-84.1-17c-25.7-10.9-48.8-26.5-68.7-46.3-19.8-19.8-35.4-43-46.3-68.7-11.3-26.6-17-54.9-17-84.1s5.7-57.5 17-84.1c10.9-25.7 26.5-48.8 46.3-68.7 19.8-19.8 43-35.4 68.7-46.3 26.6-11.3 54.9-17 84.1-17s57.5 5.7 84.1 17c25.7 10.9 48.8 26.5 68.7 46.3 19.8 19.8 35.4 43 46.3 68.7 11.3 26.6 17 54.9 17 84.1s-5.7 57.5-17 84.1c-10.8 25.8-26.4 48.9-46.3 68.7zM281.8 206.3l80 48c11.5 6.8 24
3265-7.6 15.4-18L343.6 196l33.6-40.3c8.6-10.3-3.8-24.8-15.4-18l-80 48c-7.7 4.7-7.7 15.9 0 20.6zm-147.6 48l80-48c7.8-4.7 7.8-15.9 0-20.6l-80-48c-11.6-6.9-24 7.7-15.4 18l33.6 40.3-33.6 40.3c-8.7 10.4 3.8 24.8 15.4 18zM383 288H113c-9.6 0-17.1 8.4-15.9 18 8.8 71 69.4 126 142.9 126h16c73.4 0 134-55 142.9-126 1.2-9.6-6.3-18-15.9-18zM256 400h-16c-50.2 0-93.5-33.3-107.4-80h230.8c-13.9 46.7-57.2 80-107.4 80z"></path></svg>'+'<svg class="cff-svg-bg" role="img" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path d="M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm80 152c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm-160 0c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm88 272h-16c-73.4 0-134-55-142.9-126-1.2-9.5 6.3-18 15.9-18h270c9.6 0 17.1 8.4 15.9 18-8.9 71-69.5 126-142.9 126z"></path></svg>', 3266 wow_svg = '<svg role="img" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path d="M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm0 464c-119.1 0-216-96.9-216-216S128.9 40 248 40s216 96.9 216 216-96.9 216-216 216zm0-184c-35.3 0-64 28.7-64 64s28.7 64 64 64 64-28.7 64-64-28.7-64-64-64zm0 96c-17.6 0-32-14.4-32-32s14.4-32 32-32 32 14.4 32 32-14.4 32-32 32zm-48-176c0-17.7-14.3-32-32-32s-32 14.3-32 32 14.3 32 32 32 32-14.3 32-32zm128-32c-17.7 0-32 14.3-32 32s14.3 32 32 32 32-14.3 32-32-14.3-32-32-32z"></path></svg>'+'<svg class="cff-svg-bg" role="img" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path d="M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zM136 208c0-17.7 14.3-32 32-32s32 14.3 32 32-14.3 32-32 32-32-14.3-32-32zm112 208c-35.3 0-64-28.7-64-64s28.7-64 64-64 64 28.7 64 64-28.7 64-64 64zm80-176c-17.7 0-32-14.3-32-32s14.3-32 32-32 32 14.3 32 32-14.3 32-32 32z"></path></svg>', 3267 sad_svg = '<svg role="img" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path d="M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm0 464c-119.1 0-216-96.9-216-216S128.9 40 248 40s216 96.9 216 216-96.9 216-216 216zm0-152c-44.4 0-86.2 19.6-114.8 53.8-5.7 6.8-4.8 16.9 2 22.5 6.8 5.7 16.9 4.8 22.5-2 22.4-26.8 55.3-42.2 90.2-42.2s67.8 15.4 90.2 42.2c5.3 6.4 15.4 8 22.5 2 6.8-5.7 7.7-15.8 2-22.5C334.2 339.6 292.4 320 248 320zm-80-80c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32zm160 0c17.7 0 32-14.3 32-32s-14.3-32-32-32-32 14.3-32 32 14.3 32 32 32z"></path></svg>'+'<svg class="cff-svg-bg" role="img" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path d="M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm80 168c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm-160 0c17.7 0 32 14.3 32 32s-14.3 32-32 32-32-14.3-32-32 14.3-32 32-32zm170.2 218.2C315.8 367.4 282.9 352 248 352s-67.8 15.4-90.2 42.2c-13.5 16.3-38.1-4.2-24.6-20.5C161.7 339.6 203.6 320 248 320s86.3 19.6 114.7 53.8c13.6 16.2-11 36.7-24.5 20.4z"></path></svg>', 3268 angry_svg = '<svg role="img" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path d="M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm0 464c-119.1 0-216-96.9-216-216S128.9 40 248 40s216 96.9 216 216-96.9 216-216 216zm0-136c-31.2 0-60.6 13.8-80.6 37.8-5.7 6.8-4.8 16.9 2 22.5s16.9 4.8 22.5-2c27.9-33.4 84.2-33.4 112.1 0 5.3 6.4 15.4 8 22.5 2 6.8-5.7 7.7-15.8 2-22.5-19.9-24-49.3-37.8-80.5-37.8zm-48-96c0-2.9-.9-5.6-1.7-8.2.6.1 1.1.2 1.7.2 6.9 0 13.2-4.5 15.3-11.4 2.6-8.5-2.2-17.4-10.7-19.9l-80-24c-8.4-2.5-17.4 2.3-19.9 10.7-2.6 8.5 2.2 17.4 10.7 19.9l31 9.3c-6.3 5.8-10.5 14.1-10.5 23.4 0 17.7 14.3 32 32 32s32.1-14.3 32.1-32zm171.4-63.3l-80 24c-8.5 2.5-13.3 11.5-10.7 19.9 2.1 6.9 8.4 11.4 15.3 11.4.6 0 1.1-.2 1.7-.2-.7 2.7-1.7 5.3-1.7 8.2 0 17.7 14.3 32 32 32s32-14.3 32-32c0-9.3-4.1-17.5-10.5-23.4l31-9.3c8.5-2.5 13.3-11.5 10.7-19.9-2.4-8.5-11.4-13.2-19.8-10.7z"></path></svg><span class="cff-svg-bg-dark"><svg class="cff-svg-bg" role="img" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><path d="M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zM136 240c0-9.3 4.1-17.5 10.5-23.4l-31-9.3c-8.5-2.5-13.3-11.5-10.7-19.9 2.5-8.5 11.4-13.2 19.9-10.7l80 24c8.5 2.5 13.3 11.5 10.7 19.9-2.1 6.9-8.4 11.4-15.3 11.4-.5 0-1.1-.2-1.7-.2.7 2.7 1.7 5.3 1.7 8.2 0 17.7-14.3 32-32 32S136 257.7 136 240zm168 154.2c-27.8-33.4-84.2-33.4-112.1 0-13.5 16.3-38.2-4.2-24.6-20.5 20-24 49.4-37.8 80.6-37.8s60.6 13.8 80.6 37.8c13.8 16.5-11.1 36.6-24.5 20.5zm76.6-186.9l-31 9.3c6.3 5.8 10.5 14.1 10.5 23.4 0 17.7-14.3 32-32 32s-32-14.3-32-32c0-2.9.9-5.6 1.7-8.2-.6.1-1.1.2-1.7.2-6.9 0-13.2-4.5-15.3-11.4-2.5-8.5 2.3-17.4 10.7-19.9l80-24c8.4-2.5 17.4 2.3 19.9 10.7 2.5 8.5-2.3 17.4-10.8 19.9z"></path></svg></span>', 3269 like_svg = '<svg role="img" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M496.656 285.683C506.583 272.809 512 256 512 235.468c-.001-37.674-32.073-72.571-72.727-72.571h-70.15c8.72-17.368 20.695-38.911 20.695-69.817C389.819 34.672 366.518 0 306.91 0c-29.995 0-41.126 37.918-46.829 67.228-3.407 17.511-6.626 34.052-16.525 43.951C219.986 134.75 184
3269192 162.382 203.625c-2.189.922-4.986 1.648-8.032 2.223C148.577 197.484 138.931 192 128 192H32c-17.673 0-32 14.327-32 32v256c0 17.673 14.327 32 32 32h96c17.673 0 32-14.327 32-32v-8.74c32.495 0 100.687 40.747 177.455 40.726 5.505.003 37.65.03 41.013 0 59.282.014 92.255-35.887 90.335-89.793 15.127-17.727 22.539-43.337 18.225-67.105 12.456-19.526 15.126-47.07 9.628-69.405zM32 480V224h96v256H32zm424.017-203.648C472 288 472 336 450.41 347.017c13.522 22.76 1.352 53.216-15.015 61.996 8.293 52.54-18.961 70.606-57.212 70.974-3.312.03-37.247 0-40.727 0-72.929 0-134.742-40.727-177.455-40.727V235.625c37.708 0 72.305-67.939 106.183-101.818 30.545-30.545 20.363-81.454 40.727-101.817 50.909 0 50.909 35.517 50.909 61.091 0 42.189-30.545 61.09-30.545 101.817h111.999c22.73 0 40.627 20.364 40.727 40.727.099 20.363-8.001 36.375-23.984 40.727zM104 432c0 13.255-10.745 24-24 24s-24-10.745-24-24 10.745-24 24-24 24 10.745 24 24z"></path></svg>'+'<svg class="cff-svg-bg" role="img" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M104 224H24c-13.255 0-24 10.745-24 24v240c0 13.255 10.745 24 24 24h80c13.255 0 24-10.745 24-24V248c0-13.255-10.745-24-24-24zM64 472c-13.255 0-24-10.745-24-24s10.745-24 24-24 24 10.745 24 24-10.745 24-24 24zM384 81.452c0 42.416-25.97 66.208-33.277 94.548h101.723c33.397 0 59.397 27.746 59.553 58.098.084 17.938-7.546 37.249-19.439 49.197l-.11.11c9.836 23.337 8.237 56.037-9.308 79.469 8.681 25.895-.069 57.704-16.382 74.757 4.298 17.598 2.244 32.575-6.148 44.632C440.202 511.587 389.616 512 346.839 512l-2.845-.001c-48.287-.017-87.806-17.598-119.56-31.725-15.957-7.099-36.821-15.887-52.651-16.178-6.54-.12-11.783-5.457-11.783-11.998v-213.77c0-3.2 1.282-6.271 3.558-8.521 39.614-39.144 56.648-80.587 89.117-113.111 14.804-14.832 20.188-37.236 25.393-58.902C282.515 39.293 291.817 0 312 0c24 0 72 8 72 81.452z"></path></svg>', 3270 like_svg_2 = '<svg role="img" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M466.27 286.69C475.04 271.84 480 256 480 236.85c0-44.015-37.218-85.58-85.82-85.58H357.7c4.92-12.81 8.85-28.13 8.85-46.54C366.55 31.936 328.86 0 271.28 0c-61.607 0-58.093 94.933-71.76 108.6-22.747 22.747-49.615 66.447-68.76 83.4H32c-17.673 0-32 14.327-32 32v240c0 17.673 14.327 32 32 32h64c14.893 0 27.408-10.174 30.978-23.95 44.509 1.001 75.06 39.94 177.802 39.94 7.22 0 15.22.01 22.22.01 77.117 0 111.986-39.423 112.94-95.33 13.319-18.425 20.299-43.122 17.34-66.99 9.854-18.452 13.664-40.343 8.99-62.99zm-61.75 53.83c12.56 21.13 1.26 49.41-13.94 57.57 7.7 48.78-17.608 65.9-53.12 65.9h-37.82c-71.639 0-118.029-37.82-171.64-37.82V240h10.92c28.36 0 67.98-70.89 94.54-97.46 28.36-28.36 18.91-75.63 37.82-94.54 47.27 0 47.27 32.98 47.27 56.73 0 39.17-28.36 56.72-28.36 94.54h103.99c21.11 0 37.73 18.91 37.82 37.82.09 18.9-12.82 37.81-22.27 37.81 13.489 14.555 16.371 45.236-5.21 65.62zM88 432c0 13.255-10.745 24-24 24s-24-10.745-24-24 10.745-24 24-24 24 10.745 24 24z"></path></svg>'; 3271 3272 3273 //Add first reaction 3274 var reaction_one_html = ''; 3275 if( reaction_first_num > 0 ){ 3276 if(data.love.summary.total_count == reaction_first_num){ 3277 reaction_one_html += '<span class="cff-love cff-reaction-one cff-icon">'+love_svg+'</span>'; 3278 love_added = true; 3279 } 3280 if(data.haha.summary.total_count == reaction_first_num){ 3281 reaction_one_html += '<span class="cff-haha cff-reaction-one cff-icon">'+haha_svg+'</span>'; 3282 haha_added = true; 3283 } 3284 if(data.wow.summary.total_count == reaction_first_num){ 3285 reaction_one_html += '<span class="cff-wow cff-reaction-one cff-icon">'+wow_svg+'</span>'; 3286 wow_added = true; 3287 } 3288 if(data.sad.summary.total_count == reaction_first_num){ 3289 reaction_one_html += '<span class="cff-sad cff-reaction-one cff-icon">'+sad_svg+'</span>'; 3290 sad_added = true; 3291 } 3292 if(data.angry.summary.total_count == reaction_first_num){ 3293 reaction_one_html += '<span class="cff-angry cff-reaction-one cff-icon">'+angry_svg+'</span>'; 3294 angry_added = true; 3295 } 3296 reactions_html += reaction_one_html; 3297 } 3298 3299 //If reaction one doesn't already contain two reactions (eg: if the two reaction_one
3299s are the same number) then don't include a reaction_two 3300 if( reaction_one_html.split('cff-reaction-one').length < 3 ){ 3301 //Add second reaction 3302 if( reaction_second_num > 0 ){ 3303 var reaction_two_html = ''; 3304 3305 if(data.love.summary.total_count == reaction_second_num && !love_added){ 3306 reaction_two_html = '<span class="cff-love cff-reaction-two cff-icon">'+love_svg+'</span>'; 3307 } 3308 if(data.haha.summary.total_count == reaction_second_num && !haha_added){ 3309 reaction_two_html = '<span class="cff-haha cff-reaction-two cff-icon">'+haha_svg+'</span>'; 3310 } 3311 if(data.wow.summary.total_count == reaction_second_num && !wow_added){ 3312 reaction_two_html = '<span class="cff-wow cff-reaction-two cff-icon">'+wow_svg+'</span>'; 3313 } 3314 if(data.sad.summary.total_count == reaction_second_num && !sad_added){ 3315 reaction_two_html = '<span class="cff-sad cff-reaction-two cff-icon">'+sad_svg+'</span>'; 3316 } 3317 if(data.angry.summary.total_count == reaction_second_num && !angry_added){ 3318 reaction_two_html = '<span class="cff-angry cff-reaction-two cff-icon">'+angry_svg+'</span>'; 3319 } 3320 reactions_html += reaction_two_html; 3321 } 3322 } 3323 3324 //Add the reaction icons 3325 if( $self.find('.cff-meta .cff-likes').find('.cff-icon').length < 2 ) $self.find('.cff-meta .cff-likes .cff-icon').after( reactions_html ); 3326 3327 //If there's no likes but there's a reacton then don't show the like icon - show the reaction icon instead 3328 if( parseInt(like_count) == 0 && ( parseInt(cff_love_count) > 0 || parseInt(cff_haha_count) > 0 || parseInt(cff_wow_count) > 0 || parseInt(cff_sad_count) > 0 || parseInt(cff_angry_count) > 0 ) ){ 3329 $self.find('.cff-meta .cff-likes .cff-like').remove(); 3330 $self.find('.cff-meta .cff-likes span').addClass('cff-no-animate'); 3331 } 3332 3333 //Add reactions to like count 3334 var cff_reactions_count = parseInt(like_count) + parseInt(cff_love_count) + parseInt(cff_haha_count) + parseInt(cff_wow_count) + parseInt(cff_sad_count) + parseInt(cff_angry_count); 3335 if( cff_reactions_count > 0 ) $self.find('.cff-meta .cff-likes .cff-count').text( cff_reactions_count ); 3336 3337 3338 //ADDS REACTIONS TO COMMENTS BOX 3339 var cff_no_reactions = false; 3340 if( cff_love_count == 0 && cff_haha_count == 0 && cff_wow_count == 0 && cff_sad_count == 0 && cff_angry_count == 0 ) cff_no_reactions = true; 3341 3342 var reactions_count_html = '<span class="cff-reactions-count">'; 3343 3344 if( parseInt(like_count) > 0){ 3345 reactions_count_html += '<span class="cff-like cff-icon">'+like_svg+'</span>'; 3346 3347 if( !cff_no_reactions ){ 3348 if( parseInt(like_count) > 0 ) reactions_count_html += '<span class="cff-like-count">
3348'+like_count+'</span>'; 3349 if( cff_love_count > 0 ) reactions_count_html += '<span class="cff-reaction-wrap"><span class="cff-love cff-icon">'+love_svg+'</span><span class="cff-love-count">'+cff_love_count+'</span></span>'; 3350 if( cff_haha_count > 0 ) reactions_count_html += '<span class="cff-reaction-wrap"><span class="cff-haha cff-icon">'+haha_svg+'</span><span class="cff-haha-count">'+cff_haha_count+'</span></span>'; 3351 if( cff_wow_count > 0 ) reactions_count_html += '<span class="cff-reaction-wrap"><span class="cff-wow cff-icon">'+wow_svg+'</span><span class="cff-wow-count">'+cff_wow_count+'</span></span>'; 3352 if( cff_sad_count > 0 ) reactions_count_html += '<span class="cff-reaction-wrap"><span class="cff-sad cff-icon">'+sad_svg+'</span><span class="cff-sad-count">'+cff_sad_count+'</span></span>'; 3353 if( cff_angry_count > 0 ) reactions_count_html += '<span class="cff-reaction-wrap"><span class="cff-angry cff-icon">'+angry_svg+'</span><span class="cff-angry-count">'+cff_angry_count+'</span></span>'; 3354 } 3355 } 3356 reactions_count_html += '</span>'; 3357 3358 //CREATE LIKES PART AT TOP OF COMMENTS BOX 3359 if( typeof data.likes !== 'undefined' ){ 3360 if( data.likes.data.length ){ 3361 3362 cff_likes_this += '<span class="cff-likes-this-text">'; 3363 3364 var liker_one = '', 3365 liker_two = ''; 3366 3367 if ( like_count > 0 && typeof data.likes.data[0] !== 'undefined' ){ 3368 3369 //Only link the name if a legit link is available for this user 3370 var userHasLink = false; 3371 if( typeof data.likes.data[0].link !== 'undefined' ){ 3372 if( data.likes.data[0].link.indexOf('/app_scoped_user_id/') == -1 ) userHasLink = true; 3373 } 3374 3375 //Creat link or span 3376 userHasLink ? liker_one += '<a href="'+data.likes.data[0].link+'" target="_blank" rel="nofollow noopener" class="cff-liker-one-name" style="color:'+cff_meta_link_color+';' : liker_one = '<span class="cff-liker-one-name" style="'; 3377 if (cff_no_reactions) liker_one += ' margin-left: 5px'; 3378 liker_one += '">'+data.likes.data[0].name; 3379 3380 userHasLink ? liker_one += '</a>' : liker_one += '</span>'; 3381 } 3382 3383 if ( like_count > 1 && typeof data.likes.data[1] !== 'undefined' ){ 3384 3385 //Only link the name if a legit link is available for this user 3386 var userHasLink = false; 3387 if( typeof data.likes.data[1].link !== 'undefined' ){ 3388 if( data.likes.data[1].link.indexOf('/app_scoped_user_id/') == -1 ) userHasLink = true; 3389 } 3390 3391 //Creat link or span 3392 userHasLink ? liker_two += '<a href="'+data.likes.data[1].link+'" target="_blank" rel="nofollow noopener" style="color:'+cff_meta_link_color+'">' : liker_two = '<span>'; 3393 liker_two += data.likes.data[1].name; 3394 3395 userHasLink ? liker_two += '</a>' : liker_two += '</span>'; 3396 } 3397 3398 if (like_count == 1){ 3399 cff_likes_this += liker_one+' '+cff_translate_likes_this_text; 3400 } else if (like_count == 2){ 3401 cff_likes_this += liker_one+' '+cff_translate_and_text+' '+liker_two+' '+cff_translate_like_this_text; 3402 } else if (like_count == 3){ 3403 cff_likes_this += liker_one+', '+liker_two+' '+cff_translate_and_text+' 1 '+cff_translate_other_text+' '+cff_translate_like_this_text; 3404 } else { 3405 cff_likes_this += liker_one+', '+liker_two+' '+cff_translate_and_text+' '; 3406 if (like_count == 25) cff_likes_this += '<span class="cff-comment-likes-count">'; 3407 cff_likes_this += parseInt(cff_reactions_count)-2; 3408 if (like_count == 25) cff_likes_this += '</span>'; 3409 cff_likes_this += ' '+cff_translate_others_text; 3410 3411 if( parseInt(cff_reactions_count) == parseInt(like_count) ){ 3412 cff_likes_this += ' '+cff_translate_like_this_text; 3413 } else { 3414 cff_likes_this += ' '+cff_translate_reacted_to_this_text; 3415 } 3416 3417 } 3418 3419 cff_likes_this += '</span>'; 3420 3421 if( $cffCommentLikes.find('.cff-reactions-count').length < 1 ) $cffCommentLikes.append('<span class="cff-likes-info-wrap">' + reactions_count_html + cff_likes_this + '</span>'); 3422 3423 } else { 3424 //If there's no likes data then hide the top of the comments box that shows the "likes this" section 3425 if( cff_no_reactions ){ 3426 $cffCommentLikes.hide(); 3427 } else { 3428 if( $cffCommentLikes.find('.cff-reactions-count').length < 1 ) $cffCommentLikes.append('<span class="cff-likes-info-wrap">' + reactions_count_html + '</span>'); 3429 } 3430 } 3431 3432 } 3433 3434 3435 if( typeof data.comments !== 'undefined' ){ 3436 $.each(data.comments.data, function(i, commentItem) { 3437 var consentGiven = (typeof window.cff !== 'undefined' && typeof window.cff.feeds !== 'undefined') ? window.cff.feeds[0].settings.consentGiven : true; 3438 3439 //Do a final encode of the comment message 3440 var comment_message = cffEncodeHTML(commentItem.message), 3441 comment_message = cffLinkify(comment_message), 3442 cff_comment_author_info = true, 3443 cff_hide_comment_avatars = Boolean($self.find('.cff-comments-box').attr('data-cff-hide-avatars')); 3444 3445 //Check whether comment author info exists - only accessible with page access token from the page now 3446 if( typeof commentItem.from !== 'undefined' ){ 3447 cff_comment_from_id = commentItem.from.id; 3448 } else { 3449 cff_hide_comment_avatars = true; 3450 cff_comment_author_info = false; 3451 cff_comment_from_id = ''; 3452 } 3453 3454 cff_comments += '<div class="cff-comment" id="cff_'+commentItem.id+'" data-id="'+cff_comment_from_id+'"'; 3455 cff_comments += ' style="'; 3456 ( i >= commentShow ) ? cff_comments += 'display: none;' : cff_comments += 'display: block;'; 3457 if( typeof $self.find('#cff_'+commentItem.id).attr('style') !== 'undefined' ) cff_comments += $self.find('#cff_'+commentItem.id).attr('style'); 3458 cff_comments += '"'; 3459 if( typeof commentItem.from !== 'undefined' ){ 3460 if( typeof commentItem.from.picture !== 'undefined' ){ 3461 cff_comments += 'data-avatar="'+commentItem.from.picture.data.url+'"'; 3462 } 3463 } 3464 cff_comments += '>'; 3465 cff_comments += '<div class="cff-comment-text-wrapper">'; 3466 cff_comments += '<div class="cff-comment-text'; 3467 if( cff_hide_comment_avatars ) cff_comments += ' cff-no-image'; 3468 cff_comments += '"><p>'; 3469 if( cff_comment_author_info ){ 3470 if( typeof commentItem.from.link !== 'undefined' ){ 3471 cff_comments += '<a href="'+commentItem.from.link+'" class="cff-name" target="_blank" rel="nofollow noopener" style="color:' + cff_meta_link_color + '">
3471'+commentItem.from.name+'</a>'; 3472 } else { 3473 cff_comments += '<span class="cff-name">'+commentItem.from.name+'</span>'; 3474 } 3475 } 3476 3477 //MESSAGE TAGS 3478 if( cff_post_tags && commentItem.hasOwnProperty('message_tags') ){ 3479 3480 //Loop through the tags and use the name to replace them 3481 $.each(commentItem.message_tags, function(i, message_tag) { 3482 tag_name = message_tag.name; 3483 tag_link = '<a href="http://facebook.com/'+message_tag.id+'" target="_blank" rel="nofollow noopener" style="color:'+cff_meta_link_color+'">'+message_tag.name+'</a>'; 3484 3485 comment_message = comment_message.replace(tag_name, tag_link); 3486 }); 3487 3488 } //END MESSAGE TAGS 3489 3490 cff_comments += comment_message+'</p>'; 3491 3492 3493 //Add image attachment if exists 3494 if( commentItem.hasOwnProperty('attachment') ){ 3495 if( commentItem.attachment.hasOwnProperty('media') ){ 3496 if (consentGiven) { 3497 cff_comments += '<a class="cff-comment-attachment" href="https://facebook.com/'+commentItem.id+'" target="_blank" rel="nofollow noopener"><img src="'+commentItem.attachment.media.image.src+'" alt="'; 3498 } else { 3499 cff_comments += '<a class="cff-comment-attachment" href="https://facebook.com/'+commentItem.id+'" target="_blank" rel="nofollow noopener"><span class="cff-comment-image-placeholder" data-src="'+commentItem.attachment.media.image.src+'"></span>'; 3500 } 3501 3502 if (consentGiven) { 3503 if( commentItem.attachment.hasOwnProperty('title') ){ 3504 cff_comments += commentItem.attachment.title; 3505 } else { 3506 cff_comments += 'Attachment'; 3507 } 3508 cff_comments += '" /></a>'; 3509 } else { 3510 cff_comments += '</a>'; 3511 3512 } 3513 3514 } 3515 } 3516 3517 cff_comments += '<span class="cff-time">'; 3518 var cff_middot = '', 3519 cff_comment_time = $self.find('#cff_'+commentItem.id).attr('data-cff-comment-date'); 3520 //If the time is undefined then don't show it 3521 if( typeof cff_comment_time !== 'undefined' ){ 3522 cff_comments += '<span class="cff-comment-date">'+cff_comment_time+'</span>'; 3523 cff_middot = ' · '; 3524 } 3525 if ( commentItem.like_count > 0 ) cff_comments += '<span class="cff-comment-likes"><span class="cff-comment-likes-bg"><b>'+like_svg_2+'</b>
3525'+commentItem.like_count+'</span></span>'; 3526 cff_comments += '</span>'; 3527 3528 //Comment replies 3529 var cff_comment_count = parseInt(commentItem.comment_count); 3530 if( cff_comment_count > 0 ){ 3531 //Get this from a data attr on the comments box container 3532 var cff_replies_text_string = ''; 3533 (cff_comment_count == 1) ? cff_replies_text_string = cff_translate_reply_text : cff_replies_text_string = cff_translate_replies_text; 3534 cff_comments += '<p class="cff-comment-replies" data-id="'+commentItem.id+'"><a class="cff-comment-replies-a" href="javascript:void(0);" style="color:' + cff_meta_link_color + '"><span class="cff-replies-icon"></span>'+cff_comment_count+' '+cff_replies_text_string+'</a></p><div class="cff-comment-replies-box cff-empty"></div>'; 3535 } 3536 3537 cff_comments += '</div>'; //End .cff-comment-text 3538 cff_comments += '</div>'; //End .cff-comment-text-wrapper 3539 3540 //Only load the comment avatars if they're being displayed initially, otherwise load via JS on click to save all the HTTP requests on page load 3541 if( !cff_hide_comment_avatars && cff_comment_author_info ){ 3542 cff_comments += '<div class="cff-comment-img cff-avatar-fallback">'; 3543 if( typeof commentItem.from.link !== 'undefined' ) cff_comments += '<a href="https://facebook.com/'+commentItem.from.link+'" target="_blank" rel="noopener">'; 3544 if( cff_expand_comments && (i < commentShow) ) { 3545 if (consentGiven) { 3546 cff_comments += '<img src="'+commentItem.from.picture.data.url+'" width=32 height=32 alt="'+commentItem.from.name+'" onerror="this.style.display=\'none\'">'; 3547 } else { 3548 cff_comments += '<span class="cff-comment-avatar-placeholder" data-src="'+commentItem.from.picture.data.url+'">'; 3549 } 3550 } else { 3551 cff_comments += '<span class="cff-comment-avatar"></span>'; 3552 } 3553 if( typeof commentItem.from.link !== 'undefined' ) cff_comments += '</a>'; 3554 cff_comments += '</div>'; 3555 } 3556 3557 cff_comments += '</div>'; //End .cff-comment 3558 3559 }); //End data.comments.data loop 3560 3561 } //End if 3562 3563 //Remove the comments added for SEO in PHP 3564 $self.find('.cff-comments-wrap .cff-comment').remove(); 3565 //Add the comments to the page 3566 $self.find('.cff-comments-wrap').prepend( cff_comments ); 3567 $self.find('.cff-show-more-comments').attr('data-cff-comments-total', cff_total_comments_count); 3568 3569 //Add border radius 3570 if( $self.find('.cff-comment-likes span').length > 0 ) $self.find('.cff-comment-on-facebook').css({'border-top-left-radius':"0",'border-top-right-radius':"0"}); 3571 if( $self.find('.cff-comments-wrap .cff-comment').length > 0 ) $self.find('.cff-comment-on-facebook').css({'border-bottom-left-radius':"0",'border-bottom-right-radius':"0"}); 3572 //Add a little more padding if there's no comments 3573 if( $self.find('.cff-comments-wrap .cff-comment').length < 1 ) $self.find('.cff-comment-on-facebook').css('padding','8px 15px 8px 10px'); 3574 3575 setTimeout(function(){ 3576 if( $self.closest('.cff').hasClass('cff-masonry-js') && !$self.closest('.cff').hasClass('cff-masonry-css') ) cffAddMasonry( $self.closest('.cff') ); 3577 }, 200); 3578 3579 } //End cffCreateComments() 3580 3581 3582 //Check if any lazy loading plugins have changed the image src 3583 function cff_lazy_load_correction(){ 3584 3585 var $ = jQuery; 3586 3587 // The lightbox link needs to be reset to the original source 3588 $('.cff-lightbox-link').each(function(){ 3589 var $lbLink = $(this); 3590 3591 if( $lbLink.closest('.cff-album-item').attr('data-cff-full-size') ){ 3592 lborigSrc = $lbLink.attr('data-cff-full-size'); 3593 } else { 3594 lborigSrc = $lbLink.parent().find('img').attr('data-orig-source'); 3595 } 3596 $lbLink.attr('href', lborigSrc); 3597 }) 3598 3599 // Check if lazy load placeholder image is being used 3600 $('img[data-orig-source]').each(function(){ 3601 var $self = $(this), 3602 currentSrc = $self.attr('src'), 3603 originalSrc = $self.attr('data-orig-source'); 3604 3605 // Check if the img source has been changed by lazy loading 3606 if(originalSrc != currentSrc){ 3607 $self.attr('src', originalSrc); 3608 } 3609 3610 // Timeline album posts need the background source reset 3611 if($self.hasClass('cff-multi-image')){ 3612 $self.css('background-image', 'url(' + originalSrc + ')'); 3613 } 3614 }); 3615 3616 // Need to set a default value for the link slider in shared links otherwise it gets a 1px width 3617 $('.cff-link-slider').each(function(){ 3618 $(this).find('.cff-link-slider-slides').css('width', '2500px') 3619 }); 3620 } 3621 3622 if (typeof window.cff === 'undefined' || typeof window.cff.feeds === 'undefined') { 3623 if (!$cff.find('.cff_resized_image_data').length) { 3624 cff_lazy_load_correction(); 3625 } 3626 } else if (typeof window.cff.feeds[0] !== 'undefined') { 3627 if (!window.cff.feeds[0].settings.resizingEnabled) { 3628 cff_lazy_load_correction(); 3629 } 3630 } 3631 3632 //Create shared link multi-image slider 3633 setTimeout(function(){ 3634 3635 $cff.find('.cff-link-slider').each(function(){ 3636 3637 var $cffLinkSlider = $(this), 3638 $cffLinkSliderSlides = $cffLinkSlider.find('.cff-link-slider-slides'), 3639 $cffLinkSliderItem = $cffLinkSliderSlides.find('.cff-link-slider-item'), 3640 cffLinkSliderCount = $cffLinkSliderItem.length, 3641 cffLinkSliderWidth = $cffLinkSlider.width(), 3642 cffCurSlide = 0; 3643 $cffLinkSliderSlides.css({ width: cffLinkSliderWidth * cffLinkSliderCount }); 3644 $cffLinkSliderItem.css({ width: cffLinkSliderWidth }); 3645 3646 function cffMoveSlide(dir) { 3647 //Change slides 3648 dir == 'prev' ? cffCurSlide-- : cffCurSlide++; 3649 $cffLinkSliderSlides.css('left', -cffCurSlide*cffLinkSliderWidth);
3650 3651 //Hide the nav arrows at beginning/end 3652 cffCurSlide == cffLinkSliderCount-1 ? $cffLinkSlider.find('a.cff-slider-next').hide() : $cffLinkSlider.find('a.cff-slider-next').show(); 3653 cffCurSlide > 0 ? $cffLinkSlider.find('a.cff-slider-prev').show() : $cffLinkSlider.find('a.cff-slider-prev').hide(); 3654 }; 3655 //Nav arrows click 3656 $cffLinkSlider.find('a.cff-slider-prev, a.cff-slider-next').on('click', function(e){ 3657 e.preventDefault(); 3658 $(this).hasClass('cff-slider-prev') ? cffMoveSlide('prev') : cffMoveSlide('next'); 3659 }); 3660 //Vertically center last image in slider 3661 setTimeout(function(){ 3662 var cffLastSlideHeight = $cffLinkSliderSlides.find('.cff-link-slider-item').first().height(); 3663 $cffLinkSliderSlides.find('.cff-final-item').css('height', cffLastSlideHeight).find('img').css('margin-top', (cffLastSlideHeight/2)-100 ); 3664 }, 1500); 3665 3666 //Show all slides (initially hidden in CSS) 3667 $cffLinkSliderSlides.find('.cff-link-slider-item').show(); 3668 3669 }); 3670 3671 }, 200); 3672 3673 3674 })(jQuery); //End (function($){ 3675 3676 /*! 3677 imgLiquid v0.9.944 / 03-05-2013 3678 https://github.com/karacas/imgLiquid 3679 */ 3680 3681 var imgLiquid = imgLiquid || {VER: '0.9.944'}; 3682 imgLiquid.bgs_Available = false; 3683 imgLiquid.bgs_CheckRunned = false; 3684 //Add the CSS using CSS as then it's only used when the JS file runs, otherwise with Ajax themes it's hiding the images but then the JS isn't running. This way still allows the images to display even if the JS doesn't run. 3685 jQuery('.cff').each(function() { 3686 if (!jQuery(this).hasClass('cff-disable-liquid')) { 3687 $cff.find('.cff-new .cff-album-cover img').css('visibility', 'hidden'); 3688 } 3689 }); 3690 $cff.find('.cff-new .cff-crop img').css('visibility', 'hidden'); 3691 jQuery('#cff .cff-img-attachments .cff-crop img').css('opacity', 0); 3692 3693 3694 (function ($) { 3695 3696 // ___________________________________________________________________ 3697 3698 function checkBgsIsavailable() { 3699 if (imgLiquid.bgs_CheckRunned) return; 3700 else imgLiquid.bgs_CheckRunned = true; 3701 3702 var spanBgs = $('<span style="background-size:cover" />'); 3703 $('body').append(spanBgs); 3704 3705 !function () { 3706 var bgs_Check = spanBgs[0]; 3707 if (!bgs_Check || !window.getComputedStyle) return; 3708 var compStyle = window.getComputedStyle(bgs_Check, null); 3709 if (!compStyle || !compStyle.backgroundSize) return; 3710 imgLiquid.bgs_Available = (compStyle.backgroundSize === 'cover'); 3711 }(); 3712 3713 spanBgs.remove(); 3714 } 3715 3716 3717 // ___________________________________________________________________ 3718 3719 $.fn.extend({ 3720 imgLiquid: function (options) { 3721 3722 this.defaults = { 3723 fill: true, 3724 verticalAlign: 'center', // 'top' // 'bottom' // '50%' // '10%' 3725 horizontalAlign: 'center', // 'left' // 'right' // '50%' // '10%' 3726 useBackgroundSize: false, 3727 useDataHtmlAttr: true, 3728 3729 responsive: true, /* Only for use with BackgroundSize false (or old browsers) */ 3730 delay: false, /* Only for use with BackgroundSize false (or old browsers) */ 3731 fadeInTime: false, /* Only for use with BackgroundSize false (or old browsers) */ 3732 removeBoxBackground: false, /* Only for use with Backgroun
3732dSize false (or old browsers) */ 3733 hardPixels: true, /* Only for use with BackgroundSize false (or old browsers) */ 3734 responsiveCheckTime: 500, /* Only for use with BackgroundSize false (or old browsers) */ /* time to check div resize */ 3735 timecheckvisibility: 500, /* Only for use with BackgroundSize false (or old browsers) */ /* time to recheck if visible/loaded */ 3736 3737 // CALLBACKS 3738 onStart: null, // no-params 3739 onFinish: null, // no-params 3740 onItemStart: null, // params: (index, container, img ) 3741 onItemFinish: function(index, container, img){ // params: (index, container, img ) 3742 img.addClass('cffFadeIn'); 3743 }, 3744 onItemError: null // params: (index, container, img ) 3745 }; 3746 3747 checkBgsIsavailable(); 3748 var imgLiquidRoot = this; 3749 3750 // Extend global settings 3751 this.options = options; 3752 this.settings = $.extend({}, this.defaults, this.options); 3753 3754 // CallBack 3755 if (this.settings.onStart) this.settings.onStart(); 3756 3757 3758 // ___________________________________________________________________ 3759 3760 return this.each(function ($i) { 3761 3762 // MAIN >> each for image 3763 3764 var settings = imgLiquidRoot.settings, 3765 $imgBoxCont = $(this), 3766 $img = $('img:first',$imgBoxCont); 3767 if (!$img.length) {onError(); return;} 3768 3769 3770 // Extend settings 3771 if (!$img.data('imgLiquid_settings')) { 3772 // First time 3773 settings = $.extend({}, imgLiquidRoot.settings, getSettingsOverwrite()); 3774 } else { 3775 // Recall 3776 // Remove Classes 3777 $imgBoxCont.removeClass('imgLiquid_error').removeClass('imgLiquid_ready'); 3778 settings = $.extend({}, $img.data('imgLiquid_settings'), imgLiquidRoot.options); 3779 } 3780 $img.data('imgLiquid_settings', settings); 3781 3782 3783 // Start CallBack 3784 if (settings.onItemStart) settings.onItemStart($i, $imgBoxCont, $img); /* << CallBack */ 3785 3786 3787 // Process 3788 if (imgLiquid.bgs_Available && settings.useBackgroundSize) 3789 processBgSize(); 3790 else 3791 processOldMethod(); 3792 3793 3794 // END MAIN << 3795 3796 // ___________________________________________________________________ 3797 3798 function processBgSize() { 3799 3800 // Check change img src 3801 if ($imgBoxCont.css('background-image').indexOf(encodeURI($img.attr('src'))) === -1) { 3802 // Change 3803 $imgBoxCont.css({'background-image': 'url("' + encodeURI($img.attr('src')) + '")'}); 3804 } 3805 3806 $imgBoxCont.css({ 3807 'background-size': (settings.fill) ? 'cover' : 'contain', 3808 'background-position': (settings.horizontalAlign + ' ' + settings.verticalAlign).toLowerCase(), 3809 'background-repeat': 'no-repeat' 3810 }); 3811 3812 $('a:first', $imgBoxCont).css({ 3813 'display': 'block', 3814 'width': '100%', 3815 'height': '100%' 3816 }); 3817 3818 $('img', $imgBoxCont).css({'display': 'none'}); 3819 3820 if (settings.onItemFinish) settings.onItemFinish($i, $imgBoxCont, $img); /* << CallBack */ 3821 3822 $imgBoxCont.addClass('imgLiquid_bgSize'); 3823 $imgBoxCont.addClass('imgLiquid_ready'); 3824 checkFinish(); 3825 } 3826 3827 // ___________________________________________________________________ 3828 3829 function processOldMethod() { 3830 3831 // Check change img src 3832 if ($img.data('oldSrc') && $img.data('oldSrc') !== $img.attr('src')) { 3833 3834 /* Clone & Reset img */ 3835 var $imgCopy = $img.clone().removeAttr('style'); 3836 $imgCopy.data('imgLiquid_settings', $img.data('imgLiquid_settings')); 3837 $img.parent().prepend($imgCopy); 3838 $img.remove(); 3839 $img = $imgCopy; 3840 $img[0].width = 0; 3841 3842 // Bug ie with > if (!$img[0].complete && $img[0].width) onError(); 3843 setTimeout(processOldMethod, 10); 3844 return; 3845 } 3846 3847 3848 // Reproceess? 3849 if ($img.data('imgLiquid_oldProcessed')) { 3850 makeOldProcess(); return; 3851 } 3852 3853 3854 // Set data 3855 $img.data('imgLiquid_oldProcessed', false); 3856 $img.data('oldSrc', $img.attr('src')); 3857 3858 3859 // Hide others images 3860 $('img:not(:first)', $imgBoxCont).css('display', 'none'); 3861 3862 3863 // CSSs 3864 $imgBoxCont.css({'overflow': 'hidden'}); 3865 $img.fadeTo(0, 0).removeAttr('width').removeAttr('height').css({ 3866 'visibility': 'visible', 3867 'max-width': 'none', 3868 'max-height': 'none', 3869 'width': 'auto', 3870 'height': 'auto', 3871 'display': 'block' 3872 }); 3873 3874 3875 // CheckErrors 3876 $img.on('error', onError); 3877 $img[0].onerror = onError; 3878 3879 3880 // loop until load 3881 function onLoad() { 3882 if ($img.data('imgLiquid_error') || $img.data('imgLiquid_loaded') || $img.data('imgLiquid_oldProcessed')) return; 3883 if ($imgBoxCont.is(':visible') && $img[0].complete && $img[0].width > 0 && $img[0].height > 0) { 3884 $img.data('imgLiquid_loaded', true); 3885 setTimeout(makeOldProcess, $i * settings.delay); 3886 } else { 3887 setTimeout(onLoad, settings.timecheckvisibility); 3888 } 3889 } 3890 3891 3892 onLoad(); 3893 checkResponsive(); 3894 } 3895 3896 // ___________________________________________________________________ 3897 3898 function checkResponsive() { 3899 3900 /* Only for oldProcessed method (background-size dont need) */ 3901 3902 if (!settings.responsive && !$img.data('imgLiquid_oldProcessed')) return; 3903 if (!$img.data('imgLiquid_settings')) return; 3904 3905 settings = $img.data('imgLiquid_settings'); 3906 3907 $imgBoxCont.actualSize = $imgBoxCont.get(0).offsetWidth + ($imgBoxCont.get(0).offsetHeight / 10000); 3908 if ($imgBoxCont.sizeOld && $imgBoxCont.actualSize !== $imgBoxCont.sizeOld) makeOldProcess(); 3909 3910 $imgBoxCont.sizeOld = $imgBoxCont.actualSize; 3911 setTimeout(checkResponsive, settings.responsiveCheckTime); 3912 } 3913 3914 // ___________________________________________________________________ 3915 3916 function onError() { 3917 $img.data('imgLiquid_error', true); 3918 $imgBoxCont.addClass('imgLiquid_error'); 3919 if (settings.onItemError) settings.onItemError($i, $imgBoxCont, $img); /* << CallBack */ 3920 checkFinish(); 3921 } 3922 3923 // ___________________________________________________________________ 3924 3925 function getSettingsOverwrite() { 3926 var SettingsOverwrite = {}; 3927 3928 if (imgLiquidRoot.settings.useDataHtmlAttr) { 3929 var dif = $imgBoxCont.attr('data-imgLiquid-fill'), 3930 ha = $imgBoxCont.attr('data-imgLiquid-horizontalAlign'), 3931 va = $imgBoxCont.attr('data-imgLiquid-verticalAlign'); 3932 3933 if (dif === 'true' || dif === 'false') SettingsOverwrite.fill = Boolean (dif === 'true'); 3934 if (ha !== undefined && (ha === 'left' || ha === 'center' || ha === 'right' || ha.indexOf('%') !== -1)) SettingsOverwrite.horizontalAlign = ha; 3935 if (va !== undefined && (va === 'top' || va === 'bottom' || va === 'center' || va.indexOf('%') !== -1)) SettingsOverwrite.verticalAlign = va; 3936 } 3937 3938 if (imgLiquid.isIE && imgLiquidRoot.settings.ieFadeInDisabled) SettingsOverwrite.fadeInTime = 0; //ie no anims 3939 return SettingsOverwrite; 3940 } 3941 3942 // ___________________________________________________________________ 3943 3944 function makeOldProcess() { /* Only for old browsers, or useBackgroun
3944dSize seted false */ 3945 3946 // Calculate size 3947 var w, h, wn, hn, ha, va, hdif, vdif, 3948 margT = 0, 3949 margL = 0, 3950 $imgCW = $imgBoxCont.width(), 3951 $imgCH = $imgBoxCont.height(); 3952 3953 3954 // Save original sizes 3955 if ($img.data('owidth') === undefined) $img.data('owidth', $img[0].width); 3956 if ($img.data('oheight') === undefined) $img.data('oheight', $img[0].height); 3957 3958 3959 // Compare ratio 3960 if (settings.fill === ($imgCW / $imgCH) >= ($img.data('owidth') / $img.data('oheight'))) { 3961 w = '100%'; 3962 h = 'auto'; 3963 wn = Math.floor($imgCW); 3964 hn = Math.floor($imgCW * ($img.data('oheight') / $img.data('owidth'))); 3965 } else { 3966 w = 'auto'; 3967 h = '100%'; 3968 wn = Math.floor($imgCH * ($img.data('owidth') / $img.data('oheight'))); 3969 hn = Math.floor($imgCH); 3970 } 3971 3972 // Align X 3973 ha = settings.horizontalAlign.toLowerCase(); 3974 hdif = $imgCW - wn; 3975 if (ha === 'left') margL = 0; 3976 if (ha === 'center') margL = hdif * 0.5; 3977 if (ha === 'right') margL = hdif; 3978 if (ha.indexOf('%') !== -1){ 3979 ha = parseInt (ha.replace('%',''), 10); 3980 if (ha > 0) margL = hdif * ha * 0.01; 3981 } 3982 3983 3984 // Align Y 3985 va = settings.verticalAlign.toLowerCase(); 3986 vdif = $imgCH - hn; 3987 if (va === 'left') margT = 0; 3988 if (va === 'center') margT = vdif * 0.5; 3989 if (va === 'bottom') margT = vdif; 3990 if (va.indexOf('%') !== -1){ 3991 va = parseInt (va.replace('%',''), 10); 3992 if (va > 0) margT = vdif * va * 0.01; 3993 } 3994 3995 3996 // Add Css 3997 if (settings.hardPixels) {w = wn; h = hn;} 3998 $img.css({ 3999 'width': w, 4000 'height': h, 4001 'margin-left': Math.floor(margL), 4002 'margin-top': Math.floor(margT) 4003 }); 4004 4005 4006 // FadeIn > Only first time 4007 if (!$img.data('imgLiquid_oldProcessed')) { 4008 $img.fadeTo(settings.fadeInTime, 1); 4009 $img.data('imgLiquid_oldProcessed', true); 4010 // if (settings.removeBoxBackground) $imgBoxCont.css('background-image', 'none'); 4011 var sourceImage = $img.attr('src'); 4012 $imgBoxCont.css({'background-image': 'url(' + sourceImage + ')'}); 4013 $imgBoxCont.addClass('imgLiquid_nobgSize'); 4014 $imgBoxCont.addClass('imgLiquid_ready'); 4015 } 4016 4017 4018 if (settings.onItemFinish) settings.onItemFinish($i, $imgBoxCont, $img); /* << CallBack */ 4019 checkFinish(); 4020 } 4021 4022 // ___________________________________________________________________ 4023 4024 function checkFinish() { /* Check callBack */ 4025 if ($i === imgLiquidRoot.length - 1) if (img
4025LiquidRoot.settings.onFinish) imgLiquidRoot.settings.onFinish(); 4026 } 4027 4028 4029 }); 4030 } //End imgLiquid: function 4031 }); //End $.fn.extend 4032 4033 })(jQuery); 4034 4035 if (typeof window.cff === 'undefined' || typeof window.cff.feeds === 'undefined') { 4036 window.cff = new Cff(); 4037 window.cff.createPage(window.cff.createFeeds, {}); 4038 } 4039 jQuery(document).ready(function() { 4040 var allInitiated = true; 4041 jQuery('.cff').each(function(index) { 4042 if (typeof window.cff !== 'undefined' 4043 && typeof window.cff.feeds !== 'undefined' 4044 && typeof window.cff.feeds[index] === 'undefined' ) { 4045 allInitiated = false; 4046 4047 } 4048 }); 4049 4050 if (!allInitiated) { 4051 window.cff.createPage(window.cff.createFeeds, {}); 4052 } 4053 4054 var $ = jQuery; 4055 $('#cookie-notice a').on('click', function() { 4056 setTimeout(function() { 4057 $.each(window.cff.feeds,function(index){ 4058 window.cff.feeds[ index ].afterConsentToggled(); 4059 }); 4060 },1000); 4061 }); 4062 4063 // Cookie Notice by dFactory 4064 $('#cookie-law-info-bar a').on('click', function() { 4065 setTimeout(function() { 4066 $.each(window.cff.feeds,function(index){ 4067 window.cff.feeds[ index ].afterConsentToggled(); 4068 }); 4069 },1000); 4070 }); 4071 4072 // GDPR Cookie Consent by WebToffee 4073 $('.cli-user-preference-checkbox').on('click', function(){ 4074 setTimeout(function() { 4075 $.each(window.cff.feeds,function(index){ 4076 window.cff.feeds[ index ].settings.consentGiven = false; 4077 window.cff.feeds[ index ].afterConsentToggled(); 4078 }); 4079 },1000); 4080 }); 4081 4082 // Cookiebot 4083 $(window).on('CookiebotOnAccept', function (event) { 4084 $.each(window.cff.feeds,function(index){ 4085 window.cff.feeds[ index ].settings.consentGiven = true; 4086 window.cff.feeds[ index ].afterConsentToggled(); 4087 }); 4088 }); 4089 4090 // Complianz by Really Simple Plugins 4091 $(document).on('cmplzEnableScripts', function (event) { 4092 if ( event.detail === 'marketing' ) { 4093 $.each(window.cff.feeds,function(index){ 4094 window.cff.feeds[ index ].settings.consentGiven = true; 4095 window.cff.feeds[ index ].afterConsentToggled(); 4096 }); 4097 } 4098 }); 4099 4100 // Complianz by Really Simple Plugins 4101 $(document).on('cmplzFireCategories', function (event) { 4102 if ( event.detail.category === 'marketing' ) { 4103 $.each(window.cff.feeds,function(index){ 4104 window.cff.feeds[ index ].settings.consentGiven = true; 4105 window.cff.feeds[ index ].afterConsentToggled(); 4106 }); 4107 } 4108 }); 4109 4110 // Complianz by Really Simple Plugins 4111 $(document).on('cmplzRevoke', function (event) { 4112 $.each(window.cff.feeds,function(index){ 4113 window.cff.feeds[ index ].settings.consentGiven = false; 4114 window.cff.feeds[ index ].afterConsentToggled(); 4115 }); 4116 }); 4117 4118 // Borlabs Cookie by Borlabs 4119 $(document).on('borlabs-cookie-consent-saved', function (event) { 4120 $.each(window.cff.feeds,function(index){ 4121 window.cff.feeds[ index ].settings.consentGiven = false; 4122 window.cff.feeds[ index ].afterConsentToggled(); 4123 }); 4124 }); 4125 4126 }); 4127 4128 //If a video is wrapped in this element then remove it as it causes an issue with some themes 4129 setTimeout(function(){ 4130 jQuery('#cff .embed-responsive video, #cff .embed-responsive iframe').unwrap(); 4131 }, 500); 4132 4133 4134 // Inject css styles ______________________________________________________ 4135 !function () { 4136 var css = imgLiquid.injectCss, 4137 head = document.getElementsByTagName('head')[0], 4138 style = document.createElement('style'); 4139 style.type = 'text/css'; 4140 if (style.styleSheet) { 4141 style.styleSheet.cssText = css; 4142 } else { 4143 style.appendChild(document.createTextNode(css)); 4144 } 4145 head.appendChild(style); 4146 }(); 4147 jQuery('.cff').each(function() { 4148 if (!jQuery(this).hasClass('cff-disable-liquid')) {
4149 jQuery(this).find(".cff-new .cff-album-cover").imgLiquid({fill:true}); 4150 } 4151 }); 4152 jQuery(".cff-new .cff-crop").imgLiquid({fill:true, useBackgroundSize:true}); 4153 jQuery(".cff-header-hero").imgLiquid({fill:true}); 4154 4155 } //********* END cff_init() FUNCTION ************// 4156 4157 4158 cff_init(); 4159 4160 4161//Get the Access Token from the shortcode so it can be used in the connect file 4162 function cffGetShortcodeToken($cff){ 4163 var shortcode_token_param = ''; 4164 if ( $cff.attr('data-cff-shortcode') ){ 4165 if( $cff.attr('data-cff-shortcode').indexOf('accesstoken') !== -1 ){ 4166 var shortcode_att = $cff.attr('data-cff-shortcode'), 4167 shortcode_att_arr = JSON.parse( shortcode_att ); 4168 shortcode_token_param = encodeURI('&at=' + shortcode_att_arr['accesstoken']); 4169 } 4170 } 4171 return shortcode_token_param; 4172 } 4173 4174// Used for linking text in captions 4175 /* JavaScript Linkify - v0.3 - 6/27/2009 - http://benalman.com/projects/javascript-linkify/ */ 4176 window.cffLinkify=(function(){var k="[a-z\\d.-]+://",h="(?:(?:[0-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])\\.){3}(?:[0-9]|[1-9]\\d|1\\d{2}|2[0-4]\\d|25[0-5])",c="(?:(?:[^\\s!@#$%^&*()_=+[\\]{}\\\\|;:'\",.<>/?]+)\\.)+",n="(?:ac|ad|aero|ae|af|ag|ai|al|am|an|ao|aq|arpa|ar|asia|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|biz|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|cat|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|coop|com|co|cr|cu|cv|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|info|int|in|io|iq|ir|is|it|je|jm|jobs|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mil|mk|ml|mm|mn|mobi|mo|mp|mq|mr|ms|mt|museum|mu|mv|mw|mx|my|mz|name|na|nc|net|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pro|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tel|tf|tg|th|tj|tk|tl|tm|tn|to|tp|travel|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|xn--0zwm56d|xn--11b5bs3a9aj6g|xn--80akhbyknj4f|xn--9t4b11yi5a|xn--deba0ad|xn--g6w251d|xn--hgbk6aj7f53bba|xn--hlcj6aya9esc7a|xn--jxalpdlp|xn--kgbechtv|xn--zckzah|ye|yt|yu|za|zm|zw)",f="(?:"+c+n+"|"+h+")",o="(?:[;/][^#?<>\\s]*)?",e="(?:\\?[^#<>\\s]*)?(?:#[^<>\\s]*)?",d="\\b"+k+"[^<>\\s]+",a="\\b"+f+o+e+"(?!\\w)",m="mailto:",j="(?:"+m+")?[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@"+f+e+"(?!\\w)",l=new RegExp("(?:"+d+"|"+a+"|"+j+")","ig"),g=new RegExp("^"+k,"i"),b={"'":"`",">":"<",")":"(","]":"[","}":"{","B;":"B+","b:":"b9"},i={callback:function(q,p){return p?'<a href="'+p+'" title="'+p+'" target="_blank" rel="nofollow noopener noreferrer">'+q+"</a>":q},punct_regexp:/(?:[!?.,:;'"]|(?:&|&)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)$/};return function(u,z){z=z||{};var w,v,A,p,x="",t=[],s,E,C,y,q,D,B,r;for(v in i){if(z[v]===undefined){z[v]=i[v]}}while(w=l.exec(u)){A=w[0];E=l.lastIndex;C=E-A.length;if(/[\/:]/.test(u.charAt(C-1))){continue}do{y=A;r=A.substr(-1);B=b[r];if(B){q=A.match(new RegExp("\\"+B+"(?!$)","g"));D=A.match(new RegExp("\\"+r,"g"));if((q?q.length:0)<(D?D.length:0)){A=A.substr(0,A.length-1);E--}}if(z.punct_regexp){A=A.replace(z.punct_regexp,function(F){E-=F.length;return""})}}while(A.length&&A!==y);p=A;if(!g.test(p)){p=(p.indexOf("@")!==-1?(!p.indexOf(m)?"":m):!p.indexOf("irc.")?"irc://":!p.indexOf("ftp.")?"ftp://":"http://")+p}if(s!=C){t.push([u.slice(s,C)]);s=E}t.push([A,p])}t.push([u.substr(s)]);for(v=0;v<t.length;v++){x+=z.callback.apply(window,t[v])}return x||u}})(); 4177 4178//Link #hashtags 4179 function cffReplaceHashtags(hash){ 4180 //Remove white space at beginning of hash 4181 var replacementString = jQuery.trim(hash); 4182 //If the hash is a hex code then don't replace it with a link as it's likely in the style attr, eg: "color: #ff0000" 4183 if ( /^#[0-9A-F]{6}$/i.test( replacementString ) ){ 4184 return replacementString; 4185 } else { 4186 return '<a href="https://www.facebook.com/hashtag/'+ replacementString.substring(1) +'" target="_blank" rel="nofollow noopener">' + replacementString + '</a>'; 4187 } 4188 } 4189//Link @tags 4190 function cffReplaceTags(tag){ 4191 var replacementString = jQuery.trim(tag); 4192 return '<a href="https://www.facebook.com/'+ replacementString.substring(1) +'" target="_blank" rel="nofollow noopener">' + replacementString + '</a>'; 4193 } 4194 var hashRegex = /[#]+[A-Za-z0-9-_]+/g, 4195 tagRegex = /[@]+[A-Za-z0-9-_]+/g; 4196// End caption linking functions 4197 4198//Encoding comments 4199 function cffEncodeHTML(raw) { 4200 // make sure passed variable is defined 4201 if (typeof raw === 'undefined') { 4202 return ''; 4203 } 4204 // replace greater than and less than symbols with html entity to disallow html in comments 4205 var encoded = raw.replace(/(>)/g,'>'), 4206 encoded = encoded.replace(/(<)/g,'<'); 4207 encoded = encoded.replace(/(<br\/>)/g,'<br>'); 4208 encoded = encoded.replace(/(<br>)/g,'<br>'); 4209 4210 return encoded; 4211 } 4212 4213 4214//Load comment replies using Ajax 4215 function cffLoadCommentReplies( $this ){ 4216 4217 var usegrouptoken = '', 4218 useowntoken = '', 4219 $cffClosestContainer = jQuery('#cff_'+$this.parent().attr('data-id')).closest('#cff'); 4220 if( $cffClosestContainer.hasClass('cff-group') ) usegrouptoken = '&usegrouptoken=true'; 4221 if( $cffClosestContainer.attr('data-own-token') == 'true' ) useowntoken = '&useowntoken=true'; 4222 4223 //Get the token from the shortcode 4224 var cff_page_id = $this.closest('.cff-item').attr('data-page-id'), 4225 shortcode_token_param = cffGetShortcodeToken( $cffClosestContainer ), 4226 $commentReplies = $this.parent(), 4227 $commentRepliesBox = $commentReplies.siblings('.cff-comment-replies-box'), 4228 comments_url = cffsiteurl + "/custom-facebook-feed-pro/comments.php?id=" + $commentReplies.attr('data-id') + usegrouptoken + useowntoken + '&pageid=' + cff_page_id + shortcode_token_param; 4229 4230 if( $commentReplies.hasClass('cff-hide') ){ 4231 4232 $commentRepliesBox.hide(); 4233 $commentReplies.removeClass('cff-hide'); 4234 4235 } else { 4236 4237 $commentRepliesBox.show(); 4238 $commentReplies.addClass('cff-hide'); 4239 4240 //If the replies haven't been retrieved yet then get them, otherwise just show the existing ones again 4241 if( $commentRepliesBox.hasClass('cff-empty') ){
4242 4243 //Display loader 4244 var $commentRepliesA = $commentReplies.find('a'); 4245 $commentRepliesA.append('<div class="cff-loader"></div>'); 4246 $commentReplies.find('.cff-loader').css('background-color', $commentRepliesA.css('color')); 4247 4248 var submitData = { 4249 action: 'cff_comments', 4250 id: $commentReplies.attr('data-id'), 4251 pageid: cff_page_id, 4252 }; 4253 if( $cffClosestContainer.hasClass('cff-group') ){ 4254 submitData.usegrouptoken = true; 4255 } 4256 if( $cffClosestContainer.attr('data-own-token') == 'true' ) { 4257 submitData.useowntoken = true; 4258 } 4259 if( shortcode_token_param !== '' ){ 4260 var token = shortcode_token_param.split('='); 4261 submitData.at = token[1]; 4262 } 4263 4264 var onSuccess = function(data) { 4265 4266 //Remove loader 4267 $commentReplies.find('.cff-loader').remove(); 4268 4269 //Convert string of data received from comments.php to a JSON object 4270 var data = JSON.parse( data ), 4271 allComments = ''; 4272 4273 if( typeof data.comments !== 'undefined' ){ 4274 jQuery.each(data.comments.data, function(i, commentItem) { 4275 var consentGiven = (typeof window.cff !== 'undefined' && typeof window.cff.feeds !== 'undefined') ? window.cff.feeds[0].settings.consentGiven : true; 4276 4277 //Check whether comment author info exists - only accessible with page access token from the page now 4278 var cff_comment_author_info = true; 4279 if( typeof commentItem.from !== 'undefined' ){ 4280 cff_comment_from_id = commentItem.from.id; 4281 } else { 4282 cff_comment_author_info = false; 4283 cff_comment_from_id = ''; 4284 } 4285 4286 4287 allComments += '<div class="cff-comment-reply" id="cff_'+commentItem.id+'"><div class="cff-comment-text-wrapper"><div class="cff-comment-text'; 4288 if(!cff_comment_author_info) allComments += ' cff-no-name'; 4289 allComments += '"><p>'; 4290 4291 4292 if(cff_comment_author_info){ 4293 if( typeof commentItem.from.link != 'undefined' ){ 4294 allComments += '<a href="http://facebook.com/'+commentItem.from.id+'" class="cff-name" target="_blank" rel="nofollow noopener">
4294'+commentItem.from.name+'</a>'; 4295 } else { 4296 allComments += '<span class="cff-name">'+commentItem.from.name+'</span>'; 4297 } 4298 } 4299 4300 4301 var cffCommentMessage = cffEncodeHTML(commentItem.message); 4302 allComments += cffCommentMessage; 4303 4304 //Show like count if exists 4305 if(parseInt(commentItem.like_count) > 0) allComments += '<span class="cff-comment-likes"><span class="cff-comment-likes-bg"><b style="padding-top: 3px;"><svg role="img" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M466.27 286.69C475.04 271.84 480 256 480 236.85c0-44.015-37.218-85.58-85.82-85.58H357.7c4.92-12.81 8.85-28.13 8.85-46.54C366.55 31.936 328.86 0 271.28 0c-61.607 0-58.093 94.933-71.76 108.6-22.747 22.747-49.615 66.447-68.76 83.4H32c-17.673 0-32 14.327-32 32v240c0 17.673 14.327 32 32 32h64c14.893 0 27.408-10.174 30.978-23.95 44.509 1.001 75.06 39.94 177.802 39.94 7.22 0 15.22.01 22.22.01 77.117 0 111.986-39.423 112.94-95.33 13.319-18.425 20.299-43.122 17.34-66.99 9.854-18.452 13.664-40.343 8.99-62.99zm-61.75 53.83c12.56 21.13 1.26 49.41-13.94 57.57 7.7 48.78-17.608 65.9-53.12 65.9h-37.82c-71.639 0-118.029-37.82-171.64-37.82V240h10.92c28.36 0 67.98-70.89 94.54-97.46 28.36-28.36 18.91-75.63 37.82-94.54 47.27 0 47.27 32.98 47.27 56.73 0 39.17-28.36 56.72-28.36 94.54h103.99c21.11 0 37.73 18.91 37.82 37.82.09 18.9-12.82 37.81-22.27 37.81 13.489 14.555 16.371 45.236-5.21 65.62zM88 432c0 13.255-10.745 24-24 24s-24-10.745-24-24 10.745-24 24-24 24 10.745 24 24z"></path></svg></b>
4305'+commentItem.like_count+'</span></span>'; 4306 4307 allComments += '</p>'; 4308 4309 //Add image attachment if exists 4310 if( typeof commentItem.attachment !== 'undefined' ) { 4311 if (consentGiven) { 4312 allComments += '<a class="cff-comment-attachment" href="'+commentItem.attachment.url+'" target="_blank" rel="nofollow noopener"><img src="'+commentItem.attachment.media.image.src+'" alt="'+commentItem.attachment.title+'" /></a>'; 4313 } else { 4314 allComments += '<a class="cff-comment-attachment" href="'+commentItem.attachment.url+'" target="_blank" rel="nofollow noopener"><span class="cff-comment-image-placeholder" data-src="'+commentItem.attachment.media.image.src+'" data-alt="'+commentItem.attachment.title+'"></span></a>'; 4315 } 4316 } 4317 4318 allComments += '</div></div>'; 4319 if(cff_comment_author_info) { 4320 if (consentGiven) { 4321 allComments += '<div class="cff-comment-img cff-comment-reply-img"><a href="http://facebook.com/'+commentItem.from.id+'" target="_blank" rel="nofollow noopener"><img src="'+commentItem.from.picture.data.url+'" width="20" height="20" alt="Avatar" onerror="this.style.display=\'none\'"></a></div>'; 4322 } else { 4323 allComments += '<div class="cff-comment-img cff-comment-reply-img"><a href="http://facebook.com/'+commentItem.from.id+'" target="_blank" rel="nofollow noopener"><span data-src="'+commentItem.from.picture.data.url+'"></span></a></div>'; 4324 } 4325 } 4326 allComments += '</div>'; 4327 }); 4328 } 4329 4330 $commentRepliesBox.html(allComments).removeClass('cff-empty'); 4331 4332 //Re-init masonry layout when loading comment replies 4333 if( $this.closest('#cff').hasClass('cff-masonry-js') && !$this.closest('#cff').hasClass('cff-masonry-css') && !$this.closest('#cff').hasClass('cff-opaque-comments') ){ 4334 cffAddMasonry( $this.closest('#cff') ); 4335 } 4336 4337 }; 4338 cffAjax(submitData,onSuccess); 4339 4340 } //End if 4341 4342 } //End if/else 4343 4344 } // End cffLoadCommentReplies() 4345 4346 4347 4348 4349 function cffLightbox(){ 4350 /** 4351 * Lightbox v2.7.1 4352 * by Lokesh Dhakar - http://lokeshdhakar.com/projects/lightbox2/ 4353 * 4354 * @license http://creativecommons.org/licenses/by/2.5/ 4355 * - Free for use in both personal and commercial projects 4356 * - Attribution requires leaving author name, author link, and the license info intact 4357 */ 4358 4359 (function() { 4360 // Use local alias 4361 var $ = jQuery; 4362 4363 var LightboxOptions = (function() { 4364 function LightboxOptions() { 4365 this.fadeDuration = 300; 4366 this.fitImagesInViewport = true; 4367 this.resizeDuration = 400; 4368 this.positionFromTop = 50; 4369 this.showImageNumberLabel = true; 4370 this.alwaysShowNavOnTouchDevices = false; 4371 this.wrapAround = false; 4372 } 4373 4374 // Change to localize to non-english language 4375 LightboxOptions.prototype.albumLabel = function(curImageNum, albumSize) { 4376 return curImageNum + " / " + albumSize; 4377 }; 4378 4379 return LightboxOptions; 4380 })(); 4381 4382 4383 var Lightbox = (function() { 4384 function Lightbox(options) { 4385 this.options = options; 4386 this.album = []; 4387 this.currentImageIndex = void 0; 4388 this.init(); 4389 } 4390 4391 Lightbox.prototype.init = function() { 4392 this.enable(); 4393 this.build(); 4394 }; 4395 4396 // Loop through anchors and areamaps looking for either data-lightbox attributes or rel attributes 4397 // that contain 'cff-lightbox'. When these are clicked, start lightbox. 4398 Lightbox.prototype.enable = function() { 4399 var self = this; 4400 $('body').on('click', 'a[data-cff-lightbox], area[data-cff-lightbox]', function(event) { 4401 self.start($(event.currentTarget)); 4402 return false; 4403 }); 4404 }; 4405 4406 // Build html for the lightbox and the overlay. 4407 // Attach event handlers to the new DOM elements. 4408 Lightbox.prototype.build = function() { 4409 //Disable SVG icons? 4410 var cff_lightbox_svg_class = ''; 4411 if( $('.cff.cff-no-svgs').length ) cff_lightbox_svg_class = 'cff-no-svgs'; 4412 4413 var self = this; 4414 $("<div id='cff-lightbox-overlay' class='cff-lightbox-overlay'></div><div id='cff-lightbox-wrapper' class='cff-lightbox-wrapper "+cff_lightbox_svg_class+"'><div class='cff-lightbox-outerContainer'><div class='cff-lightbox-container'><iframe type='text/html' src='' allowfullscreen frameborder='0' webkitAllowFullScreen mozallowfullscreen allowFullScreen title='Video'></iframe><img class='cff-lightbox-image' src='' alt='"+$('#cff').attr('data-fb-text')+"' /><div class='cff-lightbox-nav'><a class='cff-lightbox-prev' href=''><span>Previous</span></a><a class='cff-lightbox-next' href=''><span>Next</span></a></div><div class='cff-lightbox-loader'><a class='cff-lightbox-cancel'></a></div><div class='cff-lightbox-sidebar'></div></div></div><div class='cff-lightbox-dataContainer'><div class='cff-lightbox-data'><div class='cff-lightbox-details'><p class='cff-lightbox-caption'><span class='cff-lightbox-caption-text'></span><a class='cff-lightbox-facebook' href=''><svg aria-hidden='true' focusable='false' data-prefix='fab' data-icon='facebook-square' role='img' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512' class='svg-inline--fa fa-facebook-square fa-w-14'><path fill='currentColor' d='M400 32H48A48 48 0 0 0 0 80v352a48 48 0 0 0 48 48h137.25V327.69h-63V256h63v-54.64c0-62.15 37-96.48 93.67-96.48 27.14 0 55.52 4.84 55.52 4.84v61h-31.27c-30.81 0-40.42 19.12-40.42 38.73V256h68.78l-11 71.69h-57.78V480H400a48 48 0 0 0 48-48V80a48 48 0 0 0-48-48z'></path></svg>"+$('#cff').attr('data-fb-text')+"</a></p><div class='cff-lightbox-thumbs'><div class='cff-lightbox-thumbs-holder'></div></div></div><div class='cff-lightbox-closeContainer'><a class='cff-lightbox-close'><svg aria-hidden='true' focusable='false' data-prefix='fas' data-icon='times' role='img' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 352 512' class='svg-inline--fa fa-times fa-w-11'><path fill='currentColor' d='M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z' class=''></path></svg></a></div></div></div></div>").appendTo($('body')); 4415 4416 // Make sure hammer is defined somehow 4417 if (typeof jQuery("#cff-lightbox-wrapper").find(".cff
4417-lightbox-dataContainer").hammer !== 'function') { 4418 var Hammer = { 4419 Manager: { 4420 prototype: {} 4421 } 4422 }; 4423 (function (factory) { 4424 if (typeof define === 'function' && define.amd) { 4425 define(['jquery', 'hammerjs'], factory); 4426 } else if (typeof exports === 'object') { 4427 factory(require('jquery'), require('hammerjs')); 4428 } else { 4429 factory(jQuery, Hammer); 4430 } 4431 }(function (jQuery, Hammer) { 4432 function hammerify(el, options) { 4433 } 4434 4435 jQuery.fn.hammer = function (options) { 4436 return this.each(function () { 4437 hammerify(this, options); 4438 }); 4439 }; 4440 // extend the emit method to also trigger jQuery events 4441 Hammer.Manager.prototype.emit = (function (originalEmit) { 4442 return function (type, data) { 4443 originalEmit.call(this, type, data); 4444 jQuery(this.element).trigger({ 4445 type: type, 4446 gesture: data 4447 }); 4448 }; 4449 })(Hammer.Manager.prototype.emit); 4450 })); 4451 } 4452 4453 // Cache jQuery objects 4454 this.$lightbox = $('#cff-lightbox-wrapper'); 4455 this.$overlay = $('#cff-lightbox-overlay'); 4456 this.$outerContainer = this.$lightbox.find('.cff-lightbox-outerContainer'); 4457 this.$container = this.$lightbox.find('.cff-lightbox-container'); 4458 4459 // Store css values for future lookup 4460 this.containerTopPadding = parseInt(this.$container.css('padding-top'), 10); 4461 this.containerRightPadding = parseInt(this.$container.css('padding-right'), 10); 4462 this.containerBottomPadding = parseInt(this.$container.css('padding-bottom'), 10); 4463 this.containerLeftPadding = parseInt(this.$container.css('padding-left'), 10); 4464 4465 // Attach event handlers to the newly minted DOM elements 4466 this.$overlay.hide().on('click', function() { 4467 self.end(); 4468 if( cff_supports_video() && $('#cff-lightbox-wrapper video.cff-lightbox-video').length ) $('#cff-lightbox-wrapper video.cff-lightbox-video')[0].pause(); 4469 $('#cff-lightbox-wrapper iframe').attr('src', ''); 4470 if ($('body').length) { 4471 $('body').removeClass('cff_no_scroll'); 4472 } 4473 return false; 4474 }); 4475 4476 4477 this.$lightbox.hide().on('click', function(event) { 4478 self.album.length = 0; 4479 if ($(event.target).attr('id') === 'cff-lightbox-wrapper') { 4480 self.end(); 4481 if( cff_supports_video() && $('#cff-lightbox-wrapper video.cff-lightbox-video').length ) $('#cff-lightbox-wrapper video.cff-lightbox-video')[0].pause(); 4482 $('#cff-lightbox-wrapper iframe').attr('src', ''); 4483 if ($('body').length) { 4484 $('body').removeClass('cff_no_scroll'); 4485 } 4486 } 4487 return false; 4488 }); 4489 this.$outerContainer.on('click', function(event) {
4490 if ($(event.target).attr('id') === 'cff-lightbox-wrapper') { 4491 self.album.length = 0; 4492 self.end(); 4493 if( cff_supports_video() && $('#cff-lightbox-wrapper video.cff-lightbox-video').length ) $('#cff-lightbox-wrapper video.cff-lightbox-video')[0].pause(); 4494 $('#cff-lightbox-wrapper iframe').attr('src', ''); 4495 } 4496 return false; 4497 }); 4498 4499 4500 this.$lightbox.find('.cff-lightbox-prev').on('click', function() { 4501 if (self.currentImageIndex === 0) { 4502 self.changeImage(self.album.length - 1); 4503 } else { 4504 self.changeImage(self.currentImageIndex - 1); 4505 } 4506 if( cff_supports_video() ) $('#cff-lightbox-wrapper video.cff-lightbox-video')[0].pause(); 4507 $('#cff-lightbox-wrapper iframe').attr('src', ''); 4508 return false; 4509 }); 4510 4511 this.$lightbox.find('.cff-lightbox-next').on('click', function() { 4512 if (self.currentImageIndex === self.album.length - 1) { 4513 self.changeImage(0); 4514 } else { 4515 self.changeImage(self.currentImageIndex + 1); 4516 } 4517 if( cff_supports_video() ) $('#cff-lightbox-wrapper video.cff-lightbox-video')[0].pause(); 4518 $('#cff-lightbox-wrapper iframe').attr('src', ''); 4519 return false; 4520 }); 4521 4522 this.$lightbox.find('.cff-lightbox-outerContainer').hammer().on("swipeleft", function() { 4523 if (self.currentImageIndex === self.album.length - 1) { 4524 self.changeImage(0); 4525 } else { 4526 self.changeImage(self.currentImageIndex + 1); 4527 } 4528 if( cff_supports_video() ) $('#cff-lightbox-wrapper video.cff-lightbox-video')[0].pause(); 4529 $('#cff-lightbox-wrapper iframe').attr('src', ''); 4530 return false; 4531 }); 4532 4533 this.$lightbox.find('.cff-lightbox-outerContainer').hammer().on("swiperight", function() { 4534 if (self.currentImageIndex === 0) { 4535 self.changeImage(self.album.length - 1); 4536 } else { 4537 self.changeImage(self.currentImageIndex - 1); 4538 } 4539 if( cff_supports_video() ) $('#cff-lightbox-wrapper video.cff-lightbox-video')[0].pause(); 4540 $('#cff-lightbox-wrapper iframe').attr('src', ''); 4541 return false; 4542 }); 4543 4544 //CHANGE IMAGE ON THUMB CLICK 4545 $('.cff-lightbox-thumbs').on('click', '.cff-lightbox-attachment', function (){ 4546 var $thumb = $(this), 4547 $thumbImg = $thumb.find('img'), 4548 captionText = $thumb.attr('data-caption'); 4549 4550 if(captionText == '' || captionText == 'undefined') captionText = $thumb.attr('orig-caption'); 4551 4552 //Pass image URL, width and height to the change image function 4553 self.changeImage(parseInt( $thumb.attr('data-cff-lightbox-order') ), $thumb.attr('href'), $thumbImg.attr('width'), $thumbImg.attr('height'), $thumb.attr('data-facebook'), captionText); 4554 return false; 4555 }); 4556 4557 4558 this.$lightbox.find('.cff-lightbox-loader, .cff-lightbox-close').on('click', function() { 4559 self.album.length = 0; 4560 self.end();
4561 if( cff_supports_video() ) $('#cff-lightbox-wrapper video.cff-lightbox-video')[0].pause(); 4562 $('#cff-lightbox-wrapper iframe').attr('src', ''); 4563 if ($('body').length) { 4564 $('body').removeClass('cff_no_scroll'); 4565 } 4566 return false; 4567 }); 4568 4569 }; //End build() 4570 4571 // Show overlay and lightbox. If the image is part of a set, add siblings to album array. 4572 Lightbox.prototype.start = function($link) { 4573 var self = this; 4574 var $window = $(window); 4575 4576 $window.on('resize', $.proxy(this.sizeOverlay, this)); 4577 4578 if ($('body').length) { 4579 $('body').addClass('cff_no_scroll'); 4580 } 4581 4582 $('select, object, embed').css({ 4583 visibility: "hidden" 4584 }); 4585 4586 this.sizeOverlay(); 4587 4588 //Only set the album to be empty when the page first loads, otherwise don't empty it otherwise it's rebuilt using the "push" method below and it pushes the lightbox thumbnails onto the end of the array instead of them being spliced in at their correct location 4589 if(this.album.length == 0) this.album = []; 4590 var imageNumber = 0; 4591 4592 function addToAlbum($link) { 4593 4594 if( !$link.closest('.cff-posts-wrap').hasClass('cff_owl-carousel') ) { 4595 var albumClassName = $link.closest('.cff-posts-wrap').children('div').attr('class'); 4596 } else { 4597 var albumClassName = $link.closest('.cff-posts-wrap .cff_owl-item').children('div').attr('class'); 4598 } 4599 4600 linkParentPostID = ''; 4601 4602 if ( typeof albumClassName !== 'undefined' ) { 4603 linkParentPostID = $link.closest('.'+albumClassName.split(' ')[0]).attr('id'); 4604 linkParentPostID = (linkParentPostID !== 'undefined') ? linkParentPostID.replace('cff_','') : linkParentPostID; 4605 } 4606 4607 //If an image with the same href has already been added then don't add it to the lightbox order again 4608 var found = false; 4609 $.each(self.album, function(i, imageitem) { 4610 if( ( imageitem.link == $link.attr('href') ) && ( imageitem.postid == linkParentPostID ) ){ 4611 found = true; 4612 return; 4613 } 4614 }); 4615 //Some videos may legitimately use the exact same thumbnail images. If so, adding this class to the shortcode will allow them to be added to the lightbox order. 4616 if( !$('.cff-duplicate-video-thumbnails').length ) if(found == true) return; 4617 var closestFeedIndex = parseInt($link.closest('.cff').attr('data-cff-index')-1); 4618 4619 var video = $link.attr("data-video"), 4620 iframe = $link.attr('data-iframe'), 4621 link = $link.attr("href"), 4622 count = 0; 4623 var consentGiven = (typeof window.cff !== 'undefined' && typeof window.cff.feeds !== 'undefined') ? window.cff.feeds[0].settings.consentGiven : true; 4624 if (!consentGiven) { 4625 if (iframe !== '') { 4626 iframe = 'link'; 4627 } 4628 if (video !== '') { 4629 video = 'link'; 4630 } 4631 if ($link.closest('.cff-album-item').length 4632 && typeof $link.closest('.cff-album-item').attr('data-count') !== 'undefined') { 4633 count = $link.closest('.cff-album-item').attr('data-count'); 4634 } 4635 } 4636 self.album.push({ 4637 link: link, 4638 title: $link.attr('data-title') || $link.attr('title'), 4639 postid: $link.attr('data-id'), 4640 showthumbs: $link.attr('data-thumbs'), 4641 facebookurl: $link.attr('data-url'), 4642 video: video, 4643 iframe: iframe, 4644 type: $link.attr('data-type'), 4645 cffgroupalbums: $link.attr('data-cffgroupalbums'),
4646 isthumbnail: $link.attr('data-cff-isthumbnail'), 4647 pagename: $link.parent().attr('data-cff-page-name'), 4648 posttime: $link.parent().attr('data-cff-post-time'), 4649 lbcomments: $link.attr('data-lb-comments'), 4650 feedIndex: closestFeedIndex, 4651 count: count 4652 }); 4653 } 4654 4655 // Support both data-lightbox attribute and rel attribute implementations 4656 var dataLightboxValue = $link.attr('data-cff-lightbox'); 4657 var $links; 4658 4659 if (dataLightboxValue) { 4660 $links = $($link.prop("tagName") + '[data-cff-lightbox="' + dataLightboxValue + '"]'); 4661 for (var i = 0; i < $links.length; i = ++i) { 4662 addToAlbum($($links[i])); 4663 if ($links[i] === $link[0]) { 4664 imageNumber = i; 4665 4666 //Loop through the album array and try to match the ID of the image that was clicked on with an image within the album array. We can then use that to set the lightbox order for that image, as otherwise it's incorrect if there have been thumbs added into the album array which aren't physically present on the page as they're loaded dynamically from the thumbs array within the lightbox. Only do this for post images and not thumbnails. 4667 $.each(self.album, function(i, image) { 4668 if( (image.postid == $link.attr('data-id')) && image.isthumbnail != true ) imageNumber = i; 4669 }); 4670 } 4671 } 4672 } else { 4673 if ($link.attr('rel') === 'lightbox') { 4674 // If image is not part of a set 4675 addToAlbum($link); 4676 } else { 4677 // If image is part of a set 4678 $links = $($link.prop("tagName") + '[rel="' + $link.attr('rel') + '"]'); 4679 for (var j = 0; j < $links.length; j = ++j) { 4680 addToAlbum($($links[j])); 4681 if ($links[j] === $link[0]) { 4682 imageNumber = j; 4683 } 4684 } 4685 } 4686 } 4687 4688 // Position Lightbox 4689 var top = $window.scrollTop() + this.options.positionFromTop; 4690 var left = $window.scrollLeft(); 4691 this.$lightbox.css({ 4692 top: top + 'px', 4693 left: left + 'px' 4694 }).fadeIn(this.options.fadeDuration); 4695 4696 this.changeImage(imageNumber); 4697 }; 4698 4699 // Hide most UI elements in preparation for the animated resizing of the lightbox. 4700 Lightbox.prototype.changeImage = function(imageNumberVal, imageUrl, imgWidth, imgHeight, facebookLink, captionText) { 4701 var self = this, 4702 isThumb = false, 4703 bottomPadding = 120; 4704 4705 imageNumber = imageNumberVal; 4706 4707 //Is this a thumb being clicked? 4708 if(typeof imageUrl !== 'undefined') isThumb = true; 4709 4710 this.disableKeyboardNav(); 4711 var $image = this.$lightbox.find('.cff-lightbox-image'); 4712 4713 this.$overlay.fadeIn(this.options.fadeDuration); 4714 4715 $('.cff-lightbox-loader').fadeIn('slow'); 4716 this.$lightbox.find('.cff-lightbox-image, .cff-lightbox-nav, .cff-lightbox-prev, .cff-lightbox-next, .cff-lightbox-dataContainer, .cff-lightbox-numbers, .cff-lightbox-caption').hide(); 4717 4718 this.$outerContainer.addClass('animating'); 4719 4720 4721 // When image to show is preloaded, we send the width and height to sizeContainer() 4722 var preloader = new Image(); 4723 preloader.onload = function() { 4724 var $preloader, imageHeight, imageWidth, maxImageHeight, maxImageWidth, windowHeight, windowWidth; 4725 4726 $image.attr('src', self.album[imageNumber].link); 4727 4728 /*** THUMBS ***/ 4729 //Change the main image when it's a thumb that's being clicked 4730 if(isThumb){ 4731 $image.attr('src', imageUrl); 4732 $('.cff-lightbox-facebook').attr('href', facebookLink); 4733 $('.cff-lightbox-caption .cff-lightbox-caption-text').html(captionText); 4734 4735 //Set width and height of image when thumb is clicked 4736 preloader.width = imgWidth; 4737 preloader.height = imgHeight; 4738 4739 //Increase bottom padding to make room for at least one row of thumbs 4740 bottomPadding = 180; 4741 } 4742 /*** THUMBS ***/ 4743 4744 $preloader = $(preloader); 4745 4746 $image.width(preloader.width); 4747 $image.height(preloader.height); 4748 4749 if (self.options.fitImagesInViewport) { 4750 // Fit image inside the viewport. 4751 // Take into account the border around the image and an additional 10px gutter on each side. 4752 windowWidth = $(window).width(); 4753 windowHeight = $(window).height(); 4754 4755 //If this feed has lightbox comments enabled then add room for the sidebar 4756 var cff_lb_comments_width = 0, 4757 cffNavArrowsWidth = 80; 4758 4759 if( $('#cff_' + self.album[0].postid).closest('#cff').attr('data-lb-comments') == 'true' && windowWidth > 640 ) cff_lb_comments_width = 300; 4760 4761 //Use narrower arrows on mobile 4762 if(window.innerWidth < 640) cffNavArrowsWidth = 40; 4763 4764 maxImageWidth = windowWidth - self.containerLeftPadding - self.containerRightPadding - 20 - cff_lb_comments_width - cffNavArrowsWidth; 4765 maxImageHeight = windowHeight - self.containerTopPadding - self.containerBottomPadding - bottomPadding; 4766 4767 // Is there a fitting issue? 4768 if ((preloader.width > maxImageWidth) || (preloader.height > maxImageHeight)) { 4769 if ((preloader.width / maxImageWidth) > (preloader.height / maxImageHeight)) { 4770 imageWidth = maxImageWidth; 4771 imageHeight = parseInt(preloader.height / (preloader.width / imageWidth), 10); 4772 $image.width(imageWidth);
4773 $image.height(imageHeight); 4774 } else { 4775 imageHeight = maxImageHeight; 4776 imageWidth = parseInt(preloader.width / (preloader.height / imageHeight), 10); 4777 $image.width(imageWidth); 4778 $image.height(imageHeight); 4779 } 4780 } 4781 } 4782 4783 //Pass the width and height of the main image 4784 self.sizeContainer($image.width(), $image.height()); 4785 4786 }; 4787 4788 preloader.src = this.album[imageNumber].link; 4789 this.currentImageIndex = imageNumber; 4790 }; 4791 4792 // Stretch overlay to fit the viewport 4793 Lightbox.prototype.sizeOverlay = function() { 4794 this.$overlay 4795 .width($(window).width()) 4796 .height($(document).height()); 4797 }; 4798 4799 // Animate the size of the lightbox to fit the image we are showing 4800 Lightbox.prototype.sizeContainer = function(imageWidth, imageHeight) { 4801 var self = this; 4802 4803 var oldWidth = this.$outerContainer.outerWidth(); 4804 var oldHeight = this.$outerContainer.outerHeight(); 4805 var newWidth = imageWidth + this.containerLeftPadding + this.containerRightPadding; 4806 var newHeight = imageHeight + this.containerTopPadding + this.containerBottomPadding; 4807 4808 function postResize() { 4809 self.$lightbox.find('.cff-lightbox-dataContainer').width(newWidth); 4810 self.$lightbox.find('.cff-lightbox-prevLink').height(newHeight); 4811 self.$lightbox.find('.cff-lightbox-nextLink').height(newHeight); 4812 self.showImage(); 4813 } 4814 4815 if (oldWidth !== newWidth || oldHeight !== newHeight) { 4816 this.$outerContainer.animate({ 4817 width: newWidth, 4818 height: newHeight 4819 }, this.options.resizeDuration, 'swing', function() { 4820 postResize(); 4821 }); 4822 } else { 4823 postResize(); 4824 } 4825 }; 4826 4827 // Display the image and it's details and begin preload neighboring images. 4828 Lightbox.prototype.showImage = function() { 4829 this.$lightbox.find('.cff-lightbox-loader').hide(); 4830 this.$lightbox.find('.cff-lightbox-image').fadeIn('slow'); 4831 4832 this.updateNav(); 4833 this.updateDetails(); 4834 this.preloadNeighboringImages(); 4835 this.enableKeyboardNav(); 4836 }; 4837 4838 // Display previous and next navigation if appropriate. 4839 Lightbox.prototype.updateNav = function() { 4840 // Check to see if the browser supports touch events. If so, we take the conservative approach 4841 // and assume that mouse hover events are not supported and always show prev/next navigation 4842 // arrows in image sets. 4843 var alwaysShowNav = false; 4844 try { 4845 document.createEvent("TouchEvent"); 4846 alwaysShowNav = (this.options.alwaysShowNavOnTouchDevices)? true: false; 4847 } catch (e) {} 4848 4849 this.$lightbox.find('.cff-lightbox-nav').show(); 4850 4851 if (this.album.length > 1) { 4852 if (this.options.wrapAround) { 4853 if (alwaysShowNav) { 4854 this.$lightbox.find('.cff-lightbox-prev, .cff-lightbox-next').css('opacity', '1'); 4855 } 4856 this.$lightbox.find('.cff-lightbox-prev, .cff-lightbox-next').show(); 4857 } else { 4858 if (this.currentImageIndex > 0) { 4859 this.$lightbox.find('.cff-lightbox-prev').show(); 4860 if (alwaysShowNav) { 4861 this.$lightbox.find('.cff-lightbox-prev').css('opacity', '1'); 4862 } 4863 } 4864 if (this.currentImageIndex < this.album.length - 1) { 4865 this.$lightbox.find('.cff-lightbox-next').show(); 4866 if (alwaysShowNav) { 4867 this.$lightbox.find('.cff-lightbox-next').css('opacity', '1'); 4868 } 4869 } 4870 } 4871 } 4872 }; 4873 4874 var thumbsArr = {}; 4875 4876 // Display caption, image number, and closing button. 4877 Lightbox.prototype.updateDetails = function() { 4878 var self = this; 4879 var origCaption = ''; 4880 4881 this.$lightbox.find('.cff-lightbox-nav, .cff-lightbox-nav a').show(); 4882 4883 /** NEW PHOTO ACTION **/ 4884 4885 //Add the video element to the lightbox dynamically (as it causes issues with some themes if an empty tag is in there on page load
4885) 4886 if( $('.cff-lightbox-video').length == 0 ) $('.cff-lightbox-container').prepend("<video class='cff-lightbox-video' src='' poster='' controls></video>"); 4887 4888 //Switch video when either a new popup or navigating to new one 4889 if( cff_supports_video() ){ 4890 $('#cff-lightbox-wrapper').removeClass('cff-has-video'); 4891 4892 if (typeof this.album[this.currentImageIndex].video !== 'undefined' 4893 && this.album[this.currentImageIndex].video !== 'link'){ 4894 if( this.album[this.currentImageIndex].video.length ){ 4895 4896 $('#cff-lightbox-wrapper').addClass('cff-has-video'); 4897 $('.cff-lightbox-video').attr({ 4898 'src' : this.album[this.currentImageIndex].video, 4899 'poster' : this.album[this.currentImageIndex].link, 4900 'autoplay' : 'true' 4901 }); 4902 } 4903 } 4904 4905 } 4906 4907 var iframeIsLink = false; 4908 if (this.album[this.currentImageIndex].iframe === 'link') { 4909 iframeIsLink = true; 4910 } 4911 if ((this.album[this.currentImageIndex].video === 'link' || iframeIsLink) 4912 && ! jQuery(".cff-lightbox-container .cff_gdpr_notice").length) { 4913 jQuery(".cff-lightbox-container").prepend('<a href="'+this.album[this.currentImageIndex].facebookurl+'" target="_blank" rel="noopener noreferrer" class="cff_gdpr_notice"><svg style="color: rgba(255,255,255,1)" class="svg-inline--fa fa-play fa-w-14" aria-label="Play" aria-hidden="true" data-fa-processed="" data-prefix="fa" data-icon="play" role="presentation" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M424.4 214.7L72.4 6.6C43.8-10.3 0 6.1 0 47.9V464c0 37.5 40.7 60.1 72.4 41.3l352-208c31.4-18.5 31.5-64.1 0-82.6z"></path></svg></a>') 4914 } else if (this.album[this.currentImageIndex].video !== 'link' && !iframeIsLink) { 4915 jQuery('.cff_gdpr_notice').remove(); 4916 } else if (jQuery(".cff-lightbox-container .cff_gdpr_notice").length) { 4917 jQuery(".cff-lightbox-container .cff_gdpr_notice").attr('href',this.album[this.currentImageIndex].facebookurl); 4918 } 4919 4920 //***LIGHTBOX COMMENTS*** 4921 //Enable/disable lightbox comments. If it's a lightbox thumbnail then check whether the parent post has lb_comments enabled/disabled. 4922 var cff_lb_comments = (this.album[this.currentImageIndex].lbcomments == 'true' && $('#cff_'+this.album[this.currentImageIndex].postid+' .cff-lightbox-link').attr('data-lb-comments') != 'false') ? true : false; 4923 4924 if( $(window).width() <= 640 ) cff_lb_comments = false; 4925 4926 //Add lightbox sidebar 4927 if( cff_lb_comments ){ 4928 var lb_post_id = this.album[this.currentImageIndex].postid, 4929 page_id = lb_post_id.split('_')[0], 4930 author_name = this.album[this.currentImageIndex].pagename, 4931 date_in_correct_format = this.album[this.currentImageIndex].posttime, 4932 $lightbox_sidebar = $('.cff-lightbox-container .cff-lightbox-sidebar'), 4933 $lightbox_thumbs_holder = $('.cff-lightbox-thumbs-holder'), 4934 from_id = $( '#cff_'+this.album[this.currentImageIndex].postid ).attr('data-cff-from'); 4935 4936 //Add class to the lightbox container 4937 $('.cff-lightbox-wrapper').addClass('cff-enable-lb-comments'); 4938 4939 //Adjust width to make room for the sidebar 4940 $('.cff-lightbox-dataContainer').css( 'width', $('.cff-lightbox-dataContainer').innerWidth() + 300 ); 4941 $lightbox_sidebar.css('display', 'block'); 4942 4943 //If the from info isn't available then dis
4943play a placeholder avatar and the date 4944 var cff_post_author = ""; 4945 var consentGiven = (typeof window.cff !== 'undefined' && typeof window.cff.feeds !== 'undefined') ? window.cff.feeds[0].settings.consentGiven : true; 4946 if( consentGiven && typeof from_id !== 'undefined' ){ 4947 cff_post_author = "<div class='cff-author'><div class='cff-author-text'><p class='cff-page-name cff-author-date'><a href='https://facebook.com/"+from_id+"' target='_blank' rel='nofollow'>"+author_name+"</a><span class='cff-story'> </span></p><p class='cff-date'>"+date_in_correct_format+"</p></div><a href='https://facebook.com/"+from_id+"' target='_blank' rel='nofollow noopener' class='cff-author-img'><img src='https://graph.facebook.com/"+from_id+"/picture?type=square' title='"+author_name+"' alt='"+author_name+"' width='40' height='40'></a></div>"; 4948 } else { 4949 cff_post_author = "<div class='cff-author cff-no-author-info'><div class='cff-author-text'><p class='cff-date'>"+date_in_correct_format+"</p></div><div class='cff-author-img'></div></div>"; 4950 } 4951 4952 //Remove the close button from the bottom of lightbox as it's added to the top of the sidebar 4953 $('.cff-lightbox-dataContainer .cff-lightbox-close').remove(); 4954 4955 $lightbox_sidebar.html("<div class='cff-lightbox-closeContainer'><div class='cff-lightbox-close'><svg aria-hidden='true' focusable='false' data-prefix='fas' data-icon='times' role='img' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 352 512' class='svg-inline--fa fa-times fa-w-11'><path fill='currentColor' d='M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z' class=''></path></svg></div></div><div class='cff-lightbox-sidebar-content'>" + cff_post_author + "<p class='cff-lightbox-caption'><span class='cff-lightbox-caption-text'>" + $('.cff-lightbox-caption-text').html() + '</span></p></div>' + $('#cff_'+this.album[this.currentImageIndex].postid+' .cff-comments-box')[0].outerHTML ); 4956 4957 this.$lightbox.find('.cff-lightbox-close').on('click', function() { 4958 self.end(); 4959 self.album.length = 0; 4960 if( cff_supports_video() ) $('#cff-lightbox-wrapper video.cff-lightbox-video')[0].pause(); 4961 $('#cff-lightbox-wrapper iframe').attr('src', ''); 4962 if ($('body').length) { 4963 $('body').removeClass('cff_no_scroll'); 4964 } 4965 return false; 4966 }); 4967 4968 //Use a timeout to delay this as the thumbs aren't added till further down 4969 setTimeout(function(){ 4970 if( $lightbox_thumbs_holder.find('a').length > 1 ){ 4971 $lightbox_sidebar.find('.cff-page-name a').text( $lightbox_thumbs_holder.find('a.cff-selected').attr('data-page-name') ); 4972 $lightbox_sidebar.find('.cff-date').text( $lightbox_thumbs_holder.find('a.cff-selected').attr('data-post-date') ); 4973 } 4974 }, 0); 4975 4976 //Bump the thumbs section up if the sidebar section is enabled as there's no caption under the photo 4977 $lightbox_thumbs_holder.css('margin-top', -10); 4978 4979 //If the "__ likes this" text is too long then bump it onto the next line 4980 if( $lightbox_sidebar.find('.cff-reactions-count').innerWidth() > 150 ){ 4981 $lightbox_sidebar.find('.cff-likes-this-text').addClass('cff-long'); 4982 } 4983 4984 //Add comment avatars 4985 $lightbox_sidebar.find('.cff-comment:visible').each(function(){ 4986 var $thisComment = jQuery(this); 4987 var consentGiven = (typeof window.cff !== 'undefined' && typeof window.cff.feeds !== 'undefined') ? window.cff.feeds[0].settings.consentGiven : true; 4988 if (consentGiven) { 4989 $thisComment.find('.cff-comment-img:not(.cff-comment-reply-img) a, .cff-comment-img:not(.cff-comment-reply-img) span').html( '<img src="'+$thisComment.attr("data-avatar")+'" alt="Avatar" onerror="this.style.display=\'none\'" />' ); 4990 } 4991 4992 }); 4993 4994 //Load comment replies 4995 $lightbox_sidebar.find('.cff-comment-replies a').on('click', function(){ 4996 cffLoadCommentReplies( $(this) ); 4997 }); 4998 4999 $lightbox_sidebar.find('.cff-show-more-comments a').attr('href', $lightbox_sidebar.find('.cff-comment-on-facebook a').attr('href') ); 5000 5001 } else { //End add lightbox sidebar 5002 5003 //Disable lightbox 5004 $('.cff-lightbox-wrapper .cff-lightbox-sidebar').html(''); 5005 $('.cff-lightbox-wrapper').removeClass('cff-enable-lb-comments'); 5006 5007 } 5008 //***END LIGHTBOX COMMENTS*** 5009 5010 5011 5012 $('#cff-lightbox-wrapper').removeClass('cff-has-iframe cff-fb-player cff-has-thumbs'); 5013 5014 //If it's an iframe video (embed or FB video player) 5015 if( typeof this.album[this.currentImageIndex].iframe !== 'undefined' ){ 5016 if( this.album[this.currentImageIndex].iframe.length && this.album[this.currentImageIndex].iframe !== 'link'){ 5017 var videoURL = this.album[this.currentImageIndex].iframe; 5018 $('#cff-lightbox-wrapper').addClass('cff-has-iframe'); 5019 5020 if( videoURL.indexOf("https://www.facebook.com/v2.3/plugins/video.php?") !=-1 ) $('#cff
5020-lightbox-wrapper').addClass('cff-fb-player'); 5021 5022 //If it's a swf then don't add the autoplay parameter. This is only for embedded videos like YouTube or Vimeo. 5023 if( videoURL.indexOf(".swf") > -1 || videoURL.indexOf("&autoplay=1") !=-1 ){ 5024 var autoplayParam = ''; 5025 } else { 5026 var autoplayParam = '?autoplay=1'; 5027 } 5028 5029 //Add a slight delay before adding the URL else it doesn't autoplay on Firefox 5030 var vInt = setTimeout(function() { 5031 $('#cff-lightbox-wrapper iframe').attr({ 5032 'src' : videoURL + autoplayParam + "&mute=0" 5033 }); 5034 }, 500); 5035 } 5036 } 5037 5038 //Check whether it's a thumbnail image that's currently being shown in the lightbox 5039 var isThumbnail = false; 5040 if( this.album[this.currentImageIndex].isthumbnail ) isThumbnail = true; 5041 5042 //Remove existing thumbs unless it's a thumbnail image which is being navigated through in which case keep the existing thumbnails 5043 if( !isThumbnail ) $('.cff-lightbox-thumbs-holder').empty().removeClass('cff-animate'); 5044 5045 //Change the link on the Facebook icon to be the link to the Facebook post only if it's the first image in the lightbox and one of the thumbs hasn't been clicked 5046 if( this.album[this.currentImageIndex].link == $('.cff-lightbox-image').attr('src') ){ 5047 $('.cff-lightbox-facebook').attr('href', this.album[this.currentImageIndex].facebookurl); 5048 } 5049 5050 //Show thumbs area if there are thumbs 5051 if( this.album[this.currentImageIndex].showthumbs == 'true' ){ 5052 $('.cff-lightbox-thumbs').show(); 5053 5054 //Get the post ID 5055 var thisPostId = this.album[this.currentImageIndex].postid, 5056 albumInfo = '', 5057 albumThumbs = '', 5058 albumsonly = false; 5059 if( this.album[this.currentImageIndex].type == 'albumsonly' ) albumsonly = true; 5060 5061 5062 if( typeof thumbsArr[thisPostId] !== 'undefined' ){ 5063 5064 //load them in from array in local var 5065 $.each(thumbsArr[thisPostId], function(i, thumb) { 5066 var origCaption = thumb[5].replace(/"/g, '"'); 5067 5068 //Loop through the album array and find the imageindex of the item with this post ID. Then set the current image index to be this. Otherwise when going backwards through the lightbox the imageindex is set to be the current thumb index and then once i is added the index is too high. 5069 var albumIndex = 0; 5070 $.each(self.album, function(i, albumItem) { 5071 if( albumItem.postid == thisPostId ){ 5072 albumIndex = i; 5073 //Once found the first match exit the loop 5074 return false; 5075 } 5076 }); 5077 5078 var lightboxImageOrder = (parseInt(albumIndex)+parseInt(i)); 5079 5080 //If the small thumb isn't defined (like in regular posts) then use the full image instead 5081 if( typeof thumb[8] == 'undefined' ) thumb[8] = thumb[0]; 5082 albumThumbs += '<a href="'+thumb[0]+'" class="cff-lightbox-attachment" data-cff-lightbox="cff-lightbox-1" data-facebook="'+thumb[3]+'" data-caption="'+thumb[4]+'" orig-caption="'+origCaption+'" data-page-name="'+thumb[6]+'" data-post-date="'+thumb[7]+'" data-cff-lightbox-order="'+lightboxImageOrder+'" lbcomments="true" data-thumbs="true" data-url="'+thumb[3]+'" data-iframe data-video '; 5083 5084 (albumsonly) ? albumThumbs += 'data-type="albumsonly" ' : albumThumbs += 'data-type '; 5085 albumThumbs += 'data-cff-isthumbnail="true"><img src="'+thumb[8]+'" width="'+thumb[1]+'" height="'+thumb[2]+'" /></a>'; 5086 5087 //Add all of the thumbs (apart from the first thumb) to the lightbox order 5088 if( i > 0 ){ 5089 cffInsertLightboxImage(lightboxImageOrder, thumb[0], thumb[4], thumb[3], thisPostId, albumsonly, true, thumb[6], thumb[7], thumb[8]); 5090 } 5091 }); 5092 5093 //Add thumbs to the page 5094 $('.cff-lightbox-thumbs-holder').html( '<div class="cff-lightbox-thumbs-wrap">' + albumThumbs + '</div>' ).addClass('cff-animate'); 5095 $('.cff-lightbox-wrapper').addClass('cff-has-thumbs'); 5096 5097 //Liquidfill the thumbs 5098 jQuery(".cff-lightbox-thumbs-holder a").imgLiquid({fill:true, useBackgroun
5098dSize:true}); 5099 5100 //Hide the loader 5101 $('.cff-loader').hide(); 5102 $('.cff-lightbox-thumbs-holder').css('min-height', 0); 5103 5104 } else { 5105 //Use ajax to get them from Facebook API 5106 5107 //Set paths for thumbs.php 5108 if (typeof cffsiteurl === 'undefined' || cffsiteurl == '') cffsiteurl = window.location.host + '/wp-content/plugins'; 5109 5110 //Get the token from the shortcode 5111 var $cffClosest = $('#cff_'+thisPostId).closest('.cff'), 5112 cff_page_id = $('#cff_'+thisPostId).attr('data-page-id'), 5113 shortcode_token_param = cffGetShortcodeToken( $cffClosest ), 5114 useowntoken = ''; 5115 if( $cffClosest.attr('data-own-token') == 'true' ) useowntoken = '&useowntoken=true'; 5116 5117 //AJAX 5118 var cffAttachmentsUrl = cffsiteurl + "/custom-facebook-feed-pro/thumbs.php?id=" + thisPostId + '&pageid=' + cff_page_id + useowntoken + shortcode_token_param, 5119 thumbsData = []; 5120 5121 //If this is an albums only item and the thumbs will 5122 if( albumsonly ){ 5123 cffAttachmentsUrl = cffAttachmentsUrl + '&albumsonly=true'; 5124 var consentGiven = (typeof window.cff !== 'undefined' && typeof window.cff.feeds !== 'undefined') ? window.cff.feeds[0].settings.consentGiven : true; 5125 if (consentGiven) { 5126 $('.cff-lightbox-thumbs-holder').css('min-height', 45).after('<div class="cff-loader"></div>'); 5127 } 5128 } 5129 5130 //If it's a group album then add the absolute path so we can get the User Access Token from the DB 5131 var cffgroupalbums = this.album[this.currentImageIndex].cffgroupalbums; 5132 if( cffgroupalbums ) cffAttachmentsUrl = cffAttachmentsUrl + '&usegrouptoken=' + cffgroupalbums; 5133 5134 var submitData = { 5135 action: 'cff_thumbs', 5136 id: thisPostId, 5137 pageid: cff_page_id, 5138 }; 5139 if( shortcode_token_param !== '' ){ 5140 var token = shortcode_token_param.split('='); 5141 submitData.at = token[1]; 5142 } 5143 if( $cffClosest.attr('data-own-token') == 'true' ) { 5144 submitData.useowntoken = true; 5145 } 5146 if( cffgroupalbums ){ 5147 submitData.usegrouptoken = cffgroupalbums; 5148 } 5149 if( albumsonly ){ 5150 submitData.albumsonly = true; 5151 } 5152 5153 var onSuccess = function(data) { 5154 //Convert string of data received from thumbs.php to a JSON object 5155 data = JSON.parse( data ); 5156 5157 if(albumsonly){ 5158 //Compile the thumbs 5159 $.each(data.data, function(i, photoItem) { 5160 var dataCaption = ''; 5161 if( photoItem.name ) dataCaption = photoItem.name; 5162 // origCaption = String(origCaption).replace(/"/g, '"'); 5163 5164 //Format the caption and add links 5165 dataCaption = cffLinkify(dataCaption); 5166 dataCaption = dataCaption.replace( hashRegex , cffReplaceHashtags ); 5167 5168 // dataCaption = dataCaption.replace( tagRegex , cffReplaceTags ); - causes an issue with email address linking 5169 dataCaption = String(dataCaption).replace(/& /g, '& ').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/\n/g, "<br/>"); 5170 5171 origCaption = String(origCaption).replace(/& /g, '& ').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/\n/g, "<br/>"); 5172 5173 var lightboxImageOrder = (parseInt(self.currentImageIndex)+parseInt(i)); 5174 5175 //If it's a group then use the source otherwise it displays as question marks 5176 var cffThumbHref = photoItem.source, 5177 cffPhotoItemWidth = photoItem.width, 5178 cffPhotoItemHeight = photoItem.height; 5179 5180 //Use the full size image if available 5181 if( typeof photoItem.images[0] !== 'undefined' ){ 5182 cffThumbHref = photoItem.images[0].source; 5183 cffPhotoItemWidth = photoItem.images[0].width; 5184 cffPhotoItemHeight = photoItem.images[0].height; 5185 } 5186 5187 //Set the thumbnail image to be the smallest size available, which is the second from last in images arr 5188 if( typeof photoItem.images[ photoItem.images.length-2 ] !== 'undefined' ){ 5189 var cffThumbImg = photoItem.images[ photoItem.images.length-2 ].source; 5190 } else { 5191 var cffThumbImg = cffThumbHref; 5192 } 5193 5194 albumThumbs += '<a href="'+cffThumbHref+'" class="cff-lightbox-attachment" data-facebook="http://facebook.com/'+photoItem.id+'" data-caption="'+dataCaption+'" orig-caption="'+origCaption+'" data-cff-lightbox-order="'+lightboxImageOrder+'" data-thumbs="true" data-url="http://facebook.com/'+photoItem.id+'" data-iframe data-video data-type="albumsonly" data-cff-isthumbnail="true"><img src="'+cffThumbImg+'" lbcomments="false" width="'+cffPhotoItemWidth+'" height="'+cffPhotoItemHeight+'" /></a>'; 5195 5196 thumbsData.push([cffThumbHref, cffPhotoItemWidth, cffPhotoItemHeight, 'http://facebook.com/'+photoItem.id, dataCaption, origCaption, undefined, undefined, cffThumbImg]); 5197 5198 //Add all of the thumbs (apart from the first thumb) to the lightbox order 5199 if( i > 0 ){ 5200 cffInsertLightboxImage(lightboxImageOrder, cffThumbHref, dataCaption, 'http://facebook.com/'+photoItem.id, thisPostId, albumsonly, true, cffThumbImg); 5201 } 5202 5203 }); //End each 5204 5205 } else { 5206 //Check whether there's data.. 5207 if (typeof data.attachments !== 'undefined') { 5208 5209 //..Then compile the thumbs 5210 $.each(data.attachments.data[0].subattachments.data, function(i, subattachment) { 5211 var dataCaption = ''; 5212 if( subattachment.description ) dataCaption = subattachment.description; 5213 origCaption = String(origCaption).replace(/"/g, '"'); 5214 5215 //Format the caption and add links 5216 dataCaption = cffLinkify(dataCaption); 5217 dataCaption = dataCaption.replace( hashRegex , cffReplaceHashtags ); 5218 // dataCaption = dataCaption.replace( tagRegex , cffReplaceTags ); - causes an issue with email address linking 5219 dataCaption = String(dataCaption).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/\n/g, "<br/>"); 5220 5221 var lightboxImageOrder = (parseInt(self.currentImageIndex)+parseInt(i)); 5222 5223 albumThumbs += '<a href="'+subattachment.media.image.src+'" class="cff-lightbox-attachment" data-facebook="'+subattachment.url+'" data-caption="'+dataCaption+'" orig-caption="'+origCaption+'" lbcomments="true" data-page-name="'+author_name+'" data-post-date="'+date_in_correct_format
5223+'" data-cff-lightbox-order="'+lightboxImageOrder+'" data-thumbs="true" data-url="'+subattachment.url+'" data-iframe data-video data-type data-cff-isthumbnail="true"><img src="'+subattachment.media.image.src+'" width="'+subattachment.media.image.width+'" height="'+subattachment.media.image.height+'" /></a>'; 5224 5225 thumbsData.push([subattachment.media.image.src, subattachment.media.image.width, subattachment.media.image.height, subattachment.url, dataCaption, origCaption, author_name, date_in_correct_format]); 5226 5227 //Add all of the thumbs (apart from the first thumb) to the lightbox order 5228 if( i > 0 ){ 5229 cffInsertLightboxImage(lightboxImageOrder, subattachment.media.image.src, dataCaption, subattachment.url, thisPostId, albumsonly, true, author_name, date_in_correct_format, subattachment.media.image.src); 5230 } 5231 5232 }); 5233 5234 } //End undefined check 5235 5236 } //End if/else 5237 5238 //Add thumbs to the page 5239 if( albumThumbs.length > 0 ){ 5240 $('.cff-lightbox-thumbs-holder').html( '<div class="cff-lightbox-thumbs-wrap">' + albumThumbs + '</div>' ).addClass('cff-animate'); 5241 $('.cff-lightbox-wrapper').addClass('cff-has-thumbs'); 5242 } 5243 5244 //Liquidfill the thumbs 5245 jQuery(".cff-lightbox-thumbs-holder .cff-lightbox-attachment").imgLiquid({fill:true, useBackgroundSize:true}); 5246 5247 //Hide the loader 5248 $('.cff-loader').hide(); 5249 5250 $('.cff-lightbox-thumbs-holder').css('min-height', 0); 5251 5252 //Add the thumbs to the thumbs array to store them 5253 thumbsArr[ thisPostId ] = thumbsData; 5254 5255 //album done loading, can change items now 5256 if (albumsonly) { 5257 jQuery('.cff-lightbox-container').removeClass('cff-album-loading'); 5258 jQuery('.cff-lightbox-prev, .cff-lightbox-next').show(); 5259 } 5260 }; // end success 5261 $('.cff-gdpr-more-link').remove(); 5262 if (window.cff.feeds[ this.album[this.currentImageIndex].feedIndex ].settings.consentGiven) { 5263 // disable navigation while albums load 5264 if (albumsonly) { 5265 jQuery('.cff-lightbox-container').addClass('cff-album-loading'); 5266 jQuery('.cff-lightbox-prev, .cff-lightbox-next').hide(); 5267 } 5268 cffAjax(submitData,onSuccess); 5269 } else { 5270 if (parseInt(this.album[this.currentImageIndex].count) > 0) { 5271 $('.cff-lightbox-facebook').after('<a href="' + $('.cff-lightbox-facebook').attr('href') + '" class="cff-gdpr-more-link cff-lightbox-attachment"><div class="cff-gdpr-overlay"></div><span>+' + this.album[this.currentImageIndex].count + '</span><img src="'+jQuery('.cff-lightbox-image').attr('src')+'"></a>'); 5272 $('.cff-gdpr-more-link').imgLiquid({fill:true, useBackgroundSize:true}); 5273 setTimeout(function () { 5274 $('.cff-gdpr-more-link span').css({ 5275 'margin-top': '-' + ($('.cff-gdpr-more-link span').height() / 2) + 'px', 5276 'margin-right': '-' + ($('.cff-gdpr-more-link span').width() / 2) + 'px', 5277 'display': 'block' 5278 }); 5279 }, 200); 5280 } 5281 } 5282 5283 } //End if/else 5284 5285 } else { 5286 //If there are no thumbs then hide the thumbs area 5287 $('.cff-lightbox-thumbs').hide(); 5288 } 5289 5290 //Add a class to the selected thumb 5291 $(".cff-lightbox-attachment").removeClass('cff-selected'); 5292 $(".cff-lightbox-attachment[href='"+$('.cff-lightbox-image').attr('src')+"']").addClass('cff-selected'); 5293 5294 5295 function cffInsertLightboxImage(currentImageIndex, link, title, facebookurl, postid, albumsonly, isThumbnail,
5295cffThumbImg){ 5296 5297 //Make sure the thumbs aren't added to the lightbox order more than once 5298 var found = false; 5299 $.each(self.album, function(i, thumbitem) { 5300 if( ( thumbitem.link == link ) && ( thumbitem.postid == postid ) ){ 5301 found = true; 5302 return; 5303 } 5304 }); 5305 if(found == true) return; 5306 5307 ( albumsonly ) ? postType = 'albumsonly' : postType = ''; 5308 ( albumsonly ) ? lbcomments = 'false' : lbcomments = 'true'; 5309 5310 //Push the image into the album array at the correct location so it's included in the lightbox order 5311 self.album.splice(currentImageIndex, 0, { 5312 link: link, 5313 title: title, 5314 postid: postid, 5315 showthumbs: 'true', 5316 facebookurl: facebookurl, 5317 video: '', 5318 iframe: '', 5319 type: postType, 5320 cffgroupalbums: undefined, 5321 isthumbnail: isThumbnail, 5322 lbcomments: lbcomments, 5323 thumbimg: cffThumbImg 5324 }); 5325 5326 } //End cffInsertLightboxImage() 5327 5328 /** END NEW PHOTO ACTION **/ 5329 5330 5331 //Still show the caption section even if there's not a caption as it contains the View on Facebook link 5332 this.$lightbox.find('.cff-lightbox-caption').fadeIn('fast'); 5333 5334 5335 // Enable anchor clicks in the injected caption html. 5336 if (typeof this.album[this.currentImageIndex].title !== 'undefined' && this.album[this.currentImageIndex].title !== "") { 5337 5338 //If it's the first image in the lightbox then set the caption to be the text from the post. For all subsequent images the caption is changed on the fly based elsehwere in the code based on an attr from the thumb that's clicked 5339 var origCaption = this.album[this.currentImageIndex].title; 5340 //Add hashtag and tag links 5341 // origCaption = cffLinkify(origCaption); - Caused issues with @tag links in regular lightbox popup 5342 origCaption = origCaption.replace( hashRegex , cffReplaceHashtags ); 5343 // origCaption = origCaption.replace( tagRegex , cffReplaceTags ); - causes an issue with email address linking 5344 //Decode the caption back so that the tags are rendered as HTML: 5345 origCaption = String(origCaption).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"'); 5346 5347 var $lightboxCaption = this.$lightbox.find('.cff-lightbox-caption'), 5348 $lightboxCaptionText = $lightboxCaption.find('.cff-lightbox-caption-text'); 5349 if( this.album[this.currentImageIndex].link == $('.cff-lightbox-image').attr('src') ) $lightboxCaptionText.html( origCaption ); 5350 5351 //If there's no caption then remove the border and margin from the View on Facebook link 5352 if( $lightboxCaptionText.text() == ' ' || $lightboxCaptionText.text() == '' ){ 5353 $lightboxCaption.addClass('cff-no-caption'); 5354 } else { 5355 $lightboxCaption.removeClass('cff-no-caption'); 5356 } 5357 5358 } else { 5359 if(albumsonly || this.album[this.currentImageIndex].title === undefined) this.$lightbox.find('.cff-lightbox-caption-text').html(''); 5360 5361 //If there's no caption then add a class 5362 if( this.$lightbox.find('.cff-lightbox-caption .cff-lightbox-caption-text').text().length < 1 ) this.$lightbox.find('.cff-lightbox-caption').addClass('cff-no-caption').find('.cff-lightbox-caption-text').html(''); 5363 } 5364 5365 this.$lightbox.find('.cff-lightbox-facebook, .cff-lightbox-caption-text a, .cff-lightbox-sidebar a:not(.cff-comment-replies-a), .cff_gdpr_notice, .cff-gdpr-more-link').off('click').on('click', function(event){ 5366 window.open( 5367 $(this).attr('href'), 5368 '_blank' 5369 ) 5370 } 5371 ); 5372 5373 if (this.album.length > 1 && this.options.showImageNumberLabel) { 5374 this.$lightbox.find('.cff-lightbox-number').text(this.options.albumLabel(this.currentImageIndex + 1, this.album.length)).fadeIn('fast'); 5375 } else { 5376 this.$lightbox.find('.cff-lightbox-number').hide(); 5377 } 5378 5379 if (typeof cffLightboxAction === 'function') { 5380 setTimeout(function() { 5381 cffLightboxAction(); 5382 },100); 5383 } 5384 5385 this.$outerContainer.removeClass('animating'); 5386 5387 this.$lightbox.find('.cff-lightbox-dataContainer').fadeIn(this.options.resizeDuration, function() { 5388 return self.sizeOverlay(); 5389 }); 5390 5391 }; //End Lightbox.prototype.updateDetails 5392 5393 // Preload previous and next images in set. 5394 Lightbox.prototype.preloadNeighboringImages = function() { 5395 if (this.album.length > this.currentImageIndex + 1) { 5396 var preloadNext = new Image(); 5397 preloadNext.src = this.album[this.currentImageIndex + 1].link; 5398 } 5399 if (this.currentImageIndex > 0) { 5400 var preloadPrev = new Image(); 5401 preloadPrev.src = this.album[this.currentImageIndex - 1].link; 5402 } 5403 }; 5404 5405 Lightbox.prototype.enableKeyboardNav = function() { 5406 $(document).on('keyup.keyboard', $.proxy(this.keyboardAction, this)); 5407 }; 5408 5409 Lightbox.prototype.disableKeyboardNav = function() { 5410 $(document).off('.keyboard'); 5411 }; 5412 5413 Lightbox.prototype.keyboardAction = function(event) { 5414 var KEYCODE_ESC = 27; 5415 var KEYCODE_LEFTARROW = 37; 5416 var KEYCODE_RIGHTARROW = 39; 5417 5418 var keycode = event.keyCode; 5419 var key = String.fromCharCode(keycode).toLowerCase(); 5420 if (keycode === KEYCODE_ESC || key.match(/x|o|c/)) {
5421 if( cff_supports_video() ) $('#cff-lightbox-wrapper video.cff-lightbox-video')[0].pause(); 5422 $('#cff-lightbox-wrapper iframe').attr('src', ''); 5423 5424 this.end(); 5425 } else if (key === 'p' || keycode === KEYCODE_LEFTARROW) { 5426 if (jQuery('.cff-lightbox-container').hasClass('cff-album-loading')) { 5427 // disable navigation while albums load 5428 return; 5429 } 5430 if (this.currentImageIndex !== 0) { 5431 this.changeImage(this.currentImageIndex - 1); 5432 } else if (this.options.wrapAround && this.album.length > 1) { 5433 this.changeImage(this.album.length - 1); 5434 } 5435 5436 if( cff_supports_video() ) $('#cff-lightbox-wrapper video.cff-lightbox-video')[0].pause(); 5437 $('#cff-lightbox-wrapper iframe').attr('src', ''); 5438 5439 } else if (key === 'n' || keycode === KEYCODE_RIGHTARROW) { 5440 if (jQuery('.cff-lightbox-container').hasClass('cff-album-loading')) { 5441 // disable navigation while albums load 5442 return; 5443 } 5444 if (this.currentImageIndex !== this.album.length - 1) { 5445 this.changeImage(this.currentImageIndex + 1); 5446 } else if (this.options.wrapAround && this.album.length > 1) { 5447 this.changeImage(0); 5448 } 5449 5450 if( cff_supports_video() ) $('#cff-lightbox-wrapper video.cff-lightbox-video')[0].pause(); 5451 $('#cff-lightbox-wrapper iframe').attr('src', ''); 5452 5453 } 5454 }; 5455 5456 // Closing time 5457 Lightbox.prototype.end = function() { 5458 this.disableKeyboardNav(); 5459 $(window).off("resize", this.sizeOverlay); 5460 this.$lightbox.fadeOut(this.options.fadeDuration); 5461 this.$overlay.fadeOut(this.options.fadeDuration); 5462 $('select, object, embed').css({ 5463 visibility: "visible" 5464 }); 5465 }; 5466 5467 return Lightbox; 5468 5469 })(); //End Lightbox = (function() 5470 5471 $(function() { 5472 var options = new LightboxOptions(); 5473 var lightbox = new Lightbox(options); 5474 }); 5475 5476 }).call(this); //End (function() { 5477 5478 //Checks whether browser support HTML5 video element 5479 function cff_supports_video() { 5480 return !!document.createElement('video').canPlayType; 5481 } 5482 5483 5484 } //End cffLightbox function 5485 5486//Only call the lightbox if the class is on at least one feed on the page 5487 if( jQuery('#cff.cff-lb').length ) cffLightbox(); 5488 5489 5490 5491} //End cff_js_exists check
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.