Gatech Canvas Team Announcement Script for TA

Perform multiple actions

17.01.2024 itibariyledir. En son verisyonu görün.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

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.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         Gatech Canvas Team Announcement Script for TA
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Perform multiple actions
// @author       thuanvo09
// @match        https://gatech.instructure.com/groups/*/discussion_topics/new?is_announcement=true
// @grant        window.close
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // For open multiple tabs using Chrome console

    /*



    const start_team_id = 356322
    const end_team_id = 356348

    // teams left
    const ignore = [356340, 356342]

function urlGen(team_id) {
        return `https://gatech.instructure.com/groups/${team_id}/discussion_topics/new?is_announcement=true`
    }

    for (let i = start_team_id; i <= end_team_id; i+=2) {
        if (ignore.includes(i)) {
            continue
        }
        const url = urlGen(i)
        window.open(url, '_blank')
    }




    */

    const post_title = "This is a title";

    // convert markdown to html, use html in the content

    const post_content =
`
<h2>Hello</h2>
<p><em>This&nbsp;</em></p>
<h3><strong>is&nbsp;</strong></h3>
<p>an</p>
<pre>annoucement</pre>
`;

    function openAndModify() {
        window.onload = function () {
            setTimeout(() => {

                // title
                const title_inp = document.getElementById("discussion-title");
                title_inp.value = post_title;

                document.getElementsByClassName("css-lgvgsl-view--inlineBlock-baseButton")[3].click()

                // content
                const content_inp = document.getElementById("discussion-topic-message11")
                content_inp.value = post_content


                document.getElementsByClassName("css-lgvgsl-view--inlineBlock-baseButton")[0].click()

                // BE CAREFUL WITH THIS ACTION, NEED TO TEST
                // SUBMIT
                // document.getElementsByClassName("submit_button")[0].click()

                //                 console.log('closing')
                //                 window.close()


            }, 2000);
        };
    }

    openAndModify();



})();