TheDesk Miho (ver.11)

This commit is contained in:
cutls
2018-02-14 01:19:44 +09:00
parent 1d92abf550
commit 1dd2ea1faa
11 changed files with 75 additions and 16 deletions

View File

@@ -109,6 +109,8 @@ function media(b64, type) {
}
todc();
$("#toot-post-btn").prop("disabled", false);
$("#post-acct-sel").prop("disabled", true);
Materialize.toast("ファイルアップロード後はアカウントを切り替えられません。", 1000);
});
}

View File

@@ -68,6 +68,7 @@ function clear() {
$("#cw").removeClass("cw-avail");
$("#rec").text("いいえ");
$("#mec").text("なし");
$("#post-acct-sel").prop("disabled", false);
var vis = localStorage.getItem("vis");
if (!vis) {
$("#vis").text("public");

View File

@@ -125,6 +125,7 @@ function parseNotf(obj, popup, tlid, acct_id) {
if (popup >= 0 && obj.length < 5) {
Materialize.toast(noticetext, popup * 1000);
$(".notf-icon_" + tlid).addClass("red-text");
notftext="";
}
if (toot.spoiler_text && cw) {
var spoiler = "cw cw_hide_" + toot.id;
@@ -161,7 +162,7 @@ function parseNotf(obj, popup, tlid, acct_id) {
} else {
var sense = ""
}
viewer = viewer + '<a onclick="imgv(\''+id+'\',\''+key2+'\')" id="'+id+'-image-'+key2+'" data-url="'+url+'" data-type="'+media.type+'" class="img-parsed"><img src="' + purl + '" class="' + sense +
viewer = viewer + '<a onclick="imgv(\''+id+'\',\''+key2+'\','+acct_id+')" id="'+id+'-image-'+key2+'" data-url="'+url+'" data-type="'+media.type+'" class="img-parsed"><img src="' + purl + '" class="' + sense +
' toot-img pointer" style="width:'+cwdt+'%"></a></span>';
});
} else {

View File

@@ -95,7 +95,7 @@ function parse(obj, mix, acct_id) {
var emoji = toot.emojis[key5];
var shortcode = emoji.shortcode;
var emoji_url = '<img src="' + emoji.url +
'" style="width:2em" class="emoji-img">';
'" style="width:1em" class="emoji-img">';
var regExp = new RegExp(":" + shortcode + ":", "g");
content = content.replace(regExp, emoji_url);
});
@@ -113,7 +113,7 @@ function parse(obj, mix, acct_id) {
} else {
var sense = ""
}
viewer = viewer + '<a onclick="imgv(\''+id+'\',\''+key2+'\')" id="'+id+'-image-'+key2+'" data-url="'+url+'" data-type="'+media.type+'" class="img-parsed"><img src="' + purl + '" class="' + sense +
viewer = viewer + '<a onclick="imgv(\''+id+'\',\''+key2+'\','+acct_id+')" id="'+id+'-image-'+key2+'" data-url="'+url+'" data-type="'+media.type+'" class="img-parsed"><img src="' + purl + '" class="' + sense +
' toot-img pointer" style="width:'+cwdt+'%"></a></span>';
});
} else {

View File

@@ -1,9 +1,11 @@
/*イメージビューワー*/
//postのimg.jsとは異なります。
function imgv(id, key) {
function imgv(id, key, acct_id) {
$('#imgmodal').attr('src', './img/loading.svg');
var murl = $("#" + id + "-image-" + key).attr("data-url");
var type = $("#" + id + "-image-" + key).attr("data-type");
$("#imagemodal").attr("data-id",id);
$("#imagemodal").attr("data-acct",acct_id);
$(document).ready(function() {
if (type == "image") {
$('#imgmodal').attr('src', murl);
@@ -20,8 +22,28 @@ function imgv(id, key) {
element.onload = function() {
var width = element.naturalWidth;
var height = element.naturalHeight;
$("#imgmodal").attr('width', width);
$("#imagemodal").css('height', "calc(100vh - 20px)");
var windowH = $(window).height();
var windowW = $(window).width();
var aspect = width/height;
if(height > width){
//縦長
$("#imgmodal").css('height',windowH-60+"px");
var imgW = (windowH-50)/height*width;
$("#imgmodal").css('width',imgW+"px");
$("#imagewrap").css('height',windowH-50+"px");
$("#imagemodal").css('height',windowH+"px");
$("#imagewrap").css('width',imgW+50+"px");
$("#imagemodal").css('width',imgW+50+"px");
}else{
//横長・正方形
$("#imgmodal").css('width',windowW-30+"px");
var imgH = (windowW-50)/width*height;
$("#imgmodal").css('height',imgH+"px");
$("#imagewrap").css('width',windowW+"px");
$("#imagemodal").css('width',windowW+"px");
$("#imagewrap").css('height',imgH+60+"px");
$("#imagemodal").css('height',imgH+120+"px");
}
}
if ($("#" + id + "-image-" + (key * 1 + 1)).length == 0) {
$("#image-next").prop("disabled", true);
@@ -40,7 +62,6 @@ function imgv(id, key) {
function imgCont(type) {
var key = $('#imagemodal').attr('data-key');
var id = $('#imagemodal').attr('data-id');
if (type == "next") {
key++;
} else if (type == "prev") {
@@ -65,8 +86,28 @@ function imgCont(type) {
element.onload = function() {
var width = element.naturalWidth;
var height = element.naturalHeight;
$("#imgmodal").attr('width', width);
$("#imagemodal").css('height', "calc(100vh - 20px)");
var windowH = $(window).height();
var windowW = $(window).width();
var aspect = width/height;
if(height > width){
//縦長
$("#imgmodal").css('height',windowH-60+"px");
var imgW = (windowH-50)/height*width;
$("#imgmodal").css('width',imgW+"px");
$("#imagewrap").css('height',windowH-50+"px");
$("#imagemodal").css('height',windowH+"px");
$("#imagewrap").css('width',imgW+50+"px");
$("#imagemodal").css('width',imgW+50+"px");
}else{
//横長・正方形
$("#imgmodal").css('width',windowW-30+"px");
var imgH = (windowW-50)/width*height;
$("#imgmodal").css('height',imgH+"px");
$("#imagewrap").css('width',windowW+"px");
$("#imagemodal").css('width',windowW+"px");
$("#imagewrap").css('height',imgH+60+"px");
$("#imagemodal").css('height',imgH+120+"px");
}
}
if ($("#" + id + "-image-" + (key * 1 + 1)).length == 0) {
$("#image-next").prop("disabled", true);
@@ -88,7 +129,10 @@ function imgCont(type) {
function zoom(z) {
var wdth = $('#imagewrap img').width();
var wdth = wdth * z;
$('#imagewrap img').attr("width", wdth);
$('#imagewrap img').css("width", wdth+"px");
var hgt = $('#imagewrap img').height();
var hgt = hgt * z;
$('#imagewrap img').css("height", hgt+"px");
}
//スマホ対応ドラッグ移動システム
(function() {
@@ -167,3 +211,9 @@ element.onmousewheel = function(e) {
zoom(0.9)
}
}
function detFromImg(){
var id=$("#imagemodal").attr("data-id");
var acct_id=$("#imagemodal").attr("data-acct");
$('#imagemodal').modal('close');
details(id,acct_id);
}

View File

@@ -9,6 +9,7 @@ function Rtoggle(){
}
function Rplay(url,name){
$("#radio").attr('src',url);
r.type = "audio/mpeg";
r.load();
r.play();
$("#radio").addClass("play");