generic-skin 2.5.3 → 2.6.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Vue.component('panel-control', {
2
2
  props: ['dataElements'],
3
- data: function () {
3
+ data() {
4
4
  return {
5
5
  userId: _userdata.user_id,
6
6
  state: {
@@ -13,10 +13,10 @@ Vue.component('panel-control', {
13
13
  }
14
14
  },
15
15
  computed: {
16
- validationPanel: function () {
16
+ validationPanel() {
17
17
  return FNR.utility.genValidation(this.content.current)
18
18
  },
19
- toSave: function () {
19
+ toSave() {
20
20
  let final = [];
21
21
 
22
22
  [].forEach.call(this.content.current, (item, index) => {
@@ -33,7 +33,11 @@ Vue.component('panel-control', {
33
33
  }
34
34
  },
35
35
  methods: {
36
- updateProfile: function () {
36
+ updateProfile() {
37
+ if (!this.toSave.length || this.validationPanel !== '') {
38
+ return;
39
+ }
40
+
37
41
  this.state.page = 2;
38
42
 
39
43
  FNR.user.profile.setData(this.toSave).then((r) => {
@@ -75,6 +79,7 @@ Vue.component('panel-control', {
75
79
  <hr />
76
80
  <p>En esta página podrás editar tu perfil de usuario. En caso de que quieras editar tu contraseña, por favor dirígete a <a target="_blank" title="Ir a «Cambiar contraseña»" :href="'/profile?change_password=Cambiar+tu+contraseña&mode=editprofile&page_profil=informations&user_id=' + userId">este enlace</a>.</p>
77
81
  <p>Si estás experimentando problemas con el foro, pulsa <a title="Reiniciar cache" onclick="localStorage.clear(); window.location.replace('/')">este otro</a>. Puede que los solucione.</p>
82
+ <p>Ante cualquier duda o problema, contacta con la administración.</p>
78
83
  </div>
79
84
  <separador-foro />
80
85
  <template v-if="state.page === 0">
@@ -97,8 +102,8 @@ Vue.component('panel-control', {
97
102
  </campo-foro>
98
103
  </li>
99
104
  </ul>
100
- <div id="usereply-comand" v-if="toSave.length && validationPanel === ''">
101
- <button class="button1 btn-main" v-on:click="updateProfile()" title="Actualizar perfil">Actualizar</button>
105
+ <div id="usereply-comand">
106
+ <button class="button1 btn-main" @click="updateProfile()" title="Actualizar perfil">Actualizar</button>
102
107
  </div>
103
108
  </template>
104
109
  <template v-if="state.page === 2">
@@ -109,28 +114,28 @@ Vue.component('panel-control', {
109
114
  });
110
115
 
111
116
  Vue.component('lista-bosquejos', {
112
- data: function () {
117
+ data() {
113
118
  return {
114
119
  state: {
115
120
  page: 0
116
121
  },
117
- content: {
118
- drafts: []
119
- }
122
+ drafts: {}
120
123
  }
121
124
  },
122
125
  created() {
123
- FNR.user.profile.getDrafts().then((r) => {
126
+ FNR.user.profile.drafts.getDrafts().then((r) => {
124
127
  this.state.page = 1;
125
- this.content.drafts = r;
128
+ this.drafts = r;
126
129
  });
127
130
  },
128
131
  template: `
129
132
  <section class="wiki-content is-dramatic">
130
133
  <div class="is-content">
131
- <h2>Lista de bosquejos</h2>
134
+ <h2>Lista de Bosquejos</h2>
132
135
  <hr />
133
- <p>En esta página tienes tu lista de tus bosquejos. No es una lista completa, tan solo muestra la primera página. Si deseas ver más bosquejos, aligera la lista publicándolos.</p>
136
+ <p>En esta página tienes tu lista de Bosquejos dividida entre mensajes y temas.</p>
137
+ <p>No es una lista completa, tan solo muestra la primera página. Si deseas ver más bosquejos, aligera la lista publicándolos.</p>
138
+ <p>Ante cualquier duda o problema, contacta con la administración.</p>
134
139
  </div>
135
140
  <separador-foro />
136
141
  <template v-if="state.page === 0">
@@ -138,34 +143,251 @@ Vue.component('lista-bosquejos', {
138
143
  </template>
139
144
  <template v-else-if="state.page === 1">
140
145
  <section id="forum-drafts" class="forum-topiclist">
146
+ <div class="is-content mb-4">
147
+ <h4>Mensajes</h4>
148
+ </div>
149
+ <lista-temas-cabecera data-elements="['Tema', 'Información']"></lista-temas-cabecera>
150
+ <ul :class="'topiclist-topics no-style' + (!drafts.msgDrafts.length ? ' no-results': '')">
151
+ <template v-if="!drafts.msgDrafts.length">
152
+ <li class="is-not-topic is-not-lastpost">
153
+ <h6>No tienes bosquejos guardados</h6>
154
+ </li>
155
+ </template>
156
+ <template v-else>
157
+ <li class="row is-not-topic is-not-lastpost" v-for="draft in drafts.msgDrafts">
158
+ <temas-foro data-type="draft" data-mode="" :data-url="draft.topic.url" :data-replies="draft.info.location" :data-views="draft.info.date" :data-quick="draft.modify">
159
+ <template slot="title">{{ draft.topic.name }}</template>
160
+ </temas-foro>
161
+ </li>
162
+ </template>
163
+ </ul>
164
+ <div class="is-content mt-5 mb-4">
165
+ <h4>Temas</h4>
166
+ </div>
141
167
  <lista-temas-cabecera data-elements="['Tema', 'Información']"></lista-temas-cabecera>
142
- <ul class="topiclist-topics no-style">
143
- <template v-if="content.drafts === false">
144
- <li class="is-not-lastpost not-status">
168
+ <ul :class="'topiclist-topics no-style' + (!drafts.topicDrafts.length ? ' no-results': '')">
169
+ <template v-if="!drafts.topicDrafts.length">
170
+ <li class="is-not-topic is-not-lastpost">
145
171
  <h6>No tienes bosquejos guardados</h6>
146
172
  </li>
147
173
  </template>
148
174
  <template v-else>
149
- <li class="row is-not-lastpost not-status" v-for="draft in content.drafts">
150
- <temas-foro data-type="draft" data-mode="" :data-url="draft.topic.url" :data-title="draft.topic.name" :data-replies="draft.info.location" :data-views="draft.info.date" :data-quick="draft.modify" />
175
+ <li class="row is-not-topic is-not-lastpost" v-for="draft in drafts.topicDrafts">
176
+ <temas-foro data-type="draft" data-mode="" :data-url="draft.topic.url" :data-replies="draft.info.location" :data-views="draft.info.date" :data-quick="draft.modify">
177
+ <template slot="title">{{ draft.topic.name }}</template>
178
+ </temas-foro>
179
+ </li>
180
+ </template>
181
+ </ul>
182
+ </section>
183
+ </template>
184
+ </section>
185
+ `
186
+ });
187
+
188
+ Vue.component('lista-seguidos', {
189
+ data() {
190
+ return {
191
+ state: {
192
+ page: 0,
193
+ selected: [],
194
+ },
195
+ followed: {
196
+ page: 0,
197
+ loading: 0,
198
+ pages: [],
199
+ content: []
200
+ }
201
+ }
202
+ },
203
+ computed: {
204
+ sortedPages() {
205
+ const totalPages = this.followed.pages;
206
+ const currentPage = this.followed.page;
207
+
208
+ if (totalPages.length < 5) {
209
+ return totalPages;
210
+ }
211
+
212
+ switch (currentPage) {
213
+ case 0:
214
+ return [
215
+ totalPages[currentPage],
216
+ totalPages[currentPage + 1],
217
+ totalPages[currentPage + 2],
218
+ totalPages[currentPage + 3],
219
+ totalPages[currentPage + 4]
220
+ ];
221
+
222
+ case 1:
223
+ return [
224
+ totalPages[currentPage - 1],
225
+ totalPages[currentPage],
226
+ totalPages[currentPage + 1],
227
+ totalPages[currentPage + 2],
228
+ totalPages[currentPage + 3]
229
+ ];
230
+
231
+ case currentPages.length - 1:
232
+ return [
233
+ totalPages[currentPage - 4],
234
+ totalPages[currentPage - 3],
235
+ totalPages[currentPage - 2],
236
+ totalPages[currentPage - 1],
237
+ totalPages[currentPage]
238
+ ];
239
+
240
+ case currentPages.length - 2:
241
+ return [
242
+ totalPages[currentPage - 3],
243
+ totalPages[currentPage - 2],
244
+ totalPages[currentPage - 1],
245
+ totalPages[currentPage],
246
+ totalPages[currentPage + 1]
247
+ ];
248
+
249
+ default:
250
+ return [
251
+ totalPages[currentPage - 2],
252
+ totalPages[currentPage - 1],
253
+ totalPages[currentPage],
254
+ totalPages[currentPage + 1],
255
+ totalPages[currentPage + 2]
256
+ ];
257
+ }
258
+ }
259
+ },
260
+ methods: {
261
+ getPage(id) {
262
+ this.followed.loading = 0;
263
+
264
+ FNR.user.profile.followed.getFollowed(id).then((r) => {
265
+ this.followed.content = r;
266
+ this.followed.loading = 1;
267
+ this.state.page = 1;
268
+ });
269
+ },
270
+ setPage(id) {
271
+ this.followed.page = id;
272
+ this.getPage(this.followed.pages[this.followed.page]);
273
+ },
274
+ setTopic(id) {
275
+ const positionId = this.state.selected.indexOf(id);
276
+
277
+ if (positionId === -1) {
278
+ this.state.selected.push(id);
279
+ } else {
280
+ this.state.selected.splice(positionId, 1);
281
+ }
282
+ }
283
+ },
284
+ created() {
285
+ FNR.user.profile.followed.getPages().then((r) => {
286
+ if (r.items === 0) {
287
+ return;
288
+ }
289
+
290
+ this.followed.pages = r.pages;
291
+ this.getPage(this.followed.pages[this.followed.page]);
292
+ });
293
+ },
294
+ template: `
295
+ <section class="wiki-content is-dramatic">
296
+ <div class="is-content">
297
+ <h2>Lista de Temas Supervisados</h2>
298
+ <hr />
299
+ <p>En esta página tienes tu lista de Temas Supervisados.</p>
300
+ <p>Ante cualquier duda o problema, contacta con la administración.</p>
301
+ </div>
302
+ <separador-foro />
303
+ <template v-if="state.page === 0">
304
+ <cargando-foro data-text="Cargando utilidad…"></cargando-foro>
305
+ </template>
306
+ <template v-else-if="state.page === 1">
307
+ <mando-foro data-id="upper-controls" data-app="true">
308
+ <template slot="pagination" v-if="followed.pages.length > 1">
309
+ <a class="page-action" title="Ir a la página anterior" v-if="followed.page > 0" @click="setPage(followed.page -= 1)">
310
+ <i class="fas fa-chevron-left"></i>
311
+ </a>
312
+ <template v-for="page in sortedPages">
313
+ <strong v-if="followed.pages.indexOf(page) === followed.page">{{ followed.pages.indexOf(page) + 1 }}</strong>
314
+ <a class="page-link" :title="'Ir a la página «' + (followed.pages.indexOf(page) + 1) + '»'" v-else @click="setPage(followed.pages.indexOf(page))">{{ followed.pages.indexOf(page) + 1 }}</a>
315
+ </template>
316
+ <a class="page-action" title="Ir a la página siguiente" v-if="(followed.page + 1) < followed.pages.length" @click="setPage(followed.page += 1)">
317
+ <i class="fas fa-chevron-right"></i>
318
+ </a>
319
+ </template>
320
+ <template slot="controls">
321
+ <li @click="setPage(followed.page -= 1)">
322
+ <boton-foro data-url="#" data-name="Retirar" data-icon="fas fa-minus"></boton-foro>
323
+ </li>
324
+ </template>
325
+ </mando-foro>
326
+ <section id="forum-drafts" class="forum-topiclist">
327
+ <lista-temas-cabecera data-elements="['Tema', 'Información']"></lista-temas-cabecera>
328
+ <ul :class="'topiclist-topics no-style' + (!followed.content.length || followed.loading === 0 ? ' no-results': '')">
329
+ <template v-if="!followed.content.length">
330
+ <li class="is-not-topic is-not-lastpost">
331
+ <h6>No tienes temas supervisados</h6>
332
+ </li>
333
+ </template>
334
+ <template v-else-if="followed.loading === 0">
335
+ <li class="is-not-topic is-not-lastpost">
336
+ <cargando-foro data-text="Cargando temas…"></cargando-foro>
337
+ </li>
338
+ </template>
339
+ <template v-else>
340
+ <li class="row is-not-topic is-not-lastpost" v-for="topic in followed.content" :key="topic.id">
341
+ <temas-foro data-type="followed" data-mode="" :data-url="topic.url" :data-replies="topic.replies + ' respuestas'" :data-views="topic.views + ' visitas'">
342
+ <template slot="title">{{ topic.name }}</template>
343
+ <template slot="radio">
344
+ <div :class="'forum-checkbox' + state.selected.indexOf(topic.id) === -1 ? '' : 'is-active'">
345
+ <div class="checkbox-content" @click="setTopic(topic.id)">
346
+ <div class="checkbox-click">
347
+ <i class="fas fa-check"></i>
348
+ </div>
349
+ </div>
350
+ </div>
351
+ </template>
352
+ </temas-foro>
151
353
  </li>
152
354
  </template>
153
355
  </ul>
154
356
  </section>
357
+ <mando-foro data-id="lower-controls" data-app="true">
358
+ <template slot="pagination" v-if="followed.pages.length > 1">
359
+ <a class="page-action" title="Ir a la página anterior" v-if="followed.page > 0" @click="setPage(followed.page -= 1)">
360
+ <i class="fas fa-chevron-left"></i>
361
+ </a>
362
+ <template v-for="page in sortedPages">
363
+ <strong v-if="followed.pages.indexOf(page) === followed.page">{{ followed.pages.indexOf(page) + 1 }}</strong>
364
+ <a class="page-link" :title="'Ir a la página «' + (followed.pages.indexOf(page) + 1) + '»'" v-else @click="setPage(followed.pages.indexOf(page))">{{ followed.pages.indexOf(page) + 1 }}</a>
365
+ </template>
366
+ <a class="page-action" title="Ir a la página siguiente" v-if="(followed.page + 1) < followed.pages.length" @click="setPage(followed.page += 1)">
367
+ <i class="fas fa-chevron-right"></i>
368
+ </a>
369
+ </template>
370
+ <template slot="controls">
371
+ <li @click="setPage(followed.page -= 1)">
372
+ <boton-foro data-url="#" data-name="Retirar" data-icon="fas fa-minus"></boton-foro>
373
+ </li>
374
+ </template>
375
+ </mando-foro>
155
376
  </template>
156
377
  </section>
157
378
  `
158
379
  });
159
380
 
160
381
  Vue.component('editor-foro', {
161
- data: function () {
382
+ data() {
162
383
  return {
163
384
  state: {
164
385
  page: 0,
165
386
  editor: 'none',
166
387
  admin: (_userdata.user_level === 1),
167
388
  guest: (_userdata.session_logged_in === 0),
168
- dice: document.querySelectorAll('#list_dice').length
389
+ dice: document.querySelectorAll('#list_dice').length,
390
+ draft: document.querySelectorAll('input[name="draft"]').length
169
391
  },
170
392
  colors: FNR.forum.getColors(),
171
393
  content: {
@@ -192,11 +414,11 @@ Vue.component('editor-foro', {
192
414
  }
193
415
  },
194
416
  computed: {
195
- msgCheck: function () {
417
+ msgCheck() {
196
418
  let final = '';
197
419
 
198
420
  if (this.state.guest) {
199
- if (this.content.username.trim().length < 4 || this.content.username.trim().length > 60) {
421
+ if (this.content.username.trim().length < 1 || this.content.username.trim().length > 60) {
200
422
  final += '<li>Escribe un nombre de usuario de tamaño adecuado.</li>';
201
423
  }
202
424
  }
@@ -215,9 +437,9 @@ Vue.component('editor-foro', {
215
437
  }
216
438
  }
217
439
 
218
- if (this.state.editor === 'newtopic' || this.state.editor === 'post') {
219
- if (this.content.subject.trim().length < 4 || this.content.subject.trim().length > 60) {
220
- final += '<li>Escribe un titulo de tamaño adecuado.</li>';
440
+ if (this.state.editor === 'newtopic' || this.state.editor === 'post' || this.state.editor === 'edittopicdraft') {
441
+ if (this.content.subject.trim().length < 4 || this.content.subject.trim().length > 100) {
442
+ final += '<li>Escribe un titulo de tamaño adecuado (4 a 100 carácteres).</li>';
221
443
  }
222
444
  }
223
445
 
@@ -227,7 +449,7 @@ Vue.component('editor-foro', {
227
449
 
228
450
  return final;
229
451
  },
230
- sortedCharacters: function () {
452
+ sortedCharacters() {
231
453
  if (!Object.keys(this.users.options).length) return [];
232
454
  else return this.users.options.map((item) => {
233
455
  return item.user;
@@ -241,7 +463,7 @@ Vue.component('editor-foro', {
241
463
  return 0;
242
464
  });
243
465
  },
244
- sortedEditCharacters: function () {
466
+ sortedEditCharacters() {
245
467
  return this.users.selected.sort((a, b) => {
246
468
  if (a < b) return -1;
247
469
  else if (a > b) return 1;
@@ -250,7 +472,7 @@ Vue.component('editor-foro', {
250
472
  }
251
473
  },
252
474
  methods: {
253
- insertSomething: function (insertBefore, insertAfter) {
475
+ insertSomething(insertBefore, insertAfter) {
254
476
  const myField = document.getElementById('usereply-editor');
255
477
  const pre = insertBefore.replace(/-jump-/g, '\n');
256
478
  const post = insertAfter.replace(/-jump-/g, '\n');
@@ -260,8 +482,8 @@ Vue.component('editor-foro', {
260
482
  document.selection.createRange().text = pre + document.selection.createRange().text + post;
261
483
  } else if (myField.selectionStart || myField.selectionStart == '0') {
262
484
  const startPos = myField.selectionStart;
263
- const endPos = myField.selectionEnd;
264
- const cursorPos = endPos + pre.length + post.length;
485
+ const endPos = myField.selectionEnd
486
+ const cursorPos = endPos + pre.length;
265
487
 
266
488
  myField.value = myField.value.substring(0, startPos) + pre + myField.value.substring(startPos, endPos) + post + myField.value.substring(endPos, myField.value.length);
267
489
  myField.setSelectionRange(cursorPos, cursorPos);
@@ -269,13 +491,13 @@ Vue.component('editor-foro', {
269
491
 
270
492
  this.content.msg = myField.value;
271
493
  },
272
- newDice: function () {
494
+ newDice() {
273
495
  this.dice.current.push({
274
496
  dice: -1,
275
497
  number: 0
276
498
  });
277
499
  },
278
- addCharacter: function (character) {
500
+ addCharacter(character) {
279
501
  this.users.selected.push(character);
280
502
  this.users.selector = false;
281
503
  this.users.current = '';
@@ -284,15 +506,15 @@ Vue.component('editor-foro', {
284
506
  this.users.selector = true;
285
507
  }, 250);
286
508
  },
287
- deleteCharacter: function (index) {
509
+ deleteCharacter(index) {
288
510
  this.users.current = '';
289
511
  this.users.selected.splice(index, 1);
290
512
  },
291
- changeGroup: function () {
513
+ changeGroup() {
292
514
  this.users.selected = [];
293
515
  this.users.current = '';
294
516
  },
295
- insertUrl: function () {
517
+ insertUrl() {
296
518
  const myField = document.getElementById('usereply-editor');
297
519
  const startPos = myField.selectionStart;
298
520
  const endPos = myField.selectionEnd;
@@ -305,7 +527,7 @@ Vue.component('editor-foro', {
305
527
  }
306
528
  });
307
529
  },
308
- insertImg: function () {
530
+ insertImg() {
309
531
  FNR.html.genPrompt('Insertar imagen', 'Introduce las medidas de la imagen en píxeles pero sin la medida (por ejemplo 100x100). <u>En caso de dejarlo en blanco, se insertará con la medida inicial</u>.', 'Medidas de la imagen', '').then((result) => {
310
532
  if (result !== false) {
311
533
  this.insertSomething('[img=' + result + ']', '[/img]');
@@ -314,7 +536,7 @@ Vue.component('editor-foro', {
314
536
  }
315
537
  });
316
538
  },
317
- insertSpoiler: function () {
539
+ insertSpoiler() {
318
540
  FNR.html.genPrompt('Insertar spoiler', 'Introduce el título del spoiler. <u>En caso de dejarlo en blanco, se insertará sin él.</u>.', 'Título del spoiler', '').then((result) => {
319
541
  if (result !== false) {
320
542
  this.insertSomething('[spoiler=' + result + ']', '[/spoiler]');
@@ -323,7 +545,7 @@ Vue.component('editor-foro', {
323
545
  }
324
546
  });
325
547
  },
326
- insertQuote: function () {
548
+ insertQuote() {
327
549
  FNR.html.genPrompt('Insertar cita', 'Introduce el destinatario de la cita. <u>En caso de dejarlo en blanco, se insertará sin él.</u>.', 'Destinatario de la cita', '').then((result) => {
328
550
  if (result !== false) {
329
551
  this.insertSomething('[quote=' + result + ']', '[/quote]');
@@ -332,7 +554,7 @@ Vue.component('editor-foro', {
332
554
  }
333
555
  });
334
556
  },
335
- parseMsg: function () {
557
+ parseMsg() {
336
558
  window.forumParsing = true;
337
559
 
338
560
  if (document.querySelector('#forum-realreply > form .sceditor-container > textarea')) {
@@ -341,32 +563,6 @@ Vue.component('editor-foro', {
341
563
  document.querySelector('#forum-realreply > form textarea#text_editor_textarea').value = this.content.msg.replace(/#per/g, this.colors[this.colors.length - 1].hex);
342
564
  }
343
565
 
344
- if (this.state.editor === 'reply') {
345
- if (FNR.content.isAutosave()) {
346
- if (FNR.cache.getData('post' + document.post.t.value + '-' + _userdata.user_id) !== false && _userdata.user_id !== -1) {
347
- FNR.cache.delData('post' + document.post.t.value + '-' + _userdata.user_id);
348
- }
349
- }
350
-
351
- if (this.state.dice) {
352
- [].forEach.call(document.querySelectorAll('#forum-realreply > form #list_dice tr'), (item, index) => {
353
- if (index !== 0) {
354
- item.remove();
355
- }
356
- });
357
-
358
- document.querySelector('#forum-realreply > form #list_dice tr td').insertAdjacentHTML('beforeend', '<span id="dice_to_del"></span>');
359
-
360
- this.dice.current.filter((item) => {
361
- return item.dice !== -1;
362
- }).filter((item) => {
363
- return parseFloat(item.number) !== 0 && !isNaN(parseFloat(item.number));
364
- }).forEach((item) => {
365
- add_dice(document.querySelectorAll('#list_dice tr').length, item.dice, item.number);
366
- });
367
- }
368
- }
369
-
370
566
  if (this.state.guest) {
371
567
  if (this.content.subject.trim().length > 4 || this.content.subject.trim().length < 60) {
372
568
  document.querySelector('#forum-realreply > form input[name="username"]').value = this.content.username;
@@ -392,23 +588,80 @@ Vue.component('editor-foro', {
392
588
  }
393
589
  }
394
590
 
395
- if (this.state.editor === 'newtopic' || this.state.editor === 'post') {
396
- if (this.content.subject.trim().length > 4 || this.content.subject.trim().length < 60) {
591
+ if (this.state.editor === 'newtopic' || this.state.editor === 'post' || this.state.editor === 'edittopicdraft') {
592
+ if (this.content.subject.trim().length > 4 || this.content.subject.trim().length < 100) {
397
593
  document.querySelector('#forum-realreply > form input[name="subject"]').value = this.content.subject.trim();
398
594
  }
399
595
  }
596
+
597
+ if (this.state.editor === 'reply') {
598
+ if (FNR.content.isAutosave()) {
599
+ if (FNR.cache.getData('post' + document.post.t.value + '-' + _userdata.user_id) !== false && _userdata.user_id !== -1) {
600
+ FNR.cache.delData('post' + document.post.t.value + '-' + _userdata.user_id);
601
+ }
602
+ }
603
+ }
604
+
605
+ if (this.state.dice && (this.state.editor === 'reply' || this.state.editor === 'newtopic' || this.state.editor === 'editpostdraft' || this.state.editor === 'edittopicdraft')) {
606
+ [].forEach.call(document.querySelectorAll('#forum-realreply > form #list_dice tr'), (item, index) => {
607
+ if (index !== 0) {
608
+ item.remove();
609
+ }
610
+ });
611
+
612
+ document.querySelector('#forum-realreply > form #list_dice tr td').insertAdjacentHTML('beforeend', '<span id="dice_to_del"></span>');
613
+
614
+ this.dice.current.filter((item) => {
615
+ return item.dice !== -1;
616
+ }).filter((item) => {
617
+ return parseFloat(item.number) !== 0 && !isNaN(parseFloat(item.number));
618
+ }).forEach((item) => {
619
+ add_dice(document.querySelectorAll('#list_dice tr').length, item.dice, item.number);
620
+ });
621
+ }
400
622
  },
401
- draftMsg: function () {
623
+ draftMsg() {
624
+ if (this.msgCheck.length) {
625
+ return;
626
+ }
627
+
402
628
  this.parseMsg();
403
629
 
404
- document.querySelector('#forum-realreply > form input[value="Bosquejo"], #forum-realreply input[value="Modificar"]').click();
630
+ document.querySelector('#forum-realreply > form input[value="Bosquejo"], #forum-realreply input[value="Modificar"], #forum-realreply input[value="Registrar"]').click();
405
631
  },
406
- sendMsg: function () {
632
+ delMsg() {
633
+ const urlParams = new URLSearchParams(window.location.search);
634
+
635
+ let type = 'topicdraft';
636
+ let param = 't';
637
+
638
+ if (urlParams.get('mode') === 'editpostdraft') {
639
+ type = 'draft';
640
+ param = 'p';
641
+ }
642
+
643
+ FNR.user.profile.drafts.delDrafts(type, [urlParams.get(param)]).then((r) => {
644
+ if (r) {
645
+ window.location.replace(`${window.location.protocol}//${window.location.host}${forumConfig.usableDirections.ucp}#/bosquejos`)
646
+ } else {
647
+ FNR.html.genNotification('Atención', 'Hubo un problema al eliminar. Inténtalo de nuevo.', 'fas fa-exclamation');
648
+ }
649
+ });
650
+ },
651
+ sendMsg() {
652
+ if (this.msgCheck.length) {
653
+ return;
654
+ }
655
+
407
656
  this.parseMsg();
408
657
 
409
658
  document.querySelector('#forum-realreply > form input[value="Enviar"], #forum-realreply input[value="Publicar"]').click();
410
659
  },
411
- prevMsg: function () {
660
+ prevMsg() {
661
+ if (this.msgCheck.length) {
662
+ return;
663
+ }
664
+
412
665
  this.parseMsg();
413
666
 
414
667
  document.querySelector('#forum-realreply > form input[value="Previsualización"], #forum-realreply input[value="Previsualizar"]').click();
@@ -822,11 +1075,11 @@ Vue.component('editor-foro', {
822
1075
  <div class="character-selector">
823
1076
  <input type="text" v-model="users.current" placeholder="Escribe el nombre de un usuario." :disabled="groups.type !== -1" />
824
1077
  <ul class="no-style selector-list" v-if="users.selector && sortedCharacters.length > 0">
825
- <li v-for="(character, index) in sortedCharacters" v-on:click="addCharacter(character)" :title="'Seleccionar ' + character">{{ character }}<i class="fas fa-plus"></i></li>
1078
+ <li v-for="(character, index) in sortedCharacters" @click="addCharacter(character)" :title="'Seleccionar ' + character">{{ character }}<i class="fas fa-plus"></i></li>
826
1079
  </ul>
827
1080
  </div>
828
1081
  <ul v-if="sortedEditCharacters.length" class="no-style character-list">
829
- <li v-for="(character, index) in sortedEditCharacters" v-on:click="deleteCharacter(index)" :title="'Quitar ' + character"><i class="fas fa-times"></i> {{ character }}</li>
1082
+ <li v-for="(character, index) in sortedEditCharacters" @click="deleteCharacter(index)" :title="'Quitar ' + character"><i class="fas fa-times"></i> {{ character }}</li>
830
1083
  </ul>
831
1084
  </campo-foro>
832
1085
  </li>
@@ -836,7 +1089,7 @@ Vue.component('editor-foro', {
836
1089
  <li>
837
1090
  <campo-foro data-name="Grupo">
838
1091
  <div class="select-container">
839
- <select v-model="groups.type" v-on:change="changeGroup()" :disabled="users.selected.length !== 0">
1092
+ <select v-model="groups.type" @change="changeGroup()" :disabled="users.selected.length !== 0">
840
1093
  <option value="-1" hidden>Selecciona un grupo.</option>
841
1094
  <option v-for="option in groups.options" :value="option.value">{{ option.name }}</option>
842
1095
  </select>
@@ -844,7 +1097,7 @@ Vue.component('editor-foro', {
844
1097
  </campo-foro>
845
1098
  </li>
846
1099
  </template>
847
- <template v-else-if="state.editor === 'newtopic' && content.type !== -1">
1100
+ <template v-else-if="content.type !== -1 && (state.editor === 'newtopic' || state.editor === 'edittopicdraft')">
848
1101
  <li>
849
1102
  <campo-foro data-name="Tipo de tema">
850
1103
  <div class="select-container">
@@ -857,7 +1110,7 @@ Vue.component('editor-foro', {
857
1110
  </li>
858
1111
  </template>
859
1112
  </template>
860
- <template v-if="state.editor === 'newtopic' || state.editor === 'post'">
1113
+ <template v-if="state.editor === 'newtopic' || state.editor === 'post' || state.editor === 'edittopicdraft'">
861
1114
  <li>
862
1115
  <campo-foro data-name="Título">
863
1116
  <input type="text" v-model="content.subject" placeholder="Escribe el título." />
@@ -870,22 +1123,22 @@ Vue.component('editor-foro', {
870
1123
  <div id="usereply-buttons">
871
1124
  <ul class="is-hidden-mobile">
872
1125
  <li id="bold-button">
873
- <button class="usereply-button" v-on:click="insertSomething('[b]', '[/b]')" title="Negrita">
1126
+ <button class="usereply-button" @click="insertSomething('[b]', '[/b]')" title="Negrita">
874
1127
  <i class="fas fa-bold"></i>
875
1128
  </button>
876
1129
  </li>
877
1130
  <li id="italic-button">
878
- <button class="usereply-button" v-on:click="insertSomething('[i]', '[/i]')" title="Cursiva">
1131
+ <button class="usereply-button" @click="insertSomething('[i]', '[/i]')" title="Cursiva">
879
1132
  <i class="fas fa-italic"></i>
880
1133
  </button>
881
1134
  </li>
882
1135
  <li id="underline-button">
883
- <button class="usereply-button" v-on:click="insertSomething('[u]', '[/u]')" title="Subrayado">
1136
+ <button class="usereply-button" @click="insertSomething('[u]', '[/u]')" title="Subrayado">
884
1137
  <i class="fas fa-underline"></i>
885
1138
  </button>
886
1139
  </li>
887
1140
  <li id="strike-button">
888
- <button class="usereply-button" v-on:click="insertSomething('[strike]', '[/strike]')" title="Tachado">
1141
+ <button class="usereply-button" @click="insertSomething('[strike]', '[/strike]')" title="Tachado">
889
1142
  <i class="fas fa-strikethrough"></i>
890
1143
  </button>
891
1144
  </li>
@@ -900,7 +1153,7 @@ Vue.component('editor-foro', {
900
1153
  </div>
901
1154
  <div class="dropdown-menu" role="menu">
902
1155
  <div id="colour-list" class="dropdown-content">
903
- <div v-for="color in colors" class="usereply-option" :style="'color:' + color.hex" v-on:click="insertSomething('[color=' + color.hex + ']', '[/color]')">{{ color.name }}</div>
1156
+ <div v-for="color in colors" class="usereply-option" :style="'color:' + color.hex" @click="insertSomething('[color=' + color.hex + ']', '[/color]')">{{ color.name }}</div>
904
1157
  </div>
905
1158
  </div>
906
1159
  </div>
@@ -928,9 +1181,9 @@ Vue.component('editor-foro', {
928
1181
  </div>
929
1182
  <div class="dropdown-menu" role="menu">
930
1183
  <div id="align-list" class="dropdown-content">
931
- <div class="usereply-option" v-on:click="insertSomething('[left]', '[/left]')">Izquierda</div>
932
- <div class="usereply-option" v-on:click="insertSomething('[center]', '[/center]')">Centro</div>
933
- <div class="usereply-option" v-on:click="insertSomething('[right]', '[/right]')">Derecha</div>
1184
+ <div class="usereply-option" @click="insertSomething('[left]', '[/left]')">Izquierda</div>
1185
+ <div class="usereply-option" @click="insertSomething('[center]', '[/center]')">Centro</div>
1186
+ <div class="usereply-option" @click="insertSomething('[right]', '[/right]')">Derecha</div>
934
1187
  </div>
935
1188
  </div>
936
1189
  </div>
@@ -944,13 +1197,13 @@ Vue.component('editor-foro', {
944
1197
  </div>
945
1198
  <div class="dropdown-menu" role="menu">
946
1199
  <div id="toolbox-list" class="dropdown-content">
947
- <div class="usereply-option" v-on:click="insertUrl()">Enlace</div>
948
- <div class="usereply-option" v-on:click="insertImg()">Imagen</div>
949
- <div class="usereply-option" v-on:click="insertSpoiler()">Spoiler</div>
950
- <div class="usereply-option" v-on:click="insertSomething('[code]', '[/code]')">Code</div>
951
- <div class="usereply-option" v-on:click="insertQuote()">Cita</div>
952
- <div class="usereply-option" v-on:click="insertSomething('[hide]', '[/hide]')">Ocultar</div>
953
- <div class="usereply-option" v-on:click="insertSomething('[youtube]', '[/youtube]')">Youtube</div>
1200
+ <div class="usereply-option" @click="insertUrl()">Enlace</div>
1201
+ <div class="usereply-option" @click="insertImg()">Imagen</div>
1202
+ <div class="usereply-option" @click="insertSpoiler()">Spoiler</div>
1203
+ <div class="usereply-option" @click="insertSomething('[code]', '[/code]')">Code</div>
1204
+ <div class="usereply-option" @click="insertQuote()">Cita</div>
1205
+ <div class="usereply-option" @click="insertSomething('[hide]', '[/hide]')">Ocultar</div>
1206
+ <div class="usereply-option" @click="insertSomething('[youtube]', '[/youtube]')">Youtube</div>
954
1207
  </div>
955
1208
  </div>
956
1209
  </div>
@@ -959,26 +1212,27 @@ Vue.component('editor-foro', {
959
1212
  </div>
960
1213
  </div>
961
1214
  <textarea id="usereply-editor" contenteditable="true" v-model="content.msg"></textarea>
962
- <div id="usereply-comand" v-if="!msgCheck.length">
963
- <button class="button1 btn-main" v-on:click="sendMsg()">Enviar</button>
964
- <button class="button1" v-on:click="draftMsg()" v-if="state.editor === 'editpostdraft'">Modificar</button>
965
- <button class="button1" v-on:click="draftMsg()" v-else-if="state.editor === 'reply' && state.dice">Bosquejo</button>
966
- <button class="button1" v-on:click="prevMsg()">Previsualizar</button>
1215
+ <div id="usereply-comand">
1216
+ <button class="button1 btn-main" @click="sendMsg()">Enviar</button>
1217
+ <button class="button1" @click="draftMsg()" v-if="state.editor === 'editpostdraft' || state.editor === 'edittopicdraft'">Modificar</button>
1218
+ <button class="button1" @click="draftMsg()" v-else-if="state.draft && (state.editor === 'reply' || state.editor === 'newtopic')">Bosquejo</button>
1219
+ <button class="button1" @click="prevMsg()">Previsualizar</button>
1220
+ <button class="button1" @click="delMsg()" v-if="state.editor === 'editpostdraft' || state.editor === 'edittopicdraft'">Eliminar</button>
967
1221
  </div>
968
- <div v-if="state.editor === 'reply' && state.dice" id="usereply-dice">
1222
+ <div v-if="state.dice && (state.editor === 'reply' || state.editor === 'newtopic' || state.editor === 'editpostdraft' || state.editor === 'edittopicdraft')" id="usereply-dice">
969
1223
  <div class="usereply-header">
970
1224
  <h3>Tirar dados</h3>
971
1225
  </div>
972
1226
  <ul>
973
1227
  <li v-for="(item, index) in dice.current">
974
1228
  <div class="select-container">
975
- <select v-model="item.dice">
1229
+ <select v-model="item.dice" @change="item.number = 1">
976
1230
  <option value="-1" selected hidden>Selec. un dado</option>
977
1231
  <option v-for="option in dice.options" :value="option.value">{{ option.content }}</option>
978
1232
  </select>
979
1233
  </div>
980
1234
  <input type="number" v-model="item.number" />
981
- <button v-on:click="newDice()" v-if="(index + 1) === dice.current.length" class="dice-more">
1235
+ <button @click="newDice()" v-if="(index + 1) === dice.current.length" class="dice-more">
982
1236
  <i class="fas fa-plus"></i>
983
1237
  </button>
984
1238
  <div v-else class="dice-more"></div>