Index: disqus.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/disqus/Attic/disqus.module,v retrieving revision 1.1.2.15 diff -u -r1.1.2.15 disqus.module --- disqus.module 29 Nov 2008 09:59:51 -0000 1.1.2.15 +++ disqus.module 18 Jan 2009 23:34:40 -0000 @@ -76,10 +76,16 @@ // Inject the script $developer = variable_get('disqus_developer', FALSE); - $disqus = theme('disqus_comments', $domain, $title, $message, $developer); - + + // Create the URL + $url = url($_GET['q'], array( + 'absolute' => TRUE, + 'alias' => TRUE, + )); + + // Output the Disqus comments. $node->content['disqus'] = array( - '#value' => $disqus, + '#value' => theme('disqus_comments', $domain, $title, $message, $url, $developer), '#weight' => 50, ); } @@ -103,15 +109,7 @@ 'attributes' => array('title' => t('Jump to the comments of this posting.')), 'fragment' => 'disqus_thread', ); - static $disqus_js_added = FALSE; - if ($disqus_js_added === FALSE) { - $disqus_js_added = TRUE; - $domain = variable_get('disqus_domain', ''); - if (!empty($domain)) { - $disqus_js = theme('disqus_comments_num', $domain); - drupal_add_js($disqus_js, 'inline', 'footer'); - } - } + disqus_add_js('disqus_thread'); } } return $links; @@ -237,64 +235,84 @@ return array( 'disqus_comments' => array( 'arguments' => array( - 'domain' => NULL, 'title' => NULL, 'message' => NULL, 'developer' => NULL, 'url' => NULL, ), ), - 'disqus_comments_num' => array( - 'arguments' => array('domain' => NULL), - ), ); } /** * Renders the JavaScript to display the Disqus thread for the current page. * @param $domain - * The domain associated with this Disqus account. + * The Disqus domain associated with this account. * @param $title * The title of the thread. * @param $message * The teaser of the thread. - * @param $developer - * Whether or not testing is enabled. * @param $url * The disqus_url variable (http://disqus.com/docs/help/#faq-16). + * @param $developer + * Whether or not testing is enabled. */ -function theme_disqus_comments($domain, $title = '', $message = '', $developer = FALSE, $url = NULL) { - $view = t('View the forum thread.'); - $developer = $developer ? '1' : '0'; - $url = isset($url) ? 'var disqus_url = "'. $url .'";' : ''; - $disqus = <<var disqus_title = "$title";var disqus_message = "$message";var disqus_developer = $developer;$url
-EOT; - return $disqus; +function theme_disqus_comments($domain, $title, $message, $url, $developer) { + disqus_add_js(FALSE, array( + 'title' => $title, + 'message' => $message, + 'url' => $url, + 'developer' => $developer, + 'container_id' => 'disqus_thread', + )); + return l(t('Discuss this topic on Disqus.'), "http://$domain.disqus.com/?url=ref", array( + 'attributes' => array( + 'id' => 'disqus_thread', + ) + )); } /** - * Renders the JavaScript to change all Disqus comment links to the correct number of comments. - * - * @param $domain - * The Disqus domain associated with this account. - */ -function theme_disqus_comments_num($domain) { - $disqus_js = <<= 0) { - query += 'url' + i + '=' + encodeURIComponent(links[i].href) + '&'; - } - } - document.write(' + + + + + + +

jQuery Disqus Plugin

+

The jQuery Disqus plugin allows you to easily embed Disqus into web pages after the page has been completely loaded.

+ + +View the comment thread on Disqus. + + +Add a comment + +Add a comment + + + + +