Vue.component('nicon', {
template: `
`,
props : ['name']
})
Vue.component('rnav', {
template: `
`,
props : ['tag'],
methods: {
toggle() {
vm.$data.isFresh = false
this.tag.isTrue = !this.tag.isTrue
}
}
})
Vue.component('ritem', {
template: `
`,
props : {
tags: Array,
fresh: Boolean
}
})
Vue.component('rssdate', {
template: `
`,
computed : {
pubDate () {
const date = new Date()
return date.toUTCString()
}
}
})
Vue.component('copyme', {
template: `
`,
data() {
return {
isCopied: false
}
},
methods : {
copyToClipboard() {
const textToCopy = this.$refs.copyThis;
const range = document.createRange();
range.selectNode(textToCopy);
window.getSelection().removeAllRanges();
window.getSelection().addRange(range);
document.execCommand('copy');
window.getSelection().removeAllRanges();
this.copyDone();
},
copyDone(){
this.isCopied = true;
this.$refs.element.addEventListener('animationend', () => {
this.isCopied = false;
});
}
}
})
Vue.component('ppbut' ,{
template : `
`,
data () {
return {
isPlaying : false
}
},
props: ['audiourl'],
methods: {
pp (e) {
if (!this.isPlaying) {
this.mutePage();
this.isPlaying = !this.isPlaying;
this.$refs.audioElm.load();
this.$refs.audioElm.play();
this.$refs.audioElm.addEventListener("ended",
function() {
this.isPlaying = false;
console.log(this.isPlaying);
alert("The audio has ended");
});
} else {
this.isPlaying = !this.isPlaying;
this.$refs.audioElm.pause();
}
},
mutePage () {
var x = document.getElementsByTagName("audio");
var i;
for (i = 0; i < x.length; i++) {
x[i].pause();
}
var y = document.getElementsByClassName("ppbut");
for (i = 0; i < y.length; i++) {
y[i].classList.remove("playing");
}
}
}
})
let vm = new Vue({
data () {
return {
name: 'test',
check: 'check2',
isFresh: true,
tags: {
arts: { isTrue: false },
tech: { isTrue: false },
afk: { isTrue: false },
science: { isTrue: false },
zet: { isTrue: false },
cinema: { isTrue: false },
music: { isTrue: false },
compo: { isTrue: false },
writing: { isTrue: false },
creativity: { isTrue: false },
selfhost: { isTrue: false },
web: { isTrue: false },
privacy: { isTrue: false },
productivity: { isTrue: false },
mental: { isTrue: false },
general: { isTrue: false }
}
}
}
}).$mount('#root')