1/* ---------------------------------------- 2 * 3 * Index 4 * 5 * ---------------------------------------- 6 */ 7 8var mainview, release, movie; 9 10// constructor 11$(function(){ 12 // module 13 $('#mainview .tweet').remove(); 14 mainview = new MainView(); 15 movie = new PickUpMovie(); 16 //release = new Release(); 17 18}); 19$(window).load(function(){ 20 release = new Release(); 21 22}); 23 24/* ---------------------------------------- 25 * 26 * CLASS - MainView 27 * ----- 28 * for IE8 : slide up 29 * for Modern Browser : cross fade 30 * 31 * ---------------------------------------- 32 */ 33var MainView = function() { 34 var that = this; 35 36 this.setting = { 37 view_num : 0, 38 item_count : 0, 39 item_width : 0, 40 item_height : 0, 41 item_ratio : 1.6, 42 item_min_w : 680,//786,//1004 43 margin_x : 0, 44 curr_id : 0, 45 prev_id : null, 46 dir : 1, 47 timer : null, 48 interval : 11000 49 } 50 51 this.topics = []; 52 53 54 /* ------------------ 55 * initialize 56 */ 57 this.initialize = function() { 58 var s = this.setting; 59 60 // init 61 $('#mainview .item').each(function(i) { 62 var o = $(this).children('.bg').children('img'); 63 o.attr('data-def-width', o.width()).attr('data-def-height', o.height()); 64 65 if( $(this).children('.context').children('h2').text().length === 0 ){ 66 //console.log( $(this).children('.context').children('h2').text() ); 67 $(this).children('.context').css('backgroundPosition','0 60px'); 68 $(this).children('.context').css('backgroundSize','100% 140px'); 69 } 70 71 }); 72 73 // ã³ã³ãã³ããè¤è£½ 74 s.view_num = $('#mainview .item').length; 75 var repeat = 2; 76 var src = $('#mainview .container').html(); 77 $('#mainview .container').empty(); 78 var i; 79 var html = ''; 80 for(i=0; i<repeat; i++) { 81 html += src; 82 } 83 $('#mainview .container').html(html); 84 s.item_count = $('#mainview .item').length; 85 86 // resize 87 $(window).on({ 88 resize : $.proxy(this._resize, this), 89 scroll : $.proxy(this._scroll, this) 90 }); 91 this._resize(); 92 this._scroll(); 93 94 // ãã¼ã¸ã³èª¿æ´ 95 $('#mainview .container').css({ marginLeft : s.margin_x }); 96 97 // get image 98 var preload_images = []; 99 $('#mainview .item').each(function() { 100 preload_images.push($(this).children('.bg').children('img').attr('src')); 101 }); 102 103 // preload 104 $.imgpreload(preload_images, function() { 105 // DOMãåæå 106 that.initDom(); 107 }); 108 109 } 110 111 112 /* ------------------ 113 * initDom 114 */ 115 this.initDom = function() { 116 var s = this.setting; 117 118 // navi 119 $('#mainview .nav .prev').css({ display : 'block' }); 120 $('#mainview .nav .next').css({ display : 'block' }); 121 //$('#mainview .nav .prev a img').css({ opacity : 0 }); 122 //$('#mainview .nav .next a img').css({ opacity : 0 }); 123 124 // pagenation 125 var path_normal = $('.mainview_pagenation li img').attr('src'); 126 var path_over = path_normal.split('.png').join('_f.png'); 127 $('.mainview_pagenation li').attr('data-img-normal', path_normal).attr('data-img-over', path_over); 128 var tmpl = $('.mainview_pagenation li').clone(); 129 var i, len = s.view_num - 1; 130 for(i=0; i<len; i++) { 131 $('.mainview_pagenation li:last').after(tmpl.clone()); 132 } 133 var w = 16 * s.view_num; 134 $('.mainview_pagenation ul').width(w); 135 136 // helper 137 var src = $('.mainview_pagenation:eq(0) ul').clone(); 138 $('#helper .mainview_pagenation').html(src); 139 140 // init 141 that.initHelper(); 142 that.setNavi(); 143 that.setPagenation(); 144 that.setTimer(); 145 that.initTopics(); 146 147 // tablet 148 if(_ua.Mobile) { 149 //that.initTablet(); 150 } 151 } 152 153 154 /* ------------------ 155 * initTopics 156 */ 157 this.initTopics = function() { 158 var s = this.setting; 159 160 var tmp = ''; 161 tmp += '<div class="tweet">'; 162 tmp += '<div class="tweet_conteiner">'; 163 tmp += '<p class="label"><img src="/global/images/index/mainview_tweet_icon.png" alt="" width="157" height="23"></p>'; 164 tmp += '<div class="mainview_tweet">'; 165 tmp += '<ul>'; 166 tmp += '<li></li>'; 167 tmp += '</ul>'; 168 tmp += '</div>'; 169 tmp += '</div>'; 170 tmp += '</div>'; 171 172 //var tmpl = $('.tweet_tmpl').children('.tweet').clone(); 173 $('#mainview .item').each(function(i) { 174 $(this).append(tmp); 175 var target = $(this).children('.tweet'); 176 var obj = { 177 container : target, 178 mainview_id : i % s.view_num 179 } 180 var topic = new Topics(obj); 181 that.topics.push(topic); 182 }); 183 184 this.resetTopics(); 185 } 186 187 188 /* ------------------ 189 * resetTopics 190 */ 191 this.resetTopics = function() { 192 var s = this.setting; 193 194 var i, len = this.topics.length; 195 for(i=0; i<len; i++) { 196 if(i % s.view_num == s.prev_id % s.view_num) { 197 this.topics[i].reset(); 198 } 199 } 200 for(i=0; i<len; i++) { 201 if(i % s.view_num == s.curr_id % s.view_num) { 202 this.topics[i].start(); 203 } 204 } 205 } 206 207 /* ------------------ 208 * initHelper 209 */ 210 this.initHelper = function() { 211 var s = this.setting; 212 213 $('#helper .btn').on({ 214 click : function() { 215 common.smoothScroll('#movie'); 216 } 217 }); 218 219 // show 220 $('#helper .section_container').stop().animate({ marginTop : 0 }, 550, 'easeOutSine'); 221 } 222 223 224 /* ------------------ 225 * initTablet 226 */ 227 this.initTablet = function() { 228 var s = this.setting; 229 230 $("#mainview").touchwipe({ 231 wipeLeft : function() { 232 s.prev_id = s.curr_id; 233 s.curr_id = s.curr_id == s.item_count - 1 ? 0 : s.curr_id + 1; 234 s.dir = 1; 235 that.change(); 236 }, 237 wipeRight : function() { 238 s.prev_id = s.curr_id; 239 s.curr_id = s.curr_id == 0 ? s.item_count - 1 : s.curr_id - 1; 240 s.dir = -1; 241 that.change(); 242 }, 243 wipeUp : function() { alert("up"); }, 244 wipeDown : function() { alert("down"); }, 245 min_move_x : 20, 246 min_move_y : 20, 247 preventDefaultEvents: true 248 }); 249 } 250 251 252 /* ------------------ 253 * setNavi 254 */ 255 this.setNavi = function() { 256 var s = this.setting; 257 258 // prev 259 $('#mainview .nav .prev a').off().css({ cursor : 'pointer' }).on({ 260 click : function() { 261 s.prev_id = s.curr_id; 262 s.curr_id = s.curr_id == 0 ? s.item_count - 1 : s.curr_id - 1; 263 s.dir = -1; 264 that.change(); 265 } 266 }).children('img').stop().animate({ opacity : 1 }, 350, 'easeOutSine'); 267 268 // next 269 $('#mainview .nav .next a').off().css({ cursor : 'pointer' }).on({ 270 click : function() { 271 s.prev_id = s.curr_id; 272 s.curr_id = s.curr_id == s.item_count - 1 ? 0 : s.curr_id + 1; 273 s.dir = 1; 274 that.change(); 275 } 276 }).children('img').stop().animate({ opacity : 1 }, 350, 'easeOutSine'); 277 } 278 279 280 /* ------------------ 281 * clearNavi 282 */ 283 this.clearNavi = function() { 284 var s = this.setting; 285 $('#mainview').off(); 286 $('#mainview .nav .prev a').off().css({ cursor : 'default' }).children('img').stop().animate({ opacity : 0.5 }, 350, 'easeOutSine'); 287 $('#mainview .nav .next a').off().css({ cursor : 'default' }).children('img').stop().animate({ opacity : 0.5 }, 350, 'easeOutSine'); 288 } 289 290 291 /* ------------------ 292 * setPagenation 293 */ 294 this.setPagenation = function() { 295 var s = this.setting; 296 297 $('.mainview_pagenation').each(function() { 298 $(this).children('ul').children('li').each(function(i) { 299 if(i == s.curr_id % s.view_num) { 300 var src = $(this).attr('data-img-over'); 301 $(this).children('a').off().css({ cursor : 'default' }).children('img').attr('src', src).stop().animate({ opacity : 1 }, 450, 'easeOutSine'); 302 } else { 303 var src = $(this).attr('data-img-normal'); 304 $(this).children('a').off().on({ 305 mouseenter : function() { 306 307 }, 308 mouseleave : function() { 309 310 }, 311 click : function(e) { 312 s.dir = e.data.id - (s.curr_id % s.view_num); 313 s.prev_id = s.curr_id; 314 s.curr_id += s.dir; 315 if(s.curr_id < 0) { 316 s.curr_id += s.item_count; 317 } else if(s.curr_id >= s.item_count) { 318 s.curr_id -= s.item_count; 319 } 320 that.change(); 321 } 322 }, { id : i }).css({ cursor : 'pointer' }).children('img').attr('src', src).stop().animate({ opacity : 1 }, 450, 'easeOutSine'); 323 } 324 }); 325 }); 326 } 327 328 329 /* ------------------ 330 * clearPagenation 331 */ 332 this.clearPagenation = function() { 333 var s = this.setting; 334 335 $('.mainview_pagenation').each(function() { 336 $(this).children('ul').children('li').each(function(i) { 337 var src = i == s.curr_id % s.view_num ? $(this).attr('data-img-over') : $(this).attr('data-img-normal'); 338 $(this).children('a').off().css({ cursor : 'default' }).children('img').attr('src', src).stop().animate({ opacity : 0.5 }, 350, 'easeOutSine'); 339 }); 340 }); 341 } 342 343 344 /* ------------------ 345 * change 346 */ 347 this.change = function() { 348 var s = this.setting; 349 350 // remove event 351 this.clearPagenation(); 352 this.clearNavi(); 353 this.clearTimer(); 354 355 // animation 356 var x = -1 * s.dir * s.item_width + s.margin_x; 357 $('#mainview .container').animate({ marginLeft : x }, 1100, 'easeInOutQuart', function() { 358 // adjust 359 x += s.dir * s.item_width; 360 $('#mainview .container').css({ marginLeft : x }); 361 362 var i, len = Math.abs(s.dir); 363 for(i=0; i<len; i++) { 364 if(s.dir > 0) { 365 $('#mainview .container').children('.item:last').after($('#mainview .container').children('.item:first')); 366 } else { 367 $('#mainview .container').children('.item:first').before($('#mainview .container').children('.item:last')); 368 } 369 } 370 371 // set event 372 that.setPagenation(); 373 that.setNavi(); 374 that.resetTopics(); 375 that.setTimer(); 376 }); 377 } 378 379 380 /* ------------------ 381 * setTimer 382 */ 383 this.setTimer = function() { 384 var s = this.setting; 385 if(s.timer == null) { 386 s.timer = setInterval(function() { 387 s.prev_id = s.curr_id; 388 s.curr_id = s.curr_id == s.item_count - 1 ? 0 : s.curr_id + 1; 389 s.dir = 1; 390 that.change(); 391 }, s.interval); 392 } 393 } 394 395 396 /* ------------------ 397 * clearTimer 398 */ 399 this.clearTimer = function() { 400 var s = this.setting; 401 if(s.timer != null) { 402 clearInterval(s.timer); 403 s.timer = null; 404 } 405 } 406 407 408 /* ------------------ 409 * _resize 410 */ 411 this._resize = function() { 412 var s = this.setting; 413 414 //var winW = window.innerWidth ? window.innerWidth : $(window).width(); 415 var winW = $(window).width(); 416 var winH = window.innerHeight ? window.innerHeight : $(window).height(); 417 var scrlY = $(window).scrollTop(); 418 419 // param 420 //s.item_width = winW; 421 s.item_height = winH - 100 - 80; 422 s.item_width = Math.max(Math.round(s.item_height * s.item_ratio), s.item_min_w); 423 s.margin_x = -1 * s.view_num * s.item_width + Math.round((winW - s.item_width) / 2); 424 425 // mainview container 426 $('#mainview .container').width(s.item_width * s.item_count).css({ marginLeft : s.margin_x }); 427 428 // mainview item 429 $('#mainview').height(s.item_height); 430 $('#mainview .item').each(function(i) { 431 $(this).width(s.item_width).height(s.item_height); 432 var o = $(this).children('.bg').children('img'); 433 var def_w = parseInt(o.attr('data-def-width')); 434 var def_h = parseInt(o.attr('data-def-height')); 435 var ratio = def_h / def_w; 436 var w = s.item_width; 437 var h = Math.round(w * ratio); 438 if(h < s.item_height) { 439 h = s.item_height; 440 w = Math.round(h / ratio); 441 } 442 var x = Math.round((s.item_width - w) / 2); 443 var y = Math.round((s.item_height - h) / 2); 444 o.width(w).height(h).css({ marginLeft : x, marginTop : y }); 445 }); 446 447 // mainview navi 448 var img_h = $('#mainview .nav .prev a img').height() + 60; 449 y = Math.floor((s.item_height - img_h) / 2); 450 $('#mainview .nav li').each(function() { 451 $(this).css({ paddingTop : y }); 452 }); 453 454 //mainview text-size 455 var ts; 456 var ts = Math.round(winH/640*100*1.3); 457 if(winH<=640) { 458 ts = Math.max(120, ts); 459 } else { 460 ts = Math.min(320, ts); 461 } 462 $('#mainview .context h2').css('font-size', ts + '%'); 463 464 //console.log('winW=' + winW); 465 var textWidth = Math.min(s.item_width, winW); 466 if(s.item_width > winW) { 467 var margin_xs = Math.round((s.item_width - winW)/2) + 20; 468 $('#mainview .context h2').width(s.item_width-margin_xs*2); 469 $('#mainview .context h2').css('margin-left', margin_xs + 'px').css('margin-right', margin_xs + 'px'); 470 471 $('#mainview .context p.link').width(s.item_width-margin_xs*2); 472 $('#mainview .context p.link').css('margin-left', margin_xs + 'px').css('margin-right', margin_xs + 'px'); 473 474 $('#mainview .tweet ul').width(s.item_width-40-170); 475 $('#mainview .tweet .tweet_conteiner').css('margin-left', margin_xs + 'px').css('margin-right', margin_xs + 'px'); 476 477 }else{ 478 $('#mainview .context h2').css('margin-left', '20px').css('margin-right', '20px'); 479 $('#mainview .context p.link').css('margin-left', '20px').css('margin-right', '20px'); 480 481 $('#mainview .context h2').width(textWidth-40); 482 $('#mainview .context p.link').width(textWidth-40); 483 484 $('#mainview .tweet .tweet_conteiner').css('margin-left', '20px').css('margin-right', '20px'); 485 $('#mainview .tweet ul').width(textWidth-40-170); 486 } 487 488 } 489 490 491 /* ------------------ 492 * _scroll 493 */ 494 this._scroll = function() { 495 var s = this.setting; 496 497 var winH = window.innerHeight ? window.innerHeight : $(window).height(); 498 var scrlY = $(window).scrollTop(); 499 500 // helper 501 var helper_flag = $('#helper').attr('data-flag') == 'false' ? true : false;
502 if(scrlY < 20) { 503 if(helper_flag) { 504 var y = 0; 505 $('#helper .section_container').stop().animate({ marginTop : y }, 550, 'easeOutSine'); 506 $('#helper').attr('data-flag', 'true'); 507 } 508 } else { 509 if(!helper_flag) { 510 var y = $('#helper .section_container').height(); 511 $('#helper .section_container').stop().animate({ marginTop : y }, 450, 'easeOutQuint'); 512 $('#helper').attr('data-flag', 'false'); 513 } 514 } 515 } 516 517 518 this.initialize(); 519 520 return this; 521} 522 523 524 525 526/* ---------------------------------------- 527 * 528 * CLASS - Topics 529 * ----- 530 * for IE8 : slide up 531 * for Modern Browser : cross fade 532 * 533 * ---------------------------------------- 534 */ 535var Topics = function(opt) { 536 var that = this; 537 538 this.setting = { 539 container : null, 540 tweet_box : null, 541 mainview_id : null, 542 source : '', 543 view_num : 0, 544 container_width : 790, 545 item_count : 0, 546 item_width : 0, 547 item_height : 0, 548 curr_id : 0, 549 prev_id : null, 550 timer : null, 551 interval : 3000 552 } 553 554 this.data = []; 555 556 557 /* ------------------ 558 * initialize 559 */ 560 this.initialize = function() { 561 var s = this.setting; 562 s.container = opt.container; 563 s.mainview_id = opt.mainview_id; 564 565 // param 566 s.item_height = 50; 567 if(TOPICS_DATA[s.mainview_id]==undefined){ 568 this.data = ['', '', '']; 569 }else{ 570 this.data = TOPICS_DATA[s.mainview_id]; 571 } 572 s.item_count = this.data.length; 573 574 // DOM 575 s.tweet_box = s.container.find('.mainview_tweet'); 576 s.tweet_box.children('ul').empty(); 577 s.source = ''; 578 var i, len = s.item_count; 579 for(i=0; i<len; i++) { 580 s.source += '<li><span>' + this.data[i] + '</span></li>'; 581 } 582 s.tweet_box.children('ul').html(s.source); 583 584 // container width 585 var w = 0; 586 s.tweet_box.children('ul').children('li').each(function(i) { 587 w = Math.max(w, $(this).width()); 588 }); 589 590 w = Math.min(w, s.container.width()-170-40); 591 s.tweet_box.children('ul').width(w); 592 593 594 var winW = $(window).width(); 595 var w = s.container.width(); 596 var textWidth = Math.min(w, winW); 597 if(w > winW) { 598 var margin_xs = Math.round((w - winW)/2) + 20; 599 $('#mainview .context h2').width(w-margin_xs*2); 600 $('#mainview .context h2').css('margin-left', margin_xs + 'px').css('margin-right', margin_xs + 'px'); 601 602 $('#mainview .context p.link').width(w-margin_xs*2); 603 $('#mainview .context p.link').css('margin-left', margin_xs + 'px').css('margin-right', margin_xs + 'px'); 604 605 $('#mainview .tweet ul').width(w-40-170); 606 $('#mainview .tweet .tweet_conteiner').css('margin-left', margin_xs + 'px').css('margin-right', margin_xs + 'px'); 607 608 }else{ 609 $('#mainview .context h2').css('margin-left', '20px').css('margin-right', '20px'); 610 $('#mainview .context p.link').css('margin-left', '20px').css('margin-right', '20px'); 611 612 $('#mainview .context h2').width(textWidth-40); 613 $('#mainview .context p.link').width(textWidth-40); 614 615 $('#mainview .tweet .tweet_conteiner').css('margin-left', '20px').css('margin-right', '20px'); 616 $('#mainview .tweet ul').width(textWidth-40-170); 617 } 618 619 620 621 } 622 623 624 /* ------------------ 625 * start 626 */ 627 this.start = function() { 628 var s = this.setting; 629 630 // slide 631 var target = s.tweet_box.children('ul').children('li:eq(0)'); 632 that.setTweetSlide(target); 633 634 // set event 635 that.setTimer(); 636 } 637 638 639 /* ------------------ 640 * reset 641 */ 642 this.reset = function() { 643 var s = this.setting; 644 645 this.clearTimer(); 646 s.tweet_box.stop().css({ top : 0 }).children('ul').empty().html(s.source).children('li').each(function() { 647 $(this).children('span').stop().css({ marginLeft : 0 }); 648 }); 649 } 650 651 652 /* ------------------ 653 * change 654 */ 655 this.change = function() { 656 var s = this.setting; 657 658 // remove event 659 this.clearTimer(); 660 661 // animation for IE8 662 if(_ua.ltIE8) { 663 // animation 664 var y = -1 * s.item_height; 665 s.tweet_box.animate({ top : y }, 1100, 'easeInOutQuart', function() { 666 // adjust 667 s.tweet_box.children('ul').children('li:first').children('span').stop().css({ marginLeft : 0 }); 668 y += s.item_height; 669 s.tweet_box.css({ top : y }).children('ul').children('li:last').after(s.tweet_box.children('ul').children('li:first')); 670 671 // slide 672 that.setTweetSlide($(this).children('ul').children('li:eq(0)')); 673 674 // set event 675 that.setTimer(); 676 }); 677 678 // animation for Modern browser 679 } else { 680 681 var prev_item = s.tweet_box.children('ul').children('li:eq(' + s.prev_id + ')'); 682 prev_item.stop().animate({ opacity : 0 }, 1100, 'easeInOutQuart', function() { 683 $(this).css({ display : 'none', opacity : 0 }); 684 }); 685 686 var curr_item = s.tweet_box.children('ul').children('li:eq(' + s.curr_id + ')'); 687 curr_item.children('span').stop().css({ marginLeft : 0 }); 688 curr_item.stop().css({ display : 'block', opacity : 0 }).animate({ opacity : 1 }, 1100, 'easeInOutQuart', function() { 689 $(this).css({ opacity : 1 }); 690 691 // slide 692 that.setTweetSlide($(this)); 693 694 // set event 695 that.setTimer(); 696 }); 697 } 698 699 /* 700 // animation 701 var y = -1 * s.item_height; 702 s.tweet_box.animate({ top : y }, 1100, 'easeInOutQuart', function() { 703 // adjust 704 s.tweet_box.children('ul').children('li:first').children('span').stop().css({ marginLeft : 0 }); 705 y += s.item_height; 706 s.tweet_box.css({ top : y }).children('ul').children('li:last').after(s.tweet_box.children('ul').children('li:first')); 707 708 // slide 709 that.setTweetSlide($(this).children('ul').children('li:eq(0)')); 710 711 // set event 712 that.setTimer(); 713 }); 714 */ 715 } 716 717 718 /* ------------------ 719 * setTweetSlide 720 */ 721 this.setTweetSlide = function(target) { 722 var s = this.setting; 723 724 var w = Math.min(target.children('span').width(), 1300); 725 if(w > s.container_width) { 726 var x = s.container_width - w; 727 x = Math.max(x, -300); 728 target.children('span').stop().delay(500).animate({ marginLeft : x }, s.interval - 1000, 'linear'); 729 } 730 } 731 732 733 /* ------------------ 734 * setTimer 735 */ 736 this.setTimer = function() { 737 738 var s = this.setting; 739 if(s.timer == null) { 740 s.timer = setInterval(function() { 741 s.prev_id = s.curr_id; 742 s.curr_id = s.curr_id == s.item_count - 1 ? 0 : s.curr_id + 1; 743 s.dir = 1; 744 that.change(); 745 }, s.interval); 746 } 747 } 748 749 750 /* ------------------ 751 * clearTimer 752 */ 753 this.clearTimer = function() { 754 var s = this.setting; 755 if(s.timer != null) { 756 clearInterval(s.timer); 757 s.timer = null; 758 } 759 } 760 761 762 /* ------------------ 763 * finalize 764 */ 765 this.finalize = function() { 766 var s = this.setting; 767 768 this.clearTimer(); 769 return true; 770 } 771 772 773 this.initialize(); 774 775 return this; 776} 777 778 779 780 781/* ---------------------------------------- 782 * 783 * CLASS - Pick Up Movie 784 * 785 * ---------------------------------------- 786 */ 787var PickUpMovie = function() { 788 var that = this; 789 790 this.setting = { 791 view_num : 0, 792 item_count : 0, 793 item_width : 312, 794 item_height : 0, 795 margin_x : 0, 796 curr_id : 0, 797 prev_id : null, 798 dir : 1, 799 timer : null, 800 interval : 3500, 801 tmpl_movie : null 802 } 803 804 805 /* ------------------ 806 * initialize 807 */ 808 this.initialize = function() { 809 var s = this.setting; 810 811 // param 812 s.view_num = $('#movie .item').length; 813 s.margin_x = -1 * s.view_num * (s.item_width + 12) - 12; 814 815 // get template 816 s.tmpl_movie = $('#movie_player_tmpl .section_container').clone(); 817 818 // ã³ã³ãã³ããè¤è£½ 819 var repeat = 2; 820 var src = $('#movie .content').html(); 821 $('#movie .content').empty(); 822 var i; 823 var html = ''; 824 for(i=0; i<repeat; i++) { 825 html += src; 826 } 827 $('#movie .content').html(html); 828 s.item_count = $('#movie .item').length; 829 830 // init DOM 831 var w = (s.item_width + 12) * s.item_count; 832 $('#movie .content').width(w).css({ marginLeft : s.margin_x }); 833 834 // event 835 if(s.view_num > 3) { 836 // ã¤ãã³ãè¨å® 837 this.setEvent(); 838 this.setTimer(); 839 }else{ 840 this.setEvent(); 841 } 842 } 843 844 845 /* ------------------ 846 * setEvent 847 */ 848 this.setEvent = function() { 849 var s = this.setting; 850 851 // stage 852 if(!_ua.Mobile && s.view_num > 3) {//ã³ã³ãã³ããè¤è£½ãã¦ããã®ã§$('#movie .item').lengthã¯åã« 853 $('#movie').on({ 854 mouseenter : function() { 855 $(this).addClass('focus'); 856 that.setNavi(); 857 //$('#movie .section_header p').css({ display : 'block' }); 858 }, 859 mouseleave : function() { 860 $(this).removeClass('focus'); 861 that.clearNavi(); 862 //$('#movie .section_header p').css({ display : 'none' }); 863 } 864 }); 865 } 866 867 // item 868 $('#movie .item').each(function(i) { 869 $(this).css({ cursor : 'pointer' }).on({ 870 mouseenter : function() { 871 $(this).addClass('over'); 872 }, 873 mouseleave : function() { 874 $(this).removeClass('over'); 875 }, 876 click : function() { 877 //var url = $(this).children('link').children('a').attr('href'); 878 879 var service = $(this).attr('data-service'); 880 881 // YouTube 882 if(service == 'youtube') { 883 var id = $(this).attr('data-id'); 884 //console.log(id) 885 if(id != 'null') { 886 that.addPlayer(service, id); 887 } 888 889 // jStream 890 } else { 891 var id = parseInt($(this).attr('data-id')); 892 var src = '/api/artist/movieembed?movie_id=' + id; 893 that.openWindow(src); 894 } 895 } 896 }); 897 }); 898 } 899 900 901 /* ------------------ 902 * change 903 */ 904 this.change = function() { 905 var s = this.setting; 906 907 // clear timer 908 this.clearTimer(); 909 910 // animation 911 var x = -1 * s.dir * (s.item_width + 12) + s.margin_x; 912 $('#movie .content').animate({ marginLeft : x }, 1100, 'easeInOutQuart', function() { 913 // adjust 914 x += s.dir * (s.item_width + 12); 915 $('#movie .content').css({ marginLeft : x }); 916 917 var i, len = Math.abs(s.dir); 918 for(i=0; i<len; i++) { 919 if(s.dir > 0) { 920 $('#movie .content').children('.item:last').after($('#movie .content').children('.item:first')); 921 } else { 922 $('#movie .content').children('.item:first').before($('#movie .content').children('.item:last')); 923 } 924 } 925 926 // set timer 927 that.setTimer(); 928 }); 929 } 930 931 932 /* ------------------ 933 * setNavi 934 */ 935 this.setNavi = function() { 936 var s = this.setting; 937 938 // prev 939 $('#movie .section_header .prev').css({ display : 'block' }).children('a').off().css({ cursor : 'pointer' }).on({ 940 mouseenter : function() { 941 //$(this).children('img').stop().animate({ opacity : 1 }, 750, 'easeOutSine'); 942 }, 943 mouseleave : function() { 944 //$(this).children('img').stop().animate({ opacity : 0 }, 450, 'easeOutSine'); 945 }, 946 click : function() { 947 s.prev_id = s.curr_id; 948 s.curr_id = s.curr_id == 0 ? s.item_count - 1 : s.curr_id - 1; 949 s.dir = -1; 950 that.change(); 951 } 952 }).children('img').css({ opacity : 1 }); 953 954 // next 955 $('#movie .section_header .next').css({ display : 'block' }).children('a').off().css({ cursor : 'pointer' }).on({ 956 mouseenter : function() { 957 //$(this).children('img').stop().animate({ opacity : 1 }, 750, 'easeOutSine'); 958 }, 959 mouseleave : function() { 960 //$(this).children('img').stop().animate({ opacity : 0 }, 450, 'easeOutSine'); 961 }, 962 click : function() { 963 s.prev_id = s.curr_id; 964 s.curr_id = s.curr_id == s.item_count - 1 ? 0 : s.curr_id + 1; 965 s.dir = 1; 966 that.change(); 967 } 968 }).children('img').css({ opacity : 1 }); 969 } 970 971 972 /* ------------------ 973 * clearNavi 974 */ 975 this.clearNavi = function() { 976 var s = this.setting; 977 978 $('#movie .section_header .prev a').off().css({ cursor : 'default' }).children('img').css({ opacity : 0 }); 979 $('#movie .section_header .prev').css({ display : 'none' }); 980 $('#movie .section_header .next a').off().css({ cursor : 'default' }).children('img').css({ opacity : 0 }); 981 $('#movie .section_header .next').css({ display : 'none' }); 982 } 983 984 985 /* ------------------ 986 * setTimer 987 */ 988 this.setTimer = function() { 989 var s = this.setting; 990 if(s.timer == null) { 991 s.timer = setInterval(function() { 992 s.prev_id = s.curr_id; 993 s.curr_id = s.curr_id == s.item_count - 1 ? 0 : s.curr_id + 1; 994 s.dir = 1; 995 that.change(); 996 }, s.interval); 997 } 998 } 999 1000 1001 /* ------------------ 1002 * clearTimer 1003 */ 1004 this.clearTimer = function() { 1005 var s = this.setting; 1006 if(s.timer != null) { 1007 clearInterval(s.timer); 1008 s.timer = null; 1009 } 1010 } 1011 1012 1013 /* ------------------
1014 * openWindow 1015 */ 1016 this.openWindow = function(url) { 1017 var s = this.setting; 1018 1019 window.open(url, 'toysfactory', 'width=640, height=360, menubar=no, toolbar=no, scrollbars=yes'); 1020 } 1021 1022 1023 /* ------------------ 1024 * addPlayer 1025 */ 1026 this.addPlayer = function(service, id) { 1027 var s = this.setting; 1028 1029 //console.log('YOUTUBE : ' + id); 1030 1031 // DOM 1032 $('#movie_player').append(s.tmpl_movie.clone()).css({ display : 'block' }); 1033 this._resize(); 1034 1035 // youtube 1036 if(service == 'youtube') { 1037 var src = '<iframe width="960" height="540" src="//www.youtube.com/embed/'; 1038 src += id; 1039 src += '?rel=0" frameborder="0" allowfullscreen></iframe>'; 1040 $('#movie_player').find('.movie_player').html(src); 1041 1042 // jStream 1043 } else { 1044 1045 } 1046 1047 // close 1048 $('#movie_player').find('.close').on({ 1049 mouseenter : function() { 1050 1051 }, 1052 mouseleave : function() { 1053 1054 }, 1055 click : function() { 1056 that.removePlayer(); 1057 } 1058 }); 1059 1060 // window 1061 $('body').addClass('window'); 1062 } 1063 1064 1065 /* ------------------ 1066 * removePlayer 1067 */ 1068 this.removePlayer = function(id) { 1069 var s = this.setting; 1070 1071 if($('#movie_player .section_container').length > 0) { 1072 1073 //$('#movie_player').empty().css({ display : 'none' }); //IE8 ã§empty()ãå¹ããªã 1074 $('#movie_player').css({ display : 'none' }); 1075 $('#movie_player iframe').remove(); 1076 1077 // window 1078 $('body').removeClass('window'); 1079 } 1080 } 1081 1082 1083 /* ------------------ 1084 * _resize 1085 */ 1086 this._resize = function() { 1087 var s = this.setting; 1088 1089 var winW = window.innerWidth ? window.innerWidth : $(window).width(); 1090 var winH = window.innerHeight ? window.innerHeight : $(window).height(); 1091 var scrlY = $(window).scrollTop(); 1092 1093 // window 1094 if($('#movie_player .section_container').length > 0) { 1095 $('#movie_player').width(winW).height(winH); 1096 var y = Math.round((winH - 600) / 2); 1097 $('#movie_player .section_container').css({ marginTop : y }); 1098 } 1099 } 1100 1101 1102 this.initialize(); 1103 1104 return this; 1105} 1106 1107 1108 1109 1110/* ---------------------------------------- 1111 * 1112 * CLASS - New Release 1113 * 1114 * ---------------------------------------- 1115 */ 1116var Release = function() { 1117 var that = this; 1118 1119 this.setting = { 1120 tmpl_windoe : null 1121 } 1122 1123 1124 /* ------------------ 1125 * initialize 1126 */ 1127 this.initialize = function() { 1128 var s = this.setting; 1129 1130 // ãã³ãã¬ã¼ããåå¾ 1131 s.tmpl_window = $('#release_window_tmpl .release_window').clone(); 1132 1133 // DOMåæå 1134 this.initDOM(); 1135 } 1136 1137 1138 /* ------------------ 1139 * initDOM 1140 */ 1141 this.initDOM = function() { 1142 var s = this.setting; 1143 1144 // fix height 1145 var release_item_h = 245; 1146 $('.release_item').each(function(i) { 1147 //release_item_h = Math.max(release_item_h, $(this).height()); 1148 if(++i % 4 == 0) { 1149 for(var ii=0; ii<4; ii++) { 1150 var index =Math.floor((i - 1) / 4) * 4 + ii; 1151 //console.log("release_item_h="+release_item_h + " .release_:eq(" + index + ")="+$('.release_item:eq(' + index + ')').height()); 1152 release_item_h = Math.max(release_item_h, $('.release_item:eq(' + index + ')').height()); 1153 //$('.release_item:eq(' + index + ')').height(release_item_h); 1154 } 1155 for(var ii=0; ii<4; ii++) { 1156 var index =Math.floor((i - 1) / 4) * 4 + ii; 1157 $('.release_item:eq(' + index + ')').height(release_item_h); 1158 } 1159 release_item_h = 245; 1160 } 1161 }); 1162 1163 // event 1164 that.setEvent(); 1165 } 1166 1167 /* ------------------ 1168 * setEvent 1169 */ 1170 this.setEvent = function() { 1171 var s = this.setting; 1172 1173 $('.release_item').each(function(i) { 1174 $(this).css({ cursor : 'pointer' }).on({ 1175 mouseenter : function(e) { 1176 if(!_ua.Mobile) { 1177 var src = $(this).html(); 1178 $(this).append(s.tmpl_window.clone()); 1179 $(this).children('.release_window').children('.release_window_container').html(src); 1180 1181 // link 1182 var link01 = $(this).attr('data-link01'); 1183 if(typeof(link01) == 'undefined') { 1184 $(this).children('.release_window').find('.link01').css({ display : 'none' }); 1185 } else { 1186 $(this).children('.release_window').find('.link01').children('a').attr('href', link01); 1187 } 1188 var link02 = $(this).attr('data-link02'); 1189 if(typeof(link02) == 'undefined') { 1190 $(this).children('.release_window').find('.link02').css({ display : 'none' }); 1191 } else { 1192 $(this).children('.release_window').find('.link02').children('a').attr('href', link02); 1193 } 1194 1195 // show 1196 $(this).children('.release_window').find('.txt').css({ display : 'block' }); 1197 } 1198 }, 1199 mouseleave : function(e) { 1200 if(!_ua.Mobile) { 1201 $(this).children('.release_window').empty().remove(); 1202 } 1203 }, 1204 click : function(e) { 1205 if($(this).children('.img').children('a').length > 0) { 1206 var url = $(this).children('.img').children('a').attr('href'); 1207 location.href = url; 1208 } 1209 } 1210 }, { id : i }); 1211 }); 1212 } 1213 1214 1215 this.initialize(); 1216 1217 return this; 1218} 1219
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.