@@ -491,10 +491,9 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
if ( urlCont ) {
urlindv = urlindv . replace ( /[.*+?^=!:${}()|[\]\/\\]/g , "\\$&" )
var encoded = encodeURI ( urlCont [ 4 ] )
var punycoded = "xn--" + punycode . encode ( urlCont [ 2 ] )
var punycoded = "xn--" + punycode . encode ( urlCont [ 2 ] )
var eUrl = urlCont [ 1 ] + "://" + punycoded + "." + urlCont [ 3 ] + "/" + encoded
var regExp = new RegExp ( 'href="' + urlindv + '"' , "g" )
console . log ( eUrl , regExp )
content = content . replace ( regExp , 'href="' + eUrl + '"' )
}
}
@@ -542,60 +541,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
'"><i class="far fa-calendar-times"></i>' +
ended + '</span></div>' ;
}
if ( toot . emojis ) {
var emojick = toot . emojis [ 0 ] ;
} else {
var emojick = false ;
}
//絵文字があれば
if ( emojick ) {
Object . keys ( toot . emojis ) . forEach ( function ( key5 ) {
var emoji = toot . emojis [ key5 ] ;
var shortcode = emoji . shortcode ;
var emoji _url = '<img draggable="false" src="' + emoji . url +
'" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': ">' ;
var regExp = new RegExp ( ":" + shortcode + ":" , "g" ) ;
content = content . replace ( regExp , emoji _url ) ;
spoil = spoil . replace ( regExp , emoji _url ) ;
poll = poll . replace ( regExp , emoji _url ) ;
} ) ;
}
//ニコフレ絵文字
if ( toot . profile _emojis ) {
var nicoemojick = toot . profile _emojis [ 0 ] ;
} else {
var nicoemojick = false ;
}
//絵文字があれば(nico)
if ( nicoemojick ) {
Object . keys ( toot . profile _emojis ) . forEach ( function ( keynico ) {
var emoji = toot . profile _emojis [ keynico ] ;
var shortcode = emoji . shortcode ;
var emoji _url = '<img draggable="false" src="' + emoji . url +
'" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': ">' ;
var regExp = new RegExp ( ":" + shortcode + ":" , "g" ) ;
content = content . replace ( regExp , emoji _url ) ;
spoil = spoil . replace ( regExp , emoji _url ) ;
poll = poll . replace ( regExp , emoji _url ) ;
} ) ;
}
//デフォ絵文字
content = twemoji . parse ( content ) ;
if ( dis _name ) {
dis _name = twemoji . parse ( dis _name ) ;
}
if ( spoil ) {
spoil = twemoji . parse ( spoil ) ;
}
if ( noticetext ) {
noticetext = twemoji . parse ( noticetext ) ;
}
if ( notice ) {
notice = twemoji . parse ( notice ) ;
}
if ( poll ) {
poll = twemoji . parse ( poll ) ;
}
var mediack = toot . media _attachments [ 0 ] ;
//メディアがあれば
var media _ids = "" ;
@@ -611,8 +557,8 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
if ( toot . sensitive && nsfw ) {
var sense = "sensitive"
var blur = media . blurhash
nsfwmes = '<div class="nsfw-media">' + lang . lang _parse _nsfw + '</div>'
if ( blur ) {
nsfwmes = '<div class="nsfw-media">' + lang . lang _parse _nsfw + '</div>'
purl = parseBlur ( blur )
var sense = ""
}
@@ -625,7 +571,7 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
acct _id + ')" id="' + id + '-image-' + key2 + '" data-url="' + url +
'" data-type="video" class="img-parsed"><video src="' +
purl + '" class="' + sense +
' toot-img pointer" style="max-width:100%;"></a></span>' ;
' toot-img pointer" style="max-width:100%;" loop="true" ></a></span>' ;
} else {
if ( media . type == "unknown" ) {
viewer = viewer + '<a href="' + media . remote _url + '" title="' + media . remote _url + '">[' + lang . lang _parse _unknown + ']</a> '
@@ -777,6 +723,60 @@ function parse(obj, mix, acct_id, tlid, popup, mutefilter, type) {
}
} ) ;
}
if ( toot . emojis ) {
var emojick = toot . emojis [ 0 ] ;
} else {
var emojick = false ;
}
//絵文字があれば
if ( emojick ) {
Object . keys ( toot . emojis ) . forEach ( function ( key5 ) {
var emoji = toot . emojis [ key5 ] ;
var shortcode = emoji . shortcode ;
var emoji _url = '<img draggable="false" src="' + emoji . url +
'" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': ">' ;
var regExp = new RegExp ( ":" + shortcode + ":" , "g" ) ;
content = content . replace ( regExp , emoji _url ) ;
spoil = spoil . replace ( regExp , emoji _url ) ;
poll = poll . replace ( regExp , emoji _url ) ;
} ) ;
}
//ニコフレ絵文字
if ( toot . profile _emojis ) {
var nicoemojick = toot . profile _emojis [ 0 ] ;
} else {
var nicoemojick = false ;
}
//絵文字があれば(nico)
if ( nicoemojick ) {
Object . keys ( toot . profile _emojis ) . forEach ( function ( keynico ) {
var emoji = toot . profile _emojis [ keynico ] ;
var shortcode = emoji . shortcode ;
var emoji _url = '<img draggable="false" src="' + emoji . url +
'" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': ">' ;
var regExp = new RegExp ( ":" + shortcode + ":" , "g" ) ;
content = content . replace ( regExp , emoji _url ) ;
spoil = spoil . replace ( regExp , emoji _url ) ;
poll = poll . replace ( regExp , emoji _url ) ;
} ) ;
}
//デフォ絵文字
content = twemoji . parse ( content ) ;
if ( dis _name ) {
dis _name = twemoji . parse ( dis _name ) ;
}
if ( spoil ) {
spoil = twemoji . parse ( spoil ) ;
}
if ( noticetext ) {
noticetext = twemoji . parse ( noticetext ) ;
}
if ( notice ) {
notice = twemoji . parse ( notice ) ;
}
if ( poll ) {
poll = twemoji . parse ( poll ) ;
}
//日本語じゃない
if ( toot . language != lang . language && toot . language ) {
var trans = '<div class="action pin"><a onclick="trans(\'' + toot . language + '\',\'' + lang . language + '\')" class="waves-effect waves-dark btn-flat actct" style="padding:0" title="' + lang . lang _parse _trans + '"><i class="material-icons">g_translate</i></a></div>' ;
@@ -913,119 +913,122 @@ function userparse(obj, auth, acct_id, tlid, popup) {
var datetype = localStorage . getItem ( "datetype" ) ;
Object . keys ( obj ) . forEach ( function ( key ) {
var toot = obj [ key ] ;
console . log ( [ "Parsing" , toot ] )
if ( ! toot . username ) {
var raw = toot ;
toot = toot . accoun t;
var n otf = true ;
} else {
var notf = fa lse;
}
if ( toot . locked ) {
var locked = ' <i class="fas fa-lock red-text"></i>' ;
} else {
var locked = "" ;
}
if ( auth == "request" ) {
var authhtml = '<i class="material-icons gray pointer" onclick="request(\'' +
toot . id + '\',\'authorize\',' + acct _id + ')" title="Accept">person_add</i> <i class="material-icons gray pointer" onclick="request(\'' +
toot . id + '\',\'reject\',' + acct _id + ')" title="Reject">person_add_disabled</i>' ;
} else {
var authhtml = "" ;
}
var ftxt = lang . lang _parse _followed ;
if ( ! locale && localStorage . getItem ( "followlocale_" + acct _id ) ) {
ftxt = localStorage . getItem ( "followlocale_" + acct _id ) ;
}
if ( popup > 0 || popup == - 1 || notf ) {
var notftext = ftxt + '<br>' ;
} else {
var notftext = "" ;
}
var memory = localStorage . getItem ( "notice-mem" ) ;
if ( popup >= 0 && obj . length < 5 && notftext != memory ) {
M . toast ( { html : escapeHTML ( toot . display _name ) + ":" + ftxt , displayLength : popup * 1000 } )
$ ( ".notf-icon_" + tlid ) . addClass ( "red-text" ) ;
localStorage . setItem ( "notice-mem" , notftext ) ;
notftext = "" ;
var native = localStorage . getItem ( "nativenotf" ) ;
if ( ! native ) {
native = "yes" ;
if ( toot ) {
console . log ( [ "Parsing" , toot ] )
if ( ! toot . username ) {
var raw = too t ;
to ot = toot . account ;
var notf = true ;
} e lse {
var notf = false ;
}
if ( native == "yes" ) {
var os = localStorage . getItem ( "platform" ) ;
var options = {
body : toot . display _name + "(" + toot . acct + ") " + ftxt ,
icon : toot . avatar
} ;
var domain = localStorage . getItem ( "domain_" + acct _id ) ;
if ( os == "darwin" ) {
var n = new Notification ( 'TheDesk:' + domain , options ) ;
} else {
var nativeNotfOpt = [
'TheDesk:' + domain ,
toot . display _name + "(" + toot . acct + ")" + ftxt ,
toot . avatar ,
"userdata" ,
acct _id ,
to ot . id
]
postMessage ( [ "nativeNotf" , nativeNotfOpt ] , "*" )
if ( toot . locked ) {
var locked = ' <i class="fas fa-lock red-text"></i>' ;
} else {
var locked = "" ;
}
if ( auth == "request" ) {
var authhtml = '<i class="material-icons gray pointer" onclick="request(\'' +
toot . id + '\',\'authorize\',' + acct _id + ')" title="Accept">person_add</i> <i class="material-icons gray pointer" onclick="request(\'' +
toot . id + '\',\'reject\',' + acct _id + ')" title="Reject">person_add_disabled</i>' ;
} else {
var authhtml = "" ;
}
var ftxt = lang . lang _parse _followed ;
if ( ! locale && localStorage . getItem ( "followlocale_" + acct _id ) ) {
ftxt = localStorage . getItem ( "followlocale_" + acct _id ) ;
}
if ( popup > 0 || popup == - 1 || n otf ) {
var notftext = ftxt + '<br>' ;
} else {
var notftext = "" ;
}
var memory = localStorage . getItem ( "notice-mem" ) ;
if ( popup >= 0 && obj . length < 5 && notftext != memory ) {
M . toast ( { html : escapeHTML ( toot . display _name ) + ":" + ftxt , displayLength : popup * 1000 } )
$ ( ".notf-icon_" + tlid ) . addClass ( "red-text" ) ;
localStorage . setItem ( "notice-mem" , notftext ) ;
notftext = "" ;
var native = localStorage . getItem ( "nativenotf" ) ;
if ( ! native ) {
native = "yes" ;
}
if ( native == "yes" ) {
var os = localStorage . getItem ( "platform" ) ;
var options = {
body : toot . display _name + "(" + toot . acct + ")" + ftxt ,
icon : toot . avatar
} ;
var domain = localStorage . getItem ( "domain_" + acct _id ) ;
if ( os == "darwin" ) {
var n = new Notification ( 'TheDesk:' + domain , options ) ;
} else {
var nativeNotfOpt = [
'TheDesk:' + domain ,
toot . display _name + "(" + toot . acct + ")" + ftxt ,
toot . avatar ,
"userdata" ,
acct _id ,
toot . id
]
postMessage ( [ "nativeNotf" , nativeNotfOpt ] , "*" )
}
}
}
}
if ( toot . display _name ) {
var dis _name = escapeHTML ( toot . display _name ) ;
} else {
var dis _name = toot . username ;
}
//ネイティブ通知
if ( toot . display _name ) {
var dis _name = escapeHTML ( toot . display _name ) ;
} else {
var dis _name = toot . username ;
}
//ネイティブ通知
if ( toot . emojis ) {
var actemojick = toot . emojis [ 0 ] ;
} else {
var actemojick = false ;
}
//絵文字があれば
if ( actemojick ) {
Object . keys ( toot . emojis ) . forEach ( function ( key5 ) {
var emoji = toot . emojis [ key5 ] ;
var shortcode = emoji . shortcode ;
var emoji _url = '<img draggable="false" src="' + emoji . url +
'" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': ">' ;
var regExp = new RegExp ( ":" + shortcode + ":" , "g" ) ;
dis _name = dis _name . replace ( regExp , emoji _url ) ;
} ) ;
}
if ( dis _name ) {
dis _name = twemoji . parse ( dis _name ) ;
}
if ( toot . avatar ) {
var avatar = toot . avatar ;
} else {
var avatar = "../../img/missing.svg" ;
if ( toot . emojis ) {
var actemojick = toot . emojis [ 0 ] ;
} else {
var actemojick = false ;
}
//絵文字があれば
if ( actemojick ) {
Object . keys ( toot . emojis ) . forEach ( function ( key5 ) {
var emoji = toot . emojis [ key5 ] ;
var shortcode = emoji . shortcode ;
var emoji _url = '<img draggable="false" src="' + emoji . url +
'" class="emoji-img" data-emoji="' + shortcode + '" alt=" :' + shortcode + ': ">' ;
var regExp = new RegExp ( ":" + shortcode + ":" , "g" ) ;
dis _name = dis _name . replace ( regExp , emoji _url ) ;
} ) ;
}
if ( dis _name ) {
dis _name = twemoji . parse ( dis _name ) ;
}
if ( toot . avatar ) {
var avatar = toot . avatar ;
} else {
var avatar = "../../img/missing.svg" ;
}
templete = templete +
'<div class="cvo" style="padding-top:5px;" user-id="' + toot . id + '"><div class="area-notice">' +
notftext +
'</div><div class="area-icon"><a onclick="udg(\'' + toot . id + '\',' +
acct _id + ');" user="' + toot . acct + '" class="udg">' +
'<img draggable="false" src="' + avatar + '" width="40" class="prof-img" user="' + toot
. acct + '"></a></div>' +
'<div class="area-display_name"><div class="flex-name"><span class="user">' +
dis _name + '</span>' +
'<span class="sml gray" style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;user-select:auto; cursor:text;"> @' +
toot . acct + locked + '</span>' +
'</div>' +
'</div>' +
'<div style="justify-content:space-around" class="area-toot"> <div class="cbadge" style="width:100px;">Follows:' +
toot . following _count +
'</div><div class="cbadge" style="width:100px;">Followers:' + toot . followers _count +
'</div>' + authhtml +
'</div>' +
'</div>' +
'</div>' ;
}
templete = templete +
'<div class="cvo" style="padding-top:5px;" user-id="' + toot . id + '"><div class="area-notice">' +
notftext +
'</div><div class="area-icon"><a onclick="udg(\'' + toot . id + '\',' +
acct _id + ');" user="' + toot . acct + '" class="udg">' +
'<img draggable="false" src="' + avatar + '" width="40" class="prof-img" user="' + toot
. acct + '"></a></div>' +
'<div class="area-display_name"><div class="flex-name"><span class="user">' +
dis _name + '</span>' +
'<span class="sml gray" style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;user-select:auto; cursor:text;"> @' +
toot . acct + locked + '</span>' +
'</div>' +
'</div>' +
'<div style="justify-content:space-around" class="area-toot"> <div class="cbadge" style="width:100px;">Follows:' +
toot . following _count +
'</div><div class="cbadge" style="width:100px;">Followers:' + toot . followers _count +
'</div>' + authhtml +
'</div>' +
'</div>' +
'</div>' ;
} ) ;
return templete ;
@@ -1046,7 +1049,6 @@ function client(name) {
showCloseButton : true ,
focusConfirm : false ,
} ) . then ( ( result ) => {
console . log ( result )
if ( result . dismiss == "cancel" ) {
//Emp
var cli = localStorage . getItem ( "client_emp" ) ;