Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <template id="query-ignore-embed">
- <i aria-hidden="true" id="ignorePlugin" class="fa" v-bind:class="getClass()" v-bind:title="getTitle()" v-on:click="onIgnore"></i>
- </template>
- <script>
- kiwi.plugin('user-more', function(kiwi, log) {
- var queryIgnoreEmbedded = new kiwi.Vue({
- template: '#query-ignore-embed',
- data: {
- isIgnored: false,
- accept_text: 'Ignora',
- },
- methods: {
- getTitle() {
- return this.isIgnored ? 'Non ignorare più' : 'Ignora';
- },
- getClass() {
- return this.isIgnored ? 'fa-ban red-ban' : 'fa-ban';
- },
- onIgnore(event) {
- let buffer = kiwi.state.getActiveBuffer();
- this.isIgnored = kiwi.state.getActiveNetwork().userByName(buffer.name).ignore;
- // Change user object
- kiwi.state.getActiveNetwork().userByName(buffer.name).ignore = !this.isIgnored;
- // Get the right word! Aggiunto or Rimosso?
- var word;
- if (this.isIgnored === false) {
- word = 'aggiunto';
- } else {
- word = 'rimosso';
- }
- // Give the user the feedback
- var mynick = kiwi.state.getActiveNetwork().nick;
- //var buffer = kiwi.state.getActiveBuffer();
- kiwi.state.addMessage(buffer,
- {
- 'message': 'Hai ' + word + ' ' + buffer.name + ' alla lista degli utenti ignorati.',
- 'bodyTemplate': '',
- 'nick': 'INFO',
- 'ident': 'INFO',
- 'hostname': 'INFO',
- 'target': mynick,
- }
- );
- // Change state
- this.isIgnored = !this.isIgnored;
- }
- }
- });
- queryIgnoreEmbedded.$mount();
- kiwi.addUi('header_query', queryIgnoreEmbedded.$el);
- });
- </script>
- <style>
- #ignorePlugin {
- margin-right:1em
- }
- .red-ban {
- color: red;
- }
- </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement