YouTube Full Description

By Jordon Kalilich Last update Apr 10, 2008 — Installed 2,528 times.
// YouTube Full Description, a Greasemonkey user script
// Version 0.6 - April 10, 2008
// Copyright 2007, 2008 Jordon Kalilich (http://www.theworldofstuff.com/)
// Released under the GPL version 3
// http://www.gnu.org/copyleft/gpl.html
//
// ==UserScript==
// @name          YouTube Full Description
// @namespace     http://www.theworldofstuff.com/greasemonkey/
// @description   Automatically shows the full description on YouTube video pages.
// @include       http://youtube.com/watch?*
// @include       http://*.youtube.com/watch?*
// ==/UserScript==

updateNotifier();

var detailBox = document.getElementById('watch-video-details-inner');
if (detailBox) {
   // remove "more" and "less" links that will be borked by this
   detailBox.innerHTML = detailBox.innerHTML.replace(/\(\s*<a[^>]+onclick="[^"]+"[^>]*>\s*(more|less)\s*<\/a>\s*\)/ig,'');
   var divs = detailBox.getElementsByTagName('div');
   var expandedText;
   for (i = 0; i < divs.length; i++) {
      if (divs[i].className.match(/expand-content/i)) {
         expandedText = divs[i].innerHTML;
         break;
      }
   }
   if (expandedText) {
      expandedText = expandedText.replace(/\(\s*<a[^>]+onclick="[^"]+"[^>]*>\s*(more|less)\s+info\s*<\/a>\s*\)/ig,'');
      for (i = 0; i < divs.length; i++) {
         GM_log(divs[i].className);
         if (divs[i].className.match(/collapse-content/i)) {
            divs[i].innerHTML = expandedText;
            break;
         }
      }
   }
}

// UPDATE NOTIFIER (Version 8: March 10, 2008)
function updateNotifier() {
var scriptName = "YouTube Full Description";
var shortName = "youtubefulldescription";
var scriptVersion = 0.6;
var scriptID = '10038';

var checkForUpdates = GM_getValue('checkForUpdates', true);
if (checkForUpdates == true) {
var lastCheck = GM_getValue('lastCheck', 0);
var d = new Date();
var currentTime = Math.round(d.getTime() / 1000); // Unix time in seconds
if (currentTime >= lastCheck + 3600) { // (number of seconds in 1 hour
   GM_xmlhttpRequest({
    method: 'GET',
    url: 'http://www.theworldofstuff.com/greasemonkey/' + shortName + '.txt',
    headers: {'User-agent': 'Mozilla/4.0 (compatible) Greasemonkey','Accept': 'text/plain',},
    onload: function(responseDetails) {
      if (responseDetails.status == 200) {
        var info = responseDetails.responseText;
        function createNotice(noticeText) {
           var notice = document.createElement('div');
           with (notice.style) { id = 'GMscriptnotice'; position = 'fixed'; top = '0px'; left = '0px'; width = '100%'; background = '#ffeb7c'; zIndex = '1000'; textAlign = 'center'; font = '12px sans-serif'; fontWeight = 'normal'; color = '#000'; padding = '5px 3px 5px 3px'; margin = '0px'; borderTop = '0px'; borderRight = '0px'; borderBottom = '1px solid #beaf5d'; borderLeft = '0px'; }
           notice.innerHTML = noticeText;
           document.getElementsByTagName('body')[0].appendChild(notice);
           document.getElementById('upgradeLink').addEventListener('click', function(event) {
              notice.parentNode.removeChild(notice);
           }, true);
           document.getElementById('waitLink').addEventListener('click', function(event) {
              event.stopPropagation();
              event.preventDefault();
              alert('You will be notified again in one week.');
              GM_setValue('lastCheck', currentTime + 601200); // 1 week minus 1 hour (will be set after the one below)
              notice.parentNode.removeChild(notice);
           }, true);
           document.getElementById('offLink').addEventListener('click', function(event) {
              event.stopPropagation();
              event.preventDefault();
              var confirmTurnOff = confirm('Are you sure you no longer want to be notified of updates to this script?');
              if (confirmTurnOff) {
                 alert('You will no longer be notified of updates to ' + scriptName + '. You can change this preference in about:config.');
                 GM_setValue('checkForUpdates', false);
                 notice.parentNode.removeChild(notice);
              }
           }, true);
        }
        var linkStyle = 'color: #00f; text-decoration: underline; font: 12px sans-serif';
        if (info.match(/[\d\.]+/)) {
           var versionOnSite = info.match(/[\d\.]+/);
           var updateURL = 'http://userscripts.org/scripts/show/' + scriptID;
           if (info.indexOf(';') > 0) {
              updateURL = info.split(";")[1];
           } 
           if (versionOnSite > scriptVersion) {
              var noticeText = 'An update to the Greasemonkey user script "' + scriptName + '" is available. You are using version ' + scriptVersion + '.<br /><a href="' + updateURL + '" style="' + linkStyle + '; font-weight: bold" id="upgradeLink" target="_blank">Review changes and upgrade to version ' + versionOnSite + '</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" style="' + linkStyle + '; font-weight: normal" id="waitLink">Notify me later</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#" style="' + linkStyle + '; font-weight: normal" id="offLink">Turn off these notifications</a>';
              createNotice(noticeText);
           }
        }
        else if (info.indexOf('-') == 0) { // if the script will no longer be maintained
           GM_setValue('checkForUpdates', false);
        }
      }
    }
   });
   GM_setValue('lastCheck', currentTime);
}
}
} // END OF UPDATE NOTIFIER