TheDesk Mio (ver.1 beta2)

This commit is contained in:
cutls 2018-05-10 00:33:08 +09:00
parent e4414f6051
commit c20b14b708
9 changed files with 326 additions and 42 deletions

259
app/adobe.html Normal file
View File

@ -0,0 +1,259 @@
<!doctype html>
<html lang="ja">
<head>
<title>Adobe Photo Editor - TheDesk</title>
<meta content="width=device-width,initial-scale=1.0" name="viewport">
<link href="./css/materialize.css" type="text/css" rel="stylesheet">
<link href="./css/master.css" type="text/css" rel="stylesheet">
<link href="./css/auth.css" type="text/css" rel="stylesheet">
<link href='./css/font-awesome.css' rel='stylesheet' type='text/css'>
<link href='./css/tl.css' rel='stylesheet' type='text/css'>
<link href='./css/userdata.css' rel='stylesheet' type='text/css'>
<link href="https://fonts.googleapis.com/icon?family=Material+Icons|Open+Sans:300" rel="stylesheet">
<style>
#cb-drag {
margin-bottom: 8px;
padding: 24px 0;
text-align: center;
}
#cb-drag p {
font-weight: bold;
text-align: center;
}
#cb-file {
cursor: pointer;
}
#cb-display {
margin-bottom: 0;
}
#cb-display p {
margin-top: 8px;
margin-bottom: 0;
line-height: 1.4;
}
.cb-div {
padding: 16px;
margin-bottom: 8px;
}
.cb-image {
cursor: pointer;
}
</style>
<meta charset="utf-8">
</head>
<body id="mainView">
<script type="text/javascript" src="./js/common/jquery.js"></script>
<script type="text/javascript" src="./js/platform/first.js"></script>
<script type="text/javascript" src="./js/common/materialize.js"></script>
<script type="text/javascript" src="./js/ui/tips.js"></script>
<script type="text/javascript" src="./js/common/time.js"></script>
<script type="text/javascript" src="./js/common/modal.js"></script>
<div>
<div id="cb-drag">
<p>ここに画像ファイルをドラッグし、画像をクリックしてください。</p>
<input type="file" id="cb-file">
</div>
<div id="cb-display"></div>
</div>
<script type="text/javascript" src="https://dme0ih8comzn4.cloudfront.net/imaging/v2/editor.js"></script>
<script type="text/javascript">
var dragAndDrop = (function (window, document) {
"use strict";
var drag = document.getElementById("mainView");
var disp = document.getElementById("cb-display");
var file = document.getElementById("cb-file");
function makeView(data) {
var div, img, customEvent;
var metaData = "<p>■ファイル名: <b>" + data.name + "</b><br>■容量: <b>" + data.size + "</b>バイト</p>";
div = document.createElement("div");
div.setAttribute("class", "cb-div");
img = document.createElement("img");
img.src = data.url;
img.setAttribute("class", "cb-image");
img.style.maxWidth = "100%";
img.style.height = "auto";
div.appendChild(img);
img.insertAdjacentHTML("afterend", metaData);
disp.appendChild(div);
customEvent = document.createEvent("HTMLEvents");
customEvent.initEvent("makeView", true, false);
div.dispatchEvent(customEvent);
}
function readImage(e) {
var f = (e.dataTransfer) ? e.dataTransfer.files : e.target.files;
for (var i = 0, l = f.length; i < l; i++) {
var reader = new FileReader();
reader.onload = (function (f) {
var imageData = {};
return function (evt) {
if (f.type === "image/gif" || f.type === "image/png" || f.type === "image/jpeg") {
imageData.type = f.type;
imageData.name = f.name;
imageData.size = f.size;
imageData.date = f.lastModifiedDate.toLocaleDateString();
imageData.url = evt.target.result;
makeView(imageData);
} else {
return;
}
};
})(f[i]);
reader.readAsDataURL(f[i]);
}
}
function dragFiles() {
drag.addEventListener("drop", function (e) {
e.stopPropagation();
e.preventDefault();
readImage(e);
}, false);
drag.addEventListener("dragover", function (e) {
e.stopPropagation();
e.preventDefault();
}, false);
}
function uploadFiles() {
file.addEventListener("change", function(e) {
readImage(e);
}, false);
}
return {
init: function () {
dragFiles();
uploadFiles();
}
};
})(this, this.document);
var photoEditor = (function (window, document) {
"use strict";
var featherEditor = new Aviary.Feather({
apiKey: "ffee425017ab44b18ce95dab98a5cdc1",
onSave: function(imageID, newURL) {
var img1 = document.getElementById(imageID);
img1.src = newURL;
var electron = require("electron");
var ipc = electron.ipcRenderer;
ipc.send('bmp-image', [newURL,0]);
window.close();
}
});
function clearImage() {
this.parentNode.style.display = "none";
}
function launchEditor(id, src) {
featherEditor.launch({
image: id,
url: src
});
return false;
}
function editPhoto() {
//console.log(this);
var id = this.getAttribute("id");
var src = this.getAttribute("src");
launchEditor(id, src);
}
function makeButton() {
var button = document.createElement("button");
button.setAttribute("style",
"width: 64px;"
+ " line-height: 24px;"
+ " background-color: #37474F;"
+ " color: #fff;"
+ " border: none;"
+ " cursor: pointer;"
+ " border-radius: 2px;"
+ " font-size: 14px;"
+ " position: absolute;"
+ " text-align: center;"
+ " top: 16px;"
+ " right: 8px;"
+ " padding: 0;"
+ " z-index: 1000;"
);
button.innerHTML = "削除";
return button;
}
function listener() {
var disp = document.getElementById("cb-display");
disp.addEventListener("makeView", function () {
var image = document.querySelectorAll(".cb-image");
var button = [];
for (var i = 0, l = image.length; i < l; i++) {
button[i] = makeButton();
image[i].setAttribute("id", "cb-image_" + i);
image[i].parentNode.style.position = "relative";
image[i].parentNode.appendChild(button[i]);
button[i].addEventListener("click", clearImage, false);
image[i].addEventListener("click", editPhoto, false);
}
}, false);
}
return {
init: function () {
listener();
}
};
})(this, this.document);
dragAndDrop.init();
photoEditor.init();
</script>
<script type="text/javascript" src="./js/ui/theme.js"></script>
<script type="text/javascript" src="./js/platform/end.js"></script>
</body>
</html>

View File

@ -26,9 +26,9 @@
<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>
//必ずアプデ時のremove instance消して //必ずアプデ時のremove instance消して
var ver="Mio (ver.1 beta)"; var ver="Mio (ver.1)";
//betaを入れるとバージョンチェックしない //betaを入れるとバージョンチェックしない
var ver="beta"; //var ver="beta";
var acct_id=0; var acct_id=0;
var tlid=0; var tlid=0;
verck(ver); verck(ver);
@ -282,10 +282,10 @@ var tlid=0;
<textarea id="textarea" class="materialize-textarea unmize" style="margin-bottom:0;" data-length="500"></textarea> <textarea id="textarea" class="materialize-textarea unmize" style="margin-bottom:0;" data-length="500"></textarea>
<label for="textarea" data-trans="toot">トゥート</label> <label for="textarea" data-trans="toot">トゥート</label>
<br> <br>
<span class="sml gray pointer more-show markdown mize" id="preview-btn"> <span class="sml gray pointer markdown mize" id="preview-btn">
<a onclick="preview()">Preview</a> <a onclick="preview()">Preview</a>
</span> </span>
<span class="sml gray pointer more-show anti-markdown hide mize"> <span class="sml gray pointer anti-markdown mize">
<a onclick="mdToggle()">Markdownエディタを表示</a> <a onclick="mdToggle()">Markdownエディタを表示</a>
</span> </span>
<span id="suggest"></span> <span id="suggest"></span>
@ -722,30 +722,3 @@ var tlid=0;
<script type="text/javascript" src="./js/emoji/emojipack.js"></script> <script type="text/javascript" src="./js/emoji/emojipack.js"></script>
<script type="text/javascript" src="./js/emoji/default-emoji.js"></script> <script type="text/javascript" src="./js/emoji/default-emoji.js"></script>
<script type="text/javascript" src="./js/platform/end.js"></script> <script type="text/javascript" src="./js/platform/end.js"></script>
<!--
<script type="text/javascript" src="https://dme0ih8comzn4.cloudfront.net/imaging/v2/editor.js"></script>
<script type="text/javascript">
//Adobeエディターのセットアップ関数
function set_adbe_image(){
//<body>内の画像要素を取得
var image = document.getElementById('imgmodal');
//画像編集エディタを利用するための準備
var Editor = new Aviary.Feather({
apiKey: 'ffee425017ab44b18ce95dab98a5cdc1',
language: 'ja',
onSave: function(imageID, newURL) {
console.log(newURL);
},
});
//画像要素をクリックしたら、「編集エディタ」を表示
image.addEventListener('click', function () {
Editor.launch({
//<img>内のidとsrcを取得
image: image.id,
url: image.src
});
});
}
//エディター動作割り当てる
set_adbe_image();
</script>-->

View File

@ -9,8 +9,8 @@ var idata={
"kirishima.cloud":"instance", "kirishima.cloud":"instance",
"kirishima.cloud_name":"アスタルテ", "kirishima.cloud_name":"アスタルテ",
"kirishima.cloud_letters":"6229", "kirishima.cloud_letters":"6229",
"kirishima.cloud_bbcode":"disabled", "kirishima.cloud_bbcode":"enabled",
"kirishima.cloud_markdown":"disabled", "kirishima.cloud_markdown":"enabled",
"minohdon.jp":"instance", "minohdon.jp":"instance",
"minohdon.jp_name":"箕面丼", "minohdon.jp_name":"箕面丼",
"minohdon.jp_letters":"500", "minohdon.jp_letters":"500",

View File

@ -151,6 +151,7 @@ function login(url) {
}else{ }else{
var red = 'thedesk://manager'; var red = 'thedesk://manager';
} }
console.log(red);
localStorage.setItem("redirect", red); localStorage.setItem("redirect", red);
var start = "https://" + url + "/api/v1/apps"; var start = "https://" + url + "/api/v1/apps";
var httpreq = new XMLHttpRequest(); var httpreq = new XMLHttpRequest();

View File

@ -121,6 +121,23 @@ function parse(obj, mix, acct_id, tlid, popup) {
var times=[]; var times=[];
Object.keys(obj).forEach(function(key) { Object.keys(obj).forEach(function(key) {
var toot = obj[key]; var toot = obj[key];
var dis_name=escapeHTML(toot.account.display_name);
if(toot.account.emojis){
var actemojick = toot.account.emojis[0];
}else{
var actemojick=false;
}
//絵文字があれば
if (actemojick) {
Object.keys(toot.account.emojis).forEach(function(key5) {
var emoji = toot.account.emojis[key5];
var shortcode = emoji.shortcode;
var emoji_url = '<img src="' + emoji.url +
'" class="emoji-img" data-emoji="'+shortcode+'">';
var regExp = new RegExp(":" + shortcode + ":", "g");
dis_name = dis_name.replace(regExp, emoji_url);
});
}
if (mix == "notf") { if (mix == "notf") {
if (toot.type == "mention") { if (toot.type == "mention") {
var what = "が返信しました"; var what = "が返信しました";
@ -143,7 +160,7 @@ function parse(obj, mix, acct_id, tlid, popup) {
'absolute') + '(通知された時間)"><i class="fa fa-clock-o"></i>' + date(toot.created_at, 'absolute') + '(通知された時間)"><i class="fa fa-clock-o"></i>' + date(toot.created_at,
datetype) + datetype) +
'</span><a onclick="udg(\'' + toot.account.id + '</span><a onclick="udg(\'' + toot.account.id +
'\',\'' + acct_id + '\')" class="pointer">' + escapeHTML(toot.account.display_name) + '\',\'' + acct_id + '\')" class="pointer">' + dis_name +
"(" + toot.account.acct + "(" + toot.account.acct +
")</a>" + what; ")</a>" + what;
var notice = noticetext; var notice = noticetext;
@ -164,6 +181,23 @@ function parse(obj, mix, acct_id, tlid, popup) {
} }
var if_notf='data-notfIndv="'+acct_id+"_"+toot.id+'"'; var if_notf='data-notfIndv="'+acct_id+"_"+toot.id+'"';
var toot = toot.status; var toot = toot.status;
var dis_name=escapeHTML(toot.account.display_name);
if(toot.account.emojis){
var actemojick = toot.account.emojis[0];
}else{
var actemojick=false;
}
//絵文字があれば
if (actemojick) {
Object.keys(toot.account.emojis).forEach(function(key5) {
var emoji = toot.account.emojis[key5];
var shortcode = emoji.shortcode;
var emoji_url = '<img src="' + emoji.url +
'" class="emoji-img" data-emoji="'+shortcode+'">';
var regExp = new RegExp(":" + shortcode + ":", "g");
dis_name = dis_name.replace(regExp, emoji_url);
});
}
}else{ }else{
var if_notf=""; var if_notf="";
if (toot.reblog) { if (toot.reblog) {
@ -173,7 +207,7 @@ function parse(obj, mix, acct_id, tlid, popup) {
}else if(localStorage.getItem("domain_" + acct_id)=="mstdn.osaka" && !locale){ }else if(localStorage.getItem("domain_" + acct_id)=="mstdn.osaka" && !locale){
rebtxt = "がしばいた"; rebtxt = "がしばいた";
} }
var notice = escapeHTML(toot.account.display_name) + "(" + toot.account.acct + var notice = dis_name + "(" + toot.account.acct +
")"+rebtxt+"<br>"; ")"+rebtxt+"<br>";
var boostback = "shared"; var boostback = "shared";
var toot = toot.reblog; var toot = toot.reblog;
@ -284,7 +318,7 @@ function parse(obj, mix, acct_id, tlid, popup) {
spoil = spoil.replace(regExp, emoji_url); spoil = spoil.replace(regExp, emoji_url);
}); });
} }
var dis_name=escapeHTML(toot.account.display_name);
//デフォ絵文字 //デフォ絵文字
content=emojione.unicodeToImage(content); content=emojione.unicodeToImage(content);
if(dis_name){ if(dis_name){
@ -411,7 +445,7 @@ function parse(obj, mix, acct_id, tlid, popup) {
if(worde){ if(worde){
var word=worde.tag; var word=worde.tag;
var regExp = new RegExp( word, "g" ) ; var regExp = new RegExp( word, "g" ) ;
if(content.match(regExp)){ if($.strip_tags(content).match(regExp)){
boostback = "hide"; boostback = "hide";
} }
} }

View File

@ -87,7 +87,24 @@ function udg(user, acct_id) {
utl(json.id, '', acct_id); utl(json.id, '', acct_id);
flw(json.id, '', acct_id); flw(json.id, '', acct_id);
fer(json.id, '', acct_id); fer(json.id, '', acct_id);
$("#his-name").text(json.display_name); var dis_name=escapeHTML(json.display_name);
if(json.emojis){
var actemojick = json.emojis[0];
}else{
var actemojick=false;
}
//絵文字があれば
if (actemojick) {
Object.keys(json.emojis).forEach(function(key5) {
var emoji = json.emojis[key5];
var shortcode = emoji.shortcode;
var emoji_url = '<img src="' + emoji.url +
'" class="emoji-img" data-emoji="'+shortcode+'">';
var regExp = new RegExp(":" + shortcode + ":", "g");
dis_name = dis_name.replace(regExp, emoji_url);
});
}
$("#his-name").html(dis_name);
$("#his-acct").text(json.acct); $("#his-acct").text(json.acct);
$("#his-acct").attr("fullname",fullname); $("#his-acct").attr("fullname",fullname);
$("#his-prof").attr("src", json.avatar); $("#his-prof").attr("src", json.avatar);

View File

@ -399,7 +399,7 @@ ipc.on('nano', function (e, x, y) {
const options = { const options = {
type: 'info', type: 'info',
title: 'Adobeフォトエディタ', title: 'Adobeフォトエディタ',
message: "「許可」または「永続的に許可」をクリックするとTheDeskとAdobeで情報を共有します。", message: "「許可」または「永続的に許可」をクリックするとTheDeskとAdobeで情報を共有します。\n次のウィンドウを開いている時以外は一切提供しません。",
buttons: ['拒否', '許可','永続的に許可'] buttons: ['拒否', '許可','永続的に許可']
} }
dialog.showMessageBox(options, function(index) { dialog.showMessageBox(options, function(index) {

View File

@ -1,6 +1,6 @@
{ {
"name": "TheDesk", "name": "TheDesk",
"version": "15.0.0", "version": "15.1.0",
"description": "TheDesk on Mastodonはシンプルと多機能を両立したデスクトップ向けクライアントです", "description": "TheDesk on Mastodonはシンプルと多機能を両立したデスクトップ向けクライアントです",
"main": "main.js", "main": "main.js",
"scripts": { "scripts": {

View File

@ -1 +1 @@
{"warn":"これはGCPにアップして下さい","warn2":"これはGCPにアップして下さい","warn3":"これはGCPにアップして下さい","desk":"Mizuki (ver.7)","date":"2018-04-17","detail":"内部V:14.7.0|バグ修正・内部構成の変更"} {"warn":"これはGCPにアップして下さい","warn2":"これはGCPにアップして下さい","warn3":"これはGCPにアップして下さい","desk":"Mio (ver.1)","date":"2018-05-10","detail":"内部V:15.1.0|Adobeフォトエディタ/UI変更"}