function mediaattachments_template(status) { let media_views = ""; if(status.media_attachments[0].remote_url != null) { status.media_attachments[0].url = status.media_attachments[0].remote_url; } if ( status.media_attachments[0].url === "/files/original/missing.png" ) { return ""; } else if ( !status.sensitive ) { media_views = `
`; } else { media_views = `
Sensitive content Click to view
`; } if ( status.media_attachments[0].type === "video" | status.media_attachments[0].type === "gifv" ) { media_views += (`
`); } else { if ( status.media_attachments.length <= 2 ) { for ( let i in status.media_attachments ) { if(status.media_attachments[i].remote_url != null) { status.media_attachments[i].url = status.media_attachments[i].remote_url; } media_views += (`
`); } } else { for ( let i in status.media_attachments ) { if (Number(i) === 1) { if(status.media_attachments[i].remote_url != null) { status.media_attachments[i].url = status.media_attachments[i].remote_url; } media_views += (`
`); } else { media_views += (`
`); } } media_views += "
"; } media_views += "
"; } return media_views; } function timeline_template(status) { if (status.reblog === null) { for(i=0;i"); } const status_account_link= getRelativeURL(status.account.url, status.account.id), status_datetime= getRelativeDatetime(Date.now(), getConversionedDate(null, status.created_at)), status_attr_datetime = getConversionedDate(null, status.created_at); let alart_text= "", article_option= "", toot_reblogs_count= "", toot_favourites_count = "", media_views = ""; if ( status.spoiler_text ) { alart_text = ""+status.spoiler_text+"", article_option = "content_warning"; } if (status.reblogs_count) { toot_reblogs_count = status.reblogs_count; } if (status.favourites_count) { toot_favourites_count = status.favourites_count; } if ( status.media_attachments.length ) { media_views = mediaattachments_template(status); } if(status.account.display_name.length == 0) { status.account.display_name = status.account.username; } switch(status.visibility) { case "public":toot_privacy_mode="Public";toot_privacy_icon="globe";break; case "unlisted":toot_privacy_mode="Unlisted";toot_privacy_icon="unlock-alt";break; case "private":toot_privacy_mode="Followers-only";toot_privacy_icon="lock";break; case "direct":toot_privacy_mode="Direct";toot_privacy_icon="envelope";break; } if(toot_privacy_icon == "globe" || toot_privacy_icon == "unlock-alt") { toot_footer_width = " style='width:320px'"; toot_reblog_button = (`
`); } else { toot_footer_width = ""; toot_reblog_button = ""; } const html=(`
  • ${alart_text} ${status.content} ${media_views}
    ${toot_reblog_button}
  • `); return $(html) } else { for(i=0;i"); } const status_datetime= getRelativeDatetime(Date.now(), getConversionedDate(null, status.reblog.created_at)), status_attr_datetime = getConversionedDate(null, status.reblog.created_at), status_reblog_account_link = getRelativeURL(status.reblog.account.url, status.reblog.account.id), status_account_link= getRelativeURL(status.account.url, status.account.id); let alart_text= "", article_option= "", toot_reblogs_count= "", toot_favourites_count = "", media_views = ""; if ( status.reblog.spoiler_text ) { alart_text = ""+status.reblog.spoiler_text+"", article_option = "content_warning"; } if (status.reblog.reblogs_count) { toot_reblogs_count = status.reblog.reblogs_count; } if (status.reblog.favourites_count) { toot_favourites_count = status.reblog.favourites_count; } if ( status.reblog.media_attachments.length ) { media_views = mediaattachments_template(status.reblog); } if(status.account.display_name.length == 0) { status.account.display_name = status.account.username; } if(status.reblog.account.display_name.length == 0) { status.reblog.account.display_name = status.reblog.account.username; } switch(status.reblog.visibility) { case "public":toot_privacy_mode="Public";toot_privacy_icon="globe";break; case "unlisted":toot_privacy_mode="Unlisted";toot_privacy_icon="unlock-alt";break; } const html = (`
  • ${alart_text} ${status.reblog.content} ${media_views}
  • `); return $(html) } } function notifications_template(NotificationObj) { const notice_author_link = getRelativeURL(NotificationObj.account.url, NotificationObj.account.id); if(NotificationObj.account.display_name.length == 0) { NotificationObj.account.display_name = NotificationObj.account.username; } if ( NotificationObj.type === 'favourite' | NotificationObj.type === 'reblog' ) { const toot_author_link = getRelativeURL(NotificationObj.status.account.url, NotificationObj.status.account.id), toot_datetime= getRelativeDatetime(Date.now(), getConversionedDate(null, NotificationObj.status.created_at)), toot_attr_datetime = getConversionedDate(null, NotificationObj.status.created_at); if( NotificationObj.type=='favourite' ){ for(i=0;i"); } const html = (`
  • ${NotificationObj.status.content}

  • `); return $(html); } else if ( NotificationObj.type === 'reblog' ) { for(i=0;i"); } const sid= NotificationObj.status.id, html = (`
  • ${NotificationObj.status.content}

  • `); return $(html); } } else if ( NotificationObj.type === 'mention' ) { const toot_author_link = getRelativeURL(NotificationObj.status.account.url, NotificationObj.status.account.id), toot_datetime= getRelativeDatetime(Date.now(), getConversionedDate(null, NotificationObj.status.created_at)), toot_attr_datetime = getConversionedDate(null, NotificationObj.status.created_at); let alart_text= "", article_option= "", toot_reblogs_count= "", toot_favourites_count = "", media_views = ""; for(i=0;i"); } if (NotificationObj.status.spoiler_text) { alart_text = ''+NotificationObj.status.spoiler_text+'', article_option = 'content_warning'; } if (NotificationObj.status.reblogs_count) { toot_reblogs_count = NotificationObj.status.reblogs_count; } if (NotificationObj.status.favourites_count) { toot_favourites_count = NotificationObj.status.favourites_count; } if (NotificationObj.status.media_attachments.length) { media_views = mediaattachments_template(NotificationObj.status); } if(NotificationObj.status.account.display_name.length == 0) { NotificationObj.status.account.display_name = NotificationObj.status.account.username; } switch(NotificationObj.status.visibility) { case "public":toot_privacy_mode="Public";toot_privacy_icon="globe";break; case "unlisted":toot_privacy_mode="Unlisted";toot_privacy_icon="unlock-alt";break; case "private":toot_privacy_mode="Followers-only";toot_privacy_icon="lock";break; case "direct":toot_privacy_mode="Direct";toot_privacy_icon="envelope";break; } if(toot_privacy_icon == "globe" || toot_privacy_icon == "unlock-alt") { toot_footer_width = " style='width:320px'"; toot_reblog_button = (`
    `); } else { toot_footer_width = ""; toot_reblog_button = ""; } const html=(`
  • ${alart_text} ${NotificationObj.status.content} ${media_views}
    ${toot_reblog_button}
  • `); return $(html); } else { const html=(`
  • `); return $(html); } } function follows_template(AccountObj) { const array = AccountObj.url.split('/'), profile_link = '/'+array[array.length-1]+'@'+array[array.length-2]+'?mid='+AccountObj.id+'&'; if(AccountObj.display_name.length == 0) { AccountObj.display_name = AccountObj.username; } const html = (` `); return $(html) } function status_template(status, class_options) { if ( status.reblog === null ) { const status_account_link= getRelativeURL(status.account.url, status.account.id), status_datetime= getConversionedDate(null, status.created_at), status_attr_datetime = getConversionedDate(null, status.created_at); let alart_text= "", article_option= "", toot_reblogs_count= "", toot_favourites_count = "", media_views = ""; for(i=0;i"); } if (status.spoiler_text) { alart_text = ''+status.spoiler_text+'', article_option = 'content_warning'; } if (status.reblogs_count) { toot_reblogs_count = status.reblogs_count; } if (status.favourites_count) { toot_favourites_count = status.favourites_count; } if (status.media_attachments.length) { media_views = mediaattachments_template(status); } if(status.account.display_name.length == 0) { status.account.display_name = status.account.username; } checked_public = ""; checked_unlisted = ""; checked_private = ""; checked_direct = ""; switch(status.visibility) { case "public":toot_privacy_mode="Public";toot_privacy_icon="globe";checked_public=" checked";break; case "unlisted":toot_privacy_mode="Unlisted";toot_privacy_icon="unlock-alt";checked_unlisted=" checked";break; case "private":toot_privacy_mode="Followers-only";toot_privacy_icon="lock";checked_private=" checked";break; case "direct":toot_privacy_mode="Direct";toot_privacy_icon="envelope";checked_direct=" checked";break; } if(toot_privacy_icon == "globe" || toot_privacy_icon == "unlock-alt") { toot_footer_width = " style='width:320px'"; toot_reblog_button = (`
    `); } else { toot_footer_width = ""; toot_reblog_button = ""; } const html=(`
    ${htmlEscape(status.account.display_name)} @${status.account.acct}
    ${alart_text} ${status.content} ${media_views}
    ${toot_reblog_button}
    `); history.pushState(null, null, getRelativeURL(status.account.url, status.account.id, '/status/'+status.id)); return $(html) } else { const status_datetime= getConversionedDate(null, status.reblog.created_at), status_attr_datetime = getConversionedDate(null, status.reblog.created_at), status_reblog_account_link = getRelativeURL(status.reblog.account.url, status.reblog.account.id), status_account_link= getRelativeURL(status.reblog.account.url, status.reblog.account.id); let alart_text= "", article_option= "", toot_reblogs_count= "", toot_favourites_count = "", media_views = ""; for(i=0;i"); } if (status.spoiler_text) { alart_text = ''+status.reblog.spoiler_text+'', article_option = 'content_warning'; } if (status.reblog.reblogs_count) { toot_reblogs_count = status.reblog.reblogs_count; } if (status.reblog.favourites_count) { toot_favourites_count = status.reblog.favourites_count; } if(status.reblog.media_attachments.length){ media_views = mediaattachments_template(status.reblog); } if(status.account.display_name.length == 0) { status.account.display_name = status.account.username; } if(status.reblog.account.display_name.length == 0) { status.reblog.account.display_name = status.reblog.account.username; } checked_public = ""; checked_unlisted = ""; switch(status.reblog.visibility) { case "public":toot_privacy_mode="Public";toot_privacy_icon="globe";checked_public=" checked";break; case "unlisted":toot_privacy_mode="Unlisted";toot_privacy_icon="unlock-alt";checked_unlisted=" checked";break; } const html=(`
    `); history.pushState(null, null, getRelativeURL(status.reblog.account.url, status.reblog.id, '/status/'+status.reblog.id)); return $(html) } } function media_template(status, mediaURL) { if ( !status ) { const html = (`
    `); return $(html) } else { const status_template = timeline_template(status).html(), html = (`
    ${status_template}
    `); return $(html) } } function context_template(status, class_options) { if ( status.reblog === null ) { const status_account_link= getRelativeURL(status.account.url, status.account.id), status_datetime= getRelativeDatetime(Date.now(), getConversionedDate(null, status.created_at)), status_attr_datetime = getConversionedDate(null, status.created_at); let alart_text= "", article_option= "", toot_reblogs_count= "", toot_favourites_count = "", media_views = ""; for(i=0;i"); } if ( status.spoiler_text ) { alart_text = ''+status.spoiler_text+'', article_option = 'content_warning'; } if (status.reblogs_count) { toot_reblogs_count = status.reblogs_count; } if (status.favourites_count) { toot_favourites_count = status.favourites_count; } if( status.media_attachments.length) { media_views = mediaattachments_template(status); } if(status.account.display_name.length == 0) { status.account.display_name = status.account.username; } switch(status.visibility) { case "public":toot_privacy_mode="Public";toot_privacy_icon="globe";break; case "unlisted":toot_privacy_mode="Unlisted";toot_privacy_icon="unlock-alt";break; case "private":toot_privacy_mode="Followers-only";toot_privacy_icon="lock";break; case "direct":toot_privacy_mode="Direct";toot_privacy_icon="envelope";break; } if(toot_privacy_icon == "globe" || toot_privacy_icon == "unlock-alt") { toot_footer_width = " style='width:320px'"; toot_reblog_button = (`
    `); } else { toot_footer_width = ""; toot_reblog_button = ""; } const html=(`
    ${htmlEscape(status.account.display_name)} @${status.account.acct}
    ${alart_text} ${status.content} ${media_views}
    ${toot_reblog_button}
    `); return $(html) } else { const status_datetime= getRelativeDatetime(Date.now(), getConversionedDate(null, status.reblog.created_at)), status_attr_datetime = getConversionedDate(null, status.reblog.created_at), status_reblog_account_link = getRelativeURL(status.reblog.account.url, status.reblog.account.id), status_account_link= getRelativeURL(status.account.url, status.account.id); let alart_text= "", article_option= "", toot_reblogs_count= "", toot_favourites_count = "", media_views = ""; for(i=0;i"); } if ( status.spoiler_text ) { alart_text = ''+status.reblog.spoiler_text+'', article_option = 'content_warning'; } if (status.reblog.reblogs_count) { toot_reblogs_count = status.reblog.reblogs_count; } if (status.reblog.favourites_count) { toot_favourites_count = status.reblog.favourites_count; } if (status.reblog.media_attachments.length) { media_views = mediaattachments_template(status.reblog); } if(status.account.display_name.length == 0) { status.account.display_name = status.account.username; } if(status.reblog.account.display_name.length == 0) { status.reblog.account.display_name = status.reblog.account.username; } switch(status.reblog.visibility) { case "public":toot_privacy_mode="Public";toot_privacy_icon="globe";break; case "unlisted":toot_privacy_mode="Unlisted";toot_privacy_icon="unlock-alt";break; } const html=(`
    ${htmlEscape(status.reblog.account.display_name)} @${status.reblog.account.acct}
    ${alart_text} ${status.reblog.content} ${media_views}
    `); return $(html) } }