Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
PoTTii committed Apr 8, 2021
2 parents 623e082 + 952690a commit b7204df
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"TamperMonkey",
"pr0gramm"
],
"version": "1.6.1",
"version": "1.7.0",
"license": "GPL-3.0",
"dependencies": {
"chart.js": "^2.9.3",
Expand Down
20 changes: 15 additions & 5 deletions src/module/Rep0st.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,23 @@ export default class Rep0st {
this.visible = true;
this.loader.remove();
result.html($(res.responseText));
const images = result.find('.result-list a');
const images = result.find('.search-results a');

let currentPostId = this.getCurrentPostId();
for (let i = 1; i < images.length; i++) {
let postId = parseInt(images[i].href.replace('pr0gramm', '').replace(/\D/g,''));

if(currentPostId !== postId) {
let childrenList = images[i].children[0];

let postUrl = images[i].href;
let probability = childrenList.children[0].innerHTML;
let imgSrc = childrenList.children[1].src;

output.push({
url: images[i].href,
img: images[i].style.backgroundImage.match(/\(([^)]+)\)/)[1]
url: postUrl,
img: imgSrc,
probability: probability,
});
}
}
Expand All @@ -126,8 +133,11 @@ export default class Rep0st {
bar = bar.find('.simplebar-content');

for (let i = 0; i < urls.length; i++) {
let container = bar.append($(`<a href=${urls[i].url} target="_blank"><img src=${urls[i].img} class="rep0st-thumb" /><span title="Als Repost markieren" class="fa fa-comment"></span></a>`));
let comment = container.find(`img[src=${urls[i].img}] + span`)[0];
let probabilityContainer = `<div class="probability">${urls[i].probability}</div>`;

let container = bar.append($(`<a href=${urls[i].url} target="_blank"><img src=${urls[i].img} class="rep0st-thumb" />${probabilityContainer}<span title="Als Repost markieren" class="fa fa-comment"></span></a>`));

let comment = container.find(`img[src='${urls[i].img}'] + span`)[0];

comment.addEventListener('click', (e) => {
e.preventDefault();
Expand Down
13 changes: 13 additions & 0 deletions src/style/rep0st.less
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,16 @@
margin-top: 30px;
width: 15vw;
}

.probability {
position: absolute;
top: 5px;
right: 5px;
font-weight: bold;
color: red;

&:hover {
background-color: black;
padding: 0 4px;
}
}

0 comments on commit b7204df

Please sign in to comment.