0.0.11
This commit is contained in:
@@ -39,9 +39,28 @@ function renderContent () {
|
||||
data: JSON.stringify(data),
|
||||
success: function(data){
|
||||
document.querySelector(".content").innerHTML = data.html
|
||||
replaceHrefOnOnclick()
|
||||
},
|
||||
error: function (data){
|
||||
alert(data)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function replaceHrefOnOnclick () {
|
||||
let elements = document.querySelectorAll('.section_btn')
|
||||
let i = 0
|
||||
elements.forEach(function (){
|
||||
let cur_el = elements[i]
|
||||
if (cur_el.attributes.hasOwnProperty("href")){
|
||||
let str = cur_el.outerHTML
|
||||
let str_f_replace = cur_el.href
|
||||
str_f_replace = str_f_replace.replace(`${window.location.origin}`,'')
|
||||
str_f_replace = `href="${str_f_replace}"`
|
||||
str = str.replace(str_f_replace,'')
|
||||
str = str.replace('"target="_blank""','')
|
||||
cur_el.outerHTML = str
|
||||
}
|
||||
i++
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user