Advertisement
congdantoancau

Facebook page title renamed

Sep 13th, 2019
821
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 1.63 KB | None | 0 0
  1. /* Facebook page title renamed */
  2.  
  3. var content = null;
  4. setTimeout(function(){ content = prepair(); }, 4000);
  5. setTimeout(function() { setTitle(); }, 5000);
  6.  
  7. var username = ""; var title = "";
  8.  
  9. function prepair() {
  10.     var div_content = $('.userContent')[0];
  11.     var profile = $('#fb-timeline-cover-name')[0];
  12.  
  13.     if(typeof(div_content) != "undefined" && div_content !== null) {
  14.     content = div_content.innerText;
  15.     }
  16.     if(typeof(profile) != "undefined" && profile !== null) {
  17.     username = profile.innerText;
  18.     }
  19.  
  20.     if (!content) {
  21.         div_content = $('#u_0_12 ._7grk')[0];
  22.         if(typeof(div_content) != "undefined" && div_content !== null) {
  23.             content = div_content.innerText;
  24.         }
  25.     }
  26.    
  27.     if (!content) {
  28.         div_content = $('._1rg-')[0];
  29.         if(typeof(div_content) != "undefined" && div_content !== null) {
  30.             content = div_content.innerText;
  31.         }
  32.     }
  33.    
  34.     if (!content) {
  35.         div_content = $('._44bj')[0];
  36.         if(typeof(div_content) != "undefined" && div_content !== null) {
  37.             content = div_content.innerText;
  38.         }
  39.     }
  40.    
  41.    
  42.     if (!username) {
  43.         profile = $('._371z')[0];
  44.         if(typeof(profile) != "undefined" && profile !== null) {
  45.             username = profile.innerText;
  46.         }
  47.     }
  48.    
  49.     if (!username) {
  50.         profile = $('.profileLink')[0];
  51.         if(typeof(profile) != "undefined" && profile !== null) {
  52.             username = profile.innerText;
  53.         }
  54.     }
  55.    
  56.     if (content && content.length > 48) {
  57.             title = content.substring(0, 48) + '...';
  58.     } else {
  59.             title = content;
  60.     }
  61.     console.log('Title = ' + title);
  62.     console.log('Name = ' + username);
  63.     return content;
  64. }
  65.  
  66.  
  67. function setTitle() {
  68.     if (title) {
  69.         $('#pageTitle').html(title + ' - ' + username);
  70.     }
  71. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement