generic-skin 4.0.28 → 4.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/vueDefault.js +3 -3
- package/apps/vueMulti.js +25 -23
- package/apps/vueMulti.min.js +1 -1
- package/config/vueComponents.js +3 -3
- package/frameworks/FNRFramework.js +15 -15
- package/frameworks/FNRFramework.min.js +1 -1
- package/general.js +4 -4
- package/package.json +1 -1
package/apps/vueDefault.js
CHANGED
|
@@ -503,7 +503,7 @@ Vue.component('editor-foro', {
|
|
|
503
503
|
},
|
|
504
504
|
methods: {
|
|
505
505
|
insertSomething(insertBefore, insertAfter) {
|
|
506
|
-
const myField = document.
|
|
506
|
+
const myField = document.querySelector('#usereply-editor');
|
|
507
507
|
const pre = insertBefore.replace(/-jump-/g, '\n');
|
|
508
508
|
const post = insertAfter.replace(/-jump-/g, '\n');
|
|
509
509
|
|
|
@@ -545,7 +545,7 @@ Vue.component('editor-foro', {
|
|
|
545
545
|
this.users.current = '';
|
|
546
546
|
},
|
|
547
547
|
insertUrl() {
|
|
548
|
-
const myField = document.
|
|
548
|
+
const myField = document.querySelector('#usereply-editor');
|
|
549
549
|
const startPos = myField.selectionStart;
|
|
550
550
|
const endPos = myField.selectionEnd;
|
|
551
551
|
|
|
@@ -807,7 +807,7 @@ Vue.component('editor-foro', {
|
|
|
807
807
|
this.state.page = 1;
|
|
808
808
|
|
|
809
809
|
document.onkeydown = (e) => {
|
|
810
|
-
const editor = document.
|
|
810
|
+
const editor = document.querySelector('#usereply-editor');
|
|
811
811
|
|
|
812
812
|
if (document.activeElement === editor) {
|
|
813
813
|
if (e.ctrlKey && e.key === 'b') {
|
package/apps/vueMulti.js
CHANGED
|
@@ -337,29 +337,31 @@ Vue.component('gestor-multicuentas', {
|
|
|
337
337
|
<cargando-foro text="Cargando utilidad…"></cargando-foro>
|
|
338
338
|
</template>
|
|
339
339
|
<template v-else-if="state.page === 1">
|
|
340
|
-
<
|
|
341
|
-
<
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
<
|
|
345
|
-
<
|
|
346
|
-
<
|
|
347
|
-
<
|
|
348
|
-
|
|
349
|
-
<
|
|
350
|
-
<
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
<
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
<
|
|
362
|
-
|
|
340
|
+
<section class="forum-wikilist">
|
|
341
|
+
<aviso-foro v-show="msgCheck.length">
|
|
342
|
+
<ul v-html="msgCheck"></ul>
|
|
343
|
+
</aviso-foro>
|
|
344
|
+
<ul class="forum-fieldlist no-style">
|
|
345
|
+
<li>
|
|
346
|
+
<campo-foro name="Contraseña maestra">
|
|
347
|
+
<div class="character-selector">
|
|
348
|
+
<input :type="content.password.type" v-model="content.password.value" />
|
|
349
|
+
<a class="character-custom" @click="content.password.type === 'text' ? content.password.type = 'password' : content.password.type = 'text'" title="Cambiar modo">
|
|
350
|
+
<template v-if="content.password.type === 'text'">
|
|
351
|
+
<i class="fas fa-eye-slash"></i>
|
|
352
|
+
</template>
|
|
353
|
+
<template v-else-if="content.password.type === 'password'">
|
|
354
|
+
<i class="fas fa-eye"></i>
|
|
355
|
+
</template>
|
|
356
|
+
</a>
|
|
357
|
+
</div>
|
|
358
|
+
</campo-foro>
|
|
359
|
+
</li>
|
|
360
|
+
</ul>
|
|
361
|
+
<div id="usereply-comand" v-if="!msgCheck.length">
|
|
362
|
+
<button class="button1 btn-main" @click="setData()">Guardar</button>
|
|
363
|
+
</div>
|
|
364
|
+
</section>
|
|
363
365
|
</template>
|
|
364
366
|
<template v-else-if="state.page === 2">
|
|
365
367
|
<modal-multicuentas v-if="modal.status" :type="modal.type" :element="entry"></modal-multicuentas>
|
package/apps/vueMulti.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Vue.component("modal-multicuentas",{props:["element","type"],data(){return{state:{modal:!1},content:{edit:JSON.parse(JSON.stringify(this.element)),current:this.element}}},computed:{modalTitle(){return"new"===this.type?"Nuevo usuario":"edit"===this.type?"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(){const{name:t,password:e}=this.content.current,{name:n,password:a}=this.content.edit;return t!==n||e!==a}},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 :title="modalTitle" @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 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 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" @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" @click="pushElement()" title="Guardar entrada">Guardar</button>\n </controles-modal>\n </template>\n </modal-foro>\n '}),Vue.component("gestor-multicuentas",{data:()=>({render:0,modal:{type:"new",status:!1,bonus:!1},state:{new:!1,error:!1,page:0,pagination:0},entry:{},content:{page:1,default:forumConfig.skinOptions.paginationDefault,loading:1,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).slice((this.content.page-1)*this.content.default,this.content.page*this.content.default)}},methods:{modalClose(){this.state.page=3,setTimeout(()=>{window.location.reload()},2500)},forceRerender(){this.render+=1},setEntry(){this.entry={name:"",id:"",type:"password",password:""}},addEntry(t){t.preventDefault(),this.modal.status=!0},save(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)},setPage(t){this.content.loading=0,this.content.page=t,this.forceRerender(),setTimeout(()=>{this.content.loading=1},350)},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.</p>\n <p>Ante cualquier duda o problema, contacta con la administración.</p>\n </div>\n <separador-foro />\n <template v-if="state.page === 0">\n <cargando-foro 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 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" @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" @click="setData()">Guardar</button>\n </div>\n </template>\n <template v-else-if="state.page === 2">\n <modal-multicuentas v-if="modal.status" :type="modal.type" :element="entry"></modal-multicuentas>\n <modal-foro v-if="modal.bonus" title="Atención" @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" @click="updateForum()" title="Actualizar versión foro">Actualizar foro</button>\n <button class="button1" @click="updateLocal()" title="Actualizar versión local">Actualizar local</button>\n </controles-modal>\n </template>\n </modal-foro>\n <mando-foro id="upper-controls" app="true">\n <template slot="pagination" v-if="content.accounts.edit.length > 1">\n <paginacion-foro :page="content.page" :total="Math.ceil(content.accounts.edit.length / content.default)" @setPage="setPage" />\n </template>\n <template slot="controls">\n <li @click="addEntry($event)">\n <boton-foro url="#" name="Añadir" icon="fas fa-plus"></boton-foro>\n </li>\n <li v-if="finalCheck" @click="save($event)">\n <boton-foro url="#" name="Guardar" icon="fas fa-save" type="no-name"></boton-foro>\n </li>\n </template>\n </mando-foro>\n <section id="forum-accountlist" class="forum-wikilist">\n <lista-temas-cabecera elements="[\'Cuentas\', \'Información\']"></lista-temas-cabecera>\n <ul :class="\'wikilist-contents no-style\' + (!sortedCharacters.length || content.loading === 0 ? \' no-results\': \'\')" :key="render">\n <template v-if="!sortedCharacters.length">\n <li class="is-not-topic is-not-lastpost">\n <h6>No hay cuentas configuradas</h6>\n </li>\n </template>\n <template v-else-if="content.loading === 0">\n <li class="is-not-topic is-not-lastpost">\n <cargando-foro text="Cargando cuentas…"></cargando-foro>\n </li>\n </template>\n <template v-else v-for="(item, index) in sortedCharacters">\n <elemento-multicuentas :element="item" :id="index" :key="index"></elemento-multicuentas>\n </template>\n </ul>\n </section>\n <mando-foro id="lower-controls" app="true">\n <template slot="pagination" v-if="sortedCharacters.length > 1">\n <paginacion-foro :page="content.page" :total="Math.ceil(content.accounts.edit.length / content.default)" @setPage="setPage" />\n </template>\n <template slot="controls">\n <li @click="addEntry($event)">\n <boton-foro url="#" name="Añadir" icon="fas fa-plus"></boton-foro>\n </li>\n <li v-if="finalCheck" @click="save($event)">\n <boton-foro url="#" name="Guardar" icon="fas fa-save" 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 text="Actualizando información…"></cargando-foro>\n </template>\n </section>\n '}),Vue.component("elemento-multicuentas",{props:["element","id"],data(){return{content:this.element}},methods:{deleteElement(){FNR.html.genPrompt("Necesitamos confirmación","Te dispones a eliminar una cuenta almacenada en el gestor. ¿Estás segur@?","Escribe «ELIMINAR» para confirmar","").then(t=>{"ELIMINAR"===t&&(this.$parent.content.accounts.edit.splice(this.id,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 :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 @click="editElement()" title="Editar entrada">Editar</span> / <span @click="deleteElement()" title="Eliminar entrada">Eliminar</span>\n </span>\n </div>\n </campo-foro>\n </li>\n '});
|
|
1
|
+
Vue.component("modal-multicuentas",{props:["element","type"],data(){return{state:{modal:!1},content:{edit:JSON.parse(JSON.stringify(this.element)),current:this.element}}},computed:{modalTitle(){return"new"===this.type?"Nuevo usuario":"edit"===this.type?"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(){const{name:t,password:e}=this.content.current,{name:n,password:a}=this.content.edit;return t!==n||e!==a}},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 :title="modalTitle" @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 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 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" @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" @click="pushElement()" title="Guardar entrada">Guardar</button>\n </controles-modal>\n </template>\n </modal-foro>\n '}),Vue.component("gestor-multicuentas",{data:()=>({render:0,modal:{type:"new",status:!1,bonus:!1},state:{new:!1,error:!1,page:0,pagination:0},entry:{},content:{page:1,default:forumConfig.skinOptions.paginationDefault,loading:1,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).slice((this.content.page-1)*this.content.default,this.content.page*this.content.default)}},methods:{modalClose(){this.state.page=3,setTimeout(()=>{window.location.reload()},2500)},forceRerender(){this.render+=1},setEntry(){this.entry={name:"",id:"",type:"password",password:""}},addEntry(t){t.preventDefault(),this.modal.status=!0},save(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)},setPage(t){this.content.loading=0,this.content.page=t,this.forceRerender(),setTimeout(()=>{this.content.loading=1},350)},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.</p>\n <p>Ante cualquier duda o problema, contacta con la administración.</p>\n </div>\n <separador-foro />\n <template v-if="state.page === 0">\n <cargando-foro text="Cargando utilidad…"></cargando-foro>\n </template>\n <template v-else-if="state.page === 1">\n <section class="forum-wikilist">\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 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" @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" @click="setData()">Guardar</button>\n </div>\n </section>\n </template>\n <template v-else-if="state.page === 2">\n <modal-multicuentas v-if="modal.status" :type="modal.type" :element="entry"></modal-multicuentas>\n <modal-foro v-if="modal.bonus" title="Atención" @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" @click="updateForum()" title="Actualizar versión foro">Actualizar foro</button>\n <button class="button1" @click="updateLocal()" title="Actualizar versión local">Actualizar local</button>\n </controles-modal>\n </template>\n </modal-foro>\n <mando-foro id="upper-controls" app="true">\n <template slot="pagination" v-if="content.accounts.edit.length > 1">\n <paginacion-foro :page="content.page" :total="Math.ceil(content.accounts.edit.length / content.default)" @setPage="setPage" />\n </template>\n <template slot="controls">\n <li @click="addEntry($event)">\n <boton-foro url="#" name="Añadir" icon="fas fa-plus"></boton-foro>\n </li>\n <li v-if="finalCheck" @click="save($event)">\n <boton-foro url="#" name="Guardar" icon="fas fa-save" type="no-name"></boton-foro>\n </li>\n </template>\n </mando-foro>\n <section id="forum-accountlist" class="forum-wikilist">\n <lista-temas-cabecera elements="[\'Cuentas\', \'Información\']"></lista-temas-cabecera>\n <ul :class="\'wikilist-contents no-style\' + (!sortedCharacters.length || content.loading === 0 ? \' no-results\': \'\')" :key="render">\n <template v-if="!sortedCharacters.length">\n <li class="is-not-topic is-not-lastpost">\n <h6>No hay cuentas configuradas</h6>\n </li>\n </template>\n <template v-else-if="content.loading === 0">\n <li class="is-not-topic is-not-lastpost">\n <cargando-foro text="Cargando cuentas…"></cargando-foro>\n </li>\n </template>\n <template v-else v-for="(item, index) in sortedCharacters">\n <elemento-multicuentas :element="item" :id="index" :key="index"></elemento-multicuentas>\n </template>\n </ul>\n </section>\n <mando-foro id="lower-controls" app="true">\n <template slot="pagination" v-if="sortedCharacters.length > 1">\n <paginacion-foro :page="content.page" :total="Math.ceil(content.accounts.edit.length / content.default)" @setPage="setPage" />\n </template>\n <template slot="controls">\n <li @click="addEntry($event)">\n <boton-foro url="#" name="Añadir" icon="fas fa-plus"></boton-foro>\n </li>\n <li v-if="finalCheck" @click="save($event)">\n <boton-foro url="#" name="Guardar" icon="fas fa-save" 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 text="Actualizando información…"></cargando-foro>\n </template>\n </section>\n '}),Vue.component("elemento-multicuentas",{props:["element","id"],data(){return{content:this.element}},methods:{deleteElement(){FNR.html.genPrompt("Necesitamos confirmación","Te dispones a eliminar una cuenta almacenada en el gestor. ¿Estás segur@?","Escribe «ELIMINAR» para confirmar","").then(t=>{"ELIMINAR"===t&&(this.$parent.content.accounts.edit.splice(this.id,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 :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 @click="editElement()" title="Editar entrada">Editar</span> / <span @click="deleteElement()" title="Eliminar entrada">Eliminar</span>\n </span>\n </div>\n </campo-foro>\n </li>\n '});
|
package/config/vueComponents.js
CHANGED
|
@@ -384,11 +384,11 @@ Vue.component('controles-foro', {
|
|
|
384
384
|
},
|
|
385
385
|
created() {
|
|
386
386
|
if (this.userLog !== 0) {
|
|
387
|
-
if (document.
|
|
388
|
-
this.userMP = parseInt(document.
|
|
387
|
+
if (document.querySelector('#i_icon_mini_new_message') !== null && document.querySelector('#i_icon_mini_new_message').title.match(/[0-255]/) !== null) {
|
|
388
|
+
this.userMP = parseInt(document.querySelector('#i_icon_mini_new_message').title.match(/[0-255]/)[0]);
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
-
this.userOut = document.
|
|
391
|
+
this.userOut = document.querySelector('#logout').href;
|
|
392
392
|
}
|
|
393
393
|
},
|
|
394
394
|
template: `
|
|
@@ -223,7 +223,7 @@ const FNR = {
|
|
|
223
223
|
|
|
224
224
|
document.querySelector('body').prepend(save);
|
|
225
225
|
|
|
226
|
-
const saveDOM = document.
|
|
226
|
+
const saveDOM = document.querySelector('#forum-save');
|
|
227
227
|
});
|
|
228
228
|
},
|
|
229
229
|
},
|
|
@@ -273,7 +273,7 @@ const FNR = {
|
|
|
273
273
|
|
|
274
274
|
document.querySelector('body').prepend(save);
|
|
275
275
|
|
|
276
|
-
const saveDOM = document.
|
|
276
|
+
const saveDOM = document.querySelector('#forum-save');
|
|
277
277
|
});
|
|
278
278
|
},
|
|
279
279
|
}
|
|
@@ -770,7 +770,7 @@ const FNR = {
|
|
|
770
770
|
|
|
771
771
|
document.querySelector('body').prepend(save);
|
|
772
772
|
|
|
773
|
-
const saveDOM = document.
|
|
773
|
+
const saveDOM = document.querySelector('#forum-save');
|
|
774
774
|
});
|
|
775
775
|
}
|
|
776
776
|
}
|
|
@@ -888,7 +888,7 @@ const FNR = {
|
|
|
888
888
|
final += '<div id="' + FNR.utility.genSlug(title, '-') + '" class="modal-element">';
|
|
889
889
|
final += '<div class="modal-title">';
|
|
890
890
|
final += '<h3>' + title + '</h3>';
|
|
891
|
-
final += '<a onclick="document.
|
|
891
|
+
final += '<a onclick="document.querySelector(`#forum-modal`).remove()">';
|
|
892
892
|
final += '<i class="fas fa-times"></i>';
|
|
893
893
|
final += '</a>';
|
|
894
894
|
final += '</div>';
|
|
@@ -906,9 +906,9 @@ const FNR = {
|
|
|
906
906
|
final += '</div>';
|
|
907
907
|
final += '</div>';
|
|
908
908
|
|
|
909
|
-
final += '<div class="is-bgmodal bg-active" onclick="document.
|
|
909
|
+
final += '<div class="is-bgmodal bg-active" onclick="document.querySelector(`#forum-modal`).remove()"></div>';
|
|
910
910
|
|
|
911
|
-
document.
|
|
911
|
+
document.querySelector('#forum-modal').innerHTML = final;
|
|
912
912
|
},
|
|
913
913
|
genPrompt: (title, content, placeholder, text) => {
|
|
914
914
|
if (title === '' || title === undefined || title === null) return;
|
|
@@ -926,22 +926,22 @@ const FNR = {
|
|
|
926
926
|
resolve(result);
|
|
927
927
|
}
|
|
928
928
|
|
|
929
|
-
document.
|
|
929
|
+
document.querySelector(`#forum-modal`).remove();
|
|
930
930
|
};
|
|
931
931
|
|
|
932
932
|
document.querySelector('#modal-button-cancel').onclick = () => {
|
|
933
933
|
reject(false);
|
|
934
|
-
document.
|
|
934
|
+
document.querySelector(`#forum-modal`).remove();
|
|
935
935
|
};
|
|
936
936
|
|
|
937
937
|
document.querySelector('.modal-title a').onclick = () => {
|
|
938
938
|
reject(false);
|
|
939
|
-
document.
|
|
939
|
+
document.querySelector(`#forum-modal`).remove();
|
|
940
940
|
};
|
|
941
941
|
|
|
942
942
|
document.querySelector('.is-bgmodal.bg-active').onclick = () => {
|
|
943
943
|
reject(false);
|
|
944
|
-
document.
|
|
944
|
+
document.querySelector(`#forum-modal`).remove();
|
|
945
945
|
};
|
|
946
946
|
});
|
|
947
947
|
},
|
|
@@ -952,7 +952,7 @@ const FNR = {
|
|
|
952
952
|
if (icon === '' || icon === undefined || icon === null) return;
|
|
953
953
|
|
|
954
954
|
if (document.querySelectorAll('forum-notification').length) {
|
|
955
|
-
document.
|
|
955
|
+
document.querySelector('#forum-notification').remove();
|
|
956
956
|
clearTimeout();
|
|
957
957
|
}
|
|
958
958
|
|
|
@@ -987,18 +987,18 @@ const FNR = {
|
|
|
987
987
|
final += '</a>';
|
|
988
988
|
}
|
|
989
989
|
|
|
990
|
-
document.
|
|
990
|
+
document.querySelector('#forum-notification').innerHTML = final;
|
|
991
991
|
|
|
992
992
|
setTimeout(() => {
|
|
993
|
-
document.
|
|
993
|
+
document.querySelector(`#forum-notification`).classList.add('notification-show');
|
|
994
994
|
}, 250);
|
|
995
995
|
|
|
996
996
|
setTimeout(() => {
|
|
997
|
-
document.
|
|
997
|
+
document.querySelector(`#forum-notification`).classList.remove('notification-show');
|
|
998
998
|
}, 8000);
|
|
999
999
|
|
|
1000
1000
|
setTimeout(() => {
|
|
1001
|
-
document.
|
|
1001
|
+
document.querySelector(`#forum-notification`).remove();
|
|
1002
1002
|
}, 10000);
|
|
1003
1003
|
}
|
|
1004
1004
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const FNR={execFn:e=>{document.addEventListener("forumReady",e,!1)},forum:{getColors:()=>Object.values(forumColours).map(e=>({name:e.code,hex:e.hex})),getTopics:async(e,t)=>{const n=e=>{const t=$(e).find(".topictitle"),n=$(e).children().last();i.push({name:t.text().trim(),url:Vue.filter("url-to-normal")(t.attr("href")),lastpost:{url:Vue.filter("url-to-normal")(n.children().last().attr("href")),date:n.text().split("por")[0].trim(),who:{name:n.find("strong a").length?n.find("strong a").text().trim():"Invitado",url:Vue.filter("url-to-normal")(n.find("strong a").length?n.find("strong a").attr("href"):"/"),color:n.find("strong a").length?n.find("strong a span").attr("style").split("color:")[1]:"initial"}},forum:{name:$(e).find(".row2 + .row2:not(.centered) a").text().trim(),url:Vue.filter("url-to-normal")($(e).find(".row2 + .row2:not(.centered) a").attr("href"))}})},r=async a=>{$.get(a,a=>($(a).find(".ipbform").find("tbody").find("tr").each(function(){i.length<t&&-1===e.indexOf(parseInt($(this).find(".row2 + .row2:not(.centered) a").attr("href").split("/f")[1].split("-")[0]))&&n(this)}),i.length!==t&&$(a).find(".pagination")[0].children.length&&"b"!==$(a).find(".pagination").children().last()[0].localName?r($(a).find(".pagination").children().last().attr("href")):i))};await r("/latest?change_version=invision");let i=[];return i},getMembers:e=>new Promise((t,n)=>{let r=[];const i=(e,t)=>({user:$(e).find(".membername span").text().trim(),id:$(e).find(".popupmenu .popupmenu-item a").attr("href").split("?")[0],img:$(e).find(".mini-avatar img").attr("src"),color:t}),a=t=>{let n=[];return $(t).find(".member-list .member").each(function(){const t=FNR.utility.getGroup($(this).find(".membername span").attr("style").split("color:")[1]);e?n.push(i(this,t)):"unknown"!==t&&t!==forumConfig.skinOptions.adminGroup&&n.push(i(this,t))}),n},o=e=>{$.get(e,e=>{const n=$(e).find('.pagination img[alt="Siguiente"]').parent().attr("href")||!1;r=r.concat(a(e)),n?o(n):t(r.sort((e,t)=>e.user<t.user?-1:e.user>t.user?1:0))})};o("/memberlist?change_version=invision")}),getGroups:e=>{const t=()=>new Promise((e,t)=>{$.get("/groups?change_version=invision",t=>{let n=[];$(t).find(".group_list > li").each(function(){n.push({id:parseInt($(this).find("a").attr("href").split("/g")[1].split("-")[0]),name:$(this).find("a").text().trim(),color:$(this).find("a").css("color"),url:Vue.filter("url-to-normal")($(this).find("a").attr("href")),count:parseInt($(this).find("div > span").text())-1})}),e(n)})}),n=()=>new Promise((n,r)=>{FNR.cache.useData("groups",e).then(e=>{n(e)},e=>{t().then(e=>{FNR.cache.setData("groups",e),n(e)})})});return n()},getAffiliates:()=>new Promise((e,t)=>{const n=forumConfig.affiliatesMax,r=Object.entries(forumAffiliates).map(e=>{let t="";e[1].forEach(e=>{t+='<li><a href="'+e.url+'" title="'+e.title+'" target="_blank"><img src="'+e.img+'" alt="'+e.title+'"/></a></li>'});for(let r=0;r<n[e[0]]-e[1].length;r++)t+='<li><a href="/" title="'+forumData.name+'"><img src="'+forumDefaults.affiliates[e[0]]+'" alt="'+forumData.name+'"/></a></li>';return t});e({normal:r[0],elite:r[1],directory:r[2],sister:r[3]})})},content:{isAutosave:()=>void 0!==document.post&&(-1!==_userdata.user_id&&"reply"===document.post.mode.value&&void 0!==document.post.t),post:{getPost:e=>new Promise((t,n)=>{$.get(Vue.filter("url-to-invision")(e),n=>{const r=$(n).find("#p"+e.split("#")[1]);t({author:{text:r.find(".author a").text(),color:r.find(".author a span").css("color"),url:Vue.filter("url-to-normal")(r.find(".author a").attr("href"))},content:r.find(".post-entry > div").html(),date:r.find(".author").html().split("</a>")[1]})})}),genPost:(e,t)=>new Promise((n,r)=>{let i=document.createElement("iframe");i.id="forum-save",i.src="/post?t="+e+"&mode=reply&change_version=invision",i.width=0,i.height=0,i.onload=(()=>{a.onload=(()=>{$("#forum-save").remove(),console.clear(),n(!0)}),$("#forum-save").contents().find('.subtitle:contains("Mensaje")').next().find("textarea").val(t),$("#forum-save").contents().find('.formbuttonrow.center input[value="Enviar"]').click()}),document.querySelector("body").prepend(i);const a=document.getElementById("forum-save")})},topic:{getType:e=>{const t=[];return e.indexOf("unread")>-1?t.push("is-unread"):t.push("is-read"),e.indexOf("locked")>-1?t.push("is-closed"):e.indexOf("sticky")>1?t.push("is-sticky"):e.indexOf("global_announce")>1?t.push("is-global-announcement"):e.indexOf("announce")>1&&t.push("is-announcement"),t},genTopic:(e,t,n)=>new Promise((r,i)=>{let a=document.createElement("iframe");a.id="forum-save",a.src="/post?f="+e+"&mode=newtopic&change_version=invision",a.width=0,a.height=0,a.onload=(()=>{o.onload=(()=>{$("#forum-save").remove(),console.clear(),r(!0)}),$("#forum-save").contents().find('dl dt:contains("Título del tema")').parent().find("input").val(t),$("#forum-save").contents().find('.subtitle:contains("Mensaje")').next().find("textarea").val(n),$("#forum-save").contents().find('.formbuttonrow.center input[value="Enviar"]').click()}),document.querySelector("body").prepend(a);const o=document.getElementById("forum-save")})}},user:{getUrl:e=>{let t=void 0!==e?encodeURIComponent(e).replace(/[!'()]/g,escape).replace(/\*/g,"%2A"):_userdata.user_id;return"/profile?mode=viewprofile&u="+t},getLevel:async()=>{switch(_userdata.user_level){case 2:return"mod";case 1:return"admin";case 0:return-1==_userdata.user_id?"guest":"user"}},getGroup:async()=>{const e=await FNR.user.getLevel();if("guest"===e)return"unknown";const{colour:t}=await FNR.user.getProfile(_userdata.user_id,.25);return t},getProfile:(e,t)=>{const n=null!=e?FNR.user.getUrl(e):FNR.user.getUrl(),r=t||5,i=e=>e.find("a").length?Vue.filter("url-to-normal")(e.find("a").attr("href")):e.find("table").length?e.find("table").html():e.find("img").length?e.find("img").attr("src"):e.find("textarea").length?e.find("textarea").val():e.find("span").length?e.find("span").text().trim():"-"===e.text().trim()?"":e.text(),a=()=>new Promise((e,t)=>{$.get(n+"&change_version=invision",t=>{let r={};r.name=$(t).find(".maintitle h1 span").text(),r.lastvisit=$(t).find('dt:contains("Última visita")').parent().find("dd").text(),r.colour=FNR.utility.getGroup($(t).find(".maintitle h1 span").css("color").replace("rgb(","rgb_").replace(/, /g,"_").replace(")","")),r.avatar=$(t).find(".real_avatar img").attr("src"),r.links={profile:"/u"+n.split("&u=")[1],mp:"/privmsg?mode=post&u="+n.split("&u=")[1]},r.messages={public:parseInt($(t).find('span:contains("Mensajes")').parent().parent().find("dd > div").text())||0,private:parseInt($(t).find('dt:contains("Mensajes privados")').parent().find("dd").text())||0},r.fields={},$(t).find('dl[id^="field_id"]').each(function(){if(""!==$(this).find("dt span").text()){if("Mensajes"===$(this).find("dt span").text())return;r.fields[FNR.utility.genSlug($(this).find("dt span").text())]={name:$(this).find("dt span").text(),content:i($(this).find("dd .field_uneditable"))}}}),$(t).find(".ipbform2 > dl").each(function(){if($(this).find("dt span").length&&""!==$(this).find("dt span").text()){if("Mensajes"===$(this).find("dt span").text())return;r.fields[FNR.utility.genSlug($(this).find("dt span").text())]={name:$(this).find("dt span").text(),content:i($(this).find("dd"))}}}),r.fields.rango={name:"Rango",content:$(t).find('dt:contains("Rango:")').parent().find("dd").text()},e(r)})}),o=e=>{const t=`userInfo${e}`;return new Promise((e,n)=>{FNR.cache.useData(t,r).then(t=>{e(t)},n=>{a().then(n=>{FNR.cache.setData(t,n),e(n)})})})};return o(e)},changeAccount:async(e,t,n)=>{try{return await fetch(e),await fetch("/login",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:`username=${encodeURIComponent(t)}&password=${encodeURIComponent(n)}&autologin=1&login=1`}),!0}catch(e){return console.error("Error inesperado",e),!1}},followed:{getPages:async()=>{try{const e=await fetch("/search?search_id=watchsearch&change_version=invision"),t=await e.text(),n=document.createElement("html");n.innerHTML=t;const r=n.querySelectorAll(".pagination a");let i=[];if(r.length){const e=r[r.length-2],t=e.href.split(e.origin)[1],n=t.match(/[0-9]/g)||[],a=parseInt(n.join(""))||0,o=r[1],l=o.href.split(o.origin)[1],s=l.match(/[0-9]/g)||[],c=parseInt(s.join(""))||0,d=void 0===a?0:a/c;i=Array(d).fill(null).map((e,t)=>`/search?search_id=watchsearch&start=${c*(t+1)}&change_version=invision`)}return{items:1===n.querySelectorAll(".ipbtable tbody tr td").length?0:n.querySelectorAll(".ipbtable tbody tr").length,pages:["/search?search_id=watchsearch&change_version=invision",...i]}}catch(e){return console.error("Error inesperado",e),!1}},getFollowed:async e=>{try{const t=await fetch(e),n=await t.text(),r=document.createElement("html");return r.innerHTML=n,Array.from(r.querySelectorAll(".ipbtable tbody tr")).map(e=>{const t=e.children;return{id:parseInt(t[7].children[0].value),name:t[1].querySelector(".topictitle").textContent.trim(),url:Vue.filter("url-to-normal")(t[1].querySelector(".topictitle").href),views:parseInt(t[5].textContent),replies:parseInt(t[3].textContent),type:FNR.content.topic.getType(t[0].querySelector("img").src).join(" ")}})}catch(e){return console.error("Error inesperado",e),!1}},delFollowed:async e=>{try{return await fetch("/search?search_id=watchsearch",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:`confirm=confirm${e.map(e=>`&mark${encodeURIComponent("[]")}2=${e}`)}`}),!0}catch(e){return console.error("Error inesperado",e),!1}}},drafts:{delDrafts:async(e,t)=>{try{const n="draft"===e?"draft":"topic_draft";return await fetch(`/search?search_id=${e}search`,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:`confirm=confirm${t.map(e=>`&delete_${n}${encodeURIComponent(`[${e}]`)}=on`)}`}),!0}catch(e){return console.error("Error inesperado",e),!1}},messages:{getPages:async()=>{try{const e=await fetch("/search?search_id=draftsearch&change_version=invision"),t=await e.text(),n=document.createElement("html");n.innerHTML=t;const r=n.querySelectorAll(".pagination a");let i=[];if(r.length){const e=r[r.length-2],t=e.href.split(e.origin)[1],n=t.match(/[0-9]/g)||[],a=parseInt(n.join(""))||0,o=r[1],l=o.href.split(o.origin)[1],s=l.match(/[0-9]/g)||[],c=parseInt(s.join(""))||0,d=void 0===a?0:a/c;i=Array(d).fill(null).map((e,t)=>`/search?search_id=draftsearch&start=${c*(t+1)}&change_version=invision`)}return{items:1===n.querySelectorAll(".ipbtable tbody tr td").length?0:n.querySelectorAll(".ipbtable tbody tr").length,pages:["/search?search_id=draftsearch&change_version=invision",...i]}}catch(e){return console.error("Error inesperado",e),!1}},getDrafts:async e=>{try{const t=await fetch(e),n=await t.text(),r=document.createElement("html");return r.innerHTML=n,Array.from(r.querySelectorAll(".ipbtable tbody tr")).map(e=>{const t=e.children;return{topic:{name:t[1].textContent.trim(),url:Vue.filter("url-to-normal")(t[1].querySelector("a").href)},info:{location:t[2].textContent.trim(),date:t[3].textContent.trim()},modify:Vue.filter("url-to-normal")(t[4].querySelector("a").href)}})}catch(e){return console.error("Error inesperado",e),!1}}},topics:{getPages:async()=>{try{const e=await fetch("/search?search_id=topicdraftsearch&change_version=invision"),t=await e.text(),n=document.createElement("html");n.innerHTML=t;const r=n.querySelectorAll(".pagination a");let i=[];if(r.length){const e=r[r.length-2],t=e.href.split(e.origin)[1],n=t.match(/[0-9]/g)||[],a=parseInt(n.join(""))||0,o=r[1],l=o.href.split(o.origin)[1],s=l.match(/[0-9]/g)||[],c=parseInt(s.join(""))||0,d=void 0===a?0:a/c;i=Array(d).fill(null).map((e,t)=>`/search?search_id=topicdraftsearch&start=${c*(t+1)}&change_version=invision`)}return{items:1===n.querySelectorAll(".ipbtable tbody tr td").length?0:n.querySelectorAll(".ipbtable tbody tr").length,pages:["/search?search_id=topicdraftsearch&change_version=invision",...i]}}catch(e){return console.error("Error inesperado",e),!1}},getDrafts:async e=>{try{const t=await fetch(e),n=await t.text(),r=document.createElement("html");return r.innerHTML=n,Array.from(r.querySelectorAll(".ipbtable tbody tr")).map(e=>{const t=e.children;return{topic:{name:t[0].textContent.trim(),url:Vue.filter("url-to-normal")(t[0].querySelector("a").href)},info:{location:t[1].textContent.trim(),date:t[2].textContent.trim()},modify:Vue.filter("url-to-normal")(t[3].querySelector("a").href)}})}catch(e){return console.error("Error inesperado",e),!1}}}},profile:{getData:e=>new Promise((t,n)=>{$.get("/profile?change_version=invision&mode=editprofile",n=>{const r=n;$.get("/profile?change_version=invision&mode=editprofile&page_profil=avatars",n=>{const i=n;let a=[];[].forEach.call(e,e=>{let t="",n=[];switch(e.type){case"input":t=$(r).find('dl:contains("'+e.name+'")').find("dd").find("input").val();break;case"textarea":t=$(r).find('dl:contains("'+e.name+'")').find("dd").find("textarea").val();break;case"select":t=$(r).find('dl:contains("'+e.name+'")').find("dd").find("select option:selected").attr("value"),$(r).find('dl:contains("'+e.name+'")').find("dd").find("select option").each(function(){""!==$(this).attr("value")&&n.push({name:$(this).text(),value:$(this).attr("value")})});break;case"avatar":t=$(i).find(".box-content img").attr("src")}if("select"===e.type&&void 0===t||"select"===e.type&&""===t)return;let o={type:e.type,name:e.name,value:t};e.validation&&(o.validation=e.validation),n.length&&(o.options=n),a.push(o)}),t(a)})})}),setData:e=>new Promise((t,n)=>{const r=()=>{$("#forum-save").remove(),console.clear(),t(!0)};let i=document.createElement("iframe");i.id="forum-save",i.src="/profile?change_version=invision&mode=editprofile",i.width=0,i.height=0,i.onload=(()=>{let t=!1;[].forEach.call(e,e=>{switch(e.type){case"input":$("#forum-save").contents().find('dl:contains("'+e.name+'")').find("dd").find("input").first().val(e.value);break;case"textarea":$("#forum-save").contents().find('dl:contains("'+e.name+'")').find("dd").find("textarea").val(e.value);break;case"select":$("#forum-save").contents().find('dl:contains("'+e.name+'")').find("dd").find('select option[value="'+e.value+'"]').attr("selected","selected");break;case"avatar":t=e.value}}),a.onload=(()=>{t?(a.onload=(()=>{a.onload=(()=>{r()}),$("#forum-save").contents().find('input[name="avatarremoteurl"]').val(t),$("#forum-save").contents().find('input[type="submit"][value="Registrar"]').click()}),a.src="/profile?change_version=invision&mode=editprofile&page_profil=avatars"):r()}),$("#forum-save").contents().find('input[type="submit"][value="Registrar"]').click()}),document.querySelector("body").prepend(i);const a=document.getElementById("forum-save")})}},cache:{getData:e=>null!==localStorage.getItem(forumData.prefix+"_"+e)&&JSON.parse(localStorage.getItem(forumData.prefix+"_"+e)).content,setData:(e,t,n)=>{let r=-1===n?"undefined":(new Date).getTime();localStorage.setItem(forumData.prefix+"_"+e,JSON.stringify({cached_at:r,content:t}))},delData:e=>null!==localStorage.getItem(forumData.prefix+"_"+e)&&localStorage.removeItem(forumData.prefix+"_"+e),useData:async(e,t)=>{const n=localStorage.getItem(forumData.prefix+"_"+e),r=new Date,i=-1==t?"undefined":864e5*t;return null!=n&&-1==t||null!=n&&parseInt(JSON.parse(n).cached_at)+i>r.getTime()?JSON.parse(n).content:Promise.reject(!1)}},utility:{genSlug:(e,t)=>{const n=e=>{const t="àáäâèéëêìíïîòóöôùúüûñç·/_,:;";e=e.trim().toLowerCase();for(var n=0,r=t.length;n<r;n++)e=e.replace(new RegExp(t.charAt(n),"g"),"aaaaeeeeiiiioooouuuunc------".charAt(n));return e.replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")},r=t||"_";return n(e).replace(/-/g,r)},genArray:e=>JSON.parse(e.replace(/`/g,'"')),genValidation:e=>{let t="";return[].forEach.call(e,e=>{switch(e.validation){case"hex":e.value.match(/^#[a-f0-9]{6}$/i)||(t+="<li>El campo de "+e.name.toLowerCase()+" debe incluir un código de color hexadecimal.</li>");break;case"img":e.value.match(/(jpg|jpeg|png)$/i)||(t+="<li>El campo de "+e.name.toLowerCase()+" debe ser el enlace a una imagen (formato png, jpg o jpeg).</li>")}}),t},getGroup:e=>{const t=e=>{let t="unknown";return Object.values(forumColours).map(n=>{n.hex===e.toLowerCase()&&(t=FNR.utility.genSlug(n.code))}),t},n=e=>{let t="unknown";return Object.values(forumColours).map(n=>{n.id===e&&(t=FNR.utility.genSlug(n.code))}),t};return void 0===e?"unknown":e.indexOf("#")>-1?t(e):e.indexOf("id_")>-1?n(parseFloat(e.split("_")[1])):void 0===forumColours[e]?"unknown":FNR.utility.genSlug(forumColours[e].code)}},html:{genModal:(e,t,n)=>{if(""===e||null==e)return;if(""===t||null==t)return;let r=document.createElement("div");r.id="forum-modal",document.body.appendChild(r);let i="";i+='<div id="'+FNR.utility.genSlug(e,"-")+'" class="modal-element">',i+='<div class="modal-title">',i+="<h3>"+e+"</h3>",i+='<a onclick="document.getElementById(`forum-modal`).remove()">',i+='<i class="fas fa-times"></i>',i+="</a>",i+="</div>",i+='<div class="modal-content">',i+='<div class="is-content">',i+=t.replace(/\n/g,"<br>"),i+="</div>",""!==n&&null!=n&&(i+='<div class="modal-buttons">',i+=n,i+="</div>"),i+="</div>",i+="</div>",i+='<div class="is-bgmodal bg-active" onclick="document.getElementById(`forum-modal`).remove()"></div>',document.getElementById("forum-modal").innerHTML=i},genPrompt:(e,t,n,r)=>{if(""!==e&&null!=e&&""!==t&&null!=t)return new Promise((i,a)=>{FNR.html.genModal(e,"<p>"+t+'</p><p><input id="modal-prompt" type="text" placeholder="'+n+'" value="'+r+'"></p>','<button id="modal-button-enter" class="button1 btn-main">Confirmar</button><button id="modal-button-cancel" class="button1">Cancelar</button>'),document.querySelector("#modal-button-enter").onclick=(()=>{const e=document.querySelector("#modal-prompt").value;i(""!==e&&e),document.getElementById("forum-modal").remove()}),document.querySelector("#modal-button-cancel").onclick=(()=>{a(!1),document.getElementById("forum-modal").remove()}),document.querySelector(".modal-title a").onclick=(()=>{a(!1),document.getElementById("forum-modal").remove()}),document.querySelector(".is-bgmodal.bg-active").onclick=(()=>{a(!1),document.getElementById("forum-modal").remove()})})},genNotification:(e,t,n,r)=>{if(""===e||null==e)return;if(""===t||null==t)return;if(t.length>50)return;if(""===n||null==n)return;document.querySelectorAll("forum-notification").length&&(document.getElementById("forum-notification").remove(),clearTimeout());let i=document.createElement("div");i.id="forum-notification",document.body.appendChild(i);let a="";a+=""===r||null==r?'<div id="'+FNR.utility.genSlug(e,"-")+'" class="notification-element" onclick="document.querySelector(`#forum-notification`).classList.remove(`notification-show`)" >':'<a href="'+r+'" target="_blank" id="'+FNR.utility.genSlug(e,"-")+'" class="notification-element" onclick="document.querySelector(`#forum-notification`).classList.remove(`notification-show`)" >',a+='<div class="notification-icon">',a+='<i class="'+n+'"></i>',a+="</div>",a+='<div class="notification-content">',a+="<h3>"+e+"</h3>",a+="<p>"+t+"</p>",a+="</div>",a+='<div class="notification-controls">',a+='<i class="fas fa-times"></i>',a+="</div>",a+=""===r||null==r?"</div>":"</a>",document.getElementById("forum-notification").innerHTML=a,setTimeout(()=>{document.getElementById("forum-notification").classList.add("notification-show")},250),setTimeout(()=>{document.getElementById("forum-notification").classList.remove("notification-show")},8e3),setTimeout(()=>{document.getElementById("forum-notification").remove()},1e4)}},behaviour:{genWiki:()=>{document.querySelector(".wiki-cascade")&&[].forEach.call(document.getElementsByClassName("wiki-cascade"),e=>{e.onclick=(()=>{const t=e.parentElement.parentElement;t.classList.contains("is-active")?t.classList.remove("is-active"):t.classList.add("is-active")})}),document.querySelector(".wiki-controls .router-link-active")&&[].forEach.call(document.querySelectorAll(".wiki-controls .router-link-active"),e=>{if(!e.parentElement.parentElement.parentElement.parentElement.parentElement.classList.contains("wiki-index")){const t=(e,n)=>{let r=e.parentElement.parentElement;n&&(r=r.parentElement.parentElement),r.classList.add("is-active"),r.classList.add("is-selected"),r.parentElement.parentElement.parentElement.classList.contains("wiki-index")||t(r,!1)};t(e,!0)}}),document.querySelector("aside.wiki-index > .select-container > select")&&(document.querySelector("aside.wiki-index > .select-container > select").onchange=(()=>{router.push(document.querySelector("aside.wiki-index > .select-container > select").value)}))},genDropeable:()=>{document.querySelector(".is-dropeable")&&[].forEach.call(document.getElementsByClassName("is-dropeable"),e=>{e.onclick=(()=>{e.classList.contains("is-active")?e.classList.remove("is-active"):([].forEach.call(document.getElementsByClassName("is-dropeable"),e=>{e.classList.remove("is-active")}),e.classList.add("is-active"))})})},genControls:()=>{document.querySelector(".forum-controls")&&[].forEach.call(document.querySelectorAll(".forum-controls"),e=>{let t=0;[].forEach.call(e.children,e=>{"none"!==window.getComputedStyle(e,null).display&&(t+=e.children.length)}),0===t&&!1===e.classList.contains("not-show")&&e.classList.add("not-show")})},genDebounce:(e,t=750)=>{let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>{e.apply(this,r)},t)}}}};
|
|
1
|
+
const FNR = { execFn: e => { document.addEventListener("forumReady", e, !1) }, forum: { getColors: () => Object.values(forumColours).map(e => ({ name: e.code, hex: e.hex })), getTopics: async (e, t) => { const n = e => { const t = $(e).find(".topictitle"), n = $(e).children().last(); i.push({ name: t.text().trim(), url: Vue.filter("url-to-normal")(t.attr("href")), lastpost: { url: Vue.filter("url-to-normal")(n.children().last().attr("href")), date: n.text().split("por")[0].trim(), who: { name: n.find("strong a").length ? n.find("strong a").text().trim() : "Invitado", url: Vue.filter("url-to-normal")(n.find("strong a").length ? n.find("strong a").attr("href") : "/"), color: n.find("strong a").length ? n.find("strong a span").attr("style").split("color:")[1] : "initial" } }, forum: { name: $(e).find(".row2 + .row2:not(.centered) a").text().trim(), url: Vue.filter("url-to-normal")($(e).find(".row2 + .row2:not(.centered) a").attr("href")) } }) }, r = async a => { $.get(a, a => ($(a).find(".ipbform").find("tbody").find("tr").each(function () { i.length < t && -1 === e.indexOf(parseInt($(this).find(".row2 + .row2:not(.centered) a").attr("href").split("/f")[1].split("-")[0])) && n(this) }), i.length !== t && $(a).find(".pagination")[0].children.length && "b" !== $(a).find(".pagination").children().last()[0].localName ? r($(a).find(".pagination").children().last().attr("href")) : i)) }; await r("/latest?change_version=invision"); let i = []; return i }, getMembers: e => new Promise((t, n) => { let r = []; const i = (e, t) => ({ user: $(e).find(".membername span").text().trim(), id: $(e).find(".popupmenu .popupmenu-item a").attr("href").split("?")[0], img: $(e).find(".mini-avatar img").attr("src"), color: t }), a = t => { let n = []; return $(t).find(".member-list .member").each(function () { const t = FNR.utility.getGroup($(this).find(".membername span").attr("style").split("color:")[1]); e ? n.push(i(this, t)) : "unknown" !== t && t !== forumConfig.skinOptions.adminGroup && n.push(i(this, t)) }), n }, o = e => { $.get(e, e => { const n = $(e).find('.pagination img[alt="Siguiente"]').parent().attr("href") || !1; r = r.concat(a(e)), n ? o(n) : t(r.sort((e, t) => e.user < t.user ? -1 : e.user > t.user ? 1 : 0)) }) }; o("/memberlist?change_version=invision") }), getGroups: e => { const t = () => new Promise((e, t) => { $.get("/groups?change_version=invision", t => { let n = []; $(t).find(".group_list > li").each(function () { n.push({ id: parseInt($(this).find("a").attr("href").split("/g")[1].split("-")[0]), name: $(this).find("a").text().trim(), color: $(this).find("a").css("color"), url: Vue.filter("url-to-normal")($(this).find("a").attr("href")), count: parseInt($(this).find("div > span").text()) - 1 }) }), e(n) }) }), n = () => new Promise((n, r) => { FNR.cache.useData("groups", e).then(e => { n(e) }, e => { t().then(e => { FNR.cache.setData("groups", e), n(e) }) }) }); return n() }, getAffiliates: () => new Promise((e, t) => { const n = forumConfig.affiliatesMax, r = Object.entries(forumAffiliates).map(e => { let t = ""; e[1].forEach(e => { t += '<li><a href="' + e.url + '" title="' + e.title + '" target="_blank"><img src="' + e.img + '" alt="' + e.title + '"/></a></li>' }); for (let r = 0; r < n[e[0]] - e[1].length; r++)t += '<li><a href="/" title="' + forumData.name + '"><img src="' + forumDefaults.affiliates[e[0]] + '" alt="' + forumData.name + '"/></a></li>'; return t }); e({ normal: r[0], elite: r[1], directory: r[2], sister: r[3] }) }) }, content: { isAutosave: () => void 0 !== document.post && (-1 !== _userdata.user_id && "reply" === document.post.mode.value && void 0 !== document.post.t), post: { getPost: e => new Promise((t, n) => { $.get(Vue.filter("url-to-invision")(e), n => { const r = $(n).find("#p" + e.split("#")[1]); t({ author: { text: r.find(".author a").text(), color: r.find(".author a span").css("color"), url: Vue.filter("url-to-normal")(r.find(".author a").attr("href")) }, content: r.find(".post-entry > div").html(), date: r.find(".author").html().split("</a>")[1] }) }) }), genPost: (e, t) => new Promise((n, r) => { let i = document.createElement("iframe"); i.id = "forum-save", i.src = "/post?t=" + e + "&mode=reply&change_version=invision", i.width = 0, i.height = 0, i.onload = (() => { a.onload = (() => { $("#forum-save").remove(), console.clear(), n(!0) }), $("#forum-save").contents().find('.subtitle:contains("Mensaje")').next().find("textarea").val(t), $("#forum-save").contents().find('.formbuttonrow.center input[value="Enviar"]').click() }), document.querySelector("body").prepend(i); const a = document.getElementById("forum-save") }) }, topic: { getType: e => { const t = []; return e.indexOf("unread") > -1 ? t.push("is-unread") : t.push("is-read"), e.indexOf("locked") > -1 ? t.push("is-closed") : e.indexOf("sticky") > 1 ? t.push("is-sticky") : e.indexOf("global_announce") > 1 ? t.push("is-global-announcement") : e.indexOf("announce") > 1 && t.push("is-announcement"), t }, genTopic: (e, t, n) => new Promise((r, i) => { let a = document.createElement("iframe"); a.id = "forum-save", a.src = "/post?f=" + e + "&mode=newtopic&change_version=invision", a.width = 0, a.height = 0, a.onload = (() => { o.onload = (() => { $("#forum-save").remove(), console.clear(), r(!0) }), $("#forum-save").contents().find('dl dt:contains("Título del tema")').parent().find("input").val(t), $("#forum-save").contents().find('.subtitle:contains("Mensaje")').next().find("textarea").val(n), $("#forum-save").contents().find('.formbuttonrow.center input[value="Enviar"]').click() }), document.querySelector("body").prepend(a); const o = document.getElementById("forum-save") }) } }, user: { getUrl: e => { let t = void 0 !== e ? encodeURIComponent(e).replace(/[!'()]/g, escape).replace(/\*/g, "%2A") : _userdata.user_id; return "/profile?mode=viewprofile&u=" + t }, getLevel: async () => { switch (_userdata.user_level) { case 2: return "mod"; case 1: return "admin"; case 0: return -1 == _userdata.user_id ? "guest" : "user" } }, getGroup: async () => { const e = await FNR.user.getLevel(); if ("guest" === e) return "unknown"; const { colour: t } = await FNR.user.getProfile(_userdata.user_id, .25); return t }, getProfile: (e, t) => { const n = null != e ? FNR.user.getUrl(e) : FNR.user.getUrl(), r = t || 5, i = e => e.find("a").length ? Vue.filter("url-to-normal")(e.find("a").attr("href")) : e.find("table").length ? e.find("table").html() : e.find("img").length ? e.find("img").attr("src") : e.find("textarea").length ? e.find("textarea").val() : e.find("span").length ? e.find("span").text().trim() : "-" === e.text().trim() ? "" : e.text(), a = () => new Promise((e, t) => { $.get(n + "&change_version=invision", t => { let r = {}; r.name = $(t).find(".maintitle h1 span").text(), r.lastvisit = $(t).find('dt:contains("Última visita")').parent().find("dd").text(), r.colour = FNR.utility.getGroup($(t).find(".maintitle h1 span").css("color").replace("rgb(", "rgb_").replace(/, /g, "_").replace(")", "")), r.avatar = $(t).find(".real_avatar img").attr("src"), r.links = { profile: "/u" + n.split("&u=")[1], mp: "/privmsg?mode=post&u=" + n.split("&u=")[1] }, r.messages = { public: parseInt($(t).find('span:contains("Mensajes")').parent().parent().find("dd > div").text()) || 0, private: parseInt($(t).find('dt:contains("Mensajes privados")').parent().find("dd").text()) || 0 }, r.fields = {}, $(t).find('dl[id^="field_id"]').each(function () { if ("" !== $(this).find("dt span").text()) { if ("Mensajes" === $(this).find("dt span").text()) return; r.fields[FNR.utility.genSlug($(this).find("dt span").text())] = { name: $(this).find("dt span").text(), content: i($(this).find("dd .field_uneditable")) } } }), $(t).find(".ipbform2 > dl").each(function () { if ($(this).find("dt span").length && "" !== $(this).find("dt span").text()) { if ("Mensajes" === $(this).find("dt span").text()) return; r.fields[FNR.utility.genSlug($(this).find("dt span").text())] = { name: $(this).find("dt span").text(), content: i($(this).find("dd")) } } }), r.fields.rango = { name: "Rango", content: $(t).find('dt:contains("Rango:")').parent().find("dd").text() }, e(r) }) }), o = e => { const t = `userInfo${e}`; return new Promise((e, n) => { FNR.cache.useData(t, r).then(t => { e(t) }, n => { a().then(n => { FNR.cache.setData(t, n), e(n) }) }) }) }; return o(e) }, changeAccount: async (e, t, n) => { try { return await fetch(e), await fetch("/login", { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: `username=${encodeURIComponent(t)}&password=${encodeURIComponent(n)}&autologin=1&login=1` }), !0 } catch (e) { return console.error("Error inesperado", e), !1 } }, followed: { getPages: async () => { try { const e = await fetch("/search?search_id=watchsearch&change_version=invision"), t = await e.text(), n = document.createElement("html"); n.innerHTML = t; const r = n.querySelectorAll(".pagination a"); let i = []; if (r.length) { const e = r[r.length - 2], t = e.href.split(e.origin)[1], n = t.match(/[0-9]/g) || [], a = parseInt(n.join("")) || 0, o = r[1], l = o.href.split(o.origin)[1], s = l.match(/[0-9]/g) || [], c = parseInt(s.join("")) || 0, d = void 0 === a ? 0 : a / c; i = Array(d).fill(null).map((e, t) => `/search?search_id=watchsearch&start=${c * (t + 1)}&change_version=invision`) } return { items: 1 === n.querySelectorAll(".ipbtable tbody tr td").length ? 0 : n.querySelectorAll(".ipbtable tbody tr").length, pages: ["/search?search_id=watchsearch&change_version=invision", ...i] } } catch (e) { return console.error("Error inesperado", e), !1 } }, getFollowed: async e => { try { const t = await fetch(e), n = await t.text(), r = document.createElement("html"); return r.innerHTML = n, Array.from(r.querySelectorAll(".ipbtable tbody tr")).map(e => { const t = e.children; return { id: parseInt(t[7].children[0].value), name: t[1].querySelector(".topictitle").textContent.trim(), url: Vue.filter("url-to-normal")(t[1].querySelector(".topictitle").href), views: parseInt(t[5].textContent), replies: parseInt(t[3].textContent), type: FNR.content.topic.getType(t[0].querySelector("img").src).join(" ") } }) } catch (e) { return console.error("Error inesperado", e), !1 } }, delFollowed: async e => { try { return await fetch("/search?search_id=watchsearch", { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: `confirm=confirm${e.map(e => `&mark${encodeURIComponent("[]")}2=${e}`)}` }), !0 } catch (e) { return console.error("Error inesperado", e), !1 } } }, drafts: { delDrafts: async (e, t) => { try { const n = "draft" === e ? "draft" : "topic_draft"; return await fetch(`/search?search_id=${e}search`, { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: `confirm=confirm${t.map(e => `&delete_${n}${encodeURIComponent(`[${e}]`)}=on`)}` }), !0 } catch (e) { return console.error("Error inesperado", e), !1 } }, messages: { getPages: async () => { try { const e = await fetch("/search?search_id=draftsearch&change_version=invision"), t = await e.text(), n = document.createElement("html"); n.innerHTML = t; const r = n.querySelectorAll(".pagination a"); let i = []; if (r.length) { const e = r[r.length - 2], t = e.href.split(e.origin)[1], n = t.match(/[0-9]/g) || [], a = parseInt(n.join("")) || 0, o = r[1], l = o.href.split(o.origin)[1], s = l.match(/[0-9]/g) || [], c = parseInt(s.join("")) || 0, d = void 0 === a ? 0 : a / c; i = Array(d).fill(null).map((e, t) => `/search?search_id=draftsearch&start=${c * (t + 1)}&change_version=invision`) } return { items: 1 === n.querySelectorAll(".ipbtable tbody tr td").length ? 0 : n.querySelectorAll(".ipbtable tbody tr").length, pages: ["/search?search_id=draftsearch&change_version=invision", ...i] } } catch (e) { return console.error("Error inesperado", e), !1 } }, getDrafts: async e => { try { const t = await fetch(e), n = await t.text(), r = document.createElement("html"); return r.innerHTML = n, Array.from(r.querySelectorAll(".ipbtable tbody tr")).map(e => { const t = e.children; return { topic: { name: t[1].textContent.trim(), url: Vue.filter("url-to-normal")(t[1].querySelector("a").href) }, info: { location: t[2].textContent.trim(), date: t[3].textContent.trim() }, modify: Vue.filter("url-to-normal")(t[4].querySelector("a").href) } }) } catch (e) { return console.error("Error inesperado", e), !1 } } }, topics: { getPages: async () => { try { const e = await fetch("/search?search_id=topicdraftsearch&change_version=invision"), t = await e.text(), n = document.createElement("html"); n.innerHTML = t; const r = n.querySelectorAll(".pagination a"); let i = []; if (r.length) { const e = r[r.length - 2], t = e.href.split(e.origin)[1], n = t.match(/[0-9]/g) || [], a = parseInt(n.join("")) || 0, o = r[1], l = o.href.split(o.origin)[1], s = l.match(/[0-9]/g) || [], c = parseInt(s.join("")) || 0, d = void 0 === a ? 0 : a / c; i = Array(d).fill(null).map((e, t) => `/search?search_id=topicdraftsearch&start=${c * (t + 1)}&change_version=invision`) } return { items: 1 === n.querySelectorAll(".ipbtable tbody tr td").length ? 0 : n.querySelectorAll(".ipbtable tbody tr").length, pages: ["/search?search_id=topicdraftsearch&change_version=invision", ...i] } } catch (e) { return console.error("Error inesperado", e), !1 } }, getDrafts: async e => { try { const t = await fetch(e), n = await t.text(), r = document.createElement("html"); return r.innerHTML = n, Array.from(r.querySelectorAll(".ipbtable tbody tr")).map(e => { const t = e.children; return { topic: { name: t[0].textContent.trim(), url: Vue.filter("url-to-normal")(t[0].querySelector("a").href) }, info: { location: t[1].textContent.trim(), date: t[2].textContent.trim() }, modify: Vue.filter("url-to-normal")(t[3].querySelector("a").href) } }) } catch (e) { return console.error("Error inesperado", e), !1 } } } }, profile: { getData: e => new Promise((t, n) => { $.get("/profile?change_version=invision&mode=editprofile", n => { const r = n; $.get("/profile?change_version=invision&mode=editprofile&page_profil=avatars", n => { const i = n; let a = [];[].forEach.call(e, e => { let t = "", n = []; switch (e.type) { case "input": t = $(r).find('dl:contains("' + e.name + '")').find("dd").find("input").val(); break; case "textarea": t = $(r).find('dl:contains("' + e.name + '")').find("dd").find("textarea").val(); break; case "select": t = $(r).find('dl:contains("' + e.name + '")').find("dd").find("select option:selected").attr("value"), $(r).find('dl:contains("' + e.name + '")').find("dd").find("select option").each(function () { "" !== $(this).attr("value") && n.push({ name: $(this).text(), value: $(this).attr("value") }) }); break; case "avatar": t = $(i).find(".box-content img").attr("src") }if ("select" === e.type && void 0 === t || "select" === e.type && "" === t) return; let o = { type: e.type, name: e.name, value: t }; e.validation && (o.validation = e.validation), n.length && (o.options = n), a.push(o) }), t(a) }) }) }), setData: e => new Promise((t, n) => { const r = () => { $("#forum-save").remove(), console.clear(), t(!0) }; let i = document.createElement("iframe"); i.id = "forum-save", i.src = "/profile?change_version=invision&mode=editprofile", i.width = 0, i.height = 0, i.onload = (() => { let t = !1;[].forEach.call(e, e => { switch (e.type) { case "input": $("#forum-save").contents().find('dl:contains("' + e.name + '")').find("dd").find("input").first().val(e.value); break; case "textarea": $("#forum-save").contents().find('dl:contains("' + e.name + '")').find("dd").find("textarea").val(e.value); break; case "select": $("#forum-save").contents().find('dl:contains("' + e.name + '")').find("dd").find('select option[value="' + e.value + '"]').attr("selected", "selected"); break; case "avatar": t = e.value } }), a.onload = (() => { t ? (a.onload = (() => { a.onload = (() => { r() }), $("#forum-save").contents().find('input[name="avatarremoteurl"]').val(t), $("#forum-save").contents().find('input[type="submit"][value="Registrar"]').click() }), a.src = "/profile?change_version=invision&mode=editprofile&page_profil=avatars") : r() }), $("#forum-save").contents().find('input[type="submit"][value="Registrar"]').click() }), document.querySelector("body").prepend(i); const a = document.getElementById("forum-save") }) } }, cache: { getData: e => null !== localStorage.getItem(forumData.prefix + "_" + e) && JSON.parse(localStorage.getItem(forumData.prefix + "_" + e)).content, setData: (e, t, n) => { let r = -1 === n ? "undefined" : (new Date).getTime(); localStorage.setItem(forumData.prefix + "_" + e, JSON.stringify({ cached_at: r, content: t })) }, delData: e => null !== localStorage.getItem(forumData.prefix + "_" + e) && localStorage.removeItem(forumData.prefix + "_" + e), useData: async (e, t) => { const n = localStorage.getItem(forumData.prefix + "_" + e), r = new Date, i = -1 == t ? "undefined" : 864e5 * t; return null != n && -1 == t || null != n && parseInt(JSON.parse(n).cached_at) + i > r.getTime() ? JSON.parse(n).content : Promise.reject(!1) } }, utility: { genSlug: (e, t) => { const n = e => { const t = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;"; e = e.trim().toLowerCase(); for (var n = 0, r = t.length; n < r; n++)e = e.replace(new RegExp(t.charAt(n), "g"), "aaaaeeeeiiiioooouuuunc------".charAt(n)); return e.replace(/[^a-z0-9 -]/g, "").replace(/\s+/g, "-").replace(/-+/g, "-") }, r = t || "_"; return n(e).replace(/-/g, r) }, genArray: e => JSON.parse(e.replace(/`/g, '"')), genValidation: e => { let t = ""; return [].forEach.call(e, e => { switch (e.validation) { case "hex": e.value.match(/^#[a-f0-9]{6}$/i) || (t += "<li>El campo de " + e.name.toLowerCase() + " debe incluir un código de color hexadecimal.</li>"); break; case "img": e.value.match(/(jpg|jpeg|png)$/i) || (t += "<li>El campo de " + e.name.toLowerCase() + " debe ser el enlace a una imagen (formato png, jpg o jpeg).</li>") } }), t }, getGroup: e => { const t = e => { let t = "unknown"; return Object.values(forumColours).map(n => { n.hex === e.toLowerCase() && (t = FNR.utility.genSlug(n.code)) }), t }, n = e => { let t = "unknown"; return Object.values(forumColours).map(n => { n.id === e && (t = FNR.utility.genSlug(n.code)) }), t }; return void 0 === e ? "unknown" : e.indexOf("#") > -1 ? t(e) : e.indexOf("id_") > -1 ? n(parseFloat(e.split("_")[1])) : void 0 === forumColours[e] ? "unknown" : FNR.utility.genSlug(forumColours[e].code) } }, html: { genModal: (e, t, n) => { if ("" === e || null == e) return; if ("" === t || null == t) return; let r = document.createElement("div"); r.id = "forum-modal", document.body.appendChild(r); let i = ""; i += '<div id="' + FNR.utility.genSlug(e, "-") + '" class="modal-element">', i += '<div class="modal-title">', i += "<h3>" + e + "</h3>", i += '<a onclick="document.querySelector(`#forum-modal`).remove()">', i += '<i class="fas fa-times"></i>', i += "</a>", i += "</div>", i += '<div class="modal-content">', i += '<div class="is-content">', i += t.replace(/\n/g, "<br>"), i += "</div>", "" !== n && null != n && (i += '<div class="modal-buttons">', i += n, i += "</div>"), i += "</div>", i += "</div>", i += '<div class="is-bgmodal bg-active" onclick="document.querySelector(`#forum-modal`).remove()"></div>', document.getElementById("forum-modal").innerHTML = i }, genPrompt: (e, t, n, r) => { if ("" !== e && null != e && "" !== t && null != t) return new Promise((i, a) => { FNR.html.genModal(e, "<p>" + t + '</p><p><input id="modal-prompt" type="text" placeholder="' + n + '" value="' + r + '"></p>', '<button id="modal-button-enter" class="button1 btn-main">Confirmar</button><button id="modal-button-cancel" class="button1">Cancelar</button>'), document.querySelector("#modal-button-enter").onclick = (() => { const e = document.querySelector("#modal-prompt").value; i("" !== e && e), document.getElementById("forum-modal").remove() }), document.querySelector("#modal-button-cancel").onclick = (() => { a(!1), document.getElementById("forum-modal").remove() }), document.querySelector(".modal-title a").onclick = (() => { a(!1), document.getElementById("forum-modal").remove() }), document.querySelector(".is-bgmodal.bg-active").onclick = (() => { a(!1), document.getElementById("forum-modal").remove() }) }) }, genNotification: (e, t, n, r) => { if ("" === e || null == e) return; if ("" === t || null == t) return; if (t.length > 50) return; if ("" === n || null == n) return; document.querySelectorAll("forum-notification").length && (document.getElementById("forum-notification").remove(), clearTimeout()); let i = document.createElement("div"); i.id = "forum-notification", document.body.appendChild(i); let a = ""; a += "" === r || null == r ? '<div id="' + FNR.utility.genSlug(e, "-") + '" class="notification-element" onclick="document.querySelector(`#forum-notification`).classList.remove(`notification-show`)" >' : '<a href="' + r + '" target="_blank" id="' + FNR.utility.genSlug(e, "-") + '" class="notification-element" onclick="document.querySelector(`#forum-notification`).classList.remove(`notification-show`)" >', a += '<div class="notification-icon">', a += '<i class="' + n + '"></i>', a += "</div>", a += '<div class="notification-content">', a += "<h3>" + e + "</h3>", a += "<p>" + t + "</p>", a += "</div>", a += '<div class="notification-controls">', a += '<i class="fas fa-times"></i>', a += "</div>", a += "" === r || null == r ? "</div>" : "</a>", document.getElementById("forum-notification").innerHTML = a, setTimeout(() => { document.getElementById("forum-notification").classList.add("notification-show") }, 250), setTimeout(() => { document.getElementById("forum-notification").classList.remove("notification-show") }, 8e3), setTimeout(() => { document.getElementById("forum-notification").remove() }, 1e4) } }, behaviour: { genWiki: () => { document.querySelector(".wiki-cascade") && [].forEach.call(document.getElementsByClassName("wiki-cascade"), e => { e.onclick = (() => { const t = e.parentElement.parentElement; t.classList.contains("is-active") ? t.classList.remove("is-active") : t.classList.add("is-active") }) }), document.querySelector(".wiki-controls .router-link-active") && [].forEach.call(document.querySelectorAll(".wiki-controls .router-link-active"), e => { if (!e.parentElement.parentElement.parentElement.parentElement.parentElement.classList.contains("wiki-index")) { const t = (e, n) => { let r = e.parentElement.parentElement; n && (r = r.parentElement.parentElement), r.classList.add("is-active"), r.classList.add("is-selected"), r.parentElement.parentElement.parentElement.classList.contains("wiki-index") || t(r, !1) }; t(e, !0) } }), document.querySelector("aside.wiki-index > .select-container > select") && (document.querySelector("aside.wiki-index > .select-container > select").onchange = (() => { router.push(document.querySelector("aside.wiki-index > .select-container > select").value) })) }, genDropeable: () => { document.querySelector(".is-dropeable") && [].forEach.call(document.getElementsByClassName("is-dropeable"), e => { e.onclick = (() => { e.classList.contains("is-active") ? e.classList.remove("is-active") : ([].forEach.call(document.getElementsByClassName("is-dropeable"), e => { e.classList.remove("is-active") }), e.classList.add("is-active")) }) }) }, genControls: () => { document.querySelector(".forum-controls") && [].forEach.call(document.querySelectorAll(".forum-controls"), e => { let t = 0;[].forEach.call(e.children, e => { "none" !== window.getComputedStyle(e, null).display && (t += e.children.length) }), 0 === t && !1 === e.classList.contains("not-show") && e.classList.add("not-show") }) }, genDebounce: (e, t = 750) => { let n; return (...r) => { clearTimeout(n), n = setTimeout(() => { e.apply(this, r) }, t) } } } };
|
package/general.js
CHANGED
|
@@ -319,8 +319,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
319
319
|
|
|
320
320
|
/* Edición rápida */
|
|
321
321
|
document.addEventListener('DOMContentLoaded', () => {
|
|
322
|
-
if (document.
|
|
323
|
-
document.
|
|
322
|
+
if (document.querySelector('#forum-realreply') !== null && document.querySelector('#forum-realreply').innerHTML === '') {
|
|
323
|
+
document.querySelector('#quickreply-section').remove();
|
|
324
324
|
}
|
|
325
325
|
});
|
|
326
326
|
|
|
@@ -369,8 +369,8 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
|
369
369
|
/* GENERAL */
|
|
370
370
|
/* Breadcumbs */
|
|
371
371
|
document.addEventListener('DOMContentLoaded', () => {
|
|
372
|
-
if (document.
|
|
373
|
-
[].forEach.call(document.
|
|
372
|
+
if (document.querySelector('#breadcrumbs') && document.querySelector('#forum-breadcrumb')) {
|
|
373
|
+
[].forEach.call(document.querySelector('#breadcrumbs').children, (item, index, arr) => {
|
|
374
374
|
let url = item.href,
|
|
375
375
|
text = Vue.filter('mini-sanitize')(item.text),
|
|
376
376
|
special = '';
|