Advertisement
Guest User

Old code for loading javascript with Canvas (don't use)

a guest
Jan 20th, 2017
380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Check to see if the page content has loaded yet
  2.         function ccPageContentCheck(ccTimer) {
  3.             'use strict';
  4.             ccTimer = ccTimer || 0;
  5.             var contentLoaded = false;
  6.             // Content Pages
  7.             if ($('.show-content').length > 0 && $('.show-content').children().length > 0) {
  8.                 contentLoaded = true;
  9.             // Discussions
  10.             } else if ($('#discussion_topic').length > 0 && $('.user_content').text().length > 0) {
  11.                 contentLoaded = true;
  12.             // Assignment (Teacher View)
  13.             } else if ($('#assignment_show .teacher-version').length > 0) {
  14.                 contentLoaded = true;
  15.             } else if ($('#assignment_show .student-version').length > 0) {
  16.                 contentLoaded = true;
  17.             } else if ($('#course_syllabus').length > 0) {
  18.                 contentLoaded = true;
  19.             } else if($('#course_details_tabs').length){
  20.                 // Course Settings page
  21.                 contentLoaded = true;
  22.             } else if($('#edit_profile_form').length) {
  23.                 //Profile pages in a course
  24.                 contentLoaded = true;
  25.             } else if($('#user-info-fieldsets').length) {
  26.                 //Profile pages outside of a course
  27.                 contentLoaded = true;
  28.             }
  29.  
  30.             if (contentLoaded) {
  31.                 ccAfterContentLoaded();
  32.             } else {
  33.                 if(ccTimer < 3000){
  34.                     setTimeout(function () {
  35.                         ccPageContentCheck(ccTimer + 100);
  36.                     }, 100);
  37.                 } else{
  38.                     // add default timeout, in case we encounter a page where content is never flagged as "ready"
  39.                     ccAfterContentLoaded();
  40.                 }
  41.             }
  42.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement