generic-skin 4.0.29 → 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/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/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 = '';
|