Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var refresherID = 0;
- var currentID = 0;
- $(document).ready(function(){
- $('.start-button').click(function(){
- oldGroupedHTML = null;
- oldIndividualHTML = null;
- chrome.tabs.getSelected(null, function(tab){
- currentID = tab.id;
- });
- refresherID = setInterval(function(){
- //
- //I'd like to grab the DOM right here and save it as a variable.
- //fullDOM = whateverIsNecessaryToGrabDOM(...);
- //
- //and the following lines would clearly change because of this.
- //
- currentGroupedHTML = $(".grouped_jobs").html();
- currentIndividualHTML = $(".individual_jobs").html();
- comparator(currentGroupedHTML,currentIndividualHTML);
- chrome.tabs.reload(currentID);
- }, 4000);
- });
- $('.stop-button').click(function(){
- clearInterval(refresherID);
- });
- });
- function comparator(grouped, individual){
- IndyJobs = getNumberOfIndividualJobs();
- GroupJobs = getNumberOfGroupedJobs();
- nIndyJobs = IndyJobs[1];
- nGroupJobs = GroupJobs[1];
- console.log(GroupJobs);
- $(".lt").text("Indy: " + nIndyJobs + "; Grouped: " + nGroupJobs);
- }
- function getNumberOfIndividualJobs(){
- obviousCount = $(".individual_jobs").find("tbody").children().length;
- extraFullPages = 0;
- //next line needs to be checked sometime
- extraFullPages = $(".individual_jobs").find(".pagination.individual").children().length-4;
- if (extraFullPages < 1){
- return ["exact", obviousCount];
- }
- else{
- return ["estimate", obviousCount + extraFullPages*5 + 1];
- }
- }
- function getNumberOfGroupedJobs(){
- obviousCount = $(".grouped_jobs").find("tbody").children().length;
- extraFullPages = $(".grouped_jobs").find(".pagination.group").children().length-4
- if (extraFullPages < 1){
- return ["exact", obviousCount];
- }
- else{
- return ["estimate", obviousCount + extraFullPages*5 + 1];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment