Skip to content

Commit

Permalink
Merge pull request #26 from lalka2016/fixes
Browse files Browse the repository at this point in the history
Фиксы
  • Loading branch information
veselcraft authored Sep 29, 2023
2 parents 2374bd3 + 5019cfb commit c8a935b
Show file tree
Hide file tree
Showing 27 changed files with 1,133 additions and 163 deletions.
Binary file modified res/menu_icons.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/note.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified res/ovk_attach.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
80 changes: 71 additions & 9 deletions res/podrobnee.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
let p_bt = document.querySelector('.podrobnee');
let p_content = document.querySelector('.podrobnee_content');
let p_bt = null
let p_content = null
if(document.querySelector('.podrobnee') != null) {

p_bt.addEventListener('click', function(){
let text = ["Показать подробнее", "Скрыть"];
p_bt.innerText = text[Number(p_bt.innerText === text[0])]
p_content.classList.toggle('active');
});
p_bt = document.querySelector('.podrobnee');
p_content = document.querySelector('.podrobnee_content');

u(".post-like-button").on("click", function(e) {
p_bt.addEventListener('click', function(){
let text = ["Показать подробнее", "Скрыть"];
p_bt.innerText = text[Number(p_bt.innerText === text[0])]
p_content.classList.toggle('active');
});
}

/*u(".post-like-button").on("click", function(e) {
e.preventDefault();
var thisBtn = u(this).first();
Expand All @@ -25,4 +30,61 @@ u(".post-like-button").on("click", function(e) {
}
return false;
});
});*/

function mobileRepost(postId) {
let el = document.getElementById("post"+postId+"_actions")
let hash = document.querySelector("meta[name=csrf]").getAttribute("value");

if(document.querySelector("#post"+postId+"_actions #mobile_repost"+postId) == null) {
el.insertAdjacentHTML("beforeend", `
<div class="mobile_repost" id="mobile_repost${postId}">
${tr('your_comment')}:
<textarea name="text" id='uRepostMsgInput_${postId}'></textarea><br/>
<input type="hidden" name="hash" value="${hash}">
<input id="repSubmit" class="button" type="button" value="${tr('send')}">
</div>
`)

repSubmit.onclick = () => {
text = document.querySelector("#uRepostMsgInput_"+postId).value;
type = "wall";

let xhr = new XMLHttpRequest()
xhr.open("POST", "/wall"+postId+"/repost?hash="+encodeURIComponent(hash), true);
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xhr.onload = (function() {
if(xhr.responseText.indexOf("wall_owner") === -1) {
el.innerHTML = "can't repost"
} else {
let jsonR = JSON.parse(xhr.responseText);
location.href = "/wall" + jsonR.wall_owner
}
});

xhr.send('text='+encodeURI(text) + '&type='+type);
}
} else {
document.getElementById("post"+postId+"_actions").innerHTML = ""
}
}

if(document.querySelector("#_noteDelete") != null) {
document.querySelector("#_noteDelete").addEventListener("click", (e) => {
let link = e.currentTarget.href
let hash = document.querySelector("meta[name=csrf]").getAttribute("value")
let id = e.currentTarget.dataset.id

let xhr = new XMLHttpRequest()
xhr.open("POST", link)
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');

xhr.onload = () => {
location.href = "/notes"+id
}

xhr.send('hash='+encodeURIComponent(hash));

e.preventDefault()
})
}
Binary file added res/youtube_video.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit c8a935b

Please sign in to comment.