1// preisfuerpopkultur 3.2 | functions.js 2 3// ------------ scroll to 0 ------------ / 4window.scrollTo(0,0); 5// window.onbeforeunload = function(){ window.scrollTo(0,0); }; 6 7function doCtrl() { 8 // hi ;) 9} 10 11function onPageReady() { 12 doLog("onPageReady"); 13 getConf(); 14 initAnims(); 15 initNav(); 16 doTruncate('.text_truncate', 7); 17 initFancybox(); 18 initSvg(); 19} 20 21function onPageLoaded() { 22 doLog("onPageLoaded"); 23 initYouTube(); 24 // initFacebook("<?php echo $fbconfig['app_id']; ?>","<?php echo $fbconfig['locale']; ?>"); 25 initImageCycle(); 26 initCookieConsent(); 27} 28 29// ------------ effects ------------ // 30function hidePreloader() { 31 $("#loading-animation").fadeOut(1000); 32 $("#preloader").delay(750).fadeOut(3000, function() { $("#preloader").remove(); }); 33} 34 35function initAnims() { 36} 37 38function doAnim(elem, effect) { 39 $(elem).addClass("animated_manual_animation " + effect).one("webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend", function(){ 40 $(elem).removeClass("animated_manual_animation"); 41 $(elem).removeClass(effect); 42 }); 43 $(elem).removeClass('animated_manual'); 44} 45 46function removeAnim(elem, effect) { 47 $(elem).removeClass("animated_manual_animation"); 48 $(elem).removeClass(effect); 49 $(elem).removeClass('animated_manual'); 50} 51 52function initImageCycle() { 53 var count = 0; 54 $(".imagecycle").each(function(index) { 55 var self = this; 56 var c = count++; 57 setTimeout(function() { 58 var $elem = $(self); 59 var mysources = $elem.parent(".imageborder_holder").data("sources"); 60 if (mysources) { 61 var mysourcesArray = mysources.split(","); // console.log(mysourcesArray);
62 var currentsource = ""; 63 var i = 0; 64 var imax = mysourcesArray.length; 65 setInterval(function() { 66 i++; 67 currentsource = mysourcesArray[(i-1)]; // console.log("set src to: " + currentsource); 68 $elem.find("img").addClass("off").one("webkitTransitionEnd mozTransitionEnd MSTransitionEnd otransitionend transitionend", function(){ 69 $elem.find("img").prop("srcset","/" + base + "/media/image/" + currentsource + "_300.jpg 300w, /" + base + "/media/image/" + currentsource + "_500.jpg 500w, /" + base + "/media/image/" + currentsource + "_700.jpg 700w, /" + base + "/media/image/" + currentsource + "_1500.jpg 1500w"); 70 $elem.find("img").prop("src","/" + base + "/media/image/" + currentsource + "_500.jpg"); 71 $elem.find("img").removeClass("off"); 72 }); 73 if (i >= imax) { i = 0; } 74 }, 6000); 75 } 76 }, c * 1500); 77 }); 78 79} 80 81// ------------ inits ------------ / 82function getConf() { 83 if (device == "") { 84 // http://stackoverflow.com/questions/3514784/ 85 var ua = navigator.userAgent.toLowerCase(); 86 if (ua.match(/webos/i)) { device = "webos"; } 87 if (ua.match(/opera mini/i)) { device = "opera mini"; } 88 if (ua.match(/mobile/i)) { device = "mobile"; } 89 if (ua.match(/ipad/i)) { device = "ipad"; } 90 if (ua.match(/ipod|iphone/i)) { device = "iphone"; } 91 if (ua.match(/blackberry/i)) { device = "blackberry"; } 92 if (ua.match(/android/i)) { device = "android"; } 93 if (ua.match(/kindle/i)) { device = "kindle"; } 94 if (ua.match(/windows phone/i)) { device = "windows phone"; } 95 if (ua.match(/iemobile/i)) { device = "iemobile"; } 96 if (ua.match(/tablet/i)) { device = "tablet"; } 97 } 98 doLog("getConf() -> device: " + device); 99 if (device === "ipad" || device === "tablet") { $("#viewport_id").attr("content", "width=device-width, initial-scale=1"); } // set viewport 100 if (device !== "") { 101 $("#body_id").removeClass("desktop").addClass("device"); // set body-class, default: desktop 102 } 103} 104 105function sRefresh() { 106 // if (device == "") { window.setTimeout(function() { s.refresh(); } , 1000); } 107 Waypoint.refreshAll(); 108} 109 110// ------------ member-specials ------------ // 111function loadMember() { 112 var cooky = getCookieValue('pp_member'); 113 if (cooky) { 114 var feedback_id = "#member_feedback"; 115 var jqxhr = 116 $.ajax({ 117 dataType: "html", 118 type: "GET", 119 cache: false, 120 data: "", 121 url: "/" + base + "/member/includes/member_functions_load.php?action=load&lang=" + lang + "&country=" + country + "&device=" + device, 122 beforeSend: function () { 123 $(feedback_id).html(' <span class="icon icon-spin5 animate-spin"></span>'); 124 } 125 }) 126 .success(function(data) { $(feedback_id).empty().append(data); }) 127 .error(function(XMLHttpRequest, textStatus, errorThrown) {}) 128 .complete(function(data) {}) 129 ; 130 } 131} 132 133// ------------ load section-content ------------ // 134 135function getItems(section,type,subtype) { 136 // alert("getItems('" + section + "," + type + "," + subtype + "')"); 137 saveHistory(section,type,subtype,""); 138 var v = 0; // dummy-var 139 var jqxhr = 140 $.ajax({ 141 dataType: "html", 142 type: "GET", 143 cache: true, 144 data: "v=" + v + "§ion=" + section + "&type=" + type + "&subtype=" + subtype + "&lang=" + lang + "&device=" + device + "&country=" + country, 145 url: "/" + base + "/section_" + section + "_get_items.php", 146 beforeSend: function () { 147 $("#" + section + " ul.sub_nav li").removeClass("on"); 148 $('#' + section + "_items ul.itemlist").empty(); 149 $('#' + section + "_items .more").html('<div class="loading"><div class="icon icon-spin5 animate-spin"></div></div>'); 150 } 151 }) 152 .success(function(data) { 153 // alert("success"); 154 $("#" + section + " ul.sub_nav li.type" + type).addClass("on"); 155 $('#' + section + "_items ul.itemlist").append(data); 156 sRefresh(); // refresh waypoints + skrollr 157 }) 158 .error(function(XMLHttpRequest, textStatus, errorThrown) { 159 // alert("Error:" + XMLHttpRequest.status); 160 }) 161 .complete(function(data) { 162 // alert("complete"); 163 }) 164 ; 165} 166 167function getMoreItems(section,start,limit,type,subtype,id,modus) { 168 // alert("getMoreItems('" + section + "," + start + "," + limit + "," + type + "," + subtype + "," + id + "," + modus + "')"); 169 var v = 0; // dummy-var 170 if (start < 0) { start = 0; } 171 var jqxhr =
172 $.ajax({ 173 dataType: "html", 174 type: "GET", 175 cache: true, 176 data: "v=" + v + "§ion=" + section + "&start=" + start + "&limit=" + limit + "&type=" + type + "&subtype=" + subtype + "&id=" + id + "&lang=" + lang + "&device=" + device + "&country=" + country, 177 url: "/" + base + "/section_" + section + "_get_items.php", 178 beforeSend: function () { 179 $('#' + section + "_items .more").html('<div class="loading"><div class="icon icon-spin5 animate-spin"></div></div>'); 180 } 181 }) 182 .success(function(data) { 183 // alert("success"); 184 if (modus == 'clear') { 185 $('#' + section + "_items ul.itemlist").empty().append(data); 186 } else { 187 $('#' + section + "_items ul.itemlist").append(data); 188 } 189 sRefresh(); // refresh waypoints + skrollr 190 }) 191 .error(function(XMLHttpRequest, textStatus, errorThrown) { 192 // alert("Error:" + XMLHttpRequest.status); 193 }) 194 .complete(function(data) { 195 // alert("complete"); 196 }) 197 ; 198} 199 200function getItem(section,type,subtype,id,autoplay) { 201 // alert("getItem(" + section + "," + type + "," + subtype + "," + id + "," + autoplay + ")"); 202 saveHistory(section,type,subtype,id); 203 var ausdruck = /^(\d*)?$/; // \d = digit, \w = word, ? = egal wievielmal vorher (zb. egal wieviel buchstaben) 204 if (ausdruck.exec(id)) { 205 // alert("valid request ->\n id:" + RegExp.$1); 206 var id = RegExp.$1; 207 var feedback_id = "#" + section + "_container"; 208 var jqxhr = 209 $.ajax({ 210 dataType: "html", 211 type: "GET", 212 cache: true, 213 data: "type=" + type + "&subtype=" + subtype + "&id=" + id + "&autoplay=" + autoplay + "&lang=" + lang + "&device=" + device + "&country=" + country, 214 url: '/' + base + '/' + section + '_get_item.php', 215 beforeSend: function () { 216 $("#" + section + " ul.sub_nav li").removeClass("on"); 217 $("#" + section + "_holder").slideDown(1000); 218 $("#" + section + "_title").empty().append("Loading..."); 219 $(feedback_id).html('<div class="loading"><div class="icon icon-spin5 animate-spin"></div></div>'); 220 } 221 }) 222 .success(function(data) { 223 // alert("success"); 224 $("#" + section + " ul.sub_nav li.type" + type).addClass("on"); 225 $(feedback_id).empty().append(data); 226 }) 227 .error(function(XMLHttpRequest, textStatus, errorThrown) { 228 // alert("Error:" + XMLHttpRequest.status); 229 }) 230 .complete(function(data) { 231 // alert("complete"); 232 }) 233 ; 234 } else { 235 alert("invalid request"); 236 } 237} 238 239function setItem(section, id, txt) { 240 // alert("setItem(" + section + "," + id + "," + txt + ")"); 241 if (section === "video") { 242 $('#video_title').empty().append(urldecode(txt)); 243 $('.videothumbs ul li').removeClass('on'); 244 $('#video_btn_' + id).addClass('on'); 245 } 246} 247 248 249// ------------ teaser ------------ // 250function initTeaser() { 251 $('.slides').cycle({ 252 slides: ".slide", 253 timeout: 0, 254 swipe: true, 255 fx: "scrollHorz", 256 prev: '#slides_nav_prev', 257 next: '#slides_nav_next', 258 pager: '#slides_pager' 259 }); 260 $('.slides').on('cycle-before', function(event, optionHash, outgoingSlideEl, incomingSlideEl, forwardFlag) { 261 $("#teaser .videoborder iframe").each(function(index) { 262 var tmp_src = $(this).attr("src"); 263 if (tmp_src.search(/.youtu/i) > 0) { 264 stopYTVideo($(this).attr("id")); 265 } 266 }); 267 }); 268} 269 270function skipTeaser(event) { 271 var next_section = $(event.target).parents().find('.section').next().attr("id"); // console.log(next_section); 272 doShow(next_section,'','','',0); 273} 274 275function getTeaserVideo(feedback_id,id) { 276 // alert("getTeaserVideo(" + feedback_id + "," + id + ")"); 277 var ausdruck = /^(\d*)?$/; // \d = digit, \w = word, ? = egal wievielmal vorher (zb. egal wieviel buchstaben) 278 if (ausdruck.exec(id)) { 279 // alert("valid request ->\n id:" + RegExp.$1); 280 id = RegExp.$1; 281 var jqxhr = 282 $.ajax({ 283 dataType: "html", 284 type: "GET", 285 cache: false, 286 data: "id=" + id + "&country=" + country + "&device=" + device, 287 url: '/' + base + '/home_teaser_get_video.php', 288 beforeSend: function () { 289 $(feedback_id).html('<div class="loading"><div class="icon icon-spin5 animate-spin"></div></div>'); 290 } 291 }) 292 .success(function(data) { 293 $(feedback_id).empty().append(data); 294 }) 295 .error(function(XMLHttpRequest, textStatus, errorThrown) { 296 // alert("Error:" + XMLHttpRequest.status); 297 }) 298 .complete(function(data) { 299 // alert("complete"); 300 }) 301 ; 302 } else { 303 alert("invalid request"); 304 } 305} 306 307// ------------------------ youtube ------------------------ // 308function initYouTube() { 309 var tag = document.createElement('script'); 310 tag.src = "https://www.youtube.com/iframe_api"; 311 var firstScriptTag = document.getElementsByTagName('script')[0]; 312 firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); 313} 314var ytApiKey = "AIzaSyBiYOXVYHnSaIHec43Ixj-GaIrF84UR9bQ"; 315function onYTPlayerRendered(iframe_id) { 316 if (typeof(YT) != "undefined") { 317 doLog("video: yt-api ready"); 318 if (iframe_id == "undefined" || iframe_id == ""|| iframe_id == null) { 319 iframe_id = "videoiframe"; 320 } 321 if (document.getElementById(iframe_id)) { 322 doLog("video: rendered"); 323 var tmp_player = new YT.Player(iframe_id, { events: { 'onReady': onYTPlayerReady, 'onStateChange': onYTPlayerStateChange } }); 324 } 325 } else { 326 doLog("video: yt-api not ready"); 327 } 328} 329function onYTPlayerReady(event) { 330 var tmp_id = ""; 331 var obj = event.target; 332 for (var key in obj) { 333 if (Object.prototype.hasOwnProperty.call(obj, key)) { // http://stackoverflow.com/questions/7306669/ 334 var val = obj[key]; 335 if (val.nodeName === "IFRAME") { 336 tmp_id = urldecode(val.id); // eg.: "video_playlist_PLpEG-NdxDo_uucxo-LKxaXbuZfCScOSlX"; 337 doLog("video: ready, id: " + tmp_id); 338 if (tmp_id.indexOf("playlist") !== -1) { 339 var reg = /video_playlist_(.*)/; 340 var res = reg.exec(tmp_id); 341 if (Array.isArray(res)) { 342 var ytPlaylist = res[1]; 343 doLog("video: playlist detected: " + ytPlaylist); 344 getYTPlaylist(ytPlaylist,tmp_id); 345 } 346 } 347 break; 348 } 349 } 350 } 351} 352function onYTPlayerStateChange(event) { 353 var tmp_id = ""; 354 var tmp_title = ""; 355 var obj = event.target; 356 for (var key in obj) { 357 if (Object.prototype.hasOwnProperty.call(obj, key)) { 358 var val = obj[key]; 359 if (val.nodeName === "IFRAME") { 360 tmp_id = urldecode(val.id); 361 tmp_title = YT.get(tmp_id).getVideoData().title; 362 doLog("onYTPlayerStateChange, " + tmp_id + ", " + tmp_title); 363 switch (event.data) { 364 case -1: 365 doLog("video: unstarted (" + tmp_title + ")"); 366 if (tmp_id.indexOf("playlist") !== -1) { 367 updateYTVideoNav(tmp_id); 368 } 369 break; 370 case 0: 371 doTrack('video','complete',tmp_title); 372 break; 373 case 1: 374 doTrack('video','start',tmp_title); 375 break; 376 case 2: 377 doTrack('video','pause',tmp_title); 378 break; 379 case 3: 380 doLog("video: buffering (" + tmp_title + ")"); 381 break; 382 case 5: 383 doLog("video: cued (" + tmp_title + ")"); 384 break; 385 default: 386 break; 387 } 388 break; 389 } 390 } 391 } 392} 393var ytPlaylistIDs, ytPlaylistTitles, ytPlaylistPos, ytPlaylistSize; 394function getYTPlaylist(list,iframe_id) { 395 var playListURL = "https://www.googleapis.com/youtube/v3/playlistItems?maxResults=30&part=snippet&playlistId=" + list
395+ "&key=" + ytApiKey; 396 ytPlaylistIDs = new Array(); 397 ytPlaylistTitles = new Array(); 398 ytPlaylistPos = 0; 399 ytPlaylistSize = 0; 400 $.get(playListURL,function(data) { 401 ytPlaylistSize = data.items.length; 402 $.each(data.items, function(i, item) { 403 ytPlaylistIDs.push(item.snippet.resourceId.videoId); 404 ytPlaylistTitles.push(item.snippet.title); 405 }); 406 // console.log(ytPlaylistIDs); // console.log(ytPlaylistTitles); 407 updateYTVideoNav(iframe_id); 408 if (ytPlaylistIDs.length > 1) { 409 $("#video .video_nav_holder").slideDown("slow",function() { sRefresh(); }); 410 } 411 }); 412} 413function updateYTVideoNav(iframe_id) { 414 ytPlaylistPos = YT.get(iframe_id).getPlaylistIndex(); 415 // doLog("updateYTVideoNav(" + iframe_id + ") -> ytPlaylistPos: " + ytPlaylistPos); 416 $("#video .video_nav_prev a").attr("onClick","previousYTVideo('" + iframe_id + "')"); 417 $("#video .video_nav_next a").attr("onClick","nextYTVideo('" + iframe_id + "')"); 418 $("#video .video_title").html(ytPlaylistTitles[ytPlaylistPos]); 419 var ytPlaylistPosDisplay = ytPlaylistPos + 1; 420 if (ytPlaylistPosDisplay < 10) { ytPlaylistPosDisplay = "0" + ytPlaylistPosDisplay; } 421 var ytPlaylistSizeDisplay = ytPlaylistSize; 422 if (ytPlaylistSizeDisplay < 10) { ytPlaylistSizeDisplay = "0" + ytPlaylistSizeDisplay; } 423 $("#video .video_nav .video_nav_counter").html(ytPlaylistPosDisplay + " / " + ytPlaylistSizeDisplay); 424} 425function playYTVideo(iframe_id) { 426 YT.get(iframe_id).playVideo(); 427} 428function pauseYTVideo(iframe_id) { 429 YT.get(iframe_id).pauseVideo(); 430} 431function stopYTVideo(iframe_id) { 432 YT.get(iframe_id).stopVideo(); 433} 434function previousYTVideo(iframe_id) { 435 YT.get(iframe_id).previousVideo(); 436} 437function nextYTVideo(iframe_id) { 438 YT.get(iframe_id).nextVideo(); 439} 440 441// ------------ bg-video ------------ // 442function load_bg_video(src,id) { 443 var txt = ""; 444 if (device == "" || device == "ipad" || device == "tablet") { 445 // set bg_video (without sound: muted volume=\"0\" ) 446 txt += "<video id=\"bg_video" + id + "\" class=\"bg_video bg_video_off\" preload=\"auto\" autoplay loop muted volume=\"0\" onCanPlay=\"show_bg_video('bg_video" + id + "');\">"; 447 txt += "<source src=\"" + src + "\" type=\"video/mp4\">"; 448 txt += "</video>"; 449 txt += "<div class='fg_video'></div>"; 450 $("#bg_video_holder" + id).html(txt); 451 } 452} 453 454function show_bg_video(id) { 455 if ($("#" + id).hasClass("bg_video_off")) { 456 doLog("show_bg_video(" + id + ")"); 457 resize_bg_video(); 458 $("#" + id).removeClass("bg_video_off"); 459 $("#" + id).addClass("bg_video_on"); 460 } 461} 462 463function resize_bg_video() { 464 $(".bg_video_holder").each(function(){ 465 var e=$(this).width(),t=$(this).height(),n=1280,r=720,i=n/r,s=$(this).find(".bg_video"),o,u,a,f,l; 466 if(e/t>=i){o=e;u=Math.floor(e/n*r);a=0;f=Math.floor((t-u)/2)} 467 else if(e/t<i){u=t;o=Math.floor(t/r*n);a=Math.floor((e-o)/2);f=0} 468 s.css({width:o,height:u,marginLeft:a,marginTop:f})} 469 ) 470} 471 472function toggle_bg_video() { 473 /* 474 var video = document.getElementById('bg_video_main'); 475 if (bgVideo) { 476 $(".bg_video_ctrl").removeClass("bg_video_ctrl_on"); 477 if (video) { video.pause(); } 478 $(".bg_video_holder").hide(); 479 bgVideo = false; 480 } else { 481 $(".bg_video_ctrl").addClass("bg_video_ctrl_on"); 482 if (video) { video.play(); } 483 $(".bg_video_holder").show(); 484 bgVideo = true; 485 } 486 */ 487} 488 489 490// ------------------------ audio ------------------------ // 491 492var playlist; 493var playlist_pos = -1; 494var play_modus = "manual"; 495var oldTrack = null; 496 497function playTrack(id) { 498 // alert("playTrack(" + id + "), oldTrack: " + oldTrack); 499 var audio = document.querySelector("AUDIO"); // document.getElementById("audioplayer"); 500 id = parseInt(id); 501 playlist_pos = $.inArray(id, playlist); 502 doLog("playTrack(" + id + "), my playlist_pos:" + playlist_pos); 503 if (oldTrack === id) { 504 if (audio.paused) { 505 doPlay(); 506 } else { 507 doPause(); 508 } 509 } else { 510 audio.addEventListener("timeupdate", progressBar, true); 511 var trackname = $("#track"+ id).data("trackname"); 512 $(".track").removeClass("track_on"); 513 $(".track .playback_icon").html("<div class='icon icon-play'></div>"); 514 $(".track .track_progress").css("width","0%"); 515 $("#track"+ id).addClass("track_on"); 516 $("#track"+ id + " .playback_icon").html("<div class='icon icon-spin5 animate-spin'></div>"); 517 oldTrack = id; 518 audio.src = $("#track"+ id).data("src"); 519 audio.load(); 520 } 521} 522 523function canPlay() { 524 if (play_modus === "auto" || play_modus === "manual") { 525 doPlay(); 526 } else { 527 doPause(); 528 } 529} 530 531function doPlay() { 532 var audio = document.querySelector("AUDIO"); 533 audio.play(); 534 $("#track"+ oldTrack + " .playback_icon").html("<div class='icon icon-pause'></div>"); 535 doTrack('audio','start',$("#track"+ oldTrack).data("trackname"));
536} 537 538function doPause() { 539 var audio = document.querySelector("AUDIO"); 540 if (!audio.ended) { 541 doTrack('audio','pause',$("#track"+ oldTrack).data("trackname")); 542 } 543 if (audio.ended) { 544 $("#track"+ oldTrack + " .track_progress").css("width", "0%"); 545 doTrack('audio','complete',$("#track"+ oldTrack).data("trackname")); 546 } 547 audio.pause(); 548 $("#track"+ oldTrack + " .playback_icon").html("<div class='icon icon-play'></div>"); 549} 550 551function playPause() { 552 var audio = document.querySelector("AUDIO"); 553 if (audio.paused) { 554 doPlay(); 555 } else { 556 doPause(); 557 } 558} 559 560function playNext() { 561 doLog("playNext(), playlist.length:" + playlist.length + ", playlist_pos:" + playlist_pos); 562 if (play_modus === "auto") { 563 playlist_pos++; 564 if (playlist_pos < playlist.length) { 565 var next_id = playlist[playlist_pos]; 566 doLog("next_id: " + next_id + ", playlist_pos:" + playlist_pos); 567 playTrack(next_id); 568 } else { 569 playlist_pos = -1; 570 doLog("playlist end"); 571 doPause(); 572 } 573 } else { 574 doPause(); 575 } 576} 577 578function progressBar() { 579 var oAudio = document.getElementById('audioplayer'); 580 var elapsedTime = Math.round(oAudio.currentTime); // get current time in seconds 581 var w = (elapsedTime / oAudio.duration) * 100; // update the progress bar 582 if (w >= 0 && w <= 100) { 583 // doLog("audio-progress: " + w); 584 $("#track"+ oldTrack + " .track_progress").css("width", w + "%"); 585 } 586} 587 588function doShow(section,type,subtype,id,autoplay) { 589 // alert("doShow(" + section + "," + type + "," + subtype + "," + id + "," + autoplay + ")"); 590 /* type = parseInt(type);subtype = parseInt(subtype);id = parseInt(id);autoplay = parseInt(autoplay); */ 591 var ausdruck = /^(\w*)?$/; // \d = digit, \w = word, ? = egal wievielmal vorher (zb. egal wieviel buchstaben) 592 if ($(".header_norm").css("display") == "none") { 593 var yOffset = -1 * $(".header_compact").height(); 594 } 595 if (ausdruck.exec(id) && id != "" && id != 0 && id != undefined && id != null) { 596 // prio 1: id 597 var tmp_id = RegExp.$1; 598 doLog("id detected: " + tmp_id); 599 var tmp_type = ""; 600 if (ausdruck.exec(type) && type != "" && type != 0 && type != undefined && type != null) { 601 var tmp_type = RegExp.$1; 602 doLog("type detected: " + tmp_type); 603 } 604 if (hist[section]["type"] != tmp_type) { 605 getItems(section,tmp_type,subtype); // only reload items if type changes 606 } 607 getItem(section,tmp_type,subtype,tmp_id,autoplay); 608 section = section + "_scroll"; // scrollpoint 609 yOffset -= 20; 610 } else { 611 if (ausdruck.exec(subtype) && subtype != "" && subtype != 0 && subtype != undefined && subtype != null) { 612 // prio 2: subtype 613 var tmp_subtype = RegExp.$1; 614 doLog("subtype detected: " + tmp_subtype); 615 if (hist[section]["type"] != type) { 616 getItems(section,type,tmp_subtype); // only reload items if type changes 617 } 618 getItem(section,type,tmp_subtype,id,autoplay); 619 section = section + "_scroll"; // scrollpoint 620 yOffset -= 20; 621 } else { 622 // prio 3: type 623 if (ausdruck.exec(type) && type != "" && type != 0 && type != undefined && type != null) { 624 var tmp_type = RegExp.$1; 625 doLog("type detected: " + tmp_type); 626 $("#" + section + "_holder").slideUp("fast"); 627 $("#" + section + "_holder ." + section + "_container").empty(); 628 getItems(section,tmp_type,subtype); 629 } 630 } 631 } 632 $.scrollTo("#" + section, 1000, { 633 axis: "y", 634 offset: yOffset, 635 easing: "easeOutQuad", 636 onAfter: function () { 637 } 638 }); 639} 640 641 642// ------------------------ winner ------------------------ // 643 644function selectWinner(type) { 645 var feedback_id = "winners_holder"; 646 var jqxhr = 647 $.ajax({ 648 dataType: "html", 649 type: "GET", 650 cache: false, 651 data: "type=" + type, 652 url: "/" + base + "/winner_get_winners.php", 653 beforeSend: function () { 654 $("#" + feedback_id).show().html('<div class="loading"><div class="icon icon-spin5 animate-spin"></div></div>'); 655 } 656 }) 657 .success(function(data) { 658 $("#" + feedback_id).empty().append(data); 659 }) 660 ; 661 662 $("ul.cat li").removeClass("on"); 663 $("ul.cat #type" + type).addClass("on"); 664 665 $.scrollTo("#winners_holder", 1000, { 666 axis: "y", 667 offset: -100, 668 easing: "easeOutQuad", 669 onAfter: function () { 670 } 671 }); 672} 673 674 675// ------------------------ press_signup ------------------------ // 676 677function press_signup(){ 678 679 // check input: 680 // press_signup_email_id 681 if (!checkInput("press_signup_email_id", "Email")) { return false; } 682 if (!validateEmail($("#press_signup_email_id").val())) { 683 doWarn("press_signup_email_id","Die Email ist ungültig."); 684 return false; 685 } 686 if (!checkInput("press_signup_firstname_id", "Vorname")) { return false; } 687 if (!checkInput("press_signup_surname_id", "Nachname")) { return false; } 688 if (!checkInput("press_signup_company_id", "Unternehmen")) { return false; } 689 if (!checkInput("press_signup_position_id", "Position")) { return false; } 690 if (!checkInput("press_signup_city_id", "Stadt")) { return false; } 691 if (!checkInput("press_signup_country_id", "Land")) { return false; } 692 if (!checkInput("press_signup_question_id", "Bitte vervollständigen: Preis für ...")) { return false; } 693 694 695 // no errors -> submit: 696 document.getElementById("press_signup_submit_id").disabled = true; 697 document.getElementById("press_signup_submit_id").value = 'Bitte warten...'; 698 699 var feedback_id = "#press_signup_feedback"; 700 var jqxhr =
701 $.ajax({ 702 dataType: "html", 703 type: "POST", 704 cache: false, 705 data: $("#press_signup_form_id").serialize(), 706 url: "/" + base + '/member/includes/reciever.php', 707 beforeSend: function () { 708 $(feedback_id).html('<div class="loading"><div class="icon icon-spin5 animate-spin"></div></div>'); 709 } 710 }) 711 .success(function(data) { 712 // alert("success"); 713 $(feedback_id).empty().append(data); 714 document.getElementById("press_signup_submit_id").disabled = false; 715 document.getElementById("press_signup_submit_id").value = 'Abschicken'; 716 }) 717 .error(function(XMLHttpRequest, textStatus, errorThrown) { 718 // alert("Error:" + XMLHttpRequest.status); 719 document.getElementById("press_signup_submit_id").disabled = false; 720 document.getElementById("press_signup_submit_id").value = 'Abschicken'; 721 }) 722 .complete(function(data) { 723 // alert("complete"); 724 }) 725 ; 726 return false; 727} 728 729 730 731// ------------------------ form-validation ------------------------ // 732 733function validateEmail(email) { 734 var exp = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; 735 return exp.test(email); 736} 737 738function doWarn(id,txt) { 739 // alert("doWarn(" + id + "," + txt + ")"); 740 $("#"+id).addClass("warning"); 741 $("label[for='"+ id +"']").html("<span class='icon icon-attention'></span> " + txt); 742 $("label[for='"+ id +"']").addClass("warning"); 743 $("#"+id).disabled = false; 744 $("#"+id).focus(); 745 $.scrollTo("#"+id, 1000, { 746 axis: "y", 747 offset: -100, 748 easing: "easeOutQuad", 749 onAfter: function () { 750 } 751 }); 752 setTimeout(resetFormWarnings, 7000); 753} 754 755function resetFormWarnings() { 756 $("form .text").removeClass("warning"); 757 $("form label").removeClass("warning"); 758 $("form label").each(function(index) { 759 var myText = $(this).attr('data-text'); 760 if (myText !== undefined) { 761 $(this).text(myText); 762 } 763 }); 764} 765 766function checkInput(id, title, allow_empty) { 767 input = $("#" + id); 768 if (allow_empty === undefined) { allow_empty = false; } 769 if (allow_empty == false) { 770 if (input.val() === "" || input.val().length < 2) { 771 doWarn(id, title + " fehlt oder ist zu kurz."); 772 return false; 773 } 774 } 775 var zeichen ="/;:<>"; 776 var eingabe = input.val(); 777 var laenge = eingabe.length; 778 for(i=0; i<laenge; i++) { 779 badchar = eingabe.charAt(i); 780 if (zeichen.indexOf(badchar)>-1) { 781 doWarn(id, title + " enthält ungültige Zeichen."); 782 return false; 783 } 784 } 785 return true; 786} 787 788function checkText(id, title, allow_empty) { 789 input = $("#" + id); 790 if (allow_empty === undefined) { allow_empty = false; } 791 if (allow_empty == false) { 792 if (input.val() === "" || input.val().length < 24) { 793 doWarn(id, title + " fehlt oder ist zu kurz."); 794 return false; 795 } 796 } 797 return true; 798} 799 800function checkUrl(id, title, allow_empty) { 801 input = $("#" + id); 802 if (allow_empty === undefined) { allow_empty = false; } 803 if (allow_empty == false) { 804 if (input.val() === "" || input.val().length < 2) { 805 doWarn(id, title + " fehlt oder ist zu kurz."); 806 return false; 807 } 808 } 809 var zeichen = ";<>"; 810 var eingabe = input.val(); 811 var laenge = eingabe.length; 812 for(i=0; i<laenge; i++) { 813 badchar = eingabe.charAt(i); 814 if (zeichen.indexOf(badchar)>-1) { 815 doWarn(id, title + " enthält ungültige Zeichen."); 816 return false; 817 } 818 } 819 if (eingabe !== "") { 820 if (eingabe.indexOf("http") !== 0) { 821 doWarn(id, title + " muss mit http oder https beginnen."); 822 return false; 823 } 824 } 825 return true; 826} 827 828 829// ------------ standard functions ------------ // 830 831var resized; 832 833function initResize() { 834 $(window).on('resize orientationChanged', function(){ 835 clearTimeout(resized); 836 resized = setTimeout(onResize, 150); 837 }); 838} 839 840function onResize() { 841 // adapt teaser-size 842 var slides_pager_h = 0; // pfpk -> slider-navigation -> display:none 843 if ($(".header_norm").css("display") === "block") { 844 h = $(window).height() - $('.header_norm').height(); 845 } else {
846 if ($(".header_compact").css("top") !== "-200px") { 847 h = $(window).height() - $('.header_compact').height(); 848 } 849 } 850 var min_h = slides_pager_h; 851 $("#teaser .description").each(function(){ 852 var th = $(this).innerHeight(); 853 if (th > min_h) { min_h = th; } 854 }); 855 min_h += 100; // + "continue"-button 856 if (h >= min_h) { 857 $('#teaser').css({ height: h }); 858 $('#teaser .slides').css({ height: (h - slides_pager_h) }); 859 } else { 860 $('#teaser').css({ height: (min_h + slides_pager_h) }); 861 $('#teaser .slides').css({ height: min_h }); 862 } 863 // resize video 864 if (device === "") { 865 resize_bg_video(); 866 } 867} 868 869var myMsgTimer; 870 871function doMsg(txt,timeout) { 872 clearTimeout(myMsgTimer); 873 $("#msg").stop(true, true); 874 $("#msg").slideUp("fast", function() { 875 $("#msg .content").html(urldecode(txt)); 876 877 $("#msg").slideDown('fast', function() { 878 if ($("#msg .content").html() != "") { 879 removeAnim("#msg", "flash"); 880 doAnim("#msg", "flash"); 881 } 882 }); 883 if (!isNaN(timeout)) { 884 myMsgTimer = setTimeout(function(){ 885 closeMsg(); 886 }, timeout); 887 } 888 }); 889} 890 891function closeMsg() { 892 if (window.jQuery) { 893 $("#msg").slideUp("fast", function() { $("#msg .content").empty(); }); 894 } else { 895 document.getElementById('msg').children[0].innerHTML='';document.getElementById('msg').style.display='none'; 896 } 897} 898 899function setShare(id, url, title) { 900 var txt = ''; 901 txt += '<div class="share_tools" data-url="' + url + '" data-title="' + title + '">'; 902 txt += '<a class="share_facebook" href="#" onclick="doShare(event,\'facebook\');return false;" title="Share on facebook"><span class="icon icon-facebook"></span></a>'; 903 txt += '<a class="share_twitter" href="#" onclick="doShare(event,\'twitter\');return false;" title="Tweet"><span class="icon icon-twitter"></span></a>'; 904 txt += '<a class="share_email" href="#" onclick="doShare(event,\'email\');" title="Share via email"><span class="icon icon icon-mail"></span></a>'; 905 txt += '<a class="share_whatsapp" href="#" onclick="doShare(event,\'whatsapp\');" title="Share with whatsapp"><span class="icon icon-whatsapp"></span></a>'; 906 txt += '</div>'; 907 $('#' + id).empty().append(txt); 908} 909 910function doShare(event, network) { 911 // doMsg("doShare(" + network + ")");console.log("event:");console.log(event); 912 var share_el,share_container,url,title,share_window; 913 // get data-url & data-title from parent div.share_tools 914 if (event.target.parentNode.className == "share_tools") { 915 // old safari 916 share_el = event.target; 917 share_container = event.target.parentNode; 918 } else { 919 share_el = event.target.parentNode; 920 share_container = event.target.parentNode.parentNode; 921 } 922 // console.log("share_container:");console.log(share_container); 923 url = share_container.dataset.url; 924 title = share_container.dataset.title; 925 // console.log("data:");console.log(url);console.log(urldecode(title));doMsg("url: " + urldecode(url) + "<br>title: " + urldecode(title)); 926 doTrack('share', network, urldecode(url)); 927 switch(network) { 928 case "facebook": 929 share_window = window.open("https://www.facebook.com/sharer/sharer.php?u=" + url,"share_window","width=600,height=450,status=no,location=no,scrollbars=no,resizable=yes"); 930 share_window.focus(); 931 break; 932 case "twitter": 933 title = urldecode(title); 934 title = encodeURIComponent(title); 935 url = urldecode(url); 936 $(window).bind("message", function(event) { event = event.originalEvent; if (event.source == share_window && event.data != "__ready__") { doLog("tweet successful"); } }); 937 share_window = window.open("https://twitter.com/intent/tweet?url=" + url + "&text=" + title + "&hashtags=","share_window","width=600,height=500,status=no,location=no,scrollbars=no,resizable=yes"); 938 share_window.focus(); 939 break; 940 case "email": 941 title = urldecode(title); 942 title = encodeURIComponent(title); 943 url = urldecode(url); 944 url = encodeURIComponent(url); 945 share_el.href = "mailto:?subject=" + title + "&body=" + url; 946 break; 947 case "whatsapp": 948 share_el.href = "whatsapp://send?text=" + title + encodeURIComponent(": ") + url; 949 break; 950 default: 951 break; 952 } 953} 954 955function toggleTab(nr) { 956 $(".tabs .tabheader li").removeClass("on"); 957 $(".tabs .tab").slideUp("fast"); 958 setTimeout(function() { 959 $(".tabs .tabheader li.tab" + nr + "toggle").addClass("on"); 960 $(".tabs .tab" + nr).slideDown("slow", function() {}); 961 }, 400); 962} 963 964function doAccordion(el_class,el) { 965 if ($("#" + el + " .item_content").css("display") === "block") { 966 $("#" + el + " .item_content").slideUp("fast"); 967 $("#" + el).removeClass("item_on"); 968 } else { 969 $("." + el_class + " .item_content").slideUp("fast"); 970 $("." + el_class).removeClass("item_on"); 971 $('#' + el).addClass("item_on"); 972 setTimeout(function() { 973 $("#" + el + " .item_content").slideDown("slow", function() {}); 974 }, 400); 975 } 976} 977 978function toggleMenu() { 979 if ($("#body_id").hasClass("menu_on")) { 980 $("#body_id").removeClass("menu_on"); 981 } else { 982 $("#body_id").addClass("menu_on"); 983 } 984} 985 986function initFacebook(app_id,locale) { 987 var s = "script"; 988 var id = "facebook-jssdk"; 989 var js, fjs = document.getElementsByTagName(s)[0]; 990 if (document.getElementById(id)) return; 991 js = document.createElement(s); js.id = id; 992 js.src = "https://connect.facebook.net/" + locale + "/sdk.js#xfbml=1&version=v2.3&appId=" + app_id; 993 fjs.parentNode.insertBefore(js, fjs); 994} 995 996function doScroll(el) { 997 yOffset = -1 * $(".header_compact").outerHeight();
998 if ($(".header_compact").css("top") != "0px") { 999 yOffset = -1 * $(".header_norm").outerHeight(); 1000 } 1001 yOffset -= 20; 1002 $.scrollTo(el, 1500, { 1003 axis: "y", 1004 offset: yOffset, 1005 easing: "easeOutQuad", 1006 onAfter: function () { 1007 } 1008 }); 1009} 1010 1011function initNav() { 1012 if ($("#body_id").hasClass("popup") === false) { 1013 var waypoint = new Waypoint({ 1014 element: $('#header_bottom'), 1015 handler: function(direction) { 1016 // console.log('Scrolled to #header_bottom, Direction: ' + direction); 1017 if (direction === 'up'){ 1018 $("#body_id").removeClass("compact"); 1019 } 1020 if (direction === 'down'){ 1021 $("#body_id").addClass("compact"); 1022 } 1023 }, 1024 offset: 0 1025 }); 1026 } 1027} 1028 1029function initFancybox() { 1030 var mar; 1031 if (window.screen.width < 580) { mar = [70, 20, 145, 20]; } else { mar = [70, 70, 145, 70]; } 1032 $(".fancybox_share").fancybox({ 1033 margin : mar, 1034 padding : 1, 1035 openEffect : 'elastic', 1036 prevEffect : 'elastic', 1037 nextEffect : 'elastic', 1038 closeEffect : 'elastic', 1039 tpl : { 1040 closeBtn: '<a title="close" class="fancybox-item fancybox-close" href="javascript:;"><span class="icon icon-cancel-circled"></span></a>', 1041 next : '<a title="next" class="fancybox-nav fancybox-next" href="javascript:;"><span class="icon icon-angle-circled-right"></span></a>', 1042 prev : '<a title="previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span class="icon icon-angle-circled-left"></span></a>' 1043 }, 1044 beforeShow: function () { 1045 // add infos 1046 this.title += urldecode($(this.element).closest(".data_source").attr('data-infos')); 1047 // add share-options 1048 var share_url = $(this.element).closest(".data_source").attr('data-share_url'); 1049 var share_title = urldecode($(this.element).closest(".data_source").attr('data-share_title')); 1050 if (share_url && share_title) { 1051 // this.title += '<input value="' + share_url + '" type="text" class="text" />'; 1052 this.title += '<div class="share_tools_big"><div class="share_tools" data-url="' + share_url + '" data-title="' + share_title + '">'; 1053 this.title += '<a class="share_facebook" href="#" onclick="doShare(event,\'facebook\');return false;" title="Share on facebook"><span class="icon icon-facebook"></span></a>'; 1054 this.title += '<a class="share_twitter" href="#" onclick="doShare(event,\'twitter\');return false;" title="Tweet"><span class="icon icon-twitter"></span></a>'; 1055 this.title += '<a class="share_email" href="#" onclick="doShare(event,\'email\');" title="Share via email"><span class="icon icon icon-mail"></span></a>'; 1056 this.title += '<a class="share_whatsapp" href="#" onclick="doShare(event,\'whatsapp\');" title="Share with whatsapp"><span class="icon icon-whatsapp"></span></a>'; 1057 this.title += '</div></div>'; 1058 } 1059 }, 1060 afterShow: function() { 1061 // 1062 } 1063 }); 1064 if (window.screen.width < 580) { mar = [70, 20, 70, 20]; } else { mar = 70; } 1065 $(".fancybox").fancybox({ 1066 margin : mar, 1067 padding : 1, 1068 openEffect : 'elastic', 1069 prevEffect : 'elastic', 1070 nextEffect : 'elastic', 1071 closeEffect : 'elastic', 1072 tpl : { 1073 closeBtn: '<a title="close" class="fancybox-item fancybox-close" href="javascript:;"><span class="icon icon-cancel-circled"></span></a>', 1074 next : '<a title="next" class="fancybox-nav fancybox-next" href="javascript:;"><span class="icon icon-angle-circled-right"></span></a>', 1075 prev : '<a title="previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span class="icon icon-angle-circled-left"></span></a>' 1076 } 1077 }); 1078 $(".fancybox_iframe").fancybox({ 1079 margin : mar, 1080 padding : 1, 1081 fitToView : true, 1082 width : 540, 1083 type : 'iframe', 1084 openEffect : 'fade', 1085 tpl : { 1086 closeBtn: '<a title="close" class="fancybox-item fancybox-close" href="javascript:;"><span class="icon icon-cancel-circled"></span></a>', 1087 next : '<a title="next" class="fancybox-nav fancybox-next" href="javascript:;"><span class="icon icon-right-open"></span></a>', 1088 prev : '<a title="previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span class="icon icon-left-open"></span></a>' 1089 } 1090 }); 1091 $(".fancybox_various").fancybox({ 1092 maxWidth : 800, 1093 maxHeight : 600, 1094 fitToView : false, 1095 width : '70%', 1096 height : '70%', 1097 autoSize : false, 1098 openEffect : 'none', 1099 closeEffect : 'none', 1100 tpl : { 1101 closeBtn: '<a title="close" class="fancybox-item fancybox-close" href="javascript:;"><span class="icon icon-cancel"></span></a>', 1102 next : '<a title="next" class="fancybox-nav fancybox-next" href="javascript:;"><span class="icon icon-right-open"></span></a>', 1103 prev : '<a title="previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span class="icon icon-left-open"></span></a>' 1104 } 1105 }); 1106} 1107 1108function doTruncate(identifier, limit) { 1109 if (lang === "de") { 1110 var showText = "Mehr anzeigen"; 1111 var hideText = "Weniger anzeigen"; 1112 } else { 1113 var showText = "Show more"; 1114 var hideText = "Show less"; 1115 } 1116 if (isNaN(limit)) { limit = 7; } 1117 $(identifier).truncate({ 1118 "maxLines": limit, 1119 "truncateString": " …", 1120 "showText": "<div class='more clearfix'><span class='border title'>
1120" + showText + "</span> <span class='icon icon-down-open'></span></div>", 1121 "hideText": "<div class='more clearfix'><span class='border title'>" + hideText + "</span> <span class='icon icon-up-open'></span></div>", 1122 "animate": true, 1123 "animateOptions": { 'complete': function() { 1124 $(identifier).css("height","auto"); 1125 sRefresh(); 1126 if ($(this).data("status") === "open") { 1127 $(this).data("status","closed"); 1128 var yOffset = -1 * $(".header_compact").height(); 1129 yOffset -= 10; 1130 var myId = $(this).attr("id"); 1131 if (!myId) { 1132 myId = "trunc_" + myRandom(100000, 999999); 1133 $(this).attr("id",myId); 1134 } 1135 var target = $("#" + myId); 1136 $.scrollTo(target, 1000, { 1137 axis: "y", 1138 offset: yOffset, 1139 easing: "easeOutQuad", 1140 duration: 3000, 1141 onAfter: function () {} 1142 }); 1143 } else { 1144 $(this).data("status","open"); 1145 } 1146 } } 1147 }); 1148} 1149 1150function initCookieConsent() { 1151 window.cookieconsent.initialise({ 1152 "palette": { 1153 "popup": { "background": "#000"} 1154 }, 1155 "content": { 1156 "href": "/privacy/", 1157 "message": "Wir benutzen", 1158 "dismiss": "OK", 1159 "link": "Cookies" 1160 } 1161 }); 1162} 1163 1164function urldecode(str) { 1165 return decodeURIComponent((str+'').replace(/\+/g, ' ')); 1166} 1167 1168function doLog(txt) { 1169 node = document.getElementById("log"); 1170 if (node) { 1171 node.innerHTML = txt + "<br>\n" + node.innerHTML; 1172 } 1173} 1174 1175function doTrack(section, modus, label) { 1176 if (section != "" && modus != "" && label != "") { 1177 // umg-tracking 1178 // dataLayer.push({'event':'GAevent','eventCategory':section,'eventAction':modus,'eventLabel':label}); 1179 // analytics.js 1180 // ga('send', 'event', section, modus, label); 1181 // ga.js: 1182 _gaq.push(['_trackEvent', section, modus, label]); 1183 } 1184 doLog(section + " | " + modus + " | " + label); 1185} 1186 1187function initSvg() { 1188 $('img.svg').each(function(){ 1189 var $img = $(this); var imgID = $img.attr('id'); var imgClass = $img.attr('class'); var imgURL = $img.attr('src'); 1190 $.get(imgURL, function(data) { 1191 var $svg = $(data).find('svg'); 1192 if (typeof imgID !== 'undefined') { $svg = $svg.attr('id', imgID); } 1193 if (typeof imgClass !== 'undefined') { $svg = $svg.attr('class', imgClass+' replaced-svg'); } 1194 $svg = $svg.removeAttr('xmlns:a'); $img.replaceWith($svg); 1195 }, 'xml'); 1196 }); 1197} 1198 1199function winopen(url,name,w,h) { 1200 var w_shift = Number((screen.width/2)-(w/2)); 1201 var h_shift = Number((screen.height/2)-(h/2)); 1202 var newWin = window.open(url, name, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=no, width='+w+', height='+h+', left='+w_shift+', top='+h_shift); 1203 newWin.focus(); 1204} 1205 1206function getCookieValue(a) { // thx 2 mac: http://stackoverflow.com/questions/5639346/#answer-25490531 1207 var b = document.cookie.match('(^|;)\\s*' + a + '\\s*=\\s*([^;]+)'); 1208 return b ? b.pop() : ''; 1209} 1210 1211function kill(id) { 1212 element = document.getElementById(id); 1213 if (element) { 1214 var parent = element.parentNode; 1215 if (parent) { 1216 parent.removeChild(element); 1217 } 1218 } 1219 return false; 1220} 1221 1222// thx Jonas Raoni Soares Silva, http://jsfromhell.com/array/shuffle [rev. #1] // usage: var a = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; alert('shuffle(a): ' + shuffle(a)); 1223function shuffle(v) { 1224 for(var j, x, i = v.length; i; j = parseInt(Math.random() * i), x = v[--i], v[i] = v[j], v[j] = x); 1225 return v; 1226}; 1227 1228function myRandom(a, b) { 1229 if (a > b) { return(-1); } 1230 if (a === b) { return(a); } 1231 return a + parseInt(Math.random() * ( b - a+1 )); 1232} 1233 1234// peace out
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.