thedesk/app/js/ui/post-box.js

94 lines
2.3 KiB
JavaScript
Raw Normal View History

2018-01-28 23:22:43 +11:00
/*ささやきボックス(Cr民並感)*/
//✕隠す
function hide() {
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")
2018-01-28 23:22:43 +11:00
}
2018-02-18 03:44:03 +11:00
//最小化
function mini() {
$("body").toggleClass("mini-post");
if($("body").hasClass("mini-post")){
$(".mini-btn").text("expand_less");
}else{
$(".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-03-06 19:08:48 +11:00
console.log("show"+localStorage.getItem("postbox-left"));
$('#post-box').css("left",localStorage.getItem("postbox-left")+"px")
$('#post-box').css("top",localStorage.getItem("postbox-top")+"px")
$('#post-box').fadeIn();
2018-03-14 17:52:55 +11:00
}
2019-03-06 19:08:48 +11:00
$(function() {
$( "#post-box" ).draggable({handle: "#post-bar",
stop: function() {
console.log("stopped");
localStorage.setItem("postbox-left",$('#post-box').offset().left);
localStorage.setItem("postbox-top",$('#post-box').offset().top);
}
});
});
2018-07-28 07:25:12 +10:00
2018-02-26 02:32:10 +11:00
//コード受信
if(location.search){
var m = location.search.match(/\?mode=([a-zA-Z-0-9]+)\&code=(.+)/);
var mode=m[1];
var codex=m[2];
if(mode=="share"){
console.log(codex);
$('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-03-06 19:08:48 +11:00
$('#posttgl').click(function(e) {
2018-07-28 07:25:12 +10:00
if(!$('#post-box').hasClass("appear")){
show();
2019-03-06 19:08:48 +11:00
}else{
hide();
2018-07-28 07:25:12 +10:00
}
});
$("#timeline-container,#group").click(function(e) {
2018-09-19 02:41:48 +10:00
2018-08-05 13:36:23 +10:00
if(localStorage.getItem("box")!="absolute"){
if($('#post-box').hasClass("appear") && !localStorage.getItem("nohide")){
hide();
}
2018-07-28 07:25:12 +10:00
}
localStorage.removeItem("nohide")
});
2018-09-19 02:41:48 +10:00
$('#textarea,#cw-text').focusout(function(e) {
localStorage.setItem("nohide",true)
var countup = function(){
localStorage.removeItem("nohide")
}
//setTimeout(remove, 100);
});
2018-07-28 07:25:12 +10:00
$("#timeline-container").click(function(e) {
if(!$('#list-box').hasClass("hide")){
$("#list-box").removeClass("show");
$("#list-box").addClass("hide")
}
if(!$('#src-box').hasClass("hide")){
$("#src-box").removeClass("show");
$("#src-box").addClass("hide")
}
if(!$('#filter-box').hasClass("hide")){
$("#filter-box").removeClass("show");
$("#filter-box").addClass("hide")
}
if(!$('#add-box').hasClass("hide")){
$("#add-box").removeClass("show");
$("#add-box").addClass("hide")
}
});