1$(window).on('load', function () { 2 if ($('#ytplayer').length > 0) 3 loadYoutubeVideo($("input[name='yt-id']").val()); 4 initVideoJs(); 5}) 6/*** 7 Check if browser is chrome 8 ***/ 9var bChrome = /chrom(e|ium)/.test(navigator.userAgent.toLowerCase()); 10var themeAssistant = theme.assistant.load(); 11/*** 12 Detects whether the device is mobile so we can load MP3 for best compatibility 13 ***/ 14var baseUrl = document.location.host.split('.'); 15if ($(window).width() >= 1024 && baseUrl[0] === 'radioenergy') { 16 $('div.radio-collapse-wrap > div.profile-collapse.radio-collapse').css('right', '-95px') 17} 18 19function detectMobile() { 20 var check = false; 21 (function (a) { 22 if (/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(a) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0, 4))) check = true 23 })(navigator.userAgent || navigator.vendor || window.opera); 24 return check; 25} 26 27$('.show-name a').click(redirectToShow) 28$('.shows-listing-item a').click(redirectToShow) 29function redirectToShow() { 30 if (baseUrl[0] === 'bgradio') { 31 var url = $(this).attr('href') 32 console.log(url) 33 return themeAssistant.redirect(url) 34 } 35} 36/*** 37 Detects whether the device is android so we can load MP3 for best compatibility 38 ***/ 39function detectAndroid() { 40 var ua = navigator.userAgent.toLowerCase(); 41 var isAndroid = ua.indexOf("android") > -1; //&& ua.indexOf("mobile"); 42 if (isAndroid) { 43 return true; 44 } 45 else { 46 return false; 47 } 48} 49 50/*** 51 Detects whether the device is a tablet. Used for facebook append 52 ***/ 53function detectAndroidTablet() { 54 if (detectAndroid()) { 55 var ua = navigator.userAgent.toLowerCase(); 56 var isTablet = ua.indexOf("mobile") < 0; 57 58 return isTablet; 59 } 60 else 61 return false; 62} 63 64 65/*** 66 Detect internet explorer 67 ***/ 68function detectIE() { 69 var ua = window.navigator.userAgent; 70 var msie = ua.indexOf("MSIE "); 71 72 if (msie > 0) // If Internet Explorer, return version number 73 return true; 74 else // If another browser, return 0 75 return false; 76 77 return false; 78} 79 80function removeHash() { 81 window.location.hash = ''; 82 window.history.pushState("", document.title, window.location.pathname 83 + window.location.search); 84} 85 86function clickOnHashId() { 87 if (window.location.hash && 88 $(window.location.hash).hasClass("hash-element")) { 89 $(window.location.hash).click(); 90 } 91} 92 93/*** 94 Detect if homePage 95 ***/ 96function isHomepage() { 97 var hrefLocation = location.href; 98 if (hrefLocation.indexOf("#") > 0) { 99 hrefLocation = hrefLocation.slice(0, hrefLocation.indexOf("#")); 100 } 101 return location.origin + '/' == hrefLocation || location.origin + '/site/index' == hrefLocation; 102} 103 104 105/*** 106 Opens the external player used for older browsers 107 ***/ 108//Opens the external player used for older browsers 109function openExternalPlayer() { 110 window.open('http://www.' + radioName + '.bg/site/extplayer', '', 'width=320,height=480,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no'); 111} 112 113 114/*** 115 * Changes the stream playing with the url provided 116 */ 117function changeStream(streamNumber) { 118 if (typeof streamNumber != "undefined") { 119 ga('send', 'event', 'Radio', 'Change Quality', allChannels[mainCh
119annelNumber].allStreams[streamNumber].title); 120 } 121 playTheRadio(); 122} 123 124/*** 125 * Changes the stream playing with the url provided 126 */ 127function changeStream(streamNumber) { 128 if (typeof streamNumber != "undefined") { 129 ga('send', 'event', 'Radio', 'Change Quality', allChannels[mainChannelNumber].allStreams[streamNumber].title); 130 } 131 playTheRadio(); 132} 133 134function findCompatibleStream() { 135 for (var k in allChannels[mainChannelNumber].allStreams) { 136 var format = allChannels[mainChannelNumber].allStreams[k].format; 137 if ((Modernizr.audio.ogg && format == "OGG") || 138 (Modernizr.audio.mp3 && format == "MP3")) { 139 allChannels[mainChannelNumber].stream = allChannels[mainChannelNumber].allStreams[k]; 140 } 141 } 142} 143 144function setMainStream() { 145 for (var k in allChannels[mainChannelNumber].allStreams) { 146 if (k == 0) { 147 allChannels[mainChannelNumber].stream = allChannels[mainChannelNumber].allStreams[k]; 148 } 149 if ((detectMobile() && allChannels[mainChannelNumber].allStreams[k].webMobile == 1) || 150 (detectMobile() == false && allChannels[mainChannelNumber].allStreams[k].web == 1)) { 151 allChannels[mainChannelNumber].stream = allChannels[mainChannelNumber].allStreams[k]; 152 break; 153 } 154 } 155} 156 157function setupChannelsBtn() { 158 if (allChannels.length > 1) { 159 $(".streams-btn").css('display', 'inline-block'); 160 } 161 else { 162 $(".streams-btn").remove(); 163 } 164} 165 166function showNavbar() { 167 $('.navbar-left .navbar-nav').show(); 168} 169 170/*** 171 * Loads the radio player 172 */ 173function loadRadioPlayer(play, streamNumber) { 174 if (typeof streamNumber !== 'undefined') { 175 allChannels[mainChannelNumber].stream = allChannels[mainChannelNumber].allStreams[streamNumber]; 176 } 177 else if (allChannels[mainChannelNumber].stream !== 'undefined') { 178 setMainStream(); 179 } 180 181 var format = allChannels[mainChannelNumber].stream.format; 182 183 if ((format == 'OGG' && Modernizr.audio.ogg == false) 184 || (format == 'MP3' && Modernizr.audio.mp3 == false)) { 185 findCompatibleStream(); 186 } 187 188 var url = allChannels[mainChannelNumber].stream.url; 189 var title = allChannels[mainChannelNumber].title; 190 format = allChannels[mainChannelNumber].stream.format; 191 192 //Load the jPlayer definition 193 if (Modernizr.audio.ogg && format == 'OGG') { 194 $("#radioplayer").jPlayer({ 195 ready: function () { 196 $(this).jPlayer("setMedia", { 197 oga: url 198 }); 199 if (play == true) { 200 $("#radioplayer").jPlayer('play'); 201 ga('send', 'event', 'Radio', 'Start Playing', title); 202 } 203 }, 204 pause: function () { 205 $(this).jPlayer("clearMedia"); 206 }, 207 volumechange: function (event) { 208 iVolume = event.jPlayer.options.volume; 209 }, 210 play: function () { // To avoid multiple jPlayers playing together. 211 $(this).jPlayer("pauseOthers"); 212 }, 213 error: function (event) { 214 if ((typeof ready != 'undefined') && event.jPlayer.error.type === $.jPlayer.error.URL_NOT_SET) { 215 // Setup the media stream again and play it. 216 $(this).jPlayer("setMedia", { 217 oga: url 218 }); 219 } 220 }, 221 volume: iVolume, 222 supplied: 'oga', 223 preload: 'none', 224 swfPath: "../addons/jPlayer.latest", 225 solution: "html, flash", 226 wmode: "window", 227 nativeSuport: true 228 }); 229 } 230 else if (Modernizr.audio.mp3 && format == 'MP3') { 231 $("#radioplayer").jPlayer({ 232 ready: function () { 233 $(this).jPlayer("setMedia", { 234 mp3: url 235 }); 236 if (play == true) { 237 $("#radioplayer").jPlayer('play'); 238 ga('send', 'event', 'Radio', 'Start Playing', title); 239 } 240 }, 241 pause: function () { 242 $(this).jPlayer("clearMedia"); 243 244 }, 245 play: function () { // To avoid multiple jPlayers playing together. 246 $(this).jPlayer("pauseOthers"); 247 }, 248 volumechange: function (event) { 249 iVolume = event.jPlayer.options.volume; 250 }, 251 error: function (event) { 252 if ((typeof ready != 'undefined') && event.jPlayer.error.type === $.jPlayer.error.URL_NOT_SET) { 253 // Setup the media stream again and play it. 254 $(this).jPlayer("setMedia", { 255 mp3: url 256 }); 257 } 258 }, 259 volume: iVolume, 260 supplied: 'mp3', 261 preload: 'none', 262 swfPath: "../addons/jPlayer.latest", 263 solution: "html, flash", 264 wmode: "window", 265 nativeSuport: true 266 }); 267 } 268} 269 270 271/*** 272 * The function that is being executed when load more articles btn is clicked 273 */ 274function loadMoreItems(pageInputId, itemsType, btnWrapId, maxPageId, additionalParameters) { 275 additionalParameters = typeof additionalParameters !== 'undefined' ? additionalParameters : ''; 276 var page = parseInt($('#' + pageInputId).val()); 277 278 if (page > 0) { 279 $('.loadmore').hide(); 280 $('.internal-loading').show(); 281 282 $.ajax({
283 url: detectIE() ? 'http://' + window.location.hostname + '/' + itemsType + '/loadmore/' + page + additionalParameters 284 : location.origin + '/' + itemsType + '/loadmore/' + page + additionalParameters, 285 type: 'GET', 286 dataType: 'html', 287 success: function (data) { 288 //Add hidden container to the data so we can show the result with animation 289 var html = "<div id='" + pageInputId + "_" + (page + 1) + "' style='display: none;'>" + data + "</div>"; 290 $('#' + btnWrapId).before(html); 291 $('#' + pageInputId).val(++page); 292 293 //Check if no more pages and hide the button 294 if (parseInt($('#' + maxPageId).val()) <= page) { 295 $('#' + btnWrapId).hide(); 296 } 297 298 //Show the result 299 $('#' + pageInputId + "_" + page).show('ease'); 300 301 $('.loadmore').show(); 302 $('.internal-loading').hide(); 303 if (typeof $("img.lazy").lazyload !== 'undefined') { 304 $("img.lazy").lazyload({threshold: 100}) 305 } 306 } 307 }); 308 } 309 else { 310 return false; 311 } 312} 313 314/*** 315 * The function that is being executed when play button is clicked 316 */ 317function showSongQuote() { 318 var quoteButtons = $('.jp-quote-button'); 319 320 if (quoteButtons.length > 0 && $('.quote-popover').length == 0) { 321 var page = '/songQuote/getRandom'; 322 323 $.ajax({
324 url: detectIE() ? 'http://' + window.location.hostname + page 325 : location.origin + page, 326 type: 'GET', 327 dataType: 'html', 328 success: function (data) { 329 $('#jp-quote').popover({ 330 'placement': 'bottom', 331 'html': true, 332 'template': '<div id="quote-popover" class="popover radio-popover quote-popover" role="tooltip"><div class="popover-content"></div></div>', 333 'content': data 334 }); 335 336 $('#jp-quote-mobile').popover({ 337 'placement': 'top', 338 'html': true, 339 'template': '<div id="mobile-quote-popover" class="popover radio-popover quote-popover" role="tooltip"><div class="popover-content"></div></div>', 340 'content': data 341 }); 342 343 $('.jp-quote-button').popover('show'); 344 if (typeof $("img.lazy").lazyload !== 'undefined') { 345 $("img.lazy").lazyload({threshold: 100}) 346 } 347 }, 348 async: true 349 }); 350 } 351 else { 352 return false; 353 } 354} 355 356function showSongQuote() { 357 var quoteButtons = $('.jp-quote-button'); 358 359 if (quoteButtons.length > 0 && $('.quote-popover').length == 0) { 360 var page = '/songQuote/getRandom'; 361 362 $.ajax({
363 url: detectIE() ? 'https://' + window.location.hostname + page 364 : location.origin + page, 365 type: 'GET', 366 dataType: 'html', 367 success: function (data) { 368 $('#jp-quote').popover({ 369 'placement': 'bottom', 370 'html': true, 371 'template': '<div id="quote-popover" class="popover radio-popover quote-popover" role="tooltip"><div class="popover-content"></div></div>', 372 'content': data 373 }); 374 375 $('#jp-quote-mobile').popover({ 376 'placement': 'top', 377 'html': true, 378 'template': '<div id="mobile-quote-popover" class="popover radio-popover quote-popover" role="tooltip"><div class="popover-content"></div></div>', 379 'content': data 380 }); 381 382 $('.jp-quote-button').popover('show'); 383 if (typeof $("img.lazy").lazyload !== 'undefined') { 384 $("img.lazy").lazyload({threshold: 100}) 385 } 386 }, 387 async: true 388 }); 389 } 390 else { 391 return false; 392 } 393} 394 395function closeSongQuote() { 396 $('.jp-quote-button').popover('hide'); 397 $('.jp-quote-button').remove(); 398} 399 400function backToGallery() { 401 window.history.pushState("", "", "?"); 402} 403 404/*** 405 * open photos in fancybox 406 */ 407function enlargePhoto() { 408 var isFancyOpen = false; 409 var galleryPicture; 410 //Used to enlarge photos 411 $(".enlarge").fancybox({ 412 helpers: { 413 title: { 414 type: 'float' 415 } 416 }, 417 afterLoad: function () { 418 var href = this.href; 419 var filename = href.substr(href.lastIndexOf("/") + 1); 420 var hash = filename.substr(0, filename.indexOf(".")); 421 422 window.history.pushState("", "", '?img=' + hash); 423 //window.location.hash = hash; 424 $(".fancybox-wrap").append($('#' + hash + '>.share-article-wrap').clone()); 425 if (isFancyOpen == false) { 426 isFancyOpen = true; 427 galleryPicture = $('meta[property="og:image"]').attr('content'); 428 } 429 $('meta[property="og:image"]').attr('content', href); 430 $('meta[property="og:url"]').attr('content', window.location.href); 431 432 }, 433 beforeClose: function () { 434 removeHash(); 435 backToGallery(); 436 437 isFancyOpen = false; 438 $('meta[property="og:image"]').attr('content', '0'); 439 $('meta[property="og:url"]').attr('content', '0'); 440 }, 441 442 }); 443 var url = $(location).attr('href'); 444 var pattern = /.+?img=(\w+)-(\d+)/g; 445 var matchUrl = pattern.exec(url); 446 447 if (matchUrl) { 448 var id = '#' + matchUrl[1] + '-' + matchUrl[2]; 449 var hash = matchUrl[1] + '-' + matchUrl[2]; 450 451 $(this).ready(function () { 452 $(id).click(); 453 }) 454 } 455 456} 457 458 459/*** 460 * hides the Swipe - wont be used after the end of 2015 461 */ 462function hideSwipe() { 463 //console.log('Hide swipe'); 464 $('#swipe-carousel').hide('fast'); 465} 466 467 468/*** 469 * Shows the Swipe - wont be used after the end of 2015 470 */ 471function showSwipe() { 472 //console.log('Show swipe'); 473 $('#swipe-carousel').show('fast'); 474} 475 476 477/*** 478 * Get famous players load 479 */ 480function loadGetFamous() { 481 //Get famous playing 482 $(".promoplayer").each(function () { 483 $(this).jPlayer({ 484 485 ready: function () { 486 $(this).jPlayer("setMedia", { 487 title: "Bubble", 488 mp3: $(this).attr('data-href') 489 }); 490 }, 491 play: function () { // To avoid multiple jPlayers playing together. 492 $(this).jPlayer("pauseOthers"); 493 }, 494 swfPath: hostName + "/addons/jPlayer.latest", 495 supplied: "mp3", 496 preload: 'none', 497 cssSelectorAncestor: "#jp_container_" + $(this).attr('id'), 498 wmode: "window", 499 globalVolume: true, 500 smoothPlayBar: true, 501 keyEnabled: true 502 503 }); 504 });
505} 506 507function initPodcast() { 508 //Get famous playing 509 $(document).ready(function () { 510 if ($("#podcast_player").length) { 511 $("#podcast_player").jPlayer({ 512 ready: function () { 513 $player = $(this).jPlayer("setMedia", { 514 title: $(this).attr('data-title'), 515 mp3: $(this).attr('data-href') 516 }); 517 // MRTN: This is an old player 518 /*if ($('#radioplayer').data().jPlayer.status.paused) { 519 $player.jPlayer("play"); 520 }*/ 521 }, 522 play: function () { // To avoid multiple jPlayers playing together. 523 $(this).jPlayer("pauseOthers"); 524 var id = $(this).attr('data-id'); 525 $("#" + id + ' .podcast-ended-container').hide(); 526 // MRTN: This is an old player 527 /*var status = $('#radioplayer').data().jPlayer.status.paused; 528 if (!status) { 529 stopTheRadio(); 530 }*/ 531 }, 532 loadedmetadata: function () { 533 // not showing hours when duration is under 1 hour 534 if ($(this).data("jPlayer").status.duration / 3600 < 1) { 535 $(this).jPlayer({ 536 timeFormat: { 537 showHour: false, 538 padMin: false 539 } 540 }); 541 } 542 }, 543 ended: function () { 544 var id = $(this).attr('data-id'); 545 $("#" + id + ' .podcast-ended-container').show(); 546 $("#" + id + ">.jp_podcast").hide(); 547 startAutoPlayCounter(id + " .podcast-ended-container"); 548 }, 549 swfPath: hostName + "/addons/jPlayer.latest", 550 supplied: "mp3", 551 cssSelectorAncestor: "#jp_podcast_container", 552 wmode: "window", 553 globalVolume: true, 554 preload: "auto", 555 smoothPlayBar: true, 556 keyEnabled: true, 557 timeFormat: { 558 showHour: true 559 } 560 }); 561 } 562 }) 563} 564 565function replayThePodcast(elemid) { 566 $("#" + elemid + ' .podcast-ended-container').hide(); 567 $("#" + elemid + ">.jp_podcast").show(); 568 stopAutoPlay(elemid + " .podcast-ended-container"); 569 playThePodcast(); 570} 571 572function playThePodcast() { 573 $("#podcast_player").jPlayer('play'); 574 $(".jp_podcast-play").hide(); 575 $(".jp_podcast-pause").show(); 576 577} 578 579function pauseThePodcast() { 580 $("#podcast_player").jPlayer('pause'); 581 $(".jp_podcast-play").show(); 582 $(".jp_podcast-pause").hide(); 583 584} 585 586/*** 587 * Facebook share popup 588 */ 589function fbs_click(width, height) { 590 var leftPosition, topPosition; 591 //Allow for borders. 592 leftPosition = (window.screen.width / 2) - ((width / 2) + 10); 593 //Allow for title and status bars. 594 topPosition = (window.screen.height / 2) - ((height / 2) + 50); 595 var windowFeatures = "status=no,height=" + height + ",width=" + width + ",resizable=yes,left=" + leftPosition + ",top=" + topPosition + ",screenX=" + leftPosition + ",screenY=" + topPosition + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no"; 596 u = location.href; 597 t = document.title; 598 //window.open('http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer', windowFeatures); 599 window.open('http://www.facebook.com/sharer.php?u=' + encodeURIComponent(u), 'sharer', windowFeatures); 600 return false; 601} 602 603function attachVideoFancyLink() { 604 $('.video-fancy-link').each(function (i, obj) { 605 var elem = '<a class="various no-ajaxy fancy" data-fancybox-type="iframe" href="' + $(this).attr('data-fancy-link') + '">' + 606 '<span class="fa fa-5x fa-play-circle"> </span></a>'; 607 $(this).nextAll().remove(); 608 $(this).after(elem); 609 });
610} 611 612/*** 613 * Load youtube video 614 */ 615function loadYoutubeVideo(id) { 616 var player; 617 player = new YT.Player('ytplayer', { 618 height: '400', 619 width: '760', 620 videoId: id, 621 events: { 622 'onStateChange': onPlayerStateChange 623 } 624 }); 625} 626 627function showPopup(container) { 628 if (container.is(":visible")) { 629 container.hide(); 630 } 631 else { 632 container.show(); 633 } 634} 635 636function hidePopup(e, container, btn) { 637 if (isOutsideTwoContainers(e, container, btn)) { 638 container.hide(); 639 } 640} 641 642function slideUpPopup(e, container, btn) { 643 if (isOutsideTwoContainers(e, container, btn)) { 644 container.removeClass('slowLikebox'); 645 } 646} 647 648function isOutsideContainer(e, container) { 649 return (!container.is(e.target) && container.has(e.target).length === 0) 650} 651 652function isOutsideTwoContainers(e, container, container2) { 653 return isOutsideContainer(e, container) && isOutsideContainer(e, container2); 654} 655 656/*** 657 * When YT player changes its state this function is being called. For now it is used for volume control on the player. 658 */ 659function onPlayerStateChange(event) { 660 if (event.data == YT.PlayerState.PLAYING) { 661 $('#radioplayer').jPlayer('mute'); 662 } 663 664 if (event.data == YT.PlayerState.PAUSED) { 665 $('#radioplayer').jPlayer('unmute'); 666 } 667} 668 669/*** 670 * Return a GET parameter from its name as param passed to this function 671 */ 672function GetURLParameter(sParam) { 673 var sPageURL = window.location.search.substring(1); 674 var sURLVariables = sPageURL.split('&'); 675 for (var i = 0; i < sURLVariables.length; i++) { 676 var sParameterName = sURLVariables[i].split('='); 677 if (sParameterName[0] == sParam) { 678 return sParameterName[1]; 679 } 680 } 681} 682 683 684/*** 685 * Appends the facebook page plugin on page load 686 */ 687function appendFacebookBox() { 688 if (!detectAndroid() || detectAndroidTablet()) { 689 if (typeof facebookFrame != 'undefined') { 690 if ($('.fbcontainer').length > 0) { 691 $('.fbcontainer').append(facebookFrame); 692 } else { 693 $('.sidebar').append(facebookFrame); 694 } 695 } 696 } 697 698 //Reload the XFBML 699 if ($('.fb-page').length && typeof FB.XFBML !== 'undefined') 700 FB.XFBML.parse(); 701} 702 703 704/*** 705 * Appends the instagram plugin 706 */ 707function appendInstaBox() { 708 if (!detectAndroid() || detectAndroidTablet()) { 709 if (typeof instaFrame != 'undefined') { 710 if ($('#insta-widget').length) 711 $('#insta-widget').append(instaFrame); 712 } 713 } 714} 715 716 717/*** 718 * For now used only to change city.bg backgrounds 719 */ 720function changeBkgColor(home) { 721 if (typeof changeColors !== 'undefined') { 722 var classes = $('body').attr('class'); 723 724 if (!home) { 725 var random = Math.floor(Math.random() * 5) + 1; 726 $('body').removeClass(classes); 727 $('body').addClass('bkg-color-' + random); 728 } 729 else { 730 $('body').removeClass(classes); 731 } 732 } 733} 734 735function moveCarouselPicturesRight() { 736 if ($('.basic-owl-controls').length == 0) { 737 $('.owl-item').addClass('moved-right'); 738 } 739} 740 741/*** 742 * Initializes the owl carousel 743 */ 744function initializeOwl(name) { 745 if ($("#" + name).find('div.item').length > 1 || $("#" + name).find('div.item').length == 1) { 746 if (name == 'basic-radio-owl') { 747 748 $("#" + name).owlCarousel({ 749 items:1, 750 // dotsSpeed: 800, 751 // smartSpeed: 800, 752 // fluidSpeed: 800, 753 autoplay: true, 754 autoplaySpeed: 2000, 755 autoplayTimeout: 5000, 756 autoplayHoverPause: true, 757 mergeFit: false, 758 nav: true, 759 loop: true, 760 center: true, 761 lazyLoad: true, 762 onInitialized: defineBasicCarouselNavigationArrows, 763 // Start Carousel of first element 764 // startPosition: -1, 765 //responsiveClass:true, 766 // responsive: { 767 // // breakpoint from 0 up 768 // '0': { 769 // items: 1, 770 // nav: false 771 // }, 772 // // breakpoint from 480 up 773 // '480': { 774 // items: 1, 775 // nav: false 776 // }, 777 // // breakpoint from 768 up 778 // '768': { 779 // items: 2, 780 // nav: true,
781 // navContainer: 'basic-owl-controls' 782 // } 783 // } 784 }); 785 $("#" + name).fadeIn('ease'); 786 moveCarouselPicturesRight(); 787 } 788 else { 789 if (isHomepage()) { 790 $("#" + name).owlCarousel({ 791 items: 1, 792 nav: true, 793 dotsSpeed: 800, 794 smartSpeed: 800, 795 fluidSpeed: 800, 796 autoplay: true, 797 autoplaySpeed: 1000, 798 autoplayTimeout: 5000, 799 autoplayHoverPause: true, 800 mergeFit: false, 801 margin:0, 802 autoWidth: false, 803 autoHeight: false, 804 loop: true, 805 startPosition: 0 806 807 // "singleItem:true" is a shortcut for: 808 // items : 1, 809 // itemsDesktop : false, 810 // itemsDesktopSmall : false, 811 // itemsTablet: false, 812 // itemsMobile : false 813 814 }); 815 $("#" + name).fadeIn('ease'); 816 moveCarouselPicturesRight(); 817 } 818 } 819 } 820} 821 822 823function defineBasicCarouselNavigationArrows() { 824 var owl = $('#basic-radio-owl'); 825 826 $('div.owl-next.owl-control-item').on('click', function () { 827 owl.trigger('next.owl.carousel'); 828 }); 829 $('div.owl-prev.owl-control-item').on('click', function () { 830 owl.trigger('prev.owl.carousel'); 831 }); 832} 833 834 835/*** 836 * Initializes the bootstrap tabs for the program (in the websites that have one) 837 */ 838function initializeScheduleTabs() { 839 $('#schedule-tabs a').click(function (e) { 840 e.preventDefault() 841 $(this).tab('show') 842 }); 843} 844 845var firstAnimateMeta; 846 847/*** 848 * Metadata animation moving text from right to left 849 */ 850function animateMeta() { 851 var a = parseInt($('#now-on-the-radio').css('left')); 852 var b = $('div.now-playing-wrap').width(); 853 var radioLineWidth = $('.jp-now-playing').width(); 854 var currentRadioLineLeft = (2 * a - b + radioLineWidth) / 2; 855 $('#now-on-the-radio').css('left', 0); 856 var nowPlayingLineWidth = $('#now-on-the-radio').width(); 857 $('div.now-playing-wrap').css({ 858 width: nowPlayingLineWidth * 2 + radioLineWidth, 859 left: -1 * nowPlayingLineWidth 860 }); 861 currentRadioLineLeft = nowPlayingLineWidth + currentRadioLineLeft; 862 if (currentRadioLineLeft < 0) { 863 currentRadioLineLeft = 10; 864 } 865 $('#now-on-the-radio').css('left', currentRadioLineLeft); 866 var firstTime = 25 * currentRadioLineLeft; 867 868 $('#now-on-the-radio').animate( 869 {left: '0px'}, 870 firstTime, // duration 871 "linear", 872 function () { 873 $('#now-on-the-radio').css('left', nowPlayingLineWidth + radioLineWidth); 874 }); 875 876 firstAnimateMeta = setTimeout(animateMetaPeriodically(), firstTime); 877} 878 879function animateMetaPeriodically() { 880 var nowPlayingLineWidth = $('#now-on-the-radio').width(); 881 var radioLineWidth = $('.jp-now-playing').width(); 882 $('div.now-playing-wrap').css({ 883 width: nowPlayingLineWidth * 2 + radioLineWidth, 884 left: -1 * nowPlayingLineWidth 885 }); 886 887 $('#now-on-the-radio').animate( 888 {left: '0px'}, 889 25 * (nowPlayingLineWidth + radioLineWidth), // duration 890 "linear", 891 function () { 892 $('#now-on-the-radio').css('left', nowPlayingLineWidth + radioLineWidth); 893 stopAnimateMeta(); 894 animateMeta(); 895 }); 896} 897 898function stopAnimateMeta() { 899 clearTimeout(firstAnimateMeta); 900 $('#now-on-the-radio').stop(); 901} 902 903 904/*** 905 * Initilizes the ajaxify plugin that loads the pages into the colsmask and doesnt refresh the page 906 */ 907function initAjaxify() {
908 $('.colsmask').ajaxify({ 909 previewoff: true, 910 turbo: false, 911 inline: true, 912 requestDelay: 500 913 }); 914} 915 916 917/*** 918 * Defines the fancybox when needed. Mostly used with games. 919 */ 920function defineFancybox() { 921 $(".fancy").fancybox({ 922 maxWidth: 800, 923 maxHeight: 650, 924 minHeight: 30, 925 fitToView: true, 926 width: '100%', 927 height: '100%', 928 autoSize: true, 929 closeClick: false, 930 beforeClose: function () { 931 parent.$('#radioplayer').jPlayer('unmute'); 932 }, 933 openEffect: 'none', 934 closeEffect: 'none', 935 }); 936} 937 938/*** 939 * Defines the toastr message when needed. Mostly used when song is liked. 940 */ 941function defineToastr() { 942 toastr.options = { 943 "closeButton": false, 944 "debug": false, 945 "newestOnTop": false, 946 "progressBar": false, 947 "positionClass": "toast-bottom-right", 948 "preventDuplicates": false, 949 "onclick": null, 950 "showDuration": "300", 951 "hideDuration": "1000", 952 "timeOut": "3000", 953 "extendedTimeOut": "1000", 954 "showEasing": "swing", 955 "hideEasing": "linear", 956 "showMethod": "fadeIn", 957 "hideMethod": "fadeOut" 958 } 959} 960 961var songPopoverDelayHide = false; 962 963/*** 964 * Show pause radio animation with sharing icons 965 */ 966
967function showPauseRadio() { 968 var radioPlay = $('#radio-play'); 969 if (radioPlay.hasClass('jp-pause')) { 970 radioPlay.addClass('display-radio-pause'); 971 if (radioPlay.hasClass('active-song')) { 972 //$("#song-share-popup").slideDown("slow"); 973 $("#song-share-popup").addClass("slowLikebox"); 974 } 975 976 songPopoverDelayHide = true; 977 setTimeout(function () { 978 radioPlay.removeClass('display-radio-pause'); 979 }, 3000); 980 } 981} 982 983/* Radio Coins for */ 984$(this).unload(function () { 985 var radioLoad = radio.helper.load() 986 radioLoad.PauseListenTime() 987}); 988 989 990/*** 991 * Stops the radio 992 */ 993function stopTheRadio() { 994 var radioLoad = radio.helper.load() 995 ga('send', 'event', 'Radio', 'Stop Playing', allChannels[mainChannelNumber].title); 996 $("#radioplayer").jPlayer("stop"); 997 var radioPlay = $('#radio-play'); 998 radioPlay.removeClass('jp-pause'); 999 radioPlay.addClass('jp-play'); 1000 $('#radio-play .entypo-pause').addClass('entypo-play'); 1001 $('#radio-play .entypo-pause').removeClass('entypo-pause'); 1002 radioPlay.prop('onclick', null).off('click'); 1003 unsetupCurrentSongSharePopup(); 1004 $("#song-share-popup").removeClass("slowlikeBox"); 1005 radioLoad.PauseListenTime() 1006 radioPlay.click(function () { 1007 playTheRadio(); 1008 }); 1009} 1010 1011/*** 1012 * Plays the radio 1013 */ 1014function playTheRadio() { 1015 var radioLoad = radio.helper.load() 1016 //$("#jp_container_1").fadeIn(); 1017 $("#radioplayer").jPlayer("destroy"); 1018 if (typeof streamNumber !== 'undefined') { 1019 loadRadioPlayer(true, streamNumber); 1020 } 1021 else { 1022 loadRadioPlayer(true); 1023 } 1024 var radioPlay = $('#radio-play'); 1025 radioPlay.removeClass('jp-play'); 1026 radioPlay.addClass('jp-pause'); 1027 $('#radio-play .entypo-play').addClass('entypo-pause'); 1028 $('#radio-play .entypo-play').removeClass('entypo-play'); 1029 radioPlay.prop('onclick', null).off('click'); 1030 if (radioPlay.hasClass('active-song')) { 1031 setupCurrentSongSharePopup(); 1032 $("#song-share-popup").addClass("slowLikebox"); 1033 } 1034 radioLoad.PlayListenTime() 1035 radioPlay.click(function () { 1036 stopTheRadio(); 1037 }); 1038} 1039 1040/*** 1041 * Used in energy when there were other channels. We'll use this function probably later when we have more streams. 1042 */ 1043function changeChannel(channelId, logo) { 1044 $('#mobile-streams-btn').popover('hide'); 1045 $('#streams-btn').popover('hide'); 1046 1047 if (channelId != mainChannelNumber) { 1048 mainChannelNumber = channelId; 1049 1050 newChannelStreamsStr = getChannelStreams(); 1051 $('#stream-quality').data('bs.popover').options.content = newChannelStreamsStr; 1052 $('#mobile-stream-quality').data('bs.popover').options.content = newChannelStreamsStr; 1053 1054 if (allChannels[mainChannelNumber].stream !== 'undefined') { 1055 setMainStream(); 1056 } 1057 1058 stopUpdatingMeta(); 1059 updateMeta(); 1060 metaAjaxCall(true); 1061 1062 ga('send', 'event', 'Radio', 'Change Channel', allChannels[mainChannelNumber].title); 1063 changeStream(); 1064 1065 setPlaylistButtonStatus(); 1066 } 1067 1068 $('.streams-btn>img').attr('src', logo); 1069} 1070 1071function getChannelStreams() { 1072 var strStreams = ''; 1073 for (var k in allChannels[mainChannelNumber].allStreams) { 1074 1075 var k1 = +k + +1; 1076 var stream = '<a class="change-stream-quality" onclick="javascript:changeStream(' + k + ');" href="#quality-' + k1 + '">' + 1077 '<i class="fa fa-file-audio-o"></i>' + allChannels[mainChannelNumber].allStreams[k]['title'] + 1078 '</a>'; 1079 strStreams = strStreams.concat(stream); 1080 } 1081 return strStreams; 1082} 1083 1084 1085/*** 1086 * Defines the flow player for city 1087 */ 1088function defineLivePlayer() { 1089 if ($('#flowplayer').length) { 1090 flowplayer(function (api, root) { 1091 api.on("ready", function () { 1092 // do something when a video is loaded and ready to play 1093 //api.play(); 1094 }); 1095 }); 1096 1097 // select the above element as player container 1098 var container = document.getElementById("flowplayer"); 1099 1100 // install flowplayer into selected container 1101 flowplayer(container, { 1102 clip: { 1103 sources: [ 1104 { 1105 type: "application/x-mpegurl", 1106 src: "https://tv.city.bg/play/tshls/citytv/index.m3u8", 1107 live: true 1108 } 1109 ] 1110 } 1111 }); 1112 } else if($('#city-tv').length) { 1113 themeAssistant.tvPlayerInit() 1114 } 1115} 1116 1117 1118/** 1119 * Moves the branding below the carousel on the homepage 1120 */ 1121function moveBrandingBelowCarousel() { 1122 if ($('.branding_outer_wrap').length >= 1) { 1123 if (!$('.branding_outer_wrap').hasClass('push-branding-down')) { 1124 $('.branding_outer_wrap').addClass('push-branding-down'); 1125 } 1126 } 1127} 1128 1129 1130/** 1131 * Used when video preroll shows a video and then on the 7th second a close button appears 1132 * @param sec 1133 */ 1134function showCloseAdBtn(sec) { 1135 $(".player-overlay").ready(function () { 1136 setTimeout(function () { 1137 if ($('.player-overlay').find('div').last().html() != "") { 1138 $('.close-preroll').show(); 1139 } 1140 }, sec); 1141 });
1142} 1143 1144 1145/** 1146 * Reload the facebook plugins on the page 1147 */ 1148function reloadXFBML() { 1149 try { 1150 FB.XFBML.parse(); 1151 } catch (ex) { 1152 } 1153} 1154 1155 1156/** 1157 * Define the video player 1158 */ 1159function initVideoJs() { 1160 //var vastURL = 'http://videoads.theonion.com/vast/270.xml'; 1161 var vastURL = ''; 1162 1163 if ($('.videoclip').length && typeof videojs !== 'undefined') { 1164 videojs.options.flash.swf = "http://" + radioName + ".bg/themes/" + radioName + "/addons/video-js/video-js.swf"; 1165 //Get current Id 1166 var elemid = $('.videoclip').attr('id'); 1167 console.log(elemid); 1168 var vid = videojs(elemid); 1169 var interval; 1170 1171 vid.ready(function () { 1172 myplayer = this; 1173 myplayer.on("play", function () { 1174 $('#radioplayer').jPlayer('mute'); 1175 var id = this.id(); 1176 $("#" + id + ">video").append($("#" + id + ">.vjs-ended-container")); 1177 }); 1178 myplayer.on("pause", function () { 1179 $('#radioplayer').jPlayer('unmute'); 1180 }); 1181 myplayer.on("ended", function () { 1182 $('#radioplayer').jPlayer('unmute'); 1183 var id = this.id(); 1184 $("#" + id).append($("#" + id + ">video>.vjs-ended-container")); 1185 startAutoPlayCounter(id + ">.vjs-ended-container"); 1186 }); 1187 }); 1188 1189 if (vastURL.length > 2) { 1190 //vid.muted(true); 1191 vid.ads(); 1192 vid.vast({ 1193 //url: 'http://ad3.liverail.com/?LR_PUBLISHER_ID=1331&LR_CAMPAIGN_ID=229&LR_SCHEMA=vast2', 1194 url: vastURL, 1195 skip: 5 1196 }); 1197 1198 vid.on("play", function () { 1199 vid.muted(false); 1200 }); 1201 } 1202 1203 vid.play(); 1204 } 1205} 1206 1207function replayVideoJs(elemid) { 1208 stopAutoPlay(elemid + ">.vjs-ended-container"); 1209 var vid = videojs(elemid); 1210 vid.play(); 1211} 1212 1213function startAutoPlayCounter(elementSelector) { 1214 $('#radioplayer').jPlayer('mute'); 1215 $("#" + elementSelector + ">div>.stop-autoplay").show(); 1216 $("#" + elementSelector + ">div>span>.fa-forward").append("<span></span>"); 1217 $("#" + elementSelector + ">div>span>.fa-forward>span").countTo({ 1218 onComplete: function (value) { 1219 $("#" + elementSelector + ">div>span>.fa-forward").click(); 1220 } 1221 }); 1222} 1223 1224function stopAutoPlay(elementSelector) { 1225 $('#radioplayer').jPlayer('unmute'); 1226 clearInterval(redirectCounterInterval); 1227 $("#" + elementSelector + ">div>.stop-autoplay").hide(); 1228 $("#" + elementSelector + ">div>span>.fa-forward>span").remove(); 1229} 1230 1231function pauseFancyVideo() { 1232 videojs('videoclip_html5_api').pause(); 1233} 1234 1235var redirectCounterInterval; 1236 1237(function ($) { 1238 $.fn.countTo = function (options) { 1239 // merge the default plugin settings with the custom options 1240 options = $.extend({}, $.fn.countTo.defaults, options || {}); 1241 1242 // how many times to update the value, and how much to increment the value on each update 1243 var loops = Math.ceil(options.speed / options.refreshInterval), 1244 increment = (options.from - options.to) / loops; 1245 1246 return $(this).each(function () { 1247 var _this = this, 1248 loopCount = 0, 1249 value = options.from; 1250 $(_this).html(options.from.toFixed(options.decimals)); 1251 redirectCounterInterval = setInterval(updateTimer, options.refreshInterval); 1252 1253 function updateTimer() { 1254 value -= increment; 1255 loopCount++; 1256 $(_this).html(value.toFixed(options.decimals)); 1257 1258 if (typeof(options.onUpdate) == 'function') { 1259 options.onUpdate.call(_this, value); 1260 } 1261 1262 if (loopCount >= loops) { 1263 clearInterval(redirectCounterInterval); 1264 value = options.to; 1265 1266 if (typeof(options.onComplete) == 'function') { 1267 options.onComplete.call(_this, value); 1268 } 1269 } 1270 } 1271 }); 1272 }; 1273 1274 $.fn.countTo.defaults = { 1275 from: 5, // the number the element should start at 1276 to: 0, // the number the element should end at 1277 speed: 5000, // how long it should take to count between the target numbers 1278 refreshInterval: 1000, // how often the element should be updated
1279 decimals: 0, // the number of decimal places to show 1280 onUpdate: null, // callback method for every time the element is updated, 1281 onComplete: null, // callback method for when the element finishes updating 1282 }; 1283})(jQuery); 1284 1285/** 1286 * This function counts down the timer for the next ad. 1287 * Its normally about 10 seconds. So if you have an ad that's showing 1288 * then you go on another tab and you come back in a second, we wont load 1289 * the new ad. We will only load it after the 10 seconds (or whatever count is) 1290 */ 1291function startAdCounter() { 1292 var timer = setInterval(function () { 1293 if (adDelay > 0) { 1294 adDelay--; 1295 } 1296 else { 1297 clearInterval(timer) 1298 } 1299 }, 1000); 1300} 1301 1302/** 1303 * Destroy the video player 1304 */ 1305function destroyVideoJs() { 1306 if ($('.videoclip').length && typeof videojs !== 'undefined') { 1307 var elemid = $('.videoclip').attr('id'); 1308 var vid = videojs(elemid); 1309 vid.dispose(); 1310 } 1311} 1312 1313function hideTopMenuOnMobile() { 1314 if (detectMobile()) { 1315 $("#top").addClass('hide-top'); 1316 } 1317} 1318 1319function showTopMenuOnMobile() { 1320 if (detectMobile()) { 1321 $("#top").removeClass('hide-top'); 1322 } 1323} 1324 1325function removeSubmenuActiveLink() { 1326 if ($('.submenu>.active>a').attr('href') != window.location.pathname) { 1327 $('.submenu>.active').removeClass('active'); 1328 } 1329} 1330 1331/** 1332 * Used to make logo small on scroll 1333 */ 1334function minifyLogoAndHideMenu(show) { 1335 var ml, tp, opc; 1336 if (show == 1) { 1337 tp = 66; 1338 opc = 1; 1339 ml = themeAssistant.animateLogoShowing() 1340 1341 } 1342 else { 1343 tp = 40 1344 opc = 0 1345 ml = themeAssistant.animateLogoHide() 1346 } 1347 1348 $('.radio-player-wrap').stop().animate({ 1349 marginLeft: ml 1350 }, 500, function () { 1351 // Animation complete. 1352 }); 1353 1354 $('#submenu').stop().animate({ 1355 top: tp, 1356 opacity: opc 1357 }, 500, function () { 1358 // Animation complete. 1359 }); 1360} 1361 1362//Load custom jPlayer 1363function loadMp3FileWithJPlayer(elemId, containerId, filePath) { 1364 $("#" + elemId).jPlayer({ 1365 ready: function () { 1366 $(this).jPlayer("setMedia", { 1367 mp3: filePath 1368 }); 1369 $(this).jPlayer("play"); 1370 }, 1371 supplied: "mp3", 1372 cssSelectorAncestor: '#' + containerId, 1373 preload: 'none', 1374 swfPath: "../addons/jPlayer.latest", 1375 solution: "html, flash", 1376 wmode: "window", 1377 nativeSuport: true 1378 }); 1379}; 1380 1381function hoverChannelsBtn(element) { 1382 if (element.getAttribute('src') == '/theme_assets/radio1/images/channels.png') { 1383 element.setAttribute('src', '/theme_assets/radio1/images/channels_hover.png'); 1384 } 1385 else if (element.getAttribute('src') == '/theme_assets/radio1rock/images/channels.png') { 1386 element.setAttribute('src', '/theme_assets/radio1rock/images/channels_hover.png'); 1387 } 1388} 1389 1390function unhoverChannelsBtn(element) { 1391 if (element.getAttribute('src') == '/theme_assets/radio1/images/channels_hover.png') { 1392 element.setAttribute('src', '/theme_assets/radio1/images/channels.png'); 1393 } 1394 else if (element.getAttribute('src') == '/theme_assets/radio1rock/images/channels_hover.png') { 1395 element.setAttribute('src', '/theme_assets/radio1rock/images/channels.png'); 1396 } 1397} 1398 1399function swap(a, b) { 1400 a = $(a); 1401 b = $(b); 1402 var tmp = $('<span>').hide(); 1403 a.before(tmp); 1404 b.before(a); 1405 tmp.replaceWith(b); 1406}; 1407 1408function swapCssClasses(a, b) { 1409 var tmp = a.attr("class"); 1410 a.attr("class", b.attr("class")); 1411 b.attr("class", tmp); 1412}; 1413 1414function setupChartVote() { 1415 var $song_likes = $(this).parent().parent().find('.song-likes'); 1416 var $likes = (parseInt($song_likes.html(), 10) + 1); 1417 1418 var $row = $(this).parent().parent(); 1419 var $make_change = $('.chart-order').length > 0; 1420 while ($make_change && $row.prev().length > 0) { 1421 var $order = $row.find('.chart-order'); 1422 var $prev_song_likes = $row.prev().find('.song-likes');
1423 var $prev_likes = (parseInt($prev_song_likes.html(), 10)); 1424 if ($likes > $prev_likes) { 1425 var $prev_order = $row.prev().find('.chart-order'); 1426 swap($order, $prev_order); 1427 swapCssClasses($row, $row.prev()); 1428 $row.after($row.prev()); 1429 $('.internal-loading').show(); 1430 $('#chart-grid').hide(); 1431 $('.article-line').hide(); 1432 setTimeout( 1433 function () { 1434 $('.internal-loading').hide(); 1435 $('#chart-grid').show(); 1436 $('.article-line').show(); 1437 }, 400); 1438 } 1439 else { 1440 $make_change = false; 1441 } 1442 } 1443 1444 $(this).parent().append('<div class="song-likes song-voted-link">' + $likes + '</div><i class="fa fa-thumbs-up song-voted-link"></i>'); 1445 $(this).remove(); 1446} 1447 1448function initMap() { 1449 var map; 1450 var bounds = new google.maps.LatLngBounds(); 1451 var mapOptions = { 1452 zoom: 2, 1453 center: new google.maps.LatLng(22.6977082, 13.321867500000053), 1454 mapTypeId: google.maps.MapTypeId.ROADMAP 1455 }; 1456 1457 // Display a map on the page 1458 map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions); 1459 map.setTilt(45); 1460 1461 var page = '/radio-lover/marker'; 1462 $.ajax({
1463 url: detectIE() ? 'http://' + window.location.hostname + page 1464 : location.origin + page, 1465 type: 'GET', 1466 dataType: 'json', 1467 success: function (data) { 1468 var infoWindow = new google.maps.InfoWindow(), marker, i; 1469 1470 // Loop through our array of markers & place each one on the map 1471 for (i = 0; i < data.length; i++) { 1472 var position = new google.maps.LatLng(data[i]['longitude'], data[i]['latitude']); 1473 bounds.extend(position); 1474 marker = new google.maps.Marker({ 1475 position: position, 1476 map: map, 1477 title: data[i]['text'], 1478 icon: '/themes/commons/img/icons/' + data[i]['icon'] 1479 }); 1480 1481 // Allow each marker to have an info window 1482 google.maps.event.addListener(marker, 'click', (function (marker, i) { 1483 return function () { 1484 infoWindow.setContent(data[i]['text']); 1485 infoWindow.open(map, marker); 1486 } 1487 })(marker, i)); 1488 1489 // Automatically center the map fitting all markers on the screen 1490 map.fitBounds(bounds); 1491 } 1492 } 1493 }); 1494 1495 // Override our map zoom level once our fitBounds function runs (Make sure it only runs once) 1496 var boundsListener = google.maps.event.addListener((map), 'bounds_changed', function (event) { 1497 google.maps.event.removeListener(boundsListener); 1498 }); 1499}
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.