From 3b42dcf64852063809c6b3fad055fa26d36ac7ff Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Fri, 30 Jul 2021 11:12:45 +0530 Subject: [PATCH 01/55] Update about.css --- css/about.css | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/css/about.css b/css/about.css index e7dc3c4..1cf6ebf 100644 --- a/css/about.css +++ b/css/about.css @@ -12,13 +12,13 @@ html{ } @keyframes boing { 0% { - bottom: 3rem; + bottom: 5%; } 50% { bottom: 0; } 100% { - bottom: 3rem; + bottom: 5%; } } .bg-tr, .bg-tr-h:hover { @@ -59,3 +59,8 @@ html{ text-align: center !important; } } +@media (min-width: 320px){ + iframe { + width: auto; + } +} From a046d53684e2fbe59b267a1c389f2dcc6881887d Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Sat, 31 Jul 2021 19:35:39 +0530 Subject: [PATCH 02/55] Update index.html --- index.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 91400af..cc2f0a5 100644 --- a/index.html +++ b/index.html @@ -315,7 +315,7 @@
-
+
@@ -337,7 +337,7 @@
-
+
From 1380586ed9d3545382c6dc96a5eafcf83c0ffdbe Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Sat, 31 Jul 2021 20:21:35 +0530 Subject: [PATCH 03/55] Update main.js --- js/main.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/js/main.js b/js/main.js index 3225b57..27107f7 100644 --- a/js/main.js +++ b/js/main.js @@ -267,7 +267,7 @@ function postLike(){ username, permlink, author, - 10, + 10000, function (response) { if (response.success == true){ document.querySelector('#post-like path').setAttribute("d","M8 1.314C12.438-3.248 23.534 4.735 8 15-7.534 4.736 3.562-3.248 8 1.314z"); @@ -379,7 +379,7 @@ function getContent(u,p,type) { if (type == "reply") { var body = r.body; pushPost(u,p,body,'',lc,children) - document.querySelector("#post-tray .modal-body .post-img").innerHTML = '
'+md.render(body)+'
' + document.querySelector("#post-tray .modal-body .post-img").innerHTML = '
'+md.render(body)+'
' } else if (type == "video") { var video = JSON.parse(r.json_metadata).video[0] @@ -517,9 +517,9 @@ function followToggle(ele) { } } -getFeed(); +getNew(); function getFeed () { - hive.api.getDiscussionsByFeed({ tag: username, limit: 35, truncate_body: 1,} , function(err,res){ + hive.api.getDiscussionsByFeed({ tag: username, limit: 100, truncate_body: 1,} , function(err,res){ if ( err === null ) { filterTag(res,"feed"); } else{console.log(err);} @@ -551,7 +551,7 @@ document.querySelectorAll('a[href="#profile"]').forEach(function(ele){ });}); function getBlog(u){ - hive.api.getDiscussionsByBlog({tag: u, limit: 35, truncate_body: 1,}, function(err,res) { + hive.api.getDiscussionsByBlog({tag: u, limit: 100, truncate_body: 1,}, function(err,res) { if (err === null) { pushProfile(res); } else {console.log(err);} @@ -585,7 +585,13 @@ function getNotifications () { if(not === undefined) { console.log(not) }else { - eleNot.innerHTML += '
'+not.msg+'
'; + let x; + if ( not.type = reply ) { + x = "&reply"; + } else { + x = ""; + } + eleNot.innerHTML += '
'+not.msg+'
'; } counter = counter + 1; @@ -709,7 +715,7 @@ if (json.video) { }else { src = json.image.toString() } - type.innerHTML += '
Image not found
'+ res[counter].active_votes.length+'' + res[counter].children +'

' + md.render(json.description) + '

#' + json.tags.toString().replaceAll(",",' #') + '

Last updated on ' + res[counter].last_update.replace("T", " ") + ' utc

' ; + type.innerHTML += '
Image not found
'+ res[counter].active_votes.length+'' + res[counter].children +'

' + md.render(json.description) + '

#' + json.tags.toString().replaceAll(",",' #') + '

Last updated on ' + res[counter].last_update.replace("T", " ") + ' utc

' ; } window.addEventListener("load",function(){ From 6f62ea02b2bc77589532880814bf21fe87f8ab3b Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Sat, 31 Jul 2021 20:37:05 +0530 Subject: [PATCH 04/55] Update main.js --- js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/main.js b/js/main.js index 27107f7..179371f 100644 --- a/js/main.js +++ b/js/main.js @@ -591,7 +591,7 @@ function getNotifications () { } else { x = ""; } - eleNot.innerHTML += '
'+not.msg+'
'; + eleNot.innerHTML += '
'+not.msg+'
'; } counter = counter + 1; From b0ed35c3de56e1ac9ea12ed34848342f7143ddb1 Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Sat, 31 Jul 2021 20:41:39 +0530 Subject: [PATCH 05/55] Update main.js --- js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/main.js b/js/main.js index 179371f..4ef596a 100644 --- a/js/main.js +++ b/js/main.js @@ -586,7 +586,7 @@ function getNotifications () { console.log(not) }else { let x; - if ( not.type = reply ) { + if ( not.type = "reply" ) { x = "&reply"; } else { x = ""; From 0ac0d995487fd0ae1fdd03efeaea6bc61923ef6c Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Mon, 2 Aug 2021 14:26:34 +0530 Subject: [PATCH 06/55] Update main.js --- js/main.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/js/main.js b/js/main.js index 4ef596a..f0e25b9 100644 --- a/js/main.js +++ b/js/main.js @@ -5,9 +5,10 @@ var client = new hivesigner.Client({ }); var loginType = localStorage.getItem('type') var accessToken = localStorage.getItem('token') +var rpc = "https://rpc.ecency.com" client.setAccessToken(accessToken) -hive.api.setOptions({ url: 'https://rpc.ecency.com' }); +hive.api.setOptions({ url: rpc }); var username = localStorage.getItem("username"); var eleHome = document.getElementById("home"); @@ -566,7 +567,7 @@ function getProfileInfo(u) { getNotifications(); function getNotifications () { - var url = "https://rpc.ecency.com"; + var url = rpc; var xhr = new XMLHttpRequest(); xhr.open("POST", url); @@ -591,7 +592,7 @@ function getNotifications () { } else { x = ""; } - eleNot.innerHTML += '
'+not.msg+'
'; + eleNot.innerHTML += '
'+not.msg+'
'; } counter = counter + 1; From 5ce595438da963b61486a037944d88a572a70198 Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Mon, 2 Aug 2021 19:27:02 +0530 Subject: [PATCH 07/55] Create b58.js --- js/b58.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 js/b58.js diff --git a/js/b58.js b/js/b58.js new file mode 100644 index 0000000..2677905 --- /dev/null +++ b/js/b58.js @@ -0,0 +1,27 @@ +function b58 (input) { + var n = StrInt(input); + + var al = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'; + + var res = [] + while ( n > 58 ) { + var r = n % 58; + res.push(al[r]) + n = Math.floor(n/58) + } + + if ( n <= 58 ) { + res.push(al[n]) + } + + const out = res.reverse().toString().replaceAll(",","") + return out; +} + +function StrInt(string) { + var number = "0x"; + var length = string.length; + for (var i = 0; i < length; i++) + number += string.charCodeAt(i).toString(16); + return number; +} From d11880a12e246439682991d563051849d193c04b Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Mon, 2 Aug 2021 21:19:14 +0530 Subject: [PATCH 08/55] Update b58.js --- js/b58.js | 55 ++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 19 deletions(-) diff --git a/js/b58.js b/js/b58.js index 2677905..3f7c8dd 100644 --- a/js/b58.js +++ b/js/b58.js @@ -1,27 +1,44 @@ -function b58 (input) { - var n = StrInt(input); +// Thank you random person from github for this. - var al = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'; +var base58_chars = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; - var res = [] - while ( n > 58 ) { - var r = n % 58; - res.push(al[r]) - n = Math.floor(n/58) - } +const create_base58_map = () => { + const base58M = Array(256).fill(-1) + for (let i = 0; i < base58_chars.length; ++i) + base58M[base58_chars.charCodeAt(i)] = i + + return base58M +} + +const base58Map = create_base58_map() - if ( n <= 58 ) { - res.push(al[n]) +const binary_to_base58 = uint8array => { + const result = [] + + for (const byte of uint8array) { + let carry = byte + for (let j = 0; j < result.length; ++j) { + const x = (base58Map[result[j]] << 8) + carry + result[j] = base58_chars.charCodeAt(x % 58) + carry = (x / 58) | 0 + } + while (carry) { + result.push(base58_chars.charCodeAt(carry % 58)) + carry = (carry / 58) | 0 } + } + + for (const byte of uint8array) + if (byte) break + else result.push('1'.charCodeAt(0)) - const out = res.reverse().toString().replaceAll(",","") - return out; + result.reverse() + + return String.fromCharCode(...result) } -function StrInt(string) { - var number = "0x"; - var length = string.length; - for (var i = 0; i < length; i++) - number += string.charCodeAt(i).toString(16); - return number; +function b58 (input) { + const enc = new TextEncoder(); + const res = binary_to_base58(enc.encode(input)) + return res } From ca7b217bc877e89fcb0bacf75281c956c73148e0 Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Mon, 2 Aug 2021 21:28:10 +0530 Subject: [PATCH 09/55] Update main.js --- js/main.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/js/main.js b/js/main.js index f0e25b9..e5a98de 100644 --- a/js/main.js +++ b/js/main.js @@ -232,13 +232,13 @@ function pushPost(author,permlink,body,image,lc,children) { var imgTray = document.querySelector("#post-tray .modal-body .post-img") imgTray.innerHTML = ""; if (images.length == 1) { - imgTray.innerHTML += '' + imgTray.innerHTML += '' } else if (images.length > 1) { imgTray.innerHTML += '' var i = 0; while ( i < images.length ) { - document.querySelector("#carouselPostControls .carousel-inner").innerHTML += '' + document.querySelector("#carouselPostControls .carousel-inner").innerHTML += '' i = i + 1; } document.querySelector("#carouselPostControls .carousel-inner .carousel-item:first-child").classList.add("active") @@ -254,7 +254,7 @@ function postLike(){ var permlink = rTarg.getAttribute("data-tr-permlink") var likeCountPost = document.getElementById('like-count-post') if (accessToken) { - client.vote(username,author,permlink,10,function(err,res){ + client.vote(username,author,permlink,10000,function(err,res){ if(err === null){ console.log(res); document.querySelector('#post-like path').setAttribute("d","M8 1.314C12.438-3.248 23.534 4.735 8 15-7.534 4.736 3.562-3.248 8 1.314z"); @@ -592,7 +592,7 @@ function getNotifications () { } else { x = ""; } - eleNot.innerHTML += '
'+not.msg+'
'; + eleNot.innerHTML += '
'+not.msg+'
'; } counter = counter + 1; @@ -716,11 +716,11 @@ if (json.video) { }else { src = json.image.toString() } - type.innerHTML += '
Image not found
'+ res[counter].active_votes.length+'' + res[counter].children +'

' + md.render(json.description) + '

#' + json.tags.toString().replaceAll(",",' #') + '

Last updated on ' + res[counter].last_update.replace("T", " ") + ' utc

' ; + type.innerHTML += '
Image not found
'+ res[counter].active_votes.length+'' + res[counter].children +'

' + md.render(json.description) + '

#' + json.tags.toString().replaceAll(",",' #') + '

Last updated on ' + res[counter].last_update.replace("T", " ") + ' utc

' ; } window.addEventListener("load",function(){ - document.getElementById("loader").classList.replace("visible","invisible"); + document.getElementById("loader").classList.replace("visible","invisible"); window.addEventListener("offline",function(){ document.querySelector(".offline-notify").classList.add("offline"); }) From 9fae614b88d488197ec517a711e86996a8da70b3 Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Mon, 2 Aug 2021 21:29:43 +0530 Subject: [PATCH 10/55] Update index.html --- index.html | 1 + 1 file changed, 1 insertion(+) diff --git a/index.html b/index.html index cc2f0a5..ce6e604 100644 --- a/index.html +++ b/index.html @@ -428,6 +428,7 @@ + From 493d121315215b9187713ef32115dbec65bc8a33 Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Tue, 3 Aug 2021 06:52:10 +0530 Subject: [PATCH 11/55] Update index.html --- index.html | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index ce6e604..ab7c472 100644 --- a/index.html +++ b/index.html @@ -37,16 +37,14 @@ - - - - + + @@ -207,7 +205,7 @@ @@ -295,7 +293,7 @@ -
+

- + From 7cb9a2c3495180cab963db4561f153adba738526 Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Tue, 3 Aug 2021 07:25:11 +0530 Subject: [PATCH 12/55] Update main.js --- js/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/main.js b/js/main.js index e5a98de..fd71a3a 100644 --- a/js/main.js +++ b/js/main.js @@ -587,12 +587,12 @@ function getNotifications () { console.log(not) }else { let x; - if ( not.type = "reply" ) { + if ( not.type == "reply" ) { x = "&reply"; } else { x = ""; } - eleNot.innerHTML += '
'+not.msg+'
'; + eleNot.innerHTML += '
'+not.msg+'
'; } counter = counter + 1; From d970a14f0098e1233bfb9b8cd9b2f724440dc45a Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Tue, 3 Aug 2021 07:56:25 +0530 Subject: [PATCH 13/55] Update main.js --- js/main.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/main.js b/js/main.js index fd71a3a..cefdf75 100644 --- a/js/main.js +++ b/js/main.js @@ -694,12 +694,12 @@ function pushProfile (res) { if (img === undefined) {console.log(counter);} else if (res[counter].category == 'trhome') { eleProfileGrid.innerHTML += '
'; - document.querySelector('#trImg'+counter).style.backgroundImage = 'url("https://images.ecency.com/0x0/'+img[0]+'")'; + document.querySelector('#trImg'+counter).style.backgroundImage = 'url("https://images.ecency.com/p/'+b58(img[0])+'"?format=webp&mode=fit&width=400")'; } else if (res[counter].category === 'trvideo') { console.log(json.video) eleProfileVideo.innerHTML += '
'; - document.querySelector('#trVid'+counter).style.backgroundImage = 'url("https://images.ecency.com/0x0/'+img[0]+'")'; + document.querySelector('#trVid'+counter).style.backgroundImage = 'url("https://images.ecency.com/p/'+b58(img[0])+'?format=webp&mode=fit&width=400")'; } document.getElementById("loader").classList.replace("visible","invisible") counter = counter + 1; @@ -716,7 +716,7 @@ if (json.video) { }else { src = json.image.toString() } - type.innerHTML += '
Image not found
'+ res[counter].active_votes.length+'' + res[counter].children +'

' + md.render(json.description) + '

#' + json.tags.toString().replaceAll(",",' #') + '

Last updated on ' + res[counter].last_update.replace("T", " ") + ' utc

' ; + type.innerHTML += '
Image not found
'+ res[counter].active_votes.length+'' + res[counter].children +'

' + md.render(json.description) + '

#' + json.tags.toString().replaceAll(",",' #') + '

Last updated on ' + res[counter].last_update.replace("T", " ") + ' utc

' ; } window.addEventListener("load",function(){ From df0150586653b37cdd7a26d28e4bfc25fa170f6e Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Tue, 3 Aug 2021 08:49:03 +0530 Subject: [PATCH 14/55] Update main.js --- js/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/main.js b/js/main.js index cefdf75..213066e 100644 --- a/js/main.js +++ b/js/main.js @@ -694,12 +694,12 @@ function pushProfile (res) { if (img === undefined) {console.log(counter);} else if (res[counter].category == 'trhome') { eleProfileGrid.innerHTML += '
'; - document.querySelector('#trImg'+counter).style.backgroundImage = 'url("https://images.ecency.com/p/'+b58(img[0])+'"?format=webp&mode=fit&width=400")'; + document.querySelector('#trImg'+counter).style.backgroundImage = 'url("https://images.ecency.com/p/'+b58(img[0])+'"?format=webp&mode=fit")'; } else if (res[counter].category === 'trvideo') { console.log(json.video) eleProfileVideo.innerHTML += '
'; - document.querySelector('#trVid'+counter).style.backgroundImage = 'url("https://images.ecency.com/p/'+b58(img[0])+'?format=webp&mode=fit&width=400")'; + document.querySelector('#trVid'+counter).style.backgroundImage = 'url("https://images.ecency.com/p/'+b58(img[0])+'?format=webp&mode=fit")'; } document.getElementById("loader").classList.replace("visible","invisible") counter = counter + 1; From 49e98f9c4b395fc8b42b009e6c5aff692ccd0838 Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Tue, 3 Aug 2021 08:51:15 +0530 Subject: [PATCH 15/55] Update main.js --- js/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/main.js b/js/main.js index 213066e..67d863d 100644 --- a/js/main.js +++ b/js/main.js @@ -694,12 +694,12 @@ function pushProfile (res) { if (img === undefined) {console.log(counter);} else if (res[counter].category == 'trhome') { eleProfileGrid.innerHTML += '
'; - document.querySelector('#trImg'+counter).style.backgroundImage = 'url("https://images.ecency.com/p/'+b58(img[0])+'"?format=webp&mode=fit")'; + document.querySelector('#trImg'+counter).style.backgroundImage = 'url("https://images.ecency.com/p/'+b58(img[0])+'"?format=webp")'; } else if (res[counter].category === 'trvideo') { console.log(json.video) eleProfileVideo.innerHTML += '
'; - document.querySelector('#trVid'+counter).style.backgroundImage = 'url("https://images.ecency.com/p/'+b58(img[0])+'?format=webp&mode=fit")'; + document.querySelector('#trVid'+counter).style.backgroundImage = 'url("https://images.ecency.com/p/'+b58(img[0])+'?format=webp")'; } document.getElementById("loader").classList.replace("visible","invisible") counter = counter + 1; From 109e7822223ab8448ebd7c10a3cb367123f64814 Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Tue, 3 Aug 2021 09:02:23 +0530 Subject: [PATCH 16/55] Update main.css --- css/main.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/css/main.css b/css/main.css index ce37e96..771e2e8 100644 --- a/css/main.css +++ b/css/main.css @@ -2,7 +2,7 @@ .list-group-item { max-width: 42em; } -nav, .card-body, .card-title, .dropdown-item, .text-muted, .satisfy { +nav, .card-title, .dropdown-item, .text-muted, .satisfy { font-family: 'Satisfy', cursive; } .offline-notify{ From 464bc57bde7b673d39ea95d3c9f773699234a34e Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Tue, 3 Aug 2021 09:14:19 +0530 Subject: [PATCH 17/55] Update index.html --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index ab7c472..90a6004 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ - Terrive | Your Door to the Decentralized world. + Terrive | Decentralized Photo and Video Sharing Platform. From 88ff23bfa150cd538e5c0769b3a2b2f427444da5 Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Tue, 3 Aug 2021 09:17:05 +0530 Subject: [PATCH 18/55] Update main.js --- js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/main.js b/js/main.js index 67d863d..1567816 100644 --- a/js/main.js +++ b/js/main.js @@ -432,7 +432,7 @@ function getReplies(u,p){ if(e === null){ var counter = 0; while (counter < r.length){ - document.querySelector("#post-tray .modal-body .post-comment").innerHTML += '
'+r[counter].author+'
'+md.render(r[counter].body)+ 'reply
'; + document.querySelector("#post-tray .modal-body .post-comment").innerHTML += '
'+r[counter].author+'
'+md.render(r[counter].body)+ 'reply
'; counter = counter + 1; } }else{console.log(e);} From d6f6c7d51a036c46317d8208ec14a8aaca5a90cf Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Tue, 3 Aug 2021 09:38:43 +0530 Subject: [PATCH 19/55] Create notify.js --- js/notify.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 js/notify.js diff --git a/js/notify.js b/js/notify.js new file mode 100644 index 0000000..bad18eb --- /dev/null +++ b/js/notify.js @@ -0,0 +1,33 @@ +addEventListener("message", event => { + const [rpc, username] = event.data; + + var xhr = new XMLHttpRequest(); + xhr.open("POST", url); + + xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); + + xhr.onreadystatechange = function () { + if (xhr.readyState === 4) { + console.log(xhr.status); + var json = JSON.parse(xhr.responseText); + while (counter < json.result.length) { + var not = json.result[counter]; + if(not !=== undefined) { + let x; + if ( not.type == "reply" ) { + x = "&reply"; + } else { + x = ""; + } + var notifymsg += '
'+not.msg+'
'; + postMessage(notifymsg) + } + + counter = counter + 1; + } + } + }; + var data = '{"jsonrpc":"2.0", "method":"bridge.account_notifications", "params":{"account": "'+username+'","limit":10}, "id":1}'; + + xhr.send(data); +}); From 027bc23b7d5fc8958d6301bcecd7c3919df0fc50 Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Tue, 3 Aug 2021 09:39:41 +0530 Subject: [PATCH 20/55] Update notify.js --- js/notify.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/notify.js b/js/notify.js index bad18eb..82bdebe 100644 --- a/js/notify.js +++ b/js/notify.js @@ -1,5 +1,6 @@ addEventListener("message", event => { const [rpc, username] = event.data; + var counter = 0; var xhr = new XMLHttpRequest(); xhr.open("POST", url); From de9926eb6dc4eb5fa4d1d297f453bebc5012ea6a Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Tue, 3 Aug 2021 09:50:13 +0530 Subject: [PATCH 21/55] Update main.js --- js/main.js | 54 ++++++++++++++++-------------------------------------- 1 file changed, 16 insertions(+), 38 deletions(-) diff --git a/js/main.js b/js/main.js index 1567816..55cabca 100644 --- a/js/main.js +++ b/js/main.js @@ -495,7 +495,7 @@ function followToggle(ele) { { follower: username, following: account, - what: ['blog'], //null value for unfollow, 'blog' for follow + what: ['blog'], }, ]); @@ -565,46 +565,24 @@ function getProfileInfo(u) { }) } -getNotifications(); -function getNotifications () { - var url = rpc; - - var xhr = new XMLHttpRequest(); - xhr.open("POST", url); - - xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); - - xhr.onreadystatechange = function () { - if (xhr.readyState === 4) { - console.log(xhr.status); - var json = JSON.parse(xhr.responseText); - var counter = 0; - var eleNot = document.getElementById("notify-body"); - eleNot.innerHTML = "" - while (counter < json.result.length) { - var not = json.result[counter]; - if(not === undefined) { - console.log(not) - }else { - let x; - if ( not.type == "reply" ) { - x = "&reply"; - } else { - x = ""; - } - eleNot.innerHTML += '
'+not.msg+'
'; - } - - counter = counter + 1; - } - } - }; - var data = '{"jsonrpc":"2.0", "method":"bridge.account_notifications", "params":{"account": "'+username+'","limit":10}, "id":1}'; +const notifywrkr = work("notify.js"); - xhr.send(data); - +notifywrkr.addEventListener("message",function(e){ + document.getElementById("notify-body").innerHTML += e.data; +}); + +getNotifications(); +function getNotifications() { + document.getElementById("notify-body").innerHTML = ""; + notifywrkr.postMessage([rpc,username]) } + +function work(me) { + var wrkr = new Worker(me); + return wrkr +} + document.querySelectorAll('a[href="#discover"]').forEach(function(ele){ ele.addEventListener('show.bs.tab', function (event) { getNew(); From 3dbf67c9622ac03736d64ac1002195ebebddea3f Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Tue, 3 Aug 2021 09:52:23 +0530 Subject: [PATCH 22/55] Update main.js --- js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/main.js b/js/main.js index 55cabca..73ee5e4 100644 --- a/js/main.js +++ b/js/main.js @@ -565,7 +565,7 @@ function getProfileInfo(u) { }) } -const notifywrkr = work("notify.js"); +const notifywrkr = work("js/notify.js"); notifywrkr.addEventListener("message",function(e){ document.getElementById("notify-body").innerHTML += e.data; From f17c01df188bce3d58c1b70b3a4d6b2b610e19be Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Tue, 3 Aug 2021 09:57:49 +0530 Subject: [PATCH 23/55] Update notify.js --- js/notify.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/notify.js b/js/notify.js index 82bdebe..51a15e3 100644 --- a/js/notify.js +++ b/js/notify.js @@ -13,7 +13,7 @@ addEventListener("message", event => { var json = JSON.parse(xhr.responseText); while (counter < json.result.length) { var not = json.result[counter]; - if(not !=== undefined) { + if(not !== undefined) { let x; if ( not.type == "reply" ) { x = "&reply"; From b1b37d39ea40472b6ccff48178f914adc0d9d46c Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Tue, 3 Aug 2021 09:59:01 +0530 Subject: [PATCH 24/55] Update notify.js --- js/notify.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/notify.js b/js/notify.js index 51a15e3..c60ef5b 100644 --- a/js/notify.js +++ b/js/notify.js @@ -20,7 +20,7 @@ addEventListener("message", event => { } else { x = ""; } - var notifymsg += '
'+not.msg+'
'; + var notifymsg = '
'+not.msg+'
'; postMessage(notifymsg) } From c5a574ca5ff61cbbe20fed8910eec681c1f9ea0b Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Tue, 3 Aug 2021 10:00:52 +0530 Subject: [PATCH 25/55] Update notify.js --- js/notify.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/notify.js b/js/notify.js index c60ef5b..e2679b5 100644 --- a/js/notify.js +++ b/js/notify.js @@ -1,5 +1,5 @@ addEventListener("message", event => { - const [rpc, username] = event.data; + const [url, username] = event.data; var counter = 0; var xhr = new XMLHttpRequest(); From fd667988fad5f83a71a2e758dc9430583a6d6db5 Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Tue, 3 Aug 2021 11:08:31 +0530 Subject: [PATCH 26/55] Update main.js --- js/main.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/js/main.js b/js/main.js index 73ee5e4..5e80cd8 100644 --- a/js/main.js +++ b/js/main.js @@ -447,7 +447,7 @@ function like(id) { var author = eleAuthor.innerHTML; var permlink = eleAuthor.getAttribute("data-tr-permlink"); if (accessToken) { - client.vote(username, author, permlink, 1000, function (err, res) { + client.vote(username, author, permlink, 10000, function (err, res) { if(err === null) { console.log(res) ele.setAttribute("d","M8 1.314C12.438-3.248 23.534 4.735 8 15-7.534 4.736 3.562-3.248 8 1.314z"); @@ -460,7 +460,7 @@ function like(id) { username, permlink, author, - 10, + 10000, function (response) { console.log("voting ..."); console.log(response); @@ -672,12 +672,12 @@ function pushProfile (res) { if (img === undefined) {console.log(counter);} else if (res[counter].category == 'trhome') { eleProfileGrid.innerHTML += '
'; - document.querySelector('#trImg'+counter).style.backgroundImage = 'url("https://images.ecency.com/p/'+b58(img[0])+'"?format=webp")'; + document.querySelector('#trImg'+counter).style.backgroundImage = 'url("https://images.ecency.com/p/'+b58(img[0])+'")'; } else if (res[counter].category === 'trvideo') { console.log(json.video) eleProfileVideo.innerHTML += '
'; - document.querySelector('#trVid'+counter).style.backgroundImage = 'url("https://images.ecency.com/p/'+b58(img[0])+'?format=webp")'; + document.querySelector('#trVid'+counter).style.backgroundImage = 'url("https://images.ecency.com/p/'+b58(img[0])+'")'; } document.getElementById("loader").classList.replace("visible","invisible") counter = counter + 1; @@ -694,7 +694,7 @@ if (json.video) { }else { src = json.image.toString() } - type.innerHTML += '
Image not found
'+ res[counter].active_votes.length+'' + res[counter].children +'

' + md.render(json.description) + '

#' + json.tags.toString().replaceAll(",",' #') + '

Last updated on ' + res[counter].last_update.replace("T", " ") + ' utc

' ; + type.innerHTML += '
Image not found
'+ res[counter].active_votes.length+'' + res[counter].children +'

' + md.render(json.description) + '

#' + json.tags.toString().replaceAll(",",' #') + '

Last updated on ' + res[counter].last_update.replace("T", " ") + ' utc

' ; } window.addEventListener("load",function(){ From b3876dd29ae79aa9d17c4ccb756356887cabe8f9 Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Tue, 3 Aug 2021 11:21:40 +0530 Subject: [PATCH 27/55] Create created.js --- js/created.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 js/created.js diff --git a/js/created.js b/js/created.js new file mode 100644 index 0000000..b805ead --- /dev/null +++ b/js/created.js @@ -0,0 +1,8 @@ +addEventListener("message", event => { + const ha = event.data + ha.getDiscussionsByCreated({tag: 'trhome', limit: 35, truncate_body: 1,} , function(err,res) { + if ( err === null ) { + postMessage(res); + } else {console.log(err);} + }); +}) From 0aee1f5a4fca5be990923da331a60bc2e28825c1 Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Tue, 3 Aug 2021 11:29:33 +0530 Subject: [PATCH 28/55] Update main.js --- js/main.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/js/main.js b/js/main.js index 5e80cd8..9953f56 100644 --- a/js/main.js +++ b/js/main.js @@ -527,13 +527,13 @@ function getFeed () { }); } +const cfwrkr = work("js/created.js") function getNew () { - hive.api.getDiscussionsByCreated({tag: 'trhome', limit: 35, truncate_body: 1,} , function(err,res) { - if ( err === null ) { - filterTag(res,"new"); - } else {console.log(err);} - }); + cfwrkr.postMessage(hive.api) } +cfwrkr.addEventListener("message", e => { + filterTag(e.data,"new"); +}); document.querySelectorAll('a[href="#home"]').forEach(function(ele){ ele.addEventListener('show.bs.tab', function (event) { From 675fb57c789ad926d58b29e1568816b454f86a1c Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Tue, 3 Aug 2021 11:38:05 +0530 Subject: [PATCH 29/55] Update main.js --- js/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/main.js b/js/main.js index 9953f56..2224012 100644 --- a/js/main.js +++ b/js/main.js @@ -527,7 +527,7 @@ function getFeed () { }); } -const cfwrkr = work("js/created.js") +var cfwrkr = work("js/created.js") function getNew () { cfwrkr.postMessage(hive.api) } @@ -565,7 +565,7 @@ function getProfileInfo(u) { }) } -const notifywrkr = work("js/notify.js"); +var notifywrkr = work("js/notify.js"); notifywrkr.addEventListener("message",function(e){ document.getElementById("notify-body").innerHTML += e.data; From ff41bfcdaf888720c223ef087d2917d85338040d Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Tue, 3 Aug 2021 11:39:54 +0530 Subject: [PATCH 30/55] Update main.js --- js/main.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/js/main.js b/js/main.js index 2224012..a58d658 100644 --- a/js/main.js +++ b/js/main.js @@ -527,6 +527,11 @@ function getFeed () { }); } +function work(me) { + var wrkr = new Worker(me); + return wrkr +} + var cfwrkr = work("js/created.js") function getNew () { cfwrkr.postMessage(hive.api) @@ -577,12 +582,6 @@ function getNotifications() { notifywrkr.postMessage([rpc,username]) } - -function work(me) { - var wrkr = new Worker(me); - return wrkr -} - document.querySelectorAll('a[href="#discover"]').forEach(function(ele){ ele.addEventListener('show.bs.tab', function (event) { getNew(); From c4eb5514509d83bafc6ccf1cc90f25f6b1ff21e9 Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Tue, 3 Aug 2021 11:44:23 +0530 Subject: [PATCH 31/55] Update main.js --- js/main.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/js/main.js b/js/main.js index a58d658..7c70eff 100644 --- a/js/main.js +++ b/js/main.js @@ -527,18 +527,14 @@ function getFeed () { }); } -function work(me) { - var wrkr = new Worker(me); - return wrkr -} -var cfwrkr = work("js/created.js") +var cfwrkr = new Worker("js/created.js") +cfwrkr.addEventListener("message", e => { + filterTag(e.data,"new"); +}) function getNew () { cfwrkr.postMessage(hive.api) } -cfwrkr.addEventListener("message", e => { - filterTag(e.data,"new"); -}); document.querySelectorAll('a[href="#home"]').forEach(function(ele){ ele.addEventListener('show.bs.tab', function (event) { @@ -570,7 +566,7 @@ function getProfileInfo(u) { }) } -var notifywrkr = work("js/notify.js"); +var notifywrkr = new Worker("js/notify.js"); notifywrkr.addEventListener("message",function(e){ document.getElementById("notify-body").innerHTML += e.data; From 65898833be2074ba9dcba97f593265818e062c88 Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Tue, 3 Aug 2021 11:53:07 +0530 Subject: [PATCH 32/55] Update main.js --- js/main.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/js/main.js b/js/main.js index 7c70eff..d4c9690 100644 --- a/js/main.js +++ b/js/main.js @@ -54,7 +54,16 @@ function keychainLogin(){ } ); } - + +var cfwrkr = new Worker("js/created.js") + +cfwrkr.addEventListener("message", function(e) { + filterTag(e.data,"new"); +}) +function getNew () { + cfwrkr.postMessage(hive.api) +} + function postTypeSelector(type) { if (type == 'image') { document.getElementById("upload-input-wrap").innerHTML = '
'; @@ -527,15 +536,6 @@ function getFeed () { }); } - -var cfwrkr = new Worker("js/created.js") -cfwrkr.addEventListener("message", e => { - filterTag(e.data,"new"); -}) -function getNew () { - cfwrkr.postMessage(hive.api) -} - document.querySelectorAll('a[href="#home"]').forEach(function(ele){ ele.addEventListener('show.bs.tab', function (event) { getFeed(); From 635ffe23bdd860407cb2f8a2b5603337b9f83b87 Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Tue, 3 Aug 2021 12:55:08 +0530 Subject: [PATCH 33/55] Delete created.js --- js/created.js | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 js/created.js diff --git a/js/created.js b/js/created.js deleted file mode 100644 index b805ead..0000000 --- a/js/created.js +++ /dev/null @@ -1,8 +0,0 @@ -addEventListener("message", event => { - const ha = event.data - ha.getDiscussionsByCreated({tag: 'trhome', limit: 35, truncate_body: 1,} , function(err,res) { - if ( err === null ) { - postMessage(res); - } else {console.log(err);} - }); -}) From 566bcb05feef5e9381a26b9c4f1b201d5e6730a7 Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Tue, 3 Aug 2021 12:55:26 +0530 Subject: [PATCH 34/55] Update main.js --- js/main.js | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/js/main.js b/js/main.js index d4c9690..1707be1 100644 --- a/js/main.js +++ b/js/main.js @@ -55,14 +55,6 @@ function keychainLogin(){ ); } -var cfwrkr = new Worker("js/created.js") - -cfwrkr.addEventListener("message", function(e) { - filterTag(e.data,"new"); -}) -function getNew () { - cfwrkr.postMessage(hive.api) -} function postTypeSelector(type) { if (type == 'image') { @@ -527,7 +519,6 @@ function followToggle(ele) { } } -getNew(); function getFeed () { hive.api.getDiscussionsByFeed({ tag: username, limit: 100, truncate_body: 1,} , function(err,res){ if ( err === null ) { @@ -535,7 +526,13 @@ function getFeed () { } else{console.log(err);} }); } - +function getNew() { + hive.api.getDiscussionsByCreated({tag: 'trhome', limit: 35, truncate_body: 1,} , function(err,res) { + if ( err === null ) { + filterTag(res,"new"); + } else {console.log(err);} + }); +} document.querySelectorAll('a[href="#home"]').forEach(function(ele){ ele.addEventListener('show.bs.tab', function (event) { getFeed(); @@ -693,7 +690,8 @@ if (json.video) { } window.addEventListener("load",function(){ - document.getElementById("loader").classList.replace("visible","invisible"); + document.getElementById("loader").classList.replace("visible","invisible"); + getNew() window.addEventListener("offline",function(){ document.querySelector(".offline-notify").classList.add("offline"); }) From 8892fe613c3e7b415c8e9429d013e7f54f90bba5 Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Wed, 4 Aug 2021 11:16:56 +0530 Subject: [PATCH 35/55] Update main.js --- js/main.js | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/js/main.js b/js/main.js index 1707be1..cc7500f 100644 --- a/js/main.js +++ b/js/main.js @@ -94,6 +94,34 @@ function loadPostPreview(src,id){ } } +var fi = document.getElementById('input-image-ele'); + +fi.addEventListener("change", function(e){ + var txt = document.getElementById('upload-image-url') + var x = ""; + + if (txt.value) { + x = " "; + } + + var f = e.target.files[0] + f.arrayBuffer().then(function (arrayBuffer) { + var b = new Blob([new Uint8Array(arrayBuffer)], {type: "application/octet-stream" }); + var fd = new FormData(); + fd.append('file', b, f.name); + fetch('https://ipfs.infura.io:5001/api/v0/add', { + method: 'POST', + body: fd, + mode: 'cors' + }).then(function(r){ + r.json().then(function(d){ + console.log(d) + txt.value += x + d.Hash + }).catch(function(err){console.log(err);}) + }).catch(function(er){console.log(er);}) + }); +}); + function submitPost(){ var permlink = Math.random().toString(36).substring(2) var descBody = document.getElementById('textbox').value @@ -680,12 +708,12 @@ function push (res,type) { var json = JSON.parse(res[counter].json_metadata); var x ; var src ; -if (json.video) { - src = json.video[0] - x = 'vid' -}else { - src = json.image.toString() -} + if (json.video) { + src = json.video[0] + x = 'vid' + } else { + src = json.image.toString() + } type.innerHTML += '
Image not found
'+ res[counter].active_votes.length+'' + res[counter].children +'

' + md.render(json.description) + '

#' + json.tags.toString().replaceAll(",",' #') + '

Last updated on ' + res[counter].last_update.replace("T", " ") + ' utc

' ; } From 37d10f2bf78cc5096ab7836f2fc8ccb6e5bc4090 Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Wed, 4 Aug 2021 11:47:56 +0530 Subject: [PATCH 36/55] Update index.html --- index.html | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index 90a6004..efa64d9 100644 --- a/index.html +++ b/index.html @@ -194,8 +194,16 @@
-
-
+
+ +
+ +
+
From f1017ce4eb5e3bf06d8c61a0cd3ec0ff845fe3e5 Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Wed, 4 Aug 2021 11:53:27 +0530 Subject: [PATCH 37/55] Update main.js --- js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/main.js b/js/main.js index cc7500f..2d2eb8c 100644 --- a/js/main.js +++ b/js/main.js @@ -116,7 +116,7 @@ fi.addEventListener("change", function(e){ }).then(function(r){ r.json().then(function(d){ console.log(d) - txt.value += x + d.Hash + txt.value += x + "https://ipfs.infura.io/ipfs/" + d.Hash; }).catch(function(err){console.log(err);}) }).catch(function(er){console.log(er);}) }); From 56618828b9743ed0a96df31f561408a3c1b7a3ac Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Wed, 4 Aug 2021 12:03:29 +0530 Subject: [PATCH 38/55] Update main.js --- js/main.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/main.js b/js/main.js index 2d2eb8c..4e53a51 100644 --- a/js/main.js +++ b/js/main.js @@ -58,7 +58,7 @@ function keychainLogin(){ function postTypeSelector(type) { if (type == 'image') { - document.getElementById("upload-input-wrap").innerHTML = '
'; + document.getElementById("upload-input-wrap").innerHTML = '

'; } else if (type == 'video') { document.getElementById("upload-input-wrap").innerHTML = '

'; } @@ -117,6 +117,7 @@ fi.addEventListener("change", function(e){ r.json().then(function(d){ console.log(d) txt.value += x + "https://ipfs.infura.io/ipfs/" + d.Hash; + window.setTimeout(loadPostPreview(txt.value),500); }).catch(function(err){console.log(err);}) }).catch(function(er){console.log(er);}) }); From 3ebc2071b578982acc925e6d3aa303d67e9d8ef1 Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Wed, 4 Aug 2021 13:41:07 +0530 Subject: [PATCH 39/55] Update main.js --- js/main.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/js/main.js b/js/main.js index 4e53a51..6a2393f 100644 --- a/js/main.js +++ b/js/main.js @@ -58,7 +58,7 @@ function keychainLogin(){ function postTypeSelector(type) { if (type == 'image') { - document.getElementById("upload-input-wrap").innerHTML = '

'; + document.getElementById("upload-input-wrap").innerHTML = '

'; } else if (type == 'video') { document.getElementById("upload-input-wrap").innerHTML = '

'; } @@ -132,14 +132,14 @@ function submitPost(){ if(document.getElementById('upload-image-url').value) { var imagelink = document.getElementById('upload-image-url').value.split(" "); - var body = "![]("+imagelink[0]+")

**See this Image on [Terrive](https://terrive.on.fleek.co/?u="+username+"&p="+permlink+")**

"+descBody+"

Posted using [Terrive](https://terrive.on.fleek.co)"; + var body = "[![]("+imagelink[0]+")](https://terrive.on.fleek.co/?u="+username+"&p="+permlink+")

"+descBody+"

Posted using [Terrive](https://terrive.on.fleek.co)"; var jsonMetadata = JSON.stringify({app: "terrive/0.0.0", format: "markdown", description: descBody, tags: taglist, image: imagelink}) broadcastPost(username,permlink,body,jsonMetadata,'trhome') } else if (document.getElementById('upload-video-url').value && document.getElementById('upload-video-url-cover').value ) { taglist.push("trhome") var coverV = document.getElementById('upload-video-url-cover').value; - var bodyVC = "![]("+coverV+")

**See this Video on [Terrive](https://terrive.on.fleek.co/?u="+username+"&p="+permlink+"&video)**

"+descBody+"

Posted using [Terrive](https://terrive.on.fleek.co)"; + var bodyVC = "[![]("+coverV+")](https://terrive.on.fleek.co/?u="+username+"&p="+permlink+"&video)

"+descBody+"

Posted using [Terrive](https://terrive.on.fleek.co)"; var videolinkC = document.getElementById('upload-video-url').value; var jsonMetadataVC = JSON.stringify({app: "terrive/0.0.0", format: "markdown", description: descBody, tags: taglist, image: [coverV], video: [videolinkC],}) broadcastPost(username,permlink,bodyVC,jsonMetadataVC,'trvideo') @@ -147,17 +147,22 @@ function submitPost(){ else if (document.getElementById('upload-video-url').value) { taglist.push("trhome") var alt = 'https://siasky.net/fAHaiIPffem8Qv1XOG08zzOwga8iwqJUhgyOAHfb86FRzg' - var bodyV = "![]("+alt+")

**See this Video on [Terrive](https://terrive.on.fleek.co/?u="+username+"&p="+permlink+"&video)**

"+descBody+"

Posted using [Terrive](https://terrive.on.fleek.co)"; + var bodyV = "[![]("+alt+")](https://terrive.on.fleek.co/?u="+username+"&p="+permlink+"&video)

"+descBody+"

Posted using [Terrive](https://terrive.on.fleek.co)"; var videolink = document.getElementById('upload-video-url').value; var jsonMetadataV = JSON.stringify({app: "terrive/0.0.0", format: "markdown", description: descBody, tags: taglist, image: [alt], video: [videolink],}) broadcastPost(username,permlink,bodyV,jsonMetadataV,'trvideo') } } +function reg(s, n) { + //Thank you StackOverflow !! + var a = s.match(new RegExp('[\\w\\.]+' + '(?:[\\s-]*[\\w\\.]+){0,' + (n - 1) + '}')); + return (a === undefined || a === null) ? '' : a[0]; +} function broadcastPost(u,permlink,body,jsonMetadata,type){ if (accessToken) { - client.comment('',type,u,permlink,permlink,body,jsonMetadata, function (err,res) { + client.comment('',type,u,permlink,reg(body,2),body,jsonMetadata, function (err,res) { if (err === null || err.error_description === undefined){ console.log(res) clearUploadTray(); @@ -168,7 +173,7 @@ function broadcastPost(u,permlink,body,jsonMetadata,type){ } else if (loginType == "keychain") { hive_keychain.requestPost( u, - permlink, + reg(body,2), body, type, '', @@ -218,7 +223,6 @@ document.getElementById('reblogPop').addEventListener('show.bs.modal', function json, 'Reblog a Post', function (response) { - console.log("reblogging ..."); console.log(response); } ); From 0d67ff29717c983259709e0e96037a4d2c7c1574 Mon Sep 17 00:00:00 2001 From: appukuttan66 <72905732+appukuttan66@users.noreply.github.com> Date: Wed, 4 Aug 2021 13:46:39 +0530 Subject: [PATCH 40/55] Update index.html --- index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index efa64d9..4a090c0 100644 --- a/index.html +++ b/index.html @@ -172,7 +172,7 @@
Notifications