1if (typeof console == "undefined" || typeof console.log == "undefined") var console = { log: function() {} }; 2 3$(function() 4{ 5 IV.init(); 6}); 7 8var IVUser = 9{ 10 constIGNORE: "ignore", 11 constSUBSCRIBES: "subscribes", 12 constWATCHLATER: "watchlater", 13 cLiveBackPressed: "live_back_pressed", 14 cSubscribe_opened: "subscribe_opened", 15 cSubscribeNumClicked: "subscribeNumClicked", 16 cWatchlater_opened: "watchlater_opened", 17 htmlOverlayIgnore: "<div class='opacityLayer85white i'><div>Ezt a videót töröltük a listáról.<br><span>törlés visszavonása</span></div></div>", 18 htmlOverlayWatchlater: "<div class='opacityLayer85white wl'><div>ezt a videót eltetted késÅbbre.<br><span>mégsem</span></div></div>", 19 intervalAnimateSubscribeIcon: 0, 20 intervalGetNew: 0, 21 iSubscribeLoadImage: '', 22 oScroller: {}, 23 oScrollerWatchLater: {}, 24 page: "mainpage", 25 sCheckboxes: '#subscribes_header input[type=checkbox]', 26 sCSRF: '#csrf', 27 sCSRFSubscription: '#CSRF_subscription', 28 sCSRFProfil: '#CSRF_videoBox', 29 sCSRFBroadcast: '#CSRF_broadcast', 30 sCustomData: '#customdata', 31 sDigestFreqRadio: '.digest_freq_radio', 32 sIgnoreVideoBtn: ".edit_watchlater_button", 33 sGetNewText: "Ãj videók kerültek kedvenc csatornáidra!", 34 sHeaderSubscriberNum: '#us_subs', 35 sIndafotoErotikaKep: "#indafoto-erotika-box .indafoto-erotika-box-image", 36 sIndafotoErotikaKepCim: "#indafoto-erotika-box .indafoto-erotika-box-image-title", 37 sIndafotoErotikaKepAuthor: "#i ndafoto-erotika-box .indafoto-erotika-box-image-author", 38 sIranyito: '#iranyito', 39 sIranyitoExit: '#iranyito .exit', 40 sIranyitoNext: '#iranyito .next', 41 sIranyitoPrev: '#iranyito .prev', 42 sLazy: ".lazy", 43 sLiveDownBtn: ".live_down .btn", 44 sLogoutSubscribeBtn: '.loggedout_subscribe_btn', 45 sManageSubscribe: '#subscribes li .leiratkoz', 46 sMegnezemBtn: "#tv .btn", 47 sMKSPromo: "#mks_banner", 48 sMyContainer: '#my_container', 49 sMySubscribtions: '#my_subscribes', 50 sMyWatchLater: '#my_watch_later', 51 sOverlayLayerName: "opacityLayer85white", 52 sPlaylistSubscribe: '.playlist_subscribe', 53 sPromoClose: '.promo_hover .close', 54 sPromoHoverElement: '.promo_hover', 55 sRestoreIgnoreVideos: '.opacityLayer85white.i div span', 56 sRestoreWatchlaterVideos: '.opacityLayer85white.wl div span', 57 sSubscribedElements: '#my_subscribed_videos_elements', 58 sWatchlaterElements: '#my_watchlater_videos_elements', 59 sSubscribedVideo: '#my_subscribed_videos_elements li a', 60 sWatchlaterVideo: '#my_watchlater_videos_elements li a', 61 sSubscribeLi: '#subscribes li', 62 sSubscribeLoadImageSrc: '/images/default/icons2/feliratkozas_loading.gif', 63 sSubscriber: '.playlist_subscribe', 64 sSubscriberIcon: '.playlist_subscribe .ps .img', 65 sSubscriberNum: '.playlist_subscribe_num', 66 sSubscribesList: '#my_subscribed_videos', 67 sSubscribesListOpener : '#channelBar .back .subscribes_open', 68 sSubscribesInner: "#my_subscribed_videos_inner", 69 sVideo: "#video404", 70 sVideoSource: "#video404 source", 71 sWatchLater: ".add_watch_later", 72 sWatchLaterBtn: '.watchlater_button', 73 sWatchLaterInner: "#my_watchlater_videos_inner", 74 sWatchLaterList: '#my_watchlater_videos', 75 sWatchLaterSubscriber: ".new_browse .subscribe_button", 76 77 sSubscribeEdit : ".subscribe_edit", 78 sNewVideosCount: "#new_videos_count", 79 80 urlUserHandler: '/userhandler', 81 urlVideoHandler: '/videohandler', 82 83 videos404: [], 84 videos404data: {}, 85 86 cookieMKSPromo: "mks_promo", 87 88 init: function() 89 { 90 var self = this; 91 92 if ($.cookie && $.cookie(self.cookieMKSPromo) == "1") 93 $(self.sMKSPromo).hide(); 94 95 this.sSubscribeLoadImageSrc = IV.assetsUrl + this.sSubscribeLoadImageSrc; 96 97 if ($(this.sSubscribesList).length !== 0) { 98 this.oScroller = new Scroller(); 99 this.oScrollerWatchLater = new Scroller({ 100 personalContexts : "#my_watchlater_videos", 101 leftArrowElem : "#my_watchlater_videos .left.arrow", 102 rightArrowElem : "#my_watchlater_videos .right.arrow", 103 sliderContainer : "#my_watchlater_videos_elements" 104 }); 105 } 106 107 $(this.sSubscribedElements).find(this.sLazy).each(function() { 108 $(this).lazyload({ 109 event: "lazyload", 110 effect: "fadeIn", 111 container: $(self.sSubscribedElements) 112 }).trigger("lazyload"); 113 }); 114 115 $(this.sWatchlaterElements).find(this.sLazy).each(function() { 116 $(this).lazyload({ 117 event: "lazyload", 118 effect: "fadeIn", 119 container: $(self.sWatchlaterElements) 120 }).trigger("lazyload"); 121 }); 122 123 this.iSubscribeLoadImage = new Image(); 124 this.iSubscribeLoadImage.src = this.sSubscribeLoadImageSrc; 125 this.events(); 126 127 if (getUrlParam("error") == "badpass" && getUrlParam("error_from") == "subscribe") 128 $(this.sLogoutSubscribeBtn).click(); 129 130 this.getPageType(); 131 var location = window.location; 132 133 // if ($.cookie(IVUser.cSubscribe_opened) && !/http\:\/\/film\.[a-zA-Z\.\-]*indavideo\.hu/.test(location) && !/http\:\/\/palyazat\.[a-zA-Z\.\-]*indavideo\.hu/.test(location)) { 134 // this.toggleSubscribes(); 135 // } 136 // this.getNewSubscribedVideos(); 137 }, 138 139 ePromoHoverCloseClick: function() 140 { 141 var mom = IVUser; 142 var hash = $(mom.sPromoHoverElement).data('hash'); 143 144 if (hash == "") 145 hash = mom.cookieMKSPromo; 146 147 $(mom.sMKSPromo + ', ' + mom.sPromoHoverElement).hide(); 148 149 $.cookie(hash, '1', { expires: 1, path: '/' } ); 150 }, 151 152 animateSubscribe: function(stop) { 153 var mom = this; 154 155 stop = (stop === undefined || !stop) ? false : true; 156 157 if (!$(mom.sSubscriber).hasClass("loading") && mom.intervalAnimateSubscribeIcon === 0 && !stop) { 158 $(mom.sSubscriberIcon).fadeOut(600, function() { 159 // $(mom.sSubscriber).animate({ 160 // background: "rgb(208,88,76)" 161 // },1000, function() { 162 // }); 163 164 $(this).fadeIn(600, function() { 165 $(mom.sSubscriberIcon).css({ 'background-position': "-198px -22px" }); 166 setTimeout(function() { 167 $(mom.sSubscriberIcon).css({ 'background-position': "-198px 0" }); 168 },500); 169 170 setTimeout(function() { 171 $(mom.sSubscriberIcon).css({ 'background-position': "-198px -22px" }); 172 },1000); 173 174 setTimeout(function() { 175 $(mom.sSubscriberIcon).css({ 'background-position': "-198px 0" }); 176 },1500); 177 178 setTimeout(function() { 179 $(mom.sSubscriberIcon).css({ 'background-position': "-198px -22px" }); 180 },2000); 181 182 setTimeout(function() { 183 $(mom.sSubscriberIcon).css({ 'background-position': "-198px 0" }); 184 },2500); 185 }); 186 }); 187 188 mom.intervalAnimateSubscribeIcon = setInterval(function() { 189 $(mom.sSubscriberIcon).fadeOut(600, function() { 190 $(mom.sSubscriber).animate({ 191 background: "rgb(208,88,76)" 192 },500); 193 $(this).fadeIn(600, function() { 194 $(mom.sSubscriberIcon).css({ 'background-position': "-198px -22px" }); 195 setTimeout(function() { 196 $(mom.sSubscriberIcon).css({ 'background-position': "-198px 0" }); 197 },500); 198 199 setTimeout(function() { 200 $(mom.sSubscriberIcon).css({ 'background-position': "-198px -22px" }); 201 },1000); 202 203 setTimeout(function() { 204 $(mom.sSubscriberIcon).css({ 'background-position': "-198px 0" }); 205 },1500); 206 207 setTimeout(function() { 208 $(mom.sSubscriberIcon).css({ 'background-position': "-198px -22px" }); 209 },2000); 210 211 setTimeout(function() { 212 $(mom.sSubscriberIcon).css({ 'background-position': "-198px 0" }); 213 },2500); 214 }); 215 }); 216 },4400); 217 setTimeout(function() { 218 $(mom.sSubscriber).addClass('loading'); 219 },600); 220 } 221 else if (stop || $(mom.sSubscriberIcon).closest('.ps').is(":visible")) { 222 if (mom.intervalAnimateSubscribeIcon !== 0) 223 clearInterval(mom.intervalAnimateSubscribeIcon); 224 mom.intervalAnimateSubscribeIcon = 0; 225 $(mom.sSubscriber).removeClass('loading'); 226 $(mom.sSubscriberIcon).stop(true).removeAttr('style'); 227 } 228 }, 229 230 events: function() 231 { 232 $(document).on("click",this.sDigestFreqRadio,this.eDigestClick); 233 $(document).on("click",this.sManageSubscribe,this.eManageSubscribeClick); 234 $(document).on("click",this.sWatchLaterSubscriber,this.eSubscribeClick); 235 $(document).on("click",this.sPlaylistSubscribe,this.eSubscribeClick); 236 $(document).on("click",this.sSubscribesListOpener,this.eSubscribesListOpen); 237 $(document).on("click",this.sMySubscribtions,this.eSubscribesListOpen); 238 $(document).on("click",this.sMyWatchLater,this.eWatchLaterListOpen); 239 $(document).on("click",this.sNewVideosCount,this.eSubscribesListOpen); 240 $(document).on("click",this.sSubscribedVideo,this.eSubscribeVideoClick); 241 $(document).on("click",this.sWatchlaterVideo,this.eWatchlaterVideoClick); 242 243 $(document).on("click",this.sLiveDownBtn,this.eLiveDownBtnClick); 244 245 $(document).on("click",this.sWatchLater,this.eSetWatchLater); 246 $(document).on("click",this.sWatchLaterBtn,this.eSetWatchLater); 247 248 $(this.sLogoutSubscribeBtn).on("click",this.eLoginAndSubscribe); 249 $(document).on("click",this.sIgnoreVideoBtn,this.eIgnoreVideo); 250 $(document).on("click",this.sRestoreIgnoreVideos,this.eRestoreIgnoreVideo); 251 $(document).on("click",this.sRestoreWatchlaterVideos,this.eRestoreWatchlaterVideo); 252 $(document).on("change",this.sCheckboxes,this.eCheckAll); 253 254 $(document).on('click',this.sPromoClose,this.ePromoHoverCloseClick); 255 256 $(this.sIranyitoExit) 257 .on("mousedown",this.ePushIranyitoBtn) 258 .on("mouseup",this.eReleaseIranyitoBtn); 259 $(this.sIranyitoNext) 260 .on("click",this.eRefresh404Video) 261 .on("mousedown",this.ePushIranyitoBtn) 262 .on("mouseup",this.eReleaseIranyitoBtn); 263 $(this.sIranyitoPrev) 264 .on("click",this.eRefresh404Video) 265 .on("mousedown",this.ePushIranyitoBtn) 266 .on("mouseup",this.eReleaseIranyitoBtn); 267 268 $(document).on("click",this.sIndafotoErotikaKep,function() {
269 _gaq.push(['t2._trackEvent', 'Indafotó', 'Erotika doboz - ' + IVUser.page, "kép"]); 270 }); 271 $(document).on("click",this.sIndafotoErotikaKepCim,function() { 272 _gaq.push(['t2._trackEvent', 'Indafotó', 'Erotika doboz - ' + IVUser.page, "kép cÃme"]); 273 }); 274 $(document).on("click",this.sIndafotoErotikaKepAuthor,function() { 275 _gaq.push(['t2._trackEvent', 'Indafotó', 'Erotika doboz - ' + IVUser.page, "kép készÃtÅje"]); 276 }); 277 }, 278 279 eCheckAll: function(e) 280 { 281 var c = $(e.target).closest("span").attr('class'); 282 $(IVUser.sCheckboxes).attr("checked",false); 283 $("."+c+" input").attr('checked', true); 284 285 var ids = []; 286 var user = ""; 287 var freq = ""; 288 $("."+c+" input[type=radio]").each(function() { 289 ids.push($(this).attr('data-id')); 290 if (user === "") 291 user = $(this).attr("data-user"); 292 if (freq === "") 293 freq = $(this).attr("data-digest"); 294 }); 295 296 IVUser.subscribe(user,1,{digest_frequency:freq, ids:ids}); 297 // ide kell gomb-refresh 298 299 return false; 300 }, 301 302 eIgnoreVideo : function(e) { 303 IVUser.ignoreVideo($(this).attr("data-videourltitle"),{target: e.target}); 304 }, 305 306 eDigestClick : function() 307 { 308 IVUser.subscribe($(this).attr("data-user"),1, {digest_frequency: $(this).attr("data-digest")}); 309 $(IVUser.sCheckboxes).attr("checked",false); 310 311 // return false; 312 }, 313 314 eLiveDownBtnClick: function(e) { 315 var self = IVUser; 316 317 var user = $(self.sLiveDownBtn).data("name"); 318 if (!$(self.sLiveDownBtn).hasClass('done') && !$(self.sLiveDownBtn).hasClass('loading') && $.cookie(self.cLiveBackPressed) != 1) { 319 $(self.sLiveDownBtn).addClass("loading"); 320 321 $.ajax({
322 url : self.urlUserHandler + "/" + user, 323 type : "POST", 324 data : { 325 op: "broadcastBack", 326 CSRF: $(self.sCSRFBroadcast).val() 327 }, 328 dataType : "json", 329 success : function(data) { 330 $(self.sLiveDownBtn).removeClass('loading').html("Köszönjük!").addClass("done"); 331 $.cookie(IVUser.cLiveBackPressed, 1, { expires: 365, path: '/', domain: 'indavideo.hu' }); 332 } 333 }); 334 } 335 }, 336 337 eLoginAndSubscribe: function(e) { 338 IV.prevent(e); 339 var location = window.location.href; 340 var domain = location.split("/")[2]; 341 342 var redirUrl = "http://"+domain+"/userhandler/"+$(e.target).closest(IVUser.sSubscriber).attr("data-user")+"?addOrRemove=1&digest_frequency=10&op=subscribe&login_name="+$(e.target).closest(IVUser.sSubscriber).attr("data-user")+"&CSRF="+$(IVUser.sCSRFSubscription).val()+"&redirect_to="+encodeURIComponent(location); 343 msgLogin(false,redirUrl); 344 }, 345 346 eManageSubscribeClick: function(e) 347 { 348 IV.prevent(e); 349 350 if (!$(e.target).hasClass('loggedout_subscribe_btn')) 351 IVUser.subscribe($(this).attr("data-user"),0, {digest_frequency: 10}); 352 $(this).closest('li').remove(); 353 354 if ($(IVUser.sSubscribeLi).length < 2) { 355 $(IVUser.sCustomData).html('<div id="null-subscriber">Nincs még feliratkozásod!</div>'); 356 } 357 358 return false; 359 }, 360 361 ePushIranyitoBtn: function(e) { 362 var self = IVUser; 363 364 $(e.target).addClass("clicked"); 365 $(self.sIranyito).addClass("clicked"); 366 }, 367 368 eReleaseIranyitoBtn: function(e) { 369 var self = IVUser; 370 371 $(e.target).removeClass("clicked"); 372 $(self.sIranyito+","+self.sIranyitoPrev+","+self.sIranyitoNext).removeClass("clicked"); 373 }, 374 375 eRefresh404Video: function(e) { 376 var self = IVUser; 377 var irany = ""; 378 var video = $(self.sVideo); 379 var videoSource = $(self.sVideoSource); 380 var videoDOM = $(self.sVideo)[0]; 381 var originalURL = videoSource.attr("src"); 382 var originalPoster = video.attr("poster"); 383 384 if ($(e.target).hasClass("prev")) 385 irany = "vissza"; 386 else if ($(e.target).hasClass('next')) 387 irany = "elore"; 388 389 var array = { 390 tmb_src : originalPoster, 391 url : $(IVUser.sMegnezemBtn).attr("href") 392 }; 393 394 if ($.inArray(originalURL, IVUser.videos404) < 0) { 395 self.videos404.push(originalURL); 396 self.videos404data[originalURL] = array; 397 } 398 399 if (irany == "elore") { 400 if ($.inArray(originalURL, IVUser.videos404) == IVUser.videos404.length-1) { 401 $.ajax({ 402 url : "/404", 403 type : "POST", 404 data : { 405 "ajax" : 1 406 }, 407 dataType : "json", 408 success : function(data) { 409 if (data.video_hash && data.video_hash != "") { 410 var src = originalURL.replace(/\/404\/[a-z0-9]+\.mp4/g,"/404/"+data.video_hash+".mp4"); 411 var poster = originalPoster.replace(/indavideo\.hu\/videos\/[0-9\/\\\-]+\.jpg/g,"indavideo.hu/videos/"+data.tmb_src); 412 413 $(IVUser.sMegnezemBtn).attr("href","/video/"+data.url_title); 414 video.attr("poster",poster); 415 videoDOM.setAttribute("src", src); 416 videoSource.attr("src", src); 417 videoDOM.load(); 418 } 419 } 420 }); 421 } 422 else { 423 var next = IVUser.videos404[($.inArray(originalURL, IVUser.videos404)+1)]; 424 425 $(IVUser.sMegnezemBtn).attr("href",IVUser.videos404data[next]["url"]); 426 video.attr("poster",IVUser.videos404data[next]["tmb_src"]); 427 videoDOM.setAttribute("src", next); 428 videoSource.attr("src", next); 429 videoDOM.load(); 430 } 431 } 432 else if (irany == "vissza" && $.inArray(originalURL, IVUser.videos404) != 0) { 433 var before = IVUser.videos404[($.inArray(originalURL, IVUser.videos404)-1)]; 434 435 $(IVUser.sMegnezemBtn).attr("href",IVUser.videos404data[before]["url"]); 436 video.attr("poster",IVUser.videos404data[before]["tmb_src"]); 437 videoDOM.setAttribute("src", before); 438 videoSource.attr("src", before); 439 videoDOM.load(); 440 } 441 }, 442 443 eRestoreIgnoreVideo: function(e) { 444 IV.prevent(e); 445 446 var item = $(e.target).closest(".item"); 447 if (item.length > 0) 448 IVUser.restoreIgnoreVideo(item); 449 }, 450 451 eRestoreWatchlaterVideo: function(e) { 452 IV.prevent(e); 453 454 var item = $(e.target).closest(".item"); 455 if (item.length > 0) 456 IVUser.restoreWatchlaterVideo(item); 457 }, 458 459 eSetWatchLater: function(e) 460 { 461 IV.prevent(e); 462 // console.log("wl"); 463 var url_title = $(e.target).attr("data-title"); 464 var addremove = 1; 465 466 if ($(e.target).hasClass('later')) 467 addremove = 0; 468 469 IVUser.watchlater(url_title, addremove, { target: e.target }); 470 471 var elements = $(e.target).closest(IVUser.sSubscribedElements); 472 473 if (elements.length > 0) { 474 $(e.target).closest('li').fadeOut('fast').remove(); 475 IVUser.oScroller.refreshSlider(); 476 477 if (elements.find("li").length === 0) 478 IVUser.getSubscribedVideos(); 479 } 480 481 }, 482 483 eSubscribeClick: function(e) 484 { 485 IV.prevent(e); 486 487 if (!$(e.target).hasClass('loggedout_subscribe_btn') && $(e.target).closest(".loggedout_subscribe_btn").length === 0) { 488 var confirm = ($(e.target).closest(".TYPE_47").length > 0 && $(e.target).hasClass('subscribed')) ? 1 : 0; 489 IVUser.subscribe($(this).attr("data-user"),(($(e.target.parentNode).hasClass("subscribed") || $(e.target).hasClass("p_sdl")) ? 0 : 1), {digest_frequency: 10, target: e.target, confirm: confirm}); 490 console.log($(e.target.parentNode)); 491 if ($(e.target.parentNode).hasClass('subscribed')) { 492 $(e.target).html('Feliratkozás'); 493 } else { 494 $(e.target).html('Leiratkozás'); 495 496 } 497 } 498 499 return false;
500 }, 501 502 eSubscribesListOpen: function(e) 503 { 504 // IVUser.getSubscribedVideos(); 505 IV.prevent(e); 506 IVUser.toggleSubscribes(true); 507 //IVUser.clearGetNew(); 508 509 return false; 510 }, 511 512 eSubscribeVideoClick: function() { 513 _gaq.push(['t2._trackEvent', 'Subscribe', 'SubsBarVideo', IVUser.page]); 514 }, 515 516 eWatchlaterVideoClick: function() { 517 _gaq.push(['t2._trackEvent', 'Watchlater', 'WatchlBarVideo', IVUser.page]); 518 }, 519 520 // clearGetNew: function(allclear) 521 // { 522 // clearInterval(IVUser.intervalGetNew); 523 // $(IVUser.sNewVideosCount).animate({ 524 // left: "350px" 525 // },{ 526 // queue: false, 527 // duration: 200 528 // }); 529 530 // $(IVUser.sMySubscribtions).animate({ 531 // left: "-30px" 532 // }, { 533 // queue: false, 534 // duration: 400, 535 // easing: "easeOutCirc", 536 // complete: function() { 537 // $(IVUser.sMySubscribtions).text("Feliratkozásaim").css({ 538 // color: "#191919" 539 // }).removeClass("got_new").animate({ 540 // left: "0px" 541 // }, { 542 // queue: false, 543 // duration: 400, 544 // easing: "easeOutCirc" 545 // }).animate({ 546 // opacity: 1 547 // }, 200, "linear"); 548 // } 549 // }).animate({ 550 // opacity: 0 551 // }, 200, "linear"); 552 553 // if (!allclear) 554 // IVUser.intervalGetNew = setInterval(IVUser.getNewSubscribedVideos, 5000); 555 // }, 556 557 // getNewSubscribedVideos: function() 558 // { 559 // if($(IVUser.sSubscribesList).hasClass('opened')) { 560 // var rand = Math.floor((Math.random()*5)+1); 561 // console.log(rand); 562
563 // if ($(IVUser.sNewVideosCount).css("left") == "320px") 564 // $(IVUser.sNewVideosCount).animate({ 565 // left: "350px" 566 // }, 200, "linear", function() { 567 // console.log("kimegy"); 568 // }); 569 570 // $(IVUser.sNewVideosCount).animate({ 571 // left: "320px" 572 // },200,"linear",function() { 573 // $(this).text(rand); 574 // console.log("bejön"); 575 // }); 576 577 // var li = $(IVUser.oScroller.sliderContainer+" li").first(); 578 579 // for (var i = 0; i<rand; i++) { 580 // $(IVUser.oScroller.sliderContainer).prepend(li.clone().addClass('hidden_li')); 581 // } 582 583 // $(IVUser.oScroller.sliderContainer+" li.hidden_li").animate({ 584 // opacity: 1 585 // },1000,"easeInCirc",function() { 586 // $(this).removeClass("hidden_li"); 587 // }); 588 589 590 // if ($(IVUser.oScroller.sliderContainer).css("marginLeft") != "0px") { 591 // IVUser.oScroller.visibleFirst += rand; 592 // IVUser.oScroller.sliderMargin -= IVUser.oScroller.oneLi*rand; 593 // IVUser.clearGetNew(true); 594 // console.log("nincs elöl"); 595 // } 596 597 // IVUser.oScroller.refreshSlider(); 598 // } 599 // else { 600 // IVUser.setGetNew(); 601 // } 602 // }, 603 604 eWatchLaterListOpen: function() 605 { 606 // IVUser.getSubscribedVideos(); 607 IVUser.toggleSubscribes(true,true); 608 //IVUser.clearGetNew(); 609 610 return false; 611 }, 612 613 addOpacityLayerToElement : function(element,type) { 614 var mom = IVUser; 615 616 if (!(element instanceof jQuery)) 617 element = $(element); 618 619 if (!(element instanceof jQuery) || element.length == 0) 620 console.log("nincs ilyen elem a DOMban"); 621 622 if (type == mom.constWATCHLATER) 623 element.append(mom.htmlOverlayWatchlater); 624 else if (type == mom.constIGNORE) 625 element.append(mom.htmlOverlayIgnore); 626 627 element.find("."+mom.sOverlayLayerName).animate({ 628 opacity: 1 629 },"slow"); 630 element.addClass('deleted'); 631 632 }, 633 634 getPageType: function() { 635 var loc = window.location.href; 636 637 if (/\/browse/.test(loc)) { 638 this.page = "browse"; 639 } 640 else if (/\/video/.test(loc)) { 641 this.page = "video"; 642 } 643 else if (/\/profile/.test(loc)) { 644 this.page = "profile"; 645 } 646 else if (/\/upload/.test(loc)) { 647 this.page = "upload"; 648 } 649 else if (/\/broadcast/.test(loc)) { 650 this.page = "broadcast"; 651 } 652 }, 653 654 getSubscribedVideos: function() { 655 $.ajax( 656 { 657 url: this.urlVideoHandler, 658 type: 'POST', 659 dataType: 'json', 660 data: 661 { 662 op: 'getSubscribedContent' 663 }, 664 success: function(res) 665 { 666 if (res.success == 1) { 667 if (res.videos.length != 0) { 668 var out = ""; 669 $.each(res.videos, function(index,item) { 670 out += '<li>' + 671 '<div class="video_image">' + 672 '<span class="add_watch_later" data-title="'+item.url_title+'"></span>' + 673 '<a href="'+item._urlVideo+'">' + 674 '<img src="'+item._urlpicVideo+'">' + 675 '</a>' + 676 '</div>' + 677 '<span class="my_subscribed_videos_data">' + 678 '<h3><a href="'+item._urlVideo+'">'+item.title+'</a></h3>' + 679 '<a href="'+item._urlProfile+'" class="my_subscribed_video_owner">' + 680 '<img class="my_subscribed_video_owner_pic" src="'+item._urlpicAvatar+'">' + 681 (item.username !== "" ? item.username : item.login_name)+ 682 '</a>' + 683 '</span>' + 684 '<div class="clear"></div>' + 685 '</li>'; 686 }); 687 688 $(IVUser.sSubscribedElements).html(out); 689 IVUser.oScroller.refreshSlider(); 690 } 691 else{ 692 $(IVUser.sSubscribedElements).html("<li>Nincs megnézendŠvideód!</li>") 693 IVUser.oScroller.refreshSlider(); 694 IVUser.toggleSubscribes(); 695 } 696 } 697 }, 698 error: function(xhr) 699 { 700 console.log("rossz",xhr); 701 } //function 702 }); 703 }, 704 705 ignoreVideo : function(video_url_title,D) { 706 $(D.target).addClass('pulsing'); 707 708 $.ajax( 709 { 710 url: this.urlVideoHandler, 711 type: 'POST', 712 dataType: 'json', 713 data: 714 { 715 op: 'setIgnore', 716 url_title: video_url_title, 717 remove: (D.remove) ? 1 : 0 718 }, 719 success: function(res) 720 { 721 if (!D.remove && D.target) { 722 var target = (D.target instanceof jQuery) ? D.target : $(D.target); 723 var item = (target.hasClass('item')) ? target : target.closest('.item'); 724 725 IVUser.addOpacityLayerToElement(item,IVUser.constIGNORE); 726 $(D.target).removeClass('pulsing'); 727 } 728 else if (D.target) { 729 var target = (D.target instanceof jQuery) ? D.target : $(D.target); 730 var item = (target.hasClass('item')) ? target : target.closest('.item'); 731 732 IVUser.removeOpacityLayer(item); 733 } 734 } 735 }); 736 }, 737 738 isSubscribed: function(user) 739 { 740 var mom = this; 741 742 $.ajax( 743 { 744 url: this.urlUserHandler + user, 745 type: 'POST', 746 dataType: 'json', 747 data: 748 { 749 op: 'subscribed' 750 }, 751 success: function(res) 752 { 753 if (res.success == 1) 754 $(IVUser.sSubscriber).addClass("subscribed"); 755 } //function 756 }); 757 }, 758 759 // setGetNew: function() 760 // { 761 // IVUser.intervalGetNew = setInterval(function() {
762 // if ($(IVUser.sNewVideosCount).css("left") == "320px") 763 // $(IVUser.sNewVideosCount).animate({ 764 // left: "350px" 765 // }, 200, "linear"); 766 767 // $(IVUser.sNewVideosCount).text(Math.floor((Math.random()*100)+1)).animate({ 768 // left: "320px" 769 // },200,"linear",function() { 770 // $(IVUser.sMySubscribtions).animate({ 771 // left: "-30px" 772 // }, { 773 // queue: false, 774 // duration: 400, 775 // easing: "easeOutCirc", 776 // complete: function() { 777 // if ($(IVUser.sMySubscribtions).text() != IVUser.sGetNewText) 778 // $(IVUser.sMySubscribtions).text(IVUser.sGetNewText); 779 780 // $(IVUser.sMySubscribtions).css({ 781 // color: "#bd1818" 782 // }); 783 784 // $(IVUser.sMySubscribtions).addClass("got_new").animate({ 785 // left: "0px" 786 // }, { 787 // queue: false, 788 // duration: 400, 789 // easing: "easeOutCirc" 790 // }).animate({ 791 // opacity: 1 792 // }, 200, "linear"); 793 // } 794 // }).animate({ 795 // opacity: 0 796 // }, 200, "linear"); 797 // }); 798 // }, 4000); 799 // }, 800 801 removeOpacityLayer : function(item) { 802 if (!(item instanceof jQuery)) 803 item = $(item); 804 805 item.find("."+IVUser.sOverlayLayerName).fadeOut('slow', function() { 806 $(this).remove(); 807 item.removeClass('deleted'); 808 }); 809 }, 810 811 restoreIgnoreVideo : function(item) { 812 if (!(item instanceof jQuery)) 813 item = $(item); 814 815 var btn = item.find(IVUser.sIgnoreVideoBtn); 816 if (btn.length > 0) { 817 var url_title = btn.attr("data-videourltitle"); 818 819 IVUser.ignoreVideo(url_title,{'remove': 1, 'target': item}); 820 } 821 }, 822 823 restoreWatchlaterVideo : function(item) { 824 if (!(item instanceof jQuery)) 825 item = $(item); 826 827 var btn = item.find(IVUser.sWatchLaterBtn); 828 if (btn.length > 0) { 829 var url_title = btn.attr("data-title"); 830 831 IVUser.watchlater(url_title,0,{target: item, removeLayer: 1}); 832 } 833 }, 834 835 subscribe: function(user, addremove, D) 836 { 837 var mom = IVUser; 838// if (addremove === 1) 839// mom.animateSubscribe(); 840 // return; 841 842 if (typeof user === "object" && Object.keys(user).length == 3) { 843 addremove = (user.addremove) ? user.addremove : 0; 844 D = user.D; 845 user = user.user; 846 } 847 848 if ((!user || !addremove) && addremove != 0) { 849 return false; 850 } 851 852 var ids = null; 853 854 if (D.ids != undefined && D.ids) 855 ids = D.ids.join(); 856 857 var url = (D.ids != undefined && D.ids) ? mom.urlUserHandler : mom.urlUserHandler + "/"
857+ user; 858 var type = (D.ids != undefined && D.ids) ? "GET" : "POST"; 859 860 var subscribers = parseInt($(mom.sSubscriberNum).first().text() != "" ? $(mom.sSubscriberNum).first().text() : 0); 861 862 if (D.confirm) { 863 D.confirm = 0; 864 msgYesNo( 865 "Tényleg leiratkozol a csatorna új videóiról?", 866 "Még meggondolhatod magad!", 867 1, 868 { 869 doFunction : IVUser.subscribe, 870 args: { 871 user : user, 872 addremove : addremove, 873 D : D 874 } 875 }, 876 false); 877 } 878 else { 879 $.ajax( 880 { 881 url: url, 882 type: type, 883 dataType: 'json', 884 data: 885 { 886 op: 'subscribe', 887 addOrRemove: addremove, 888 digest_frequency: D.digest_frequency, 889 uid: ids, 890 CSRF: $(mom.sCSRFSubscription).length > 0 ? $(mom.sCSRFSubscription).val() : $(mom.sCSRFProfil).val() 891 }, 892 success: function(res) 893 { 894 mom.animateSubscribe(true); 895 if ($(IVUser.sSubscriber).hasClass('subscribed')) { 896 $(IVUser.sSubscriber).removeClass("subscribed"); 897 $(IVUser.sSubscriberNum).text(subscribers-1); 898 $(IVUser.sHeaderSubscriberNum).text(subscribers-1); 899 if ((subscribers-1) == 0) 900 $(IVUser.sSubscriberNum).hide(); 901 } 902 else { 903 $(IVUser.sSubscriber).addClass("subscribed"); 904 $(IVUser.sSubscriberNum).show().text(subscribers+1); 905 $(IVUser.sHeaderSubscriberNum).text(subscribers+1); 906 } 907 908 if ($(D.target).hasClass("subscribe_button") && $(D.target).hasClass("non-subscribed") && $(D.target).closest('.watchlater').length > 0) { 909 var data_attr = $(D.target).attr("data-user"); 910 $(".subscribe_button[data-user='"+data_attr+"']").fadeOut(200,function() { 911 $(this).hide(); 912 }); 913 } 914 915 if ($(D.target).hasClass("subscribe_button") && $(D.target).hasClass("subscribed")) { 916 var data_attr = $(D.target).attr("data-user"); 917 $(".subscribe_button[data-user='"+data_attr+"']").removeClass('subscribed').addClass('non-subscribed').attr("title","Feliratkozás"); 918 } 919 else { 920 var data_attr = $(D.target).attr("data-user"); 921 $(".subscribe_button[data-user='"+data_attr+"']").removeClass('non-subscribed').addClass('subscribed').attr("title","Leiratkozás"); 922 } 923 924 } //function 925 }); 926 } 927 }, 928 929 toggleSubscribes: function(click,isWatchLater) 930 { 931 var mom = this; 932 // if ($.cookie(IVUser.cWatchlater_opened)) { 933 // $(mom.sSubscribesListOpener).toggleClass('opened'); 934 // } 935 936 if (click) { 937 if (isWatchLater) { 938 if ($(mom.sSubscribesList).hasClass('opened')) { 939 if ($(IVUser.sSubscribeEdit).hasClass("active")) 940 $(IVUser.sSubscribeEdit).removeClass("active"); 941 942 $.removeCookie(IVUser.cSubscribe_opened, { path: '/', domain: 'indavideo.hu' }); 943 $.cookie(IVUser.cWatchlater_opened, 1, { expires: 365, path: '/', domain: 'indavideo.hu' }); 944 $(mom.sMyContainer).height($(mom.sMyContainer).height()); 945 $(mom.sMySubscribtions).removeClass('active'); 946 $(mom.sSubscribesList).fadeOut(300, function() { 947 $(this).toggleClass('opened'); 948 $(mom.sWatchLaterList).fadeIn(300, function() { 949 $(this).toggleClass('opened'); 950 $(mom.sMyWatchLater).toggleClass('active'); 951 $(mom.sMyContainer).height("auto"); 952 }); 953 }); 954 _gaq.push(['t2._trackEvent', 'Watchlater', 'WatchlBarSwitch', this.page]); 955 } 956 else if ($.cookie(IVUser.cWatchlater_opened) == 1 && $(mom.sWatchLaterList).hasClass('opened')) { 957 if ($(IVUser.sSubscribeEdit).hasClass("active")) 958 $(IVUser.sSubscribeEdit).removeClass("active"); 959 960 $.removeCookie(IVUser.cWatchlater_opened, { path: '/', domain: 'indavideo.hu' });
961 _gaq.push(['t2._trackEvent', 'Watchlater', 'WatchlBarClose', this.page]); 962 $(mom.sWatchLaterList).slideToggle(200, function() { 963 $(this).toggleClass('opened'); 964 $(mom.sMyWatchLater).toggleClass('active'); 965 }); 966 } 967 else { 968 if ($(IVUser.sSubscribeEdit).hasClass("active")) 969 $(IVUser.sSubscribeEdit).removeClass("active"); 970 971 $.cookie(IVUser.cWatchlater_opened, 1, { expires: 365, path: '/', domain: 'indavideo.hu' }); 972 _gaq.push(['t2._trackEvent', 'Watchlater', 'WatchlBarOpen', this.page]); 973 $(mom.sWatchLaterList).slideToggle(200, function() { 974 $(this).toggleClass('opened'); 975 $(mom.sMyWatchLater).toggleClass('active'); 976 }); 977 } 978 $(mom.sWatchlaterElements).find(mom.sLazy).trigger('lazyload'); 979 } 980 else { 981 if ($(mom.sWatchLaterList).hasClass('opened')) { 982 if ($(IVUser.sNewVideosCount).hasClass('active')) { 983 $(IVUser.sNewVideosCount).removeClass('active'); 984 $.cookie(IVUser.cSubscribeNumClicked, 1, { expires: 1, path: '/', domain: 'indavideo.hu' }); 985 } 986 987 if (!$(IVUser.sSubscribeEdit).hasClass("active")) 988 $(IVUser.sSubscribeEdit).addClass("active"); 989 990 $.removeCookie(IVUser.cWatchlater_opened, { path: '/', domain: 'indavideo.hu' }); 991 $.cookie(IVUser.cSubscribe_opened, 1, { expires: 365, path: '/', domain: 'indavideo.hu' }); 992 $(mom.sMyContainer).height($(mom.sMyContainer).height()); 993 $(mom.sMyWatchLater).removeClass('active'); 994 $(mom.sWatchLaterList).fadeOut(300, function() { 995 $(this).toggleClass('opened'); 996 $(mom.sSubscribesList).fadeIn(300, function() { 997 $(this).toggleClass('opened'); 998 $(mom.sMySubscribtions).toggleClass('active'); 999 $(mom.sMyContainer).height("auto"); 1000 }); 1001 }); 1002 _gaq.push(['t2._trackEvent', 'Subscribe', 'SubsBarSwitch', this.page]); 1003 } 1004 else if ($.cookie(IVUser.cSubscribe_opened) == 1 && $(mom.sSubscribesList).hasClass('opened')) { 1005 $(IVUser.sSubscribeEdit).removeClass("active"); 1006 1007 $.removeCookie(IVUser.cSubscribe_opened, { path: '/', domain: 'indavideo.hu' }); 1008 _gaq.push(['t2._trackEvent', 'Subscribe', 'SubsBarClose', this.page]); 1009 $(mom.sSubscribesList).slideToggle(200, function() { 1010 $(this).toggleClass('opened'); 1011 $(mom.sMySubscribtions).toggleClass('active'); 1012 }); 1013 } 1014 else { 1015 if ($(IVUser.sNewVideosCount).hasClass('active')) { 1016 $(IVUser.sNewVideosCount).removeClass('active'); 1017 $.cookie(IVUser.cSubscribeNumClicked, 1, { expires: 1, path: '/', domain: 'indavideo.hu' }); 1018 } 1019 1020 if (!$(IVUser.sSubscribeEdit).hasClass("active")) 1021 $(IVUser.sSubscribeEdit).addClass("active"); 1022 1023 $.cookie(IVUser.cSubscribe_opened, 1, { expires: 365, path: '/', domain: 'indavideo.hu' }); 1024 _gaq.push(['t2._trackEvent', 'Subscribe', 'SubsBarOpen', this.page]); 1025 $(mom.sSubscribesList).slideToggle(200, function() { 1026 $(this).toggleClass('opened'); 1027 $(mom.sMySubscribtions).toggleClass('active'); 1028 }); 1029 } 1030 $(mom.sSubscribedElements).find(mom.sLazy).trigger('lazyload'); 1031 } 1032 } 1033 }, 1034 1035 watchlater: function(url_title, addremove, D) 1036 { 1037 var mom = IVUser; 1038 1039 if ((!url_title || !addremove) && addremove != 0) 1040 return false; 1041 1042 var target = (D.target instanceof jQuery) ? D.target : $(D.target); 1043 // console.log(target, D.target); 1044 target.addClass('pulsing'); 1045 1046 _gaq.push(['t2._trackEvent', 'Subscribe', 'SubsBarWatchLater', mom.page]); 1047 1048 $.ajax( 1049 { 1050 url: mom.urlVideoHandler, 1051 type: "POST", 1052 dataType: 'json', 1053 data: 1054 { 1055 op: 'watchlater', 1056 action: 'videoHandler', 1057 addOrRemove: addremove, 1058 url_title: url_title 1059 }, 1060 success: function(res) 1061 { 1062 target.removeClass('pulsing').removeAttr('title'); 1063 if (!D.removeLayer) { 1064 target.toggleClass("later"); 1065 if (target.hasClass(mom.sWatchLaterBtn.replace(/[\.\#]{1}/g, ""))) { 1066 mom.addOpacityLayerToElement(target.closest(".item"),mom.constWATCHLATER); 1067 } 1068 } 1069 else { 1070 var item = (target.hasClass('item')) ? target : target.closest('.item'); 1071 1072 IVUser.removeOpacityLayer(item); 1073 } 1074 } //function 1075 }); 1076 }, 1077 1078 ____: function(){} 1079}; 1080 1081var IVPlayList = 1082{ 1083 sPlaylistContainer: '#plContainer', 1084 sPagerHandle: '.plPagerHandle', 1085 sPagerHandleLeft: '#plPagerHandleLeft', 1086 sPagerHandleRight: '#plPagerHandleRight', 1087 sPagerHandlePrev: '#plPagerHandlePrev', 1088 sPagerHandleNext: '#plPagerHandleNext', 1089 sPlayStripContainer: '#plPlayStripContainer', 1090 sPlayStrip: '#plPlayStrip', 1091 sPlayStrip_OL: '#plPlayStrip ol', 1092 sPlayStripItems: '#plPlayStrip ol li', 1093 sItemTitle: '#itemTitle', 1094 sItemHelper: '.itemHelper', 1095 sUndoLastAction: '#undoLastAction', 1096 1097 sDelActualPlaylist: '#delActualPlaylist', 1098 1099 sActionRemoveOverlay: 'span.actionRemoveOverlay', 1100 1101 sPlaylistSelect: '#plPlaylistSelect', 1102 sPlaylistSelect_SelectedOption: '#plPlaylistSelect option:selected', 1103 sPlaylistToggle: '.plToggle', 1104 1105 sPlaylistShow: '#plShow', 1106 sPlaylistHide: '#plHide', 1107 1108 sLoopToggle: '.plLoopToggle', 1109 sLoopEnabled: '#plLoopEnabled', 1110 sLoopDisabled: '#plLoopDisabled', 1111 1112 //Context menuitem, toggles the playlist on/off 1113 sTogglePlaylist: '#showHideMyLists', 1114 1115 sItemPrefix: '#plv_', 1116 1117 paddingOffset: -5, 1118 animationDuration: 300, 1119 1120 //Interval after playstrip moves one element either way with a dragged (sortable) element on pagerhandles 1121 intervalHoverScroll: 200, 1122 1123 //Currently dragged item 1124 draggedItem: null, 1125 1126 //The last item id 1127 lastItemId: 0, 1128 1129 //Stores the last deleted video element 1130 undoLastVideo: { id:null, url_title: null, playlistID: null, html: null }, 1131 1132 //Current video played 1133 currentVideo: '', 1134 1135 //Current playlist ID - 1 by default, which is all videos per user 1136 currentPlaylistID: 1, 1137 1138 //setTimeout/setInterval timer ids 1139 timerID: {timeout : {}, interval: {}}, 1140 1141 textPlaylistHide: 'Listáim elrejtése', 1142 textPlaylistShow: 'Listáim mutatása', 1143 1144 urlPlaylistBar: '/playlist_bar/?load=1', 1145 urlLoadPlaylists: '/playlist_bar?load=1&json=1', 1146 urlLoadPlaylistItems: '/playlist/get/', 1147 urlPrefixVideoPage: '/video/', 1148 urlPlaylistAdmin: '/playlistadmin', 1149 1150 cookiePlaylistLoop: 'playlist_loop', 1151 1152 init: function() 1153 { 1154//EVENT HANDLERS 1155 1156 $(document).on('click', this.sPlaylistToggle, {mom: this}, this.togglePlayStripVisibility); 1157 $(document).on('click', this.sLoopToggle, {mom: this}, this.toggleLoop); 1158 1159 //video item mouseover - Show overlays, show actual video item title 1160 $(document).on('mouseover', this.sPlayStripItems, {mom:this}, this.eItemMouseOver); 1161 1162 //video item mouseout - Hide video item title 1163 $(document).on('mouseout', this.sPlayStripItems, {mom:this}, this.eItemMouseOut); 1164
1165 //video item click - navigate to video 1166 $(document).on('click', this.sPlayStripItems, {mom:this}, this.eItemClick); 1167 1168 //Playstrip mouseleave actions - like remove negative sign overlay 1169 $(document).on('mouseleave', this.sPlayStrip, {mom:this}, this.ePlaystripMouseLeave); 1170 1171 //right bottom negative sign overlay click - Remove video from playlist 1172 $(document).on('click', this.sActionRemoveOverlay, {mom:this}, this.eActionRemoveOverlayClick); 1173 1174 //Undo option - click 1175 $(document).on('click', this.sUndoLastAction, {mom:this}, this.eRestoreUndo); 1176 1177 //Show/hide playlist - from profile context menu 1178 $(document).on('click', this.sTogglePlaylist, {mom: this}, this.eTogglePlaylistVisibility); 1179 1180 //Playlist dropdown playlist change 1181 $(document).on('change',this.sPlaylistSelect, {mom: this}, this.ePlaylistSelectChange); 1182 1183 //$(this.sDelActualPlaylist).live('click',{mom: this}, this.eDelActualPlaylistClick); 1184 1185 $(document).on('click', this.sPagerHandle, {mom: this}, this.ePagerHandleClick); 1186 $(document).on('mouseover', this.sPagerHandle, {mom: this}, this.ePagerHandleOver); 1187 $(document).on('mouseout', this.sPagerHandle, {mom: this}, this.ePagerHandleOut); 1188 1189//INIT BASICS 1190 1191 //Current video played 1192 this.currentVideo = window.location.pathname.split('/')[2]; 1193 1194 if ( IV.sys.GET.pid ) 1195 { 1196 this.currentPlaylistID = IV.sys.GET.pid; 1197 1198 //IF PID is set, then we have to show the playlist 1199 this.eTogglePlaylistVisibility(); 1200 } //if 1201 }, 1202 1203 ePagerHandleOver: function(e) 1204 { 1205 var mom = e.data.mom; 1206 1207// IV.log('over'); 1208 1209 if (mom.draggedItem != null) 1210 { 1211 var itemOffset = mom.draggedItem.offset(); 1212 1213 IV.log('offset'); 1214 IV.log(itemOffset); 1215 } //if 1216 1217 if (mom.draggedItem != null) 1218 { 1219 //IV.log('GotItem!'); 1220 switch($(this).attr('id')) 1221 { 1222 case mom.sPagerHandleLeft.substr(1): 1223 mom.changePosition('-1', {animationDuration: 0}); 1224 1225 IV.log('left'); 1226 1227 clearInterval(mom.timerID.interval.changePosition); 1228 mom.timerID.interval.changePosition = null; 1229 mom.timerID.interval.changePosition = setInterval(function() 1230 { 1231 if (mom.timerID.interval.changePosition) 1232 { 1233 mom.changePosition('-1',{animationDuration: 0}) 1234 } 1235 }, mom.intervalHoverScroll); 1236 1237 IV.log('<<'); 1238 break; 1239 1240 case mom.sPagerHandleRight.substr(1): 1241 mom.changePosition('+1', {animationDuration: 0}); 1242 1243 IV.log('right'); 1244 1245 clearInterval(mom.timerID.interval.changePosition); 1246 mom.timerID.interval.changePosition = null; 1247 mom.timerID.interval.changePosition = setInterval(function() 1248 { 1249 if (mom.timerID.interval.changePosition) 1250 { 1251 mom.changePosition('+1',{animationDuration: 0}) 1252 } 1253 }, mom.intervalHoverScroll); 1254 1255 IV.log( 'intervalID:' + mom.timerID.interval.changePosition ); 1256 1257 IV.log('>>'); 1258 break; 1259 } //switch 1260 } //if 1261 }, 1262 1263 ePagerHandleOut: function(e) 1264 { 1265 var mom = e.data.mom; 1266 1267 if (mom.draggedItem != null) 1268 mom.draggedItem.css('position','absolute'); 1269 1270 //IV.log(mom.timerID.interval.changePosition); 1271 clearInterval(mom.timerID.interval.changePosition); 1272 mom.timerID.interval.changePosition = null; 1273 }, 1274 1275 eActionRemoveOverlayClick: function(e) 1276 { 1277 var mom = e.data.mom; 1278 1279 IV.log('remove'); 1280 1281 mom.removeFromPlaylist( mom.currentPlaylistID, $(this).parent('li') ); 1282 1283 e.stopPropagation(); 1284 1285 return; 1286 }, 1287 1288 ePlaylistSelectChange: function(e) 1289 { 1290 var mom = e.data.mom; 1291 1292 mom.loadPlaylistItems( $(mom.sPlaylistSelect_SelectedOption).val() ); 1293 1294 mom.hideUndoOption(); 1295 }, 1296 1297 hideUndoOption: function() 1298 { 1299 $(this.sUndoLastAction).hide(); 1300 }, 1301 1302 eItemMouseOver: function(e) 1303 { 1304 var mom = e.data.mom; 1305 1306 //Show video title 1307 $(mom.sItemTitle).text( $(this).attr('_title') ); 1308 1309 if (mom.currentPlaylistID != 1) 1310 var aro = $(this).children('span.actionRemoveOverlay').show(); 1311 }, 1312 1313 eItemMouseOut: function(e) 1314 { 1315 var mom = e.data.mom; 1316 var aro = $(this).children('span.actionRemoveOverlay'); 1317 1318 $(mom.sItemTitle).text( '' ); 1319 1320 $(aro).hide(); 1321 }, 1322 1323 eItemClick: function(e) 1324 { 1325 var mom = e.data.mom 1326 var loc = mom.urlPrefixVideoPage + $(this).attr('_url_title') + '?pid=' + mom.currentPlaylistID; 1327 1328 //ctrl+click, open video in new window 1329 if (e.ctrlKey) 1330 { 1331 e.preventDefault(); 1332 window.open(loc,'_blank'); 1333 } 1334 //Open in current window 1335 else 1336 { 1337 window.location.href = loc; 1338 } //if 1339 }, 1340 1341 ePlaystripMouseLeave: function(e) 1342 { 1343 var mom = e.data.mom; 1344 1345 //$(mom.sActionRemoveOverlay).hide(); 1346 }, 1347 1348 addItem: function(data, opt) 1349 { 1350 if (!data) 1351 return false;
1352 1353 var self = this; 1354 var ps = $(this.sPlayStrip_OL); 1355 var itemID = ++this.lastItemId; 1356 1357/* 1358data: 1359 "hash": "3ec0374d41", 1360 "title": "Hargitai Bea fot\u00f3z\u00e1sa", 1361 "url_title": "Hargitai_Bea_fotozasa", 1362 "thumbnail": "http:\/\/pics.izsof.test.indavideo.hu\/videos\/210\/602\/2.jpg", 1363 "id": "210602" 1364*/ 1365 1366 if (!this.isItemIDAvailable(data.id)) 1367 { 1368 //Returns newly added item 1369 ps.append('<li id="'+this.sItemPrefix.substr(1)+data.id+'"><span class="actionRemoveOverlay"></span><div style="width: 120px; height: 70px; overflow: hidden; margin:3px;"><img src="'+data.thumbnail+'" ></div></li>'); 1370 //<span class="actionRemoveOverlay" style="top: 66px; left: 496px; display: none;"></span> 1371 1372 //IV.log(data.url_title); 1373 //IV.log(this.currentVideo); 1374 1375 //Change border for currently playing element 1376 if (data.url_title == this.currentVideo) 1377 { 1378 IV.log('playing'); 1379 $(this.sItemPrefix + data.id).addClass('playing'); 1380 } //if 1381 1382 //Setting attributes 1383 $.each(data, function(i,v) 1384 { 1385 //IV.log( self.sItemPrefix + data.id ); 1386 //Return actual LI object 1387 $(self.sItemPrefix + data.id).attr('_'+ i, v); 1388 }); 1389 } //if 1390 1391 return false; 1392 }, 1393 1394 /** 1395 * Substitute of delItem 1396 * 1397 * @param id 1398 */ 1399 delItem: function(id) 1400 { 1401 this.removeItem(id); 1402 }, 1403 1404 removeItem: function(id) 1405 { 1406 if ( /^plv_[0-9]+$/i.test(id) ) 1407 { 1408 $('#' + id).remove(); 1409 } 1410 else 1411 { 1412 //Store item in undo 1413 $(this.sItemPrefix + id).remove(); 1414 } //if 1415 }, 1416 1417 removeItems: function() 1418 { 1419 $(this.sPlayStripItems).remove(); 1420 }, 1421 1422 ePagerHandleClick: function(e) 1423 { 1424 mom = e.data.mom; 1425 1426 switch( $(this).attr('id') ) 1427 { 1428 case mom.sPagerHandleLeft.substr(1): 1429 mom.changePosition('-page'); 1430 break; 1431 1432 case mom.sPagerHandleRight.substr(1): 1433 mom.changePosition('+page'); 1434 break; 1435 1436 case mom.sPagerHandlePrev.substr(1): 1437 mom.playVideo('prev'); 1438 break; 1439 1440 case mom.sPagerHandleNext.substr(1): 1441 mom.playVideo('next'); 1442 break; 1443 } //switch 1444 }, 1445 1446 playVideo: function(action) 1447 { 1448 switch(action) 1449 { 1450 case 'prev': 1451 var url_title = $( this.sPlayStripItems + '[_url_title="'+this.currentVideo+'"]' ).prev().attr('_url_title'); 1452 1453 if (!url_title) 1454 { 1455 this.playVideo('last'); 1456 return; 1457 } //if 1458 break; 1459 1460 case 'next': 1461 var url_title = $(this.sPlayStripItems + '[_url_title="'+this.currentVideo+'"]' ).next().attr('_url_title'); 1462 1463 if (!url_title) 1464 { 1465 this.playVideo('first'); 1466 return; 1467 } //if 1468 break; 1469 1470 case 'first': 1471 IV.log('first'); 1472 var url_title = $(this.sPlayStripItems + ':first' ).attr('_url_title'); 1473 break; 1474 1475 case 'last': 1476 IV.log('last'); 1477 var url_title = $(this.sPlayStripItems + ':last' ).attr('_url_title'); 1478 break; 1479 } //switch 1480 1481 window.location.href = mom.urlPrefixVideoPage + url_title + '?pid=' + mom.currentPlaylistID; 1482 }, 1483 1484 //rename 1485 getPlayingVideo: function() 1486 { 1487 1488 }, 1489 1490 changePosition: function(movement, opt) 1491 { 1492 if ( $.isEmptyObject(opt) ) 1493 { 1494 opt = this; 1495 } //if 1496 1497 //Get the strip width 1498 var stripWidth = this.getPlayStripWidth(); 1499 1500 //Get playlist item width 1501 var iWidth = this.getPlayListItemWidth(); 1502 1503 //We have to relocate to the itemPerStrip+1 nth element 1504 //itemPerStrip stores how many items are FULLY visible on the strip 1505 var itemPerStrip = Math.floor(stripWidth / iWidth); 1506 1507 //The leftmost item in the strip 1508 var actualItem = this.getActualItem(); 1509 1510 //The item count in the strip 1511 var countItem = this.getCountItem(); 1512 1513 //The new, leftmost item position where the scroller has to position itself 1514 //By default its the same as actualItem, so we won't budge 1515 //var itemNewPosition = actualItem; 1516 1517 position = actualItem; 1518 movement = movement + ''; 1519 1520 //Adding/subtracting 1521 if ( $.inArray(movement.charAt(0),['+','-']) != -1) 1522 { 1523 switch(movement.charAt(0)) 1524 { 1525 case '+': 1526 //Move one full page right 1527 if (movement.substr(1) == 'page') 1528 { 1529 if (actualItem < countItem) 1530 { 1531 position = actualItem + (itemPerStrip); 1532 1533 //Get to the first element 1534 if ( position > countItem) 1535 { 1536 position = countItem; 1537 } //if 1538 } 1539 //Do nothing, since actualItem = countItem 1540 else 1541 { 1542 1543 } //if 1544 } 1545 //Move n element right 1546 else 1547 { 1548 IV.log( movement.substr(1) ); 1549 position = actualItem + parseInt(movement.substr(1)); 1550 } 1551 break; 1552
1553 case '-': 1554 if (movement.substr(1) == 'page') 1555 { 1556 //We are at last element, sooo 1557 //We have 6 visible items 1558 //38 39 40 41 42 43 44 |45 46 47 48 49 50|END 1559 //Show it from 39 1560 if (actualItem >= (countItem-itemPerStrip) ) 1561 { 1562 position = countItem - (itemPerStrip*2-1); 1563 } 1564 else if (actualItem > 1) 1565 { 1566 position = actualItem - (itemPerStrip); 1567 1568 //Get to the first element 1569 if ( position < 1) 1570 { 1571 position = 1; 1572 } //if 1573 } 1574 //Do nothing, since actualItem = 1 1575 else 1576 { 1577 } //if 1578 } 1579 else 1580 { 1581 IV.log( movement.substr(1) ); 1582 position = actualItem - parseInt(movement.substr(1)); 1583 } //if 1584 break; 1585 } //switch 1586 1587 if ( position > countItem ) 1588 { 1589 position = countItem; 1590 } 1591 else if (position < 1) 1592 { 1593 position = 1; 1594 } //if 1595 } 1596 //Specific itemNO given 1597 else 1598 { 1599 position = parseInt(movement); 1600 } //if 1601 1602 this.setActualItem(position); 1603 1604// $(this.sPlayStrip + ' li:nth-child(' + position +')') 1605 1606 //$(mom.sPlayStrip).scrollTo($(mom.sItemPrefix+itemNewPosition), mom.animationDuration, 1607 $(this.sPlayStrip).scrollTo( $(this.sPlayStrip + ' li:nth-child(' + position +')') , opt.animationDuration, 1608 { 1609 offset: this.paddingOffset, 1610 easing: 'easeInOutCirc' 1611 }); 1612 1613 /* 1614 $(mom.sPlayStrip).stop().animate( 1615 { 1616 scrollLeft: $(mom.sItemPrefix+itemNewPosition).offset().left 1617 }, 100,'easeOutQuint'); 1618 */ 1619 }, 1620 1621 togglePlayStripVisibility: function(e) 1622 { 1623 var mom = e.data.mom; 1624 1625 switch( $(this).attr('id') ) 1626 { 1627 case mom.sPlaylistShow.substr(1): 1628 mom.showPlayStrip(); 1629 break; 1630 1631 case mom.sPlaylistHide.substr(1): 1632 mom.hidePlayStrip(); 1633 break; 1634 } //switch 1635 }, 1636 1637 showPlayStrip: function() 1638 { 1639 $(this.sPlayStripContainer).show(); 1640 $(this.sPlaylistShow).hide(); 1641 $(this.sPlaylistHide).show(); 1642 }, 1643 1644 hidePlayStrip: function() 1645 { 1646 //we have to (re)store scroll position, since webkit resets scrollLeft after a display: none 1647 $(this.sPlayStripContainer).hide(); 1648 $(this.sPlaylistShow).show(); 1649 $(this.sPlaylistHide).hide(); 1650 1651 this.hideUndoOption(); 1652 }, 1653 1654 isPlaylistVisible: function() 1655 { 1656 return $(this.sPlaylistContainer).is(':visible'); 1657 }, 1658 1659 isPlaylistLoaded: function() 1660 { 1661 //By default sPlayListContainer is totally empty... if it has one ascending div, its considered loaded 1662 return ($(this.sPlaylistContainer + ' div').length > 0 ? true : false); 1663 }, 1664 1665 eTogglePlaylistVisibility: function(e) 1666 { 1667 if (e) 1668 var mom = e.data.mom; 1669 //Called from init 1670 else 1671 var mom = this; 1672 1673 //SHOW 1674 if (!mom.isPlaylistVisible()) 1675 { 1676 mom.showPlaylist(); 1677 } 1678 //HIDE 1679 else 1680 { 1681 mom.hidePlaylist(); 1682 } //if 1683 1684 mom.loadPlaylistHTML(); 1685 }, 1686 1687 /** 1688 * Show Playlist with playstrip maximized 1689 * 1690 */ 1691 showAll: function() 1692 { 1693 this.showPlaylist(); 1694 this.showPlayStrip(); 1695 }, 1696 1697 showPlaylist: function() 1698 { 1699 $(this.sPlaylistContainer).show(); 1700 //Also change the context text 1701 $(this.sTogglePlaylist).html(this.textPlaylistHide); 1702 }, 1703 1704 hidePlaylist: function() 1705 { 1706 $(this.sPlaylistContainer).hide(); 1707 //Also change the context text 1708 $(this.sTogglePlaylist).html(this.textPlaylistShow); 1709 }, 1710 1711 /** 1712 * 1713 * Load Playlist HTML structure and 1714 * get playlists, show first or selected and its contents 1715 * 1716 */ 1717 loadPlaylistHTML: function( opt ) 1718 { 1719 var self = this; 1720 1721 if (!opt) 1722 opt = {}; 1723 1724 //If playlist not yet loaded, loooad it 1725 if ( !this.isPlaylistLoaded() || opt.reload ) 1726 { 1727 $(this.sPlaylistContainer).load(this.urlPlaylistBar, 1728 1729 //onSuccess 1730 function() 1731 { 1732 //-*-*-* Load events onPlaylistLoad 1733 self.eventsOnPlaylistHTMLLoad(); 1734 1735 //IV.log('cookie', $.cookie(self.cookiePlaylistLoop) ); 1736 //console.log('aaaaaa:'+ $.cookie(self.cookiePlaylistLoop)); 1737 //Looping enabled 1738 if (!$.cookie(self.cookiePlaylistLoop) || $.cookie(self.cookiePlaylistLoop) == '1') 1739 { 1740 //IV.log('ENABLED'); 1741 //Inverse logic... in order to enable looping, the disable element must be clicked 1742 $(self.sLoopDisabled).trigger('click'); 1743 } 1744 else 1745 { 1746 $(self.sLoopEnabled).trigger('click'); 1747 } //if 1748 1749 //-*-*-* Set sortable 1750 $(IVPlayList.sPlayStrip_OL).sortable( 1751 { 1752 position: 'fixed', 1753 axis: 'x', 1754 distance: 5, 1755 tolerance: 'pointer', 1756 scrollSensitivity: 1, 1757 1758 start: function(e, ui) 1759 { 1760 IV.log('dragstart'); 1761 IVPlayList.draggedItem = ui.item; 1762 1763 //Create helpers at each end
1764 //$(IVPlayList.sPlayStrip_OL).prepend('<li class="'+IVPlayList.sItemHelper.substr(1)+'"><div style="width: 120px; height: 70px; overflow: hidden; margin:3px;"></div></li>'); 1765 //$(IVPlayList.sPlayStrip_OL).append('<li class="'+IVPlayList.sItemHelper.substr(1)+'"><div style="width: 120px; height: 70px; overflow: hidden; margin:3px;"></div></li>'); 1766 }, 1767 1768 stop: function(e, ui) 1769 { 1770 IV.log('dragend'); 1771 IVPlayList.draggedItem = null; 1772 1773 //Destroy helpers 1774 //$(IVPlayList.sItemHelper).remove(); 1775 } 1776 }); 1777 1778 //Load playlist 1779 if (!opt.noplaylist) 1780 self.loadPlaylists(); 1781 1782 //Callback baby 1783 if (opt.onSuccess) 1784 opt.onSuccess(); 1785 }); 1786 } //if 1787 }, 1788 1789 eventsOnPlaylistHTMLLoad: function() 1790 { 1791 //Delete actual playlist - click 1792 IVHelper.usure(this.sDelActualPlaylist, 1793 { 1794 question: 'Biztos vagy benne?', 1795 execute: this.eDelActualPlaylistClick, 1796 executeParameters: [{data: {mom: this}}] 1797 }); 1798 }, 1799 1800 clearPlaylists: function() 1801 { 1802 $(this.sPlaylistSelect).find('option') 1803 .remove(); 1804 }, 1805 1806 /** 1807 * Load playlists and display given or default (playlistID = 1 - all videos) playlist by ID 1808 * 1809 * @param playlistID Playlist to select and display its contents 1810 */ 1811 loadPlaylists: function(playlistID) 1812 { 1813 var self = this; 1814 1815 if (!playlistID) 1816 playlistID = self.currentPlaylistID; 1817 1818 $.ajax( 1819 { 1820 url: this.urlLoadPlaylists, 1821 type: 'GET', 1822 dataType: 'json', 1823 data: { 1824 "pid" : playlistID 1825 }, 1826 success: function(res) 1827 { 1828 self.clearPlaylists(); 1829 1830 var options = $(self.sPlaylistSelect); 1831 1832 $.each(res, function() 1833 { 1834 options.append($("<option />").val(this.id).text(this.title)); 1835 }); 1836 1837 //Select actual playlist from dropdown 1838 if ( ! self.selectPlaylistMenuItemBy({by: 'id', value: playlistID }).length ) 1839 { 1840 //if failed, then fallback to all the videos 1841 playlistID = 1; 1842 self.selectPlaylistMenuItemBy({by: 'id', value: playlistID }) 1843 } //if 1844 1845 self.loadPlaylistItems(playlistID); 1846 } //function 1847 }); 1848 }, 1849 1850 loadPlaylistItems: function(playlistId) 1851 { 1852 var self = this; 1853 1854 //set playlistID - this must be moved, if loadPlaylistItems will be used as static func 1855 self.currentPlaylistID = playlistId; 1856 1857 //ERROR 1858 if (!playlistId) 1859 return false; 1860 1861 $.ajax( 1862 { 1863 url: this.urlLoadPlaylistItems + playlistId, 1864 type: 'GET', 1865 dataType: 'json', 1866 success: function(res) 1867 { 1868 var data = null; 1869 1870 self.removeItems(); 1871 1872 //Custom format 1873 if (playlistId == 1) 1874 { 1875 data = res.data; 1876 } 1877 else 1878 { 1879 data = res; 1880 } //if 1881 1882 $.each(data, function(i, v) 1883 { 1884 self.addItem(v); 1885 }); 1886 1887 //Trigger sortable refresh 1888 //$(IVPlayList.sPlayStrip_OL).sortable('refresh'); 1889 1890 //Scroll back to the first element 1891 self.changePosition(1,{animationDuration: 0}); 1892 1893 //Show or hide playlist delete action 1894 if 1895 ( 1896 self.currentPlaylistID == 1 || $(self.sPlaylistSelect).find('option:contains("Kedvenceim")').prop('selected') 1897 ) 1898 { 1899 $(self.sDelActualPlaylist).hide(); 1900 } 1901 else 1902 { 1903 $(self.sDelActualPlaylist).show(); 1904 } //if 1905 1906 //Scroll to actual video element 1907 if (playlistId == IV.sys.GET.pid) 1908 { 1909 self.changePosition(self.getCurrentVideoPosition(), {animationDuration: 0}); 1910 } //if 1911 1912 } //function 1913 }); 1914 }, 1915 1916 getCurrentVideoPosition: function() 1917 { 1918 //index returns a zero based order position, hence the +1 1919 return $(this.sPlayStripItems).index( $(this.sPlayStripItems + '[_url_title="'+this.currentVideo+'"]' ) )+1; 1920 }, 1921 1922 selectPlaylistMenuItemBy: function(opt) 1923 { 1924 switch(opt.by) 1925 { 1926 case 'value': 1927 case 'id': 1928 return $(this.sPlaylistSelect).find('option[value="'+opt.value+'"]').prop('selected',true); 1929 break; 1930 1931 case 'content': 1932 case 'text': 1933 return $(this.sPlaylistSelect).find('option:contains("'+opt.value+'")').prop('selected',true); 1934 break; 1935 } //switch 1936 }, 1937 1938 eDelActualPlaylistClick: function(e) 1939 { 1940 var mom = e.data.mom; 1941 1942 IV.log(this); 1943 1944 mom.delPlaylist( mom.currentPlaylistID ); 1945 }, 1946 1947 delPlaylist: function(playlistID) 1948 { 1949 var mom = this; 1950 1951 $.post ( 1952 this.urlPlaylistAdmin, 1953 { 1954 action: 'videoHandler', 1955 op: 'removePlaylist', 1956 pid: playlistID 1957 }, 1958 function (data) 1959 { 1960 mom.removeItems(); 1961 1962 //Remove playlist item from the select - dead sure alternative :) 1963 //$(mom.sPlaylistSelect).find('option[value="'+playlistID+'"]').remove(); 1964 //Remove currently selected playlist item from the select 1965 $(mom.sPlaylistSelect_SelectedOption).remove(); 1966 1967 $("#context_thumbnail table tbody tr#playlist_" + playlistID).remove(); 1968 1969 //Select all my videos option 1970 mom.loadPlaylistItems( 1 ); 1971 }, 'json'); 1972 }, 1973 1974 addToPlaylist: function(playlistID, url_title) 1975 { 1976 var self = this; 1977 var cbox = $('#playlist_'+playlistID+' > input'); 1978 console.log(cbox); 1979 $.post ( 1980 this.urlPlaylistAdmin, 1981 { 1982 action: 'videoHandler', 1983 op: 'addToPlaylist', 1984 hash: $("#emb_hash").val(), 1985 url_title : (url_title ? url_title : $("#context_thumbnail .what").html() ), 1986 pid: playlistID, 1987 addOrRemove: $('#playlist_'+playlistID+' > input').prop('checked') ? 1 : 0 1988 }, 1989 function (data) 1990 { 1991 var data = data; 1992 console.log(data.playlist); 1993 if (data.success == '1' && data.playlist) { 1994// $('#playlist_'+data.playlist+' > a > input').prop("checked", data.addOrRemove); 1995 } 1996 }, 'json'); 1997 }, 1998 1999 createPlaylist: function (title, url_title, newMainpage) 2000 { 2001 var self = this; 2002 2003 var playlistCount = $('#addPlaylists').find('li').length 2004 2005 if (playlistCount >= 50) // 25, csak van 3 static tr is a table-ben 2006 { 2007 alert ('Már túl sok listát hoztál létre!'); 2008 return false;
2009 } //if 2010 2011 $.post (this.urlPlaylistAdmin, 2012 { 2013 action: 'videoHandler', 2014 op: 'createPlaylist', 2015 //video beloldal 2016 hash: $("#emb_hash").val(), 2017 //fooldal 2018 url_title: url_title, 2019 title: title 2020 }, 2021 function (data) 2022 { 2023 if (typeof data.success === 'undefined'); 2024 else if (typeof data.playlist === 'undefined'); 2025 else if (data.success != '1'); 2026 //alert ('nem1'); 2027 else 2028 { 2029 playlists = document.getElementById('addPlaylists'); 2030 newlist = document.createElement('li'); 2031 newlist.setAttribute("id", "playlist_"+data.playlist.id); 2032 2033 newlist.innerHTML = "<input type=\"checkbox\" checked=\"checked\" onclick=\"IVPlayList.addToPlaylist(data.playlist.id); return true;\">"+data.playlist.title; 2034 playlists.appendChild(newlist); 2035 }; 2036 }, 'json'); 2037 return false; 2038 }, 2039 2040 removeFromPlaylist: function(playlistID, jqItem/*LI element*/) 2041 { 2042 var mom = this; 2043 2044 $.post (this.urlPlaylistAdmin, 2045 { 2046 action: 'videoHandler', 2047 op: 'addToPlaylist', 2048 hash : '', 2049 url_title : $(jqItem).attr('_url_title'), 2050 pid: playlistID, 2051 addOrRemove: 0 2052 }, 2053 function (data) 2054 { 2055 mom.storeUndo 2056 ({ 2057 id: $(jqItem).attr('_id'), 2058 playlistID: playlistID, 2059 url_title: $(jqItem).attr('_url_title'), 2060 //outerHTML :P 2061 html: $(jqItem).clone().wrap('<p>').parent().html() 2062 }); 2063 2064 mom.removeItem($(jqItem).attr('_id')); 2065 //myAlert ('A videót töröltük a listáról!', 'Törlés a listáról'); 2066 }, 'json'); 2067 }, 2068 2069 storeUndo: function(data) 2070 { 2071 this.undoLastVideo = data; 2072 2073 $(this.sUndoLastAction).show(); 2074 }, 2075 2076 eRestoreUndo: function(e) 2077 { 2078 var mom = e.data.mom; 2079 2080 mom.restoreUndo(); 2081 }, 2082 2083 restoreUndo: function() 2084 { 2085 if ( this.undoLastVideo.id ) 2086 { 2087 //addtoplaylist 2088 this.addToPlaylist(this.undoLastVideo.playlistID, this.undoLastVideo.url_title); 2089 2090 //Change to playlist 2091 this.selectPlaylistMenuItemBy({by: 'id', value: this.undoLastVideo.playlistID }) 2092 2093 this.hideUndoOption(); 2094 } //if 2095 }, 2096 2097 addRate: function () 2098 { 2099 $.post (this.urlPlaylistAdmin, 2100 { 2101 action: 'videoHandler', 2102 op: 'rateVideo', 2103 hash: $("#emb_hash").val() 2104 //,url_title: $("#context_thumbnail .what").html() 2105 }, 2106 function (data) 2107 { 2108 if (typeof data.success != 'undefined') 2109 { 2110 if (data.success == '1') 2111 myAlert ('A szavazatot rögzÃtettük!','Szavazás videóra'); 2112 else 2113 myAlert ('Már szavaztál!', 'Szavazás videóra'); 2114 } //if 2115 }, 'json'); 2116 }, 2117 2118 setFavourite: function(i,elem) 2119 { 2120 var url_title = ""; 2121 2122 if (elem) { 2123 url_title = ($("#context_thumbnail .what").html().lenght) ? $("#context_thumbnail .what").html() : elem.find("input").val(); 2124 } 2125 else 2126 url_title = $("#context_thumbnail .what").html(); 2127 2128 $.post ( 2129 this.urlPlaylistAdmin, 2130 { 2131 action: 'videoHandler', 2132 op: 'setFavourite', 2133 hash: $("#emb_hash").val(), 2134 url_title : url_title, 2135 addOrRemove: 1 2136 }, 2137 function () 2138 { 2139 $("#context_thumbnail").fadeOut (); 2140 myAlert ('A videót hozzáadtuk!', 'Kedvencekhez adás'); 2141 loaded = false; 2142 getPlayListHTML(); 2143 }, 'json'); 2144 }, 2145 2146 toggleLoop: function(e) 2147 { 2148 var mom = e.data.mom; 2149 2150// IV.log('LOOPA'); 2151 2152 switch( $(this).attr('id') ) 2153 { 2154 case mom.sLoopEnabled.substr(1): 2155 $(mom.sLoopEnabled).hide(); 2156 $(mom.sLoopDisabled).show(); 2157//IV.log('NO LOOP'); 2158 //Delete, no looping 2159 $.cookie(mom.cookiePlaylistLoop, 0, {path: '/', expires: 365, domain: document.domain } ); 2160 break; 2161 2162 case mom.sLoopDisabled.substr(1): 2163 $(mom.sLoopEnabled).show(); 2164 $(mom.sLoopDisabled).hide(); 2165//IV.log('LOOP SET'); 2166 $.cookie( mom.cookiePlaylistLoop, 1, {path: '/', expires: 365, domain: document.domain } ); 2167 break; 2168 } //switch 2169 2170 IV.log(mom.isLooping()); 2171 }, 2172 2173 2174// IS? - STATECHECKS 2175 2176 isLooping: function() 2177 { 2178 if ( $(this.sLoopEnabled).is(':visible')) 2179 return true; 2180 else 2181 return false; 2182 }, 2183 2184 isItemIDAvailable: function(itemID) 2185 { 2186 return ( $( this.sItemPrefix + itemID).length > 0 ? true : false ); 2187 }, 2188 2189 2190// SETTER-GETTERS 2191 2192 getPlayStripWidth: function() 2193 { 2194 return parseInt( $(this.sPlayStrip).outerWidth() ); 2195 }, 2196 2197 getPlayListItemWidth: function() 2198 { 2199 return parseInt( $(this.sPlayStrip + ' li:first-child').outerWidth() ); 2200 }, 2201 2202 getActualItem: function() 2203 { 2204 return parseInt( $(this.sPlayStrip).attr('actualItem') ); 2205 }, 2206 2207 setActualItem: function(actualItem) 2208 { 2209 $(this.sPlayStrip).attr('actualItem',actualItem); 2210 }, 2211 2212 getCountItem: function() 2213 { 2214 return parseInt( $(this.sPlayStripItems).length ); 2215 }, 2216 2217 ____: function(){} 2218}; 2219 2220var IVHelper = 2221{ 2222 /** 2223 * Replace original text with a confirmation question and restores the original text after n seconds on mousout 2224 * 2225 * @param elem mixed jQuery selector 2226 * 2227 * Example: IVHelper.confirmationText( 2228 * { 2229 * execute: execute function on confirmed click 2230 * question: 'Delete, for sure?', //Confirming question to ask on first click 2231 * }); 2232 * 2233 * 2234 */ 2235 2236 usure: function(elem, opt) 2237 { 2238 $.each($(elem), function(i,element) 2239 { 2240 if (! $(element).data('usure_init') ) 2241 { 2242 $(element).data('usure_init', 1); 2243 $(element).data('usure_execute', opt.execute); 2244 $(element).data('usure_textorigi', $(element).text() ); 2245 2246 $(element).on('click', function(e) 2247 { 2248 if ( $(this).data('usure_asked') == 1 ) 2249 { 2250 if (opt.execute) 2251 opt.execute.apply(this, opt.executeParameters); 2252 2253 } 2254 else 2255 { 2256 $(this).data('usure_asked',1); 2257 2258 $(this).text(opt.question); 2259 2260 e.preventDefault(); 2261 } 2262 }); 2263 2264 $(element).on('mouseout', function(e) 2265 { 2266 var self = this; 2267 2268 $(this).data('usure_timerid', 2269 setTimeout(function() 2270 { 2271 $(self).text( $(self).data('usure_textorigi') ); 2272 $(self).data('usure_asked',0); 2273 }, 1000) ); 2274 }); 2275 2276 $(element).on('mouseover', function(e) 2277 { 2278 var self = this; 2279 2280 //Got timer, clear it 2281 if ( $(this).data('usure_timerid') ) 2282 { 2283 clearTimeout($(this).data('usure_timerid')); 2284 $(this).data('usure_timerid',null); 2285 } //if 2286 }); 2287 } //if 2288 2289 }); 2290 } //function 2291 2292 2293}; 2294 2295var IVSystem = 2296{ 2297 GET: {}, 2298 URLPATH: [],
2299 2300 init: function() 2301 { 2302 this.parseURLParameters(); 2303 this.parseURLPath(); 2304 }, 2305 2306 parseURLParameters: function() 2307 { 2308 var match, 2309 pl = /\+/g, // Regex for replacing addition symbol with a space 2310 search = /([^&=]+)=?([^&]*)/g, 2311 decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); }, 2312 query = window.location.search.substring(1); 2313 2314 while (match = search.exec(query)) 2315 this.GET[decode(match[1])] = decode(match[2]); 2316 }, 2317 2318 parseURLPath: function() 2319 { 2320 this.URLPATH = window.location.pathname.substr(1).split('/'); 2321 }, 2322 2323 ____: function(){} 2324}; 2325 2326var IVSection = 2327{ 2328 2329 init: function() 2330 { 2331 var sectionName = IVSystem.URLPATH[0].charAt(0).toUpperCase() + IVSystem.URLPATH[0].slice(1); 2332 2333 //if init exists inside our object, then CAALLLL BIATCH 2334 if (window["IVSection"+sectionName] && sectionName && "init" in window["IVSection"+sectionName]) 2335 { 2336 window["IVSection"+sectionName].init(); 2337 } //if 2338 }, 2339 2340 ____: function(){} 2341}; 2342 2343var IVSectionVideo = 2344{ 2345 commentCount: 0, 2346 commentLoaded: 0, 2347 commentPageCount: 0, 2348 commentPageCurrent: 1, 2349 sNewCommentForm: '#new_comment_form', 2350 sNewCommentText: '#new_comment_text', 2351 sCommentErrorText: '.error_text', 2352 sCommentsContainer: '.vid_comments_read .container', 2353 sCommentDotAnimation: '#dot_cont span', 2354 sCommentSubmitContainer: '.submitButton_container', 2355 2356 storLastComment: 'iv_comment_last', 2357 2358 init: function() 2359 { 2360 //this.events(); 2361 if (window.location.hash == '#newcomment') 2362 { 2363 $(this.sNewCommentText).focus(); 2364 } //if 2365 2366 if (IVSystem.GET.op == 'comment_subscribe' && typeof IVSystem.GET.success != 'undefined') 2367 { 2368 if 2369 ( 2370 typeof window.history.pushState == 'function' 2371 // && window.location.hash != '#nagyitas' 2372 ) 2373 { 2374 history.replaceState(null, '', location.protocol + '//' + location.host + location.pathname); 2375 2376 //todo: notification 2377 } //if 2378 } //if 2379 2380 //Restore comment 2381 if (IVSystem.GET.restore == 1) 2382 { 2383 history.replaceState(null, '', location.protocol + '//' + location.host + location.pathname); 2384 this.commentRestore(); 2385 } //if 2386 2387 this.events(); 2388 }, 2389 2390 events: function() 2391 { 2392 $(this.sNewCommentForm).on('submit', {mom:this}, this.eSubmitNewCommentForm ); 2393 }, 2394 2395 commentRestore: function() 2396 { 2397 $(this.sNewCommentText).val(localStorage.getItem(this.storLastComment)); 2398 }, 2399 2400 commentSave: function(redirect) 2401 { 2402 localStorage.setItem(this.storLastComment, $(this.sNewCommentText).val()); 2403 if (redirect) 2404 { 2405 window.location = location.protocol + '//' + location.host + location.pathname + "?restore=1#newcomment"; 2406 } 2407 }, 2408 2409 commentStartDotAnimation: function() 2410 { 2411 $(this.sCommentSubmitContainer).addClass("loading"); 2412 2413 doDotDotDotBlinking(this.sCommentDotAnimation); 2414 2415 var inter = setInterval(function() 2416 { 2417 doDotDotDotBlinking(IVSectionVideo.sCommentDotAnimation); 2418 },1600); 2419 2420 return inter; 2421 }, 2422 2423 commentStopDotAnimation: function(loopid) 2424 { 2425 clearInterval(loopid); 2426 $(this.sNewCommentText).addClass("errorous"); 2427 $(this.sCommentSubmitContainer).removeClass("loading"); 2428 $(this.sNewCommentText).focus(); 2429 }, 2430 2431 checkCommentText: function() 2432 { 2433 return !( !$(this.sNewCommentText).val().length); 2434 }, 2435 2436 eSubmitNewCommentForm: function(e) 2437 { 2438 var mom = e.data.mom; 2439 var loopid = mom.commentStartDotAnimation(); 2440 2441 if (! mom.checkCommentText()) 2442 { 2443 mom.commentStopDotAnimation(loopid); 2444 return false; 2445 } //if 2446 2447 $(mom.sCommentErrorText).hide(); 2448 $(mom.sNewCommentText).removeClass("errorous"); 2449 $(mom.sNewCommentText).attr('readonly',true); 2450 $(mom.sNewCommentForm).addClass('readonly'); 2451 2452 $.ajax 2453 ({ 2454 type: 'POST', 2455 url: '/commentform', 2456 data: $(mom.sNewCommentForm).serialize(), 2457 dataType: 'json', 2458 error: function(jqXHR, textStatus, errorThrown) 2459 { 2460 $(mom.sNewCommentText).attr('readonly',false); 2461 $(mom.sNewCommentForm).removeClass('readonly'); 2462 2463 /*Szniki taktika*/ 2464 $(mom.sNewCommentText).addClass("errorous"); 2465 $(mom.sCommentSubmitContainer).removeClass("loading"); 2466 2467 }, 2468 success: function(R, textStatus, jqXHR) 2469 { 2470 if (R.status == 'dupe') 2471 { 2472 $(mom.sCommentErrorText).text('Duplikált hozzászólás!').show(); 2473 } 2474 else 2475 { 2476 $(mom.sCommentErrorText).hide(); 2477 $(mom.sNewCommentText).val('').focus(); 2478 } //if 2479 2480 localStorage.removeItem('iv_comment_last'); 2481 2482 $(mom.sNewCommentText).attr('readonly',false); 2483 $(mom.sNewCommentForm).removeClass('readonly'); 2484 $(mom.sCommentSubmitContainer).removeClass("loading"); 2485 clearInterval(loopid); 2486 2487 newComment = document.createElement('div'); 2488 newComment.setAttribute('class', 'vid_comments_read_content row pt-2 pb-1 mt-2'); 2489 newComment.innerHTML = R.html; 2490 $(mom.sCommentsContainer).prepend(newComment); 2491 2492 // {"status":"ok","id":"2529572","text":"psoaoapaoapoa12345678910111214","datetime":"2020-05-23 22:51:24"} 2493 // add comment DOM 2494 /* 2495 <div class="vid_comments_read_content row pt-2 pb-1 mt-2"> 2496 <div class="col-2 col-md-1 p-0"> 2497 <img class="img-fluid " src="//pics.indavideo.hu//users/000/7.80-14.jpg" alt=""> 2498 </div> 2499 <div class="col-10 col-md-11 p-0 pl-2 d-flex flex-wrap">
2500 <span class="vid_comments_read_name">pnc</span> 2501 2502 <div class="ml-auto"> 2503 <span>2020-05-23 22:42:43</span> 2504 </div> 2505 <p class="vid_comments_read_desc col-12"> 2506 aaaaooa 2507 </p> 2508 </div> 2509 </div> 2510 */ 2511 } 2512 }); 2513 2514 return false; 2515 }, 2516 2517 ____: function(){} 2518}; 2519 2520var IVMainPage = 2521{ 2522 sListItem: ".BOX_CONTENT.INDEXVIDEO_NAGY .item", 2523 sDescription: ".description", 2524 2525 init: function() { 2526 this.setDescriptionCrop(); 2527 }, 2528 2529 setDescriptionCrop: function() { 2530 var self = IVMainPage; 2531 2532 $(self.sListItem).each(function() { 2533 $(this).find(self.sDescription).dotdotdot({ 2534 height : "60px", 2535 }); 2536 }); 2537 } 2538}; 2539 2540var IVTemplate = 2541{ 2542 compiledTemplate: [], 2543 2544 configOptions: {}, 2545 2546 //Cached output 2547 cache: [], 2548 2549 init: function() 2550 { 2551 //do something terrible 2552 }, 2553 2554 emptyCache: function() 2555 { 2556 this.cache = []; 2557 }, 2558 2559 isCached: function(cacheName) 2560 { 2561 if ( this.cache[cacheName] ) 2562 return true; 2563 2564 return false; 2565 }, 2566 2567 getCached: function(cacheName, target) 2568 { 2569 if (this.isCached(cacheName)) 2570 { 2571 if (target) 2572 { 2573 $(target).html( this.cache[cacheName] ); 2574 } //if 2575 2576 return this.cache[cacheName]; 2577 } //if 2578 2579 return ''; 2580 }, 2581 2582 display: function(opt) 2583 { 2584 var mom = this; 2585 2586 if ( !opt.template || !opt.data || ! opt.target ) 2587 if ( !opt.template || (!opt.data && !opt.ajaxOptions) || ! opt.target ) 2588 return false; 2589 2590 //Got a cache id, so check if we've ever rendered this content 2591 if (opt.cache && ! opt.forceRender) 2592 { 2593 if ( this.isCached(opt.cache) ) 2594 { 2595 this.getCached(opt.cache,opt.target); 2596 2597 if (!opt.dontScroll && typeof profil == "object") 2598 profil.movePager(); 2599 2600 return ""; 2601 } //if 2602 } //if 2603 2604 opt.templateID = $(opt.template).prop('id'); 2605 2606 //Template not yet exists, so compile 2607 if (!this.compiledTemplate[ opt.templateID ] || opt.forceCompile) 2608 { 2609 this.compiledTemplate[ opt.templateID ] = dust.compile( $(opt.template).html(), opt.templateID); 2610 } //if 2611 2612 // dust.isDebug = true; 2613 // dust.debugLevel = 'DEBUG'; 2614 dust.loadSource(this.compiledTemplate[ opt.templateID ]); 2615 2616 if (opt.ajaxOptions) 2617 { 2618 var ajaxopts = $.extend({momopt: opt}, opt.ajaxOptions); 2619 2620 $.ajax( ajaxopts ) 2621 .done 2622 ( 2623 function(data, textStatus) 2624 { 2625 $.each(data, function(i,item) { 2626 if (item.PUBLIC_TAGS) { 2627 data[i].TAGS = []; 2628 $.each(item.PUBLIC_TAGS,function(index, tag) { 2629 data[i].TAGS.push(tag); 2630 }); 2631 } 2632 }); 2633 2634 this.momopt.data = { 2635 "items" : data 2636 }; 2637 2638 2639 mom.configOptions = this.momopt; 2640 2641 mom.render(); 2642 2643 if (typeof profil == "object") 2644 profil.reinitCarousels(); 2645 2646 if (!opt.dontScroll && typeof profil == "object") 2647 profil.movePager(); 2648 } //function 2649 ); 2650 } 2651 else 2652 { 2653 mom.configOptions = opt; 2654 mom.render(); 2655 2656 if (typeof profil == "object") 2657 profil.reinitCarousels(); 2658 2659 if (!opt.dontScroll && typeof profil == "object") 2660 profil.movePager(); 2661 } //if 2662 }, 2663 2664 render: function() 2665 { 2666 var mom = this; 2667 2668 dust.render( mom.configOptions.templateID , mom.configOptions.data, mom.renderCallback); 2669 }, 2670 2671 renderCallback: function(err, out) 2672 { 2673 var mom = IVTemplate; 2674 2675 if (err) 2676 console.log(err); 2677 else 2678 { 2679 if (mom.configOptions.cache) 2680 mom.setCacheByKey(mom.configOptions.cache, out); 2681 2682 // ez itt gááááány!! értelmesebb nevet kell neki adni, mert félrevezet 2683 // ez a replace arra vonatkozik, hogy a "more" gomb helyére replace-eljen-e !!! 2684 if (mom.configOptions.replace) 2685 $(mom.configOptions.replaceElement).replaceWith(out); 2686 else 2687 $(mom.configOptions.target).html(out); 2688 } 2689 }, 2690 2691 setCacheByKey: function(cacheKey, content) { 2692 this.cache[ cacheKey ] = content; 2693 }, 2694 2695 ___: function() {} 2696}; 2697 2698var IV = 2699{ 2700 debug: 1, 2701 assetsUrl: "//assets.indavideo.hu/", 2702 2703// MODULES 2704 playlist: IVPlayList, 2705 sys: IVSystem, 2706 user: IVUser, 2707 section: IVSection, 2708 template: IVTemplate, 2709 mainpage: IVMainPage, 2710 2711// SYSTEM WIDE FUNCTIONS 2712 2713 init: function() 2714 { 2715 var url = window.location.href.split("/")[2].split("."); 2716 var basePoint = $.inArray("indavideo",url); 2717 2718/* if ($.inArray("test", url) >= 0)
2719 this.assetsUrl += url[basePoint-2]+"."+url[basePoint-1]+"."+url[basePoint]+".hu/"; 2720 else if ($.inArray("demo",url) >= 0) 2721 this.assetsUrl += url[basePoint-1]+"."+url[basePoint]+".hu/"; 2722 else 2723 this.assetsUrl += url[basePoint]+".hu/"; 2724*/ 2725 this.sys.init(); 2726 this.playlist.init(); 2727 this.user.init(); 2728 this.section.init(); 2729 this.template.init(); 2730 this.mainpage.init(); 2731 }, 2732 2733 jqDelSelectorPrefix: function(jqSelector) 2734 { 2735 return jqSelector.replace(/[\.#]*/g, ""); 2736 }, 2737 2738 log: function(data) 2739 { 2740 if (IV.debug) 2741 console.log(data); 2742 }, 2743 2744 prevent : function(e) { 2745 e.preventDefault(); 2746 e.stopImmediatePropagation(); 2747 e.stopPropagation(); 2748 }, 2749 2750// THE LAST ONE - no more commas baby! 2751 2752 __FLATLINE__: function(){} 2753}; 2754 2755 2756;
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.