generic-skin 2.3.3 → 2.3.4
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.
|
@@ -122,7 +122,7 @@ const FNR = {
|
|
|
122
122
|
name: $(this).find('a').text().trim(),
|
|
123
123
|
color: $(this).find('a').css('color'),
|
|
124
124
|
url: Vue.filter('url-to-normal')($(this).find('a').attr('href')),
|
|
125
|
-
count: parseInt($(this).find('div > span').text())
|
|
125
|
+
count: parseInt($(this).find('div > span').text()) - 1
|
|
126
126
|
});
|
|
127
127
|
});
|
|
128
128
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const FNR={execFn:function(e){document.addEventListener("forumReady",e,!1)},forum:{getColors:function(){return Object.values(forumColours).map(e=>({name:e.code,hex:e.hex}))},getLatest:function(e,t){return new Promise((n,i)=>{const a=e=>{const t=$(e).find(".topictitle"),n=$(e).children().last();r.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"))}})},o=i=>{$.get(i,i=>{$(i).find(".ipbform").find("tbody").find("tr").each(function(){r.length<t&&-1===e.indexOf(parseInt($(this).find(".row2 + .row2:not(.centered) a").attr("href").split("/f")[1].split("-")[0]))&&a(this)}),r.length!==t&&$(i).find(".pagination")[0].children.length&&"b"!==$(i).find(".pagination").children().last()[0].localName?o($(i).find(".pagination").children().last().attr("href")):n(r)})};let r=[];o("/latest?change_version=invision")})},getMembers:function(e){return new Promise((t,n)=>{let i=[];const a=(e,t)=>({user:$(e).find(".avatar-mini a span strong").text(),id:$(e).find(".avatar-mini a").attr("href").split("?")[0],img:$(e).find(".avatar-mini a img").attr("src"),color:t}),o=t=>{let n=[];return $(t).find("#memberlist tbody tr").each(function(){const t=FNR.utility.getGroup($(this).find(".avatar-mini a span").attr("style").split("color:")[1]);e?n.push(a(this,t)):"unknown"!==t&&"narracion"!==t&&n.push(a(this,t))}),n},r=e=>{$.get(e,e=>{const n=$(e).find('.pagination img[alt="Siguiente"]').parent().attr("href")||!1;i=i.concat(o(e)),n?r(n):t(i.sort((e,t)=>e.user<t.user?-1:e.user>t.user?1:0))})};r("/memberlist?change_version=invision")})},getGroups:function(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())})}),e(n)})}),n=()=>new Promise((n,i)=>{FNR.cache.useData("groups",e).then(e=>{n(e)},e=>{t().then(e=>{FNR.cache.setData("groups",e),n(e)})})});return n()},getAffiliates:function(){return new Promise((e,t)=>{const n=forumConfig.affiliatesMax,i=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 i=0;i<n[e[0]]-e[1].length;i++)t+='<li><a href="/" title="'+forumData.name+'"><img src="'+forumDefaults.affiliates[e[0]]+'" alt="'+forumData.name+'"/></a></li>';return t});e({normal:i[0],elite:i[1],directory:i[2],sister:i[3]})})}},content:{post:{getPost:function(e){return new Promise((t,n)=>{$.get(Vue.filter("url-to-invision")(e),n=>{const i=$(n).find("#p"+e.split("#")[1]);t({author:{text:i.find(".author a").text(),color:i.find(".author a span").css("color"),url:Vue.filter("url-to-normal")(i.find(".author a").attr("href"))},content:i.find(".post-entry > div").html(),date:i.find(".author").html().split("</a>")[1]})})})},getLast:function(e){return new Promise((t,n)=>{$.get(Vue.filter("url-to-invision")(e),e=>{const n=$(e).find(".pagination.topic-options").children().last().prev().attr("href")||!1,i=e,a=e=>{const t=e=>$(e).find(".post").parent().children().last().prev(),n=""!==t(e).find(".author a").text();return{author:{text:n?t(e).find(".author a").text():"Invitado",color:n?t(e).find(".author a span").css("color"):"#bdbdbd",url:n?t(e).find(".author a").attr("href").replace("?change_version=invision",""):"#"},locate:{text:$(e).find("#navstrip").find("li").last().text(),url:$(e).find("#navstrip").find("li").last().find("a").attr("href").replace("?change_version=invision","")},url:t(e).find(".postbody-head h3 a").attr("href").replace("?change_version=invision",""),content:t(e).find(".post-entry > div").html(),date:n?t(e).find(".author").html().split("</a>")[1].trim():t(e).find(".author").html().split("Invitado")[1].trim()}};n?$.get(n,e=>{t(a(e))}):t(a(i))})})}},topic:{genTopic:function(e,t,n){return new Promise((i,a)=>{let o=document.createElement("iframe");o.id="forum-save",o.src="/post?f="+e+"&mode=newtopic&change_version=invision",o.width=0,o.height=0,o.onload=(()=>{r.onload=(()=>{$("#forum-save").remove(),console.clear(),i(!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 > header").prepend(o);const r=document.getElementById("forum-save")})},isAutosave:function(){return void 0!==document.post&&(-1!==_userdata.user_id&&"reply"===document.post.mode.value&&void 0!==document.post.t)}}},user:{getLevel:function(){switch(_userdata.user_level){case 2:return"mod";case 1:return"admin";case 0:return-1==_userdata.user_id?"guest":"user"}},changeAccount:function(e,t,n){return new Promise((i,a)=>{let o=document.createElement("iframe");o.id="forum-save",o.src=e,o.width=0,o.height=0,o.onload=(()=>{o.onload=(()=>{o.onload=(()=>{console.clear(),i(!0)}),$("#forum-save").contents().find('input[name="username"]').val(t),$("#forum-save").contents().find('input[name="password"]').val(n),$("#forum-save").contents().find('input[type="submit"][name="login"]').click()}),r.src="/login?change_version=invision"}),document.querySelector("body > header").prepend(o);const r=document.getElementById("forum-save")})},profile:{getUrl:function(e){let t=void 0!==e?encodeURIComponent(e).replace(/[!'()]/g,escape).replace(/\*/g,"%2A"):_userdata.user_id;return"/profile?mode=viewprofile&u="+t},getData:function(e){return new Promise((t,n)=>{$.get("/profile?change_version=invision&mode=editprofile",n=>{const i=n;$.get("/profile?change_version=invision&mode=editprofile&page_profil=avatars",n=>{const a=n;let o=[];[].forEach.call(e,e=>{let t="",n=[];switch(e.type){case"input":t=$(i).find('dl:contains("'+e.name+'")').find("dd").find("input").val();break;case"textarea":t=$(i).find('dl:contains("'+e.name+'")').find("dd").find("textarea").val();break;case"select":t=$(i).find('dl:contains("'+e.name+'")').find("dd").find("select option:selected").attr("value"),$(i).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=$(a).find(".box-content img").attr("src")}if("select"===e.type&&void 0===t||"select"===e.type&&""===t)return;let r={type:e.type,name:e.name,value:t};e.validation&&(r.validation=e.validation),n.length&&(r.options=n),o.push(r)}),t(o)})})})},setData:function(e){return new Promise((t,n)=>{const i=()=>{$("#forum-save").remove(),console.clear(),t(!0)};let a=document.createElement("iframe");a.id="forum-save",a.src="/profile?change_version=invision&mode=editprofile",a.width=0,a.height=0,a.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}}),o.onload=(()=>{t?(o.onload=(()=>{o.onload=(()=>{i()}),$("#forum-save").contents().find('input[name="avatarremoteurl"]').val(t),$("#forum-save").contents().find('input[type="submit"][value="Registrar"]').click()}),o.src="/profile?change_version=invision&mode=editprofile&page_profil=avatars"):i()}),$("#forum-save").contents().find('input[type="submit"][value="Registrar"]').click()}),document.querySelector("body > header").prepend(a);const o=document.getElementById("forum-save")})},getAll:function(e,t){const n=null!=e?FNR.user.profile.getUrl(e):FNR.user.profile.getUrl(),i=t||5,a=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(),o=()=>new Promise((e,t)=>{$.get(n+"&change_version=invision",t=>{let i={};i.name=$(t).find(".maintitle h1 span").text(),i.lastvisit=$(t).find('dt:contains("Última visita")').parent().find("dd").text(),i.colour=FNR.utility.getGroup($(t).find(".maintitle h1 span").css("color").replace("rgb(","rgb_").replace(/, /g,"_").replace(")","")),i.avatar=$(t).find(".real_avatar img").attr("src"),i.links={profile:"/u"+n.split("&u=")[1],mp:"/privmsg?mode=post&u="+n.split("&u=")[1]},i.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},i.fields={},$(t).find('dl[id^="field_id"]').each(function(){if(""!==$(this).find("dt span").text()){if("Mensajes"===$(this).find("dt span").text())return;i.fields[FNR.utility.genSlug($(this).find("dt span").text())]={name:$(this).find("dt span").text(),content:a($(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;i.fields[FNR.utility.genSlug($(this).find("dt span").text())]={name:$(this).find("dt span").text(),content:a($(this).find("dd"))}}}),i.fields.rango={name:"Rango",content:$(t).find('dt:contains("Rango:")').parent().find("dd").text()},e(i)})}),r=e=>{const t="userInfo"+e;return new Promise((e,n)=>{FNR.cache.useData(t,i).then(t=>{e(t)},n=>{o().then(n=>{FNR.cache.setData(t,n),e(n)})})})};return r(e)},getDrafts:function(){return new Promise((e,t)=>{$.get("/search?search_id=draftsearch&change_version=invision",t=>{if(0!==parseFloat($(t).find(".maintitle > h3").text())){let n=[];$(t).find(".ipbform .ipbtable tbody > tr").each(function(){const e=$(this).find("td");n.push({topic:{name:e[1].textContent.trim(),url:Vue.filter("url-to-normal")(e[1].querySelector("a").href)},info:{location:e[2].textContent.trim(),date:e[3].textContent.trim()},modify:Vue.filter("url-to-normal")(e[4].querySelector("a").href)})}),e(n)}else e(!1)})})}}},cache:{setData:function(e,t,n){let i=-1===n?"undefined":(new Date).getTime();localStorage.setItem(forumData.prefix+"_"+e,JSON.stringify({cached_at:i,content:t}))},getData:function(e){return null!==localStorage.getItem(forumData.prefix+"_"+e)&&JSON.parse(localStorage.getItem(forumData.prefix+"_"+e)).content},delData:function(e){return null!==localStorage.getItem(forumData.prefix+"_"+e)&&localStorage.removeItem(forumData.prefix+"_"+e)},useData:function(e,t){return new Promise((n,i)=>{let a=localStorage.getItem(forumData.prefix+"_"+e),o=new Date,r=-1==t?"undefined":864e5*t;null!=a&&-1==t||null!=a&&parseInt(JSON.parse(a).cached_at)+r>o.getTime()?n(JSON.parse(a).content):i(!1)})}},utility:{genSlug:function(e,t){const n=e=>{const t="àáäâèéëêìíïîòóöôùúüûñç·/_,:;";e=e.trim().toLowerCase();for(var n=0,i=t.length;n<i;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,"-")},i=t||"_";return n(e).replace(/-/g,i)},genArray:function(e){return JSON.parse(e.replace(/`/g,'"'))},genValidation:function(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:function(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:function(e,t,n){if(""===e||null==e)return;if(""===t||null==t)return;let i=document.createElement("div");i.id="forum-modal",document.body.appendChild(i);let a="";a+='<div id="'+FNR.utility.genSlug(e,"-")+'" class="modal-element">',a+='<div class="modal-title">',a+="<h3>"+e+"</h3>",a+='<a onclick="document.getElementById(`forum-modal`).remove()">',a+='<i class="fas fa-times"></i>',a+="</a>",a+="</div>",a+='<div class="modal-content">',a+='<div class="is-content">',a+=t.replace(/\n/g,"<br>"),a+="</div>",""!==n&&null!=n&&(a+='<div class="modal-buttons">',a+=n,a+="</div>"),a+="</div>",a+="</div>",a+='<div class="is-bgmodal bg-active" onclick="document.getElementById(`forum-modal`).remove()"></div>',document.getElementById("forum-modal").innerHTML=a},genPrompt:function(e,t,n,i){if(""!==e&&null!=e&&""!==t&&null!=t)return new Promise((a,o)=>{FNR.html.genModal(e,"<p>"+t+'</p><p><input id="modal-prompt" type="text" placeholder="'+n+'" value="'+i+'"></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;a(""!==e&&e),document.getElementById("forum-modal").remove()}),document.querySelector("#modal-button-cancel").onclick=(()=>{o(!1),document.getElementById("forum-modal").remove()}),document.querySelector(".modal-title a").onclick=(()=>{o(!1),document.getElementById("forum-modal").remove()}),document.querySelector(".is-bgmodal.bg-active").onclick=(()=>{o(!1),document.getElementById("forum-modal").remove()})})},genNotification:function(e,t,n,i){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 a=document.createElement("div");a.id="forum-notification",document.body.appendChild(a);let o="";o+=""===i||null==i?'<div id="'+FNR.utility.genSlug(e,"-")+'" class="notification-element" onclick="document.querySelector(`#forum-notification`).classList.remove(`notification-show`)" >':'<a href="'+i+'" target="_blank" id="'+FNR.utility.genSlug(e,"-")+'" class="notification-element" onclick="document.querySelector(`#forum-notification`).classList.remove(`notification-show`)" >',o+='<div class="notification-icon">',o+='<i class="'+n+'"></i>',o+="</div>",o+='<div class="notification-content">',o+="<h3>"+e+"</h3>",o+="<p>"+t+"</p>",o+="</div>",o+='<div class="notification-controls">',o+='<i class="fas fa-times"></i>',o+="</div>",o+=""===i||null==i?"</div>":"</a>",document.getElementById("forum-notification").innerHTML=o,setTimeout(()=>{document.getElementById("forum-notification").classList.add("notification-show")},500),setTimeout(()=>{document.getElementById("forum-notification").classList.remove("notification-show")},8e3),setTimeout(()=>{document.getElementById("forum-notification").remove()},1e4)}},behaviour:{genWiki:function(){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 i=e.parentElement.parentElement;n&&(i=i.parentElement.parentElement),i.classList.add("is-active"),i.classList.add("is-selected"),i.parentElement.parentElement.parentElement.classList.contains("wiki-index")||t(i,!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:function(){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"))})})}}};
|
|
1
|
+
const FNR={execFn:function(e){document.addEventListener("forumReady",e,!1)},forum:{getColors:function(){return Object.values(forumColours).map(e=>({name:e.code,hex:e.hex}))},getLatest:function(e,t){return new Promise((n,i)=>{const a=e=>{const t=$(e).find(".topictitle"),n=$(e).children().last();r.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"))}})},o=i=>{$.get(i,i=>{$(i).find(".ipbform").find("tbody").find("tr").each(function(){r.length<t&&-1===e.indexOf(parseInt($(this).find(".row2 + .row2:not(.centered) a").attr("href").split("/f")[1].split("-")[0]))&&a(this)}),r.length!==t&&$(i).find(".pagination")[0].children.length&&"b"!==$(i).find(".pagination").children().last()[0].localName?o($(i).find(".pagination").children().last().attr("href")):n(r)})};let r=[];o("/latest?change_version=invision")})},getMembers:function(e){return new Promise((t,n)=>{let i=[];const a=(e,t)=>({user:$(e).find(".avatar-mini a span strong").text(),id:$(e).find(".avatar-mini a").attr("href").split("?")[0],img:$(e).find(".avatar-mini a img").attr("src"),color:t}),o=t=>{let n=[];return $(t).find("#memberlist tbody tr").each(function(){const t=FNR.utility.getGroup($(this).find(".avatar-mini a span").attr("style").split("color:")[1]);e?n.push(a(this,t)):"unknown"!==t&&"narracion"!==t&&n.push(a(this,t))}),n},r=e=>{$.get(e,e=>{const n=$(e).find('.pagination img[alt="Siguiente"]').parent().attr("href")||!1;i=i.concat(o(e)),n?r(n):t(i.sort((e,t)=>e.user<t.user?-1:e.user>t.user?1:0))})};r("/memberlist?change_version=invision")})},getGroups:function(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,i)=>{FNR.cache.useData("groups",e).then(e=>{n(e)},e=>{t().then(e=>{FNR.cache.setData("groups",e),n(e)})})});return n()},getAffiliates:function(){return new Promise((e,t)=>{const n=forumConfig.affiliatesMax,i=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 i=0;i<n[e[0]]-e[1].length;i++)t+='<li><a href="/" title="'+forumData.name+'"><img src="'+forumDefaults.affiliates[e[0]]+'" alt="'+forumData.name+'"/></a></li>';return t});e({normal:i[0],elite:i[1],directory:i[2],sister:i[3]})})}},content:{post:{getPost:function(e){return new Promise((t,n)=>{$.get(Vue.filter("url-to-invision")(e),n=>{const i=$(n).find("#p"+e.split("#")[1]);t({author:{text:i.find(".author a").text(),color:i.find(".author a span").css("color"),url:Vue.filter("url-to-normal")(i.find(".author a").attr("href"))},content:i.find(".post-entry > div").html(),date:i.find(".author").html().split("</a>")[1]})})})},getLast:function(e){return new Promise((t,n)=>{$.get(Vue.filter("url-to-invision")(e),e=>{const n=$(e).find(".pagination.topic-options").children().last().prev().attr("href")||!1,i=e,a=e=>{const t=e=>$(e).find(".post").parent().children().last().prev(),n=""!==t(e).find(".author a").text();return{author:{text:n?t(e).find(".author a").text():"Invitado",color:n?t(e).find(".author a span").css("color"):"#bdbdbd",url:n?t(e).find(".author a").attr("href").replace("?change_version=invision",""):"#"},locate:{text:$(e).find("#navstrip").find("li").last().text(),url:$(e).find("#navstrip").find("li").last().find("a").attr("href").replace("?change_version=invision","")},url:t(e).find(".postbody-head h3 a").attr("href").replace("?change_version=invision",""),content:t(e).find(".post-entry > div").html(),date:n?t(e).find(".author").html().split("</a>")[1].trim():t(e).find(".author").html().split("Invitado")[1].trim()}};n?$.get(n,e=>{t(a(e))}):t(a(i))})})}},topic:{genTopic:function(e,t,n){return new Promise((i,a)=>{let o=document.createElement("iframe");o.id="forum-save",o.src="/post?f="+e+"&mode=newtopic&change_version=invision",o.width=0,o.height=0,o.onload=(()=>{r.onload=(()=>{$("#forum-save").remove(),console.clear(),i(!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 > header").prepend(o);const r=document.getElementById("forum-save")})},isAutosave:function(){return void 0!==document.post&&(-1!==_userdata.user_id&&"reply"===document.post.mode.value&&void 0!==document.post.t)}}},user:{getLevel:function(){switch(_userdata.user_level){case 2:return"mod";case 1:return"admin";case 0:return-1==_userdata.user_id?"guest":"user"}},changeAccount:function(e,t,n){return new Promise((i,a)=>{let o=document.createElement("iframe");o.id="forum-save",o.src=e,o.width=0,o.height=0,o.onload=(()=>{o.onload=(()=>{o.onload=(()=>{console.clear(),i(!0)}),$("#forum-save").contents().find('input[name="username"]').val(t),$("#forum-save").contents().find('input[name="password"]').val(n),$("#forum-save").contents().find('input[type="submit"][name="login"]').click()}),r.src="/login?change_version=invision"}),document.querySelector("body > header").prepend(o);const r=document.getElementById("forum-save")})},profile:{getUrl:function(e){let t=void 0!==e?encodeURIComponent(e).replace(/[!'()]/g,escape).replace(/\*/g,"%2A"):_userdata.user_id;return"/profile?mode=viewprofile&u="+t},getData:function(e){return new Promise((t,n)=>{$.get("/profile?change_version=invision&mode=editprofile",n=>{const i=n;$.get("/profile?change_version=invision&mode=editprofile&page_profil=avatars",n=>{const a=n;let o=[];[].forEach.call(e,e=>{let t="",n=[];switch(e.type){case"input":t=$(i).find('dl:contains("'+e.name+'")').find("dd").find("input").val();break;case"textarea":t=$(i).find('dl:contains("'+e.name+'")').find("dd").find("textarea").val();break;case"select":t=$(i).find('dl:contains("'+e.name+'")').find("dd").find("select option:selected").attr("value"),$(i).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=$(a).find(".box-content img").attr("src")}if("select"===e.type&&void 0===t||"select"===e.type&&""===t)return;let r={type:e.type,name:e.name,value:t};e.validation&&(r.validation=e.validation),n.length&&(r.options=n),o.push(r)}),t(o)})})})},setData:function(e){return new Promise((t,n)=>{const i=()=>{$("#forum-save").remove(),console.clear(),t(!0)};let a=document.createElement("iframe");a.id="forum-save",a.src="/profile?change_version=invision&mode=editprofile",a.width=0,a.height=0,a.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}}),o.onload=(()=>{t?(o.onload=(()=>{o.onload=(()=>{i()}),$("#forum-save").contents().find('input[name="avatarremoteurl"]').val(t),$("#forum-save").contents().find('input[type="submit"][value="Registrar"]').click()}),o.src="/profile?change_version=invision&mode=editprofile&page_profil=avatars"):i()}),$("#forum-save").contents().find('input[type="submit"][value="Registrar"]').click()}),document.querySelector("body > header").prepend(a);const o=document.getElementById("forum-save")})},getAll:function(e,t){const n=null!=e?FNR.user.profile.getUrl(e):FNR.user.profile.getUrl(),i=t||5,a=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(),o=()=>new Promise((e,t)=>{$.get(n+"&change_version=invision",t=>{let i={};i.name=$(t).find(".maintitle h1 span").text(),i.lastvisit=$(t).find('dt:contains("Última visita")').parent().find("dd").text(),i.colour=FNR.utility.getGroup($(t).find(".maintitle h1 span").css("color").replace("rgb(","rgb_").replace(/, /g,"_").replace(")","")),i.avatar=$(t).find(".real_avatar img").attr("src"),i.links={profile:"/u"+n.split("&u=")[1],mp:"/privmsg?mode=post&u="+n.split("&u=")[1]},i.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},i.fields={},$(t).find('dl[id^="field_id"]').each(function(){if(""!==$(this).find("dt span").text()){if("Mensajes"===$(this).find("dt span").text())return;i.fields[FNR.utility.genSlug($(this).find("dt span").text())]={name:$(this).find("dt span").text(),content:a($(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;i.fields[FNR.utility.genSlug($(this).find("dt span").text())]={name:$(this).find("dt span").text(),content:a($(this).find("dd"))}}}),i.fields.rango={name:"Rango",content:$(t).find('dt:contains("Rango:")').parent().find("dd").text()},e(i)})}),r=e=>{const t="userInfo"+e;return new Promise((e,n)=>{FNR.cache.useData(t,i).then(t=>{e(t)},n=>{o().then(n=>{FNR.cache.setData(t,n),e(n)})})})};return r(e)},getDrafts:function(){return new Promise((e,t)=>{$.get("/search?search_id=draftsearch&change_version=invision",t=>{if(0!==parseFloat($(t).find(".maintitle > h3").text())){let n=[];$(t).find(".ipbform .ipbtable tbody > tr").each(function(){const e=$(this).find("td");n.push({topic:{name:e[1].textContent.trim(),url:Vue.filter("url-to-normal")(e[1].querySelector("a").href)},info:{location:e[2].textContent.trim(),date:e[3].textContent.trim()},modify:Vue.filter("url-to-normal")(e[4].querySelector("a").href)})}),e(n)}else e(!1)})})}}},cache:{setData:function(e,t,n){let i=-1===n?"undefined":(new Date).getTime();localStorage.setItem(forumData.prefix+"_"+e,JSON.stringify({cached_at:i,content:t}))},getData:function(e){return null!==localStorage.getItem(forumData.prefix+"_"+e)&&JSON.parse(localStorage.getItem(forumData.prefix+"_"+e)).content},delData:function(e){return null!==localStorage.getItem(forumData.prefix+"_"+e)&&localStorage.removeItem(forumData.prefix+"_"+e)},useData:function(e,t){return new Promise((n,i)=>{let a=localStorage.getItem(forumData.prefix+"_"+e),o=new Date,r=-1==t?"undefined":864e5*t;null!=a&&-1==t||null!=a&&parseInt(JSON.parse(a).cached_at)+r>o.getTime()?n(JSON.parse(a).content):i(!1)})}},utility:{genSlug:function(e,t){const n=e=>{const t="àáäâèéëêìíïîòóöôùúüûñç·/_,:;";e=e.trim().toLowerCase();for(var n=0,i=t.length;n<i;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,"-")},i=t||"_";return n(e).replace(/-/g,i)},genArray:function(e){return JSON.parse(e.replace(/`/g,'"'))},genValidation:function(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:function(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:function(e,t,n){if(""===e||null==e)return;if(""===t||null==t)return;let i=document.createElement("div");i.id="forum-modal",document.body.appendChild(i);let a="";a+='<div id="'+FNR.utility.genSlug(e,"-")+'" class="modal-element">',a+='<div class="modal-title">',a+="<h3>"+e+"</h3>",a+='<a onclick="document.getElementById(`forum-modal`).remove()">',a+='<i class="fas fa-times"></i>',a+="</a>",a+="</div>",a+='<div class="modal-content">',a+='<div class="is-content">',a+=t.replace(/\n/g,"<br>"),a+="</div>",""!==n&&null!=n&&(a+='<div class="modal-buttons">',a+=n,a+="</div>"),a+="</div>",a+="</div>",a+='<div class="is-bgmodal bg-active" onclick="document.getElementById(`forum-modal`).remove()"></div>',document.getElementById("forum-modal").innerHTML=a},genPrompt:function(e,t,n,i){if(""!==e&&null!=e&&""!==t&&null!=t)return new Promise((a,o)=>{FNR.html.genModal(e,"<p>"+t+'</p><p><input id="modal-prompt" type="text" placeholder="'+n+'" value="'+i+'"></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;a(""!==e&&e),document.getElementById("forum-modal").remove()}),document.querySelector("#modal-button-cancel").onclick=(()=>{o(!1),document.getElementById("forum-modal").remove()}),document.querySelector(".modal-title a").onclick=(()=>{o(!1),document.getElementById("forum-modal").remove()}),document.querySelector(".is-bgmodal.bg-active").onclick=(()=>{o(!1),document.getElementById("forum-modal").remove()})})},genNotification:function(e,t,n,i){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 a=document.createElement("div");a.id="forum-notification",document.body.appendChild(a);let o="";o+=""===i||null==i?'<div id="'+FNR.utility.genSlug(e,"-")+'" class="notification-element" onclick="document.querySelector(`#forum-notification`).classList.remove(`notification-show`)" >':'<a href="'+i+'" target="_blank" id="'+FNR.utility.genSlug(e,"-")+'" class="notification-element" onclick="document.querySelector(`#forum-notification`).classList.remove(`notification-show`)" >',o+='<div class="notification-icon">',o+='<i class="'+n+'"></i>',o+="</div>",o+='<div class="notification-content">',o+="<h3>"+e+"</h3>",o+="<p>"+t+"</p>",o+="</div>",o+='<div class="notification-controls">',o+='<i class="fas fa-times"></i>',o+="</div>",o+=""===i||null==i?"</div>":"</a>",document.getElementById("forum-notification").innerHTML=o,setTimeout(()=>{document.getElementById("forum-notification").classList.add("notification-show")},500),setTimeout(()=>{document.getElementById("forum-notification").classList.remove("notification-show")},8e3),setTimeout(()=>{document.getElementById("forum-notification").remove()},1e4)}},behaviour:{genWiki:function(){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 i=e.parentElement.parentElement;n&&(i=i.parentElement.parentElement),i.classList.add("is-active"),i.classList.add("is-selected"),i.parentElement.parentElement.parentElement.classList.contains("wiki-index")||t(i,!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:function(){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"))})})}}};
|
package/package.json
CHANGED
package/frameworks/FMHelper.js
DELETED
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
/*! FM HELPER v0.1.8 | Flerex | flerex.dev */
|
|
2
|
-
(function(a, b, c) {
|
|
3
|
-
'use strict';
|
|
4
|
-
console.log('%cFM Helper by %cFlerex%c.blog', 'font-family: "Open Sans", Arial, sans-serif; font-size: 1.2em;', 'font-size: 1.5em; text-transform: uppercase; letter-spacing: -1px; font-weight: 800; color: #0d5ad5;', 'color: #e42e88; text-transform: none; font-size: 1.2em; font-style: italic;'), console.log('https://flerex.dev');
|
|
5
|
-
const d = 'FMHELPER_';
|
|
6
|
-
a.FLX = a.FLX || {}, a.FLX.helper = function() {
|
|
7
|
-
function h(Q) {
|
|
8
|
-
switch (Q.body.id) {
|
|
9
|
-
case 'phpbb':
|
|
10
|
-
return 'phpBB3';
|
|
11
|
-
case 'modernbb':
|
|
12
|
-
return 'ModernBB';
|
|
13
|
-
}
|
|
14
|
-
return Q.getElementById('ipbwrapper') ? 'Invision' : Q.querySelector('.pun') ? 'PunBB' : Q.body.hasAttribute('bgcolor') ? 'phpBB2' : c
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function m(Q) {
|
|
18
|
-
const R = '\xE0\xE1\xE4\xE2\xE8\xE9\xEB\xEA\xEC\xED\xEF\xEE\xF2\xF3\xF6\xF4\xF9\xFA\xFC\xFB\xF1\xE7\xB7/_,:;';
|
|
19
|
-
Q = Q.trim().toLowerCase();
|
|
20
|
-
for (var T = 0, U = R.length; T < U; T++) Q = Q.replace(new RegExp(R.charAt(T), 'g'), 'aaaaeeeeiiiioooouuuunc------'.charAt(T));
|
|
21
|
-
return Q.replace(/[^a-z0-9 -]/g, '').replace(/\s+/g, '-').replace(/-+/g, '-')
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
function n() {
|
|
25
|
-
return -1 != O.id
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function o() {
|
|
29
|
-
switch (_userdata.user_level) {
|
|
30
|
-
case 2:
|
|
31
|
-
return 'mod';
|
|
32
|
-
case 1:
|
|
33
|
-
return 'admin';
|
|
34
|
-
case 0:
|
|
35
|
-
return -1 == _userdata.user_id ? 'guest' : 'user';
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function p() {
|
|
40
|
-
return _userdata.avatar.split('"')[1]
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
function r(Q, R) {
|
|
44
|
-
return Q = Q.getTime(), R = R.getTime(), Math.floor(Math.abs(Q - R) / 8.64e7)
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function s(Q, R) {
|
|
48
|
-
if (!localStorage) return !1;
|
|
49
|
-
const S = d + Q,
|
|
50
|
-
T = localStorage.getItem(S);
|
|
51
|
-
if (!T) return null;
|
|
52
|
-
const U = JSON.parse(T),
|
|
53
|
-
V = new Date(U.cached_at);
|
|
54
|
-
return r(V, new Date) >= R ? (localStorage.removeItem(S), null) : U.content
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function t(Q, R) {
|
|
58
|
-
if (!localStorage) return !1;
|
|
59
|
-
const S = {
|
|
60
|
-
cached_at: new Date().getTime(),
|
|
61
|
-
content: R
|
|
62
|
-
};
|
|
63
|
-
localStorage.setItem(d + Q, JSON.stringify(S))
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function u(Q, R) {
|
|
67
|
-
let S, T = null,
|
|
68
|
-
U = R.querySelector('.tooltip-title'),
|
|
69
|
-
V = R.querySelector('.tooltip-subtitle');
|
|
70
|
-
if (!U) return null;
|
|
71
|
-
let W = U.querySelector('span[style]');
|
|
72
|
-
return W && (W = W.style.color), U.firstElementChild && (S = U.firstElementChild.style.color), V && (T = V.innerHTML.match(/:\s(.*)/)[1]), new User(Q, U.textContent, c, R.getElementsByTagName('img')[0].src, T, +R.querySelector('.tooltip-counts').firstChild.firstElementChild.textContent, W)
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
function v(Q) {
|
|
76
|
-
return Array.from(Q).map(R => new Group(R.href.match(/\/g(\d+)-/)[1], R.textContent, R.style.color))
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
function w(Q) {
|
|
80
|
-
return Q + '?change_version=' + 'invision'
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
function x(Q) {
|
|
84
|
-
return /^\w+\s*:\s+(?:\[\s.+\s\]\s*)+/.test(Q.textContent)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
function y(Q) {
|
|
88
|
-
const R = Array.from(Q.body.getElementsByTagName('*')).find(x);
|
|
89
|
-
return R ? R.querySelectorAll('a[href^="/g"]') : null
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
function z(Q) {
|
|
93
|
-
const R = Array.from(Q.querySelectorAll('#fo_stat div')).find(x);
|
|
94
|
-
return R ? R.querySelectorAll('a[href^="/g"]') : null
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
function A(...Q) {
|
|
98
|
-
const [R, S] = K(Q), T = 'groups', U = s(T, S);
|
|
99
|
-
if (null !== U) return U.forEach(W => Object.setPrototypeOf(W, Group.prototype)), Promise.resolve(U);
|
|
100
|
-
const V = D(w('/forum')).then(W => {
|
|
101
|
-
let X = z(W) || y(W);
|
|
102
|
-
if (!X) throw new Error('Could not get the forums legend. Please check if {LEGEND} is set on your index_body template.');
|
|
103
|
-
if (!X.length) return c;
|
|
104
|
-
const Y = v(X);
|
|
105
|
-
return t(T, Y), Y
|
|
106
|
-
});
|
|
107
|
-
return R && V.then(W => {
|
|
108
|
-
R.call(this, W)
|
|
109
|
-
}), V
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function B(Q, ...R) {
|
|
113
|
-
if (Q === c) throw new Error('User ID missing');
|
|
114
|
-
const [S, T] = K(R), U = 'u' + Q, V = s(U, T);
|
|
115
|
-
if (null !== V) return Object.setPrototypeOf(V, User.prototype), Promise.resolve(V);
|
|
116
|
-
const W = D('/ajax/index.php', {
|
|
117
|
-
data: {
|
|
118
|
-
f: 'm',
|
|
119
|
-
user_id: Q
|
|
120
|
-
}
|
|
121
|
-
}).then(X => {
|
|
122
|
-
let Y = u(Q, X);
|
|
123
|
-
return t(U, Y), Y
|
|
124
|
-
});
|
|
125
|
-
return S && W.then(X => {
|
|
126
|
-
S.call(this, X)
|
|
127
|
-
}), W
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
function C(Q) {
|
|
131
|
-
return '?' + Object.keys(Q).map(R => encodeURIComponent(R) + '=' + encodeURIComponent(Q[R])).join('&')
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function D(Q, R = {}) {
|
|
135
|
-
return R.hasOwnProperty('data') && (Q += C(R.data)), fetch(Q, Object.assign({
|
|
136
|
-
method: 'GET',
|
|
137
|
-
credentials: 'include'
|
|
138
|
-
}, R)).then(S => S.text()).then(S => {
|
|
139
|
-
return new DOMParser().parseFromString(S, 'text/html')
|
|
140
|
-
})
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
function E(Q) {
|
|
144
|
-
'loading' == b.readyState ? b.addEventListener('DOMContentLoaded', Q) : Q()
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
function G(Q) {
|
|
148
|
-
const R = Q.querySelector('div.pagination');
|
|
149
|
-
return !!R && Array.from(R.children).filter(S => {
|
|
150
|
-
return 'A' == S.tagName && +S.textContent
|
|
151
|
-
})
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
function H(Q) {
|
|
155
|
-
const R = Q.querySelector('div.pagination');
|
|
156
|
-
return !!R && parseInt(R.firstElementChild.textContent.match(/start = \(start > \d+\) \? \d+ : start;\n {4}start = \(start - \d+\) \* (\d+);/)[1])
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
function I(Q, R) {
|
|
160
|
-
const S = Q.querySelector('table.ipbtable tbody tr:nth-child(2)').childNodes[1].firstElementChild.firstElementChild;
|
|
161
|
-
return !!S && S.style.color == R
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
function J(Q, R) {
|
|
165
|
-
let S = 0;
|
|
166
|
-
return I(Q, R.color) && S++, 1 != Q.querySelector('table.ipbtable tbody tr:last-child').childElementCount && (S += Q.querySelectorAll('table.ipbtable tbody tr').length - 3), S
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
function K(Q) {
|
|
170
|
-
let R = [!1, 30];
|
|
171
|
-
return 2 == Q.length ? R = Q : 'integer' == typeof Q[0] ? R[1] = Q[0] : R[0] = Q[0], R
|
|
172
|
-
}
|
|
173
|
-
class User {
|
|
174
|
-
constructor(Q, R, S, T, U, V, W) {
|
|
175
|
-
this.id = Q, this.username = R, this.level = S, this.avatar = T, this.rank = U, this.posts = V, this.color = W
|
|
176
|
-
}
|
|
177
|
-
getRankAsText() {
|
|
178
|
-
if (!this.rank) return '';
|
|
179
|
-
let Q = new DOMParser().parseFromString(this.rank, 'text/html');
|
|
180
|
-
return Q.body.textContent.trim()
|
|
181
|
-
}
|
|
182
|
-
getURL() {
|
|
183
|
-
return `/u${this.id}`
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
class Group {
|
|
187
|
-
constructor(Q, R, S) {
|
|
188
|
-
this.id = Q, this.name = R, this.color = S
|
|
189
|
-
}
|
|
190
|
-
getURL() {
|
|
191
|
-
return `/g${this.id}-${m(this.name)}`
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
const O = new User(_userdata.user_id, _userdata.username, o(), p(), _lang.hasOwnProperty('rank_title') ? _lang.rank_title : c, _userdata.user_posts, c),
|
|
195
|
-
P = {
|
|
196
|
-
isLoggedIn: n,
|
|
197
|
-
userLevel: o,
|
|
198
|
-
getGroups: A,
|
|
199
|
-
getUser: B,
|
|
200
|
-
slugify: m,
|
|
201
|
-
attachScriptToChat: function(Q) {
|
|
202
|
-
function R(T, U) {
|
|
203
|
-
'complete' == T.contentDocument.readyState ? U() : T.addEventListener('load', U)
|
|
204
|
-
}
|
|
205
|
-
let S = b.createElement('script');
|
|
206
|
-
S.type = 'text/javascript', S.textContent = `;(${Q.toString()})();`, E(function() {
|
|
207
|
-
const T = b.querySelectorAll('object[data^="/chatbox/index.forum"], iframe[src^="/chatbox/index.forum"]');
|
|
208
|
-
Array.from(T).foreach(U => {
|
|
209
|
-
R(U, function() {
|
|
210
|
-
U.contentDocument.getElementsByTagName('head')[0].appendChild(S.cloneNode(!0))
|
|
211
|
-
})
|
|
212
|
-
})
|
|
213
|
-
})
|
|
214
|
-
},
|
|
215
|
-
getVersion: function() {
|
|
216
|
-
return h(b)
|
|
217
|
-
},
|
|
218
|
-
enableDebugMode: function() {
|
|
219
|
-
console.warn('%cATTENTION: Debug mode is enabled', 'color: red; font-weight: bold; font-size: 1.1em;'), console.warn('CSS files are not being cached by browsers');
|
|
220
|
-
const Q = '?debug=' + +new Date;
|
|
221
|
-
b.querySelectorAll('link[rel="stylesheet"]').forEach(R => {
|
|
222
|
-
R.setAttribute('href', R.getAttribute('href') + Q)
|
|
223
|
-
})
|
|
224
|
-
},
|
|
225
|
-
setCache: t,
|
|
226
|
-
getCache: s,
|
|
227
|
-
get: D
|
|
228
|
-
};
|
|
229
|
-
return n() && Object.assign(P, {
|
|
230
|
-
currentUser: function(Q) {
|
|
231
|
-
switch (Q) {
|
|
232
|
-
case 'id':
|
|
233
|
-
return O.id;
|
|
234
|
-
case 'username':
|
|
235
|
-
case 'name':
|
|
236
|
-
return O.username;
|
|
237
|
-
case 'avatar':
|
|
238
|
-
return p();
|
|
239
|
-
case 'level':
|
|
240
|
-
return O.level;
|
|
241
|
-
case 'rank':
|
|
242
|
-
return O.rank;
|
|
243
|
-
case 'posts':
|
|
244
|
-
return O.posts;
|
|
245
|
-
}
|
|
246
|
-
throw new Error('Argument is not supported')
|
|
247
|
-
},
|
|
248
|
-
u: O,
|
|
249
|
-
user: O
|
|
250
|
-
}), User.prototype.getGroup = function() {
|
|
251
|
-
return new Promise(Q => {
|
|
252
|
-
A().then(R => {
|
|
253
|
-
this.color === c ? B(this.id).then(S => {
|
|
254
|
-
Q(R.find(T => T.color == S.color))
|
|
255
|
-
}) : Q(R.find(S => S.color == this.color))
|
|
256
|
-
})
|
|
257
|
-
})
|
|
258
|
-
}, Group.prototype.getMemberAmount = function(...Q) {
|
|
259
|
-
const [R, S] = K(Q), T = 'gc' + this.id, U = s(T, S);
|
|
260
|
-
if (null !== U) return Promise.resolve(U);
|
|
261
|
-
const V = D(w(`/g${this.id}-`)).then(W => {
|
|
262
|
-
const X = G(W);
|
|
263
|
-
if (!X.length) {
|
|
264
|
-
const Y = J(W, this);
|
|
265
|
-
return t(T, Y), Y
|
|
266
|
-
}
|
|
267
|
-
return D(X.pop().href)
|
|
268
|
-
}).then(W => {
|
|
269
|
-
if ('number' == typeof W) return W;
|
|
270
|
-
const X = G(W),
|
|
271
|
-
Y = X.length * H(W) + J(W, this);
|
|
272
|
-
return t(T, Y), Y
|
|
273
|
-
});
|
|
274
|
-
return R && V.then(W => {
|
|
275
|
-
R.call(this, W)
|
|
276
|
-
}), V
|
|
277
|
-
}, P
|
|
278
|
-
}(), 'undefined' == typeof a._ && (a._ = FLX.helper), 'undefined' == typeof a.H && (a.H = FLX.helper)
|
|
279
|
-
})(this, document);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(e,t,r){"use strict";console.log("%cFM Helper by %cFlerex%c.blog",'font-family: "Open Sans", Arial, sans-serif; font-size: 1.2em;',"font-size: 1.5em; text-transform: uppercase; letter-spacing: -1px; font-weight: 800; color: #0d5ad5;","color: #e42e88; text-transform: none; font-size: 1.2em; font-style: italic;"),console.log("https://flerex.dev");const n="FMHELPER_";e.FLX=e.FLX||{},e.FLX.helper=function(){function e(e){switch(e.body.id){case"phpbb":return"phpBB3";case"modernbb":return"ModernBB"}return e.getElementById("ipbwrapper")?"Invision":e.querySelector(".pun")?"PunBB":e.body.hasAttribute("bgcolor")?"phpBB2":r}function o(e){const t="àáäâèéëêìíïîòóöôùúüûñç·/_,:;";e=e.trim().toLowerCase();for(var r=0,n=t.length;r<n;r++)e=e.replace(new RegExp(t.charAt(r),"g"),"aaaaeeeeiiiioooouuuunc------".charAt(r));return e.replace(/[^a-z0-9 -]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")}function s(){return-1!=q.id}function i(){switch(_userdata.user_level){case 2:return"mod";case 1:return"admin";case 0:return-1==_userdata.user_id?"guest":"user"}}function l(){return _userdata.avatar.split('"')[1]}function a(e,t){return e=e.getTime(),t=t.getTime(),Math.floor(Math.abs(e-t)/864e5)}function c(e,t){if(!localStorage)return!1;const r=n+e,o=localStorage.getItem(r);if(!o)return null;const s=JSON.parse(o),i=new Date(s.cached_at);return a(i,new Date)>=t?(localStorage.removeItem(r),null):s.content}function u(e,t){if(!localStorage)return!1;const r={cached_at:(new Date).getTime(),content:t};localStorage.setItem(n+e,JSON.stringify(r))}function h(e,t){let n,o=null,s=t.querySelector(".tooltip-title"),i=t.querySelector(".tooltip-subtitle");if(!s)return null;let l=s.querySelector("span[style]");return l&&(l=l.style.color),s.firstElementChild&&(n=s.firstElementChild.style.color),i&&(o=i.innerHTML.match(/:\s(.*)/)[1]),new L(e,s.textContent,r,t.getElementsByTagName("img")[0].src,o,+t.querySelector(".tooltip-counts").firstChild.firstElementChild.textContent,l)}function f(e){return Array.from(e).map(e=>new O(e.href.match(/\/g(\d+)-/)[1],e.textContent,e.style.color))}function d(e){return e+"?change_version=invision"}function m(e){return/^\w+\s*:\s+(?:\[\s.+\s\]\s*)+/.test(e.textContent)}function g(e){const t=Array.from(e.body.getElementsByTagName("*")).find(m);return t?t.querySelectorAll('a[href^="/g"]'):null}function p(e){const t=Array.from(e.querySelectorAll("#fo_stat div")).find(m);return t?t.querySelectorAll('a[href^="/g"]'):null}function y(...e){const[t,n]=A(e),o="groups",s=c(o,n);if(null!==s)return s.forEach(e=>Object.setPrototypeOf(e,O.prototype)),Promise.resolve(s);const i=w(d("/forum")).then(e=>{let t=p(e)||g(e);if(!t)throw new Error("Could not get the forums legend. Please check if {LEGEND} is set on your index_body template.");if(!t.length)return r;const n=f(t);return u(o,n),n});return t&&i.then(e=>{t.call(this,e)}),i}function b(e,...t){if(e===r)throw new Error("User ID missing");const[n,o]=A(t),s="u"+e,i=c(s,o);if(null!==i)return Object.setPrototypeOf(i,L.prototype),Promise.resolve(i);const l=w("/ajax/index.php",{data:{f:"m",user_id:e}}).then(t=>{let r=h(e,t);return u(s,r),r});return n&&l.then(e=>{n.call(this,e)}),l}function S(e){return"?"+Object.keys(e).map(t=>encodeURIComponent(t)+"="+encodeURIComponent(e[t])).join("&")}function w(e,t={}){return t.hasOwnProperty("data")&&(e+=S(t.data)),fetch(e,Object.assign({method:"GET",credentials:"include"},t)).then(e=>e.text()).then(e=>(new DOMParser).parseFromString(e,"text/html"))}function x(e){"loading"==t.readyState?t.addEventListener("DOMContentLoaded",e):e()}function C(e){const t=e.querySelector("div.pagination");return!!t&&Array.from(t.children).filter(e=>"A"==e.tagName&&+e.textContent)}function E(e){const t=e.querySelector("div.pagination");return!!t&&parseInt(t.firstElementChild.textContent.match(/start = \(start > \d+\) \? \d+ : start;\n {4}start = \(start - \d+\) \* (\d+);/)[1])}function v(e,t){const r=e.querySelector("table.ipbtable tbody tr:nth-child(2)").childNodes[1].firstElementChild.firstElementChild;return!!r&&r.style.color==t}function _(e,t){let r=0;return v(e,t.color)&&r++,1!=e.querySelector("table.ipbtable tbody tr:last-child").childElementCount&&(r+=e.querySelectorAll("table.ipbtable tbody tr").length-3),r}function A(e){let t=[!1,30];return 2==e.length?t=e:"integer"==typeof e[0]?t[1]=e[0]:t[0]=e[0],t}class L{constructor(e,t,r,n,o,s,i){this.id=e,this.username=t,this.level=r,this.avatar=n,this.rank=o,this.posts=s,this.color=i}getRankAsText(){if(!this.rank)return"";let e=(new DOMParser).parseFromString(this.rank,"text/html");return e.body.textContent.trim()}getURL(){return`/u${this.id}`}}class O{constructor(e,t,r){this.id=e,this.name=t,this.color=r}getURL(){return`/g${this.id}-${o(this.name)}`}}const q=new L(_userdata.user_id,_userdata.username,i(),l(),_lang.hasOwnProperty("rank_title")?_lang.rank_title:r,_userdata.user_posts,r),D={isLoggedIn:s,userLevel:i,getGroups:y,getUser:b,slugify:o,attachScriptToChat:function(e){function r(e,t){"complete"==e.contentDocument.readyState?t():e.addEventListener("load",t)}let n=t.createElement("script");n.type="text/javascript",n.textContent=`;(${e.toString()})();`,x(function(){const e=t.querySelectorAll('object[data^="/chatbox/index.forum"], iframe[src^="/chatbox/index.forum"]');Array.from(e).foreach(e=>{r(e,function(){e.contentDocument.getElementsByTagName("head")[0].appendChild(n.cloneNode(!0))})})})},getVersion:function(){return e(t)},enableDebugMode:function(){console.warn("%cATTENTION: Debug mode is enabled","color: red; font-weight: bold; font-size: 1.1em;"),console.warn("CSS files are not being cached by browsers");const e="?debug="+ +new Date;t.querySelectorAll('link[rel="stylesheet"]').forEach(t=>{t.setAttribute("href",t.getAttribute("href")+e)})},setCache:u,getCache:c,get:w};return s()&&Object.assign(D,{currentUser:function(e){switch(e){case"id":return q.id;case"username":case"name":return q.username;case"avatar":return l();case"level":return q.level;case"rank":return q.rank;case"posts":return q.posts}throw new Error("Argument is not supported")},u:q,user:q}),L.prototype.getGroup=function(){return new Promise(e=>{y().then(t=>{this.color===r?b(this.id).then(r=>{e(t.find(e=>e.color==r.color))}):e(t.find(e=>e.color==this.color))})})},O.prototype.getMemberAmount=function(...e){const[t,r]=A(e),n="gc"+this.id,o=c(n,r);if(null!==o)return Promise.resolve(o);const s=w(d(`/g${this.id}-`)).then(e=>{const t=C(e);if(!t.length){const t=_(e,this);return u(n,t),t}return w(t.pop().href)}).then(e=>{if("number"==typeof e)return e;const t=C(e),r=t.length*E(e)+_(e,this);return u(n,r),r});return t&&s.then(e=>{t.call(this,e)}),s},D}(),void 0===e._&&(e._=FLX.helper),void 0===e.H&&(e.H=FLX.helper)})(this,document);
|