From 4e02ff6991988f863c5df90eda92a19627e01be1 Mon Sep 17 00:00:00 2001 From: moparisthebest Date: Sat, 27 Apr 2013 10:53:51 -0400 Subject: [PATCH] Added ssijs to grab forum threads --- _config.yml | 7 ++++++- source/_includes/asides/ssi.html | 27 +++++++++++++++++++++++++++ source/javascripts/ssi.js | 32 ++++++++++++++++++++++++++++++++ source/ssijs.php | 31 +++++++++++++++++++++++++++++++ 4 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 source/_includes/asides/ssi.html create mode 100644 source/javascripts/ssi.js create mode 100644 source/ssijs.php diff --git a/_config.yml b/_config.yml index 1b531d2..a434ea4 100644 --- a/_config.yml +++ b/_config.yml @@ -45,7 +45,7 @@ titlecase: true # Converts page and post titles to titlecase # list each of the sidebar modules you want to include, in the order you want them to appear. # To add custom asides, create files in /source/_includes/custom/asides/ and add them to the list like 'custom/asides/custom_aside_name.html' -default_asides: [asides/recent_posts.html, asides/sidead.html, asides/delicious.html, asides/pinboard.html, asides/googleplus.html] +default_asides: [asides/ssi.html, asides/recent_posts.html, asides/sidead.html, asides/delicious.html, asides/pinboard.html, asides/googleplus.html] # Each layout uses the default asides, but they can have their own asides instead. Simply uncomment the lines below # and add an array with the asides you want to use. @@ -102,5 +102,10 @@ google_bannerad_slot: 4021158971 google_bannerad_width: 468 google_bannerad_height: 60 +# forum announcements +ssi_board: 112 +ssi_limit: 3 +ssi_length: 200 + # Facebook Like facebook_like: true diff --git a/source/_includes/asides/ssi.html b/source/_includes/asides/ssi.html new file mode 100644 index 0000000..2b25a89 --- /dev/null +++ b/source/_includes/asides/ssi.html @@ -0,0 +1,27 @@ +{% if site.ssi_board %} +
+

Announcements

+ + + +
+{% endif %} diff --git a/source/javascripts/ssi.js b/source/javascripts/ssi.js new file mode 100644 index 0000000..21bc99c --- /dev/null +++ b/source/javascripts/ssi.js @@ -0,0 +1,32 @@ +var smf_ssi = (function(){ + function escapeHtml(str) { + str = str.replace(/<(img|br)[^>]*>/g, ' '); + //return $('
').text(str).html(); + return str; + } + function render(target, data){ + //alert(data.id); + //console.log(data.id); + //console.log(data[0].id); + if (!data) + return; + var i = 0, fragment = '', t = $(target)[0]; + + for(i = 0; i < data.length; i++) { + fragment += '
  • '+data[i].subject+'

    '+escapeHtml(data[i].body||'')+'

  • '; + } + t.innerHTML = fragment; + } + return { + showThreads: function(options){ + $.ajax({ + url: "/ssijs.php" + //url: "http://www.moparisthebest.com/ssijs.php" + , dataType: 'jsonp' + , data: { board: options.board, limit: options.limit, length: options.length } + , error: function (err, textStatus, errorThrown) { $(options.target + ' li.loading').addClass('error').text("Error loading feed textStatus: '"+textStatus+"' errorThrown: '"+errorThrown+"'"); } + , success: function(data) { render(options.target, data); } + }); + } + }; +})(); diff --git a/source/ssijs.php b/source/ssijs.php new file mode 100644 index 0000000..8b3d812 --- /dev/null +++ b/source/ssijs.php @@ -0,0 +1,31 @@ + \ No newline at end of file