linuxdo-next

一个呼吸顺畅的 linux.do 论坛

От 09.03.2024. Виж последната версия.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey, Greasemonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да инсталирате разширение, като например Tampermonkey .

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Violentmonkey.

За да инсталирате този скрипт, трябва да имате инсталирано разширение като Tampermonkey или Userscripts.

За да инсталирате скрипта, трябва да инсталирате разширение като Tampermonkey.

За да инсталирате този скрипт, трябва да имате инсталиран скриптов мениджър.

(Вече имам скриптов мениджър, искам да го инсталирам!)

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да инсталирате разширение като Stylus.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

За да инсталирате този стил, трябва да имате инсталиран мениджър на потребителски стилове.

(Вече имам инсталиран мениджър на стиловете, искам да го инсталирам!)

// ==UserScript==
// @name         linuxdo-next
// @namespace    linuxdo-next
// @version      0.1.0
// @author       delph1s
// @description  一个呼吸顺畅的 linux.do 论坛
// @license      GPLv2
// @iconURL      https://cdn.linux.do/uploads/default/original/1X/3a18b4b0da3e8cf96f7eea15241c3d251f28a39b.png
// @match        *://linux.do/
// @match        *://linux.do/*
// @require      https://cdn.jsdelivr.net/npm/[email protected]/umd/react.production.min.js
// @require      https://cdn.jsdelivr.net/npm/[email protected]/umd/react-dom.production.min.js
// @grant        GM_addStyle
// @run-at       document-end
// ==/UserScript==

(t=>{if(typeof GM_addStyle=="function"){GM_addStyle(t);return}const n=document.createElement("style");n.textContent=t,document.head.append(n)})(' :export{appName:"linuxdo-next";pluginContainer:linuxdo-next-container;functionButton:linuxdo-next-function-button}#linuxdo-next-container{width:100%;height:100%;position:absolute;top:0;left:0;z-index:-9999}.linuxdo-next-function-button{position:absolute;top:120px;right:40px;z-index:9999} ');

(function (require$$0, require$$0$1) {
  'use strict';

  var jsxRuntime = { exports: {} };
  var reactJsxRuntime_production_min = {};
  /**
   * @license React
   * react-jsx-runtime.production.min.js
   *
   * Copyright (c) Facebook, Inc. and its affiliates.
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE file in the root directory of this source tree.
   */
  var f = require$$0, k = Symbol.for("react.element"), l = Symbol.for("react.fragment"), m$1 = Object.prototype.hasOwnProperty, n = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, p = { key: true, ref: true, __self: true, __source: true };
  function q(c, a, g) {
    var b, d = {}, e = null, h = null;
    void 0 !== g && (e = "" + g);
    void 0 !== a.key && (e = "" + a.key);
    void 0 !== a.ref && (h = a.ref);
    for (b in a)
      m$1.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
    if (c && c.defaultProps)
      for (b in a = c.defaultProps, a)
        void 0 === d[b] && (d[b] = a[b]);
    return { $$typeof: k, type: c, key: e, ref: h, props: d, _owner: n.current };
  }
  reactJsxRuntime_production_min.Fragment = l;
  reactJsxRuntime_production_min.jsx = q;
  reactJsxRuntime_production_min.jsxs = q;
  {
    jsxRuntime.exports = reactJsxRuntime_production_min;
  }
  var jsxRuntimeExports = jsxRuntime.exports;
  var client = {};
  var m = require$$0$1;
  {
    client.createRoot = m.createRoot;
    client.hydrateRoot = m.hydrateRoot;
  }
  const appName = '"linuxdo-next"';
  const pluginContainer = "linuxdo-next-container";
  const functionButton = "linuxdo-next-function-button";
  const styles = {
    appName,
    pluginContainer,
    functionButton
  };
  function Modal(props) {
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "modal-container", children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        "div",
        {
          id: "ember628",
          className: "ember-view modal d-modal create-invite-modal",
          "data-keyboard": "false",
          "aria-modal": "true",
          role: "dialog",
          "aria-labelledby": "discourse-modal-title",
          children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "d-modal__container", children: [
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "d-modal__header", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "d-modal__title", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { id: "discourse-modal-title", className: "d-modal__title-text", children: "创建邀请" }) }),
              /* @__PURE__ */ jsxRuntimeExports.jsx(
                "button",
                {
                  className: "btn no-text btn-icon btn-transparent modal-close",
                  title: "关闭",
                  type: "button",
                  onClick: () => props.setModalVisible(false),
                  children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                    "svg",
                    {
                      className: "fa d-icon d-icon-times svg-icon svg-string",
                      xmlns: "http://www.w3.org/2000/svg",
                      children: /* @__PURE__ */ jsxRuntimeExports.jsx("use", { href: "#times" })
                    }
                  )
                }
              )
            ] }),
            /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "d-modal__body", tabIndex: -1, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("form", { children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "input-group input-email", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { htmlFor: "invite-email", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    "svg",
                    {
                      className: "fa d-icon d-icon-envelope svg-icon svg-string",
                      xmlns: "http://www.w3.org/2000/svg",
                      children: /* @__PURE__ */ jsxRuntimeExports.jsx("use", { href: "#envelope" })
                    }
                  ),
                  "限制为"
                ] }),
                /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "invite-email-container", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
                  "input",
                  {
                    id: "invite-email",
                    className: "ember-text-field ember-view",
                    placeholder: "[email protected] 或者 example.com",
                    type: "text"
                  }
                ) })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "input-group invite-max-redemptions", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { htmlFor: "invite-max-redemptions", children: [
                  /* @__PURE__ */ jsxRuntimeExports.jsx(
                    "svg",
                    {
                      className: "fa d-icon d-icon-users svg-icon svg-string",
                      xmlns: "http://www.w3.org/2000/svg",
                      children: /* @__PURE__ */ jsxRuntimeExports.jsx("use", { href: "#users" })
                    }
                  ),
                  "最大使用次数"
                ] }),
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  "input",
                  {
                    id: "invite-max-redemptions",
                    className: "ember-text-field ember-view",
                    min: "1",
                    max: "10",
                    type: "number"
                  }
                )
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "input-group input-expires-at", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("label", { children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  "svg",
                  {
                    className: "fa d-icon d-icon-far-clock svg-icon svg-string",
                    xmlns: "http://www.w3.org/2000/svg",
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx("use", { href: "#far-clock" })
                  }
                ),
                "于 3 天过期"
              ] }) })
            ] }) }),
            /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "d-modal__footer", children: [
              /* @__PURE__ */ jsxRuntimeExports.jsxs("button", { className: "btn btn-icon-text btn-primary save-invite", type: "button", children: [
                /* @__PURE__ */ jsxRuntimeExports.jsx(
                  "svg",
                  {
                    className: "fa d-icon d-icon-link svg-icon svg-string",
                    xmlns: "http://www.w3.org/2000/svg",
                    children: /* @__PURE__ */ jsxRuntimeExports.jsx("use", { href: "#link" })
                  }
                ),
                /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "d-button-label", children: "保存邀请" })
              ] }),
              /* @__PURE__ */ jsxRuntimeExports.jsxs(
                "button",
                {
                  className: "btn btn-icon-text btn-primary send-invite",
                  disabled: false,
                  title: "限制只允许电子邮件邀请并发送邀请电子邮件",
                  type: "button",
                  children: [
                    /* @__PURE__ */ jsxRuntimeExports.jsx(
                      "svg",
                      {
                        className: "fa d-icon d-icon-envelope svg-icon svg-string",
                        xmlns: "http://www.w3.org/2000/svg",
                        children: /* @__PURE__ */ jsxRuntimeExports.jsx("use", { href: "#envelope" })
                      }
                    ),
                    /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "d-button-label", children: "保存并发送电子邮件" })
                  ]
                }
              )
            ] })
          ] })
        }
      ),
      /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "d-modal__backdrop" })
    ] });
  }
  function App() {
    const [logModalVisible, setLogModalVisible] = require$$0.useState(false);
    require$$0.useEffect(() => {
      const containerSelector = "header.d-header div.contents div.panel ul";
      document.querySelector(containerSelector);
      document.createElement("li");
    }, []);
    return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: styles.functionButton, children: [
      /* @__PURE__ */ jsxRuntimeExports.jsx(
        "button",
        {
          className: "btn btn-default create reply-to-post no-text btn-icon",
          title: "开始进行自动点赞",
          type: "button",
          onClick: () => setLogModalVisible(true),
          children: /* @__PURE__ */ jsxRuntimeExports.jsx(
            "svg",
            {
              className: "fa d-icon d-icon-paper-plane svg-icon prefix-icon svg-string",
              xmlns: "http://www.w3.org/2000/svg",
              children: /* @__PURE__ */ jsxRuntimeExports.jsx("use", { href: "#paper-plane" })
            }
          )
        }
      ),
      logModalVisible && /* @__PURE__ */ jsxRuntimeExports.jsx(Modal, { setModalVisible: setLogModalVisible })
    ] });
  }
  const appendLinuxDoNext = () => {
    const app = document.createElement("div");
    app.setAttribute("id", styles.pluginContainer);
    document.body.append(app);
    return app;
  };
  client.createRoot(appendLinuxDoNext()).render(
    /* @__PURE__ */ jsxRuntimeExports.jsx(require$$0.StrictMode, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(App, {}) })
  );

})(React, ReactDOM);