Scheduled toot available

This commit is contained in:
cutls 2019-01-22 01:25:40 +09:00
parent 4f82cf00d6
commit f3186373bf
7 changed files with 127 additions and 13 deletions

View File

@ -35,6 +35,15 @@
#cw-text { #cw-text {
display: none; display: none;
} }
#sch-box {
display: none;
}
#sch-box input {
width:auto;
}
.picker__close, .picker__today, .picker__clear {
color: #26a69a !important;
}
.cw { .cw {
display: none; display: none;
} }

View File

@ -32,3 +32,53 @@ function nl2br(str) {
str = str.replace(/(\n|\r)/g, "<br />"); str = str.replace(/(\n|\r)/g, "<br />");
return str; return str;
} }
function formattime(date){
var str=date.getFullYear()+"-";
if(date.getMonth()+1<10){
str=str+"0"+(date.getMonth()+1)+"-";
}else{
str=str+(date.getMonth()+1)+"-";
}
if(date.getDate()<10){
str=str+"0"+date.getDate()
}else{
str=str+date.getDate()
}
str=str+"T";
if(date.getHours()<10){
str=str+"0"+date.getHours()+":"
}else{
str=str+date.getHours()+":"
}
if(date.getMinutes()<10){
str=str+"0"+date.getMinutes()
}else{
str=str+date.getMinutes()
}
return str;
}
function formattimeutc(date){
var str=date.getUTCFullYear()+"-";
if(date.getUTCMonth()+1<10){
str=str+"0"+(date.getUTCMonth()+1)+"-";
}else{
str=str+(date.getUTCMonth()+1)+"-";
}
if(date.getUTCDate()<10){
str=str+"0"+date.getUTCDate()
}else{
str=str+date.getUTCDate()
}
str=str+"T";
if(date.getUTCHours()<10){
str=str+"0"+date.getUTCHours()+":"
}else{
str=str+date.getUTCHours()+":"
}
if(date.getUTCMinutes()<10){
str=str+"0"+date.getUTCMinutes()
}else{
str=str+date.getUTCMinutes()
}
return str;
}

View File

@ -105,6 +105,14 @@ function post(mode,postvis) {
}else if(vis=="local"){ }else if(vis=="local"){
toot.status=str+"👁️"; toot.status=str+"👁️";
} }
//ここに非公開・未収載タグについてwarn
if(~str.indexOf("#")){
if(vis == "local" || vis=="unlisted" || vis=="direct" || vis=="private"){
if(!confirm(lang_post_tagVis[lang])){
return false;
}
}
}
if ($("#cw").hasClass("cw-avail")) { if ($("#cw").hasClass("cw-avail")) {
var spo = $("#cw-text").val(); var spo = $("#cw-text").val();
cw(); cw();
@ -112,6 +120,14 @@ function post(mode,postvis) {
} else { } else {
var spo = ""; var spo = "";
} }
if ($("#sch-box").hasClass("sch-avail")) {
var scheduled=formattimeutc(new Date(Date.parse($("#sch-date").val())))
schedule();
toot.scheduled_at=scheduled;
} else {
var scheduled = "";
}
var httpreq = new XMLHttpRequest(); var httpreq = new XMLHttpRequest();
httpreq.open('POST', start, true); httpreq.open('POST', start, true);
httpreq.setRequestHeader('Content-Type', 'application/json'); httpreq.setRequestHeader('Content-Type', 'application/json');

View File

@ -113,3 +113,17 @@ $(function() {
}); });
}); });
//スケジュール
function schedule(){
if($("#sch-box").hasClass("sch-avail")){
$("#sch-box").hide();
$("#sch-box").removeClass("sch-avail");
}else{
var date = new Date();
$("#sch-box").show();
$("#sch-date").val(formattime(date));
console.log(formattime(date));
$("#sch-box").addClass("sch-avail");
}
}

View File

@ -26,7 +26,7 @@
<script type="text/javascript" src="../../js/common/modal.js"></script> <script type="text/javascript" src="../../js/common/modal.js"></script>
<script type="text/javascript" src="../../js/ui/jquery-ui.min.js"></script> <script type="text/javascript" src="../../js/ui/jquery-ui.min.js"></script>
<script> <script>
var ver="Miria (17.0.0)"; var ver="Miria (17.0.1)";
//betaを入れるとバージョンチェックしない //betaを入れるとバージョンチェックしない
//GitHubに上げるときはindex.htmlをちゃんとする。(index.start.html) //GitHubに上げるときはindex.htmlをちゃんとする。(index.start.html)
//var ver="beta"; //var ver="beta";
@ -125,9 +125,8 @@ var lang="{{lang}}";
<i class="waves-effect gray material-icons purple-text dropdown-button" data-activates='dropdown1' id="vis-icon">public</i> <i class="waves-effect gray material-icons purple-text dropdown-button" data-activates='dropdown1' id="vis-icon">public</i>
<a class="waves-effect gray" id="cw" onclick="cw()" title="{{cwDes}}">CW</a> <a class="waves-effect gray" id="cw" onclick="cw()" title="{{cwDes}}">CW</a>
<span><span id="imgup"></span><span id="imgsel"><i class="waves-effect material-icons gray" onclick="fileselect()" title="{{selfile}}">photo_library</i></span></span> <span><span id="imgup"></span><span id="imgsel"><i class="waves-effect material-icons gray" onclick="fileselect()" title="{{selfile}}">photo_library</i></span></span>
<i class="waves-effect gray material-icons" onclick="adobe()" title="{{adobephoto}}">format_shapes</i>
<i class="waves-effect gray material-icons" onclick="emojiToggle()" id="emojibtn" title="{{insertEmoji}}">tag_faces</i> <i class="waves-effect gray material-icons" onclick="emojiToggle()" id="emojibtn" title="{{insertEmoji}}">tag_faces</i>
<a class="pointer waves-effect gray" id="npbtn" title="{{NowPlayingDes}}"><i class="material-icons" style="font-size:24px;">music_note</i></a> <i class="waves-effect gray material-icons dropdown-button" data-activates='dropdown2'>more_vert</i>
<i class="material-icons nex gray waves-effect" title="{{clearToot}}(Ctrl+Shit+C)" data-trans-title="post_box_clear" id="clear">clear</i> <i class="material-icons nex gray waves-effect" title="{{clearToot}}(Ctrl+Shit+C)" data-trans-title="post_box_clear" id="clear">clear</i>
</div> </div>
<div class="col s12 mize" style="margin-bottom:5px; padding:0;"> <div class="col s12 mize" style="margin-bottom:5px; padding:0;">
@ -140,6 +139,9 @@ var lang="{{lang}}";
</span> </span>
<br> <br>
<input type="text" id="cw-text" placeholder="{{cwtext}}" class="mize" style="margin:0"> <input type="text" id="cw-text" placeholder="{{cwtext}}" class="mize" style="margin:0">
<div id="sch-box">{{postat}}<br><span class="sml">{{scheduleWarn}}</span><br>
<input type="datetime-local" id="sch-date" placeholder="{{schedule}}" class="datepicker" style="margin:0">
</div>
</div> </div>
</div> </div>
<!-- 公開範囲 Dropdown Structure --> <!-- 公開範囲 Dropdown Structure -->
@ -164,6 +166,21 @@ var lang="{{lang}}";
<a onclick="vis('direct')" class="disabled direct">{{directJP}}(Direct)</a> <a onclick="vis('direct')" class="disabled direct">{{directJP}}(Direct)</a>
</li> </li>
</ul> </ul>
<!-- その他 Dropdown Structure -->
<ul id='dropdown2' class='dropdown-content'>
<li>
<a onclick="adobe()">{{adobephoto}}</a>
</li>
<li>
<a onclick="nowplaying('spotify');">{{NPSpotify}}</a>
</li>
<li>
<a onclick="nowplaying('itunes');">{{NPiTunes}}</a>
</li>
<li>
<a onclick="schedule();">{{schedule}}</a>
</li>
</ul>
<!--hidden area--> <!--hidden area-->
<input type="hidden" id="reply"> <input type="hidden" id="reply">
<input type="hidden" id="media"> <input type="hidden" id="media">
@ -528,16 +545,16 @@ var lang="{{lang}}";
<a href="https://thedesk.top" target="_blank">HP</a><br> <a href="https://thedesk.top" target="_blank">HP</a><br>
<a href="https://github.com/cutls/TheDesk" target="_blank">GitHub</a><br> <a href="https://github.com/cutls/TheDesk" target="_blank">GitHub</a><br>
<br> <br>
<div id="release-Miria_17-0-0" class="release-do" style="display:none; "> <div id="release-Miria_17-0-1" class="release-do" style="display:none; ">
<a href="https://code.cutls.com/thedesk-log/" target="_blank">開発の経緯</a><br> <a href="https://code.cutls.com/thedesk-log/" target="_blank">開発の経緯</a><br>
<a href="https://ja.mstdn.wiki/TheDesk" target="_blank">機能一覧</a><br> <a href="https://ja.mstdn.wiki/TheDesk" target="_blank">機能一覧</a><br>
Entyでは支援者様限定で様々なTheDeskに関する記事をご覧いただけます。<br> Entyでは支援者様限定で様々なTheDeskに関する記事をご覧いただけます。<br>
困ったときは、<a href="https://docs.thedesk.top">TheDesk Docs</a>をご覧ください。 困ったときは、<a href="https://docs.thedesk.top">TheDesk Docs</a>をご覧ください。
<h5>Release Note Miria (17.0.0)</h5> <h5>Release Note Miria (17.0.1)</h5>
セキュリティアップデート、安定性の向上。<br> バグ修正<br>
<b>#InstanceTickerが使用できるように</b><br> (Mastodon 2.7)<b>時間指定投稿が利用できます。</b><br>
<b>フォントが直感的に選べるように</b><br> (Mastodon 2.7)<b>「インスタンス」を「サーバー」に変更</b><br>
<b>リンク解析をオンにしても制限がかからないように</b>(これによりデフォルトでオンになります。)<br>
</div> </div>
<br><br> <br><br>
<h3>{{supportme}}</h3> <h3>{{supportme}}</h3>

View File

@ -9,7 +9,11 @@
"selfile":"Attach..", "selfile":"Attach..",
"adobephoto":"Adobe Photo Editor", "adobephoto":"Adobe Photo Editor",
"insertEmoji":"Emojis", "insertEmoji":"Emojis",
"NowPlayingDes":"NowPlaying[Click to insert info of Spotify(account link is required.)/control+click to insert that of iTunes(macOS)]", "NPSpotify":"Spotify NowPlaying",
"NPiTunes":"iTunes NowPlaying(macOS)",
"schedule":"Scheduled toot",
"postat":"Post at",
"scheduleWarn":"2.7.0~ Minimum time gap:5min(clock on the server may not be accurate.)",
"clearToot":"Clear toot box", "clearToot":"Clear toot box",
"replyMode":"Reply", "replyMode":"Reply",
"no":"No", "no":"No",

View File

@ -9,7 +9,11 @@
"selfile":"ファイルを選択", "selfile":"ファイルを選択",
"adobephoto":"Adobeフォトエディタ", "adobephoto":"Adobeフォトエディタ",
"insertEmoji":"絵文字を挿入", "insertEmoji":"絵文字を挿入",
"NowPlayingDes":"NowPlaying[クリックでSpotify(アカウント連携が必要です)/control+クリックでiTunes(macOSが必要です)]", "NPSpotify":"Spotify NowPlaying",
"NPiTunes":"iTunes NowPlaying(macOS)",
"schedule":"時間指定投稿",
"postat":"時間指定投稿",
"scheduleWarn":"2.7.0~ 5分以内には投稿できません。サーバーの時計が正確とは限りません。",
"clearToot":"トゥートボックスのクリア", "clearToot":"トゥートボックスのクリア",
"replyMode":"返信モード", "replyMode":"返信モード",
"no":"いいえ", "no":"いいえ",
@ -25,7 +29,7 @@
"localJP":"ローカル限定", "localJP":"ローカル限定",
"directJP":"ダイレクト", "directJP":"ダイレクト",
"sectoot":"セカンダリートゥート", "sectoot":"セカンダリートゥート",
"emojiWarn":"インスタンスによって実装が異なります。", "emojiWarn":"サーバーによって実装が異なります。",
"emojiInsertWarn":"一部絵文字は入力できません。", "emojiInsertWarn":"一部絵文字は入力できません。",
"refreshEmoji":"絵文字更新", "refreshEmoji":"絵文字更新",
"closeThisBox":"このボックスを閉じる", "closeThisBox":"このボックスを閉じる",