Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. <template id="query-ignore-embed">
  2. <i aria-hidden="true" id="ignorePlugin" class="fa" v-bind:class="getClass()" v-bind:title="getTitle()" v-on:click="onIgnore"></i>
  3. </template>
  4.  
  5. <script>
  6. kiwi.plugin('user-more', function(kiwi, log) {
  7.  
  8. var queryIgnoreEmbedded = new kiwi.Vue({
  9. template: '#query-ignore-embed',
  10. data: {
  11. isIgnored: false,
  12. accept_text: 'Ignora',
  13. },
  14.  
  15. methods: {
  16. getTitle() {
  17. return this.isIgnored ? 'Non ignorare più' : 'Ignora';
  18. },
  19. getClass() {
  20. return this.isIgnored ? 'fa-ban red-ban' : 'fa-ban';
  21. },
  22. onIgnore(event) {
  23. let buffer = kiwi.state.getActiveBuffer();
  24. this.isIgnored = kiwi.state.getActiveNetwork().userByName(buffer.name).ignore;
  25.  
  26. // Change user object
  27. kiwi.state.getActiveNetwork().userByName(buffer.name).ignore = !this.isIgnored;
  28.  
  29. // Get the right word! Aggiunto or Rimosso?
  30. var word;
  31.  
  32. if (this.isIgnored === false) {
  33. word = 'aggiunto';
  34. } else {
  35. word = 'rimosso';
  36. }
  37.  
  38. // Give the user the feedback
  39. var mynick = kiwi.state.getActiveNetwork().nick;
  40. //var buffer = kiwi.state.getActiveBuffer();
  41. kiwi.state.addMessage(buffer,
  42. {
  43. 'message': 'Hai ' + word + ' ' + buffer.name + ' alla lista degli utenti ignorati.',
  44. 'bodyTemplate': '',
  45. 'nick': 'INFO',
  46. 'ident': 'INFO',
  47. 'hostname': 'INFO',
  48. 'target': mynick,
  49. }
  50. );
  51.  
  52. // Change state
  53. this.isIgnored = !this.isIgnored;
  54. }
  55. }
  56. });
  57.  
  58. queryIgnoreEmbedded.$mount();
  59. kiwi.addUi('header_query', queryIgnoreEmbedded.$el);
  60. });
  61. </script>
  62.  
  63. <style>
  64. #ignorePlugin {
  65. margin-right:1em
  66. }
  67. .red-ban {
  68. color: red;
  69. }
  70. </style>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement