zmandel / Plus-for-Trello

Plus for Trello chrome extension, web & mobile app
https://chrome.google.com/webstore/detail/plus-for-trello-time-trac/gjjpophepkbhejnglcmkdnncmaanojkf
Other
130 stars 27 forks source link

window-module not found #8

Closed marudhupandiyang closed 9 years ago

marudhupandiyang commented 9 years ago

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;
}
marudhupandiyang commented 9 years ago

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;
}
zmandel commented 9 years ago

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!