2018-01-28 23:22:43 +11:00
|
|
|
/*ささやきボックス(Cr民並感)*/
|
|
|
|
//✕隠す
|
|
|
|
function hide() {
|
2019-03-13 02:51:07 +11:00
|
|
|
$("#right-side").hide()
|
2019-09-01 00:35:18 +10:00
|
|
|
$("#right-side").css("width", "300px")
|
|
|
|
$("#left-side").css("width", "100%")
|
|
|
|
var width = localStorage.getItem("postbox-width").replace("px", "") * 1;
|
|
|
|
if (!width) {
|
|
|
|
width = 300
|
|
|
|
}
|
|
|
|
$("#post-box").css("width", width)
|
2019-03-06 19:08:48 +11:00
|
|
|
$('#post-box').fadeOut()
|
|
|
|
$("#post-box").removeClass("appear")
|
2018-09-19 02:41:48 +10:00
|
|
|
$("#emoji").addClass("hide")
|
2019-04-11 02:52:01 +10:00
|
|
|
$("#left-side").show();
|
|
|
|
$("#default-emoji").show();
|
|
|
|
$("#unreact").show();
|
|
|
|
$("#addreact").addClass("hide");
|
2018-01-28 23:22:43 +11:00
|
|
|
}
|
2018-02-18 03:44:03 +11:00
|
|
|
//最小化
|
|
|
|
function mini() {
|
|
|
|
$("body").toggleClass("mini-post");
|
2019-05-19 17:39:30 +10:00
|
|
|
if ($("body").hasClass("mini-post")) {
|
2018-02-18 03:44:03 +11:00
|
|
|
$(".mini-btn").text("expand_less");
|
2019-05-19 17:39:30 +10:00
|
|
|
} else {
|
2018-02-18 03:44:03 +11:00
|
|
|
$(".mini-btn").text("expand_more");
|
|
|
|
}
|
|
|
|
}
|
2018-01-28 23:22:43 +11:00
|
|
|
//最小化時に展開
|
|
|
|
function show() {
|
2019-03-06 19:08:48 +11:00
|
|
|
$("#post-box").addClass("appear")
|
2018-07-28 07:25:12 +10:00
|
|
|
$("#textarea").focus();
|
2019-05-19 17:39:30 +10:00
|
|
|
console.log("show" + localStorage.getItem("postbox-left"));
|
|
|
|
var left = localStorage.getItem("postbox-left");
|
|
|
|
if (left > $('body').width() - $('#post-box').width()) {
|
|
|
|
left = $('body').width() - $('#post-box').width();
|
|
|
|
} else if (left < 0) {
|
|
|
|
left = 0;
|
2019-03-10 02:03:02 +11:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
var top = localStorage.getItem("postbox-top");
|
|
|
|
if (top > $('body').height() - $('#post-box').height()) {
|
|
|
|
top = $('body').height() - $('#post-box').height();
|
|
|
|
} else if (top < 0) {
|
|
|
|
top = 0;
|
2019-03-10 02:03:02 +11:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
$('#post-box').css("left", left + "px")
|
|
|
|
$('#post-box').css("top", top + "px")
|
2019-09-01 00:35:18 +10:00
|
|
|
var height = localStorage.getItem("postbox-height");
|
|
|
|
var width = localStorage.getItem("postbox-width");
|
|
|
|
if (height) {
|
|
|
|
$('#post-box').css("height", height + "px")
|
|
|
|
}
|
|
|
|
if (width) {
|
|
|
|
$('#post-box').css("width", width + "px")
|
|
|
|
} else {
|
|
|
|
$('#post-box').css("width", "300px")
|
|
|
|
}
|
2019-03-06 19:08:48 +11:00
|
|
|
$('#post-box').fadeIn();
|
2019-06-22 01:22:45 +10:00
|
|
|
$('#textarea').characterCounter();
|
2018-03-14 17:52:55 +11:00
|
|
|
}
|
|
|
|
|
2019-05-19 17:39:30 +10:00
|
|
|
$(function () {
|
|
|
|
$("#post-box").draggable({
|
|
|
|
handle: "#post-bar",
|
|
|
|
stop: function () {
|
|
|
|
var left = $('#post-box').offset().left;
|
|
|
|
if (left > $('body').width() - $('#post-box').width()) {
|
|
|
|
left = $('body').width() - $('#post-box').width();
|
|
|
|
} else if (left < 0) {
|
|
|
|
left = 0;
|
|
|
|
}
|
|
|
|
var top = $('#post-box').offset().top;
|
|
|
|
if (top > $('body').height() - $('#post-box').height()) {
|
|
|
|
top = $('body').height() - $('#post-box').height();
|
|
|
|
} else if (top < 0) {
|
|
|
|
top = 0;
|
|
|
|
}
|
|
|
|
localStorage.setItem("postbox-left", left);
|
|
|
|
localStorage.setItem("postbox-top", top);
|
|
|
|
}
|
|
|
|
});
|
2019-09-01 00:35:18 +10:00
|
|
|
$("#post-box").resizable({
|
|
|
|
minHeight: 150,
|
|
|
|
minWidth: 100,
|
|
|
|
stop: function (event, ui) {
|
|
|
|
localStorage.setItem("postbox-height", ui.size.height);
|
|
|
|
localStorage.setItem("postbox-width", ui.size.width);
|
|
|
|
}
|
|
|
|
});
|
2019-03-06 19:08:48 +11:00
|
|
|
});
|
2018-07-28 07:25:12 +10:00
|
|
|
|
2018-02-26 02:32:10 +11:00
|
|
|
//コード受信
|
2019-05-19 17:39:30 +10:00
|
|
|
if (location.search) {
|
2018-02-26 02:32:10 +11:00
|
|
|
var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/);
|
2019-05-19 17:39:30 +10:00
|
|
|
var mode = m[1];
|
|
|
|
var codex = m[2];
|
|
|
|
if (mode == "share") {
|
2018-02-26 02:32:10 +11:00
|
|
|
$('textarea').focus();
|
|
|
|
$("#textarea").val(decodeURI(codex));
|
|
|
|
show();
|
|
|
|
$("body").removeClass("mini-post");
|
|
|
|
$(".mini-btn").text("expand_less");
|
|
|
|
}
|
2018-07-28 07:25:12 +10:00
|
|
|
}
|
2019-05-19 17:39:30 +10:00
|
|
|
$('#posttgl').click(function (e) {
|
|
|
|
if (!$('#post-box').hasClass("appear")) {
|
2018-07-28 07:25:12 +10:00
|
|
|
show();
|
2019-05-19 17:39:30 +10:00
|
|
|
} else {
|
2019-03-06 19:08:48 +11:00
|
|
|
hide();
|
2018-07-28 07:25:12 +10:00
|
|
|
}
|
2019-07-12 01:53:55 +10:00
|
|
|
$('.cvo').removeClass("selectedToot")
|
|
|
|
selectedColumn = 0
|
|
|
|
selectedToot = 0
|
2018-07-28 07:25:12 +10:00
|
|
|
});
|
|
|
|
|
2019-05-19 17:39:30 +10:00
|
|
|
$("#timeline-container,#group").click(function (e) {
|
|
|
|
if (localStorage.getItem("box") != "absolute") {
|
|
|
|
if ($('#post-box').hasClass("appear") && !localStorage.getItem("nohide")) {
|
2018-08-05 13:36:23 +10:00
|
|
|
hide();
|
|
|
|
}
|
2018-07-28 07:25:12 +10:00
|
|
|
}
|
2019-07-12 01:53:55 +10:00
|
|
|
$('.cvo').removeClass("selectedToot")
|
|
|
|
selectedColumn = 0
|
|
|
|
selectedToot = 0
|
2018-07-28 07:25:12 +10:00
|
|
|
localStorage.removeItem("nohide")
|
|
|
|
});
|
2019-05-19 17:39:30 +10:00
|
|
|
$('#textarea,#cw-text').focusout(function (e) {
|
|
|
|
localStorage.setItem("nohide", true)
|
|
|
|
var countup = function () {
|
2018-09-19 02:41:48 +10:00
|
|
|
localStorage.removeItem("nohide")
|
2019-05-19 17:39:30 +10:00
|
|
|
}
|
2018-09-19 02:41:48 +10:00
|
|
|
//setTimeout(remove, 100);
|
2019-07-12 01:53:55 +10:00
|
|
|
$('.cvo').removeClass("selectedToot")
|
|
|
|
selectedColumn = 0
|
|
|
|
selectedToot = 0
|
2019-03-15 06:48:01 +11:00
|
|
|
});
|