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