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.
78 lines
2.6 KiB
78 lines
2.6 KiB
WMarkDown.WMonitor = function(wmarkdown){
|
|
|
|
const self = this;
|
|
let started = false;
|
|
|
|
const construct = () => {};
|
|
|
|
this.start = () => {
|
|
|
|
if(started)
|
|
return;
|
|
started = true;
|
|
|
|
self.build();
|
|
|
|
};
|
|
|
|
this.build = () => {
|
|
|
|
const blocks = [];
|
|
|
|
wmarkdown.item_self.querySelectorAll("[data-wmonitor][data-status=unloaded]").forEach(item => {
|
|
|
|
item.setAttribute("data-status", "loading");
|
|
item.innerHTML = (`
|
|
<form method="post" action="#" onsubmit="return false">
|
|
<fieldset>
|
|
<legend data-i18n="monitor">Monitor</legend>
|
|
<ul>
|
|
<li class="likes" data-value="0" data-i18n="likes" data-i18n-without="true" title="Likes" onclick="` + wmarkdown.object_name + `.wmonitor.set_like(this, event);">
|
|
<span data-icon="likes"></span>
|
|
<span class="value">0</span>
|
|
</li>
|
|
<li class="dislikes" data-value="0" data-i18n="dislikes" data-i18n-without="true" title="Dislikes" onclick="` + wmarkdown.object_name + `.wmonitor.set_dislike(this, event);">
|
|
<span data-icon="dislikes"></span>
|
|
<span class="value">0</span>
|
|
</li>
|
|
<li class="views" data-value="0" data-i18n="views" data-i18n-without="true" title="Views">
|
|
<span data-icon="views"></span>
|
|
<span class="full">0</span>
|
|
</li>
|
|
<li class="comments" data-value="0" data-i18n="comments" data-i18n-without="true" title="Comments" onclick="` + wmarkdown.object_name + `.wmonitor.view_comments(this, event);">
|
|
<span data-icon="comments"></span>
|
|
<span class="value">0</span>
|
|
</li>
|
|
</ul>
|
|
</fieldset>
|
|
</form>
|
|
`);
|
|
blocks.push(item.getAttribute("data-wmonitor"));
|
|
|
|
});
|
|
|
|
console.log(blocks);
|
|
|
|
};
|
|
|
|
this.set_like = (item, event) => {
|
|
|
|
console.log("like");
|
|
|
|
};
|
|
|
|
this.set_dislike = (item, event) => {
|
|
|
|
console.log("dislike");
|
|
|
|
};
|
|
|
|
this.view_comments = (item, event) => {
|
|
|
|
console.log("comments");
|
|
|
|
};
|
|
|
|
construct();
|
|
|
|
};
|
|
|