fediparty/js/main.min.js

1 line
2.2 KiB
JavaScript

"use strict";document.addEventListener("DOMContentLoaded",function(){var t=document.getElementById("f-menu"),n=document.getElementById("overlay");document.addEventListener("keyup",function(e){e=e.key||e.keyCode;"Escape"!==e&&"Esc"!==e&&27!==e||t.checked&&(t.checked=!1,n.checked=!0)}),document.getElementById("menuClose").addEventListener("click",function(e){e.preventDefault(),t.checked=!1,n.checked=!0});for(var e,c=document.getElementsByClassName("hidden"),o=[],r=0;e=c[r];++r)o.push(e);document.addEventListener("click",function(e){var t=!1,n=null;{var c;o.forEach(function(e){e.checked&&(t=!0,n=e)}),e.target.classList.contains("hidden")||!0!==t||(c=n.nextElementSibling,c="#".concat(c.id),null===function(e,t){var n=e.matches||e.webkitMatchesSelector||e.mozMatchesSelector||e.msMatchesSelector;for(;e;){if(n.call(e,t))return e;e=e.parentElement}return null}(e.target,c)&&(n.checked=!1))}});for(var a=document.querySelector("h1"),l=document.querySelector("head").querySelector("title"),u=document.querySelector('meta[property="og:title"]'),l=null===l?"":l.textContent,u=null===u?"":u.content,a=null===a?"":a.textContent,d=l||u||a,i=encodeURIComponent(window.location.href),s=document.querySelectorAll(".share-btn"),m=[],h=0;h<s.length;h++)m.push(s[h]);for(var p=document.querySelectorAll(".popup input"),f=[],v=0;v<p.length;v++)f.push(p[v]);function g(e){var t=((n="podurl"!==e.target.name)?e.target:e.target.nextSibling).value,n=(n?e.target.previousSibling:e.target).value,e=encodeURI(d).replace(/%20/g,"+"),n=(n=n).match(/^https:\/\//i)?n:(n=n.split("/").filter(function(e){return-1<e.indexOf(".")}),"https://".concat(encodeURIComponent(n)));"diaspora"===t||"friendica"===t||"socialhome"===t?window.open("".concat(n,"/bookmarklet?url=").concat(i,"&title=").concat(e)):"gnusocial"===t?window.open("".concat(n,"/notice/new?status_textarea=").concat(e,"&").concat(i)):"mastodon"===t?window.open("".concat(n,"/share?text=").concat(e," ").concat(i)):"hubzilla"===t&&window.open("".concat(n,"/rpost?f=&url=").concat(i,"&title=").concat(e))}m.forEach(function(e){return e.addEventListener("click",g)}),f.forEach(function(e){return e.addEventListener("keyup",function(e){var t=e.key||e.keyCode;"Enter"!==t&&13!==t||g(e)})})});