Diferencia entre revisiones de «Usuario:Toolroot-sh/vector.js»

sin resumen de edición
m
 
"use strict";function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _defineProperties(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function _createClass(e,t,n){return t&&_defineProperties(e.prototype,t),n&&_defineProperties(e,n),e}var list_nav=document.querySelector(".vector-menu-content-list"),stylesIcons="height:18px;width:18px;margin-right:10px;",username=document.querySelector("#pt-userpage a"),talk=list_nav.querySelector("#pt-mytalk a"),sandbox=list_nav.querySelector("#pt-sandbox a"),preferences=list_nav.querySelector("#pt-preferences a"),beta=list_nav.querySelector("#pt-betafeatures a"),watchlist=list_nav.querySelector("#pt-watchlist a"),logout=list_nav.querySelector("#pt-logout a"),items=[{name:username.innerHTML,link:username.href,icon:'<svg xmlns="http://www.w3.org/2000/svg" style="'+stylesIcons+'" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-user"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"></path><circle cx="12" cy="7" r="4"></circle></svg>'},{name:talk.innerHTML,link:talk.href,icon:'<svg xmlns="http://www.w3.org/2000/svg" style="'+stylesIcons+'" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-message-square"><path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path></svg>'},{name:sandbox.innerHTML,link:sandbox.href,icon:'<svg xmlns="http://www.w3.org/2000/svg" style="'+stylesIcons+'" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-archive"><polyline points="21 8 21 21 3 21 3 8"></polyline><rect x="1" y="3" width="22" height="5"></rect><line x1="10" y1="12" x2="14" y2="12"></line></svg>'},{name:preferences.innerHTML,link:preferences.href,icon:'<svg xmlns="http://www.w3.org/2000/svg" style="'+stylesIcons+'" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-settings"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>'},{name:beta.innerHTML,link:beta.href,icon:'<svg xmlns="http://www.w3.org/2000/svg" style="'+stylesIcons+'" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-tag"><path d="M20.59 13.41l-7.17 7.17a2 2 0 0 1-2.83 0L2 12V2h10l8.59 8.59a2 2 0 0 1 0 2.82z"></path><line x1="7" y1="7" x2="7.01" y2="7"></line></svg>'},{name:watchlist.innerHTML,link:watchlist.href,icon:'<svg xmlns="http://www.w3.org/2000/svg" style="'+stylesIcons+'" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-activity"><polyline points="22 12 18 12 15 21 9 3 6 12 2 12"></polyline></svg>'},{name:logout.innerHTML,link:logout.href,icon:'<svg xmlns="http://www.w3.org/2000/svg" style="'+stylesIcons+'" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-log-out"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path><polyline points="16 17 21 12 16 7"></polyline><line x1="21" y1="12" x2="9" y2="12"></line></svg>'}],Dropdown=function(){function e(t){_classCallCheck(this,e),this.dropdown=document.querySelector(t),this.generateEvents()}return _createClass(e,[{key:"generateEvents",value:function(){this.generateDropdown(),this.mouseEffects(this.dropdown)}},{key:"generateDropdown",value:function(){var e=this,t=document.createElement("div");t.classList.add("dropdown-username");t.style.cssText="\n background: #fff;\n position: absolute;\n top: 100%;\n min-width: 220px230px;\n right: 0;\n margin-top: .5em;\n display: flex;\n\t\t\tborder-radius: 12px;\n padding: 10px 0;\n flex-direction: column;\n box-shadow: 0px 10px 50px rgba(0,0,0,0.1);\n\t\t\tvisibility: hidden;\n\t\t\topacity: 0;\n transform: scale(.95);\n\t\t\ttransition: visibility 300ms ease-in-out, opacity 300ms ease-in-out, transform 300ms ease-in-out\n\t\t",items.forEach(function(n){t.innerHTML+='<a href="'+n.link+'" style="\n\t\t\tpadding: 10px !important;\n\t\t\tpadding-left: 15px20px !important;\n\t\t\tfont-weight: 500 !important;\n\t\t\tfont-size: 1.1em;\n display: flex;\n align-items: center;\n\t\t">'+n.icon+e.capitalizeFirstLetter(n.name)+"</a>"}),this.dropdown.style.position="relative",this.dropdown.appendChild(t)}},{key:"mouseEffects",value:function(e){e.addEventListener("mousemove",function(){e.classList.add("active")}),e.addEventListener("mouseleave",function(){e.classList.remove("active")})}},{key:"capitalizeFirstLetter",value:function(e){return e.charAt(0).toUpperCase()+e.slice(1)}}]),e}(),Contribs=function(){function e(){_classCallCheck(this,e)}return _createClass(e,null,[{key:"generateIcon",value:function(e){this.item=document.querySelector(e);this.item.innerHTML='<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M11 3.05493C6.50005 3.55238 3 7.36745 3 12C3 16.9706 7.02944 21 12 21C16.6326 21 20.4476 17.5 20.9451 13H11V3.05493Z" stroke="#4A5568" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M20.4878 9H15V3.5123C17.5572 4.41613 19.5839 6.44285 20.4878 9Z" stroke="#4A5568" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>'}}]),e}(),GenerateAvatar=function(){function e(t,n,r){_classCallCheck(this,e),this.item=document.querySelector(t),this.background_color=n,this.color=r,this.generate()}return _createClass(e,[{key:"generate",value:function(){var e="\n display: flex;\n justify-content: center;\n align-items: center;\n border-radius: 50%;\n height: 35px;\n width: 35px;\n background-color: ".concat(this.background_color,";\n color: ").concat(this.color,";\n padding: 0 !important;\n margin-top: -3px\n "),t=this.getFirstLetter(this.item.innerHTML);this.item.style.cssText=e,this.item.innerHTML=t}},{key:"getFirstLetter",value:function(e){return e.charAt(0)}}]),e}();new Dropdown("#pt-userpage"),new GenerateAvatar("#pt-userpage a","#1f76ff","#fff"),Contribs.generateIcon("#pt-mycontris a");
1968

ediciones