Eba Ders Oluşturma

Eba ders oluşturma!

// ==UserScript==
// @name         Eba Ders Oluşturma
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Eba ders oluşturma!
// @author       İbrahim Beylem
// @match        https://ders.eba.gov.tr/ders/proxy/VCollabPlayer_v*/index.html
// @grant        none
// ==/UserScript==

(function() {
    function checkbutton(){
        var asd = document.querySelector("#ebaEtudEditView > div.vc-layout-view-content-padding > div > div > div.row.m-n.vc-resp-all-margin.vc-border-bottom-thin-light > div:nth-child(2) > div.vc-bg-color-white.p-xs > div.row.m-n.p-b-xs")
        if (asd){
            var sinif = document.querySelector("#ebaEtudEditView > div.vc-layout-view-content-padding > div > div > div.row.m-n.vc-resp-all-margin.vc-border-bottom-thin-light > div:nth-child(1) > div.row.m-n.vc-bg-color-white.p-b-sm > div:nth-child(2) > select")
            var button = document.querySelector("#btn1")
            if(sinif.selectedIndex!==3){
                sinif.selectedIndex=3
                sinif.dispatchEvent(new Event('change'));
            }
            if (!button){
                var btn=document.createElement("button");
                btn.setAttribute("id","btn1");
                btn.setAttribute("name","btn1");
                btn.innerText="Doldur!!!";
                btn.style.cssText="color: white;background: #159230;font-size: 16px;/* padding: 8px; */";
                asd.appendChild(btn);
                btn.addEventListener ("click", DersSec , false);
            }
        }
    }



    function DersSec(){
        /*var dersler = {
            "Türkçe": "14",
            "Matematik": "10",
            "Beden Eğitimi ve Oyun": "2",
            "Hayat Bilgisi": "7",
            "Fen Bilimleri": "4",
            "Serbest Etkinlik": "13",
            "Görsel Sanatlar": "6",
            "Müzik": "11"
        };
        var ders = ["Türkçe", "Matematik", "Beden Eğitimi ve Oyun", "Hayat Bilgisi", "Fen Bilimleri", "Serbest Etkinlik", "Görsel Sanatlar", "Müzik"]
        var secim = prompt("1 = türkçe\n 2: Matematik\n 3: Beden Eğitimi\n 4: Hayat Bilgisi\n 5: Fen Bilimleri\n 6: Serbest Etkinlik\n 7: Görsel Sanatlar\n 8: Müzik ");
        ders = ders[secim - 1]
    */
        var ders = document.querySelector("#ebaEtudEditView > div.vc-layout-view-content-padding > div > div > div.row.m-n.vc-resp-all-margin.vc-border-bottom-thin-light > div:nth-child(2) > div.vc-bg-color-white.p-xs > div.row.m-n.p-b-xs > div > div.col-lg-3.col-md-3.col-sm-3.p-no.p-r-xxs.p-b-xxs > div.ui-select-container.ui-select-bootstrap.dropdown.ng-valid.ng-not-empty.ng-touched > div.ui-select-match.ng-scope > span > span.ui-select-match-text.pull-left > span").innerText
        var zoomlink = "https://us05web.zoom.us/j/5117966161?pwd=aGdQWFpKc0gvcGZwaDVzUW5FR1dPQT09"
        var sifre = "asdasd"
        document.querySelector("#ebaEtudEditView > div.vc-layout-view-content-padding > div > div > div.row.m-n.vc-resp-all-margin.vc-border-bottom-thin-light > div:nth-child(1) > div.row.m-n.vc-bg-color-white.p-b-sm > div.col-sm-4.p-xs > input").value = ders
        document.querySelector("#ebaEtudEditView > div.vc-layout-view-content-padding > div > div > div.row.m-n.vc-resp-all-margin.vc-border-bottom-thin-light > div:nth-child(1) > div.row.m-n.vc-bg-color-white.p-b-sm > div.col-sm-4.p-xs > input").dispatchEvent(new Event('change'));
        document.querySelector("#ebaEtudEditView > div.vc-layout-view-content-padding > div > div > div.row.m-n.vc-resp-all-margin.vc-border-bottom-thin-light > div:nth-child(1) > div.row.m-n.vc-bg-color-white.p-b-sm > div:nth-child(6) > select").selectedIndex=1 // ZOOOMU SEÇ
        document.querySelector("#ebaEtudEditView > div.vc-layout-view-content-padding > div > div > div.row.m-n.vc-resp-all-margin.vc-border-bottom-thin-light > div:nth-child(1) > div.row.m-n.vc-bg-color-white.p-b-sm > div:nth-child(6) > select").dispatchEvent(new Event('change'));
        document.querySelector("#ebaEtudEditView > div.vc-layout-view-content-padding > div > div > div.row.m-n.vc-resp-all-margin.vc-border-bottom-thin-light > div:nth-child(1) > div.row.m-n.vc-bg-color-white.p-b-sm > div.col-sm-6.col-xs-12.p-xs > input").value = zoomlink
        document.querySelector("#ebaEtudEditView > div.vc-layout-view-content-padding > div > div > div.row.m-n.vc-resp-all-margin.vc-border-bottom-thin-light > div:nth-child(1) > div.row.m-n.vc-bg-color-white.p-b-sm > div.col-sm-6.col-xs-12.p-xs > input").dispatchEvent(new Event('change'));
        document.querySelector("#ebaEtudEditView > div.vc-layout-view-content-padding > div > div > div.row.m-n.vc-resp-all-margin.vc-border-bottom-thin-light > div:nth-child(1) > div.row.m-n.vc-bg-color-white.p-b-sm > div:nth-child(8) > input").value = sifre
        document.querySelector("#ebaEtudEditView > div.vc-layout-view-content-padding > div > div > div.row.m-n.vc-resp-all-margin.vc-border-bottom-thin-light > div:nth-child(1) > div.row.m-n.vc-bg-color-white.p-b-sm > div:nth-child(8) > input").dispatchEvent(new Event('change'));
        document.querySelector("#ebaEtudEditView > div.vc-layout-view-content-padding > div > div > div.row.m-n.vc-resp-all-margin.vc-border-bottom-thin-light > div:nth-child(2) > div.vc-bg-color-white.p-xs > div.row.m-n.p-b-xs > div > div.col-lg-3.col-md-3.col-sm-3.p-no.p-r-xxs.p-b-xxs > div.ui-select-container.ui-select-bootstrap.dropdown.ng-valid.ng-not-empty > div.ui-select-match.ng-scope > span > span.ui-select-match-text.pull-left > span").click() //ders seçme
        //$('div[id^=ui-select-choices-row-][id$=' + dersler[ders] + ']').click()
        document.querySelector("#ebaEtudEditView > div.vc-layout-view-content-padding > div > div > div.row.m-n.vc-resp-all-margin.vc-border-bottom-thin-light > div:nth-child(2) > div.vc-bg-color-white.p-xs > div.vc-display-flex.vc-justify-content-space-between.vc-width-full.vc-align-items-flex-end > div:nth-child(1) > div > div.m-t-xxs.m-b-xxs.vc-multi-select-max-height.ng-scope.ng-isolate-scope > span > button").click() // şube seçimi
        document.querySelector("#ebaEtudEditView > div.vc-layout-view-content-padding > div > div > div.row.m-n.vc-resp-all-margin.vc-border-bottom-thin-light > div:nth-child(2) > div.vc-bg-color-white.p-xs > div.vc-display-flex.vc-justify-content-space-between.vc-width-full.vc-align-items-flex-end > div:nth-child(1) > div > div.m-t-xxs.m-b-xxs.vc-multi-select-max-height.ng-scope.ng-isolate-scope > span > div > div > div > div > label > span").click() //şube seçildi
        document.querySelector("#ebaEtudEditView > div.vc-layout-view-content-padding > div > div > div.row.m-n.vc-resp-all-margin.vc-border-bottom-thin-light > div:nth-child(2) > div.vc-bg-color-white.p-xs > div.vc-display-flex.vc-justify-content-space-between.vc-width-full.vc-align-items-flex-end > div.pull-right > div").click() //öğrencileri seçme
        setTimeout(function () {
            document.querySelector("#ebaEtudEditView > div.vc-layout-view-content-padding > div > div > div.row.m-n.vc-resp-all-margin.vc-border-bottom-thin-light > div:nth-child(2) > div.vc-bg-color-white.p-xs > div.vc-display-flex.vc-justify-content-space-between.vc-width-full.vc-align-items-flex-end > div.pull-right > div").click();
        }, 1000); // BEKLE

        var dersigonder = document.querySelector("#ebaEtudEditView > div.vc-layout-view-content-padding > div > div > div.vc-resp-all-margin.p-xs.ng-scope > div.row.vc-display-flex.vc-flex-wrap-wrap.vc-justify-content-flex-end.vc-align-items-center > div.col-sm-3.col-xs-12.m-b-xs > div")
        var saniye = 10;
        var checkExist = setInterval(function() {
            dersigonder = document.querySelector("#ebaEtudEditView > div.vc-layout-view-content-padding > div > div > div.vc-resp-all-margin.p-xs.ng-scope > div.row.vc-display-flex.vc-flex-wrap-wrap.vc-justify-content-flex-end.vc-align-items-center > div.col-sm-3.col-xs-12.m-b-xs > div")
            if (dersigonder) {
                console.log("dersi gönder butonu bulundu!");
//                dersigonder.click()
                clearInterval(checkExist);
            }
            saniye --;
            if(saniye <= 0) {
                console.log(`${saniye}dersi gönder bulunamadı`)
                clearInterval(checkExist);
            }
            console.log('dersi gönder aranıyor: ' + saniye)
        }, 1000); // check every 1000ms

    }


    setInterval(checkbutton, 1000);
})();