henriqueog
11/1/2017 - 10:41 AM

capture courses as object

captures the courses of a certain list in the blackboard and structures them as objects. trimString function required

//pegar lista de disciplinas criadas
_rootList=document.getElementById('listContainer_databody');
_rootListCount=0;
while(_rootListCount<_rootList.children.length)
{
    _element = document.getElementById('listContainer_row:'+String(_rootListCount));
    if(_element.children[1].childElementCount <=0){
    _regExpCommunityID= new RegExp('[0-9]{1,5}','gi');
    _regexpmodelID =new RegExp('\\([A-Z]{2,6}[0-9]{2,5}[A-Z]{1,3}\\)');
    _urlComm =trimString(_element.children[2].children[1].children[0].getAttribute('href'));
    _matchId = _regExpCommunityID.exec(_urlComm);
    _refClasse = trimString(_element.children[2].children[1].children[0].textContent);
    _block = trimString(_element.children[8].children[1].textContent);
    _name = trimString(_element.children[3].children[1].textContent);
    _modelID='';
    if(_regexpmodelID.test(_name))
    {
      _modelID=_regexpmodelID.exec(_name);
      _name.replace(_regexpmodelID,'');
    }
    console.log("name:'"+_name+"',model:'"+_modelID+"',bb: "+_matchId+",ref:'"+_refClasse+"',block:'"+_block+"'");
    }
    _modelID='';
    _rootListCount++;
}