$(function () { //iphone labelクリック $('label').click(function () { }); //tab $('.ui-tab-body').not('.active').hide(); $('.ui-tab-nav a').on('click', function () { $(this).parents('.ui-tab').find('.ui-tab-body').hide(); $(this).parents('.ui-tab').find('.ui-tab-nav a').removeClass('active'); $($(this).attr('href')).show(); $(this).addClass('active'); return false; }); // ui-togglepane $('.toggleSection .ui-togglebtn').click(function () { if ($(this).next().css('display') != 'none') { $(this).next().slideUp(150); $(this).removeClass('open'); } else { $(this).next().slideDown(150); $(this).addClass('open'); } return false; }); $('.ui-closeopen .ui-togglebtn').click(function () { if ($(this).next().css('display') != 'none') { $(this).next().slideToggle(150); $(this).toggleClass('open'); } else { $('.ui-togglepane').hide(); $(this).next().slideToggle(150); $('.ui-togglebtn').removeClass('open'); $(this).toggleClass('open'); } return false; }); $('.modalOther ul li a').hover(function () { $(this).addClass("active"); return false; }); //dialog $('.ui-togglepane ul li.audio a').click(function () { $(".ui-togglepane ul li.audio").toggleClass("active"); return false; }); // スムーズスクロール $('.mod-toc a, .to-top a').click(function () { $('html,body').animate({ scrollTop: $($(this).attr('href')).offset().top }); return false; }); //HVHAI Add 07/21/2014 $('#to-top').click(function () { $('body,html').animate({ scrollTop: 0 }, 800); return false; }); //2012 追記 トグル var pl = $(".coverarea01 .player a"); pl.click(function () { $(this).toggleClass("act"); return false; }); //2013 追記 コピーガード var lyric = $(".mod-lyric"); lyric.on("selectstart mousedown contextmenu copy", function () { return false; }); //ボタンの挙動 var mbrs_global = $(".ui-global"); mbrs_global.on('touchstart touchmove', function () { $(this).addClass('active'); }).on('touchend gestureend', function () { $(this).removeClass('active'); }); // IOS4判定 if (/OS 4.*/.test(navigator.userAgent)) { $("body").addClass("no-position-fixed"); }; // TOP画面から遷移時、cookieにコーナーID記録 $("[id^=addcorner_] a").click(function () { var corner_value = $(this).parents("[id^=addcorner_]").attr("id").substring(10); // ランキングをクリックする場合 if (corner_value.indexOf("tempRkg") > -1) { corner_value = "rkg"; } if (corner_value.indexOf("tempD") > -1) { corner_value = "rkg_d"; } if (corner_value.indexOf("tempW") > -1) { corner_value = "rkg_w"; } if (corner_value.indexOf("tempM") > -1) { corner_value = "rkg_m"; } AddCookie("corner", corner_value, 24); }); // cookieにコーナーID削除 $("[id^=delcorner_] a").click(function () { DelCookie("corner"); }); }); // List image size var imageStyleBorder = ""; var imgcss = document.styleSheets[0].cssRules; if (imgcss != null) { for (var i = 0; i < imgcss.length; i++) { if (imgcss[i].selectorText == ".mod-indexList img") { imageStyleBorder = imgcss[i].style.border; imgcss[i].style.border = "none"; } } } else { imageStyleBorder = "1px solid #9b9b96"; } function imgSize(image) { var w = image.offsetWidth; var h = image.offsetHeight; var max = w; var p = image.parentNode; if (h > w) { max = h; } if (p != null) { //for get querystring var query = image.src; var flagQuery = 0; var varsFirst = query.split("?"); if (varsFirst.length == 2) { var vars = varsFirst[1].split("&"); for (var i = 0; i < vars.length; i++) { var pair = vars[i].split("="); if (pair[0] == "sr.dw") { if (pair[1] != w) { w = pair[1]; flagQuery = 1; } } else if (pair[0] == "sr.dh") { if (pair[1] != h) { h = pair[1]; flagQuery = 1; } } } if(flagQuery == 1) { max = w; if (h > w) { max = h; } } } //end get querystring///// p.style.width = max + "px"; p.style.height = max + "px"; p.style.textAlign = "center"; if (w != 0 && h != 0) { image.onload = null; if (h > w) { image.style.width = w + "px"; image.style.height = "auto"; } } } image.style.border = imageStyleBorder; } function imgLoadError(myImg, width, height) { myImg.src = '/Content/img/img_noImage_300x300.jpg?sr.dw=' + width + '&sr.dh=' + height; if (width != null || height != null) { myImg.width = width; myImg.height = height; } } // function get url parameter val function getUrlVars() { var vars = [], hash; var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&'); for (var i = 0; i < hashes.length; i++) { hash = hashes[i].split('='); vars.push(encodeURIComponent(hash[0])); vars[encodeURIComponent(hash[0])] = encodeURIComponent(hash[1]); } return vars; } generateGuid = function () { var guid; this.guid = (function () { var S4 = function () { return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1); } return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4()); })(); } function SampleJsonPostRequest(id, log_type, play_time, client_session_id, content_type) { var data = ""; if (arguments.length == 5) { data = "product_id=" + id.substring(2, id.length) + "&log_type=" + log_type + "&play_time=" + Math.floor(play_time) + "&client_session_id=" + client_session_id + "&content_type=" + content_type; } else { data = "product_id=" + id.substring(2, id.length) + "&log_type=" + log_type + "&play_time=" + Math.floor(play_time) + "&client_session_id=" + client_session_id; } var request_url = smapleLogUrl; ajax = $.ajax({ type: "POST", url: request_url, data: data, headers: { "pragma": "no-cache", "Cache-Control": "no-cache" }, success: function (serverResponse) { ajax = null; }, error: function (e, t) { ajax = null; } }); } function JsonPostRequest(id, log_type, play_time, client_session_id, content_type) { var data = ""; if (arguments.length == 5) { data = "product_id=" + id.substring(2, id.length) + "&log_type=" + log_type + "&play_time=" + Math.floor(play_time) + "&client_session_id=" + client_session_id + "&content_type=" + content_type; } else { data = "product_id=" + id.substring(2, id.length) + "&log_type=" + log_type + "&play_time=" + Math.floor(play_time) + "&client_session_id=" + client_session_id; } var request_url = "/Sample/JsonPostMethod"; ajax = $.ajax({ type: "POST", url: request_url, data: data, success: function (serverResponse) { ajax = null; }, error: function (e, t) { ajax = null; } }); } /** * MopitaIDをチェックする */ function CheckMopitaId(mopitaId) { var reg = new RegExp('^[^.][0-9a-zA-Z]{4,28}[^.]$'); var result = reg.exec(mopitaId); if (result == null) { return false; } return true; } /** * パスワードをチェックする */ function CheckPassword(password) { var reg = new RegExp('^[A-Za-z0-9-_\.\S]{1,}$'); var result = reg.exec(password); if (result == null) { return false; } return true; } /** * lenをチェックする */ function CheckLen(str, start, end) { if (Len(str) < start || Len(str) > end) { return false; } return true; } function Len(str) { var i, sum; sum = 0; for (i = 0; i < str.length; i++) { if ((str.charCodeAt(i) >= 0) && (str.charCodeAt(i) <= 255)) sum = sum + 1; else sum = sum + 2; } return sum; } /** * 文字 */ function cutLengthString(str, len) { var strLen = str.length; var textTrim = str.substr(0, len); if(len < strLen) { textTrim = textTrim + " …"; } else { textTrim = str; } return textTrim; } /** * 歌詞遷移判断 */ function GotoKashi(pid, artistName, title, packageName, topurl) { if ($('#modalPane0') != null) $('#modalPane02').remove(); if ($('.modal_container') != null) $('.modal_container').empty(); var okUrl = topurl + "/Kashi/" + pid + "?artistname=" + artistName + "&title=" + title + "&packageName=" + packageName; $.ajax({ type: "POST", url: topurl + "/Kashi/GetLyricData", data: { "id": pid, "artistName": artistName, "title": title, "packageName": packageName }, dataType: "Json", success: function (response) { if (response == -1) { } else if (response == 0) { window.location = okUrl; if ($('.modal_overlay') != null) $('.modal_overlay').empty(); } } }); } function GotoKashiPC(pid, artistName, title, topurl, artistId, packageName, contentType) { var okUrl = topurl + "/Kashi/" + pid + "?artistname=" + artistName + "&title=" + title + "&packageName=" + packageName; var detailUrl = topurl + "/Artist/" + artistId + "/" + contentType + "/" + pid; if (window.location.pathname.indexOf("Kashi") != -1) { window.location = detailUrl; return; } $.ajax({ type: "POST", url: topurl + "/Kashi/GetLyricData", data: { "id": pid, "artistName": artistName, "title": title, "packageName": packageName }, dataType: "Json", success: function (response) { if (response == -1) { $('#bgLayer').fadeIn(); $('.mod-modal.kashi').fadeIn(); } else if (response == 0) { window.location = okUrl; } } }); } // cookie追加 function AddCookie(key, value, hour) { var date1, date2; date1 = new Date(); date1.setTime(date1.getTime() + hour * 60 * 60 * 1000); date2 = date1.toGMTString(); document.cookie = key + "=" + value + ";expires=" + date2 + ';path=/'; } // cookie追加(Domain指定) function AddCookieDomain(key, value, hour, domain) { var date1, date2; date1 = new Date(); date1.setTime(date1.getTime() + hour * 60 * 60 * 1000); date2 = date1.toGMTString(); var param = ""; if (domain != null && domain != "") { param = ";domain=" + domain; } document.cookie = key + "=" + value + ";expires=" + date2 + ';path=/' + param; } // cookie削除 function DelCookie(key) { var date1, date2; date1 = new Date(); date1.setTime(date1.getTime() - 1); date2 = date1.toGMTString(); document.cookie = key + "=;expires=" + date2 + ';path=/'; } // cookie削除(Domain指定) function DelCookieDomain(key, domain) { var date1, date2; date1 = new Date(); date1.setTime(date1.getTime() - 1); date2 = date1.toGMTString(); var param = ""; if (domain != null && domain != "") { param = ";domain=" + domain; } document.cookie = key + "=;expires=" + date2 + ';path=/' + param; } //cookie読み function getCookie(key) { var arrStr = document.cookie.split("; "); for (var i = 0; i < arrStr.length; i++) { var temp = arrStr[i].split("="); if (temp[0] == key) return unescape(temp[1]); } return null; } //JAMボタンの変更操作非同期 function JAMButtonChangeAjax(productList, topurl) { $.ajax({ type: "POST", url: topurl + "/MusicDetail/GetProdStatus", data: { "productList": productList }, headers: { "pragma": "no-cache", "Cache-Control": "no-cache" }, success: function (serverResponse) { JAMButtonChange(serverResponse); } }); } //JAMボタンの変更操作 function JAMButtonChange(obj) { if (obj == -1) { } else { if (obj.Result == 2000) { $('.action-favorite').removeClass("action-favorite").addClass("action-favorite active"); } else if (obj.Result == 2001) { var list = obj.ResultDetail; for (i = 0; i < list.length; i++) { var prodId = "#" + list[i].ProductId; if (list[i].RegistStatus == 2000) { $(prodId).find('.action-favorite').removeClass("action-favorite").addClass("action-favorite active"); } } } } } function getJamNotifyInfo(topurl) { $.ajax({ type: "POST", url: topurl + "/UserMenu/GetJamNotifyInfo", data: {}, dataType: "Json", success: function (response) { if (response.ResultCode == "2000") { var unReadCount = response.UnreadNotifyCount; if (unReadCount >= 1) { $("#jammenu").html('メニュー'); $("#jam_usermenu").html('music.jp JAMについて'); } else { $("#jammenu").html('メニュー'); $("#jam_usermenu").html('music.jp JAMについて'); } } } }); } // JAM 人気プレイリストを取得する function getJamPularityPlaylist(topurl) { $.ajax({ type: "POST", url: topurl + "/PickupJam/GetPlayList", data: {}, headers: { "pragma": "no-cache", "Cache-Control": "no-cache" }, success: function (response) { getPlaylist(response); } }); } function getPlaylist(obj) { if (obj.Result == "2000") { var count = obj.Count; var list = obj.ResultDetail; var additem = '

人気プレイリスト

'; $("#jamPlaylist").append(additem); } } // JAM 人気DJを取得する function getJamPularityDJ(topurl) { $.ajax({ type: "POST", url: topurl + "/Pickup/GetDJ", data: {}, headers: { "pragma": "no-cache", "Cache-Control": "no-cache" }, success: function (response) { getDJ(response); } }); } function getDJ(obj) { if (obj.Result == "2000") { var count = obj.Count; var list = obj.ResultDetail; var additem = '

人気DJ

'; additem += '
'; additem += '
    '; $("#jamDJ").append(additem); $("#slideBody4>ul").css("margin-left", "10px"); $("#slideShow4").flickGallery({ viewport: "#slideBody4", slideWrap: "#slideBody4>ul", paging: "#slidePoint4 ul", pagingBtn: "li", pagingActiveClass: "act", pagingRow: 3, scroll: false //translate3d:true }); } } function popupOpenCheck(backurl, popupGamen, topurl, biko1, biko2, biko3) { var request_url = null; var data = null; var check = window.location.href.search("https://"); if (check != -1) { topurl = topurl.replace("http://", "https://"); } if ('DisabledMacDevice' == popupGamen) { request_url = topurl + "/PopUpPc/GetDisabledMacDevice"; } else if ('PurchasedDownload' == popupGamen) { request_url = topurl + "/PopUpPc/GetPurchasedDownload"; data = "pid=" + biko1; } else if ('PlaylistCancel' == popupGamen) { request_url = topurl + "/PopUpPc/GetPlaylistCancel"; data = "playlistId=" + biko2; } else if ('PlaylistDelete' == popupGamen) { request_url = topurl + "/PopUpPc/GetPlaylistDelete"; data = "playListId=" + biko1; } ajax = $.ajax({ type: "POST", url: request_url, data: data, headers: { "pragma": "no-cache", "Cache-Control": "no-cache" }, success: function (response) { if (response == "0" && backurl != "") { window.location = backurl; } else { $('#bgLayer').fadeIn(); $('#open-popup').fadeIn(); $('#open-popup').empty(); $('#open-popup').append(response); if ('PurchasedDownload' == popupGamen) { $('#open-popup').addClass("purchased"); } var winH = $(window).height(); var modalH = $('#open-popup').height(); var adjH = (winH - modalH) / 2; $('#open-popup').css("top", adjH); $(window).resize(); $('.ui-closeModal').click(function (e) { $('#bgLayer').fadeOut(); $('.mod-modal').fadeOut(); e.preventDefault(); }); } } }); } var dBackPoint = []; function setDataReturnRate(id, point, returnRate) { dBackPoint.push({ xid: id, xpoint: point, xreturnRate: returnRate }); } function removeItemInObjectBackPoint(pid) { for (var i = 0; i < dBackPoint.length; i++) { if (dBackPoint[i].xid == pid) { dBackPoint.splice(i, 1); } } } function reCalculatePoint() { var backPoint = 0; var arry = $.extend(true, [], dBackPoint); arry.sort(function (a, b) { if (a.xreturnRate - b.xreturnRate == 0) { return a.xpoint - b.xpoint; } else { return a.xreturnRate - b.xreturnRate; } }); for (var i = 0; i < arry.length; i++) { if (arry[i] != null) { backPoint += Math.floor(arry[i].xpoint * arry[i].xreturnRate); } } return backPoint; }