1function waitForRender() { 2 if (!window.renderLoaded || (typeof $ == 'undefined')) { 3 setTimeout(waitForRender, 10); 4 } else { 5 goFunc(); 6 } 7} 8 9function filterType() { 10 var temp = location.pathname.match(/^\/(gay|trans(gender)?)(?=$|\/)/); 11 return temp? temp[1].charAt(0) : "s"; 12} 13 14 15function applyErrors(form, json) { 16 var err = json.errors || []; 17 var inps = form.find(":input[name]").removeClass("is-invalid"); 18 var mmsg = form.find(".msg-main").text(json.message).attr("class", "msg-main alert alert-" + ((json.code == 0)? "success" : "warning")); 19 var errnum = 0; 20 21 inps.siblings(".invalid-feedback").remove(); 22 for (var i in err) { 23 var inp = inps.filter("[name=" + i + "]"); 24 if (inp.addClass("is-invalid").length) { 25 inp.after($('<span class="invalid-feedback">').text(err[i])); 26 errnum++; 27 } 28 } 29 30 mmsg.toggle(!errnum && !!json.message); 31} 32 33 34function str2url(txt) { 35 return txt.toLowerCase().replace(/[\s.,\/#!$%\^&\*;:{}=\-_`~()]+/uig, ' ').trim().replace(/ +/g, '-'); 36} 37 38 39function sppc_allow_pu(e) { 40 var link = $(e.target).closest("a"); 41 return link.has("img,picture").length && !link.attr("target") && !/\/report-link/.test(link.attr("href")); 42} 43 44 45 46function goFunc() { 47 window.pgcounts = cookieArray("pgc"); 48 window.pgCounter = function(type, inc, save) { 49 if (inc) { 50 pgcounts[type] = (parseInt(pgcounts[type]) || 0) + inc; 51 pgcounts.chg = true; 52 } 53 if (save) { 54 if (pgcounts.chg) { 55 delete pgcounts.chg; 56 cookieArray("pgc", pgcounts, void 0, false); 57 } 58 } else { 59 return parseInt(pgcounts[type]) || 0; 60 } 61 } 62 63 //Load JS or CSS libraries 64 window.onLib = function(libs) {
65 var proms = libs? ((libs instanceof Array)? libs : [libs]).map(function(x) { 66 var doc = document; 67 var css = /\.css$/.test(x); 68 if (x.match(/^[^\/]+$/i)) { 69 x = "/static/" + x; 70 } 71 72 // Check if this resource is already included on the page 73 var current = Array.from(doc.getElementsByTagName(css? "link" : "script")).filter(function(xx) { 74 return css? (xx.rel == "stylesheet" && xx.getAttribute("href") == x) : (xx.getAttribute("src") == x); 75 })[0]; 76 77 // Create new resource if it doesn't already exist 78 if (!current) { 79 var current = doc.createElement(css? "link" : "script"); 80 current._lprm = new Promise(function(resolve, reject) { 81 if (css) { 82 current.rel = "stylesheet"; 83 } else { 84 current.type = "text/javascript"; 85 current.async = false; 86 } 87 current.onload = resolve; 88 current.onerror = reject; 89 doc.head.appendChild(current); 90 current[css? "href" : "src"] = x; 91 }); 92 } 93 94 return current._lprm || Promise.resolve(true); 95 }) : []; 96 return Promise.all(proms); 97 } 98 99 // user settings 100 window.ContentUserSettings = { 101 cookie_name: 'us_s', 102 favs: 'nope', 103 dfavs: 'nope', 104 types: { 105 scene: "5", 106 category: "16", 107 channel: "13", 108 pornstar: "2", 109 source: "31", 110 pics: "29" 111 }, 112 init: function() { 113 if (ContentUserSettings.favs == 'nope') { 114 ContentUserSettings.favs = {s: {}, g: {}, t: {}}; 115 ContentUserSettings.dfavs = {s: {}, g: {}, t: {}}; 116 var temp = $.cookie(ContentUserSettings.cookie_name); 117 if (temp) { 118 temp = JSON.parse(temp); 119 if (temp) { 120 if (temp.favs) { 121 if (temp.favs.s) { 122 ContentUserSettings.favs = temp.favs; 123 ContentUserSettings.dfavs = temp.dfavs || {s: {}, g: {}, t: {}}; 124 } else { 125 ContentUserSettings.favs.s = temp.favs; 126 ContentUserSettings.dfavs.s = temp.dfavs || []; 127 } 128 } else { 129 ContentUserSettings.favs.s = temp; 130 } 131 } 132 } 133 } 134 }, 135 commit: function() { 136 ContentUserSettings.init(); 137 $.cookie(ContentUserSettings.cookie_name, JSON.stringify({favs: ContentUserSettings.favs, dfavs: ContentUserSettings.dfavs}), {expires: 365}) 138 }, 139 translateType: function(type) { 140 return 't' + (parseInt(type) ? type : (ContentUserSettings.types[type] || 5)); 141 }, 142 getFavs: function(cf, type) { 143 ContentUserSettings.init(); 144 return ContentUserSettings.favs[cf][ContentUserSettings.translateType(type)] || []; 145 }, 146 isFav: function(cf, type, id) { 147 return ContentUserSettings.getFavs(cf, type).includes(id); 148 }, 149 toggleFav: function(cf, type, id, set) { 150 ContentUserSettings.init(); 151 if (set) { 152 ContentUserSettings.toggleDFav(cf, type, id, false); 153 } 154 var vote, t; 155 if (set && !ContentUserSettings.isFav(cf, type, id)) { 156 t = ContentUserSettings.translateType(type); 157 if (!ContentUserSettings.favs[cf]) { 158 ContentUserSettings.favs[cf] = {}; 159 } 160 if (!ContentUserSettings.favs[cf][t]) { 161 ContentUserSettings.favs[cf][t] = []; 162 } 163 ContentUserSettings.favs[cf][t].push(id); 164 ContentUserSettings.commit(); 165 vote = 1; 166 } else if (!set && ContentUserSettings.isFav(cf, type, id)) { 167 t = ContentUserSettings.translateType(type); 168 if (!ContentUserSettings.favs[cf]) { 169 ContentUserSettings.favs[cf] = {}; 170 } 171 if (!ContentUserSettings.favs[cf][t]) { 172 ContentUserSettings.favs[cf][t] = []; 173 } 174 ContentUserSettings.favs[cf][t].splice(ContentUserSettings.favs[cf][t].indexOf(id), 1); 175 ContentUserSettings.commit(); 176 vote = -1; 177 } 178 var data = { 179 request_id: body.data("rid"), 180 user_id: body.data("uuid"), 181 type_id: body.data("pt"), 182 item_id: body.data("pi"), 183 action: "fav", 184 vote: vote, 185 position: 1, 186 ref: document.referrer, 187 url: location.pathname, 188 thumb: 0 189 }; 190 if (data.item_id) { 191 $.get("/click.json", data); 192 } 193 }, 194 getDFavs: function(cf, type) { 195 ContentUserSettings.init(); 196 return ContentUserSettings.dfavs[cf][ContentUserSettings.translateType(type)] || []; 197 }, 198 isDFav: function(cf, type, id) { 199 return ContentUserSettings.getDFavs(cf, type).includes(id); 200 }, 201 toggleDFav: function(cf, type, id, set) { 202 ContentUserSettings.init(); 203 if (set) { 204 ContentUserSettings.toggleFav(cf, type, id, false); 205 } 206 if (set && !ContentUserSettings.isDFav(cf, type, id)) { 207 var t = ContentUserSettings.translateType(type); 208 if (!ContentUserSettings.dfavs[cf]) { 209 ContentUserSettings.dfavs[cf] = {}; 210 } 211 if (!ContentUserSettings.dfavs[cf][t]) { 212 ContentUserSettings.dfavs[cf][t] = []; 213 } 214 ContentUserSettings.dfavs[cf][t].push(id); 215 ContentUserSettings.commit(); 216 } else if (!set && ContentUserSettings.isDFav(cf, type, id)) { 217 var t = ContentUserSettings.translateType(type); 218 if (!ContentUserSettings.dfavs[cf]) { 219 ContentUserSettings.dfavs[cf] = {}; 220 } 221 if (!ContentUserSettings.dfavs[cf][t]) { 222 ContentUserSettings.dfavs[cf][t] = []; 223 } 224 ContentUserSettings.dfavs[cf][t].splice(ContentUserSettings.dfavs[cf][t].indexOf(id), 1); 225 ContentUserSettings.commit(); 226 } 227 } 228 }; 229 230 231 //Get next element, wrapping to the first one if none exist 232 $.fn.nextWrap = function(selector) { 233 var next = this.nextAll(selector).first(); 234 return next.length? next : this.prevAll(selector).last(); 235 }; 236 237 238 // Get the previous element, wrapping to the last one if none exist 239 $.fn.prevWrap = function(selector) { 240 var prev = this.prevAll(selector).first(); 241 return prev.length? prev : this.nextAll(selector).last(); 242 }; 243 244 //Compact values of all form elements into a plain JS object 245 $.fn.serializeObject = function(filter, parseArrays) { 246 var result = { }; 247 var dupes = { }; 248 var items = this.find(":input[name]").add(this.filter(":input[name]")); 249 if (typeof filter == "string" || typeof filter == "function") { 250 items = items.filter(filter); 251 } 252 253 this.find("[data-json-array]").each(function() { 254 var block = $(this); 255 var name = block.attr("data-json-array"); 256 var arr = result[name] = result[name] || []; 257 arr.push(block.serializeObject(filter, parseArrays)); 258 items = items.not(block.find(":input[name]")); 259 }); 260 261 items.each(function() { 262 var val, name = this.name; 263 if (name.indexOf("[]") >= 0) { 264 dupes[name] = dupes[name] || 0; 265 name = name.replace("[]", "[" + dupes[name]++ + "]"); 266 }
267 if (this.type == "checkbox") { 268 if (this.value.indexOf("/") > -1) { 269 var temp = this.value.split("/"); 270 val = this.checked? temp[0] : temp[1]; 271 } else if (this.value == "yes") { 272 val = this.checked? "yes" : "no"; 273 } else if (this.checked) { 274 val = this.value; 275 } 276 } else if (this.type != "radio" || this.checked) { 277 val = $(this).val(); 278 } else { 279 return; 280 } 281 var ind = parseArrays? name.match(/\[([^\]]+)\]/) : null; 282 if (ind) { 283 var i1 = name.replace(ind[0], ""), i2 = ind[1]; 284 if (!result[i1]) { 285 result[i1] = { }; 286 } 287 result[i1][i2] = val; 288 } else { 289 result[name] = val; 290 } 291 }); 292 if (typeof filter == "object") { 293 result = $.extend(result, filter); 294 } 295 return result; 296 }; 297 298 $.lpost = function(lock, url, data, fun, type) { 299 lock = $(lock); 300 var req, lclass = "loading"; 301 if (url === "abort") { 302 req = lock.removeClass(lclass).data("lxhr"); 303 if (req) { 304 lock.removeData("lxhr"); 305 req.abort(); 306 } 307 return false; 308 } 309 if (lock.hasClass(lclass)) { 310 return lock.data("lxhr"); 311 } 312 lock.addClass(lclass); 313 req = (typeof url == "string")? $.post(url, data, fun, type) : $.ajax($.extend({ type: "POST", data: data, success: fun }, url)); 314 lock.data("lxhr", req); 315 return req.always(function() { 316 lock.removeClass(lclass).removeData("lxhr"); 317 }); 318 }; 319 320 // Lightweight autocomplete plugin 321 $.fn.autosuggest = function(cbs) { 322 var inp = this; 323 var temp = inp.data("autocomp"); 324 325 if (temp) { 326 if (cbs === "destroy") { 327 inp.removeData("autocomp").off(); 328 temp.results.remove(); 329 } else if (cbs === "abort" || cbs === "reset") { 330 clearTimeout(inp[0].tmID); 331 $.lpost(inp, "abort"); 332 if (cbs === "reset") { 333 inp.val(""); 334 temp.results.hide(); 335 } 336 } else if (cbs === "toggle") { 337 temp.toggle(arguments[1]); 338 } 339 return inp; 340 } 341 if (["destroy", "abort", "reset", "toggle"].indexOf(cbs) >= 0) { 342 return inp; 343 } 344 345 346 // Config options 347 var cbs = (typeof cbs == "string")? { source: cbs } : cbs; 348 var conf = $.extend({ tagIcon: "span", tagType: "span", tagThumb: "span", minLength: 2, tagCont: "span", classCont: "results", timeout: 150 }, cbs); 349 350 351 var res = conf.cont || inp.siblings("." + conf.classCont + ":first"); 352 var generated = !res.length; 353 if (generated) { 354 res = $("<" + conf.tagCont + ">").addClass(conf.classCont).hide().insertAfter(inp); 355 } 356 var asObj = { results: res, config: conf, generated: generated }; 357 inp.data("autocomp", asObj); 358 359 360 var minlen = conf.minLength; 361 var tgIcon = conf.tagIcon; 362 var tgType = conf.tagType; 363 var tgThumb = conf.tagThumb; 364 var sticky = conf.sticky; 365 if (typeof sticky != "number") { 366 sticky = sticky? 1 : 0; 367 } 368 369 var cbMap, cbRow, cbToggle, cbDis, cbSel, cbFocus; 370 cbMap = conf.map || function(x) { 371 x = (typeof x == "object")? x : { label: x }; 372 x.label = x.label || x.name || ""; 373 return $.extend({ url: "#go", value: x.label }, x); 374 }; 375 376 cbRow = conf.renderRow || function(item, hl) { 377 var text = item.label; 378 if (!item.separator) { 379 text = text.replace(/<[^>]+>/g, "").replace(hl, function(m) { return "<strong>" + m + "</strong>"; }); 380 } 381 if (item.icon) { 382 text = '<' + tgIcon + ' class="icon-' + item.icon + '"></' + tgIcon + '>' + text; 383 } 384 if (item.thumb) { 385 text = '<' + tgThumb + ' class="thumb" style="background-image: url(' + item.thumb + ')"></' + tgThumb + '>' + text; 386 } 387 if (item.type && typeof(item.type) == "string") { 388 text = '<' + tgType + ' class="type">' + item.type + '</' + tgType + '>' + text; 389 } 390 if (item.separator) { 391 var link = $("<span>").addClass("separator").text(text); 392 } else { 393 var link = $("<a>").data("item", item).attr("href", item.url).html(text); 394 } 395 if (item.cls) { 396 link.addClass(item.cls); 397 } 398 return link; 399 }; 400 401 // Toggle result div visibility function 402 cbToggle = function(tg) { 403 if (res.is(":visible") != tg) { 404 res.toggle(tg); 405 var cb = tg? conf.open : conf.close; 406 if (cb) { 407 cb.call(inp, res); 408 } else if (conf.toggle) { 409 conf.toggle.call(inp, res, tg); 410 } 411 } 412 }; 413 414 // Display results function - invoked when results finished loading from data source 415 cbDis = conf.render || function(data, res, val) { 416 var reg = new RegExp(val.trim().replace(/[^\w\s]+/g, "").replace(/\s+/g, "|"), "gi"); 417 res.html(cbRow.call(inp, { label: val, value: null, label: val, url: "#go" }).hide().addClass("active")); 418 cbToggle(data.length > 0); 419 for (var i in data) { 420 res.append(cbRow.call(inp, cbMap(data[i], val), reg)); 421 } 422 }; 423 424 // Click result function - invoked when links in results set are clicked 425 cbSel = conf.select || function(link, item) { 426 this.val(item.label); 427 if (sticky < 2) { 428 cbToggle(false); 429 } 430 if (link[0].hash) { 431 this.closest("form").submit(); 432 return false;
433 } else { 434 window.location = link[0].href; 435 } 436 }; 437 438 cbFocus = conf.focus || function(link, item) { 439 inp.val(item.label); 440 cbToggle(true); 441 }; 442 443 $.extend(asObj, { toggle: cbToggle }); 444 var ignoreBlur = 0; 445 var fdat = conf.formData; 446 var prm = conf.param || inp.attr("name") || "q"; 447 var url = "/search/suggest.json"; 448 if (typeof conf.source == "string") { 449 url = conf.source; 450 conf.source = null; 451 } 452 var cbSrc = conf.source || function(response, val) { 453 var temp = $.extend({ }, (typeof(fdat) == "function")? fdat.call(inp) : fdat); 454 temp[prm] = val; 455 $.lpost(inp, "abort"); // If previous request hasn't finished yet (shouldn't happen too often, hopefully), abort it, and unlock or element so lpost can run again 456 $.lpost(inp, url, temp, response, "json"); 457 }; 458 459 inp.keydown(function(e) { 460 if (e.which == 13) { 461 var temp = res.filter(":visible").find("a.active:visible"); 462 if (temp.length) { 463 temp.click(); 464 return false; 465 } 466 } 467 }).keyup(function(e) { 468 if (e.which == 27 || e.which == 13) { 469 clearTimeout(this.tmID); 470 cbToggle(false); 471 } else if ((e.which == 38 || e.which == 40) && res.children().length) { 472 var temp = res.find("a.active"); 473 if (!temp.length) { 474 temp = res.find("a:first"); 475 } 476 temp = temp[(e.which == 38)? "prevWrap" : "nextWrap"]("a"); 477 temp.addClass("active").siblings().removeClass("active"); 478 temp.length && cbFocus.call(inp, temp, temp.data("item")); 479 } else if (this.lastVal == inp.val()) { 480 cbToggle(res.children().length > 1); 481 } else { 482 var val = inp.val(); 483 var valLen = val.trim().length; 484 485 var cbResp = function(data) { 486 if (data && typeof data.code == "number") { 487 data = data.results || data.data; 488 } 489 cbDis.call(inp, (data instanceof Array)? data : [], res, val); 490 }; 491 clearTimeout(this.tmID); 492 if (!valLen || (minlen > 0 && minlen > valLen)) { 493 cbToggle(false); 494 return; 495 } 496 this.lastVal = val; 497 this.tmID = setTimeout(function() { 498 cbSrc.call(inp, cbResp, val); 499 }, conf.timeout); 500 } 501 }).blur(function() { 502 if (("ontouchstart" in window) && (Date.now() - ignoreBlur > 10)) { 503 !sticky && res.is(":visible") && setTimeout(function() { cbToggle(false); }, 100); 504 } 505 }); 506 507 res.on("click", "a", function() { 508 var link = $(this); 509 var data = link.data("item"); 510 if (data) { 511 return cbSel.call(inp, link, data); 512 } 513 }).on("mouseover", function() { 514 res.find("a:first:hidden").addClass("active").siblings(".active").removeClass("active"); 515 }); 516 517 if (!sticky) { 518 $("body").mousedown(function(e) { 519 ignoreBlur = Date.now(); 520 res.is(":visible") && cbToggle($(e.target).closest(inp.add(res)).length > 0); 521 }); 522 } 523 524 return inp; 525 }; 526 527 528 function setupExoClick() { 529 530 } 531 532 var body = $("body"); 533 var showsppc = !body.hasClass("mem-premium"); 534 var rmnote = '<span class="ad-label">' + l10n["t.rmlabel"] + '</span>'; 535 var screensize = Math.min(screen.availHeight, screen.availWidth); 536 var sppcType = (body.is(".is-mobile") || (screensize > 10 && screensize < 520))? "m" : "d"; 537 538 function setupSPPC() { 539 var topDomain = "porn." + (/^hi-/.test($("html").attr("lang"))? "sex" : "com"); 540 $sppc.deliveryHost = "tfosrv.com"; 541 $sppc.showStdURL = "c2hvd19zdGQkJDk1MzM0OQ=="; 542 543 if (sppcType == "m") { 544 $sppc.defaults = { width: 300, height: 250, site: ({ g: 12941, s: 12921 })[filterType()] }; 545 $sppc.zones = ({ 546 g: { 547 m_pu: { channel: 59671, type: "mobile", site: 12921 }, 548 m_tapp: { channel: 60051 }, 549 m_tcams: { channel: 60041 }, 550 m_tdate: { channel: 60031 }, 551 m_top: { channel: 60001, width: 305, height: 99, html_suffix: rmnote }, 552 m_mid: { channel: 60011, width: 305, height: 99, html_suffix: rmnote }, 553 m_foot: { channel: 60021, width: 300, height: 250, html_suffix: rmnote } 554 }, 555 s: { 556 m_pu: { channel: 59671, type: "mobile" }, 557 m_top: { channel: 59661, height: 99, width: 305, html_suffix: rmnote }, 558 m_mid: { channel: 59651, height: 99, width: 305, html_suffix: rmnote }, 559 m_foot: { channel: 59641, height: 250, width: 300, html_suffix: rmnote }, 560 m_play: { channel: 59731, height: 250, width: 300, html_suffix: rmnote }, 561 m_tapp: { channel: 59701, width: "100%", height: 65 }, 562 m_tcams: { channel: 59691, width: "100%", height: 65 }, 563 m_tdate: { channel: 59681, width: "100%", height: 65 }, 564 m_im: { channel: 59711, width: 305, height: 99, delay: 1000 }, 565 m_int: { channel: 59721, width: 300, height: 250 }, 566 m_vid: { channel: 59741, vast: 4, m_url: "vmedia." + topDomain }, 567 inter: { channel: 59811, width: 900, height: 1600 } 568 }, 569 t: { } 570 })[filterType()]; 571 } else { 572 $sppc.defaults = { width: 300, height: 250, site: ({ g: 12931, s: 12911 })[filterType()] }; 573 $sppc.zones = ({ 574 g: { 575 d_pu: { channel: 59901, width: 1100, height: 800, type: "mobile" }, 576 d_tdate: { channel: 59981 }, 577 d_tcams: { channel: 59991 },
578 d_inplayer: { channel: 59911, display: function(i) { rmedia.html(i); }, html_suffix: rmnote }, 579 d_embed: { site: 61, channel: 1147 }, 580 d_index: { channel: 59881, html_suffix: rmnote }, 581 d_player1: { channel: 59861, refresh: 2, refresh_int: 180 }, 582 d_player2: { channel: 59871, refresh: 2, refresh_int: 180, html_suffix: rmnote }, 583 d_side1: { channel: 59941 }, 584 d_side2: { channel: 59951 }, 585 d_side3: { channel: 59961 }, 586 d_foot1: { channel: 59831 }, 587 d_foot2: { channel: 59841 }, 588 d_foot3: { channel: 59851 }, 589 d_fwide: { channel: 59971, width: 950, height: 250, html_suffix: rmnote } 590 }, 591 s: { 592 d_pu: { channel: 59421, width: 1100, height: 800, type: "mobile" }, 593 //d_tcams: { channel: 1204, width: "100%", height: "auto" }, 594 d_tdate: { channel: 59491, width: "100%", height: "auto" }, 595 d_play: { channel: 59431, display: function(i) { rmedia.html(i); }, html_suffix: rmnote }, 596 d_index: { channel: 59411, html_suffix: rmnote }, 597 d_embed: { site: 61, channel: 1147 }, 598 d_player1: { channel: 59371, refresh: 2, refresh_int: 180 }, 599 d_player2: { channel: 59401, refresh: 2, refresh_int: 180, html_suffix: rmnote }, 600 d_side1: { channel: 59461 }, 601 d_side2: { channel: 59471 }, 602 d_side3: { channel: 59481 }, 603 d_foot1: { channel: 59341 }, 604 d_foot2: { channel: 59351 }, 605 d_foot3: { channel: 59361 }, 606 d_fwide: { channel: 59391, width: 950, height: 250, html_suffix: rmnote }, 607 d_vid: { channel: 59561, vast: 4, m_url: "vmedia." + topDomain }, 608 inter: { channel: 59621, width: 1600, height: 900 } 609 }, 610 t: { } 611 })[filterType()]; 612 } 613 614 function initRM() { 615 sppc_statefix(); 616 var hasPage = /\bpg=\d+/.test(location.search); 617 618 if (sppcType === "m") { 619 //if (location.pathname == "/" && filterType() == "s") { 620 // $sppc.initPU("m_pu"); 621 //} 622 623 //if (pgCounter("pu") > 1) { 624 // $sppc.initPU("m_pu"); 625 //} 626 627 if (hasPage) { 628 $sppc.prependTo(".picture-related", "m_top"); 629 630 $sppc.addToList({ element: ".list-videos", position: { row: 2 } }, "m_mid", '<div class="list-global__mid-b">'); 631 // exoClickAds.addToList({ element: ".list-videos", position: { row: 2 } }, "m_mid", '<div class="list-global__mid-b">'); 632 633 // $sppc.addBefore(".pagination", "m_foot", '<div class="foot-zn">'); 634 } 635 636 var tabs = $(".mtbs a"); 637 /* 638 var temp = ["m_tapp"]; 639 for (var i in temp) { 640 var i = parseInt(i); 641 if ($sppc.zones[temp[i]]) { 642 tabs.eq(i).filter("[href^=javas]").attr({ target: "_blank", rel: "nofollow", href: $sppc.getURL(temp[i], { redirect: 1 }) }); 643 } 644 } 645 */ 646 } else { 647 if (pgCounter("pu") < 3) { 648 pgCounter("pu", 1, true); 649 } 650 //if (pgCounter("pu") > 1) { 651 // $sppc.initPU("d_pu"); 652 //} 653 /* 654 if (hasPage) { 655 $sppc.addBefore(".pagination", "d_fwide", '<div class="foot-zn">'); 656 } 657 */ 658 659 $sppc.prependTo(".picture-related", "d_player1"); 660 } 661 } 662 663 function initRMB() { 664 $sppc.ajaxFilter = function(html) { 665 return html.replace(/http:\/\//g, "https://").replace(/system\/files\/images\//g, ""); 666 }; 667 var hash = ($("body").data("rmh") || "").split(","); 668 var pref = hash[0], suff = hash[1], show = hash[2]; 669 670 $sppc.defaults.m_url = "/" + pref + "cdn" + suff; 671 if ($sppc.zones.d_vid) { 672 $sppc.zones.d_vid.m_url = "/" + pref + "vcdn" + suff 673 } 674 $sppc.defaults.disable = ["richmedia"]; 675 $sppc.defaults.type = "ajax"; 676 $sppc.deliveryScript = "/" + pref + "media" + suff + "/" + show; 677 $sppc.defaults.disable_ctypes = function(zone) { 678 return (zone == "d_pu")? null : "flatrate"; 679 }; 680 681 // Remove previously-inserted items, if any 682 $("iframe.sppc").remove(); 683 initRM(); 684 685 // Cam fix 686 $(".js-lcms a[rel='nofollow'][target='_blank']").removeAttr("target"); 687 688 689 // Show message 690 /*if (!cookieArray("dsm", "adb")) { 691 var msg = $('<div class="wrap"><div class="abwarning"><p>' + l10n["t.abwarning"] + '</p><a href="#" class="abwarning__close"><i class="ico-close"></i></a></div></div>'); 692 $("header,.mtbs").last().after(msg); 693 msg.find("a").click(function() { 694 cookieArray("dsm", "adb", 1); 695 msg.slideUp(); 696 }); 697 }*/ 698 } 699 700 if (showsppc) { 701 $sppc.detectAB(51).then(function(blocked) { 702 if (blocked) { 703 initRMB(); 704 } else { 705 $sppc.detectAB(300).then(function(blocked) { 706 blocked && initRMB(); 707 }); 708 } 709 }); 710 setTimeout(function() { 711 !$sppc.ab && initRM(); 712 }, 1); 713 } 714 715 716 717 718 719 // When HLS is disabled, pick a reasonable initial value 720 function activatePlayerStream(player) { 721 var str = player.streams; 722 if (str && str.length > 1 && !str[0].hls) { 723 var stid = parseInt(blowplayer.cconf("bitrate")) || ((sppcType == "m")? 360 : 720); 724 var str2 = str.slice().sort(function(a, b) {
725 var da = Math.abs(parseInt(a.id) - stid); 726 var db = Math.abs(parseInt(b.id) - stid); 727 return da - db; 728 }); 729 for (var i in str2) { 730 str2[i].active = (i == 0); 731 } 732 } 733 } 734 735 736 // On PPV conf 737 function onPPVConf(eurl) { 738 $.ajaxSetup({ xhrFields: { withCredentials: true } }); 739 var match = eurl.match(/\/(\d+)($|\?)/); 740 var dat = { scene_id: match[1], auth: $("body").data("mauth") }; 741 /*if ($sppc.ab) { 742 dat.hls = "no"; 743 }*/ 744 var prom1 = onLib(["//www.paidperview.com/static/blowplayer3.js", "//www.paidperview.com/static/blowplayer3.css"]); 745 var prom2 = $.post(eurl.replace(/\/embed\/(\d+)/, "/embed-conf/$1.json"), dat); 746 return Promise.all([prom1, prom2]).then(function(res) { return res[1]; }); 747 } 748 749 750 751 // Player prev / next buttons, download links, etc 752 $(".video-player__navigation a").filter("[href='#prev'],[href='#next']").click(function(e) { 753 e.preventDefault(); 754 var nsc, sc = $(this).closest(".js-player").data("sblock"); 755 var prev = this.hash == "#prev"; 756 if (sc) { 757 nsc = sc[prev? "prevAll" : "nextAll"](".has-player").first(); 758 if (!nsc.length) { 759 nsc = sc[prev? "nextAll" : "prevAll"](".has-player").last(); 760 } 761 nsc.find("a:first").click(); 762 } 763 }); 764 $(".video-player__download").on("click", ">a", function(e) { 765 e.preventDefault(); 766 $(".video-player__download-opts").toggleClass("is-active"); 767 }); 768 $(".js-player").on("click", ".expand", function(e) { 769 e.preventDefault(); 770 var toggle = $(this).siblings("a,span").slice(body.hasClass("is-mobile")? 6 : 12).not(this).toggle(); 771 $(this).text(toggle.last().is(":visible")? "-" : "+"); 772 }); 773 $(window).on("keyup", function(e) { 774 var pl = $(".js-player.is-active"); 775 if (pl.length && (e.which == 39 || e.which == 37)) { 776 pl.find("a[href='#" + ((e.which == 37)? "prev" : "next") + "']").click(); 777 } 778 }); 779 780 781 // Player popup 782 $(".list-global__item.has-player a.go").click(function(e) { 783 e.preventDefault(); 784 var block = $(this).closest(".has-player"); 785 displayPlayer(block.find(".list-global__title a").text(), block.data("sobj") || {}, block, block.data("rcust")); 786 }); 787 $(window).resize(function() { 788 var bp = window.blowplayer; 789 bp = bp? bp.get(0) : null; 790 if (bp) { 791 bp.maxHeight = $(window).height() * 0.7; 792 bp.resize(); 793 } 794 }); 795 796 function displayPlayer(title, scene, block, rcust) { 797 var player = $("div.js-player").first(); 798 var urlTpl = player.data("destplain"); 799 var eurl = scene.embed || ""; 800 var ppv = /\bpaidperview\.com\/video/.test(eurl); 801 var icont = player.find(".video-player__iframe-container"); 802 var scont = player.find(".video-player__src"); 803 var i, listTags, listActors, listChannel, listDownload; 804 var premBlock = player.find(".video-player__premium").hide(); 805 806 player.data("id", scene.scene_id).data("sblock", block).find("h3").text(title); 807 player.find(".video-player__right-col").toggle(showsppc); 808 809 810 var linkList = function(links, icon) { 811 var ico, item, list = []; 812 for (var x of links || []) { 813 ico = x.icon || icon; 814 ico = ico? '<i class="' + ico + '"></i>' : null; 815 item = x.link? $("<a>").attr("href", /^https?:/.test(x.link)? x.link : urlTpl.replace("/deststub", x.link)) : $("<span>"); 816 if (x.style) { 817 item.addClass(x.style); 818 } 819 list.push(item.append(ico, x.name)[0]); 820 } 821 return list; 822 }; 823 824 // Embedded via ajax 825 if (ppv) { 826 icont.find("iframe").attr("src", ""); 827 var cont = player.find(".playerbox"); 828 if (!cont.length) { 829 cont = $('<div class="playerbox"></div>').appendTo(player.find(".video-player__player")); 830 } else if (cont.data("blowplayer")) { 831 cont.data("blowplayer").destroy(); 832 } 833 onPPVConf(eurl).then(function(json) { 834 icont.hide(); 835 if (json.code) { 836 cont.text(json.message); 837 } else if (json.player) { 838 activatePlayerStream(json.player); 839 var chan = json.player.channelBanner; 840 $.extend(json.player, { share: false, height: null, maxHeight: $(window).height() * 0.7 }); 841 $blow(cont, json.player); 842 843 // Provider link 844 scont.toggle(!!chan).attr("href", json.player.channelURL);
845 scont.contents().last()[0].textContent = "Provided by " + scene.channel; 846 player.find(".video-player__src-img").toggle(!!chan).attr("href", json.player.channelURL).find("img").attr("src", chan); 847 848 // Do we have downloads? 849 if (json.downloads) { 850 var exc = body.is(".is-mobile")? /\b240p/ : /\b(360|240)p/; 851 var links = json.downloads.filter(function(x) { 852 if (x.level != "SD") { 853 var temp = (x.level == "UHD")? "4k" : "hd"; 854 x.name = '<span class="list-global__label--' + '">' + temp.toUpperCase() + '</span> ' + x.name; 855 } 856 return json.downloads.length < 2 || !exc.test(x.name); 857 }).reverse(); 858 premBlock.show().find(".video-player__download-opts").html("").append(linkList(links)); 859 } 860 } 861 }); 862 // Embedded via iframe 863 } else { 864 //if (ppv && $sppc.ab && !/[?&]hls\b/.test(eurl)) { 865 // eurl += (/\?/.test(eurl)? "&" : "?") + "hls=no"; 866 //} 867 var temp = window.preFrame? window.preFrame() : Promise.resolve(true); 868 temp.then(function() { 869 icont.show().find("iframe").attr("src", eurl); 870 scont.add(premBlock).hide(); 871 player.find(".video-player__src-img").hide(); 872 }); 873 } 874 875 876 listTags = linkList(scene.categories); 877 listChannel = linkList(scene.channel? [{ name: scene.channel, link: scene.channel_on_site? ("/" + str2url(scene.channel)) : null, style: "video-player__channel" }] : [], "ico-video"); 878 listActors = linkList(scene.actors.map(function(x) { 879 return { name: x, link: scene.on_site_actors.includes(x)? ("/" + str2url(x)) : null, style: "video-player__actor" }; 880 }), "ico-user"); 881 882 player.find(".video-player__details,.video-player__tags").children("a,span").not(".video-player__premium-btn").remove(); 883 player.find(".video-player__details").prepend(listChannel.concat(listActors)); 884 885 var cat = player.find(".video-player__tags").append(listTags); 886 var tlimit = body.hasClass("is-mobile")? 6 : 12; 887 if (listTags.length > tlimit) { 888 cat.children("a").slice(tlimit).hide(); 889 cat.append('<a href="#" class="expand">+</a>'); 890 } 891 892 var defs = $sppc.defaults; 893 var m = rcust? eurl.match(/\/(\d+)(\?|$)/) : null; 894 if (m) { 895 defs.misc1 = "X" + m[1]; 896 defs.misc2 = rcust; 897 } 898 899 // Size player 900 fixPlayerSize(); 901 902 setModal(player); 903 904 // SPPC 905 showsppc && setTimeout(function() { 906 var cids = { }; 907 var zones = (sppcType == "m")? ["m_top"] : ["d_player1", "d_player2"]; 908 if (/\bVR\b/.test(scene.categories.join(","))) { 909 cids = { d_player1: 4539, d_fwide: 4545, d_index: 4541, d_pu: 4543, d_vid: 33951, m_top: 33911, m_mid: 33921, m_foot: 33901, m_pu: 33931, m_vid: 33941 }; 910 } 911 for (var i in zones) { 912 var replace = cids[zones[i]]; 913 var merge = replace? { channe: replace, sub_id: scene.source } : { sub_id: scene.source }; 914 zones[i] = $.extend({ }, $sppc.getZone(zones[i]), merge); 915 } 916 $sppc.appendTo(player.find((sppcType == "m")? ".video-player__mobile" : ".video-player__desktop").html(""), zones); 917 defs.misc1 = defs.misc2 = null; 918 }, 10); 919 } 920 921 // Scene auto 922 $(".scene_pop div.has-player").each(function() { 923 var sc = $(this); 924 var list = sc.closest(".scene_pop"); 925 $("div.wrap div.list-videos").prepend(sc); 926 list.remove(); 927 sc.find("a.go").click(); 928 }); 929 930 if (window.location.hash) { 931 $.post('/wp-admin/admin-ajax.php', { action: 'mconf', sq: window.location.hash.substr(1) }, function(json) { 932 if (!json.code) { 933 var block = null; 934 $(".has-player").each(function() { 935 if ($(this).data('itemid') == json.scene.scene_id) { 936 block = $(this); 937 } 938 }); 939 displayPlayer(json.title, json.scene, block, json.rcust); 940 } 941 }, 'json'); 942 } 943 944 $sppc.detectAB(300).then(function(blocked) { 945 $('div[data-adch]').each(function () { 946 var ele = $(this); 947 $.ajax({ url: sppc_deliv_script(), data: { 948 ident: Math.round(1E4 * Math.random()), 949 id_site: ele.data('adsi'), 950 id_channel: ele.data('adch'), 951 ref: document.URL, 952 ck: Math.round(1E3 * Math.random()), 953 vars: { 954 site_id: ele.data('adsi'), 955 channel_id: ele.data('adch'), 956 width: 320, 957 height: 180 958 }, 959 // m_url: 'https://media.porn.com', 960 typeFormat: 'json', 961 dit: true 962 }, type: "post" }).then(function(json) { 963 if (json && json.ads && json.ads.length > 0) { 964 var ad = json.ads.shift(); 965 if (ad.click_url) { 966 var linkAttrs = { 967 href: ad.click_url, 968 rel: 'nofollow', 969 title: ad.cta 970 }; 971 if (!blocked) { 972 linkAttrs.target = '_blank'; 973 } 974 ele.append( 975 $('<div>').addClass('list-global__thumb').append( 976 $('<a>').attr(linkAttrs).append( 977 $('<picture>').append( 978 $('<source>').attr({ 979 type: 'image/webp', 980 srcset: ad.images.rectangular_16x9.webp 981 }), 982 $('<source>').attr({ 983 type: 'image/jpeg', 984 srcset: ad.images.rectangular_16x9.url 985 }), 986 $('<img>').addClass('card__img').attr({ 987 loading: 'lazy', 988 src: ad.images.rectangular_16x9.url, 989 alt: ad.cta, 990 width: 320, 991 height: 180 992 }) 993 ) 994 ) 995 ), 996 $('<div>').addClass('list-global__meta').append( 997 $('<p>').addClass('list-global__title').append( 998 $('<a>').attr(linkAttrs).text(ad.description) 999 ), 1000 $('<div>').addClass('list-global__details').append( 1001 $('<span>').append( 1002 $('<a>').attr(linkAttrs).text(ad.cta) 1003 ), 1004 $('<span>').addClass('list-global__native').text('AD') 1005 ) 1006 ), 1007 $('<img>').attr({ 1008 src: ad.impr_url, 1009 width: 1, 1010 height: 1 1011 }).css({ 1012 position: 'absolute', 1013 left: '-10000px' 1014 }) 1015 ); 1016 } 1017 } 1018 }); 1019 }); 1020 }); 1021 1022 // interstitial 1023 $(".list-videos").on("click auxclick", ".list-global__item a.inter", function(e) { 1024 e.preventDefault(); 1025 var mod = $('div.modal__interstitial'); 1026 var item = $(this).closest('.list-global__item'); 1027 var suid = item.data('suid'); 1028 var scene = item.data("sobj") || false; 1029 var ldiv = item.closest(".list-videos"); 1030 var ltype = ldiv.data("list"); 1031 mod.data("ltype", ltype || false); 1032 mod.data("itemid", item.data("itemid")); 1033 mod.data("posit", item.index(".list-global__item") + 1); 1034 mod.data("queryid", item.data("queryid")); 1035 mod.data("qpos", item.data("qpos")); 1036 mod.data("thumb", item.data("thumb")); 1037 mod.data("qmid", ldiv.data("qmid")); 1038 mod.find("a.thumb img").attr("src", item.find("picture img").first().attr("src")); 1039 if (scene) { 1040 mod.find('p.title').text(scene.title); 1041 mod.find('span.src').text(scene.source); 1042 mod.find('a.go').attr("href", scene.link); 1043 mod.find('div.sp').empty(); 1044 var zone = $sppc.getZone('inter'); 1045 var screensize = Math.min(screen.availHeight, screen.availWi
1045dth); 1046 var pageType = ($("body").is(".is-mobile") || (screensize > 10 && screensize < 520))? "m" : "d"; 1047 if (pageType == 'm') { 1048 zone.width = 900; 1049 zone.height = 1600; 1050 } else { 1051 zone.width = 1600; 1052 zone.height = 900; 1053 } 1054 $.ajax({ url: sppc_deliv_script(), data: { 1055 ident: Math.round(1E4 * Math.random()), 1056 id_site: zone.site, 1057 id_channel: zone.channel, 1058 ref: document.URL, 1059 ck: Math.round(1E3 * Math.random()), 1060 vars: { site_id: zone.site, channel_id: zone.channel }, 1061 typeFormat: 'json', 1062 dit: true, 1063 m1: 'instl', 1064 m2: scene.cc + ':PORN:' + suid 1065 }, type: "post" }).then(function(json) { 1066 if (json.ads && json.ads.length) { 1067 var ad = json.ads[0]; 1068 var atype = false; 1069 if ("type" in ad) { 1070 switch (ad.type) { 1071 case "fp_desktop_image": 1072 case "fp_mobile_image": 1073 atype = 'image'; 1074 break; 1075 case "fp_desktop_video": 1076 case "fp_mobile_video": 1077 atype = 'video'; 1078 break; 1079 case "fp_desktop_richmedia": 1080 case "fp_mobile_richmedia": 1081 atype = 'rich'; 1082 break; 1083 case "google_adsense": 1084 atype = 'fall'; 1085 break; 1086 case "vast_wrapper": 1087 atype = 'vast'; 1088 break; 1089 } 1090 } 1091 if ("vast_url" in ad) { 1092 atype = 'vast'; 1093 } 1094 if ("mp4" in ad) { 1095 atype = 'video'; 1096 } 1097 if ("content" in ad) { 1098 atype = 'rich'; 1099 } 1100 var el = false; 1101 if (atype == 'rich') { 1102 el = $(ad.content); 1103 } else if (atype == 'image') { 1104 el = $('<a>').attr({ target: "_blank", href: ad.click_url }).append( 1105 $('<picture>').append( 1106 $('<source>').attr({ srcset: ad.webp, type: "image/webp" }), 1107 $('<source>').attr({ srcset: ad.filename, type: ad.mime_type }), 1108 $('<img>').attr({ src: ad.filename, alt: "image" }) 1109 ) 1110 ); 1111 } else if (atype == 'video' || atype == 'vast') { 1112 var src = $(); 1113 if (atype == 'video') { 1114 var fmt = ['mp4', 'webm', 'ogg']; 1115 for (var x in fmt) { 1116 if (x in ad) { 1117 src.add($('<source>').attr({ 1118 src: ad[x], 1119 type: 'video/' + x 1120 })); 1121 } 1122 } 1123 } else { 1124 if ('mediaFiles' in ad) { 1125 for (var x in ad.mediaFiles) { 1126 src.add($('<source>').attr({ 1127 src: x.fileURL, 1128 type: x.mimeType 1129 })); 1130 } 1131 } 1132 } 1133 if (src.length) { 1134 el = $('<a>').attr({ target: "_blank", href: ad.click_url }).append( 1135 $('<video>').attr({ 1136 muted: "", 1137 controlsList: "nodownload", 1138 autoplay: 'autoplay', 1139 preload: 'auto', 1140 loop: '', 1141 playsinline: '' 1142 }).prop({ 1143 muted: 'muted', 1144 controlsList: 'nodownload', 1145 autoplay: 'autoplay', 1146 preload: 'auto', 1147 loop: 'loop', 1148 playsinline: 'playsinline' 1149 }).append(src) 1150 ); 1151 } 1152 } 1153 if (el) { 1154 $('div.modal__interstitial div.sp').append(el); 1155 if ("impr_url" in ad) { 1156 $('div.modal__interstitial').append( 1157 $('<img>').attr({ 1158 src: ad.impr_url, 1159 width: 1, 1160 height: 1 1161 }).css({ 1162 position: 'absolute', 1163 left: '-10000px' 1164 }) 1165 ); 1166 } 1167 var hmult = 9/16; 1168 var screensize = Math.min(screen.availHeight, screen.availWidth); 1169 if ($("body").is(".is-mobile") || (screensize > 10 && screensize < 520)) { 1170 hmult = 16/9; 1171 } 1172 $('div.modal__interstitial div.sp picture,div.sp img').css('width', Math.floor(mod.find('div.thumb-wrap').first().width()) + 'px'); 1173 $('div.modal__interstitial div.sp video,div.modal__interstitial div.sp iframe').attr({ 1174 width: Math.floor($('div.modal__interstitial div.thumb-wrap').first().width()) + 'px', 1175 height: Math.floor($('div.modal__interstitial div.thumb-wrap').first().width() * hmult) + 'px' 1176 }); 1177 } 1178 } 1179 }); 1180 setModal(mod.closest('div.modal')); 1181 var hmult = 9/16; 1182 if (pageType == 'm') { 1183 hmult = 16/9; 1184 } 1185 mod.find('div.sp picture,div.sp img').css('width', Math.floor(mod.find('div.thumb
1185-wrap').first().width()) + 'px'); 1186 mod.find('div.sp video,div.sp iframe').attr({ 1187 width: Math.floor(mod.find('div.thumb-wrap').first().width()) + 'px', 1188 height: Math.floor(mod.find('div.thumb-wrap').first().width() * hmult) + 'px' 1189 }); 1190 $("a.inter.src_" + scene.s_c).removeClass("inter").addClass("go"); 1191 $.cookie('inter_done_' + scene.s_c, 1); 1192 } 1193 1194 // Add voting widget 1195 if (!item.find(".list-global__vote").length) { 1196 var w = $('<div class="list-global__vote">' + 1197 '<a href="#up" class="list-global__vote-up"><i class="ico-thumb_up"></i></a>' + 1198 '<a href="#dn" class="list-global__vote-dn"><i class="ico-thumb_down"></i></a>' + 1199 '<a href="#x" class="list-global__vote-x"><i class="ico-close"></i></a>' + 1200 '</div>').insertBefore(item.find(".list-global__report")); 1201 } 1202 }); 1203 } 1204 onVars("$sppc", setupSPPC); 1205 onVars("exoClickAds", setupExoClick) 1206 1207 // Collapse buttons 1208 $(".btn--toggle-bio").click(function() { 1209 var ttext, ftext, link = $(this); 1210 link.closest(".body-text").toggleClass("body-text--collapsed"); 1211 if (ttext = link.data("toggletext")) { 1212 ftext = link.contents()[0]; 1213 link.data("toggletext", ftext.textContent); 1214 ftext.textContent = ttext; 1215 } 1216 }); 1217 1218 1219 $(".container-fluid__heading .btn--heading").click(function(e) { 1220 e.preventDefault(); 1221 $(this).closest(".container-fluid__content-block").toggleClass("is-collapsed"); 1222 }); 1223 1224 $.each({ ".profile__share": ".share-links", ".btn--search": ".search-page", ".btn--filter": ".filters-horizontal" }, function(i, x) { 1225 $(i).click(function(e) { 1226 e.preventDefault(); 1227 $(x).toggleClass("is-active"); 1228 }); 1229 }); 1230 1231 1232 1233 // search 1234 function setupSearch() { 1235 var form = $('.search-box__form'); 1236 $(".search-box__input").autosuggest({ 1237 source: function(response, val) { 1238 $.post('/wp-admin/admin-ajax.php', { action: 'autocomplete', sq: val, or: form.data('cf') }, function(json) { 1239 response(json, $(".search-box__results"), val); 1240 }, 'json'); 1241 }, 1242 cont: $(".search-box__results"), 1243 render: function(data, res, val) { 1244 if (data.length) { 1245 data = data[0]; 1246 } 1247 var dest = form.data('sd'); 1248 var labels = {}; 1249 labels.pornstar = form.data('trpornstar'); 1250 labels.channel = form.data('trchannel'); 1251 labels.category = form.data('trcategory'); 1252 labels.source = form.data('trsource'); 1253 labels.pics = form.data('trpics'); 1254 var blocks = ['category', 'pornstar', 'channel', 'source']; 1255 res.html(''); 1256 if (data.has_results) { 1257 for (var i = 0; i < 4; i++) { 1258 if (typeof data[blocks[i]] !== 'undefined') { 1259 res.append($('<div>').addClass('search-box__heading').text(labels[blocks[i]])); 1260 for (var j = 0; j < data[blocks[i]].length; j++) { 1261 res.append($('<a>').addClass('search-box__item').data('item', {label: data[blocks[i]][j].name}).attr('href', data[blocks[i]][j].link).attr('rel', 'nofollow').text(data[blocks[i]][j].name)); 1262 } 1263 } 1264 } 1265 res.show(); 1266 } else { 1267 res.hide(); 1268 } 1269 }, 1270 select: function(link, item) { 1271 window.location = link[0].href; 1272 $(".search-box__input").autosuggest("toggle", false); 1273 } 1274 }).closest("form").submit(function() { 1275 var search = $.trim($(".search-box__input").val()); 1276 if (!search || search.length > 100) { 1277 return false; 1278 } 1279 search = search.toLowerCase().trim(); 1280 window.location = form.data('sd').replace('sqph', encodeURIComponent(search).replace(/(%20|\s)+/g, "+")); 1281 return false; 1282 }); 1283 } 1284 if ($('.search-box__form').length) { 1285 setupSearch(); 1286 } 1287 1288 // duration sliders 1289 function setupSlider() { 1290 if (typeof noUiSlider == "undefined") { 1291 setTimeout(setupSlider, 10); 1292 } else { 1293 $(".duration-slider").each(function() { 1294 var ds = $(this).get(0); 1295 noUiSlider.create(ds, { 1296 start: [$(this).data("lval") || $(this).data("smin"), $(this).data("hval") || $(this).data("smax")], 1297 connect: true, 1298 step: 10, 1299 range: { 1300 min: $(this).data("smin"), 1301 max: $(this).data("smax") 1302 }, 1303 orientation: $(this).data("orient") 1304 }); 1305 ds.noUiSlider.on("update", function(values, handle) {
1306 var ele = $(".duration-slider"); 1307 var ll = parseInt(values[0]); 1308 var lh = parseInt(values[1]); 1309 ele.each(function() { 1310 var el = $(this); 1311 el.parent().find(".minval").text(ll); 1312 if (lh >= parseInt(el.data("smax"))) { 1313 el.parent().find(".maxval").text(lh + "+"); 1314 } else { 1315 el.parent().find(".maxval").text(lh); 1316 } 1317 }); 1318 }); 1319 ds.noUiSlider.on("end", function(values, handle) { 1320 var ele = $(".duration-slider").first(); 1321 var ll = parseInt(values[0]); 1322 var lh = parseInt(values[1]); 1323 var low_limit = parseInt(ele.data("smin")); 1324 var high_limit = parseInt(ele.data("smax")); 1325 var dest = ele.data("destnone"); 1326 if (ll != parseInt(ele.data("lval")) || lh != parseInt(ele.data("hval"))) { 1327 if (ll != low_limit && lh != high_limit) { 1328 dest = ele.data("destboth"); 1329 } else if (ll != low_limit) { 1330 dest = ele.data("destmin"); 1331 } else if (lh != high_limit) { 1332 dest = ele.data("destmax"); 1333 } 1334 window.location = dest.replace("123", ll).replace("456", lh); 1335 } 1336 }); 1337 }); 1338 } 1339 } 1340 setupSlider(); 1341 1342 $(".list-videos").on("click", ".list-global__vote a", function(e) { 1343 e.preventDefault(); 1344 var link = $(this); 1345 var item = link.closest(".list-global__item"); 1346 var act = this.hash.substring(1); 1347 1348 if (act == "x") { 1349 link.closest(".list-global__vote").remove(); 1350 } else if (link.siblings("a").length) { 1351 var body = $("body"); 1352 link.siblings("a").remove(); 1353 1354 var data = { 1355 request_id: body.data("rid"), 1356 user_id: body.data("uuid"), 1357 type_id: 5, 1358 item_id: item.data("itemid"), 1359 action: "vote", 1360 vote: (act == "up")? 1 : -1, 1361 position: item.index(".list-global__item") + 1, 1362 ref: document.referrer, 1363 url: location.pathname, 1364 thumb: item.data("thumb"), 1365 q_id: item.data("queryid"), 1366 q_pos: item.data("qpos") }; 1367 1368 $.get("/click.json", data); 1369 } 1370 }); 1371 1372 // Footer links 1373 $(".footer__heading").click(function() { 1374 $(this).parent().toggleClass("is-active"); 1375 }); 1376 1377 // Lang alert 1378 // Don't toggle visibility here because it's already handled by the global ico-close handler 1379 $(".lang-alert a[href='#x']").click(function(e) { 1380 cookieArray("sst", "langsel", "x"); 1381 }); 1382 1383 // Remember last selected lang 1384 $(".ln-list a").click(function(e) { 1385 var lang = ($(this).parent().attr("class") || "").match(/flag-([a-z]{2})/); 1386 lang && cookieArray("sst", "langsel", lang[1]); 1387 }); 1388 1389 // Favorite buttons 1390 $(".heading-primary__favorite--up").click(function(e) { 1391 e.preventDefault(); 1392 var ele = $(this); 1393 ele.toggleClass("is-active"); 1394 ele.siblings(".heading-primary__favorite--dn").removeClass("is-active"); 1395 ContentUserSettings.toggleFav(ele.data("ff"), ele.data("ft"), ele.data("fi"), ele.hasClass("is-active")); 1396 }); 1397 1398 $(".heading-primary__favorite--dn").click(function(e) { 1399 e.preventDefault(); 1400 var ele = $(this); 1401 ele.toggleClass("is-active"); 1402 ele.siblings(".heading-primary__favorite--up").removeClass("is-active"); 1403 ContentUserSettings.toggleDFav(ele.data("ff"), ele.data("ft"), ele.data("fi"), ele.hasClass("is-active")); 1404 }); 1405 1406 // cookie warning 1407 if (cookieArray("sst", "ac_c") != '1') { 1408 $('div.cookie-alert').addClass('is-active'); 1409 } 1410 1411 $('div.cookie-alert a[href="#x"]').click(function(e) { 1412 e.preventDefault(); 1413 $('div.cookie-alert').remove(); 1414 }); 1415 1416 $('div.cookie-alert a[href="#a"]').click(function(e) { 1417 e.preventDefault(); 1418 cookieArray("sst", "ac_c", '1'); 1419 $('div.cookie-alert').remove(); 1420 }); 1421 1422 $("body").on("click auxclick", "div.modal__interstitial a.go", function(e) { 1423 if (e.button != 0 && e.button != 1) { 1424 return; 1425 } 1426 var mod = $('div.modal__interstitial');
1427 var data = eventParams({ 1428 type_id: 5, 1429 item_id: mod.data("itemid"), 1430 action: "click", 1431 position: mod.data("posit"), 1432 thumb: mod.data("thumb"), 1433 q_id: mod.data("queryid"), 1434 q_pos: mod.data("qpos"), 1435 q_mid: mod.data("qmid") }); 1436 if (mod.data("ltype")) { 1437 data.list = mod.data("ltype"); 1438 } 1439 1440 $.get("/click.json", data); 1441 1442 setModal(false); 1443 }); 1444 1445 if ($('div.modal__interstitial').length && $("a.inter_n").length) { 1446 $("a.inter_n").removeClass("inter_n").removeClass("go").addClass("inter"); 1447 } 1448 1449 // Hover preview for in-site scene cards. The 1450 // data-internal attr is set by list-videos.php 1451 // when the scene passes the provider + date gate. 1452 // The <video> element ships with empty src; we 1453 // load preview.mp4 on first mouseenter so idle 1454 // listings cost zero CDN egress. Skipped on 1455 // mobile (no hover, plus would burn data). 1456 if (!body.hasClass("is-mobile")) { 1457 $(".list-videos").on( 1458 "mouseenter", 1459 ".list-global__item[data-internal]", 1460 function() { 1461 var v = this.querySelector( 1462 "video.list-global__preview" 1463 ); 1464 if (!v) return; 1465 if (!v.src) v.src = v.dataset.preview; 1466 var p = v.play(); 1467 if (p && p.catch) p.catch(function() {}); 1468 } 1469 ).on( 1470 "mouseleave", 1471 ".list-global__item[data-internal]", 1472 function() { 1473 var v = this.querySelector( 1474 "video.list-global__preview" 1475 ); 1476 if (!v) return; 1477 v.pause(); 1478 v.currentTime = 0; 1479 } 1480 ); 1481 } 1482} 1483 1484waitForRender();
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.