Update 2 files

- /Live2dHistoire/live2d/js/message.js
- /assets/js/main_new.js
This commit is contained in:
mayx 2025-05-24 17:33:47 +00:00
parent 7937972e19
commit 2d757a0e7c
2 changed files with 173 additions and 167 deletions

View File

@ -1,30 +1,30 @@
var home_Path = document.location.protocol +'//' + window.document.location.hostname +'/'; var home_Path = document.location.protocol + '//' + window.document.location.hostname + '/';
var userAgent = window.navigator.userAgent.toLowerCase(); var userAgent = window.navigator.userAgent.toLowerCase();
console.log(userAgent); console.log(userAgent);
var norunAI = [ "android", "iphone", "ipod", "ipad", "windows phone"]; var norunAI = ["android", "iphone", "ipod", "ipad", "windows phone"];
var norunFlag = false; var norunFlag = false;
for(var i=0;i<norunAI.length;i++){ for (var i = 0; i < norunAI.length; i++) {
if(userAgent.indexOf(norunAI[i]) > -1){ if (userAgent.indexOf(norunAI[i]) > -1) {
norunFlag = true; norunFlag = true;
break; break;
} }
} }
if(!window.WebGLRenderingContext){ if (!window.WebGLRenderingContext) {
norunFlag = true; norunFlag = true;
} }
if(!norunFlag){ if (!norunFlag) {
var hitFlag = false; var hitFlag = false;
var AIFadeFlag = false; var AIFadeFlag = false;
var liveTlakTimer = null; var liveTlakTimer = null;
var sleepTimer_ = null; var sleepTimer_ = null;
var AITalkFlag = false; var AITalkFlag = false;
var talkNum = 0; var talkNum = 0;
(function (){ (function () {
function renderTip(template, context) { function renderTip(template, context) {
var tokenReg = /(\\)?\{([^\{\}\\]+)(\\)?\}/g; var tokenReg = /(\\)?\{([^\{\}\\]+)(\\)?\}/g;
return template.replace(tokenReg, function (word, slash1, token, slash2) { return template.replace(tokenReg, function (word, slash1, token, slash2) {
@ -42,87 +42,88 @@ if(!norunFlag){
return currentObject; return currentObject;
}); });
} }
String.prototype.renderTip = function (context) { String.prototype.renderTip = function (context) {
return renderTip(this, context); return renderTip(this, context);
}; };
var re = /x/; var re = /x/;
re.toString = function() { console.log(re);
re.toString = function () {
showMessage('哈哈,你打开了控制台,是想要看看我的秘密吗?', 5000); showMessage('哈哈,你打开了控制台,是想要看看我的秘密吗?', 5000);
return ''; return '';
}; };
$(document).on('copy', function (){ $(document).on('copy', function () {
showMessage('你都复制了些什么呀,转载要记得加上出处哦~~', 5000); showMessage('你都复制了些什么呀,转载要记得加上出处哦~~', 5000);
}); });
function initTips(){ function initTips() {
$.ajax({ $.ajax({
cache: true, cache: true,
url: message_Path+'message.json', url: message_Path + 'message.json',
dataType: "json", dataType: "json",
success: function (result){ success: function (result) {
$.each(result.mouseover, function (index, tips){ $.each(result.mouseover, function (index, tips) {
$(tips.selector).mouseover(function (){ $(tips.selector).mouseover(function () {
var text = tips.text; var text = tips.text;
if(Array.isArray(tips.text)) text = tips.text[Math.floor(Math.random() * tips.text.length + 1)-1]; if (Array.isArray(tips.text)) text = tips.text[Math.floor(Math.random() * tips.text.length + 1) - 1];
text = text.renderTip({text: $(this).text()}); text = text.renderTip({ text: $(this).text() });
showMessage(text, 3000); showMessage(text, 3000);
talkValTimer(); talkValTimer();
clearInterval(liveTlakTimer); clearInterval(liveTlakTimer);
liveTlakTimer = null; liveTlakTimer = null;
}); });
$(tips.selector).mouseout(function (){ $(tips.selector).mouseout(function () {
showHitokoto(); showHitokoto();
if(liveTlakTimer == null){ if (liveTlakTimer == null) {
liveTlakTimer = window.setInterval(function(){ liveTlakTimer = window.setInterval(function () {
showHitokoto(); showHitokoto();
},15000); }, 15000);
}; };
}); });
}); });
$.each(result.click, function (index, tips){ $.each(result.click, function (index, tips) {
$(tips.selector).click(function (){ $(tips.selector).click(function () {
if(hitFlag){ if (hitFlag) {
return false return false
} }
hitFlag = true; hitFlag = true;
setTimeout(function(){ setTimeout(function () {
hitFlag = false; hitFlag = false;
},8000); }, 8000);
var text = tips.text; var text = tips.text;
if(Array.isArray(tips.text)) text = tips.text[Math.floor(Math.random() * tips.text.length + 1)-1]; if (Array.isArray(tips.text)) text = tips.text[Math.floor(Math.random() * tips.text.length + 1) - 1];
text = text.renderTip({text: $(this).text()}); text = text.renderTip({ text: $(this).text() });
showMessage(text, 3000); showMessage(text, 3000);
}); });
clearInterval(liveTlakTimer); clearInterval(liveTlakTimer);
liveTlakTimer = null; liveTlakTimer = null;
if(liveTlakTimer == null){ if (liveTlakTimer == null) {
liveTlakTimer = window.setInterval(function(){ liveTlakTimer = window.setInterval(function () {
showHitokoto(); showHitokoto();
},15000); }, 15000);
}; };
}); });
} }
}); });
} }
initTips(); initTips();
var text; var text;
if(document.referrer !== '' && document.referrer.split('/')[2] !== window.location.host ){ if (document.referrer !== '' && document.referrer.split('/')[2] !== window.location.host) {
var referrer = document.createElement('a'); var referrer = document.createElement('a');
referrer.href = document.referrer; referrer.href = document.referrer;
text = '嗨!来自 <span style="color:#0099cc;">' + referrer.hostname + '</span> 的朋友!'; text = '嗨!来自 <span style="color:#0099cc;">' + referrer.hostname + '</span> 的朋友!';
var domain = referrer.hostname.split('.')[1]; var domain = referrer.hostname.split('.')[1];
if (domain == 'baidu') { if (domain == 'baidu') {
text = '嗨! 来自 百度搜索 的朋友!<br>欢迎访问<span style="color:#0099cc;">「 ' + document.title.split(' | ')[0] + ' 」</span>'; text = '嗨! 来自 百度搜索 的朋友!<br>欢迎访问<span style="color:#0099cc;">「 ' + document.title.split(' | ')[0] + ' 」</span>';
}else if (domain == 'so') { } else if (domain == 'so') {
text = '嗨! 来自 360搜索 的朋友!<br>欢迎访问<span style="color:#0099cc;">「 ' + document.title.split(' | ')[0] + ' 」</span>'; text = '嗨! 来自 360搜索 的朋友!<br>欢迎访问<span style="color:#0099cc;">「 ' + document.title.split(' | ')[0] + ' 」</span>';
}else if (domain == 'google') { } else if (domain == 'google') {
text = '嗨! 来自 谷歌搜索 的朋友!<br>欢迎访问<span style="color:#0099cc;">「 ' + document.title.split(' | ')[0] + ' 」</span>'; text = '嗨! 来自 谷歌搜索 的朋友!<br>欢迎访问<span style="color:#0099cc;">「 ' + document.title.split(' | ')[0] + ' 」</span>';
} }
}else { } else {
if (window.location.href == home_Path) { //主页URL判断需要斜杠结尾 if (window.location.href == home_Path) { //主页URL判断需要斜杠结尾
var now = (new Date()).getHours(); var now = (new Date()).getHours();
if (now > 23 || now <= 5) { if (now > 23 || now <= 5) {
@ -144,133 +145,139 @@ if(!norunFlag){
} else { } else {
text = '嗨~ 快来逗我玩吧!'; text = '嗨~ 快来逗我玩吧!';
} }
}else { } else {
text = '欢迎阅读<span style="color:#0099cc;">「 ' + document.title.split(' | ')[0] + ' 」</span>'; text = '欢迎阅读<span style="color:#0099cc;">「 ' + document.title.split(' | ')[0] + ' 」</span>';
} }
} }
showMessage(text, 12000); showMessage(text, 12000);
})(); })();
liveTlakTimer = setInterval(function(){ liveTlakTimer = setInterval(function () {
showHitokoto(); showHitokoto();
},15000); }, 15000);
function showHitokoto(){ function showHitokoto() {
if(sessionStorage.getItem("Sleepy")!=="1"){ if (sessionStorage.getItem("Sleepy") !== "1") {
if(!AITalkFlag){ if (!AITalkFlag) {
$.getJSON('https://hitokoto.mayx.eu.org/',function(result){ $.getJSON('https://hitokoto.mayx.eu.org/', function (result) {
talkValTimer(); talkValTimer();
showMessage(result.hitokoto, 0); showMessage(result.hitokoto, 0);
}); });
} }
}else{ } else {
hideMessage(0); hideMessage(0);
if(sleepTimer_==null){ if (sleepTimer_ == null) {
sleepTimer_ = setInterval(function(){ sleepTimer_ = setInterval(function () {
checkSleep(); checkSleep();
},200); }, 200);
} }
console.log(sleepTimer_); console.log(sleepTimer_);
} }
} }
function checkSleep(){ function checkSleep() {
var sleepStatu = sessionStorage.getItem("Sleepy"); var sleepStatu = sessionStorage.getItem("Sleepy");
if(sleepStatu!=='1'){ if (sleepStatu !== '1') {
talkValTimer(); talkValTimer();
showMessage('你回来啦~', 0); showMessage('你回来啦~', 0);
clearInterval(sleepTimer_); clearInterval(sleepTimer_);
sleepTimer_= null; sleepTimer_ = null;
} }
} }
function showMessage(text, timeout){ function showMessage(text, timeout) {
if(Array.isArray(text)) text = text[Math.floor(Math.random() * text.length + 1)-1]; if (Array.isArray(text)) text = text[Math.floor(Math.random() * text.length + 1) - 1];
//console.log('showMessage', text); //console.log('showMessage', text);
$('.message').stop(); $('.message').stop();
if(text instanceof EventSource){ if (text instanceof EventSource) {
var outputContainer = $('.message')[0]; var outputContainer = $('.message')[0];
var eventFlag = false; var eventFlag = false;
text.onmessage = (event) => { text.onmessage = (event) => {
if (event.data == "[DONE]") { if (event.data == "[DONE]") {
text.close(); text.close();
return; return;
} else { } else {
if(!eventFlag){ if (!eventFlag) {
talkValTimer(); talkValTimer();
outputContainer.textContent = ""; outputContainer.textContent = "";
eventFlag = true; eventFlag = true;
} }
const data = JSON.parse(event.data); const data = JSON.parse(event.data);
outputContainer.textContent += data.response; outputContainer.textContent += data.response;
} }
} }
}else{ } else {
$('.message').html(text); $('.message').html(text);
} }
$('.message').fadeTo(200, 1); $('.message').fadeTo(200, 1);
//if (timeout === null) timeout = 5000; //if (timeout === null) timeout = 5000;
//hideMessage(timeout); //hideMessage(timeout);
} }
function talkValTimer(){ function talkValTimer() {
$('#live_talk').val('1'); $('#live_talk').val('1');
} }
function hideMessage(timeout){ function hideMessage(timeout) {
//$('.message').stop().css('opacity',1); //$('.message').stop().css('opacity',1);
if (timeout === null) timeout = 5000; if (timeout === null) timeout = 5000;
$('.message').delay(timeout).fadeTo(200, 0); $('.message').delay(timeout).fadeTo(200, 0);
} }
function initLive2d (){ function initLive2d() {
$('#hideButton').on('click', function(){ $("#landlord").mouseenter(function () {
if(AIFadeFlag){ $(".live_ico_box").fadeIn();
});
$("#landlord").mouseleave(function () {
$(".live_ico_box").fadeOut();
});
$('#hideButton').on('click', function () {
if (AIFadeFlag) {
return false; return false;
}else{ } else {
AIFadeFlag = true; AIFadeFlag = true;
localStorage.setItem("live2dhidden", "0"); localStorage.setItem("live2dhidden", "0");
$('#landlord').fadeOut(200); $('#landlord').fadeOut(200);
$('#open_live2d').delay(200).fadeIn(200); $('#open_live2d').delay(200).fadeIn(200);
setTimeout(function(){ setTimeout(function () {
AIFadeFlag = false; AIFadeFlag = false;
},300); }, 300);
} }
}); });
$('#open_live2d').on('click', function(){ $('#open_live2d').on('click', function () {
if(AIFadeFlag){ if (AIFadeFlag) {
return false; return false;
}else{ } else {
AIFadeFlag = true; AIFadeFlag = true;
localStorage.setItem("live2dhidden", "1"); localStorage.setItem("live2dhidden", "1");
$('#open_live2d').fadeOut(200); $('#open_live2d').fadeOut(200);
$('#landlord').delay(200).fadeIn(200); $('#landlord').delay(200).fadeIn(200);
setTimeout(function(){ setTimeout(function () {
AIFadeFlag = false; AIFadeFlag = false;
},300); }, 300);
} }
}); });
$('#youduButton').on('click',function(){ $('#youduButton').on('click', function () {
if($('#youduButton').hasClass('doudong')){ if ($('#youduButton').hasClass('doudong')) {
var typeIs = $('#youduButton').attr('data-type'); var typeIs = $('#youduButton').attr('data-type');
$('#youduButton').removeClass('doudong'); $('#youduButton').removeClass('doudong');
$('body').removeClass(typeIs); $('body').removeClass(typeIs);
$('#youduButton').attr('data-type',''); $('#youduButton').attr('data-type', '');
}else{ } else {
var duType = $('#duType').val(); var duType = $('#duType').val();
var duArr = duType.split(","); var duArr = duType.split(",");
var dataType = duArr[Math.floor(Math.random() * duArr.length)]; var dataType = duArr[Math.floor(Math.random() * duArr.length)];
$('#youduButton').addClass('doudong'); $('#youduButton').addClass('doudong');
$('#youduButton').attr('data-type',dataType); $('#youduButton').attr('data-type', dataType);
$('body').addClass(dataType); $('body').addClass(dataType);
} }
}); });
if(talkAPI!==""){ if (talkAPI !== "") {
$('#showInfoBtn').on('click',function(){ $('#showInfoBtn').on('click', function () {
var live_statu = $('#live_statu_val').val(); var live_statu = $('#live_statu_val').val();
if(live_statu=="0"){ if (live_statu == "0") {
return return
}else{ } else {
$('#live_statu_val').val("0"); $('#live_statu_val').val("0");
$('.live_talk_input_body').fadeOut(500); $('.live_talk_input_body').fadeOut(500);
AITalkFlag = false; AITalkFlag = false;
@ -279,105 +286,105 @@ if(!norunFlag){
$('#showInfoBtn').hide(); $('#showInfoBtn').hide();
} }
}); });
$('#showTalkBtn').on('click',function(){ $('#showTalkBtn').on('click', function () {
var live_statu = $('#live_statu_val').val(); var live_statu = $('#live_statu_val').val();
if(live_statu=="1"){ if (live_statu == "1") {
return return
}else{ } else {
$('#live_statu_val').val("1"); $('#live_statu_val').val("1");
$('.live_talk_input_body').fadeIn(500); $('.live_talk_input_body').fadeIn(500);
AITalkFlag = true; AITalkFlag = true;
$('#showTalkBtn').hide(); $('#showTalkBtn').hide();
$('#showInfoBtn').show(); $('#showInfoBtn').show();
} }
}); });
$('#talk_send').on('click',function(){ $('#talk_send').on('click', function () {
var info_ = $('#AIuserText').val(); var info_ = $('#AIuserText').val();
// var userid_ = $('#AIuserName').val(); // var userid_ = $('#AIuserName').val();
let add_id = ""; let add_id = "";
if($('#load_this').prop("checked")){ if ($('#load_this').prop("checked")) {
add_id = "&id="+encodeURIComponent($('#post_id').val()); add_id = "&id=" + encodeURIComponent($('#post_id').val());
} }
if(info_ == "" ){ if (info_ == "") {
showMessage('写点什么吧!',0); showMessage('写点什么吧!', 0);
return; return;
} }
showMessage('思考中~', 0); showMessage('思考中~', 0);
const evSource = new EventSource(talkAPI + "?info=" + encodeURIComponent(info_) + add_id); const evSource = new EventSource(talkAPI + "?info=" + encodeURIComponent(info_) + add_id);
showMessage(evSource); showMessage(evSource);
}); });
}else{ } else {
$('#showInfoBtn').hide(); $('#showInfoBtn').hide();
$('#showTalkBtn').hide(); $('#showTalkBtn').hide();
} }
//获取音乐信息初始化 //获取音乐信息初始化
var bgmListInfo = $('input[name=live2dBGM]'); var bgmListInfo = $('input[name=live2dBGM]');
if(bgmListInfo.length == 0){ if (bgmListInfo.length == 0) {
$('#musicButton').hide(); $('#musicButton').hide();
}else{ } else {
var bgmPlayNow = parseInt($('#live2d_bgm').attr('data-bgm')); var bgmPlayNow = parseInt($('#live2d_bgm').attr('data-bgm'));
var bgmPlayTime = 0; var bgmPlayTime = 0;
var live2dBGM_Num = sessionStorage.getItem("live2dBGM_Num"); var live2dBGM_Num = sessionStorage.getItem("live2dBGM_Num");
var live2dBGM_PlayTime = sessionStorage.getItem("live2dBGM_PlayTime"); var live2dBGM_PlayTime = sessionStorage.getItem("live2dBGM_PlayTime");
if(live2dBGM_Num){ if (live2dBGM_Num) {
if(live2dBGM_Num<=$('input[name=live2dBGM]').length-1){ if (live2dBGM_Num <= $('input[name=live2dBGM]').length - 1) {
bgmPlayNow = parseInt(live2dBGM_Num); bgmPlayNow = parseInt(live2dBGM_Num);
} }
} }
if(live2dBGM_PlayTime){ if (live2dBGM_PlayTime) {
bgmPlayTime = parseInt(live2dBGM_PlayTime); bgmPlayTime = parseInt(live2dBGM_PlayTime);
} }
var live2dBGMSrc = bgmListInfo.eq(bgmPlayNow).val(); var live2dBGMSrc = bgmListInfo.eq(bgmPlayNow).val();
$('#live2d_bgm').attr('data-bgm',bgmPlayNow); $('#live2d_bgm').attr('data-bgm', bgmPlayNow);
$('#live2d_bgm').attr('src',live2dBGMSrc); $('#live2d_bgm').attr('src', live2dBGMSrc);
$('#live2d_bgm')[0].currentTime = bgmPlayTime; $('#live2d_bgm')[0].currentTime = bgmPlayTime;
$('#live2d_bgm')[0].volume = 0.5; $('#live2d_bgm')[0].volume = 0.5;
var live2dBGM_IsPlay = sessionStorage.getItem("live2dBGM_IsPlay"); var live2dBGM_IsPlay = sessionStorage.getItem("live2dBGM_IsPlay");
var live2dBGM_WindowClose = sessionStorage.getItem("live2dBGM_WindowClose"); var live2dBGM_WindowClose = sessionStorage.getItem("live2dBGM_WindowClose");
if(live2dBGM_IsPlay == '0' && live2dBGM_WindowClose == '0'){ if (live2dBGM_IsPlay == '0' && live2dBGM_WindowClose == '0') {
$('#live2d_bgm')[0].play(); $('#live2d_bgm')[0].play();
$('#musicButton').addClass('play'); $('#musicButton').addClass('play');
} }
sessionStorage.setItem("live2dBGM_WindowClose" , '1'); sessionStorage.setItem("live2dBGM_WindowClose", '1');
$('#musicButton').on('click',function(){ $('#musicButton').on('click', function () {
if($('#musicButton').hasClass('play')){ if ($('#musicButton').hasClass('play')) {
$('#live2d_bgm')[0].pause(); $('#live2d_bgm')[0].pause();
$('#musicButton').removeClass('play'); $('#musicButton').removeClass('play');
sessionStorage.setItem("live2dBGM_IsPlay",'1'); sessionStorage.setItem("live2dBGM_IsPlay", '1');
}else{ } else {
$('#live2d_bgm')[0].play(); $('#live2d_bgm')[0].play();
$('#musicButton').addClass('play'); $('#musicButton').addClass('play');
sessionStorage.setItem("live2dBGM_IsPlay",'0'); sessionStorage.setItem("live2dBGM_IsPlay", '0');
} }
}); });
window.onbeforeunload = function(){ window.onbeforeunload = function () {
sessionStorage.setItem("live2dBGM_WindowClose" , '0'); sessionStorage.setItem("live2dBGM_WindowClose", '0');
if($('#musicButton').hasClass('play')){ if ($('#musicButton').hasClass('play')) {
sessionStorage.setItem("live2dBGM_IsPlay",'0'); sessionStorage.setItem("live2dBGM_IsPlay", '0');
} }
} }
document.getElementById('live2d_bgm').addEventListener("timeupdate", function(){ document.getElementById('live2d_bgm').addEventListener("timeupdate", function () {
var live2dBgmPlayTimeNow = document.getElementById('live2d_bgm').currentTime; var live2dBgmPlayTimeNow = document.getElementById('live2d_bgm').currentTime;
sessionStorage.setItem("live2dBGM_PlayTime" , live2dBgmPlayTimeNow ); sessionStorage.setItem("live2dBGM_PlayTime", live2dBgmPlayTimeNow);
}); });
document.getElementById('live2d_bgm').addEventListener("ended", function(){ document.getElementById('live2d_bgm').addEventListener("ended", function () {
var listNow = parseInt($('#live2d_bgm').attr('data-bgm')); var listNow = parseInt($('#live2d_bgm').attr('data-bgm'));
listNow ++ ; listNow++;
if(listNow > $('input[name=live2dBGM]').length-1){ if (listNow > $('input[name=live2dBGM]').length - 1) {
listNow = 0; listNow = 0;
} }
var listNewSrc = $('input[name=live2dBGM]').eq(listNow).val(); var listNewSrc = $('input[name=live2dBGM]').eq(listNow).val();
sessionStorage.setItem("live2dBGM_Num",listNow); sessionStorage.setItem("live2dBGM_Num", listNow);
$('#live2d_bgm').attr('src',listNewSrc); $('#live2d_bgm').attr('src', listNewSrc);
$('#live2d_bgm')[0].play(); $('#live2d_bgm')[0].play();
$('#live2d_bgm').attr('data-bgm',listNow); $('#live2d_bgm').attr('data-bgm', listNow);
}); });
document.getElementById('live2d_bgm').addEventListener("error", function(){ document.getElementById('live2d_bgm').addEventListener("error", function () {
$('#live2d_bgm')[0].pause(); $('#live2d_bgm')[0].pause();
$('#musicButton').removeClass('play'); $('#musicButton').removeClass('play');
showMessage('音乐似乎加载不出来了呢!',0); showMessage('音乐似乎加载不出来了呢!', 0);
}); });
} }
// //获取用户名 // //获取用户名
@ -388,12 +395,12 @@ if(!norunFlag){
//获取位置 //获取位置
var landL = sessionStorage.getItem("historywidth"); var landL = sessionStorage.getItem("historywidth");
var landB = sessionStorage.getItem("historyheight"); var landB = sessionStorage.getItem("historyheight");
if(landL == null || landB ==null){ if (landL == null || landB == null) {
landL = '5px' landL = '5px'
landB = '0px' landB = '0px'
} }
$('#landlord').css('left',landL+'px'); $('#landlord').css('left', landL + 'px');
$('#landlord').css('bottom',landB + 'px'); $('#landlord').css('bottom', landB + 'px');
//移动 //移动
function getEvent() { function getEvent() {
return window.event || arguments.callee.caller.arguments[0]; return window.event || arguments.callee.caller.arguments[0];
@ -406,7 +413,7 @@ if(!norunFlag){
var moveable = false; var moveable = false;
var docMouseMoveEvent = document.onmousemove; var docMouseMoveEvent = document.onmousemove;
var docMouseUpEvent = document.onmouseup; var docMouseUpEvent = document.onmouseup;
smcc.onmousedown = function(){ smcc.onmousedown = function () {
var ent = getEvent(); var ent = getEvent();
moveable = true; moveable = true;
moveX = ent.clientX; moveX = ent.clientX;
@ -414,20 +421,20 @@ if(!norunFlag){
var obj = smcc; var obj = smcc;
moveBottom = parseInt(obj.style.bottom); moveBottom = parseInt(obj.style.bottom);
moveLeft = parseInt(obj.style.left); moveLeft = parseInt(obj.style.left);
if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){ if (isFirefox = navigator.userAgent.indexOf("Firefox") > 0) {
window.getSelection().removeAllRanges(); window.getSelection().removeAllRanges();
} }
document.onmousemove = function(){ document.onmousemove = function () {
if(moveable){ if (moveable) {
var ent = getEvent(); var ent = getEvent();
var x = moveLeft + ent.clientX - moveX; var x = moveLeft + ent.clientX - moveX;
var y = moveBottom + (moveY - ent.clientY); var y = moveBottom + (moveY - ent.clientY);
obj.style.left = x + "px"; obj.style.left = x + "px";
obj.style.bottom = y + "px"; obj.style.bottom = y + "px";
} }
}; };
document.onmouseup = function(){ document.onmouseup = function () {
if(moveable){ if (moveable) {
var historywidth = obj.style.left; var historywidth = obj.style.left;
var historyheight = obj.style.bottom; var historyheight = obj.style.bottom;
historywidth = historywidth.replace('px', ''); historywidth = historywidth.replace('px', '');
@ -436,7 +443,7 @@ if(!norunFlag){
sessionStorage.setItem("historyheight", historyheight); sessionStorage.setItem("historyheight", historyheight);
document.onmousemove = docMouseMoveEvent; document.onmousemove = docMouseMoveEvent;
document.onmouseup = docMouseUpEvent; document.onmouseup = docMouseUpEvent;
moveable = false; moveable = false;
moveX = 0; moveX = 0;
moveY = 0; moveY = 0;
moveBottom = 0; moveBottom = 0;
@ -445,36 +452,42 @@ if(!norunFlag){
}; };
}; };
} }
$(document).ready(function() { $(document).ready(function () {
var AIimgSrc = [ var AIimgSrc = [
home_Path + message_Path + "model/histoire/histoire.1024/texture_00.png", home_Path + message_Path + "model/histoire/histoire.1024/texture_00.png",
home_Path + message_Path + "model/histoire/histoire.1024/texture_01.png", home_Path + message_Path + "model/histoire/histoire.1024/texture_01.png",
home_Path + message_Path + "model/histoire/histoire.1024/texture_02.png", home_Path + message_Path + "model/histoire/histoire.1024/texture_02.png",
home_Path + message_Path + "model/histoire/histoire.1024/texture_03.png" home_Path + message_Path + "model/histoire/histoire.1024/texture_03.png",
home_Path + message_Path + "images/info.png",
home_Path + message_Path + "images/music.png",
home_Path + message_Path + "images/pasue.png",
home_Path + message_Path + "images/quite.png",
home_Path + message_Path + "images/talk.png",
home_Path + message_Path + "images/youdu.png"
] ]
var images = []; var images = [];
var imgLength = AIimgSrc.length; var imgLength = AIimgSrc.length;
var loadingNum = 0; var loadingNum = 0;
for(var i=0;i<imgLength;i++){ for (var i = 0; i < imgLength; i++) {
images[i] = new Image(); images[i] = new Image();
images[i].src = AIimgSrc[i]; images[i].src = AIimgSrc[i];
images[i].onload = function(){ images[i].onload = function () {
loadingNum++; loadingNum++;
if(loadingNum===imgLength){ if (loadingNum === imgLength) {
var live2dhidden = localStorage.getItem("live2dhidden"); var live2dhidden = localStorage.getItem("live2dhidden");
if(live2dhidden==="0"){ if (live2dhidden === "0") {
setTimeout(function(){ setTimeout(function () {
$('#open_live2d').fadeIn(200); $('#open_live2d').fadeIn(200);
},1300); }, 1300);
}else{ } else {
setTimeout(function(){ setTimeout(function () {
$('#landlord').fadeIn(200); $('#landlord').fadeIn(200);
},1300); }, 1300);
} }
setTimeout(function(){ setTimeout(function () {
loadlive2d("live2d", message_Path+"model/histoire/model.json"); loadlive2d("live2d", message_Path + "model/histoire/model.json");
},1000); }, 1000);
initLive2d (); initLive2d();
images = null; images = null;
} }
} }

View File

@ -1,11 +1,4 @@
$(function () { $(function () {
$("div#landlord").mouseenter(function () {
$("div.live_ico_box").fadeIn();
});
$("div#landlord").mouseleave(function () {
$("div.live_ico_box").fadeOut();
});
const urlParams = new URLSearchParams(window.location.search); const urlParams = new URLSearchParams(window.location.search);
const keyword = urlParams.get('kw')?.trim(); const keyword = urlParams.get('kw')?.trim();