Permalink
Browse files

remove some unused files/features, replace disqus comments with faceb…

…ook comments
  • Loading branch information...
1 parent 2daf409 commit 56a60dc4cf3d1f67f7f756c0e21d3f4add7ac363 Benjamin Golub committed Mar 1, 2011
Showing with 17 additions and 192 deletions.
  1. +4 −9 blog.py
  2. +0 −168 static/javascript/retweet.js
  3. +1 −1 templates/base.html
  4. +1 −1 templates/entry.html
  5. +1 −1 templates/home.html
  6. +10 −12 templates/modules/entry.html
View
@@ -333,20 +333,14 @@ def head(self):
class EntryModule(tornado.web.UIModule):
- def render(self, entry, show_comments=False, show_share=False):
+ def render(self, entry, show_comments=False):
self.show_comments = show_comments
- self.show_count = not show_comments
return self.render_string("modules/entry.html", entry=entry,
- show_comments=show_comments, show_share=show_share)
-
- def embedded_javascript(self):
- if self.show_count:
- return self.render_string("disquscount.js")
- return None
+ show_comments=show_comments)
def javascript_files(self):
if self.show_comments:
- return ["http://disqus.com/forums/benjamingolub/embed.js"]
+ return ["http://connect.facebook.net/en_US/all.js#xfbml=1"]
return None
@@ -397,6 +391,7 @@ def render(self, cursor):
"blog_author": "Benjamin Golub",
"blog_title": "Benjamin Golub",
"fb_admins": "15500414",
+ "fb_app_id": "143871635676545",
"debug": os.environ.get("SERVER_SOFTWARE", "").startswith("Development/"),
"template_path": os.path.join(os.path.dirname(__file__), "templates"),
"ui_modules": {
@@ -1,168 +0,0 @@
-/*
- * Easy Retweet Button
- * http://ejohn.org/blog/retweet/
- * by John Resig (ejohn.org)
- *
- * Licensed under the MIT License:
- * http://www.opensource.org/licenses/mit-license.php
- */
-
-(function(){
-
-window.RetweetJS = {
- // Your Bit.ly Username
- bitly_user: "bgolub",
-
- // Your Bit.ly API Key
- // Found here: http://bit.ly/account
- bitly_key: "R_7ed6e9eed7cec0a356ebe44a7da2994b",
-
- // The text to replace the links with
- link_text: (/windows/i.test( navigator.userAgent) ? "►" : "♻") +
- " Retweet",
-
- // What # to show (Use "clicks" for # of clicks or "none" for nothing)
- count_type: "clicks",
-
- // Tweet Prefix text
- // "RT @jeresig " would result in: "RT @jeresig Link Title http://bit.ly/asdf"
- prefix: "RT @bgolub: ",
-
- // Style information
- styling: "a.retweet { font: 12px Helvetica,Arial; color: #000; text-decoration: none; border: 0px; }" +
- "a.retweet span { color: #FFF; background: #94CC3D; margin-left: 2px; border: 1px solid #43A52A; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; padding: 3px; }" +
- "a.vert { display: block; text-align: center; font-size: 16px; float: left; margin: 4px; }" +
- "a.retweet strong.vert { display: block; margin-bottom: 4px; background: #F5F5F5; border: 1px solid #EEE; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; padding: 3px; }" +
- "a.retweet span.vert { display: block; font-size: 12px; margin-left: 0px; }"
-};
-
-//////////////// No Need to Configure Below Here ////////////////
-
-var loadCount = 1;
-
-// Asynchronously load the Bit.ly JavaScript API
-// If it hasn't been loaded already
-if ( typeof BitlyClient === "undefined" ) {
- var head = document.getElementsByTagName("head")[0] ||
- document.documentElement;
- var script = document.createElement("script");
- script.src = "http://bit.ly/javascript-api.js?version=latest&login=" +
- RetweetJS.bitly_user + "&apiKey=" + RetweetJS.bitly_key;
- script.charSet = "utf-8";
- head.appendChild( script );
-
- var check = setInterval(function(){
- if ( typeof BitlyCB !== "undefined" ) {
- clearInterval( check );
- head.removeChild( script );
- loaded();
- }
- }, 10);
-
- loadCount = 0;
-}
-
-if ( document.addEventListener ) {
- document.addEventListener("DOMContentLoaded", loaded, false);
-
-} else if ( window.attachEvent ) {
- window.attachEvent("onload", loaded);
-}
-
-function loaded(){
- // Need to wait for doc ready and js ready
- if ( ++loadCount < 2 ) {
- return;
- }
-
- var elems = [], urlElem = {}, hashURL = {};
-
- BitlyCB.shortenResponse = function(data) {
- for ( var url in data.results ) {
- var hash = data.results[url].userHash;
- hashURL[hash] = url;
-
- var elems = urlElem[ url ];
-
- for ( var i = 0; i < elems.length; i++ ) {
- elems[i].href += hash;
- }
-
- if ( RetweetJS.count_type === "clicks" ) {
- BitlyClient.stats(hash, 'BitlyCB.statsResponse');
- }
- }
- };
-
- BitlyCB.statsResponse = function(data) {
- var clicks = data.results.clicks, hash = data.results.userHash;
- var url = hashURL[ hash ], elems = urlElem[ url ];
-
- if ( clicks > 0 ) {
- for ( var i = 0; i < elems.length; i++ ) {
- var strong = document.createElement("strong");
- strong.appendChild( document.createTextNode( clicks + " " ) );
- elems[i].insertBefore(strong, elems[i].firstChild);
-
- if ( /(^|\s)vert(\s|$)/.test( elems[i].className ) ) {
- elems[i].firstChild.className = elems[i].lastChild.className = "vert";
- }
- }
- }
-
- hashURL[ hash ] = urlElem[ url ] = null;
- };
-
- if ( document.getElementsByClassName ) {
- elems = document.getElementsByClassName("retweet");
- } else {
- var tmp = document.getElementsByTagName("a");
- for ( var i = 0; i < tmp.length; i++ ) {
- if ( /(^|\s)retweet(\s|$)/.test( tmp[i].className ) ) {
- elems.push( tmp[i] );
- }
- }
- }
-
- if ( elems.length && RetweetJS.styling ) {
- var style = document.createElement("style");
- style.type = "text/css";
-
- try {
- style.appendChild( document.createTextNode( RetweetJS.styling ) );
- } catch (e) {
- if ( style.styleSheet ) {
- style.styleSheet.cssText = RetweetJS.styling;
- }
- }
-
- document.body.appendChild( style );
- }
-
- for ( var i = 0; i < elems.length; i++ ) {
- var elem = elems[i];
-
- if ( /(^|\s)self(\s|$)/.test( elem.className ) ) {
- elem.href = window.location;
- elem.title = document.title;
- }
-
- var origText = elem.title || elem.textContent || elem.innerText,
- href = elem.href;
-
- elem.innerHTML = "<span>" + RetweetJS.link_text + "</span>";
- elem.title = "";
- elem.href = "http://twitter.com/home?status=" +
- encodeURIComponent(RetweetJS.prefix + origText + " http://bit.ly/");
-
- if ( urlElem[ href ] ) {
- urlElem[ href ].push( elem );
- } else {
- urlElem[ href ] = [ elem ];
- BitlyClient.shorten(href, 'BitlyCB.shortenResponse');
- }
- }
-
-}
-
-})();
View
@@ -3,6 +3,7 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="verify-v1" content="PewSSzFH6scpEjdLjwzFShlRf6p1U0TavfOMx2+aXYM=" />
+ <meta property="fb:app_id" content="{{ handler.settings.get("fb_app_id", "") }}"/>
<meta property="fb:admins" content="{{ handler.settings.get("fb_admins", "") }}"/>
<title>{% block title %}{{ escape(handler.settings["blog_title"]) }}{% end %}</title>
<link rel="stylesheet" href="/static/css/base.css" type="text/css"/>
@@ -91,6 +92,5 @@
</tr>
</table>
{% block bottom %}{% end %}
- <script src="/static/javascript/retweet.js" type="text/javascript"></script>
</body>
</html>
@@ -3,5 +3,5 @@
{% block title %}{{ escape(entry.title) }} - {{ escape(handler.settings["blog_title"]) }}{% end %}
{% block content %}
- {{ modules.Entry(entry, show_comments=True, show_share=True) }}
+ {{ modules.Entry(entry, show_comments=True) }}
{% end %}
View
@@ -2,7 +2,7 @@
{% block content %}
{% for entry in entries %}
- {{ modules.Entry(entry, show_share=True) }}
+ {{ modules.Entry(entry) }}
{% end %}
{% if entries and cursor %}
{{ modules.Navigation(cursor) }}
@@ -3,11 +3,9 @@
<div class="date">
{{ locale.format_date(entry.published, full_format=True, shorter=True) }}
</div>
- {% if show_share %}
- <div class="facebook">
- <iframe src="http://www.facebook.com/plugins/like.php?href={{ url_escape('http://' + request.host + '/' + entry.slug) }}&amp;layout=button_count" scrolling="no" frameborder="0" allowTransparency="true" ></iframe>
- </div>
- {% end %}
+ <div class="facebook">
+ <iframe src="http://www.facebook.com/plugins/like.php?href={{ url_escape('http://' + request.host + '/' + entry.slug) }}&amp;layout=button_count" scrolling="no" frameborder="0" allowTransparency="true" ></iframe>
+ </div>
<div class="body">{{ entry.body }}</div>
{% if entry.tags %}
<div class="tags">
@@ -21,11 +19,11 @@
<a href="/hide?key={{ str(entry.key()) }}">{{ _("Hide") }}</a>
</div>
{% end %}
- {% if not show_comments %}
- <div class="comments">
- <a href="/{{ entry.slug }}#disqus_thread">Comments</a>
- </div>
- {% else %}
- <div id="disqus_thread"></div>
- {% end %}
+ <div class="comments" id="comments">
+ {% if show_comments %}
+ <fb:comments href="{{ url_escape('http://' + request.host + '/' + entry.slug) }}"></fb:comments>
+ {% else %}
+ <a href="/{{ entry.slug }}#comments">{{ _("Comments") }}</a>
+ {% end %}
+ </div>
</div>

0 comments on commit 56a60dc

Please sign in to comment.