You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.8 KiB
67 lines
1.8 KiB
{{define "scripts"}}
|
|
<script src="/webassets/vue.min.js"></script>
|
|
<script src="/webassets/axios.min.js"></script>
|
|
<script src="/webassets/vue-toasted.min.js"></script>
|
|
|
|
<script>
|
|
Vue.use(Toasted);
|
|
String.prototype.capitalize = function() {
|
|
return this.charAt(0).toUpperCase() + this.slice(1);
|
|
}
|
|
const limit = 300;
|
|
function checkUseMore(){
|
|
let elements = document.getElementsByClassName("useMore");
|
|
|
|
for (let index = 0; index < elements.length; index++) {
|
|
const element = elements[index];
|
|
let display = element.style.display;
|
|
let originalText = element.textContent;
|
|
if (originalText.length <= limit) {
|
|
continue;
|
|
}
|
|
let newText = originalText.substr(0, limit);
|
|
|
|
let newElement = document.createElement(element.tagName);
|
|
newElement.textContent = newText;
|
|
|
|
newElement.classList.add("short-version");
|
|
element.classList.add("long-version");
|
|
|
|
let more = document.createElement("a");
|
|
more.textContent = " show more";
|
|
more.style.cursor = "pointer";
|
|
more.onclick = function () {
|
|
element.style.display = display;
|
|
newElement.style.display = "none";
|
|
};
|
|
|
|
let less = document.createElement("a");
|
|
less.textContent = " show less";
|
|
less.style.cursor = "pointer";
|
|
less.onclick = function () {
|
|
element.style.display = "none";
|
|
newElement.style.display = display;
|
|
};
|
|
|
|
newElement.appendChild(more);
|
|
element.appendChild(less);
|
|
|
|
element.parentNode.insertBefore(newElement, element.nextSibling);
|
|
element.style.display = "none";
|
|
}
|
|
}
|
|
checkUseMore();
|
|
|
|
function openPlayer(itemId,podcastId){
|
|
let url="/player?";
|
|
if(itemId){
|
|
url+="&itemId="+itemId
|
|
}
|
|
if(podcastId){
|
|
url+="&podcastId="+podcastId
|
|
}
|
|
const player= window.open(url,"podgrab_player");
|
|
}
|
|
</script>
|
|
{{end}}
|