No edit summary
No edit summary
 
(13 intermediate revisions by the same user not shown)
Line 26: Line 26:
   });
   });
   element.addEventListener('click', (e) => {
   element.addEventListener('click', (e) => {
     // this will only get triggered on desktop
     // this will only get triggered on desktopg
     // because we call preventDefault for the "touchend" event
     // because we call preventDefault for the "touchend" event
     handler(e);
     handler(e);
Line 118: Line 118:
     var d = Math.floor(h / 24);
     var d = Math.floor(h / 24);
     return d + "d ago";
     return d + "d ago";
  }
  function jakeInjectStyles() {
    if (document.getElementById("jake-rc-style")) return;
    var style = document.createElement("style");
    style.id = "jake-rc-style";
    style.textContent =
      "#p-jake-recentchanges .vector-menu-heading{display:flex;align-items:center;justify-content:space-between;}" +
      "#p-jake-recentchanges .jake-rc-dot{width:8px;height:8px;border-radius:50%;background:#2da44e;box-shadow:0 0 0 2px rgba(45,164,78,.18);flex:0 0 auto;}" +
      "#p-jake-recentchanges .vector-menu-heading{font-size:.95em;}" +
      "#p-jake-recentchanges .vector-menu-content{font-size:.92em;}" +
      "#p-jake-recentchanges .jake-rc-meta{font-size:.85em;opacity:.85;}";
    document.head.appendChild(style);
   }
   }


Line 127: Line 141:
     if (!menu) return null;
     if (!menu) return null;
     if (document.getElementById("p-jake-recentchanges")) return null;
     if (document.getElementById("p-jake-recentchanges")) return null;
    jakeInjectStyles();


     var portlet = document.createElement("div");
     var portlet = document.createElement("div");
Line 134: Line 150:
     var heading = document.createElement("div");
     var heading = document.createElement("div");
     heading.className = "vector-menu-heading";
     heading.className = "vector-menu-heading";
     heading.textContent = "Recent changes";
 
     var headingText = document.createElement("span");
    headingText.textContent = "Recent changes";
 
    var dot = document.createElement("span");
    dot.className = "jake-rc-dot";
    dot.setAttribute("aria-hidden", "true");
    dot.title = "Live";
 
    heading.appendChild(headingText);
    heading.appendChild(dot);


     var content = document.createElement("div");
     var content = document.createElement("div");
Line 180: Line 206:
         action: "query",
         action: "query",
         list: "recentchanges",
         list: "recentchanges",
         rcnamespace: 0,
         rcnamespace: "0", /* 4 */
         rclimit: 5,
         rclimit: 5,
         rcprop: "title|timestamp|user",
         rcprop: "title|timestamp|user",
Line 263: Line 289:
})();
})();
/* */
/* */
/*
(function () {
(function () {
   function jakeAddFeedbackToNamespaces() {
   function jakeAddFeedbackToNamespaces() {
Line 306: Line 333:
   } else {
   } else {
     jakeInit();
     jakeInit();
  }
})();
*/
/* */
(function () {
  function jakeAddFooterSocialRow() {
    var footer = document.getElementById("footer");
    if (!footer) return;
    var places = document.getElementById("footer-places");
    if (!places) return;
    if (document.getElementById("footer-social")) return;
    var ul = document.createElement("ul");
    ul.id = "footer-social";
    ul.className = "noprint crw-footer-social";
    function add(href, label) {
      var li = document.createElement("li");
      var a = document.createElement("a");
      a.href = href;
      a.textContent = label;
      a.setAttribute("aria-label", label);
      a.title = label;
      li.appendChild(a);
      ul.appendChild(li);
    }
    // add("https://discord.gg/8w5rSNAXRf", "Discord");
    add("https://www.linkedin.com/company/consumer-rights-wiki/", "LinkedIn");
    add("https://www.reddit.com/user/ConsumerRightsWiki/", "Reddit");
    places.parentNode.insertBefore(ul, places.nextSibling);
  }
  if (document.readyState === "loading") {
    document.addEventListener("DOMContentLoaded", jakeAddFooterSocialRow);
  } else {
    jakeAddFooterSocialRow();
   }
   }
})();
})();