generic-skin 3.0.9 → 3.1.0
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.
- package/apps/vueChrono.js +19 -19
- package/apps/vueChrono.min.js +1 -1
- package/apps/vueDefault.js +19 -19
- package/apps/vueMulti.js +20 -20
- package/apps/vueMulti.min.js +1 -1
- package/apps/vueRela.js +18 -18
- package/apps/vueRela.min.js +1 -1
- package/config/vueComponents.js +55 -55
- package/config/vueElements.js +1 -1
- package/config/vueFilters.js +5 -0
- package/config/vueFilters.min.js +1 -1
- package/options/noManagers.js +3 -3
- package/options/noManagers.min.js +1 -1
- package/package.json +1 -1
package/apps/vueChrono.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Vue.component('modal-cronologia', {
|
|
2
2
|
props: ['dataElement', 'dataType'],
|
|
3
|
-
data
|
|
3
|
+
data() {
|
|
4
4
|
return {
|
|
5
5
|
page: 0,
|
|
6
6
|
state: {
|
|
@@ -18,11 +18,11 @@ Vue.component('modal-cronologia', {
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
computed: {
|
|
21
|
-
modalTitle
|
|
21
|
+
modalTitle() {
|
|
22
22
|
if (this.dataType === 'new') return 'Nueva entrada';
|
|
23
23
|
else if (this.dataType === 'edit') return 'Editar entrada';
|
|
24
24
|
},
|
|
25
|
-
oneCheck
|
|
25
|
+
oneCheck() {
|
|
26
26
|
let final = '';
|
|
27
27
|
|
|
28
28
|
if (!Object.keys(this.content.edit).length) return final;
|
|
@@ -77,7 +77,7 @@ Vue.component('modal-cronologia', {
|
|
|
77
77
|
|
|
78
78
|
return final;
|
|
79
79
|
},
|
|
80
|
-
secondCheck
|
|
80
|
+
secondCheck() {
|
|
81
81
|
let final = '';
|
|
82
82
|
|
|
83
83
|
if (!Object.keys(this.content.edit).length) return final;
|
|
@@ -92,10 +92,10 @@ Vue.component('modal-cronologia', {
|
|
|
92
92
|
|
|
93
93
|
return final;
|
|
94
94
|
},
|
|
95
|
-
finalCheck
|
|
95
|
+
finalCheck() {
|
|
96
96
|
return JSON.stringify(this.content.current) !== JSON.stringify(this.finalData);
|
|
97
97
|
},
|
|
98
|
-
finalData
|
|
98
|
+
finalData() {
|
|
99
99
|
let data = JSON.parse(JSON.stringify(this.content.edit));
|
|
100
100
|
|
|
101
101
|
if (!Object.keys(this.content.edit).length) return data;
|
|
@@ -129,7 +129,7 @@ Vue.component('modal-cronologia', {
|
|
|
129
129
|
|
|
130
130
|
return data;
|
|
131
131
|
},
|
|
132
|
-
sortedCharacters
|
|
132
|
+
sortedCharacters() {
|
|
133
133
|
if (!Object.keys(this.content.edit).length) return this.$parent.users.map((item) => {
|
|
134
134
|
return item.user;
|
|
135
135
|
});
|
|
@@ -141,7 +141,7 @@ Vue.component('modal-cronologia', {
|
|
|
141
141
|
return item.toLowerCase().indexOf(this.info.user.toLowerCase()) > -1;
|
|
142
142
|
});
|
|
143
143
|
},
|
|
144
|
-
sortedEditCharacters
|
|
144
|
+
sortedEditCharacters() {
|
|
145
145
|
return this.info.people.sort((a, b) => {
|
|
146
146
|
if (a < b) return -1;
|
|
147
147
|
else if (a > b) return 1;
|
|
@@ -150,12 +150,12 @@ Vue.component('modal-cronologia', {
|
|
|
150
150
|
}
|
|
151
151
|
},
|
|
152
152
|
methods: {
|
|
153
|
-
modalClose
|
|
153
|
+
modalClose() {
|
|
154
154
|
this.$parent.modal.type = 'new';
|
|
155
155
|
this.$parent.modal.status = false;
|
|
156
156
|
this.$parent.setEntry();
|
|
157
157
|
},
|
|
158
|
-
pushElement
|
|
158
|
+
pushElement() {
|
|
159
159
|
if (this.$parent.modal.type === 'edit') {
|
|
160
160
|
this.$parent.content.edit.splice(this.$parent.content.edit.map((item) => {
|
|
161
161
|
return item.position;
|
|
@@ -303,7 +303,7 @@ Vue.component('modal-cronologia', {
|
|
|
303
303
|
});
|
|
304
304
|
|
|
305
305
|
Vue.component('gestor-cronologia', {
|
|
306
|
-
data
|
|
306
|
+
data() {
|
|
307
307
|
return {
|
|
308
308
|
render: 0,
|
|
309
309
|
modal: {
|
|
@@ -323,7 +323,7 @@ Vue.component('gestor-cronologia', {
|
|
|
323
323
|
}
|
|
324
324
|
},
|
|
325
325
|
computed: {
|
|
326
|
-
sortedContent
|
|
326
|
+
sortedContent() {
|
|
327
327
|
return JSON.parse(JSON.stringify(this.content.edit)).sort(({
|
|
328
328
|
date: a,
|
|
329
329
|
name: n1
|
|
@@ -343,7 +343,7 @@ Vue.component('gestor-cronologia', {
|
|
|
343
343
|
return n1 - n2;
|
|
344
344
|
});
|
|
345
345
|
},
|
|
346
|
-
paginationContent
|
|
346
|
+
paginationContent() {
|
|
347
347
|
const limit = forumConfig.skinOptions.paginationDefault;
|
|
348
348
|
const pages = Math.floor((this.sortedContent.length - 1) / limit) + 1;
|
|
349
349
|
|
|
@@ -360,15 +360,15 @@ Vue.component('gestor-cronologia', {
|
|
|
360
360
|
content: this.sortedContent.slice(this.state.pagination * limit, (this.state.pagination + 1) * limit)
|
|
361
361
|
};
|
|
362
362
|
},
|
|
363
|
-
finalCheck
|
|
363
|
+
finalCheck() {
|
|
364
364
|
return JSON.stringify(this.content.current) !== JSON.stringify(this.content.edit);
|
|
365
365
|
}
|
|
366
366
|
},
|
|
367
367
|
methods: {
|
|
368
|
-
forceRerender
|
|
368
|
+
forceRerender() {
|
|
369
369
|
this.render += 1;
|
|
370
370
|
},
|
|
371
|
-
setEntry
|
|
371
|
+
setEntry() {
|
|
372
372
|
this.entry = {
|
|
373
373
|
link: '',
|
|
374
374
|
name: '',
|
|
@@ -526,13 +526,13 @@ Vue.component('gestor-cronologia', {
|
|
|
526
526
|
|
|
527
527
|
Vue.component('elemento-cronologia', {
|
|
528
528
|
props: ['dataElement', 'dataType', 'dataId'],
|
|
529
|
-
data
|
|
529
|
+
data() {
|
|
530
530
|
return {
|
|
531
531
|
content: this.dataElement
|
|
532
532
|
}
|
|
533
533
|
},
|
|
534
534
|
methods: {
|
|
535
|
-
deleteElement
|
|
535
|
+
deleteElement() {
|
|
536
536
|
this.$parent.content.edit.splice(this.$parent.content.edit.map((item) => {
|
|
537
537
|
return item.position;
|
|
538
538
|
}).indexOf(this.dataId), 1);
|
|
@@ -543,7 +543,7 @@ Vue.component('elemento-cronologia', {
|
|
|
543
543
|
|
|
544
544
|
this.$parent.forceRerender();
|
|
545
545
|
},
|
|
546
|
-
editElement
|
|
546
|
+
editElement() {
|
|
547
547
|
this.$parent.modal.type = 'edit';
|
|
548
548
|
this.$parent.entry = this.content;
|
|
549
549
|
this.$parent.modal.status = true;
|
package/apps/vueChrono.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Vue.component("modal-cronologia", { props: ["dataElement", "dataType"], data: function () { return { page: 0, state: { modal: !1 }, info: { user: "", people: [], selector: !0 }, content: { edit: JSON.parse(JSON.stringify(this.dataElement)), current: this.dataElement } } }, computed: { modalTitle: function () { return "new" === this.dataType ? "Nueva entrada" : "edit" === this.dataType ? "Editar entrada" : void 0 }, oneCheck: function () { let t = ""; if (!Object.keys(this.content.edit).length) return t; this.content.edit.name.length < 5 && (t += "<li>Escribe un título lo suficientemente largo.</li>"), -1 === this.content.edit.link.indexOf("/t") && (t += "<li>Escribe un enlace válido.</li>"); let e = []; if ((1 > parseFloat(this.content.edit.date.day) || parseFloat(this.content.edit.date.day) > forumData.date.day || "" === this.content.edit.date.day || Number.isNaN(parseFloat(this.content.edit.date.day))) && e.push("un día correcto (1 al " + forumData.date.day + ")"), (1 > parseFloat(this.content.edit.date.month) || parseFloat(this.content.edit.date.month) > forumData.date.month || "" === this.content.edit.date.month || Number.isNaN(parseFloat(this.content.edit.date.month))) && e.push("un mes correcto (1 al " + forumData.date.month + ")"), ("DFI" === this.content.edit.date.time && parseFloat(this.content.edit.date.year) > forumData.date.year || "DFI" === this.content.edit.date.time && parseFloat(this.content.edit.date.year) < 1 || "" === this.content.edit.date.year || Number.isNaN(parseFloat(this.content.edit.date.year))) && e.push("un año correcto"), -1 === this.content.edit.date.time && e.push("un periodo correcto"), e.length) { let n = ""; n += "<li>Recuerda poner ", [].forEach.call(e, (t, e, a) => { n += t, a.length - 2 === e ? n += " y " : a.length === e + 1 ? n += "." : a.length > e && (n += ", ") }), n += "</li>", t += n } return t }, secondCheck: function () { let t = ""; return Object.keys(this.content.edit).length ? (-1 === this.content.edit.status && (t += "<li>Selecciona un estado para el tema.</li>"), this.info.people.length || (t += "<li>Selecciona al menos un personaje.</li>"), t) : t }, finalCheck: function () { return JSON.stringify(this.content.current) !== JSON.stringify(this.finalData) }, finalData: function () { let t = JSON.parse(JSON.stringify(this.content.edit)); if (!Object.keys(this.content.edit).length) return t; let e = "", n = ""; return [].forEach.call(JSON.parse(JSON.stringify(this.sortedEditCharacters)), (t, a, o) => { e += t, n += Vue.filter("just-name")(t), o.length - 2 === a ? (e += " y ", n += " y ") : o.length === a + 1 ? (e += "", n += "") : o.length > a && (e += ", ", n += ", ") }), t.people.count = this.info.people.length, t.people.list = e, t.people.short = n, "new" === this.$parent.modal.type && (t.position = this.$parent.content.edit.length), t }, sortedCharacters: function () { return Object.keys(this.content.edit).length ? this.$parent.users.map(t => t.user).filter(t => -1 === this.info.people.indexOf(t)).filter(t => t.toLowerCase().indexOf(this.info.user.toLowerCase()) > -1) : this.$parent.users.map(t => t.user) }, sortedEditCharacters: function () { return this.info.people.sort((t, e) => t < e ? -1 : t > e ? 1 : 0) } }, methods: { modalClose: function () { this.$parent.modal.type = "new", this.$parent.modal.status = !1, this.$parent.setEntry() }, pushElement: function () { "edit" === this.$parent.modal.type && this.$parent.content.edit.splice(this.$parent.content.edit.map(t => t.position).indexOf(this.content.current.position), 1), this.$parent.content.edit.push(this.finalData), this.modalClose() }, addCharacter: function (t) { this.info.people.push(t), this.info.selector = !1, this.info.user = "", setTimeout(() => { this.info.selector = !0 }, 250) }, deleteCharacter: function (t) { const e = JSON.parse(JSON.stringify(this.content.edit.status)); this.info.people.splice(t, 1), this.forceRerender(), this.content.edit.status = -1, this.content.edit.status = e } }, created() { let t = []; "" !== this.content.edit.people.list && (t = -1 === this.content.edit.people.list.indexOf(" y ") ? [this.content.edit.people.list] : this.content.edit.people.list.split(" y ")[0].split(", ").concat(this.content.edit.people.list.split(" y ")[1])), this.info.people = t }, template: '\n <modal-foro :data-title="modalTitle" v-on:modal-close="modalClose()">\n <template v-if="page === 0">\n <template slot="content">\n <aviso-foro v-show="oneCheck.length">\n <ul v-html="oneCheck"></ul>\n </aviso-foro>\n <ul class="forum-fieldlist no-style">\n <li>\n <campo-foro data-name="Título">\n <input type="text" v-model="content.edit.name" placeholder="Escribe el nombre del tema." />\n </campo-foro>\n </li>\n <li>\n <campo-foro data-name="Enlace">\n <input type="text" v-model="content.edit.link" placeholder="Escribe el enlace del tema." />\n </campo-foro>\n </li>\n <li>\n <campo-foro data-name="Fecha">\n <div class="input-date">\n <div class="date-element date-dmy">\n <label>\n Día\n <input type="text" v-model="content.edit.date.day" placeholder="0" />\n </label>\n <label>\n Mes\n <input type="text" v-model="content.edit.date.month" placeholder="0" />\n </label>\n <label>\n Año\n <input type="text" v-model="content.edit.date.year" placeholder="0" />\n </label>\n </div>\n <div class="date-element not-show mt-4">\n <label>\n Periodo\n <div class="select-container">\n <select v-model="content.edit.date.time">\n <option value="-1" hidden>-</option>\n <option value="AFI">AFI</option>\n <option value="DFI">DFI</option>\n </select>\n </div>\n </label>\n </div>\n </div>\n </campo-foro>\n </li>\n </ul>\n </template>\n <template slot="controls" v-if="!oneCheck.length">\n <controles-modal>\n <button class="button1 btn-main" v-on:click="page = 1" title="Paso siguiente">Siguiente</button>\n </controles-modal>\n </template>\n </template>\n <template v-else-if="page === 1">\n <template slot="content">\n <aviso-foro v-show="secondCheck.length">\n <ul v-html="secondCheck"></ul>\n </aviso-foro>\n <ul class="forum-fieldlist no-style">\n <li>\n <campo-foro data-name="Estado">\n <div class="select-container">\n <select v-model="content.edit.status">\n <option value="-1" selected="selected" hidden="hidden">Selecciona un estado para el tema</option>\n <option value="ropened">Activo</option>\n <option value="rclosed">Cerrado</option>\n <option value="rabandoned">Abandonado</option>\n </select>\n </div>\n </campo-foro>\n </li>\n <li>\n <campo-foro data-name="Personajes">\n <div class="character-selector">\n <input type="text" v-model="info.user" placeholder="Escribe el nombre de un personaje." />\n <ul class="no-style selector-list" v-if="sortedCharacters.length > 0 && info.selector">\n <li v-for="(character, index) in sortedCharacters" v-on:click="addCharacter(character)" :title="\'Seleccionar «\' + character + \'»\'">{{ character }}<i class="fas fa-plus"></i></li>\n </ul>\n <a class="character-custom" v-on:click="addCharacter(info.user)" v-if="info.user.length > 2" :title="\'Seleccionar «\' + info.user + \'»\'">\n <i class="fas fa-plus"></i>\n </a>\n </div>\n <ul v-if="info.people.length" class="no-style character-list">\n <li v-for="(character, index) in sortedEditCharacters" v-on:click="deleteCharacter(index)" :title="\'Quitar \' + character"><i class="fas fa-times"></i> {{ character }}</li>\n </ul>\n </campo-foro>\n </li>\n </ul>\n </template>\n <template slot="controls">\n <controles-modal>\n <button class="button2" v-on:click="page = 0" title="Paso anterior">Anterior</button>\n <button class="button1 btn-main" v-on:click="pushElement()" v-if="!secondCheck.length && finalCheck" title="Guardar entrada">Guardar</button>\n </controles-modal>\n </template>\n </template>\n </modal-foro>\n ' }), Vue.component("gestor-cronologia", { data: function () { return { render: 0, modal: { type: "new", status: !1 }, users: [], state: { page: 0, pagination: 0 }, entry: {}, content: { edit: [], current: [] } } }, computed: { sortedContent: function () { return JSON.parse(JSON.stringify(this.content.edit)).sort(({ date: t, name: e }, { date: n, name: a }) => { if (t.time !== n.time) return "AFI" === t.time ? -1 : 1; const o = "AFI" === t.time ? n : t, i = "AFI" === t.time ? t : n; return parseFloat(t.year) !== parseFloat(n.year) ? parseFloat(o.year) - parseFloat(i.year) : parseFloat(t.month) !== parseFloat(n.month) ? parseFloat(o.month) - parseFloat(i.month) : parseFloat(t.day) !== parseFloat(n.day) ? parseFloat(o.day) - parseFloat(i.day) : e - a }) }, paginationContent: function () { const t = forumConfig.skinOptions.paginationDefault, e = Math.floor((this.sortedContent.length - 1) / t) + 1; let n = []; for (let t = 0; t < e; t++)n.push(t); return this.forceRerender(), { pages: n, content: this.sortedContent.slice(this.state.pagination * t, (this.state.pagination + 1) * t) } }, finalCheck: function () { return JSON.stringify(this.content.current) !== JSON.stringify(this.content.edit) } }, methods: { forceRerender: function () { this.render += 1 }, setEntry: function () { this.entry = { link: "", name: "", status: -1, people: { list: "", short: "", count: 0 }, date: { time: "DFI", day: "", month: "", year: "" } } }, addEntry: function (t) { t.preventDefault(), this.modal.status = !0 }, save: function (t) { t.preventDefault(), this.state.page = 2; const e = this.sortedContent.map(t => (void 0 !== t.desc && delete t.desc, void 0 !== t.position && delete t.position, t)); FNR.user.profile.setData([{ name: forumConfig.profileUser.cronoField, type: "textarea", value: JSON.stringify(e).replace(/"/g, "`") }]).then(t => { t ? (FNR.html.genNotification("Atención", "Información actualizada sin inconvenientes.", "fas fa-check"), setTimeout(() => { window.location.reload() }, 2e3)) : FNR.html.genNotification("Atención", "Hubo un problema al actualizar. Dale otro intento.", "fas fa-exclamation") }) } }, created() { FNR.user.profile.getData([{ name: forumConfig.profileUser.cronoField, type: "textarea" }]).then(t => { const e = FNR.utility.genArray(t[0].value).map((t, e) => { let n = t; return n.position = e, n }); this.content.edit = e, this.content.current = JSON.parse(JSON.stringify(e)), FNR.forum.getMembers().then(t => { this.setEntry(), this.users = t, this.state.page = 1 }) }) }, template: '\n <section id="forum-chronology" class="wiki-content is-dramatic">\n <div class="is-content">\n <h2>Cronología</h2>\n <hr />\n <p>En esta página podrás editar la cronología de tu personaje. Experimenta con su funcionamiento, es bastante intuitivo.</p>\n </div>\n <separador-foro />\n <template v-if="state.page === 0">\n <cargando-foro data-text="Cargando utilidad…"></cargando-foro>\n </template>\n <template v-else-if="state.page === 1">\n <modal-cronologia v-if="modal.status" :data-type="modal.type" :data-element="entry"></modal-cronologia>\n <mando-foro data-id="upper-controls" data-app="true">\n <template slot="pagination" v-if="paginationContent.pages.length > 1">\n <a class="page-action" title="Ir a la página anterior" v-if="state.pagination > 0" v-on:click="state.pagination -= 1">\n <i class="fas fa-chevron-left"></i>\n </a>\n <template v-for="page in paginationContent.pages">\n <strong v-if="page === state.pagination">{{ page + 1 }}</strong>\n <a class="page-link" :title="\'Ir a la página «\' + (page + 1) + \'»\'" v-else v-on:click="state.pagination = page">{{ page + 1 }}</a>\n </template>\n <a class="page-action" title="Ir a la página siguiente" v-if="(state.pagination + 1) < paginationContent.pages.length" v-on:click="state.pagination += 1">\n <i class="fas fa-chevron-right"></i>\n </a>\n </template>\n <template slot="controls">\n <li v-on:click="addEntry($event)">\n <boton-foro data-url="#" data-name="Añadir" data-icon="fas fa-plus"></boton-foro>\n </li>\n <li v-if="finalCheck" v-on:click="save($event)">\n <boton-foro data-url="#" data-name="Guardar" data-icon="fas fa-save" data-type="no-name"></boton-foro>\n </li>\n </template>\n </mando-foro>\n <ul id="forum-rplist" class="no-style" :key="render">\n <template v-if="!paginationContent.content.length">\n <li class="is-not-lastpost not-status">\n <h6>No hay entradas en tu cronología</h6>\n </li>\n </template>\n <template v-else v-for="rp in paginationContent.content">\n <elemento-cronologia :data-element="rp" data-type="manager" :data-id="rp.position" />\n </template>\n </ul>\n <mando-foro data-id="lower-controls" data-app="true">\n <template slot="pagination" v-if="paginationContent.pages.length > 1">\n <a class="page-action" title="Ir a la página anterior" v-if="state.pagination > 0" v-on:click="state.pagination -= 1">\n <i class="fas fa-chevron-left"></i>\n </a>\n <template v-for="page in paginationContent.pages">\n <strong v-if="page === state.pagination">{{ page + 1 }}</strong>\n <a class="page-link" :title="\'Ir a la página «\' + (page + 1) + \'»\'" v-else v-on:click="state.pagination = page">{{ page + 1 }}</a>\n </template>\n <a class="page-action" title="Ir a la página siguiente" v-if="(state.pagination + 1) < paginationContent.pages.length" v-on:click="state.pagination += 1">\n <i class="fas fa-chevron-right"></i>\n </a>\n </template>\n <template slot="controls">\n <li v-on:click="addEntry($event)">\n <boton-foro data-url="#" data-name="Añadir" data-icon="fas fa-plus"></boton-foro>\n </li>\n <li v-if="finalCheck" v-on:click="save($event)">\n <boton-foro data-url="#" data-name="Guardar" data-icon="fas fa-save" data-type="no-name"></boton-foro>\n </li>\n </template>\n </mando-foro>\n </template>\n <template v-else-if="state.page === 2">\n <cargando-foro data-text="Actualizando información…"></cargando-foro>\n </template>\n </section>\n ' }), Vue.component("elemento-cronologia", { props: ["dataElement", "dataType", "dataId"], data: function () { return { content: this.dataElement } }, methods: { deleteElement: function () { this.$parent.content.edit.splice(this.$parent.content.edit.map(t => t.position).indexOf(this.dataId), 1), 0 === this.$parent.paginationContent.content.length && 0 !== this.$parent.state.pagination && (this.$parent.state.pagination -= 1), this.$parent.forceRerender() }, editElement: function () { this.$parent.modal.type = "edit", this.$parent.entry = this.content, this.$parent.modal.status = !0 } }, template: '\n <li class="rp-list">\n <template v-if="dataType === \'manager\'">\n <a class="rp-element rp-manager">\n <div class="rp-icon">\n <template v-if="content.status === \'ropened\'">\n <i class="fas fa-lock-open"></i>\n </template>\n <template v-else-if="content.status === \'rclosed\'">\n <i class="fas fa-lock"></i>\n </template>\n <template v-else-if="content.status === \'rabandoned\'">\n <i class="fas fa-times"></i>\n </template>\n </div>\n <div class="rp-content">\n <div class="rp-name">\n <span>{{ content.name }}</span>\n <small>\n {{ content.date.day | to-number | in-two-digits }}/{{ content.date.month | to-number | in-two-digits }}/{{ content.date.year | to-number | in-two-digits }} - <template v-if="content.people.count < 4">{{ content.people.short }}</template><template v-else>Invitados</template>\n </small>\n </div>\n <div class="rp-controls">\n <span v-on:click="editElement()" title="Editar entrada">Editar</span> / <span v-on:click="deleteElement()" title="Eliminar entrada">Eliminar</span>\n </div>\n </div>\n </a>\n </template>\n <template v-else-if="dataType === \'profile\'">\n <a class="rp-element" :href="content.link" target="_blank" :title="\'Ir al tema «\' + content.name + \'»\'">\n <div class="rp-icon">\n <template v-if="content.status === \'ropened\'">\n <i class="fas fa-lock-open"></i>\n </template>\n <template v-else-if="content.status === \'rclosed\'">\n <i class="fas fa-lock"></i>\n </template>\n <template v-else-if="content.status === \'rabandoned\'">\n <i class="fas fa-times"></i>\n </template>\n </div>\n <div class="rp-content">\n <div class="rp-name">\n <span>{{ content.name }}</span>\n <small>\n {{ content.date.day | to-number | in-two-digits }}/{{ content.date.month | to-number | in-two-digits }}/{{ content.date.year | to-number | in-two-digits }} - <template v-if="content.people.count < 4">{{ content.people.short }}</template><template v-else>Invitados</template>\n </small>\n </div>\n </div>\n </a>\n </template>\n </li>\n ' });
|
|
1
|
+
Vue.component("modal-cronologia", { props: ["dataElement", "dataType"], data() { return { page: 0, state: { modal: !1 }, info: { user: "", people: [], selector: !0 }, content: { edit: JSON.parse(JSON.stringify(this.dataElement)), current: this.dataElement } } }, computed: { modalTitle() { return "new" === this.dataType ? "Nueva entrada" : "edit" === this.dataType ? "Editar entrada" : void 0 }, oneCheck() { let t = ""; if (!Object.keys(this.content.edit).length) return t; this.content.edit.name.length < 5 && (t += "<li>Escribe un título lo suficientemente largo.</li>"), -1 === this.content.edit.link.indexOf("/t") && (t += "<li>Escribe un enlace válido.</li>"); let e = []; if ((1 > parseFloat(this.content.edit.date.day) || parseFloat(this.content.edit.date.day) > forumData.date.day || "" === this.content.edit.date.day || Number.isNaN(parseFloat(this.content.edit.date.day))) && e.push("un día correcto (1 al " + forumData.date.day + ")"), (1 > parseFloat(this.content.edit.date.month) || parseFloat(this.content.edit.date.month) > forumData.date.month || "" === this.content.edit.date.month || Number.isNaN(parseFloat(this.content.edit.date.month))) && e.push("un mes correcto (1 al " + forumData.date.month + ")"), ("DFI" === this.content.edit.date.time && parseFloat(this.content.edit.date.year) > forumData.date.year || "DFI" === this.content.edit.date.time && parseFloat(this.content.edit.date.year) < 1 || "" === this.content.edit.date.year || Number.isNaN(parseFloat(this.content.edit.date.year))) && e.push("un año correcto"), -1 === this.content.edit.date.time && e.push("un periodo correcto"), e.length) { let n = ""; n += "<li>Recuerda poner ", [].forEach.call(e, (t, e, a) => { n += t, a.length - 2 === e ? n += " y " : a.length === e + 1 ? n += "." : a.length > e && (n += ", ") }), n += "</li>", t += n } return t }, secondCheck() { let t = ""; return Object.keys(this.content.edit).length ? (-1 === this.content.edit.status && (t += "<li>Selecciona un estado para el tema.</li>"), this.info.people.length || (t += "<li>Selecciona al menos un personaje.</li>"), t) : t }, finalCheck() { return JSON.stringify(this.content.current) !== JSON.stringify(this.finalData) }, finalData() { let t = JSON.parse(JSON.stringify(this.content.edit)); if (!Object.keys(this.content.edit).length) return t; let e = "", n = ""; return [].forEach.call(JSON.parse(JSON.stringify(this.sortedEditCharacters)), (t, a, o) => { e += t, n += Vue.filter("just-name")(t), o.length - 2 === a ? (e += " y ", n += " y ") : o.length === a + 1 ? (e += "", n += "") : o.length > a && (e += ", ", n += ", ") }), t.people.count = this.info.people.length, t.people.list = e, t.people.short = n, "new" === this.$parent.modal.type && (t.position = this.$parent.content.edit.length), t }, sortedCharacters() { return Object.keys(this.content.edit).length ? this.$parent.users.map(t => t.user).filter(t => -1 === this.info.people.indexOf(t)).filter(t => t.toLowerCase().indexOf(this.info.user.toLowerCase()) > -1) : this.$parent.users.map(t => t.user) }, sortedEditCharacters() { return this.info.people.sort((t, e) => t < e ? -1 : t > e ? 1 : 0) } }, methods: { modalClose() { this.$parent.modal.type = "new", this.$parent.modal.status = !1, this.$parent.setEntry() }, pushElement() { "edit" === this.$parent.modal.type && this.$parent.content.edit.splice(this.$parent.content.edit.map(t => t.position).indexOf(this.content.current.position), 1), this.$parent.content.edit.push(this.finalData), this.modalClose() }, addCharacter: function (t) { this.info.people.push(t), this.info.selector = !1, this.info.user = "", setTimeout(() => { this.info.selector = !0 }, 250) }, deleteCharacter: function (t) { const e = JSON.parse(JSON.stringify(this.content.edit.status)); this.info.people.splice(t, 1), this.forceRerender(), this.content.edit.status = -1, this.content.edit.status = e } }, created() { let t = []; "" !== this.content.edit.people.list && (t = -1 === this.content.edit.people.list.indexOf(" y ") ? [this.content.edit.people.list] : this.content.edit.people.list.split(" y ")[0].split(", ").concat(this.content.edit.people.list.split(" y ")[1])), this.info.people = t }, template: '\n <modal-foro :data-title="modalTitle" v-on:modal-close="modalClose()">\n <template v-if="page === 0">\n <template slot="content">\n <aviso-foro v-show="oneCheck.length">\n <ul v-html="oneCheck"></ul>\n </aviso-foro>\n <ul class="forum-fieldlist no-style">\n <li>\n <campo-foro data-name="Título">\n <input type="text" v-model="content.edit.name" placeholder="Escribe el nombre del tema." />\n </campo-foro>\n </li>\n <li>\n <campo-foro data-name="Enlace">\n <input type="text" v-model="content.edit.link" placeholder="Escribe el enlace del tema." />\n </campo-foro>\n </li>\n <li>\n <campo-foro data-name="Fecha">\n <div class="input-date">\n <div class="date-element date-dmy">\n <label>\n Día\n <input type="text" v-model="content.edit.date.day" placeholder="0" />\n </label>\n <label>\n Mes\n <input type="text" v-model="content.edit.date.month" placeholder="0" />\n </label>\n <label>\n Año\n <input type="text" v-model="content.edit.date.year" placeholder="0" />\n </label>\n </div>\n <div class="date-element not-show mt-4">\n <label>\n Periodo\n <div class="select-container">\n <select v-model="content.edit.date.time">\n <option value="-1" hidden>-</option>\n <option value="AFI">AFI</option>\n <option value="DFI">DFI</option>\n </select>\n </div>\n </label>\n </div>\n </div>\n </campo-foro>\n </li>\n </ul>\n </template>\n <template slot="controls" v-if="!oneCheck.length">\n <controles-modal>\n <button class="button1 btn-main" v-on:click="page = 1" title="Paso siguiente">Siguiente</button>\n </controles-modal>\n </template>\n </template>\n <template v-else-if="page === 1">\n <template slot="content">\n <aviso-foro v-show="secondCheck.length">\n <ul v-html="secondCheck"></ul>\n </aviso-foro>\n <ul class="forum-fieldlist no-style">\n <li>\n <campo-foro data-name="Estado">\n <div class="select-container">\n <select v-model="content.edit.status">\n <option value="-1" selected="selected" hidden="hidden">Selecciona un estado para el tema</option>\n <option value="ropened">Activo</option>\n <option value="rclosed">Cerrado</option>\n <option value="rabandoned">Abandonado</option>\n </select>\n </div>\n </campo-foro>\n </li>\n <li>\n <campo-foro data-name="Personajes">\n <div class="character-selector">\n <input type="text" v-model="info.user" placeholder="Escribe el nombre de un personaje." />\n <ul class="no-style selector-list" v-if="sortedCharacters.length > 0 && info.selector">\n <li v-for="(character, index) in sortedCharacters" v-on:click="addCharacter(character)" :title="\'Seleccionar «\' + character + \'»\'">{{ character }}<i class="fas fa-plus"></i></li>\n </ul>\n <a class="character-custom" v-on:click="addCharacter(info.user)" v-if="info.user.length > 2" :title="\'Seleccionar «\' + info.user + \'»\'">\n <i class="fas fa-plus"></i>\n </a>\n </div>\n <ul v-if="info.people.length" class="no-style character-list">\n <li v-for="(character, index) in sortedEditCharacters" v-on:click="deleteCharacter(index)" :title="\'Quitar \' + character"><i class="fas fa-times"></i> {{ character }}</li>\n </ul>\n </campo-foro>\n </li>\n </ul>\n </template>\n <template slot="controls">\n <controles-modal>\n <button class="button2" v-on:click="page = 0" title="Paso anterior">Anterior</button>\n <button class="button1 btn-main" v-on:click="pushElement()" v-if="!secondCheck.length && finalCheck" title="Guardar entrada">Guardar</button>\n </controles-modal>\n </template>\n </template>\n </modal-foro>\n ' }), Vue.component("gestor-cronologia", { data() { return { render: 0, modal: { type: "new", status: !1 }, users: [], state: { page: 0, pagination: 0 }, entry: {}, content: { edit: [], current: [] } } }, computed: { sortedContent() { return JSON.parse(JSON.stringify(this.content.edit)).sort(({ date: t, name: e }, { date: n, name: a }) => { if (t.time !== n.time) return "AFI" === t.time ? -1 : 1; const o = "AFI" === t.time ? n : t, i = "AFI" === t.time ? t : n; return parseFloat(t.year) !== parseFloat(n.year) ? parseFloat(o.year) - parseFloat(i.year) : parseFloat(t.month) !== parseFloat(n.month) ? parseFloat(o.month) - parseFloat(i.month) : parseFloat(t.day) !== parseFloat(n.day) ? parseFloat(o.day) - parseFloat(i.day) : e - a }) }, paginationContent() { const t = forumConfig.skinOptions.paginationDefault, e = Math.floor((this.sortedContent.length - 1) / t) + 1; let n = []; for (let t = 0; t < e; t++)n.push(t); return this.forceRerender(), { pages: n, content: this.sortedContent.slice(this.state.pagination * t, (this.state.pagination + 1) * t) } }, finalCheck() { return JSON.stringify(this.content.current) !== JSON.stringify(this.content.edit) } }, methods: { forceRerender() { this.render += 1 }, setEntry() { this.entry = { link: "", name: "", status: -1, people: { list: "", short: "", count: 0 }, date: { time: "DFI", day: "", month: "", year: "" } } }, addEntry: function (t) { t.preventDefault(), this.modal.status = !0 }, save: function (t) { t.preventDefault(), this.state.page = 2; const e = this.sortedContent.map(t => (void 0 !== t.desc && delete t.desc, void 0 !== t.position && delete t.position, t)); FNR.user.profile.setData([{ name: forumConfig.profileUser.cronoField, type: "textarea", value: JSON.stringify(e).replace(/"/g, "`") }]).then(t => { t ? (FNR.html.genNotification("Atención", "Información actualizada sin inconvenientes.", "fas fa-check"), setTimeout(() => { window.location.reload() }, 2e3)) : FNR.html.genNotification("Atención", "Hubo un problema al actualizar. Dale otro intento.", "fas fa-exclamation") }) } }, created() { FNR.user.profile.getData([{ name: forumConfig.profileUser.cronoField, type: "textarea" }]).then(t => { const e = FNR.utility.genArray(t[0].value).map((t, e) => { let n = t; return n.position = e, n }); this.content.edit = e, this.content.current = JSON.parse(JSON.stringify(e)), FNR.forum.getMembers().then(t => { this.setEntry(), this.users = t, this.state.page = 1 }) }) }, template: '\n <section id="forum-chronology" class="wiki-content is-dramatic">\n <div class="is-content">\n <h2>Cronología</h2>\n <hr />\n <p>En esta página podrás editar la cronología de tu personaje. Experimenta con su funcionamiento, es bastante intuitivo.</p>\n </div>\n <separador-foro />\n <template v-if="state.page === 0">\n <cargando-foro data-text="Cargando utilidad…"></cargando-foro>\n </template>\n <template v-else-if="state.page === 1">\n <modal-cronologia v-if="modal.status" :data-type="modal.type" :data-element="entry"></modal-cronologia>\n <mando-foro data-id="upper-controls" data-app="true">\n <template slot="pagination" v-if="paginationContent.pages.length > 1">\n <a class="page-action" title="Ir a la página anterior" v-if="state.pagination > 0" v-on:click="state.pagination -= 1">\n <i class="fas fa-chevron-left"></i>\n </a>\n <template v-for="page in paginationContent.pages">\n <strong v-if="page === state.pagination">{{ page + 1 }}</strong>\n <a class="page-link" :title="\'Ir a la página «\' + (page + 1) + \'»\'" v-else v-on:click="state.pagination = page">{{ page + 1 }}</a>\n </template>\n <a class="page-action" title="Ir a la página siguiente" v-if="(state.pagination + 1) < paginationContent.pages.length" v-on:click="state.pagination += 1">\n <i class="fas fa-chevron-right"></i>\n </a>\n </template>\n <template slot="controls">\n <li v-on:click="addEntry($event)">\n <boton-foro data-url="#" data-name="Añadir" data-icon="fas fa-plus"></boton-foro>\n </li>\n <li v-if="finalCheck" v-on:click="save($event)">\n <boton-foro data-url="#" data-name="Guardar" data-icon="fas fa-save" data-type="no-name"></boton-foro>\n </li>\n </template>\n </mando-foro>\n <ul id="forum-rplist" class="no-style" :key="render">\n <template v-if="!paginationContent.content.length">\n <li class="is-not-lastpost not-status">\n <h6>No hay entradas en tu cronología</h6>\n </li>\n </template>\n <template v-else v-for="rp in paginationContent.content">\n <elemento-cronologia :data-element="rp" data-type="manager" :data-id="rp.position" />\n </template>\n </ul>\n <mando-foro data-id="lower-controls" data-app="true">\n <template slot="pagination" v-if="paginationContent.pages.length > 1">\n <a class="page-action" title="Ir a la página anterior" v-if="state.pagination > 0" v-on:click="state.pagination -= 1">\n <i class="fas fa-chevron-left"></i>\n </a>\n <template v-for="page in paginationContent.pages">\n <strong v-if="page === state.pagination">{{ page + 1 }}</strong>\n <a class="page-link" :title="\'Ir a la página «\' + (page + 1) + \'»\'" v-else v-on:click="state.pagination = page">{{ page + 1 }}</a>\n </template>\n <a class="page-action" title="Ir a la página siguiente" v-if="(state.pagination + 1) < paginationContent.pages.length" v-on:click="state.pagination += 1">\n <i class="fas fa-chevron-right"></i>\n </a>\n </template>\n <template slot="controls">\n <li v-on:click="addEntry($event)">\n <boton-foro data-url="#" data-name="Añadir" data-icon="fas fa-plus"></boton-foro>\n </li>\n <li v-if="finalCheck" v-on:click="save($event)">\n <boton-foro data-url="#" data-name="Guardar" data-icon="fas fa-save" data-type="no-name"></boton-foro>\n </li>\n </template>\n </mando-foro>\n </template>\n <template v-else-if="state.page === 2">\n <cargando-foro data-text="Actualizando información…"></cargando-foro>\n </template>\n </section>\n ' }), Vue.component("elemento-cronologia", { props: ["dataElement", "dataType", "dataId"], data() { return { content: this.dataElement } }, methods: { deleteElement() { this.$parent.content.edit.splice(this.$parent.content.edit.map(t => t.position).indexOf(this.dataId), 1), 0 === this.$parent.paginationContent.content.length && 0 !== this.$parent.state.pagination && (this.$parent.state.pagination -= 1), this.$parent.forceRerender() }, editElement() { this.$parent.modal.type = "edit", this.$parent.entry = this.content, this.$parent.modal.status = !0 } }, template: '\n <li class="rp-list">\n <template v-if="dataType === \'manager\'">\n <a class="rp-element rp-manager">\n <div class="rp-icon">\n <template v-if="content.status === \'ropened\'">\n <i class="fas fa-lock-open"></i>\n </template>\n <template v-else-if="content.status === \'rclosed\'">\n <i class="fas fa-lock"></i>\n </template>\n <template v-else-if="content.status === \'rabandoned\'">\n <i class="fas fa-times"></i>\n </template>\n </div>\n <div class="rp-content">\n <div class="rp-name">\n <span>{{ content.name }}</span>\n <small>\n {{ content.date.day | to-number | in-two-digits }}/{{ content.date.month | to-number | in-two-digits }}/{{ content.date.year | to-number | in-two-digits }} - <template v-if="content.people.count < 4">{{ content.people.short }}</template><template v-else>Invitados</template>\n </small>\n </div>\n <div class="rp-controls">\n <span v-on:click="editElement()" title="Editar entrada">Editar</span> / <span v-on:click="deleteElement()" title="Eliminar entrada">Eliminar</span>\n </div>\n </div>\n </a>\n </template>\n <template v-else-if="dataType === \'profile\'">\n <a class="rp-element" :href="content.link" target="_blank" :title="\'Ir al tema «\' + content.name + \'»\'">\n <div class="rp-icon">\n <template v-if="content.status === \'ropened\'">\n <i class="fas fa-lock-open"></i>\n </template>\n <template v-else-if="content.status === \'rclosed\'">\n <i class="fas fa-lock"></i>\n </template>\n <template v-else-if="content.status === \'rabandoned\'">\n <i class="fas fa-times"></i>\n </template>\n </div>\n <div class="rp-content">\n <div class="rp-name">\n <span>{{ content.name }}</span>\n <small>\n {{ content.date.day | to-number | in-two-digits }}/{{ content.date.month | to-number | in-two-digits }}/{{ content.date.year | to-number | in-two-digits }} - <template v-if="content.people.count < 4">{{ content.people.short }}</template><template v-else>Invitados</template>\n </small>\n </div>\n </div>\n </a>\n </template>\n </li>\n ' });
|
package/apps/vueDefault.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Vue.component('panel-control', {
|
|
2
2
|
props: ['dataElements'],
|
|
3
|
-
data
|
|
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
|
|
16
|
+
validationPanel() {
|
|
17
17
|
return FNR.utility.genValidation(this.content.current)
|
|
18
18
|
},
|
|
19
|
-
toSave
|
|
19
|
+
toSave() {
|
|
20
20
|
let final = [];
|
|
21
21
|
|
|
22
22
|
[].forEach.call(this.content.current, (item, index) => {
|
|
@@ -33,7 +33,7 @@ Vue.component('panel-control', {
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
methods: {
|
|
36
|
-
updateProfile
|
|
36
|
+
updateProfile() {
|
|
37
37
|
this.state.page = 2;
|
|
38
38
|
|
|
39
39
|
FNR.user.profile.setData(this.toSave).then((r) => {
|
|
@@ -109,7 +109,7 @@ Vue.component('panel-control', {
|
|
|
109
109
|
});
|
|
110
110
|
|
|
111
111
|
Vue.component('lista-bosquejos', {
|
|
112
|
-
data
|
|
112
|
+
data() {
|
|
113
113
|
return {
|
|
114
114
|
state: {
|
|
115
115
|
page: 0
|
|
@@ -160,7 +160,7 @@ Vue.component('lista-bosquejos', {
|
|
|
160
160
|
});
|
|
161
161
|
|
|
162
162
|
Vue.component('editor-foro', {
|
|
163
|
-
data
|
|
163
|
+
data() {
|
|
164
164
|
return {
|
|
165
165
|
state: {
|
|
166
166
|
page: 0,
|
|
@@ -194,7 +194,7 @@ Vue.component('editor-foro', {
|
|
|
194
194
|
}
|
|
195
195
|
},
|
|
196
196
|
computed: {
|
|
197
|
-
msgCheck
|
|
197
|
+
msgCheck() {
|
|
198
198
|
let final = '';
|
|
199
199
|
|
|
200
200
|
if (this.state.guest) {
|
|
@@ -229,7 +229,7 @@ Vue.component('editor-foro', {
|
|
|
229
229
|
|
|
230
230
|
return final;
|
|
231
231
|
},
|
|
232
|
-
sortedCharacters
|
|
232
|
+
sortedCharacters() {
|
|
233
233
|
if (!Object.keys(this.users.options).length) return [];
|
|
234
234
|
else return this.users.options.map((item) => {
|
|
235
235
|
return item.user;
|
|
@@ -243,7 +243,7 @@ Vue.component('editor-foro', {
|
|
|
243
243
|
return 0;
|
|
244
244
|
});
|
|
245
245
|
},
|
|
246
|
-
sortedEditCharacters
|
|
246
|
+
sortedEditCharacters() {
|
|
247
247
|
return this.users.selected.sort((a, b) => {
|
|
248
248
|
if (a < b) return -1;
|
|
249
249
|
else if (a > b) return 1;
|
|
@@ -271,7 +271,7 @@ Vue.component('editor-foro', {
|
|
|
271
271
|
|
|
272
272
|
this.content.msg = myField.value;
|
|
273
273
|
},
|
|
274
|
-
newDice
|
|
274
|
+
newDice() {
|
|
275
275
|
this.dice.current.push({
|
|
276
276
|
dice: -1,
|
|
277
277
|
number: 0
|
|
@@ -290,11 +290,11 @@ Vue.component('editor-foro', {
|
|
|
290
290
|
this.users.current = '';
|
|
291
291
|
this.users.selected.splice(index, 1);
|
|
292
292
|
},
|
|
293
|
-
changeGroup
|
|
293
|
+
changeGroup() {
|
|
294
294
|
this.users.selected = [];
|
|
295
295
|
this.users.current = '';
|
|
296
296
|
},
|
|
297
|
-
insertUrl
|
|
297
|
+
insertUrl() {
|
|
298
298
|
const myField = document.getElementById('usereply-editor');
|
|
299
299
|
const startPos = myField.selectionStart;
|
|
300
300
|
const endPos = myField.selectionEnd;
|
|
@@ -307,7 +307,7 @@ Vue.component('editor-foro', {
|
|
|
307
307
|
}
|
|
308
308
|
});
|
|
309
309
|
},
|
|
310
|
-
insertImg
|
|
310
|
+
insertImg() {
|
|
311
311
|
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) => {
|
|
312
312
|
if (result !== false) {
|
|
313
313
|
this.insertSomething('[img=' + result + ']', '[/img]');
|
|
@@ -316,7 +316,7 @@ Vue.component('editor-foro', {
|
|
|
316
316
|
}
|
|
317
317
|
});
|
|
318
318
|
},
|
|
319
|
-
insertSpoiler
|
|
319
|
+
insertSpoiler() {
|
|
320
320
|
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) => {
|
|
321
321
|
if (result !== false) {
|
|
322
322
|
this.insertSomething('[spoiler=' + result + ']', '[/spoiler]');
|
|
@@ -325,7 +325,7 @@ Vue.component('editor-foro', {
|
|
|
325
325
|
}
|
|
326
326
|
});
|
|
327
327
|
},
|
|
328
|
-
insertQuote
|
|
328
|
+
insertQuote() {
|
|
329
329
|
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) => {
|
|
330
330
|
if (result !== false) {
|
|
331
331
|
this.insertSomething('[quote=' + result + ']', '[/quote]');
|
|
@@ -334,7 +334,7 @@ Vue.component('editor-foro', {
|
|
|
334
334
|
}
|
|
335
335
|
});
|
|
336
336
|
},
|
|
337
|
-
parseMsg
|
|
337
|
+
parseMsg() {
|
|
338
338
|
window.forumParsing = true;
|
|
339
339
|
|
|
340
340
|
if (document.querySelector('#forum-realreply > form .sceditor-container > textarea')) {
|
|
@@ -400,17 +400,17 @@ Vue.component('editor-foro', {
|
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
},
|
|
403
|
-
draftMsg
|
|
403
|
+
draftMsg() {
|
|
404
404
|
this.parseMsg();
|
|
405
405
|
|
|
406
406
|
document.querySelector('#forum-realreply > form input[value="Bosquejo"], #forum-realreply input[value="Modificar"]').click();
|
|
407
407
|
},
|
|
408
|
-
sendMsg
|
|
408
|
+
sendMsg() {
|
|
409
409
|
this.parseMsg();
|
|
410
410
|
|
|
411
411
|
document.querySelector('#forum-realreply > form input[value="Enviar"], #forum-realreply input[value="Publicar"]').click();
|
|
412
412
|
},
|
|
413
|
-
prevMsg
|
|
413
|
+
prevMsg() {
|
|
414
414
|
this.parseMsg();
|
|
415
415
|
|
|
416
416
|
document.querySelector('#forum-realreply > form input[value="Previsualización"], #forum-realreply input[value="Previsualizar"]').click();
|
package/apps/vueMulti.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Vue.component('modal-multicuentas', {
|
|
2
2
|
props: ['dataElement', 'dataType'],
|
|
3
|
-
data
|
|
3
|
+
data() {
|
|
4
4
|
return {
|
|
5
5
|
state: {
|
|
6
6
|
modal: false
|
|
@@ -12,11 +12,11 @@ Vue.component('modal-multicuentas', {
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
computed: {
|
|
15
|
-
modalTitle
|
|
15
|
+
modalTitle() {
|
|
16
16
|
if (this.dataType === 'new') return 'Nuevo usuario';
|
|
17
17
|
else if (this.dataType === 'edit') return 'Editar usuario';
|
|
18
18
|
},
|
|
19
|
-
oneCheck
|
|
19
|
+
oneCheck() {
|
|
20
20
|
let final = '';
|
|
21
21
|
|
|
22
22
|
if (this.content.edit.name.length < 4) {
|
|
@@ -29,18 +29,18 @@ Vue.component('modal-multicuentas', {
|
|
|
29
29
|
|
|
30
30
|
return final;
|
|
31
31
|
},
|
|
32
|
-
finalCheck
|
|
32
|
+
finalCheck() {
|
|
33
33
|
return JSON.stringify(this.content.current) !== JSON.stringify(this.content.edit);
|
|
34
34
|
}
|
|
35
35
|
},
|
|
36
36
|
methods: {
|
|
37
|
-
modalClose
|
|
37
|
+
modalClose() {
|
|
38
38
|
this.$parent.modal.type = 'new';
|
|
39
39
|
this.$parent.modal.status = false;
|
|
40
40
|
this.$parent.setEntry();
|
|
41
41
|
this.$parent.forceRerender();
|
|
42
42
|
},
|
|
43
|
-
pushElement
|
|
43
|
+
pushElement() {
|
|
44
44
|
if (this.$parent.modal.type === 'edit') {
|
|
45
45
|
let id = this.$parent.content.accounts.edit.map((item) => {
|
|
46
46
|
return item.id;
|
|
@@ -98,7 +98,7 @@ Vue.component('modal-multicuentas', {
|
|
|
98
98
|
});
|
|
99
99
|
|
|
100
100
|
Vue.component('gestor-multicuentas', {
|
|
101
|
-
data
|
|
101
|
+
data() {
|
|
102
102
|
return {
|
|
103
103
|
render: 0,
|
|
104
104
|
modal: {
|
|
@@ -127,7 +127,7 @@ Vue.component('gestor-multicuentas', {
|
|
|
127
127
|
}
|
|
128
128
|
},
|
|
129
129
|
computed: {
|
|
130
|
-
msgCheck
|
|
130
|
+
msgCheck() {
|
|
131
131
|
let final = '';
|
|
132
132
|
|
|
133
133
|
if (this.content.password.value.length < 5) {
|
|
@@ -136,10 +136,10 @@ Vue.component('gestor-multicuentas', {
|
|
|
136
136
|
|
|
137
137
|
return final;
|
|
138
138
|
},
|
|
139
|
-
finalCheck
|
|
139
|
+
finalCheck() {
|
|
140
140
|
return JSON.stringify(this.content.accounts.current) !== JSON.stringify(this.content.accounts.edit);
|
|
141
141
|
},
|
|
142
|
-
sortedCharacters
|
|
142
|
+
sortedCharacters() {
|
|
143
143
|
return this.content.accounts.edit.sort((a, b) => {
|
|
144
144
|
if (a.name < b.name) return -1;
|
|
145
145
|
else if (a.name > b.name) return 1;
|
|
@@ -148,16 +148,16 @@ Vue.component('gestor-multicuentas', {
|
|
|
148
148
|
}
|
|
149
149
|
},
|
|
150
150
|
methods: {
|
|
151
|
-
modalClose
|
|
151
|
+
modalClose() {
|
|
152
152
|
this.state.page = 3;
|
|
153
153
|
setTimeout(() => {
|
|
154
154
|
window.location.reload();
|
|
155
155
|
}, 2500);
|
|
156
156
|
},
|
|
157
|
-
forceRerender
|
|
157
|
+
forceRerender() {
|
|
158
158
|
this.render += 1;
|
|
159
159
|
},
|
|
160
|
-
setEntry
|
|
160
|
+
setEntry() {
|
|
161
161
|
this.entry = {
|
|
162
162
|
name: '',
|
|
163
163
|
id: '',
|
|
@@ -175,10 +175,10 @@ Vue.component('gestor-multicuentas', {
|
|
|
175
175
|
|
|
176
176
|
this.updateData();
|
|
177
177
|
},
|
|
178
|
-
updateLocal
|
|
178
|
+
updateLocal() {
|
|
179
179
|
this.updateData();
|
|
180
180
|
},
|
|
181
|
-
updateForum
|
|
181
|
+
updateForum() {
|
|
182
182
|
this.content.accounts.edit = FNR.cache.getData('usermultiaccounts').map((item) => {
|
|
183
183
|
return {
|
|
184
184
|
name: item.name,
|
|
@@ -187,7 +187,7 @@ Vue.component('gestor-multicuentas', {
|
|
|
187
187
|
});
|
|
188
188
|
this.updateData();
|
|
189
189
|
},
|
|
190
|
-
setData
|
|
190
|
+
setData() {
|
|
191
191
|
this.state.page = 3;
|
|
192
192
|
|
|
193
193
|
FNR.cache.setData('userpassword', this.content.password.value, -1);
|
|
@@ -196,7 +196,7 @@ Vue.component('gestor-multicuentas', {
|
|
|
196
196
|
window.location.reload();
|
|
197
197
|
}, 2500);
|
|
198
198
|
},
|
|
199
|
-
updateData
|
|
199
|
+
updateData() {
|
|
200
200
|
this.state.page = 3;
|
|
201
201
|
|
|
202
202
|
const data = this.content.accounts.edit.map((item) => {
|
|
@@ -392,18 +392,18 @@ Vue.component('gestor-multicuentas', {
|
|
|
392
392
|
|
|
393
393
|
Vue.component('elemento-multicuentas', {
|
|
394
394
|
props: ['dataElement', 'dataId'],
|
|
395
|
-
data
|
|
395
|
+
data() {
|
|
396
396
|
return {
|
|
397
397
|
content: this.dataElement
|
|
398
398
|
}
|
|
399
399
|
},
|
|
400
400
|
methods: {
|
|
401
|
-
deleteElement
|
|
401
|
+
deleteElement() {
|
|
402
402
|
this.$parent.content.accounts.edit.splice(this.dataId, 1);
|
|
403
403
|
|
|
404
404
|
this.$parent.forceRerender();
|
|
405
405
|
},
|
|
406
|
-
editElement
|
|
406
|
+
editElement() {
|
|
407
407
|
this.$parent.modal.type = 'edit';
|
|
408
408
|
this.$parent.entry = this.content;
|
|
409
409
|
this.$parent.modal.status = true;
|
package/apps/vueMulti.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Vue.component("modal-multicuentas", { props: ["dataElement", "dataType"], data: function () { return { state: { modal: !1 }, content: { edit: JSON.parse(JSON.stringify(this.dataElement)), current: this.dataElement } } }, computed: { modalTitle: function () { return "new" === this.dataType ? "Nuevo usuario" : "edit" === this.dataType ? "Editar usuario" : void 0 }, oneCheck: function () { let t = ""; return this.content.edit.name.length < 4 && (t += "<li>Escribe el nombre de la cuenta.</li>"), this.content.edit.password.length < 4 && (t += "<li>Escribe la contraseña de la cuenta.</li>"), t }, finalCheck: function () { return JSON.stringify(this.content.current) !== JSON.stringify(this.content.edit) } }, methods: { modalClose: function () { this.$parent.modal.type = "new", this.$parent.modal.status = !1, this.$parent.setEntry(), this.$parent.forceRerender() }, pushElement: function () { if ("edit" === this.$parent.modal.type) { let t = this.$parent.content.accounts.edit.map(t => t.id).indexOf(this.content.current.id); this.$parent.content.accounts.edit.splice(t, 1) } this.$parent.content.accounts.edit.push({ name: this.content.edit.name, type: "password", id: FNR.utility.genSlug(this.content.edit.name), password: this.content.edit.password }), this.modalClose() } }, template: '\n <modal-foro :data-title="modalTitle" v-on:modal-close="modalClose()">\n <template slot="content">\n <aviso-foro v-show="oneCheck.length">\n <ul v-html="oneCheck"></ul>\n </aviso-foro>\n <ul class="forum-fieldlist no-style">\n <li>\n <campo-foro data-name="Nombre">\n <input type="text" v-model="content.edit.name" placeholder="Escribe el nombre de la cuenta." />\n </campo-foro>\n </li>\n <li>\n <campo-foro data-name="Contraseña">\n <div class="character-selector">\n <input :type="content.edit.type" v-model="content.edit.password" placeholder="Escribe la contraseña de la cuenta." />\n <a class="character-custom" v-on:click="content.edit.type === \'text\' ? content.edit.type = \'password\' : content.edit.type = \'text\'" title="Cambiar modo">\n <template v-if="content.edit.type === \'text\'">\n <i class="fas fa-eye-slash"></i>\n </template>\n <template v-else-if="content.edit.type === \'password\'">\n <i class="fas fa-eye"></i>\n </template>\n </a>\n </div>\n </campo-foro>\n </li>\n </ul>\n </template>\n <template slot="controls">\n <controles-modal v-if="!oneCheck.length && finalCheck">\n <button class="button1 btn-main" v-on:click="pushElement()" title="Guardar entrada">Guardar</button>\n </controles-modal>\n </template>\n </modal-foro>\n ' }), Vue.component("gestor-multicuentas", { data: function () { return { render: 0, modal: { type: "new", status: !1, bonus: !1 }, state: { new: !1, error: !1, page: 0, pagination: 0 }, entry: {}, content: { encrypted: {}, password: { type: "password", value: "" }, accounts: { current: [], edit: [] } } } }, computed: { msgCheck: function () { let t = ""; return this.content.password.value.length < 5 && (t += "<li>Escribe la contraseña maestra.</li>"), t }, finalCheck: function () { return JSON.stringify(this.content.accounts.current) !== JSON.stringify(this.content.accounts.edit) }, sortedCharacters: function () { return this.content.accounts.edit.sort((t, e) => t.name < e.name ? -1 : t.name > e.name ? 1 : 0) } }, methods: { modalClose: function () { this.state.page = 3, setTimeout(() => { window.location.reload() }, 2500) }, forceRerender: function () { this.render += 1 }, setEntry: function () { this.entry = { name: "", id: "", type: "password", password: "" } }, addEntry: function (t) { t.preventDefault(), this.modal.status = !0 }, save: function (t) { t.preventDefault(), this.updateData() }, updateLocal: function () { this.updateData() }, updateForum: function () { this.content.accounts.edit = FNR.cache.getData("usermultiaccounts").map(t => ({ name: t.name, password: sjcl.decrypt(this.content.password.value, t.password) })), this.updateData() }, setData: function () { this.state.page = 3, FNR.cache.setData("userpassword", this.content.password.value, -1), setTimeout(() => { window.location.reload() }, 2500) }, updateData: function () { this.state.page = 3; const t = this.content.accounts.edit.map(t => ({ name: t.name, password: sjcl.encrypt(this.content.password.value, t.password) })); FNR.cache.setData("userpassword", this.content.password.value, -1), FNR.cache.setData("usermultiaccounts", t, -1), FNR.user.profile.setData([{ name: forumConfig.profileUser.accountsField, type: "textarea", value: JSON.stringify([{ password: this.state.new ? sjcl.encrypt(this.content.password.value, "gaylien_masterpass") : this.content.encrypted.password, accounts: t }]).replace(/"/g, "`") }]).then(t => { t ? (FNR.html.genNotification("Atención", "Información actualizada sin inconvenientes.", "fas fa-check"), setTimeout(() => { window.location.reload() }, 2500)) : FNR.html.genNotification("Atención", "Hubo un problema al actualizar. Dale otro intento.", "fas fa-exclamation") }) } }, created() { FNR.user.profile.getData([{ name: forumConfig.profileUser.accountsField, type: "textarea" }]).then(t => { if (this.content.encrypted = FNR.utility.genArray(t[0].value)[0], this.state.new = 0 === Object.keys(this.content.encrypted).length, FNR.cache.getData("userpassword")) try { sjcl.decrypt(FNR.cache.getData("userpassword"), this.content.encrypted.password) } catch (t) { "ccm: tag doesn't match" === t.message && (this.state.error = !0, FNR.cache.delData("userpassword"), setTimeout(() => { window.location.reload() }, 2500)) } finally { if (!this.state.error) if (this.state.new && FNR.cache.getData("usermultiaccounts").length > 0) this.state.page = 3, FNR.user.profile.setData([{ name: forumConfig.profileUser.accountsField, type: "textarea", value: JSON.stringify([{ password: sjcl.encrypt(FNR.cache.getData("userpassword"), "gaylien_masterpass"), accounts: FNR.cache.getData("usermultiaccounts") }]).replace(/"/g, "`") }]).then(t => { t ? (FNR.html.genNotification("Atención", "Información actualizada sin inconvenientes.", "fas fa-check"), setTimeout(() => { window.location.reload() }, 2500)) : FNR.html.genNotification("Atención", "Hubo un problema al actualizar. Dale otro intento.", "fas fa-exclamation") }); else { let t = []; this.content.password.value = FNR.cache.getData("userpassword"), this.state.new || (t = JSON.parse(JSON.stringify(this.content.encrypted)).accounts.map(t => ({ name: t.name, type: "password", id: FNR.utility.genSlug(t.name), password: sjcl.decrypt(this.content.password.value, t.password) }))), this.setEntry(), this.content.accounts.edit = t, this.content.accounts.current = JSON.parse(JSON.stringify(t)), this.state.page = 2, this.state.new || JSON.stringify(FNR.cache.getData("usermultiaccounts")) === JSON.stringify(this.content.encrypted.accounts) || (this.modal.bonus = !0) } } else this.state.page = 1 }) }, template: '\n <section id="forum-multiaccount" class="wiki-content is-dramatic">\n <div class="is-content">\n <h2>Multicuentas</h2>\n <hr />\n <p>En esta página podrás configurar tu cambio de cuenta rápido. Experimenta con su funcionamiento, es bastante intuitivo.</p>\n </div>\n <separador-foro />\n <template v-if="state.page === 0">\n <cargando-foro data-text="Cargando utilidad…"></cargando-foro>\n </template>\n <template v-else-if="state.page === 1">\n <aviso-foro v-show="msgCheck.length">\n <ul v-html="msgCheck"></ul>\n </aviso-foro>\n <ul class="forum-fieldlist no-style">\n <li>\n <campo-foro data-name="Contraseña maestra">\n <div class="character-selector">\n <input :type="content.password.type" v-model="content.password.value" />\n <a class="character-custom" v-on:click="content.password.type === \'text\' ? content.password.type = \'password\' : content.password.type = \'text\'" title="Cambiar modo">\n <template v-if="content.password.type === \'text\'">\n <i class="fas fa-eye-slash"></i>\n </template>\n <template v-else-if="content.password.type === \'password\'">\n <i class="fas fa-eye"></i>\n </template>\n </a>\n </div>\n </campo-foro>\n </li>\n </ul>\n <div id="usereply-comand" v-if="!msgCheck.length">\n <button class="button1 btn-main" v-on:click="setData()">Guardar</button>\n </div>\n </template>\n <template v-else-if="state.page === 2">\n <modal-multicuentas v-if="modal.status" :data-type="modal.type" :data-element="entry"></modal-multicuentas>\n <modal-foro v-if="modal.bonus" data-title="Atención" v-on:modal-close="modalClose()">\n <template slot="content">\n <p>Hemos detectado que tienes dos versiones de tu base de datos de cuentas asociadas diferentes. Por favor, elige o actualizar la del dispositivo o la del foro.</p>\n </template>\n <template slot="controls">\n <controles-modal>\n <button class="button1 btn-main" v-on:click="updateForum()" title="Actualizar versión foro">Actualizar foro</button>\n <button class="button1" v-on:click="updateLocal()" title="Actualizar versión local">Actualizar local</button>\n </controles-modal>\n </template>\n </modal-foro>\n <mando-foro data-id="upper-controls" data-app="true">\n <template slot="controls">\n <li v-on:click="addEntry($event)">\n <boton-foro data-url="#" data-name="Añadir" data-icon="fas fa-plus"></boton-foro>\n </li>\n <li v-if="finalCheck" v-on:click="save($event)">\n <boton-foro data-url="#" data-name="Guardar" data-icon="fas fa-save" data-type="no-name"></boton-foro>\n </li>\n </template>\n </mando-foro>\n <ul class="no-style" :key="render">\n <template v-if="!sortedCharacters.length">\n <li class="is-not-lastpost not-status">\n <h6>No hay cuentas configuradas</h6>\n </li>\n </template>\n <template v-else v-for="(item, index) in sortedCharacters">\n <elemento-multicuentas :data-element="item" :data-id="index" :key="index"></elemento-multicuentas>\n </template>\n </ul>\n <mando-foro data-id="lower-controls" data-app="true">\n <template slot="controls">\n <li v-on:click="addEntry($event)">\n <boton-foro data-url="#" data-name="Añadir" data-icon="fas fa-plus"></boton-foro>\n </li>\n <li v-if="finalCheck" v-on:click="save($event)">\n <boton-foro data-url="#" data-name="Guardar" data-icon="fas fa-save" data-type="no-name"></boton-foro>\n </li>\n </template>\n </mando-foro>\n </template>\n <template v-else-if="state.page === 3">\n <cargando-foro data-text="Actualizando información…"></cargando-foro>\n </template>\n </section>\n ' }), Vue.component("elemento-multicuentas", { props: ["dataElement", "dataId"], data: function () { return { content: this.dataElement } }, methods: { deleteElement: function () { this.$parent.content.accounts.edit.splice(this.dataId, 1), this.$parent.forceRerender() }, editElement: function () { this.$parent.modal.type = "edit", this.$parent.entry = this.content, this.$parent.modal.status = !0 } }, template: '\n <li>\n <campo-foro :data-name="content.name">\n <div class="character-selector">\n <input :type="content.type" v-model="content.password" disabled/>\n <span class="character-custom rp-controls">\n <span v-on:click="editElement()" title="Editar entrada">Editar</span> / <span v-on:click="deleteElement()" title="Eliminar entrada">Eliminar</span>\n </span>\n </div>\n </campo-foro>\n </li>\n ' });
|
|
1
|
+
Vue.component("modal-multicuentas", { props: ["dataElement", "dataType"], data() { return { state: { modal: !1 }, content: { edit: JSON.parse(JSON.stringify(this.dataElement)), current: this.dataElement } } }, computed: { modalTitle() { return "new" === this.dataType ? "Nuevo usuario" : "edit" === this.dataType ? "Editar usuario" : void 0 }, oneCheck() { let t = ""; return this.content.edit.name.length < 4 && (t += "<li>Escribe el nombre de la cuenta.</li>"), this.content.edit.password.length < 4 && (t += "<li>Escribe la contraseña de la cuenta.</li>"), t }, finalCheck() { return JSON.stringify(this.content.current) !== JSON.stringify(this.content.edit) } }, methods: { modalClose() { this.$parent.modal.type = "new", this.$parent.modal.status = !1, this.$parent.setEntry(), this.$parent.forceRerender() }, pushElement() { if ("edit" === this.$parent.modal.type) { let t = this.$parent.content.accounts.edit.map(t => t.id).indexOf(this.content.current.id); this.$parent.content.accounts.edit.splice(t, 1) } this.$parent.content.accounts.edit.push({ name: this.content.edit.name, type: "password", id: FNR.utility.genSlug(this.content.edit.name), password: this.content.edit.password }), this.modalClose() } }, template: '\n <modal-foro :data-title="modalTitle" v-on:modal-close="modalClose()">\n <template slot="content">\n <aviso-foro v-show="oneCheck.length">\n <ul v-html="oneCheck"></ul>\n </aviso-foro>\n <ul class="forum-fieldlist no-style">\n <li>\n <campo-foro data-name="Nombre">\n <input type="text" v-model="content.edit.name" placeholder="Escribe el nombre de la cuenta." />\n </campo-foro>\n </li>\n <li>\n <campo-foro data-name="Contraseña">\n <div class="character-selector">\n <input :type="content.edit.type" v-model="content.edit.password" placeholder="Escribe la contraseña de la cuenta." />\n <a class="character-custom" v-on:click="content.edit.type === \'text\' ? content.edit.type = \'password\' : content.edit.type = \'text\'" title="Cambiar modo">\n <template v-if="content.edit.type === \'text\'">\n <i class="fas fa-eye-slash"></i>\n </template>\n <template v-else-if="content.edit.type === \'password\'">\n <i class="fas fa-eye"></i>\n </template>\n </a>\n </div>\n </campo-foro>\n </li>\n </ul>\n </template>\n <template slot="controls">\n <controles-modal v-if="!oneCheck.length && finalCheck">\n <button class="button1 btn-main" v-on:click="pushElement()" title="Guardar entrada">Guardar</button>\n </controles-modal>\n </template>\n </modal-foro>\n ' }), Vue.component("gestor-multicuentas", { data() { return { render: 0, modal: { type: "new", status: !1, bonus: !1 }, state: { new: !1, error: !1, page: 0, pagination: 0 }, entry: {}, content: { encrypted: {}, password: { type: "password", value: "" }, accounts: { current: [], edit: [] } } } }, computed: { msgCheck() { let t = ""; return this.content.password.value.length < 5 && (t += "<li>Escribe la contraseña maestra.</li>"), t }, finalCheck() { return JSON.stringify(this.content.accounts.current) !== JSON.stringify(this.content.accounts.edit) }, sortedCharacters() { return this.content.accounts.edit.sort((t, e) => t.name < e.name ? -1 : t.name > e.name ? 1 : 0) } }, methods: { modalClose() { this.state.page = 3, setTimeout(() => { window.location.reload() }, 2500) }, forceRerender() { this.render += 1 }, setEntry() { this.entry = { name: "", id: "", type: "password", password: "" } }, addEntry: function (t) { t.preventDefault(), this.modal.status = !0 }, save: function (t) { t.preventDefault(), this.updateData() }, updateLocal() { this.updateData() }, updateForum() { this.content.accounts.edit = FNR.cache.getData("usermultiaccounts").map(t => ({ name: t.name, password: sjcl.decrypt(this.content.password.value, t.password) })), this.updateData() }, setData() { this.state.page = 3, FNR.cache.setData("userpassword", this.content.password.value, -1), setTimeout(() => { window.location.reload() }, 2500) }, updateData() { this.state.page = 3; const t = this.content.accounts.edit.map(t => ({ name: t.name, password: sjcl.encrypt(this.content.password.value, t.password) })); FNR.cache.setData("userpassword", this.content.password.value, -1), FNR.cache.setData("usermultiaccounts", t, -1), FNR.user.profile.setData([{ name: forumConfig.profileUser.accountsField, type: "textarea", value: JSON.stringify([{ password: this.state.new ? sjcl.encrypt(this.content.password.value, "gaylien_masterpass") : this.content.encrypted.password, accounts: t }]).replace(/"/g, "`") }]).then(t => { t ? (FNR.html.genNotification("Atención", "Información actualizada sin inconvenientes.", "fas fa-check"), setTimeout(() => { window.location.reload() }, 2500)) : FNR.html.genNotification("Atención", "Hubo un problema al actualizar. Dale otro intento.", "fas fa-exclamation") }) } }, created() { FNR.user.profile.getData([{ name: forumConfig.profileUser.accountsField, type: "textarea" }]).then(t => { if (this.content.encrypted = FNR.utility.genArray(t[0].value)[0], this.state.new = 0 === Object.keys(this.content.encrypted).length, FNR.cache.getData("userpassword")) try { sjcl.decrypt(FNR.cache.getData("userpassword"), this.content.encrypted.password) } catch (t) { "ccm: tag doesn't match" === t.message && (this.state.error = !0, FNR.cache.delData("userpassword"), setTimeout(() => { window.location.reload() }, 2500)) } finally { if (!this.state.error) if (this.state.new && FNR.cache.getData("usermultiaccounts").length > 0) this.state.page = 3, FNR.user.profile.setData([{ name: forumConfig.profileUser.accountsField, type: "textarea", value: JSON.stringify([{ password: sjcl.encrypt(FNR.cache.getData("userpassword"), "gaylien_masterpass"), accounts: FNR.cache.getData("usermultiaccounts") }]).replace(/"/g, "`") }]).then(t => { t ? (FNR.html.genNotification("Atención", "Información actualizada sin inconvenientes.", "fas fa-check"), setTimeout(() => { window.location.reload() }, 2500)) : FNR.html.genNotification("Atención", "Hubo un problema al actualizar. Dale otro intento.", "fas fa-exclamation") }); else { let t = []; this.content.password.value = FNR.cache.getData("userpassword"), this.state.new || (t = JSON.parse(JSON.stringify(this.content.encrypted)).accounts.map(t => ({ name: t.name, type: "password", id: FNR.utility.genSlug(t.name), password: sjcl.decrypt(this.content.password.value, t.password) }))), this.setEntry(), this.content.accounts.edit = t, this.content.accounts.current = JSON.parse(JSON.stringify(t)), this.state.page = 2, this.state.new || JSON.stringify(FNR.cache.getData("usermultiaccounts")) === JSON.stringify(this.content.encrypted.accounts) || (this.modal.bonus = !0) } } else this.state.page = 1 }) }, template: '\n <section id="forum-multiaccount" class="wiki-content is-dramatic">\n <div class="is-content">\n <h2>Multicuentas</h2>\n <hr />\n <p>En esta página podrás configurar tu cambio de cuenta rápido. Experimenta con su funcionamiento, es bastante intuitivo.</p>\n </div>\n <separador-foro />\n <template v-if="state.page === 0">\n <cargando-foro data-text="Cargando utilidad…"></cargando-foro>\n </template>\n <template v-else-if="state.page === 1">\n <aviso-foro v-show="msgCheck.length">\n <ul v-html="msgCheck"></ul>\n </aviso-foro>\n <ul class="forum-fieldlist no-style">\n <li>\n <campo-foro data-name="Contraseña maestra">\n <div class="character-selector">\n <input :type="content.password.type" v-model="content.password.value" />\n <a class="character-custom" v-on:click="content.password.type === \'text\' ? content.password.type = \'password\' : content.password.type = \'text\'" title="Cambiar modo">\n <template v-if="content.password.type === \'text\'">\n <i class="fas fa-eye-slash"></i>\n </template>\n <template v-else-if="content.password.type === \'password\'">\n <i class="fas fa-eye"></i>\n </template>\n </a>\n </div>\n </campo-foro>\n </li>\n </ul>\n <div id="usereply-comand" v-if="!msgCheck.length">\n <button class="button1 btn-main" v-on:click="setData()">Guardar</button>\n </div>\n </template>\n <template v-else-if="state.page === 2">\n <modal-multicuentas v-if="modal.status" :data-type="modal.type" :data-element="entry"></modal-multicuentas>\n <modal-foro v-if="modal.bonus" data-title="Atención" v-on:modal-close="modalClose()">\n <template slot="content">\n <p>Hemos detectado que tienes dos versiones de tu base de datos de cuentas asociadas diferentes. Por favor, elige o actualizar la del dispositivo o la del foro.</p>\n </template>\n <template slot="controls">\n <controles-modal>\n <button class="button1 btn-main" v-on:click="updateForum()" title="Actualizar versión foro">Actualizar foro</button>\n <button class="button1" v-on:click="updateLocal()" title="Actualizar versión local">Actualizar local</button>\n </controles-modal>\n </template>\n </modal-foro>\n <mando-foro data-id="upper-controls" data-app="true">\n <template slot="controls">\n <li v-on:click="addEntry($event)">\n <boton-foro data-url="#" data-name="Añadir" data-icon="fas fa-plus"></boton-foro>\n </li>\n <li v-if="finalCheck" v-on:click="save($event)">\n <boton-foro data-url="#" data-name="Guardar" data-icon="fas fa-save" data-type="no-name"></boton-foro>\n </li>\n </template>\n </mando-foro>\n <ul class="no-style" :key="render">\n <template v-if="!sortedCharacters.length">\n <li class="is-not-lastpost not-status">\n <h6>No hay cuentas configuradas</h6>\n </li>\n </template>\n <template v-else v-for="(item, index) in sortedCharacters">\n <elemento-multicuentas :data-element="item" :data-id="index" :key="index"></elemento-multicuentas>\n </template>\n </ul>\n <mando-foro data-id="lower-controls" data-app="true">\n <template slot="controls">\n <li v-on:click="addEntry($event)">\n <boton-foro data-url="#" data-name="Añadir" data-icon="fas fa-plus"></boton-foro>\n </li>\n <li v-if="finalCheck" v-on:click="save($event)">\n <boton-foro data-url="#" data-name="Guardar" data-icon="fas fa-save" data-type="no-name"></boton-foro>\n </li>\n </template>\n </mando-foro>\n </template>\n <template v-else-if="state.page === 3">\n <cargando-foro data-text="Actualizando información…"></cargando-foro>\n </template>\n </section>\n ' }), Vue.component("elemento-multicuentas", { props: ["dataElement", "dataId"], data() { return { content: this.dataElement } }, methods: { deleteElement() { this.$parent.content.accounts.edit.splice(this.dataId, 1), this.$parent.forceRerender() }, editElement() { this.$parent.modal.type = "edit", this.$parent.entry = this.content, this.$parent.modal.status = !0 } }, template: '\n <li>\n <campo-foro :data-name="content.name">\n <div class="character-selector">\n <input :type="content.type" v-model="content.password" disabled/>\n <span class="character-custom rp-controls">\n <span v-on:click="editElement()" title="Editar entrada">Editar</span> / <span v-on:click="deleteElement()" title="Eliminar entrada">Eliminar</span>\n </span>\n </div>\n </campo-foro>\n </li>\n ' });
|