zmandel/Plus-for-Trello

window-module not found

Closed this issue · 2 comments

Hey
Just found something strange happening. insertFrontpageChartsWorker is getting called repeatedly obviously due to the timeout set. But no chart is appearing. Narrowed down to the below piece of code, divInsertAfter is of length 0 always. Any idea on this. I'm on version 3.3.4

var divInsertAfter = $(".window-module");
//timing note: .window-module also needs to be present
if (divMainBoardsContainer.length == 0 || divInsertAfter.length == 0) {
    setTimeout(function () { insertFrontpageChartsWorker(mainDiv, dataWeek, user); }, 50); //wait until trello loads that div
    return false;
}

I just fixed it by the below piece of code. If it looks ok, do update it.
I believe that window-module was something that is removed now from trello page.

var divMainBoardsContainer = $(".member-boards-view");
var divInsertAfter = $(".window-module");

//panther changes starts 
if(divInsertAfter.length == 0 && divMainBoardsContainer.length != 0 ){
    divMainBoardsContainer.prepend('<div class="window-module"></div>');
    var divInsertAfter = $(".window-module");
 }
//panther changes ends

   //timing note: .window-module also needs to be present
   if (divMainBoardsContainer.length == 0 || divInsertAfter.length == 0) {
    setTimeout(function () { insertFrontpageChartsWorker(mainDiv, dataWeek, user); }, 50);                //wait until trello loads that div
    return false;
}

This fix was already present in the published version. Its likely that Chrome had not updated your extensions yet. Indeed trello removed that class last week. Plus was updated that day (friday) to the new Trello html.
cheers!