Greasy Fork is available in English.

gitAddProject

git add project for pms

As of 04.08.2021. See апошняя версія.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         gitAddProject
// @namespace    http://tampermonkey.net/
// @version      0.1.0
// @description  git add project for pms
// @author       HolmesZhao
// @match        *://pms.zuoyebang.cc/ApplyForGit*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
    let username = "[email protected]"
    let projects = [
        { "power": "paperangtest", "reason": "迁移项目"}
    ]

    function addProject(power, reason) {
        let gitcode = "Paperang_iOS"
        let approved = "[email protected]"
        let deptfullname = "其他部门"
        var data = JSON.stringify({"username": username,"gitcode": gitcode,"power":"Add Project:" + power + " (private)", "gitapproved": approved, "url": "git.zuoyebang.cc", "reason": reason, "deptfullname": deptfullname});
    
        var xhr = new XMLHttpRequest();
        xhr.withCredentials = true;
    
        xhr.addEventListener("readystatechange", function() {
        if(this.readyState === 4) {
            console.log(this.responseText);
        }
        });
    
        xhr.open("POST", "https://pms.zuoyebang.cc/testplatapi/git/SetApproved");
        xhr.setRequestHeader("Cookie", document.cookie);
        xhr.setRequestHeader("Content-Type", "application/json");
    
        xhr.send(data);
    }

    function addButton(name, marginLeft, fun) {
        var txt = document.createTextNode(name);
        var btn = document.createElement('button');
        btn.className = 'mmbutton';
        btn.style = "z-index: 9999; font-size: large; position: fixed; top: 0pt; left: "+(screen.width / 4 + marginLeft)+"px;";
        btn.onclick = fun;
        btn.appendChild(txt);
        document.body.appendChild(btn);
        return btn.offsetWidth;
    };

    function inject() {
        projects.forEach(e => {
            addProject(e.power, e.reason)
        })
        alert('已发送所有请求');
    }

    window.onload = () => {
        addButton('注入脚本', 0, inject);
    }
})();