mirror of
https://git.wownero.com/wownero/wownero-funding-system.git
synced 2024-08-15 00:53:45 +00:00
Cleanup some comments javascript
This commit is contained in:
parent
f8dbd59f05
commit
bd9270c92d
2 changed files with 18 additions and 25 deletions
|
@ -585,6 +585,7 @@ ul.b {
|
||||||
max-width:500px;
|
max-width:500px;
|
||||||
max-height:600px;
|
max-height:600px;
|
||||||
display: inline;
|
display: inline;
|
||||||
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.wow_addy{
|
.wow_addy{
|
||||||
|
|
|
@ -180,11 +180,14 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
let regexp_url = /^[a-zA-Z0-9.:\/]+$/;
|
let regexp_xss = /^[a-zA-Z0-9.:\/]+$/;
|
||||||
let regexp_address = /(W[o|W][a-zA-Z0-9]{95})/g;
|
let regexp_address = /(W[o|W][a-zA-Z0-9]{95})/g;
|
||||||
|
let regexp_imgur = /(https:\/\/i.imgur.com\/[a-zA-Z]{0,7}.[jpg|png|gif|webm]+)/g;
|
||||||
|
let regexp_imgflip = /(https:\/\/i.imgflip.com\/[a-zA-Z0-9]{0,7}.[jpg|png|gif|webm]+)/g;
|
||||||
let truncated_addy = function(obj){ return `<span data-addy="${obj}" class="wow_addy">${obj.substring(0, 4)}...${obj.slice(-4)}</span>`; }
|
let truncated_addy = function(obj){ return `<span data-addy="${obj}" class="wow_addy">${obj.substring(0, 4)}...${obj.slice(-4)}</span>`; }
|
||||||
|
|
||||||
function rich_addy(obj) {
|
function rich_addy(obj) {
|
||||||
|
// richtext addy's
|
||||||
let html = obj.html();
|
let html = obj.html();
|
||||||
var matches = html.match(regexp_address);
|
var matches = html.match(regexp_address);
|
||||||
if(matches) {
|
if(matches) {
|
||||||
|
@ -196,30 +199,19 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function rich_img(obj) {
|
function rich_img(obj) {
|
||||||
let content = obj.html();
|
// convert images to <img>
|
||||||
//let x = obj.attr('data-id');
|
let html = obj.html();
|
||||||
//if(x == 52){
|
//let uid = obj.attr('data-id');
|
||||||
// debugger;
|
var matches = html.match(regexp_imgur) || [];
|
||||||
//}
|
matches = matches.concat(html.match(regexp_imgflip));
|
||||||
|
if(matches) {
|
||||||
let spl = content.split(' ');
|
matches.filter(function (value, index, self) {
|
||||||
let lines = [];
|
return self.indexOf(value) === index && typeof value === 'string';
|
||||||
spl.forEach(function (line) {
|
}).forEach(function (obj) {
|
||||||
line = line.trim();
|
html = html.replace(new RegExp(obj, 'g'), `<br><img src="${obj}"/></a><br>`)
|
||||||
if (line && line.search(regexp_url) != -1 && line.indexOf("..") < 0) {
|
|
||||||
if (line.startsWith('https://i.imgflip.com/')) {
|
|
||||||
line = `<br><img src="${line}"/></a><br>`;
|
|
||||||
} else if (line.startsWith('https://i.imgur.com/')) {
|
|
||||||
line = `<br><img src="${line}"/></a><br>`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (line) {
|
|
||||||
lines.push(line);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
obj.html(lines.join(" "));
|
obj.html(html);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).on('click', '.wow_addy', function(event){
|
$(document).on('click', '.wow_addy', function(event){
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue