(function ($) { /* -----------------------------------------------*/ // DOM Ready /* -----------------------------------------------*/ $(function () { $('.loading-wrap').before(''); tableInit(); $(".playAudio").click(function () { var classThis = this.className; var newClass = ""; if (classThis.indexOf("mti-icon-player_stop")>= 0) { newClass = this.className.replace("mti-icon-player_stop", "mti-icon-player_play"); this.className = newClass; } else { newClass = classThis.replace("mti-icon-player_play", "mti-icon-player_stop"); this.className = newClass; } }); }); /* -----------------------------------------------*/ // window.load /* -----------------------------------------------*/ $(window).load(function () { $('.loading-gif').hide(); $('.loading-wrap').animate({ 'opacity': '1' }, 500); $('.flList-7 > li').autoHeight({ height: 'height' }); $('.autoHeight-7').autoHeight({ column: 7 }); $('.flList-7 > li').autoHeight({ column: 7 }); $(".bx-viewport").height("auto"); }); /* -----------------------------------------------*/ // rollover /* -----------------------------------------------*/ function rollover() { var speed = 120; var easing = 'linear'; $('img.hover').hover(function () { $(this).stop().animate({ 'opacity': '0.6' }, speed, easing); }, function () { $(this).stop().animate({ 'opacity': '1' }, speed, easing); }); }; /* -----------------------------------------------------------------------*/ // rollover /* -----------------------------------------------------------------------*/ $(function () { var postfix = '_ov'; var elm = document.createElement('img'); var ov = 'img-over'; $("img." + ov + "").not('[src*="' + postfix + '."]').each(function () { var img = $(this); var src = img.attr('src'); //console.log(src); var src_on = src.substr(0, src.lastIndexOf('.')) + postfix + src.substring(src.lastIndexOf('.')); var cln = elm.cloneNode(true); $(cln).attr('src', src_on); $(img).hover( function () { img.attr('src', src_on); }, function () { img.attr('src', src); } ); }); }); /* -----------------------------------------------*/ // imgReplace /* -----------------------------------------------*/ function imgReplace() { if ($('body').attr('id') != 'mobile') { var replace = $('img.replace'); var len = replace.length; var setSrc; for (var i = 0; i < len; i++) { setSrc = $(replace[i]).attr('src').split('/m'); $(replace[i]).attr('src', setSrc[0] + setSrc[1]); } } }; /* -----------------------------------------------*/ // smoothScroll /* -----------------------------------------------*/ $(function () { $('a[href^=#]').click(function () { var href = $(this).attr('href'), headerHeight = $('#header .row-03').height(); //console.log(href); if ($(this).hasClass("tabNav")) { } else if (href != "#") { //console.log("in"); var speed = 500; var href = $(this).attr("href"); var target = $(href == "#" || href == "" ? 'html' : href); var position = target.offset().top - headerHeight; $("html, body").animate({ scrollTop: position }, speed, "swing"); return false; } }); }); /** * ページトップ * * @class pageTop function */ function pageTop() { var winW = $(window).width(); var curTop = $(window).scrollTop(); // スクロールイベント $(window).bind('scroll', function () { curTop = $(window).scrollTop(); winW = $(window).width(); winH = $(window).height(); pageTopToggle(curTop, winW, winH); }); // リサイズイベント $(window).bind('resize', function () { curTop = $(window).scrollTop(); winW = $(window).width(); winH = $(window).height(); pageTopToggle(curTop, winW, winH); }); } /** * ページトップ2 * * @class pageTopToggle function */ function pageTopToggle(curTop, winW, winH) { /** * hogeメソッドです。 * * @method function * @param {Int} curTop * @param {Int} winW * @param {Int} winH */ var speed = 200; var easing = 'swing'; var pageTop = $('#pagetop'); var breakHeight = $('#sidebar').height() + 370 - winH; var finalX = 750; var finalY = $('#container').height() - winH - 60; if (breakHeight > curTop || finalX > winW) { $(pageTop).fadeOut(speed, easing); $(pageTop).removeClass('static'); } else { $(pageTop).fadeIn(speed, easing); $(pageTop).removeClass('static'); } if (finalY < curTop) { $(pageTop).addClass('static'); } } /* -----------------------------------------------*/ // グロナビ /* -----------------------------------------------*/ $(function () { var gnav = $("#gnav a"); var gnav01 = $("#gnav ul.grobal .gnav01"); var gnav02 = $("#gnav ul.grobal .gnav02"); var gnav03 = $("#gnav ul.grobal .gnav03"); var gnav04 = $("#gnav ul.grobal .gnav04"); var gnav05 = $("#gnav ul.grobal .gnav05"); var sub01sel = $("#gnav .subnav01"); var sub02sel = $("#gnav .subnav02"); var sub03sel = $("#gnav .subnav03"); var sub04sel = $("#gnav .subnav04"); var sub05sel = $("#gnav .subnav05"); gnav01.unbind('click').click(function () { if (sub01sel.css('display') == 'none') { sub01sel.slideDown("fast"); } else { sub01sel.slideUp("fast"); } sub02sel.slideUp("fast"); sub03sel.slideUp("fast"); sub04sel.slideUp("fast"); sub05sel.slideUp("fast"); }); gnav02.unbind('click').click(function () { if (sub02sel.css('display') == 'none') { sub02sel.slideDown("fast"); } else { sub02sel.slideUp("fast"); } sub01sel.slideUp("fast"); sub03sel.slideUp("fast"); sub04sel.slideUp("fast"); sub05sel.slideUp("fast"); }); gnav03.unbind('click').click(function () { if (sub03sel.css('display') == 'none') { sub03sel.slideDown("fast"); } else { sub03sel.slideUp("fast"); } sub01sel.slideUp("fast"); sub02sel.slideUp("fast"); sub04sel.slideUp("fast"); sub05sel.slideUp("fast"); }); gnav04.unbind('click').click(function () { if (sub04sel.css('display') == 'none') { sub04sel.slideDown("fast"); } else { sub04sel.slideUp("fast"); } sub01sel.slideUp("fast"); sub02sel.slideUp("fast"); sub03sel.slideUp("fast"); sub05sel.slideUp("fast"); }); gnav05.unbind('click').click(function () { if (sub05sel.css('display') == 'none') { sub05sel.slideDown("fast"); } else { sub05sel.slideUp("fast"); } sub01sel.slideUp("fast"); sub02sel.slideUp("fast"); sub03sel.slideUp("fast"); sub04sel.slideUp("fast"); }); $("#header, #wrapper, #breadcrumb").unbind('click').click(function () { sub01sel.slideUp("fast"); sub02sel.slideUp("fast"); sub03sel.slideUp("fast"); sub04sel.slideUp("fast"); sub05sel.slideUp("fast"); }); $(window).scroll(function () { sub01sel.slideUp("fast"); sub02sel.slideUp("fast"); sub03sel.slideUp("fast"); sub04sel.slideUp("fast"); sub05sel.slideUp("fast"); }); }); /* -----------------------------------------------*/ // nth-child /* -----------------------------------------------*/ $(function () { $('.flList-2 li:nth-child(2n)').addClass('listLast'); $('.flList-3 li:nth-child(3n)').addClass('listLast'); $('.flList-4 li:nth-child(4n)').addClass('listLast'); $('.flList-5 li:nth-child(5n)').addClass('listLast'); $('.flList-6 li:nth-child(6n)').addClass('listLast'); $('.flList-7 li:nth-child(7n)').addClass('listLast'); }); /* -----------------------------------------------*/ // Loading Button /* -----------------------------------------------*/ $("a.btn-more").click(function (e) { $(this).children("span").addClass("btn-loading"); e.preventDefault(); }); /* ----------------------------------------------------*/ // Words Length Wrap /* ----------------------------------------------------*/ $(function () { var regs = new RegExp("(\.music\.jp\:?[0-9]*/?$)|(/pickup)", "i"); var regs2 = new RegExp("(\.music\.jp\:?[0-9]*/?$)|(/LimitedTimeBundle)", "i"); var afterTxt = ' …'; // 文字カット後に表示するテキスト WordsLengthWrap($('.mod-trackList ul li p.tieup'), 15); // ignore top and pickup if (!regs.test(window.location.href) && !regs2.test(window.location.href)) { WordsLengthWrap($('.mod-trackList ul li p.comment'), 36); } WordsLengthWrap($('.mod-rankingList .col ul li .rankingList-content .rankingList-content-tieup'), 25); WordsLengthWrap($('.mod-featureList ul li p.profile'), 38); WordsLengthWrap($('.WLW-10'), 10); WordsLengthWrap($('.WLW-15'), 15); WordsLengthWrap($('.WLW-20'), 20); WordsLengthWrap($('.WLW-25'), 25); WordsLengthWrap($('.WLW-30'), 30); WordsLengthWrap($('.WLW-35'), 35); WordsLengthWrap($('.WLW-40'), 40); WordsLengthWrap($('.WLW-45'), 45); WordsLengthWrap($('.WLW-50'), 50); WordsLengthWrap($('.WLW-55'), 55); WordsLengthWrap($('.WLW-60'), 60); WordsLengthWrap($('.WLW-65'), 65); WordsLengthWrap($('.WLW-70'), 70); WordsLengthWrap($('.WLW-75'), 75); WordsLengthWrap($('.WLW-80'), 80); WordsLengthWrap($('.WLW-85'), 85); WordsLengthWrap($('.WLW-90'), 90); WordsLengthWrap($('.WLW-95'), 95); WordsLengthWrap($('.WLW-100'), 100); function WordsLengthWrap(elem, num) { elem.each(function () { var textLength = $(this).text().length; var textTrim = $(this).text().substr(0, (num)); if (num < textLength) { $(this).html(textTrim + afterTxt).css({ visibility: 'visible' }); } else if (num >= textLength) { $(this).css({ visibility: 'visible' }); } }); } }); // ポイント入力での総合計変更 $('#ui-use-point').bind('keyup', function () { var grandtotal = $(this).data('total'); if ($(this).val().match(/^[0-9]+$/)) { var total = grandtotal - $(this).val(); if (total < 0) { //$(this).val(grandtotal); total = 0; } $('#ui-grandtotal-cost').text(addFigure(total)); } else if ($(this).val() == '') { var total = grandtotal; $('#ui-grandtotal-cost').text(addFigure(total)); } else { var total = grandtotal; $('#ui-grandtotal-cost').text(addFigure(total)); $(this).val(0); } }); // ポイント入力での総合計変更 $('#comic-ui-use-point').bind('keyup', function () { var grandtotal = $(this).data('total'); if ($(this).val().match(/^[0-9]+$/)) { var total = grandtotal - $(this).val(); if (total < 0) { //$(this).val(grandtotal); total = 0; } $('#comic-ui-grandtotal-cost').text(addFigure(total)); } else if ($(this).val() == '') { var total = grandtotal; $('#comic-ui-grandtotal-cost').text(addFigure(total)); } else { var total = grandtotal; $('#comic-ui-grandtotal-cost').text(addFigure(total)); $(this).val(0); } }); $('#book-ui-use-point').bind('keyup', function () { var grandtotal = $(this).data('total'); if ($(this).val().match(/^[0-9]+$/)) { var total = grandtotal - $(this).val(); if (total < 0) { //$(this).val(grandtotal); total = 0; } $('#book-ui-grandtotal-cost').text(addFigure(total)); } else if ($(this).val() == '') { var total = grandtotal; $('#book-ui-grandtotal-cost').text(addFigure(total)); } else { var total = grandtotal; $('#book-ui-grandtotal-cost').text(addFigure(total)); $(this).val(0); } }); $('#ui-use-point-individual').bind('keyup', function () { var grandtotal = $(this).data('total'); if ($(this).val().match(/^[0-9]+$/)) { var total = grandtotal - $(this).val(); if (total < 0) { $(this).val(grandtotal); total = 0; } $('#ui-individual-cost').text(total); } else if ($(this).val() == '') { var total = grandtotal; $('#ui-individual-cost').text(total); } else { var total = grandtotal; $('#ui-individual-cost').text(total); $(this).val(0); } var cost1 = parseInt($("#ui-monthly-cost").text()); var cost2 = parseInt($("#ui-individual-cost").text()); var totalCost = cost1 + cost2; $("#ui-grandtotal-cost").text(totalCost); $('#ui-individual-cost').text(addFigure(String(cost2))); }); // tab navigation 2014/4/3追記 $('.tabBody').not('.active').hide(); $(".ui-tabNav a").on("click", function () { $(this).parent().parent().children('li').removeClass("on"); $(this).parent("li").addClass("on"); $(this).parent().parent().parent().find('.tabBody').hide(); $($(this).attr("href")).show().addClass("heightLineParent"); return false; }); })(jQuery); /** * Text input instruction @class inputの色切り替え */ function cText(obj) { /** * @method function cText * @param {String 対象input} obj */ if (obj.value == obj.defaultValue) { obj.value = ""; obj.style.color = "#000"; } } /** * Text input instruction @class inputの色切り替え2 */ function sText(obj) { /** @method function sText @param {String 対象input} obj */ if (obj.value == "") { obj.value = obj.defaultValue; obj.style.color = "#999"; } } /** Checkbox All check @class すべてにチェックを入れる */ /** @event click @param {String} selecter */ var selecter = $(".input-chk-All"); var selecter02 = $(".input-chk-All-02"); selecter.click(function () { AllCheck(); }); selecter02.click(function () { AllCheck02(); }); function AllCheck() { /** @method function AllCheck */ if (selecter.attr("checked")) { selecter02.attr("checked", true); $(".input-chk-child").attr("checked", true); dl_button_fnc(1); } else { selecter02.attr("checked", false); $(".input-chk-child").attr("checked", false); dl_button_fnc(2); } } function AllCheck02() { /** @method function AllCheck02 */ if (selecter02.attr("checked")) { selecter.attr("checked", true); $(".input-chk-child").attr("checked", true); dl_button_fnc(1); } else { selecter.attr("checked", false); $(".input-chk-child").attr("checked", false); dl_button_fnc(2); } } /* ----------------------------------------------------*/ // 無効時ボタンクリックすると文言表示 /* ----------------------------------------------------*/ $(function () { var dlbtn_sel = $(".dl-btn"); dlbtn_sel.each(function (i) { dlbtn_sel.eq(i).click(function () { if ($(this).hasClass("btn-disabled")) { $(".txt-alert").eq(i).text("ダウンロードする楽曲をチェックしてください"); } }); }); }); /* ----------------------------------------------------*/ // チェックを入れていない場合は、「インストールしてチェックした楽曲をダウンロード」のボタンが無効の状態(上下2箇所ある) //いずれかのチェックボックスにチェックを入れるとボタンが有効になる /* ----------------------------------------------------*/ function setupOnClickEventInputChkChild() { $(".input-chk-child").on("click", function () { var dlbtn_sel = $(".dl-btn"); if ($(this).attr("checked")) { dl_button_fnc(1); } else { //allcheck var n = $(".input-chk-child:checked").length; if (n == 0) { dl_button_fnc(2); } } }); } setupOnClickEventInputChkChild(); /* ------------------------------------------*/ // DLButtonControl /* ------------------------------------------*/ function dl_button_fnc(chknum) { var dlbtn_sel = $(".dl-btn"); if (chknum == 1) { dlbtn_sel.removeClass("btn-disabled"); $(".txt-alert").text(""); } else { dlbtn_sel.addClass("btn-disabled"); } } /* ------------------------------------------*/ // tableInit /* ------------------------------------------*/ function tableInit() { var tr = $("tr.index-list-cart-multiLink"); var td = $("tr.index-list-cart-multiLink td.link"); var btn = $("tr.index-list-cart-multiLink td.btn"); var thum = $("tr.index-list-cart-multiLink th.url"); var flg; //hover $(tr).hover(function () { if ($(this).find('a').length > 0) { $(this).addClass('hover'); } else { return; } }, function () { $(this).removeClass('hover'); }); //link $(td).click(function () { var anc = $(this).parent().find('a'); if (anc.length > 0) { var url = $(anc).attr('href'); location.href = url; } }); //link $(btn).click(function () { var anc = $(this).find('a'); if (anc.length > 0) { var url = $(anc).attr('href'); location.href = url; } }); //link $(thum).click(function () { var anc = $(this).find('a'); if (anc.length > 0) { var url = $(anc).attr('href'); location.href = url; } }); //anchor $(tr).find('a').click(function (e) { e.preventDefault(); }); } // 数値を3桁区切り function addFigure(str) { var num = new String(str).replace(/,/g, ""); while (num != (num = num.replace(/^(-?\d+)(\d{3})/, "$1,$2"))); return num; } /* ------------------------------------------*/ // gnav Fixed /* ------------------------------------------*/ $(function ($) { var body = $('body'), header = $('#header .row-03'), headerHeight = $('#header .row-03').height(), content = $('#content'), result = $('.result'), offset = header.offset(); header.css("height", headerHeight + "px"); //content.css("padding-top",headerHeight+"px"); if (header.length > 0) { $(window).scroll(function () { if ($(window).scrollTop() > offset.top) { body.addClass('fixed'); header.addClass('fixed'); header.addClass('fixed'); result.addClass('fixed'); content.css('paddingTop', headerHeight + 'px'); } else { body.removeClass('fixed'); header.removeClass('fixed'); result.removeClass('fixed'); content.css('paddingTop', 0); } }); } }); /* ------------------------------------------*/ // Menu Justified /* ------------------------------------------*/ $(function () { justified($('ul.mod-mainMenu.justified')); justified($('ul.mod-subMenu.justified')); function justified(elem) { elem.each(function () { // console.log("justified"); var liNum = $(this).children("li").length; //this内のliの個数 // var ulWidth = $(this).width(); //thisの幅 // var liWidth = ulWidth / liNum; //this内のliの幅 var liWidth = ((100 / liNum)) + "%"; //console.log("liWidth= " + liWidth); // console.log("liNum="+liNum+",ulWidth="+ulWidth+",liWidth="+liWidth); $(this).children("li").css("width", liWidth); //$(this).children("li:last-child").css("width",liWidth); }); } }); /* ------------------------------------------*/ // Auto Height /* ------------------------------------------*/ $(function () { $('.flList-2 > li').autoHeight({ height: 'height' }); $('.flList-3 > li').autoHeight({ height: 'height' }); $('.flList-4 > li').autoHeight({ height: 'height' }); $('.flList-5 > li').autoHeight({ height: 'height' }); $('.flList-6 > li').autoHeight({ height: 'height' }); //$('.flList-7 > li').autoHeight({height:'height'}); $('.autoHeight-2').autoHeight({ column: 2 }); $('.autoHeight-3').autoHeight({ column: 3 }); $('.autoHeight-4').autoHeight({ column: 4 }); $('.autoHeight-5').autoHeight({ column: 5 }); $('.autoHeight-6').autoHeight({ column: 6 }); //$('.autoHeight-7').autoHeight({column:7}); $('.flList-2 > li').autoHeight({ column: 2 }); $('.flList-3 > li').autoHeight({ column: 3 }); $('.flList-4 > li').autoHeight({ column: 4 }); $('.flList-5 > li').autoHeight({ column: 5 }); $('.flList-6 > li').autoHeight({ column: 6 }); //$('.flList-7 > li').autoHeight({column:7}); // $('.track-list-col3 .track-list-item').autoHeight({column:3}); // $('.track-list-col5 .track-list-item').autoHeight({column:5}); // $('.track-list-col7 .track-list-item').autoHeight({column:7}); }); /* -----------------------------------------------*/ // Modal Window /* -----------------------------------------------*/ $(function () { $('a[rel^=ui-openModal],span[rel^=ui-openModal]').click(function (e) { var id = $(this).attr("id"); if (id != undefined) { var strCount = 0; var strArr = id.split("|"); var modVal = strArr[0]; strCount = strArr[1].length; var resImg = strArr[1].substring(strCount - 10, strCount); var actImg = strArr[1].substring(0, strCount - 10) + "modal_" + resImg; if (modVal == "03") { $("#imgPrize3").attr("src", "/" + actImg); $("#prizeWin3").attr("class", "people" + strArr[2]); $("#descPrize3").html(strArr[3]); } else if (modVal == "01") { $("#imgPrize1").attr("src", "/" + actImg); $("#prizeWin1").attr("class", "people" + strArr[2]); $("#descPrize1").html(strArr[3]); $("#forwardUrl").attr("onclick", "applyApplication('" + strArr[4] + "','" + strArr[5] + "')"); } else if (modVal == "02") { $("#imgPrize2").attr("src", "/" + actImg); $("#prizeWin2").attr("class", "people" + strArr[2]); $("#descPrize2").html(strArr[3]); $("#point").text(strArr[4]); } } $('#bgLayer').fadeIn(); var rel = $(this).attr('rel').slice(13); winH = $(window).height(); var selectModal = $('.mod-modal.' + rel); var winH = $(window).height(); var modalH = selectModal.height(); var adjH = (winH - modalH) / 2; selectModal.css("top", adjH); selectModal.fadeIn(); // console.log("selectModal:"+selectModal); // console.log("modalH:"+modalH); // console.log("adjH:"+adjH); e.preventDefault(); }); function closeModal() { $('#bgLayer').fadeOut(); $('.mod-modal').fadeOut(); } function loadOnBgLayer() { $('.mod-modal').hide(); $('.bgLayer-loading').show(); } $('.ui-closeModal').click(function (e) { closeModal(); e.preventDefault(); }); $('#bgLayer').click(function () { closeModal(); }); $('.confirm-payment').click(function () { loadOnBgLayer(); $('#bgLayer').css('pointer-events', 'none'); window.location.href = $(this).data('href'); }); }); /* -----------------------------------------------*/ // Button Disable /* -----------------------------------------------*/ $(function () { $("a.btn-disabled , a.disabled , .mod-mainMenu li.on a , .mod-subMenu li.on a , .mod-genreSubMenu dl dd.on a").click(function () { return false; }); }); /* -----------------------------------------------*/ // Button Status Toggle /* -----------------------------------------------*/ $(function () { $('.js-btn-toggledisable').css("pointer-events", "auto"); $('.js-btn-toggledisable').on('click', function (e) { $(this).toggleClass("btn-disabled"); e.preventDefault(); }); }); /* -----------------------------------------------*/ // Favorite Button Status Toggle /* -----------------------------------------------*/ $(function () { $('.btn-favorite,.btn-reference').on('click', function (e) { $(this).toggleClass("active"); }); }); /* -----------------------------------------------*/ // IMG copy guard /* -----------------------------------------------*/ $(function () { var copyGuardImage_content = $("#content img"); var copyGuardImage_slider = $("#slider img"); var copyGuardImage_bnrArea = $("#bnrArea img"); var copyGuardTxt_lyrics = $(".mod-lyrics"); copyGuard(copyGuardImage_content); copyGuard(copyGuardImage_slider); copyGuard(copyGuardImage_bnrArea); copyGuard(copyGuardTxt_lyrics); function copyGuard(elem) { elem.each(function () { if (!$(this).hasClass('no-copyguard')) { $(this).on('mousedown', function () { return false; }); $(this).on('contextmenu', function () { return false; }); $(this).on('onselectstart', function () { return false; }); } }); } copyGuardImg(copyGuardImage_content); copyGuardImg(copyGuardImage_slider); copyGuardImg(copyGuardImage_bnrArea); function copyGuardImg(elem) { elem.each(function () { if (!$(this).hasClass('no-copyguard')) { $(this).attr({ onMouseDown: 'return false', oncontextmenu: 'return false', onselectstart: 'return false' }); } }); } }); /* -----------------------------------------------*/ // placeholder IE Fix /* -----------------------------------------------*/ $(function () { //IE9以下の場合はplaceholderの値をvalueに変換 if (ie() <= 9) { var inputKeyword = $("input#Keyword"); var searchText = inputKeyword.attr("placeholder"); if (inputKeyword.val() == "") { inputKeyword.val(searchText); inputKeyword.css("color", "#999"); } //forcusアウト時、placeholderの値に戻す inputKeyword.blur(function () { if ($(this).val() == "") { $(this).val(searchText); $(this).css("color", "#999"); } }); inputKeyword.focus(function () { if ($(this).val() == "") { var searchText = inputKeyword.attr("placeholder"); $(this).val(searchText); $(this).css("color", "#999"); } else { $(this).css("color", "#000"); } }); } }); function redirectToUrl(url) { // IE8 and lower if ($.browser.msie && $.browser.version < 9) { var link = document.createElement('a'); link.href = url; document.body.appendChild(link); link.click(); } // All other browsers else { window.location.href = url; } } //IE使用バージョン取得 function ie() { var undef, v = 3, div = document.createElement('div'); while ( div.innerHTML = '', div.getElementsByTagName('i')[0] ); return v > 4 ? v : undef; } function isHttps(url, tops) { var regs = new RegExp('^https', 'i'); var retTop = ""; if (regs.test(url) && !regs.test(tops)) { retTop = tops.replace('http://', 'https://'); } else { retTop = tops; } return retTop; } function GenerateIntegrationPopupPartial(refererUrl, currentPage, topUrl) { var isOK = false; var refurl = decodeURI(refererUrl); var curpage = decodeURI(currentPage); var data = "refererUrl=" + refurl + "¤tPage=" + curpage; var tops = isHttps(window.location.href, topUrl); var request_url = tops + "/PopUpPc/ShowIntegrationPopup"; var request_url2 = tops + "/PopUpPc/GenerateIntegrationPartialPopup"; ajax = $.ajax({ type: "POST", url: request_url, data: data, async: false, headers: { "pragma": "no-cache", "Cache-Control": "no-cache" }, success: function (serverResponse) { ajax = null; if (serverResponse === 1) { ajax = $.ajax({ type: "POST", url: request_url2, data: data, async: false, headers: { "pragma": "no-cache", "Cache-Control": "no-cache" }, success: function (popupresponse) { ajax = null; if (serverResponse === 1) { $('#integrationpopuppartial').append(popupresponse); isOK = true; } }, error: function (e, t) { ajax = null; } }); } }, error: function (e, t) { ajax = null; } }); return isOK; } function GeneratePopupPartial(topUrl) { var data = ""; var tops = isHttps(window.location.href, topUrl); var request_url = tops + "/OneClick/GeneratePartialView"; ajax = $.ajax({ type: "GET", url: request_url, data: data, async: false, headers: { "pragma": "no-cache", "Cache-Control": "no-cache" }, success: function (serverResponse) { ajax = null; $('#oneclickpopuppartial').append(serverResponse); }, error: function (e, t) { ajax = null; } }); } function GenerateKashiPopupPartial(songname, artistname) { var data = "songName=" + songname + "&artistName=" + artistname; var tops = isHttps(window.location.href, topUrl); var request_url = tops + "/PopUpPc/GenerateKashiPopupPartialView"; ajax = $.ajax({ type: "POST", url: request_url, data: data, async: false, headers: { "pragma": "no-cache", "Cache-Control": "no-cache" }, success: function (serverResponse) { ajax = null; $('#kashipopuppartial').append(serverResponse); }, error: function (e, t) { ajax = null; } }); } function GenerateCartPopupPartial(title, artistname, id, pageType) { var data = "title=" + title + "&artistName=" + artistname + "&id=" + id + "&pageType=" + pageType; var tops = isHttps(window.location.href, topUrl); var request_url = tops + "/PopUpPc/GenerateCartErrorPopupPartialView"; ajax = $.ajax({ type: "POST", url: request_url, data: data, async: false, headers: { "pragma": "no-cache", "Cache-Control": "no-cache" }, success: function (serverResponse) { ajax = null; $('#carterrormessagepopup').append(serverResponse); }, error: function (e, t) { ajax = null; } }); } function GenerateFavoriteErrorPopupPartial(songname, artistname) { var data = "songName=" + songname + "&artistName=" + artistname; var tops = isHttps(window.location.href, topUrl); var request_url = tops + "/PopUpPc/GenerateFavoriteErrorPopupPartialView"; ajax = $.ajax({ type: "POST", url: request_url, data: data, async: false, headers: { "pragma": "no-cache", "Cache-Control": "no-cache" }, success: function (serverResponse) { ajax = null; $('#favoriteerrormessagepopup').append(serverResponse); }, error: function (e, t) { ajax = null; } }); } function ArtistFavoriteErrorPopupPartial(artistname) { var data = "artistname=" + artistname; var tops = isHttps(window.location.href, topUrl); var request_url = tops + "/PopUpPc/ArtistFavoriteErrorPopupPartialView"; ajax = $.ajax({ type: "POST", url: request_url, data: data, async: false, headers: { "pragma": "no-cache", "Cache-Control": "no-cache" }, success: function (serverResponse) { ajax = null; $('#favoriteerrormessagepopup').append(serverResponse); }, error: function (e, t) { ajax = null; } }); } function PlaylistFavoriteErrorPopupPartial(playlistname) { var data = "playlistname=" + playlistname; var tops = isHttps(window.location.href, topUrl); var request_url = tops + "/PopUpPc/PlaylistFavoriteErrorPopupPartialView"; ajax = $.ajax({ type: "POST", url: request_url, data: data, async: false, headers: { "pragma": "no-cache", "Cache-Control": "no-cache" }, success: function (serverResponse) { ajax = null; $('#favoriteerrormessagepopup').append(serverResponse); }, error: function (e, t) { ajax = null; } }); } function NicknameExistsCheckPopupPartial(id, pageName) { var tops = isHttps(window.location.href, topUrl); var request_url = tops + "/PopUpPc/NicknameExistsCheckPopupPartialView"; var data = "id=" + id + "&pageName=" + pageName; ajax = $.ajax({ type: "POST", url: request_url, data: data, async: false, headers: { "pragma": "no-cache", "Cache-Control": "no-cache" }, success: function (serverResponse) { ajax = null; $('#favoriteerrormessagepopup').append(serverResponse); }, error: function (e, t) { ajax = null; } }); } function len(str) { var i, sum; sum = 0; var strLen = str.length; for (i = 0; i < strLen; i++) { if ((str.charCodeAt(i) >= 0 && str.charCodeAt(i) <= 255) || (str.charCodeAt(i) >= 0xff61 && str.charCodeAt(i) <= 0xff9f)) sum = sum + 1; else sum = sum + 2; } return sum; } function trim(str) { return str.replace(/(^\s*)|(\s*$)/g, ""); } /* -----------------------------------------------*/ // tab menu /* -----------------------------------------------*/ // $(function () { // //tab // $('.ui-tab-body').not('.active').hide(); // $('.ui-tab-menu a').on('click', function(){ // $(this).parents(".ui-tab").find('.ui-tab-body').hide(); // $(this).parents(".ui-tab-menu").find('li').removeClass('on'); // $(this).parent().addClass('on'); // $($(this).attr('href')).show(); // return false; // }); // }); /* -----------------------------------------------*/ // side menu popup /* -----------------------------------------------*/ // $(function () { // $(".sidebar-list-submenu").hover( // function(){ // $(this).find(".submenu-body").show(); // }, // function(){ // $(this).find(".submenu-body").hide(); // } // ); // }); /* -----------------------------------------------*/ // user review edit area /* -----------------------------------------------*/ $(function () { $(".edit-content").hide(); $(".edit-btn").on("click", function () { $(".edit-content").slideDown(); $(".edit-btn").addClass("hide"); return false; }); }); /* -----------------------------------------------*/ // heigtLineClass /* -----------------------------------------------*/ function heightLineGroupClass(group, target, num) { var roop = 0, groupNum = 1, rand = Math.floor(Math.random() * 200); //もしも同じ乱数があった場合もう一度乱数取得 if ($("[class *= 'heightLine-groupClass" + rand + "']").length > 0) { rand = Math.floor(Math.random() * 200); } $(group).each(function (i) { index = $(this).index() + 1; if (index == 1) { roop++; } if (num != "") { if (roop > 0 && index == 1) { groupNum++; } if (target == "") { $(this).addClass("heightLine-groupClass" + rand + "-" + groupNum); } else { $(this).find(target).addClass("heightLine-groupClass" + rand + "-" + groupNum); } if (index % num == 0) { groupNum++; } } else { if (target == "") { $(this).addClass("heightLine-groupClass" + rand + "-" + groupNum); } else { $(this).find(target).addClass("heightLine-groupClass" + rand + "-" + groupNum); } } }); } $(function () { //heightLine用のクラス付与 heightLineGroupClass(".mod-feature-list .feature-list-item", "", 4); heightLineGroupClass(".image-list-2col > ul > li","",2); heightLineGroupClass(".track-list-col3 .track-list-item", "", 3); heightLineGroupClass(".track-list-col5 .popular-slider .track-list-item", "", 30); heightLineGroupClass(".group-carousel-height", ".track-list-item", 10); heightLineGroupClass(".track-list-col5 .track-list-item", "", 5); heightLineGroupClass(".track-list-col7 .track-list-item", "", 7); heightLineGroupClass(".general-box-3col .general-box-item", "", 3); heightLineGroupClass(".general-box-2col .general-box-item", "", 2); heightLineGroupClass(".track-list-col3-2 .track-list-item", "", 3); heightLineGroupClass(".sidebar-user-list .sidebar-user-list-item", "", 2); heightLineGroupClass(".sidebar-image-list .sidebar-image-list-item", "", 2); //ニュース用に追加 heightLineGroupClass(".mod-news-list.synthesize",".item-box",2); heightLineGroupClass(".mod-news-textlink li","a",3); /* -----------------------------------------------*/ // スライダー /* -----------------------------------------------*/ //スライダー $(".mod-general-box-bxslider, .track-list-slider").bxSlider({ //オートプレイ auto: false, //ループの有無 infiniteLoop: true, //スライドスピード speed: 1000, //高さの自動調整 adaptiveHeight: true }); //ADD BY @HAIHV $('.popular-slider').bxSlider({ auto: true, responsive: false, useCSS: false, slideWidth: 668, minSlides: 6, maxSlides: 6, moveSlides: 5 }); //タブ切り替え部分のスライダー $(".js-tab-box .bxslider").bxSlider({ auto: false, speed: 1000 }); //編成汎用枠スライダー用高さ調整 var thisClass, thisClassArr = [], heightArr = []; $("[class*='height-hensei']").each(function (i) { thisClass = $(this).attr("class").match(/height-hensei.../); thisClassArr[i] = thisClass[0]; }); $.unique(thisClassArr); for (var num = 0; num < thisClassArr.length; num++) { $("." + thisClassArr[num]).each(function (i) { heightArr[i] = $(this).height(); }); maxHei = Math.max.apply(null, heightArr); $("." + thisClassArr[num]).height(maxHei); } }); $(function () { $(".form-checkbox:checked,.form-radio:checked").addClass("checked"); $(".form-checkbox").change(function () { $(this).toggleClass("checked"); $(this).blur(); }); $(".form-radio").change(function () { if ($(this).is(":checked")) { $(".form-radio:not(:checked)").removeClass("checked"); $(this).addClass("checked"); $(this).blur(); } }); // バイオグラフィ部分の表示・非表示 var boxShowContentHei = $(".info-box-biography .content").height(); boxShowBaseHei = 90; if (boxShowBaseHei < boxShowContentHei) { $(".info-box-biography .content").css("height", boxShowBaseHei + "px"); } else { $(".info-box-biography .mod-more").hide(); } $(".info-box-biography .mod-more").on("click", function (e) { var boxShowClass = $(this).attr("class"); e.preventDefault(); $(this).toggleClass("mod-more-close"); if (boxShowClass.indexOf("mod-more-close") > 0) { $(this).prev(".content").css("height", boxShowBaseHei + "px"); $(this).find("a").removeClass("link-up"); $(this).find("a").addClass("link-down"); $(this).find("a").text("もっと見る"); } else { $(this).prev(".content").css("height", "auto"); $(this).find("a").removeClass("link-down"); $(this).find("a").addClass("link-up"); $(this).find("a").text("閉じる"); } }); //歌詞ボタンをクリックしたらクラスをつける $(".lyrics-add-btn a").click(function () { $(".lyrics-add-btn a").toggleClass("btn-active"); }); //タブ切り替え $(".js-tab-body").each(function () { var self = $(this); var index = self.find(".mod-tab-box .on").index(); self.find(".js-tab-box:not(.js-tab-box:eq(" + index + "))").css({ "visibility": "hidden", "position": "absolute", "top": 0 }); }); $(".js-tab-body .mod-tab-box li a, .js-tab-body .mod-tab-box li span").on("click", function () { var wrapObj = $(this).parents(".js-tab-body"), parent = $(this).parent("li"), index = parent.index(); if ($(this).hasClass("disabled")) { return false; } $(this).parents("ul").find("li").removeClass("on"); $(this).parents("ul").find("li:eq(" + index + ")").addClass("on"); wrapObj.find(".js-tab-box").css({ "visibility": "hidden", "position": "absolute", "top": 0 }); wrapObj.find(".js-tab-box:eq(" + index + ")").css({ "visibility": "visible", "position": "static" }); return false; }); //ヘッダー キーワードセレクトボタンのカスタマイズ $(".js-form-select").customSelect(); $(".js-form-select-mypage").customSelect(); $(".profile-box .comment").heightChange({ line: 5 }); $(".mod-review.js-heightChange .comment").heightChange({ line: 4 }); //リンクの無効化 $("a[href='#cancel']").click(function (e) { e.preventDefault(); }); }); /* -----------------------------------------------*/ // レビュー編集 /* -----------------------------------------------*/ $(function () { $(".js-review-edit .edit-post").hide(); $(".js-review-edit .edit-action").on("click", function (e) { e.preventDefault(); var self = $(this), objWrap = self.parents(".js-review-edit"), editText = objWrap.find(".edit-text").text(); objWrap.find(".edit-post").show(); objWrap.find(".edit-display, .edit-text").hide(); }); $(".js-review-edit .edit-cancel").on("click", function (e) { e.preventDefault(); var self = $(this), objWrap = self.parents(".js-review-edit"); objWrap.find(".edit-post").hide(); objWrap.find(".edit-display, .edit-text").show(); }); }); /* -----------------------------------------------*/ // プロフィール編集 active checkbox /* -----------------------------------------------*/ $(function () { // $(".profile-edit .fm-select-list p").on("click",function(){ // var self = $(this), // selfParent = self.parents(".form-item"), // index = self.index(), // selectNum = selfParent.find("select").length; // //select 複数時 // if(selectNum > 1){ // var active = 0, // ativeIndex; // for(var i = 0;i < selectNum;i++){ // var ativeIndex = selfParent.find(".fm-select-list").eq(i).children(".select-active").index(); // if(ativeIndex > 0){active++;} // } // if(active == selectNum){ // selfParent.find("input:checkbox").addClass("checked").attr("checked","checked"); // }else{ // selfParent.find("input:checkbox").removeClass("checked").removeAttr("checked"); // } // //select 1つの時 // }else{ // if(self.index() > 0){ // selfParent.find("input:checkbox").addClass("checked").attr("checked","checked"); // }else{ // selfParent.find("input:checkbox").removeClass("checked").removeAttr("checked"); // } // } // }); $(".profile-edit .profile-mail").on("keyup", function () { var self = $(this), selfParent = self.parents(".form-item"), index = self.index(), selectNum = selfParent.find("select").length; if ($(this).val()) { selfParent.find("input:checkbox").addClass("checked").attr("checked", "checked"); } else { selfParent.find("input:checkbox").removeClass("checked").removeAttr("checked"); } }); }); /*--heightChange プラグイン *options - height = 切り替える高さ - action = 切り替えイベントを発火させるDOM ※ def - .mod-link - changeText = 切り替える文字 ※ def - .閉じる - changeLink = 切り替えるクラス ※ def - .link-up */ $.fn.heightChange = function (op) { op = $.extend({ action: ".mod-link", changeText: "閉じる", changeClassDef: "link-down", changeClass: "link-up" }, op); return this.each(function () { var $this = $(this), $thisParent = $this.parent("div"), action = op.action, line = op.line, lineHiehgt = $this.css("lineHeight").replace("px", ""), height = line * lineHiehgt, changeText = op.changeText, changeClassDef = op.changeClassDef, changeClass = op.changeClass; var ua = navigator.userAgent, ie8 = ua.match(/msie [8.]/i), ie9 = ua.match(/msie [9.]/i); if (ie8 || ie9) { var fontSize = $this.css("fontSize").replace("px", ""); height = lineHiehgt * fontSize * line; } if ($this.height() <= height) { $($thisParent).find(action).hide(); } else { //高さ設定 $(this).css({ "height": height + "px", "overflow": "hidden" }); } //高さ切り替え var self, text, originalText; $($thisParent).find(action).on("click", function (e) { e.preventDefault(); self = $(this); text = self.text(); originalText = self.attr("data-original-text"); if (originalText) { self.text(self.attr("data-original-text")); $this.height(height); self.removeClass(changeClass); self.addClass(changeClassDef); self.removeAttr("data-original-text"); } else { self.text(changeText); $this.height("auto"); self.removeClass(changeClassDef).addClass(changeClass); self.attr("data-original-text", text); } }); }); } $.fn.customSelect = function () { return this.each(function () { var $this = $(this); var objParent = $this.parent("div"), setVal; if ($this.find("option:selected").text()) { setVal = $this.find("option:selected").text(); } else { setVal = $this.find("option:eq(0)").text(); } $this.after('\
'+ setVal + '
\
\ '); $this.hide(); objParent.find(".fm-select-list").hide(); var opNum = $this.find("option").length, selectIndex = $this.prop('selectedIndex'), attr, i; for (i = 0; i < opNum; i++) { if ($this.find("option").eq(i).attr("class") == undefined) { attr = ""; } else { attr = $this.find("option").eq(i).attr("class"); } if (i == selectIndex) { objParent.find(".fm-select-list").append("

" + $this.find("option:eq(" + i + ")").text() + "

"); } else { objParent.find(".fm-select-list").append("

" + $this.find("option:eq(" + i + ")").text() + "

"); } } $(document).on("click", function (event) { var target = event.target; if (!$(target).is(".fm-select-value, .select-active, .icon-wrap, .icon")) { $(".fm-select-list").hide(); objParent.find("i").removeClass("icon-up"); } }); //リストの表示・非表示 objParent.find(".fm-select-list, .fm-select-value, .icon-wrap").on("click", function () { objParent.find(".fm-select-list").toggle(); objParent.find("i").toggleClass("icon-up"); }); //値の切り替え objParent.find(".fm-select-list p").on("click", function () { var index = $(this).index(); objParent.find(".fm-select-list p").removeClass("select-active"); $(this).addClass("select-active"); $this.find("option").removeAttr("selected"); $this.find("option:eq(" + index + ")").attr("selected", "selected"); objParent.find(".fm-select-value").text($(this).text()); //Force select call onchange event $this.trigger('change'); if (typeof (onSelectDeviceType) === "function") { onSelectDeviceType($this.val()); } }); }); } /* -----------------------------------------------*/ // ユーザ登録周りのform分制御 // password表示非表示切り替え制御 /* -----------------------------------------------*/ $(function () { $('.js-toggle-pass-mask').on('blur', function () { var self = $(this), selfName = self.attr('name'), textObj = self.next('.js-toggle-pass'), maskPass = self.val(); if (textObj.length > 0) { textObj.val(maskPass); } }); $('.js-toggle-pass').on('blur', function () { var self = $(this), selfName = self.attr('name'), maskObjName = $(this).prev().attr('name'), maskObj = self.prev('.js-toggle-pass-mask'), textPass = self.val(); maskObj.val(textPass); }); $('.js-toggle-pass-check').on('click', function () { var self = $(this), selfName = self.attr('id'), toggleObj = self.parent('.js-toggle-pass-wrapper').find('[class*="js-toggle-pass"]').not('[type="checkbox"]'); toggleObj.toggle(); }); }); /* -----------------------------------------------*/ // ユーザ登録周りのform分制御 // 生年月日/tel等、数字入力時の入力場所自動移動 /* -----------------------------------------------*/ $(function () { $('.js-move-input').on('keyup', function (e) { var str = $(this).val(), strLength = str.length, maxLength = $(this).attr("maxlength"); if (e.keyCode == 8 && strLength == 0) { $(this).prev().focus(); } if (47 < e.keyCode && e.keyCode < 58 || 95 < e.keyCode && e.keyCode < 106) { if (strLength >= maxLength) { $(this).next().focus(); } } else { str = str.replace(/[0-9]/g, function (s) { return String.fromCharCode(s.charCodeAt(0) - 0xFEE0) }); str = str.replace(/[^0-9]/g, ''); $(this).val(str); return false; } }); });